[SeaBIOS] [PATCH 2/2] pci/acpi: add mcfg table for mmconfig

Kevin O'Connor kevin at koconnor.net
Wed Nov 21 03:08:56 CET 2012


On Tue, Nov 20, 2012 at 05:55:51PM +0100, Gerd Hoffmann wrote:
[...]
> +static void *
> +build_mcfg(void)
> +{
> +    struct acpi_table_mcfg *mcfg;
> +
> +    if (!mmconfig.address)
> +        return NULL;
> +
> +    int len = sizeof(*mcfg) + 1 * sizeof(mcfg->allocation[0]);
> +    mcfg = malloc_high(len);
> +    if (!mcfg) {
> +        warn_noalloc();
> +        return NULL;
> +    }
> +    memset(mcfg, 0, len);
> +    mcfg->allocation[0] = mmconfig;

Given all the funky things SeaBIOS does with 16/32bit mode string
copies, I'd prefer to use explicit memcpy() calls instead of using
implicit struct copies (though I agree it's not likely to be an issue
in this particular call site).

That said, though, I don't see a gain in having the acpi code
communicate with the pciinit code.  Both sets of code are effectively
qemu specific, build_mcfg() is only going to get called on q35, and
thus the mmconfig struct will always have hard coded values.  Might as
well have build_mcfg detect q35 and just put the hard-coded values in
directly.  Let me know if I've missed something.

-Kevin



More information about the SeaBIOS mailing list