VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / asm-parisc / pdc.h
1 #ifndef _PARISC_PDC_H
2 #define _PARISC_PDC_H
3
4 #include <linux/config.h>
5
6 /*
7  *      PDC return values ...
8  *      All PDC calls return a subset of these errors. 
9  */
10
11 #define PDC_WARN                  3     /* Call completed with a warning */
12 #define PDC_REQ_ERR_1             2     /* See above                     */
13 #define PDC_REQ_ERR_0             1     /* Call would generate a requestor error */
14 #define PDC_OK                    0     /* Call completed successfully  */
15 #define PDC_BAD_PROC             -1     /* Called non-existent procedure*/
16 #define PDC_BAD_OPTION           -2     /* Called with non-existent option */
17 #define PDC_ERROR                -3     /* Call could not complete without an error */
18 #define PDC_NE_MOD               -5     /* Module not found             */
19 #define PDC_NE_CELL_MOD          -7     /* Cell module not found        */
20 #define PDC_INVALID_ARG         -10     /* Called with an invalid argument */
21 #define PDC_BUS_POW_WARN        -12     /* Call could not complete in allowed power budget */
22 #define PDC_NOT_NARROW          -17     /* Narrow mode not supported    */
23
24
25 /*
26  *      PDC entry points...
27  */
28
29 #define PDC_POW_FAIL    1               /* perform a power-fail         */
30 #define PDC_POW_FAIL_PREPARE    0       /* prepare for powerfail        */
31
32 #define PDC_CHASSIS     2               /* PDC-chassis functions        */
33 #define PDC_CHASSIS_DISP        0       /* update chassis display       */
34 #define PDC_CHASSIS_WARN        1       /* return chassis warnings      */
35 #define PDC_CHASSIS_DISPWARN    2       /* update&return chassis status */
36 #define PDC_RETURN_CHASSIS_INFO 128     /* HVERSION dependent: return chassis LED/LCD info  */
37
38 #define PDC_PIM         3               /* Get PIM data                 */
39 #define PDC_PIM_HPMC            0       /* Transfer HPMC data           */
40 #define PDC_PIM_RETURN_SIZE     1       /* Get Max buffer needed for PIM*/
41 #define PDC_PIM_LPMC            2       /* Transfer HPMC data           */
42 #define PDC_PIM_SOFT_BOOT       3       /* Transfer Soft Boot data      */
43 #define PDC_PIM_TOC             4       /* Transfer TOC data            */
44
45 #define PDC_MODEL       4               /* PDC model information call   */
46 #define PDC_MODEL_INFO          0       /* returns information          */
47 #define PDC_MODEL_BOOTID        1       /* set the BOOT_ID              */
48 #define PDC_MODEL_VERSIONS      2       /* returns cpu-internal versions*/
49 #define PDC_MODEL_SYSMODEL      3       /* return system model info     */
50 #define PDC_MODEL_ENSPEC        4       /* enable specific option       */
51 #define PDC_MODEL_DISPEC        5       /* disable specific option      */
52 #define PDC_MODEL_CPU_ID        6       /* returns cpu-id (only newer machines!) */
53 #define PDC_MODEL_CAPABILITIES  7       /* returns OS32/OS64-flags      */
54 #define PDC_MODEL_GET_BOOT__OP  8       /* returns boot test options    */
55 #define PDC_MODEL_SET_BOOT__OP  9       /* set boot test options        */
56
57 #define PA89_INSTRUCTION_SET    0x4     /* capatibilies returned        */
58 #define PA90_INSTRUCTION_SET    0x8
59
60 #define PDC_CACHE       5               /* return/set cache (& TLB) info*/
61 #define PDC_CACHE_INFO          0       /* returns information          */
62 #define PDC_CACHE_SET_COH       1       /* set coherence state          */
63 #define PDC_CACHE_RET_SPID      2       /* returns space-ID bits        */
64
65 #define PDC_HPA         6               /* return HPA of processor      */
66 #define PDC_HPA_PROCESSOR       0
67 #define PDC_HPA_MODULES         1
68
69 #define PDC_COPROC      7               /* Co-Processor (usually FP unit(s)) */
70 #define PDC_COPROC_CFG          0       /* Co-Processor Cfg (FP unit(s) enabled?) */
71
72 #define PDC_IODC        8               /* talk to IODC                 */
73 #define PDC_IODC_READ           0       /* read IODC entry point        */
74 /*      PDC_IODC_RI_                     * INDEX parameter of PDC_IODC_READ */
75 #define PDC_IODC_RI_DATA_BYTES  0       /* IODC Data Bytes              */
76 /*                              1, 2       obsolete - HVERSION dependent*/
77 #define PDC_IODC_RI_INIT        3       /* Initialize module            */
78 #define PDC_IODC_RI_IO          4       /* Module input/output          */
79 #define PDC_IODC_RI_SPA         5       /* Module input/output          */
80 #define PDC_IODC_RI_CONFIG      6       /* Module input/output          */
81 /*                              7         obsolete - HVERSION dependent */
82 #define PDC_IODC_RI_TEST        8       /* Module input/output          */
83 #define PDC_IODC_RI_TLB         9       /* Module input/output          */
84 #define PDC_IODC_NINIT          2       /* non-destructive init         */
85 #define PDC_IODC_DINIT          3       /* destructive init             */
86 #define PDC_IODC_MEMERR         4       /* check for memory errors      */
87 #define PDC_IODC_INDEX_DATA     0       /* get first 16 bytes from mod IODC */
88 #define PDC_IODC_BUS_ERROR      -4      /* bus error return value       */
89 #define PDC_IODC_INVALID_INDEX  -5      /* invalid index return value   */
90 #define PDC_IODC_COUNT          -6      /* count is too small           */
91
92 #define PDC_TOD         9               /* time-of-day clock (TOD)      */
93 #define PDC_TOD_READ            0       /* read TOD                     */
94 #define PDC_TOD_WRITE           1       /* write TOD                    */
95 #define PDC_TOD_ITIMER          2       /* calibrate Interval Timer (CR16) */
96
97 #define PDC_STABLE      10              /* stable storage (sprockets)   */
98 #define PDC_STABLE_READ         0
99 #define PDC_STABLE_WRITE        1
100 #define PDC_STABLE_RETURN_SIZE  2
101 #define PDC_STABLE_VERIFY_CONTENTS 3
102 #define PDC_STABLE_INITIALIZE   4
103
104 #define PDC_NVOLATILE   11              /* often not implemented        */
105
106 #define PDC_ADD_VALID   12              /* Memory validation PDC call   */
107 #define PDC_ADD_VALID_VERIFY    0       /* Make PDC_ADD_VALID verify region */
108
109 #define PDC_INSTR       15              /* get instr to invoke PDCE_CHECK() */
110
111 #define PDC_PROC        16              /* (sprockets)                  */
112
113 #define PDC_CONFIG      16              /* (sprockets)                  */
114 #define PDC_CONFIG_DECONFIG     0
115 #define PDC_CONFIG_DRECONFIG    1
116 #define PDC_CONFIG_DRETURN_CONFIG 2
117
118 #define PDC_BLOCK_TLB   18              /* manage hardware block-TLB    */
119 #define PDC_BTLB_INFO           0       /* returns parameter            */
120 #define PDC_BTLB_INSERT         1       /* insert BTLB entry            */
121 #define PDC_BTLB_PURGE          2       /* purge BTLB entries           */
122 #define PDC_BTLB_PURGE_ALL      3       /* purge all BTLB entries       */
123
124 #define PDC_TLB         19              /* manage hardware TLB miss handling */
125 #define PDC_TLB_INFO            0       /* returns parameter            */
126 #define PDC_TLB_SETUP           1       /* set up miss handling         */
127
128 #define PDC_MEM         20              /* Manage memory                */
129 #define PDC_MEM_MEMINFO         0
130 #define PDC_MEM_ADD_PAGE        1
131 #define PDC_MEM_CLEAR_PDT       2
132 #define PDC_MEM_READ_PDT        3
133 #define PDC_MEM_RESET_CLEAR     4
134 #define PDC_MEM_GOODMEM         5
135 #define PDC_MEM_TABLE           128     /* Non contig mem map (sprockets) */
136 #define PDC_MEM_RETURN_ADDRESS_TABLE    PDC_MEM_TABLE
137 #define PDC_MEM_GET_MEMORY_SYSTEM_TABLES_SIZE   131
138 #define PDC_MEM_GET_MEMORY_SYSTEM_TABLES        132
139 #define PDC_MEM_GET_PHYSICAL_LOCATION_FROM_MEMORY_ADDRESS 133
140
141 #define PDC_MEM_RET_SBE_REPLACED        5       /* PDC_MEM return values */
142 #define PDC_MEM_RET_DUPLICATE_ENTRY     4
143 #define PDC_MEM_RET_BUF_SIZE_SMALL      1
144 #define PDC_MEM_RET_PDT_FULL            -11
145 #define PDC_MEM_RET_INVALID_PHYSICAL_LOCATION ~0ULL
146
147 #ifndef __ASSEMBLY__
148 typedef struct {
149     unsigned long long  baseAddr;
150     unsigned int        pages;
151     unsigned int        reserved;
152 } MemAddrTable_t;
153 #endif
154
155
156 #define PDC_PSW         21              /* Get/Set default System Mask  */
157 #define PDC_PSW_MASK            0       /* Return mask                  */
158 #define PDC_PSW_GET_DEFAULTS    1       /* Return defaults              */
159 #define PDC_PSW_SET_DEFAULTS    2       /* Set default                  */
160 #define PDC_PSW_ENDIAN_BIT      1       /* set for big endian           */
161 #define PDC_PSW_WIDE_BIT        2       /* set for wide mode            */ 
162
163 #define PDC_SYSTEM_MAP  22              /* find system modules          */
164 #define PDC_FIND_MODULE         0
165 #define PDC_FIND_ADDRESS        1
166 #define PDC_TRANSLATE_PATH      2
167
168 #define PDC_SOFT_POWER  23              /* soft power switch            */
169 #define PDC_SOFT_POWER_INFO     0       /* return info about the soft power switch */
170 #define PDC_SOFT_POWER_ENABLE   1       /* enable/disable soft power switch */
171
172
173 /* HVERSION dependent */
174
175 /* The PDC_MEM_MAP calls */
176 #define PDC_MEM_MAP     128             /* on s700: return page info    */
177 #define PDC_MEM_MAP_HPA         0       /* returns hpa of a module      */
178
179 #define PDC_EEPROM      129             /* EEPROM access                */
180 #define PDC_EEPROM_READ_WORD    0
181 #define PDC_EEPROM_WRITE_WORD   1
182 #define PDC_EEPROM_READ_BYTE    2
183 #define PDC_EEPROM_WRITE_BYTE   3
184 #define PDC_EEPROM_EEPROM_PASSWORD -1000
185
186 #define PDC_NVM         130             /* NVM (non-volatile memory) access */
187 #define PDC_NVM_READ_WORD       0
188 #define PDC_NVM_WRITE_WORD      1
189 #define PDC_NVM_READ_BYTE       2
190 #define PDC_NVM_WRITE_BYTE      3
191
192 #define PDC_SEED_ERROR  132             /* (sprockets)                  */
193
194 #define PDC_IO          135             /* log error info, reset IO system */
195 #define PDC_IO_READ_AND_CLEAR_ERRORS    0
196 #define PDC_IO_RESET                    1
197 #define PDC_IO_RESET_DEVICES            2
198 /* sets bits 6&7 (little endian) of the HcControl Register */
199 #define PDC_IO_USB_SUSPEND      0xC000000000000000
200 #define PDC_IO_EEPROM_IO_ERR_TABLE_FULL -5      /* return value */
201 #define PDC_IO_NO_SUSPEND               -6      /* return value */
202
203 #define PDC_BROADCAST_RESET 136         /* reset all processors         */
204 #define PDC_DO_RESET            0       /* option: perform a broadcast reset */
205 #define PDC_DO_FIRM_TEST_RESET  1       /* Do broadcast reset with bitmap */
206 #define PDC_BR_RECONFIGURATION  2       /* reset w/reconfiguration      */
207 #define PDC_FIRM_TEST_MAGIC     0xab9ec36fUL    /* for this reboot only */
208
209 #define PDC_LAN_STATION_ID 138          /* Hversion dependent mechanism for */
210 #define PDC_LAN_STATION_ID_READ 0       /* getting the lan station address  */
211
212 #define PDC_LAN_STATION_ID_SIZE 6
213
214 #define PDC_CHECK_RANGES 139            /* (sprockets)                  */
215
216 #define PDC_NV_SECTIONS 141             /* (sprockets)                  */
217
218 #define PDC_PERFORMANCE 142             /* performance monitoring       */
219
220 #define PDC_SYSTEM_INFO 143             /* system information           */
221 #define PDC_SYSINFO_RETURN_INFO_SIZE    0
222 #define PDC_SYSINFO_RRETURN_SYS_INFO    1
223 #define PDC_SYSINFO_RRETURN_ERRORS      2
224 #define PDC_SYSINFO_RRETURN_WARNINGS    3
225 #define PDC_SYSINFO_RETURN_REVISIONS    4
226 #define PDC_SYSINFO_RRETURN_DIAGNOSE    5
227 #define PDC_SYSINFO_RRETURN_HV_DIAGNOSE 1005
228
229 #define PDC_RDR         144             /* (sprockets)                  */
230 #define PDC_RDR_READ_BUFFER     0
231 #define PDC_RDR_READ_SINGLE     1
232 #define PDC_RDR_WRITE_SINGLE    2
233
234 #define PDC_INTRIGUE    145             /* (sprockets)                  */
235 #define PDC_INTRIGUE_WRITE_BUFFER        0
236 #define PDC_INTRIGUE_GET_SCRATCH_BUFSIZE 1
237 #define PDC_INTRIGUE_START_CPU_COUNTERS  2
238 #define PDC_INTRIGUE_STOP_CPU_COUNTERS   3
239
240 #define PDC_STI         146             /* STI access                   */
241 /* same as PDC_PCI_XXX values (see below) */
242
243 /* Legacy PDC definitions for same stuff */
244 #define PDC_PCI_INDEX   147
245 #define PDC_PCI_INTERFACE_INFO          0
246 #define PDC_PCI_SLOT_INFO               1
247 #define PDC_PCI_INFLIGHT_BYTES          2
248 #define PDC_PCI_READ_CONFIG             3
249 #define PDC_PCI_WRITE_CONFIG            4
250 #define PDC_PCI_READ_PCI_IO             5
251 #define PDC_PCI_WRITE_PCI_IO            6
252 #define PDC_PCI_READ_CONFIG_DELAY       7
253 #define PDC_PCI_UPDATE_CONFIG_DELAY     8
254 #define PDC_PCI_PCI_PATH_TO_PCI_HPA     9
255 #define PDC_PCI_PCI_HPA_TO_PCI_PATH     10
256 #define PDC_PCI_PCI_PATH_TO_PCI_BUS     11
257 #define PDC_PCI_PCI_RESERVED            12
258 #define PDC_PCI_PCI_INT_ROUTE_SIZE      13
259 #define PDC_PCI_GET_INT_TBL_SIZE        PDC_PCI_PCI_INT_ROUTE_SIZE
260 #define PDC_PCI_PCI_INT_ROUTE           14
261 #define PDC_PCI_GET_INT_TBL             PDC_PCI_PCI_INT_ROUTE 
262 #define PDC_PCI_READ_MON_TYPE           15
263 #define PDC_PCI_WRITE_MON_TYPE          16
264
265
266 /* Get SCSI Interface Card info:  SDTR, SCSI ID, mode (SE vs LVD) */
267 #define PDC_INITIATOR   163
268 #define PDC_GET_INITIATOR       0
269 #define PDC_SET_INITIATOR       1
270 #define PDC_DELETE_INITIATOR    2
271 #define PDC_RETURN_TABLE_SIZE   3
272 #define PDC_RETURN_TABLE        4
273
274 #define PDC_LINK        165             /* (sprockets)                  */
275 #define PDC_LINK_PCI_ENTRY_POINTS       0  /* list (Arg1) = 0 */
276 #define PDC_LINK_USB_ENTRY_POINTS       1  /* list (Arg1) = 1 */
277
278
279 /* constants for OS (NVM...) */
280 #define OS_ID_NONE              0       /* Undefined OS ID      */
281 #define OS_ID_HPUX              1       /* HP-UX OS             */
282 #define OS_ID_LINUX             OS_ID_HPUX /* just use the same value as hpux */
283 #define OS_ID_MPEXL             2       /* MPE XL OS            */
284 #define OS_ID_OSF               3       /* OSF OS               */
285 #define OS_ID_HPRT              4       /* HP-RT OS             */
286 #define OS_ID_NOVEL             5       /* NOVELL OS            */
287 #define OS_ID_NT                6       /* NT OS                */
288
289
290 /* constants for PDC_CHASSIS */
291 #define OSTAT_OFF               0
292 #define OSTAT_FLT               1 
293 #define OSTAT_TEST              2
294 #define OSTAT_INIT              3
295 #define OSTAT_SHUT              4
296 #define OSTAT_WARN              5
297 #define OSTAT_RUN               6
298 #define OSTAT_ON                7
299
300 #ifndef __ASSEMBLY__
301
302 #include <linux/types.h>
303
304 extern int pdc_type;
305
306 /* Values for pdc_type */
307 #define PDC_TYPE_ILLEGAL        -1
308 #define PDC_TYPE_PAT             0 /* 64-bit PAT-PDC */
309 #define PDC_TYPE_SYSTEM_MAP      1 /* 32-bit, but supports PDC_SYSTEM_MAP */
310 #define PDC_TYPE_SNAKE           2 /* Doesn't support SYSTEM_MAP */
311
312 struct pdc_chassis_info {       /* for PDC_CHASSIS_INFO */
313         unsigned long actcnt;   /* actual number of bytes returned */
314         unsigned long maxcnt;   /* maximum number of bytes that could be returned */
315 };
316
317 struct pdc_coproc_cfg {         /* for PDC_COPROC_CFG */
318         unsigned long ccr_functional;
319         unsigned long ccr_present;
320         unsigned long revision;
321         unsigned long model;
322 };
323
324 struct pdc_model {              /* for PDC_MODEL */
325         unsigned long hversion;
326         unsigned long sversion;
327         unsigned long hw_id;
328         unsigned long boot_id;
329         unsigned long sw_id;
330         unsigned long sw_cap;
331         unsigned long arch_rev;
332         unsigned long pot_key;
333         unsigned long curr_key;
334 };
335
336 /* Values for PDC_MODEL_CAPABILITES non-equivalent virtual aliasing support */
337
338 #define PDC_MODEL_IOPDIR_FDC            (1 << 2)        /* see sba_iommu.c */
339 #define PDC_MODEL_NVA_MASK              (3 << 4)
340 #define PDC_MODEL_NVA_SUPPORTED         (0 << 4)
341 #define PDC_MODEL_NVA_SLOW              (1 << 4)
342 #define PDC_MODEL_NVA_UNSUPPORTED       (3 << 4)
343
344 struct pdc_cache_cf {           /* for PDC_CACHE  (I/D-caches) */
345     unsigned long
346 #ifdef __LP64__
347                 cc_padW:32,
348 #endif
349                 cc_alias: 4,    /* alias boundaries for virtual addresses   */
350                 cc_block: 4,    /* to determine most efficient stride */
351                 cc_line : 3,    /* maximum amount written back as a result of store (multiple of 16 bytes) */
352                 cc_shift: 2,    /* how much to shift cc_block left */
353                 cc_wt   : 1,    /* 0 = WT-Dcache, 1 = WB-Dcache */
354                 cc_sh   : 2,    /* 0 = separate I/D-cache, else shared I/D-cache */
355                 cc_cst  : 3,    /* 0 = incoherent D-cache, 1=coherent D-cache */
356                 cc_pad1 : 5,    /* reserved */
357                 cc_assoc: 8;    /* associativity of I/D-cache */
358 };
359
360 struct pdc_tlb_cf {             /* for PDC_CACHE (I/D-TLB's) */
361     unsigned long tc_pad0:12,   /* reserved */
362 #ifdef __LP64__
363                 tc_padW:32,
364 #endif
365                 tc_sh   : 2,    /* 0 = separate I/D-TLB, else shared I/D-TLB */
366                 tc_hv   : 1,    /* HV */
367                 tc_page : 1,    /* 0 = 2K page-size-machine, 1 = 4k page size */
368                 tc_cst  : 3,    /* 0 = incoherent operations, else coherent operations */
369                 tc_aid  : 5,    /* ITLB: width of access ids of processor (encoded!) */
370                 tc_pad1 : 8;    /* ITLB: width of space-registers (encoded) */
371 };
372
373 struct pdc_cache_info {         /* main-PDC_CACHE-structure (caches & TLB's) */
374         /* I-cache */
375         unsigned long   ic_size;        /* size in bytes */
376         struct pdc_cache_cf ic_conf;    /* configuration */
377         unsigned long   ic_base;        /* base-addr */
378         unsigned long   ic_stride;
379         unsigned long   ic_count;
380         unsigned long   ic_loop;
381         /* D-cache */
382         unsigned long   dc_size;        /* size in bytes */
383         struct pdc_cache_cf dc_conf;    /* configuration */
384         unsigned long   dc_base;        /* base-addr */
385         unsigned long   dc_stride;
386         unsigned long   dc_count;
387         unsigned long   dc_loop;
388         /* Instruction-TLB */
389         unsigned long   it_size;        /* number of entries in I-TLB */
390         struct pdc_tlb_cf it_conf;      /* I-TLB-configuration */
391         unsigned long   it_sp_base;
392         unsigned long   it_sp_stride;
393         unsigned long   it_sp_count;
394         unsigned long   it_off_base;
395         unsigned long   it_off_stride;
396         unsigned long   it_off_count;
397         unsigned long   it_loop;
398         /* data-TLB */
399         unsigned long   dt_size;        /* number of entries in D-TLB */
400         struct pdc_tlb_cf dt_conf;      /* D-TLB-configuration */
401         unsigned long   dt_sp_base;
402         unsigned long   dt_sp_stride;
403         unsigned long   dt_sp_count;
404         unsigned long   dt_off_base;
405         unsigned long   dt_off_stride;
406         unsigned long   dt_off_count;
407         unsigned long   dt_loop;
408 };
409
410 #if 0
411 /* If you start using the next struct, you'll have to adjust it to
412  * work with 64-bit firmware I think -PB
413  */
414 struct pdc_iodc {     /* PDC_IODC */
415         unsigned char   hversion_model;
416         unsigned char   hversion;
417         unsigned char   spa;
418         unsigned char   type;
419         unsigned int    sversion_rev:4;
420         unsigned int    sversion_model:19;
421         unsigned int    sversion_opt:8;
422         unsigned char   rev;
423         unsigned char   dep;
424         unsigned char   features;
425         unsigned char   pad1;
426         unsigned int    checksum:16;
427         unsigned int    length:16;
428         unsigned int    pad[15];
429 } __attribute__((aligned(8))) ;
430 #endif
431
432 #ifndef CONFIG_PA20
433 /* no BLTBs in pa2.0 processors */
434 struct pdc_btlb_info_range {
435         __u8 res00;
436         __u8 num_i;
437         __u8 num_d;
438         __u8 num_comb;
439 };
440
441 struct pdc_btlb_info {  /* PDC_BLOCK_TLB, return of PDC_BTLB_INFO */
442         unsigned int min_size;  /* minimum size of BTLB in pages */
443         unsigned int max_size;  /* maximum size of BTLB in pages */
444         struct pdc_btlb_info_range fixed_range_info;
445         struct pdc_btlb_info_range variable_range_info;
446 };
447
448 #endif /* !CONFIG_PA20 */
449
450 #ifdef __LP64__
451 struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */
452         unsigned long entries_returned;
453         unsigned long entries_total;
454 };
455
456 struct pdc_memory_table {       /* PDC_MEM/PDC_MEM_TABLE (arguments) */
457         unsigned long paddr;
458         unsigned int  pages;
459         unsigned int  reserved;
460 };
461 #endif /* __LP64__ */
462
463 struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */
464         unsigned long mod_addr;
465         unsigned long mod_pgs;
466         unsigned long add_addrs;
467 };
468
469 struct pdc_system_map_addr_info { /* PDC_SYSTEM_MAP/FIND_ADDRESS */
470         unsigned long mod_addr;
471         unsigned long mod_pgs;
472 };
473
474 struct hardware_path {
475         char  flags;    /* see bit definitions below */
476         char  bc[6];    /* Bus Converter routing info to a specific */
477                         /* I/O adaptor (< 0 means none, > 63 resvd) */
478         char  mod;      /* fixed field of specified module */
479 };
480
481 /*
482  * Device path specifications used by PDC.
483  */
484 struct pdc_module_path {
485         struct hardware_path path;
486         unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */
487 };
488
489 #ifndef CONFIG_PA20
490 /* Only used on some pre-PA2.0 boxes */
491 struct pdc_memory_map {         /* PDC_MEMORY_MAP */
492         unsigned long hpa;      /* mod's register set address */
493         unsigned long more_pgs; /* number of additional I/O pgs */
494 };
495 #endif
496
497 struct pdc_tod {
498         unsigned long tod_sec; 
499         unsigned long tod_usec;
500 };
501
502 /* architected results from PDC_PIM/transfer hpmc on a PA1.1 machine */
503
504 struct pdc_hpmc_pim_11 { /* PDC_PIM */
505         __u32 gr[32];
506         __u32 cr[32];
507         __u32 sr[8];
508         __u32 iasq_back;
509         __u32 iaoq_back;
510         __u32 check_type;
511         __u32 cpu_state;
512         __u32 rsvd1;
513         __u32 cache_check;
514         __u32 tlb_check;
515         __u32 bus_check;
516         __u32 assists_check;
517         __u32 rsvd2;
518         __u32 assist_state;
519         __u32 responder_addr;
520         __u32 requestor_addr;
521         __u32 path_info;
522         __u64 fr[32];
523 };
524
525 /*
526  * architected results from PDC_PIM/transfer hpmc on a PA2.0 machine
527  *
528  * Note that PDC_PIM doesn't care whether or not wide mode was enabled
529  * so the results are different on  PA1.1 vs. PA2.0 when in narrow mode.
530  *
531  * Note also that there are unarchitected results available, which
532  * are hversion dependent. Do a "ser pim 0 hpmc" after rebooting, since
533  * the firmware is probably the best way of printing hversion dependent
534  * data.
535  */
536
537 struct pdc_hpmc_pim_20 { /* PDC_PIM */
538         __u64 gr[32];
539         __u64 cr[32];
540         __u64 sr[8];
541         __u64 iasq_back;
542         __u64 iaoq_back;
543         __u32 check_type;
544         __u32 cpu_state;
545         __u32 cache_check;
546         __u32 tlb_check;
547         __u32 bus_check;
548         __u32 assists_check;
549         __u32 assist_state;
550         __u32 path_info;
551         __u64 responder_addr;
552         __u64 requestor_addr;
553         __u64 fr[32];
554 };
555
556 #endif /* __ASSEMBLY__ */
557
558 /* flags of the device_path (see below) */
559 #define PF_AUTOBOOT     0x80
560 #define PF_AUTOSEARCH   0x40
561 #define PF_TIMER        0x0F
562
563 #ifndef __ASSEMBLY__
564
565 struct device_path {            /* page 1-69 */
566         unsigned char flags;    /* flags see above! */
567         unsigned char bc[6];    /* bus converter routing info */
568         unsigned char mod;
569         unsigned int  layers[6];/* device-specific layer-info */
570 } __attribute__((aligned(8))) ;
571
572 struct pz_device {
573         struct  device_path dp; /* see above */
574         /* struct       iomod *hpa; */
575         unsigned int hpa;       /* HPA base address */
576         /* char *spa; */
577         unsigned int spa;       /* SPA base address */
578         /* int  (*iodc_io)(struct iomod*, ...); */
579         unsigned int iodc_io;   /* device entry point */
580         short   pad;            /* reserved */
581         unsigned short cl_class;/* see below */
582 } __attribute__((aligned(8))) ;
583
584 #endif /* __ASSEMBLY__ */
585
586 /* cl_class
587  * page 3-33 of IO-Firmware ARS
588  * IODC ENTRY_INIT(Search first) RET[1]
589  */
590 #define CL_NULL         0       /* invalid */
591 #define CL_RANDOM       1       /* random access (as disk) */
592 #define CL_SEQU         2       /* sequential access (as tape) */
593 #define CL_DUPLEX       7       /* full-duplex point-to-point (RS-232, Net) */
594 #define CL_KEYBD        8       /* half-duplex console (HIL Keyboard) */
595 #define CL_DISPL        9       /* half-duplex console (display) */
596 #define CL_FC           10      /* FiberChannel access media */
597
598 #if 0
599 /* FIXME: DEVCLASS_* duplicates CL_* (above).  Delete DEVCLASS_*? */
600 #define DEVCLASS_RANDOM         1
601 #define DEVCLASS_SEQU           2
602 #define DEVCLASS_DUPLEX         7
603 #define DEVCLASS_KEYBD          8
604 #define DEVCLASS_DISP           9
605 #endif
606
607 /* IODC ENTRY_INIT() */
608 #define ENTRY_INIT_SRCH_FRST    2
609 #define ENTRY_INIT_SRCH_NEXT    3
610 #define ENTRY_INIT_MOD_DEV      4
611 #define ENTRY_INIT_DEV          5
612 #define ENTRY_INIT_MOD          6
613 #define ENTRY_INIT_MSG          9
614
615 /* IODC ENTRY_IO() */
616 #define ENTRY_IO_BOOTIN         0
617 #define ENTRY_IO_BOOTOUT        1
618 #define ENTRY_IO_CIN            2
619 #define ENTRY_IO_COUT           3
620 #define ENTRY_IO_CLOSE          4
621 #define ENTRY_IO_GETMSG         9
622 #define ENTRY_IO_BBLOCK_IN      16
623 #define ENTRY_IO_BBLOCK_OUT     17
624
625 /* IODC ENTRY_SPA() */
626
627 /* IODC ENTRY_CONFIG() */
628
629 /* IODC ENTRY_TEST() */
630
631 /* IODC ENTRY_TLB() */
632
633
634 /* DEFINITION OF THE ZERO-PAGE (PAG0) */
635 /* based on work by Jason Eckhardt (jason@equator.com) */
636
637 #ifndef __ASSEMBLY__
638
639 #define PAGE0   ((struct zeropage *)__PAGE_OFFSET)
640
641 struct zeropage {
642         /* [0x000] initialize vectors (VEC) */
643         unsigned int    vec_special;            /* must be zero */
644         /* int  (*vec_pow_fail)(void);*/
645         unsigned int    vec_pow_fail; /* power failure handler */
646         /* int  (*vec_toc)(void); */
647         unsigned int    vec_toc;
648         unsigned int    vec_toclen;
649         /* int  (*vec_rendz)(void); */
650         unsigned int vec_rendz;
651         int     vec_pow_fail_flen;
652         int     vec_pad[10];            
653         
654         /* [0x040] reserved processor dependent */
655         int     pad0[112];
656
657         /* [0x200] reserved */
658         int     pad1[84];
659
660         /* [0x350] memory configuration (MC) */
661         int     memc_cont;              /* contiguous mem size (bytes) */
662         int     memc_phsize;            /* physical memory size */
663         int     memc_adsize;            /* additional mem size, bytes of SPA space used by PDC */
664         unsigned int mem_pdc_hi;        /* used for 64-bit */
665
666         /* [0x360] various parameters for the boot-CPU */
667         /* unsigned int *mem_booterr[8]; */
668         unsigned int mem_booterr[8];    /* ptr to boot errors */
669         unsigned int mem_free;          /* first location, where OS can be loaded */
670         /* struct iomod *mem_hpa; */
671         unsigned int mem_hpa;           /* HPA of the boot-CPU */
672         /* int (*mem_pdc)(int, ...); */
673         unsigned int mem_pdc;           /* PDC entry point */
674         unsigned int mem_10msec;        /* number of clock ticks in 10msec */
675
676         /* [0x390] initial memory module (IMM) */
677         /* struct iomod *imm_hpa; */
678         unsigned int imm_hpa;           /* HPA of the IMM */
679         int     imm_soft_boot;          /* 0 = was hard boot, 1 = was soft boot */
680         unsigned int    imm_spa_size;           /* SPA size of the IMM in bytes */
681         unsigned int    imm_max_mem;            /* bytes of mem in IMM */
682
683         /* [0x3A0] boot console, display device and keyboard */
684         struct pz_device mem_cons;      /* description of console device */
685         struct pz_device mem_boot;      /* description of boot device */
686         struct pz_device mem_kbd;       /* description of keyboard device */
687
688         /* [0x430] reserved */
689         int     pad430[116];
690
691         /* [0x600] processor dependent */
692         __u32   pad600[1];
693         __u32   proc_sti;               /* pointer to STI ROM */
694         __u32   pad608[126];
695 };
696
697 #endif /* __ASSEMBLY__ */
698
699 /* Page Zero constant offsets used by the HPMC handler */
700
701 #define BOOT_CONSOLE_HPA_OFFSET  0x3c0
702 #define BOOT_CONSOLE_SPA_OFFSET  0x3c4
703 #define BOOT_CONSOLE_PATH_OFFSET 0x3a8
704
705 #ifndef __ASSEMBLY__
706 void pdc_console_init(void);    /* in pdc_console.c */
707 void pdc_console_restart(void);
708
709 void setup_pdc(void);           /* in inventory.c */
710
711 /* wrapper-functions from pdc.c */
712
713 int pdc_add_valid(unsigned long address);
714 int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
715 int pdc_chassis_disp(unsigned long disp);
716 int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info);
717 int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
718                   void *iodc_data, unsigned int iodc_data_size);
719 int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info,
720                              struct pdc_module_path *mod_path, long mod_index);
721 int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info, 
722                               long mod_index, long addr_index);
723 int pdc_model_info(struct pdc_model *model);
724 int pdc_model_sysmodel(char *name);
725 int pdc_model_cpuid(unsigned long *cpu_id);
726 int pdc_model_versions(unsigned long *versions, int id);
727 int pdc_model_capabilities(unsigned long *capabilities);
728 int pdc_cache_info(struct pdc_cache_info *cache);
729 #ifndef CONFIG_PA20
730 int pdc_btlb_info(struct pdc_btlb_info *btlb);
731 int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
732 #endif /* !CONFIG_PA20 */
733 int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
734
735 int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa);
736 int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl);
737
738 int pdc_get_initiator(struct hardware_path *hwpath, unsigned char *scsi_id, unsigned long *period, char *width, char *mode);
739 int pdc_tod_read(struct pdc_tod *tod);
740 int pdc_tod_set(unsigned long sec, unsigned long usec);
741
742 #ifdef __LP64__
743 int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
744                 struct pdc_memory_table *tbl, unsigned long entries);
745 #endif
746
747 void set_firmware_width(void);
748 int pdc_do_firm_test_reset(unsigned long ftc_bitmap);
749 int pdc_do_reset(void);
750 int pdc_soft_power_info(unsigned long *power_reg);
751 int pdc_soft_power_button(int sw_control);
752 void pdc_io_reset(void);
753 void pdc_io_reset_devices(void);
754 int pdc_iodc_getc(void);
755 void pdc_iodc_putc(unsigned char c);
756 void pdc_iodc_outc(unsigned char c);
757
758 void pdc_emergency_unlock(void);
759 int pdc_sti_call(unsigned long func, unsigned long flags,
760                  unsigned long inptr, unsigned long outputr,
761                  unsigned long glob_cfg);
762
763 extern void pdc_init(void);
764
765 #endif /* __ASSEMBLY__ */
766
767 #endif /* _PARISC_PDC_H */