Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm64/arm64/nexus.c
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
#include <machine/pcb.h> | #include <machine/pcb.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <machine/resource.h> | #include <machine/resource.h> | ||||
#include <machine/intr.h> | #include <machine/intr.h> | ||||
#ifdef FDT | #ifdef FDT | ||||
#include <dev/ofw/ofw_bus_subr.h> | |||||
#include <dev/ofw/openfirm.h> | #include <dev/ofw/openfirm.h> | ||||
#include "ofw_bus_if.h" | #include "ofw_bus_if.h" | ||||
#endif | #endif | ||||
#ifdef DEV_ACPI | #ifdef DEV_ACPI | ||||
#include <contrib/dev/acpica/include/acpi.h> | #include <contrib/dev/acpica/include/acpi.h> | ||||
#include <dev/acpica/acpivar.h> | #include <dev/acpica/acpivar.h> | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { | ||||
err = bus_space_map(&memmap_bus, paddr, psize, 0, &vaddr); | err = bus_space_map(&memmap_bus, paddr, psize, 0, &vaddr); | ||||
if (err != 0) { | if (err != 0) { | ||||
rman_deactivate_resource(r); | rman_deactivate_resource(r); | ||||
return (err); | return (err); | ||||
} | } | ||||
rman_set_bustag(r, &memmap_bus); | rman_set_bustag(r, &memmap_bus); | ||||
rman_set_virtual(r, (void *)vaddr); | rman_set_virtual(r, (void *)vaddr); | ||||
rman_set_bushandle(r, vaddr); | rman_set_bushandle(r, vaddr); | ||||
} else if (type == SYS_RES_IRQ) { | |||||
intr_activate_irq(child, r); | |||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static struct resource_list * | static struct resource_list * | ||||
nexus_get_reslist(device_t dev, device_t child) | nexus_get_reslist(device_t dev, device_t child) | ||||
{ | { | ||||
struct nexus_device *ndev = DEVTONX(child); | struct nexus_device *ndev = DEVTONX(child); | ||||
Show All 17 Lines | |||||
static int | static int | ||||
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, | nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, | ||||
struct resource *r) | struct resource *r) | ||||
{ | { | ||||
bus_size_t psize; | bus_size_t psize; | ||||
bus_space_handle_t vaddr; | bus_space_handle_t vaddr; | ||||
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { | |||||
psize = (bus_size_t)rman_get_size(r); | psize = (bus_size_t)rman_get_size(r); | ||||
vaddr = rman_get_bushandle(r); | vaddr = rman_get_bushandle(r); | ||||
if (vaddr != 0) { | if (vaddr != 0) { | ||||
bus_space_unmap(&memmap_bus, vaddr, psize); | bus_space_unmap(&memmap_bus, vaddr, psize); | ||||
rman_set_virtual(r, NULL); | rman_set_virtual(r, NULL); | ||||
rman_set_bushandle(r, 0); | rman_set_bushandle(r, 0); | ||||
} | } | ||||
} else if (type == SYS_RES_IRQ) { | |||||
intr_deactivate_irq(child, r); | |||||
} | |||||
return (rman_deactivate_resource(r)); | return (rman_deactivate_resource(r)); | ||||
} | } | ||||
#ifdef FDT | #ifdef FDT | ||||
static device_method_t nexus_fdt_methods[] = { | static device_method_t nexus_fdt_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, nexus_fdt_probe), | DEVMETHOD(device_probe, nexus_fdt_probe), | ||||
Show All 29 Lines | nexus_fdt_attach(device_t dev) | ||||
nexus_add_child(dev, 10, "ofwbus", 0); | nexus_add_child(dev, 10, "ofwbus", 0); | ||||
return (nexus_attach(dev)); | return (nexus_attach(dev)); | ||||
} | } | ||||
static int | static int | ||||
nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells, | nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells, | ||||
pcell_t *intr) | pcell_t *intr) | ||||
{ | { | ||||
u_int irq; | |||||
struct intr_map_data_fdt *fdt_data; | |||||
size_t len; | |||||
return (INTR_IRQ_INVALID); | len = sizeof(*fdt_data) + icells * sizeof(pcell_t); | ||||
fdt_data = (struct intr_map_data_fdt *)intr_alloc_map_data( | |||||
INTR_MAP_DATA_FDT, len, M_WAITOK | M_ZERO); | |||||
fdt_data->iparent = iparent; | |||||
fdt_data->ncells = icells; | |||||
memcpy(fdt_data->cells, intr, icells * sizeof(pcell_t)); | |||||
irq = intr_map_irq(NULL, iparent, (struct intr_map_data *)fdt_data); | |||||
return (irq); | |||||
} | } | ||||
#endif | #endif | ||||
#ifdef DEV_ACPI | #ifdef DEV_ACPI | ||||
static device_method_t nexus_acpi_methods[] = { | static device_method_t nexus_acpi_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, nexus_acpi_probe), | DEVMETHOD(device_probe, nexus_acpi_probe), | ||||
DEVMETHOD(device_attach, nexus_acpi_attach), | DEVMETHOD(device_attach, nexus_acpi_attach), | ||||
Show All 30 Lines |