OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [shared/] [include/] [nvram.h] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.