Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ieee1394 do not assume all fw devices speak sbp.
details: https://anonhg.NetBSD.org/src/rev/21cdddbe6f32
branches: trunk
changeset: 757602:21cdddbe6f32
user: cegger <cegger%NetBSD.org@localhost>
date: Tue Sep 07 07:26:54 2010 +0000
description:
do not assume all fw devices speak sbp.
teach the fw attach code to deal with different fw device classes.
this allows other fw drivers than sbp to attach
diffstat:
sys/dev/ieee1394/firewire.c | 54 ++++++++++++++++++++++++++++++++++++-----
sys/dev/ieee1394/firewirereg.h | 4 +-
2 files changed, 49 insertions(+), 9 deletions(-)
diffs (121 lines):
diff -r 69a4184a8e33 -r 21cdddbe6f32 sys/dev/ieee1394/firewire.c
--- a/sys/dev/ieee1394/firewire.c Tue Sep 07 07:19:45 2010 +0000
+++ b/sys/dev/ieee1394/firewire.c Tue Sep 07 07:26:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: firewire.c,v 1.37 2010/08/26 08:56:15 cegger Exp $ */
+/* $NetBSD: firewire.c,v 1.38 2010/09/07 07:26:54 cegger Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.37 2010/08/26 08:56:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.38 2010/09/07 07:26:54 cegger Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -1959,6 +1959,45 @@
/* NOTREACHED */
}
+static const char *
+fw_get_devclass(struct fw_device *fwdev)
+{
+ struct crom_context cc;
+ struct csrreg *reg;
+
+ crom_init_context(&cc, fwdev->csrrom);
+ reg = crom_search_key(&cc, CSRKEY_VER);
+ if (reg == NULL)
+ return "null";
+
+ switch (reg->val) {
+ case CSR_PROTAVC:
+ return "av/c";
+ case CSR_PROTCAL:
+ return "cal";
+ case CSR_PROTEHS:
+ return "ehs";
+ case CSR_PROTHAVI:
+ return "havi";
+ case CSR_PROTCAM104:
+ return "cam104";
+ case CSR_PROTCAM120:
+ return "cam120";
+ case CSR_PROTCAM130:
+ return "cam130";
+ case CSR_PROTDPP:
+ return "printer";
+ case CSR_PROTIICP:
+ return "iicp";
+ case CSRVAL_T10SBP2:
+ return "sbp";
+ default:
+ if (firewire_debug)
+ printf("%s: reg->val 0x%x\n",
+ __func__, reg->val);
+ return "sbp";
+ }
+}
/*
* To attach sub-devices layer onto IEEE1394 bus.
@@ -1973,7 +2012,7 @@
struct fw_attach_args fwa;
int locs[IEEE1394IFCF_NLOCS];
- fwa.name = "sbp";
+ fwa.name = "null";
fwa.fc = fc;
mutex_enter(&fc->fc_mtx);
@@ -1993,16 +2032,17 @@
locs[IEEE1394IFCF_EUIHI] = fwdev->eui.hi;
locs[IEEE1394IFCF_EUILO] = fwdev->eui.lo;
+ fwa.name = fw_get_devclass(fwdev);
fwa.fwdev = fwdev;
- fwdev->sbp = config_found_sm_loc(sc->dev, "ieee1394if",
+ fwdev->dev = config_found_sm_loc(sc->dev, "ieee1394if",
locs, &fwa, firewire_print, config_stdsubmatch);
- if (fwdev->sbp == NULL) {
+ if (fwdev->dev == NULL) {
free(devlist, M_DEVBUF);
break;
}
devlist->fwdev = fwdev;
- devlist->dev = fwdev->sbp;
+ devlist->dev = fwdev->dev;
mutex_enter(&fc->fc_mtx);
if (SLIST_EMPTY(&sc->devlist))
@@ -2064,7 +2104,7 @@
link);
free(devlist, M_DEVBUF);
- if (config_detach(fwdev->sbp, DETACH_FORCE) != 0)
+ if (config_detach(fwdev->dev, DETACH_FORCE) != 0)
return;
STAILQ_REMOVE(&fc->devices, fwdev, fw_device, link);
diff -r 69a4184a8e33 -r 21cdddbe6f32 sys/dev/ieee1394/firewirereg.h
--- a/sys/dev/ieee1394/firewirereg.h Tue Sep 07 07:19:45 2010 +0000
+++ b/sys/dev/ieee1394/firewirereg.h Tue Sep 07 07:26:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: firewirereg.h,v 1.13 2010/05/23 18:56:58 christos Exp $ */
+/* $NetBSD: firewirereg.h,v 1.14 2010/09/07 07:26:54 cegger Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -63,7 +63,7 @@
#define FWDEVATTACHED 2
#define FWDEVINVAL 3
STAILQ_ENTRY(fw_device) link;
- device_t sbp;
+ device_t dev;
};
struct firewire_softc {
Home |
Main Index |
Thread Index |
Old Index