summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2020-07-02 15:58:17 +0000
committerkrw <krw@openbsd.org>2020-07-02 15:58:17 +0000
commit712f76d030379aaf3ee44399cbb9e20aec70076e (patch)
tree2b70d0cffc5bede74edc861db45d2e3cb2584d0f /sys/dev
parentWe need the same header files on powerpc64 as we have on powerpc. (diff)
downloadwireguard-openbsd-712f76d030379aaf3ee44399cbb9e20aec70076e.tar.xz
wireguard-openbsd-712f76d030379aaf3ee44399cbb9e20aec70076e.zip
Shuffle things around so that sc->sc_link initialization is
even more concentrated just before config_found().
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/aic79xx_openbsd.c22
-rw-r--r--sys/dev/ic/ami.c14
-rw-r--r--sys/dev/ic/gdt_common.c30
3 files changed, 32 insertions, 34 deletions
diff --git a/sys/dev/ic/aic79xx_openbsd.c b/sys/dev/ic/aic79xx_openbsd.c
index 466bf17ce62..f5240e51c44 100644
--- a/sys/dev/ic/aic79xx_openbsd.c
+++ b/sys/dev/ic/aic79xx_openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic79xx_openbsd.c,v 1.51 2020/06/27 14:29:44 krw Exp $ */
+/* $OpenBSD: aic79xx_openbsd.c,v 1.52 2020/07/02 15:58:17 krw Exp $ */
/*
* Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
@@ -99,6 +99,16 @@ ahd_attach(struct ahd_softc *ahd)
printf("%s\n", ahd_info);
ahd_lock(ahd, &s);
+ if (bootverbose) {
+ ahd_controller_info(ahd, ahd_info, sizeof ahd_info);
+ printf("%s: %s\n", ahd->sc_dev.dv_xname, ahd_info);
+ }
+
+ ahd_intr_enable(ahd, TRUE);
+
+ if (ahd->flags & AHD_RESET_BUS_A)
+ ahd_reset_channel(ahd, 'A', TRUE);
+
/*
* fill in the prototype scsi_links.
*/
@@ -110,16 +120,6 @@ ahd_attach(struct ahd_softc *ahd)
ahd->sc_channel.openings = 16; /* Must ALWAYS be < 256!! */
ahd->sc_channel.pool = &ahd->sc_iopool;
- if (bootverbose) {
- ahd_controller_info(ahd, ahd_info, sizeof ahd_info);
- printf("%s: %s\n", ahd->sc_dev.dv_xname, ahd_info);
- }
-
- ahd_intr_enable(ahd, TRUE);
-
- if (ahd->flags & AHD_RESET_BUS_A)
- ahd_reset_channel(ahd, 'A', TRUE);
-
saa.saa_sc_link = &ahd->sc_channel;
ahd->sc_child = config_found((void *)&ahd->sc_dev, &saa, scsiprint);
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index bffccd4e2d6..52c83c05269 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.244 2020/06/27 17:28:58 krw Exp $ */
+/* $OpenBSD: ami.c,v 1.245 2020/07/02 15:58:17 krw Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -517,12 +517,6 @@ ami_attach(struct ami_softc *sc)
/* TODO: fetch & print cache strategy */
/* TODO: fetch & print scsi and raid info */
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter = &ami_switch;
- sc->sc_link.adapter_target = SDEV_NO_ADAPTER_TARGET;
- sc->sc_link.adapter_buswidth = sc->sc_maxunits;
- sc->sc_link.pool = &sc->sc_iopool;
-
#ifdef AMI_DEBUG
printf(", FW %s, BIOS v%s, %dMB RAM\n"
"%s: %d channels, %d %ss, %d logical drives, "
@@ -544,6 +538,12 @@ ami_attach(struct ami_softc *sc)
/* lock around ioctl requests */
rw_init(&sc->sc_lock, NULL);
+ sc->sc_link.adapter_softc = sc;
+ sc->sc_link.adapter = &ami_switch;
+ sc->sc_link.adapter_target = SDEV_NO_ADAPTER_TARGET;
+ sc->sc_link.adapter_buswidth = sc->sc_maxunits;
+ sc->sc_link.pool = &sc->sc_iopool;
+
saa.saa_sc_link = &sc->sc_link;
config_found(&sc->sc_dev, &saa, scsiprint);
diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c
index 35136fa942c..d85a95d5afa 100644
--- a/sys/dev/ic/gdt_common.c
+++ b/sys/dev/ic/gdt_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gdt_common.c,v 1.71 2020/06/27 17:28:58 krw Exp $ */
+/* $OpenBSD: gdt_common.c,v 1.72 2020/07/02 15:58:17 krw Exp $ */
/*
* Copyright (c) 1999, 2000, 2003 Niklas Hallqvist. All rights reserved.
@@ -150,15 +150,6 @@ gdt_attach(struct gdt_softc *sc)
gc_chain);
}
- /* Fill in the prototype scsi_link. */
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter = &gdt_switch;
- /* openings will be filled in later. */
- sc->sc_link.adapter_buswidth =
- (sc->sc_class & GDT_FC) ? GDT_MAXID : GDT_MAX_HDRIVES;
- sc->sc_link.adapter_target = SDEV_NO_ADAPTER_TARGET;
- sc->sc_link.pool = &sc->sc_iopool;
-
if (!gdt_internal_cmd(sc, GDT_SCREENSERVICE, GDT_INIT, 0, 0, 0)) {
printf("screen service initialization error %d\n",
sc->sc_status);
@@ -451,12 +442,6 @@ gdt_attach(struct gdt_softc *sc)
sc->sc_hdr[i].hd_devtype = sc->sc_info;
}
- if (sc->sc_ndevs == 0)
- sc->sc_link.openings = 0;
- else
- sc->sc_link.openings = (GDT_MAXCMDS - GDT_CMD_RESERVE) /
- sc->sc_ndevs;
-
printf("dpmem %llx %d-bus %d cache device%s\n",
(long long)sc->sc_dpmembase,
sc->sc_bus_cnt, cdev_cnt, cdev_cnt == 1 ? "" : "s");
@@ -476,6 +461,19 @@ gdt_attach(struct gdt_softc *sc)
#endif
gdt_cnt++;
+ /* Fill in the prototype scsi_link. */
+ if (sc->sc_ndevs == 0)
+ sc->sc_link.openings = 0;
+ else
+ sc->sc_link.openings = (GDT_MAXCMDS - GDT_CMD_RESERVE) /
+ sc->sc_ndevs;
+ sc->sc_link.adapter_softc = sc;
+ sc->sc_link.adapter = &gdt_switch;
+ sc->sc_link.adapter_buswidth =
+ (sc->sc_class & GDT_FC) ? GDT_MAXID : GDT_MAX_HDRIVES;
+ sc->sc_link.adapter_target = SDEV_NO_ADAPTER_TARGET;
+ sc->sc_link.pool = &sc->sc_iopool;
+
saa.saa_sc_link = &sc->sc_link;
config_found(&sc->sc_dev, &saa, scsiprint);