Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/cores/pmu/bhnd_pmu_core.c
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | bhnd_pmu_core_attach(device_t dev) | ||||
/* Allocate register block */ | /* Allocate register block */ | ||||
rid = 0; | rid = 0; | ||||
res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); | res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); | ||||
if (res == NULL) { | if (res == NULL) { | ||||
device_printf(dev, "failed to allocate resources\n"); | device_printf(dev, "failed to allocate resources\n"); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
/* Allocate our per-core PMU state */ | |||||
if ((error = bhnd_alloc_pmu(dev))) { | |||||
device_printf(sc->dev, "failed to allocate PMU state: %d\n", | |||||
error); | |||||
return (error); | |||||
} | |||||
/* Delegate to common driver implementation */ | /* Delegate to common driver implementation */ | ||||
if ((error = bhnd_pmu_attach(dev, res))) { | if ((error = bhnd_pmu_attach(dev, res))) { | ||||
bhnd_release_resource(dev, SYS_RES_MEMORY, rid, res); | bhnd_release_resource(dev, SYS_RES_MEMORY, rid, res); | ||||
return (error); | return (error); | ||||
} | } | ||||
sc->rid = rid; | sc->rid = rid; | ||||
return (0); | return (0); | ||||
Show All 34 Lines |