vmm: Only fill in PIO and 32-bit MMIO space on zero segment

Since each segment must have disjoint address spaces only advertise
address space in the 32-bit range and the PIO address space on the
default (zero) segment.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-10-06 16:54:16 +01:00
parent 3059ba4305
commit c118d7d7d3

View File

@ -356,35 +356,56 @@ impl Aml for PciSegment {
let pci_dsm = PciDsmMethod {}; let pci_dsm = PciDsmMethod {};
pci_dsdt_inner_data.push(&pci_dsm); pci_dsdt_inner_data.push(&pci_dsm);
let crs = aml::Name::new( let crs = if self.id == 0 {
"_CRS".into(), aml::Name::new(
&aml::ResourceTemplate::new(vec![ "_CRS".into(),
&aml::AddressSpace::new_bus_number(0x0u16, 0x0u16), &aml::ResourceTemplate::new(vec![
#[cfg(target_arch = "x86_64")] &aml::AddressSpace::new_bus_number(0x0u16, 0x0u16),
&aml::Io::new(0xcf8, 0xcf8, 1, 0x8), #[cfg(target_arch = "x86_64")]
&aml::Memory32Fixed::new( &aml::Io::new(0xcf8, 0xcf8, 1, 0x8),
true, &aml::Memory32Fixed::new(
self.mmio_config_address as u32, true,
PCI_MMIO_CONFIG_SIZE as u32, self.mmio_config_address as u32,
), PCI_MMIO_CONFIG_SIZE as u32,
&aml::AddressSpace::new_memory( ),
aml::AddressSpaceCachable::NotCacheable, &aml::AddressSpace::new_memory(
true, aml::AddressSpaceCachable::NotCacheable,
layout::MEM_32BIT_DEVICES_START.0 as u32, true,
(layout::MEM_32BIT_DEVICES_START.0 + layout::MEM_32BIT_DEVICES_SIZE - 1) as u32, layout::MEM_32BIT_DEVICES_START.0 as u32,
), (layout::MEM_32BIT_DEVICES_START.0 + layout::MEM_32BIT_DEVICES_SIZE - 1)
&aml::AddressSpace::new_memory( as u32,
aml::AddressSpaceCachable::NotCacheable, ),
true, &aml::AddressSpace::new_memory(
self.start_of_device_area, aml::AddressSpaceCachable::NotCacheable,
self.end_of_device_area, true,
), self.start_of_device_area,
#[cfg(target_arch = "x86_64")] self.end_of_device_area,
&aml::AddressSpace::new_io(0u16, 0x0cf7u16), ),
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
&aml::AddressSpace::new_io(0x0d00u16, 0xffffu16), &aml::AddressSpace::new_io(0u16, 0x0cf7u16),
]), #[cfg(target_arch = "x86_64")]
); &aml::AddressSpace::new_io(0x0d00u16, 0xffffu16),
]),
)
} else {
aml::Name::new(
"_CRS".into(),
&aml::ResourceTemplate::new(vec![
&aml::AddressSpace::new_bus_number(0x0u16, 0x0u16),
&aml::Memory32Fixed::new(
true,
self.mmio_config_address as u32,
PCI_MMIO_CONFIG_SIZE as u32,
),
&aml::AddressSpace::new_memory(
aml::AddressSpaceCachable::NotCacheable,
true,
self.start_of_device_area,
self.end_of_device_area,
),
]),
)
};
pci_dsdt_inner_data.push(&crs); pci_dsdt_inner_data.push(&crs);
let mut pci_devices = Vec::new(); let mut pci_devices = Vec::new();