18c2ecf20Sopenharmony_ci#ifndef __PARISC_PATPDC_H
28c2ecf20Sopenharmony_ci#define __PARISC_PATPDC_H
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
68c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
78c2ecf20Sopenharmony_ci * for more details.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Copyright 2000 (c) Hewlett Packard (Paul Bame <bame()spam.parisc-linux.org>)
108c2ecf20Sopenharmony_ci * Copyright 2000,2004 (c) Grant Grundler <grundler()nahspam.parisc-linux.org>
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define PDC_PAT_CELL           	64L   /* Interface for gaining and
158c2ecf20Sopenharmony_ci                                         * manipulatin g cell state within PD */
168c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_GET_NUMBER    0L   /* Return Cell number */
178c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_GET_INFO      1L   /* Returns info about Cell */
188c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_MODULE        2L   /* Returns info about Module */
198c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_SET_ATTENTION 9L   /* Set Cell Attention indicator */
208c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_NUMBER_TO_LOC 10L   /* Cell Number -> Location */
218c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_WALK_FABRIC   11L   /* Walk the Fabric */
228c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_GET_RDT_SIZE  12L   /* Return Route Distance Table Sizes */
238c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_GET_RDT       13L   /* Return Route Distance Tables */
248c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_GET_LOCAL_PDH_SZ 14L /* Read Local PDH Buffer Size */
258c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_SET_LOCAL_PDH    15L  /* Write Local PDH Buffer */
268c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_GET_REMOTE_PDH_SZ 16L /* Return Remote PDH Buffer Size */
278c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_GET_REMOTE_PDH 17L /* Read Remote PDH Buffer */
288c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_GET_DBG_INFO   128L  /* Return DBG Buffer Info */
298c2ecf20Sopenharmony_ci#define PDC_PAT_CELL_CHANGE_ALIAS   129L  /* Change Non-Equivalent Alias Chacking */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/*
338c2ecf20Sopenharmony_ci** Arg to PDC_PAT_CELL_MODULE memaddr[4]
348c2ecf20Sopenharmony_ci**
358c2ecf20Sopenharmony_ci** Addresses on the Merced Bus != all Runway Bus addresses.
368c2ecf20Sopenharmony_ci** This is intended for programming SBA/LBA chips range registers.
378c2ecf20Sopenharmony_ci*/
388c2ecf20Sopenharmony_ci#define IO_VIEW      0UL
398c2ecf20Sopenharmony_ci#define PA_VIEW      1UL
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* PDC_PAT_CELL_MODULE entity type values */
428c2ecf20Sopenharmony_ci#define	PAT_ENTITY_CA	0	/* central agent */
438c2ecf20Sopenharmony_ci#define	PAT_ENTITY_PROC	1	/* processor */
448c2ecf20Sopenharmony_ci#define	PAT_ENTITY_MEM	2	/* memory controller */
458c2ecf20Sopenharmony_ci#define	PAT_ENTITY_SBA	3	/* system bus adapter */
468c2ecf20Sopenharmony_ci#define	PAT_ENTITY_LBA	4	/* local bus adapter */
478c2ecf20Sopenharmony_ci#define	PAT_ENTITY_PBC	5	/* processor bus converter */
488c2ecf20Sopenharmony_ci#define	PAT_ENTITY_XBC	6	/* crossbar fabric connect */
498c2ecf20Sopenharmony_ci#define	PAT_ENTITY_RC	7	/* fabric interconnect */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* PDC_PAT_CELL_MODULE address range type values */
528c2ecf20Sopenharmony_ci#define PAT_PBNUM           0         /* PCI Bus Number */
538c2ecf20Sopenharmony_ci#define PAT_LMMIO           1         /* < 4G MMIO Space */
548c2ecf20Sopenharmony_ci#define PAT_GMMIO           2         /* > 4G MMIO Space */
558c2ecf20Sopenharmony_ci#define PAT_NPIOP           3         /* Non Postable I/O Port Space */
568c2ecf20Sopenharmony_ci#define PAT_PIOP            4         /* Postable I/O Port Space */
578c2ecf20Sopenharmony_ci#define PAT_AHPA            5         /* Addional HPA Space */
588c2ecf20Sopenharmony_ci#define PAT_UFO             6         /* HPA Space (UFO for Mariposa) */
598c2ecf20Sopenharmony_ci#define PAT_GNIP            7         /* GNI Reserved Space */
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* PDC PAT CHASSIS LOG -- Platform logging & forward progress functions */
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define PDC_PAT_CHASSIS_LOG		65L
668c2ecf20Sopenharmony_ci#define PDC_PAT_CHASSIS_WRITE_LOG    	0L /* Write Log Entry */
678c2ecf20Sopenharmony_ci#define PDC_PAT_CHASSIS_READ_LOG     	1L /* Read  Log Entry */
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* PDC PAT COMPLEX */
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define PDC_PAT_COMPLEX			66L
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* PDC PAT CPU  -- CPU configuration within the protection domain */
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define PDC_PAT_CPU                	67L
778c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_INFO            	0L /* Return CPU config info */
788c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_DELETE          	1L /* Delete CPU */
798c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_ADD             	2L /* Add    CPU */
808c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_GET_NUMBER      	3L /* Return CPU Number */
818c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_GET_HPA         	4L /* Return CPU HPA */
828c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_STOP            	5L /* Stop   CPU */
838c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_RENDEZVOUS      	6L /* Rendezvous CPU */
848c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_GET_CLOCK_INFO  	7L /* Return CPU Clock info */
858c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_GET_RENDEZVOUS_STATE 8L /* Return Rendezvous State */
868c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_PLUNGE_FABRIC 	128L /* Plunge Fabric */
878c2ecf20Sopenharmony_ci#define PDC_PAT_CPU_UPDATE_CACHE_CLEANSING 129L /* Manipulate Cache
888c2ecf20Sopenharmony_ci                                                 * Cleansing Mode */
898c2ecf20Sopenharmony_ci/*  PDC PAT EVENT -- Platform Events */
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define PDC_PAT_EVENT              	68L
928c2ecf20Sopenharmony_ci#define PDC_PAT_EVENT_GET_CAPS     	0L /* Get Capabilities */
938c2ecf20Sopenharmony_ci#define PDC_PAT_EVENT_SET_MODE     	1L /* Set Notification Mode */
948c2ecf20Sopenharmony_ci#define PDC_PAT_EVENT_SCAN         	2L /* Scan Event */
958c2ecf20Sopenharmony_ci#define PDC_PAT_EVENT_HANDLE       	3L /* Handle Event */
968c2ecf20Sopenharmony_ci#define PDC_PAT_EVENT_GET_NB_CALL  	4L /* Get Non-Blocking call Args */
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/*  PDC PAT HPMC -- Cause processor to go into spin loop, and wait
998c2ecf20Sopenharmony_ci *  			for wake up from Monarch Processor.
1008c2ecf20Sopenharmony_ci */
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#define PDC_PAT_HPMC               70L
1038c2ecf20Sopenharmony_ci#define PDC_PAT_HPMC_RENDEZ_CPU     0L /* go into spin loop */
1048c2ecf20Sopenharmony_ci#define PDC_PAT_HPMC_SET_PARAMS     1L /* Allows OS to specify intr which PDC
1058c2ecf20Sopenharmony_ci                                        * will use to interrupt OS during
1068c2ecf20Sopenharmony_ci                                        * machine check rendezvous */
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* parameters for PDC_PAT_HPMC_SET_PARAMS: */
1098c2ecf20Sopenharmony_ci#define HPMC_SET_PARAMS_INTR 	    1L /* Rendezvous Interrupt */
1108c2ecf20Sopenharmony_ci#define HPMC_SET_PARAMS_WAKE 	    2L /* Wake up processor */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/*  PDC PAT IO  -- On-line services for I/O modules */
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define PDC_PAT_IO                  71L
1168c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_SLOT_STATUS   	5L /* Get Slot Status Info*/
1178c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_LOC_FROM_HARDWARE 6L /* Get Physical Location from */
1188c2ecf20Sopenharmony_ci                                            /* Hardware Path */
1198c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_HARDWARE_FROM_LOC 7L /* Get Hardware Path from
1208c2ecf20Sopenharmony_ci                                             * Physical Location */
1218c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_PCI_CONFIG_FROM_HW 11L /* Get PCI Configuration
1228c2ecf20Sopenharmony_ci                                               * Address from Hardware Path */
1238c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_HW_FROM_PCI_CONFIG 12L /* Get Hardware Path
1248c2ecf20Sopenharmony_ci                                               * from PCI Configuration Address */
1258c2ecf20Sopenharmony_ci#define PDC_PAT_IO_READ_HOST_BRIDGE_INFO 13L  /* Read Host Bridge State Info */
1268c2ecf20Sopenharmony_ci#define PDC_PAT_IO_CLEAR_HOST_BRIDGE_INFO 14L /* Clear Host Bridge State Info*/
1278c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE 15L /* Get PCI INT Routing Table
1288c2ecf20Sopenharmony_ci                                                   * Size */
1298c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_PCI_ROUTING_TABLE  16L /* Get PCI INT Routing Table */
1308c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_HINT_TABLE_SIZE 	17L /* Get Hint Table Size */
1318c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_HINT_TABLE   	18L /* Get Hint Table */
1328c2ecf20Sopenharmony_ci#define PDC_PAT_IO_PCI_CONFIG_READ  	19L /* PCI Config Read */
1338c2ecf20Sopenharmony_ci#define PDC_PAT_IO_PCI_CONFIG_WRITE 	20L /* PCI Config Write */
1348c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_NUM_IO_SLOTS 	21L /* Get Number of I/O Bay Slots in
1358c2ecf20Sopenharmony_ci                                       		  * Cabinet */
1368c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_LOC_IO_SLOTS 	22L /* Get Physical Location of I/O */
1378c2ecf20Sopenharmony_ci                                   		     /* Bay Slots in Cabinet */
1388c2ecf20Sopenharmony_ci#define PDC_PAT_IO_BAY_STATUS_INFO  	28L /* Get I/O Bay Slot Status Info */
1398c2ecf20Sopenharmony_ci#define PDC_PAT_IO_GET_PROC_VIEW        29L /* Get Processor view of IO address */
1408c2ecf20Sopenharmony_ci#define PDC_PAT_IO_PROG_SBA_DIR_RANGE   30L /* Program directed range */
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci/* PDC PAT MEM  -- Manage memory page deallocation */
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define PDC_PAT_MEM            72L
1468c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_PD_INFO     	0L /* Return PDT info for PD       */
1478c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_PD_CLEAR    	1L /* Clear PDT for PD             */
1488c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_PD_READ     	2L /* Read PDT entries for PD      */
1498c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_PD_RESET    	3L /* Reset clear bit for PD       */
1508c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_CELL_INFO   	5L /* Return PDT info For Cell     */
1518c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_CELL_CLEAR  	6L /* Clear PDT For Cell           */
1528c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_CELL_READ   	7L /* Read PDT entries For Cell    */
1538c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_CELL_RESET  	8L /* Reset clear bit For Cell     */
1548c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_SETGM		9L /* Set Good Memory value        */
1558c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_ADD_PAGE		10L /* ADDs a page to the cell      */
1568c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_ADDRESS		11L /* Get Physical Location From   */
1578c2ecf20Sopenharmony_ci					    /* Memory Address               */
1588c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_GET_TXT_SIZE   	12L /* Get Formatted Text Size   */
1598c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_GET_PD_TXT     	13L /* Get PD Formatted Text     */
1608c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_GET_CELL_TXT   	14L /* Get Cell Formatted Text   */
1618c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_RD_STATE_INFO  	15L /* Read Mem Module State Info*/
1628c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_CLR_STATE_INFO 	16L /*Clear Mem Module State Info*/
1638c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_CLEAN_RANGE    	128L /*Clean Mem in specific range*/
1648c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_GET_TBL_SIZE   	131L /* Get Memory Table Size     */
1658c2ecf20Sopenharmony_ci#define PDC_PAT_MEM_GET_TBL        	132L /* Get Memory Table          */
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci/* PDC PAT NVOLATILE  --  Access Non-Volatile Memory */
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci#define PDC_PAT_NVOLATILE	73L
1718c2ecf20Sopenharmony_ci#define PDC_PAT_NVOLATILE_READ		0L /* Read Non-Volatile Memory   */
1728c2ecf20Sopenharmony_ci#define PDC_PAT_NVOLATILE_WRITE		1L /* Write Non-Volatile Memory  */
1738c2ecf20Sopenharmony_ci#define PDC_PAT_NVOLATILE_GET_SIZE	2L /* Return size of NVM         */
1748c2ecf20Sopenharmony_ci#define PDC_PAT_NVOLATILE_VERIFY	3L /* Verify contents of NVM     */
1758c2ecf20Sopenharmony_ci#define PDC_PAT_NVOLATILE_INIT		4L /* Initialize NVM             */
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/* PDC PAT PD */
1788c2ecf20Sopenharmony_ci#define PDC_PAT_PD		74L         /* Protection Domain Info   */
1798c2ecf20Sopenharmony_ci#define PDC_PAT_PD_GET_ADDR_MAP		0L  /* Get Address Map          */
1808c2ecf20Sopenharmony_ci#define PDC_PAT_PD_GET_PDC_INTERF_REV	1L  /* Get PDC Interface Revisions */
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci#define PDC_PAT_CAPABILITY_BIT_PDC_SERIALIZE	(1UL << 0)
1838c2ecf20Sopenharmony_ci#define PDC_PAT_CAPABILITY_BIT_PDC_POLLING	(1UL << 1)
1848c2ecf20Sopenharmony_ci#define PDC_PAT_CAPABILITY_BIT_PDC_NBC		(1UL << 2) /* non-blocking calls */
1858c2ecf20Sopenharmony_ci#define PDC_PAT_CAPABILITY_BIT_PDC_UFO		(1UL << 3)
1868c2ecf20Sopenharmony_ci#define PDC_PAT_CAPABILITY_BIT_PDC_IODC_32	(1UL << 4)
1878c2ecf20Sopenharmony_ci#define PDC_PAT_CAPABILITY_BIT_PDC_IODC_64	(1UL << 5)
1888c2ecf20Sopenharmony_ci#define PDC_PAT_CAPABILITY_BIT_PDC_HPMC_RENDEZ	(1UL << 6)
1898c2ecf20Sopenharmony_ci#define PDC_PAT_CAPABILITY_BIT_SIMULTANEOUS_PTLB (1UL << 7)
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci/* PDC_PAT_PD_GET_ADDR_MAP entry types */
1928c2ecf20Sopenharmony_ci#define PAT_MEMORY_DESCRIPTOR		1
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci/* PDC_PAT_PD_GET_ADDR_MAP memory types */
1958c2ecf20Sopenharmony_ci#define PAT_MEMTYPE_MEMORY		0
1968c2ecf20Sopenharmony_ci#define PAT_MEMTYPE_FIRMWARE		4
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci/* PDC_PAT_PD_GET_ADDR_MAP memory usage */
1998c2ecf20Sopenharmony_ci#define PAT_MEMUSE_GENERAL		0
2008c2ecf20Sopenharmony_ci#define PAT_MEMUSE_GI			128
2018c2ecf20Sopenharmony_ci#define PAT_MEMUSE_GNI			129
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/* PDC PAT REGISTER TOC */
2048c2ecf20Sopenharmony_ci#define PDC_PAT_REGISTER_TOC	75L
2058c2ecf20Sopenharmony_ci#define PDC_PAT_TOC_REGISTER_VECTOR	0L /* Register TOC Vector */
2068c2ecf20Sopenharmony_ci#define PDC_PAT_TOC_READ_VECTOR		1L /* Read TOC Vector     */
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci/* PDC PAT SYSTEM_INFO */
2098c2ecf20Sopenharmony_ci#define PDC_PAT_SYSTEM_INFO	76L
2108c2ecf20Sopenharmony_ci/* PDC_PAT_SYSTEM_INFO uses the same options as PDC_SYSTEM_INFO function. */
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
2138c2ecf20Sopenharmony_ci#include <linux/types.h>
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci#ifdef CONFIG_64BIT
2168c2ecf20Sopenharmony_ci#define is_pdc_pat()	(PDC_TYPE_PAT == pdc_type)
2178c2ecf20Sopenharmony_ciextern int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num);
2188c2ecf20Sopenharmony_ciextern int pdc_pat_get_irt(void *r_addr, unsigned long cell_num);
2198c2ecf20Sopenharmony_ci#else	/* ! CONFIG_64BIT */
2208c2ecf20Sopenharmony_ci/* No PAT support for 32-bit kernels...sorry */
2218c2ecf20Sopenharmony_ci#define is_pdc_pat()	(0)
2228c2ecf20Sopenharmony_ci#define pdc_pat_get_irt_size(num_entries, cell_numn)	PDC_BAD_PROC
2238c2ecf20Sopenharmony_ci#define pdc_pat_get_irt(r_addr, cell_num)		PDC_BAD_PROC
2248c2ecf20Sopenharmony_ci#endif	/* ! CONFIG_64BIT */
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_cistruct pdc_pat_cell_num {
2288c2ecf20Sopenharmony_ci	unsigned long cell_num;
2298c2ecf20Sopenharmony_ci	unsigned long cell_loc;
2308c2ecf20Sopenharmony_ci};
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cistruct pdc_pat_cpu_num {
2338c2ecf20Sopenharmony_ci	unsigned long cpu_num;
2348c2ecf20Sopenharmony_ci	unsigned long cpu_loc;
2358c2ecf20Sopenharmony_ci};
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_cistruct pdc_pat_mem_retinfo { /* PDC_PAT_MEM/PDC_PAT_MEM_PD_INFO (return info) */
2388c2ecf20Sopenharmony_ci	unsigned int ke;	/* bit 0: memory inside good memory? */
2398c2ecf20Sopenharmony_ci	unsigned int current_pdt_entries:16;
2408c2ecf20Sopenharmony_ci	unsigned int max_pdt_entries:16;
2418c2ecf20Sopenharmony_ci	unsigned long Cs_bitmap;
2428c2ecf20Sopenharmony_ci	unsigned long Ic_bitmap;
2438c2ecf20Sopenharmony_ci	unsigned long good_mem;
2448c2ecf20Sopenharmony_ci	unsigned long first_dbe_loc; /* first location of double bit error */
2458c2ecf20Sopenharmony_ci	unsigned long clear_time; /* last PDT clear time (since Jan 1970) */
2468c2ecf20Sopenharmony_ci};
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_cistruct pdc_pat_mem_cell_pdt_retinfo { /* PDC_PAT_MEM/PDC_PAT_MEM_CELL_INFO */
2498c2ecf20Sopenharmony_ci	u64 reserved:32;
2508c2ecf20Sopenharmony_ci	u64 cs:1;		/* clear status: cleared since the last call? */
2518c2ecf20Sopenharmony_ci	u64 current_pdt_entries:15;
2528c2ecf20Sopenharmony_ci	u64 ic:1;		/* interleaving had to be changed ? */
2538c2ecf20Sopenharmony_ci	u64 max_pdt_entries:15;
2548c2ecf20Sopenharmony_ci	unsigned long good_mem;
2558c2ecf20Sopenharmony_ci	unsigned long first_dbe_loc; /* first location of double bit error */
2568c2ecf20Sopenharmony_ci	unsigned long clear_time; /* last PDT clear time (since Jan 1970) */
2578c2ecf20Sopenharmony_ci};
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_cistruct pdc_pat_mem_read_pd_retinfo { /* PDC_PAT_MEM/PDC_PAT_MEM_PD_READ */
2618c2ecf20Sopenharmony_ci	unsigned long actual_count_bytes;
2628c2ecf20Sopenharmony_ci	unsigned long pdt_entries;
2638c2ecf20Sopenharmony_ci};
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_cistruct pdc_pat_mem_phys_mem_location { /* PDC_PAT_MEM/PDC_PAT_MEM_ADDRESS */
2668c2ecf20Sopenharmony_ci	u64 cabinet:8;
2678c2ecf20Sopenharmony_ci	u64 ign1:8;
2688c2ecf20Sopenharmony_ci	u64 ign2:8;
2698c2ecf20Sopenharmony_ci	u64 cell_slot:8;
2708c2ecf20Sopenharmony_ci	u64 ign3:8;
2718c2ecf20Sopenharmony_ci	u64 dimm_slot:8; /* DIMM slot, e.g. 0x1A, 0x2B, show user hex value! */
2728c2ecf20Sopenharmony_ci	u64 ign4:8;
2738c2ecf20Sopenharmony_ci	u64 source:4; /* for mem: always 0x07 */
2748c2ecf20Sopenharmony_ci	u64 source_detail:4; /* for mem: always 0x04 (SIMM or DIMM) */
2758c2ecf20Sopenharmony_ci};
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_cistruct pdc_pat_pd_addr_map_entry {
2788c2ecf20Sopenharmony_ci	unsigned char entry_type;       /* 1 = Memory Descriptor Entry Type */
2798c2ecf20Sopenharmony_ci	unsigned char reserve1[5];
2808c2ecf20Sopenharmony_ci	unsigned char memory_type;
2818c2ecf20Sopenharmony_ci	unsigned char memory_usage;
2828c2ecf20Sopenharmony_ci	unsigned long paddr;
2838c2ecf20Sopenharmony_ci	unsigned int  pages;            /* Length in 4K pages */
2848c2ecf20Sopenharmony_ci	unsigned int  reserve2;
2858c2ecf20Sopenharmony_ci	unsigned long cell_map;
2868c2ecf20Sopenharmony_ci};
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci/********************************************************************
2898c2ecf20Sopenharmony_ci* PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr
2908c2ecf20Sopenharmony_ci* ----------------------------------------------------------
2918c2ecf20Sopenharmony_ci* Bit  0 to 51 - conf_base_addr
2928c2ecf20Sopenharmony_ci* Bit 52 to 62 - reserved
2938c2ecf20Sopenharmony_ci* Bit       63 - endianess bit
2948c2ecf20Sopenharmony_ci********************************************************************/
2958c2ecf20Sopenharmony_ci#define PAT_GET_CBA(value) ((value) & 0xfffffffffffff000UL)
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci/********************************************************************
2988c2ecf20Sopenharmony_ci* PDC_PAT_CELL[Return Cell Module] memaddr[1] mod_info
2998c2ecf20Sopenharmony_ci* ----------------------------------------------------
3008c2ecf20Sopenharmony_ci* Bit  0 to  7 - entity type
3018c2ecf20Sopenharmony_ci*    0 = central agent,            1 = processor,
3028c2ecf20Sopenharmony_ci*    2 = memory controller,        3 = system bus adapter,
3038c2ecf20Sopenharmony_ci*    4 = local bus adapter,        5 = processor bus converter,
3048c2ecf20Sopenharmony_ci*    6 = crossbar fabric connect,  7 = fabric interconnect,
3058c2ecf20Sopenharmony_ci*    8 to 254 reserved,            255 = unknown.
3068c2ecf20Sopenharmony_ci* Bit  8 to 15 - DVI
3078c2ecf20Sopenharmony_ci* Bit 16 to 23 - IOC functions
3088c2ecf20Sopenharmony_ci* Bit 24 to 39 - reserved
3098c2ecf20Sopenharmony_ci* Bit 40 to 63 - mod_pages
3108c2ecf20Sopenharmony_ci*    number of 4K pages a module occupies starting at conf_base_addr
3118c2ecf20Sopenharmony_ci********************************************************************/
3128c2ecf20Sopenharmony_ci#define PAT_GET_ENTITY(value)	(((value) >> 56) & 0xffUL)
3138c2ecf20Sopenharmony_ci#define PAT_GET_DVI(value)	(((value) >> 48) & 0xffUL)
3148c2ecf20Sopenharmony_ci#define PAT_GET_IOC(value)	(((value) >> 40) & 0xffUL)
3158c2ecf20Sopenharmony_ci#define PAT_GET_MOD_PAGES(value) ((value) & 0xffffffUL)
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci/*
3198c2ecf20Sopenharmony_ci** PDC_PAT_CELL_GET_INFO return block
3208c2ecf20Sopenharmony_ci*/
3218c2ecf20Sopenharmony_citypedef struct pdc_pat_cell_info_rtn_block {
3228c2ecf20Sopenharmony_ci	unsigned long pdc_rev;
3238c2ecf20Sopenharmony_ci	unsigned long capabilities; /* see PDC_PAT_CAPABILITY_BIT_* */
3248c2ecf20Sopenharmony_ci	unsigned long reserved0[2];
3258c2ecf20Sopenharmony_ci	unsigned long cell_info;	/* 0x20 */
3268c2ecf20Sopenharmony_ci	unsigned long cell_phys_location;
3278c2ecf20Sopenharmony_ci	unsigned long cpu_info;
3288c2ecf20Sopenharmony_ci	unsigned long cpu_speed;
3298c2ecf20Sopenharmony_ci	unsigned long io_chassis_phys_location;
3308c2ecf20Sopenharmony_ci	unsigned long cell_io_information;
3318c2ecf20Sopenharmony_ci	unsigned long reserved1[2];
3328c2ecf20Sopenharmony_ci	unsigned long io_slot_info_size; /* 0x60 */
3338c2ecf20Sopenharmony_ci	struct {
3348c2ecf20Sopenharmony_ci		unsigned long header, info0, info1;
3358c2ecf20Sopenharmony_ci		unsigned long phys_loc, hw_path;
3368c2ecf20Sopenharmony_ci	} io_slot[16];
3378c2ecf20Sopenharmony_ci	unsigned long cell_mem_size;	/* 0x2e8 */
3388c2ecf20Sopenharmony_ci	unsigned long cell_dimm_info_size;
3398c2ecf20Sopenharmony_ci	unsigned long dimm_info[16];
3408c2ecf20Sopenharmony_ci	unsigned long fabric_info_size;	/* 0x3f8 */
3418c2ecf20Sopenharmony_ci	struct {			/* 0x380 */
3428c2ecf20Sopenharmony_ci		unsigned long fabric_info_xbc_port;
3438c2ecf20Sopenharmony_ci		unsigned long rc_attached_to_xbc;
3448c2ecf20Sopenharmony_ci	} xbc[8*4];
3458c2ecf20Sopenharmony_ci} pdc_pat_cell_info_rtn_block_t;
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/* FIXME: mod[508] should really be a union of the various mod components */
3498c2ecf20Sopenharmony_cistruct pdc_pat_cell_mod_maddr_block {	/* PDC_PAT_CELL_MODULE */
3508c2ecf20Sopenharmony_ci	unsigned long cba;		/* func 0 cfg space address */
3518c2ecf20Sopenharmony_ci	unsigned long mod_info;		/* module information */
3528c2ecf20Sopenharmony_ci	unsigned long mod_location;	/* physical location of the module */
3538c2ecf20Sopenharmony_ci	struct hardware_path mod_path;	/* module path (device path - layers) */
3548c2ecf20Sopenharmony_ci	unsigned long mod[508];		/* PAT cell module components */
3558c2ecf20Sopenharmony_ci} __attribute__((aligned(8))) ;
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_citypedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t;
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ciextern int pdc_pat_chassis_send_log(unsigned long status, unsigned long data);
3618c2ecf20Sopenharmony_ciextern int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info);
3628c2ecf20Sopenharmony_ciextern int pdc_pat_cell_info(struct pdc_pat_cell_info_rtn_block *info,
3638c2ecf20Sopenharmony_ci		unsigned long *actcnt, unsigned long offset,
3648c2ecf20Sopenharmony_ci		unsigned long cell_number);
3658c2ecf20Sopenharmony_ciextern int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc,
3668c2ecf20Sopenharmony_ci		unsigned long mod, unsigned long view_type, void *mem_addr);
3678c2ecf20Sopenharmony_ciextern int pdc_pat_cell_num_to_loc(void *, unsigned long);
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ciextern int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, unsigned long hpa);
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ciextern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
3728c2ecf20Sopenharmony_ci		unsigned long count, unsigned long offset);
3738c2ecf20Sopenharmony_ciextern int pdc_pat_pd_get_pdc_revisions(unsigned long *legacy_rev,
3748c2ecf20Sopenharmony_ci		unsigned long *pat_rev, unsigned long *pdc_cap);
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ciextern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val);
3778c2ecf20Sopenharmony_ciextern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val);
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ciextern int pdc_pat_mem_pdt_info(struct pdc_pat_mem_retinfo *rinfo);
3808c2ecf20Sopenharmony_ciextern int pdc_pat_mem_pdt_cell_info(struct pdc_pat_mem_cell_pdt_retinfo *rinfo,
3818c2ecf20Sopenharmony_ci		unsigned long cell);
3828c2ecf20Sopenharmony_ciextern int pdc_pat_mem_read_cell_pdt(struct pdc_pat_mem_read_pd_retinfo *pret,
3838c2ecf20Sopenharmony_ci		unsigned long *pdt_entries_ptr, unsigned long max_entries);
3848c2ecf20Sopenharmony_ciextern int pdc_pat_mem_read_pd_pdt(struct pdc_pat_mem_read_pd_retinfo *pret,
3858c2ecf20Sopenharmony_ci		unsigned long *pdt_entries_ptr, unsigned long count,
3868c2ecf20Sopenharmony_ci		unsigned long offset);
3878c2ecf20Sopenharmony_ciextern int pdc_pat_mem_get_dimm_phys_location(
3888c2ecf20Sopenharmony_ci                struct pdc_pat_mem_phys_mem_location *pret,
3898c2ecf20Sopenharmony_ci                unsigned long phys_addr);
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci#endif /* ! __PARISC_PATPDC_H */
394