From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=213.0.25.189; helo=mx.telnet-ri.es; envelope-from=dbeamonte@telnet-ri.es; receiver=edk2-devel@lists.01.org Received: from mx.telnet-ri.es (mx.telnet-ri.es [213.0.25.189]) by ml01.01.org (Postfix) with ESMTP id DF607225E4002 for ; Mon, 26 Mar 2018 04:22:19 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mx.telnet-ri.es (Postfix) with ESMTP id 709ED1568039 for ; Mon, 26 Mar 2018 13:28:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at telnet-ri.es Received: from mx.telnet-ri.es ([127.0.0.1]) by localhost (mail.telnet-ri.es [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9R7USrVYaCOD for ; Mon, 26 Mar 2018 13:28:51 +0200 (CEST) Received: from mail.telnet-ri.es (svrcas00.telnet-ri.es [192.168.80.61]) (Authenticated sender: conector_mta@telnet-ri.es) by mx.telnet-ri.es (Postfix) with ESMTP id EF0151568037 for ; Mon, 26 Mar 2018 13:28:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.1 mx.telnet-ri.es EF0151568037 Authentication-Results: mx.telnet-ri.es; dmarc=none header.from=telnet-ri.es Authentication-Results: mx.telnet-ri.es; spf=pass smtp.mailfrom=dbeamonte@telnet-ri.es DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telnet-ri.es; s=dkim2k; t=1522063730; bh=ykMrrViuM62pl1Ke6zVkyweUlvYId4BF0zQgUGEQOPE=; h=From:To:Subject:Date; b=gPLM+MUVFVgqw0QbljZDjxvuB4/VYEBS19qDJKSQaq8pLXF4J802+txpeFs0lrb9t FkfLXcO/RSzvlZLfsmGDvzm8O/42/bX+OWhFCaP5dIljeovHo4a+hirnjQN03vMnnS s4gnrZztUkcJoJGoMH8SYWB3NIbh3Yp7eRYOfucE= Received: from SVRDAG01.telnet-ri.es ([fe80::b9a3:74cb:640e:c119]) by SVRCAS00.telnet-ri.es ([::1]) with mapi id 14.03.0352.000; Mon, 26 Mar 2018 13:28:51 +0200 From: David Beamonte Arbues To: "edk2-devel@lists.01.org" Thread-Topic: Change default Setup variable in MinnowBoard (for setting eMMCBootMode) Thread-Index: AdPE9O3lqB6l/ZagSU6sLm7+jyiGpw== Date: Mon, 26 Mar 2018 11:28:50 +0000 Message-ID: Accept-Language: es-ES, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.202.117] MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 26 Mar 2018 07:34:31 -0700 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: Change default Setup variable in MinnowBoard (for setting eMMCBootMode) X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Mar 2018 11:22:22 -0000 Content-Language: es-ES Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, I am working with a self-designed board based on MinnowBard-Max reference b= oard and I would like to change some default boot behaviour. I am specifically trying to change the value of Setup.eMMCBootMode (which i= s 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 wo= rk. When recompiling and booting, the value in the menu is always 0 (auto-d= etect) no matter which default value I set. ... oneof varid =3D Setup.eMMCBootMode, prompt =3D STRING_TOKEN(STR_EMMC_BOOT_PROMPT), help =3D STRING_TOKEN(STR_EMMC_BOOT_HELP), option text =3D STRING_TOKEN(STR_DISABLE), value=3D0, flags=3DRESET_REQ= UIRED; option text =3D STRING_TOKEN(STR_AUTO_DETECT), value=3D1, flags=3DRESET= _REQUIRED; option text =3D STRING_TOKEN(STR_EMMC_BOOT_41), value=3D2, flags=3DRESE= T_REQUIRED; option text =3D STRING_TOKEN(STR_EMMC_BOOT_45), value=3D3, flags=3DDEFA= ULT | MANUFACTURING | RESET_REQUIRED; endoneof; ... I have verified that after flashing a new BIOS, the default value is set (p= revious manual configurations are erased), so it means somewhere in the cod= e, the Setup variable is being built with that default value. If I add debu= g 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_CONFIGURA= TION 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 !=3D = sizeof(SYSTEM_CONFIGURATION) always fails so I get an Assert. Below it's sh= own 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 PeiGetVaria= ble. // VariableSize =3D sizeof(SYSTEM_CONFIGURATION); Status =3D Variable->GetVariable ( Variable, L"Setup", &gEfiSetupVariableGuid, NULL, &VariableSize, SystemConfiguration ); if (EFI_ERROR (Status) || VariableSize !=3D sizeof(SYSTEM_CONFIGURATION))= { //The setup variable is corrupted VariableSize =3D sizeof(SYSTEM_CONFIGURATION); Status =3D 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 conclusi= on 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 t= o do it Thanks in advance, David