Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/55899 )
Change subject: mb/emulation/qemu-i440fx: Tidy up PAM register writes ......................................................................
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 th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/55899 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Paul Menzel paulepanter@mailbox.org Reviewed-by: Nico Huber nico.h@gmx.de --- M src/mainboard/emulation/qemu-i440fx/mainboard.c 1 file changed, 5 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve
diff --git a/src/mainboard/emulation/qemu-i440fx/mainboard.c b/src/mainboard/emulation/qemu-i440fx/mainboard.c index bc97554..218c47f 100644 --- a/src/mainboard/emulation/qemu-i440fx/mainboard.c +++ b/src/mainboard/emulation/qemu-i440fx/mainboard.c @@ -10,15 +10,15 @@ 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);