summaryrefslogtreecommitdiffstats
path: root/sys/dev/sdmmc
diff options
context:
space:
mode:
authormatthew <matthew@openbsd.org>2011-07-17 22:46:47 +0000
committermatthew <matthew@openbsd.org>2011-07-17 22:46:47 +0000
commit3ba30b1bc6606186b78adb0373ac3c83c82ed540 (patch)
tree5d0a100ee78cd2f1a9e8639fa58a1de99d475bfb /sys/dev/sdmmc
parentFix an integer overflow for very long lines by replacing the datatype of 2 offsets from int to regoff_t. (diff)
downloadwireguard-openbsd-3ba30b1bc6606186b78adb0373ac3c83c82ed540.tar.xz
wireguard-openbsd-3ba30b1bc6606186b78adb0373ac3c83c82ed540.zip
Backout a bunch of my SCSI commits from c2k11. At least one of these
is causing problems when trying to boot sparc64 from an isp(4). Verified to fix the sparc64/isp(4) regression by krw@; ok deraadt@
Diffstat (limited to 'sys/dev/sdmmc')
-rw-r--r--sys/dev/sdmmc/sdmmc_scsi.c23
-rw-r--r--sys/dev/sdmmc/sdmmcvar.h4
2 files changed, 14 insertions, 13 deletions
diff --git a/sys/dev/sdmmc/sdmmc_scsi.c b/sys/dev/sdmmc/sdmmc_scsi.c
index 74b262a6101..b27f5d45086 100644
--- a/sys/dev/sdmmc/sdmmc_scsi.c
+++ b/sys/dev/sdmmc/sdmmc_scsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc_scsi.c,v 1.29 2011/07/09 02:11:29 matthew Exp $ */
+/* $OpenBSD: sdmmc_scsi.c,v 1.30 2011/07/17 22:46:48 matthew Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -33,7 +33,8 @@
#include <dev/sdmmc/sdmmc_scsi.h>
#include <dev/sdmmc/sdmmcvar.h>
-#define SDMMC_SCSIID_MAX 0x10
+#define SDMMC_SCSIID_HOST 0x00
+#define SDMMC_SCSIID_MAX 0x0f
#define SDMMC_SCSI_MAXCMDS 8
@@ -104,15 +105,15 @@ sdmmc_scsi_attach(struct sdmmc_softc *sc)
scbus = malloc(sizeof *scbus, M_DEVBUF, M_WAITOK | M_ZERO);
scbus->sc_tgt = malloc(sizeof(*scbus->sc_tgt) *
- SDMMC_SCSIID_MAX, M_DEVBUF, M_WAITOK | M_ZERO);
+ (SDMMC_SCSIID_MAX+1), M_DEVBUF, M_WAITOK | M_ZERO);
/*
* Each card that sent us a CID in the identification stage
- * gets a SCSI ID, whether it is a memory card or not.
+ * gets a SCSI ID > 0, whether it is a memory card or not.
*/
- scbus->sc_ntargets = 0;
+ scbus->sc_ntargets = 1;
SIMPLEQ_FOREACH(sf, &sc->sf_head, sf_list) {
- if (scbus->sc_ntargets >= SDMMC_SCSIID_MAX)
+ if (scbus->sc_ntargets >= SDMMC_SCSIID_MAX+1)
break;
scbus->sc_tgt[scbus->sc_ntargets].card = sf;
scbus->sc_ntargets++;
@@ -129,18 +130,18 @@ sdmmc_scsi_attach(struct sdmmc_softc *sc)
scbus->sc_adapter.scsi_cmd = sdmmc_scsi_cmd;
scbus->sc_adapter.scsi_minphys = sdmmc_scsi_minphys;
- scbus->sc_link.adapter_target = SCSI_NO_ADAPTER_TARGET;
+ scbus->sc_link.adapter_target = SDMMC_SCSIID_HOST;
+ scbus->sc_link.adapter_buswidth = scbus->sc_ntargets;
scbus->sc_link.adapter_softc = sc;
+ scbus->sc_link.luns = 1;
scbus->sc_link.openings = 1;
scbus->sc_link.adapter = &scbus->sc_adapter;
scbus->sc_link.pool = &scbus->sc_iopool;
bzero(&saa, sizeof(saa));
- saa.saa.saa_sc_link = &scbus->sc_link;
- saa.saa.saa_targets = scbus->sc_ntargets;
- saa.saa.saa_luns = 1;
+ saa.scsi_link = &scbus->sc_link;
- scbus->sc_child = config_found(&sc->sc_dev, &saa.saa, scsiprint);
+ scbus->sc_child = config_found(&sc->sc_dev, &saa, scsiprint);
if (scbus->sc_child == NULL) {
printf("%s: can't attach scsibus\n", sc->sc_dev.dv_xname);
goto free_ccbs;
diff --git a/sys/dev/sdmmc/sdmmcvar.h b/sys/dev/sdmmc/sdmmcvar.h
index a3960a09f47..2c1542dd84b 100644
--- a/sys/dev/sdmmc/sdmmcvar.h
+++ b/sys/dev/sdmmc/sdmmcvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmcvar.h,v 1.19 2011/07/09 00:39:29 matthew Exp $ */
+/* $OpenBSD: sdmmcvar.h,v 1.20 2011/07/17 22:46:48 matthew Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -182,7 +182,7 @@ struct sdmmc_softc {
* Attach devices at the sdmmc bus.
*/
struct sdmmc_attach_args {
- struct scsibus_attach_args saa; /* XXX */
+ struct scsi_link *scsi_link; /* XXX */
struct sdmmc_function *sf;
};