[QEMU] Add GPIO fields to enable more tests
This patch added more fields in QEMU GPIO so that more CFGDATA related tests can be done on QEMU platform. Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This commit is contained in:
parent
0e0eb047e3
commit
2e9cdbf5a7
|
@ -278,6 +278,12 @@ class Board(BaseBoard):
|
|||
|
||||
return container_list
|
||||
|
||||
def GetOutputImages (self):
|
||||
# define extra images that will be copied to output folder
|
||||
img_list = ['CfgDataStitch.py',
|
||||
'CfgDataDef.yaml']
|
||||
return img_list
|
||||
|
||||
def GetImageLayout (self):
|
||||
|
||||
compress = '' if self.STAGE1B_XIP else 'Lz4'
|
||||
|
|
|
@ -43,11 +43,17 @@ template:
|
|||
- GPIORxState :
|
||||
name : GPIORxState
|
||||
type : Reserved
|
||||
length : 1b
|
||||
length : 7b
|
||||
- GPIOPADMode:
|
||||
name : PadMode
|
||||
type : EditNum, HEX, (0x00,0xFF)
|
||||
help : >
|
||||
GPIO PAD Mode.
|
||||
length : 8b
|
||||
- Reserved :
|
||||
name : Reserved
|
||||
type : Reserved
|
||||
length : 28b
|
||||
length : 14b
|
||||
- GPIODirection :
|
||||
name : Direction
|
||||
type : Combo
|
||||
|
@ -68,10 +74,21 @@ template:
|
|||
name : GPIO Pin ID
|
||||
type : Reserved
|
||||
length : 16b
|
||||
- GPIOElectricalCfg :
|
||||
name : GPIO ElectricalCfg
|
||||
type : Combo
|
||||
option : 0x0:TermDefault, 0x1:TermNone, 0x5:TermNone, 0x9:TermWpd20K, 0x13:TermWpu1K, 0x17:TermWpu2K, 0x15:TermWpu5K, 0x19:TermWpu20K, 0x1B:TermWpu1K2K, 0x1F:TermNative, 0x20:NoTolerance1v8, 0x60:Tolerance1v8
|
||||
help : >
|
||||
GPIO Electrical Configuration. Set GPIO termination and Pad Tolerance.(applicable only for some pads):-
|
||||
- TermDefault = Leave termination setting unmodified, - TermNone = None, - TermWpd5K = 5kOhm weak pull-down, - TermWpd20K = 20kOhm weak pull-down,
|
||||
- TermWpu1K = 1kOhm weak pull-up, - TermWpu2K = 2kOhm weak pull-up, - TermWpu5K = 5kOhm weak pull-up, - TermWpu20K = 20kOhm weak pull-up, - TermWpu1K2K = 1kOhm & 2kOhm weak pull-up,
|
||||
- TermNative = Native function. This setting is applicable only to some native modes,
|
||||
- NoTolerance1v8 = Disable 1.8V pad tolerance, Tolerance1v8 = Enable 1.8V pad tolerance
|
||||
length : 9b
|
||||
- Reserved :
|
||||
name : Reserved
|
||||
type : Reserved
|
||||
length : 15b
|
||||
length : 6b
|
||||
- GPIOSkip :
|
||||
name : GPIO Skip
|
||||
type : Combo
|
||||
|
|
|
@ -18,8 +18,8 @@ PLAT_NAME_CFG_DATA.PlatformName | 'QEMU_31'
|
|||
GPIO_CFG_DATA.GpioConfPad1_GPP_A1.GPIOSkip | 1
|
||||
GPIO_CFG_DATA.GpioConfPad1_GPP_A6.GPIOSkip | 1
|
||||
|
||||
GPIO_CFG_DATA.GpioConfPad0_GPP_A3 | 0xC0008003
|
||||
GPIO_CFG_DATA.GpioConfPad1_GPP_A4 | 0x20060014
|
||||
GPIO_CFG_DATA.GpioConfPad0_GPP_A3 | 0x40000801
|
||||
GPIO_CFG_DATA.GpioConfPad1_GPP_A4 | 0x00050014
|
||||
|
||||
MEMORY_CFG_DATA.MemTest2 | 0x11112222
|
||||
SILICON_CFG_DATA.SiliconTest1 | 0x22223333
|
||||
|
|
|
@ -78,11 +78,11 @@
|
|||
value : 0
|
||||
|
||||
- !expand { GPIO_TMPL : [ GPP_A0 , 0x00000000, 0x00000010 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A1 , 0x40000001, 0x00000011 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A2 , 0x80000002, 0x00000012 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A3 , 0xC0000003, 0x00000013 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A4 , 0x01000004, 0x00000014 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A5 , 0x41000005, 0x00000015 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A6 , 0x81000006, 0x00000016 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A7 , 0xC1000007, 0x00000017 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A1 , 0x40000101, 0x00000011 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A2 , 0x80000201, 0x00000012 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A3 , 0xC0000301, 0x00000013 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A4 , 0x00000400, 0x00000014 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A5 , 0x40000500, 0x00000015 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A6 , 0x80000601, 0x00000016 ] }
|
||||
- !expand { GPIO_TMPL : [ GPP_A7 , 0xC0000700, 0x00000017 ] }
|
||||
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
#!/usr/bin/env python
|
||||
## @ cfgdate_update.py
|
||||
#
|
||||
# Test CFGDATA update for SBL image post build.
|
||||
#
|
||||
# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
from test_base import *
|
||||
|
||||
def get_check_lines ():
|
||||
lines = [
|
||||
"===== Intel Slim Bootloader STAGE1A =====",
|
||||
"===== Intel Slim Bootloader STAGE1B =====",
|
||||
"===== Intel Slim Bootloader STAGE2 ======",
|
||||
"Universal Payload UEFI",
|
||||
"Jump to payload",
|
||||
"[Bds]Booting UEFI Shell",
|
||||
"any other key to continue.",
|
||||
]
|
||||
return lines
|
||||
|
||||
def usage():
|
||||
print("usage:\n python %s bios_image os_image_dir\n" % sys.argv[0])
|
||||
print(" bios_image : QEMU Slim Bootloader firmware image.")
|
||||
print(" This image can be generated through the normal Slim Bootloader build process.")
|
||||
print(" out_dir : Directory for output.")
|
||||
print("")
|
||||
|
||||
|
||||
def main():
|
||||
if sys.version_info.major < 3:
|
||||
print ("This script needs Python3 !")
|
||||
return -1
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
usage()
|
||||
return -2
|
||||
|
||||
bios_img = sys.argv[1]
|
||||
img_dir = sys.argv[2]
|
||||
|
||||
print("Universal UEFI payload boot test for Slim BootLoader")
|
||||
|
||||
tmp_dir = os.path.dirname(os_dir) + '/temp'
|
||||
create_dirs ([tmp_dir, os_dir])
|
||||
|
||||
# download and unzip UEFI payload image
|
||||
local_file = tmp_dir + '/UefiUpld.zip'
|
||||
download_url (
|
||||
'https://github.com/slimbootloader/slimbootloader/files/7317829/UefiUpld.zip',
|
||||
local_file
|
||||
)
|
||||
unzip_file (local_file, tmp_dir)
|
||||
|
||||
# Create new EPAYLOAD and replace it in SlimBootloader.bin
|
||||
layout = ',\n'.join ([
|
||||
"( 'EPLD', 'EPAYLOAD.bin' , 'NORMAL' , 'RSA3072_PSS_SHA2_384' , 'KEY_ID_CONTAINER_RSA3072' , 0x10 , 0 , 0x0 )",
|
||||
"( 'UEFI', 'UefiUpld.elf' , 'Lzma' , 'SHA2_384' , '' , 0x10 , 0 , 0x0 )"
|
||||
])
|
||||
gen_file_from_object (tmp_dir + '/epld.txt', layout, '')
|
||||
sbl_dir = os.getcwd()
|
||||
os.environ['SBL_KEY_DIR'] = os.path.join (sbl_dir, '..', 'SblKeys')
|
||||
os.chdir (tmp_dir)
|
||||
cmds = [sys.executable, sbl_dir + '/BootloaderCorePkg/Tools/GenContainer.py', 'create', '-l', 'epld.txt', '-td', get_tool_dir(sbl_dir)]
|
||||
run_process (cmds)
|
||||
cmds = [sys.executable, sbl_dir + '/BootloaderCorePkg/Tools/IfwiUtility.py', 'replace', '-i', os.path.join(sbl_dir, bios_img), '-f', 'EPAYLOAD.bin', '-p', 'IFWI/BIOS/NRD/EPLD']
|
||||
run_process (cmds)
|
||||
os.chdir (sbl_dir)
|
||||
|
||||
# run QEMU boot with timeout
|
||||
output = []
|
||||
lines = run_qemu(bios_img, os_dir, boot_order = 'ba', timeout = 8)
|
||||
output.extend(lines)
|
||||
|
||||
# check test result
|
||||
ret = check_result (output, get_check_lines())
|
||||
|
||||
print ('UEFI Universal Payload boot test %s !\n' % ('PASSED' if ret == 0 else 'FAILED'))
|
||||
|
||||
return ret
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
Loading…
Reference in New Issue