On 2015-01-28 00:50:43, Laszlo Ersek wrote:
> On 01/28/15 00:29, Jordan Justen wrote:
> > On 2015-01-27 00:17:52, Laszlo Ersek wrote:
> >> On 01/26/15 22:32, Jordan Justen wrote:
> >>> On 2015-01-24 15:04:52, Laszlo Ersek wrote:
> >>>> +EFI_STATUS
> >>>> +EFIAPI
> >>>> +InstallAllQemuLinkedTables (
> >>>> +  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
> >>>> +  );
> >>>
> >>> What do you think about moving this to QemuFwCfgLib instead?
> >>
> >> This crossed my mind earlier, but I don't think it's a good idea. Just
> >> because it depends on FwCfg, I don't want to fuse it with the base
> >> library. (Same for QemuBootOrderLib.) ("Base" meaning "foundational",
> >> not "available to all phases", in this context, clearly.)
> >>
> >> (1) Main reason is it makes it harder to port the various independent
> >> features gradually, and/or to port them selectively even for the longer
> >> term.
> >>
> >> A good negative example is the QemuFwCfgS3Enabled() API. Because it was
> >> so small and so easy to implement for OVMF / x86, we fused it with the
> >> QemuFwCfgLib interface. When implementing the library class for ARM
> >> guests, I had no choice but to implement it too (as "return FALSE")
> >> because it had already been part of the interface. The implementation is
> >> quite useless, and worse, nothing at all calls it in ArmVirtualizationPkg.
> >>
> >>> How about:
> >>>   RETURN_STATUS
> >>>   EFIAPI
> >>>   QemuFwCfgInstallAcpiTables (
> >>>     VOID
> >>>     );
> >>>
> >>> Obviously this should just assert if called in SEC or PEI.
> >>
> >> I can rename the function if you'd like, but I think build-time (ie.
> >> interface-level) constraints of an API are superior to runtime asserts.
> >> This holds for both different UEFI phases and different architectures.
> >>
> >> You probably don't like the proliferation of small, QEMU-specific
> >> libraries in OVMF. I can appreciate that from an aesthetic POV, but
> >> these features are really this fine-grained, and exposing their
> >> dependencies on the library class level allows me to port them more
> >> flexibly.
> >>
> >> (2) Another reason is that by making the QemuFwCfgLib lib class more
> >> comprehensive, code duplication would worsen. The QemuBootOrderLib and
> >> QemuLoaderLib functionality is identical between ARM and x86. The
> >> underlying fw_cfg access / transfer methods are different.
> > 
> > They may be different, but looking, I'm wondering why
> > OvmfPkg/Library/QemuFwCfgLib doesn't have arm support, rather than
> > putting it into a separate module over in
> > ArmPlatformPkg/ArmVirtualizationPkg/Library/QemuFwCfgLib.
> 
> (a) OvmfPkg/Library/QemuFwCfgLib shares the C-language implementation of
> InternalQemuFwCfgReadBytes() between Ia32 and X64, and the underlying
> IoReadFifo8() function has platform-dependent assembly implementation.
> Whereas ArmPlatformPkg/ArmVirtualizationPkg/Library/QemuFwCfgLib has an
> implementation that differs even on the C language level (and no
> assembly at all).
> 
> The library constructor is also different; the latter depends on
> ARM-specific PCDs. It seemed cleaner to break away completely than to
> litter the code with MDE_CPU_* macros, different INF sections, and mix
> in some assembly too.

I'm thinking arch specific C files, possibly only with
InternalQemuFwCfgReadBytes. It does seem like a single implementation
of QemuFwCfgLib is possible. Regarding the PCDs, I would say they
could be fixed or dynamic depending on the platform. Anyway, I guess
this is more of a cleanup issue at this point...

Regarding the other issue. How about instead of yet-another-library,
we add OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiDxe.inf that only supports
fw-cfg?

-Jordan

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to