File indexing completed on 2025-05-11 08:23:54
0001
0002
0003
0004
0005
0006
0007 #ifndef _PPC_NVRAM_H
0008 #define _PPC_NVRAM_H
0009
0010 #define NVRAM_AS0 0x74
0011 #define NVRAM_AS1 0x75
0012 #define NVRAM_DATA 0x77
0013
0014
0015
0016 #define MOTO_RTC_SECONDS 0x1FF9
0017 #define MOTO_RTC_MINUTES 0x1FFA
0018 #define MOTO_RTC_HOURS 0x1FFB
0019 #define MOTO_RTC_DAY_OF_WEEK 0x1FFC
0020 #define MOTO_RTC_DAY_OF_MONTH 0x1FFD
0021 #define MOTO_RTC_MONTH 0x1FFE
0022 #define MOTO_RTC_YEAR 0x1FFF
0023 #define MOTO_RTC_CONTROLA 0x1FF8
0024 #define MOTO_RTC_CONTROLB 0x1FF9
0025
0026 #ifndef BCD_TO_BIN
0027 #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
0028 #endif
0029
0030 #ifndef BIN_TO_BCD
0031 #define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
0032 #endif
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #define NVSIZE 4096
0046 #define OSAREASIZE 512
0047 #define CONFSIZE 1024
0048
0049 #ifndef ASM
0050
0051 typedef struct _SECURITY {
0052 unsigned long BootErrCnt;
0053 unsigned long ConfigErrCnt;
0054 unsigned long BootErrorDT[2];
0055 unsigned long ConfigErrorDT[2];
0056 unsigned long BootCorrectDT[2];
0057 unsigned long ConfigCorrectDT[2];
0058 unsigned long BootSetDT[2];
0059 unsigned long ConfigSetDT[2];
0060 unsigned char Serial[16];
0061 } SECURITY;
0062
0063 typedef enum _OS_ID {
0064 Unknown = 0,
0065 Firmware = 1,
0066 AIX = 2,
0067 NT = 3,
0068 MKOS2 = 4,
0069 MKAIX = 5,
0070 Taligent = 6,
0071 Solaris = 7,
0072 MK = 12
0073 } OS_ID;
0074
0075 typedef struct _ERROR_LOG {
0076 unsigned char ErrorLogEntry[40];
0077 } ERROR_LOG;
0078
0079 typedef enum _BOOT_STATUS {
0080 BootStarted = 0x01,
0081 BootFinished = 0x02,
0082 RestartStarted = 0x04,
0083 RestartFinished = 0x08,
0084 PowerFailStarted = 0x10,
0085 PowerFailFinished = 0x20,
0086 ProcessorReady = 0x40,
0087 ProcessorRunning = 0x80,
0088 ProcessorStart = 0x0100
0089 } BOOT_STATUS;
0090
0091 typedef struct _RESTART_BLOCK {
0092 unsigned short Version;
0093 unsigned short Revision;
0094 unsigned long ResumeReserve1[2];
0095 volatile unsigned long BootStatus;
0096 unsigned long CheckSum;
0097 void* RestartAddress;
0098 void* SaveAreaAddr;
0099 unsigned long SaveAreaLength;
0100 } RESTART_BLOCK;
0101
0102 typedef enum _OSAREA_USAGE {
0103 Empty = 0,
0104 Used = 1
0105 } OSAREA_USAGE;
0106
0107 typedef enum _PM_MODE {
0108 Suspend = 0x80,
0109 Normal = 0x00
0110 } PMMode;
0111
0112 typedef struct _HEADER {
0113 unsigned short Size;
0114 unsigned char Version;
0115 unsigned char Revision;
0116
0117
0118 unsigned short Crc1;
0119 unsigned short Crc2;
0120 unsigned char LastOS;
0121 unsigned char Endian;
0122 unsigned char OSAreaUsage;
0123 unsigned char PMMode;
0124 RESTART_BLOCK RestartBlock;
0125 SECURITY Security;
0126 ERROR_LOG ErrorLog[2];
0127
0128
0129 void* GEAddress;
0130 unsigned long GELength;
0131
0132
0133 unsigned long GELastWriteDT[2];
0134
0135
0136 void* ConfigAddress;
0137 unsigned long ConfigLength;
0138
0139
0140 unsigned long ConfigLastWriteDT[2];
0141 unsigned long ConfigCount;
0142
0143
0144 void* OSAreaAddress;
0145 unsigned long OSAreaLength;
0146
0147
0148 unsigned long OSAreaLastWriteDT[2];
0149 } HEADER;
0150
0151
0152 typedef struct _NVRAM_MAP {
0153 HEADER Header;
0154 unsigned char GEArea[NVSIZE-CONFSIZE-OSAREASIZE-sizeof(HEADER)];
0155 unsigned char OSArea[OSAREASIZE];
0156 unsigned char ConfigArea[CONFSIZE];
0157 } NVRAM_MAP;
0158
0159
0160 void init_prep_nvram(void);
0161 char *prep_nvram_get_var(const char *name);
0162 char *prep_nvram_first_var(void);
0163 char *prep_nvram_next_var(char *name);
0164
0165 #endif
0166
0167 #endif