summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-09-29 18:53:59 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-09-29 18:53:59 +0000
commit6f415681be00dcdc05769f91ebca9456b32f361b (patch)
treeee62c054b3dc72f6dd3cbf2f3ffd7eb42702dd08 /sys/dev
parentb2ba974c9b6802e7ab3d776db1f051466d36c23e (diff)
better dmesg output including onboard memory size when present, free resources on failures; krw@ ok
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/dcreg.h4
-rw-r--r--sys/dev/pci/siop_pci_common.c60
2 files changed, 35 insertions, 29 deletions
diff --git a/sys/dev/ic/dcreg.h b/sys/dev/ic/dcreg.h
index 3c04e79ba5a..15c6a02cd07 100644
--- a/sys/dev/ic/dcreg.h
+++ b/sys/dev/ic/dcreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dcreg.h,v 1.31 2003/09/25 21:47:10 mickey Exp $ */
+/* $OpenBSD: dcreg.h,v 1.32 2003/09/29 18:53:58 mickey Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -266,7 +266,7 @@
#define DC_INTRS \
(DC_IMR_RX_OK|DC_IMR_TX_OK|DC_IMR_RX_NOBUF|DC_IMR_RX_WATDOGTIMEO|\
- DC_IMR_TX_NOBUF|DC_IMR_TX_UNDERRUN|DC_IMR_BUS_ERR| \
+ DC_IMR_TX_IDLE|DC_IMR_TX_NOBUF|DC_IMR_TX_UNDERRUN|DC_IMR_BUS_ERR|\
DC_IMR_ABNORMAL|DC_IMR_NORMAL/*|DC_IMR_TX_EARLY*/)
/*
* Serial I/O (EEPROM/ROM) bits.
diff --git a/sys/dev/pci/siop_pci_common.c b/sys/dev/pci/siop_pci_common.c
index 301634027e3..d487ade4254 100644
--- a/sys/dev/pci/siop_pci_common.c
+++ b/sys/dev/pci/siop_pci_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop_pci_common.c,v 1.10 2003/09/06 22:24:14 krw Exp $ */
+/* $OpenBSD: siop_pci_common.c,v 1.11 2003/09/29 18:53:58 mickey Exp $ */
/* $NetBSD: siop_pci_common.c,v 1.17 2002/05/04 18:11:06 bouyer Exp $ */
/*
@@ -224,11 +224,12 @@ siop_pci_attach_common(pci_sc, siop_sc, pa, intr)
pcireg_t memtype;
int memh_valid, ioh_valid;
bus_addr_t ioaddr, memaddr;
+ bus_size_t memsize, iosize;
pci_sc->sc_pp =
siop_lookup_product(pa->pa_id, PCI_REVISION(pa->pa_class));
if (pci_sc->sc_pp == NULL) {
- printf("siop: broken match/attach!\n");
+ printf(": broken match/attach!\n");
return 0;
}
/* copy interesting infos about the chip */
@@ -263,7 +264,7 @@ siop_pci_attach_common(pci_sc, siop_sc, pa, intr)
}
ioh_valid = (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_IO, 0,
- &iot, &ioh, &ioaddr, NULL, 0) == 0);
+ &iot, &ioh, &ioaddr, &iosize, 0) == 0);
if (memh_valid) {
siop_sc->sc_rt = memt;
@@ -274,11 +275,33 @@ siop_pci_attach_common(pci_sc, siop_sc, pa, intr)
siop_sc->sc_rh = ioh;
siop_sc->sc_raddr = ioaddr;
} else {
- printf("\n%s: unable to map device registers\n",
- siop_sc->sc_dev.dv_xname);
+ printf(": unable to map device registers\n");
return 0;
}
+ if (pci_intr_map(pa, &intrhandle) != 0) {
+ printf(": couldn't map interrupt\n");
+ bus_space_unmap(siop_sc->sc_rt, siop_sc->sc_rh, iosize);
+ return 0;
+ }
+ intrstr = pci_intr_string(pa->pa_pc, intrhandle);
+ pci_sc->sc_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO,
+ intr, siop_sc, siop_sc->sc_dev.dv_xname);
+ if (pci_sc->sc_ih != NULL) {
+ printf(": %s",
+ intrstr ? intrstr : "?");
+ } else {
+ printf(": couldn't establish interrupt");
+ if (intrstr != NULL)
+ printf(" at %s", intrstr);
+ printf("\n");
+ bus_space_unmap(siop_sc->sc_rt, siop_sc->sc_rh, iosize);
+ return 0;
+ }
+
+#ifdef __hppa__
+ siop_sc->features &= ~SF_CHIP_RAM;
+#endif
if (siop_sc->features & SF_CHIP_RAM) {
int bar;
switch (memtype) {
@@ -291,33 +314,16 @@ siop_pci_attach_common(pci_sc, siop_sc, pa, intr)
}
if (pci_mapreg_map(pa, bar, memtype, 0,
&siop_sc->sc_ramt, &siop_sc->sc_ramh,
- &siop_sc->sc_scriptaddr, NULL, 0) == 0) {
- printf(" using on-board RAM");
+ &siop_sc->sc_scriptaddr, &memsize, 0) == 0) {
+ printf(", using %dK of on-board RAM", memsize / 1024);
} else {
- printf(" can't map on-board RAM");
+ printf(", can't map on-board RAM");
siop_sc->features &= ~SF_CHIP_RAM;
}
}
- if (pci_intr_map(pa, &intrhandle) != 0) {
- printf("\n%s: couldn't map interrupt\n",
- siop_sc->sc_dev.dv_xname);
- return 0;
- }
- intrstr = pci_intr_string(pa->pa_pc, intrhandle);
- pci_sc->sc_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO,
- intr, siop_sc, siop_sc->sc_dev.dv_xname);
- if (pci_sc->sc_ih != NULL) {
- printf(" %s\n",
- intrstr ? intrstr : "?");
- } else {
- printf("\n%s: couldn't establish interrupt",
- siop_sc->sc_dev.dv_xname);
- if (intrstr != NULL)
- printf(" at %s", intrstr);
- printf("\n");
- return 0;
- }
+ printf("\n");
+
return 1;
}