Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/acpica/acpi_resource.c
Show All 39 Lines | |||||
#include <machine/resource.h> | #include <machine/resource.h> | ||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include <contrib/dev/acpica/include/acpi.h> | #include <contrib/dev/acpica/include/acpi.h> | ||||
#include <contrib/dev/acpica/include/accommon.h> | #include <contrib/dev/acpica/include/accommon.h> | ||||
#include <dev/acpica/acpivar.h> | #include <dev/acpica/acpivar.h> | ||||
#ifdef INTRNG | |||||
#include "acpi_bus_if.h" | |||||
#endif | |||||
/* Hooks for the ACPI CA debugging infrastructure */ | /* Hooks for the ACPI CA debugging infrastructure */ | ||||
#define _COMPONENT ACPI_BUS | #define _COMPONENT ACPI_BUS | ||||
ACPI_MODULE_NAME("RESOURCE") | ACPI_MODULE_NAME("RESOURCE") | ||||
struct lookup_irq_request { | struct lookup_irq_request { | ||||
ACPI_RESOURCE *acpi_res; | ACPI_RESOURCE *acpi_res; | ||||
struct resource *res; | struct resource *res; | ||||
int counter; | int counter; | ||||
▲ Show 20 Lines • Show All 495 Lines • ▼ Show 20 Lines | return; | ||||
device_printf(dev, "memory range not supported\n"); | device_printf(dev, "memory range not supported\n"); | ||||
} | } | ||||
static void | static void | ||||
acpi_res_set_irq(device_t dev, void *context, uint8_t *irq, int count, | acpi_res_set_irq(device_t dev, void *context, uint8_t *irq, int count, | ||||
int trig, int pol) | int trig, int pol) | ||||
{ | { | ||||
struct acpi_res_context *cp = (struct acpi_res_context *)context; | struct acpi_res_context *cp = (struct acpi_res_context *)context; | ||||
rman_res_t intr; | |||||
if (cp == NULL || irq == NULL) | if (cp == NULL || irq == NULL) | ||||
return; | return; | ||||
/* This implements no resource relocation. */ | /* This implements no resource relocation. */ | ||||
if (count != 1) | if (count != 1) | ||||
return; | return; | ||||
bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1); | #ifdef INTRNG | ||||
intr = ACPI_BUS_MAP_INTR(device_get_parent(dev), dev, *irq, | |||||
(trig == ACPI_EDGE_SENSITIVE) ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL, | |||||
(pol == ACPI_ACTIVE_HIGH) ? INTR_POLARITY_HIGH : INTR_POLARITY_LOW); | |||||
#else | |||||
intr = *irq; | |||||
#endif | |||||
bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, intr, 1); | |||||
} | } | ||||
static void | static void | ||||
acpi_res_set_ext_irq(device_t dev, void *context, uint32_t *irq, int count, | acpi_res_set_ext_irq(device_t dev, void *context, uint32_t *irq, int count, | ||||
int trig, int pol) | int trig, int pol) | ||||
{ | { | ||||
struct acpi_res_context *cp = (struct acpi_res_context *)context; | struct acpi_res_context *cp = (struct acpi_res_context *)context; | ||||
rman_res_t intr; | |||||
if (cp == NULL || irq == NULL) | if (cp == NULL || irq == NULL) | ||||
return; | return; | ||||
/* This implements no resource relocation. */ | /* This implements no resource relocation. */ | ||||
if (count != 1) | if (count != 1) | ||||
return; | return; | ||||
bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1); | #ifdef INTRNG | ||||
intr = ACPI_BUS_MAP_INTR(device_get_parent(dev), dev, *irq, | |||||
(trig == ACPI_EDGE_SENSITIVE) ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL, | |||||
(pol == ACPI_ACTIVE_HIGH) ? INTR_POLARITY_HIGH : INTR_POLARITY_LOW); | |||||
#else | |||||
intr = *irq; | |||||
#endif | |||||
bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, intr, 1); | |||||
} | } | ||||
static void | static void | ||||
acpi_res_set_drq(device_t dev, void *context, uint8_t *drq, int count) | acpi_res_set_drq(device_t dev, void *context, uint8_t *drq, int count) | ||||
{ | { | ||||
struct acpi_res_context *cp = (struct acpi_res_context *)context; | struct acpi_res_context *cp = (struct acpi_res_context *)context; | ||||
if (cp == NULL || drq == NULL) | if (cp == NULL || drq == NULL) | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |