Page MenuHomeFreeBSD

Use EFI memory map to determine attributes for AcpiOsMapMemory mappings on arm64
ClosedPublic

Authored by greg_unrelenting.technology on Jun 9 2020, 7:42 PM.

Details

Summary

(WIP, please help me improve this, or just do it better :D)

AcpiOsMapMemory is used for device memory when e.g. an _INI method wants to access physical memory.
However, aarch64 pmap_mapbios is hardcoded to writeback, which is no good.
We need to default to device memory and use EFI memory map attributes to detect different modes.

This fixes XHCI initialization on the Raspberry Pi 4 UEFI firmware (https://github.com/pftf/RPi4/issues/50).

Inspired by NetBSD: https://github.com/NetBSD/src/blob/792df501ab0f93d73372a9bc2c7f19ccb733c1e5/sys/arch/arm/acpi/acpi_machdep.c#L70

Test Plan

Works on my RPi4 :) no-harm on the Marvell MACCHIATObin (Armada8k)

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

andrew requested changes to this revision.Jun 9 2020, 8:39 PM

You should teach pmap_mapbios to take into account the EFI memory type.

The parsing on the EFI map should be in machdep.c as that already has the EFI support code.

This revision now requires changes to proceed.Jun 9 2020, 8:39 PM
sys/arm64/arm64/machdep.c
1108 ↗(On Diff #72905)

I think you can add a break or return a device memory type at the end of the loop as we shouldn't see overlapping entries.

greg_unrelenting.technology edited the test plan for this revision. (Show Details)
greg_unrelenting.technology marked an inline comment as done.
This revision is now accepted and ready to land.Jun 28 2020, 2:07 PM