sservice.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SSERVICE_H
#define _SSERVICE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
typedef int(f_tt)(int, ...); /* for lint - cc -v quieting */
/*
* identifiers for all SS functions implemented
*/
#define SS_GetAdapter 0
#define SS_GetPage 1
#define SS_GetSocket 2
#define SS_GetStatus 3
#define SS_GetWindow 4
#define SS_InquireAdapter 5
#define SS_InquireSocket 6
#define SS_InquireWindow 7
#define SS_ResetSocket 8
#define SS_SetPage 9
#define SS_SetAdapter 10
#define SS_SetSocket 11
#define SS_SetWindow 12
#define SS_SetIRQHandler 13
#define SS_ClearIRQHandler 14
#define CSGetActiveDip 98
#define CSInitDev 99
#define CSRegister 100
#define CSCISInit 101
#define CSUnregister 102
/*
* XXX
*/
#define CISGetAddress 103
#define CISSetAddress 104
#define CSCardRemoved 105
#define CSGetCookiesAndDip 106
/*
* returns a la Socket Services
*/
#define SUCCESS 0x00
#define BAD_ADAPTER 0x01
#define BAD_ATTRIBUTE 0x02
#define BAD_BASE 0x03
#define BAD_EDC 0x04
#define BAD_IRQ 0x06
#define BAD_OFFSET 0x07
#define BAD_PAGE 0x08
#define READ_FAILURE 0x09
#define BAD_SIZE 0x0a
#define BAD_SOCKET 0x0b
#define BAD_TYPE 0x0d
#define BAD_VCC 0x0e
#define BAD_VPP 0x0f
#define BAD_WINDOW 0x11
#define WRITE_FAILURE 0x12
#define NO_CARD 0x14
#define BAD_FUNCTION 0x15
#define BAD_MODE 0x16
#define BAD_SPEED 0x17
#define BUSY 0x18
#define NO_RESOURCE 0x20
/* events for callback */
/* card related events */
#define PCE_CARD_REMOVAL 0 /* card removed */
#define PCE_EXCLUSIVE_COMPLETE 13
#define PCE_EXCLUSIVE_REQUEST 14
#define PCE_INSERTION_COMPLETE 15
#define PCE_INSERTION_REQUEST 16
#define PCE_REGISTRATION_COMPLETE 17
#define PCE_RESET_COMPLETE 18
#define PCE_RESET_PHYSICAL 19
#define PCE_RESET_REQUEST 20
#define PCE_TIMER_EXPIRED 21
/* added for SPARC CPR support */
#define PCE_PM_RESUME 22
#define PCE_PM_SUSPEND 23
/* added for dynamic nexus registration */
/* event callback uses an indirect call -- make it look like a function */
/* values for "socket number" field for PCE_SS_INIT_STATE event */
/*
* The following structure is to support CSRegister
*/
typedef struct csregister {
/* CS entry point */
int (*cs_card_services)(int, ...);
/* CS event entry point */
} csregister_t;
/* GetAdapter(get_adapter_t) */
typedef struct get_adapter {
unsigned state; /* adapter hardware state */
/* IRQ definitions */
#define IRQ_ENABLE 0x8000
/* GetPage(get_page_t) */
typedef struct get_page {
unsigned window; /* window number */
unsigned page; /* page number within window */
unsigned state; /* page state: */
/*
* PS_ATTRIBUTE
* PS_COMMON
* PS_IO (for DoRight?)
* PS_ENABLED
* PS_WP
*/
} get_page_t;
/*
* PS flags
*/
#define PS_ATTRIBUTE 0x01
#define PS_ENABLED 0x02
#define PS_WP 0x04
/* GetSocket(get_socket_t) */
typedef struct get_socket {
unsigned socket; /* socket number */
unsigned SCIntMask; /* status change interrupt mask */
unsigned VccLevel; /* VCC voltage in 1/10 volt */
unsigned Vpp1Level; /* VPP1 voltage in 1/10 volt */
unsigned Vpp2Level; /* VPP2 voltage in 1/10 volt */
unsigned state; /* latched status change signals */
unsigned CtlInd; /* controls and indicators */
unsigned IFType; /* memory-only or memory & I/O */
} get_socket_t;
/* GetStatus(get_ss_status_t) */
typedef struct get_ss_status {
unsigned socket; /* socket number */
unsigned CardState; /* real-time card state */
unsigned SocketState; /* latched status change signals */
unsigned CtlInd; /* controls and indicators */
unsigned IFType; /* memory-only or memory & I/O */
/*
* Socket specific flags and capabilities
*/
#define SBM_WP 0x01
#define SBM_LOCKED 0x02
#define SBM_EJECT 0x04
#define SBM_INSERT 0x08
#define SBM_BVD1 0x10
#define SBM_BVD2 0x20
#define SBM_RDYBSY 0x40
#define SBM_CD 0x80
/* capabilities only */
#define SBM_LOCK 0x10
#define SBM_BATT 0x20
#define SBM_BUSY 0x40
#define SBM_XID 0x80
/* GetWindow(get_window_t) */
typedef struct get_window {
unsigned window; /* window number */
unsigned socket; /* socket this window is assigned to */
unsigned size; /* size in bytes */
unsigned state; /* current state of window hardware */
} get_window_t;
/*
* window flags (state and capabilities)
*/
#define WS_IO 0x01
#define WS_ENABLED 0x02
#define WS_16BIT 0x04
#define WS_PAGED 0x80
#define WS_EISA 0x10
#define WS_CENABLE 0x20
/* Inquire Adapter(inquire_adapter_t) */
typedef struct inquire_adapter {
unsigned NumSockets; /* number of sockets */
unsigned NumWindows; /* number of windows */
unsigned NumEDCs; /* number of EDCs */
unsigned AdpCaps; /* adapter power capabilities */
int NumPower; /* number of power entries */
struct power_entry {
unsigned PowerLevel; /* voltage in 1/10 volt */
unsigned ValidSignals; /* voltage is valid for: */
/*
* VCC
* VPP1
* VPP2
* if none are set, this is end
* of list
*/
} *power_entry;
int NumInterrupts; /* number of interrupts supportable */
struct intr_entry {
int pri;
int intr;
} *AvailInterrupts; /* array of intrs, one per intr */
#define VCC 0x80
#define VPP1 0x40
#define VPP2 0x20
/* InquireSocket(inquire_socket_t) */
typedef struct inquire_socket {
unsigned socket; /* socket number */
unsigned SCIntCaps; /* status change interrupt events */
unsigned SCRptCaps; /* reportable status change events */
unsigned CtlIndCaps; /* controls and indicators */
unsigned SocketCaps; /* socket capabilities */
/* InquireWindow(inquire_window_t) */
typedef struct memwin_char {
unsigned MemWndCaps; /* memory window characteristcs */
unsigned MinSize; /* minimum window size */
unsigned MaxSize; /* maximum window size */
unsigned ReqGran; /* window size constraints */
unsigned ReqBase; /* base address alignment boundry */
unsigned ReqOffset; /* offset alignment boundry */
unsigned Slowest; /* slowest speed in nanoseconds */
unsigned Fastest; /* fastest speed in nanoseconds */
typedef struct iowin_char {
unsigned IOWndCaps; /* I/O window characteristcs */
unsigned MinSize; /* minimum window size */
unsigned MaxSize; /* maximum window size */
unsigned ReqGran; /* window size constraints */
unsigned AddrLines; /* number of address lines decoded */
unsigned EISASlot; /* EISA I/O address decoding */
} iowin_char_t;
typedef struct inquire_window {
unsigned window; /* window number */
unsigned WndCaps; /* window capabilities */
/* note that we always declare both forms */
/* interface definitions */
#define IF_TYPE_MASK 0x03
#define DREQ_MASK 0x0c
#define DREQ_NONE 0x00
#define DREQ_SPKR 0x04
#define DREQ_IOIS16 0x08
#define DREQ_INPACK 0x0c
#define DMA_CHAN_MASK 0xf0
#define IF_CB 0x04
#define IF_DMA 0x08
#define IF_VSKEY 0x10
#define IF_33VC 0x20
#define IF_XXVCC 0x40
/* window capabilities */
/* generic */
#define WC_IO 0x0004
#define WC_WAIT 0x0080
#define WC_COMMON 0x0001
#define WC_ATTRIBUTE 0x0002
/* I/O and memory */
#define WC_BASE 0x0001
#define WC_SIZE 0x0002
#define WC_WENABLE 0x0004
#define WC_8BIT 0x0008
#define WC_16BIT 0x0010
#define WC_BALIGN 0x0020
#define WC_POW2 0x0040
/* memory only */
#define WC_CALIGN 0x0080
#define WC_PAVAIL 0x0100
#define WC_PSHARED 0x0200
#define WC_PENABLE 0x0400
#define WC_WP 0x0800
/* I/O only */
#define WC_INPACK 0x0080
#define WC_EISA 0x0100
#define WC_CENABLE 0x0200
/* SetPage(set_page_t *) */
typedef struct set_page {
unsigned window; /* window number */
unsigned page; /* page number */
unsigned state; /* page state */
} set_page_t;
/* SetSocket(set_socket_t) */
typedef struct set_socket {
unsigned socket; /* socket number */
unsigned SCIntMask; /* status change enables */
unsigned Vcontrol; /* power control flags */
unsigned VccLevel; /* Vcc power index level */
unsigned Vpp1Level; /* Vpp1 power index level */
unsigned Vpp2Level; /* Vpp2 power index level */
unsigned State;
unsigned CtlInd; /* control and indicator bits */
} set_socket_t;
/* SetIRQHandler(set_irq_handler_t) */
typedef struct set_irq_handler {
unsigned socket; /* associate with a socket for now */
unsigned irq;
unsigned handler_id; /* ID of this client's handler */
void *arg1; /* arg to call client handler with */
void *arg2; /* arg to call client handler with */
#define IRQ_ANY 0x0
/* interrupt priority levels */
#define PRIORITY_LOW 0x00
#define PRIORITY_HIGH 0x10
/* ClearIRQHandler(clear_irq_handler_t) */
typedef struct clear_irq_handler {
unsigned socket;
unsigned handler_id; /* client handler ID to remove */
/* SetWindow(set_window_t) */
typedef struct set_window {
unsigned window; /* window number */
unsigned socket; /* socket number */
unsigned WindowSize; /* window size in bytes */
unsigned state; /* window state */
unsigned speed; /* window speed, nanoseconds */
} set_window_t;
/* CSInitDev */
typedef
struct ss_make_device_node {
char *name; /* device node path and name */
char *slot; /* slot name string */
char *busaddr; /* bus addr name string */
int minor_num; /* device node minor number */
char *node_type; /* device node type */
/*
* csss_adapter_info_t - provides additional per-socket adapter info
*/
typedef struct csss_adapter_info_t {
int major; /* adapter major number */
int minor; /* adapter minor number */
int number; /* canonical adapter number */
int num_sockets; /* # sockets on this adapter */
int first_socket; /* first socket # on this adapter */
/* CSGetCookiesAndDip */
typedef struct get_cookies_and_dip_t {
unsigned socket; /* socket number */
/* ResetSocket */
#define RESET_MODE_FULL 0 /* Reset to SocketServices Specification */
/* union of all exported functions functions */
typedef
union sservice {
} sservice_t;
/* event manager structures */
struct pcm_make_dev {
int socket;
int flags;
int op;
int type;
char driver[MODMAXNAMELEN];
char path[MAXPATHLEN];
};
#ifdef _KERNEL
/*
* prototypes for nexi
*/
int, char *, caddr_t, int *);
int pcmcia_power(dev_info_t *, int, int);
void pcmcia_begin_resume(dev_info_t *);
void pcmcia_wait_insert(dev_info_t *);
/* resource allocation functions and structure */
typedef struct ra_return {
} ra_return_t;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SSERVICE_H */