Lines Matching +full:conf +full:- +full:pd

1 /*-
2 * Copyright (c) 2008-2010 Rui Paulo
6 * Copyright (c) 2016-2019 Netflix, Inc. written by M. Warner Losh
96 * in the event no currdev is found. -2 means always break, -1 means
133 status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz, 0);
136 status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz,
170 if ((EISA_ID_TO_NUM(acpi->HID) & 0xff00) == 0x300 &&
171 (acpi->HID & 0xffff) == PNP_EISA_ID_CONST) {
185 if (usb->DeviceClass == 3 && /* HID */
186 usb->DeviceSubClass == 1 && /* Boot devices */
187 usb->DeviceProtocol == 1) { /* Boot keyboards */
227 * pointer is non-null, we're a partition not a full disk
230 if (dp->pd_devsw->dv_type == DEVT_DISK) {
233 currdev.dd.d_dev = dp->pd_devsw;
234 if (dp->pd_parent == NULL) {
235 currdev.dd.d_unit = dp->pd_unit;
239 currdev.dd.d_unit = dp->pd_parent->pd_unit;
240 currdev.d_slice = dp->pd_unit;
245 set_currdev_devsw(dp->pd_devsw, dp->pd_unit);
256 stat(PATH_BOOTABLE_TOKEN, &st) == 0 || /* non-standard layout */
281 setenv("zfs-bootonce", buf, 1);
318 if (efizfs_get_guid_by_handle(pp->pd_handle, &guid))
346 #define SIZE(dp, edp) (size_t)((intptr_t)(void *)edp - (intptr_t)(void *)dp)
455 ucs2_to_utf8(fp->PathName, &kernel);
481 * Look at the passed-in boot_info, if any. If we find it then we need
488 * partition that has either /boot/defaults/loader.conf on it or
492 * a concession to buggy UEFI implementations, like u-boot, if
546 * a follow-on boot image in that boot_info, use that. In this
550 * loader.conf.
557 case BAD_CHOICE: /* specified file not found -> error */
595 dp = efiblk_get_pdinfo_by_handle(boot_img->DeviceHandle);
597 text = efi_devpath_name(dp->pd_devpath);
605 if (dp->pd_parent != NULL) {
607 dp = dp->pd_parent;
608 STAILQ_FOREACH(pp, &dp->pd_part, pd_link) {
617 text = efi_devpath_name(pp->pd_devpath);
634 if (efi_handle_lookup(boot_img->DeviceHandle, &dev, &unit, &extra) == 0) {
675 if (fail_timeout == -2) /* Always break to OK */
677 if (fail_timeout == -1) /* Never break to OK */
682 fail_timeout - (int)(now - then));
690 } while (now - then < fail_timeout);
710 * args from UCS-2 to ASCII (16 to 8 bit) as they are copied (though this
711 * method is flawed for non-ASCII characters).
746 while (length--)
764 rsdt = (ACPI_TABLE_RSDT *)(uintptr_t)rsdp->RsdtPhysicalAddress;
765 xsdt = (ACPI_TABLE_XSDT *)(uintptr_t)rsdp->XsdtPhysicalAddress;
766 if (rsdp->Revision < 2) {
773 entries = (sdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size;
776 addr = le32toh(rsdt->TableOffsetEntry[i]);
778 addr = le64toh(xsdt->TableOffsetEntry[i]);
782 if (acpi_checksum(sdp, sdp->Length)) {
784 sdp->Signature);
787 if (memcmp(sig, sdp->Signature, 4) == 0)
805 [0x0d] = "pl011", /* Arm SBSA 32-bit width */
818 static int baud[] = { 0, -1, -1, 9600, 19200, -1, 57600, 115200 };
821 return (-1);
831 return (-1);
832 return (1 << (rw - 1));
849 * the uart(4) console string. We use io == -1 to select between I/O ports and
857 int br, db, io, rs, rw, sb, xo, pv, pd;
865 dt = acpi_uart_type(spcr->InterfaceType);
867 printf("UART Type %d not known\n", spcr->InterfaceType);
872 io = -1;
873 pv = spcr->PciVendorId;
874 pd = spcr->PciDeviceId;
875 if (pv == 0xffff && pd == 0xffff) {
876 if (spcr->SerialPort.SpaceId == 1)
877 io = spcr->SerialPort.Address;
879 mm = spcr->SerialPort.Address;
880 rs = ffs(spcr->SerialPort.BitWidth) - 4;
881 rw = acpi_uart_regionwidth(spcr->SerialPort.AccessWidth);
888 pa = acpi_uart_parity(spcr->Parity);
889 sb = spcr->StopBits;
897 if (spcr->Header.Revision <= 2)
900 xo = spcr->UartClkFreq;
903 * PreciseBaudrate, when non-zero, is to be preferred. It's only valid,
905 * old, we do the old-style table lookup. Otherwise we believe it.
907 if (spcr->Header.Revision <= 3 || spcr->PreciseBaudrate == 0)
908 br = acpi_uart_baud(spcr->BaudRate);
910 br = spcr->PreciseBaudrate;
912 if (io != -1) {
915 } else if (pv != 0xffff && pd != 0xffff) {
916 asprintf(&val, "db:%d,dt:%s,pv:%#x,pd:%#x,pa:%s,br:%d,xo=%d",
917 db, dt, pv, pd, pa, br, xo);
934 * and if we don't, we default to video. If there's a dual-console situation
991 if (EISA_ID_TO_NUM(acpi->HID) == 0x501) {
992 setenv_int("efi_8250_uid", acpi->UID);
999 setenv_int("efi_com_speed", uart->BaudRate);
1049 int fd = -1;
1059 if (fd == -1)
1099 * it here, even if the typical idium would have '- 1' here to
1112 parse_loader_efi_config(boot_img->DeviceHandle, fn);
1135 revision = rsdp->Revision;
1140 strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId));
1141 buf[sizeof(rsdp->OemId)] = '\0';
1143 sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress);
1148 (unsigned long long)rsdp->XsdtPhysicalAddress);
1150 sprintf(buf, "%d", rsdp->Length);
1183 for (k = 0; k < ST->NumberOfTableEntries; k++) {
1184 guid = &ST->ConfigurationTable[k].VendorGuid;
1190 ST->ConfigurationTable[k].VendorTable);
1192 smbios_detect(ST->ConfigurationTable[k].VendorTable);
1205 * Chicken-and-egg problem; we want to have console output early, but
1248 * args (eg -h) or via the UEFI ConOut variable.
1259 * there, which are subtly different than loader.conf variables. Only
1311 /* case VIDEO_ONLY can't happen -- it's the first if above */
1334 printf(" Image base: 0x%lx\n", (unsigned long)boot_img->ImageBase);
1335 printf(" EFI version: %d.%02d\n", ST->Hdr.Revision >> 16,
1336 ST->Hdr.Revision & 0xffff);
1337 printf(" EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor,
1338 ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
1342 text = efi_devpath_name(boot_img->FilePath);
1349 rv = OpenProtocolByHandle(boot_img->DeviceHandle, &devid,
1383 is_last = boot_order[(sz / sizeof(boot_order[0])) - 1] == boot_current;
1387 * u-boot doesn't set BootOrder, but otherwise participates in the
1422 BS->SetWatchdogTimer(0, 0, 0, NULL);
1455 COMMAND_SET(efi_seed_entropy, "efi-seed-entropy", "try to get entropy from the EFI RNG", command_seed_entropy);
1476 * size of a single Fortuna pool -- i.e. not enough to ensure
1477 * that Fortuna is safely seeded -- don't expand it since we
1485 status = BS->LocateProtocol(&rng_guid, NULL, (VOID **)&rng);
1502 TSENTER2("rng->GetRNG");
1503 status = rng->GetRNG(rng, NULL, size_efi, (UINT8 *)buf_efi);
1536 if (devsw[i]->dv_cleanup != NULL)
1537 (devsw[i]->dv_cleanup)();
1539 RS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
1553 if (devsw[i]->dv_cleanup != NULL)
1554 (devsw[i]->dv_cleanup)();
1556 RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
1576 status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver);
1582 status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver);
1600 efi_memory_type(p->Type), (uintmax_t)p->PhysicalStart,
1601 (uintmax_t)p->VirtualStart, (uintmax_t)p->NumberOfPages);
1605 if (p->Attribute & EFI_MEMORY_UC)
1607 if (p->Attribute & EFI_MEMORY_WC)
1609 if (p->Attribute & EFI_MEMORY_WT)
1611 if (p->Attribute & EFI_MEMORY_WB)
1613 if (p->Attribute & EFI_MEMORY_UCE)
1615 if (p->Attribute & EFI_MEMORY_WP)
1617 if (p->Attribute & EFI_MEMORY_RP)
1619 if (p->Attribute & EFI_MEMORY_XP)
1621 if (p->Attribute & EFI_MEMORY_NV)
1623 if (p->Attribute & EFI_MEMORY_MORE_RELIABLE)
1625 if (p->Attribute & EFI_MEMORY_RO)
1645 (unsigned long)ST->NumberOfTableEntries);
1647 for (i = 0; i < ST->NumberOfTableEntries; i++) {
1651 guid = &ST->ConfigurationTable[i].VendorGuid;
1659 printf(" at %p\n", ST->ConfigurationTable[i].VendorTable);
1678 conout = ST->ConOut;
1686 status = conout->QueryMode(conout, mode, &cols, &rows);
1691 status = conout->SetMode(conout, mode);
1700 printf("Current mode: %d\n", conout->Mode->Mode);
1701 for (i = 0; i <= conout->Mode->MaxMode; i++) {
1702 status = conout->QueryMode(conout, i, &cols, &rows);
1751 status = BS->LocateHandle(AllHandles, NULL, NULL, &bufsz, buffer);
1762 status = BS->LocateHandle(AllHandles, NULL, NULL, &bufsz, buffer);
1781 status = BS->ProtocolsPerHandle(handle, &protocols, &nproto);
1799 BS->FreePool(protocols);
1863 if (fstat(fd, &st) < -1) {
1869 status = BS->AllocatePool(EfiLoaderCode, (UINTN)st.st_size, &buf);
1877 (void)BS->FreePool(buf);
1882 status = BS->LoadImage(FALSE, IH, NULL, buf, st.st_size, &loaderhandle);
1883 (void)BS->FreePool(buf);
1899 loaded_image->LoadOptions = argp = malloc (len);
1900 loaded_image->LoadOptionsSize = len;
1907 *(--argv) = 0;
1915 pdinfo_t *hd, *pd;
1917 switch (dev->d_dev->dv_type) {
1921 loaded_image->DeviceHandle =
1922 efizfs_get_handle_by_guid(z_dev->pool_guid);
1926 loaded_image->DeviceHandle =
1927 efi_find_handle(dev->d_dev, dev->d_unit);
1931 if (STAILQ_EMPTY(&hd->pd_part)) {
1932 loaded_image->DeviceHandle = hd->pd_handle;
1936 STAILQ_FOREACH(pd, &hd->pd_part, pd_link) {
1940 if (pd->pd_unit == (uint32_t)d_dev->d_slice) {
1941 loaded_image->DeviceHandle =
1942 pd->pd_handle;
1951 status = BS->StartImage(loaderhandle, NULL, NULL);
1954 free(loaded_image->LoadOptions);
1955 loaded_image->LoadOptions = NULL;
1956 status = BS->UnloadImage(loaded_image);
1985 rootpath[sizeof(rootpath) -1] = '\0';