[coreboot] [PATCH] Set the register based on the ROMSIZE
Scott Duplichan
scott at notabs.org
Fri Dec 10 17:30:23 CET 2010
> @@ -57,8 +57,18 @@
> * Enable LPC ROM range start at:
> * 0xfff8(0000): 512KB
> * 0xfff0(0000): 1MB
> + * 0xffe0(0000): 2MB
> + * 0xffc0(0000): 4MB
> */
> + #if CONFIG_COREBOOT_ROMSIZE_KB_512 ||
> CONFIG_COREBOOT_ROMSIZE_KB_256 || CONFIG_COREBOOT_ROMSIZE_KB_128
> + pci_write_config16(dev, 0x6c, 0xfff8); /* 512KB */
> + #elif CONFIG_COREBOOT_ROMSIZE_KB_1024
> pci_write_config16(dev, 0x6c, 0xfff0); /* 1 MB */
> + #elif CONFIG_COREBOOT_ROMSIZE_KB_2048
> + pci_write_config16(dev, 0x6c, 0xffe0); /* 2 MB */
> + #elif CONFIG_COREBOOT_ROMSIZE_KB_4096
> + pci_write_config16(dev, 0x6c, 0xffc0); /* 4 MB */
> + #endif
]
]How about
]pci_write_config16(dev, 0x6c,
]0x10000-(max(512,CONFIG_COREBOOT_ROMSIZE_KB)>>6));
]instead?
]
]Patrick
Why not...
pci_write_config16(dev, 0x6c,0x10000-(CONFIG_COREBOOT_ROMSIZE_KB>>6));
In other words, why apply special treatment to sizes < 512KB?
In any case, I think most readers of C code would find one of
these methods easier to follow than the preprocessor method.
Thanks,
Scott
More information about the coreboot
mailing list