pdcpat.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. #ifndef __PARISC_PATPDC_H
  2. #define __PARISC_PATPDC_H
  3. /*
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright 2000 (c) Hewlett Packard (Paul Bame <bame()spam.parisc-linux.org>)
  9. * Copyright 2000,2004 (c) Grant Grundler <grundler()nahspam.parisc-linux.org>
  10. */
  11. #define PDC_PAT_CELL 64L /* Interface for gaining and
  12. * manipulatin g cell state within PD */
  13. #define PDC_PAT_CELL_GET_NUMBER 0L /* Return Cell number */
  14. #define PDC_PAT_CELL_GET_INFO 1L /* Returns info about Cell */
  15. #define PDC_PAT_CELL_MODULE 2L /* Returns info about Module */
  16. #define PDC_PAT_CELL_SET_ATTENTION 9L /* Set Cell Attention indicator */
  17. #define PDC_PAT_CELL_NUMBER_TO_LOC 10L /* Cell Number -> Location */
  18. #define PDC_PAT_CELL_WALK_FABRIC 11L /* Walk the Fabric */
  19. #define PDC_PAT_CELL_GET_RDT_SIZE 12L /* Return Route Distance Table Sizes */
  20. #define PDC_PAT_CELL_GET_RDT 13L /* Return Route Distance Tables */
  21. #define PDC_PAT_CELL_GET_LOCAL_PDH_SZ 14L /* Read Local PDH Buffer Size */
  22. #define PDC_PAT_CELL_SET_LOCAL_PDH 15L /* Write Local PDH Buffer */
  23. #define PDC_PAT_CELL_GET_REMOTE_PDH_SZ 16L /* Return Remote PDH Buffer Size */
  24. #define PDC_PAT_CELL_GET_REMOTE_PDH 17L /* Read Remote PDH Buffer */
  25. #define PDC_PAT_CELL_GET_DBG_INFO 128L /* Return DBG Buffer Info */
  26. #define PDC_PAT_CELL_CHANGE_ALIAS 129L /* Change Non-Equivalent Alias Chacking */
  27. /*
  28. ** Arg to PDC_PAT_CELL_MODULE memaddr[4]
  29. **
  30. ** Addresses on the Merced Bus != all Runway Bus addresses.
  31. ** This is intended for programming SBA/LBA chips range registers.
  32. */
  33. #define IO_VIEW 0UL
  34. #define PA_VIEW 1UL
  35. /* PDC_PAT_CELL_MODULE entity type values */
  36. #define PAT_ENTITY_CA 0 /* central agent */
  37. #define PAT_ENTITY_PROC 1 /* processor */
  38. #define PAT_ENTITY_MEM 2 /* memory controller */
  39. #define PAT_ENTITY_SBA 3 /* system bus adapter */
  40. #define PAT_ENTITY_LBA 4 /* local bus adapter */
  41. #define PAT_ENTITY_PBC 5 /* processor bus converter */
  42. #define PAT_ENTITY_XBC 6 /* crossbar fabric connect */
  43. #define PAT_ENTITY_RC 7 /* fabric interconnect */
  44. /* PDC_PAT_CELL_MODULE address range type values */
  45. #define PAT_PBNUM 0 /* PCI Bus Number */
  46. #define PAT_LMMIO 1 /* < 4G MMIO Space */
  47. #define PAT_GMMIO 2 /* > 4G MMIO Space */
  48. #define PAT_NPIOP 3 /* Non Postable I/O Port Space */
  49. #define PAT_PIOP 4 /* Postable I/O Port Space */
  50. #define PAT_AHPA 5 /* Addional HPA Space */
  51. #define PAT_UFO 6 /* HPA Space (UFO for Mariposa) */
  52. #define PAT_GNIP 7 /* GNI Reserved Space */
  53. /* PDC PAT CHASSIS LOG -- Platform logging & forward progress functions */
  54. #define PDC_PAT_CHASSIS_LOG 65L
  55. #define PDC_PAT_CHASSIS_WRITE_LOG 0L /* Write Log Entry */
  56. #define PDC_PAT_CHASSIS_READ_LOG 1L /* Read Log Entry */
  57. /* PDC PAT CPU -- CPU configuration within the protection domain */
  58. #define PDC_PAT_CPU 67L
  59. #define PDC_PAT_CPU_INFO 0L /* Return CPU config info */
  60. #define PDC_PAT_CPU_DELETE 1L /* Delete CPU */
  61. #define PDC_PAT_CPU_ADD 2L /* Add CPU */
  62. #define PDC_PAT_CPU_GET_NUMBER 3L /* Return CPU Number */
  63. #define PDC_PAT_CPU_GET_HPA 4L /* Return CPU HPA */
  64. #define PDC_PAT_CPU_STOP 5L /* Stop CPU */
  65. #define PDC_PAT_CPU_RENDEZVOUS 6L /* Rendezvous CPU */
  66. #define PDC_PAT_CPU_GET_CLOCK_INFO 7L /* Return CPU Clock info */
  67. #define PDC_PAT_CPU_GET_RENDEZVOUS_STATE 8L /* Return Rendezvous State */
  68. #define PDC_PAT_CPU_PLUNGE_FABRIC 128L /* Plunge Fabric */
  69. #define PDC_PAT_CPU_UPDATE_CACHE_CLEANSING 129L /* Manipulate Cache
  70. * Cleansing Mode */
  71. /* PDC PAT EVENT -- Platform Events */
  72. #define PDC_PAT_EVENT 68L
  73. #define PDC_PAT_EVENT_GET_CAPS 0L /* Get Capabilities */
  74. #define PDC_PAT_EVENT_SET_MODE 1L /* Set Notification Mode */
  75. #define PDC_PAT_EVENT_SCAN 2L /* Scan Event */
  76. #define PDC_PAT_EVENT_HANDLE 3L /* Handle Event */
  77. #define PDC_PAT_EVENT_GET_NB_CALL 4L /* Get Non-Blocking call Args */
  78. /* PDC PAT HPMC -- Cause processor to go into spin loop, and wait
  79. * for wake up from Monarch Processor.
  80. */
  81. #define PDC_PAT_HPMC 70L
  82. #define PDC_PAT_HPMC_RENDEZ_CPU 0L /* go into spin loop */
  83. #define PDC_PAT_HPMC_SET_PARAMS 1L /* Allows OS to specify intr which PDC
  84. * will use to interrupt OS during
  85. * machine check rendezvous */
  86. /* parameters for PDC_PAT_HPMC_SET_PARAMS: */
  87. #define HPMC_SET_PARAMS_INTR 1L /* Rendezvous Interrupt */
  88. #define HPMC_SET_PARAMS_WAKE 2L /* Wake up processor */
  89. /* PDC PAT IO -- On-line services for I/O modules */
  90. #define PDC_PAT_IO 71L
  91. #define PDC_PAT_IO_GET_SLOT_STATUS 5L /* Get Slot Status Info*/
  92. #define PDC_PAT_IO_GET_LOC_FROM_HARDWARE 6L /* Get Physical Location from */
  93. /* Hardware Path */
  94. #define PDC_PAT_IO_GET_HARDWARE_FROM_LOC 7L /* Get Hardware Path from
  95. * Physical Location */
  96. #define PDC_PAT_IO_GET_PCI_CONFIG_FROM_HW 11L /* Get PCI Configuration
  97. * Address from Hardware Path */
  98. #define PDC_PAT_IO_GET_HW_FROM_PCI_CONFIG 12L /* Get Hardware Path
  99. * from PCI Configuration Address */
  100. #define PDC_PAT_IO_READ_HOST_BRIDGE_INFO 13L /* Read Host Bridge State Info */
  101. #define PDC_PAT_IO_CLEAR_HOST_BRIDGE_INFO 14L /* Clear Host Bridge State Info*/
  102. #define PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE 15L /* Get PCI INT Routing Table
  103. * Size */
  104. #define PDC_PAT_IO_GET_PCI_ROUTING_TABLE 16L /* Get PCI INT Routing Table */
  105. #define PDC_PAT_IO_GET_HINT_TABLE_SIZE 17L /* Get Hint Table Size */
  106. #define PDC_PAT_IO_GET_HINT_TABLE 18L /* Get Hint Table */
  107. #define PDC_PAT_IO_PCI_CONFIG_READ 19L /* PCI Config Read */
  108. #define PDC_PAT_IO_PCI_CONFIG_WRITE 20L /* PCI Config Write */
  109. #define PDC_PAT_IO_GET_NUM_IO_SLOTS 21L /* Get Number of I/O Bay Slots in
  110. * Cabinet */
  111. #define PDC_PAT_IO_GET_LOC_IO_SLOTS 22L /* Get Physical Location of I/O */
  112. /* Bay Slots in Cabinet */
  113. #define PDC_PAT_IO_BAY_STATUS_INFO 28L /* Get I/O Bay Slot Status Info */
  114. #define PDC_PAT_IO_GET_PROC_VIEW 29L /* Get Processor view of IO address */
  115. #define PDC_PAT_IO_PROG_SBA_DIR_RANGE 30L /* Program directed range */
  116. /* PDC PAT MEM -- Manage memory page deallocation */
  117. #define PDC_PAT_MEM 72L
  118. #define PDC_PAT_MEM_PD_INFO 0L /* Return PDT info for PD */
  119. #define PDC_PAT_MEM_PD_CLEAR 1L /* Clear PDT for PD */
  120. #define PDC_PAT_MEM_PD_READ 2L /* Read PDT entries for PD */
  121. #define PDC_PAT_MEM_PD_RESET 3L /* Reset clear bit for PD */
  122. #define PDC_PAT_MEM_CELL_INFO 5L /* Return PDT info For Cell */
  123. #define PDC_PAT_MEM_CELL_CLEAR 6L /* Clear PDT For Cell */
  124. #define PDC_PAT_MEM_CELL_READ 7L /* Read PDT entries For Cell */
  125. #define PDC_PAT_MEM_CELL_RESET 8L /* Reset clear bit For Cell */
  126. #define PDC_PAT_MEM_SETGM 9L /* Set Golden Memory value */
  127. #define PDC_PAT_MEM_ADD_PAGE 10L /* ADDs a page to the cell */
  128. #define PDC_PAT_MEM_ADDRESS 11L /* Get Physical Location From */
  129. /* Memory Address */
  130. #define PDC_PAT_MEM_GET_TXT_SIZE 12L /* Get Formatted Text Size */
  131. #define PDC_PAT_MEM_GET_PD_TXT 13L /* Get PD Formatted Text */
  132. #define PDC_PAT_MEM_GET_CELL_TXT 14L /* Get Cell Formatted Text */
  133. #define PDC_PAT_MEM_RD_STATE_INFO 15L /* Read Mem Module State Info*/
  134. #define PDC_PAT_MEM_CLR_STATE_INFO 16L /*Clear Mem Module State Info*/
  135. #define PDC_PAT_MEM_CLEAN_RANGE 128L /*Clean Mem in specific range*/
  136. #define PDC_PAT_MEM_GET_TBL_SIZE 131L /* Get Memory Table Size */
  137. #define PDC_PAT_MEM_GET_TBL 132L /* Get Memory Table */
  138. /* PDC PAT NVOLATILE -- Access Non-Volatile Memory */
  139. #define PDC_PAT_NVOLATILE 73L
  140. #define PDC_PAT_NVOLATILE_READ 0L /* Read Non-Volatile Memory */
  141. #define PDC_PAT_NVOLATILE_WRITE 1L /* Write Non-Volatile Memory */
  142. #define PDC_PAT_NVOLATILE_GET_SIZE 2L /* Return size of NVM */
  143. #define PDC_PAT_NVOLATILE_VERIFY 3L /* Verify contents of NVM */
  144. #define PDC_PAT_NVOLATILE_INIT 4L /* Initialize NVM */
  145. /* PDC PAT PD */
  146. #define PDC_PAT_PD 74L /* Protection Domain Info */
  147. #define PDC_PAT_PD_GET_ADDR_MAP 0L /* Get Address Map */
  148. /* PDC_PAT_PD_GET_ADDR_MAP entry types */
  149. #define PAT_MEMORY_DESCRIPTOR 1
  150. /* PDC_PAT_PD_GET_ADDR_MAP memory types */
  151. #define PAT_MEMTYPE_MEMORY 0
  152. #define PAT_MEMTYPE_FIRMWARE 4
  153. /* PDC_PAT_PD_GET_ADDR_MAP memory usage */
  154. #define PAT_MEMUSE_GENERAL 0
  155. #define PAT_MEMUSE_GI 128
  156. #define PAT_MEMUSE_GNI 129
  157. #ifndef __ASSEMBLY__
  158. #include <linux/types.h>
  159. #ifdef CONFIG_64BIT
  160. #define is_pdc_pat() (PDC_TYPE_PAT == pdc_type)
  161. extern int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num);
  162. extern int pdc_pat_get_irt(void *r_addr, unsigned long cell_num);
  163. #else /* ! CONFIG_64BIT */
  164. /* No PAT support for 32-bit kernels...sorry */
  165. #define is_pdc_pat() (0)
  166. #define pdc_pat_get_irt_size(num_entries, cell_numn) PDC_BAD_PROC
  167. #define pdc_pat_get_irt(r_addr, cell_num) PDC_BAD_PROC
  168. #endif /* ! CONFIG_64BIT */
  169. struct pdc_pat_cell_num {
  170. unsigned long cell_num;
  171. unsigned long cell_loc;
  172. };
  173. struct pdc_pat_cpu_num {
  174. unsigned long cpu_num;
  175. unsigned long cpu_loc;
  176. };
  177. struct pdc_pat_pd_addr_map_entry {
  178. unsigned char entry_type; /* 1 = Memory Descriptor Entry Type */
  179. unsigned char reserve1[5];
  180. unsigned char memory_type;
  181. unsigned char memory_usage;
  182. unsigned long paddr;
  183. unsigned int pages; /* Length in 4K pages */
  184. unsigned int reserve2;
  185. unsigned long cell_map;
  186. };
  187. /********************************************************************
  188. * PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr
  189. * ----------------------------------------------------------
  190. * Bit 0 to 51 - conf_base_addr
  191. * Bit 52 to 62 - reserved
  192. * Bit 63 - endianess bit
  193. ********************************************************************/
  194. #define PAT_GET_CBA(value) ((value) & 0xfffffffffffff000UL)
  195. /********************************************************************
  196. * PDC_PAT_CELL[Return Cell Module] memaddr[1] mod_info
  197. * ----------------------------------------------------
  198. * Bit 0 to 7 - entity type
  199. * 0 = central agent, 1 = processor,
  200. * 2 = memory controller, 3 = system bus adapter,
  201. * 4 = local bus adapter, 5 = processor bus converter,
  202. * 6 = crossbar fabric connect, 7 = fabric interconnect,
  203. * 8 to 254 reserved, 255 = unknown.
  204. * Bit 8 to 15 - DVI
  205. * Bit 16 to 23 - IOC functions
  206. * Bit 24 to 39 - reserved
  207. * Bit 40 to 63 - mod_pages
  208. * number of 4K pages a module occupies starting at conf_base_addr
  209. ********************************************************************/
  210. #define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL)
  211. #define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL)
  212. #define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL)
  213. #define PAT_GET_MOD_PAGES(value) ((value) & 0xffffffUL)
  214. /*
  215. ** PDC_PAT_CELL_GET_INFO return block
  216. */
  217. typedef struct pdc_pat_cell_info_rtn_block {
  218. unsigned long cpu_info;
  219. unsigned long cell_info;
  220. unsigned long cell_location;
  221. unsigned long reo_location;
  222. unsigned long mem_size;
  223. unsigned long dimm_status;
  224. unsigned long pdc_rev;
  225. unsigned long fabric_info0;
  226. unsigned long fabric_info1;
  227. unsigned long fabric_info2;
  228. unsigned long fabric_info3;
  229. unsigned long reserved[21];
  230. } pdc_pat_cell_info_rtn_block_t;
  231. /* FIXME: mod[508] should really be a union of the various mod components */
  232. struct pdc_pat_cell_mod_maddr_block { /* PDC_PAT_CELL_MODULE */
  233. unsigned long cba; /* func 0 cfg space address */
  234. unsigned long mod_info; /* module information */
  235. unsigned long mod_location; /* physical location of the module */
  236. struct hardware_path mod_path; /* module path (device path - layers) */
  237. unsigned long mod[508]; /* PAT cell module components */
  238. } __attribute__((aligned(8))) ;
  239. typedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t;
  240. extern int pdc_pat_chassis_send_log(unsigned long status, unsigned long data);
  241. extern int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info);
  242. extern int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long mod, unsigned long view_type, void *mem_addr);
  243. extern int pdc_pat_cell_num_to_loc(void *, unsigned long);
  244. extern int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa);
  245. extern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, unsigned long count, unsigned long offset);
  246. extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val);
  247. extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val);
  248. /* Flag to indicate this is a PAT box...don't use this unless you
  249. ** really have to...it might go away some day.
  250. */
  251. extern int pdc_pat; /* arch/parisc/kernel/inventory.c */
  252. #endif /* __ASSEMBLY__ */
  253. #endif /* ! __PARISC_PATPDC_H */