pcmcia.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.
*/
/*
* PCMCIA nexus
*/
#ifndef _PCMCIA_H
#define _PCMCIA_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(DEBUG)
#define PCMCIA_DEBUG
#endif
#define PCMCIA_MAX_WIN_ADAPT 40
/*
*/
#define PCMCIA_NEXUS_NAME "pcmcia"
#define PCMCIA_ADAPTER_NODE "ddi_pcmcia:adapter"
#define PCMCIA_SOCKET_NODE "ddi_pcmcia:socket"
#define PCMCIA_PCCARD_NODE "ddi_pcmcia:pccard"
/*
* private interface between nexus and adapter specific driver
* This is only an "ops" type structure
*/
typedef struct pcmcia_if {
int (*pcif_set_callback)();
int (*pcif_get_adapter)();
int (*pcif_get_page)();
int (*pcif_get_socket)();
int (*pcif_get_status)();
int (*pcif_get_window)();
int (*pcif_inquire_adapter)();
int (*pcif_inquire_socket)();
int (*pcif_inquire_window)();
int (*pcif_reset_socket)();
int (*pcif_set_page)();
int (*pcif_set_window)();
int (*pcif_set_socket)();
int (*pcif_set_interrupt)();
int (*pcif_clr_interrupt)();
int (*pcic_init_dev)();
uint32_t (*pcic_get_tstamp)();
} pcmcia_if_t;
/*
* magic number and version information to identify
* variant of the PCMCIA nexus.
*/
#define PCIF_MAGIC 0x50434946
#define DEFAULT_CS_NAME "cs"
/*
* all adapter drivers use a commonly defined structure for
* their private data. This structure must be filled in
* and set. The an_private member is for the driver writer's
* use and is not looked at by the nexus.
*/
struct pcmcia_adapter_nexus_private {
void *an_private;
};
typedef struct pcmcia_adapter_nexus_private anp_t;
struct pcm_regs {
};
/*
* shared interrupts are handled by the
* nexus going through the list
*/
typedef struct inthandler {
struct inthandler *next;
struct inthandler *prev;
int flags;
unsigned handler_id;
void *arg1;
void *arg2;
unsigned socket;
unsigned irq;
unsigned priority;
} inthandler_t;
/*
* parent private data area
* not using the old style but will adapt on request
* this allows better framework handling and 1275 compliance
*/
struct pcmcia_parent_private {
int ppd_nreg; /* number of regs */
int ppd_intr; /* number intrspecs (always 0 or 1) */
struct intrspec *ppd_intrspec;
short ppd_socket; /* socket number of this instance */
short ppd_function; /* function number */
int ppd_active; /* is PC Card in a socket and active */
void *ppd_handle; /* client handle */
};
/*
* macros to make indirect functions easier
* and shorter (makes cstyle happier)
*/
sock)
typedef struct pcmcia_cs {
int (*pccs_callback)();
int (*pccs_getconfig)();
} pcmcia_cs_t;
#define PCCS_MAGIC 0x50434353
/* properties used by the nexus for setup */
/*
* per adapter structure
* this structure defines everything necessary for the
* the nexus to interact with the adapter specific driver
*/
struct pcmcia_adapter {
int pca_module; /* adapter major number */
int pca_unit; /* adapter minor number */
int pca_number; /* canonical adapter number */
void *pca_power;
int pca_numpower;
int pca_numsockets;
int pca_first_socket;
char pca_name[MODMAXNAMELEN];
};
#define PCMCIA_MAX_FUNCTIONS 8
typedef struct pcmcia_logical_window {
int lw_window; /* window number */
int lw_socket; /* logical socket number assigned */
struct pcmcia_adapter *lw_adapter;
int lw_len;
/*
* management interface hook
*/
#define EM_EVENTSIZE 4
struct pcmcia_mif {
struct pcmcia_mif *mif_next;
void (*mif_function)();
};
#define PR_MASK 0x7
/* socket bit map */
/*
* Max resoruce limits - all of these have to be power-of-2 aligned
* and the PR_MAX_IO_LEN and PR_MAX_MEM_LEN values must be at
* least 64 or the allocators will panic.
*/
#define PR_MAX_IO_RANGES 4
#define PR_MAX_MEM_RANGES 32
#define PR_MAX_IOADDR 0xffffffff
#define PR_MAX_MEMADDR 0xffffffff
#define PR_MAX_INTERRUPTS 0xff
/*
* structures and definitions used in the private interface
*/
/* general values */
#define PC_SUCCESS 1
#define PC_FAILURE 0
/* set_mem() */
#define PC_MEM_AM 0
#define PC_MEM_CM 1
/* device classes */
#define PCC_MULTI 0
#define PCC_MEMORY 1
#define PCC_SERIAL 2
#define PCC_PARALLEL 3
#define PCC_FIXED_DISK 4
#define PCC_VIDEO 5
#define PCC_LAN 6
/*
* device information structure information
* this is what is used for initial construction of a device node
*/
struct pcm_device_info {
int pd_socket;
int pd_function;
int pd_type;
char pd_bind_name[MODMAXNAMELEN];
char pd_generic_name[MODMAXNAMELEN];
};
#define PCM_DEFAULT_NODEID (-1)
#define PCM_DEV_MODEL "model"
#define PCM_DEV_ACTIVE "card-active"
#define PCM_DEV_SOCKET "socket"
#define PCM_DEV_R2TYPE "16bitcard"
#define PCM_DEV_CARDBUS "cardbus"
typedef
struct init_dev {
int socket;
} init_dev_t;
/*
* device descriptions
* used to determine what driver to associate with a PC Card
* so that automatic creation of device information trees can
* be supported.
*/
typedef
struct pcm_device_node {
struct pcm_device_node *pd_next;
char pd_name[16];
int pd_flags;
int pd_devtype; /* from device tuple */
int pd_funcid;
int pd_manfid;
int pd_manmask;
#define PCM_NAME_1275 0x0001
#define PCM_NAME_VERS1 0x0002
#define PCM_NAME_GENERIC 0x0004
#define PCM_NO_CONFIG 0x0008
#define PCM_OTHER_NOCIS 0x0100
#define PCM_MULTI_FUNCTION 0x0200
#define PCM_MAX_R2_MEM 0x3ffffff
#define PCMDEV_PREFIX "PC,"
#define PCMDEV_NAMEPREF "pccard"
/* property names */
#define PCM_PROP_DEVICE "device"
#define PCM_PROP_FUNCID "funcid"
/* 1275 specific properties */
#define PCM_1275_NUMWIN "#windows"
#define PCM_1275_NUMSOCK "#sockets"
#define PCM_1275_SCIC "status-change-int_caps"
/* basic device types */
#define PCM_TYPE_MULTI 0
#define PCM_TYPE_MEMORY 1
#define PCM_TYPE_SERIAL 2
#define PCM_TYPE_PARALLEL 3
#define PCM_TYPE_FIXED 4
#define PCM_TYPE_VIDEO 5
#define PCM_TYPE_LAN 6
typedef
struct string_to_int {
char *sti_str;
} str_int_t;
/*
*/
/* SS is temporary until design done */
/* stuff that used to be in obpdefs.h but no longer */
#define PCM_DEVICETYPE "device_type"
/*
* new regspec and other 1275 stuff
*/
#define PC_REG_BASEREG(x) ((x) & 0xff)
/* solaris internal only */
#define PC_GET_REG_BASEREG(x) ((x) & 0xff)
/* solaris internal only */
#define PC_INCR_REFCNT(x) (((x) & 0xFF00FFFF) | \
#define PC_DECR_REFCNT(x) (((x) & 0xFF00FFFF) | \
#define PC_REG_PHYS_HI(n, p, t, c, s, f, r) (uint32_t)( \
PC_REG_RELOC(n) | \
PC_REG_PREFETCH(p) | \
PC_REG_TYPE(t) | \
PC_REG_SPACE(c) | \
PC_REG_SOCKET(s) | \
PC_REG_FUNCTION(f) | \
PC_REG_BASEREG(r))
#define PC_REG_TYPE_CARDBUS 0
#define PC_REG_TYPE_16BIT 1
#define PC_REG_SPACE_CONFIG 0x0
#define PC_REG_SPACE_IO 0x1
#define PC_REG_SPACE_MEMORY 0x2
#define PC_REG_SPACE_ATTRIBUTE 0x4
/*
* internal properties and other prop_op defines
*/
/* specific known properties */
#define PCMCIA_PROP_SOCKET 0 /* "socket" */
#ifdef __cplusplus
}
#endif
#endif /* _PCMCIA_H */