From a00e63fb9da97e7b71f87d20bc4267f31aaa4570 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 26 Jul 1999 05:43:17 +0000 Subject: shrink code, cleanup port printouts, repairs various comments --- sys/dev/pcmcia/aic_pcmcia.c | 17 +++++------------ sys/dev/pcmcia/com_pcmcia.c | 4 +++- sys/dev/pcmcia/if_ep_pcmcia.c | 14 +++++++------- sys/dev/pcmcia/if_ne_pcmcia.c | 35 ++++++++++++++++------------------- sys/dev/pcmcia/if_sm_pcmcia.c | 11 +++++------ sys/dev/pcmcia/if_xe.c | 18 ++++++++---------- sys/dev/pcmcia/wdc_pcmcia.c | 12 ++++++++++-- 7 files changed, 54 insertions(+), 57 deletions(-) (limited to 'sys/dev/pcmcia') diff --git a/sys/dev/pcmcia/aic_pcmcia.c b/sys/dev/pcmcia/aic_pcmcia.c index f18eb9b72ac..ca1f1ed8085 100644 --- a/sys/dev/pcmcia/aic_pcmcia.c +++ b/sys/dev/pcmcia/aic_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic_pcmcia.c,v 1.4 1999/07/01 06:29:54 fgsch Exp $ */ +/* $OpenBSD: aic_pcmcia.c,v 1.5 1999/07/26 05:43:15 deraadt Exp $ */ /* $NetBSD: aic_pcmcia.c,v 1.6 1998/07/19 17:28:15 christos Exp $ */ /* @@ -122,9 +122,7 @@ aic_pcmcia_attach(parent, self, aux) struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; struct pcmcia_function *pf = pa->pf; -#if 0 struct aic_pcmcia_product *app; -#endif psc->sc_pf = pf; @@ -169,22 +167,17 @@ aic_pcmcia_attach(parent, self, aux) return; } + printf(" port 0x%lx/%d", psc->sc_pcioh.addr, psc->sc_pcioh.size); + if (!aic_find(sc->sc_iot, sc->sc_ioh)) { printf(": unable to detect chip!\n"); return; } -#if 0 app = aic_pcmcia_lookup(pa); - if (app == NULL) { - printf("\n"); - panic("aic_pcmcia_attach: impossible"); - } - - printf(": %s\n", app->app_name); -#else + if (app) + printf(": %s", app->app_name); printf("\n"); -#endif aicattach(sc); diff --git a/sys/dev/pcmcia/com_pcmcia.c b/sys/dev/pcmcia/com_pcmcia.c index 0ca430a18d5..59434122260 100644 --- a/sys/dev/pcmcia/com_pcmcia.c +++ b/sys/dev/pcmcia/com_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_pcmcia.c,v 1.12 1999/01/28 04:58:29 fgsch Exp $ */ +/* $OpenBSD: com_pcmcia.c,v 1.13 1999/07/26 05:43:15 deraadt Exp $ */ /* $NetBSD: com_pcmcia.c,v 1.15 1998/08/22 17:47:58 msaitoh Exp $ */ /*- @@ -291,6 +291,8 @@ found: return; } + printf(" port 0x%lx/%d", psc->sc_pcioh.addr, psc->sc_pcioh.size); + sc->sc_iobase = -1; #ifdef notyet sc->sc_frequency = COM_FREQ; diff --git a/sys/dev/pcmcia/if_ep_pcmcia.c b/sys/dev/pcmcia/if_ep_pcmcia.c index 9cce564f64f..8aa53bcbf9d 100644 --- a/sys/dev/pcmcia/if_ep_pcmcia.c +++ b/sys/dev/pcmcia/if_ep_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ep_pcmcia.c,v 1.14 1999/05/28 12:41:55 niklas Exp $ */ +/* $OpenBSD: if_ep_pcmcia.c,v 1.15 1999/07/26 05:43:15 deraadt Exp $ */ /* $NetBSD: if_ep_pcmcia.c,v 1.16 1998/08/17 23:20:40 thorpej Exp $ */ /*- @@ -332,6 +332,8 @@ ep_pcmcia_attach(parent, self, aux) return; } + printf(" port 0x%lx/%d", psc->sc_pcioh.addr, cfe->iospace[0].length); + switch (pa->product) { case PCMCIA_PRODUCT_3COM_3C562: /* @@ -355,20 +357,18 @@ ep_pcmcia_attach(parent, self, aux) if (epp == NULL) panic("ep_pcmcia_attach: impossible"); - printf(": %s,", epp->epp_name); - #ifdef notyet sc->enable = ep_pcmcia_enable; sc->disable = ep_pcmcia_disable; #endif - epconfig(sc, epp->epp_chipset, enaddr); - /* establish the interrupt. */ sc->sc_ih = pcmcia_intr_establish(pa->pf, IPL_NET, epintr, sc); if (sc->sc_ih == NULL) - printf("%s: couldn't establish interrupt\n", - sc->sc_dev.dv_xname); + printf(", couldn't establish interrupt"); + + printf(": <%s>", epp->epp_name); + epconfig(sc, epp->epp_chipset, enaddr); #ifdef notyet sc->enabled = 0; diff --git a/sys/dev/pcmcia/if_ne_pcmcia.c b/sys/dev/pcmcia/if_ne_pcmcia.c index 4a64c575bec..69a0c00045f 100644 --- a/sys/dev/pcmcia/if_ne_pcmcia.c +++ b/sys/dev/pcmcia/if_ne_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ne_pcmcia.c,v 1.10 1999/07/01 06:29:55 fgsch Exp $ */ +/* $OpenBSD: if_ne_pcmcia.c,v 1.11 1999/07/26 05:43:16 deraadt Exp $ */ /* $NetBSD: if_ne_pcmcia.c,v 1.17 1998/08/15 19:00:04 thorpej Exp $ */ /* @@ -382,7 +382,7 @@ ne_pcmcia_attach(parent, self, aux) */ if (cfe->num_memspace != 1) { - printf(": unexpected number of memory spaces " + printf(": unexpected number of memory spaces, " " %d should be 1\n", cfe->num_memspace); return; } @@ -457,7 +457,7 @@ ne_pcmcia_attach(parent, self, aux) return; } - printf("\n"); + printf(" port 0x%lx/%d", psc->sc_pcioh.addr, NE2000_NIC_NPORTS); /* * Read the station address from the board. @@ -468,17 +468,15 @@ ne_pcmcia_attach(parent, self, aux) if (ne_dev->enet_maddr >= 0) { if (pcmcia_mem_alloc(pa->pf, ETHER_ADDR_LEN * 2, &pcmh)) { - printf("%s: can't alloc mem for" - " enet addr\n", - dsc->sc_dev.dv_xname); + printf(": can't alloc mem for" + " address\n"); return; } if (pcmcia_mem_map(pa->pf, PCMCIA_MEM_ATTR, ne_dev->enet_maddr, ETHER_ADDR_LEN * 2, &pcmh, &offset, &mwindow)) { - printf("%s: can't map mem for" - " enet addr\n", - dsc->sc_dev.dv_xname); + printf(": can't map mem for" + " address\n"); return; } for (j = 0; j < ETHER_ADDR_LEN; j++) @@ -502,8 +500,8 @@ ne_pcmcia_attach(parent, self, aux) enaddr[2] != ne_dev->enet_vendor[2]) { printf("%s: enet addr has incorrect vendor code\n", dsc->sc_dev.dv_xname); - printf("%s: (%02x:%02x:%02x should be " - "%02x:%02x:%02x)\n", dsc->sc_dev.dv_xname, + printf(": (%02x:%02x:%02x should be " + "%02x:%02x:%02x)\n", enaddr[0], enaddr[1], enaddr[2], ne_dev->enet_vendor[0], ne_dev->enet_vendor[1], @@ -528,8 +526,13 @@ ne_pcmcia_attach(parent, self, aux) dsc->init_card = rtl80x9_init_card; } - printf("%s: %s%s Ethernet\n", dsc->sc_dev.dv_xname, ne_dev->name, - typestr); + /* set up the interrupt */ + psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, dp8390_intr, + dsc); + if (psc->sc_ih == NULL) + printf("no irq"); + + printf(": <%s%s>\n", ne_dev->name, typestr); /* Initialize media, if we have it. */ if (npp_init_media != NULL) @@ -541,12 +544,6 @@ ne_pcmcia_attach(parent, self, aux) pcmcia_function_disable(pa->pf); #endif - /* set up the interrupt */ - psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, dp8390_intr, - dsc); - if (psc->sc_ih == NULL) - printf("%s: couldn't establish interrupt\n", - dsc->sc_dev.dv_xname); } int diff --git a/sys/dev/pcmcia/if_sm_pcmcia.c b/sys/dev/pcmcia/if_sm_pcmcia.c index 1d41c3ed73b..667e8ab5eb0 100644 --- a/sys/dev/pcmcia/if_sm_pcmcia.c +++ b/sys/dev/pcmcia/if_sm_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sm_pcmcia.c,v 1.3 1998/10/14 07:34:43 fgsch Exp $ */ +/* $OpenBSD: if_sm_pcmcia.c,v 1.4 1999/07/26 05:43:16 deraadt Exp $ */ /* $NetBSD: if_sm_pcmcia.c,v 1.11 1998/08/15 20:47:32 thorpej Exp $ */ /*- @@ -207,11 +207,13 @@ sm_pcmcia_attach(parent, self, aux) return; } + printf(" port 0x%lx/%d", psc->sc_pcioh.addr, cfe->iospace[0].length); + spp = sm_pcmcia_lookup(pa); if (spp == NULL) panic("sm_pcmcia_attach: impossible"); - printf(": %s\n", spp->spp_name); + printf(": %s", spp->spp_name); /* * First try to get the Ethernet address from FUNCE/LANNID tuple. @@ -229,19 +231,16 @@ sm_pcmcia_attach(parent, self, aux) case PCMCIA_VENDOR_MEGAHERTZ2: cisstr = pa->pf->sc->card.cis1_info[3]; break; - case PCMCIA_VENDOR_SMC: cisstr = pa->pf->sc->card.cis1_info[2]; break; } - if (cisstr != NULL && sm_pcmcia_ascii_enaddr(cisstr, myla)) enaddr = myla; } if (enaddr == NULL) - printf("%s: unable to get Ethernet address\n", - sc->sc_dev.dv_xname); + printf(", unable to get Ethernet address\n"); /* Perform generic intialization. */ smc91cxx_attach(sc, enaddr); diff --git a/sys/dev/pcmcia/if_xe.c b/sys/dev/pcmcia/if_xe.c index 3e849146ba0..8552f56c283 100644 --- a/sys/dev/pcmcia/if_xe.c +++ b/sys/dev/pcmcia/if_xe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xe.c,v 1.3 1999/05/19 14:04:04 niklas Exp $ */ +/* $OpenBSD: if_xe.c,v 1.4 1999/07/26 05:43:16 deraadt Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist, C Stone, Job de Haas @@ -320,6 +320,8 @@ xe_pcmcia_attach(parent, self, aux) sc->sc_bsh = psc->sc_pcmh.memh; #endif + printf(" port 0x%lx/%d", psc->sc_pcmh.addr, 16); + /* Figure out what card we are. */ sc->sc_flags = xe_pcmcia_interpret_manfid(parent); @@ -368,8 +370,7 @@ xe_pcmcia_attach(parent, self, aux) if (enaddr) bcopy(enaddr, sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); else { - printf("%s: unable to get ethernet address\n", - sc->sc_dev.dv_xname); + printf(", unable to get ethernet address\n"); goto bad; } @@ -396,11 +397,9 @@ xe_pcmcia_attach(parent, self, aux) DPRINTF(XED_MII | XED_CONFIG, ("bmsr %x\n", xe_mdi_read(&sc->sc_dev, 0, 1))); mii_phy_probe(self, &sc->sc_mii, 0xffffffff); - if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { - printf(", no phy found, using auto mode"); + if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO, 0, NULL); - } ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO); /* @@ -413,16 +412,15 @@ xe_pcmcia_attach(parent, self, aux) sizeof(struct ether_header)); #endif /* NBPFILTER > 0 */ - printf("\n"); - /* Establish the interrupt. */ sc->sc_ih = pcmcia_intr_establish(pa->pf, IPL_NET, xe_intr, sc); if (sc->sc_ih == NULL) { - printf("%s: couldn't establish interrupt\n", - sc->sc_dev.dv_xname); + printf(", couldn't establish interrupt\n"); goto bad; } + printf("\n"); + /* * Reset and initialize the card again for DINGO (as found in Linux * driver). Without this Dingo will get a watchdog timeout the first diff --git a/sys/dev/pcmcia/wdc_pcmcia.c b/sys/dev/pcmcia/wdc_pcmcia.c index b4fa604731e..289d2e102b4 100644 --- a/sys/dev/pcmcia/wdc_pcmcia.c +++ b/sys/dev/pcmcia/wdc_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc_pcmcia.c,v 1.3 1999/07/21 05:23:13 deraadt Exp $ */ +/* $OpenBSD: wdc_pcmcia.c,v 1.4 1999/07/26 05:43:16 deraadt Exp $ */ /* $NetBSD: wdc_pcmcia.c,v 1.19 1999/02/19 21:49:43 abs Exp $ */ /*- @@ -305,6 +305,7 @@ wdc_pcmcia_attach(parent, self, aux) if (pcmcia_io_map(pa->pf, quirks & WDC_PCMCIA_FORCE_16BIT_IO ? PCMCIA_WIDTH_IO16 : PCMCIA_WIDTH_AUTO, 0, sc->sc_pioh.size, &sc->sc_pioh, &sc->sc_iowindow)) { + /* XXX should unallocate */ printf(": can't map first I/O space\n"); return; } @@ -317,10 +318,17 @@ wdc_pcmcia_attach(parent, self, aux) if (cfe->num_iospace > 1 && pcmcia_io_map(pa->pf, PCMCIA_WIDTH_AUTO, 0, sc->sc_auxpioh.size, &sc->sc_auxpioh, &sc->sc_auxiowindow)) { + /* XXX should unallocate */ printf(": can't map second I/O space\n"); return; } + printf(" port 0x%lx/%d", + sc->sc_pioh.addr, sc->sc_pioh.size); + if (cfe->num_iospace > 1 && sc->sc_auxpioh.size > 0) + printf(",0x%lx/%d", + sc->sc_auxpioh.addr, sc->sc_auxpioh.size); + sc->wdc_channel.cmd_iot = sc->sc_pioh.iot; sc->wdc_channel.cmd_ioh = sc->sc_pioh.ioh; sc->wdc_channel.ctl_iot = sc->sc_auxpioh.iot; @@ -357,7 +365,7 @@ wdc_pcmcia_attach(parent, self, aux) sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO, wdcintr, &sc->wdc_channel); if (sc->sc_ih == NULL) { - printf("couldn't establish interrupt handler\n"); + printf("couldn't establish interrupt handler"); } #endif -- cgit v1.2.3