Re: Help on UEFI variables

Laszlo Ersek

On 08/17/20 17:00, wrote:
Good days to everybody,

I'm working on a user-space driver that uses UEFI for storing some driver specific variables.
Why do you use UEFI variables for storing data related to a user-space
component? If the use case has nothing to do with UEFI (or firmware in
general), then UEFI variables look like a bad fit.

Volatile UEFI variables are suitable for carrying some information from
pre-boot time (firmware components) to the OS, with no need to survive a

Non-volatile UEFI variables are persistent firmware settings. Their
storage is usually both very limited, and slow to access.

Due to the fact that this driver runs on Real-Time platform +1ms delays are unacceptable. When storing variables on UEFI, after couple hundred writes system hangs for 2-3 seconds. Which is unbearable. I'm guessing that "Variable Reclaim" is being invoked and that causes for system to hang. I had an idea to use EDKII's AllocateRuntimePool to allocate memory in UEFI then store my variable. Although, I'm not sure if that method is user-space. If anyone has an idea what causes this delay and/or has an idea to solve this problem I'm all ears.
From "Table 29. Memory Type Usage before ExitBootServices()":

EfiRuntimeServicesData -- The data portions of a loaded UEFI Runtime
Driver and the default data allocation type used by a UEFI Runtime
Driver to allocate pool memory.

From "Table 30. Memory Type Usage after ExitBootServices()":

EfiRuntimeServicesData -- The memory in this range is to be preserved by
the UEFI OS loader and OS in the working and ACPI S1–S3 states.

My idea (without knowing more) would be "use different storage".


Join to automatically receive all group messages.