Deleted Added
full compact
sbus.c (146391) sbus.c (152684)
1/*-
2 * Copyright (c) 1998 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Paul Kranenburg.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 84 unchanged lines hidden (view full) ---

93 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
94 * SUCH DAMAGE.
95 *
96 * from: @(#)sbus.c 8.1 (Berkeley) 6/11/93
97 * from: NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp
98 */
99
100#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Paul Kranenburg.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 84 unchanged lines hidden (view full) ---

93 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
94 * SUCH DAMAGE.
95 *
96 * from: @(#)sbus.c 8.1 (Berkeley) 6/11/93
97 * from: NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp
98 */
99
100#include <sys/cdefs.h>
101__FBSDID("$FreeBSD: head/sys/sparc64/sbus/sbus.c 146391 2005-05-19 14:47:31Z marius $");
101__FBSDID("$FreeBSD: head/sys/sparc64/sbus/sbus.c 152684 2005-11-22 16:39:44Z marius $");
102
103/*
104 * SBus support.
105 */
106
107#include <sys/param.h>
108#include <sys/systm.h>
109#include <sys/bus.h>
110#include <sys/kernel.h>
111#include <sys/malloc.h>
112#include <sys/module.h>
113#include <sys/pcpu.h>
114#include <sys/reboot.h>
115
116#include <dev/ofw/ofw_bus.h>
102
103/*
104 * SBus support.
105 */
106
107#include <sys/param.h>
108#include <sys/systm.h>
109#include <sys/bus.h>
110#include <sys/kernel.h>
111#include <sys/malloc.h>
112#include <sys/module.h>
113#include <sys/pcpu.h>
114#include <sys/reboot.h>
115
116#include <dev/ofw/ofw_bus.h>
117#include <dev/ofw/ofw_bus_subr.h>
117#include <dev/ofw/openfirm.h>
118
119#include <machine/bus.h>
120#include <machine/bus_private.h>
121#include <machine/iommureg.h>
122#include <machine/bus_common.h>
123#include <machine/intr_machdep.h>
124#include <machine/nexusvar.h>

--- 6 unchanged lines hidden (view full) ---

131
132#include <sparc64/sbus/ofw_sbus.h>
133#include <sparc64/sbus/sbusreg.h>
134#include <sparc64/sbus/sbusvar.h>
135
136struct sbus_devinfo {
137 int sdi_burstsz;
138 int sdi_clockfreq;
118#include <dev/ofw/openfirm.h>
119
120#include <machine/bus.h>
121#include <machine/bus_private.h>
122#include <machine/iommureg.h>
123#include <machine/bus_common.h>
124#include <machine/intr_machdep.h>
125#include <machine/nexusvar.h>

--- 6 unchanged lines hidden (view full) ---

132
133#include <sparc64/sbus/ofw_sbus.h>
134#include <sparc64/sbus/sbusreg.h>
135#include <sparc64/sbus/sbusvar.h>
136
137struct sbus_devinfo {
138 int sdi_burstsz;
139 int sdi_clockfreq;
139 char *sdi_compat; /* PROM compatible */
140 char *sdi_model; /* PROM model */
141 char *sdi_name; /* PROM name */
142 phandle_t sdi_node; /* PROM node */
143 int sdi_slot;
140 int sdi_slot;
144 char *sdi_type; /* PROM device_type */
145
141
142 struct ofw_bus_devinfo sdi_obdinfo;
146 struct resource_list sdi_rl;
147};
148
149/* Range descriptor, allocated for each sc_range. */
150struct sbus_rd {
151 bus_addr_t rd_poffset;
152 bus_addr_t rd_pend;
153 int rd_slot;

--- 47 unchanged lines hidden (view full) ---

201static bus_read_ivar_t sbus_read_ivar;
202static bus_get_resource_list_t sbus_get_resource_list;
203static bus_setup_intr_t sbus_setup_intr;
204static bus_teardown_intr_t sbus_teardown_intr;
205static bus_alloc_resource_t sbus_alloc_resource;
206static bus_release_resource_t sbus_release_resource;
207static bus_activate_resource_t sbus_activate_resource;
208static bus_deactivate_resource_t sbus_deactivate_resource;
143 struct resource_list sdi_rl;
144};
145
146/* Range descriptor, allocated for each sc_range. */
147struct sbus_rd {
148 bus_addr_t rd_poffset;
149 bus_addr_t rd_pend;
150 int rd_slot;

--- 47 unchanged lines hidden (view full) ---

198static bus_read_ivar_t sbus_read_ivar;
199static bus_get_resource_list_t sbus_get_resource_list;
200static bus_setup_intr_t sbus_setup_intr;
201static bus_teardown_intr_t sbus_teardown_intr;
202static bus_alloc_resource_t sbus_alloc_resource;
203static bus_release_resource_t sbus_release_resource;
204static bus_activate_resource_t sbus_activate_resource;
205static bus_deactivate_resource_t sbus_deactivate_resource;
209static ofw_bus_get_compat_t sbus_get_compat;
210static ofw_bus_get_model_t sbus_get_model;
211static ofw_bus_get_name_t sbus_get_name;
212static ofw_bus_get_node_t sbus_get_node;
213static ofw_bus_get_type_t sbus_get_type;
206static ofw_bus_get_devinfo_t sbus_get_devinfo;
214
215static int sbus_inlist(const char *, const char **);
207
208static int sbus_inlist(const char *, const char **);
216static struct sbus_devinfo * sbus_setup_dinfo(struct sbus_softc *sc,
217 phandle_t node, char *name);
218static void sbus_destroy_dinfo(struct sbus_devinfo *dinfo);
209static struct sbus_devinfo * sbus_setup_dinfo(device_t, struct sbus_softc *,
210 phandle_t);
211static void sbus_destroy_dinfo(struct sbus_devinfo *);
219static void sbus_intr_stub(void *);
220static bus_space_tag_t sbus_alloc_bustag(struct sbus_softc *);
221static void sbus_overtemp(void *);
222static void sbus_pwrfail(void *);
212static void sbus_intr_stub(void *);
213static bus_space_tag_t sbus_alloc_bustag(struct sbus_softc *);
214static void sbus_overtemp(void *);
215static void sbus_pwrfail(void *);
216static int sbus_print_res(struct sbus_devinfo *);
223
224static device_method_t sbus_methods[] = {
225 /* Device interface */
226 DEVMETHOD(device_probe, sbus_probe),
227 DEVMETHOD(device_attach, sbus_attach),
228
229 /* Bus interface */
230 DEVMETHOD(bus_print_child, sbus_print_child),

--- 4 unchanged lines hidden (view full) ---

235 DEVMETHOD(bus_alloc_resource, sbus_alloc_resource),
236 DEVMETHOD(bus_activate_resource, sbus_activate_resource),
237 DEVMETHOD(bus_deactivate_resource, sbus_deactivate_resource),
238 DEVMETHOD(bus_release_resource, sbus_release_resource),
239 DEVMETHOD(bus_get_resource_list, sbus_get_resource_list),
240 DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
241
242 /* ofw_bus interface */
217
218static device_method_t sbus_methods[] = {
219 /* Device interface */
220 DEVMETHOD(device_probe, sbus_probe),
221 DEVMETHOD(device_attach, sbus_attach),
222
223 /* Bus interface */
224 DEVMETHOD(bus_print_child, sbus_print_child),

--- 4 unchanged lines hidden (view full) ---

229 DEVMETHOD(bus_alloc_resource, sbus_alloc_resource),
230 DEVMETHOD(bus_activate_resource, sbus_activate_resource),
231 DEVMETHOD(bus_deactivate_resource, sbus_deactivate_resource),
232 DEVMETHOD(bus_release_resource, sbus_release_resource),
233 DEVMETHOD(bus_get_resource_list, sbus_get_resource_list),
234 DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
235
236 /* ofw_bus interface */
243 DEVMETHOD(ofw_bus_get_compat, sbus_get_compat),
244 DEVMETHOD(ofw_bus_get_model, sbus_get_model),
245 DEVMETHOD(ofw_bus_get_name, sbus_get_name),
246 DEVMETHOD(ofw_bus_get_node, sbus_get_node),
247 DEVMETHOD(ofw_bus_get_type, sbus_get_type),
237 DEVMETHOD(ofw_bus_get_devinfo, sbus_get_devinfo),
238 DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat),
239 DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model),
240 DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
241 DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
242 DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
248
249 { 0, 0 }
250};
251
252static driver_t sbus_driver = {
253 "sbus",
254 sbus_methods,
255 sizeof(struct sbus_softc),

--- 44 unchanged lines hidden (view full) ---

300{
301 struct sbus_softc *sc;
302 struct sbus_devinfo *sdi;
303 struct sbus_ranges *range;
304 struct resource *res;
305 device_t cdev;
306 bus_addr_t phys;
307 bus_size_t size;
243
244 { 0, 0 }
245};
246
247static driver_t sbus_driver = {
248 "sbus",
249 sbus_methods,
250 sizeof(struct sbus_softc),

--- 44 unchanged lines hidden (view full) ---

295{
296 struct sbus_softc *sc;
297 struct sbus_devinfo *sdi;
298 struct sbus_ranges *range;
299 struct resource *res;
300 device_t cdev;
301 bus_addr_t phys;
302 bus_size_t size;
308 char *name, *cname;
303 char *name;
309 phandle_t child, node;
310 u_int64_t mr;
311 int intr, clock, rid, vec, i;
312
313 sc = device_get_softc(dev);
314 node = nexus_get_node(dev);
315
316 if ((sc->sc_nreg = OF_getprop_alloc(node, "reg", sizeof(*sc->sc_reg),

--- 134 unchanged lines hidden (view full) ---

451 /* Initialize the counter-timer. */
452 sparc64_counter_init(sc->sc_bustag, sc->sc_bushandle, SBR_TC0);
453
454 /*
455 * Loop through ROM children, fixing any relative addresses
456 * and then configuring each device.
457 */
458 for (child = OF_child(node); child != 0; child = OF_peer(child)) {
304 phandle_t child, node;
305 u_int64_t mr;
306 int intr, clock, rid, vec, i;
307
308 sc = device_get_softc(dev);
309 node = nexus_get_node(dev);
310
311 if ((sc->sc_nreg = OF_getprop_alloc(node, "reg", sizeof(*sc->sc_reg),

--- 134 unchanged lines hidden (view full) ---

446 /* Initialize the counter-timer. */
447 sparc64_counter_init(sc->sc_bustag, sc->sc_bushandle, SBR_TC0);
448
449 /*
450 * Loop through ROM children, fixing any relative addresses
451 * and then configuring each device.
452 */
453 for (child = OF_child(node); child != 0; child = OF_peer(child)) {
459 if ((OF_getprop_alloc(child, "name", 1, (void **)&cname)) == -1)
454 if ((sdi = sbus_setup_dinfo(dev, sc, child)) == NULL)
460 continue;
455 continue;
461
462 if ((sdi = sbus_setup_dinfo(sc, child, cname)) == NULL) {
463 device_printf(dev, "<%s>: incomplete\n", cname);
464 free(cname, M_OFWPROP);
465 continue;
466 }
467 /*
468 * For devices where there are variants that are actually
469 * split into two SBus devices (as opposed to the first
470 * half of the device being a SBus device and the second
471 * half hanging off of the first one) like 'auxio' and
472 * 'SUNW,fdtwo' or 'dma' and 'esp' probe the SBus device
473 * which is a prerequisite to the driver attaching to the
474 * second one with a lower order. Saves us from dealing
475 * with different probe orders in the respective device
476 * drivers which generally is more hackish.
477 */
478 cdev = device_add_child_ordered(dev, (OF_child(child) == 0 &&
456 /*
457 * For devices where there are variants that are actually
458 * split into two SBus devices (as opposed to the first
459 * half of the device being a SBus device and the second
460 * half hanging off of the first one) like 'auxio' and
461 * 'SUNW,fdtwo' or 'dma' and 'esp' probe the SBus device
462 * which is a prerequisite to the driver attaching to the
463 * second one with a lower order. Saves us from dealing
464 * with different probe orders in the respective device
465 * drivers which generally is more hackish.
466 */
467 cdev = device_add_child_ordered(dev, (OF_child(child) == 0 &&
479 sbus_inlist(cname, sbus_order_first)) ? SBUS_ORDER_FIRST :
480 SBUS_ORDER_NORMAL, NULL, -1);
481 if (cdev == NULL)
482 panic("%s: device_add_child_ordered failed", __func__);
468 sbus_inlist(sdi->sdi_obdinfo.obd_name, sbus_order_first)) ?
469 SBUS_ORDER_FIRST : SBUS_ORDER_NORMAL, NULL, -1);
470 if (cdev == NULL) {
471 device_printf(dev,
472 "<%s>: device_add_child_ordered failed\n",
473 sdi->sdi_obdinfo.obd_name);
474 sbus_destroy_dinfo(sdi);
475 continue;
476 }
483 device_set_ivars(cdev, sdi);
484 }
485 return (bus_generic_attach(dev));
486}
487
488static struct sbus_devinfo *
477 device_set_ivars(cdev, sdi);
478 }
479 return (bus_generic_attach(dev));
480}
481
482static struct sbus_devinfo *
489sbus_setup_dinfo(struct sbus_softc *sc, phandle_t node, char *name)
483sbus_setup_dinfo(device_t dev, struct sbus_softc *sc, phandle_t node)
490{
491 struct sbus_devinfo *sdi;
492 struct sbus_regs *reg;
493 u_int32_t base, iv, *intr;
494 int i, nreg, nintr, slot, rslot;
495
496 sdi = malloc(sizeof(*sdi), M_DEVBUF, M_ZERO | M_WAITOK);
484{
485 struct sbus_devinfo *sdi;
486 struct sbus_regs *reg;
487 u_int32_t base, iv, *intr;
488 int i, nreg, nintr, slot, rslot;
489
490 sdi = malloc(sizeof(*sdi), M_DEVBUF, M_ZERO | M_WAITOK);
497 if (sdi == NULL)
491 if (ofw_bus_gen_setup_devinfo(&sdi->sdi_obdinfo, node) != 0) {
492 free(sdi, M_DEVBUF);
498 return (NULL);
493 return (NULL);
494 }
499 resource_list_init(&sdi->sdi_rl);
495 resource_list_init(&sdi->sdi_rl);
500 sdi->sdi_name = name;
501 sdi->sdi_node = node;
502 OF_getprop_alloc(node, "compatible", 1, (void **)&sdi->sdi_compat);
503 OF_getprop_alloc(node, "device_type", 1, (void **)&sdi->sdi_type);
504 OF_getprop_alloc(node, "model", 1, (void **)&sdi->sdi_model);
505 slot = -1;
506 nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)&reg);
507 if (nreg == -1) {
496 slot = -1;
497 nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)&reg);
498 if (nreg == -1) {
508 if (sdi->sdi_type == NULL ||
509 strcmp(sdi->sdi_type, "hierarchical") != 0) {
510 sbus_destroy_dinfo(sdi);
511 return (NULL);
499 if (sdi->sdi_obdinfo.obd_type == NULL ||
500 strcmp(sdi->sdi_obdinfo.obd_type, "hierarchical") != 0) {
501 device_printf(dev, "<%s>: incomplete\n",
502 sdi->sdi_obdinfo.obd_name);
503 goto fail;
512 }
513 } else {
514 for (i = 0; i < nreg; i++) {
515 base = reg[i].sbr_offset;
516 if (SBUS_ABS(base)) {
517 rslot = SBUS_ABS_TO_SLOT(base);
518 base = SBUS_ABS_TO_OFFSET(base);
519 } else
520 rslot = reg[i].sbr_slot;
504 }
505 } else {
506 for (i = 0; i < nreg; i++) {
507 base = reg[i].sbr_offset;
508 if (SBUS_ABS(base)) {
509 rslot = SBUS_ABS_TO_SLOT(base);
510 base = SBUS_ABS_TO_OFFSET(base);
511 } else
512 rslot = reg[i].sbr_slot;
521 if (slot != -1 && slot != rslot)
522 panic("%s: multiple slots", __func__);
513 if (slot != -1 && slot != rslot) {
514 device_printf(dev, "<%s>: multiple slots\n",
515 sdi->sdi_obdinfo.obd_name);
516 free(reg, M_OFWPROP);
517 goto fail;
518 }
523 slot = rslot;
524
525 resource_list_add(&sdi->sdi_rl, SYS_RES_MEMORY, i,
526 base, base + reg[i].sbr_size, reg[i].sbr_size);
527 }
528 free(reg, M_OFWPROP);
529 }
530 sdi->sdi_slot = slot;

--- 24 unchanged lines hidden (view full) ---

555 sdi->sdi_burstsz = sc->sc_burst;
556 else
557 sdi->sdi_burstsz &= sc->sc_burst;
558 if (OF_getprop(node, "clock-frequency", &sdi->sdi_clockfreq,
559 sizeof(sdi->sdi_clockfreq)) == -1)
560 sdi->sdi_clockfreq = sc->sc_clockfreq;
561
562 return (sdi);
519 slot = rslot;
520
521 resource_list_add(&sdi->sdi_rl, SYS_RES_MEMORY, i,
522 base, base + reg[i].sbr_size, reg[i].sbr_size);
523 }
524 free(reg, M_OFWPROP);
525 }
526 sdi->sdi_slot = slot;

--- 24 unchanged lines hidden (view full) ---

551 sdi->sdi_burstsz = sc->sc_burst;
552 else
553 sdi->sdi_burstsz &= sc->sc_burst;
554 if (OF_getprop(node, "clock-frequency", &sdi->sdi_clockfreq,
555 sizeof(sdi->sdi_clockfreq)) == -1)
556 sdi->sdi_clockfreq = sc->sc_clockfreq;
557
558 return (sdi);
559
560fail:
561 sbus_destroy_dinfo(sdi);
562 return (NULL);
563}
564
563}
564
565/* Free everything except sdi_name, which is handled separately. */
566static void
567sbus_destroy_dinfo(struct sbus_devinfo *dinfo)
568{
569
570 resource_list_free(&dinfo->sdi_rl);
565static void
566sbus_destroy_dinfo(struct sbus_devinfo *dinfo)
567{
568
569 resource_list_free(&dinfo->sdi_rl);
571 if (dinfo->sdi_compat != NULL)
572 free(dinfo->sdi_compat, M_OFWPROP);
573 if (dinfo->sdi_model != NULL)
574 free(dinfo->sdi_model, M_OFWPROP);
575 if (dinfo->sdi_type != NULL)
576 free(dinfo->sdi_type, M_OFWPROP);
570 ofw_bus_gen_destroy_devinfo(&dinfo->sdi_obdinfo);
577 free(dinfo, M_DEVBUF);
578}
579
580static int
581sbus_print_child(device_t dev, device_t child)
582{
571 free(dinfo, M_DEVBUF);
572}
573
574static int
575sbus_print_child(device_t dev, device_t child)
576{
583 struct sbus_devinfo *dinfo;
584 struct resource_list *rl;
585 int rv;
586
577 int rv;
578
587 dinfo = device_get_ivars(child);
588 rl = &dinfo->sdi_rl;
589 rv = bus_print_child_header(dev, child);
579 rv = bus_print_child_header(dev, child);
590 rv += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx");
591 rv += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
580 rv += sbus_print_res(device_get_ivars(child));
592 rv += bus_print_child_footer(dev, child);
593 return (rv);
594}
595
596static void
597sbus_probe_nomatch(device_t dev, device_t child)
598{
581 rv += bus_print_child_footer(dev, child);
582 return (rv);
583}
584
585static void
586sbus_probe_nomatch(device_t dev, device_t child)
587{
599 struct sbus_devinfo *dinfo;
600 struct resource_list *rl;
588 const char *type;
601
589
602 dinfo = device_get_ivars(child);
603 rl = &dinfo->sdi_rl;
604 device_printf(dev, "<%s>", dinfo->sdi_name);
605 resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx");
606 resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
590 device_printf(dev, "<%s>", ofw_bus_get_name(child));
591 sbus_print_res(device_get_ivars(child));
592 type = ofw_bus_get_type(child);
607 printf(" type %s (no driver attached)\n",
593 printf(" type %s (no driver attached)\n",
608 dinfo->sdi_type != NULL ? dinfo->sdi_type : "unknown");
594 type != NULL ? type : "unknown");
609}
610
611static int
612sbus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
613{
614 struct sbus_softc *sc;
615 struct sbus_devinfo *dinfo;
616

--- 110 unchanged lines hidden (view full) ---

727 * Enable the interrupt and program the target module now we have the
728 * handler installed.
729 */
730 SYSIO_WRITE8(sc, intrmapptr, INTMAP_ENABLE(intrmap, PCPU_GET(mid)));
731 return (error);
732}
733
734static int
595}
596
597static int
598sbus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
599{
600 struct sbus_softc *sc;
601 struct sbus_devinfo *dinfo;
602

--- 110 unchanged lines hidden (view full) ---

713 * Enable the interrupt and program the target module now we have the
714 * handler installed.
715 */
716 SYSIO_WRITE8(sc, intrmapptr, INTMAP_ENABLE(intrmap, PCPU_GET(mid)));
717 return (error);
718}
719
720static int
735sbus_teardown_intr(device_t dev, device_t child,
736 struct resource *vec, void *cookie)
721sbus_teardown_intr(device_t dev, device_t child, struct resource *vec,
722 void *cookie)
737{
738 struct sbus_clr *scl;
739 int error;
740
741 scl = (struct sbus_clr *)cookie;
742 error = BUS_TEARDOWN_INTR(device_get_parent(dev), child, vec,
743 scl->scl_cookie);
744 /*

--- 135 unchanged lines hidden (view full) ---

880 if (rle == NULL)
881 panic("%s: cannot find resource", __func__);
882 if (rle->res == NULL)
883 panic("%s: resource entry is not busy", __func__);
884 rle->res = NULL;
885 return (0);
886}
887
723{
724 struct sbus_clr *scl;
725 int error;
726
727 scl = (struct sbus_clr *)cookie;
728 error = BUS_TEARDOWN_INTR(device_get_parent(dev), child, vec,
729 scl->scl_cookie);
730 /*

--- 135 unchanged lines hidden (view full) ---

866 if (rle == NULL)
867 panic("%s: cannot find resource", __func__);
868 if (rle->res == NULL)
869 panic("%s: resource entry is not busy", __func__);
870 rle->res = NULL;
871 return (0);
872}
873
874static const struct ofw_bus_devinfo *
875sbus_get_devinfo(device_t bus, device_t child)
876{
877 struct sbus_devinfo *sdi;
878
879 sdi = device_get_ivars(child);
880 return (&sdi->sdi_obdinfo);
881}
882
888/*
889 * Handle an overtemp situation.
890 *
891 * SPARCs have temperature sensors which generate interrupts
892 * if the machine's temperature exceeds a certain threshold.
893 * This handles the interrupt and powers off the machine.
894 * The same needs to be done to PCI controller drivers.
895 */

--- 25 unchanged lines hidden (view full) ---

921 panic("%s: out of memory", __func__);
922
923 sbt->bst_cookie = sc;
924 sbt->bst_parent = sc->sc_bustag;
925 sbt->bst_type = SBUS_BUS_SPACE;
926 return (sbt);
927}
928
883/*
884 * Handle an overtemp situation.
885 *
886 * SPARCs have temperature sensors which generate interrupts
887 * if the machine's temperature exceeds a certain threshold.
888 * This handles the interrupt and powers off the machine.
889 * The same needs to be done to PCI controller drivers.
890 */

--- 25 unchanged lines hidden (view full) ---

916 panic("%s: out of memory", __func__);
917
918 sbt->bst_cookie = sc;
919 sbt->bst_parent = sc->sc_bustag;
920 sbt->bst_type = SBUS_BUS_SPACE;
921 return (sbt);
922}
923
929static const char *
930sbus_get_compat(device_t bus, device_t dev)
924static int
925sbus_print_res(struct sbus_devinfo *sdi)
931{
926{
932 struct sbus_devinfo *dinfo;
927 int rv;
933
928
934 dinfo = device_get_ivars(dev);
935 return (dinfo->sdi_compat);
929 rv = 0;
930 rv += resource_list_print_type(&sdi->sdi_rl, "mem", SYS_RES_MEMORY,
931 "%#lx");
932 rv += resource_list_print_type(&sdi->sdi_rl, "irq", SYS_RES_IRQ,
933 "%ld");
934 return (rv);
936}
935}
937
938static const char *
939sbus_get_model(device_t bus, device_t dev)
940{
941 struct sbus_devinfo *dinfo;
942
943 dinfo = device_get_ivars(dev);
944 return (dinfo->sdi_model);
945}
946
947static const char *
948sbus_get_name(device_t bus, device_t dev)
949{
950 struct sbus_devinfo *dinfo;
951
952 dinfo = device_get_ivars(dev);
953 return (dinfo->sdi_name);
954}
955
956static phandle_t
957sbus_get_node(device_t bus, device_t dev)
958{
959 struct sbus_devinfo *dinfo;
960
961 dinfo = device_get_ivars(dev);
962 return (dinfo->sdi_node);
963}
964
965static const char *
966sbus_get_type(device_t bus, device_t dev)
967{
968 struct sbus_devinfo *dinfo;
969
970 dinfo = device_get_ivars(dev);
971 return (dinfo->sdi_type);
972}