PERFORCE change 143060 for review
Julian Elischer
julian at FreeBSD.org
Fri Jun 6 22:19:30 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143060
Change 143060 by julian at julian_trafmon1 on 2008/06/06 22:18:49
IFC at 143055
Affected files ...
.. //depot/projects/vimage/src/sys/arm/conf/GUMSTIX#1 branch
.. //depot/projects/vimage/src/sys/arm/conf/GUMSTIX.hints#1 branch
.. //depot/projects/vimage/src/sys/arm/include/intr.h#5 integrate
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/files.pxa#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/if_smc_smi.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_gpio.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_icu.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_machdep.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_obio.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_smi.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_space.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_timer.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxareg.h#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxavar.h#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/std.pxa#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/uart_bus_pxa.c#1 branch
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/uart_cpu_pxa.c#1 branch
.. //depot/projects/vimage/src/sys/conf/files#26 integrate
.. //depot/projects/vimage/src/sys/conf/options.arm#6 integrate
.. //depot/projects/vimage/src/sys/contrib/pf/net/pf_ioctl.c#11 integrate
.. //depot/projects/vimage/src/sys/dev/bktr/bktr_i2c.c#3 integrate
.. //depot/projects/vimage/src/sys/dev/cs/if_cs.c#3 integrate
.. //depot/projects/vimage/src/sys/dev/cs/if_cs_isa.c#4 integrate
.. //depot/projects/vimage/src/sys/dev/cs/if_cs_pccard.c#4 integrate
.. //depot/projects/vimage/src/sys/dev/cs/if_csreg.h#2 integrate
.. //depot/projects/vimage/src/sys/dev/cs/if_csvar.h#3 integrate
.. //depot/projects/vimage/src/sys/dev/ichsmb/ichsmb.c#4 integrate
.. //depot/projects/vimage/src/sys/dev/ichsmb/ichsmb_pci.c#4 integrate
.. //depot/projects/vimage/src/sys/dev/ichsmb/ichsmb_var.h#2 integrate
.. //depot/projects/vimage/src/sys/dev/iicbus/iicsmb.c#2 integrate
.. //depot/projects/vimage/src/sys/dev/mii/miidevs#12 integrate
.. //depot/projects/vimage/src/sys/dev/mii/smcphy.c#1 branch
.. //depot/projects/vimage/src/sys/dev/si/si.c#3 integrate
.. //depot/projects/vimage/src/sys/dev/si/si.h#2 integrate
.. //depot/projects/vimage/src/sys/dev/smbus/smb.c#2 integrate
.. //depot/projects/vimage/src/sys/dev/smc/if_smc.c#1 branch
.. //depot/projects/vimage/src/sys/dev/smc/if_smcreg.h#1 branch
.. //depot/projects/vimage/src/sys/dev/smc/if_smcvar.h#1 branch
.. //depot/projects/vimage/src/sys/pci/amdpm.c#3 integrate
.. //depot/projects/vimage/src/sys/pci/amdsmb.c#4 integrate
.. //depot/projects/vimage/src/sys/pci/intpm.c#8 integrate
.. //depot/projects/vimage/src/sys/pci/nfsmb.c#5 integrate
.. //depot/projects/vimage/src/sys/pci/viapm.c#4 integrate
.. //depot/projects/vimage/src/sys/vm/vm_page.c#16 integrate
Differences ...
==== //depot/projects/vimage/src/sys/arm/include/intr.h#5 (text+ko) ====
@@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/arm/include/intr.h,v 1.8 2008/04/20 23:29:06 cognet Exp $
+ * $FreeBSD: src/sys/arm/include/intr.h,v 1.9 2008/06/06 05:08:09 benno Exp $
*
*/
@@ -41,6 +41,9 @@
#ifdef CPU_XSCALE_81342
#define NIRQ 128
+#elif defined(CPU_XSCALE_PXA2X0)
+#include <arm/xscale/pxa/pxareg.h>
+#define NIRQ IRQ_GPIO_MAX
#elif defined(CPU_ARM9)
#define NIRQ 64
#else
==== //depot/projects/vimage/src/sys/conf/files#26 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1306 2008/05/27 06:41:49 ed Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1307 2008/06/06 05:00:49 benno Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -901,6 +901,7 @@
dev/mii/rlswitch.c optional rlswitch
# XXX rue only?
dev/mii/ruephy.c optional miibus | ruephy
+dev/mii/smcphy.c optional miibus | smcphy
dev/mii/tdkphy.c optional miibus | tdkphy
dev/mii/tlphy.c optional miibus | tlphy
dev/mii/ukphy.c optional miibus | mii
@@ -1104,6 +1105,7 @@
dev/smbus/smbconf.c optional smbus
dev/smbus/smbus.c optional smbus
dev/smbus/smbus_if.m optional smbus
+dev/smc/if_smc.c optional smc
dev/sn/if_sn.c optional sn
dev/sn/if_sn_isa.c optional sn isa
dev/sn/if_sn_pccard.c optional sn pccard
==== //depot/projects/vimage/src/sys/conf/options.arm#6 (text+ko) ====
@@ -1,4 +1,4 @@
-#$FreeBSD: src/sys/conf/options.arm,v 1.19 2007/10/31 07:28:45 kevlo Exp $
+#$FreeBSD: src/sys/conf/options.arm,v 1.20 2008/06/06 05:08:09 benno Exp $
ARM9_CACHE_WRITE_THROUGH opt_global.h
ARM_CACHE_LOCK_ENABLE opt_global.h
ARMFPE opt_global.h
@@ -14,6 +14,7 @@
CPU_XSCALE_80321 opt_global.h
CPU_XSCALE_81342 opt_global.h
CPU_XSCALE_IXP425 opt_global.h
+CPU_XSCALE_PXA2X0 opt_global.h
FLASHADDR opt_global.h
KERNPHYSADDR opt_global.h
KERNVIRTADDR opt_global.h
==== //depot/projects/vimage/src/sys/contrib/pf/net/pf_ioctl.c#11 (text+ko) ====
@@ -40,7 +40,7 @@
#include "opt_inet6.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.32 2008/05/09 23:02:55 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.33 2008/06/05 19:30:20 mlaier Exp $");
#endif
#ifdef __FreeBSD__
@@ -1532,7 +1532,7 @@
}
#ifdef __FreeBSD__ /* ROUTEING */
- if (rule->rtableid > 0 && rule->rtableid < rt_numfibs)
+ if (rule->rtableid > 0 && rule->rtableid > rt_numfibs)
#else
if (rule->rtableid > 0 && !rtable_exists(rule->rtableid))
#endif
@@ -1795,7 +1795,7 @@
if (newrule->rtableid > 0 &&
#ifdef __FreeBSD__ /* ROUTING */
- newrule->rtableid < rt_numfibs)
+ newrule->rtableid > rt_numfibs)
#else
!rtable_exists(newrule->rtableid))
#endif
==== //depot/projects/vimage/src/sys/dev/bktr/bktr_i2c.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_i2c.c,v 1.29 2006/12/31 19:42:47 jmg Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_i2c.c,v 1.30 2008/06/06 18:40:38 jhb Exp $");
/*
* I2C support for the bti2c chipset.
@@ -128,18 +128,22 @@
switch (index) {
case SMB_REQUEST_BUS:
/* XXX test & set */
+ mtx_lock(&Giant);
if (!sc->bus_owned) {
sc->bus_owned = 1;
} else
error = EWOULDBLOCK;
+ mtx_unlock(&Giant);
break;
case SMB_RELEASE_BUS:
/* XXX test & set */
+ mtx_lock(&Giant);
if (sc->bus_owned) {
sc->bus_owned = 0;
} else
error = EINVAL;
+ mtx_unlock(&Giant);
break;
default:
@@ -161,18 +165,22 @@
switch (index) {
case IIC_REQUEST_BUS:
/* XXX test & set */
+ mtx_lock(&Giant);
if (!sc->bus_owned) {
sc->bus_owned = 1;
} else
error = EWOULDBLOCK;
+ mtx_unlock(&Giant);
break;
case IIC_RELEASE_BUS:
/* XXX test & set */
+ mtx_lock(&Giant);
if (sc->bus_owned) {
sc->bus_owned = 0;
} else
error = EINVAL;
+ mtx_unlock(&Giant);
break;
default:
@@ -184,8 +192,10 @@
int bti2c_iic_reset(device_t dev, u_char speed, u_char addr, u_char * oldaddr)
{
+ mtx_lock(&Giant);
if (oldaddr)
*oldaddr = 0; /* XXX */
+ mtx_unlock(&Giant);
return (IIC_ENOADDR);
}
@@ -195,12 +205,14 @@
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
int clock;
+ mtx_lock(&Giant);
clock = INL(sc, BKTR_I2C_DATA_CTL) & 0x2;
if (val)
OUTL(sc, BKTR_I2C_DATA_CTL, clock | 1);
else
OUTL(sc, BKTR_I2C_DATA_CTL, clock);
+ mtx_unlock(&Giant);
return;
}
@@ -210,12 +222,14 @@
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
int data;
+ mtx_lock(&Giant);
data = INL(sc, BKTR_I2C_DATA_CTL) & 0x1;
if (val)
OUTL(sc, BKTR_I2C_DATA_CTL, 0x2 | data);
else
OUTL(sc, BKTR_I2C_DATA_CTL, data);
+ mtx_unlock(&Giant);
return;
}
@@ -224,8 +238,12 @@
bti2c_iic_getsda(device_t dev)
{
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
+ int retval;
- return (INL(sc,BKTR_I2C_DATA_CTL) & 0x1);
+ mtx_lock(&Giant);
+ retval = INL(sc,BKTR_I2C_DATA_CTL) & 0x1;
+ mtx_unlock(&Giant);
+ return (retval);
}
int
@@ -239,6 +257,8 @@
{
u_long x;
+ mtx_lock(&Giant);
+
/* clear status bits */
OUTL(sc, BKTR_INT_STAT, (BT848_INT_RACK | BT848_INT_I2CDONE));
@@ -257,9 +277,11 @@
if ( !x || !( INL(sc, BKTR_INT_STAT) & BT848_INT_RACK) ) {
BTI2C_DEBUG(printf("%c%c", (!x)?'+':'-',
(!( INL(sc, BKTR_INT_STAT) & BT848_INT_RACK))?'+':'-'));
+ mtx_unlock(&Giant);
return (SMB_ENOACK);
}
BTI2C_DEBUG(printf("+"));
+ mtx_unlock(&Giant);
/* return OK */
return( 0 );
@@ -305,6 +327,7 @@
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
u_long x;
+ mtx_lock(&Giant);
/* clear status bits */
OUTL(sc,BKTR_INT_STAT, (BT848_INT_RACK | BT848_INT_I2CDONE));
@@ -322,11 +345,13 @@
if ( !x || !(INL(sc,BKTR_INT_STAT) & BT848_INT_RACK) ) {
BTI2C_DEBUG(printf("r%c%c", (!x)?'+':'-',
(!( INL(sc,BKTR_INT_STAT) & BT848_INT_RACK))?'+':'-'));
+ mtx_unlock(&Giant);
return (SMB_ENOACK);
}
*byte = (char)((INL(sc,BKTR_I2C_DATA_CTL) >> 8) & 0xff);
BTI2C_DEBUG(printf("r%x+", *byte));
+ mtx_unlock(&Giant);
return (0);
}
==== //depot/projects/vimage/src/sys/dev/cs/if_cs.c#3 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cs/if_cs.c,v 1.49 2008/06/05 14:49:35 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cs/if_cs.c,v 1.53 2008/06/06 17:27:19 imp Exp $");
/*
*
@@ -94,23 +94,17 @@
static int get_eeprom_cksum(int, int, uint16_t *);
static int wait_eeprom_ready( struct cs_softc *);
static void control_dc_dc( struct cs_softc *, int );
-static int send_test_pkt( struct cs_softc * );
static int enable_tp(struct cs_softc *);
static int enable_aui(struct cs_softc *);
static int enable_bnc(struct cs_softc *);
static int cs_duplex_auto(struct cs_softc *);
devclass_t cs_devclass;
+driver_intr_t csintr;
/* sysctl vars */
SYSCTL_NODE(_hw, OID_AUTO, cs, CTLFLAG_RD, 0, "cs device parameters");
-int cs_debug = 0;
-TUNABLE_INT("hw.cs.debug", &cs_debug);
-SYSCTL_INT(_hw_cs, OID_AUTO, debug, CTLFLAG_RW,
- &cs_debug, 0,
- "cs debug");
-
int cs_ignore_cksum_failure = 0;
TUNABLE_INT("hw.cs.ignore_checksum_failure", &cs_ignore_cksum_failure);
SYSCTL_INT(_hw_cs, OID_AUTO, ignore_checksum_failure, CTLFLAG_RW,
@@ -137,9 +131,8 @@
int i;
#ifdef CS_DEBUG
- printf(CS_NAME":EEPROM data from %x for %x:\n", off, len);
+ device_printf(sc->dev, "EEPROM data from %x for %x:\n", off, len);
#endif
-
for (i=0; i < len; i++) {
if (wait_eeprom_ready(sc) < 0)
return (-1);
@@ -150,8 +143,7 @@
buffer[i] = cs_readreg(sc, PP_EEData);
#ifdef CS_DEBUG
- printf("%02x %02x ",(unsigned char)buffer[i],
- (unsigned char)buffer[i] >> 8);
+ printf("%04x ",buffer[i]);
#endif
}
@@ -170,20 +162,34 @@
for (i = 0; i < len; i++)
cksum += buffer[i];
cksum &= 0xffff;
- if (cksum==0)
+ if (cksum == 0 || cs_ignore_cksum_failure)
return (0);
- if (cs_ignore_cksum_failure) {
- printf(CS_NAME": checksum mismatch, ignoring\n");
- return (0);
- }
return (-1);
}
static int
wait_eeprom_ready(struct cs_softc *sc)
{
- DELAY(30000); /* XXX should we do some checks here ? */
- return (0);
+ int i;
+
+ /*
+ * From the CS8900A datasheet, section 3.5.2:
+ * "Before issuing any command to the EEPROM, the host must wait
+ * for the SIBUSY bit (Register 16, SelfST, bit 8) to clear. After
+ * each command has been issued, the host must wait again for SIBUSY
+ * to clear."
+ *
+ * Before we issue the command, we should be !busy, so that will
+ * be fast. The datasheet suggests that clock out from the part
+ * per word will be on the order of 25us, which is consistant with
+ * the 1MHz serial clock and 16bits... We should never hit 100,
+ * let alone 15,000 here. The original code did an unconditional
+ * 30ms DELAY here. Bad Kharma. cs_readreg takes ~2us.
+ */
+ for (i = 0; i < 15000; i++) /* 30ms max */
+ if (!(cs_readreg(sc, PP_SelfST) & SI_BUSY))
+ return (0);
+ return (1);
}
static void
@@ -208,7 +214,7 @@
cs_writereg(sc, PP_AutoNegCTL,
RE_NEG_NOW | ALLOW_FDX | AUTO_NEG_ENABLE);
for (i=0; cs_readreg(sc, PP_AutoNegST) & AUTO_NEG_BUSY; i++) {
- if (i > 40000) {
+ if (i > 4000) {
device_printf(sc->dev,
"full/half duplex auto negotiation timeout\n");
error = ETIMEDOUT;
@@ -228,77 +234,23 @@
return (0);
}
-/*
- * XXX This was rewritten from Linux driver without any tests.
- */
-static int
-send_test_pkt(struct cs_softc *sc)
-{
- char test_packet[] = { 0,0,0,0,0,0, 0,0,0,0,0,0,
- 0, 46, /* A 46 in network order */
- 0, 0, /* DSAP=0 & SSAP=0 fields */
- 0xf3, 0 /* Control (Test Req + P bit set) */ };
- int i;
- u_char ether_address_backup[ETHER_ADDR_LEN];
-
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- ether_address_backup[i] = sc->enaddr[i];
-
- cs_writereg(sc, PP_LineCTL, cs_readreg(sc, PP_LineCTL) | SERIAL_TX_ON);
- bcopy(test_packet, sc->enaddr, ETHER_ADDR_LEN);
- bcopy(test_packet+ETHER_ADDR_LEN,
- sc->enaddr, ETHER_ADDR_LEN);
- cs_outw(sc, TX_CMD_PORT, sc->send_cmd);
- cs_outw(sc, TX_LEN_PORT, sizeof(test_packet));
-
- /* Wait for chip to allocate memory */
- DELAY(50000);
- if (!(cs_readreg(sc, PP_BusST) & READY_FOR_TX_NOW)) {
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- sc->enaddr[i] = ether_address_backup[i];
- return (0);
- }
-
- outsw(sc->nic_addr + TX_FRAME_PORT, test_packet, sizeof(test_packet));
-
- DELAY(30000);
-
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- sc->enaddr[i] = ether_address_backup[i];
- if ((cs_readreg(sc, PP_TxEvent) & TX_SEND_OK_BITS) == TX_OK)
- return (1);
- return (0);
-}
-
-/*
- * XXX This was rewritten from Linux driver without any tests.
- */
static int
enable_aui(struct cs_softc *sc)
{
- control_dc_dc(sc, 0);
cs_writereg(sc, PP_LineCTL,
(sc->line_ctl & ~AUTO_AUI_10BASET) | AUI_ONLY);
-
- if (!send_test_pkt(sc))
- return (EINVAL);
+ control_dc_dc(sc, 0);
return (0);
}
-/*
- * XXX This was rewritten from Linux driver without any tests.
- */
static int
enable_bnc(struct cs_softc *sc)
{
- control_dc_dc(sc, 1);
cs_writereg(sc, PP_LineCTL,
(sc->line_ctl & ~AUTO_AUI_10BASET) | AUI_ONLY);
-
- if (!send_test_pkt(sc))
- return (EINVAL);
+ control_dc_dc(sc, 1);
return (0);
}
@@ -315,6 +267,7 @@
uint16_t eeprom_buff[CHKSUM_LEN];
int chip_type, pp_isaint, pp_isadma;
+ sc->dev = dev;
error = cs_alloc_port(dev, 0, CS_89x0_IO_PORTS);
if (error)
return (error);
@@ -475,40 +428,19 @@
return (ENOENT);
sc->port_rid = rid;
sc->port_res = res;
- sc->port_used = size;
return (0);
}
/*
- * Allocate a memory resource with the given resource id.
- */
-int
-cs_alloc_memory(device_t dev, int rid, int size)
-{
- struct cs_softc *sc = device_get_softc(dev);
- struct resource *res;
-
- res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
- 0ul, ~0ul, size, RF_ACTIVE);
- if (res == NULL)
- return (ENOENT);
- sc->mem_rid = rid;
- sc->mem_res = res;
- sc->mem_used = size;
- return (0);
-}
-
-/*
* Allocate an irq resource with the given resource id.
*/
int
-cs_alloc_irq(device_t dev, int rid, int flags)
+cs_alloc_irq(device_t dev, int rid)
{
struct cs_softc *sc = device_get_softc(dev);
struct resource *res;
- res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- (RF_ACTIVE | flags));
+ res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
if (res == NULL)
return (ENOENT);
sc->irq_rid = rid;
@@ -529,11 +461,6 @@
sc->port_rid, sc->port_res);
sc->port_res = 0;
}
- if (sc->mem_res) {
- bus_release_resource(dev, SYS_RES_MEMORY,
- sc->mem_rid, sc->mem_res);
- sc->mem_res = 0;
- }
if (sc->irq_res) {
bus_release_resource(dev, SYS_RES_IRQ,
sc->irq_rid, sc->irq_res);
@@ -574,13 +501,6 @@
ifp->if_ioctl=cs_ioctl;
ifp->if_init=cs_init;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
- /*
- * MIB DATA
- */
- /*
- ifp->if_linkmib=&sc->mibdata;
- ifp->if_linkmiblen=sizeof sc->mibdata;
- */
ifp->if_flags=(IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
==== //depot/projects/vimage/src/sys/dev/cs/if_cs_isa.c#4 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cs/if_cs_isa.c,v 1.8 2008/06/05 14:49:35 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cs/if_cs_isa.c,v 1.12 2008/06/06 16:10:10 imp Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -48,8 +48,8 @@
#include <dev/cs/if_csvar.h>
#include <dev/cs/if_csreg.h>
-static int cs_isa_probe (device_t);
-static int cs_isa_attach (device_t);
+static int cs_isa_probe(device_t);
+static int cs_isa_attach(device_t);
static struct isa_pnp_id cs_ids[] = {
{ 0x4060630e, NULL }, /* CSC6040 */
@@ -63,7 +63,7 @@
static int
cs_isa_probe(device_t dev)
{
- int error = 0;
+ int error;
/* Check isapnp ids */
error = ISA_PNP_PROBE(device_get_parent(dev), dev, cs_ids);
@@ -72,15 +72,13 @@
if (error == ENXIO)
goto end;
- /* If we had some other problem. */
- if (!(error == 0 || error == ENOENT))
- goto end;
-
- error = cs_cs89x0_probe(dev);
+ /* If we've matched, or there's no PNP ID, probe chip */
+ if (error == 0 || error == ENOENT)
+ error = cs_cs89x0_probe(dev);
end:
/* Make sure IRQ is assigned for probe message and available */
if (error == 0)
- error = cs_alloc_irq(dev, 0, 0);
+ error = cs_alloc_irq(dev, 0);
cs_release_resources(dev);
return (error);
@@ -92,10 +90,7 @@
struct cs_softc *sc = device_get_softc(dev);
cs_alloc_port(dev, 0, CS_89x0_IO_PORTS);
- /* XXX mem appears to not be used at all */
- if (sc->mem_used)
- cs_alloc_memory(dev, sc->mem_rid, sc->mem_used);
- cs_alloc_irq(dev, sc->irq_rid, 0);
+ cs_alloc_irq(dev, sc->irq_rid);
return (cs_attach(dev));
}
@@ -104,9 +99,7 @@
/* Device interface */
DEVMETHOD(device_probe, cs_isa_probe),
DEVMETHOD(device_attach, cs_isa_attach),
-#ifdef CS_HAS_DETACH
DEVMETHOD(device_detach, cs_detach),
-#endif
{ 0, 0 }
};
==== //depot/projects/vimage/src/sys/dev/cs/if_cs_pccard.c#4 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cs/if_cs_pccard.c,v 1.20 2008/06/05 14:49:35 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cs/if_cs_pccard.c,v 1.24 2008/06/06 16:10:10 imp Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -58,13 +58,10 @@
cs_pccard_probe(device_t dev)
{
const struct pccard_product *pp;
- int error;
uint32_t fcn = PCCARD_FUNCTION_UNSPEC;
/* Make sure we're a network function */
- error = pccard_get_function(dev, &fcn);
- if (error != 0)
- return (error);
+ pccard_get_function(dev, &fcn);
if (fcn != PCCARD_FUNCTION_NETWORK)
return (ENXIO);
@@ -87,7 +84,7 @@
error = cs_cs89x0_probe(dev);
if (error != 0)
return (error);
- error = cs_alloc_irq(dev, sc->irq_rid, 0);
+ error = cs_alloc_irq(dev, sc->irq_rid);
if (error != 0)
goto bad;
==== //depot/projects/vimage/src/sys/dev/cs/if_csreg.h#2 (text+ko) ====
@@ -27,7 +27,7 @@
*/
/*
- * $FreeBSD: src/sys/dev/cs/if_csreg.h,v 1.6 2005/01/06 01:42:32 imp Exp $
+ * $FreeBSD: src/sys/dev/cs/if_csreg.h,v 1.7 2008/06/06 04:56:27 imp Exp $
*/
#define CS_89x0_IO_PORTS 0x0020
@@ -518,9 +518,6 @@
#define CS_DUPLEX_FULL 1
#define CS_DUPLEX_HALF 2
-/* Device name */
-#define CS_NAME "cs"
-
/*
* It would appear that for pccards (well, the IBM EtherJet PCMCIA card) that
* are connected to card bus bridges there's a problem. For reading the
==== //depot/projects/vimage/src/sys/dev/cs/if_csvar.h#3 (text+ko) ====
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/cs/if_csvar.h,v 1.10 2008/06/05 14:49:35 jhb Exp $
+ * $FreeBSD: src/sys/dev/cs/if_csvar.h,v 1.12 2008/06/06 05:25:24 imp Exp $
*/
#ifndef _IF_CSVAR_H
@@ -50,11 +50,7 @@
struct ifmedia media; /* Media information */
int port_rid; /* resource id for port range */
- int port_used; /* nonzero if ports used */
struct resource* port_res; /* resource for port range */
- int mem_rid; /* resource id for memory range */
- int mem_used; /* nonzero if memory used */
- struct resource* mem_res; /* resource for memory range */
int irq_rid; /* resource id for irq */
struct resource* irq_res; /* resource for irq */
void* irq_handle; /* handle for irq handler */
@@ -79,12 +75,10 @@
#define CS_ASSERT_LOCKED(sc) mtx_assert(&(sc)->lock, MA_OWNED)
int cs_alloc_port(device_t dev, int rid, int size);
-int cs_alloc_memory(device_t dev, int rid, int size);
-int cs_alloc_irq(device_t dev, int rid, int flags);
+int cs_alloc_irq(device_t dev, int rid);
int cs_attach(device_t dev);
int cs_cs89x0_probe(device_t dev);
int cs_detach(device_t dev);
void cs_release_resources(device_t dev);
-driver_intr_t csintr;
#endif /* _IF_CSVAR_H */
==== //depot/projects/vimage/src/sys/dev/ichsmb/ichsmb.c#4 (text+ko) ====
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ichsmb/ichsmb.c,v 1.18 2007/02/23 12:18:43 piso Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ichsmb/ichsmb.c,v 1.19 2008/06/06 18:29:56 jhb Exp $");
/*
* Support for the SMBus controller logical device which is part of the
@@ -121,10 +121,10 @@
}
/* Clear interrupt conditions */
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_STA, 0xff);
+ bus_write_1(sc->io_res, ICH_HST_STA, 0xff);
/* Set up interrupt handler */
- error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC,
+ error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
NULL, ichsmb_device_intr, sc, &sc->irq_handle);
if (error != 0) {
device_printf(dev, "can't setup irq\n");
@@ -181,10 +181,10 @@
case SMB_QWRITE:
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_QUICK;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | (how == SMB_QREAD ?
ICH_XMIT_SLVA_READ : ICH_XMIT_SLVA_WRITE));
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
smb_error = ichsmb_wait(sc);
mtx_unlock(&sc->mutex);
@@ -207,10 +207,10 @@
("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd));
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_WRITE);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, byte);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CMD, byte);
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
smb_error = ichsmb_wait(sc);
mtx_unlock(&sc->mutex);
@@ -229,12 +229,12 @@
("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd));
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_READ);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR)
- *byte = bus_space_read_1(sc->io_bst, sc->io_bsh, ICH_D0);
+ *byte = bus_read_1(sc->io_res, ICH_D0);
mtx_unlock(&sc->mutex);
DBG("smb_error=%d byte=0x%02x\n", smb_error, (u_char)*byte);
return (smb_error);
@@ -252,11 +252,11 @@
("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd));
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_WRITE);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, byte);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
+ bus_write_1(sc->io_res, ICH_D0, byte);
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
smb_error = ichsmb_wait(sc);
mtx_unlock(&sc->mutex);
@@ -276,12 +276,12 @@
("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd));
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_WRITE);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, word & 0xff);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D1, word >> 8);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
+ bus_write_1(sc->io_res, ICH_D0, word & 0xff);
+ bus_write_1(sc->io_res, ICH_D1, word >> 8);
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
smb_error = ichsmb_wait(sc);
mtx_unlock(&sc->mutex);
@@ -300,13 +300,13 @@
("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd));
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_READ);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR)
- *byte = bus_space_read_1(sc->io_bst, sc->io_bsh, ICH_D0);
+ *byte = bus_read_1(sc->io_res, ICH_D0);
mtx_unlock(&sc->mutex);
DBG("smb_error=%d byte=0x%02x\n", smb_error, (u_char)*byte);
return (smb_error);
@@ -323,16 +323,16 @@
("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd));
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_READ);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) {
- *word = (bus_space_read_1(sc->io_bst,
- sc->io_bsh, ICH_D0) & 0xff)
- | (bus_space_read_1(sc->io_bst,
- sc->io_bsh, ICH_D1) << 8);
+ *word = (bus_read_1(sc->io_res,
+ ICH_D0) & 0xff)
+ | (bus_read_1(sc->io_res,
+ ICH_D1) << 8);
}
mtx_unlock(&sc->mutex);
DBG("smb_error=%d word=0x%04x\n", smb_error, (u_int16_t)*word);
@@ -351,18 +351,18 @@
("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd));
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_PROC_CALL;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_WRITE);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, sdata & 0xff);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D1, sdata >> 8);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
+ bus_write_1(sc->io_res, ICH_D0, sdata & 0xff);
+ bus_write_1(sc->io_res, ICH_D1, sdata >> 8);
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) {
- *rdata = (bus_space_read_1(sc->io_bst,
- sc->io_bsh, ICH_D0) & 0xff)
- | (bus_space_read_1(sc->io_bst,
- sc->io_bsh, ICH_D1) << 8);
+ *rdata = (bus_read_1(sc->io_res,
+ ICH_D0) & 0xff)
+ | (bus_read_1(sc->io_res,
+ ICH_D1) << 8);
}
mtx_unlock(&sc->mutex);
DBG("smb_error=%d rdata=0x%04x\n", smb_error, (u_int16_t)*rdata);
@@ -402,12 +402,12 @@
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_WRITE);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, count);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_BLOCK_DB, buf[0]);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
+ bus_write_1(sc->io_res, ICH_D0, count);
+ bus_write_1(sc->io_res, ICH_BLOCK_DB, buf[0]);
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
smb_error = ichsmb_wait(sc);
mtx_unlock(&sc->mutex);
@@ -433,11 +433,11 @@
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK;
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
+ bus_write_1(sc->io_res, ICH_XMIT_SLVA,
(slave << 1) | ICH_XMIT_SLVA_READ);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, *count); /* XXX? */
- bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
+ bus_write_1(sc->io_res, ICH_D0, *count); /* XXX? */
+ bus_write_1(sc->io_res, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) {
bcopy(sc->block_data, buf, min(sc->block_count, *count));
@@ -509,7 +509,7 @@
for (count = 0; count < maxloops; count++) {
/* Get and reset status bits */
- status = bus_space_read_1(sc->io_bst, sc->io_bsh, ICH_HST_STA);
+ status = bus_read_1(sc->io_res, ICH_HST_STA);
#if ICHSMB_DEBUG
if ((status & ~(ICH_HST_STA_INUSE_STS | ICH_HST_STA_HOST_BUSY))
|| count > 0) {
@@ -532,7 +532,7 @@
if ((status & ~ok_bits) != 0) {
device_printf(dev, "irq 0x%02x during %d\n", status,
cmd_index);
- bus_space_write_1(sc->io_bst, sc->io_bsh,
+ bus_write_1(sc->io_res,
ICH_HST_STA, (status & ~ok_bits));
continue;
}
@@ -567,16 +567,16 @@
if (sc->block_index < sc->block_count) {
/* Write next byte */
- bus_space_write_1(sc->io_bst,
- sc->io_bsh, ICH_BLOCK_DB,
+ bus_write_1(sc->io_res,
+ ICH_BLOCK_DB,
sc->block_data[sc->block_index++]);
}
} else {
/* First interrupt, get the count also */
if (sc->block_index == 0) {
- sc->block_count = bus_space_read_1(
- sc->io_bst, sc->io_bsh, ICH_D0);
+ sc->block_count = bus_read_1(
+ sc->io_res, ICH_D0);
}
/* Get next byte, if any */
@@ -584,15 +584,15 @@
/* Read next byte */
sc->block_data[sc->block_index++] =
- bus_space_read_1(sc->io_bst,
- sc->io_bsh, ICH_BLOCK_DB);
+ bus_read_1(sc->io_res,
+ ICH_BLOCK_DB);
/* Set "LAST_BYTE" bit before reading
the last byte of block data */
if (sc->block_index
>= sc->block_count - 1) {
- bus_space_write_1(sc->io_bst,
- sc->io_bsh, ICH_HST_CNT,
+ bus_write_1(sc->io_res,
+ ICH_HST_CNT,
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list