summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/PlatformDxe/Platform.c
Commit message (Collapse)AuthorAgeFilesLines
* OvmfPkg: Fix Hii form name mismatch with EFI variableYin Wang2023-09-061-1/+1
| | | | | | | | | | | | | | | | The Hii form is named "MainFormState" while the EFI variable is named "PlatformConfig". This discrepancy in names causes the following SCT cases to fail on RiscVVirtQemu: ExtractConfigConformance ExtractConfigFunction ExtractConfig_Func Previous commit 16acacf addressed two of these issues, and this patch fixes the remaining one. Signed-off-by: Yin Wang <yin.wang@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* OvmfPkg: Update code to be more C11 compliant by using __func__Rebecca Cran2023-04-101-7/+7
| | | | | | | | | | | | | __FUNCTION__ is a pre-standard extension that gcc and Visual C++ among others support, while __func__ was standardized in C99. Since it's more standard, replace __FUNCTION__ with __func__ throughout OvmfPkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
* OvmfPkg: fix PlatformConfigGerd Hoffmann2022-12-231-2/+2
| | | | | | | | The Hii form is named "MainFormState" and the EFI variable is named "PlatformConfig". Take into account the different names. Fixes: aefcc91805fd ("OvmfPkg/PlatformDxe: Handle all requests in ExtractConfig and RouteConfig") Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg/PlatformDxe: Handle all requests in ExtractConfig and RouteConfigDimitrije Pavlov2022-09-051-2/+113
| | | | | | | | | | | | | | | | | | | | | | | Per the UEFI specification, if the Request argument in EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig() is NULL or does not contain any request elements, the implementation should return all of the settings being abstracted for the particular ConfigHdr reference. The current implementation returns EFI_INVALID_PARAMETER if Request is NULL or does not contain any request elements. Instead, construct a new ConfigRequest to handle these cases per the specification. In addition, per the UEFI specification, if the Configuration argument in EFI_HII_CONFIG_ACCESS_PROTOCOL.RouteConfig() has a ConfigHdr that specifies a non-existing target, the implementation should return EFI_NOT_FOUND. The current implementation returns EFI_INVALID_PARAMETER if Configuration has a non-existing target in ConfigHdr. Instead, perform a check and return EFI_NOT_FOUND in this case. Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* OvmfPkg/PlatformDxe: Check RouteConfig arguments for spec complianceYuan Yu2022-09-051-1/+1
| | | | | | | | | | | | Per UEFI Spec 2.9, EFI_HII_CONFIG_ROUTING_PROTOCOL.RouteConfig() should return EFI_INVALID_PARAMETER if caller passes in a NULL for the Configuration parameter (see 35.4 EFI HII Configuration Routing Protocol). Add a check to return EFI_INVALID_PARAMETER when Configuration is NULL. Signed-off-by: Yuan Yu <yuanyu@google.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* OvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig argumentsDimitrije Pavlov2022-08-161-0/+8
| | | | | | | | | | | | The current implementation does not check if Progress or Results pointers in ExtractConfig are NULL, or if Progress pointer in RouteConfig is NULL. This causes the SCT test suite to crash. Add a check to return EFI_INVALID_PARAMETER if any of these pointers are NULL. Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com> Reviewed-by: Sunny Wang <sunny.wang@arm.com>
* OvmfPkg: add PcdVideoResolutionSourceGerd Hoffmann2022-01-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a UINT8 (enum) PCD telling where the PcdVideoHorizontalResolution and PcdVideoVerticalResolution values are coming from. It can be: 0 (unset aka default from dsc file), or 1 (from PlatformConfig), or 2 (set by Video Driver). It will be used by video drivers to avoid overriding PlatformConfig values, or override each others values in case multiple display devices are present. The underlying problem this tries to solve is that the GOP protocol has no way to indicate the preferred video mode. On physical hardware this isn't much of a problem because using the highest resolution available works just fine as that is typically the native display resolution But in a virtual machine you don't want come up with a huge 4k window by default just because the virtual vga is able to handle that. Cutting down the video mode list isn't a great solution either as that would also remove the modes from the platform configuration so the user wouldn't be able to pick a resolution higher than the default any more. So with patch drivers can use use PcdVideoHorizontalResolution and PcdVideoVerticalResolution to indicate what the preferred display resolution is, without overwriting the user preferences from PlatformConfig if present. A possible alternative approach would be to extend the GOP protocol, but I'm not sure this is a good plan given this is mostly a problem for virtual machines and using PCDs allows to keep this local to OvmfPkg. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Ard Biesheuvel <ardb@kernel.org>
* OvmfPkg: Apply uncrustify changesMichael Kubacki2021-12-071-173/+264
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the OvmfPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Andrew Fish <afish@apple.com>
* OvmfPkg: replace old EFI_D_ debug levels with new DEBUG_ onesRebecca Cran2020-04-301-7/+7
| | | | | | | | | | | | | Generated mechanically with: find OvmfPkg -type f -exec sed -i -e 's/EFI_D_/DEBUG_/g' {} \; Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Cc: Philippe Mathieu-Daude <philmd@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200429215327.606467-1-rebecca@bsdio.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functionsLaszlo Ersek2019-10-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following call tree: PlatformInit () mInstalledPackages = HiiAddPackages () GopInstalled () PopulateForm (PackageList = mInstalledPackages) CreateResolutionOptions (PackageList) HiiSetString (PackageList HiiUpdateForm (PackageList) PlatformDxe passes around an EFI_HII_HANDLE that (a) originates from HiiAddPackages() and (b) is ultimately passed to HiiSetString() and HiiUpdateForm(). The intermediate functions PopulateForm() and CreateResolutionOptions() however take that parameter as an (EFI_HII_HANDLE*). There is no bug in practice (because the affected functions never try to de-reference the "PackageList" parameter, they just pass it on), but the function prototypes are semantically wrong. Fix that. This could remain hidden so long because pointer-to-VOID silently converts to/from any pointer-to-object type, and the UEFI spec mandates that EFI_HII_HANDLE be a typedef to (VOID*). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* OvmfPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-091-7/+1
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformDxe: eliminate unchecked PcdSetXX() callsLaszlo Ersek2016-10-251-2/+6
| | | | | | | | | | | | | | | These are deprecated / disabled under the DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. Introduce a variable called PcdStatus, and use it to assert the success of these operations (there is no reason for them to fail here). Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=166 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # RVCT Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* OvmfPkg: PlatformDxe: connect RouteConfig() to platform dataLaszlo Ersek2014-03-221-1/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Establish the full stack of conversions when modifying the platform configuration: ConfigResp -- form engine / HII communication | [ConfigToBlock] | v MAIN_FORM_STATE -- binary representation of form/widget state | [FormStateToPlatformConfig] | v PLATFORM_CONFIG -- accessible to DXE and UEFI drivers | [PlatformConfigSave] | v UEFI non-volatile variable -- accessible to external utilities Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15375 6f19259b-4bc3-4df7-8a09-765794883524
* OvmfPkg: PlatformDxe: connect ExtractConfig() to platform dataLaszlo Ersek2014-03-221-4/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Establish the full stack of conversions in retrieving the platform configuration: MultiConfigAltResp -- form engine / HII communication ^ | [BlockToConfig] | MAIN_FORM_STATE -- binary representation of form/widget state ^ | [PlatformConfigToFormState] | PLATFORM_CONFIG -- accessible to DXE and UEFI drivers ^ | [PlatformConfigLoad] | UEFI non-volatile variable -- accessible to external utilities Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15374 6f19259b-4bc3-4df7-8a09-765794883524
* OvmfPkg: PlatformDxe: add save and discard buttons to the formLaszlo Ersek2014-03-221-0/+22
| | | | | | | | | | The RouteConfig() function is also called now as expected. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15373 6f19259b-4bc3-4df7-8a09-765794883524
* OvmfPkg: PlatformDxe: get available resolutions from GOPLaszlo Ersek2014-03-221-20/+220
| | | | | | | | | | Generate the options for the drop-down list from the GOP resolutions. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15372 6f19259b-4bc3-4df7-8a09-765794883524
* OvmfPkg/PlatformDxe: Silence warning seen with GCC48 IA32Jordan Justen2014-03-221-1/+3
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15370 6f19259b-4bc3-4df7-8a09-765794883524
* OvmfPkg: PlatformDxe: add form widgets for video modesLaszlo Ersek2014-03-221-1/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In this patch we populate the form with the two widgets related to video resolution: - A read-only string field displaying the preference for the next boot. - A drop-down list offering choices for changing the setting. This list is implemented with dynamically generated IFR opcodes. (In general, the current preference may be missing, or it may be invalid for the available video RAM size. The list of possible new settings is filtered with the video RAM size.) Because the form now becomes able to receive input, we must also implement ExtractConfig(). This function tells the HII engine about the state of the widgets. For now we set up both widgets with static data only: - The current preference always says "Unset". The driver code is still isolated from the backend (the UEFI variable store). - The list of possible resolutions offers 800x600 only. We don't interrogate the GOP yet. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15369 6f19259b-4bc3-4df7-8a09-765794883524
* OvmfPkg: PlatformDxe: add an empty HII formLaszlo Ersek2014-03-221-0/+165
| | | | | | | | | | ... which opens from the Device Manager window. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15367 6f19259b-4bc3-4df7-8a09-765794883524
* OvmfPkg: PlatformDxe: set preferred video resolution from platform configLaszlo Ersek2014-03-221-0/+41
| | | | | | | | | | | | | | | | | The GraphicsConsoleDxe driver (in MdeModulePkg/Universal/Console) determines the preferred video resolution from the dynamic PCDs - gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution - gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution Setting the graphics resolution during boot is useful when the guest OS (for lack of a dedicated display driver) continues to work with the original GOP resolution and framebuffer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15366 6f19259b-4bc3-4df7-8a09-765794883524
* OvmfPkg: introduce empty PlatformDxeLaszlo Ersek2014-03-221-0/+53
This DXE driver will load/save persistent values for OVMF's config knobs, plus expose those knobs via HII. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15364 6f19259b-4bc3-4df7-8a09-765794883524