Lines Matching +full:reboot +full:- +full:mode

2  * Copyright (c) 2008-2010 Rui Paulo
32 #include <sys/reboot.h>
78 * in the event no currdev is found. -2 means always break, -1 means
79 * never break, 0 means poll once and then reboot, > 0 means wait for
94 if (h == img->DeviceHandle) in efi_zfs_is_preferred()
100 devpath = efi_lookup_devpath(img->DeviceHandle); in efi_zfs_is_preferred()
140 else if (start_sector == hd->PartitionStart) in efi_zfs_is_preferred()
193 if ((EISA_ID_TO_NUM(acpi->HID) & 0xff00) == in has_keyboard()
195 (acpi->HID & 0xffff) == PNP_EISA_ID_CONST) { in has_keyboard()
216 if (usb->DeviceClass == 3 && in has_keyboard()
217 usb->DeviceSubClass == 1 && in has_keyboard()
218 usb->DeviceProtocol == 1) { in has_keyboard()
276 * pointer is non-null, we're a partition not a full disk in set_currdev_pdinfo()
279 if (dp->pd_devsw->dv_type == DEVT_DISK) { in set_currdev_pdinfo()
282 currdev.dd.d_dev = dp->pd_devsw; in set_currdev_pdinfo()
283 if (dp->pd_parent == NULL) { in set_currdev_pdinfo()
284 currdev.dd.d_unit = dp->pd_unit; in set_currdev_pdinfo()
288 currdev.dd.d_unit = dp->pd_parent->pd_unit; in set_currdev_pdinfo()
289 currdev.d_slice = dp->pd_unit; in set_currdev_pdinfo()
294 set_currdev_devsw(dp->pd_devsw, dp->pd_unit); in set_currdev_pdinfo()
327 setenv("zfs-bootonce", bootonce, 1); in probe_zfs_currdev()
351 if (efizfs_get_guid_by_handle(pp->pd_handle, &guid)) in try_as_currdev()
392 dp = efiblk_get_pdinfo_by_handle(img->DeviceHandle); in find_currdev()
394 text = efi_devpath_name(dp->pd_devpath); in find_currdev()
402 if (dp->pd_parent != NULL) { in find_currdev()
403 dp = dp->pd_parent; in find_currdev()
404 STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { in find_currdev()
405 text = efi_devpath_name(pp->pd_devpath); in find_currdev()
429 if (efi_handle_lookup(img->DeviceHandle, &dev, &unit, &extra) == 0) { in find_currdev()
470 if (fail_timeout == -2) /* Always break to OK */ in interactive_interrupt()
472 if (fail_timeout == -1) /* Never break to OK */ in interactive_interrupt()
476 printf("press any key to interrupt reboot " in interactive_interrupt()
478 fail_timeout - (int)(now - then)); in interactive_interrupt()
486 } while (now - then < fail_timeout); in interactive_interrupt()
525 * non-server systems may not have serial. in parse_uefi_con_out()
542 if (EISA_ID_TO_NUM(acpi->HID) == 0x501) { in parse_uefi_con_out()
543 setenv_int("efi_8250_uid", acpi->UID); in parse_uefi_con_out()
550 setenv_int("efi_com_speed", uart->BaudRate); in parse_uefi_con_out()
611 if (EISA_ID_TO_NUM(acpi->HID) == 0x501) { in efi_serial_get_uid()
612 return (acpi->UID); in efi_serial_get_uid()
618 return (-1); in efi_serial_get_uid()
665 switch (uid - lowest) { in uefi_serial_console()
713 * XXX Chicken-and-egg problem; we want to have console output in main()
727 (void) snprintf(var, sizeof (var), "%s,8,n,1,-", s); in main()
728 if (asprintf(&name, "%s-mode", serial) > 0) { in main()
732 if (asprintf(&name, "%s-spcr-mode", serial) > 0) { in main()
758 * args from UCS-2 to ASCII (16 to 8 bit) as they are copied (though in main()
759 * this method is flawed for non-ASCII characters). in main()
762 if (argv[i][0] == '-') { in main()
814 strncat(var, ",8,n,1,-", sizeof (var)); in main()
815 setenv("ttya-mode", var, 1); in main()
868 if (devsw[i]->dv_init != NULL) in main()
869 (devsw[i]->dv_init)(); in main()
879 printf("Image base: 0x%lx\n", (unsigned long)img->ImageBase); in main()
880 printf("EFI version: %d.%02d\n", ST->Hdr.Revision >> 16, in main()
881 ST->Hdr.Revision & 0xffff); in main()
882 printf("EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor, in main()
883 ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); in main()
888 text = efi_devpath_name(img->FilePath); in main()
895 status = OpenProtocolByHandle(img->DeviceHandle, in main()
928 BS->SetWatchdogTimer(0, 0, 0, NULL); in main()
955 COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
994 while ((ch = getopt(argc, argv, "fh")) != -1) { in command_reboot()
1000 printf("Usage: reboot [-f]\n"); in command_reboot()
1012 if (devsw[i]->dv_cleanup != NULL) in command_reboot()
1013 (devsw[i]->dv_cleanup)(); in command_reboot()
1015 RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); in command_reboot()
1029 if (devsw[i]->dv_cleanup != NULL) in command_poweroff()
1030 (devsw[i]->dv_cleanup)(); in command_poweroff()
1032 RS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); in command_poweroff()
1053 status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver); in command_memmap()
1059 status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver); in command_memmap()
1078 efi_memory_type(p->Type), p->PhysicalStart, in command_memmap()
1079 p->VirtualStart, p->NumberOfPages); in command_memmap()
1084 if (p->Attribute & EFI_MEMORY_UC) in command_memmap()
1086 if (p->Attribute & EFI_MEMORY_WC) in command_memmap()
1088 if (p->Attribute & EFI_MEMORY_WT) in command_memmap()
1090 if (p->Attribute & EFI_MEMORY_WB) in command_memmap()
1092 if (p->Attribute & EFI_MEMORY_UCE) in command_memmap()
1094 if (p->Attribute & EFI_MEMORY_WP) in command_memmap()
1096 if (p->Attribute & EFI_MEMORY_RP) in command_memmap()
1098 if (p->Attribute & EFI_MEMORY_XP) in command_memmap()
1100 if (p->Attribute & EFI_MEMORY_NV) in command_memmap()
1102 if (p->Attribute & EFI_MEMORY_MORE_RELIABLE) in command_memmap()
1104 if (p->Attribute & EFI_MEMORY_RO) in command_memmap()
1125 (unsigned long)ST->NumberOfTableEntries); in command_configuration()
1126 for (i = 0; i < ST->NumberOfTableEntries; i++) { in command_configuration()
1130 guid = &ST->ConfigurationTable[i].VendorGuid; in command_configuration()
1138 printf(" at %p\n", ST->ConfigurationTable[i].VendorTable); in command_configuration()
1145 COMMAND_SET(mode, "mode", "change or display EFI text modes", command_mode);
1151 unsigned int mode; in command_mode() local
1163 conout = ST->ConOut; in command_mode()
1166 mode = strtol(argv[1], &cp, 0); in command_mode()
1168 printf("Invalid mode\n"); in command_mode()
1171 status = conout->QueryMode(conout, mode, &cols, &rows); in command_mode()
1173 printf("invalid mode %d\n", mode); in command_mode()
1176 status = conout->SetMode(conout, mode); in command_mode()
1178 printf("couldn't set mode %d\n", mode); in command_mode()
1185 printf("Current mode: %d\n", conout->Mode->Mode); in command_mode()
1186 for (i = 0; i <= conout->Mode->MaxMode; i++) { in command_mode()
1187 status = conout->QueryMode(conout, i, &cols, &rows); in command_mode()
1190 printf("Mode %d: %u columns, %u rows\n", i, (unsigned)cols, in command_mode()
1195 printf("Select a mode with the command \"mode <number>\"\n"); in command_mode()
1212 status = BS->LocateHandle(AllHandles, NULL, NULL, &bufsz, buffer); in command_lsefi()
1223 status = BS->LocateHandle(AllHandles, NULL, NULL, &bufsz, buffer); in command_lsefi()
1257 status = BS->ProtocolsPerHandle(handle, &protocols, &nproto); in command_lsefi()
1275 BS->FreePool(protocols); in command_lsefi()
1329 if (fstat(fd, &st) < -1) { in command_chain()
1335 status = BS->AllocatePool(EfiLoaderCode, (UINTN)st.st_size, &buf); in command_chain()
1343 (void) BS->FreePool(buf); in command_chain()
1348 status = BS->LoadImage(FALSE, IH, NULL, buf, st.st_size, &loaderhandle); in command_chain()
1349 (void) BS->FreePool(buf); in command_chain()
1366 loaded_image->LoadOptions = argp = malloc(len); in command_chain()
1367 if (loaded_image->LoadOptions == NULL) { in command_chain()
1369 (void) BS->UnloadImage(loaded_image); in command_chain()
1372 loaded_image->LoadOptionsSize = len; in command_chain()
1379 *(--argv) = 0; in command_chain()
1387 switch (dev->d_dev->dv_type) { in command_chain()
1390 loaded_image->DeviceHandle = in command_chain()
1391 efizfs_get_handle_by_guid(z_dev->pool_guid); in command_chain()
1394 loaded_image->DeviceHandle = in command_chain()
1395 efi_find_handle(dev->d_dev, dev->d_unit); in command_chain()
1399 if (STAILQ_EMPTY(&hd->pd_part)) { in command_chain()
1400 loaded_image->DeviceHandle = hd->pd_handle; in command_chain()
1404 STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { in command_chain()
1408 if (pd->pd_unit == d_dev->d_slice) { in command_chain()
1409 loaded_image->DeviceHandle = in command_chain()
1410 pd->pd_handle; in command_chain()
1419 status = BS->StartImage(loaderhandle, NULL, NULL); in command_chain()
1423 free(loaded_image->LoadOptions); in command_chain()
1424 loaded_image->LoadOptions = NULL; in command_chain()
1425 status = BS->UnloadImage(loaded_image); in command_chain()