o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
/* $NetBSD: pcmciavar.h,v 1.12 2000/02/08 12:51:31 enami Exp $ */
|
1999-10-26 06:52:31 +00:00
|
|
|
/* $FreeBSD$ */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Marc Horowitz.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
|
|
|
|
#include <machine/bus.h>
|
|
|
|
|
|
|
|
extern int pccard_verbose;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Contains information about mapped/allocated i/o spaces.
|
|
|
|
*/
|
|
|
|
struct pccard_io_handle {
|
|
|
|
bus_space_tag_t iot; /* bus space tag (from chipset) */
|
|
|
|
bus_space_handle_t ioh; /* mapped space handle */
|
|
|
|
bus_addr_t addr; /* resulting address in bus space */
|
|
|
|
bus_size_t size; /* size of i/o space */
|
|
|
|
int flags; /* misc. information */
|
1999-12-07 06:44:38 +00:00
|
|
|
int width;
|
1999-10-26 06:52:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define PCCARD_IO_ALLOCATED 0x01 /* i/o space was allocated */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Contains information about allocated memory space.
|
|
|
|
*/
|
|
|
|
struct pccard_mem_handle {
|
|
|
|
bus_space_tag_t memt; /* bus space tag (from chipset) */
|
|
|
|
bus_space_handle_t memh; /* mapped space handle */
|
|
|
|
bus_addr_t addr; /* resulting address in bus space */
|
|
|
|
bus_size_t size; /* size of mem space */
|
|
|
|
bus_size_t realsize; /* how much we really allocated */
|
2002-01-29 16:57:50 +00:00
|
|
|
long offset; /* mapped Offset on card */
|
|
|
|
bus_addr_t cardaddr; /* Absolute address on card */
|
1999-12-07 06:44:38 +00:00
|
|
|
int kind;
|
1999-10-26 06:52:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* pccard itself */
|
|
|
|
|
|
|
|
#define PCCARD_CFE_MWAIT_REQUIRED 0x0001
|
|
|
|
#define PCCARD_CFE_RDYBSY_ACTIVE 0x0002
|
|
|
|
#define PCCARD_CFE_WP_ACTIVE 0x0004
|
|
|
|
#define PCCARD_CFE_BVD_ACTIVE 0x0008
|
|
|
|
#define PCCARD_CFE_IO8 0x0010
|
|
|
|
#define PCCARD_CFE_IO16 0x0020
|
|
|
|
#define PCCARD_CFE_IRQSHARE 0x0040
|
|
|
|
#define PCCARD_CFE_IRQPULSE 0x0080
|
|
|
|
#define PCCARD_CFE_IRQLEVEL 0x0100
|
|
|
|
#define PCCARD_CFE_POWERDOWN 0x0200
|
|
|
|
#define PCCARD_CFE_READONLY 0x0400
|
|
|
|
#define PCCARD_CFE_AUDIO 0x0800
|
|
|
|
|
|
|
|
struct pccard_config_entry {
|
|
|
|
int number;
|
2003-04-08 06:59:20 +00:00
|
|
|
uint32_t flags;
|
1999-10-26 06:52:31 +00:00
|
|
|
int iftype;
|
|
|
|
int num_iospace;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The card will only decode this mask in any case, so we can
|
|
|
|
* do dynamic allocation with this in mind, in case the suggestions
|
|
|
|
* below are no good.
|
|
|
|
*/
|
|
|
|
u_long iomask;
|
|
|
|
struct {
|
|
|
|
u_long length;
|
|
|
|
u_long start;
|
|
|
|
} iospace[4]; /* XXX this could be as high as 16 */
|
2003-04-08 06:59:20 +00:00
|
|
|
uint16_t irqmask;
|
1999-10-26 06:52:31 +00:00
|
|
|
int num_memspace;
|
|
|
|
struct {
|
|
|
|
u_long length;
|
|
|
|
u_long cardaddr;
|
|
|
|
u_long hostaddr;
|
|
|
|
} memspace[2]; /* XXX this could be as high as 8 */
|
|
|
|
int maxtwins;
|
2000-10-16 07:51:12 +00:00
|
|
|
struct resource *iores[4];
|
|
|
|
int iorid[4];
|
|
|
|
struct resource *irqres;
|
|
|
|
int irqrid;
|
|
|
|
struct resource *memres[2];
|
|
|
|
int memrid[2];
|
2000-05-26 02:09:24 +00:00
|
|
|
STAILQ_ENTRY(pccard_config_entry) cfe_list;
|
1999-10-26 06:52:31 +00:00
|
|
|
};
|
|
|
|
|
2001-09-02 06:37:41 +00:00
|
|
|
struct pccard_funce_disk {
|
|
|
|
int pfd_interface;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pccard_funce_lan {
|
|
|
|
int pfl_nidlen;
|
2003-04-08 06:59:20 +00:00
|
|
|
uint8_t pfl_nid[8];
|
2001-09-02 06:37:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
union pccard_funce {
|
|
|
|
struct pccard_funce_disk pfv_disk;
|
|
|
|
struct pccard_funce_lan pfv_lan;
|
|
|
|
};
|
|
|
|
|
1999-10-26 06:52:31 +00:00
|
|
|
struct pccard_function {
|
|
|
|
/* read off the card */
|
|
|
|
int number;
|
|
|
|
int function;
|
|
|
|
int last_config_index;
|
2002-11-14 05:15:50 +00:00
|
|
|
uint32_t ccr_base; /* Offset with card's memory */
|
|
|
|
uint32_t ccr_mask;
|
2000-01-10 06:58:17 +00:00
|
|
|
struct resource *ccr_res;
|
|
|
|
int ccr_rid;
|
2000-05-26 02:09:24 +00:00
|
|
|
STAILQ_HEAD(, pccard_config_entry) cfe_head;
|
|
|
|
STAILQ_ENTRY(pccard_function) pf_list;
|
1999-10-26 06:52:31 +00:00
|
|
|
/* run-time state */
|
|
|
|
struct pccard_softc *sc;
|
|
|
|
struct pccard_config_entry *cfe;
|
|
|
|
struct pccard_mem_handle pf_pcmh;
|
2000-08-22 04:25:57 +00:00
|
|
|
device_t dev;
|
1999-10-26 06:52:31 +00:00
|
|
|
#define pf_ccrt pf_pcmh.memt
|
|
|
|
#define pf_ccrh pf_pcmh.memh
|
|
|
|
#define pf_ccr_realsize pf_pcmh.realsize
|
2002-11-14 05:15:50 +00:00
|
|
|
uint32_t pf_ccr_offset; /* Offset from ccr_base of CIS */
|
1999-10-26 06:52:31 +00:00
|
|
|
int pf_ccr_window;
|
2002-11-14 05:15:50 +00:00
|
|
|
long pf_mfc_iobase; /* Right type? */
|
1999-10-26 06:52:31 +00:00
|
|
|
long pf_mfc_iomax;
|
|
|
|
int pf_flags;
|
2001-01-06 18:04:55 +00:00
|
|
|
driver_intr_t *intr_handler;
|
|
|
|
void *intr_handler_arg;
|
|
|
|
void *intr_handler_cookie;
|
2001-09-02 06:37:41 +00:00
|
|
|
|
|
|
|
union pccard_funce pf_funce; /* CISTPL_FUNCE */
|
|
|
|
#define pf_funce_disk_interface pf_funce.pfv_disk.pfd_interface
|
|
|
|
#define pf_funce_lan_nid pf_funce.pfv_lan.pfl_nid
|
|
|
|
#define pf_funce_lan_nidlen pf_funce.pfv_lan.pfl_nidlen
|
1999-10-26 06:52:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* pf_flags */
|
|
|
|
#define PFF_ENABLED 0x0001 /* function is enabled */
|
|
|
|
|
|
|
|
struct pccard_card {
|
|
|
|
int cis1_major;
|
|
|
|
int cis1_minor;
|
|
|
|
/* XXX waste of space? */
|
|
|
|
char cis1_info_buf[256];
|
|
|
|
char *cis1_info[4];
|
|
|
|
/*
|
|
|
|
* Use int32_t for manufacturer and product so that they can
|
|
|
|
* hold the id value found in card CIS and special value that
|
|
|
|
* indicates no id was found.
|
|
|
|
*/
|
|
|
|
int32_t manufacturer;
|
2001-11-11 20:15:47 +00:00
|
|
|
#define PCMCIA_VENDOR_INVALID -1
|
1999-10-26 06:52:31 +00:00
|
|
|
int32_t product;
|
2001-11-11 20:15:47 +00:00
|
|
|
#define PCMCIA_PRODUCT_INVALID -1
|
2002-02-20 14:30:46 +00:00
|
|
|
int16_t prodext;
|
2003-04-08 06:59:20 +00:00
|
|
|
uint16_t error;
|
2001-11-11 20:15:47 +00:00
|
|
|
#define PCMCIA_CIS_INVALID { NULL, NULL, NULL, NULL }
|
2000-05-26 02:09:24 +00:00
|
|
|
STAILQ_HEAD(, pccard_function) pf_head;
|
1999-10-26 06:52:31 +00:00
|
|
|
};
|
|
|
|
|
2000-04-19 08:31:21 +00:00
|
|
|
#define PCCARD_MEM_ATTR 1
|
|
|
|
#define PCCARD_MEM_COMMON 2
|
|
|
|
|
|
|
|
#define PCCARD_WIDTH_AUTO 0
|
|
|
|
#define PCCARD_WIDTH_IO8 1
|
|
|
|
#define PCCARD_WIDTH_IO16 2
|
|
|
|
|
1999-11-29 06:42:55 +00:00
|
|
|
/* More later? */
|
|
|
|
struct pccard_ivar {
|
|
|
|
struct resource_list resources;
|
2000-09-16 06:52:20 +00:00
|
|
|
struct pccard_function *fcn;
|
1999-10-26 06:52:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pccard_softc {
|
2000-01-06 07:30:28 +00:00
|
|
|
device_t dev;
|
2000-01-10 06:58:17 +00:00
|
|
|
/* this stuff is for the socket */
|
2000-01-06 07:30:28 +00:00
|
|
|
|
1999-10-26 06:52:31 +00:00
|
|
|
/* this stuff is for the card */
|
|
|
|
struct pccard_card card;
|
2000-01-06 07:30:28 +00:00
|
|
|
int sc_enabled_count; /* num functions enabled */
|
1999-10-26 06:52:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
1999-12-07 06:44:38 +00:00
|
|
|
pccardbus_if_setup(struct pccard_softc*);
|
1999-10-26 06:52:31 +00:00
|
|
|
|
|
|
|
struct pccard_cis_quirk {
|
|
|
|
int32_t manufacturer;
|
|
|
|
int32_t product;
|
|
|
|
char *cis1_info[4];
|
|
|
|
struct pccard_function *pf;
|
|
|
|
struct pccard_config_entry *cfe;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pccard_tuple {
|
|
|
|
unsigned int code;
|
|
|
|
unsigned int length;
|
|
|
|
u_long mult;
|
|
|
|
bus_addr_t ptr;
|
|
|
|
bus_space_tag_t memt;
|
|
|
|
bus_space_handle_t memh;
|
|
|
|
};
|
|
|
|
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
struct pccard_product {
|
|
|
|
const char *pp_name; /* NULL if end of table */
|
2003-04-08 06:59:20 +00:00
|
|
|
#define PCCARD_VENDOR_ANY (0xffffffff)
|
|
|
|
uint32_t pp_vendor;
|
|
|
|
#define PCCARD_PRODUCT_ANY (0xffffffff)
|
|
|
|
uint32_t pp_product;
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
int pp_expfunc;
|
2001-01-21 08:09:00 +00:00
|
|
|
const char *pp_cis[4];
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef int (*pccard_product_match_fn) (device_t dev,
|
|
|
|
const struct pccard_product *ent, int vpfmatch);
|
|
|
|
|
2002-07-17 05:20:43 +00:00
|
|
|
#include "card_if.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* make this inline so that we don't have to worry about dangling references
|
|
|
|
* to it in the modules or the code.
|
|
|
|
*/
|
|
|
|
static __inline const struct pccard_product *
|
|
|
|
pccard_product_lookup(device_t dev, const struct pccard_product *tab,
|
|
|
|
size_t ent_size, pccard_product_match_fn matchfn)
|
|
|
|
{
|
|
|
|
return CARD_DO_PRODUCT_LOOKUP(device_get_parent(dev), dev,
|
|
|
|
tab, ent_size, matchfn);
|
|
|
|
}
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
|
1999-12-07 06:44:38 +00:00
|
|
|
void pccard_read_cis(struct pccard_softc *);
|
1999-10-26 06:52:31 +00:00
|
|
|
void pccard_check_cis_quirks(device_t);
|
|
|
|
void pccard_print_cis(device_t);
|
2000-04-13 06:42:58 +00:00
|
|
|
int pccard_scan_cis(device_t,
|
|
|
|
int (*) (struct pccard_tuple *, void *), void *);
|
1999-10-26 06:52:31 +00:00
|
|
|
|
|
|
|
#define pccard_cis_read_1(tuple, idx0) \
|
|
|
|
(bus_space_read_1((tuple)->memt, (tuple)->memh, (tuple)->mult*(idx0)))
|
|
|
|
|
|
|
|
#define pccard_tuple_read_1(tuple, idx1) \
|
|
|
|
(pccard_cis_read_1((tuple), ((tuple)->ptr+(2+(idx1)))))
|
|
|
|
|
|
|
|
#define pccard_tuple_read_2(tuple, idx2) \
|
2001-08-27 00:09:42 +00:00
|
|
|
(pccard_tuple_read_1((tuple), (idx2)) | \
|
1999-10-26 06:52:31 +00:00
|
|
|
(pccard_tuple_read_1((tuple), (idx2)+1)<<8))
|
|
|
|
|
|
|
|
#define pccard_tuple_read_3(tuple, idx3) \
|
|
|
|
(pccard_tuple_read_1((tuple), (idx3)) | \
|
|
|
|
(pccard_tuple_read_1((tuple), (idx3)+1)<<8) | \
|
|
|
|
(pccard_tuple_read_1((tuple), (idx3)+2)<<16))
|
|
|
|
|
|
|
|
#define pccard_tuple_read_4(tuple, idx4) \
|
|
|
|
(pccard_tuple_read_1((tuple), (idx4)) | \
|
|
|
|
(pccard_tuple_read_1((tuple), (idx4)+1)<<8) | \
|
|
|
|
(pccard_tuple_read_1((tuple), (idx4)+2)<<16) | \
|
|
|
|
(pccard_tuple_read_1((tuple), (idx4)+3)<<24))
|
|
|
|
|
|
|
|
#define pccard_tuple_read_n(tuple, n, idxn) \
|
|
|
|
(((n)==1)?pccard_tuple_read_1((tuple), (idxn)) : \
|
|
|
|
(((n)==2)?pccard_tuple_read_2((tuple), (idxn)) : \
|
|
|
|
(((n)==3)?pccard_tuple_read_3((tuple), (idxn)) : \
|
|
|
|
/* n == 4 */ pccard_tuple_read_4((tuple), (idxn)))))
|
|
|
|
|
|
|
|
#define PCCARD_SPACE_MEMORY 1
|
|
|
|
#define PCCARD_SPACE_IO 2
|
|
|
|
|
|
|
|
#define pccard_mfc(sc) (STAILQ_FIRST(&(sc)->card.pf_head) && \
|
|
|
|
STAILQ_NEXT(STAILQ_FIRST(&(sc)->card.pf_head),pf_list))
|
|
|
|
|
|
|
|
#define pccard_io_alloc(pf, start, size, align, pciop) \
|
|
|
|
(pccard_chip_io_alloc((pf)->sc->pct, pf->sc->pch, (start), \
|
|
|
|
(size), (align), (pciop)))
|
|
|
|
|
|
|
|
#define pccard_io_free(pf, pciohp) \
|
|
|
|
(pccard_chip_io_free((pf)->sc->pct, (pf)->sc->pch, (pciohp)))
|
|
|
|
|
1999-12-07 06:44:38 +00:00
|
|
|
int pccard_io_map(struct pccard_function *, int, bus_addr_t,
|
|
|
|
bus_size_t, struct pccard_io_handle *, int *);
|
|
|
|
void pccard_io_unmap(struct pccard_function *, int);
|
1999-10-26 06:52:31 +00:00
|
|
|
|
|
|
|
#define pccard_mem_alloc(pf, size, pcmhp) \
|
|
|
|
(pccard_chip_mem_alloc((pf)->sc->pct, (pf)->sc->pch, (size), (pcmhp)))
|
|
|
|
#define pccard_mem_free(pf, pcmhp) \
|
|
|
|
(pccard_chip_mem_free((pf)->sc->pct, (pf)->sc->pch, (pcmhp)))
|
|
|
|
#define pccard_mem_map(pf, kind, card_addr, size, pcmhp, offsetp, windowp) \
|
|
|
|
(pccard_chip_mem_map((pf)->sc->pct, (pf)->sc->pch, (kind), \
|
|
|
|
(card_addr), (size), (pcmhp), (offsetp), (windowp)))
|
|
|
|
#define pccard_mem_unmap(pf, window) \
|
|
|
|
(pccard_chip_mem_unmap((pf)->sc->pct, (pf)->sc->pch, (window)))
|
2000-01-21 03:08:46 +00:00
|
|
|
|
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
|
|
|
/* compat layer */
|
2001-03-22 06:00:07 +00:00
|
|
|
static __inline int
|
|
|
|
pccard_compat_probe(device_t dev)
|
|
|
|
{
|
|
|
|
return (CARD_COMPAT_DO_PROBE(device_get_parent(dev), dev));
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline int
|
|
|
|
pccard_compat_attach(device_t dev)
|
|
|
|
{
|
|
|
|
return (CARD_COMPAT_DO_ATTACH(device_get_parent(dev), dev));
|
|
|
|
}
|
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
|
|
|
|
2000-01-21 03:08:46 +00:00
|
|
|
/* ivar interface */
|
|
|
|
enum {
|
|
|
|
PCCARD_IVAR_ETHADDR, /* read ethernet address from CIS tupple */
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
PCCARD_IVAR_VENDOR,
|
|
|
|
PCCARD_IVAR_PRODUCT,
|
2002-02-20 14:30:46 +00:00
|
|
|
PCCARD_IVAR_PRODEXT,
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
PCCARD_IVAR_FUNCTION_NUMBER,
|
|
|
|
PCCARD_IVAR_VENDOR_STR, /* CIS string for "Manufacturer" */
|
|
|
|
PCCARD_IVAR_PRODUCT_STR,/* CIS strnig for "Product" */
|
2000-10-15 17:21:50 +00:00
|
|
|
PCCARD_IVAR_CIS3_STR,
|
2001-04-21 04:08:39 +00:00
|
|
|
PCCARD_IVAR_CIS4_STR,
|
|
|
|
PCCARD_IVAR_FUNCTION
|
2000-01-21 03:08:46 +00:00
|
|
|
};
|
|
|
|
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
#define PCCARD_ACCESSOR(A, B, T) \
|
|
|
|
__inline static int \
|
|
|
|
pccard_get_ ## A(device_t dev, T *t) \
|
|
|
|
{ \
|
2001-08-27 00:09:42 +00:00
|
|
|
return BUS_READ_IVAR(device_get_parent(dev), dev, \
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
PCCARD_IVAR_ ## B, (uintptr_t *) t); \
|
2000-03-26 07:01:52 +00:00
|
|
|
}
|
|
|
|
|
2003-04-08 06:59:20 +00:00
|
|
|
PCCARD_ACCESSOR(ether, ETHADDR, uint8_t)
|
|
|
|
PCCARD_ACCESSOR(vendor, VENDOR, uint32_t)
|
|
|
|
PCCARD_ACCESSOR(product, PRODUCT, uint32_t)
|
|
|
|
PCCARD_ACCESSOR(prodext, PRODEXT, uint16_t)
|
|
|
|
PCCARD_ACCESSOR(function_number,FUNCTION_NUMBER, uint32_t)
|
|
|
|
PCCARD_ACCESSOR(function, FUNCTION, uint32_t)
|
o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
2000-09-22 01:15:26 +00:00
|
|
|
PCCARD_ACCESSOR(vendor_str, VENDOR_STR, char *)
|
|
|
|
PCCARD_ACCESSOR(product_str, PRODUCT_STR, char *)
|
|
|
|
PCCARD_ACCESSOR(cis3_str, CIS3_STR, char *)
|
|
|
|
|
2001-05-08 23:56:47 +00:00
|
|
|
/* shared memory flags */
|
2000-03-26 07:01:52 +00:00
|
|
|
enum {
|
2001-05-08 23:56:47 +00:00
|
|
|
PCCARD_A_MEM_COM, /* common */
|
|
|
|
PCCARD_A_MEM_ATTR, /* attribute */
|
|
|
|
PCCARD_A_MEM_8BIT, /* 8 bit */
|
|
|
|
PCCARD_A_MEM_16BIT /* 16 bit */
|
2000-03-26 07:01:52 +00:00
|
|
|
};
|
|
|
|
|
2000-08-19 19:22:04 +00:00
|
|
|
#define PCCARD_SOFTC(d) (struct pccard_softc *) device_get_softc(d)
|
2000-10-09 03:40:15 +00:00
|
|
|
#define PCCARD_IVAR(d) (struct pccard_ivar *) device_get_ivars(d)
|
2001-11-15 06:37:13 +00:00
|
|
|
|
|
|
|
#define PCCARD_S(a, b) PCMCIA_STR_ ## a ## _ ## b
|
|
|
|
#define PCCARD_P(a, b) PCMCIA_PRODUCT_ ## a ## _ ## b
|
|
|
|
#define PCCARD_C(a, b) PCMCIA_CIS_ ## a ## _ ## b
|
|
|
|
#define PCMCIA_CARD(v, p, f) { PCCARD_S(v, p), PCMCIA_VENDOR_ ## v, \
|
|
|
|
PCCARD_P(v, p), f, PCCARD_C(v, p) }
|
|
|
|
#define PCMCIA_CARD2(v1, p1, p2, f) \
|
|
|
|
{ PCMCIA_STR_ ## p2, PCMCIA_VENDOR_ ## v1, PCCARD_P(v1, p1), \
|
|
|
|
f, PCMCIA_CIS_ ## p2}
|
2003-04-08 15:28:58 +00:00
|
|
|
#define PCMCIA_CARD_ND(v, p, f) { NULL, PCMCIA_VENDOR_ ## v, \
|
|
|
|
PCCARD_P(v, p), f, PCCARD_C(v, p) }
|
|
|
|
#define PCMCIA_CARD2_ND(v1, p1, p2, f) \
|
|
|
|
{ NULL, PCMCIA_VENDOR_ ## v1, PCCARD_P(v1, p1), \
|
|
|
|
f, PCMCIA_CIS_ ## p2}
|
2001-11-15 06:37:13 +00:00
|
|
|
|