Skip to content

Commit

Permalink
DasharoModulePkg: move more declarations to DasharoOptions.h
Browse files Browse the repository at this point in the history
To have all of them collected in one place and have no need to reach
into HII-related header from unrelated parts of the code.

Signed-off-by: Sergii Dmytruk <[email protected]>
  • Loading branch information
SergiiDmytruk committed Jun 10, 2024
1 parent b646ad1 commit 1acd954
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 61 deletions.
4 changes: 2 additions & 2 deletions DasharoBootPolicies/BootPolicies.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
#include <Library/DebugLib.h>
#include <Library/UefiLib.h>
#include "BootPolicies.h"
#include "Library/DasharoSystemFeaturesUiLib/DasharoSystemFeaturesHii.h"
#include <DasharoOptions.h>

#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
Expand Down Expand Up @@ -41,7 +41,7 @@ InitializeBootPolicies (
EFI_STATUS Status = EFI_SUCCESS;
BOOLEAN *EfiVar;
UINTN VarSize = sizeof(BOOLEAN);
IOMMU_CONFIG *IommuConfig;
DASHARO_IOMMU_CONFIG *IommuConfig;
UINT8 PcdVal = 0;

gBS = SystemTable->BootServices;
Expand Down
45 changes: 45 additions & 0 deletions Include/DasharoOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,53 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// UINT8 type.
//

#define DASHARO_FAN_CURVE_OPTION_SILENT 0
#define DASHARO_FAN_CURVE_OPTION_PERFORMANCE 1

#define DASHARO_ME_MODE_ENABLE 0
#define DASHARO_ME_MODE_DISABLE_HECI 1
#define DASHARO_ME_MODE_DISABLE_HAP 2

#define DASHARO_OPTION_ROM_POLICY_DISABLE_ALL 0
#define DASHARO_OPTION_ROM_POLICY_ENABLE_ALL 1
#define DASHARO_OPTION_ROM_POLICY_VGA_ONLY 2

#define DASHARO_SLEEP_TYPE_S0IX 0
#define DASHARO_SLEEP_TYPE_S3 1

#define DASHARO_POWER_FAILURE_STATE_OFF 0
#define DASHARO_POWER_FAILURE_STATE_ON 1
#define DASHARO_POWER_FAILURE_STATE_KEEP 2
#define DASHARO_POWER_FAILURE_STATE_HIDDEN 0xff

// The values aren't random, they match FSP_M_CONFIG::SpdProfileSelected
#define DASHARO_MEMORY_PROFILE_JEDEC 0
#define DASHARO_MEMORY_PROFILE_XMP1 2
#define DASHARO_MEMORY_PROFILE_XMP2 3
#define DASHARO_MEMORY_PROFILE_XMP3 4

//
// Structures describing format of some of the above EFI variables. Must be
// packed.
//

#pragma pack(push,1)

typedef struct {
BOOLEAN WatchdogEnable;
UINT16 WatchdogTimeout;
} DASHARO_WATCHDOG_CONFIG;

typedef struct {
BOOLEAN IommuEnable;
BOOLEAN IommuHandoff;
} DASHARO_IOMMU_CONFIG;

typedef struct {
UINT8 StartThreshold;
UINT8 StopThreshold;
} DASHARO_BATTERY_CONFIG;

#pragma pack(pop)

#endif
109 changes: 50 additions & 59 deletions Library/DasharoSystemFeaturesUiLib/DasharoSystemFeaturesHii.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,6 @@ SPDX-License-Identifier: BSD-2-Clause

#define DASHARO_FEATURES_DATA_VARSTORE_ID 0x0001

#pragma pack(push,1)
typedef struct {
BOOLEAN WatchdogEnable;
UINT16 WatchdogTimeout;
} WATCHDOG_CONFIG;

typedef struct {
BOOLEAN IommuEnable;
BOOLEAN IommuHandoff;
} IOMMU_CONFIG;

typedef struct {
UINT8 StartThreshold;
UINT8 StopThreshold;
} BATTERY_CONFIG;
#pragma pack(pop)

#define FAN_CURVE_OPTION_SILENT 0
#define FAN_CURVE_OPTION_PERFORMANCE 1

typedef struct {
// Feature visibility
BOOLEAN ShowSecurityMenu;
Expand Down Expand Up @@ -74,55 +54,66 @@ typedef struct {
BOOLEAN S3SupportExperimental;
BOOLEAN Have2ndUart;
BOOLEAN ShowCpuThrottlingThreshold;

// Feature data
BOOLEAN LockBios;
BOOLEAN SmmBwp;
BOOLEAN NetworkBoot;
BOOLEAN UsbStack;
BOOLEAN UsbMassStorage;
UINT8 MeMode;
BOOLEAN Ps2Controller;
WATCHDOG_CONFIG WatchdogConfig;
BOOLEAN WatchdogAvailable;
UINT8 FanCurveOption;
IOMMU_CONFIG IommuConfig;
BOOLEAN BootManagerEnabled;
UINT8 SleepType;
UINT8 PowerFailureState;
BOOLEAN ResizeableBarsEnabled;
UINT8 OptionRomExecution;
BOOLEAN EnableCamera;
BOOLEAN EnableWifiBt;
BATTERY_CONFIG BatteryConfig;
UINT8 MemoryProfile;
BOOLEAN SerialPortRedirection;
BOOLEAN SerialPort2Redirection;
UINT8 CpuThrottlingThreshold;
UINT8 CpuMaxTemperature;
UINT8 CpuMinThrottlingThreshold;
BOOLEAN LockBios;
BOOLEAN SmmBwp;
BOOLEAN NetworkBoot;
BOOLEAN UsbStack;
BOOLEAN UsbMassStorage;
UINT8 MeMode;
BOOLEAN Ps2Controller;
DASHARO_WATCHDOG_CONFIG WatchdogConfig;
BOOLEAN WatchdogAvailable;
UINT8 FanCurveOption;
DASHARO_IOMMU_CONFIG IommuConfig;
BOOLEAN BootManagerEnabled;
UINT8 SleepType;
UINT8 PowerFailureState;
BOOLEAN ResizeableBarsEnabled;
UINT8 OptionRomExecution;
BOOLEAN EnableCamera;
BOOLEAN EnableWifiBt;
DASHARO_BATTERY_CONFIG BatteryConfig;
UINT8 MemoryProfile;
BOOLEAN SerialPortRedirection;
BOOLEAN SerialPort2Redirection;
UINT8 CpuThrottlingThreshold;
UINT8 CpuMaxTemperature;
UINT8 CpuMinThrottlingThreshold;
} DASHARO_FEATURES_DATA;

#define ME_MODE_ENABLE 0
#define ME_MODE_DISABLE_HECI 1
#define ME_MODE_DISABLE_HAP 2
//
// DasharoOptions.h can be included by files unrelated to Dasharo in which case
// it's useful to indicate where they came from.
//
// HII code, however, is already specific to Dasharo and there is no need to
// have extra 8 characters here.
//

#define FAN_CURVE_OPTION_SILENT DASHARO_FAN_CURVE_OPTION_SILENT
#define FAN_CURVE_OPTION_PERFORMANCE DASHARO_FAN_CURVE_OPTION_PERFORMANCE

#define ME_MODE_ENABLE DASHARO_ME_MODE_ENABLE
#define ME_MODE_DISABLE_HECI DASHARO_ME_MODE_DISABLE_HECI
#define ME_MODE_DISABLE_HAP DASHARO_ME_MODE_DISABLE_HAP

#define OPTION_ROM_POLICY_DISABLE_ALL DASHARO_OPTION_ROM_POLICY_DISABLE_ALL
#define OPTION_ROM_POLICY_ENABLE_ALL DASHARO_OPTION_ROM_POLICY_ENABLE_ALL
#define OPTION_ROM_POLICY_VGA_ONLY DASHARO_OPTION_ROM_POLICY_VGA_ONLY

#define SLEEP_TYPE_S0IX 0
#define SLEEP_TYPE_S3 1
#define SLEEP_TYPE_S0IX DASHARO_SLEEP_TYPE_S0IX
#define SLEEP_TYPE_S3 DASHARO_SLEEP_TYPE_S3

#define POWER_FAILURE_STATE_OFF 0
#define POWER_FAILURE_STATE_ON 1
#define POWER_FAILURE_STATE_KEEP 2
#define POWER_FAILURE_STATE_HIDDEN 0xff
#define POWER_FAILURE_STATE_OFF DASHARO_POWER_FAILURE_STATE_OFF
#define POWER_FAILURE_STATE_ON DASHARO_POWER_FAILURE_STATE_ON
#define POWER_FAILURE_STATE_KEEP DASHARO_POWER_FAILURE_STATE_KEEP
#define POWER_FAILURE_STATE_HIDDEN DASHARO_POWER_FAILURE_STATE_HIDDEN

// Values aren't random, they match FSP_M_CONFIG::SpdProfileSelected
#define MEMORY_PROFILE_JEDEC 0
#define MEMORY_PROFILE_XMP1 2
#define MEMORY_PROFILE_XMP2 3
#define MEMORY_PROFILE_XMP3 4
#define MEMORY_PROFILE_JEDEC DASHARO_MEMORY_PROFILE_JEDEC
#define MEMORY_PROFILE_XMP1 DASHARO_MEMORY_PROFILE_XMP1
#define MEMORY_PROFILE_XMP2 DASHARO_MEMORY_PROFILE_XMP2
#define MEMORY_PROFILE_XMP3 DASHARO_MEMORY_PROFILE_XMP3

#define NETWORK_BOOT_QUESTION_ID 0x8000
#define WATCHDOG_ENABLE_QUESTION_ID 0x8001
Expand Down

0 comments on commit 1acd954

Please sign in to comment.