17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*8134ee03Srw148561 * Common Development and Distribution License (the "License"). 6*8134ee03Srw148561 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*8134ee03Srw148561 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SSERVICE_H 277c478bd9Sstevel@tonic-gate #define _SSERVICE_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate typedef int(f_tt)(int, ...); /* for lint - cc -v quieting */ 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate /* 387c478bd9Sstevel@tonic-gate * identifiers for all SS functions implemented 397c478bd9Sstevel@tonic-gate */ 407c478bd9Sstevel@tonic-gate #define SS_GetAdapter 0 417c478bd9Sstevel@tonic-gate #define SS_GetPage 1 427c478bd9Sstevel@tonic-gate #define SS_GetSocket 2 437c478bd9Sstevel@tonic-gate #define SS_GetStatus 3 447c478bd9Sstevel@tonic-gate #define SS_GetWindow 4 457c478bd9Sstevel@tonic-gate #define SS_InquireAdapter 5 467c478bd9Sstevel@tonic-gate #define SS_InquireSocket 6 477c478bd9Sstevel@tonic-gate #define SS_InquireWindow 7 487c478bd9Sstevel@tonic-gate #define SS_ResetSocket 8 497c478bd9Sstevel@tonic-gate #define SS_SetPage 9 507c478bd9Sstevel@tonic-gate #define SS_SetAdapter 10 517c478bd9Sstevel@tonic-gate #define SS_SetSocket 11 527c478bd9Sstevel@tonic-gate #define SS_SetWindow 12 537c478bd9Sstevel@tonic-gate #define SS_SetIRQHandler 13 547c478bd9Sstevel@tonic-gate #define SS_ClearIRQHandler 14 557c478bd9Sstevel@tonic-gate #define CSGetActiveDip 98 567c478bd9Sstevel@tonic-gate #define CSInitDev 99 577c478bd9Sstevel@tonic-gate #define CSRegister 100 587c478bd9Sstevel@tonic-gate #define CSCISInit 101 597c478bd9Sstevel@tonic-gate #define CSUnregister 102 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate /* 627c478bd9Sstevel@tonic-gate * XXX 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate #define CISGetAddress 103 657c478bd9Sstevel@tonic-gate #define CISSetAddress 104 667c478bd9Sstevel@tonic-gate #define CSCardRemoved 105 677c478bd9Sstevel@tonic-gate #define CSGetCookiesAndDip 106 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * returns a la Socket Services 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate #define SUCCESS 0x00 747c478bd9Sstevel@tonic-gate #define BAD_ADAPTER 0x01 757c478bd9Sstevel@tonic-gate #define BAD_ATTRIBUTE 0x02 767c478bd9Sstevel@tonic-gate #define BAD_BASE 0x03 777c478bd9Sstevel@tonic-gate #define BAD_EDC 0x04 787c478bd9Sstevel@tonic-gate #define BAD_IRQ 0x06 797c478bd9Sstevel@tonic-gate #define BAD_OFFSET 0x07 807c478bd9Sstevel@tonic-gate #define BAD_PAGE 0x08 817c478bd9Sstevel@tonic-gate #define READ_FAILURE 0x09 827c478bd9Sstevel@tonic-gate #define BAD_SIZE 0x0a 837c478bd9Sstevel@tonic-gate #define BAD_SOCKET 0x0b 847c478bd9Sstevel@tonic-gate #define BAD_TYPE 0x0d 857c478bd9Sstevel@tonic-gate #define BAD_VCC 0x0e 867c478bd9Sstevel@tonic-gate #define BAD_VPP 0x0f 877c478bd9Sstevel@tonic-gate #define BAD_WINDOW 0x11 887c478bd9Sstevel@tonic-gate #define WRITE_FAILURE 0x12 897c478bd9Sstevel@tonic-gate #define NO_CARD 0x14 907c478bd9Sstevel@tonic-gate #define BAD_FUNCTION 0x15 917c478bd9Sstevel@tonic-gate #define BAD_MODE 0x16 927c478bd9Sstevel@tonic-gate #define BAD_SPEED 0x17 937c478bd9Sstevel@tonic-gate #define BUSY 0x18 947c478bd9Sstevel@tonic-gate #define NO_RESOURCE 0x20 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* events for callback */ 977c478bd9Sstevel@tonic-gate /* card related events */ 987c478bd9Sstevel@tonic-gate #define PCE_CARD_REMOVAL 0 /* card removed */ 997c478bd9Sstevel@tonic-gate #define PCE_CARD_INSERT 1 /* card inserted */ 1007c478bd9Sstevel@tonic-gate #define PCE_CARD_READY 2 /* ready state changed */ 1017c478bd9Sstevel@tonic-gate #define PCE_CARD_BATTERY_WARN 3 /* battery is getting low */ 1027c478bd9Sstevel@tonic-gate #define PCE_CARD_BATTERY_DEAD 4 /* battery is dead */ 1037c478bd9Sstevel@tonic-gate #define PCE_CARD_STATUS_CHANGE 5 /* card status change for I/O card */ 1047c478bd9Sstevel@tonic-gate #define PCE_CARD_WRITE_PROTECT 6 /* card write protect status change */ 1057c478bd9Sstevel@tonic-gate #define PCE_CARD_RESET 7 /* client requested reset complete */ 1067c478bd9Sstevel@tonic-gate #define PCE_CARD_UNLOCK 8 /* lock has been unlocked (opt) */ 1077c478bd9Sstevel@tonic-gate #define PCE_CLIENT_INFO 9 /* someone wants client information */ 1087c478bd9Sstevel@tonic-gate #define PCE_EJECTION_COMPLETE 10 /* Motor has finished ejecting card */ 1097c478bd9Sstevel@tonic-gate #define PCE_EJECTION_REQUEST 11 /* request to eject card */ 1107c478bd9Sstevel@tonic-gate #define PCE_ERASE_COMPLETE 12 /* a Flash Erase request completed */ 1117c478bd9Sstevel@tonic-gate #define PCE_EXCLUSIVE_COMPLETE 13 1127c478bd9Sstevel@tonic-gate #define PCE_EXCLUSIVE_REQUEST 14 1137c478bd9Sstevel@tonic-gate #define PCE_INSERTION_COMPLETE 15 1147c478bd9Sstevel@tonic-gate #define PCE_INSERTION_REQUEST 16 1157c478bd9Sstevel@tonic-gate #define PCE_REGISTRATION_COMPLETE 17 1167c478bd9Sstevel@tonic-gate #define PCE_RESET_COMPLETE 18 1177c478bd9Sstevel@tonic-gate #define PCE_RESET_PHYSICAL 19 1187c478bd9Sstevel@tonic-gate #define PCE_RESET_REQUEST 20 1197c478bd9Sstevel@tonic-gate #define PCE_TIMER_EXPIRED 21 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* added for SPARC CPR support */ 1227c478bd9Sstevel@tonic-gate #define PCE_PM_RESUME 22 1237c478bd9Sstevel@tonic-gate #define PCE_PM_SUSPEND 23 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate /* added for dynamic nexus registration */ 1267c478bd9Sstevel@tonic-gate #define PCE_SS_INIT_STATE 24 /* SS init state */ 1277c478bd9Sstevel@tonic-gate #define PCE_ADD_SOCKET 25 /* add a new socket */ 1287c478bd9Sstevel@tonic-gate #define PCE_DROP_SOCKET 26 /* drop an existing socket */ 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate #define PCE_DEV_IDENT 30 /* The nexus has identified the device */ 1317c478bd9Sstevel@tonic-gate #define PCE_INIT_DEV 31 /* asking for a device */ 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate #define PCE_E2M(event) (1 << (event)) 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate /* event callback uses an indirect call -- make it look like a function */ 1367c478bd9Sstevel@tonic-gate #define CS_EVENT(event, socket, arg) (*pcmcia_cs_event) (event, socket, arg) 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate /* values for "socket number" field for PCE_SS_INIT_STATE event */ 1397c478bd9Sstevel@tonic-gate #define PCE_SS_STATE_INIT 0x0001 /* SS ready for callbacks */ 1407c478bd9Sstevel@tonic-gate #define PCE_SS_STATE_DEINIT 0x0002 /* SS not ready for callbacks */ 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate /* 1437c478bd9Sstevel@tonic-gate * The following structure is to support CSRegister 1447c478bd9Sstevel@tonic-gate */ 1457c478bd9Sstevel@tonic-gate typedef struct csregister { 1467c478bd9Sstevel@tonic-gate uint32_t cs_magic; /* magic number */ 1477c478bd9Sstevel@tonic-gate uint32_t cs_version; /* CS version number */ 1487c478bd9Sstevel@tonic-gate /* CS entry point */ 1497c478bd9Sstevel@tonic-gate int (*cs_card_services)(int, ...); 1507c478bd9Sstevel@tonic-gate /* CS event entry point */ 1517c478bd9Sstevel@tonic-gate f_tt *cs_event; 1527c478bd9Sstevel@tonic-gate } csregister_t; 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate /* GetAdapter(get_adapter_t) */ 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate typedef struct get_adapter { 1577c478bd9Sstevel@tonic-gate unsigned state; /* adapter hardware state */ 1587c478bd9Sstevel@tonic-gate irq_t SCRouting; /* status change IRQ routing */ 1597c478bd9Sstevel@tonic-gate } get_adapter_t; 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate /* IRQ definitions */ 1627c478bd9Sstevel@tonic-gate #define IRQ_ENABLE 0x8000 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate /* GetPage(get_page_t) */ 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate typedef struct get_page { 1677c478bd9Sstevel@tonic-gate unsigned window; /* window number */ 1687c478bd9Sstevel@tonic-gate unsigned page; /* page number within window */ 1697c478bd9Sstevel@tonic-gate unsigned state; /* page state: */ 1707c478bd9Sstevel@tonic-gate /* 1717c478bd9Sstevel@tonic-gate * PS_ATTRIBUTE 1727c478bd9Sstevel@tonic-gate * PS_COMMON 1737c478bd9Sstevel@tonic-gate * PS_IO (for DoRight?) 1747c478bd9Sstevel@tonic-gate * PS_ENABLED 1757c478bd9Sstevel@tonic-gate * PS_WP 1767c478bd9Sstevel@tonic-gate */ 1777c478bd9Sstevel@tonic-gate off_t offset; /* PC card's memory offset */ 1787c478bd9Sstevel@tonic-gate } get_page_t; 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate /* 1817c478bd9Sstevel@tonic-gate * PS flags 1827c478bd9Sstevel@tonic-gate */ 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate #define PS_ATTRIBUTE 0x01 1857c478bd9Sstevel@tonic-gate #define PS_ENABLED 0x02 1867c478bd9Sstevel@tonic-gate #define PS_WP 0x04 1877c478bd9Sstevel@tonic-gate #define PS_IO 0x08 /* needed? for DoRight */ 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate /* GetSocket(get_socket_t) */ 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate typedef struct get_socket { 1927c478bd9Sstevel@tonic-gate unsigned socket; /* socket number */ 1937c478bd9Sstevel@tonic-gate unsigned SCIntMask; /* status change interrupt mask */ 1947c478bd9Sstevel@tonic-gate unsigned VccLevel; /* VCC voltage in 1/10 volt */ 1957c478bd9Sstevel@tonic-gate unsigned Vpp1Level; /* VPP1 voltage in 1/10 volt */ 1967c478bd9Sstevel@tonic-gate unsigned Vpp2Level; /* VPP2 voltage in 1/10 volt */ 1977c478bd9Sstevel@tonic-gate unsigned state; /* latched status change signals */ 1987c478bd9Sstevel@tonic-gate unsigned CtlInd; /* controls and indicators */ 1997c478bd9Sstevel@tonic-gate irq_t IRQRouting; /* I/O IRQ routing */ 2007c478bd9Sstevel@tonic-gate unsigned IFType; /* memory-only or memory & I/O */ 2017c478bd9Sstevel@tonic-gate } get_socket_t; 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate /* GetStatus(get_ss_status_t) */ 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate typedef struct get_ss_status { 2067c478bd9Sstevel@tonic-gate unsigned socket; /* socket number */ 2077c478bd9Sstevel@tonic-gate unsigned CardState; /* real-time card state */ 2087c478bd9Sstevel@tonic-gate unsigned SocketState; /* latched status change signals */ 2097c478bd9Sstevel@tonic-gate unsigned CtlInd; /* controls and indicators */ 2107c478bd9Sstevel@tonic-gate irq_t IRQRouting; /* I/O IRQ routing */ 2117c478bd9Sstevel@tonic-gate unsigned IFType; /* memory-only or memory & I/O */ 2127c478bd9Sstevel@tonic-gate } get_ss_status_t; 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate /* 2157c478bd9Sstevel@tonic-gate * Socket specific flags and capabilities 2167c478bd9Sstevel@tonic-gate */ 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate #define SBM_WP 0x01 2197c478bd9Sstevel@tonic-gate #define SBM_LOCKED 0x02 2207c478bd9Sstevel@tonic-gate #define SBM_EJECT 0x04 2217c478bd9Sstevel@tonic-gate #define SBM_INSERT 0x08 2227c478bd9Sstevel@tonic-gate #define SBM_BVD1 0x10 2237c478bd9Sstevel@tonic-gate #define SBM_BVD2 0x20 2247c478bd9Sstevel@tonic-gate #define SBM_RDYBSY 0x40 2257c478bd9Sstevel@tonic-gate #define SBM_CD 0x80 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate /* capabilities only */ 2287c478bd9Sstevel@tonic-gate #define SBM_LOCK 0x10 2297c478bd9Sstevel@tonic-gate #define SBM_BATT 0x20 2307c478bd9Sstevel@tonic-gate #define SBM_BUSY 0x40 2317c478bd9Sstevel@tonic-gate #define SBM_XID 0x80 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate /* GetWindow(get_window_t) */ 2347c478bd9Sstevel@tonic-gate typedef uint32_t speed_t; /* memory speed in nanoseconds */ 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate typedef struct get_window { 2377c478bd9Sstevel@tonic-gate unsigned window; /* window number */ 2387c478bd9Sstevel@tonic-gate unsigned socket; /* socket this window is assigned to */ 2397c478bd9Sstevel@tonic-gate unsigned size; /* size in bytes */ 2407c478bd9Sstevel@tonic-gate unsigned state; /* current state of window hardware */ 2417c478bd9Sstevel@tonic-gate uint_t speed; /* speed in nanoseconds */ 2427c478bd9Sstevel@tonic-gate uint_t base; 2437c478bd9Sstevel@tonic-gate ddi_acc_handle_t handle; /* base addr in host space */ 2447c478bd9Sstevel@tonic-gate } get_window_t; 2457c478bd9Sstevel@tonic-gate 2467c478bd9Sstevel@tonic-gate /* 2477c478bd9Sstevel@tonic-gate * window flags (state and capabilities) 2487c478bd9Sstevel@tonic-gate */ 2497c478bd9Sstevel@tonic-gate #define WS_IO 0x01 2507c478bd9Sstevel@tonic-gate #define WS_ENABLED 0x02 2517c478bd9Sstevel@tonic-gate #define WS_16BIT 0x04 2527c478bd9Sstevel@tonic-gate #define WS_PAGED 0x80 2537c478bd9Sstevel@tonic-gate #define WS_EISA 0x10 2547c478bd9Sstevel@tonic-gate #define WS_CENABLE 0x20 2557c478bd9Sstevel@tonic-gate #define WS_EXACT_MAPIN 0x40 /* map exactly what's asked for */ 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gate /* Inquire Adapter(inquire_adapter_t) */ 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate typedef struct inquire_adapter { 2607c478bd9Sstevel@tonic-gate unsigned NumSockets; /* number of sockets */ 2617c478bd9Sstevel@tonic-gate unsigned NumWindows; /* number of windows */ 2627c478bd9Sstevel@tonic-gate unsigned NumEDCs; /* number of EDCs */ 2637c478bd9Sstevel@tonic-gate 2647c478bd9Sstevel@tonic-gate unsigned AdpCaps; /* adapter power capabilities */ 2657c478bd9Sstevel@tonic-gate irq_t ActiveHigh; /* active high status change IRQ */ 2667c478bd9Sstevel@tonic-gate irq_t ActiveLow; /* active low status change IRQ */ 2677c478bd9Sstevel@tonic-gate int NumPower; /* number of power entries */ 2687c478bd9Sstevel@tonic-gate struct power_entry { 2697c478bd9Sstevel@tonic-gate unsigned PowerLevel; /* voltage in 1/10 volt */ 2707c478bd9Sstevel@tonic-gate unsigned ValidSignals; /* voltage is valid for: */ 2717c478bd9Sstevel@tonic-gate /* 2727c478bd9Sstevel@tonic-gate * VCC 2737c478bd9Sstevel@tonic-gate * VPP1 2747c478bd9Sstevel@tonic-gate * VPP2 2757c478bd9Sstevel@tonic-gate * if none are set, this is end 2767c478bd9Sstevel@tonic-gate * of list 2777c478bd9Sstevel@tonic-gate */ 2787c478bd9Sstevel@tonic-gate } *power_entry; 2797c478bd9Sstevel@tonic-gate int NumInterrupts; /* number of interrupts supportable */ 2807c478bd9Sstevel@tonic-gate struct intr_entry { 2817c478bd9Sstevel@tonic-gate int pri; 2827c478bd9Sstevel@tonic-gate int intr; 2837c478bd9Sstevel@tonic-gate } *AvailInterrupts; /* array of intrs, one per intr */ 2847c478bd9Sstevel@tonic-gate uint_t ResourceFlags; /* resource allocation requirements */ 2857c478bd9Sstevel@tonic-gate } inquire_adapter_t; 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate #define VCC 0x80 2887c478bd9Sstevel@tonic-gate #define VPP1 0x40 2897c478bd9Sstevel@tonic-gate #define VPP2 0x20 2907c478bd9Sstevel@tonic-gate #define V_MASK (VCC|VPP1|VPP2) 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate #define RES_OWN_IRQ 0x0001 /* adapter owns own IRQ resources */ 2937c478bd9Sstevel@tonic-gate #define RES_OWN_IO 0x0002 /* adapter owns own I/O resources */ 2947c478bd9Sstevel@tonic-gate #define RES_OWN_MEM 0x0004 /* adapter owns own memory resources */ 2957c478bd9Sstevel@tonic-gate #define RES_IRQ_NEXUS 0x0008 /* adapter/nexus must multiplex IRQs */ 2967c478bd9Sstevel@tonic-gate #define RES_IRQ_SHAREABLE 0x0010 /* IRQ can be shared */ 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate /* InquireSocket(inquire_socket_t) */ 2997c478bd9Sstevel@tonic-gate 3007c478bd9Sstevel@tonic-gate typedef struct inquire_socket { 3017c478bd9Sstevel@tonic-gate unsigned socket; /* socket number */ 3027c478bd9Sstevel@tonic-gate unsigned SCIntCaps; /* status change interrupt events */ 3037c478bd9Sstevel@tonic-gate unsigned SCRptCaps; /* reportable status change events */ 3047c478bd9Sstevel@tonic-gate unsigned CtlIndCaps; /* controls and indicators */ 3057c478bd9Sstevel@tonic-gate unsigned SocketCaps; /* socket capabilities */ 3067c478bd9Sstevel@tonic-gate irq_t ActiveHigh; /* active high status change IRQ */ 3077c478bd9Sstevel@tonic-gate irq_t ActiveLow; /* active low status change IRQ */ 3087c478bd9Sstevel@tonic-gate } inquire_socket_t; 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate /* InquireWindow(inquire_window_t) */ 3117c478bd9Sstevel@tonic-gate 3127c478bd9Sstevel@tonic-gate typedef struct memwin_char { 3137c478bd9Sstevel@tonic-gate unsigned MemWndCaps; /* memory window characteristcs */ 3147c478bd9Sstevel@tonic-gate baseaddr_t FirstByte; /* first byte in host space */ 3157c478bd9Sstevel@tonic-gate baseaddr_t LastByte; /* last byte in host space */ 3167c478bd9Sstevel@tonic-gate unsigned MinSize; /* minimum window size */ 3177c478bd9Sstevel@tonic-gate unsigned MaxSize; /* maximum window size */ 3187c478bd9Sstevel@tonic-gate unsigned ReqGran; /* window size constraints */ 3197c478bd9Sstevel@tonic-gate unsigned ReqBase; /* base address alignment boundry */ 3207c478bd9Sstevel@tonic-gate unsigned ReqOffset; /* offset alignment boundry */ 3217c478bd9Sstevel@tonic-gate unsigned Slowest; /* slowest speed in nanoseconds */ 3227c478bd9Sstevel@tonic-gate unsigned Fastest; /* fastest speed in nanoseconds */ 3237c478bd9Sstevel@tonic-gate } mem_win_char_t; 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate typedef struct iowin_char { 3267c478bd9Sstevel@tonic-gate unsigned IOWndCaps; /* I/O window characteristcs */ 3277c478bd9Sstevel@tonic-gate baseaddr_t FirstByte; /* first byte in host space */ 3287c478bd9Sstevel@tonic-gate baseaddr_t LastByte; /* last byte in host space */ 3297c478bd9Sstevel@tonic-gate unsigned MinSize; /* minimum window size */ 3307c478bd9Sstevel@tonic-gate unsigned MaxSize; /* maximum window size */ 3317c478bd9Sstevel@tonic-gate unsigned ReqGran; /* window size constraints */ 3327c478bd9Sstevel@tonic-gate unsigned AddrLines; /* number of address lines decoded */ 3337c478bd9Sstevel@tonic-gate unsigned EISASlot; /* EISA I/O address decoding */ 3347c478bd9Sstevel@tonic-gate } iowin_char_t; 3357c478bd9Sstevel@tonic-gate 3367c478bd9Sstevel@tonic-gate typedef struct inquire_window { 3377c478bd9Sstevel@tonic-gate unsigned window; /* window number */ 3387c478bd9Sstevel@tonic-gate unsigned WndCaps; /* window capabilities */ 3397c478bd9Sstevel@tonic-gate socket_enum_t Sockets; /* window<->socket assignment mask */ 3407c478bd9Sstevel@tonic-gate /* note that we always declare both forms */ 3417c478bd9Sstevel@tonic-gate mem_win_char_t mem_win_char; 3427c478bd9Sstevel@tonic-gate iowin_char_t iowin_char; 3437c478bd9Sstevel@tonic-gate } inquire_window_t; 3447c478bd9Sstevel@tonic-gate 3457c478bd9Sstevel@tonic-gate 3467c478bd9Sstevel@tonic-gate /* interface definitions */ 3477c478bd9Sstevel@tonic-gate #define IF_CARDBUS 0x00 /* CardBus interface */ 3487c478bd9Sstevel@tonic-gate #define IF_IO 0x01 /* IO + memory */ 3497c478bd9Sstevel@tonic-gate #define IF_MEMORY 0x02 /* memory only */ 3507c478bd9Sstevel@tonic-gate #define IF_TYPE_MASK 0x03 3517c478bd9Sstevel@tonic-gate 3527c478bd9Sstevel@tonic-gate #define DREQ_MASK 0x0c 3537c478bd9Sstevel@tonic-gate #define DREQ_NONE 0x00 3547c478bd9Sstevel@tonic-gate #define DREQ_SPKR 0x04 3557c478bd9Sstevel@tonic-gate #define DREQ_IOIS16 0x08 3567c478bd9Sstevel@tonic-gate #define DREQ_INPACK 0x0c 3577c478bd9Sstevel@tonic-gate 3587c478bd9Sstevel@tonic-gate #define DMA_CHAN_MASK 0xf0 3597c478bd9Sstevel@tonic-gate #define DMA_GET_CHAN(x) (((x) >> 4) & 0xF) 3607c478bd9Sstevel@tonic-gate #define DMA_SET_CHAN(x, y) (((x) & 0xF) | ((y) & ~DMA_CHAN_MASK)) 3617c478bd9Sstevel@tonic-gate 3627c478bd9Sstevel@tonic-gate #define IF_CB 0x04 3637c478bd9Sstevel@tonic-gate #define IF_DMA 0x08 3647c478bd9Sstevel@tonic-gate #define IF_VSKEY 0x10 3657c478bd9Sstevel@tonic-gate #define IF_33VC 0x20 3667c478bd9Sstevel@tonic-gate #define IF_XXVCC 0x40 3677c478bd9Sstevel@tonic-gate 3687c478bd9Sstevel@tonic-gate 3697c478bd9Sstevel@tonic-gate #define PC_PAGESIZE 0x4000 /* 16K page size */ 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate /* window capabilities */ 3727c478bd9Sstevel@tonic-gate /* generic */ 3737c478bd9Sstevel@tonic-gate #define WC_IO 0x0004 3747c478bd9Sstevel@tonic-gate #define WC_WAIT 0x0080 3757c478bd9Sstevel@tonic-gate #define WC_COMMON 0x0001 3767c478bd9Sstevel@tonic-gate #define WC_ATTRIBUTE 0x0002 3777c478bd9Sstevel@tonic-gate /* I/O and memory */ 3787c478bd9Sstevel@tonic-gate #define WC_BASE 0x0001 3797c478bd9Sstevel@tonic-gate #define WC_SIZE 0x0002 3807c478bd9Sstevel@tonic-gate #define WC_WENABLE 0x0004 3817c478bd9Sstevel@tonic-gate #define WC_8BIT 0x0008 3827c478bd9Sstevel@tonic-gate #define WC_16BIT 0x0010 3837c478bd9Sstevel@tonic-gate #define WC_BALIGN 0x0020 3847c478bd9Sstevel@tonic-gate #define WC_POW2 0x0040 3857c478bd9Sstevel@tonic-gate /* memory only */ 3867c478bd9Sstevel@tonic-gate #define WC_CALIGN 0x0080 3877c478bd9Sstevel@tonic-gate #define WC_PAVAIL 0x0100 3887c478bd9Sstevel@tonic-gate #define WC_PSHARED 0x0200 3897c478bd9Sstevel@tonic-gate #define WC_PENABLE 0x0400 3907c478bd9Sstevel@tonic-gate #define WC_WP 0x0800 3917c478bd9Sstevel@tonic-gate /* I/O only */ 3927c478bd9Sstevel@tonic-gate #define WC_INPACK 0x0080 3937c478bd9Sstevel@tonic-gate #define WC_EISA 0x0100 3947c478bd9Sstevel@tonic-gate #define WC_CENABLE 0x0200 3957c478bd9Sstevel@tonic-gate /* Solaris/SPARC */ 3967c478bd9Sstevel@tonic-gate #define WC_IO_RANGE_PER_WINDOW 0x8000 /* I/O range unique for each window */ 3977c478bd9Sstevel@tonic-gate 3987c478bd9Sstevel@tonic-gate /* SetPage(set_page_t *) */ 3997c478bd9Sstevel@tonic-gate typedef struct set_page { 4007c478bd9Sstevel@tonic-gate unsigned window; /* window number */ 4017c478bd9Sstevel@tonic-gate unsigned page; /* page number */ 4027c478bd9Sstevel@tonic-gate unsigned state; /* page state */ 4037c478bd9Sstevel@tonic-gate off_t offset; /* offset in PC card space */ 4047c478bd9Sstevel@tonic-gate } set_page_t; 4057c478bd9Sstevel@tonic-gate 4067c478bd9Sstevel@tonic-gate /* SetSocket(set_socket_t) */ 4077c478bd9Sstevel@tonic-gate 4087c478bd9Sstevel@tonic-gate typedef struct set_socket { 4097c478bd9Sstevel@tonic-gate unsigned socket; /* socket number */ 4107c478bd9Sstevel@tonic-gate unsigned SCIntMask; /* status change enables */ 4117c478bd9Sstevel@tonic-gate unsigned Vcontrol; /* power control flags */ 4127c478bd9Sstevel@tonic-gate unsigned VccLevel; /* Vcc power index level */ 4137c478bd9Sstevel@tonic-gate unsigned Vpp1Level; /* Vpp1 power index level */ 4147c478bd9Sstevel@tonic-gate unsigned Vpp2Level; /* Vpp2 power index level */ 4157c478bd9Sstevel@tonic-gate unsigned State; 4167c478bd9Sstevel@tonic-gate unsigned CtlInd; /* control and indicator bits */ 4177c478bd9Sstevel@tonic-gate irq_t IREQRouting; /* I/O IRQ routing */ 4187c478bd9Sstevel@tonic-gate unsigned IFType; /* interface type (mem/IO) */ 4197c478bd9Sstevel@tonic-gate } set_socket_t; 4207c478bd9Sstevel@tonic-gate 4217c478bd9Sstevel@tonic-gate #define VCTL_CISREAD 0x01 /* controlled by Vcc/Vpp sense pins */ 4227c478bd9Sstevel@tonic-gate #define VCTL_OVERRIDE 0x02 /* 16-bit cards, ignore the sense pins */ 4237c478bd9Sstevel@tonic-gate 4247c478bd9Sstevel@tonic-gate /* SetIRQHandler(set_irq_handler_t) */ 4257c478bd9Sstevel@tonic-gate 4267c478bd9Sstevel@tonic-gate typedef struct set_irq_handler { 4277c478bd9Sstevel@tonic-gate unsigned socket; /* associate with a socket for now */ 4287c478bd9Sstevel@tonic-gate unsigned irq; 4297c478bd9Sstevel@tonic-gate unsigned handler_id; /* ID of this client's handler */ 4307c478bd9Sstevel@tonic-gate f_tt *handler; /* client IO IRQ handler entry point */ 4317c478bd9Sstevel@tonic-gate void *arg1; /* arg to call client handler with */ 4327c478bd9Sstevel@tonic-gate void *arg2; /* arg to call client handler with */ 4337c478bd9Sstevel@tonic-gate ddi_iblock_cookie_t *iblk_cookie; /* iblk cookie pointer */ 4347c478bd9Sstevel@tonic-gate ddi_idevice_cookie_t *idev_cookie; /* idev cookie pointer */ 4357c478bd9Sstevel@tonic-gate } set_irq_handler_t; 4367c478bd9Sstevel@tonic-gate 4377c478bd9Sstevel@tonic-gate #define IRQ_ANY 0x0 4387c478bd9Sstevel@tonic-gate 4397c478bd9Sstevel@tonic-gate /* interrupt priority levels */ 4407c478bd9Sstevel@tonic-gate #define PRIORITY_LOW 0x00 4417c478bd9Sstevel@tonic-gate #define PRIORITY_HIGH 0x10 4427c478bd9Sstevel@tonic-gate 4437c478bd9Sstevel@tonic-gate /* ClearIRQHandler(clear_irq_handler_t) */ 4447c478bd9Sstevel@tonic-gate 4457c478bd9Sstevel@tonic-gate typedef struct clear_irq_handler { 4467c478bd9Sstevel@tonic-gate unsigned socket; 4477c478bd9Sstevel@tonic-gate unsigned handler_id; /* client handler ID to remove */ 4487c478bd9Sstevel@tonic-gate f_tt *handler; /* client IO IRQ handler entry point */ 4497c478bd9Sstevel@tonic-gate } clear_irq_handler_t; 4507c478bd9Sstevel@tonic-gate 4517c478bd9Sstevel@tonic-gate /* SetWindow(set_window_t) */ 4527c478bd9Sstevel@tonic-gate 4537c478bd9Sstevel@tonic-gate typedef struct set_window { 4547c478bd9Sstevel@tonic-gate unsigned window; /* window number */ 4557c478bd9Sstevel@tonic-gate unsigned socket; /* socket number */ 4567c478bd9Sstevel@tonic-gate unsigned WindowSize; /* window size in bytes */ 4577c478bd9Sstevel@tonic-gate unsigned state; /* window state */ 4587c478bd9Sstevel@tonic-gate unsigned speed; /* window speed, nanoseconds */ 4597c478bd9Sstevel@tonic-gate uint_t base; 4607c478bd9Sstevel@tonic-gate ddi_acc_handle_t handle; /* base addr in host space */ 4617c478bd9Sstevel@tonic-gate dev_info_t *child; /* child's dip */ 4627c478bd9Sstevel@tonic-gate ddi_device_acc_attr_t attr; 4637c478bd9Sstevel@tonic-gate } set_window_t; 4647c478bd9Sstevel@tonic-gate 4657c478bd9Sstevel@tonic-gate /* CSInitDev */ 4667c478bd9Sstevel@tonic-gate typedef 4677c478bd9Sstevel@tonic-gate struct ss_make_device_node { 4687c478bd9Sstevel@tonic-gate uint32_t flags; /* operation flags */ 4697c478bd9Sstevel@tonic-gate dev_info_t *dip; /* dip for this client */ 4707c478bd9Sstevel@tonic-gate char *name; /* device node path and name */ 4717c478bd9Sstevel@tonic-gate char *slot; /* slot name string */ 4727c478bd9Sstevel@tonic-gate char *busaddr; /* bus addr name string */ 4737c478bd9Sstevel@tonic-gate int spec_type; /* dev special type (block/char) */ 4747c478bd9Sstevel@tonic-gate int minor_num; /* device node minor number */ 4757c478bd9Sstevel@tonic-gate char *node_type; /* device node type */ 4767c478bd9Sstevel@tonic-gate } ss_make_device_node_t; 4777c478bd9Sstevel@tonic-gate 4787c478bd9Sstevel@tonic-gate #define SS_CSINITDEV_CREATE_DEVICE 0x01 /* create device node */ 4797c478bd9Sstevel@tonic-gate #define SS_CSINITDEV_REMOVE_DEVICE 0x02 /* remove device node */ 4807c478bd9Sstevel@tonic-gate #define SS_CSINITDEV_USE_SLOT 0x04 /* use slot name from caller */ 4817c478bd9Sstevel@tonic-gate #define SS_CSINITDEV_USE_BUSADDR 0x08 /* use bus addr from caller */ 4827c478bd9Sstevel@tonic-gate #define SS_CSINITDEV_MORE_DEVICES 0x10 /* send PCE_INIT_DEV */ 4837c478bd9Sstevel@tonic-gate #define SS_CSINITDEV_SEND_DEV_EVENT 0x10 /* send PCE_INIT_DEV */ 4847c478bd9Sstevel@tonic-gate 4857c478bd9Sstevel@tonic-gate /* 4867c478bd9Sstevel@tonic-gate * csss_adapter_info_t - provides additional per-socket adapter info 4877c478bd9Sstevel@tonic-gate */ 4887c478bd9Sstevel@tonic-gate typedef struct csss_adapter_info_t { 4897c478bd9Sstevel@tonic-gate char name[MODMAXNAMELEN]; /* adapter name */ 4907c478bd9Sstevel@tonic-gate int major; /* adapter major number */ 4917c478bd9Sstevel@tonic-gate int minor; /* adapter minor number */ 4927c478bd9Sstevel@tonic-gate int number; /* canonical adapter number */ 4937c478bd9Sstevel@tonic-gate int num_sockets; /* # sockets on this adapter */ 4947c478bd9Sstevel@tonic-gate int first_socket; /* first socket # on this adapter */ 4957c478bd9Sstevel@tonic-gate } csss_adapter_info_t; 4967c478bd9Sstevel@tonic-gate 4977c478bd9Sstevel@tonic-gate /* CSGetCookiesAndDip */ 4987c478bd9Sstevel@tonic-gate typedef struct get_cookies_and_dip_t { 4997c478bd9Sstevel@tonic-gate unsigned socket; /* socket number */ 5007c478bd9Sstevel@tonic-gate dev_info_t *dip; /* adapter instance dip */ 5017c478bd9Sstevel@tonic-gate ddi_iblock_cookie_t *iblock; /* for event handler */ 5027c478bd9Sstevel@tonic-gate ddi_idevice_cookie_t *idevice; /* for event handler */ 5037c478bd9Sstevel@tonic-gate csss_adapter_info_t adapter_info; /* adapter info for socket */ 5047c478bd9Sstevel@tonic-gate } get_cookies_and_dip_t; 5057c478bd9Sstevel@tonic-gate 5067c478bd9Sstevel@tonic-gate /* ResetSocket */ 5077c478bd9Sstevel@tonic-gate #define RESET_MODE_FULL 0 /* Reset to SocketServices Specification */ 5087c478bd9Sstevel@tonic-gate #define RESET_MODE_CARD_ONLY 1 /* only reset the card itself */ 5097c478bd9Sstevel@tonic-gate 5107c478bd9Sstevel@tonic-gate /* union of all exported functions functions */ 5117c478bd9Sstevel@tonic-gate typedef 5127c478bd9Sstevel@tonic-gate union sservice { 5137c478bd9Sstevel@tonic-gate get_adapter_t get_adapter; 5147c478bd9Sstevel@tonic-gate get_page_t get_page; 5157c478bd9Sstevel@tonic-gate get_socket_t get_socket; 5167c478bd9Sstevel@tonic-gate get_window_t get_window; 5177c478bd9Sstevel@tonic-gate get_ss_status_t get_ss_status; 5187c478bd9Sstevel@tonic-gate inquire_adapter_t inquire_adapter; 5197c478bd9Sstevel@tonic-gate inquire_socket_t inquire_socket; 5207c478bd9Sstevel@tonic-gate inquire_window_t inquire_window; 5217c478bd9Sstevel@tonic-gate set_page_t set_page; 5227c478bd9Sstevel@tonic-gate set_socket_t set_socket; 5237c478bd9Sstevel@tonic-gate set_irq_handler_t set_irq_handler; 5247c478bd9Sstevel@tonic-gate set_window_t set_window; 5257c478bd9Sstevel@tonic-gate get_cookies_and_dip_t get_cookies; 5267c478bd9Sstevel@tonic-gate ss_make_device_node_t make_device; 5277c478bd9Sstevel@tonic-gate } sservice_t; 5287c478bd9Sstevel@tonic-gate 5297c478bd9Sstevel@tonic-gate /* event manager structures */ 5307c478bd9Sstevel@tonic-gate struct pcm_make_dev { 5317c478bd9Sstevel@tonic-gate int socket; 5327c478bd9Sstevel@tonic-gate int flags; 5337c478bd9Sstevel@tonic-gate int op; 5347c478bd9Sstevel@tonic-gate dev_t dev; 5357c478bd9Sstevel@tonic-gate int type; 5367c478bd9Sstevel@tonic-gate char driver[MODMAXNAMELEN]; 5377c478bd9Sstevel@tonic-gate char path[MAXPATHLEN]; 5387c478bd9Sstevel@tonic-gate }; 5397c478bd9Sstevel@tonic-gate 5407c478bd9Sstevel@tonic-gate #define PCM_EVENT_MORE 0x0001 /* more events of this type coming */ 5417c478bd9Sstevel@tonic-gate 5427c478bd9Sstevel@tonic-gate #ifdef _KERNEL 5437c478bd9Sstevel@tonic-gate 5447c478bd9Sstevel@tonic-gate #include <sys/sunndi.h> 5457c478bd9Sstevel@tonic-gate 5467c478bd9Sstevel@tonic-gate /* 5477c478bd9Sstevel@tonic-gate * prototypes for nexi 5487c478bd9Sstevel@tonic-gate */ 5497c478bd9Sstevel@tonic-gate 5507c478bd9Sstevel@tonic-gate int pcmcia_attach(dev_info_t *, struct pcmcia_adapter_nexus_private *); 5517c478bd9Sstevel@tonic-gate int pcmcia_ctlops(dev_info_t *, dev_info_t *, ddi_ctl_enum_t, void *, void *); 5527c478bd9Sstevel@tonic-gate int pcmcia_prop_op(dev_t, dev_info_t *, dev_info_t *, ddi_prop_op_t, 5537c478bd9Sstevel@tonic-gate int, char *, caddr_t, int *); 5547c478bd9Sstevel@tonic-gate int pcmcia_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, 5557c478bd9Sstevel@tonic-gate ddi_intr_handle_impl_t *hdlp, void *result); 5567c478bd9Sstevel@tonic-gate 5577c478bd9Sstevel@tonic-gate int pcmcia_open(dev_t *, int, int, cred_t *); 5587c478bd9Sstevel@tonic-gate int pcmcia_close(dev_t, int, int, cred_t *); 5597c478bd9Sstevel@tonic-gate int pcmcia_ioctl(dev_t, int, intptr_t, int, cred_t *, int *); 5607c478bd9Sstevel@tonic-gate int pcmcia_power(dev_info_t *, int, int); 5617c478bd9Sstevel@tonic-gate void pcmcia_begin_resume(dev_info_t *); 5627c478bd9Sstevel@tonic-gate void pcmcia_wait_insert(dev_info_t *); 5637c478bd9Sstevel@tonic-gate 5647c478bd9Sstevel@tonic-gate 5657c478bd9Sstevel@tonic-gate /* resource allocation functions and structure */ 5667c478bd9Sstevel@tonic-gate typedef struct ra_return { 5677c478bd9Sstevel@tonic-gate uint_t ra_addr_hi; 5687c478bd9Sstevel@tonic-gate uint_t ra_addr_lo; 5697c478bd9Sstevel@tonic-gate uint_t ra_len; 5707c478bd9Sstevel@tonic-gate } ra_return_t; 5717c478bd9Sstevel@tonic-gate 572*8134ee03Srw148561 int pcmcia_alloc_mem(dev_info_t *, ndi_ra_request_t *, ra_return_t *, 573*8134ee03Srw148561 dev_info_t **); 574*8134ee03Srw148561 int pcmcia_alloc_io(dev_info_t *, ndi_ra_request_t *, ra_return_t *, 575*8134ee03Srw148561 dev_info_t **); 5767c478bd9Sstevel@tonic-gate int pcmcia_free_mem(dev_info_t *, ra_return_t *); 5777c478bd9Sstevel@tonic-gate int pcmcia_free_io(dev_info_t *, ra_return_t *); 5787c478bd9Sstevel@tonic-gate int pcmcia_map_reg(dev_info_t *, dev_info_t *, ra_return_t *, 5797c478bd9Sstevel@tonic-gate uint32_t, caddr_t *, ddi_acc_handle_t *, 5807c478bd9Sstevel@tonic-gate ddi_device_acc_attr_t *, uint32_t); 5817c478bd9Sstevel@tonic-gate int pcmcia_bus_map(dev_info_t *, dev_info_t *, ddi_map_req_t *, 5827c478bd9Sstevel@tonic-gate off_t, off_t, caddr_t *); 5837c478bd9Sstevel@tonic-gate 5847c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 5857c478bd9Sstevel@tonic-gate 5867c478bd9Sstevel@tonic-gate #ifdef __cplusplus 5877c478bd9Sstevel@tonic-gate } 5887c478bd9Sstevel@tonic-gate #endif 5897c478bd9Sstevel@tonic-gate 5907c478bd9Sstevel@tonic-gate #endif /* _SSERVICE_H */ 591