From: David van Moolenbroek Date: Tue, 6 Mar 2012 23:49:16 +0000 (+0100) Subject: drivers: remove redundant PCI ID tables X-Git-Tag: v3.2.1~672 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=5152cfd8bd6bf1de667379a59912a97a9b2cf7a8;p=minix.git drivers: remove redundant PCI ID tables - remove PCI tables where system.conf suffices - remove drivers' ability to mess up NIC order - fix dp8390 PCI enumeration - convert ti1225 to instance model - add system.conf entry for ti1225 --- diff --git a/drivers/ahci/ahci.c b/drivers/ahci/ahci.c index 78e86eedb..4aed999a3 100644 --- a/drivers/ahci/ahci.c +++ b/drivers/ahci/ahci.c @@ -1905,14 +1905,12 @@ PRIVATE void port_init(struct port_state *ps) /*===========================================================================* * ahci_probe * *===========================================================================*/ -PRIVATE int ahci_probe(int instance) +PRIVATE int ahci_probe(int skip) { /* Find a matching PCI device. */ - int r, skip, devind; + int r, devind; u16_t vid, did; - u8_t bcr, scr, pir; - u32_t t3; pci_init(); @@ -1920,25 +1918,7 @@ PRIVATE int ahci_probe(int instance) if (r <= 0) return -1; - skip = 0; - - for (;;) { - /* Get the class register values. */ - bcr = pci_attr_r8(devind, PCI_BCR); - scr = pci_attr_r8(devind, PCI_SCR); - pir = pci_attr_r8(devind, PCI_PIFR); - - t3 = (bcr << 16) | (scr << 8) | pir; - - /* If the device is a match, see if we have to leave it to - * another driver instance. - */ - if (t3 == PCI_T3_AHCI) { - if (skip == instance) - break; - skip++; - } - + while (skip--) { r = pci_next_dev(&devind, &vid, &did); if (r <= 0) return -1; diff --git a/drivers/atl2/atl2.c b/drivers/atl2/atl2.c index 70adec6ec..756bde4ec 100644 --- a/drivers/atl2/atl2.c +++ b/drivers/atl2/atl2.c @@ -84,14 +84,6 @@ PRIVATE struct { PRIVATE iovec_s_t iovec[NR_IOREQS]; -PRIVATE struct { - u16_t vid; - u16_t did; -} pcitab[] = { - { 0x1969, 0x2048 }, /* Attansic Technology Corp, L2 FastEthernet */ - { 0x0000, 0x0000 } -}; - PRIVATE int instance; /*===========================================================================* @@ -465,13 +457,13 @@ PRIVATE int atl2_setup(void) /*===========================================================================* * atl2_probe * *===========================================================================*/ -PRIVATE int atl2_probe(int instance) +PRIVATE int atl2_probe(int skip) { /* Find a matching PCI device. */ u16_t vid, did; char *dname; - int i, r, devind, skip; + int r, devind; pci_init(); @@ -479,19 +471,7 @@ PRIVATE int atl2_probe(int instance) if (r <= 0) return -1; - skip = 0; - - for (;;) { - for (i = 0; pcitab[i].vid != 0; i++) - if (pcitab[i].vid == vid && pcitab[i].did == did) - break; - - if (pcitab[i].vid != 0) { - if (skip == instance) break; - - skip++; - } - + while (skip--) { r = pci_next_dev(&devind, &vid, &did); if (r <= 0) return -1; diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index 7eccd28a2..ea786bf85 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -285,7 +285,8 @@ PRIVATE void do_watchdog(void *UNUSED(message)) return; } -PRIVATE int de_probe(dpeth_t *dep, int skip){ +PRIVATE int de_probe(dpeth_t *dep, int skip) +{ int i, r, devind; u16_t vid, did, temp16; @@ -295,16 +296,8 @@ PRIVATE int de_probe(dpeth_t *dep, int skip){ if (r == 0) return FALSE; - for(;;) + while (skip--) { - if ( DEC21140A_VID == vid && - DEC21140A_DID == did) - { - if (!skip) - break; - skip--; - } - r= pci_next_dev(&devind, &vid, &did); if (!r) return FALSE; diff --git a/drivers/dec21140A/dec21140A.h b/drivers/dec21140A/dec21140A.h index da2dac178..6a8b4ea95 100644 --- a/drivers/dec21140A/dec21140A.h +++ b/drivers/dec21140A/dec21140A.h @@ -32,8 +32,6 @@ Created: 09/01/2009 Nicolas Tittley (first.last @ gmail DOT com) #define DE_MIN_BASE_ADDR 0x0400 #define DE_SROM_EA_OFFSET 20 #define DE_SETUP_FRAME_SIZE 192 -#define DEC21140A_VID 0x1011 -#define DEC21140A_DID 0x0009 typedef struct iovec_dat_s { diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index 4af3d7311..3c24d3248 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -324,11 +324,9 @@ void dp8390_dump() *===========================================================================*/ static void pci_conf() { - int confnr; char envvar[16]; struct dpeth *dep; - static char envfmt[] = "*:d.d.d"; - long v; + int i, pci_instance; static int first_time= 1; if (!first_time) @@ -337,30 +335,22 @@ static void pci_conf() dep= &de_state; - /* Pick a default configuration for this instance. */ - confnr= MIN(de_instance, DP_CONF_NR-1); - strcpy(envvar, "DPETH0"); envvar[5] += de_instance; if (!(dep->de_pci= env_prefix(envvar, "pci"))) return; /* no PCI config */ - v= 0; - (void) env_parse(envvar, envfmt, 1, &v, 0, 255); - dep->de_pcibus= v; - v= 0; - (void) env_parse(envvar, envfmt, 2, &v, 0, 255); - dep->de_pcidev= v; - v= 0; - (void) env_parse(envvar, envfmt, 3, &v, 0, 255); - dep->de_pcifunc= v; - if (!dep->de_pci) { - printf("%s: no pci for instance %d\n", dep->de_name, - de_instance); - return; + /* Count the number of dp instances before this one that are configured + * for PCI, so that we can skip that many when enumerating PCI devices. + */ + pci_instance= 0; + for (i= 0; i < de_instance; i++) { + envvar[5]= i; + if (env_prefix(envvar, "pci")) + pci_instance++; } - if (!rtl_probe(dep, de_instance)) + if (!rtl_probe(dep, pci_instance)) dep->de_pci= -1; } #endif /* ENABLE_PCI */ diff --git a/drivers/dp8390/dp8390.h b/drivers/dp8390/dp8390.h index 77ac014b3..b3ae821fe 100644 --- a/drivers/dp8390/dp8390.h +++ b/drivers/dp8390/dp8390.h @@ -257,9 +257,6 @@ typedef struct dpeth #if ENABLE_PCI /* PCI config */ char de_pci; /* TRUE iff PCI device */ - u8_t de_pcibus; - u8_t de_pcidev; - u8_t de_pcifunc; #endif /* Do it yourself send queue */ diff --git a/drivers/dp8390/rtl8029.c b/drivers/dp8390/rtl8029.c index b0895a372..8fd381777 100644 --- a/drivers/dp8390/rtl8029.c +++ b/drivers/dp8390/rtl8029.c @@ -22,18 +22,6 @@ Created: April 2000 by Philip Homburg #if ENABLE_PCI -PRIVATE struct pcitab -{ - u16_t vid; - u16_t did; - int checkclass; -} pcitab[]= -{ - { 0x10ec, 0x8029, 0 }, /* Realtek RTL8029 */ - - { 0x0000, 0x0000, 0 } -}; - _PROTOTYPE( static void rtl_init, (struct dpeth *dep) ); #if 0 _PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) ); @@ -46,7 +34,7 @@ PUBLIC int rtl_probe(dep, skip) struct dpeth *dep; int skip; { - int i, r, devind, just_one; + int r, devind; u16_t vid, did; u32_t bar; u8_t ilr; @@ -54,58 +42,12 @@ int skip; pci_init(); - if ((dep->de_pcibus | dep->de_pcidev | dep->de_pcifunc) != 0) - { - /* Look for specific PCI device */ - r= pci_find_dev(dep->de_pcibus, dep->de_pcidev, - dep->de_pcifunc, &devind); - if (r == 0) - { - printf("%s: no PCI found at %d.%d.%d\n", - dep->de_name, dep->de_pcibus, - dep->de_pcidev, dep->de_pcifunc); - return 0; - } - pci_ids(devind, &vid, &did); - just_one= TRUE; - } - else - { - r= pci_first_dev(&devind, &vid, &did); - if (r == 0) - return 0; - just_one= FALSE; - } + r= pci_first_dev(&devind, &vid, &did); + if (r == 0) + return 0; - for(;;) + while (skip--) { - for (i= 0; pcitab[i].vid != 0 || pcitab[i].did != 0; i++) - { - if (pcitab[i].vid != vid) - continue; - if (pcitab[i].did != did) - continue; - if (pcitab[i].checkclass) { - panic("rtl_probe: class check not implemented"); - } - break; - } - if (pcitab[i].vid != 0 || pcitab[i].did != 0) { - if (just_one || !skip) - break; - skip--; - } - - if (just_one) - { - printf( - "%s: wrong PCI device (%04X/%04X) found at %d.%d.%d\n", - dep->de_name, vid, did, - dep->de_pcibus, - dep->de_pcidev, dep->de_pcifunc); - return 0; - } - r= pci_next_dev(&devind, &vid, &did); if (!r) return 0; diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index c8e2aa927..6874c30bc 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -242,15 +242,11 @@ PRIVATE int e1000_probe(e1000_t *e, int skip) return FALSE; } /* Loop devices on the PCI bus. */ - for(;;) + while (skip--) { E1000_DEBUG(3, ("%s: probe() devind %d vid 0x%x did 0x%x\n", e->name, devind, vid, did)); - if (!skip) - break; - skip--; - if (!(r = pci_next_dev(&devind, &vid, &did))) { return FALSE; diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 5051841a1..856b6db1f 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -40,25 +40,6 @@ /* Configuration */ #define FXP_ENVVAR "FXPETH" -struct pcitab -{ - u16_t vid; - u16_t did; - int checkclass; -}; - -PRIVATE struct pcitab pcitab_fxp[]= -{ - { 0x8086, 0x1229, 0 }, /* Intel 82557, etc. */ - { 0x8086, 0x2449, 0 }, /* Intel 82801BA/BAM/CA/CAM */ - { 0x8086, 0x103d, 0 }, /* Intel 82801DB */ - { 0x8086, 0x1064, 0 }, /* Intel 82562 */ - { 0x8086, 0x1031, 0 }, /* Intel 82801CAM VE */ - { 0x8086, 0x1032, 0 }, /* Intel 82801CAM VE */ - { 0x8086, 0x1209, 0 }, /* Intel 82551IT */ - { 0x0000, 0x0000, 0 } -}; - typedef int irq_hook_t; /* ignore interrupt for the moment */ @@ -116,9 +97,6 @@ typedef struct fxp /* PCI related */ int fxp_seen; /* TRUE iff device available */ - u8_t fxp_pcibus; - u8_t fxp_pcidev; - u8_t fxp_pcifunc; /* 'large' items */ irq_hook_t fxp_hook; @@ -422,10 +400,7 @@ message *mp; *===========================================================================*/ static void fxp_pci_conf() { - static char envvar[] = FXP_ENVVAR "#"; - fxp_t *fp; - long v; fp= fxp_state; @@ -433,40 +408,9 @@ static void fxp_pci_conf() fp->fxp_name[4] += fxp_instance; fp->fxp_seen= FALSE; fp->fxp_features= FFE_NONE; - envvar[sizeof(FXP_ENVVAR)-1]= '0'+fxp_instance; -#if 0 - if (getenv(envvar) != NULL) - { - if (strcmp(getenv(envvar), "off") == 0) - { - fp->fxp_pcibus= 255; - } - if (!env_prefix(envvar, "pci")) - env_panic(envvar); - } -#endif pci_init(); - if (fp->fxp_pcibus == 255) - return; - - v= 0; -#if 0 - (void) env_parse(envvar, envfmt, 1, &v, 0, 255); -#endif - fp->fxp_pcibus= v; - v= 0; -#if 0 - (void) env_parse(envvar, envfmt, 2, &v, 0, 255); -#endif - fp->fxp_pcidev= v; - v= 0; -#if 0 - (void) env_parse(envvar, envfmt, 3, &v, 0, 255); -#endif - fp->fxp_pcifunc= v; - if (fxp_probe(fp, fxp_instance)) fp->fxp_seen= TRUE; } @@ -476,65 +420,18 @@ static void fxp_pci_conf() *===========================================================================*/ static int fxp_probe(fxp_t *fp, int skip) { - int i, r, devind, just_one; + int r, devind; u16_t vid, did; u32_t bar; u8_t ilr, rev; char *dname, *str; - if ((fp->fxp_pcibus | fp->fxp_pcidev | fp->fxp_pcifunc) != 0) - { - /* Look for specific PCI device */ - r= pci_find_dev(fp->fxp_pcibus, fp->fxp_pcidev, - fp->fxp_pcifunc, &devind); - if (r == 0) - { - printf("%s: no PCI device found at %d.%d.%d\n", - fp->fxp_name, fp->fxp_pcibus, - fp->fxp_pcidev, fp->fxp_pcifunc); - return FALSE; - } - pci_ids(devind, &vid, &did); - just_one= TRUE; - } - else - { - r= pci_first_dev(&devind, &vid, &did); - if (r == 0) - return FALSE; - just_one= FALSE; - } + r= pci_first_dev(&devind, &vid, &did); + if (r == 0) + return FALSE; - for(;;) + while (skip--) { - for (i= 0; pcitab_fxp[i].vid != 0; i++) - { - if (pcitab_fxp[i].vid != vid) - continue; - if (pcitab_fxp[i].did != did) - continue; - if (pcitab_fxp[i].checkclass) { - panic("fxp_probe: class check not implemented"); - } - break; - } - if (pcitab_fxp[i].vid != 0) - { - if (just_one || !skip) - break; - skip--; - } - - if (just_one) - { - printf( - "%s: wrong PCI device (%04x/%04x) found at %d.%d.%d\n", - fp->fxp_name, vid, did, - fp->fxp_pcibus, - fp->fxp_pcidev, fp->fxp_pcifunc); - return FALSE; - } - r= pci_next_dev(&devind, &vid, &did); if (!r) return FALSE; diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index 196eff086..9ae0e7ccf 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -79,19 +79,6 @@ ec_conf_t ec_conf[EC_CONF_NR]= /* Card addresses */ { 0x0000, 0, 0x00000, }, }; -/* Actually, we use PCI-BIOS info. */ -PRIVATE struct pcitab -{ - u16_t vid; - u16_t did; - int checkclass; -} pcitab[]= -{ - { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, 0 }, /* AMD LANCE */ - - { 0x0000, 0x0000, 0 } -}; - /* General */ _PROTOTYPE( static void do_init, (message *mp) ); _PROTOTYPE( static void ec_init, (ether_card_t *ec) ); @@ -1405,63 +1392,15 @@ int skip; unsigned short pci_cmd; unsigned short ioaddr; int lance_version, chip_version; - int devind, just_one, i, r; - + int devind, r; u16_t vid, did; - if ((ec->ec_pcibus | ec->ec_pcidev | ec->ec_pcifunc) != 0) - { - /* Look for specific PCI device */ - r= pci_find_dev(ec->ec_pcibus, ec->ec_pcidev, - ec->ec_pcifunc, &devind); - if (r == 0) - { - printf("%s: no PCI found at %d.%d.%d\n", - ec->port_name, ec->ec_pcibus, - ec->ec_pcidev, ec->ec_pcifunc); - return 0; - } - pci_ids(devind, &vid, &did); - just_one= TRUE; - } - else - { - r= pci_first_dev(&devind, &vid, &did); - if (r == 0) - return 0; - just_one= FALSE; - } + r= pci_first_dev(&devind, &vid, &did); + if (r == 0) + return 0; - for(;;) + while (skip--) { - for (i= 0; pcitab[i].vid != 0; i++) - { - if (pcitab[i].vid != vid) - continue; - if (pcitab[i].did != did) - continue; - if (pcitab[i].checkclass) { - panic("class check not implemented"); - } - break; - } - if (pcitab[i].vid != 0) - { - if (just_one || !skip) - break; - skip--; - } - - if (just_one) - { - printf( - "%s: wrong PCI device (%04x/%04x) found at %d.%d.%d\n", - ec->port_name, vid, did, - ec->ec_pcibus, - ec->ec_pcidev, ec->ec_pcifunc); - return 0; - } - r= pci_next_dev(&devind, &vid, &did); if (!r) return 0; diff --git a/drivers/lance/lance.h b/drivers/lance/lance.h index be8aa33b2..4e8a39ab6 100644 --- a/drivers/lance/lance.h +++ b/drivers/lance/lance.h @@ -16,9 +16,6 @@ #define PCI_COMMAND_MASTER 0x4 -#define PCI_VENDOR_ID_AMD 0x1022 -#define PCI_DEVICE_ID_AMD_LANCE 0x2000 - /* macros for 'mode' */ #define EC_DISABLED 0x0 @@ -81,10 +78,6 @@ typedef struct ether_card int ec_hook; int ec_ramsize; - /* PCI */ - u8_t ec_pcibus; - u8_t ec_pcidev; - u8_t ec_pcifunc; /* Addrassing */ u16_t ec_memseg; diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index dbf2c9f73..3ce544df5 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -25,17 +25,6 @@ #define VERBOSE 1 /* display message during init */ -PRIVATE struct pcitab { - u16_t vid; - u16_t did; - int checkclass; -} pcitab[]= -{ - { 0x1260, 0x3873, 0 }, - { 0x1186, 0x1300, 0 }, - { 0x0000, 0x0000, 0 } -}; - #include #include @@ -488,11 +477,7 @@ static void or_init (message * mp) { * can be searched (at the end: or_probe function) * *****************************************************************************/ static void or_pci_conf () { - long v; t_or *orp; - static char envfmt[] = "*:d.d.d"; - static char envvar[] = OR_ENVVAR "#"; - static char val[128]; /* extract information from the boot monitor about the pci * configuration if provided */ @@ -501,22 +486,6 @@ static void or_pci_conf () { strncpy (orp->or_name, OR_NAME, sizeof(OR_NAME)); orp->or_name[sizeof(OR_NAME) - 2] = or_instance + '0'; orp->or_seen = FALSE; - /* whats this envvar; whats the definition;*/ - /* i guess this whole loop could be removed*/ - envvar[sizeof (OR_ENVVAR) - 1] = '0' + or_instance; - if (0 == env_get_param(envvar, val, sizeof(val)) && - ! env_prefix(envvar, "pci")) { - env_panic(envvar); - } - v = 0; - (void) env_parse (envvar, envfmt, 1, &v, 0, 255); - orp->or_pci_bus = v; - v = 0; - (void) env_parse (envvar, envfmt, 2, &v, 0, 255); - orp->or_pci_dev = v; - v = 0; - (void) env_parse (envvar, envfmt, 3, &v, 0, 255); - orp->or_pci_func = v; /* Initialize the pci bus, bridges and cards, if not yet done */ pci_init (); @@ -538,67 +507,15 @@ static int or_probe (t_or * orp, int skip) u32_t bar; char *dname; u16_t vid, did; - int i, r, devind, just_one; - - if ((orp->or_pci_bus | orp->or_pci_dev | orp->or_pci_func) != 0) { - /* The monitor has provided us with clues about where the - * device is. Try to find it at that place */ - r = pci_find_dev (orp->or_pci_bus, orp->or_pci_dev, - orp->or_pci_func, &devind); - if (r == 0) { - printf ("%s: no PCI found at %d.%d.%d\n", - orp->or_name, orp->or_pci_bus, - orp->or_pci_dev, orp->or_pci_func); - return (0); - } - /* get the information about the card, vendor id and device - * id */ - pci_ids (devind, &vid, &did); - just_one = TRUE; - } else { - /* no clue where the card is. Start looking from the - * beginning */ - r = pci_first_dev (&devind, &vid, &did); - if (r == 0) - return (0); - just_one = FALSE; - } - - while (TRUE) { - /* loop through the pcitab to find a maching entry. The match - * being between one of the values in pcitab and the - * information provided by the pci bus */ - for (i = 0; pcitab[i].vid != 0; i++) { - if (pcitab[i].vid != vid) - continue; - if (pcitab[i].did != did) - continue; - if (pcitab[i].checkclass) { - panic("or_probe:class check not implmnted"); - } - /* we have found the card in the pci bus */ - break; - } + int r, devind; - /* unless we are looking for a specific device, we may have to - * skip a number of cards because they are already reserved for - * other (lower) ports of this driver */ - if (pcitab[i].vid != 0) { - if (just_one || !skip) - break; - skip--; - } - - if (just_one) { - printf ("%s: wrong PCI device", orp->or_name); - printf (" (%04x/%04x) found at %d.%d.%d\n", vid, did, - orp->or_pci_bus, orp->or_pci_dev, - orp->or_pci_func); - return (0); - } + /* Start looking from the beginning */ + r = pci_first_dev (&devind, &vid, &did); + if (r == 0) + return (0); - /* if the pci device which was under consideration was not - * of the desired brand or type, get the next device */ + /* Skip as many instances as requested */ + while (skip--) { r = pci_next_dev (&devind, &vid, &did); if (!r) return (0); diff --git a/drivers/orinoco/orinoco.h b/drivers/orinoco/orinoco.h index e48299fa7..6adb838b5 100644 --- a/drivers/orinoco/orinoco.h +++ b/drivers/orinoco/orinoco.h @@ -16,7 +16,6 @@ #define LARGE_KEY_LENGTH 13 #define IW_ESSID_MAX_SIZE 32 #define IOVEC_NR 16 -#define OR_ENVVAR "ORETH" #define OR_NAME "orinoco#n" #define IEEE802_11_HLEN 30 @@ -82,9 +81,6 @@ typedef struct s_or /* PCI related */ int or_seen; - u8_t or_pci_bus; - u8_t or_pci_dev; - u8_t or_pci_func; int devind; /* 'large' items */ diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 3dae0aacc..42192a2ab 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -16,36 +16,6 @@ #include "rtl8139.h" -PRIVATE struct pcitab -{ - u16_t vid; - u16_t did; - int checkclass; -} pcitab[]= -{ - { 0x10ec, 0x8139, 0 }, /* Realtek RTL8139 */ - - /* Alternative IDs */ - { 0x02ac, 0x1012, 0 }, /* SpeedStream 1012 PCMCIA 10/100 */ - { 0x1065, 0x8139, 0 }, /* Texas Microsystems 8139C Network Card */ - { 0x1113, 0x1211, 0 }, /* Accton MPX5030 or SMC1211TX EZCard 10/100 */ - { 0x1186, 0x1300, 0 }, /* D-Link DFE530TX+/DFE538TX */ - { 0x1186, 0x1340, 0 }, /* D-Link DFE690TXD */ - { 0x11db, 0x1234, 0 }, /* Sega Dreamcast HIT-400 */ - { 0x1259, 0xa117, 0 }, /* Allied Telesyn 8139 */ - { 0x1259, 0xa11e, 0 }, /* Allied Telesyn 8139 */ - { 0x126c, 0x1211, 0 }, /* Northern Telecom 10/100BaseTX*/ - { 0x13d1, 0xab06, 0 }, /* AboCom FE2000VX */ - { 0x1432, 0x9130, 0 }, /* Edimax Computer Co. RTL81xx */ - { 0x14ea, 0xab06, 0 }, /* Planex FNW-3603-TX */ - { 0x14ea, 0xab07, 0 }, /* Planex FNW-3800-TX */ - { 0x1500, 0x1360, 0 }, /* Delta Electronics RealTek Ethernet */ - { 0x1743, 0x8139, 0 }, /* Peppercon AG 8139 ROL/F-100 */ - { 0x4033, 0x1360, 0 }, /* Addtron Technology 8139 */ - - { 0x0000, 0x0000, 0 } -}; - PUBLIC re_t re_state; static int re_instance; @@ -419,30 +389,12 @@ message *mp; static void rl_pci_conf() { re_t *rep; - static char envvar[] = RL_ENVVAR "#"; - static char envfmt[] = "*:d.d.d"; - static char val[128]; - long v; rep= &re_state; strcpy(rep->re_name, "rtl8139#0"); rep->re_name[8] += re_instance; rep->re_seen= FALSE; - envvar[sizeof(RL_ENVVAR)-1]= '0'+re_instance; - if (0 == env_get_param(envvar, val, sizeof(val)) && - ! env_prefix(envvar, "pci")) { - env_panic(envvar); - } - v= 0; - (void) env_parse(envvar, envfmt, 1, &v, 0, 255); - rep->re_pcibus= v; - v= 0; - (void) env_parse(envvar, envfmt, 2, &v, 0, 255); - rep->re_pcidev= v; - v= 0; - (void) env_parse(envvar, envfmt, 3, &v, 0, 255); - rep->re_pcifunc= v; pci_init(); @@ -457,7 +409,7 @@ static int rl_probe(rep, skip) re_t *rep; int skip; { - int i, r, devind, just_one; + int r, devind; u16_t vid, did; u32_t bar; u8_t ilr; @@ -465,59 +417,12 @@ int skip; char *dname; #endif - if ((rep->re_pcibus | rep->re_pcidev | rep->re_pcifunc) != 0) - { - /* Look for specific PCI device */ - r= pci_find_dev(rep->re_pcibus, rep->re_pcidev, - rep->re_pcifunc, &devind); - if (r == 0) - { - printf("%s: no PCI found at %d.%d.%d\n", - rep->re_name, rep->re_pcibus, - rep->re_pcidev, rep->re_pcifunc); - return 0; - } - pci_ids(devind, &vid, &did); - just_one= TRUE; - } - else - { - r= pci_first_dev(&devind, &vid, &did); - if (r == 0) - return 0; - just_one= FALSE; - } + r= pci_first_dev(&devind, &vid, &did); + if (r == 0) + return 0; - for(;;) + while (skip--) { - for (i= 0; pcitab[i].vid != 0; i++) - { - if (pcitab[i].vid != vid) - continue; - if (pcitab[i].did != did) - continue; - if (pcitab[i].checkclass) { - panic("class check not implemented"); - } - break; - } - if (pcitab[i].vid != 0) - { - if (just_one || !skip) - break; - skip--; - } - - if (just_one) - { - printf( - "%s: wrong PCI device (%04x/%04x) found at %d.%d.%d\n", - rep->re_name, vid, did, - rep->re_pcibus, - rep->re_pcidev, rep->re_pcifunc); - return 0; - } - r= pci_next_dev(&devind, &vid, &did); if (!r) return 0; @@ -617,8 +522,7 @@ re_t *rep; buf += BUF_ALIGNMENT - off; } - tell_dev((vir_bytes)mallocbuf, tot_bufsize, rep->re_pcibus, - rep->re_pcidev, rep->re_pcifunc); + tell_dev((vir_bytes)mallocbuf, tot_bufsize, 0, 0, 0); for (i= 0; ire_name, "rtl8169#0"); rep->re_name[8] += re_instance; rep->re_seen = FALSE; - envvar[sizeof(RL_ENVVAR)-1] = '0' + re_instance; - if (0 == env_get_param(envvar, val, sizeof(val)) && - !env_prefix(envvar, "pci")) - { - env_panic(envvar); - } - v = 0; - (void) env_parse(envvar, envfmt, 1, &v, 0, 255); - rep->re_pcibus = v; - v = 0; - (void) env_parse(envvar, envfmt, 2, &v, 0, 255); - rep->re_pcidev = v; - v = 0; - (void) env_parse(envvar, envfmt, 3, &v, 0, 255); - rep->re_pcifunc = v; pci_init(); @@ -662,56 +615,17 @@ static int rl_probe(rep, skip) re_t *rep; int skip; { - int i, r, devind, just_one; + int r, devind; u16_t vid, did; u32_t bar; u8_t ilr; char *dname; - if ((rep->re_pcibus | rep->re_pcidev | rep->re_pcifunc) != 0) { - /* Look for specific PCI device */ - r = pci_find_dev(rep->re_pcibus, rep->re_pcidev, - rep->re_pcifunc, &devind); - if (r == 0) { - printf("%s: no PCI found at %d.%d.%d\n", - rep->re_name, rep->re_pcibus, - rep->re_pcidev, rep->re_pcifunc); - return 0; - } - pci_ids(devind, &vid, &did); - just_one = TRUE; - } else { - r = pci_first_dev(&devind, &vid, &did); - if (r == 0) - return 0; - just_one = FALSE; - } - - for (;;) { - for (i = 0; pcitab[i].vid != 0; i++) { - if (pcitab[i].vid != vid) - continue; - if (pcitab[i].did != did) - continue; - if (pcitab[i].checkclass) { - panic("class check not implemented"); - } - break; - } - if (pcitab[i].vid != 0) { - if (just_one || !skip) - break; - skip--; - } - - if (just_one) { - printf("%s: wrong PCI device (%04x/%04x) found at %d.%d.%d\n", - rep->re_name, vid, did, - rep->re_pcibus, - rep->re_pcidev, rep->re_pcifunc); - return 0; - } + r = pci_first_dev(&devind, &vid, &did); + if (r == 0) + return 0; + while (skip--) { r = pci_next_dev(&devind, &vid, &did); if (!r) return 0; diff --git a/drivers/ti1225/ti1225.c b/drivers/ti1225/ti1225.c index a5529faa5..82ee8ed33 100644 --- a/drivers/ti1225/ti1225.c +++ b/drivers/ti1225/ti1225.c @@ -16,11 +16,8 @@ Created: Dec 2005 by Philip Homburg /* The use of interrupts is not yet ready for prime time */ #define USE_INTS 0 -#define NR_PORTS 2 - PRIVATE struct port { - unsigned p_flags; int p_devind; u8_t p_cb_busnr; u16_t p_exca_port; @@ -29,26 +26,13 @@ PRIVATE struct port int p_hook; #endif volatile struct csr *csr_ptr; -} ports[NR_PORTS]; - -#define PF_PRESENT 1 - -struct pcitab -{ - u16_t vid; - u16_t did; - int checkclass; -}; - -PRIVATE struct pcitab pcitab_ti[]= -{ - { 0x104C, 0xAC1C, 0 }, /* TI PCI1225 */ +} port; - { 0x0000, 0x0000, 0 } -}; +PRIVATE int instance; PRIVATE int debug; -FORWARD _PROTOTYPE( void hw_init, (struct port *pp) ); +FORWARD _PROTOTYPE( int hw_probe, (int skip) ); +FORWARD _PROTOTYPE( void hw_init, (struct port *pp, int devind) ); FORWARD _PROTOTYPE( void do_int, (struct port *pp) ); /* SEF functions and variables. */ @@ -84,17 +68,17 @@ int main(int argc, char *argv[]) *===========================================================================*/ PRIVATE void sef_local_startup() { - /* Register init callbacks. */ - sef_setcb_init_fresh(sef_cb_init_fresh); - sef_setcb_init_lu(sef_cb_init_fresh); - sef_setcb_init_restart(sef_cb_init_fresh); + /* Register init callbacks. */ + sef_setcb_init_fresh(sef_cb_init_fresh); + sef_setcb_init_lu(sef_cb_init_fresh); + sef_setcb_init_restart(sef_cb_init_fresh); - /* Register live update callbacks. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); + /* Register live update callbacks. */ + sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); + sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Let SEF perform startup. */ - sef_startup(); + /* Let SEF perform startup. */ + sef_startup(); } /*===========================================================================* @@ -103,77 +87,60 @@ PRIVATE void sef_local_startup() PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) { /* Initialize the ti1225 driver. */ - int c, i, r, first, devind, port; - u16_t vid, did; + int r, devind; + long v; if((r=tsc_calibrate()) != OK) panic("tsc_calibrate failed: %d", r); - debug= 0; - while (c= getopt(env_argc, env_argv, "d?"), c != -1) - { - switch(c) - { - case '?': panic("Usage: ti1225 [-d]"); - case 'd': debug++; break; - default: panic("getopt failed"); - } - } + v = 0; + (void) env_parse("instance", "d", 0, &v, 0, 255); + instance = (int) v; - pci_init(); + v = 0; + (void) env_parse("debug", "d", 0, &v, 0, 1); + debug = (int) v; - first= 1; - port= 0; - for (;;) - { - if (first) - { - first= 0; - r= pci_first_dev(&devind, &vid, &did); - } - else - r= pci_next_dev(&devind, &vid, &did); - if (r != 1) - break; + devind = hw_probe(instance); - for (i= 0; pcitab_ti[i].vid != 0; i++) - { - if (pcitab_ti[i].vid != vid) - continue; - if (pcitab_ti[i].did != did) - continue; - if (pcitab_ti[i].checkclass) { - panic("fxp_probe: class check not implemented"); - } - break; - } - if (pcitab_ti[i].vid == 0) - continue; - - pci_reserve(devind); - - if (debug) - printf("ti1225: found device %04x/%04x\n", vid, did); - ports[port].p_devind= devind; - ports[port].p_flags |= PF_PRESENT; - port++; - if (port >= NR_PORTS) - break; - } + if (devind < 0) + return(ENODEV); - for (i= 0; ip_devind; + pp->p_devind= devind; if (debug) printf("hw_init: devind = %d\n", devind); @@ -277,6 +244,9 @@ PRIVATE void hw_init(struct port *pp) #endif } +/*===========================================================================* + * do_int * + *===========================================================================*/ PRIVATE void do_int(struct port *pp) { int devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv, diff --git a/etc/system.conf b/etc/system.conf index 7a021b812..34c567159 100644 --- a/etc/system.conf +++ b/etc/system.conf @@ -459,6 +459,14 @@ service es1371 pci device 1274/1371; }; +service ti1225 +{ + system + IRQCTL # 19 + ; + pci device 104c/ac1c; +}; + service amddev { pci device 1022/1103;