10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*3664Srw148561 * Common Development and Distribution License (the "License"). 6*3664Srw148561 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*3664Srw148561 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SSERVICE_H 270Sstevel@tonic-gate #define _SSERVICE_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifdef __cplusplus 320Sstevel@tonic-gate extern "C" { 330Sstevel@tonic-gate #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate typedef int(f_tt)(int, ...); /* for lint - cc -v quieting */ 360Sstevel@tonic-gate 370Sstevel@tonic-gate /* 380Sstevel@tonic-gate * identifiers for all SS functions implemented 390Sstevel@tonic-gate */ 400Sstevel@tonic-gate #define SS_GetAdapter 0 410Sstevel@tonic-gate #define SS_GetPage 1 420Sstevel@tonic-gate #define SS_GetSocket 2 430Sstevel@tonic-gate #define SS_GetStatus 3 440Sstevel@tonic-gate #define SS_GetWindow 4 450Sstevel@tonic-gate #define SS_InquireAdapter 5 460Sstevel@tonic-gate #define SS_InquireSocket 6 470Sstevel@tonic-gate #define SS_InquireWindow 7 480Sstevel@tonic-gate #define SS_ResetSocket 8 490Sstevel@tonic-gate #define SS_SetPage 9 500Sstevel@tonic-gate #define SS_SetAdapter 10 510Sstevel@tonic-gate #define SS_SetSocket 11 520Sstevel@tonic-gate #define SS_SetWindow 12 530Sstevel@tonic-gate #define SS_SetIRQHandler 13 540Sstevel@tonic-gate #define SS_ClearIRQHandler 14 550Sstevel@tonic-gate #define CSGetActiveDip 98 560Sstevel@tonic-gate #define CSInitDev 99 570Sstevel@tonic-gate #define CSRegister 100 580Sstevel@tonic-gate #define CSCISInit 101 590Sstevel@tonic-gate #define CSUnregister 102 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* 620Sstevel@tonic-gate * XXX 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate #define CISGetAddress 103 650Sstevel@tonic-gate #define CISSetAddress 104 660Sstevel@tonic-gate #define CSCardRemoved 105 670Sstevel@tonic-gate #define CSGetCookiesAndDip 106 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* 700Sstevel@tonic-gate * returns a la Socket Services 710Sstevel@tonic-gate */ 720Sstevel@tonic-gate 730Sstevel@tonic-gate #define SUCCESS 0x00 740Sstevel@tonic-gate #define BAD_ADAPTER 0x01 750Sstevel@tonic-gate #define BAD_ATTRIBUTE 0x02 760Sstevel@tonic-gate #define BAD_BASE 0x03 770Sstevel@tonic-gate #define BAD_EDC 0x04 780Sstevel@tonic-gate #define BAD_IRQ 0x06 790Sstevel@tonic-gate #define BAD_OFFSET 0x07 800Sstevel@tonic-gate #define BAD_PAGE 0x08 810Sstevel@tonic-gate #define READ_FAILURE 0x09 820Sstevel@tonic-gate #define BAD_SIZE 0x0a 830Sstevel@tonic-gate #define BAD_SOCKET 0x0b 840Sstevel@tonic-gate #define BAD_TYPE 0x0d 850Sstevel@tonic-gate #define BAD_VCC 0x0e 860Sstevel@tonic-gate #define BAD_VPP 0x0f 870Sstevel@tonic-gate #define BAD_WINDOW 0x11 880Sstevel@tonic-gate #define WRITE_FAILURE 0x12 890Sstevel@tonic-gate #define NO_CARD 0x14 900Sstevel@tonic-gate #define BAD_FUNCTION 0x15 910Sstevel@tonic-gate #define BAD_MODE 0x16 920Sstevel@tonic-gate #define BAD_SPEED 0x17 930Sstevel@tonic-gate #define BUSY 0x18 940Sstevel@tonic-gate #define NO_RESOURCE 0x20 950Sstevel@tonic-gate 960Sstevel@tonic-gate /* events for callback */ 970Sstevel@tonic-gate /* card related events */ 980Sstevel@tonic-gate #define PCE_CARD_REMOVAL 0 /* card removed */ 990Sstevel@tonic-gate #define PCE_CARD_INSERT 1 /* card inserted */ 1000Sstevel@tonic-gate #define PCE_CARD_READY 2 /* ready state changed */ 1010Sstevel@tonic-gate #define PCE_CARD_BATTERY_WARN 3 /* battery is getting low */ 1020Sstevel@tonic-gate #define PCE_CARD_BATTERY_DEAD 4 /* battery is dead */ 1030Sstevel@tonic-gate #define PCE_CARD_STATUS_CHANGE 5 /* card status change for I/O card */ 1040Sstevel@tonic-gate #define PCE_CARD_WRITE_PROTECT 6 /* card write protect status change */ 1050Sstevel@tonic-gate #define PCE_CARD_RESET 7 /* client requested reset complete */ 1060Sstevel@tonic-gate #define PCE_CARD_UNLOCK 8 /* lock has been unlocked (opt) */ 1070Sstevel@tonic-gate #define PCE_CLIENT_INFO 9 /* someone wants client information */ 1080Sstevel@tonic-gate #define PCE_EJECTION_COMPLETE 10 /* Motor has finished ejecting card */ 1090Sstevel@tonic-gate #define PCE_EJECTION_REQUEST 11 /* request to eject card */ 1100Sstevel@tonic-gate #define PCE_ERASE_COMPLETE 12 /* a Flash Erase request completed */ 1110Sstevel@tonic-gate #define PCE_EXCLUSIVE_COMPLETE 13 1120Sstevel@tonic-gate #define PCE_EXCLUSIVE_REQUEST 14 1130Sstevel@tonic-gate #define PCE_INSERTION_COMPLETE 15 1140Sstevel@tonic-gate #define PCE_INSERTION_REQUEST 16 1150Sstevel@tonic-gate #define PCE_REGISTRATION_COMPLETE 17 1160Sstevel@tonic-gate #define PCE_RESET_COMPLETE 18 1170Sstevel@tonic-gate #define PCE_RESET_PHYSICAL 19 1180Sstevel@tonic-gate #define PCE_RESET_REQUEST 20 1190Sstevel@tonic-gate #define PCE_TIMER_EXPIRED 21 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate /* added for SPARC CPR support */ 1220Sstevel@tonic-gate #define PCE_PM_RESUME 22 1230Sstevel@tonic-gate #define PCE_PM_SUSPEND 23 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate /* added for dynamic nexus registration */ 1260Sstevel@tonic-gate #define PCE_SS_INIT_STATE 24 /* SS init state */ 1270Sstevel@tonic-gate #define PCE_ADD_SOCKET 25 /* add a new socket */ 1280Sstevel@tonic-gate #define PCE_DROP_SOCKET 26 /* drop an existing socket */ 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate #define PCE_DEV_IDENT 30 /* The nexus has identified the device */ 1310Sstevel@tonic-gate #define PCE_INIT_DEV 31 /* asking for a device */ 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate #define PCE_E2M(event) (1 << (event)) 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate /* event callback uses an indirect call -- make it look like a function */ 1360Sstevel@tonic-gate #define CS_EVENT(event, socket, arg) (*pcmcia_cs_event) (event, socket, arg) 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate /* values for "socket number" field for PCE_SS_INIT_STATE event */ 1390Sstevel@tonic-gate #define PCE_SS_STATE_INIT 0x0001 /* SS ready for callbacks */ 1400Sstevel@tonic-gate #define PCE_SS_STATE_DEINIT 0x0002 /* SS not ready for callbacks */ 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate /* 1430Sstevel@tonic-gate * The following structure is to support CSRegister 1440Sstevel@tonic-gate */ 1450Sstevel@tonic-gate typedef struct csregister { 1460Sstevel@tonic-gate uint32_t cs_magic; /* magic number */ 1470Sstevel@tonic-gate uint32_t cs_version; /* CS version number */ 1480Sstevel@tonic-gate /* CS entry point */ 1490Sstevel@tonic-gate int (*cs_card_services)(int, ...); 1500Sstevel@tonic-gate /* CS event entry point */ 1510Sstevel@tonic-gate f_tt *cs_event; 1520Sstevel@tonic-gate } csregister_t; 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate /* GetAdapter(get_adapter_t) */ 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate typedef struct get_adapter { 1570Sstevel@tonic-gate unsigned state; /* adapter hardware state */ 1580Sstevel@tonic-gate irq_t SCRouting; /* status change IRQ routing */ 1590Sstevel@tonic-gate } get_adapter_t; 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate /* IRQ definitions */ 1620Sstevel@tonic-gate #define IRQ_ENABLE 0x8000 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate /* GetPage(get_page_t) */ 1650Sstevel@tonic-gate 1660Sstevel@tonic-gate typedef struct get_page { 1670Sstevel@tonic-gate unsigned window; /* window number */ 1680Sstevel@tonic-gate unsigned page; /* page number within window */ 1690Sstevel@tonic-gate unsigned state; /* page state: */ 1700Sstevel@tonic-gate /* 1710Sstevel@tonic-gate * PS_ATTRIBUTE 1720Sstevel@tonic-gate * PS_COMMON 1730Sstevel@tonic-gate * PS_IO (for DoRight?) 1740Sstevel@tonic-gate * PS_ENABLED 1750Sstevel@tonic-gate * PS_WP 1760Sstevel@tonic-gate */ 1770Sstevel@tonic-gate off_t offset; /* PC card's memory offset */ 1780Sstevel@tonic-gate } get_page_t; 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate /* 1810Sstevel@tonic-gate * PS flags 1820Sstevel@tonic-gate */ 1830Sstevel@tonic-gate 1840Sstevel@tonic-gate #define PS_ATTRIBUTE 0x01 1850Sstevel@tonic-gate #define PS_ENABLED 0x02 1860Sstevel@tonic-gate #define PS_WP 0x04 1870Sstevel@tonic-gate #define PS_IO 0x08 /* needed? for DoRight */ 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate /* GetSocket(get_socket_t) */ 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate typedef struct get_socket { 1920Sstevel@tonic-gate unsigned socket; /* socket number */ 1930Sstevel@tonic-gate unsigned SCIntMask; /* status change interrupt mask */ 1940Sstevel@tonic-gate unsigned VccLevel; /* VCC voltage in 1/10 volt */ 1950Sstevel@tonic-gate unsigned Vpp1Level; /* VPP1 voltage in 1/10 volt */ 1960Sstevel@tonic-gate unsigned Vpp2Level; /* VPP2 voltage in 1/10 volt */ 1970Sstevel@tonic-gate unsigned state; /* latched status change signals */ 1980Sstevel@tonic-gate unsigned CtlInd; /* controls and indicators */ 1990Sstevel@tonic-gate irq_t IRQRouting; /* I/O IRQ routing */ 2000Sstevel@tonic-gate unsigned IFType; /* memory-only or memory & I/O */ 2010Sstevel@tonic-gate } get_socket_t; 2020Sstevel@tonic-gate 2030Sstevel@tonic-gate /* GetStatus(get_ss_status_t) */ 2040Sstevel@tonic-gate 2050Sstevel@tonic-gate typedef struct get_ss_status { 2060Sstevel@tonic-gate unsigned socket; /* socket number */ 2070Sstevel@tonic-gate unsigned CardState; /* real-time card state */ 2080Sstevel@tonic-gate unsigned SocketState; /* latched status change signals */ 2090Sstevel@tonic-gate unsigned CtlInd; /* controls and indicators */ 2100Sstevel@tonic-gate irq_t IRQRouting; /* I/O IRQ routing */ 2110Sstevel@tonic-gate unsigned IFType; /* memory-only or memory & I/O */ 2120Sstevel@tonic-gate } get_ss_status_t; 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate /* 2150Sstevel@tonic-gate * Socket specific flags and capabilities 2160Sstevel@tonic-gate */ 2170Sstevel@tonic-gate 2180Sstevel@tonic-gate #define SBM_WP 0x01 2190Sstevel@tonic-gate #define SBM_LOCKED 0x02 2200Sstevel@tonic-gate #define SBM_EJECT 0x04 2210Sstevel@tonic-gate #define SBM_INSERT 0x08 2220Sstevel@tonic-gate #define SBM_BVD1 0x10 2230Sstevel@tonic-gate #define SBM_BVD2 0x20 2240Sstevel@tonic-gate #define SBM_RDYBSY 0x40 2250Sstevel@tonic-gate #define SBM_CD 0x80 2260Sstevel@tonic-gate 2270Sstevel@tonic-gate /* capabilities only */ 2280Sstevel@tonic-gate #define SBM_LOCK 0x10 2290Sstevel@tonic-gate #define SBM_BATT 0x20 2300Sstevel@tonic-gate #define SBM_BUSY 0x40 2310Sstevel@tonic-gate #define SBM_XID 0x80 2320Sstevel@tonic-gate 2330Sstevel@tonic-gate /* GetWindow(get_window_t) */ 2340Sstevel@tonic-gate typedef uint32_t speed_t; /* memory speed in nanoseconds */ 2350Sstevel@tonic-gate 2360Sstevel@tonic-gate typedef struct get_window { 2370Sstevel@tonic-gate unsigned window; /* window number */ 2380Sstevel@tonic-gate unsigned socket; /* socket this window is assigned to */ 2390Sstevel@tonic-gate unsigned size; /* size in bytes */ 2400Sstevel@tonic-gate unsigned state; /* current state of window hardware */ 2410Sstevel@tonic-gate uint_t speed; /* speed in nanoseconds */ 2420Sstevel@tonic-gate uint_t base; 2430Sstevel@tonic-gate ddi_acc_handle_t handle; /* base addr in host space */ 2440Sstevel@tonic-gate } get_window_t; 2450Sstevel@tonic-gate 2460Sstevel@tonic-gate /* 2470Sstevel@tonic-gate * window flags (state and capabilities) 2480Sstevel@tonic-gate */ 2490Sstevel@tonic-gate #define WS_IO 0x01 2500Sstevel@tonic-gate #define WS_ENABLED 0x02 2510Sstevel@tonic-gate #define WS_16BIT 0x04 2520Sstevel@tonic-gate #define WS_PAGED 0x80 2530Sstevel@tonic-gate #define WS_EISA 0x10 2540Sstevel@tonic-gate #define WS_CENABLE 0x20 2550Sstevel@tonic-gate #define WS_EXACT_MAPIN 0x40 /* map exactly what's asked for */ 2560Sstevel@tonic-gate 2570Sstevel@tonic-gate /* Inquire Adapter(inquire_adapter_t) */ 2580Sstevel@tonic-gate 2590Sstevel@tonic-gate typedef struct inquire_adapter { 2600Sstevel@tonic-gate unsigned NumSockets; /* number of sockets */ 2610Sstevel@tonic-gate unsigned NumWindows; /* number of windows */ 2620Sstevel@tonic-gate unsigned NumEDCs; /* number of EDCs */ 2630Sstevel@tonic-gate 2640Sstevel@tonic-gate unsigned AdpCaps; /* adapter power capabilities */ 2650Sstevel@tonic-gate irq_t ActiveHigh; /* active high status change IRQ */ 2660Sstevel@tonic-gate irq_t ActiveLow; /* active low status change IRQ */ 2670Sstevel@tonic-gate int NumPower; /* number of power entries */ 2680Sstevel@tonic-gate struct power_entry { 2690Sstevel@tonic-gate unsigned PowerLevel; /* voltage in 1/10 volt */ 2700Sstevel@tonic-gate unsigned ValidSignals; /* voltage is valid for: */ 2710Sstevel@tonic-gate /* 2720Sstevel@tonic-gate * VCC 2730Sstevel@tonic-gate * VPP1 2740Sstevel@tonic-gate * VPP2 2750Sstevel@tonic-gate * if none are set, this is end 2760Sstevel@tonic-gate * of list 2770Sstevel@tonic-gate */ 2780Sstevel@tonic-gate } *power_entry; 2790Sstevel@tonic-gate int NumInterrupts; /* number of interrupts supportable */ 2800Sstevel@tonic-gate struct intr_entry { 2810Sstevel@tonic-gate int pri; 2820Sstevel@tonic-gate int intr; 2830Sstevel@tonic-gate } *AvailInterrupts; /* array of intrs, one per intr */ 2840Sstevel@tonic-gate uint_t ResourceFlags; /* resource allocation requirements */ 2850Sstevel@tonic-gate } inquire_adapter_t; 2860Sstevel@tonic-gate 2870Sstevel@tonic-gate #define VCC 0x80 2880Sstevel@tonic-gate #define VPP1 0x40 2890Sstevel@tonic-gate #define VPP2 0x20 2900Sstevel@tonic-gate #define V_MASK (VCC|VPP1|VPP2) 2910Sstevel@tonic-gate 2920Sstevel@tonic-gate #define RES_OWN_IRQ 0x0001 /* adapter owns own IRQ resources */ 2930Sstevel@tonic-gate #define RES_OWN_IO 0x0002 /* adapter owns own I/O resources */ 2940Sstevel@tonic-gate #define RES_OWN_MEM 0x0004 /* adapter owns own memory resources */ 2950Sstevel@tonic-gate #define RES_IRQ_NEXUS 0x0008 /* adapter/nexus must multiplex IRQs */ 2960Sstevel@tonic-gate #define RES_IRQ_SHAREABLE 0x0010 /* IRQ can be shared */ 2970Sstevel@tonic-gate 2980Sstevel@tonic-gate /* InquireSocket(inquire_socket_t) */ 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate typedef struct inquire_socket { 3010Sstevel@tonic-gate unsigned socket; /* socket number */ 3020Sstevel@tonic-gate unsigned SCIntCaps; /* status change interrupt events */ 3030Sstevel@tonic-gate unsigned SCRptCaps; /* reportable status change events */ 3040Sstevel@tonic-gate unsigned CtlIndCaps; /* controls and indicators */ 3050Sstevel@tonic-gate unsigned SocketCaps; /* socket capabilities */ 3060Sstevel@tonic-gate irq_t ActiveHigh; /* active high status change IRQ */ 3070Sstevel@tonic-gate irq_t ActiveLow; /* active low status change IRQ */ 3080Sstevel@tonic-gate } inquire_socket_t; 3090Sstevel@tonic-gate 3100Sstevel@tonic-gate /* InquireWindow(inquire_window_t) */ 3110Sstevel@tonic-gate 3120Sstevel@tonic-gate typedef struct memwin_char { 3130Sstevel@tonic-gate unsigned MemWndCaps; /* memory window characteristcs */ 3140Sstevel@tonic-gate baseaddr_t FirstByte; /* first byte in host space */ 3150Sstevel@tonic-gate baseaddr_t LastByte; /* last byte in host space */ 3160Sstevel@tonic-gate unsigned MinSize; /* minimum window size */ 3170Sstevel@tonic-gate unsigned MaxSize; /* maximum window size */ 3180Sstevel@tonic-gate unsigned ReqGran; /* window size constraints */ 3190Sstevel@tonic-gate unsigned ReqBase; /* base address alignment boundry */ 3200Sstevel@tonic-gate unsigned ReqOffset; /* offset alignment boundry */ 3210Sstevel@tonic-gate unsigned Slowest; /* slowest speed in nanoseconds */ 3220Sstevel@tonic-gate unsigned Fastest; /* fastest speed in nanoseconds */ 3230Sstevel@tonic-gate } mem_win_char_t; 3240Sstevel@tonic-gate 3250Sstevel@tonic-gate typedef struct iowin_char { 3260Sstevel@tonic-gate unsigned IOWndCaps; /* I/O window characteristcs */ 3270Sstevel@tonic-gate baseaddr_t FirstByte; /* first byte in host space */ 3280Sstevel@tonic-gate baseaddr_t LastByte; /* last byte in host space */ 3290Sstevel@tonic-gate unsigned MinSize; /* minimum window size */ 3300Sstevel@tonic-gate unsigned MaxSize; /* maximum window size */ 3310Sstevel@tonic-gate unsigned ReqGran; /* window size constraints */ 3320Sstevel@tonic-gate unsigned AddrLines; /* number of address lines decoded */ 3330Sstevel@tonic-gate unsigned EISASlot; /* EISA I/O address decoding */ 3340Sstevel@tonic-gate } iowin_char_t; 3350Sstevel@tonic-gate 3360Sstevel@tonic-gate typedef struct inquire_window { 3370Sstevel@tonic-gate unsigned window; /* window number */ 3380Sstevel@tonic-gate unsigned WndCaps; /* window capabilities */ 3390Sstevel@tonic-gate socket_enum_t Sockets; /* window<->socket assignment mask */ 3400Sstevel@tonic-gate /* note that we always declare both forms */ 3410Sstevel@tonic-gate mem_win_char_t mem_win_char; 3420Sstevel@tonic-gate iowin_char_t iowin_char; 3430Sstevel@tonic-gate } inquire_window_t; 3440Sstevel@tonic-gate 3450Sstevel@tonic-gate 3460Sstevel@tonic-gate /* interface definitions */ 3470Sstevel@tonic-gate #define IF_CARDBUS 0x00 /* CardBus interface */ 3480Sstevel@tonic-gate #define IF_IO 0x01 /* IO + memory */ 3490Sstevel@tonic-gate #define IF_MEMORY 0x02 /* memory only */ 3500Sstevel@tonic-gate #define IF_TYPE_MASK 0x03 3510Sstevel@tonic-gate 3520Sstevel@tonic-gate #define DREQ_MASK 0x0c 3530Sstevel@tonic-gate #define DREQ_NONE 0x00 3540Sstevel@tonic-gate #define DREQ_SPKR 0x04 3550Sstevel@tonic-gate #define DREQ_IOIS16 0x08 3560Sstevel@tonic-gate #define DREQ_INPACK 0x0c 3570Sstevel@tonic-gate 3580Sstevel@tonic-gate #define DMA_CHAN_MASK 0xf0 3590Sstevel@tonic-gate #define DMA_GET_CHAN(x) (((x) >> 4) & 0xF) 3600Sstevel@tonic-gate #define DMA_SET_CHAN(x, y) (((x) & 0xF) | ((y) & ~DMA_CHAN_MASK)) 3610Sstevel@tonic-gate 3620Sstevel@tonic-gate #define IF_CB 0x04 3630Sstevel@tonic-gate #define IF_DMA 0x08 3640Sstevel@tonic-gate #define IF_VSKEY 0x10 3650Sstevel@tonic-gate #define IF_33VC 0x20 3660Sstevel@tonic-gate #define IF_XXVCC 0x40 3670Sstevel@tonic-gate 3680Sstevel@tonic-gate 3690Sstevel@tonic-gate #define PC_PAGESIZE 0x4000 /* 16K page size */ 3700Sstevel@tonic-gate 3710Sstevel@tonic-gate /* window capabilities */ 3720Sstevel@tonic-gate /* generic */ 3730Sstevel@tonic-gate #define WC_IO 0x0004 3740Sstevel@tonic-gate #define WC_WAIT 0x0080 3750Sstevel@tonic-gate #define WC_COMMON 0x0001 3760Sstevel@tonic-gate #define WC_ATTRIBUTE 0x0002 3770Sstevel@tonic-gate /* I/O and memory */ 3780Sstevel@tonic-gate #define WC_BASE 0x0001 3790Sstevel@tonic-gate #define WC_SIZE 0x0002 3800Sstevel@tonic-gate #define WC_WENABLE 0x0004 3810Sstevel@tonic-gate #define WC_8BIT 0x0008 3820Sstevel@tonic-gate #define WC_16BIT 0x0010 3830Sstevel@tonic-gate #define WC_BALIGN 0x0020 3840Sstevel@tonic-gate #define WC_POW2 0x0040 3850Sstevel@tonic-gate /* memory only */ 3860Sstevel@tonic-gate #define WC_CALIGN 0x0080 3870Sstevel@tonic-gate #define WC_PAVAIL 0x0100 3880Sstevel@tonic-gate #define WC_PSHARED 0x0200 3890Sstevel@tonic-gate #define WC_PENABLE 0x0400 3900Sstevel@tonic-gate #define WC_WP 0x0800 3910Sstevel@tonic-gate /* I/O only */ 3920Sstevel@tonic-gate #define WC_INPACK 0x0080 3930Sstevel@tonic-gate #define WC_EISA 0x0100 3940Sstevel@tonic-gate #define WC_CENABLE 0x0200 3950Sstevel@tonic-gate /* Solaris/SPARC */ 3960Sstevel@tonic-gate #define WC_IO_RANGE_PER_WINDOW 0x8000 /* I/O range unique for each window */ 3970Sstevel@tonic-gate 3980Sstevel@tonic-gate /* SetPage(set_page_t *) */ 3990Sstevel@tonic-gate typedef struct set_page { 4000Sstevel@tonic-gate unsigned window; /* window number */ 4010Sstevel@tonic-gate unsigned page; /* page number */ 4020Sstevel@tonic-gate unsigned state; /* page state */ 4030Sstevel@tonic-gate off_t offset; /* offset in PC card space */ 4040Sstevel@tonic-gate } set_page_t; 4050Sstevel@tonic-gate 4060Sstevel@tonic-gate /* SetSocket(set_socket_t) */ 4070Sstevel@tonic-gate 4080Sstevel@tonic-gate typedef struct set_socket { 4090Sstevel@tonic-gate unsigned socket; /* socket number */ 4100Sstevel@tonic-gate unsigned SCIntMask; /* status change enables */ 4110Sstevel@tonic-gate unsigned Vcontrol; /* power control flags */ 4120Sstevel@tonic-gate unsigned VccLevel; /* Vcc power index level */ 4130Sstevel@tonic-gate unsigned Vpp1Level; /* Vpp1 power index level */ 4140Sstevel@tonic-gate unsigned Vpp2Level; /* Vpp2 power index level */ 4150Sstevel@tonic-gate unsigned State; 4160Sstevel@tonic-gate unsigned CtlInd; /* control and indicator bits */ 4170Sstevel@tonic-gate irq_t IREQRouting; /* I/O IRQ routing */ 4180Sstevel@tonic-gate unsigned IFType; /* interface type (mem/IO) */ 4190Sstevel@tonic-gate } set_socket_t; 4200Sstevel@tonic-gate 4210Sstevel@tonic-gate #define VCTL_CISREAD 0x01 /* controlled by Vcc/Vpp sense pins */ 4220Sstevel@tonic-gate #define VCTL_OVERRIDE 0x02 /* 16-bit cards, ignore the sense pins */ 4230Sstevel@tonic-gate 4240Sstevel@tonic-gate /* SetIRQHandler(set_irq_handler_t) */ 4250Sstevel@tonic-gate 4260Sstevel@tonic-gate typedef struct set_irq_handler { 4270Sstevel@tonic-gate unsigned socket; /* associate with a socket for now */ 4280Sstevel@tonic-gate unsigned irq; 4290Sstevel@tonic-gate unsigned handler_id; /* ID of this client's handler */ 4300Sstevel@tonic-gate f_tt *handler; /* client IO IRQ handler entry point */ 4310Sstevel@tonic-gate void *arg1; /* arg to call client handler with */ 4320Sstevel@tonic-gate void *arg2; /* arg to call client handler with */ 4330Sstevel@tonic-gate ddi_iblock_cookie_t *iblk_cookie; /* iblk cookie pointer */ 4340Sstevel@tonic-gate ddi_idevice_cookie_t *idev_cookie; /* idev cookie pointer */ 4350Sstevel@tonic-gate } set_irq_handler_t; 4360Sstevel@tonic-gate 4370Sstevel@tonic-gate #define IRQ_ANY 0x0 4380Sstevel@tonic-gate 4390Sstevel@tonic-gate /* interrupt priority levels */ 4400Sstevel@tonic-gate #define PRIORITY_LOW 0x00 4410Sstevel@tonic-gate #define PRIORITY_HIGH 0x10 4420Sstevel@tonic-gate 4430Sstevel@tonic-gate /* ClearIRQHandler(clear_irq_handler_t) */ 4440Sstevel@tonic-gate 4450Sstevel@tonic-gate typedef struct clear_irq_handler { 4460Sstevel@tonic-gate unsigned socket; 4470Sstevel@tonic-gate unsigned handler_id; /* client handler ID to remove */ 4480Sstevel@tonic-gate f_tt *handler; /* client IO IRQ handler entry point */ 4490Sstevel@tonic-gate } clear_irq_handler_t; 4500Sstevel@tonic-gate 4510Sstevel@tonic-gate /* SetWindow(set_window_t) */ 4520Sstevel@tonic-gate 4530Sstevel@tonic-gate typedef struct set_window { 4540Sstevel@tonic-gate unsigned window; /* window number */ 4550Sstevel@tonic-gate unsigned socket; /* socket number */ 4560Sstevel@tonic-gate unsigned WindowSize; /* window size in bytes */ 4570Sstevel@tonic-gate unsigned state; /* window state */ 4580Sstevel@tonic-gate unsigned speed; /* window speed, nanoseconds */ 4590Sstevel@tonic-gate uint_t base; 4600Sstevel@tonic-gate ddi_acc_handle_t handle; /* base addr in host space */ 4610Sstevel@tonic-gate dev_info_t *child; /* child's dip */ 4620Sstevel@tonic-gate ddi_device_acc_attr_t attr; 4630Sstevel@tonic-gate } set_window_t; 4640Sstevel@tonic-gate 4650Sstevel@tonic-gate /* CSInitDev */ 4660Sstevel@tonic-gate typedef 4670Sstevel@tonic-gate struct ss_make_device_node { 4680Sstevel@tonic-gate uint32_t flags; /* operation flags */ 4690Sstevel@tonic-gate dev_info_t *dip; /* dip for this client */ 4700Sstevel@tonic-gate char *name; /* device node path and name */ 4710Sstevel@tonic-gate char *slot; /* slot name string */ 4720Sstevel@tonic-gate char *busaddr; /* bus addr name string */ 4730Sstevel@tonic-gate int spec_type; /* dev special type (block/char) */ 4740Sstevel@tonic-gate int minor_num; /* device node minor number */ 4750Sstevel@tonic-gate char *node_type; /* device node type */ 4760Sstevel@tonic-gate } ss_make_device_node_t; 4770Sstevel@tonic-gate 4780Sstevel@tonic-gate #define SS_CSINITDEV_CREATE_DEVICE 0x01 /* create device node */ 4790Sstevel@tonic-gate #define SS_CSINITDEV_REMOVE_DEVICE 0x02 /* remove device node */ 4800Sstevel@tonic-gate #define SS_CSINITDEV_USE_SLOT 0x04 /* use slot name from caller */ 4810Sstevel@tonic-gate #define SS_CSINITDEV_USE_BUSADDR 0x08 /* use bus addr from caller */ 4820Sstevel@tonic-gate #define SS_CSINITDEV_MORE_DEVICES 0x10 /* send PCE_INIT_DEV */ 4830Sstevel@tonic-gate #define SS_CSINITDEV_SEND_DEV_EVENT 0x10 /* send PCE_INIT_DEV */ 4840Sstevel@tonic-gate 4850Sstevel@tonic-gate /* 4860Sstevel@tonic-gate * csss_adapter_info_t - provides additional per-socket adapter info 4870Sstevel@tonic-gate */ 4880Sstevel@tonic-gate typedef struct csss_adapter_info_t { 4890Sstevel@tonic-gate char name[MODMAXNAMELEN]; /* adapter name */ 4900Sstevel@tonic-gate int major; /* adapter major number */ 4910Sstevel@tonic-gate int minor; /* adapter minor number */ 4920Sstevel@tonic-gate int number; /* canonical adapter number */ 4930Sstevel@tonic-gate int num_sockets; /* # sockets on this adapter */ 4940Sstevel@tonic-gate int first_socket; /* first socket # on this adapter */ 4950Sstevel@tonic-gate } csss_adapter_info_t; 4960Sstevel@tonic-gate 4970Sstevel@tonic-gate /* CSGetCookiesAndDip */ 4980Sstevel@tonic-gate typedef struct get_cookies_and_dip_t { 4990Sstevel@tonic-gate unsigned socket; /* socket number */ 5000Sstevel@tonic-gate dev_info_t *dip; /* adapter instance dip */ 5010Sstevel@tonic-gate ddi_iblock_cookie_t *iblock; /* for event handler */ 5020Sstevel@tonic-gate ddi_idevice_cookie_t *idevice; /* for event handler */ 5030Sstevel@tonic-gate csss_adapter_info_t adapter_info; /* adapter info for socket */ 5040Sstevel@tonic-gate } get_cookies_and_dip_t; 5050Sstevel@tonic-gate 5060Sstevel@tonic-gate /* ResetSocket */ 5070Sstevel@tonic-gate #define RESET_MODE_FULL 0 /* Reset to SocketServices Specification */ 5080Sstevel@tonic-gate #define RESET_MODE_CARD_ONLY 1 /* only reset the card itself */ 5090Sstevel@tonic-gate 5100Sstevel@tonic-gate /* union of all exported functions functions */ 5110Sstevel@tonic-gate typedef 5120Sstevel@tonic-gate union sservice { 5130Sstevel@tonic-gate get_adapter_t get_adapter; 5140Sstevel@tonic-gate get_page_t get_page; 5150Sstevel@tonic-gate get_socket_t get_socket; 5160Sstevel@tonic-gate get_window_t get_window; 5170Sstevel@tonic-gate get_ss_status_t get_ss_status; 5180Sstevel@tonic-gate inquire_adapter_t inquire_adapter; 5190Sstevel@tonic-gate inquire_socket_t inquire_socket; 5200Sstevel@tonic-gate inquire_window_t inquire_window; 5210Sstevel@tonic-gate set_page_t set_page; 5220Sstevel@tonic-gate set_socket_t set_socket; 5230Sstevel@tonic-gate set_irq_handler_t set_irq_handler; 5240Sstevel@tonic-gate set_window_t set_window; 5250Sstevel@tonic-gate get_cookies_and_dip_t get_cookies; 5260Sstevel@tonic-gate ss_make_device_node_t make_device; 5270Sstevel@tonic-gate } sservice_t; 5280Sstevel@tonic-gate 5290Sstevel@tonic-gate /* event manager structures */ 5300Sstevel@tonic-gate struct pcm_make_dev { 5310Sstevel@tonic-gate int socket; 5320Sstevel@tonic-gate int flags; 5330Sstevel@tonic-gate int op; 5340Sstevel@tonic-gate dev_t dev; 5350Sstevel@tonic-gate int type; 5360Sstevel@tonic-gate char driver[MODMAXNAMELEN]; 5370Sstevel@tonic-gate char path[MAXPATHLEN]; 5380Sstevel@tonic-gate }; 5390Sstevel@tonic-gate 5400Sstevel@tonic-gate #define PCM_EVENT_MORE 0x0001 /* more events of this type coming */ 5410Sstevel@tonic-gate 5420Sstevel@tonic-gate #ifdef _KERNEL 5430Sstevel@tonic-gate 5440Sstevel@tonic-gate #include <sys/sunndi.h> 5450Sstevel@tonic-gate 5460Sstevel@tonic-gate /* 5470Sstevel@tonic-gate * prototypes for nexi 5480Sstevel@tonic-gate */ 5490Sstevel@tonic-gate 5500Sstevel@tonic-gate int pcmcia_attach(dev_info_t *, struct pcmcia_adapter_nexus_private *); 5510Sstevel@tonic-gate int pcmcia_ctlops(dev_info_t *, dev_info_t *, ddi_ctl_enum_t, void *, void *); 5520Sstevel@tonic-gate int pcmcia_prop_op(dev_t, dev_info_t *, dev_info_t *, ddi_prop_op_t, 5530Sstevel@tonic-gate int, char *, caddr_t, int *); 5540Sstevel@tonic-gate int pcmcia_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, 5550Sstevel@tonic-gate ddi_intr_handle_impl_t *hdlp, void *result); 5560Sstevel@tonic-gate 5570Sstevel@tonic-gate int pcmcia_open(dev_t *, int, int, cred_t *); 5580Sstevel@tonic-gate int pcmcia_close(dev_t, int, int, cred_t *); 5590Sstevel@tonic-gate int pcmcia_ioctl(dev_t, int, intptr_t, int, cred_t *, int *); 5600Sstevel@tonic-gate int pcmcia_power(dev_info_t *, int, int); 5610Sstevel@tonic-gate void pcmcia_begin_resume(dev_info_t *); 5620Sstevel@tonic-gate void pcmcia_wait_insert(dev_info_t *); 5630Sstevel@tonic-gate 5640Sstevel@tonic-gate 5650Sstevel@tonic-gate /* resource allocation functions and structure */ 5660Sstevel@tonic-gate typedef struct ra_return { 5670Sstevel@tonic-gate uint_t ra_addr_hi; 5680Sstevel@tonic-gate uint_t ra_addr_lo; 5690Sstevel@tonic-gate uint_t ra_len; 5700Sstevel@tonic-gate } ra_return_t; 5710Sstevel@tonic-gate 572*3664Srw148561 int pcmcia_alloc_mem(dev_info_t *, ndi_ra_request_t *, ra_return_t *, 573*3664Srw148561 dev_info_t **); 574*3664Srw148561 int pcmcia_alloc_io(dev_info_t *, ndi_ra_request_t *, ra_return_t *, 575*3664Srw148561 dev_info_t **); 5760Sstevel@tonic-gate int pcmcia_free_mem(dev_info_t *, ra_return_t *); 5770Sstevel@tonic-gate int pcmcia_free_io(dev_info_t *, ra_return_t *); 5780Sstevel@tonic-gate int pcmcia_map_reg(dev_info_t *, dev_info_t *, ra_return_t *, 5790Sstevel@tonic-gate uint32_t, caddr_t *, ddi_acc_handle_t *, 5800Sstevel@tonic-gate ddi_device_acc_attr_t *, uint32_t); 5810Sstevel@tonic-gate int pcmcia_bus_map(dev_info_t *, dev_info_t *, ddi_map_req_t *, 5820Sstevel@tonic-gate off_t, off_t, caddr_t *); 5830Sstevel@tonic-gate 5840Sstevel@tonic-gate #endif /* _KERNEL */ 5850Sstevel@tonic-gate 5860Sstevel@tonic-gate #ifdef __cplusplus 5870Sstevel@tonic-gate } 5880Sstevel@tonic-gate #endif 5890Sstevel@tonic-gate 5900Sstevel@tonic-gate #endif /* _SSERVICE_H */ 591