efi: Print ISA-specific and unknown memory attributes
The attribute mnemonic table did not cover EFI_MEMORY_ISA_VALID and the EFI_MEMORY_ISA_MASK field, and attribute bits without a mnemonic were silently dropped, so a memory map carrying ISA-specific, invalid or not yet known attributes displayed incomplete information without any hint that something was missing. Add a mnemonic for EFI_MEMORY_ISA_VALID and print the ISA-specific field as ISA=<value> when it is valid, instead of decoding bits whose meaning U-Boot cannot know. Any remaining bits that match neither the mnemonic table nor the ISA field are printed as a hexadecimal value. Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
This commit is contained in:
committed by
Heinrich Schuchardt
parent
6abd738e20
commit
e394b1e848
+18
-2
@@ -58,6 +58,7 @@ static const struct efi_mem_attrs {
|
||||
{EFI_MEMORY_SP, "SP"},
|
||||
{EFI_MEMORY_CPU_CRYPTO, "CRYPT"},
|
||||
{EFI_MEMORY_HOT_PLUGGABLE, "HOTPL"},
|
||||
{EFI_MEMORY_ISA_VALID, "ISA_VALID"},
|
||||
{EFI_MEMORY_RUNTIME, "RT"},
|
||||
};
|
||||
|
||||
@@ -91,13 +92,16 @@ static const char *efi_mem_type_name(u32 type)
|
||||
* efi_print_mem_attrs() - print the names of set EFI memory attributes
|
||||
*
|
||||
* Prints the set attribute bits as a '|'-separated list of mnemonics,
|
||||
* e.g. ' UC|WB|RT', preceded by a space. Prints nothing if no known
|
||||
* attribute bit is set.
|
||||
* e.g. ' UC|WB|RT', preceded by a space. When EFI_MEMORY_ISA_VALID is
|
||||
* set, the EFI_MEMORY_ISA_MASK field is printed as ISA=<value>. Bits
|
||||
* that have no mnemonic are printed as a hexadecimal value so that
|
||||
* invalid or not yet known attributes are never dropped silently.
|
||||
*
|
||||
* @attributes: memory attributes (EFI_MEMORY_...)
|
||||
*/
|
||||
static void efi_print_mem_attrs(u64 attributes)
|
||||
{
|
||||
u64 unknown = attributes;
|
||||
int sep, i;
|
||||
|
||||
for (sep = 0, i = 0; i < ARRAY_SIZE(efi_mem_attrs); i++)
|
||||
@@ -109,7 +113,19 @@ static void efi_print_mem_attrs(u64 attributes)
|
||||
sep = 1;
|
||||
}
|
||||
puts(efi_mem_attrs[i].text);
|
||||
unknown &= ~efi_mem_attrs[i].bit;
|
||||
}
|
||||
|
||||
if (attributes & EFI_MEMORY_ISA_VALID) {
|
||||
printf("%sISA=0x%llx", sep ? "|" : " ",
|
||||
(attributes & EFI_MEMORY_ISA_MASK) >>
|
||||
EFI_MEMORY_ISA_SHIFT);
|
||||
sep = 1;
|
||||
unknown &= ~EFI_MEMORY_ISA_MASK;
|
||||
}
|
||||
|
||||
if (unknown)
|
||||
printf("%s0x%llx", sep ? "|" : " ", unknown);
|
||||
}
|
||||
|
||||
void efi_show_memmap(struct efi_mem_desc *map, efi_uintn_t map_size,
|
||||
|
||||
@@ -45,7 +45,10 @@ Start, End
|
||||
|
||||
Attributes
|
||||
The attributes of the region as a '|'-separated list of mnemonics,
|
||||
e.g. UC for EFI_MEMORY_UC and RT for EFI_MEMORY_RUNTIME.
|
||||
e.g. UC for EFI_MEMORY_UC and RT for EFI_MEMORY_RUNTIME. When the
|
||||
region carries ISA-specific attributes (EFI_MEMORY_ISA_VALID is set),
|
||||
the ISA-specific field is shown as ISA=<value>. Attribute bits without
|
||||
a mnemonic are shown as a hexadecimal value.
|
||||
|
||||
efi tables
|
||||
~~~~~~~~~~
|
||||
|
||||
+6
-1
@@ -268,6 +268,9 @@ enum efi_memory_type {
|
||||
#define EFI_MEMORY_CPU_CRYPTO ((u64)0x0000000000080000ULL) /* cryptographically protectable */
|
||||
#define EFI_MEMORY_HOT_PLUGGABLE \
|
||||
((u64)0x0000000000100000ULL) /* hot pluggable */
|
||||
#define EFI_MEMORY_ISA_MASK ((u64)0x0FFFF00000000000ULL) /* ISA-specific attributes */
|
||||
#define EFI_MEMORY_ISA_SHIFT 44
|
||||
#define EFI_MEMORY_ISA_VALID ((u64)0x4000000000000000ULL) /* ISA_MASK field is valid */
|
||||
#define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL) /* range requires runtime mapping */
|
||||
#define EFI_MEM_DESC_VERSION 1
|
||||
|
||||
@@ -686,7 +689,9 @@ void efi_show_tables(struct efi_system_table *systab);
|
||||
*
|
||||
* Prints one line per descriptor with the memory type name, the physical
|
||||
* start and end address and the attributes as a '|'-separated list of
|
||||
* mnemonics.
|
||||
* mnemonics. The ISA-specific attribute field is printed as ISA=<value>
|
||||
* when EFI_MEMORY_ISA_VALID is set, and any remaining bits without a
|
||||
* mnemonic are printed as a hexadecimal value.
|
||||
*
|
||||
* The virtual addresses of the descriptors are not shown: the map is
|
||||
* identity mapped before SetVirtualAddressMap() is called, so the field
|
||||
|
||||
Reference in New Issue
Block a user