Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/puc/puc.c
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
#include <dev/pci/pcireg.h> | #include <dev/pci/pcireg.h> | ||||
#include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
#include <dev/puc/puc_bus.h> | #include <dev/puc/puc_bus.h> | ||||
#include <dev/puc/puc_cfg.h> | #include <dev/puc/puc_cfg.h> | ||||
#include <dev/puc/puc_bfe.h> | #include <dev/puc/puc_bfe.h> | ||||
#define PUC_ISRCCNT 5 | |||||
struct puc_port { | |||||
struct puc_bar *p_bar; | |||||
struct resource *p_rres; | |||||
struct resource *p_ires; | |||||
device_t p_dev; | |||||
int p_nr; | |||||
int p_type; | |||||
int p_rclk; | |||||
int p_hasintr:1; | |||||
serdev_intr_t *p_ihsrc[PUC_ISRCCNT]; | |||||
void *p_iharg; | |||||
int p_ipend; | |||||
}; | |||||
devclass_t puc_devclass; | devclass_t puc_devclass; | ||||
const char puc_driver_name[] = "puc"; | const char puc_driver_name[] = "puc"; | ||||
static MALLOC_DEFINE(M_PUC, "PUC", "PUC driver"); | static MALLOC_DEFINE(M_PUC, "PUC", "PUC driver"); | ||||
SYSCTL_NODE(_hw, OID_AUTO, puc, CTLFLAG_RD, 0, "puc(9) driver configuration"); | SYSCTL_NODE(_hw, OID_AUTO, puc, CTLFLAG_RD, 0, "puc(9) driver configuration"); | ||||
struct puc_bar * | struct puc_bar * | ||||
▲ Show 20 Lines • Show All 644 Lines • ▼ Show 20 Lines | case PUC_IVAR_CLOCK: | ||||
break; | break; | ||||
case PUC_IVAR_TYPE: | case PUC_IVAR_TYPE: | ||||
*result = port->p_type; | *result = port->p_type; | ||||
break; | break; | ||||
default: | default: | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | |||||
int | |||||
puc_bus_write_ivar(device_t dev, device_t child, int index, uintptr_t val) | |||||
{ | |||||
struct puc_port *port; | |||||
struct puc_softc *sc; | |||||
intptr_t *varr; | |||||
/* Get our immediate child. */ | |||||
while (child != NULL && device_get_parent(child) != dev) | |||||
child = device_get_parent(child); | |||||
if (child == NULL) | |||||
return (EINVAL); | |||||
port = device_get_ivars(child); | |||||
KASSERT(port != NULL, ("%s %d", __func__, __LINE__)); | |||||
switch(index) { | |||||
case PUC_IVAR_TARGETBAUD: | |||||
sc = device_get_softc(dev); | |||||
if (sc && sc->sc_cfg && sc->sc_cfg->config_function) { | |||||
varr = (intptr_t *)val; | |||||
return sc->sc_cfg->config_function(sc, PUC_CFG_TARGETBAUD, port->p_nr - 1, varr); | |||||
} | |||||
return EOPNOTSUPP; | |||||
} | |||||
return ENOENT; | |||||
} | } | ||||
int | int | ||||
puc_bus_print_child(device_t dev, device_t child) | puc_bus_print_child(device_t dev, device_t child) | ||||
{ | { | ||||
struct puc_port *port; | struct puc_port *port; | ||||
int retval; | int retval; | ||||
Show All 31 Lines |