From 1c4589280ae4e9ba34266e674459fffd6f0282dc Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 17 Dec 2021 08:56:34 +0100 Subject: [PATCH] hvmloader: tidy pci_mem_{start,end} For one at least pci_mem_start has to be precisely 32 bits wide, so use uint32_t for both. Otherwise expressions like "pci_mem_start <<= 1" won't have the intended effect (in their context). Further since its introduction pci_mem_end was never written to. Mark it const to make this explicit. Finally drop PCI_MEM_END: It is used just once and needlessly disconnected from the other constant (RESERVED_MEMBASE) it needs to match. Use RESERVED_MEMBASE as initializer of pci_mem_end instead. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- tools/firmware/hvmloader/config.h | 6 ++---- tools/firmware/hvmloader/pci.c | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h index 844120bc87..c82adf6dc5 100644 --- a/tools/firmware/hvmloader/config.h +++ b/tools/firmware/hvmloader/config.h @@ -55,12 +55,10 @@ extern uint8_t ioapic_version; #define PCI_ISA_DEVFN 0x08 /* dev 1, fn 0 */ #define PCI_ISA_IRQ_MASK 0x0c20U /* ISA IRQs 5,10,11 are PCI connected */ -/* MMIO hole: Hardcoded defaults, which can be dynamically expanded. */ -#define PCI_MEM_END 0xfc000000 - #define ACPI_TIS_HDR_ADDRESS 0xFED40F00UL -extern unsigned long pci_mem_start, pci_mem_end; +extern uint32_t pci_mem_start; +extern const uint32_t pci_mem_end; extern uint64_t pci_hi_mem_start, pci_hi_mem_end; extern bool acpi_enabled; diff --git a/tools/firmware/hvmloader/pci.c b/tools/firmware/hvmloader/pci.c index 72f92d4450..257a6feb61 100644 --- a/tools/firmware/hvmloader/pci.c +++ b/tools/firmware/hvmloader/pci.c @@ -29,8 +29,8 @@ #include #include -unsigned long pci_mem_start = HVM_BELOW_4G_MMIO_START; -unsigned long pci_mem_end = PCI_MEM_END; +uint32_t pci_mem_start = HVM_BELOW_4G_MMIO_START; +const uint32_t pci_mem_end = RESERVED_MEMBASE; uint64_t pci_hi_mem_start = 0, pci_hi_mem_end = 0; enum virtual_vga virtual_vga = VGA_none; @@ -329,7 +329,7 @@ void pci_setup(void) else { pci_mem_start = max_ram_below_4g; - printf("pci_mem_start=0x%lx (was 0x%x) for mmio_hole_size=%lu\n", + printf("pci_mem_start=0x%x (was 0x%x) for mmio_hole_size=0x%lx\n", pci_mem_start, HVM_BELOW_4G_MMIO_START, (long)mmio_hole_size); } -- 2.30.2