Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F6682167
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
val_packett.cool
Jun 10 2020, 12:40 AM
2020-06-10 00:40:16 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
raw.txt
View Options
--- 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
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609769
Default Alt Text
raw.txt (1 KB)
Attached To
Mode
P391 WIP ACPI _DMA constraint support (just hardcoded to 3GB for RPi4 for now)
Attached
Detach File
Event Timeline
Log In to Comment