diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 15:34:47 -0500 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 15:34:47 -0500 |
commit | 0a0fc0ddbe732779366ab6b1b879f62195e65967 (patch) | |
tree | 7b42490a676cf39ae0691b6859ecf7fd410f229b /include/asm-powerpc/nvram.h | |
parent | 4d5dbd0945d9e0833dd7964a3d6ee33157f7cc7a (diff) | |
parent | 3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff) |
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'include/asm-powerpc/nvram.h')
-rw-r--r-- | include/asm-powerpc/nvram.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/include/asm-powerpc/nvram.h b/include/asm-powerpc/nvram.h new file mode 100644 index 000000000000..f3563e11e260 --- /dev/null +++ b/include/asm-powerpc/nvram.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * NVRAM definitions and access functions. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_POWERPC_NVRAM_H | ||
11 | #define _ASM_POWERPC_NVRAM_H | ||
12 | |||
13 | #define NVRW_CNT 0x20 | ||
14 | #define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */ | ||
15 | #define NVRAM_BLOCK_LEN 16 | ||
16 | #define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN) | ||
17 | #define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN) | ||
18 | |||
19 | #define NVRAM_AS0 0x74 | ||
20 | #define NVRAM_AS1 0x75 | ||
21 | #define NVRAM_DATA 0x77 | ||
22 | |||
23 | |||
24 | /* RTC Offsets */ | ||
25 | |||
26 | #define MOTO_RTC_SECONDS 0x1FF9 | ||
27 | #define MOTO_RTC_MINUTES 0x1FFA | ||
28 | #define MOTO_RTC_HOURS 0x1FFB | ||
29 | #define MOTO_RTC_DAY_OF_WEEK 0x1FFC | ||
30 | #define MOTO_RTC_DAY_OF_MONTH 0x1FFD | ||
31 | #define MOTO_RTC_MONTH 0x1FFE | ||
32 | #define MOTO_RTC_YEAR 0x1FFF | ||
33 | #define MOTO_RTC_CONTROLA 0x1FF8 | ||
34 | #define MOTO_RTC_CONTROLB 0x1FF9 | ||
35 | |||
36 | #define NVRAM_SIG_SP 0x02 /* support processor */ | ||
37 | #define NVRAM_SIG_OF 0x50 /* open firmware config */ | ||
38 | #define NVRAM_SIG_FW 0x51 /* general firmware */ | ||
39 | #define NVRAM_SIG_HW 0x52 /* hardware (VPD) */ | ||
40 | #define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */ | ||
41 | #define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */ | ||
42 | #define NVRAM_SIG_SYS 0x70 /* system env vars */ | ||
43 | #define NVRAM_SIG_CFG 0x71 /* config data */ | ||
44 | #define NVRAM_SIG_ELOG 0x72 /* error log */ | ||
45 | #define NVRAM_SIG_VEND 0x7e /* vendor defined */ | ||
46 | #define NVRAM_SIG_FREE 0x7f /* Free space */ | ||
47 | #define NVRAM_SIG_OS 0xa0 /* OS defined */ | ||
48 | #define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */ | ||
49 | |||
50 | /* If change this size, then change the size of NVNAME_LEN */ | ||
51 | struct nvram_header { | ||
52 | unsigned char signature; | ||
53 | unsigned char checksum; | ||
54 | unsigned short length; | ||
55 | char name[12]; | ||
56 | }; | ||
57 | |||
58 | #ifdef __KERNEL__ | ||
59 | struct nvram_partition { | ||
60 | struct list_head partition; | ||
61 | struct nvram_header header; | ||
62 | unsigned int index; | ||
63 | }; | ||
64 | |||
65 | |||
66 | extern int nvram_write_error_log(char * buff, int length, unsigned int err_type); | ||
67 | extern int nvram_read_error_log(char * buff, int length, unsigned int * err_type); | ||
68 | extern int nvram_clear_error_log(void); | ||
69 | extern struct nvram_partition *nvram_find_partition(int sig, const char *name); | ||
70 | |||
71 | extern int pSeries_nvram_init(void); | ||
72 | extern int mmio_nvram_init(void); | ||
73 | #endif /* __KERNEL__ */ | ||
74 | |||
75 | /* PowerMac specific nvram stuffs */ | ||
76 | |||
77 | enum { | ||
78 | pmac_nvram_OF, /* Open Firmware partition */ | ||
79 | pmac_nvram_XPRAM, /* MacOS XPRAM partition */ | ||
80 | pmac_nvram_NR /* MacOS Name Registry partition */ | ||
81 | }; | ||
82 | |||
83 | #ifdef __KERNEL__ | ||
84 | /* Return partition offset in nvram */ | ||
85 | extern int pmac_get_partition(int partition); | ||
86 | |||
87 | /* Direct access to XPRAM on PowerMacs */ | ||
88 | extern u8 pmac_xpram_read(int xpaddr); | ||
89 | extern void pmac_xpram_write(int xpaddr, u8 data); | ||
90 | |||
91 | /* Synchronize NVRAM */ | ||
92 | extern void nvram_sync(void); | ||
93 | |||
94 | /* Normal access to NVRAM */ | ||
95 | extern unsigned char nvram_read_byte(int i); | ||
96 | extern void nvram_write_byte(unsigned char c, int i); | ||
97 | #endif | ||
98 | |||
99 | /* Some offsets in XPRAM */ | ||
100 | #define PMAC_XPRAM_MACHINE_LOC 0xe4 | ||
101 | #define PMAC_XPRAM_SOUND_VOLUME 0x08 | ||
102 | |||
103 | /* Machine location structure in PowerMac XPRAM */ | ||
104 | struct pmac_machine_location { | ||
105 | unsigned int latitude; /* 2+30 bit Fractional number */ | ||
106 | unsigned int longitude; /* 2+30 bit Fractional number */ | ||
107 | unsigned int delta; /* mix of GMT delta and DLS */ | ||
108 | }; | ||
109 | |||
110 | /* | ||
111 | * /dev/nvram ioctls | ||
112 | * | ||
113 | * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is | ||
114 | * definitely obsolete. Do not use it if you can avoid it | ||
115 | */ | ||
116 | |||
117 | #define OBSOLETE_PMAC_NVRAM_GET_OFFSET \ | ||
118 | _IOWR('p', 0x40, int) | ||
119 | |||
120 | #define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */ | ||
121 | #define IOC_NVRAM_SYNC _IO('p', 0x43) /* Sync NVRAM image */ | ||
122 | |||
123 | #endif /* _ASM_POWERPC_NVRAM_H */ | ||