Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/powermac/smu.c
Show All 12 Lines | |||||
int16_t sc_slots_pow_offset; | int16_t sc_slots_pow_offset; | ||||
struct cdev *sc_leddev; | struct cdev *sc_leddev; | ||||
}; | }; | ||||
/* regular bus attachment functions */ | /* regular bus attachment functions */ | ||||
static int smu_probe(device_t); | static int smu_probe(device_t); | ||||
static bool smu_delay_attach(device_t); | |||||
static int smu_attach(device_t); | static int smu_attach(device_t); | ||||
static const struct ofw_bus_devinfo * | static const struct ofw_bus_devinfo * | ||||
smu_get_devinfo(device_t bus, device_t dev); | smu_get_devinfo(device_t bus, device_t dev); | ||||
/* cpufreq notification hooks */ | /* cpufreq notification hooks */ | ||||
static void smu_cpufreq_pre_change(device_t, const struct cf_level *level); | static void smu_cpufreq_pre_change(device_t, const struct cf_level *level); | ||||
static void smu_cpufreq_post_change(device_t, const struct cf_level *level); | static void smu_cpufreq_post_change(device_t, const struct cf_level *level); | ||||
Show All 16 Lines | |||||
/* where to find the doorbell GPIO */ | /* where to find the doorbell GPIO */ | ||||
static device_t smu_doorbell = NULL; | static device_t smu_doorbell = NULL; | ||||
static device_method_t smu_methods[] = { | static device_method_t smu_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, smu_probe), | DEVMETHOD(device_probe, smu_probe), | ||||
DEVMETHOD(device_delay_attach, smu_delay_attach), | |||||
DEVMETHOD(device_attach, smu_attach), | DEVMETHOD(device_attach, smu_attach), | ||||
/* Clock interface */ | /* Clock interface */ | ||||
DEVMETHOD(clock_gettime, smu_gettime), | DEVMETHOD(clock_gettime, smu_gettime), | ||||
DEVMETHOD(clock_settime, smu_settime), | DEVMETHOD(clock_settime, smu_settime), | ||||
/* ofw_bus interface */ | /* ofw_bus interface */ | ||||
DEVMETHOD(bus_child_pnpinfo_str,ofw_bus_gen_child_pnpinfo_str), | DEVMETHOD(bus_child_pnpinfo_str,ofw_bus_gen_child_pnpinfo_str), | ||||
Show All 24 Lines | |||||
static void | static void | ||||
smu_phys_callback(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) | smu_phys_callback(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) | ||||
{ | { | ||||
struct smu_softc *sc = xsc; | struct smu_softc *sc = xsc; | ||||
sc->sc_cmd_phys = segs[0].ds_addr; | sc->sc_cmd_phys = segs[0].ds_addr; | ||||
} | } | ||||
static bool | |||||
smu_delay_attach(device_t dev) | |||||
{ | |||||
/* Delay attachment until our GPIO has attached */ | |||||
return (smu_doorbell == NULL); | |||||
} | |||||
static int | static int | ||||
smu_attach(device_t dev) | smu_attach(device_t dev) | ||||
{ | { | ||||
struct smu_softc *sc; | struct smu_softc *sc; | ||||
phandle_t node, child; | phandle_t node, child; | ||||
uint8_t data[12]; | uint8_t data[12]; | ||||
imp: This would transition into
if (smu_doorbell == NULL) return EAGAIN; | |||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
mtx_init(&sc->sc_mtx, "smu", NULL, MTX_DEF); | mtx_init(&sc->sc_mtx, "smu", NULL, MTX_DEF); | ||||
sc->sc_cur_cmd = NULL; | sc->sc_cur_cmd = NULL; | ||||
sc->sc_doorbellirqid = -1; | sc->sc_doorbellirqid = -1; | ||||
sc->sc_u3 = 0; | sc->sc_u3 = 0; | ||||
if (OF_finddevice("/u3") != -1) | if (OF_finddevice("/u3") != -1) | ||||
sc->sc_u3 = 1; | sc->sc_u3 = 1; | ||||
/* | /* | ||||
* Map the mailbox area. This should be determined from firmware, | * Map the mailbox area. This should be determined from firmware, | ||||
* but I have not found a simple way to do that. | * but I have not found a simple way to do that. | ||||
Context not available. |
This would transition into
if (smu_doorbell == NULL) return EAGAIN;