Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sbus Change the devhandle_from_*() functions to also...
details: https://anonhg.NetBSD.org/src/rev/1302f9988e2e
branches: trunk
changeset: 359777:1302f9988e2e
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sat Jan 22 11:49:16 2022 +0000
description:
Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
diffstat:
sys/arch/macppc/dev/gpio.c | 7 ++++---
sys/arch/macppc/dev/mediabay.c | 7 ++++---
sys/arch/macppc/dev/obio.c | 7 ++++---
sys/arch/macppc/dev/smu.c | 3 ++-
sys/arch/macppc/dev/uni-n.c | 7 ++++---
sys/arch/macppc/macppc/mainbus.c | 13 ++++++++-----
sys/arch/sparc/dev/bootbus.c | 7 ++++---
sys/arch/sparc/dev/ebus.c | 7 ++++---
sys/arch/sparc/dev/sbus.c | 9 +++++----
sys/arch/sparc/include/promlib.h | 8 ++++----
sys/arch/sparc/sparc/autoconf.c | 19 ++++++++++++-------
sys/arch/sparc/sparc/iommu.c | 10 ++++++----
sys/arch/sparc/sparc/promlib.c | 22 ++++++++++++++--------
sys/arch/sparc64/dev/cbus.c | 5 +++--
sys/arch/sparc64/dev/central.c | 8 +++++---
sys/arch/sparc64/dev/ebus.c | 8 +++++---
sys/arch/sparc64/dev/ebus_mainbus.c | 8 +++++---
sys/arch/sparc64/dev/fhc.c | 7 ++++---
sys/arch/sparc64/dev/sbus.c | 7 ++++---
sys/arch/sparc64/dev/upa.c | 7 ++++---
sys/arch/sparc64/dev/vbus.c | 6 ++++--
sys/arch/sparc64/sparc64/autoconf.c | 11 +++++++----
sys/arch/x86/x86/mpacpi.c | 7 ++++---
sys/dev/acpi/acpi.c | 10 ++++++----
sys/dev/acpi/acpi_pci.c | 6 +++---
sys/dev/acpi/acpi_util.c | 23 +++++++++++++++--------
sys/dev/acpi/acpi_util.h | 4 ++--
sys/dev/fdt/fdtbus.c | 12 ++++++++----
sys/dev/i2c/i2c.c | 10 ++++++----
sys/dev/ofisa/ofisa.c | 7 ++++---
sys/dev/ofw/ofbus.c | 12 ++++++++----
sys/dev/ofw/ofw_pci_subr.c | 6 +++---
sys/dev/ofw/ofw_subr.c | 22 ++++++++++++++--------
sys/dev/ofw/openfirm.h | 4 ++--
sys/dev/sbus/dma_sbus.c | 7 ++++---
sys/dev/sbus/lebuffer.c | 7 ++++---
sys/dev/sbus/qec.c | 7 ++++---
37 files changed, 203 insertions(+), 134 deletions(-)
diffs (truncated from 1361 to 300 lines):
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/macppc/dev/gpio.c
--- a/sys/arch/macppc/dev/gpio.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/macppc/dev/gpio.c Sat Jan 22 11:49:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.15 2021/08/07 16:18:57 thorpej Exp $ */
+/* $NetBSD: gpio.c,v 1.16 2022/01/22 11:49:16 thorpej Exp $ */
/*-
* Copyright (C) 1998 Internet Research Institute, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.15 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.16 2022/01/22 11:49:16 thorpej Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -97,6 +97,7 @@
sc->sc_port = mapiodev(ca->ca_baseaddr + ca->ca_reg[0], ca->ca_reg[1],
false);
+ devhandle_t selfh = device_handle(self);
ca2.ca_baseaddr = ca->ca_baseaddr;
for (child = OF_child(ca->ca_node); child; child = OF_peer(child)) {
namelen = OF_getprop(child, "name", name, sizeof(name));
@@ -120,7 +121,7 @@
ca2.ca_intr = intr;
config_found(self, &ca2, gpio_obio_print,
- CFARGS(.devhandle = devhandle_from_of(child)));
+ CFARGS(.devhandle = devhandle_from_of(selfh, child)));
}
}
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/macppc/dev/mediabay.c
--- a/sys/arch/macppc/dev/mediabay.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/macppc/dev/mediabay.c Sat Jan 22 11:49:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mediabay.c,v 1.26 2021/08/07 16:18:57 thorpej Exp $ */
+/* $NetBSD: mediabay.c,v 1.27 2022/01/22 11:49:16 thorpej Exp $ */
/*-
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mediabay.c,v 1.26 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mediabay.c,v 1.27 2022/01/22 11:49:16 thorpej Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -225,6 +225,7 @@
printf(" done.\n");
}
+ devhandle_t selfh = device_handle(sc->sc_dev);
for (child = OF_child(sc->sc_node); child; child = OF_peer(child)) {
memset(name, 0, sizeof(name));
if (OF_getprop(child, "name", name, sizeof(name)) == -1)
@@ -244,7 +245,7 @@
ca.ca_intr = intr;
content = config_found(sc->sc_dev, &ca, mediabay_print,
- CFARGS(.devhandle = devhandle_from_of(child)));
+ CFARGS(.devhandle = devhandle_from_of(selfh, child)));
if (content) {
sc->sc_content = content;
return;
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/macppc/dev/obio.c
--- a/sys/arch/macppc/dev/obio.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/macppc/dev/obio.c Sat Jan 22 11:49:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: obio.c,v 1.50 2021/08/07 16:18:57 thorpej Exp $ */
+/* $NetBSD: obio.c,v 1.51 2022/01/22 11:49:16 thorpej Exp $ */
/*-
* Copyright (C) 1998 Internet Research Institute, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.50 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.51 2022/01/22 11:49:16 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -236,6 +236,7 @@
bus_space_write_1(ca.ca_tag, bsh, 0x37, 0x03);
}
+ devhandle_t selfh = device_handle(self);
for (child = OF_child(node); child; child = OF_peer(child)) {
namelen = OF_getprop(child, "name", name, sizeof(name));
if (namelen < 0)
@@ -272,7 +273,7 @@
ca.ca_intr = intr;
config_found(self, &ca, obio_print,
- CFARGS(.devhandle = devhandle_from_of(child)));
+ CFARGS(.devhandle = devhandle_from_of(selfh, child)));
}
}
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/macppc/dev/smu.c
--- a/sys/arch/macppc/dev/smu.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/macppc/dev/smu.c Sat Jan 22 11:49:16 2022 +0000
@@ -365,6 +365,7 @@
int node;
char name[32];
+ devhandle_t selfh = device_handle(sc->sc_dev);
node = of_getnode_byname(sc->sc_node, "smu-i2c-control");
if (node == 0) node = sc->sc_node;
for (node = OF_child(node);
@@ -393,7 +394,7 @@
ca.ca_node = node;
ca.ca_tag = i2c;
config_found(sc->sc_dev, &ca, smu_iicbus_print,
- CFARGS(.devhandle = devhandle_from_of(node)));
+ CFARGS(.devhandle = devhandle_from_of(selfh, node)));
sc->sc_num_iicbus++;
}
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/macppc/dev/uni-n.c
--- a/sys/arch/macppc/dev/uni-n.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/macppc/dev/uni-n.c Sat Jan 22 11:49:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uni-n.c,v 1.11 2021/08/07 16:18:58 thorpej Exp $ */
+/* $NetBSD: uni-n.c,v 1.12 2022/01/22 11:49:16 thorpej Exp $ */
/*-
* Copyright (C) 2005 Michael Lorenz.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uni-n.c,v 1.11 2021/08/07 16:18:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uni-n.c,v 1.12 2022/01/22 11:49:16 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -129,6 +129,7 @@
panic("Can't init uni-n mem tag");
}
+ devhandle_t selfh = device_handle(self);
for (child = OF_child(node); child; child = OF_peer(child)) {
namelen = OF_getprop(child, "name", name, sizeof(name));
if (namelen < 0)
@@ -150,7 +151,7 @@
ca.ca_reg = reg;
ca.ca_intr = intr;
config_found(self, &ca, uni_n_print,
- CFARGS(.devhandle = devhandle_from_of(child)));
+ CFARGS(.devhandle = devhandle_from_of(selfh, child)));
}
}
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/macppc/macppc/mainbus.c
--- a/sys/arch/macppc/macppc/mainbus.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/macppc/macppc/mainbus.c Sat Jan 22 11:49:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.24 2021/08/07 16:18:58 thorpej Exp $ */
+/* $NetBSD: mainbus.c,v 1.25 2022/01/22 11:49:16 thorpej Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.24 2021/08/07 16:18:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.25 2022/01/22 11:49:16 thorpej Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -73,6 +73,8 @@
printf("\n");
+ devhandle_t selfh = device_handle(self);
+
cpus = OF_finddevice("/cpus");
if (cpus != 0) {
node = OF_child(cpus);
@@ -81,7 +83,8 @@
ca.ca_reg = reg;
ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg));
config_found(self, &ca, NULL,
- CFARGS(.devhandle = devhandle_from_of(node)));
+ CFARGS(.devhandle = devhandle_from_of(selfh,
+ node)));
node = OF_peer(node);
}
} else {
@@ -100,7 +103,7 @@
oba.oba_busname = "ofw";
oba.oba_phandle = node;
config_found(self, &oba, NULL,
- CFARGS(.devhandle = devhandle_from_of(node)));
+ CFARGS(.devhandle = devhandle_from_of(selfh, node)));
}
for (node = OF_child(OF_finddevice("/")); node; node = OF_peer(node)) {
@@ -113,7 +116,7 @@
ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg));
ca.ca_reg = reg;
config_found(self, &ca, NULL,
- CFARGS(.devhandle = devhandle_from_of(node)));
+ CFARGS(.devhandle = devhandle_from_of(selfh, node)));
}
#ifdef MAMBO
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/sparc/dev/bootbus.c
--- a/sys/arch/sparc/dev/bootbus.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/sparc/dev/bootbus.c Sat Jan 22 11:49:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootbus.c,v 1.23 2021/08/07 16:19:05 thorpej Exp $ */
+/* $NetBSD: bootbus.c,v 1.24 2022/01/22 11:49:16 thorpej Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.23 2021/08/07 16:19:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.24 2022/01/22 11:49:16 thorpej Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -115,6 +115,7 @@
}
/* Attach the CPU (and possibly bootbus) child nodes. */
+ devhandle_t selfh = device_handle(self);
for (node = firstchild(sc->sc_node); node != 0;
node = nextsibling(node)) {
struct bootbus_attach_args baa;
@@ -123,7 +124,7 @@
panic("bootbus_attach: failed to set up attach args");
config_found(self, &baa, bootbus_print,
- CFARGS(.devhandle = prom_node_to_devhandle(node),
+ CFARGS(.devhandle = prom_node_to_devhandle(selfh, node),
.submatch = bootbus_submatch));
bootbus_destroy_attach_args(&baa);
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/sparc/dev/ebus.c
--- a/sys/arch/sparc/dev/ebus.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/sparc/dev/ebus.c Sat Jan 22 11:49:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ebus.c,v 1.41 2021/08/07 16:19:05 thorpej Exp $ */
+/* $NetBSD: ebus.c,v 1.42 2022/01/22 11:49:16 thorpej Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.41 2021/08/07 16:19:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.42 2022/01/22 11:49:16 thorpej Exp $");
#if defined(DEBUG) && !defined(EBUS_DEBUG)
#define EBUS_DEBUG
@@ -307,6 +307,7 @@
* now attach all our children
*/
DPRINTF(EDB_CHILD, ("ebus node %08x, searching children...\n", node));
+ devhandle_t selfh = device_handle(self);
for (node = firstchild(node); node; node = nextsibling(node)) {
char *name = prom_getpropstring(node, "name");
@@ -317,7 +318,7 @@
DPRINTF(EDB_CHILD,
("- found child `%s', attaching\n", ea.ea_name));
(void)config_found(self, &ea, ebus_print,
- CFARGS(.devhandle = prom_node_to_devhandle(node)));
+ CFARGS(.devhandle = prom_node_to_devhandle(selfh, node)));
ebus_destroy_attach_args(&ea);
}
}
diff -r 94411c20c7f2 -r 1302f9988e2e sys/arch/sparc/dev/sbus.c
--- a/sys/arch/sparc/dev/sbus.c Sat Jan 22 11:16:00 2022 +0000
+++ b/sys/arch/sparc/dev/sbus.c Sat Jan 22 11:49:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbus.c,v 1.83 2021/08/07 16:19:05 thorpej Exp $ */
+/* $NetBSD: sbus.c,v 1.84 2022/01/22 11:49:16 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.83 2021/08/07 16:19:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.84 2022/01/22 11:49:16 thorpej Exp $");
Home |
Main Index |
Thread Index |
Old Index