Page MenuHomeFreeBSD
Authored By
val_packett.cool
Jun 10 2020, 12:40 AM
Size
1 KB
Referenced Files
None
Subscribers
None
--- i/sys/dev/acpica/acpi.c
+++ w/sys/dev/acpica/acpi.c
@@ -183,6 +183,7 @@ static void acpi_enable_pcie(void);
static void acpi_hint_device_unit(device_t acdev, device_t child,
const char *name, int *unitp);
static void acpi_reset_interfaces(device_t dev);
+static bus_dma_tag_t acpi_get_dma_tag(device_t dev, device_t child);
static device_method_t acpi_methods[] = {
/* Device interface */
@@ -217,6 +218,7 @@ static device_method_t acpi_methods[] = {
DEVMETHOD(bus_hint_device_unit, acpi_hint_device_unit),
DEVMETHOD(bus_get_cpus, acpi_get_cpus),
DEVMETHOD(bus_get_domain, acpi_get_domain),
+ DEVMETHOD(bus_get_dma_tag, acpi_get_dma_tag),
/* ACPI bus */
DEVMETHOD(acpi_id_probe, acpi_device_id_probe),
@@ -430,6 +432,25 @@ acpi_identify(void)
return (0);
}
+static bus_dma_tag_t
+acpi_get_dma_tag(device_t dev, device_t child)
+{
+ bus_dma_tag_t result;
+
+ // TODO: get acpi handle of child, walk up the dsdt and get _DMA (and _CCA) data
+ // like NetBSD: https://github.com/NetBSD/src/blob/792df501ab0f93d73372a9bc2c7f19ccb733c1e5/sys/arch/arm/acpi/acpi_machdep.c#L400
+
+ if (bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0,
+ 0xbfffffff /* 3GB */, BUS_SPACE_MAXADDR, NULL, NULL,
+ BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, BUS_SPACE_MAXSIZE,
+ /* BUS_DMA_COHERENT */ 0, NULL, NULL,
+ &result)) {
+ printf("disaster\n");
+ }
+
+ return (result);
+}
+
/*
* Fetch some descriptive data from ACPI to put in our attach message.
*/

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609769
Default Alt Text
raw.txt (1 KB)

Event Timeline