summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-11-28 05:49:27 +0000
committerimp <imp@FreeBSD.org>1999-11-28 05:49:27 +0000
commitcf802d0461169cfb548af94ad4cf6d8a41f67f62 (patch)
treec49916f874f7ce73f7775936c55bc68c476c7240 /sys/dev
parente7efcb5302ff3b4faef7cf619f51a4b4a509f09a (diff)
downloadFreeBSD-src-cf802d0461169cfb548af94ad4cf6d8a41f67f62.zip
FreeBSD-src-cf802d0461169cfb548af94ad4cf6d8a41f67f62.tar.gz
Update pccard code to latest NetBSD code. This is the last merge
before newbusification hits full steam ahead. All: Adjust NetBSD labels to reflect new base versions. dev/pcic/i82365.c: 1.24 Interface change for kernel threads 1.25 Massive unification for cardbus dev/pcic/i82365var.h 1.8 Massive unification for cardbus dev/pcic/i82365_isasubr.c 1.3 Massive unification for cardbus dev/pccard/pccard_cis.c 1.11 Massive unification for cardbus (better device printing, better memspace calcs) dev/pccard/pccard_cis_quirks.c 1.4,1.5 Lotsa 3com devices dev/pccard/pccardchip.h 1.4 Massive unification for cardbus dev/pccard/pccarddevs 1.33..1.59 Lots of devices
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pccard/pccard.c8
-rw-r--r--sys/dev/pccard/pccard_cis.c35
-rw-r--r--sys/dev/pccard/pccard_cis_quirks.c54
-rw-r--r--sys/dev/pccard/pccardchip.h7
-rw-r--r--sys/dev/pccard/pccarddevs65
-rw-r--r--sys/dev/pcic/i82365.c166
-rw-r--r--sys/dev/pcic/i82365_isasubr.c13
-rw-r--r--sys/dev/pcic/i82365var.h18
8 files changed, 273 insertions, 93 deletions
diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c
index b12227a..ccaeb3b 100644
--- a/sys/dev/pccard/pccard.c
+++ b/sys/dev/pccard/pccard.c
@@ -100,7 +100,7 @@ pccard_ccr_write(pf, ccr, val)
}
}
-static int
+int
pccard_card_attach(device_t dev)
{
struct pccard_softc *sc = (struct pccard_softc *)
@@ -185,7 +185,7 @@ pccard_card_attach(device_t dev)
return (attached ? 0 : 1);
}
-static void
+void
pccard_card_detach(device_t dev, int flags)
{
struct pccard_softc *sc = (struct pccard_softc *)
@@ -217,7 +217,7 @@ pccard_card_detach(device_t dev, int flags)
}
}
-static void
+void
pccard_card_deactivate(device_t dev)
{
struct pccard_softc *sc = (struct pccard_softc *)
@@ -242,7 +242,7 @@ pccard_card_deactivate(device_t dev)
}
}
-static int
+int
pccard_card_gettype(device_t dev)
{
struct pccard_softc *sc = (struct pccard_softc *)
diff --git a/sys/dev/pccard/pccard_cis.c b/sys/dev/pccard/pccard_cis.c
index 682ed58..1924969 100644
--- a/sys/dev/pccard/pccard_cis.c
+++ b/sys/dev/pccard/pccard_cis.c
@@ -547,25 +547,28 @@ pccard_print_cis(device_t dev)
if (cfe->num_iospace) {
printf("; iomask %lx, iospace", cfe->iomask);
- for (i = 0; i < cfe->num_iospace; i++)
- printf(" %lx%s%lx",
- cfe->iospace[i].start,
- cfe->iospace[i].length ? "-" : "",
- cfe->iospace[i].start +
- cfe->iospace[i].length - 1);
+ for (i = 0; i < cfe->num_iospace; i++) {
+ printf(" %lx", cfe->iospace[i].start);
+ if (cfe->iospace[i].length)
+ printf("-%lx",
+ cfe->iospace[i].start +
+ cfe->iospace[i].length - 1);
+ }
}
if (cfe->num_memspace) {
printf("; memspace");
- for (i = 0; i < cfe->num_memspace; i++)
- printf(" %lx%s%lx%s%lx",
- cfe->memspace[i].cardaddr,
- cfe->memspace[i].length ? "-" : "",
- cfe->memspace[i].cardaddr +
- cfe->memspace[i].length - 1,
- cfe->memspace[i].hostaddr ?
- "@" : "",
- cfe->memspace[i].hostaddr);
+ for (i = 0; i < cfe->num_memspace; i++) {
+ printf(" %lx",
+ cfe->memspace[i].cardaddr);
+ if (cfe->memspace[i].length)
+ printf("-%lx",
+ cfe->memspace[i].cardaddr +
+ cfe->memspace[i].length - 1);
+ if (cfe->memspace[i].hostaddr)
+ printf("@%lx",
+ cfe->memspace[i].hostaddr);
+ }
}
if (cfe->maxtwins)
printf("; maxtwins %d", cfe->maxtwins);
@@ -1134,7 +1137,7 @@ pccard_parse_cis_tuple(tuple, arg)
idx++;
cfe->num_memspace = reg &
- PCCARD_TPCE_MS_COUNT;
+ PCCARD_TPCE_MS_COUNT + 1;
if (cfe->num_memspace >
(sizeof(cfe->memspace) /
diff --git a/sys/dev/pccard/pccard_cis_quirks.c b/sys/dev/pccard/pccard_cis_quirks.c
index 448ca40..5cd0aa1 100644
--- a/sys/dev/pccard/pccard_cis_quirks.c
+++ b/sys/dev/pccard/pccard_cis_quirks.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pcmcia_cis_quirks.c,v 1.3 1998/12/29 09:00:28 marc Exp $ */
+/* $NetBSD: pcmcia_cis_quirks.c,v 1.5 1999/10/11 17:50:21 thorpej Exp $ */
/* $FreeBSD$ */
#define PCCARDDEBUG
@@ -98,6 +98,48 @@ static struct pccard_config_entry pccard_3cxem556_func1_cfe0 = {
0, /* maxtwins */
};
+static struct pccard_function pccard_3ccfem556bi_func0 = {
+ 0, /* function number */
+ PCCARD_FUNCTION_NETWORK,
+ 0x07, /* last cfe number */
+ 0x1000, /* ccr_base */
+ 0x267, /* ccr_mask */
+};
+
+static struct pccard_config_entry pccard_3ccfem556bi_func0_cfe0 = {
+ 0x07, /* cfe number */
+ PCCARD_CFE_IO8 | PCCARD_CFE_IO16 | PCCARD_CFE_IRQLEVEL,
+ PCCARD_IFTYPE_IO,
+ 1, /* num_iospace */
+ 5, /* iomask */
+ { { 0x0020, 0 } }, /* iospace */
+ 0xffff, /* irqmask */
+ 0, /* num_memspace */
+ { }, /* memspace */
+ 0, /* maxtwins */
+};
+
+static struct pccard_function pccard_3ccfem556bi_func1 = {
+ 1, /* function number */
+ PCCARD_FUNCTION_SERIAL,
+ 0x27, /* last cfe number */
+ 0x1100, /* ccr_base */
+ 0x277, /* ccr_mask */
+};
+
+static struct pccard_config_entry pccard_3ccfem556bi_func1_cfe0 = {
+ 0x27, /* cfe number */
+ PCCARD_CFE_IO8 | PCCARD_CFE_IRQLEVEL,
+ PCCARD_IFTYPE_IO,
+ 1, /* num_iospace */
+ 3, /* iomask */
+ { { 0x0008, 0 } }, /* iospace */
+ 0xffff, /* irqmask */
+ 0, /* num_memspace */
+ { }, /* memspace */
+ 0, /* maxtwins */
+};
+
static struct pccard_function pccard_sveclancard_func0 = {
0, /* function number */
PCCARD_FUNCTION_NETWORK,
@@ -125,6 +167,16 @@ static struct pccard_cis_quirk pccard_cis_quirks[] = {
&pccard_3cxem556_func0, &pccard_3cxem556_func0_cfe0 },
{ PCCARD_VENDOR_3COM, PCCARD_PRODUCT_3COM_3CXEM556, PCCARD_CIS_INVALID,
&pccard_3cxem556_func1, &pccard_3cxem556_func1_cfe0 },
+ { PCCARD_VENDOR_3COM, PCCARD_PRODUCT_3COM_3CXEM556INT, PCCARD_CIS_INVALID,
+ &pccard_3cxem556_func0, &pccard_3cxem556_func0_cfe0 },
+ { PCCARD_VENDOR_3COM, PCCARD_PRODUCT_3COM_3CXEM556INT, PCCARD_CIS_INVALID,
+ &pccard_3cxem556_func1, &pccard_3cxem556_func1_cfe0 },
+ { PCCARD_VENDOR_3COM, PCCARD_PRODUCT_3COM_3CCFEM556BI,
+ PCCARD_CIS_INVALID,
+ &pccard_3ccfem556bi_func0, &pccard_3ccfem556bi_func0_cfe0 },
+ { PCCARD_VENDOR_3COM, PCCARD_PRODUCT_3COM_3CCFEM556BI,
+ PCCARD_CIS_INVALID,
+ &pccard_3ccfem556bi_func1, &pccard_3ccfem556bi_func1_cfe0 },
{ PCCARD_VENDOR_INVALID, PCCARD_PRODUCT_INVALID, PCCARD_CIS_SVEC_LANCARD,
&pccard_sveclancard_func0, &pccard_sveclancard_func0_cfe0 },
};
diff --git a/sys/dev/pccard/pccardchip.h b/sys/dev/pccard/pccardchip.h
index 3b99dc8..f674643 100644
--- a/sys/dev/pccard/pccardchip.h
+++ b/sys/dev/pccard/pccardchip.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pcmciachip.h,v 1.3 1998/11/17 08:49:12 thorpej Exp $ */
+/* $NetBSD: pcmciachip.h,v 1.4 1999/10/15 06:07:32 haya Exp $ */
/* $FreeBSD$ */
/*
@@ -84,6 +84,9 @@ struct pccard_chip_functions {
/* card enable/disable */
void (*socket_enable) __P((pccard_chipset_handle_t));
void (*socket_disable) __P((pccard_chipset_handle_t));
+
+ /* card detection */
+ int (*card_detect) __P((pcmcia_chipset_handle_t));
};
/* Memory space functions. */
@@ -130,7 +133,7 @@ struct pccard_chip_functions {
((*(tag)->socket_disable)((handle)))
struct pccardbus_attach_args {
- char *paa_busname;
+ char *paa_busname; /* Bus name */
pccard_chipset_tag_t pct;
pccard_chipset_handle_t pch;
bus_addr_t iobase; /* start i/o space allocation here */
diff --git a/sys/dev/pccard/pccarddevs b/sys/dev/pccard/pccarddevs
index 443d37e..4dbd495 100644
--- a/sys/dev/pccard/pccarddevs
+++ b/sys/dev/pccard/pccarddevs
@@ -1,5 +1,5 @@
-$NetBSD: pcmciadevs,v 1.33 1999/02/19 21:49:43 abs Exp $
-/* $FreeBSD$ */
+$FreeBSD$
+/* $NetBSD: pcmciadevs,v 1.59 1999/11/27 01:03:18 soren Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -58,17 +58,22 @@ vendor ADAPTEC 0x012f Adaptec Corporation
vendor COMPAQ1 0x0138 Compaq Corporation (1)
vendor LINKSYS 0x0149 Linksys Corporation
vendor SIMPLETECH 0x014d Simple Technology
+vendor LUCENT 0x0156 Lucent Technologies
vendor COMPAQ2 0x0183 Compaq Corporation (2)
vendor DAYNA 0x0194 Dayna Corporation
vendor IODATA 0x01bf I-O DATA
+vendor BAY 0x01eb Bay Networks
vendor COMPEX 0x8a01 Compex Corporation
+vendor CONTEC 0xc001 Contec
vendor COREGA 0xc00f Corega K.K.
+vendor ALLIEDTELESIS 0xc00f Allied Telesis K.K.
vendor HAGIWARASYSCOM 0xc012 Hagiwara SYS-COM
vendor RATOC 0xc015 RATOC System Inc.
/*
* List of known products. Grouped by vendor.
*/
+
/* Adaptec Products */
product ADAPTEC APA1460_1 0x0001 Adaptec APA-1460/A SCSI Host Adapter
product ADAPTEC APA1460_2 0x0002 Adaptec APA-1460/B SCSI Host Adapter
@@ -77,11 +82,17 @@ product ADAPTEC APA1460_2 0x0002 Adaptec APA-1460/B SCSI Host Adapter
product 3COM 3C562 0x0562 3Com 3c562 33.6 Modem/10Mbps Ethernet
product 3COM 3C589 0x0589 3Com 3c589 10Mbps Ethernet
product 3COM 3C574 0x0574 3Com 3c574-TX 10/100Mbps Ethernet
+product 3COM 3CXM056BNW 0x002f 3Com/NoteWorthy 3CXM056-BNW 56K Modem
product 3COM 3CXEM556 0x0035 3Com/Megahertz 3CXEM556 Ethernet/Modem
+product 3COM 3CXEM556INT 0x003d 3Com/Megahertz 3CXEM556-INT Ethernet/Modem
+product 3COM 3CCFEM556BI 0x0556 3Com/Megahertz 3CCFEM556BI Ethernet/Modem
/* Compex Products */
product COMPEX LINKPORT_ENET_B 0x0100 Compex Linkport ENET-B Ethernet
+/* Lasat Products */
+product LASAT CREDIT_288 0x2811 Lasat Credit 288 Modem
+
/* Dayna Products */
product DAYNA COMMUNICARD_E_1 0x002d Dayna CommuniCard E
product DAYNA COMMUNICARD_E_2 0x002f Dayna CommuniCard E
@@ -96,14 +107,22 @@ product FUJITSU SCSI600 0x0401 Fujitsu SCSI 600 Interface
product MOTOROLA POWER144 0x0105 Motorola Power 14.4 Modem
product MOTOROLA PM100C 0x0302 Motorola Personal Messenger 100C CDPD Modem
+/* Fujitsu Products */
+product FUJITSU LA501 0x2000 Fujitsu Towa LA501 Ethernet
+product FUJITSU LA10S 0x1003 Fujitsu Compact Flash Ethernet
+
/* IBM Products */
+product IBM 3270 0x0001 3270 Emulation
product IBM INFOMOVER 0x0002 National Semiconductor InfoMover
+product IBM 5250 0x000b 5250 Emulation
+product IBM TROPIC 0x001e Token Ring 4/16
product IBM HOME_AND_AWAY 0x002e IBM Home and Away Modem
product IBM WIRELESS_LAN_ENTRY 0x0032 Wireless LAN Entry
-product IBM PORTABLE_CDROM_DRIVE 0x002d PCMCIA Portable CD-ROM Drive
+product IBM PORTABLE_CDROM 0x002d PCMCIA Portable CD-ROM Drive
+product IBM ETHERJET 0x003f IBM EtherJet Ethernet
/* I-O DATA */
-product IODATA PCLAT 0x2216 I-O DATA PCLA/T
+product IODATA PCLATE 0x2216 I-O DATA PCLA/TE
/* Linksys corporation */
product LINKSYS ECARD_1 0x0265 Linksys EthernetCard or D-Link DE-650
@@ -112,6 +131,7 @@ product LINKSYS TRUST_COMBO_ECARD 0x021b Trust (Linksys) Combo EthernetCard
/* Megahertz Products */
product MEGAHERTZ XJ4288 0x0023 Megahertz XJ4288 Modem
+product MEGAHERTZ XJ4336 0x0027 Megahertz XJ4336 Modem
product MEGAHERTZ XJ5560 0x0034 Megahertz X-JACK 56kbps Modem
product MEGAHERTZ2 XJACK 0x0103 Megahertz X-JACK Ethernet
product MEGAHERTZ XJEM3336 0x0006 Megahertz X-JACK Ethernet Modem
@@ -124,10 +144,13 @@ product SANDISK SDCFB 0x0401 Sandisk CompactFlash Card
/* Simple Technology Products */
product SIMPLETECH COMMUNICATOR288 0x0100 Simple Technology 28.8 Communicator
+/* Simpletech ID also used by Symbol */
+product SIMPLETECH SPECTRUM24 0x801 Symbol Spectrum24 WLAN Adapter
/* Socket Communications Products */
product SOCKET PAGECARD 0x0003 Socket Communications PageCard
product SOCKET DUAL_RS232 0x0006 Socket Communications Dual RS232
+product SOCEKT LP_ETHER_CF 0x0075 Socket Communications Low Power Ethernet CF
/* TDK Products */
product TDK LAK_CD021BX 0x0200 TDK LAK-CD021BX Ethernet
@@ -138,21 +161,35 @@ product TDK XIR_CE_10 0x0108 Xircom CreditCard Ethernet
product TDK XIR_CEM_10 0x110a Xircom CreditCard Ethernet + Modem
product TDK XIR_CEM_28 0x110b Xircom CreditCard Ethernet + Modem 28.8
product TDK XIR_PS_CE2_10 0x010b Xircom CreditCard CE2 Ethernet
-product TDK XIR_CE3_100 0x010a Xircom CreditCard Ethernet 10/100
+product TDK XIR_CE3_10_100 0x010a Xircom CreditCard CE3 10/100 Ethernet
product TDK XIR_CNW 0x0802 Xircom CreditCard Netwave
-/* NewMedia Products */
-product NEWMEDIA BASICS 0x0019 NewMedia BASICS Ethernet
+/* New Media Products */
+product NEWMEDIA BASICS 0x0019 New Media BASICS Ethernet
+product NEWMEDIA BUSTOASTER 0xc102 New Media BusToaster SCSI Host Adapter
/* Standard Microsystems Corporation Products */
product SMC 8016 0x0105 SMC 8016 EtherCard
+product SMC EZCARD 0x8022 SMC EXCard 10 PCMCIA
+
+/* Contec C-NET(PC) */
+product CONTEC CNETPC 0x0000 Contec C-NET(PC)C
+
+/* Allied Telesis K.K. */
+product ALLIEDTELESIS LA_PCM 0x0002 Allied Telesis LA-PCM
/* RATOC System Inc. Products */
product RATOC REX_R280 0x1 RATOC REX-R280
+/* Lucent WaveLAN/IEEE */
+product LUCENT WAVELAN_IEEE 0x0002 WaveLAN/IEEE
+
+product BAY STACK_650 0x804 BayStack 650 Wireless LAN
+
/* Cards we know only by their cis */
vendor PREMAX -1 Premax
vendor PLANET -1 Planet
+vendor PLANEX -1 Planex Communications Inc
vendor DLINK -1 D-Link
vendor RPTI -1 RPTI
vendor ACCTON -1 ACCTON
@@ -161,10 +198,16 @@ vendor DIGITAL -1 Digital Equipment Corporation
vendor TEAC -1 TEAC
vendor SVEC -1 SVEC/Hawking Technology
vendor NAKAGAWAMETAL -1 NAKAGAWA METAL
+vendor AMBICOM -1 AmbiCom Inc
product MEGAHERTZ XJ2288 { "MEGAHERTZ", "MODEM&spXJ2288", NULL, NULL } Megahertz XJ2288 Modem
product PREMAX PE200 { "PMX&sp&sp&sp", "PE-200", NULL, NULL } PreMax PE-200
product PLANET SMARTCOM2000 { "PCMCIA", "UE2212", NULL, NULL } Planet SmartCOM 2000
+/*
+ * vendor ID of FNW-3600-T is LINKSYS(0x0149) and product ID is 0xc1ab, but
+ * it conflicts with LINKSYS Combo EhternetCard.
+ */
+product PLANEX FNW3600T { "Fast&spEthernet", "Adapter", "1.0", NULL } Planex FNW-3600-T
product DLINK DE650 { "D-Link", "DE-650", NULL, NULL } D-Link DE-650
product DLINK DE660 { "D-Link", "DE-660", NULL, NULL } D-Link DE-660
product RPTI EP401 { "RPTI", "EP401&spEthernet&spNE2000&spCompatible", NULL, NULL } RPTI EP401
@@ -172,10 +215,14 @@ product ACCTON EN2212 { "ACCTON", "EN2212", NULL, NULL } Accton EN2212
product YEDATA EXTERNAL_FDD { "Y-E&spDATA", "External&spFDD", NULL, NULL } Y-E DATA External FDD
product DIGITAL DEPCMXX { "DIGITAL", "DEPCM-XX", NULL, NULL } DEC DEPCM-BA
product TEAC IDECARDII { NULL, "NinjaATA-", NULL, NULL } TEAC IDE Card/II
-product LINKSYS ECARD_2 { "LINKSYS", "E-CARD", NULL, NULL } Linksys E-Card
-product COREGA PCC_2 { "corega&spK.K.", "corega&spEther&spPCC-T", NULL, NULL } Corega
+product LINKSYS ECARD_2 { "LINKSYS", "E-CARD", NULL, NULL } Linksys E-Card
+product COREGA ETHER_PCC_T { "corega&spK.K.", "corega&spEther&spPCC-T", NULL, NULL } Corega
+product COREGA ETHER_II_PCC_T { "corega&spK.K.", "corega&spEtherII&spPCC-T", NULL, NULL } Corega
+product COREGA FAST_ETHER_PCC_TX { "corega&spK.K.", "corega&spFastEther&spPCC-TX", NULL, NULL } Corega
product SVEC COMBOCARD { "Ethernet", "Adapter", NULL, NULL } SVEC/Hawking Tech. Combo Card
product SVEC LANCARD { "SVEC", "FD605&spPCMCIA&spEtherNet&spCard", "V1-1", NULL } SVEC PCMCIA Lan Card
product NAKAGAWAMETAL LNT10TN { "PCMCIA", "LNT-10TN", NULL, NULL } NAKAGAWA METAL LNT-10TN NE2000 Compatible Card
+product AMBICOM AMB8002T { "AmbiCom&spInc", "AMB8002T", NULL, NULL } AmbiCom AMB8002T
+product IODATA PCLAT { "I-O&spDATA", "PCLA", "ETHERNET", NULL } IO-DATA PCLA/T
diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c
index 0b3fbf3..caa1330 100644
--- a/sys/dev/pcic/i82365.c
+++ b/sys/dev/pcic/i82365.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82365.c,v 1.23 1999/02/19 03:14:00 mycroft Exp $ */
+/* $NetBSD: i82365.c,v 1.25 1999/10/15 06:07:27 haya Exp $ */
/* $FreeBSD$ */
/*
@@ -106,6 +106,9 @@ void pcic_queue_event __P((struct pcic_handle *, int));
static void pcic_wait_ready __P((struct pcic_handle *));
+static u_int8_t st_pcic_read __P((struct pcic_handle *, int));
+static void st_pcic_write __P((struct pcic_handle *, int, u_int8_t));
+
int
pcic_ident_ok(ident)
int ident;
@@ -196,8 +199,13 @@ pcic_attach(device_t dev)
DPRINTF(("pcic ident regs:"));
- sc->handle[0].sc = sc;
+ sc->handle[0].ph_parent = (struct device *)sc;
sc->handle[0].sock = C0SA;
+ /* initialise pcic_read and pcic_write functions */
+ sc->handle[0].ph_read = st_pcic_read;
+ sc->handle[0].ph_write = st_pcic_write;
+ sc->handle[0].ph_bus_t = sc->iot;
+ sc->handle[0].ph_bus_h = sc->ioh;
if (pcic_ident_ok(reg = pcic_read(&sc->handle[0], PCIC_IDENT))) {
sc->handle[0].flags = PCIC_FLAG_SOCKETP;
count++;
@@ -208,8 +216,13 @@ pcic_attach(device_t dev)
DPRINTF((" 0x%02x", reg));
- sc->handle[1].sc = sc;
+ sc->handle[1].ph_parent = (struct device *)sc;
sc->handle[1].sock = C0SB;
+ /* initialise pcic_read and pcic_write functions */
+ sc->handle[1].ph_read = st_pcic_read;
+ sc->handle[1].ph_write = st_pcic_write;
+ sc->handle[1].ph_bus_t = sc->iot;
+ sc->handle[1].ph_bus_h = sc->ioh;
if (pcic_ident_ok(reg = pcic_read(&sc->handle[1], PCIC_IDENT))) {
sc->handle[1].flags = PCIC_FLAG_SOCKETP;
count++;
@@ -225,8 +238,13 @@ pcic_attach(device_t dev)
* if you try to read from the second one. Maybe pcic_ident_ok
* shouldn't accept 0?
*/
- sc->handle[2].sc = sc;
+ sc->handle[2].ph_parent = (struct device *)sc;
sc->handle[2].sock = C1SA;
+ /* initialise pcic_read and pcic_write functions */
+ sc->handle[2].ph_read = st_pcic_read;
+ sc->handle[2].ph_write = st_pcic_write;
+ sc->handle[2].ph_bus_t = sc->iot;
+ sc->handle[2].ph_bus_h = sc->ioh;
if (pcic_vendor(&sc->handle[0]) != PCIC_VENDOR_CIRRUS_PD672X ||
pcic_read(&sc->handle[2], PCIC_IDENT) != 0) {
if (pcic_ident_ok(reg = pcic_read(&sc->handle[2],
@@ -240,8 +258,13 @@ pcic_attach(device_t dev)
DPRINTF((" 0x%02x", reg));
- sc->handle[3].sc = sc;
- sc->handle[3].sock = C1SB;
+ sc->handle[3].ph_parent = (struct device *)sc;
+ sc->handle[3].sock = C1SB;
+ /* initialise pcic_read and pcic_write functions */
+ sc->handle[3].ph_read = st_pcic_read;
+ sc->handle[3].ph_write = st_pcic_write;
+ sc->handle[3].ph_bus_t = sc->iot;
+ sc->handle[3].ph_bus_h = sc->ioh;
if (pcic_ident_ok(reg = pcic_read(&sc->handle[3],
PCIC_IDENT))) {
sc->handle[3].flags = PCIC_FLAG_SOCKETP;
@@ -335,6 +358,7 @@ pcic_attach_socket(h)
struct pcic_handle *h;
{
struct pccardbus_attach_args paa;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
/* initialize the rest of the handle */
@@ -344,14 +368,15 @@ pcic_attach_socket(h)
h->ih_irq = 0;
/* now, config one pccard device per socket */
+
paa.paa_busname = "pccard";
- paa.pct = (pccard_chipset_tag_t) h->sc->pct;
+ paa.pct = (pccard_chipset_tag_t) sc->pct;
paa.pch = (pccard_chipset_handle_t) h;
- paa.iobase = h->sc->iobase;
- paa.iosize = h->sc->iosize;
+ paa.iobase = sc->iobase;
+ paa.iosize = sc->iosize;
#if XXX
- h->pccard = config_found_sm(&h->sc->dev, &paa, pcic_print,
+ h->pccard = config_found_sm(&sc->dev, &paa, pcic_print,
pcic_submatch);
#endif
@@ -390,10 +415,7 @@ pcic_create_event_thread(arg)
device_printf(h->sc->dev,
"cannot create event thread for sock 0x%02x\n", h->sock);
panic("pcic_create_event_thread");
- } else
- device_printf(h->sc->dev,
- "create event thread for sock 0x%02x\n", h->sock);
-
+ }
}
void
@@ -403,6 +425,7 @@ pcic_event_thread(arg)
struct pcic_handle *h = arg;
struct pcic_event *pe;
int s;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
while (h->shutdown == 0) {
s = splhigh();
@@ -440,7 +463,7 @@ pcic_event_thread(arg)
}
splx(s);
- DPRINTF(("%s: insertion event\n", h->sc->dev.dv_xname));
+ DPRINTF(("%s: insertion event\n", h->ph_parent->dv_xname));
pcic_attach_card(h);
break;
@@ -464,7 +487,7 @@ pcic_event_thread(arg)
}
splx(s);
- DPRINTF(("%s: removal event\n", h->sc->dev.dv_xname));
+ DPRINTF(("%s: removal event\n", h->ph_parent->dv_xname));
pcic_detach_card(h, DETACH_FORCE);
break;
@@ -478,7 +501,7 @@ pcic_event_thread(arg)
h->event_thread = NULL;
/* In case parent is waiting for us to exit. */
- wakeup(h->sc);
+ wakeup(sc);
kthread_exit(0);
}
@@ -488,6 +511,7 @@ pcic_init_socket(h)
struct pcic_handle *h;
{
int reg;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
/*
* queue creation of a kernel thread to handle insert/removal events.
@@ -500,7 +524,7 @@ pcic_init_socket(h)
/* set up the card to interrupt on card detect */
- pcic_write(h, PCIC_CSC_INTR, (h->sc->irq << PCIC_CSC_INTR_IRQ_SHIFT) |
+ pcic_write(h, PCIC_CSC_INTR, (sc->irq << PCIC_CSC_INTR_IRQ_SHIFT) |
PCIC_CSC_INTR_CD_ENABLE);
pcic_write(h, PCIC_INTR, 0);
pcic_read(h, PCIC_CSC);
@@ -512,7 +536,7 @@ pcic_init_socket(h)
reg = pcic_read(h, PCIC_CIRRUS_MISC_CTL_2);
if (reg & PCIC_CIRRUS_MISC_CTL_2_SUSPEND) {
DPRINTF(("%s: socket %02x was suspended\n",
- h->sc->dev.dv_xname, h->sock));
+ sc->dev.dv_xname, h->sock));
reg &= ~PCIC_CIRRUS_MISC_CTL_2_SUSPEND;
pcic_write(h, PCIC_CIRRUS_MISC_CTL_2, reg);
}
@@ -659,21 +683,21 @@ pcic_intr_socket(h)
PCIC_CSC_BATTDEAD);
if (cscreg & PCIC_CSC_GPI) {
- DPRINTF(("%s: %02x GPI\n", h->sc->dev.dv_xname, h->sock));
+ DPRINTF(("%s: %02x GPI\n", h->ph_parent->dv_xname, h->sock));
}
if (cscreg & PCIC_CSC_CD) {
int statreg;
statreg = pcic_read(h, PCIC_IF_STATUS);
- DPRINTF(("%s: %02x CD %x\n", h->sc->dev.dv_xname, h->sock,
+ DPRINTF(("%s: %02x CD %x\n", h->ph_parent->dv_xname, h->sock,
statreg));
if ((statreg & PCIC_IF_STATUS_CARDDETECT_MASK) ==
PCIC_IF_STATUS_CARDDETECT_PRESENT) {
if (h->laststate != PCIC_LASTSTATE_PRESENT) {
DPRINTF(("%s: enqueing INSERTION event\n",
- h->sc->dev.dv_xname));
+ h->ph_parent->dv_xname));
pcic_queue_event(h, PCIC_EVENT_INSERTION);
}
h->laststate = PCIC_LASTSTATE_PRESENT;
@@ -681,11 +705,11 @@ pcic_intr_socket(h)
if (h->laststate == PCIC_LASTSTATE_PRESENT) {
/* Deactivate the card now. */
DPRINTF(("%s: deactivating card\n",
- h->sc->dev.dv_xname));
+ h->ph_parent->dv_xname));
pcic_deactivate_card(h);
DPRINTF(("%s: enqueing REMOVAL event\n",
- h->sc->dev.dv_xname));
+ h->ph_parent->dv_xname));
pcic_queue_event(h, PCIC_EVENT_REMOVAL);
}
h->laststate = ((statreg & PCIC_IF_STATUS_CARDDETECT_MASK) == 0)
@@ -693,14 +717,14 @@ pcic_intr_socket(h)
}
}
if (cscreg & PCIC_CSC_READY) {
- DPRINTF(("%s: %02x READY\n", h->sc->dev.dv_xname, h->sock));
+ DPRINTF(("%s: %02x READY\n", h->ph_parent->dv_xname, h->sock));
/* shouldn't happen */
}
if (cscreg & PCIC_CSC_BATTWARN) {
- DPRINTF(("%s: %02x BATTWARN\n", h->sc->dev.dv_xname, h->sock));
+ DPRINTF(("%s: %02x BATTWARN\n", h->ph_parent->dv_xname, h->sock));
}
if (cscreg & PCIC_CSC_BATTDEAD) {
- DPRINTF(("%s: %02x BATTDEAD\n", h->sc->dev.dv_xname, h->sock));
+ DPRINTF(("%s: %02x BATTDEAD\n", h->ph_parent->dv_xname, h->sock));
}
return (cscreg ? 1 : 0);
}
@@ -728,12 +752,10 @@ void
pcic_attach_card(h)
struct pcic_handle *h;
{
- struct pccard_softc *psc = (void*)h->pccard;
+
if (!(h->flags & PCIC_FLAG_CARDP)) {
-#if XXX
/* call the MI attach function */
- psc->sc_if.if_card_attach (psc);
-#endif
+ pccard_card_attach(h->pccard);
h->flags |= PCIC_FLAG_CARDP;
} else {
@@ -746,14 +768,12 @@ pcic_detach_card(h, flags)
struct pcic_handle *h;
int flags; /* DETACH_* */
{
- struct pccard_softc *psc = (void*)h->pccard;
+
if (h->flags & PCIC_FLAG_CARDP) {
h->flags &= ~PCIC_FLAG_CARDP;
/* call the MI detach function */
-#if XXX
- psc->sc_if.if_card_detach (psc, flags);
-#endif
+ pccard_card_detach(h->pccard, flags);
} else {
DPRINTF(("pcic_detach_card: already detached"));
}
@@ -763,11 +783,9 @@ void
pcic_deactivate_card(h)
struct pcic_handle *h;
{
- struct pccard_softc *psc = (void*)h->pccard;
+
/* call the MI deactivate function */
-#if XXX
- psc->sc_if.if_card_deactivate (psc);
-#endif
+ pccard_card_deactivate(h->pccard);
/* power down the socket */
pcic_write(h, PCIC_PWRCTL, 0);
@@ -787,6 +805,7 @@ pcic_chip_mem_alloc(pch, size, pcmhp)
bus_addr_t addr;
bus_size_t sizepg;
int i, mask, mhandle;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
/* out of sc->memh, allocate as many pages as necessary */
@@ -801,17 +820,17 @@ pcic_chip_mem_alloc(pch, size, pcmhp)
mhandle = 0; /* XXX gcc -Wuninitialized */
for (i = 0; i <= PCIC_MAX_MEM_PAGES - sizepg; i++) {
- if ((h->sc->subregionmask & (mask << i)) == (mask << i)) {
+ if ((sc->subregionmask & (mask << i)) == (mask << i)) {
#if XXX
- if (bus_space_subregion(h->sc->memt, h->sc->memh,
+ if (bus_space_subregion(sc->memt, sc->memh,
i * PCIC_MEM_PAGESIZE,
sizepg * PCIC_MEM_PAGESIZE, &memh))
return (1);
#endif
mhandle = mask << i;
- addr = h->sc->membase + (i * PCIC_MEM_PAGESIZE);
- h->sc->subregionmask &= ~(mhandle);
- pcmhp->memt = h->sc->memt;
+ addr = sc->membase + (i * PCIC_MEM_PAGESIZE);
+ sc->subregionmask &= ~(mhandle);
+ pcmhp->memt = sc->memt;
pcmhp->memh = memh;
pcmhp->addr = addr;
pcmhp->size = size;
@@ -830,8 +849,9 @@ pcic_chip_mem_free(pch, pcmhp)
struct pccard_mem_handle *pcmhp;
{
struct pcic_handle *h = (struct pcic_handle *) pch;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
- h->sc->subregionmask |= pcmhp->mhandle;
+ sc->subregionmask |= pcmhp->mhandle;
}
static struct mem_map_index_st {
@@ -962,6 +982,7 @@ pcic_chip_mem_map(pch, kind, card_addr, size, pcmhp, offsetp, windowp)
bus_addr_t busaddr;
long card_offset;
int i, win;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
win = -1;
for (i = 0; i < (sizeof(mem_map_index) / sizeof(mem_map_index[0]));
@@ -980,7 +1001,7 @@ pcic_chip_mem_map(pch, kind, card_addr, size, pcmhp, offsetp, windowp)
/* XXX this is pretty gross */
- if (h->sc->memt != pcmhp->memt)
+ if (sc->memt != pcmhp->memt)
panic("pcic_chip_mem_map memt is bogus");
busaddr = pcmhp->addr;
@@ -1048,12 +1069,13 @@ pcic_chip_io_alloc(pch, start, size, align, pcihp)
bus_space_handle_t ioh;
bus_addr_t ioaddr;
int flags = 0;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
/*
* Allocate some arbitrary I/O space.
*/
- iot = h->sc->iot;
+ iot = sc->iot;
if (start) {
ioaddr = start;
@@ -1066,8 +1088,8 @@ pcic_chip_io_alloc(pch, start, size, align, pcihp)
} else {
flags |= PCCARD_IO_ALLOCATED;
#if XXX
- if (bus_space_alloc(iot, h->sc->iobase,
- h->sc->iobase + h->sc->iosize, size, align, 0, 0,
+ if (bus_space_alloc(iot, sc->iobase,
+ sc->iobase + sc->iosize, size, align, 0, 0,
&ioaddr, &ioh))
return (1);
#endif
@@ -1190,6 +1212,7 @@ pcic_chip_io_map(pch, width, offset, size, pcihp, windowp)
#ifdef PCICDEBUG
static char *width_names[] = { "auto", "io8", "io16" };
#endif
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
/* XXX Sanity check offset/size. */
@@ -1209,7 +1232,7 @@ pcic_chip_io_map(pch, width, offset, size, pcihp, windowp)
/* XXX this is pretty gross */
- if (h->sc->iot != pcihp->iot)
+ if (sc->iot != pcihp->iot)
panic("pcic_chip_io_map iot is bogus");
DPRINTF(("pcic_chip_io_map window %d %s port %lx+%lx\n",
@@ -1277,7 +1300,6 @@ pcic_chip_socket_enable(pch)
pccard_chipset_handle_t pch;
{
struct pcic_handle *h = (struct pcic_handle *) pch;
- struct pccard_softc *psc = (void*)h->pccard;
int cardtype, reg, win;
/* this bit is mostly stolen from pcic_attach_card */
@@ -1292,6 +1314,16 @@ pcic_chip_socket_enable(pch)
*/
delay((300 + 100) * 1000);
+#ifdef VADEM_POWER_HACK
+ bus_space_write_1(sc->iot, sc->ioh, PCIC_REG_INDEX, 0x0e);
+ bus_space_write_1(sc->iot, sc->ioh, PCIC_REG_INDEX, 0x37);
+ printf("prcr = %02x\n", pcic_read(h, 0x02));
+ printf("cvsr = %02x\n", pcic_read(h, 0x2f));
+ printf("DANGER WILL ROBINSON! Changing voltage select!\n");
+ pcic_write(h, 0x2f, pcic_read(h, 0x2f) & ~0x03);
+ printf("cvsr = %02x\n", pcic_read(h, 0x2f));
+#endif
+
/* power up the socket */
pcic_write(h, PCIC_PWRCTL, PCIC_PWRCTL_DISABLE_RESETDRV
@@ -1340,9 +1372,7 @@ pcic_chip_socket_enable(pch)
/* set the card type */
-#if XXX
- cardtype = psc->sc_if.if_card_gettype (psc);
-#endif
+ cardtype = pccard_card_gettype(h->pccard);
reg = pcic_read(h, PCIC_INTR);
reg &= ~(PCIC_INTR_CARDTYPE_MASK | PCIC_INTR_IRQ_MASK | PCIC_INTR_ENABLE);
@@ -1353,7 +1383,7 @@ pcic_chip_socket_enable(pch)
pcic_write(h, PCIC_INTR, reg);
DPRINTF(("%s: pcic_chip_socket_enable %02x cardtype %s %02x\n",
- h->sc->dev.dv_xname, h->sock,
+ h->ph_parent->dv_xname, h->sock,
((cardtype == PCCARD_IFTYPE_IO) ? "io" : "mem"), reg));
/* reinstall all the memory and io mappings */
@@ -1384,3 +1414,29 @@ pcic_chip_socket_disable(pch)
*/
delay(300 * 1000);
}
+
+static u_int8_t
+st_pcic_read(h, idx)
+ struct pcic_handle *h;
+ int idx;
+{
+ if (idx != -1) {
+ bus_space_write_1(h->ph_bus_t, h->ph_bus_h, PCIC_REG_INDEX,
+ h->sock + idx);
+ }
+ return bus_space_read_1(h->ph_bus_t, h->ph_bus_h, PCIC_REG_DATA);
+}
+
+static void
+st_pcic_write(h, idx, data)
+ struct pcic_handle *h;
+ int idx;
+ u_int8_t data;
+{
+ if (idx != -1) {
+ bus_space_write_1(h->ph_bus_t, h->ph_bus_h, PCIC_REG_INDEX,
+ h->sock + idx);
+ }
+
+ bus_space_write_1(h->ph_bus_t, h->ph_bus_h, PCIC_REG_DATA, data);
+}
diff --git a/sys/dev/pcic/i82365_isasubr.c b/sys/dev/pcic/i82365_isasubr.c
index 671225e..33ef728 100644
--- a/sys/dev/pcic/i82365_isasubr.c
+++ b/sys/dev/pcic/i82365_isasubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82365_isasubr.c,v 1.1 1998/06/07 18:28:31 sommerfe Exp $ */
+/* $NetBSD: i82365_isasubr.c,v 1.3 1999/10/15 06:07:27 haya Exp $ */
/* $FreeBSD$ */
/*
@@ -232,8 +232,10 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg)
{
#define IST_LEVEL 1
#define IST_PULSE 2
+#define IST_EDGE 3
struct pcic_handle *h = (struct pcic_handle *) pch;
- isa_chipset_tag_t ic = h->sc->intr_est;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
+ isa_chipset_tag_t ic = sc->intr_est;
int irq, ist;
void *ih;
int reg;
@@ -243,7 +245,7 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg)
else if (pf->cfe->flags & PCCARD_CFE_IRQPULSE)
ist = IST_PULSE;
else
- ist = IST_LEVEL;
+ ist = IST_EDGE;
#if XXX
if (isa_intr_alloc(ic,
@@ -255,7 +257,7 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg)
#endif
reg = pcic_read(h, PCIC_INTR);
- reg &= ~PCIC_INTR_IRQ_MASK;
+ reg &= ~(PCIC_INTR_IRQ_MASK | PCIC_INTR_ENABLE);
reg |= irq;
pcic_write(h, PCIC_INTR, reg);
@@ -272,7 +274,8 @@ pcic_isa_chip_intr_disestablish(pch, ih)
void *ih;
{
struct pcic_handle *h = (struct pcic_handle *) pch;
- isa_chipset_tag_t ic = h->sc->intr_est;
+ struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
+ isa_chipset_tag_t ic = sc->intr_est;
int reg;
h->ih_irq = 0;
diff --git a/sys/dev/pcic/i82365var.h b/sys/dev/pcic/i82365var.h
index eb5b37c..cb3bc76 100644
--- a/sys/dev/pcic/i82365var.h
+++ b/sys/dev/pcic/i82365var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: i82365var.h,v 1.7 1999/01/21 07:43:33 msaitoh Exp $ */
+/* $NetBSD: i82365var.h,v 1.8 1999/10/15 06:07:27 haya Exp $ */
/* $FreeBSD$ */
/*
@@ -48,6 +48,12 @@ struct pcic_event {
struct pcic_handle {
struct pcic_softc *sc;
+ struct device *ph_parent;
+ bus_space_tag_t ph_bus_t; /* I/O or MEM? I don't mind */
+ bus_space_handle_t ph_bus_h;
+ u_int8_t (* ph_read) __P((struct pcic_handle*, int));
+ void (* ph_write) __P((struct pcic_handle *, int, u_int8_t));
+
int vendor;
int sock;
int flags;
@@ -167,6 +173,8 @@ void pcic_chip_io_unmap __P((pccard_chipset_handle_t, int));
void pcic_chip_socket_enable __P((pccard_chipset_handle_t));
void pcic_chip_socket_disable __P((pccard_chipset_handle_t));
+#if 0
+
static __inline int pcic_read __P((struct pcic_handle *, int));
static __inline int
pcic_read(h, idx)
@@ -191,3 +199,11 @@ pcic_write(h, idx, data)
h->sock + idx);
bus_space_write_1(h->sc->iot, h->sc->ioh, PCIC_REG_DATA, (data));
}
+#else
+#define pcic_read(h, idx) \
+ (*(h)->ph_read)((h), (idx))
+
+#define pcic_write(h, idx, data) \
+ (*(h)->ph_write)((h), (idx), (data))
+
+#endif
OpenPOWER on IntegriCloud