* Dynamic Pci configuration devices
@ 2018-05-08 14:16 Guy Raviv
2018-05-08 14:47 ` Laszlo Ersek
0 siblings, 1 reply; 4+ messages in thread
From: Guy Raviv @ 2018-05-08 14:16 UTC (permalink / raw)
To: edk2-devel
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?
Thanks,
Guy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Dynamic Pci configuration devices
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
0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2018-05-08 14:47 UTC (permalink / raw)
To: Guy Raviv; +Cc: edk2-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Dynamic Pci configuration devices
2018-05-08 14:47 ` Laszlo Ersek
@ 2018-05-09 5:50 ` Guy Raviv
2018-05-09 11:39 ` Laszlo Ersek
0 siblings, 1 reply; 4+ messages in thread
From: Guy Raviv @ 2018-05-09 5:50 UTC (permalink / raw)
To: Laszlo Ersek; +Cc: edk2-devel
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.
Thanks,
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Dynamic Pci configuration devices
2018-05-09 5:50 ` Guy Raviv
@ 2018-05-09 11:39 ` Laszlo Ersek
0 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2018-05-09 11:39 UTC (permalink / raw)
To: Guy Raviv; +Cc: edk2-devel
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
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-09 11:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox