From 9f0237640951470ded761abd092b18062f787954 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 16 Apr 2005 09:30:48 +0000 Subject: [PATCH] Make isa_probe_addr a simple integer rather than a struct, to facilitate specification of ISA_PROBE_ADDRS. --- src/drivers/bus/isa.c | 9 ++++++--- src/drivers/net/cs89x0.c | 12 ++++++------ src/drivers/net/depca.c | 6 +++--- src/drivers/net/eepro.c | 8 +++----- src/drivers/net/skel.c | 6 +++--- src/drivers/net/smc9000.c | 10 ++++------ src/include/isa.h | 10 ++++------ 7 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/drivers/bus/isa.c b/src/drivers/bus/isa.c index e2c1e7ae..a4af1202 100644 --- a/src/drivers/bus/isa.c +++ b/src/drivers/bus/isa.c @@ -13,7 +13,10 @@ * instead. Some cards (e.g. the 3c509) implement a proprietary * ISAPnP-like mechanism. * - * The ISA probe address list can be overridden by config.c; if + * The ISA probe address list can be overridden by config.c; if the + * user specifies ISA_PROBE_ADDRS then that list will be used first. + * (If ISA_PROBE_ADDRS ends with a zero, the driver's own list will + * never be used). */ /* @@ -49,7 +52,7 @@ int find_isa_device ( struct isa_device *isa, struct isa_driver *driver ) { } /* Set I/O address */ - ioaddr = isa_extra_probe_addrs[i].addr; + ioaddr = isa_extra_probe_addrs[i]; /* An I/O address of 0 in extra_probe_addrs list means * stop probing (i.e. don't continue to the @@ -80,7 +83,7 @@ int find_isa_device ( struct isa_device *isa, struct isa_driver *driver ) { } /* Set I/O address */ - ioaddr = driver->probe_addrs[i].addr; + ioaddr = driver->probe_addrs[i]; /* Use probe_addr method to see if there's a device * present at this address. diff --git a/src/drivers/net/cs89x0.c b/src/drivers/net/cs89x0.c index c2d09fa0..3c7dc004 100644 --- a/src/drivers/net/cs89x0.c +++ b/src/drivers/net/cs89x0.c @@ -463,7 +463,7 @@ static struct nic_operations cs89x0_operations = { ETH_PROBE - Look for an adapter ***************************************************************************/ -static int cs89x0_probe_addr ( uint16_t ioaddr ) { +static int cs89x0_probe_addr ( isa_probe_addr_t ioaddr ) { /* if they give us an odd I/O address, then do ONE write to the address port, to get it back to address zero, where we expect to find the EISA signature word. */ @@ -685,14 +685,14 @@ static int cs89x0_probe ( struct dev *dev, struct isa_device *isa ) { return 1; } -static struct isa_probe_addr cs89x0_probe_addrs[] = { +static isa_probe_addr_t cs89x0_probe_addrs[] = { #ifndef EMBEDDED /* use "conservative" default values for autoprobing */ - { 0x300 }, { 0x320 }, { 0x340 }, { 0x200 }, { 0x220 }, { 0x240 }, - { 0x260 }, { 0x280 }, { 0x2a0 }, { 0x2c0 }, { 0x2e0 }, + 0x300, 0x320, 0x340, 0x200, 0x220, 0x240, + 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, /* if that did not work, then be more aggressive */ - { 0x301 }, { 0x321 }, { 0x341 }, { 0x201 }, { 0x221 }, { 0x241 }, - { 0x261 }, { 0x281 }, { 0x2a1 }, { 0x2c1 }, { 0x2e1 }, + 0x301, 0x321, 0x341, 0x201, 0x221, 0x241, + 0x261, 0x281, 0x2a1, 0x2c1, 0x2e1, #else 0x01000300, #endif diff --git a/src/drivers/net/depca.c b/src/drivers/net/depca.c index 45cc2d7c..78339b08 100644 --- a/src/drivers/net/depca.c +++ b/src/drivers/net/depca.c @@ -695,7 +695,7 @@ static void depca_irq(struct nic *nic __unused, irq_action_t action __unused) static u8 nicsr; -static int depca_probe1 ( uint16_t ioaddr ) { +static int depca_probe1 ( isa_probe_addr_t ioaddr ) { u8 data; /* This is only correct for little endian machines, but then Etherboot doesn't work on anything but a PC */ @@ -787,8 +787,8 @@ static int depca_probe ( struct dev *dev, struct isa_device *isa ) { return 1; } -static struct isa_probe_addr depca_probe_addrs[] = { - { 0x300 }, { 0x200 }, +static isa_probe_addr_t depca_probe_addrs[] = { + 0x300, 0x200, }; static struct isa_driver depca_driver = diff --git a/src/drivers/net/eepro.c b/src/drivers/net/eepro.c index d97b2495..a2b75e0e 100644 --- a/src/drivers/net/eepro.c +++ b/src/drivers/net/eepro.c @@ -516,7 +516,7 @@ static int read_eeprom(uint16_t ioaddr, int location) return (retval); } -static int eepro_probe1 ( uint16_t ioaddr ) { +static int eepro_probe1 ( isa_probe_addr_t ioaddr ) { int id, counter; id = inb(ioaddr + ID_REG); @@ -600,10 +600,8 @@ static int eepro_probe ( struct dev *dev, struct isa_device *isa ) { return 1; } -static struct isa_probe_addr eepro_probe_addrs[] = { - { 0x300 }, - { 0x210 }, { 0x240 }, { 0x280 }, { 0x2C0 }, { 0x200 }, - { 0x320 }, { 0x340 }, { 0x360 }, +static isa_probe_addr_t eepro_probe_addrs[] = { + 0x300, 0x210, 0x240, 0x280, 0x2C0, 0x200, 0x320, 0x340, 0x360, }; static struct isa_driver eepro_driver = diff --git a/src/drivers/net/skel.c b/src/drivers/net/skel.c index e47fdb26..369f841b 100644 --- a/src/drivers/net/skel.c +++ b/src/drivers/net/skel.c @@ -349,7 +349,7 @@ ISA_ROM ( "skel-mca", "Skeleton MCA Adapter" ); * ************************************************************************** */ -static int skel_isa_probe_addr ( uint16_t ioaddr __unused ) { +static int skel_isa_probe_addr ( isa_probe_addr_t ioaddr __unused ) { return 0; } @@ -372,9 +372,9 @@ static int skel_isa_probe ( struct dev *dev, struct isa_device *isa ) { return 1; } -static struct isa_probe_addr skel_isa_probe_addrs[] = { +static isa_probe_addr_t skel_isa_probe_addrs[] = { /* - { 0x200 }, { 0x240 }, + 0x200, 0x240, */ }; diff --git a/src/drivers/net/smc9000.c b/src/drivers/net/smc9000.c index 09345a62..6cadcd0c 100644 --- a/src/drivers/net/smc9000.c +++ b/src/drivers/net/smc9000.c @@ -108,7 +108,7 @@ static void smc_reset(int ioaddr) * * --------------------------------------------------------------------- */ -static int smc9000_probe_addr( unsigned short ioaddr ) +static int smc9000_probe_addr( isa_probe_addr_t ioaddr ) { word bank; word revision_register; @@ -483,11 +483,9 @@ static int smc9000_probe ( struct dev *dev, struct isa_device *isa ) { * change for a slightly different card, you can add it to the array. * */ -static struct isa_probe_addr smc9000_probe_addrs[] = { - { 0x200 }, { 0x220 }, { 0x240 }, { 0x260 }, - { 0x280 }, { 0x2A0 }, { 0x2C0 }, { 0x2E0 }, - { 0x300 }, { 0x320 }, { 0x340 }, { 0x360 }, - { 0x380 }, { 0x3A0 }, { 0x3C0 }, { 0x3E0 }, +static isa_probe_addr_t smc9000_probe_addrs[] = { + 0x200, 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x2E0, + 0x300, 0x320, 0x340, 0x360, 0x380, 0x3A0, 0x3C0, 0x3E0, }; static struct isa_driver smc9000_driver = diff --git a/src/include/isa.h b/src/include/isa.h index b1107e52..a76e526b 100644 --- a/src/include/isa.h +++ b/src/include/isa.h @@ -19,9 +19,7 @@ struct isa_device { * An individual ISA device, identified by probe address * */ -struct isa_probe_addr { - uint16_t addr; -} __attribute__ (( packed )); +typedef uint16_t isa_probe_addr_t; /* * An ISA driver, with a probe address list and a probe_addr method. @@ -32,9 +30,9 @@ struct isa_probe_addr { */ struct isa_driver { const char *name; - struct isa_probe_addr *probe_addrs; + isa_probe_addr_t *probe_addrs; unsigned int addr_count; - int ( * probe_addr ) ( uint16_t addr ); + int ( * probe_addr ) ( isa_probe_addr_t addr ); uint16_t mfg_id; uint16_t prod_id; }; @@ -72,7 +70,7 @@ extern int find_isa_boot_device ( struct dev *dev, * config.c defines isa_extra_probe_addrs and isa_extra_probe_addr_count. * */ -extern struct isa_probe_addr isa_extra_probe_addrs[]; +extern isa_probe_addr_t isa_extra_probe_addrs[]; extern unsigned int isa_extra_probe_addr_count; #endif /* ISA_H */