public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Change default Setup variable in MinnowBoard (for setting eMMCBootMode)
@ 2018-03-26 11:28 David Beamonte Arbues
  0 siblings, 0 replies; only message in thread
From: David Beamonte Arbues @ 2018-03-26 11:28 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Hello,

I am working with a self-designed board based on MinnowBard-Max reference board and I would like to change some default boot behaviour.

I am specifically trying to change the value of Setup.eMMCBootMode (which is defined in SouthClusterConfig.vfi) from the default value 0 (auto detect) to 3 (eMMC 4.5), but the problem that I find is more general.

Changing DEFAULT flag definition in the .vfi file as shown below doesn't work. When recompiling and booting, the value in the menu is always 0 (auto-detect) no matter which default value I set.

                ...
  oneof varid   = Setup.eMMCBootMode,
    prompt      = STRING_TOKEN(STR_EMMC_BOOT_PROMPT),
    help        = STRING_TOKEN(STR_EMMC_BOOT_HELP),
    option text = STRING_TOKEN(STR_DISABLE), value=0, flags=RESET_REQUIRED;
    option text = STRING_TOKEN(STR_AUTO_DETECT), value=1, flags=RESET_REQUIRED;
    option text = STRING_TOKEN(STR_EMMC_BOOT_41), value=2, flags=RESET_REQUIRED;
    option text = STRING_TOKEN(STR_EMMC_BOOT_45), value=3, flags=DEFAULT | MANUFACTURING | RESET_REQUIRED;
  endoneof;
                ...

I have verified that after flashing a new BIOS, the default value is set (previous manual configurations are erased), so it means somewhere in the code, the Setup variable is being built with that default value. If I add debug messages anywhere in the code, I see that eMMCBootCode is always 0.

Another solution that I have tried is to add new fields to SYSTEM_CONFIGURATION structure.

  ...
  UINT8   SdCardRemovable; // ACPI reporting MMC/SD media as: removable/non-removable
  UINT8   GpioWakeCapability;
  UINT8   RtcBattery;
  UINT8   LpeAudioReportedByDSDT;

  UINT8   new_field1;
  UINT8   new_field2;
  UINT8   new_field3;
  UINT8   new_field4;
} SYSTEM_CONFIGURATION;
#pragma pack()
...

The problem with this modification is that the condition VariableSize != sizeof(SYSTEM_CONFIGURATION) always fails so I get an Assert. Below it's shown a place where this condition is checked (extract from PlatformEarlyInit.c).

  //


  // Use normal setup default from NVRAM variable,


  // the Platform Mode (manufacturing/safe/normal) is handle in PeiGetVariable.


  //


  VariableSize = sizeof(SYSTEM_CONFIGURATION);


  Status = Variable->GetVariable (


                       Variable,


                       L"Setup",


                       &gEfiSetupVariableGuid,


                       NULL,


                       &VariableSize,


                       SystemConfiguration


                       );


  if (EFI_ERROR (Status) || VariableSize != sizeof(SYSTEM_CONFIGURATION)) {


   //The setup variable is corrupted


    VariableSize = sizeof(SYSTEM_CONFIGURATION);


    Status = Variable->GetVariable(


              Variable,


              L"SetupRecovery",


              &gEfiSetupVariableGuid,


              NULL,


              &VariableSize,


              SystemConfiguration


              );


    ASSERT_EFI_ERROR (Status);


  }


The condition fails because VariableSize still reflects the original length of SYSTEM_CONFIGURATION whereas sizeof(SYSTEM_CONFIGURATION) shows the new value (4 bytes more) with the fields added. This brings me to the conclusion that there is some other place in the code where the variable "Setup" is initialized and it is using another copy of the structure.

I would like to know:

  *   if it is possible to change the default value of the "Setup" variable and the place to do so
  *   if it is possible to add new fields to the "Setup" variable and how to do it

Thanks in advance,
David



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-26 11:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-26 11:28 Change default Setup variable in MinnowBoard (for setting eMMCBootMode) David Beamonte Arbues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox