Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/acpica/acpi_hpet.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Find an existing IRQ resource that matches the requested IRQ range | * Find an existing IRQ resource that matches the requested IRQ range | ||||
* and return its RID. If one is not found, use a new RID. | * and return its RID. If one is not found, use a new RID. | ||||
*/ | */ | ||||
static int | static int | ||||
hpet_find_irq_rid(device_t dev, u_long start, u_long end) | hpet_find_irq_rid(device_t dev, u_long start, u_long end) | ||||
{ | { | ||||
u_long irq; | rman_res_t irq; | ||||
int error, rid; | int error, rid; | ||||
for (rid = 0;; rid++) { | for (rid = 0;; rid++) { | ||||
error = bus_get_resource(dev, SYS_RES_IRQ, rid, &irq, NULL); | error = bus_get_resource(dev, SYS_RES_IRQ, rid, &irq, NULL); | ||||
if (error != 0 || (start <= irq && irq <= end)) | if (error != 0 || (start <= irq && irq <= end)) | ||||
return (rid); | return (rid); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
sc->mem_rid = 0; | sc->mem_rid = 0; | ||||
sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, | sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, | ||||
RF_ACTIVE); | RF_ACTIVE); | ||||
if (sc->mem_res == NULL) | if (sc->mem_res == NULL) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
/* Validate that we can access the whole region. */ | /* Validate that we can access the whole region. */ | ||||
if (rman_get_size(sc->mem_res) < HPET_MEM_WIDTH) { | if (rman_get_size(sc->mem_res) < HPET_MEM_WIDTH) { | ||||
device_printf(dev, "memory region width %ld too small\n", | device_printf(dev, "memory region width %jd too small\n", | ||||
rman_get_size(sc->mem_res)); | rman_get_size(sc->mem_res)); | ||||
bus_free_resource(dev, SYS_RES_MEMORY, sc->mem_res); | bus_free_resource(dev, SYS_RES_MEMORY, sc->mem_res); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
/* Be sure timer is enabled. */ | /* Be sure timer is enabled. */ | ||||
hpet_enable(sc); | hpet_enable(sc); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |