HomeFreeBSD

arm64: limit EFI excluded regions to physical memory types

Description

arm64: limit EFI excluded regions to physical memory types

Consolidate add_efi_map_entry() and exclude_efi_map_entry() into a
single function, handle_efi_map_entry(), so that the exact set of entry
types handled is the same in the addition or exclusion cases. Before,
exclude_efi_map_entry() had a 'default' case that would exclude all
entry types that were not listed explicitly in the switch statement.

Logically, we do not need to exclude a range that could not possibly be
added to physmem, and we do not need to exclude bus ranges that are not
physical memory, for example EFI_MD_TYPE_IOMEM.

Since physmem's ram0 device will reserve bus memory resources for its
owned ranges, this was preventing attachment of the watchdog device on
the RPI4B. For some reason its region of memory-mapped I/O appeared in
the EFI memory map (with the aforementioned EFI_MD_TYPE_IOMEM type).
This change fixes the attachment issue, as we prevent the physmem API
from messing with this range of bus space.

PR: 270044
Reported by: karels, Mark Millard
Reviewed by: andrew, karels, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39003

(cherry picked from commit 8937bd37d07c5c75995e01457aec00fb0a05c462)

Details

Provenance
mhorneAuthored on Mar 15 2023, 3:26 PM
Reviewer
andrew
Differential Revision
D39003: arm64: limit EFI excluded regions to physical memory types
Parents
rG9521266b82df: arm64/machdep: Add parameter to the EFI table walking code
Branches
Unknown
Tags
Unknown