From: Laszlo Ersek <lersek@redhat.com>
To: Guy Raviv <guyraviv8@gmail.com>
Cc: edk2-devel@lists.01.org
Subject: Re: Dynamic Pci configuration devices
Date: Tue, 8 May 2018 16:47:17 +0200 [thread overview]
Message-ID: <cd18b3d3-431f-70b9-0b3e-8f74a35b0644@redhat.com> (raw)
In-Reply-To: <CALFDPeX0SWeqXt=rjDGN+kUdjvNrN4ZaBet20n=jAVo9p+c+tw@mail.gmail.com>
On 05/08/18 16:16, Guy Raviv wrote:
> Hi all,
>
> currently in
>
> \Vlv2DeviceRefCodePkg\AcpiTablesPCAT\HOST_BUS.ASL
>
> The PCI devices are declared statically.
>
> i want to make this declaration dynamic - so that the device number can change
>
> according according to my hardware setup. Is it possible?
There are generally two ways for this.
One is to write the bulk of the ASL like seen here, statically, but all
the customizable values are referenced as external objects / fields.
Then, a platform ACPI DXE driver in the firmware computes those values,
and installs a small SSDT with just those objects. The AML is generated
manually by the firmware, which is super awkward, but due to the small
size of the integer objects etc, it is tolerable.
A similar approach can be seen e.g. in "OvmfPkg/AcpiPlatformDxe/Qemu.c",
function QemuInstallAcpiSsdtTable(). And the referring ASL code is in
"OvmfPkg/AcpiTables/Dsdt.asl". (Search both for "FWDT".)
(Note however that said function is not used nowadays on QEMU, because
now QEMU generates *all* of the AML dynamically.)
The other approach is to process the (static) AML before installing it
with EFI_ACPI_TABLE_PROTOCOL.InstallAcpiTable(). If you know the exact
path to / structure of the AML node that you want to modify, the
EFI_ACPI_SDT_PROTOCOL lets you navigate to the node, and patch it
in-place, in a memory array. Then you can install the modified table
blob with EFI_ACPI_TABLE_PROTOCOL. (Important: do not modify a table
*after* it is installed.)
One example for the 2nd approach should be
"QuarkPlatformPkg/Acpi/Dxe/AcpiPlatform/AcpiPciUpdate.c".
Thanks
Laszlo
next prev parent reply other threads:[~2018-05-08 14:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-08 14:16 Dynamic Pci configuration devices Guy Raviv
2018-05-08 14:47 ` Laszlo Ersek [this message]
2018-05-09 5:50 ` Guy Raviv
2018-05-09 11:39 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd18b3d3-431f-70b9-0b3e-8f74a35b0644@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox