1 /* 2 * PreP compliant NVRAM access 3 */ 4 5 #ifdef __KERNEL__ 6 #ifndef _PPC_NVRAM_H 7 #define _PPC_NVRAM_H 8 9 #define NVRAM_AS0 0x74 10 #define NVRAM_AS1 0x75 11 #define NVRAM_DATA 0x77 12 13 14 /* RTC Offsets */ 15 16 #define MOTO_RTC_SECONDS 0x1FF9 17 #define MOTO_RTC_MINUTES 0x1FFA 18 #define MOTO_RTC_HOURS 0x1FFB 19 #define MOTO_RTC_DAY_OF_WEEK 0x1FFC 20 #define MOTO_RTC_DAY_OF_MONTH 0x1FFD 21 #define MOTO_RTC_MONTH 0x1FFE 22 #define MOTO_RTC_YEAR 0x1FFF 23 #define MOTO_RTC_CONTROLA 0x1FF8 24 #define MOTO_RTC_CONTROLB 0x1FF9 25 26 #ifndef BCD_TO_BIN 27 #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) 28 #endif 29 30 #ifndef BIN_TO_BCD 31 #define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10) 32 #endif 33 34 /* PowerMac specific nvram stuffs */ 35 36 enum { 37 pmac_nvram_OF, /* Open Firmware partition */ 38 pmac_nvram_XPRAM, /* MacOS XPRAM partition */ 39 pmac_nvram_NR /* MacOS Name Registry partition */ 40 }; 41 42 /* Return partition offset in nvram */ 43 extern int pmac_get_partition(int partition); 44 45 /* Direct access to XPRAM */ 46 extern u8 pmac_xpram_read(int xpaddr); 47 extern void pmac_xpram_write(int xpaddr, u8 data); 48 49 /* Some offsets in XPRAM */ 50 #define PMAC_XPRAM_MACHINE_LOC 0xe4 51 #define PMAC_XPRAM_SOUND_VOLUME 0x08 52 53 /* Machine location structure in XPRAM */ 54 struct pmac_machine_location { 55 unsigned int latitude; /* 2+30 bit Fractional number */ 56 unsigned int longitude; /* 2+30 bit Fractional number */ 57 unsigned int delta; /* mix of GMT delta and DLS */ 58 }; 59 60 /* /dev/nvram ioctls */ 61 #define PMAC_NVRAM_GET_OFFSET _IOWR('p', 0x40, int) /* Get NVRAM partition offset */ 62 63 #endif 64 #endif /* __KERNEL__ */ 65