Make 64 bit window detection logic a bit cleaner: don't hardcode 0 address as invalid, instead check start < end.
Signed-off-by: Michael S. Tsirkin mst@redhat.com --- src/acpi.c | 2 +- src/pciinit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c index b03b2ba..1037093 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -355,7 +355,7 @@ build_ssdt(void) // store pci io windows *(u32*)&ssdt_ptr[acpi_pci32_start[0]] = cpu_to_le32(pcimem_start); *(u32*)&ssdt_ptr[acpi_pci32_end[0]] = cpu_to_le32(pcimem_end - 1); - if (pcimem64_start) { + if (pcimem64_start < pcimem64_end) { ssdt_ptr[acpi_pci64_valid[0]] = 1; *(u64*)&ssdt_ptr[acpi_pci64_start[0]] = cpu_to_le64(pcimem64_start); *(u64*)&ssdt_ptr[acpi_pci64_end[0]] = cpu_to_le64(pcimem64_end - 1); diff --git a/src/pciinit.c b/src/pciinit.c index a4a5bf5..fdf1362 100644 --- a/src/pciinit.c +++ b/src/pciinit.c @@ -818,7 +818,7 @@ static void pci_bios_map_devices(struct pci_bus *busses, struct pci_mem *mem) pci_region_map_entries(busses, &r64_pref); } else if (!mem) { // no bars mapped high -> drop 64bit window (see dsdt) - pcimem64_start = 0; + pcimem64_end = pcimem64_start = 0; } // Map regions on each device. int bus;
On Tue, Apr 30, 2013 at 01:36:33PM +0300, Michael S. Tsirkin wrote:
Make 64 bit window detection logic a bit cleaner: don't hardcode 0 address as invalid, instead check start < end.
Signed-off-by: Michael S. Tsirkin mst@redhat.com
Hmm, scratch this patch. This does not handle case where last byte is all ones - _end would be 0.
src/acpi.c | 2 +- src/pciinit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c index b03b2ba..1037093 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -355,7 +355,7 @@ build_ssdt(void) // store pci io windows *(u32*)&ssdt_ptr[acpi_pci32_start[0]] = cpu_to_le32(pcimem_start); *(u32*)&ssdt_ptr[acpi_pci32_end[0]] = cpu_to_le32(pcimem_end - 1);
- if (pcimem64_start) {
- if (pcimem64_start < pcimem64_end) { ssdt_ptr[acpi_pci64_valid[0]] = 1; *(u64*)&ssdt_ptr[acpi_pci64_start[0]] = cpu_to_le64(pcimem64_start); *(u64*)&ssdt_ptr[acpi_pci64_end[0]] = cpu_to_le64(pcimem64_end - 1);
diff --git a/src/pciinit.c b/src/pciinit.c index a4a5bf5..fdf1362 100644 --- a/src/pciinit.c +++ b/src/pciinit.c @@ -818,7 +818,7 @@ static void pci_bios_map_devices(struct pci_bus *busses, struct pci_mem *mem) pci_region_map_entries(busses, &r64_pref); } else if (!mem) { // no bars mapped high -> drop 64bit window (see dsdt)
pcimem64_start = 0;
} // Map regions on each device. int bus;pcimem64_end = pcimem64_start = 0;
-- MST