OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <IndustryStandard/Pci.h>
#include <Guid/AppleDevicePath.h>
#include <Guid/Gpt.h>
#include <Protocol/BlockIo.h>
#include <Protocol/LoadFile.h>
#include <Protocol/PciIo.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/UsbIo.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/DevicePathLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcFileLib.h>
#include <Library/UefiBootServicesTableLib.h>
Go to the source code of this file.
Macros | |
#define | ACPI_VMD0001_HID 0x000159A4 |
#define | ACPI_VBS0001_HID 0x00015853 |
Functions | |
VOID | InternalConnectAll (VOID) |
STATIC BOOLEAN | BmMatchUsbClass (IN EFI_USB_IO_PROTOCOL *UsbIo, IN USB_CLASS_DEVICE_PATH *UsbClass) |
STATIC BOOLEAN | BmMatchUsbWwid (IN EFI_USB_IO_PROTOCOL *UsbIo, IN USB_WWID_DEVICE_PATH *UsbWwid) |
STATIC EFI_HANDLE * | BmFindUsbDevice (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINTN ParentDevicePathSize, OUT UINTN *UsbIoHandleCount) |
STATIC EFI_DEVICE_PATH_PROTOCOL * | BmExpandUsbDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN EFI_DEVICE_PATH_PROTOCOL *FullPath, IN EFI_DEVICE_PATH_PROTOCOL *ShortformNode) |
STATIC EFI_DEVICE_PATH_PROTOCOL * | BmExpandMediaDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN EFI_DEVICE_PATH_PROTOCOL *FullPath, IN EFI_HANDLE Handle) |
STATIC BOOLEAN | BmMatchPartitionDevicePathNode (IN EFI_HANDLE Handle, IN EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath, IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath, IN BOOLEAN LocateEsp) |
STATIC EFI_DEVICE_PATH_PROTOCOL * | BmExpandPartitionDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath) |
STATIC EFI_STATUS | BmConnectUsbShortFormDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath) |
STATIC EFI_DEVICE_PATH_PROTOCOL * | BmExpandHyperVDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath) |
STATIC EFI_DEVICE_PATH_PROTOCOL * | BmExpandAppleSDCardDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath) |
EFI_DEVICE_PATH_PROTOCOL * | OcGetNextLoadOptionDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN EFI_DEVICE_PATH_PROTOCOL *FullPath) |
Variables | |
STATIC BOOLEAN | mConnectAllExecuted = FALSE |
Library functions which relates with booting.
Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file ExpandDevicePath.c.
#define ACPI_VBS0001_HID 0x00015853 |
Definition at line 33 of file ExpandDevicePath.c.
#define ACPI_VMD0001_HID 0x000159A4 |
Definition at line 32 of file ExpandDevicePath.c.
STATIC EFI_STATUS BmConnectUsbShortFormDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath | ) |
Connect the specific Usb device which match the short form device path, and whose bus is determined by Host Controller (Uhci or Ehci).
DevicePath | A short-form device path that starts with the first element being a USB WWID or a USB Class device path |
Definition at line 755 of file ExpandDevicePath.c.
STATIC EFI_DEVICE_PATH_PROTOCOL * BmExpandAppleSDCardDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Match macOS-made SD card device path onto standard SD card UEFI device path. macOS uses a vendor-specific path for SD card devices and produces paths like: PciRoot(0x0) /Pci(0x1A,0x0) /VenMsg(C063C579-9F78-4BA5-9F42-D0B0149597A6,01000000000000000000000000000000) /HD(2,GPT,D2BEDE60-7C48-4D94-8915-A579450E3C43,0x64028,0x7417FB0)
We need to match them on standard SD card device paths like: PciRoot(0x0) /Pci(0x1A,0x0) /eMMC(0x0) /Ctrl(0x0) /HD(2,GPT,D2BEDE60-7C48-4D94-8915-A579450E3C43,0x64028,0x7417FB0)
[in] | FilePath | macOS-made device path with VenMsg parts trimmed (i.e. VenMsg(0x0, 0x0)/.../File). |
Definition at line 977 of file ExpandDevicePath.c.
STATIC EFI_DEVICE_PATH_PROTOCOL * BmExpandHyperVDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Match macOS-made Hyper-V device path onto Hyper-V UEFI firmware device path. macOS is unaware of Hyper-V and therefore produces paths like: Acpi(0x000159A4,0x0) /Acpi(0x00015853,0x0) /Scsi(0x0,0x0) /HD(2,GPT,63882141-5773-4630-B8FD-2C6E4A491C78,0x64028,0x3A66090) We need to match them on real Hyper-V device paths like: AcpiEx(@@0000,@@0000,0x0,VMBus,,) /VenHw(9B17E5A2-0891-42DD-B653-80B5C22809BA,D96361BAA104294DB60572E2FFB1DC7F19539477F36F4B429750F8B5593AAA27) /Scsi(0x0,0x0) /HD(2,GPT,63882141-5773-4630-B8FD-2C6E4A491C78,0x64028,0x3A66090)
Additionally, MacHyperVSupport exposes disks as individual SCSI targets to properly support hotplug where Hyper-V exposes just a single target.
[in] | FilePath | macOS-made device path with ACPI parts trimmed (i.e. Scsi(0x0, 0x0)/.../File). |
Definition at line 851 of file ExpandDevicePath.c.
STATIC EFI_DEVICE_PATH_PROTOCOL * BmExpandMediaDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
IN EFI_DEVICE_PATH_PROTOCOL * | FullPath, | ||
IN EFI_HANDLE | Handle ) |
Expand the media device path which points to a BlockIo or SimpleFileSystem instance.
DevicePath | The media device path pointing to a BlockIo or SimpleFileSystem instance. |
FullPath | The full path returned by the routine in last call. Set to NULL in first call. |
Definition at line 465 of file ExpandDevicePath.c.
STATIC EFI_DEVICE_PATH_PROTOCOL * BmExpandPartitionDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Expand a device path that starts with a hard drive media device path node to be a full device path that includes the full hardware path to the device. We need to do this so it can be booted. As an optimization the front match (the part point to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ) is saved in a variable so a connect all is not required on every boot. All successful history device path which point to partition node (the front part) will be saved.
FilePath | The device path pointing to a load option. It could be a short-form device path. |
Definition at line 660 of file ExpandDevicePath.c.
STATIC EFI_DEVICE_PATH_PROTOCOL * BmExpandUsbDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath, |
IN EFI_DEVICE_PATH_PROTOCOL * | FullPath, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | ShortformNode ) |
Expand USB Class or USB WWID device path node to be full device path of a USB device in platform.
This function support following 4 cases: 1) Boot Option device path starts with a USB Class or USB WWID device path, and there is no Media FilePath device path in the end. In this case, it will follow Removable Media Boot Behavior. 2) Boot Option device path starts with a USB Class or USB WWID device path, and ended with Media FilePath device path. 3) Boot Option device path starts with a full device path to a USB Host Controller, contains a USB Class or USB WWID device path node, while not ended with Media FilePath device path. In this case, it will follow Removable Media Boot Behavior. 4) Boot Option device path starts with a full device path to a USB Host Controller, contains a USB Class or USB WWID device path node, and ended with Media FilePath device path.
FilePath | The device path pointing to a load option. It could be a short-form device path. |
FullPath | The full path returned by the routine in last call. Set to NULL in first call. |
ShortformNode | Pointer to the USB short-form device path node in the FilePath buffer. |
Definition at line 399 of file ExpandDevicePath.c.
STATIC EFI_HANDLE * BmFindUsbDevice | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
IN UINTN | ParentDevicePathSize, | ||
OUT UINTN * | UsbIoHandleCount ) |
Find a USB device which match the specified short-form device path start with USB Class or USB WWID device path. If ParentDevicePath is NULL, this function will search in all USB devices of the platform. If ParentDevicePath is not NULL, this function will only search in its child devices.
DevicePath | The device path that contains USB Class or USB WWID device path. |
ParentDevicePathSize | The length of the device path before the USB Class or USB WWID device path. |
UsbIoHandleCount | A pointer to the count of the returned USB IO handles. |
NULL | The matched USB IO handles cannot be found. |
other | The matched USB IO handles. |
Definition at line 306 of file ExpandDevicePath.c.
STATIC BOOLEAN BmMatchPartitionDevicePathNode | ( | IN EFI_HANDLE | Handle, |
IN EFI_DEVICE_PATH_PROTOCOL * | BlockIoDevicePath, | ||
IN HARDDRIVE_DEVICE_PATH * | HardDriveDevicePath, | ||
IN BOOLEAN | LocateEsp ) |
Check whether there is a instance in BlockIoDevicePath, which contain multi device path instances, has the same partition node with HardDriveDevicePath device path
Handle | The partition's device handle |
BlockIoDevicePath | Multi device path instances which need to check |
HardDriveDevicePath | A device path which starts with a hard drive media device path. |
LocateEsp | Use ESP- instead of PartitionNumber-matching. |
TRUE | There is a matched device path instance. |
FALSE | There is no matched device path instance. |
Definition at line 580 of file ExpandDevicePath.c.
STATIC BOOLEAN BmMatchUsbClass | ( | IN EFI_USB_IO_PROTOCOL * | UsbIo, |
IN USB_CLASS_DEVICE_PATH * | UsbClass ) |
Check whether a USB device match the specified USB Class device path. This function follows "Load Option Processing" behavior in UEFI specification.
UsbIo | USB I/O protocol associated with the USB device. |
UsbClass | The USB Class device path to match. |
TRUE | The USB device match the USB Class device path. |
FALSE | The USB device does not match the USB Class device path. |
Definition at line 93 of file ExpandDevicePath.c.
STATIC BOOLEAN BmMatchUsbWwid | ( | IN EFI_USB_IO_PROTOCOL * | UsbIo, |
IN USB_WWID_DEVICE_PATH * | UsbWwid ) |
Check whether a USB device match the specified USB WWID device path. This function follows "Load Option Processing" behavior in UEFI specification.
UsbIo | USB I/O protocol associated with the USB device. |
UsbWwid | The USB WWID device path to match. |
TRUE | The USB device match the USB WWID device path. |
FALSE | The USB device does not match the USB WWID device path. |
Definition at line 186 of file ExpandDevicePath.c.
VOID InternalConnectAll | ( | VOID | ) |
Connect all the drivers to all the controllers.
This function makes sure all the current system drivers manage the correspoinding controllers if have. And at the same time, makes sure all the system controllers have driver to manage it if have.
Definition at line 48 of file ExpandDevicePath.c.
EFI_DEVICE_PATH_PROTOCOL * OcGetNextLoadOptionDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath, |
IN EFI_DEVICE_PATH_PROTOCOL * | FullPath ) |
Get the next possible full path pointing to the load option. The routine doesn't guarantee the returned full path points to an existing file, and it also doesn't guarantee the existing file is a valid load option.
FilePath | The device path pointing to a load option. It could be a short-form device path. |
FullPath | The full path returned by the routine in last call. Set to NULL in first call. |
Definition at line 1055 of file ExpandDevicePath.c.
STATIC BOOLEAN mConnectAllExecuted = FALSE |
Definition at line 36 of file ExpandDevicePath.c.