residual.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. /* 7/18/95 */
  2. /*----------------------------------------------------------------------------*/
  3. /* Residual Data header definitions and prototypes */
  4. /*----------------------------------------------------------------------------*/
  5. /* Structure map for RESIDUAL on PowerPC Reference Platform */
  6. /* residual.h - Residual data structure passed in r3. */
  7. /* Load point passed in r4 to boot image. */
  8. /* For enum's: if given in hex then they are bit significant, */
  9. /* i.e. only one bit is on for each enum */
  10. /* Reserved fields must be filled with zeros. */
  11. #ifdef __KERNEL__
  12. #ifndef _RESIDUAL_
  13. #define _RESIDUAL_
  14. #ifndef __ASSEMBLY__
  15. #define MAX_CPUS 32 /* These should be set to the maximum */
  16. #define MAX_MEMS 64 /* number possible for this system. */
  17. #define MAX_DEVICES 256 /* Changing these will change the */
  18. #define AVE_PNP_SIZE 32 /* structure, hence the version of */
  19. #define MAX_MEM_SEGS 64 /* this header file. */
  20. /*----------------------------------------------------------------------------*/
  21. /* Public structures... */
  22. /*----------------------------------------------------------------------------*/
  23. #include <asm/pnp.h>
  24. typedef enum _L1CACHE_TYPE {
  25. NoneCAC = 0,
  26. SplitCAC = 1,
  27. CombinedCAC = 2
  28. } L1CACHE_TYPE;
  29. typedef enum _TLB_TYPE {
  30. NoneTLB = 0,
  31. SplitTLB = 1,
  32. CombinedTLB = 2
  33. } TLB_TYPE;
  34. typedef enum _FIRMWARE_SUPPORT {
  35. Conventional = 0x01,
  36. OpenFirmware = 0x02,
  37. Diagnostics = 0x04,
  38. LowDebug = 0x08,
  39. Multiboot = 0x10,
  40. LowClient = 0x20,
  41. Hex41 = 0x40,
  42. FAT = 0x80,
  43. ISO9660 = 0x0100,
  44. SCSI_InitiatorID_Override = 0x0200,
  45. Tape_Boot = 0x0400,
  46. FW_Boot_Path = 0x0800
  47. } FIRMWARE_SUPPORT;
  48. typedef enum _FIRMWARE_SUPPLIERS {
  49. IBMFirmware = 0x00,
  50. MotoFirmware = 0x01, /* 7/18/95 */
  51. FirmWorks = 0x02, /* 10/5/95 */
  52. Bull = 0x03, /* 04/03/96 */
  53. } FIRMWARE_SUPPLIERS;
  54. typedef enum _ENDIAN_SWITCH_METHODS {
  55. UsePort92 = 0x01,
  56. UsePCIConfigA8 = 0x02,
  57. UseFF001030 = 0x03,
  58. } ENDIAN_SWITCH_METHODS;
  59. typedef enum _SPREAD_IO_METHODS {
  60. UsePort850 = 0x00,
  61. /*UsePCIConfigA8 = 0x02,*/
  62. } SPREAD_IO_METHODS;
  63. typedef struct _VPD {
  64. /* Box dependent stuff */
  65. unsigned char PrintableModel[32]; /* Null terminated string.
  66. Must be of the form:
  67. vvv,<20h>,<model designation>,<0x0>
  68. where vvv is the vendor ID
  69. e.g. IBM PPS MODEL 6015<0x0> */
  70. unsigned char Serial[16]; /* 12/94:
  71. Serial Number; must be of the form:
  72. vvv<serial number> where vvv is the
  73. vendor ID.
  74. e.g. IBM60151234567<20h><20h> */
  75. unsigned char Reserved[48];
  76. unsigned long FirmwareSupplier; /* See FirmwareSuppliers enum */
  77. unsigned long FirmwareSupports; /* See FirmwareSupport enum */
  78. unsigned long NvramSize; /* Size of nvram in bytes */
  79. unsigned long NumSIMMSlots;
  80. unsigned short EndianSwitchMethod; /* See EndianSwitchMethods enum */
  81. unsigned short SpreadIOMethod; /* See SpreadIOMethods enum */
  82. unsigned long SmpIar;
  83. unsigned long RAMErrLogOffset; /* Heap offset to error log */
  84. unsigned long Reserved5;
  85. unsigned long Reserved6;
  86. unsigned long ProcessorHz; /* Processor clock frequency in Hertz */
  87. unsigned long ProcessorBusHz; /* Processor bus clock frequency */
  88. unsigned long Reserved7;
  89. unsigned long TimeBaseDivisor; /* (Bus clocks per timebase tic)*1000 */
  90. unsigned long WordWidth; /* Word width in bits */
  91. unsigned long PageSize; /* Page size in bytes */
  92. unsigned long CoherenceBlockSize; /* Unit of transfer in/out of cache
  93. for which coherency is maintained;
  94. normally <= CacheLineSize. */
  95. unsigned long GranuleSize; /* Unit of lock allocation to avoid */
  96. /* false sharing of locks. */
  97. /* L1 Cache variables */
  98. unsigned long CacheSize; /* L1 Cache size in KB. This is the */
  99. /* total size of the L1, whether */
  100. /* combined or split */
  101. unsigned long CacheAttrib; /* L1CACHE_TYPE */
  102. unsigned long CacheAssoc; /* L1 Cache associativity. Use this
  103. for combined cache. If split, put
  104. zeros here. */
  105. unsigned long CacheLineSize; /* L1 Cache line size in bytes. Use
  106. for combined cache. If split, put
  107. zeros here. */
  108. /* For split L1 Cache: (= combined if combined cache) */
  109. unsigned long I_CacheSize;
  110. unsigned long I_CacheAssoc;
  111. unsigned long I_CacheLineSize;
  112. unsigned long D_CacheSize;
  113. unsigned long D_CacheAssoc;
  114. unsigned long D_CacheLineSize;
  115. /* Translation Lookaside Buffer variables */
  116. unsigned long TLBSize; /* Total number of TLBs on the system */
  117. unsigned long TLBAttrib; /* Combined I+D or split TLB */
  118. unsigned long TLBAssoc; /* TLB Associativity. Use this for
  119. combined TLB. If split, put zeros
  120. here. */
  121. /* For split TLB: (= combined if combined TLB) */
  122. unsigned long I_TLBSize;
  123. unsigned long I_TLBAssoc;
  124. unsigned long D_TLBSize;
  125. unsigned long D_TLBAssoc;
  126. unsigned long ExtendedVPD; /* Offset to extended VPD area;
  127. null if unused */
  128. } VPD;
  129. typedef enum _DEVICE_FLAGS {
  130. Enabled = 0x4000, /* 1 - PCI device is enabled */
  131. Integrated = 0x2000,
  132. Failed = 0x1000, /* 1 - device failed POST code tests */
  133. Static = 0x0800, /* 0 - dynamically configurable
  134. 1 - static */
  135. Dock = 0x0400, /* 0 - not a docking station device
  136. 1 - is a docking station device */
  137. Boot = 0x0200, /* 0 - device cannot be used for BOOT
  138. 1 - can be a BOOT device */
  139. Configurable = 0x0100, /* 1 - device is configurable */
  140. Disableable = 0x80, /* 1 - device can be disabled */
  141. PowerManaged = 0x40, /* 0 - not managed; 1 - managed */
  142. ReadOnly = 0x20, /* 1 - device is read only */
  143. Removable = 0x10, /* 1 - device is removable */
  144. ConsoleIn = 0x08,
  145. ConsoleOut = 0x04,
  146. Input = 0x02,
  147. Output = 0x01
  148. } DEVICE_FLAGS;
  149. typedef enum _BUS_ID {
  150. ISADEVICE = 0x01,
  151. EISADEVICE = 0x02,
  152. PCIDEVICE = 0x04,
  153. PCMCIADEVICE = 0x08,
  154. PNPISADEVICE = 0x10,
  155. MCADEVICE = 0x20,
  156. MXDEVICE = 0x40, /* Devices on mezzanine bus */
  157. PROCESSORDEVICE = 0x80, /* Devices on processor bus */
  158. VMEDEVICE = 0x100,
  159. } BUS_ID;
  160. typedef struct _DEVICE_ID {
  161. unsigned long BusId; /* See BUS_ID enum above */
  162. unsigned long DevId; /* Big Endian format */
  163. unsigned long SerialNum; /* For multiple usage of a single
  164. DevId */
  165. unsigned long Flags; /* See DEVICE_FLAGS enum above */
  166. unsigned char BaseType; /* See pnp.h for bit definitions */
  167. unsigned char SubType; /* See pnp.h for bit definitions */
  168. unsigned char Interface; /* See pnp.h for bit definitions */
  169. unsigned char Spare;
  170. } DEVICE_ID;
  171. typedef union _BUS_ACCESS {
  172. struct _PnPAccess{
  173. unsigned char CSN;
  174. unsigned char LogicalDevNumber;
  175. unsigned short ReadDataPort;
  176. } PnPAccess;
  177. struct _ISAAccess{
  178. unsigned char SlotNumber; /* ISA Slot Number generally not
  179. available; 0 if unknown */
  180. unsigned char LogicalDevNumber;
  181. unsigned short ISAReserved;
  182. } ISAAccess;
  183. struct _MCAAccess{
  184. unsigned char SlotNumber;
  185. unsigned char LogicalDevNumber;
  186. unsigned short MCAReserved;
  187. } MCAAccess;
  188. struct _PCMCIAAccess{
  189. unsigned char SlotNumber;
  190. unsigned char LogicalDevNumber;
  191. unsigned short PCMCIAReserved;
  192. } PCMCIAAccess;
  193. struct _EISAAccess{
  194. unsigned char SlotNumber;
  195. unsigned char FunctionNumber;
  196. unsigned short EISAReserved;
  197. } EISAAccess;
  198. struct _PCIAccess{
  199. unsigned char BusNumber;
  200. unsigned char DevFuncNumber;
  201. unsigned short PCIReserved;
  202. } PCIAccess;
  203. struct _ProcBusAccess{
  204. unsigned char BusNumber;
  205. unsigned char BUID;
  206. unsigned short ProcBusReserved;
  207. } ProcBusAccess;
  208. } BUS_ACCESS;
  209. /* Per logical device information */
  210. typedef struct _PPC_DEVICE {
  211. DEVICE_ID DeviceId;
  212. BUS_ACCESS BusAccess;
  213. /* The following three are offsets into the DevicePnPHeap */
  214. /* All are in PnP compressed format */
  215. unsigned long AllocatedOffset; /* Allocated resource description */
  216. unsigned long PossibleOffset; /* Possible resource description */
  217. unsigned long CompatibleOffset; /* Compatible device identifiers */
  218. } PPC_DEVICE;
  219. typedef enum _CPU_STATE {
  220. CPU_GOOD = 0, /* CPU is present, and active */
  221. CPU_GOOD_FW = 1, /* CPU is present, and in firmware */
  222. CPU_OFF = 2, /* CPU is present, but inactive */
  223. CPU_FAILED = 3, /* CPU is present, but failed POST */
  224. CPU_NOT_PRESENT = 255 /* CPU not present */
  225. } CPU_STATE;
  226. typedef struct _PPC_CPU {
  227. unsigned long CpuType; /* Result of mfspr from Processor
  228. Version Register (PVR).
  229. PVR(0-15) = Version (e.g. 601)
  230. PVR(16-31 = EC Level */
  231. unsigned char CpuNumber; /* CPU Number for this processor */
  232. unsigned char CpuState; /* CPU State, see CPU_STATE enum */
  233. unsigned short Reserved;
  234. } PPC_CPU;
  235. typedef struct _PPC_MEM {
  236. unsigned long SIMMSize; /* 0 - absent or bad
  237. 8M, 32M (in MB) */
  238. } PPC_MEM;
  239. typedef enum _MEM_USAGE {
  240. Other = 0x8000,
  241. ResumeBlock = 0x4000, /* for use by power management */
  242. SystemROM = 0x2000, /* Flash memory (populated) */
  243. UnPopSystemROM = 0x1000, /* Unpopulated part of SystemROM area */
  244. IOMemory = 0x0800,
  245. SystemIO = 0x0400,
  246. SystemRegs = 0x0200,
  247. PCIAddr = 0x0100,
  248. PCIConfig = 0x80,
  249. ISAAddr = 0x40,
  250. Unpopulated = 0x20, /* Unpopulated part of System Memory */
  251. Free = 0x10, /* Free part of System Memory */
  252. BootImage = 0x08, /* BootImage part of System Memory */
  253. FirmwareCode = 0x04, /* FirmwareCode part of System Memory */
  254. FirmwareHeap = 0x02, /* FirmwareHeap part of System Memory */
  255. FirmwareStack = 0x01 /* FirmwareStack part of System Memory*/
  256. } MEM_USAGE;
  257. typedef struct _MEM_MAP {
  258. unsigned long Usage; /* See MEM_USAGE above */
  259. unsigned long BasePage; /* Page number measured in 4KB pages */
  260. unsigned long PageCount; /* Page count measured in 4KB pages */
  261. } MEM_MAP;
  262. typedef struct _RESIDUAL {
  263. unsigned long ResidualLength; /* Length of Residual */
  264. unsigned char Version; /* of this data structure */
  265. unsigned char Revision; /* of this data structure */
  266. unsigned short EC; /* of this data structure */
  267. /* VPD */
  268. VPD VitalProductData;
  269. /* CPU */
  270. unsigned short MaxNumCpus; /* Max CPUs in this system */
  271. unsigned short ActualNumCpus; /* ActualNumCpus < MaxNumCpus means */
  272. /* that there are unpopulated or */
  273. /* otherwise unusable cpu locations */
  274. PPC_CPU Cpus[MAX_CPUS];
  275. /* Memory */
  276. unsigned long TotalMemory; /* Total amount of memory installed */
  277. unsigned long GoodMemory; /* Total amount of good memory */
  278. unsigned long ActualNumMemSegs;
  279. MEM_MAP Segs[MAX_MEM_SEGS];
  280. unsigned long ActualNumMemories;
  281. PPC_MEM Memories[MAX_MEMS];
  282. /* Devices */
  283. unsigned long ActualNumDevices;
  284. PPC_DEVICE Devices[MAX_DEVICES];
  285. unsigned char DevicePnPHeap[2*MAX_DEVICES*AVE_PNP_SIZE];
  286. } RESIDUAL;
  287. /*
  288. * Forward declaration - we can't include <linux/pci.h> because it
  289. * breaks the boot loader
  290. */
  291. struct pci_dev;
  292. extern RESIDUAL *res;
  293. extern void print_residual_device_info(void);
  294. extern PPC_DEVICE *residual_find_device(unsigned long BusMask,
  295. unsigned char * DevID, int BaseType,
  296. int SubType, int Interface, int n);
  297. extern int residual_pcidev_irq(struct pci_dev *dev);
  298. extern void residual_irq_mask(char *irq_edge_mask_lo, char *irq_edge_mask_hi);
  299. extern unsigned int residual_isapic_addr(void);
  300. extern PnP_TAG_PACKET *PnP_find_packet(unsigned char *p, unsigned packet_tag,
  301. int n);
  302. extern PnP_TAG_PACKET *PnP_find_small_vendor_packet(unsigned char *p,
  303. unsigned packet_type,
  304. int n);
  305. extern PnP_TAG_PACKET *PnP_find_large_vendor_packet(unsigned char *p,
  306. unsigned packet_type,
  307. int n);
  308. #ifdef CONFIG_PREP_RESIDUAL
  309. #define have_residual_data (res && res->ResidualLength)
  310. #else
  311. #define have_residual_data 0
  312. #endif
  313. #endif /* __ASSEMBLY__ */
  314. #endif /* ndef _RESIDUAL_ */
  315. #endif /* __KERNEL__ */