pcic_var.h revision 459fbba0bc115fe006d3634487b686fa707e1fbf
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* PCIC driver specific data structures
*/
#ifndef _PCIC_VAR_H
#define _PCIC_VAR_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* defines and default values for power management simulation
*/
#define PCIC_PM_DEF_METHOD 0 /* use no methods as default */
typedef struct pcic_pm_t {
int state; /* state */
} pcic_pm_t;
/*
*/
#define PCIC_REM_DEBOUNCE_CNT 40
#define PCIC_DEBOUNCE_OK_CNT 10
/*
* Loop control in pcic_ready_wait
*
* Multiplying PCIC_READY_WAIT_LOOPS * PCIC_READY_WAIT_TIME gives
* total loop time in mS
*/
typedef struct pcs_memwin {
int pcw_status;
int pcw_len;
volatile caddr_t pcw_hostmem;
} pcs_memwin_t;
typedef struct pci_iowin {
int pcw_status;
int pcw_len;
volatile caddr_t pcw_hostmem;
/* Cirrus Logic specific offset info */
int pcw_offset;
} pcs_iowin_t;
typedef
struct pcic_socket {
int pcs_flags;
int pcs_socket; /* socket to determine register set */
char pcs_cd_softint_flg;
int pcs_iobase;
int pcs_iolen;
int pcs_conflen;
int pcs_conf_index; /* used to select which cftable entry to use */
int pcs_irq;
int pcs_smi;
int pcs_state;
int pcs_status;
int pcs_intmask;
union pcic_window {
typedef struct pcic_debounce_state {
int insert_cnt;
int remove_cnt;
int uncertain_cnt;
int prev_status;
int debounce_cnt;
typedef struct pcicdev_t {
char *pc_chipname;
int pc_io_type;
int pc_intr_mode; /* which interrupt method */
/* in pcic_intr() */
int pc_numsockets;
/* used to inform nexus of events */
int (*pc_callback)();
int pc_cb_arg;
int (*pc_ss_bios)();
int pc_numpower;
struct power_entry *pc_power;
int mem_reg_num; /* memory space reg number */
int io_reg_num; /* IO space reg number */
int bus_speed; /* parent bus speed */
int pc_lastreg;
struct pcic_cd_change_param {
int sn;
} pcicdev_t;
#define PCF_ATTACHED 0x00000001
#define PCF_INTRENAB 0x00000008
#define PCF_MULT_IRQ 0x00040000
/* newer features */
/*
* misc flags
*/
#define PCIC_FOUND_ADAPTER 0x00000001
#define PCIC_ENABLE_IO 0x00000002
#define PCIC_ENABLE_MEM 0x00000004
/*
* interrupt modes
* the pcic variants provide a number of interrupt modes.
* e.g. on PCI, we can either use PCI interrupts or ISA interrupts
* but the SPARC version must use PCI interrupts and x86 "depends"
*/
#define PCIC_INTR_MODE_ISA 00 /* default- use ISA mode */
/*
* I/O access types
*/
#define PCIC_IO_TYPE_82365SL 0 /* uses index/data reg model */
/*
* On some PCI busses, the IO and memory resources available to us are
* available via the last two tuples in the reg property. The
* following defines are the reg numbers from the end of the reg
* property, and NOT the reg number itself.
*/
#define PCIC_PCI_MEM_REG_OFFSET 2
#define PCIC_PCI_IO_REG_OFFSET 3
/* I/O type 82365SL is default, Yenta is alternative */
#define PCIC_IOTYPE_82365SL 0
/*
* On Yenta cards, the PCI configuration space bridge control register
* must match the interrupt * type we have selected.
*/
#define PCIC_CB_BRIDGE_CTL 0x3E
#define PCIC_BCTL_IREQ_ISA 0x80
/*
* On all PCI busses, we get at least two tuples in the reg property. One
* of the tuples is the config space tuple and the other is the PCIC
* IO control register space tuple.
*/
#define PCIC_PCI_CONFIG_REG_NUM 0
#define PCIC_PCI_CONFIG_REG_OFFSET 0
#define PCIC_PCI_CONFIG_REG_LENGTH 0x100
#define PCIC_PCI_CONTROL_REG_NUM 1
#define PCIC_PCI_CONTROL_REG_OFFSET 0
#define PCIC_PCI_CONTROL_REG_LENGTH 4
/*
*
* IOreg,0x0,0x8, 0x0,0x0,0x100000, 0x1,0x0,0x1000
* ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
* adapter regs general memory general IO
*
* where IOreg specifies the adapter's control registers in
* IO space.
* The value of PCIC_ISA_IO_REG_OFFSET must be the first
* component of the third (general IO) register spec.
*/
#define PCIC_ISA_IO_REG_OFFSET 1
#define PCIC_ISA_CONTROL_REG_NUM 0
#define PCIC_ISA_CONTROL_REG_OFFSET 0 /* XXX MUST be 0! */
#define PCIC_ISA_CONTROL_REG_LENGTH 2
#define PCIC_ISA_MEM_REG_NUM 1
#define PCIC_ISA_IO_REG_NUM 2
/*
* there are several variants of the 82365 chip from different "clone"
* vendors. Each has a few differences which may or may not have to be
* handled. The following defines are used to identify the chip being
* used. If it can't be determined, then 82365SL is assumed.
*
*/
#define PCIC_TYPE_I82365SL "i82365SL"
#define PCIC_TYPE_PD6710 "PD6710"
#define PCIC_TYPE_PD6720 "PD6720"
#define PCIC_TYPE_PD6722 "PD6722"
#define PCIC_VG_465 "VG465"
#define PCIC_VG_365 "VG365"
#define PCIC_VG_468 "VG468"
#define PCIC_VG_469 "VG469"
#define PCIC_RICOH 0x04
#define PCIC_TYPE_RF5C296 "RF5C296"
#define PCIC_TYPE_RF5C396 "RF5C396"
/* PCI adapters are known by 32-bit value of vendor+device id */
/*
* The following are PCI-R2 adapters
* The Cirrus Logic PCI adapters typically have their IRQ3 line
* routed to the PCI INT A# line.
*/
#define PCIC_CL_VENDORID 0x1013
#define PCIC_PD6729_DEVID 0x1100
#define PCIC_TYPE_PD6729 "PD6729"
#define PCIC_PD6729_INTA_ROUTE 0x03
#define PCIC_TYPE_PD6730 "PD6730"
#define PCIC_PD6730_DEVID 0x1101
#define PCIC_PD6730_INTA_ROUTE 0x09
#define PCIC_TYPE_PD6832 "PD6832"
#define PCIC_PD6832_DEVID 0x1110
/* Intel i82092AA controller */
#define PCIC_INTEL_VENDORID 0x8086
#define PCIC_TYPE_i82092 "i82092"
#define PCIC_i82092_DEVID 0x1221
/* Texas Instruments */
#define PCIC_TI_VENDORID 0x104C
#define PCIC_PCI1050_DEVID 0xAC10
#define PCIC_PCI1130_DEVID 0xAC12
#define PCIC_PCI1131_DEVID 0xAC15
#define PCIC_PCI1250_DEVID 0xAC16
#define PCIC_PCI1221_DEVID 0xAC19
#define PCIC_PCI1225_DEVID 0xAC1C
#define PCIC_PCI1220_DEVID 0xAC17
#define PCIC_PCI1260_DEVID 0xAC18
#define PCIC_PCI1210_DEVID 0xAC1A
#define PCIC_PCI1450_DEVID 0xAC1B
#define PCIC_PCI1251_DEVID 0xAC1D
#define PCIC_PCI1211_DEVID 0xAC1E
#define PCIC_PCI1251B_DEVID 0xAC1F
#define PCIC_PCI1260B_DEVID 0xAC30
#define PCIC_PCI4450_DEVID 0xAC40
#define PCIC_PCI4410_DEVID 0xAC41
#define PCIC_PCI4451_DEVID 0xAC42
#define PCIC_PCI4510_DEVID 0xAC44
#define PCIC_PCI1410_DEVID 0xAC50
#define PCIC_PCI1420_DEVID 0xAC51
#define PCIC_PCI1451_DEVID 0xAC52
#define PCIC_PCI1421_DEVID 0xAC53
#define PCIC_PCI1520_DEVID 0xAC55
#define PCIC_PCI1510_DEVID 0xAC56
#define PCIC_TYPE_PCI1130 "PCI1130"
#define PCIC_TYPE_PCI1031 "PCI1031"
#define PCIC_TYPE_PCI1131 "PCI1131"
#define PCIC_TYPE_PCI1250 "PCI1250"
#define PCIC_TYPE_PCI1050 "PCI1050"
#define PCIC_TYPE_PCI1221 "PCI1221"
#define PCIC_TYPE_PCI1225 "PCI1225"
#define PCIC_TYPE_PCI1220 "PCI1220"
#define PCIC_TYPE_PCI1260 "PCI1260"
#define PCIC_TYPE_PCI1210 "PCI1210"
#define PCIC_TYPE_PCI1450 "PCI1450"
#define PCIC_TYPE_PCI1251 "PCI1251"
#define PCIC_TYPE_PCI1211 "PCI1211"
#define PCIC_TYPE_PCI1251B "PCI1251B"
#define PCIC_TYPE_PCI1260B "PCI1260B"
#define PCIC_TYPE_PCI4450 "PCI4450"
#define PCIC_TYPE_PCI4410 "PCI4410"
#define PCIC_TYPE_PCI4451 "PCI4451"
#define PCIC_TYPE_PCI4510 "PCI4510"
#define PCIC_TYPE_PCI1410 "PCI1410"
#define PCIC_TYPE_PCI1420 "PCI1420"
#define PCIC_TYPE_PCI1451 "PCI1451"
#define PCIC_TYPE_PCI1421 "PCI1421"
#define PCIC_TYPE_PCI1510 "PCI1510"
#define PCIC_TYPE_PCI1520 "PCI1520"
#define PCIC_TYPE_TI "PCIC_TI"
/* O2 Micro */
#define PCIC_O2_VENDORID 0x1217
#define PCIC_OZ6912_DEVID 0x6972
#define PCIC_TYPE_OZ6912 "OZ6912"
#define PCIC_TYPE_O2MICRO "O2Micro"
/* ENE */
#define PCIC_ENE_VENDORID 0x1524
#define PCIC_ENE1410_DEVID 0x1410
#define PCIC_TYPE_1410 "ENE1410"
#define PCIC_ENE1420_DEVID 0x1420
#define PCIC_TYPE_1420 "ENE1420"
/* SMC 34C90 */
#define PCIC_SMC_VENDORID 0x10B3
#define PCIC_SMC34C90_DEVID 0xB106
#define PCIC_TYPE_34C90 "SMC34c90"
/* Ricoh RL5CXXX */
#define PCIC_RICOH_VENDORID 0x1180
#define PCIC_RL5C466_DEVID 0x0466
#define PCIC_RL5C475_DEVID 0x0475
#define PCIC_RL5C476_DEVID 0x0476
#define PCIC_RL5C477_DEVID 0x0477
#define PCIC_RL5C478_DEVID 0x0478
#define PCIC_TYPE_RL5C466 "RL5C466"
#define PCIC_TYPE_RL5C475 "RL5C475"
#define PCIC_TYPE_RL5C476 "RL5C476"
#define PCIC_TYPE_RL5C477 "RL5C477"
#define PCIC_TYPE_RL5C478 "RL5C478"
#define PCIC_TYPE_RICOH "Ricoh"
/* Toshiba */
#define PCIC_TOSHIBA_VENDORID 0x1179
#define PCIC_TOPIC95_DEVID 0x0603
#define PCIC_TYPE_TOPIC95 "ToPIC95"
#define PCIC_TOPIC100_DEVID 0x0617
#define PCIC_TYPE_TOPIC100 "ToPIC100"
#define PCIC_TYPE_TOSHIBA "Toshiba"
/* Generic Yenta compliant chip */
#define PCIC_TYPE_YENTA "Yenta"
/* Yenta-compliant vcc register, bits */
#define PCIC_PRESENT_STATE_REG 0x8
#define PCIC_VCC_MASK 0xc00
#define PCIC_VCC_3VCARD 0x800
#define PCIC_VCC_5VCARD 0x400
/* TI Multi Function Terminal selection (MFUNC0 selected as INTA) */
#define PCIC_TI_MFUNC_SEL 0x22
#define PCICPROP_CTL "controller"
#define PCIC_REV_LEVEL_LOW 0x02
#define PCIC_REV_LEVEL_HI 0x04
#define PCIC_REV_C 0x04
#define PCIC_REV_MASK 0x0f
#define PCIC_ID_NAME "pcic"
#define PCIC_DEV_NAME "pcic"
#ifndef DEVI_PCI_NEXNAME
#define DEVI_PCI_NEXNAME "pci"
#endif
#ifndef DEVI_PCIEX_NEXNAME
#define DEVI_PCIEX_NEXNAME "pciex"
#endif
/* PCI Class Code stuff */
#define PCIC_MEM_AM 0 /* Attribute Memory */
/*
* For speed calculation, assume a SYSCLK rate of 8.33MHz
* unless our parent tells us otherwise. 8.33MHz is a
* reasonable default for an ISA bus.
*/
#define PCIC_PCI_25MHZ 25
/* simplify the callback so it looks like straight function call */
/* hardware event capabilities -- needs sservice.h */
/* note that we don't support indicators via the PCIC */
#define PCIC_DEFAULT_CTL_CAPS (0)
/* format of pcic "ranges" property */
typedef struct pcic_ranges {
/* debug stuff */
#if defined(DEBUG)
#define PCIC_DEBUG
#endif
#ifdef __cplusplus
}
#endif
#endif /* _PCIC_VAR_H */