Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/powermac/grackle.c
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
#include <powerpc/powermac/gracklevar.h> | #include <powerpc/powermac/gracklevar.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include "pcib_if.h" | #include "pcib_if.h" | ||||
#define PCI_VENDOR_ID_MOTOROLA 0x1057 | |||||
#define PCI_DEVICE_ID_MPC106 0x0002 | |||||
/* | /* | ||||
* Device interface. | * Device interface. | ||||
*/ | */ | ||||
static int grackle_probe(device_t); | static int grackle_probe(device_t); | ||||
static int grackle_attach(device_t); | static int grackle_attach(device_t); | ||||
/* | /* | ||||
* pcib interface. | * pcib interface. | ||||
*/ | */ | ||||
static u_int32_t grackle_read_config(device_t, u_int, u_int, u_int, | static u_int32_t grackle_read_config(device_t, u_int, u_int, u_int, | ||||
u_int, int); | u_int, int); | ||||
static void grackle_write_config(device_t, u_int, u_int, u_int, | static void grackle_write_config(device_t, u_int, u_int, u_int, | ||||
u_int, u_int32_t, int); | u_int, u_int32_t, int); | ||||
/* | /* | ||||
* Local routines. | * Local routines. | ||||
*/ | */ | ||||
static int grackle_enable_config(struct grackle_softc *, u_int, | static int grackle_enable_config(struct grackle_softc *, u_int, | ||||
u_int, u_int, u_int); | u_int, u_int, u_int); | ||||
static void grackle_disable_config(struct grackle_softc *); | static void grackle_disable_config(struct grackle_softc *); | ||||
static int badaddr(void *, size_t); | static int badaddr(void *, size_t); | ||||
static struct grackle_hb_dev { | struct pci_device_table grackle_hb_devs[] = { | ||||
uint32_t deviceid; | {PCI_DEV(PCI_VENDOR_ID_MOTOROLA, PCI_DEVICE_ID_MPC106), | ||||
const char *description; | PCI_DESCR("MPC106 (Grackle) Host-PCI bridge")} | ||||
} grackle_hb_devs[] = { | |||||
{0x00021057, "Grackle Host to PCI bridge"}, | |||||
{0, NULL}, | |||||
}; | }; | ||||
/* | /* | ||||
* Driver methods. | * Driver methods. | ||||
*/ | */ | ||||
static device_method_t grackle_methods[] = { | static device_method_t grackle_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, grackle_probe), | DEVMETHOD(device_probe, grackle_probe), | ||||
Show All 10 Lines | |||||
DEFINE_CLASS_1(pcib, grackle_driver, grackle_methods, | DEFINE_CLASS_1(pcib, grackle_driver, grackle_methods, | ||||
sizeof(struct grackle_softc), ofw_pci_driver); | sizeof(struct grackle_softc), ofw_pci_driver); | ||||
DRIVER_MODULE(grackle, ofwbus, grackle_driver, grackle_devclass, 0, 0); | DRIVER_MODULE(grackle, ofwbus, grackle_driver, grackle_devclass, 0, 0); | ||||
static int | static int | ||||
grackle_probe(device_t dev) | grackle_probe(device_t dev) | ||||
{ | { | ||||
const char *type, *compatible; | const char *type, *compatible; | ||||
const struct pci_device_table grcd; | |||||
type = ofw_bus_get_type(dev); | type = ofw_bus_get_type(dev); | ||||
compatible = ofw_bus_get_compat(dev); | compatible = ofw_bus_get_compat(dev); | ||||
grcd = PCI_MATCH(dev, grackle_hb_devs); | |||||
if (type == NULL || compatible == NULL) | if (type == NULL || compatible == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
if (strcmp(type, "pci") != 0 || strcmp(compatible, "grackle") != 0) | if (strcmp(type, "pci") != 0 || strcmp(compatible, "grackle") != 0) | ||||
return (ENXIO); | return (ENXIO); | ||||
if (grcd == NULL) | |||||
device_set_desc(dev, "MPC106 (Grackle) Host-PCI bridge"); | return (ENXIO); | ||||
device_set_desc(dev, grcd->descr); | |||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
grackle_attach(device_t dev) | grackle_attach(device_t dev) | ||||
{ | { | ||||
struct grackle_softc *sc; | struct grackle_softc *sc; | ||||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | |||||
static driver_t grackle_hb_driver = { | static driver_t grackle_hb_driver = { | ||||
"grackle_hb", | "grackle_hb", | ||||
grackle_hb_methods, | grackle_hb_methods, | ||||
1, | 1, | ||||
}; | }; | ||||
static devclass_t grackle_hb_devclass; | static devclass_t grackle_hb_devclass; | ||||
DRIVER_MODULE(grackle_hb, pci, grackle_hb_driver, grackle_hb_devclass, 0, 0); | DRIVER_MODULE(grackle_hb, pci, grackle_hb_driver, grackle_hb_devclass, 0, 0); | ||||
MODULE_PNP_INFO("U32:device", pci, grackle_hb, grackle_hb_devs, | PCI_PNP_INFO(grackle_hb_devs); | ||||
sizeof(grackle_hb_devs[0]), nitems(grackle_hb_devs) - 1); |