[48674] | 1 | /* $Id: fsw_efi.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * fsw_efi.h - EFI host environment header.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
[48674] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
[48674] | 11 | *
|
---|
[96407] | 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
[48674] | 25 | * The contents of this file may alternatively be used under the terms
|
---|
| 26 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
[48674] | 29 | * CDDL are applicable instead of those of the GPL.
|
---|
| 30 | *
|
---|
| 31 | * You may elect to license modified versions of this file under the
|
---|
| 32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[96407] | 33 | *
|
---|
| 34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[69498] | 35 | * ---------------------------------------------------------------------------
|
---|
[48674] | 36 | * This code is based on:
|
---|
| 37 | *
|
---|
| 38 | * Copyright (c) 2006 Christoph Pfisterer
|
---|
| 39 | *
|
---|
| 40 | * Redistribution and use in source and binary forms, with or without
|
---|
| 41 | * modification, are permitted provided that the following conditions are
|
---|
| 42 | * met:
|
---|
| 43 | *
|
---|
| 44 | * * Redistributions of source code must retain the above copyright
|
---|
| 45 | * notice, this list of conditions and the following disclaimer.
|
---|
| 46 | *
|
---|
| 47 | * * Redistributions in binary form must reproduce the above copyright
|
---|
| 48 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 49 | * documentation and/or other materials provided with the
|
---|
| 50 | * distribution.
|
---|
| 51 | *
|
---|
| 52 | * * Neither the name of Christoph Pfisterer nor the names of the
|
---|
| 53 | * contributors may be used to endorse or promote products derived
|
---|
| 54 | * from this software without specific prior written permission.
|
---|
| 55 | *
|
---|
| 56 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
| 57 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
| 58 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
---|
| 59 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
---|
| 60 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 61 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 62 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 63 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 64 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 65 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
| 66 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 67 | */
|
---|
| 68 |
|
---|
| 69 | #ifndef _FSW_EFI_H_
|
---|
| 70 | #define _FSW_EFI_H_
|
---|
| 71 |
|
---|
| 72 | #include "fsw_core.h"
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | /**
|
---|
| 76 | * EFI Host: Private per-volume structure.
|
---|
| 77 | */
|
---|
| 78 |
|
---|
| 79 | typedef struct {
|
---|
| 80 | UINT64 Signature; //!< Used to identify this structure
|
---|
| 81 |
|
---|
| 82 | EFI_FILE_IO_INTERFACE FileSystem; //!< Published EFI protocol interface structure
|
---|
| 83 |
|
---|
| 84 | EFI_HANDLE Handle; //!< The device handle the protocol is attached to
|
---|
| 85 | EFI_DISK_IO *DiskIo; //!< The Disk I/O protocol we use for disk access
|
---|
| 86 | UINT32 MediaId; //!< The media ID from the Block I/O protocol
|
---|
| 87 | EFI_STATUS LastIOStatus; //!< Last status from Disk I/O
|
---|
| 88 |
|
---|
| 89 | struct fsw_volume *vol; //!< FSW volume structure
|
---|
| 90 |
|
---|
| 91 | } FSW_VOLUME_DATA;
|
---|
| 92 |
|
---|
| 93 | /** Signature for the volume structure. */
|
---|
| 94 | #define FSW_VOLUME_DATA_SIGNATURE EFI_SIGNATURE_32 ('f', 's', 'w', 'V')
|
---|
| 95 | /** Access macro for the volume structure. */
|
---|
| 96 | #define FSW_VOLUME_FROM_FILE_SYSTEM(a) CR (a, FSW_VOLUME_DATA, FileSystem, FSW_VOLUME_DATA_SIGNATURE)
|
---|
| 97 |
|
---|
| 98 | /**
|
---|
| 99 | * EFI Host: Private structure for a EFI_FILE interface.
|
---|
| 100 | */
|
---|
| 101 |
|
---|
| 102 | typedef struct {
|
---|
| 103 | UINT64 Signature; //!< Used to identify this structure
|
---|
| 104 |
|
---|
| 105 | EFI_FILE FileHandle; //!< Published EFI protocol interface structure
|
---|
| 106 |
|
---|
| 107 | UINTN Type; //!< File type used for dispatching
|
---|
| 108 | struct fsw_shandle shand; //!< FSW handle for this file
|
---|
| 109 |
|
---|
| 110 | } FSW_FILE_DATA;
|
---|
| 111 |
|
---|
| 112 | /** File type: regular file. */
|
---|
| 113 | #define FSW_EFI_FILE_TYPE_FILE (0)
|
---|
| 114 | /** File type: directory. */
|
---|
| 115 | #define FSW_EFI_FILE_TYPE_DIR (1)
|
---|
| 116 |
|
---|
| 117 | /** Signature for the file handle structure. */
|
---|
| 118 | #define FSW_FILE_DATA_SIGNATURE EFI_SIGNATURE_32 ('f', 's', 'w', 'F')
|
---|
| 119 | /** Access macro for the file handle structure. */
|
---|
| 120 | #define FSW_FILE_FROM_FILE_HANDLE(a) CR (a, FSW_FILE_DATA, FileHandle, FSW_FILE_DATA_SIGNATURE)
|
---|
| 121 |
|
---|
| 122 |
|
---|
| 123 | //
|
---|
| 124 | // Library functions
|
---|
| 125 | //
|
---|
| 126 |
|
---|
| 127 | VOID fsw_efi_decode_time(OUT EFI_TIME *EfiTime, IN UINT32 UnixTime);
|
---|
| 128 |
|
---|
| 129 | UINTN fsw_efi_strsize(struct fsw_string *s);
|
---|
| 130 | VOID fsw_efi_strcpy(CHAR16 *Dest, struct fsw_string *src);
|
---|
| 131 |
|
---|
| 132 |
|
---|
| 133 | #endif
|
---|