acrn-config: enhance the target config

1. add misc.py to get systemd ram and root device
2. add more specify comments for arguments of functions

v1-v2:
    typo: Parser -> Parse
    some grammar check

v2-v3:
    add the message for Cx state

Tracked-On: #3602
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Terry Zou <terry.zou@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Wei Liu
2019-08-02 19:17:58 +08:00
committed by wenlingz
parent 6045a5e54c
commit b73f97aaba
13 changed files with 317 additions and 102 deletions

View File

@@ -11,8 +11,11 @@ CACHE_TYPE = {
}
def execute(cmd, reg):
"""Execute the cmd"""
def dump_cpuid_reg(cmd, reg):
"""execute the cmd of cpuid, and return the register value by reg
:param cmd: command what can be executed in shell
:param reg: register name
"""
cache_t = ''
res = parser_lib.cmd_excute(cmd)
@@ -55,7 +58,7 @@ def get_clos_info():
clos_max = 0
clos_cache = False
cmd = "cpuid -r -l 0x10"
clos_cache = execute(cmd, "ebx")
clos_cache = dump_cpuid_reg(cmd, "ebx")
if clos_cache == "L2":
cmd = "cpuid -r -l 0x10 --subleaf 2"
@@ -66,16 +69,19 @@ def get_clos_info():
parser_lib.print_yel("CLOS is not supported!")
return (clos_cache, clos_max)
clos_max = execute(cmd, "edx")
clos_max = dump_cpuid_reg(cmd, "edx")
return (clos_cache, clos_max)
def generate_info(board_info):
"""Generate clos information"""
"""Generate clos information
:param board_info: this is the file which stores the hardware board information
"""
(clos_cache, clos_max) = get_clos_info()
with open(board_info, 'a+') as board_fp:
print("\t<CLOS_INFO>", file=board_fp)
print("\tclos supported by cache:{}".format(clos_cache), file=board_fp)
print("\tclos max:{}".format(clos_max), file=board_fp)
print("\t</CLOS_INFO>\n", file=board_fp)
with open(board_info, 'a+') as config:
print("\t<CLOS_INFO>", file=config)
print("\tclos supported by cache:{}".format(clos_cache), file=config)
print("\tclos max:{}".format(clos_max), file=config)
print("\t</CLOS_INFO>\n", file=config)