system76-edk2/OvmfPkg/PlatformDxe/PlatformConfig.h
Laszlo Ersek 5267c89b4d OvmfPkg: PlatformDxe: utility functions for saving / loading configuration
The two functions introduced here allow the saving and loading of platform
configuration to/from the non-volatile variable store.

The PLATFORM_CONFIG structure and the two functions that take it / return
it are generally meant for any DXE or UEFI driver that needs to access
platform configuration. For now we keep this small "library" internal to
PlatformDxe.

The PLATFORM_CONFIG wire format is intended only to grow over time (as
long as the variable GUID remains unchanged). At the introduction of new
fields, new feature flags must be added, and recognized in
PlatformConfigLoad().

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@15365 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-22 07:13:02 +00:00

60 lines
1.5 KiB
C

/** @file
Utility functions for serializing (persistently storing) and deserializing
OVMF's platform configuration.
Copyright (C) 2014, Red Hat, Inc.
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _PLATFORM_CONFIG_H_
#define _PLATFORM_CONFIG_H_
#include <Base.h>
//
// This structure participates in driver configuration. It does not
// (necessarily) reflect the wire format in the persistent store.
//
#pragma pack(1)
typedef struct {
//
// preferred graphics console resolution when booting
//
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
} PLATFORM_CONFIG;
#pragma pack()
//
// Please see the API documentation near the function definitions.
//
EFI_STATUS
EFIAPI
PlatformConfigSave (
IN PLATFORM_CONFIG *PlatformConfig
);
EFI_STATUS
EFIAPI
PlatformConfigLoad (
OUT PLATFORM_CONFIG *PlatformConfig,
OUT UINT64 *OptionalElements
);
//
// Feature flags for OptionalElements.
//
#define PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION BIT0
#define PLATFORM_CONFIG_F_DOWNGRADE BIT63
#endif // _PLATFORM_CONFIG_H_