summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/ppcn_60x/nvram/prepnvr.h
blob: 058cf7b45afcf707b5293d2a24376431c063194f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* Structure map for NVRAM on PowerPC Reference Platform */

/* Revision 1 changes (8/25/94):
        - Power Management (RESTART_BLOCK struct)
        - Normal added to PM_MODE
        - OSIRQMask (HEADER struct) */

/* All fields are either character/byte strings which are valid either
endian or they are big-endian numbers.

There are a number of Date and Time fields which are in RTC format,
big-endian. These are stored in UT (GMT).

For enum's: if given in hex then they are bit significant, i.e. only
one bit is on for each enum.
*/

#ifndef _NVRAM_
#define _NVRAM_

#define VERSION  1
#define REVISION 0

#define OSAREASIZE 1024   /* size of OSArea space */
#define CONFSIZE 512      /* guess at size of Configuration space */

typedef struct _SECURITY {
  unsigned long BootErrCnt;         /* Count of boot password errors */
  unsigned long ConfigErrCnt;       /* Count of config password errors */
  unsigned long BootErrorDT[2];     /* Date&Time from RTC of last error in pw */
  unsigned long ConfigErrorDT[2];   /* Date&Time from RTC of last error in pw */
  unsigned long BootCorrectDT[2];   /* Date&Time from RTC of last correct pw */
  unsigned long ConfigCorrectDT[2]; /* Date&Time from RTC of last correct pw */
  unsigned long BootSetDT[2];       /* Date&Time from RTC of last set of pw */
  unsigned long ConfigSetDT[2];     /* Date&Time from RTC of last set of pw */
  unsigned char Serial[16];         /* Box serial number */
  } SECURITY;

typedef enum _OS_ID {
  Unknown = 0,
  Firmware = 1,
  AIX = 2,
  NT = 3,
  WPOS2 = 4,
  WPAIX = 5,
  Taligent = 6,
  Solaris = 7,
  Netware = 8,
  USL = 9,
  Low_End_Client = 10,
  SCO = 11
  } OS_ID;

typedef struct _ERROR_LOG {
  unsigned char ErrorLogEntry[40]; /* To be architected */
  } ERROR_LOG;

/*---Revision 1: Change the following struct:---*/
typedef struct _RESUME_BLOCK {
                                        /* Hibernation Resume Device will be an
                                           environment variable */
    unsigned long CheckSum;             /* Checksum of RESUME_BLOCK */
    volatile unsigned long BootStatus;

    void * ResumeAddr;                  /* For Suspend Resume */
    void * SaveAreaAddr;                /* For Suspend Resume */
    unsigned long SaveAreaLength;       /* For Suspend Resume */

    unsigned long HibResumeImageRBA;    /* RBA (512B blocks) of compressed OS
                                           memory image to be loaded by FW
                                           on Resume from hibernation */
    unsigned long HibResumeImageRBACount; /* Size of image in 512B blocks*/
    unsigned long Reserved;
  } RESUME_BLOCK;

typedef enum _OSAREA_USAGE {
  Empty = 0,
  Used = 1
  } OSAREA_USAGE;

typedef enum _PM_MODE {
  Suspend = 0x80,     /* Part of state is in memory */
  Hibernate = 0x40,   /* Nothing in memory - state saved elsewhere */
/* Revision 1: Normal added (actually was already here) */
  Normal = 0x00       /* No power management in effect */
  } PMMode;

typedef struct _HEADER {
  unsigned short Size;    /* NVRAM size in K(1024) */
  unsigned char Version;  /* Structure map different */
  unsigned char Revision; /* Structure map the same -
                             may be new values in old fields
                             in other words old code still works */
  unsigned short Crc1;    /* check sum from beginning of nvram to OSArea */
  unsigned short Crc2;    /* check sum of config */
  unsigned char LastOS;   /* OS_ID */
  unsigned char Endian;   /* B if big endian, L if little endian */
  unsigned char OSAreaUsage; /* OSAREA_USAGE */
  unsigned char PMMode;   /* Shutdown mode */
  RESUME_BLOCK ResumeBlock;
  SECURITY Security;
  ERROR_LOG ErrorLog[2];

/* Global Environment information */
  void * GEAddress;
  unsigned long GELength;
  /* Date&Time from RTC of last change to Global Environment */
  unsigned long GELastWriteDT[2];

/* Configuration information */
  void * ConfigAddress;
  unsigned long ConfigLength;
  /* Date&Time from RTC of last change to Configuration */
  unsigned long ConfigLastWriteDT[2];
  unsigned long ConfigCount; /* Count of entries in Configuration */

/* OS dependent temp area */
  void * OSAreaAddress;
  unsigned long OSAreaLength;
  /* Date&Time from RTC of last change to OSAreaArea */
  unsigned long OSAreaLastWriteDT[2];

/* Revision 1: add this mask - function tbd */
  /*unsigned short OSIRQMask;  OS to FW IRQ Mask - "I've used this one" */
  } HEADER, *PHEADER;

 #endif  /* ndef _NVRAM_ */