VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / asm-parisc / pdcpat.h
index 2f74d90..715d94d 100644 (file)
@@ -6,12 +6,11 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) Hewlett Packard (Paul Bame <bame@puffin.external.hp.com>)
- * Copyright 2000 (c) Grant Grundler <grundler@puffin.external.hp.com>
+ * Copyright 2000 (c) Hewlett Packard (Paul Bame <bame()spam.parisc-linux.org>)
+ * Copyright 2000,2004 (c) Grant Grundler <grundler()nahspam.parisc-linux.org>
  */
 
 
-/* PDC PAT CELL */
 #define PDC_PAT_CELL                   64L   /* Interface for gaining and 
                                          * manipulatin g cell state within PD */
 #define PDC_PAT_CELL_GET_NUMBER    0L   /* Return Cell number */
 #define PAT_GNIP            7         /* GNI Reserved Space */
 
 
-/* PDC PAT CHASSIS LOG */
 
-#define PDC_PAT_CHASSIS_LOG            65L /* Platform logging & forward
-                                           ** progress functions */
+/* PDC PAT CHASSIS LOG -- Platform logging & forward progress functions */
+
+#define PDC_PAT_CHASSIS_LOG            65L
 #define PDC_PAT_CHASSIS_WRITE_LOG      0L /* Write Log Entry */
 #define PDC_PAT_CHASSIS_READ_LOG       1L /* Read  Log Entry */
 
-/* PDC PAT CPU  */
 
-#define PDC_PAT_CPU                    67L /* Interface to CPU configuration
-                                               * within the protection domain */
+/* PDC PAT CPU  -- CPU configuration within the protection domain */
+
+#define PDC_PAT_CPU                    67L
 #define PDC_PAT_CPU_INFO               0L /* Return CPU config info */
 #define PDC_PAT_CPU_DELETE             1L /* Delete CPU */
 #define PDC_PAT_CPU_ADD                2L /* Add    CPU */
 #define PDC_PAT_CPU_PLUNGE_FABRIC      128L /* Plunge Fabric */
 #define PDC_PAT_CPU_UPDATE_CACHE_CLEANSING 129L /* Manipulate Cache 
                                                  * Cleansing Mode */
-/*  PDC PAT EVENT */
+/*  PDC PAT EVENT -- Platform Events */
 
-#define PDC_PAT_EVENT                  68L /* Interface to Platform Events */
+#define PDC_PAT_EVENT                  68L
 #define PDC_PAT_EVENT_GET_CAPS         0L /* Get Capabilities */
 #define PDC_PAT_EVENT_SET_MODE         1L /* Set Notification Mode */
 #define PDC_PAT_EVENT_SCAN             2L /* Scan Event */
 #define PDC_PAT_EVENT_HANDLE           3L /* Handle Event */
 #define PDC_PAT_EVENT_GET_NB_CALL      4L /* Get Non-Blocking call Args */
 
-/*  PDC PAT HPMC */
+/*  PDC PAT HPMC -- Cause processor to go into spin loop, and wait
+ *                     for wake up from Monarch Processor.
+ */
 
-#define PDC_PAT_HPMC               70L /* Cause processor to go into spin
-                                      ** loop, and wait for wake up from
-                                      ** Monarch Processor */
+#define PDC_PAT_HPMC               70L
 #define PDC_PAT_HPMC_RENDEZ_CPU     0L /* go into spin loop */
 #define PDC_PAT_HPMC_SET_PARAMS     1L /* Allows OS to specify intr which PDC 
-                                        * will use to interrupt OS during machine
-                                        * check rendezvous */
+                                        * will use to interrupt OS during
+                                        * machine check rendezvous */
 
 /* parameters for PDC_PAT_HPMC_SET_PARAMS: */
 #define HPMC_SET_PARAMS_INTR       1L /* Rendezvous Interrupt */
 #define HPMC_SET_PARAMS_WAKE       2L /* Wake up processor */
 
-/*  PDC PAT IO */
 
-#define PDC_PAT_IO                  71L /* On-line services for I/O modules */
+/*  PDC PAT IO  -- On-line services for I/O modules */
+
+#define PDC_PAT_IO                  71L
 #define PDC_PAT_IO_GET_SLOT_STATUS     5L /* Get Slot Status Info*/
 #define PDC_PAT_IO_GET_LOC_FROM_HARDWARE 6L /* Get Physical Location from */
                                             /* Hardware Path */
 #define PDC_PAT_IO_GET_PROC_VIEW        29L /* Get Processor view of IO address */
 #define PDC_PAT_IO_PROG_SBA_DIR_RANGE   30L /* Program directed range */
 
-/* PDC PAT MEM */
 
-#define PDC_PAT_MEM                    72L /* Manage memory page deallocation */
+/* PDC PAT MEM  -- Manage memory page deallocation */
+
+#define PDC_PAT_MEM            72L
 #define PDC_PAT_MEM_PD_INFO            0L /* Return PDT info for PD       */
 #define PDC_PAT_MEM_PD_CLEAR           1L /* Clear PDT for PD             */
 #define PDC_PAT_MEM_PD_READ            2L /* Read PDT entries for PD      */
 #define PDC_PAT_MEM_GET_TBL_SIZE       131L /* Get Memory Table Size     */
 #define PDC_PAT_MEM_GET_TBL            132L /* Get Memory Table          */
 
-/* PDC PAT NVOLATILE */
 
-#define PDC_PAT_NVOLATILE              73L /* Access Non-Volatile Memory */
-#define PDC_PAT_NVOLATILE_READ         0L /* Read Non-Volatile Memory   */
-#define PDC_PAT_NVOLATILE_WRITE        1L /* Write Non-Volatile Memory  */
-#define PDC_PAT_NVOLATILE_GET_SIZE     2L /* Return size of NVM         */
-#define PDC_PAT_NVOLATILE_VERIFY       3L /* Verify contents of NVM     */
-#define PDC_PAT_NVOLATILE_INIT         4L /* Initialize NVM             */
+/* PDC PAT NVOLATILE  --  Access Non-Volatile Memory */
+
+#define PDC_PAT_NVOLATILE      73L
+#define PDC_PAT_NVOLATILE_READ         0L /* Read Non-Volatile Memory   */
+#define PDC_PAT_NVOLATILE_WRITE                1L /* Write Non-Volatile Memory  */
+#define PDC_PAT_NVOLATILE_GET_SIZE     2L /* Return size of NVM         */
+#define PDC_PAT_NVOLATILE_VERIFY       3L /* Verify contents of NVM     */
+#define PDC_PAT_NVOLATILE_INIT         4L /* Initialize NVM             */
+
+/* PDC PAT PD */
+#define PDC_PAT_PD             74L         /* Protection Domain Info   */
+#define PDC_PAT_PD_GET_ADDR_MAP                0L  /* Get Address Map          */
+
+/* PDC_PAT_PD_GET_ADDR_MAP entry types */
+#define PAT_MEMORY_DESCRIPTOR          1   
+
+/* PDC_PAT_PD_GET_ADDR_MAP memory types */
+#define PAT_MEMTYPE_MEMORY             0
+#define PAT_MEMTYPE_FIRMWARE           4
+
+/* PDC_PAT_PD_GET_ADDR_MAP memory usage */
+#define PAT_MEMUSE_GENERAL             0
+#define PAT_MEMUSE_GI                  128
+#define PAT_MEMUSE_GNI                 129
+
 
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 
+#ifdef CONFIG_PARISC64
+#define is_pdc_pat()   (PDC_TYPE_PAT == pdc_type)
+extern int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num);
+extern int pdc_pat_get_irt(void *r_addr, unsigned long cell_num);
+#else  /* ! CONFIG_PARISC64 */
+/* No PAT support for 32-bit kernels...sorry */
+#define is_pdc_pat()   (0)
+#define pdc_pat_get_irt_size(num_entries, cell_numn)   PDC_BAD_PROC
+#define pdc_pat_get_irt(r_addr, cell_num)              PDC_BAD_PROC
+#endif /* ! CONFIG_PARISC64 */
+
+
+struct pdc_pat_cell_num {
+       unsigned long cell_num;
+       unsigned long cell_loc;
+};
+
+struct pdc_pat_cpu_num {
+       unsigned long cpu_num;
+       unsigned long cpu_loc;
+};
+
+struct pdc_pat_pd_addr_map_entry {
+       unsigned char entry_type;       /* 1 = Memory Descriptor Entry Type */
+       unsigned char reserve1[5];
+       unsigned char memory_type;
+       unsigned char memory_usage;
+       unsigned long paddr;
+       unsigned int  pages;            /* Length in 4K pages */
+       unsigned int  reserve2;
+       unsigned long cell_map;
+};
+
+/********************************************************************
+* PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr
+* ----------------------------------------------------------
+* Bit  0 to 51 - conf_base_addr
+* Bit 52 to 62 - reserved
+* Bit       63 - endianess bit
+********************************************************************/
+#define PAT_GET_CBA(value) ((value) & 0xfffffffffffff000UL)
+
+/********************************************************************
+* PDC_PAT_CELL[Return Cell Module] memaddr[1] mod_info
+* ----------------------------------------------------
+* Bit  0 to  7 - entity type
+*    0 = central agent,            1 = processor,
+*    2 = memory controller,        3 = system bus adapter,
+*    4 = local bus adapter,        5 = processor bus converter,
+*    6 = crossbar fabric connect,  7 = fabric interconnect,
+*    8 to 254 reserved,            255 = unknown.
+* Bit  8 to 15 - DVI
+* Bit 16 to 23 - IOC functions
+* Bit 24 to 39 - reserved
+* Bit 40 to 63 - mod_pages
+*    number of 4K pages a module occupies starting at conf_base_addr
+********************************************************************/
+#define PAT_GET_ENTITY(value)  (((value) >> 56) & 0xffUL)
+#define PAT_GET_DVI(value)     (((value) >> 48) & 0xffUL)
+#define PAT_GET_IOC(value)     (((value) >> 40) & 0xffUL)
+#define PAT_GET_MOD_PAGES(value)(((value) & 0xffffffUL)
+
+
 /*
 ** PDC_PAT_CELL_GET_INFO return block
 */
@@ -192,26 +274,34 @@ typedef struct pdc_pat_cell_info_rtn_block {
 
 /* FIXME: mod[508] should really be a union of the various mod components */
 struct pdc_pat_cell_mod_maddr_block {  /* PDC_PAT_CELL_MODULE */
-       unsigned long cba;              /* function 0 configuration space address */
-       unsigned long mod_info;         /* module information */
-       unsigned long mod_location;     /* physical location of the module */
-       unsigned long mod_path;         /* module path (device path - layers) */
+       unsigned long cba;              /* func 0 cfg space address */
+       unsigned long mod_info;         /* module information */
+       unsigned long mod_location;     /* physical location of the module */
+       struct hardware_path mod_path;  /* module path (device path - layers) */
        unsigned long mod[508];         /* PAT cell module components */
 } __attribute__((aligned(8))) ;
 
 typedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t;
 
 
-extern int pdc_pat_cell_get_number(void *);
-extern int pdc_pat_cell_module(void *, unsigned long, unsigned long, unsigned long, void *);
+extern int pdc_pat_chassis_send_log(unsigned long status, unsigned long data);
+extern int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info);
+extern int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long mod, unsigned long view_type, void *mem_addr);
 extern int pdc_pat_cell_num_to_loc(void *, unsigned long);
 
+extern int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa);
+
+extern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, unsigned long count, unsigned long offset);
+
+
+extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val); 
+extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val); 
+
+
 /* Flag to indicate this is a PAT box...don't use this unless you
 ** really have to...it might go away some day.
 */
-#ifdef __LP64__
 extern int pdc_pat;     /* arch/parisc/kernel/inventory.c */
-#endif
 
 /********************************************************************
 * PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr