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>
This commit is contained in:
Angel Pons 2021-06-28 14:11:38 +02:00 committed by Patrick Georgi
parent 3b1a9944aa
commit 5124c131ba
1 changed files with 5 additions and 5 deletions

View File

@ -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);