On macOS Apple Silicon, Thunderbolt-connected eGPUs don't get BAR addresses
assigned by the OS. The BAR registers in PCI config space remain 0x00000000,
causing _CopyDeviceMemoryWithIndex to return mappings that read as 0xFFFFFFFF
(unmapped memory), making the GPU unusable for compute.
This patch adds ProgramBARAddresses() to TinyGPUDriver::Start_Impl, which:
1. Checks if BAR0 is unassigned (0x00000000 or 0xFFFFFFFF)
2. Determines each BAR's size requirement by writing/reading 0xFFFFFFFF
3. Reads the parent Thunderbolt bridge's memory aperture (MEM base/limit,
prefetchable MEM base/limit) from PCI config space
4. Allocates naturally-aligned BAR addresses from the bridge aperture
5. Writes the addresses to BAR registers in config space
6. Re-enables Memory Space and Bus Master in the command register
7. Logs all steps for debugging
This mirrors what Linux does in pci_assign_resource() and what mac-amdgpu
does manually for the R9700. Without this, the DriverKit extension can
enumerate the GPU but cannot access its MMIO registers.
Tested-on: AMD Radeon AI PRO R9700 32GB (RDNA4) on M4 Mac Mini via
ACASIS G4Pro Thunderbolt 4 enclosure.
Fixes: #15813, #15864, #16714
Related: #15730, #15744