summaryrefslogtreecommitdiffstats
path: root/ShellPkg
Commit message (Collapse)AuthorAgeFilesLines
* ShellPkg: Unload image on EFI_SECURITY_VIOLATIONDandan Bi2019-09-253-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now. This follows UEFI Spec. But if the caller of LoadImage() doesn't have the option to defer the execution of an image, we can not treat EFI_SECURITY_VIOLATION like any other LoadImage() error, we should unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly for the callers in ShellPkg which don't have the policy to defer the execution of the image. Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Philippe Mathieu-Daude <philmd@redhat.com> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1992 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* ShellPkg/ShellPkg.dsc AARCH64: enable stack protectorArd Biesheuvel2019-09-051-4/+1
| | | | | | | | | | Incorporate the stack protector library into the AARCH64 build of the Shell binaries as a NULL library resolution, to avoid build errors when the compiler injects stack integrity checks. Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ShellPkg/Pci.c: Update supported link speed to PCI5.0Gao, Zhichao2019-09-041-2/+14
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1955 Refer to PCI express base specification Reversion 5.0, Version 1.0, Table 7-33, Supported Link Speeds Vector bit 3 indicate the speed 16 GT/s and bit 4 indicate the speed 32 GT/s. Add the support to shell command 'pci ...'. Change the MaxLinkSpeed other values' result from 'Unknown' to 'Reserved' to make the result align. Cc: Ray Ni <ray.ni@intel.com> Cc: Oleksiy <oleksiyy@ami.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* ShellPkg/CommandLib: avoid NULL derefence and memory leakHeinrich Schuchardt2019-09-031-6/+14
| | | | | | | | | | | | | | | | | | | Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI variable PlatformLang is not defined due to dereferencing gUnicodeCollation gUnicodeCollation (= NULL) in ShellCommandRegisterCommandName(). Furthermore CommandInit() is leaking PlatformLang if gUnicodeCollation != NULL. Close the memory leak and use the first UnicodeCollation instance if PlatfomLang is not defined. Fixes: d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper UnicodeCollation instance") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellDriver1CommandsLib: Make array big enoughZhichao Gao2019-08-191-3/+3
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1941 The two CHAR16 array ChildCountStr and DeviceCountStr is defined to hold the decimal string data of UINTN. The max of UINTN is 18446744073709551615 and it contain 20 characters. So make their size to 21 CHAR16s to hold the string data with a null-terminate. UnicodeValueToStringS regard the value input as INT64, and 21 CHARs is enough to hold the lowest value with minus '-'. Although the value shouldn't be such big. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Oleksiy <oleksiyy@ami.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Linson Augustine <Linson.augustine@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Replace shift logical leftShenglei Zhang2019-08-191-1/+1
| | | | | | | | | | | | | Replace the operation to shift logical left with the function LShiftU64, which has the same functionality. The original code causes ShellPkg build failure with build target"-b NOOPT". Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Initialize local variablesShenglei Zhang2019-08-162-0/+18
| | | | | | | | | | | At latest edk2 version, there is build failure when building ShellPkg with VS2012x86, which results from uninitialized local variables. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Remove the variable "Index"Shenglei Zhang2019-08-151-2/+0
| | | | | | | | | | | | | In IortParser.c ,the variable Index is set but not used in function DumpIortNodeNamedComponent. This will cause build failure when building ShellPkg with GCC. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Add missing header files in INFShenglei Zhang2019-08-131-0/+2
| | | | | | | | | | | | MadtParser.h and PpttParser.h are actually used but missing INF file, which will generate warning message when building this package. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellLevel2CommansLib: Pointer Resonse should be checkedGao, Zhichao2019-08-122-2/+8
| | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2049 ShellPkg\Library\UefiShellLevel2CommandsLib\Cp.c line 104 and ShellPkg\Library\UefiShellLevel2CommandsLib\Mv.c line 640, the pointer variable Response may be a NULL pointer. So we should make sure that it isn't NULL before dereference it. If Response is NULL that indicates a EFI_OUT_OF_RESOURCES error, directly return SHELL_ABORTED. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: acpiview: SRAT: Prevent buffer overrunsKrzysztof Koch2019-08-121-1/+13
| | | | | | | | | | | | | | | | | | | Modify the SRAT parsing logic to prevent reading past the table buffer length provided. Check if the Static Resource Allocation Structure's buffer fits in the SRAT table buffer before its contents are dumped. Prevent buffer overruns when reading the Static Resource Allocation Structure's header. References: - ACPI 6.3, January 2019, Section 5.2.16 Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@inte.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: PPTT: Prevent buffer overrunsKrzysztof Koch2019-08-121-11/+27
| | | | | | | | | | | | | | | | | | | | | | | Modify the PPTT table parsing logic to prevent reading past the ACPI buffer lengths provided. Check if the Number of Private Resources specified in the Processor Hierarchy Node (Type 0) is possible given the Type 0 Structure's buffer length. Make sure that the processor topology structure's buffer fits in the PPTT table buffer before its contents are dumped. Prevent buffer overruns when reading the processor topology structure's header. References: - ACPI 6.3, January 2019, Section 5.2.29 Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@inte.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: MADT: Prevent buffer overrunsKrzysztof Koch2019-08-121-1/+1
| | | | | | | | | | Modify the parsing logic to prevent reading past the MADT table buffer length provided when parsing the Interrupt Controller Structure header. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@inte.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: IORT: Prevent buffer overrunsKrzysztof Koch2019-08-121-86/+105
| | | | | | | | | | | | | | | | | | | | | | | | Modify the IORT table parsing logic to prevent reading past the buffer lengths provided. Change DumpIortNodeIdMappings() function's signature and implementation to simplify buffer overrun prevention. Update all calls to this function accordingly. Modify the parser for each type of IORT node such that the offset from the start of the node's buffer is tracked as the parsing function is executed. Again, this change helps prevent buffer overruns. Test that the IORT node buffer fits in the table buffer before the node's buffer contents are dumped. References: - IO Remapping Table (Issue D), Platform Design Document, March 2018 Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@inte.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: GTDT: Prevent buffer overrunsKrzysztof Koch2019-08-121-73/+78
| | | | | | | | | | | | | | | | | | | | | | | | Modify the GTDT table parsing logic to prevent reading past the ACPI buffer lengths provided and to make it consistent with other table parsers. This includes converting the do-while loop in ParseAcpiGtdt() into a while loop. Remove a check which ensures that the entire Platform GT Block Structure buffer has been parsed. The ACPI specification does not ban from defining buffers which are larger than the size indicated by the count and sizes of substructures which constitute it. Change the data type of the Length parameter to the DumpGTBlock() function to reflect the width of the respective ACPI structure's field. References: - ACPI 6.3, January 2019, Table 5-124 Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@inte.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: DBG2: Prevent buffer overrunsKrzysztof Koch2019-08-121-49/+92
| | | | | | | | | | | | | | | | | | | | | | | | | Modify the DBG2 table parsing logic to prevent reading past the ACPI buffer lengths provided. Modify the signature of the DumpDbgDeviceInfo() function to make it consistent with the ACPI structure processing functions in other acpiview parsers. Now, the length of the Debug Device Information Structure is read before the entire structure is dumped. This refactoring change makes it easier to stop reading beyond the DBG2 table buffer if the Debug Device Information Structure Buffer does not fit in the DBG2 buffer. For processing the first two fields of the Debug Device Information Structure (to get the length) a new ACPI_PARSER array is defined. References: - Microsoft Debug Port Table 2 (DBG2), December 10, 2015 Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@inte.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' optionJonathan Watt2019-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | For all other bcfg commands the "#" (option number) argument(s) are treated as hexedecimal values regardless of whether or not they are prefixed by "0x". This change fixes '-opt' to handle its "#" (option number) argument consistently with the other commands. Making this change removes a potential footgun whereby a user that has been using a number without a "0x" prefix with other bcfg commands finds that, on using that exact same number with '-opt', it has this time unexpectedly been interpreted as a decimal number and they have modified (corrupted) an unrelated load option. For example, a user may have been specifying "10" to other commands to have them act on the 16th option (because simply "10", without any prefix, is how 'bcfg boot dump' displayed the option number for the 16th option). Unfortunately for them, if they also use '-opt' with "10" it would unexpectedly and inconsistently act on the 10th option. CC: Jaben Carsey <jaben.carsey@intel.com> CC: Ray Ni <ray.ni@intel.com> Signed-off-by: Jonathan Watt <jwatt@jwatt.org> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Bi Dandan <dandan.bi@intel.com>
* ShellPkg: Add shell with all commands integratedMichael D Kinney2019-08-051-1/+21
| | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1970 Update ShellPkg DSC file to build an extra version of the Shell with all commands integrated. This verifies that the shell can build in this max configuration. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Tested-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg/AcpiView: Fix IA32 link errorMichael D Kinney2019-08-051-1/+1
| | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1970 Update SLIT_ELEMENT() macro to use MultU64x64() to perform multiplication on 64-bit operands. This is required to avoid use of an intrinsic on IA32 VS20xx builds. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Tested-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validationKrzysztof Koch2019-07-311-9/+23
| | | | | | | | | | | | | | | | Move Performance Monitoring Counter Group (PMCG) node ID mapping count validation from the core IORT acpiview parser logic to a dedicated function. Now, the pointer to the validation function is passed to the IortNodePmcgParser[] ACPI_PARSER array. This check does not affect the flow of IORT parsing and is limited to a single table field in scope, therefore, it is better to keep it away from the code responsible for traversing the table. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: MADT: Split structure length validationKrzysztof Koch2019-07-311-8/+22
| | | | | | | | | | | | | | | | | | | Split the Interrupt Controller Structure length validation in the acpiview UEFI shell tool into two logical parts: 1. Ensuring MADT table parser forward progress. 2. Preventing MADT table buffer overruns. Also, make the condition for infinite loop detection applicable to all types of Interrupt Controller Structures (for all interrupt models which can be represented in MADT). Check if the controller length specified is shorter than the byte size of the first two fields ('Type' and 'Length') present in every valid Interrupt Controller Structure. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: SRAT: Minor code style enhancementsKrzysztof Koch2019-07-311-1/+2
| | | | | | | | | | Minor changes to the SRAT parser code to conform with the EDKII coding style and to make it consistent with other ACPI table parsers. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: RSDP: Make code consistent with other parsersKrzysztof Koch2019-07-311-2/+9
| | | | | | | | | | | | | | | | | List ParseAcpi() function arguments one per line in order to make this function call consistent with ParseAcpi() calls in other ACPI table parsers. Also, notify the user that XsdtAddress value of 0 results in RSDP parsing being terminated and that the XSDT table will not be processed. This effectively means that no more ACPI tables will be parsed because of this RSDP table content error. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() callKrzysztof Koch2019-07-311-14/+4
| | | | | | | | | | | | | | Remove a call to ParseAcpi() responsible for getting the XSDT table length. This call is not needed because the ACPI table buffer length is provided as an input argument to the ParseAcpiXsdt() function. Modify remaining code to use the AcpiTableLength argument of the ParseAcpiXsdt() function instead of a global static variable. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct()Krzysztof Koch2019-07-313-14/+22
| | | | | | | | | | | | | | | | | Modify the signature of the DumpGasStruct() function to include the buffer length parameter and to return the number of bytes parsed by the function. This way it becomes possible to prevent buffer overruns when dumping Generic Address Structure's (GAS) fields in the acpiview table parsers. Update all existing DumpGasStruct() calls in acpiview to add the length argument. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: DBG2: Remove redundant forward declarationsKrzysztof Koch2019-07-191-46/+16
| | | | | | | | | | | | Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: GTDT: Remove redundant forward declarationsKrzysztof Koch2019-07-191-58/+33
| | | | | | | | | | | | | | | Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Replace multple use of literal values for GT Block Timer Frame count/number validation with a macro definition. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: IORT: Remove redundant forward declarationsKrzysztof Koch2019-07-191-44/+14
| | | | | | | | | | | | Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: MADT: Remove redundant forward declarationsKrzysztof Koch2019-07-191-74/+44
| | | | | | | | | | | | Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: SRAT: Remove redundant forward declarationsKrzysztof Koch2019-07-191-46/+18
| | | | | | | | | | | | Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: SPCR: Remove redundant forward declarationKrzysztof Koch2019-07-191-59/+29
| | | | | | | | | | | Reposition blocks of code to remove redundant forward function declarations in order to reduce the code size. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: FADT: Remove redundant forward declarationsKrzysztof Koch2019-07-191-79/+34
| | | | | | | | | | | | Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: acpiview: RSDP: Remove redundant forward declarationsKrzysztof Koch2019-07-191-47/+17
| | | | | | | | | | | | Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg/Type.c: Add value check before (LoopVar - 1)Zhichao Gao2019-07-191-11/+13
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1964 If the file begin with single line Feed ('\n'), then "AsciiChar == '\n' && ((CHAR8*)Buffer)[LoopVar-1] != '\r'" would cause a underflow. Add this condition "(AsciiChar == '\n' && LoopVar == 0)" before it to make sure (LoopVar - 1) would never encounter a underflow. Same change in Unicode section. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Andrew Fish <afish@apple.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Andrew Fish <afish@apple.com>
* ShellPkg: acpiview: Make '-h' option not require a parameterKrzysztof Koch2019-07-022-31/+5
| | | | | | | | | | | | | | | Make the -h command line option a binary flag. Now, colour highlighting is enabled whenever this flag is set (stateless), instead of being dependent on previous acpiview command invocations. By removing the parameter required with the -h flag the command line parsing logic becomes simpler. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: Remove duplicate indentation in IORT parserKrzysztof Koch2019-07-021-9/+9
| | | | | | | | | | | | | | | | Remove redundant whitespace characters at the beginning of the strings describing IORT table field names. When dumping ACPI table contents, the indentation level for printing field names is controled using the 'Indent' argument to the 'ParseAcpi' function. In the IORT acpiview parser, both 'Indent' and extra whitespace characters are used for indentation, which results in excess indentation. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: Remove '-v' flag from allowed command line argsKrzysztof Koch2019-07-022-5/+1
| | | | | | | | | | | | | | | | According to the acpiview documentation, the -v flag enables verbose output and it is set on default. Moreover, the acpiview UEFI shell tool dumps the same output with and without this flag set. Therefore this patch removes the superfluous -v flag from allowed command line parameters. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: Remove redundant IORT node types enumKrzysztof Koch2019-07-021-22/+8
| | | | | | | | | | Replace the enum defining valid node types in the IORT table with macros from IoRemappingTable.h. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: Allow disabling consistency checks (-q flag)Krzysztof Koch2019-07-025-9/+65
| | | | | | | | | | | | | | | | | | | | | | The current documentation for the acpiview UEFI shell tool states that the '-c' flag enables consistency checks on ACPI table data. However, these checks are enabled anyway by default. This patch keeps ACPI table validation as a default option, but it makes it possible to turn ACPI table validation off by setting the newly-introduced '-q' flag. Consequently, the '-c' flag is removed. The remaining code changes in this patch make a number of consistency checks optional (but enabled by default): 1. ACPI table field offset mismatch. 2. ACPI table field validation functions provided in the ACPI_PARSER arrays. 3. Table checksum computation. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: Make DBG2 output consistent with other tablesKrzysztof Koch2019-07-021-1/+2
| | | | | | | | | | | | | Print an extra newline character at the end DBG2 table parsing in order to make the output resemble the one for other ACPI table parsers. With this change, there is now a blank line between the DBG2 table dump and the 'Table Statistics' section. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: Fix '\n\n' printing in Table Checksum reportingKrzysztof Koch2019-07-021-4/+4
| | | | | | | | | | | | | | Move printing double newline character ('\n\n') from the beginning of ACPI table checksum validation message to the end of the raw binary data dump. This way acpiview table dump looks similar regardless of whether Table Checksum is validated or not. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: Remove '/?' from valid command line flagsKrzysztof Koch2019-07-021-2/+1
| | | | | | | | | | | | Acpiview currently allows displaying help info by specifying both -? and /? flags. This patch removes /? from valid command line flags that can be passed to the acpiview tool, as this flag is not used for such purpose in other UEFI shell commands. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg: acpiview: Improve PPTT table field validationKrzysztof Koch2019-07-022-10/+130
| | | | | | | | | | | | | | Add Cache Structure (Type 1) 'Number of sets' and 'Associativity' field validation in the acpiview Processor Properties Topology Table (PPTT) parser. Replace literal values with precompiler macros for existing Cache Structure validation functions. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* ShellPkg/UefiShellLib: Set input pointer parameter to null if failureBret Barkelew2019-07-011-0/+5
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1906 While failed to allocate memory to save the response, set the input/output parameter 'Response'(VOID **) to NULL to indicate the failure not only depend on the returned status. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* ShellPkg: acpiview: ACPI 6.3 update for MADT parserKrzysztof Koch2019-06-172-8/+118
| | | | | | | | | | | | | | | | | | | The ACPI 6.3 specification introduces a 'SPE overflow Interrupt' field as part of the GICC structure. Update the MADT parser to decode this field and validate the interrupt ID used. References: - ACPI 6.3 Specification - January 2019 - Arm Generic Interrupt Controller Architecture Specification, GIC architecture version 3 and version 4, issue E - Arm Server Base System Architecture 5.0 Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg/Debug1CommandsLib: Fix bugs in func DisplaySysEventLogDataDandan Bi2019-06-121-6/+14
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1498 This patch fix following bugs in func DisplaySysEventLogData: 1. Log increment (Log = (LOG_RECORD_FORMAT *) (LogData + Offset);) should happened in the end of while loop, not in the very beginning. 2. DisplaySELTypes function should be used in while loop instead of DisplaySELVarDataFormatType. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg/acpiview: GTDT updates for ACPI 6.3Pierre Gondois2019-06-101-2/+4
| | | | | | | | | | | The ACPI 6.3 specification introduces support to describe the ARMv8.1 virtual EL2 timers. This patch updates the GTDT parser of acpiview to decode the EL2 virtual timer fields. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: Add NetworkPkg/NetworkPkg.dec as the package dependencyLiming Gao2019-05-214-4/+8
| | | | | | | | | | | NetLib will be moved from MdeModulePkg and NetworkPkg. So, the module that consumes NetLib need to depend on NetworkPkg.dec. Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* ShellPkg: Display VENDOR_ID in ASCII when parsing PPTTKrzysztof Koch2019-05-201-1/+1
| | | | | | | | | | | | | | The ID Type Structure (Type 2) inside the Processor Properties Topology Table (PPTT) has a VENDOR_ID field which identifies the node vendor. The approved values are listed in the ACPI ID Registry and they are meant to be interpreted as arrays of ASCII characters. This change to the acpiview parser for PPTT aims to reflect that. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Update DSC to use NetworkPkg's include fragment fileLiming Gao2019-05-191-1/+1
| | | | | | | | Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>