summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2004-12-19 06:17:55 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2004-12-19 06:17:55 +0000
commita3169783fccc3c8d71cceea0b5d9bf7aba4bb708 (patch)
treea19123a8e6d53a5a709a0a62fc616eb3a6fb0413 /sys/dev/pci
parentae02df2057edb3b786f254cf8867184962234a11 (diff)
Reduce delta to FreeBSD by adding and using ahd_alloc() rather than
manually reproducing bits in ahd_pci.c. Just as in ahc, avoid allocating and freeing zero length bits of memory for platform data. Don't try to free all or part of ahd_softc, but correctly free allocated memory for seep_config if necessary. Add a final few fields to ahd_softc and scb in preparation for updating/fixing timeout handling. No functional changes.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/ahd_pci.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/sys/dev/pci/ahd_pci.c b/sys/dev/pci/ahd_pci.c
index b38848fcd20..07376f5213b 100644
--- a/sys/dev/pci/ahd_pci.c
+++ b/sys/dev/pci/ahd_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahd_pci.c,v 1.10 2004/12/10 17:43:19 krw Exp $ */
+/* $OpenBSD: ahd_pci.c,v 1.11 2004/12/19 06:17:54 krw Exp $ */
/*
* Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
@@ -337,48 +337,24 @@ ahd_pci_attach(struct device *parent, struct device *self, void *aux)
const struct ahd_pci_identity *entry;
struct pci_attach_args *pa = aux;
struct ahd_softc *ahd = (void *)self;
- struct scb_data *shared_scb_data;
pci_intr_handle_t ih;
const char *intrstr;
pcireg_t command, devconfig, memtype, reg, subid;
uint16_t device, subvendor;
int error, ioh_valid, ioh2_valid, l, memh_valid, offset;
- shared_scb_data = NULL;
ahd->dev_softc = pa;
-
- ahd_set_name(ahd, ahd->sc_dev.dv_xname);
ahd->parent_dmat = pa->pa_dmat;
+ if (ahd_alloc(ahd, ahd->sc_dev.dv_xname) == NULL)
+ return;
+
command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
subid = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
entry = ahd_find_pci_device(pa->pa_id, subid);
if (entry == NULL)
return;
- ahd->seep_config = malloc(sizeof(*ahd->seep_config),
- M_DEVBUF, M_NOWAIT);
- if (ahd->seep_config == NULL) {
- printf("%s: cannot malloc seep_config!\n", ahd_name(ahd));
- return;
- }
- memset(ahd->seep_config, 0, sizeof(*ahd->seep_config));
-
- LIST_INIT(&ahd->pending_scbs);
-
- ahd->flags = AHD_SPCHK_ENB_A|AHD_RESET_BUS_A|AHD_TERM_ENB_A
- | AHD_EXTENDED_TRANS_A|AHD_STPWLEVEL_A;
- ahd->int_coalescing_timer = AHD_INT_COALESCING_TIMER_DEFAULT;
- ahd->int_coalescing_maxcmds = AHD_INT_COALESCING_MAXCMDS_DEFAULT;
- ahd->int_coalescing_mincmds = AHD_INT_COALESCING_MINCMDS_DEFAULT;
- ahd->int_coalescing_threshold = AHD_INT_COALESCING_THRESHOLD_DEFAULT;
- ahd->int_coalescing_stop_threshold = AHD_INT_COALESCING_STOP_THRESHOLD_DEFAULT;
-
- if (ahd_platform_alloc(ahd, NULL) != 0) {
- ahd_free(ahd);
- return;
- }
-
/*
* Record if this is a HostRAID board.
*/