| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2011 Red Hat, Inc. |
|---|
| 3 | 4 | * All rights reserved. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 7 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License |
|---|
| 15 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 16 | 5 | * |
|---|
| 17 | 6 | * Author(s): Peter Jones <pjones@redhat.com> |
|---|
| 18 | 7 | */ |
|---|
| .. | .. |
|---|
| 20 | 9 | #define __LINUX_PE_H |
|---|
| 21 | 10 | |
|---|
| 22 | 11 | #include <linux/types.h> |
|---|
| 12 | + |
|---|
| 13 | +/* |
|---|
| 14 | + * Linux EFI stub v1.0 adds the following functionality: |
|---|
| 15 | + * - Loading initrd from the LINUX_EFI_INITRD_MEDIA_GUID device path, |
|---|
| 16 | + * - Loading/starting the kernel from firmware that targets a different |
|---|
| 17 | + * machine type, via the entrypoint exposed in the .compat PE/COFF section. |
|---|
| 18 | + * |
|---|
| 19 | + * The recommended way of loading and starting v1.0 or later kernels is to use |
|---|
| 20 | + * the LoadImage() and StartImage() EFI boot services, and expose the initrd |
|---|
| 21 | + * via the LINUX_EFI_INITRD_MEDIA_GUID device path. |
|---|
| 22 | + * |
|---|
| 23 | + * Versions older than v1.0 support initrd loading via the image load options |
|---|
| 24 | + * (using initrd=, limited to the volume from which the kernel itself was |
|---|
| 25 | + * loaded), or via arch specific means (bootparams, DT, etc). |
|---|
| 26 | + * |
|---|
| 27 | + * On x86, LoadImage() and StartImage() can be omitted if the EFI handover |
|---|
| 28 | + * protocol is implemented, which can be inferred from the version, |
|---|
| 29 | + * handover_offset and xloadflags fields in the bootparams structure. |
|---|
| 30 | + */ |
|---|
| 31 | +#define LINUX_EFISTUB_MAJOR_VERSION 0x1 |
|---|
| 32 | +#define LINUX_EFISTUB_MINOR_VERSION 0x0 |
|---|
| 23 | 33 | |
|---|
| 24 | 34 | #define MZ_MAGIC 0x5a4d /* "MZ" */ |
|---|
| 25 | 35 | |
|---|
| .. | .. |
|---|
| 45 | 55 | #define IMAGE_FILE_MACHINE_POWERPC 0x01f0 |
|---|
| 46 | 56 | #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 |
|---|
| 47 | 57 | #define IMAGE_FILE_MACHINE_R4000 0x0166 |
|---|
| 58 | +#define IMAGE_FILE_MACHINE_RISCV32 0x5032 |
|---|
| 59 | +#define IMAGE_FILE_MACHINE_RISCV64 0x5064 |
|---|
| 60 | +#define IMAGE_FILE_MACHINE_RISCV128 0x5128 |
|---|
| 48 | 61 | #define IMAGE_FILE_MACHINE_SH3 0x01a2 |
|---|
| 49 | 62 | #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 |
|---|
| 50 | 63 | #define IMAGE_FILE_MACHINE_SH3E 0x01a4 |
|---|
| .. | .. |
|---|
| 166 | 179 | uint16_t oem_info; /* oem specific */ |
|---|
| 167 | 180 | uint16_t reserved1[10]; /* reserved */ |
|---|
| 168 | 181 | uint32_t peaddr; /* address of pe header */ |
|---|
| 169 | | - char message[64]; /* message to print */ |
|---|
| 182 | + char message[]; /* message to print */ |
|---|
| 170 | 183 | }; |
|---|
| 171 | 184 | |
|---|
| 172 | 185 | struct mz_reloc { |
|---|