PCI_BAR_IOBASE() macro for bit extraction

This commit is contained in:
2025-11-29 00:19:02 +01:00
parent 436f29bec9
commit 3183117718
2 changed files with 3 additions and 1 deletions

View File

@@ -48,6 +48,8 @@ typedef union {
#define PCI_DEV_PER_BUS 32 #define PCI_DEV_PER_BUS 32
#define PCI_FN_PER_DEV 32 #define PCI_FN_PER_DEV 32
#define PCI_BAR_IOBASE(bar) ((bar) & 0xFFFFFFFC)
uint32_t pci_read32(PciDev dev, uint32_t field); uint32_t pci_read32(PciDev dev, uint32_t field);
uint16_t pci_read16(PciDev dev, uint32_t field); uint16_t pci_read16(PciDev dev, uint32_t field);
uint8_t pci_read8(PciDev dev, uint32_t field); uint8_t pci_read8(PciDev dev, uint32_t field);

View File

@@ -162,7 +162,7 @@ void pci_qemu_pci_serial_init(void) {
LOG("pci", "QEMU_PCI_SERIAL bar0=0x%x\n", bar0); LOG("pci", "QEMU_PCI_SERIAL bar0=0x%x\n", bar0);
uint16_t iobase = bar0 & 0xFFFFFFFC; uint16_t iobase = PCI_BAR_IOBASE(bar0);
LOG("pci", "QEMU_PCI_SERIAL iobase=0x%x\n", iobase); LOG("pci", "QEMU_PCI_SERIAL iobase=0x%x\n", iobase);
QEMU_PCI_SERIAL_DEV.iobase = iobase; QEMU_PCI_SERIAL_DEV.iobase = iobase;