summaryrefslogtreecommitdiffstats
path: root/src/mainboard
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-28 14:11:38 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-07-01 09:42:55 +0000
commit5124c131ba89145dfa481016038fbc8f26a86656 (patch)
tree5afcd3c59cc2eed286d254b4c131f69edd79aefa /src/mainboard
parent3b1a9944aa58f781a7a6e9c86ed9bde56fa8074e (diff)
downloadcoreboot-5124c131ba89145dfa481016038fbc8f26a86656.tar.gz
coreboot-5124c131ba89145dfa481016038fbc8f26a86656.tar.bz2
coreboot-5124c131ba89145dfa481016038fbc8f26a86656.zip
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>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/emulation/qemu-i440fx/mainboard.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mainboard/emulation/qemu-i440fx/mainboard.c b/src/mainboard/emulation/qemu-i440fx/mainboard.c
index bc97554442d6..218c47f0aa75 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);