RTEMS
6.1-rc6
Loading...
Searching...
No Matches
bsps
powerpc
include
nvram.h
1
/*
2
* PreP compliant NVRAM access
3
*
4
* This file can be found in motorla or IBP PPC site.
5
*/
6
7
#ifndef _PPC_NVRAM_H
8
#define _PPC_NVRAM_H
9
10
#define NVRAM_AS0 0x74
11
#define NVRAM_AS1 0x75
12
#define NVRAM_DATA 0x77
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
/* Structure map for NVRAM on PowerPC Reference Platform */
35
/* All fields are either character/byte strings which are valid either
36
endian or they are big-endian numbers.
37
38
There are a number of Date and Time fields which are in RTC format,
39
big-endian. These are stored in UT (GMT).
40
41
For enum's: if given in hex then they are bit significant, i.e. only
42
one bit is on for each enum.
43
*/
44
45
#define NVSIZE 4096
/* size of NVRAM */
46
#define OSAREASIZE 512
/* size of OSArea space */
47
#define CONFSIZE 1024
/* guess at size of Configuration space */
48
49
#ifndef ASM
50
51
typedef
struct
_SECURITY
{
52
unsigned
long
BootErrCnt;
/* Count of boot password errors */
53
unsigned
long
ConfigErrCnt;
/* Count of config password errors */
54
unsigned
long
BootErrorDT[2];
/* Date&Time from RTC of last error in pw */
55
unsigned
long
ConfigErrorDT[2];
/* Date&Time from RTC of last error in pw */
56
unsigned
long
BootCorrectDT[2];
/* Date&Time from RTC of last correct pw */
57
unsigned
long
ConfigCorrectDT[2];
/* Date&Time from RTC of last correct pw */
58
unsigned
long
BootSetDT[2];
/* Date&Time from RTC of last set of pw */
59
unsigned
long
ConfigSetDT[2];
/* Date&Time from RTC of last set of pw */
60
unsigned
char
Serial[16];
/* Box serial number */
61
}
SECURITY
;
62
63
typedef
enum
_OS_ID {
64
Unknown = 0,
65
Firmware = 1,
66
AIX = 2,
67
NT = 3,
68
MKOS2 = 4,
69
MKAIX = 5,
70
Taligent = 6,
71
Solaris = 7,
72
MK = 12
73
} OS_ID;
74
75
typedef
struct
_ERROR_LOG
{
76
unsigned
char
ErrorLogEntry[40];
/* To be architected */
77
}
ERROR_LOG
;
78
79
typedef
enum
_BOOT_STATUS {
80
BootStarted = 0x01,
81
BootFinished = 0x02,
82
RestartStarted = 0x04,
83
RestartFinished = 0x08,
84
PowerFailStarted = 0x10,
85
PowerFailFinished = 0x20,
86
ProcessorReady = 0x40,
87
ProcessorRunning = 0x80,
88
ProcessorStart = 0x0100
89
} BOOT_STATUS;
90
91
typedef
struct
_RESTART_BLOCK
{
92
unsigned
short
Version;
93
unsigned
short
Revision;
94
unsigned
long
ResumeReserve1[2];
95
volatile
unsigned
long
BootStatus;
96
unsigned
long
CheckSum;
/* Checksum of RESTART_BLOCK */
97
void
* RestartAddress;
98
void
* SaveAreaAddr;
99
unsigned
long
SaveAreaLength;
100
}
RESTART_BLOCK
;
101
102
typedef
enum
_OSAREA_USAGE {
103
Empty = 0,
104
Used = 1
105
} OSAREA_USAGE;
106
107
typedef
enum
_PM_MODE {
108
Suspend = 0x80,
/* Part of state is in memory */
109
Normal = 0x00
/* No power management in effect */
110
} PMMode;
111
112
typedef
struct
_HEADER
{
113
unsigned
short
Size;
/* NVRAM size in K(1024) */
114
unsigned
char
Version;
/* Structure map different */
115
unsigned
char
Revision;
/* Structure map the same -may
116
be new values in old fields
117
in other words old code still works */
118
unsigned
short
Crc1;
/* check sum from beginning of nvram to OSArea */
119
unsigned
short
Crc2;
/* check sum of config */
120
unsigned
char
LastOS;
/* OS_ID */
121
unsigned
char
Endian;
/* B if big endian, L if little endian */
122
unsigned
char
OSAreaUsage;
/* OSAREA_USAGE */
123
unsigned
char
PMMode;
/* Shutdown mode */
124
RESTART_BLOCK
RestartBlock;
125
SECURITY
Security;
126
ERROR_LOG
ErrorLog[2];
127
128
/* Global Environment information */
129
void
* GEAddress;
130
unsigned
long
GELength;
131
132
/* Date&Time from RTC of last change to Global Environment */
133
unsigned
long
GELastWriteDT[2];
134
135
/* Configuration information */
136
void
* ConfigAddress;
137
unsigned
long
ConfigLength;
138
139
/* Date&Time from RTC of last change to Configuration */
140
unsigned
long
ConfigLastWriteDT[2];
141
unsigned
long
ConfigCount;
/* Count of entries in Configuration */
142
143
/* OS dependent temp area */
144
void
* OSAreaAddress;
145
unsigned
long
OSAreaLength;
146
147
/* Date&Time from RTC of last change to OSArea */
148
unsigned
long
OSAreaLastWriteDT[2];
149
}
HEADER
;
150
151
/* Here is the whole map of the NVRAM */
152
typedef
struct
_NVRAM_MAP
{
153
HEADER
Header;
154
unsigned
char
GEArea[NVSIZE-CONFSIZE-OSAREASIZE-
sizeof
(
HEADER
)];
155
unsigned
char
OSArea[OSAREASIZE];
156
unsigned
char
ConfigArea[CONFSIZE];
157
}
NVRAM_MAP
;
158
159
/* Routines to manipulate the NVRAM */
160
void
init_prep_nvram(
void
);
161
char
*prep_nvram_get_var(
const
char
*name);
162
char
*prep_nvram_first_var(
void
);
163
char
*prep_nvram_next_var(
char
*name);
164
165
#endif
/* ASM */
166
167
#endif
/* _PPC_NVRAM_H */
_ERROR_LOG
Definition:
nvram.h:75
_HEADER
Definition:
nvram.h:112
_NVRAM_MAP
Definition:
nvram.h:152
_RESTART_BLOCK
Definition:
nvram.h:91
_SECURITY
Definition:
nvram.h:51
Generated by
1.9.6