2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A
2N/A#ifndef _LIBUEFI_RT_PATH_IMPL_H_
2N/A#define _LIBUEFI_RT_PATH_IMPL_H_
2N/A
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * Private definitions for UEFI run time path library interfaces.
2N/A */
2N/A
2N/A/*
2N/A * uefi_device_path_t type definitions
2N/A */
2N/A#define UEFI_HARDWARE_PATH 0x01
2N/A#define UEFI_ACPI_PATH 0x02
2N/A#define UEFI_MESSAGE_PATH 0x03
2N/A#define UEFI_MEDIA_PATH 0x04
2N/A#define UEFI_BIOS_PATH 0x05
2N/A#define UEFI_END_PATH 0x7f
2N/A
2N/A/*
2N/A * subtypes
2N/A */
2N/A#define UEFI_PCI 1
2N/A#define UEFI_CTRL 5
2N/A#define UEFI_HARD_DRIVE 1
2N/A#define UEFI_FILE_PATH 4
2N/A#define UEFI_ACPI 1
2N/A#define UEFI_ACPIE 2
2N/A#define UEFI_ATAPI 1
2N/A#define UEFI_SCSI 2
2N/A#define UEFI_FIBRE 3
2N/A#define UEFI_FIBRE_EX 21
2N/A#define UEFI_USB 5
2N/A#define UEFI_SATA 18
2N/A#define UEFI_MACADDR 11
2N/A#define UEFI_END_ENTIRE 0xff
2N/A#define UEFI_END_INSTANCE 0x01
2N/A
2N/A/*
2N/A * signature type in hard drive media path
2N/A */
2N/A#define UEFI_NO_SIG 0x0
2N/A#define UEFI_MBR_SIG 0x1
2N/A#define UEFI_GUID_SIG 0x2
2N/A
2N/A/*
2N/A * partition type in hard drive media path
2N/A */
2N/A#define UEFI_MBR 0x1
2N/A#define UEFI_GPT 0x2
2N/A
2N/A
2N/A
2N/A
2N/A/*
2N/A * Generic structure header for device path that gives the length
2N/A * of the specific structure. Specific structures contain the
2N/A * same first 3 fields.
2N/A */
2N/Atypedef struct uefi_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A} uefi_device_path_t;
2N/A
2N/Atypedef char *uefirt_bootopt_buff_t;
2N/A
2N/A
2N/Atypedef struct uefi_file_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint16_t path_name[];
2N/A} uefi_file_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_pci_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint8_t function_number;
2N/A uint8_t device_number;
2N/A} uefi_pci_device_path_t;
2N/A
2N/Atypedef struct uefi_ctrl_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint32_t ctrl_number;
2N/A} uefi_ctrl_device_path_t;
2N/A
2N/A
2N/A#pragma pack(1)
2N/A
2N/Atypedef struct uefi_hard_drive_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint32_t part_number;
2N/A uint64_t part_start;
2N/A uint64_t part_size;
2N/A uint8_t part_sig[16];
2N/A uint8_t part_format;
2N/A uint8_t sig_type;
2N/A} uefi_hard_drive_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_scsi_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint16_t target;
2N/A uint16_t lun;
2N/A} uefi_scsi_device_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_atapi_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint8_t channel;
2N/A uint8_t drive;
2N/A uint16_t lun;
2N/A} uefi_atapi_device_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_fibre_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint64_t wwn;
2N/A uint64_t lun;
2N/A} uefi_fibre_device_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_usb_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint8_t ppn;
2N/A uint8_t in;
2N/A} uefi_usb_device_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_sata_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint16_t port;
2N/A uint16_t port_mult;
2N/A uint16_t lun;
2N/A} uefi_sata_device_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_acpi_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint32_t hid;
2N/A uint32_t uid;
2N/A} uefi_acpi_device_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_bios_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint16_t device_type;
2N/A uint16_t status_flag;
2N/A char desc_str[];
2N/A} uefi_bios_device_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_macaddr_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint8_t mac_addr[32];
2N/A uint8_t iff_type;
2N/A} uefi_macaddr_device_path_t;
2N/A
2N/A
2N/Atypedef struct uefi_acpie_device_path {
2N/A uint8_t type;
2N/A uint8_t subtype;
2N/A uint16_t len;
2N/A uint32_t hid;
2N/A uint32_t uid;
2N/A uint32_t cid;
2N/A /*
2N/A * Combined _HIDSTR, _UIDSTR, _CIDStr. Each string is NULL-terminated
2N/A * even if not present.
2N/A */
2N/A char id_str[];
2N/A} uefi_acpie_device_path_t;
2N/A
2N/A#pragma pack()
2N/A
2N/A/*
2N/A * Corresponds to the data elements needed to construct
2N/A * a firmware Boot#### property according to section 3.1.3
2N/A * of the UEFI spec. The actual in firmware property format cannot be
2N/A * represented by a C structure. But this is used to represent
2N/A * that data in the library.
2N/A */
2N/Atypedef struct uefi_load_option {
2N/A UINT32 attr;
2N/A UINT16 dpath_len;
2N/A CHAR16 *desc;
2N/A uefi_device_path_t **dpath_list;
2N/A void *optdata;
2N/A UINTN optdata_len;
2N/A} uefi_load_option_t;
2N/A
2N/A
2N/Atypedef struct uefi_lib_impl {
2N/A size_t memlist_size;
2N/A size_t memlist_end;
2N/A void **memlist_addr;
2N/A int uefirt_fd;
2N/A} uefi_lib_impl_t;
2N/A
2N/A
2N/A#define BOOT_NAME_SZ 9
2N/A#define MEMLIST_INCREMENT 20
2N/A
2N/A
2N/A#define EPRINT(fmt ...) \
2N/A if (uefirt_path_eprint == -1) { \
2N/A if (getenv("UEFIRT_PATH_EPRINT")) { \
2N/A uefirt_path_eprint = 1; \
2N/A } else { \
2N/A uefirt_path_eprint = 0; \
2N/A } \
2N/A } \
2N/A if (uefirt_path_eprint) { \
2N/A (void) fprintf(stderr, ##fmt); \
2N/A }
2N/A
2N/A
2N/A#define DPRINT(fmt ...) \
2N/A if (uefirt_path_debug == -1) { \
2N/A if (getenv("UEFIRT_PATH_DEBUG")) { \
2N/A uefirt_path_debug = 1; \
2N/A } else { \
2N/A uefirt_path_debug = 0; \
2N/A } \
2N/A } \
2N/A if (uefirt_path_debug) { \
2N/A (void) fprintf(stdout, ##fmt); \
2N/A }
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBUEFI_RT_PATH_IMPL_H_ */