1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-19 15:33:56 +00:00

loader.efi style(9) cleanup

Submitted by:	smh
This commit is contained in:
Ed Maste 2016-01-06 19:18:43 +00:00
parent c82e181b74
commit f548a62da9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=293245

View File

@ -227,50 +227,47 @@ command_memmap(int argc, char *argv[])
status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver);
if (status != EFI_BUFFER_TOO_SMALL) {
printf("Can't determine memory map size\n");
return CMD_ERROR;
return (CMD_ERROR);
}
map = malloc(sz);
status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver);
if (EFI_ERROR(status)) {
printf("Can't read memory map\n");
return CMD_ERROR;
return (CMD_ERROR);
}
ndesc = sz / dsz;
printf("%23s %12s %12s %8s %4s\n",
"Type", "Physical", "Virtual", "#Pages", "Attr");
"Type", "Physical", "Virtual", "#Pages", "Attr");
for (i = 0, p = map; i < ndesc;
i++, p = NextMemoryDescriptor(p, dsz)) {
printf("%23s %012lx %012lx %08lx ",
types[p->Type],
p->PhysicalStart,
p->VirtualStart,
p->NumberOfPages);
if (p->Attribute & EFI_MEMORY_UC)
printf("UC ");
if (p->Attribute & EFI_MEMORY_WC)
printf("WC ");
if (p->Attribute & EFI_MEMORY_WT)
printf("WT ");
if (p->Attribute & EFI_MEMORY_WB)
printf("WB ");
if (p->Attribute & EFI_MEMORY_UCE)
printf("UCE ");
if (p->Attribute & EFI_MEMORY_WP)
printf("WP ");
if (p->Attribute & EFI_MEMORY_RP)
printf("RP ");
if (p->Attribute & EFI_MEMORY_XP)
printf("XP ");
printf("\n");
printf("%23s %012lx %012lx %08lx ", types[p->Type],
p->PhysicalStart, p->VirtualStart, p->NumberOfPages);
if (p->Attribute & EFI_MEMORY_UC)
printf("UC ");
if (p->Attribute & EFI_MEMORY_WC)
printf("WC ");
if (p->Attribute & EFI_MEMORY_WT)
printf("WT ");
if (p->Attribute & EFI_MEMORY_WB)
printf("WB ");
if (p->Attribute & EFI_MEMORY_UCE)
printf("UCE ");
if (p->Attribute & EFI_MEMORY_WP)
printf("WP ");
if (p->Attribute & EFI_MEMORY_RP)
printf("RP ");
if (p->Attribute & EFI_MEMORY_XP)
printf("XP ");
printf("\n");
}
return CMD_OK;
return (CMD_OK);
}
COMMAND_SET(configuration, "configuration",
"print configuration tables", command_configuration);
COMMAND_SET(configuration, "configuration", "print configuration tables",
command_configuration);
static const char *
guid_to_string(EFI_GUID *guid)
@ -318,7 +315,7 @@ command_configuration(int argc, char *argv[])
printf(" at %p\n", ST->ConfigurationTable[i].VendorTable);
}
return CMD_OK;
return (CMD_OK);
}
@ -395,20 +392,17 @@ command_nvram(int argc, char *argv[])
status = RS->GetNextVariableName(&varsz, NULL, NULL);
for (; status != EFI_NOT_FOUND; ) {
status = RS->GetNextVariableName(&varsz, var,
&varguid);
status = RS->GetNextVariableName(&varsz, var, &varguid);
//if (EFI_ERROR(status))
//break;
conout->OutputString(conout, var);
printf("=");
datasz = 0;
status = RS->GetVariable(var, &varguid, NULL, &datasz,
NULL);
status = RS->GetVariable(var, &varguid, NULL, &datasz, NULL);
/* XXX: check status */
data = malloc(datasz);
status = RS->GetVariable(var, &varguid, NULL, &datasz,
data);
status = RS->GetVariable(var, &varguid, NULL, &datasz, data);
if (EFI_ERROR(status))
printf("<error retrieving variable>");
else {