public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
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: Wed, 9 May 2018 13:39:33 +0200	[thread overview]
Message-ID: <48405a60-d646-5997-9af3-cda9d5a14b50@redhat.com> (raw)
In-Reply-To: <CALFDPeXeq9A1MCH3vJ0_R-82P3yLMU7yjzyf0WMyVZ55zuqqdA@mail.gmail.com>

On 05/09/18 07:50, Guy Raviv wrote:
> Thanks for the detailed answer.
> 
> if i choose the 2nd approach would it be possible to modify the structrue
> itself of the pci tree,
> and not only a specific device number?
> example: if i add a pci bridge between my board and a graphic card.

I can't answer this off-hand, but I don't need to: please check the
documentation of EFI_ACPI_SDT_PROTOCOL in the PI spec. After you review
the member functions that the protocol has, you can likely determine the
answer.

Thanks,
Laszlo


> On Tue, May 8, 2018 at 5:47 PM, Laszlo Ersek <lersek@redhat.com> wrote:
> 
>> 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
>>
> 



      reply	other threads:[~2018-05-09 11:39 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
2018-05-09  5:50   ` Guy Raviv
2018-05-09 11:39     ` Laszlo Ersek [this message]

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=48405a60-d646-5997-9af3-cda9d5a14b50@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