Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/sparc64 add location info to sd instances i...
details: https://anonhg.NetBSD.org/src/rev/831ddb1f53e0
branches: trunk
changeset: 745118:831ddb1f53e0
user: macallan <macallan%NetBSD.org@localhost>
date: Sun Feb 23 05:14:29 2020 +0000
description:
add location info to sd instances if we know which drive bay they live in
Sun Fire v210 only for now, others should be easy to add
diffstat:
sys/arch/sparc64/sparc64/autoconf.c | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diffs (60 lines):
diff -r 3c665a71be95 -r 831ddb1f53e0 sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c Sun Feb 23 04:24:56 2020 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c Sun Feb 23 05:14:29 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $ */
+/* $NetBSD: autoconf.c,v 1.217 2020/02/23 05:14:29 macallan Exp $ */
/*
* Copyright (c) 1996
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.217 2020/02/23 05:14:29 macallan Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -1088,6 +1088,28 @@
}
}
+static void
+add_drivebay_props_v210(device_t dev, int ofnode, void *aux)
+{
+ struct scsipibus_attach_args *sa = aux;
+ int target = sa->sa_periph->periph_target;
+ char path[256]= "";
+
+ OF_package_to_path(ofnode, path, sizeof(path));
+
+ /* see if we're on the onboard controller's 1st channel */
+ if (strcmp(path, "/pci@1c,600000/scsi@2") != 0)
+ return;
+ /* yes, yes we are */
+ if ( target < 2) {
+ prop_dictionary_t dict = device_properties(dev);
+ char name[16];
+
+ snprintf(name, sizeof(name), "bay%d", target);
+ prop_dictionary_set_cstring(dict, "location", name);
+ }
+}
+
/*
* Called back during autoconfiguration for each device found
*/
@@ -1163,6 +1185,12 @@
ofnode = device_ofnode(device_parent(busdev));
dev_bi_unit_drive_match(dev, ofnode, periph->periph_target + off,
0, periph->periph_lun);
+ if (device_is_a(busdev, "scsibus")) {
+ /* see if we're in a known SCA drivebay */
+ if (strcmp(machine_model, "SUNW,Sun-Fire-V210") == 0) {
+ add_drivebay_props_v210(dev, ofnode, aux);
+ }
+ }
return;
} else if (device_is_a(dev, "wd")) {
struct ata_device *adev = aux;
Home |
Main Index |
Thread Index |
Old Index