15317dd875
- device_print_child() either lets the BUS_PRINT_CHILD method produce the entire device announcement message or it prints "foo0: not found\n" Alter sys/kern/subr_bus.c:bus_generic_print_child() to take on the previous behavior of device_print_child() (printing the "foo0: <FooDevice 1.1>" bit of the announce message.) Provide bus_print_child_header() and bus_print_child_footer() to actually print the output for bus_generic_print_child(). These functions should be used whenever possible (unless you can just use bus_generic_print_child()) The BUS_PRINT_CHILD method now returns int instead of void. Modify everything else that defines or uses a BUS_PRINT_CHILD method to comply with the above changes. - Devices are 'on' a bus, not 'at' it. - If a custom BUS_PRINT_CHILD method does the same thing as bus_generic_print_child(), use bus_generic_print_child() - Use device_get_nameunit() instead of both device_get_name() and device_get_unit() - All BUS_PRINT_CHILD methods return the number of characters output. Reviewed by: dfr, peter
101 lines
2.6 KiB
C
101 lines
2.6 KiB
C
/* $Id: tcasic.c,v 1.4 1999/05/10 15:54:58 peter Exp $ */
|
|
/* from $NetBSD: tcasic.c,v 1.23 1998/05/14 00:01:31 thorpej Exp $ */
|
|
|
|
/*
|
|
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
|
* All rights reserved.
|
|
*
|
|
* Author: Chris G. Demetriou
|
|
*
|
|
* Permission to use, copy, modify and distribute this software and
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
* notice and this permission notice appear in all copies of the
|
|
* software, derivative works or modified versions, and any portions
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
*
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
*
|
|
* Carnegie Mellon requests users of this software to return to
|
|
*
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
* School of Computer Science
|
|
* Carnegie Mellon University
|
|
* Pittsburgh PA 15213-3890
|
|
*
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
* rights to redistribute these changes.
|
|
*/
|
|
|
|
#include "opt_cpu.h"
|
|
|
|
#include <sys/param.h>
|
|
#include <sys/systm.h>
|
|
#include <sys/kernel.h>
|
|
#include <sys/module.h>
|
|
#include <sys/bus.h>
|
|
|
|
#include <machine/rpb.h>
|
|
|
|
/*#include <alpha/tc/dwlpxreg.h>*/
|
|
|
|
#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa)
|
|
|
|
static devclass_t tcasic_devclass;
|
|
static device_t tcasic0; /* XXX only one for now */
|
|
|
|
struct tcasic_softc {
|
|
vm_offset_t dmem_base; /* dense memory */
|
|
vm_offset_t smem_base; /* sparse memory */
|
|
vm_offset_t io_base; /* sparse i/o */
|
|
vm_offset_t cfg_base; /* sparse pci config */
|
|
};
|
|
|
|
#define TCASIC_SOFTC(dev) (struct tcasic_softc*) device_get_softc(dev)
|
|
|
|
static int tcasic_probe(device_t dev);
|
|
static int tcasic_attach(device_t dev);
|
|
|
|
static device_method_t tcasic_methods[] = {
|
|
/* Device interface */
|
|
DEVMETHOD(device_probe, tcasic_probe),
|
|
DEVMETHOD(device_attach, tcasic_attach),
|
|
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
|
{ 0, 0 }
|
|
};
|
|
|
|
static driver_t tcasic_driver = {
|
|
"tcasic",
|
|
tcasic_methods,
|
|
sizeof(struct tcasic_softc),
|
|
};
|
|
|
|
extern device_t tc0;
|
|
static int
|
|
tcasic_probe(device_t dev)
|
|
{
|
|
if (tcasic0)
|
|
return ENXIO;
|
|
if((hwrpb->rpb_type != ST_DEC_3000_300) &&
|
|
(hwrpb->rpb_type != ST_DEC_3000_500))
|
|
return ENXIO;
|
|
tcasic0 = dev;
|
|
device_set_desc(dev, "Turbochannel Host Bus Adapter");
|
|
tc0 = device_add_child(dev, "tc", 0, 0);
|
|
return 0;
|
|
}
|
|
|
|
static int
|
|
tcasic_attach(device_t dev)
|
|
{
|
|
tcasic0 = dev;
|
|
|
|
/* chipset = tcasic_chipset;*/
|
|
device_probe_and_attach(tc0);
|
|
return 0;
|
|
}
|
|
|
|
DRIVER_MODULE(tcasic, root, tcasic_driver, tcasic_devclass, 0, 0);
|
|
|