Deleted Added
sdiff udiff text old ( 318480 ) new ( 328889 )
full compact
1/*-
2 * Copyright (c) 2008-2010 Rui Paulo
3 * Copyright (c) 2006 Marcel Moolenaar
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: stable/11/sys/boot/efi/loader/main.c 318480 2017-05-18 18:39:23Z markj $");
30
31#include <sys/param.h>
32#include <sys/reboot.h>
33#include <sys/boot.h>
34#include <inttypes.h>
35#include <stand.h>
36#include <string.h>
37#include <setjmp.h>

--- 460 unchanged lines hidden (view full) ---

498command_memmap(int argc, char *argv[])
499{
500 UINTN sz;
501 EFI_MEMORY_DESCRIPTOR *map, *p;
502 UINTN key, dsz;
503 UINT32 dver;
504 EFI_STATUS status;
505 int i, ndesc;
506 static char *types[] = {
507 "Reserved",
508 "LoaderCode",
509 "LoaderData",
510 "BootServicesCode",
511 "BootServicesData",
512 "RuntimeServicesCode",
513 "RuntimeServicesData",

--- 15 unchanged lines hidden (view full) ---

529 map = malloc(sz);
530 status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver);
531 if (EFI_ERROR(status)) {
532 printf("Can't read memory map\n");
533 return (CMD_ERROR);
534 }
535
536 ndesc = sz / dsz;
537 printf("%23s %12s %12s %8s %4s\n",
538 "Type", "Physical", "Virtual", "#Pages", "Attr");
539
540 for (i = 0, p = map; i < ndesc;
541 i++, p = NextMemoryDescriptor(p, dsz)) {
542 printf("%23s %012jx %012jx %08jx ", types[p->Type],
543 (uintmax_t)p->PhysicalStart, (uintmax_t)p->VirtualStart,
544 (uintmax_t)p->NumberOfPages);
545 if (p->Attribute & EFI_MEMORY_UC)
546 printf("UC ");
547 if (p->Attribute & EFI_MEMORY_WC)
548 printf("WC ");
549 if (p->Attribute & EFI_MEMORY_WT)
550 printf("WT ");
551 if (p->Attribute & EFI_MEMORY_WB)
552 printf("WB ");
553 if (p->Attribute & EFI_MEMORY_UCE)
554 printf("UCE ");
555 if (p->Attribute & EFI_MEMORY_WP)
556 printf("WP ");
557 if (p->Attribute & EFI_MEMORY_RP)
558 printf("RP ");
559 if (p->Attribute & EFI_MEMORY_XP)
560 printf("XP ");
561 printf("\n");
562 }
563
564 return (CMD_OK);
565}
566
567COMMAND_SET(configuration, "configuration", "print configuration tables",
568 command_configuration);
569
570static const char *
571guid_to_string(EFI_GUID *guid)

--- 5 unchanged lines hidden (view full) ---

577 guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
578 guid->Data4[5], guid->Data4[6], guid->Data4[7]);
579 return (buf);
580}
581
582static int
583command_configuration(int argc, char *argv[])
584{
585 UINTN i;
586
587 printf("NumberOfTableEntries=%lu\n",
588 (unsigned long)ST->NumberOfTableEntries);
589 for (i = 0; i < ST->NumberOfTableEntries; i++) {
590 EFI_GUID *guid;
591
592 printf(" ");
593 guid = &ST->ConfigurationTable[i].VendorGuid;
594 if (!memcmp(guid, &mps, sizeof(EFI_GUID)))
595 printf("MPS Table");
596 else if (!memcmp(guid, &acpi, sizeof(EFI_GUID)))

--- 9 unchanged lines hidden (view full) ---

606 else if (!memcmp(guid, &memtype, sizeof(EFI_GUID)))
607 printf("Memory Type Information Table");
608 else if (!memcmp(guid, &debugimg, sizeof(EFI_GUID)))
609 printf("Debug Image Info Table");
610 else if (!memcmp(guid, &fdtdtb, sizeof(EFI_GUID)))
611 printf("FDT Table");
612 else
613 printf("Unknown Table (%s)", guid_to_string(guid));
614 printf(" at %p\n", ST->ConfigurationTable[i].VendorTable);
615 }
616
617 return (CMD_OK);
618}
619
620
621COMMAND_SET(mode, "mode", "change or display EFI text modes", command_mode);
622
623static int
624command_mode(int argc, char *argv[])

--- 415 unchanged lines hidden ---