From 5124c131ba89145dfa481016038fbc8f26a86656 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 28 Jun 2021 14:11:38 +0200 Subject: [PATCH] mb/emulation/qemu-i440fx: Tidy up PAM register writes Tidy up the code that programs the PAM (Programmable Attribute Map) registers. Introduce the `D0F0_PAM` macro and use it to replace the magic `0x59` and `0x5a` values in the code. Adjust the range of the for-loop to work with the `D0F0_PAM` macro, and properly indent the loop's body. Change-Id: I9036425d726ffb69737ea6ed36c7a8f61d9d040a Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/55899 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Nico Huber --- src/mainboard/emulation/qemu-i440fx/mainboard.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mainboard/emulation/qemu-i440fx/mainboard.c b/src/mainboard/emulation/qemu-i440fx/mainboard.c index bc97554442..218c47f0aa 100644 --- a/src/mainboard/emulation/qemu-i440fx/mainboard.c +++ b/src/mainboard/emulation/qemu-i440fx/mainboard.c @@ -10,15 +10,15 @@ static const unsigned char qemu_i440fx_irqs[] = { 11, 10, 10, 11, }; +#define D0F0_PAM(x) (0x59 + (x)) /* 0-6 */ + static void qemu_nb_init(struct device *dev) { /* Map memory at 0xc0000 - 0xfffff */ int i; - uint8_t v = pci_read_config8(dev, 0x59); - v |= 0x30; - pci_write_config8(dev, 0x59, v); - for (i = 0; i < 6; i++) - pci_write_config8(dev, 0x5a + i, 0x33); + pci_or_config8(dev, D0F0_PAM(0), 0x30); + for (i = 1; i <= 6; i++) + pci_write_config8(dev, D0F0_PAM(i), 0x33); /* This sneaked in here, because Qemu does not emulate a SuperIO chip. */ pc_keyboard_init(NO_AUX_DEVICE);