xref: /titanic_51/usr/src/uts/common/sys/pcic_var.h (revision 459fbba0bc115fe006d3634487b686fa707e1fbf)
13db86aabSstevel /*
23db86aabSstevel  * CDDL HEADER START
33db86aabSstevel  *
43db86aabSstevel  * The contents of this file are subject to the terms of the
53db86aabSstevel  * Common Development and Distribution License (the "License").
63db86aabSstevel  * You may not use this file except in compliance with the License.
73db86aabSstevel  *
83db86aabSstevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93db86aabSstevel  * or http://www.opensolaris.org/os/licensing.
103db86aabSstevel  * See the License for the specific language governing permissions
113db86aabSstevel  * and limitations under the License.
123db86aabSstevel  *
133db86aabSstevel  * When distributing Covered Code, include this CDDL HEADER in each
143db86aabSstevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153db86aabSstevel  * If applicable, add the following below this CDDL HEADER, with the
163db86aabSstevel  * fields enclosed by brackets "[]" replaced with your own identifying
173db86aabSstevel  * information: Portions Copyright [yyyy] [name of copyright owner]
183db86aabSstevel  *
193db86aabSstevel  * CDDL HEADER END
203db86aabSstevel  */
213db86aabSstevel 
223db86aabSstevel /*
23*8134ee03Srw148561  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
243db86aabSstevel  * Use is subject to license terms.
253db86aabSstevel  */
263db86aabSstevel 
273db86aabSstevel /*
283db86aabSstevel  * PCIC driver specific data structures
293db86aabSstevel  */
303db86aabSstevel 
313db86aabSstevel #ifndef _PCIC_VAR_H
323db86aabSstevel #define	_PCIC_VAR_H
333db86aabSstevel 
343db86aabSstevel #pragma ident	"%Z%%M%	%I%	%E% SMI"
353db86aabSstevel 
363db86aabSstevel #ifdef	__cplusplus
373db86aabSstevel extern "C" {
383db86aabSstevel #endif
393db86aabSstevel 
403db86aabSstevel /*
413db86aabSstevel  * defines and default values for power management simulation
423db86aabSstevel  */
433db86aabSstevel #define	PCIC_PM_TIME		3	/* PM timer timeout time in secs */
443db86aabSstevel #define	PCIC_PM_DETWIN		6	/* detection window in secs */
453db86aabSstevel #define	PCIC_PM_METHOD_TIME	0x0001	/* use time check */
463db86aabSstevel #define	PCIC_PM_METHOD_REG	0x0002	/* use reg check */
473db86aabSstevel #define	PCIC_PM_DEF_METHOD	0	/* use no methods as default */
483db86aabSstevel 
493db86aabSstevel #define	PCIC_PM_INIT	0x0001	/* init PM handler */
503db86aabSstevel #define	PCIC_PM_RUN	0x0002	/* normal PM handler operation */
513db86aabSstevel 
523db86aabSstevel typedef struct pcic_pm_t {
533db86aabSstevel 	int		state;	/* state */
543db86aabSstevel 	uint32_t	ptime;	/* previous time check */
553db86aabSstevel 	dev_info_t	*dip;	/* dip to pass */
563db86aabSstevel } pcic_pm_t;
573db86aabSstevel 
583db86aabSstevel /*
593db86aabSstevel  * Card insertion/removal processing debounce parameters
603db86aabSstevel  */
613db86aabSstevel #define	PCIC_REM_DEBOUNCE_CNT	40
623db86aabSstevel #define	PCIC_REM_DEBOUNCE_TIME	0x1000	/* in uS */
633db86aabSstevel #define	PCIC_DEBOUNCE_OK_CNT    10
643db86aabSstevel 
653db86aabSstevel /*
663db86aabSstevel  * Loop control in pcic_ready_wait
673db86aabSstevel  *
683db86aabSstevel  * Multiplying PCIC_READY_WAIT_LOOPS * PCIC_READY_WAIT_TIME gives
693db86aabSstevel  *	total loop time in mS
703db86aabSstevel  */
713db86aabSstevel #define	PCIC_READY_WAIT_LOOPS	205	/* count */
723db86aabSstevel #define	PCIC_READY_WAIT_TIME	20	/* mS */
733db86aabSstevel 
743db86aabSstevel typedef struct pcs_memwin {
753db86aabSstevel 	int			pcw_status;
763db86aabSstevel 	uint32_t		pcw_base;
773db86aabSstevel 	int			pcw_len;
783db86aabSstevel 	uint32_t		pcw_speed;
793db86aabSstevel 	volatile caddr_t	pcw_hostmem;
803db86aabSstevel 	off_t			pcw_offset;
813db86aabSstevel 	ddi_acc_handle_t	pcw_handle;
82*8134ee03Srw148561 	dev_info_t		*res_dip; /* dip from which mem is allocated */
833db86aabSstevel } pcs_memwin_t;
843db86aabSstevel 
853db86aabSstevel typedef struct pci_iowin {
863db86aabSstevel 	int 			pcw_status;
873db86aabSstevel 	uint32_t		pcw_base;
883db86aabSstevel 	int			pcw_len;
893db86aabSstevel 	uint32_t		pcw_speed;
903db86aabSstevel 	volatile caddr_t	pcw_hostmem;
913db86aabSstevel 				/* Cirrus Logic specific offset info */
923db86aabSstevel 	int			pcw_offset;
933db86aabSstevel 	ddi_acc_handle_t	pcw_handle;
94*8134ee03Srw148561 	dev_info_t		*res_dip; /* dip from which io is allocated */
953db86aabSstevel } pcs_iowin_t;
963db86aabSstevel 
973db86aabSstevel #define	PCW_MAPPED	0x0001	/* window is mapped */
983db86aabSstevel #define	PCW_ENABLED	0x0002	/* window is enabled */
993db86aabSstevel #define	PCW_ATTRIBUTE	0x0004	/* window is in attribute memory */
1003db86aabSstevel #define	PCW_WP		0x0008	/* window is write protected */
1013db86aabSstevel #define	PCW_OFFSET	0x0010	/* window uses CL style offset */
1023db86aabSstevel 
1033db86aabSstevel typedef
1043db86aabSstevel struct pcic_socket {
1053db86aabSstevel 	int	pcs_flags;
1063db86aabSstevel 	uchar_t	*pcs_io;	/* I/O address of PCIC controller */
1073db86aabSstevel 	int	pcs_socket;	/* socket to determine register set */
1083db86aabSstevel 	char    pcs_cd_softint_flg;
1093db86aabSstevel 	timeout_id_t pcs_debounce_id;	/* timeout for CD debounce */
1103db86aabSstevel 	ddi_softint_handle_t pcs_cd_softint_hdl; /* Debounce softint id */
1113db86aabSstevel 	struct pcicdev_t *pcs_pcic;
1123db86aabSstevel 	caddr_t pcs_phys;
1133db86aabSstevel 	int	pcs_iobase;
1143db86aabSstevel 	int	pcs_iolen;
1153db86aabSstevel 	caddr_t pcs_confbase;
1163db86aabSstevel 	int	pcs_conflen;
1173db86aabSstevel 	int	pcs_conf_index;	/* used to select which cftable entry to use */
1183db86aabSstevel 	int 	pcs_irq;
1193db86aabSstevel 	int	pcs_smi;
1203db86aabSstevel 	int	pcs_state;
1213db86aabSstevel 	int	pcs_status;
1223db86aabSstevel 	int	pcs_intmask;
1233db86aabSstevel 	uint32_t pcs_vcc;
1243db86aabSstevel 	uint32_t pcs_vpp1;
1253db86aabSstevel 	uint32_t pcs_vpp2;
1263db86aabSstevel 	union pcic_window {
1273db86aabSstevel 		pcs_memwin_t mem;
1283db86aabSstevel 		pcs_iowin_t  io;
1293db86aabSstevel 	}	pcs_windows[PCIC_IOWINDOWS + PCIC_MEMWINDOWS];
1303db86aabSstevel } pcic_socket_t;
1313db86aabSstevel 
1323db86aabSstevel #define	PCS_CARD_PRESENT	0x0001	/* card inserted in socket */
1333db86aabSstevel #define	PCS_CARD_IDENTIFIED	0x0002	/* card has been identified */
1343db86aabSstevel #define	PCS_CARD_ENABLED	0x0004	/* card and socket enabled */
1353db86aabSstevel #define	PCS_CARD_WPS		0x0008	/* write protect ignored */
1363db86aabSstevel #define	PCS_IRQ_ENABLED		0x0010	/* irq is a mask of values */
1373db86aabSstevel #define	PCS_CARD_RAM		0x0020	/* ram needs to be mapped */
1383db86aabSstevel #define	PCS_CARD_IO		0x0040	/* card is I/O type */
1393db86aabSstevel #define	PCS_CARD_16BIT		0x0080	/* set in 16-bit mode */
1403db86aabSstevel #define	PCS_SOCKET_IO		0x0100	/* socket is I/O type */
1413db86aabSstevel #define	PCS_READY		0x0200	/* socket just came ready */
1423db86aabSstevel #define	PCS_WAITING		0x0400	/* Doing a wait on this socket */
1433db86aabSstevel #define	PCS_STARTING		0x0800	/* Starting up flag */
1443db86aabSstevel #define	PCS_CARD_ISCARDBUS	0x1000	/* NJH - 32 bit (CARDBUS) card */
1453db86aabSstevel #define	PCS_CARD_IS16BIT	0x2000	/* So we can tell if it's OK */
1463db86aabSstevel #define	PCS_CARD_REMOVED	0x4000	/* Removed but still work to do */
1473db86aabSstevel #define	PCS_CARD_CBREM		0x8000	/* Cardbus specific work to do */
1480d282d13Srw148561 #define	PCS_DEBOUNCING		0x10000  /* Socket in debouncing state */
1493db86aabSstevel 
1503db86aabSstevel #define	PCIC_MAX_SOCKETS 4	/* 2 per chip up to 2 chips per IO addr */
1513db86aabSstevel 
1523db86aabSstevel typedef struct pcic_debounce_state {
1533db86aabSstevel 	int insert_cnt;
1543db86aabSstevel 	int remove_cnt;
1553db86aabSstevel 	int uncertain_cnt;
1563db86aabSstevel 	int prev_status;
1573db86aabSstevel 	int debounce_cnt;
1583db86aabSstevel 	timeout_id_t timeout_id;
1593db86aabSstevel } pcic_debounce_state_t;
1603db86aabSstevel 
1613db86aabSstevel typedef struct pcicdev_t {
1623db86aabSstevel 	uint32_t		pc_flags;
1633db86aabSstevel 	uint32_t		pc_type;
1643db86aabSstevel 	char			*pc_chipname;
1653db86aabSstevel 	uint32_t		pc_irqs;	/* the possible IRQ levels */
1663db86aabSstevel 	uint32_t		pc_smi;		/* SMI IRQ */
1673db86aabSstevel 	uint32_t		pc_irq;		/* IO IRQ */
1683db86aabSstevel 	int			pc_io_type;
1693db86aabSstevel 	int			pc_intr_mode;	/* which interrupt method */
1703db86aabSstevel 	dev_info_t		*dip;
1713db86aabSstevel 	ddi_idevice_cookie_t	pc_dcookie;	/* Stay compatible w/ PCMCIA */
1723db86aabSstevel 	inthandler_t		*sirq[14];	/* List for each level */
1733db86aabSstevel 	uint16_t		si_actflg;	/* Bit for each active level */
1743db86aabSstevel 	inthandler_t		*irq_top;
1753db86aabSstevel 	inthandler_t		*irq_current;
1763db86aabSstevel 	ddi_intr_handle_t	*pc_pci_intr_hdlp; /* For PCI based adapters */
1773db86aabSstevel 	ddi_iblock_cookie_t	pc_pri;		/* Priority saved for mutexes */
1783db86aabSstevel 	ddi_intr_handle_t	*pc_intr_htblp;	/* ISA: interrupt handles */
1793db86aabSstevel 	ddi_softint_handle_t	pc_softint_hdl;	/* Softinterrupt handle */
1803db86aabSstevel 	kmutex_t		pc_lock;	/* general register lock */
1813db86aabSstevel 	kmutex_t		intr_lock;	/* protects fields modified */
1823db86aabSstevel 						/* in pcic_intr() */
1833db86aabSstevel 	int			pc_numsockets;
1843db86aabSstevel 				/* used to inform nexus of events */
1853db86aabSstevel 	int			(*pc_callback)();
1863db86aabSstevel 	int			pc_cb_arg;
1873db86aabSstevel 	int			(*pc_ss_bios)();
1883db86aabSstevel 	struct pcic_socket	pc_sockets[PCIC_MAX_SOCKETS];
1893db86aabSstevel 	int			pc_numpower;
1903db86aabSstevel 	struct power_entry	*pc_power;
1913db86aabSstevel 	timeout_id_t		pc_pmtimer;	/* timeout for simulating PM */
1923db86aabSstevel 	pcic_pm_t		pmt;		/* PM handler structure */
1933db86aabSstevel 	kcondvar_t		pm_cv;		/* CV for suspend/resume sync */
1943db86aabSstevel 	ddi_acc_handle_t	handle;		/* PCIC register handle */
1953db86aabSstevel 	ddi_acc_handle_t	cfg_handle;	/* PCIC config space handle */
1963db86aabSstevel 	uchar_t			*cfgaddr;	/* config address */
1973db86aabSstevel 	uchar_t			*ioaddr;	/* PCIC register IO base */
1983db86aabSstevel 	int			mem_reg_num;	/* memory space reg number */
1993db86aabSstevel 	offset_t		mem_reg_offset;
2003db86aabSstevel 	int			io_reg_num;	/* IO space reg number */
2013db86aabSstevel 	offset_t		io_reg_offset;
2023db86aabSstevel 	int			bus_speed;	/* parent bus speed */
2033db86aabSstevel 	uint32_t		pc_timestamp;   /* last time touched */
2043db86aabSstevel 	inthandler_t		*pc_handlers;
2053db86aabSstevel 	int			pc_lastreg;
2063db86aabSstevel 	uint32_t		pc_base;	/* first possible mem-addr */
2073db86aabSstevel 	uint32_t		pc_bound;	/* bound length */
2083db86aabSstevel 	uint32_t		pc_iobase;	/* first io addr */
2093db86aabSstevel 	uint32_t		pc_iobound;
2103db86aabSstevel 	pcic_debounce_state_t   deb_state[PCIC_MAX_SOCKETS];
2113db86aabSstevel 	int			pc_softintr_req[PCIC_MAX_SOCKETS];
2123db86aabSstevel 	struct pcic_cd_change_param {
2133db86aabSstevel 		struct pcicdev_t	*pcic;
2143db86aabSstevel 		pcic_socket_t		*sockp;
2153db86aabSstevel 		int			sn;
2163db86aabSstevel 	}  pcic_cd_change_param[PCIC_MAX_SOCKETS];
2173db86aabSstevel } pcicdev_t;
2183db86aabSstevel 
2193db86aabSstevel 
2203db86aabSstevel 
2213db86aabSstevel #define	PCF_ATTACHED	0x00000001
2223db86aabSstevel #define	PCF_CALLBACK	0x00000002	/* callback handler registered */
2233db86aabSstevel #define	PCF_GPI_EJECT	0x00000004	/* GPI signal is eject/insert */
2243db86aabSstevel #define	PCF_INTRENAB	0x00000008
2253db86aabSstevel #define	PCF_USE_SMI	0x00000010	/* use the SMI enable */
2263db86aabSstevel #define	PCF_AUDIO	0x00000020	/* use audio if available */
2273db86aabSstevel #define	PCF_SUSPENDED	0x00000040	/* driver attached but suspended */
2283db86aabSstevel #define	PCF_EXTEND_INTR	0x00000080	/* Use Vadem interrupt sharing */
2293db86aabSstevel #define	PCF_1SOCKET	0x00000100	/* Chip only has one socket  */
2303db86aabSstevel #define	PCF_33VCAP	0x00000200	/* 3.3 Volt capable and coded */
2313db86aabSstevel #define	PCF_CBPWRCTL	0x00000400	/* Use cardbus regs for power ctl */
2323db86aabSstevel #define	PCF_DEBOUNCE	0x00002000	/* Chip has hardware debounce enabled */
2333db86aabSstevel #define	PCF_VPPX	0x00004000	/* Vpp1 and Vpp2 tied together */
2343db86aabSstevel #define	PCF_EXTBUFF	0x00008000	/* Chip strapped for external buffers */
2353db86aabSstevel #define	PCF_PCIBUS	0x00010000	/* this instance on a PCI bus */
2363db86aabSstevel #define	PCF_NOIO_OFF	0x00020000	/* 0 offset for IO mapping */
2373db86aabSstevel #define	PCF_MULT_IRQ	0x00040000
2383db86aabSstevel #define	PCF_IO_REMAP	0x00080000	/* adapter can remap I/O */
2393db86aabSstevel #define	PCF_CARDBUS	0x00100000	/* Yenta CardBus */
2403db86aabSstevel #define	PCF_MEM_PAGE	0x00200000	/* all windows same 16M page */
2413db86aabSstevel 
2423db86aabSstevel /* newer features */
2433db86aabSstevel #define	PCF_DMA		0x00400000	/* supports DMA */
2443db86aabSstevel #define	PCF_ZV		0x00800000	/* supports Zoom Video */
2453db86aabSstevel 
2463db86aabSstevel #define	PCF_ISA6729	0x01000000	/* 6729 */
2473db86aabSstevel 
2483db86aabSstevel /*
2493db86aabSstevel  * misc flags
2503db86aabSstevel  */
2513db86aabSstevel #define	PCIC_FOUND_ADAPTER	0x00000001
2523db86aabSstevel #define	PCIC_ENABLE_IO		0x00000002
2533db86aabSstevel #define	PCIC_ENABLE_MEM		0x00000004
2543db86aabSstevel 
2553db86aabSstevel #define	PCIC_SOFTINT_PRI_VAL	0x04	/* value used while adding softint */
2563db86aabSstevel 
2573db86aabSstevel /*
2583db86aabSstevel  * interrupt modes
2593db86aabSstevel  * the pcic variants provide a number of interrupt modes.
2603db86aabSstevel  * e.g. on PCI, we can either use PCI interrupts or ISA interrupts
2613db86aabSstevel  * but the SPARC version must use PCI interrupts and x86 "depends"
2623db86aabSstevel  */
2633db86aabSstevel 
2643db86aabSstevel #define	PCIC_INTR_MODE_ISA	00 /* default- use ISA mode */
2653db86aabSstevel #define	PCIC_INTR_MODE_PCI	01 /* use pure PCI */
2663db86aabSstevel #define	PCIC_INTR_MODE_PCI_1	02 /* use pure PCI but share */
2673db86aabSstevel #define	PCIC_INTR_MODE_PCI_S	03 /* serial PCI interrupts */
2683db86aabSstevel 
2693db86aabSstevel #define	PCIC_INTR_DEF_PRI	11 /* default IPL level */
2703db86aabSstevel 
2713db86aabSstevel /*
2723db86aabSstevel  * I/O access types
2733db86aabSstevel  */
2743db86aabSstevel #define	PCIC_IO_TYPE_82365SL	0 /* uses index/data reg model */
2753db86aabSstevel #define	PCIC_IO_TYPE_YENTA	1 /* uses the Yenta spec memory model */
2763db86aabSstevel 
2773db86aabSstevel /*
2783db86aabSstevel  * On some PCI busses, the IO and memory resources available to us are
2793db86aabSstevel  *	available via the last two tuples in the reg property. The
2803db86aabSstevel  *	following defines are the reg numbers from the end of the reg
2813db86aabSstevel  *	property, and NOT the reg number itself.
2823db86aabSstevel  */
2833db86aabSstevel #define	PCIC_PCI_MEM_REG_OFFSET	2
2843db86aabSstevel #define	PCIC_PCI_IO_REG_OFFSET	3
2853db86aabSstevel 
2863db86aabSstevel /* I/O type 82365SL is default, Yenta is alternative */
2873db86aabSstevel #define	PCIC_IOTYPE_82365SL	0
2883db86aabSstevel #define	PCIC_IOTYPE_YENTA	1 /* CardBus memory mode */
2893db86aabSstevel 
2903db86aabSstevel /*
2913db86aabSstevel  * On Yenta cards, the PCI configuration space bridge control register
2923db86aabSstevel  * must match the interrupt * type we have selected.
2933db86aabSstevel  */
2943db86aabSstevel 
2953db86aabSstevel #define	PCIC_CB_BRIDGE_CTL	0x3E
2963db86aabSstevel #define	PCIC_BCTL_IREQ_ISA	0x80
2973db86aabSstevel 
2983db86aabSstevel /*
2993db86aabSstevel  * On all PCI busses, we get at least two tuples in the reg property. One
3003db86aabSstevel  *	of the tuples is the config space tuple and the other is the PCIC
3013db86aabSstevel  *	IO control register space tuple.
3023db86aabSstevel  */
3033db86aabSstevel 
3043db86aabSstevel #define	PCIC_PCI_CONFIG_REG_NUM	0
3053db86aabSstevel #define	PCIC_PCI_CONFIG_REG_OFFSET	0
3063db86aabSstevel #define	PCIC_PCI_CONFIG_REG_LENGTH	0x100
3073db86aabSstevel 
3083db86aabSstevel #define	PCIC_PCI_CONTROL_REG_NUM	1
3093db86aabSstevel #define	PCIC_PCI_CONTROL_REG_OFFSET	0
3103db86aabSstevel #define	PCIC_PCI_CONTROL_REG_LENGTH	4
3113db86aabSstevel #define	PCIC_CB_CONTROL_REG_LENGTH	4096 /* CardBus is 4K mem page */
3123db86aabSstevel 
3133db86aabSstevel /*
3143db86aabSstevel  * On ISA/EISA/MCA our reg property must look like this:
3153db86aabSstevel  *
3163db86aabSstevel  *	IOreg,0x0,0x8, 0x0,0x0,0x100000, 0x1,0x0,0x1000
3173db86aabSstevel  *	^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^
3183db86aabSstevel  *	adapter regs    general memory	   general IO
3193db86aabSstevel  *
3203db86aabSstevel  * where IOreg specifies the adapter's control registers in
3213db86aabSstevel  *	IO space.
3223db86aabSstevel  * The value of PCIC_ISA_IO_REG_OFFSET must be the first
3233db86aabSstevel  *	component of the third (general IO) register spec.
3243db86aabSstevel  */
3253db86aabSstevel #define	PCIC_ISA_IO_REG_OFFSET		1
3263db86aabSstevel #define	PCIC_ISA_CONTROL_REG_NUM	0
3273db86aabSstevel #define	PCIC_ISA_CONTROL_REG_OFFSET	0	/* XXX MUST be 0! */
3283db86aabSstevel #define	PCIC_ISA_CONTROL_REG_LENGTH	2
3293db86aabSstevel 
3303db86aabSstevel #define	PCIC_ISA_MEM_REG_NUM		1
3313db86aabSstevel #define	PCIC_ISA_IO_REG_NUM		2
3323db86aabSstevel 
3333db86aabSstevel /*
3343db86aabSstevel  * there are several variants of the 82365 chip from different "clone"
3353db86aabSstevel  * vendors.  Each has a few differences which may or may not have to be
3363db86aabSstevel  * handled.  The following defines are used to identify the chip being
3373db86aabSstevel  * used.  If it can't be determined, then 82365SL is assumed.
3383db86aabSstevel  *
3393db86aabSstevel  * The following are ISA/EISA/MCA-R2 adapters
3403db86aabSstevel  */
3413db86aabSstevel #define	PCIC_I82365SL		0x00 /* Intel 82365SL */
3423db86aabSstevel #define	PCIC_TYPE_I82365SL	"i82365SL"
3433db86aabSstevel #define	PCIC_CL_PD6710		0x01 /* Cirrus Logic CL-PD6710/6720 */
3443db86aabSstevel #define	PCIC_CL_PD6722		0x05 /* Cirrus Logic CL-PD6722 */
3453db86aabSstevel #define	PCIC_TYPE_PD6710	"PD6710"
3463db86aabSstevel #define	PCIC_TYPE_PD6720	"PD6720"
3473db86aabSstevel #define	PCIC_TYPE_PD6722	"PD6722"
3483db86aabSstevel #define	PCIC_VADEM		0x02 /* Vadem VG465/365 */
3493db86aabSstevel #define	PCIC_VADEM_VG469	0x03 /* Vadem VG469 - P&P, etc. */
3503db86aabSstevel #define	PCIC_VG_465		"VG465"
3513db86aabSstevel #define	PCIC_VG_365		"VG365"
3523db86aabSstevel #define	PCIC_VG_468		"VG468"
3533db86aabSstevel #define	PCIC_VG_469		"VG469"
3543db86aabSstevel #define	PCIC_RICOH		0x04
3553db86aabSstevel #define	PCIC_TYPE_RF5C296	"RF5C296"
3563db86aabSstevel #define	PCIC_TYPE_RF5C396	"RF5C396"
3573db86aabSstevel 
3583db86aabSstevel /* PCI adapters are known by 32-bit value of vendor+device id */
3593db86aabSstevel #define	PCI_ID(vend, dev)	((uint32_t)(((uint32_t)(vend) << 16) | (dev)))
3603db86aabSstevel 
3613db86aabSstevel /*
3623db86aabSstevel  * The following are PCI-R2 adapters
3633db86aabSstevel  * The Cirrus Logic PCI adapters typically have their IRQ3 line
3643db86aabSstevel  *	routed to the PCI INT A# line.
3653db86aabSstevel  */
3663db86aabSstevel #define	PCIC_CL_VENDORID	0x1013
3673db86aabSstevel #define	PCIC_PD6729_DEVID	0x1100
3683db86aabSstevel #define	PCIC_TYPE_PD6729	"PD6729"
3693db86aabSstevel #define	PCIC_CL_PD6729		PCI_ID(PCIC_CL_VENDORID, PCIC_PD6729_DEVID)
3703db86aabSstevel #define	PCIC_PD6729_INTA_ROUTE	0x03
3713db86aabSstevel 
3723db86aabSstevel #define	PCIC_TYPE_PD6730	"PD6730"
3733db86aabSstevel #define	PCIC_PD6730_DEVID	0x1101
3743db86aabSstevel #define	PCIC_CL_PD6730		PCI_ID(PCIC_CL_VENDORID, PCIC_PD6730_DEVID)
3753db86aabSstevel #define	PCIC_PD6730_INTA_ROUTE	0x09
3763db86aabSstevel 
3773db86aabSstevel #define	PCIC_TYPE_PD6832	"PD6832"
3783db86aabSstevel #define	PCIC_PD6832_DEVID	0x1110
3793db86aabSstevel #define	PCIC_CL_PD6832		PCI_ID(PCIC_CL_VENDORID, PCIC_PD6832_DEVID)
3803db86aabSstevel 
3813db86aabSstevel /* Intel i82092AA controller */
3823db86aabSstevel 
3833db86aabSstevel #define	PCIC_INTEL_VENDORID	0x8086
3843db86aabSstevel #define	PCIC_TYPE_i82092	"i82092"
3853db86aabSstevel #define	PCIC_i82092_DEVID	0x1221
3863db86aabSstevel #define	PCIC_INTEL_i82092	PCI_ID(PCIC_INTEL_VENDORID, \
3873db86aabSstevel 					PCIC_i82092_DEVID)
3883db86aabSstevel #define	PCIC_i82092_INTA_ROUTE	0x0	/* XXX ? what is it really ? XXX */
3893db86aabSstevel 
3903db86aabSstevel /* Texas Instruments */
3913db86aabSstevel 
3923db86aabSstevel #define	PCIC_TI_VENDORID	0x104C
3933db86aabSstevel #define	PCIC_PCI1050_DEVID	0xAC10
3943db86aabSstevel #define	PCIC_PCI1130_DEVID	0xAC12
3953db86aabSstevel #define	PCIC_PCI1031_DEVID	0xAC13 /* R2 only with Yenta IF */
3963db86aabSstevel #define	PCIC_PCI1131_DEVID	0xAC15
3973db86aabSstevel #define	PCIC_PCI1250_DEVID	0xAC16
3983db86aabSstevel #define	PCIC_PCI1221_DEVID	0xAC19
3993db86aabSstevel #define	PCIC_PCI1225_DEVID	0xAC1C
4003db86aabSstevel #define	PCIC_PCI1220_DEVID	0xAC17
4013db86aabSstevel #define	PCIC_PCI1260_DEVID	0xAC18
4023db86aabSstevel #define	PCIC_PCI1210_DEVID	0xAC1A
4033db86aabSstevel #define	PCIC_PCI1450_DEVID	0xAC1B
4043db86aabSstevel #define	PCIC_PCI1251_DEVID	0xAC1D
4053db86aabSstevel #define	PCIC_PCI1211_DEVID	0xAC1E
4063db86aabSstevel #define	PCIC_PCI1251B_DEVID	0xAC1F
4073db86aabSstevel #define	PCIC_PCI1260B_DEVID	0xAC30
4083db86aabSstevel #define	PCIC_PCI4450_DEVID	0xAC40
4093db86aabSstevel #define	PCIC_PCI4410_DEVID	0xAC41
4103db86aabSstevel #define	PCIC_PCI4451_DEVID	0xAC42
4113db86aabSstevel #define	PCIC_PCI4510_DEVID	0xAC44
4123db86aabSstevel #define	PCIC_PCI1410_DEVID	0xAC50
4133db86aabSstevel #define	PCIC_PCI1420_DEVID	0xAC51
4143db86aabSstevel #define	PCIC_PCI1451_DEVID	0xAC52
4153db86aabSstevel #define	PCIC_PCI1421_DEVID	0xAC53
4163db86aabSstevel #define	PCIC_PCI1520_DEVID	0xAC55
4173db86aabSstevel #define	PCIC_PCI1510_DEVID	0xAC56
4183db86aabSstevel 
4193db86aabSstevel #define	PCIC_TI_PCI1130		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1130_DEVID)
4203db86aabSstevel #define	PCIC_TYPE_PCI1130	"PCI1130"
4213db86aabSstevel #define	PCIC_TI_PCI1031		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1031_DEVID)
4223db86aabSstevel #define	PCIC_TYPE_PCI1031	"PCI1031"
4233db86aabSstevel #define	PCIC_TI_PCI1131		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1131_DEVID)
4243db86aabSstevel #define	PCIC_TYPE_PCI1131	"PCI1131"
4253db86aabSstevel #define	PCIC_TI_PCI1250		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1250_DEVID)
4263db86aabSstevel #define	PCIC_TYPE_PCI1250	"PCI1250"
4273db86aabSstevel #define	PCIC_TI_PCI1050		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1050_DEVID)
4283db86aabSstevel #define	PCIC_TYPE_PCI1050	"PCI1050"
4293db86aabSstevel #define	PCIC_TI_PCI1221		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1221_DEVID)
4303db86aabSstevel #define	PCIC_TYPE_PCI1221	"PCI1221"
4313db86aabSstevel #define	PCIC_TI_PCI1225		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1225_DEVID)
4323db86aabSstevel #define	PCIC_TYPE_PCI1225	"PCI1225"
4333db86aabSstevel #define	PCIC_TI_PCI1220		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1220_DEVID)
4343db86aabSstevel #define	PCIC_TYPE_PCI1220	"PCI1220"
4353db86aabSstevel #define	PCIC_TI_PCI1260		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1260_DEVID)
4363db86aabSstevel #define	PCIC_TYPE_PCI1260	"PCI1260"
4373db86aabSstevel #define	PCIC_TI_PCI1210		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1210_DEVID)
4383db86aabSstevel #define	PCIC_TYPE_PCI1210	"PCI1210"
4393db86aabSstevel #define	PCIC_TI_PCI1450		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1450_DEVID)
4403db86aabSstevel #define	PCIC_TYPE_PCI1450	"PCI1450"
4413db86aabSstevel #define	PCIC_TI_PCI1251		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1251_DEVID)
4423db86aabSstevel #define	PCIC_TYPE_PCI1251	"PCI1251"
4433db86aabSstevel #define	PCIC_TI_PCI1211		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1211_DEVID)
4443db86aabSstevel #define	PCIC_TYPE_PCI1211	"PCI1211"
4453db86aabSstevel #define	PCIC_TI_PCI1251B	PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1251B_DEVID)
4463db86aabSstevel #define	PCIC_TYPE_PCI1251B	"PCI1251B"
4473db86aabSstevel #define	PCIC_TI_PCI1260B	PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1260B_DEVID)
4483db86aabSstevel #define	PCIC_TYPE_PCI1260B	"PCI1260B"
4493db86aabSstevel #define	PCIC_TI_PCI4450		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI4450_DEVID)
4503db86aabSstevel #define	PCIC_TYPE_PCI4450	"PCI4450"
4513db86aabSstevel #define	PCIC_TI_PCI4410		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI4410_DEVID)
4523db86aabSstevel #define	PCIC_TYPE_PCI4410	"PCI4410"
4533db86aabSstevel #define	PCIC_TI_PCI4451		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI4451_DEVID)
4543db86aabSstevel #define	PCIC_TYPE_PCI4451	"PCI4451"
4553db86aabSstevel #define	PCIC_TI_PCI4510		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI4510_DEVID)
4563db86aabSstevel #define	PCIC_TYPE_PCI4510	"PCI4510"
4573db86aabSstevel #define	PCIC_TI_PCI1410		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1410_DEVID)
4583db86aabSstevel #define	PCIC_TYPE_PCI1410	"PCI1410"
4593db86aabSstevel #define	PCIC_TI_PCI1420		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1420_DEVID)
4603db86aabSstevel #define	PCIC_TYPE_PCI1420	"PCI1420"
4613db86aabSstevel #define	PCIC_TI_PCI1451		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1451_DEVID)
4623db86aabSstevel #define	PCIC_TYPE_PCI1451	"PCI1451"
4633db86aabSstevel #define	PCIC_TI_PCI1421		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1421_DEVID)
4643db86aabSstevel #define	PCIC_TYPE_PCI1421	"PCI1421"
4653db86aabSstevel #define	PCIC_TI_PCI1510		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1510_DEVID)
4663db86aabSstevel #define	PCIC_TYPE_PCI1510	"PCI1510"
4673db86aabSstevel #define	PCIC_TI_PCI1520		PCI_ID(PCIC_TI_VENDORID, PCIC_PCI1520_DEVID)
4683db86aabSstevel #define	PCIC_TYPE_PCI1520	"PCI1520"
4693db86aabSstevel #define	PCIC_TI_VENDOR		PCI_ID(PCIC_TI_VENDORID, 0x0000)
4703db86aabSstevel #define	PCIC_TYPE_TI		"PCIC_TI"
4713db86aabSstevel 
4723db86aabSstevel /* O2 Micro */
4733db86aabSstevel #define	PCIC_O2_VENDORID	0x1217
4743db86aabSstevel #define	PCIC_OZ6912_DEVID	0x6972
4753db86aabSstevel #define	PCIC_O2_OZ6912		PCI_ID(PCIC_O2_VENDORID, PCIC_OZ6912_DEVID)
4763db86aabSstevel #define	PCIC_TYPE_OZ6912	"OZ6912"
4773db86aabSstevel #define	PCIC_O2MICRO_VENDOR	PCI_ID(PCIC_O2_VENDORID, 0x0000)
4783db86aabSstevel #define	PCIC_TYPE_O2MICRO	"O2Micro"
4793db86aabSstevel 
4803db86aabSstevel /* ENE */
4813db86aabSstevel #define	PCIC_ENE_VENDORID	0x1524
4823db86aabSstevel #define	PCIC_ENE1410_DEVID	0x1410
4833db86aabSstevel #define	PCIC_ENE_1410		PCI_ID(PCIC_ENE_VENDORID, PCIC_ENE1410_DEVID)
4843db86aabSstevel #define	PCIC_TYPE_1410		"ENE1410"
4853db86aabSstevel #define	PCIC_ENE1420_DEVID	0x1420
4863db86aabSstevel #define	PCIC_ENE_1420		PCI_ID(PCIC_ENE_VENDORID, PCIC_ENE1420_DEVID)
4873db86aabSstevel #define	PCIC_TYPE_1420		"ENE1420"
4883db86aabSstevel 
4893db86aabSstevel /* SMC 34C90 */
4903db86aabSstevel #define	PCIC_SMC_VENDORID	0x10B3
4913db86aabSstevel #define	PCIC_SMC34C90_DEVID	0xB106
4923db86aabSstevel #define	PCIC_SMC_34C90		PCI_ID(PCIC_SMC_VENDORID, PCIC_SMC34C90_DEVID)
4933db86aabSstevel #define	PCIC_TYPE_34C90		"SMC34c90"
4943db86aabSstevel 
4953db86aabSstevel /* Ricoh RL5CXXX */
4963db86aabSstevel #define	PCIC_RICOH_VENDORID	0x1180
4973db86aabSstevel #define	PCIC_RL5C466_DEVID	0x0466
4983db86aabSstevel #define	PCIC_RL5C475_DEVID	0x0475
4993db86aabSstevel #define	PCIC_RL5C476_DEVID	0x0476
5003db86aabSstevel #define	PCIC_RL5C477_DEVID	0x0477
5013db86aabSstevel #define	PCIC_RL5C478_DEVID	0x0478
5023db86aabSstevel #define	PCIC_RICOH_RL5C466	PCI_ID(PCIC_RICOH_VENDORID, PCIC_RL5C466_DEVID)
5033db86aabSstevel #define	PCIC_RICOH_RL5C475	PCI_ID(PCIC_RICOH_VENDORID, PCIC_RL5C475_DEVID)
5043db86aabSstevel #define	PCIC_RICOH_RL5C476	PCI_ID(PCIC_RICOH_VENDORID, PCIC_RL5C476_DEVID)
5053db86aabSstevel #define	PCIC_RICOH_RL5C477	PCI_ID(PCIC_RICOH_VENDORID, PCIC_RL5C477_DEVID)
5063db86aabSstevel #define	PCIC_RICOH_RL5C478	PCI_ID(PCIC_RICOH_VENDORID, PCIC_RL5C478_DEVID)
5073db86aabSstevel #define	PCIC_TYPE_RL5C466		"RL5C466"
5083db86aabSstevel #define	PCIC_TYPE_RL5C475		"RL5C475"
5093db86aabSstevel #define	PCIC_TYPE_RL5C476		"RL5C476"
5103db86aabSstevel #define	PCIC_TYPE_RL5C477		"RL5C477"
5113db86aabSstevel #define	PCIC_TYPE_RL5C478		"RL5C478"
5123db86aabSstevel #define	PCIC_RICOH_VENDOR	PCI_ID(PCIC_RICOH_VENDORID, 0x0000)
5133db86aabSstevel #define	PCIC_TYPE_RICOH		"Ricoh"
5143db86aabSstevel 
5153db86aabSstevel /* Toshiba */
5163db86aabSstevel #define	PCIC_TOSHIBA_VENDORID	0x1179
5173db86aabSstevel #define	PCIC_TOPIC95_DEVID	0x0603
5183db86aabSstevel #define	PCIC_TOSHIBA_TOPIC95	PCI_ID(PCIC_TOSHIBA_VENDORID, \
5193db86aabSstevel 					PCIC_TOPIC95_DEVID)
5203db86aabSstevel #define	PCIC_TYPE_TOPIC95	"ToPIC95"
5213db86aabSstevel #define	PCIC_TOPIC100_DEVID	0x0617
5223db86aabSstevel #define	PCIC_TOSHIBA_TOPIC100	PCI_ID(PCIC_TOSHIBA_VENDORID, \
5233db86aabSstevel 					PCIC_TOPIC100_DEVID)
5243db86aabSstevel #define	PCIC_TYPE_TOPIC100	"ToPIC100"
5253db86aabSstevel #define	PCIC_TOSHIBA_VENDOR	PCI_ID(PCIC_TOSHIBA_VENDORID, 0x0000)
5263db86aabSstevel #define	PCIC_TYPE_TOSHIBA	"Toshiba"
5273db86aabSstevel 
5283db86aabSstevel /* Generic Yenta compliant chip */
5293db86aabSstevel #define	PCIC_TYPE_YENTA		"Yenta"
5303db86aabSstevel 
5313db86aabSstevel /* Yenta-compliant vcc register, bits */
5323db86aabSstevel #define	PCIC_PRESENT_STATE_REG	0x8
5333db86aabSstevel #define	PCIC_VCC_MASK		0xc00
5343db86aabSstevel #define	PCIC_VCC_3VCARD		0x800
5353db86aabSstevel #define	PCIC_VCC_5VCARD		0x400
5363db86aabSstevel 
5373db86aabSstevel #define	PCIC_16BIT_CARD		0x010		/* 16 bit card */
5383db86aabSstevel #define	PCIC_CB_CARD		0x020		/* cardbus card */
5393db86aabSstevel #define	PCIC_CINT_IREQ		0x040		/* Interrupt present */
5403db86aabSstevel #define	PCIC_NOT_A_CARD		0x080		/* Not a card */
5413db86aabSstevel #define	PCIC_DATA_LOST		0x100		/* Data lost */
5423db86aabSstevel #define	PCIC_BAD_VCC_REQ	0x200		/* Bad Vcc request */
5433db86aabSstevel 
544*8134ee03Srw148561 
545*8134ee03Srw148561 /* TI Multi Function Terminal selection (MFUNC0 selected as INTA) */
546*8134ee03Srw148561 #define	PCIC_TI_MFUNC_SEL	0x22
547*8134ee03Srw148561 
5483db86aabSstevel #define	PCICPROP_CTL		"controller"
5493db86aabSstevel 
5503db86aabSstevel #define	PCIC_REV_LEVEL_LOW	0x02
5513db86aabSstevel #define	PCIC_REV_LEVEL_HI 	0x04
5523db86aabSstevel #define	PCIC_REV_C		0x04
5533db86aabSstevel #define	PCIC_REV_MASK		0x0f
5543db86aabSstevel 
5553db86aabSstevel #define	PCIC_ID_NAME		"pcic"
5563db86aabSstevel #define	PCIC_DEV_NAME		"pcic"
5573db86aabSstevel 
5583db86aabSstevel #ifndef	DEVI_PCI_NEXNAME
5593db86aabSstevel #define	DEVI_PCI_NEXNAME	"pci"
5603db86aabSstevel #endif
5613db86aabSstevel 
562*8134ee03Srw148561 #ifndef DEVI_PCIEX_NEXNAME
563*8134ee03Srw148561 #define	DEVI_PCIEX_NEXNAME	"pciex"
564*8134ee03Srw148561 #endif
565*8134ee03Srw148561 
5663db86aabSstevel /* PCI Class Code stuff */
5673db86aabSstevel #define	PCIC_PCI_CLASS(cls, subclass)	(((cls) << 16) | ((subclass) << 8))
5683db86aabSstevel #define	PCIC_PCI_PCMCIA	PCIC_PCI_CLASS(PCI_CLASS_BRIDGE, PCI_BRIDGE_PCMCIA)
5693db86aabSstevel #define	PCIC_PCI_CARDBUS PCIC_PCI_CLASS(PCI_CLASS_BRIDGE, PCI_BRIDGE_CARDBUS)
5703db86aabSstevel 
5713db86aabSstevel #define	PCIC_MEM_AM	0	/* Attribute Memory */
5723db86aabSstevel #define	PCIC_MEM_CM	1	/* Common Memory */
5733db86aabSstevel 
5743db86aabSstevel #define	PCS_SUBTYPE_UNKNOWN	0x00 /* haven't processed this yet */
5753db86aabSstevel #define	PCS_SUBTYPE_MEMORY	0x01 /* normal memory access */
5763db86aabSstevel #define	PCS_SUBTYPE_FAT		0x02 /* DOS floppy (FAT) file system */
5773db86aabSstevel 
5783db86aabSstevel /*
5793db86aabSstevel  * For speed calculation, assume a SYSCLK rate of 8.33MHz
5803db86aabSstevel  *	unless our parent tells us otherwise. 8.33MHz is a
5813db86aabSstevel  *	reasonable default for an ISA bus.
5823db86aabSstevel  */
5833db86aabSstevel #define	PCIC_ISA_DEF_SYSCLK	8	/* MHZ */
5843db86aabSstevel #define	PCIC_PCI_DEF_SYSCLK	33	/* MHZ */
5853db86aabSstevel #define	PCIC_PCI_25MHZ		25
5863db86aabSstevel #define	mhztons(c)		(1000000 / (uint32_t)((c) * 1000))
5873db86aabSstevel #define	PCIC_SYSCLK_25MHZ	25 * 1000 * 1000
5883db86aabSstevel #define	PCIC_SYSCLK_33MHZ	33 * 1000 * 1000
5893db86aabSstevel 
5903db86aabSstevel /* simplify the callback so it looks like straight function call */
5913db86aabSstevel #define	PC_CALLBACK	(*pcic->pc_callback)
5923db86aabSstevel 
5933db86aabSstevel /* hardware event capabilities -- needs sservice.h */
5943db86aabSstevel #define	PCIC_DEFAULT_INT_CAPS	(SBM_BVD1|SBM_BVD2|SBM_RDYBSY|SBM_CD)
5953db86aabSstevel #define	PCIC_DEFAULT_RPT_CAPS	(PCIC_DEFAULT_INT_CAPS|SBM_WP)
5963db86aabSstevel /* note that we don't support indicators via the PCIC */
5973db86aabSstevel #define	PCIC_DEFAULT_CTL_CAPS	(0)
5983db86aabSstevel 
5993db86aabSstevel /* format of pcic "ranges" property */
6003db86aabSstevel typedef struct pcic_ranges {
6013db86aabSstevel 	uint32_t pcic_range_caddrhi;
6023db86aabSstevel 	uint32_t pcic_range_caddrlo;
6033db86aabSstevel 	uint32_t pcic_range_paddrhi;
6043db86aabSstevel 	uint32_t pcic_range_paddrmid;
6053db86aabSstevel 	uint32_t pcic_range_paddrlo;
6063db86aabSstevel 	uint32_t pcic_range_size;
6073db86aabSstevel } pcic_ranges_t;
6083db86aabSstevel 
6093db86aabSstevel /* debug stuff */
6103db86aabSstevel #if defined(DEBUG)
6113db86aabSstevel #define	PCIC_DEBUG
6123db86aabSstevel #endif
6133db86aabSstevel 
6143db86aabSstevel #ifdef	__cplusplus
6153db86aabSstevel }
6163db86aabSstevel #endif
6173db86aabSstevel 
6183db86aabSstevel #endif	/* _PCIC_VAR_H */
619