├── .github └── workflows │ ├── ci.yaml │ ├── publish_review_event.yaml │ └── store_review_event.yaml ├── Android.mk ├── COPYING ├── README.md ├── TPP ├── avb ├── Android.mk ├── libavb │ ├── avb_chain_partition_descriptor.c │ ├── avb_chain_partition_descriptor.h │ ├── avb_cmdline.c │ ├── avb_cmdline.h │ ├── avb_crc32.c │ ├── avb_crypto.c │ ├── avb_crypto.h │ ├── avb_descriptor.c │ ├── avb_descriptor.h │ ├── avb_footer.c │ ├── avb_footer.h │ ├── avb_hash_descriptor.c │ ├── avb_hash_descriptor.h │ ├── avb_hashtree_descriptor.c │ ├── avb_hashtree_descriptor.h │ ├── avb_kernel_cmdline_descriptor.c │ ├── avb_kernel_cmdline_descriptor.h │ ├── avb_ops.h │ ├── avb_property_descriptor.c │ ├── avb_property_descriptor.h │ ├── avb_rsa.c │ ├── avb_rsa.h │ ├── avb_sha.h │ ├── avb_sha256.c │ ├── avb_sha512.c │ ├── avb_slot_verify.c │ ├── avb_slot_verify.h │ ├── avb_sysdeps.h │ ├── avb_sysdeps_posix.c │ ├── avb_util.c │ ├── avb_util.h │ ├── avb_vbmeta_image.c │ ├── avb_vbmeta_image.h │ ├── avb_version.c │ ├── avb_version.h │ └── libavb.h ├── libavb_ab │ ├── avb_ab_flow.c │ ├── avb_ab_flow.h │ ├── avb_ab_ops.h │ └── libavb_ab.h ├── libavb_atx │ ├── avb_atx_ops.h │ ├── avb_atx_types.h │ ├── avb_atx_validate.c │ ├── avb_atx_validate.h │ └── libavb_atx.h └── libavb_user │ ├── uefi_avb_ops.c │ ├── uefi_avb_ops.h │ ├── uefi_avb_sysdeps.c │ ├── uefi_avb_util.c │ └── uefi_avb_util.h ├── build ├── CMakeLists.txt ├── README ├── config.cmake ├── elf_ia32_abl.lds ├── libpayload-config.h └── sources.cmake ├── crashdump.c ├── crashdump.h ├── doc ├── autodetect.md ├── crashmode.md ├── fastboot.md └── installer.md ├── include ├── acpi.h ├── adb.h ├── aes_gcm.h ├── android.h ├── android_vb2.h ├── blobstore.h ├── dt_table.h ├── em.h ├── embedded_controller.h ├── endian.h ├── fastboot.h ├── fatfs.h ├── firststage_mount.h ├── gpio.h ├── gpt.h ├── gpt_bin.h ├── hecisupport.h ├── ioc_can.h ├── ioc_uart_protocol.h ├── ivshmem.h ├── keybox_provision.h ├── lib.h ├── libelfloader.h ├── libtipc.h ├── life_cycle.h ├── log.h ├── oemvars.h ├── options.h ├── pae.h ├── pci.h ├── power.h ├── protocol.h ├── qnx_guest_shm.h ├── security.h ├── security_interface.h ├── security_vb2.h ├── slot.h ├── smbios.h ├── sparse_format.h ├── storage.h ├── targets.h ├── tcp.h ├── text_parser.h ├── timer.h ├── tpm2_security.h ├── transport.h ├── trusty_common.h ├── trusty_interface.h ├── uefi_utils.h ├── ui.h ├── upng.h ├── usb.h ├── vars.h ├── vbmeta_ias.h ├── version.h └── watchdog.h ├── installer.c ├── kernelflinger.c ├── kf4abl.c ├── kf4cic.c ├── kfld.c ├── libadb ├── Android.mk ├── adb.c ├── adb_socket.c ├── adb_socket.h ├── devmem.c ├── devmem.h ├── hexdump.c ├── hexdump.h ├── ioport.c ├── ioport.h ├── lsacpi.c ├── lsacpi.h ├── lspartition.c ├── lspartition.h ├── lspci.c ├── lspci.h ├── pci_class.c ├── pci_class.h ├── reader.c ├── reader.h ├── reboot_service.c ├── service.h ├── shell_service.c ├── shell_service.h └── sync_service.c ├── libedk2_tpm ├── Android.mk ├── IoLib.c ├── README ├── RegisterFilterLibNull.c ├── Tpm2Capability.c ├── Tpm2Context.c ├── Tpm2DeviceLib.c ├── Tpm2EnhancedAuthorization.c ├── Tpm2Help.c ├── Tpm2Hierarchy.c ├── Tpm2Integrity.c ├── Tpm2NVStorage.c ├── Tpm2Ptp.c ├── Tpm2Random.c ├── Tpm2Sequences.c ├── Tpm2Session.c ├── Tpm2Tis.c └── include │ ├── Base.h │ ├── BaseIoLibIntrinsicInternal.h │ ├── BaseLib.h │ ├── BaseTypes.h │ ├── IndustryStandard │ ├── Acpi.h │ ├── Acpi10.h │ ├── Acpi20.h │ ├── Acpi30.h │ ├── Acpi40.h │ ├── Acpi50.h │ ├── Acpi51.h │ ├── Acpi60.h │ ├── Acpi61.h │ ├── Acpi62.h │ ├── Acpi63.h │ ├── Acpi64.h │ ├── AcpiAml.h │ ├── Atapi.h │ ├── Bluetooth.h │ ├── Bmp.h │ ├── DmaRemappingReportingTable.h │ ├── ElTorito.h │ ├── Emmc.h │ ├── HighPrecisionEventTimerTable.h │ ├── LowPowerIdleTable.h │ ├── Mbr.h │ ├── MemoryMappedConfigurationSpaceAccessTable.h │ ├── Nvme.h │ ├── Pci.h │ ├── Pci22.h │ ├── Pci23.h │ ├── Pci30.h │ ├── PciCodeId.h │ ├── PciExpress21.h │ ├── PciExpress30.h │ ├── PciExpress31.h │ ├── PciExpress40.h │ ├── PciExpress50.h │ ├── PeImage.h │ ├── Scsi.h │ ├── Sd.h │ ├── SmBios.h │ ├── SmBus.h │ ├── Tpm12.h │ ├── Tpm20.h │ ├── Tpm2Acpi.h │ ├── TpmPtp.h │ ├── TpmTis.h │ ├── UefiTcgPlatform.h │ └── Usb.h │ ├── IoLib.h │ ├── PcdLib.h │ ├── ProcessorBind.h │ ├── RegisterFilterLib.h │ ├── Tcg2Protocol.h │ ├── Tpm12.h │ ├── Tpm20.h │ ├── Tpm2CommandLib.h │ ├── Tpm2DeviceLib.h │ ├── Tpm2Help.h │ └── UefiTcgPlatform.h ├── libefitcp ├── Android.mk └── tcp.c ├── libefiusb ├── Android.mk ├── device_mode │ ├── CpuIo2.h │ ├── UsbDeviceDxe.c │ ├── UsbDeviceDxe.h │ ├── UsbDeviceMode.c │ ├── UsbDeviceMode.h │ ├── XdciCommon.h │ ├── XdciDWC.c │ ├── XdciDWC.h │ ├── XdciDevice.c │ ├── XdciDevice.h │ ├── XdciInterface.h │ ├── XdciTable.c │ ├── XdciUtility.c │ ├── XdciUtility.h │ └── cpuio.c ├── protocol │ ├── Usb.h │ ├── UsbDeviceLib.h │ ├── UsbDeviceModeProtocol.h │ └── UsbIo.h └── usb.c ├── libelfloader ├── Android.mk ├── elf32_ld.c ├── elf64_ld.c ├── elf_ld.c └── include │ ├── elf32_ld.h │ ├── elf64_ld.h │ └── elf_ld.h ├── libfastboot ├── Android.mk ├── authenticated_action.c ├── authenticated_action.h ├── bootloader.c ├── bootloader.h ├── bootmgr.c ├── bootmgr.h ├── fastboot.c ├── fastboot_flashing.c ├── fastboot_flashing.h ├── fastboot_oem.c ├── fastboot_oem.h ├── fastboot_transport.c ├── fastboot_transport.h ├── fastboot_ui.c ├── fastboot_ui.h ├── flash.c ├── flash.h ├── hashes.c ├── hashes.h ├── info.c ├── info.h ├── installer_ui.c ├── installer_ui.h ├── intel_variables.c ├── intel_variables.h ├── keybox_provision.c ├── sparse.c └── sparse.h ├── libheci ├── Android.mk └── hecisupport.c ├── libkernelflinger ├── Android.mk ├── README ├── UsbMassBot.c ├── UsbMassBot.h ├── acpi.c ├── acpi_image.c ├── aes_gcm.c ├── android.c ├── android_vb2.c ├── blobstore.c ├── efilinux.c ├── efilinux.h ├── em.c ├── embedded_controller.c ├── fatfs.c ├── fatfs │ ├── LICENSE.txt │ ├── README.asc │ └── source │ │ ├── 00history.txt │ │ ├── 00readme.txt │ │ ├── diskio.c │ │ ├── diskio.h │ │ ├── ff.c │ │ ├── ff.h │ │ ├── ffconf.h │ │ ├── ffsystem.c │ │ └── ffunicode.c ├── firststage_mount.c ├── general_block.c ├── gpio.c ├── gpt.c ├── ias_sig.c ├── ioc_can.c ├── ivshmem.c ├── lib.c ├── life_cycle.c ├── log.c ├── mmc.c ├── no_ui.c ├── nvme.c ├── oemvars.c ├── options.c ├── pae.c ├── pci.c ├── protocol │ ├── AcpiTableProtocol.h │ ├── Afws_general_heci_agent.h │ ├── Afws_keymaster_heci_agent.h │ ├── AtaPassThru.h │ ├── Atapi.h │ ├── BootloaderSeedProtocol.h │ ├── CardInfo.h │ ├── ChargingAppletProtocol.h │ ├── DevicePath.h │ ├── EraseBlock.h │ ├── GpioProtocol.h │ ├── Heci.h │ ├── LifeCycleProtocol.h │ ├── MkhiMsgs.h │ ├── Mmc.h │ ├── NvmExpressHci.h │ ├── NvmExpressPassthru.h │ ├── ScsiPassThruExt.h │ ├── SdHostIo.h │ ├── SdMmcPassThru.h │ ├── StorageSecurityCommand.h │ ├── tco_protocol.h │ └── ufs.h ├── qsort.c ├── res │ ├── fonts │ │ ├── 12x22_font.png │ │ ├── 18x32_font.png │ │ ├── OFL.txt │ │ └── README │ └── images │ │ ├── bootloader.png │ │ ├── crash_event.png │ │ ├── crashmode.png │ │ ├── droid_operation.png │ │ ├── empty_battery.png │ │ ├── low_battery.png │ │ ├── power_off.png │ │ ├── reboot.png │ │ ├── recoverymode.png │ │ ├── restartbootloader.png │ │ ├── splash_intel.png │ │ └── start.png ├── sata.c ├── sdcard.c ├── sdio.c ├── sdio.h ├── security.c ├── security_abl.c ├── security_efi.c ├── security_efi.h ├── security_sbl.c ├── security_vb2.c ├── security_vsbl.c ├── slot.c ├── slot_avb.c ├── smbios.c ├── storage.c ├── targets.c ├── text_parser.c ├── timer.c ├── tools │ ├── Android.mk │ ├── gen_fonts.sh │ └── png2c.c ├── tpm2_security.c ├── trusty_abl.c ├── trusty_common.c ├── trusty_efi.c ├── trusty_sbl.c ├── trusty_vsbl.c ├── uefi_utils.c ├── ufs.c ├── ui.c ├── ui_boot_menu.c ├── ui_color.c ├── ui_confirm.c ├── ui_font.c ├── ui_image.c ├── ui_textarea.c ├── upng.c ├── usb_storage.c ├── vars.c ├── vbmeta_ias.c ├── virtual_media.c └── watchdog.c ├── libqltipc ├── Android.mk ├── interface │ └── include │ │ └── interface │ │ ├── avb │ │ └── avb.h │ │ └── keymaster │ │ └── keymaster.h └── ql-tipc │ ├── Android.mk │ ├── LICENSE │ ├── README.md │ ├── arch │ └── x86 │ │ ├── compiler.h │ │ ├── sysdeps_osloader.c │ │ ├── trusty_dev.c │ │ └── trusty_mem.c │ ├── avb.c │ ├── include │ └── trusty │ │ ├── arm_ffa.h │ │ ├── avb.h │ │ ├── keymaster.h │ │ ├── keymaster_serializable.h │ │ ├── libtipc.h │ │ ├── rpmb.h │ │ ├── sm_err.h │ │ ├── smc.h │ │ ├── smcall.h │ │ ├── sysdeps.h │ │ ├── trusty_dev.h │ │ ├── trusty_ipc.h │ │ ├── trusty_mem.h │ │ └── util.h │ ├── ipc.c │ ├── ipc_dev.c │ ├── keymaster.c │ ├── keymaster_serializable.c │ ├── libtipc.c │ ├── trusty_dev_common.c │ └── util.c ├── libsslsupport ├── Android.mk ├── borningssl │ └── sys │ │ └── syscall.h ├── errno.h ├── inttypes.h ├── limits.h ├── openssl_support.h ├── stdarg.h ├── stddef.h ├── stdio.h ├── stdlib.h ├── sys │ └── types.h ├── time.h └── wrapper.c ├── libtransport ├── Android.mk └── transport.c ├── libxbc ├── Android.mk ├── libxbc.c └── libxbc.h ├── prebuilt └── board │ ├── APL_UP2 │ └── fastboot.elf │ └── RPL_IVI │ ├── blizzard_ivi │ ├── installer.efi │ └── kernelflinger.efi │ ├── installer.efi │ └── kernelflinger.efi ├── unittest.c ├── unittest.h ├── ux.c └── ux.h /.github/workflows/store_review_event.yaml: -------------------------------------------------------------------------------- 1 | name: Store_Review_Event 2 | 3 | on: 4 | pull_request_review: 5 | types: "**" 6 | permissions: read-all 7 | 8 | jobs: 9 | Store_Review_Event: 10 | runs-on: ubuntu-latest 11 | name: Store Review Event 12 | steps: 13 | - name: Upload event JSON as artifact 14 | uses: actions/upload-artifact@v4 15 | with: 16 | name: eventjson 17 | path: "${{ github.event_path }}" 18 | retention-days: 7 -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Intel Corportaion 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /TPP: -------------------------------------------------------------------------------- 1 | Third-party program 2 | 3 | efiwrapper 4 | BSD 2-Clause "Simplified" License 5 | Copyright (C) <2016-2024> Intel Corporation 6 | SPDX-License-Identifier: BSD-2-Clause 7 | https://github.com/projectceladon/efiwrapper 8 | 9 | codeboot 10 | 3-Clause BSD license 11 | Copyright (C) <2023> Intel Corporation 12 | SPDX-License-Identifier: BSD-3-Clause 13 | https://github.com/projectceladon/coreboot 14 | 15 | EDK2 16 | BSD-2-Clause Plus Patent License 17 | Copyright (c) 2019, TianoCore and contributors 18 | SPDX-License-Identifier: BSD-2-Clause-Patent 19 | https://github.com/tianocore/edk2 20 | 21 | Modified Libgnuefi libefi 22 | Copyright (c) 1998-2000 Intel Corporation 23 | BSD License 24 | SPDX-License-Identifier: BSD-1-Clause 25 | https://github.com/projectceladon/external-gnu-efi 26 | 27 | libavb 28 | Copyright 2016, The Android Open Source Project,primarily licensed under the Apache License, Version 2.0 29 | SPDX-License-Identifier: Apache-2.0 30 | https://android.googlesource.com/platform/external/avb/ 31 | 32 | borringssl 33 | OpenSSL + ISC license 34 | Copyright (c) 1998-2011 The OpenSSL Project. 35 | Copyright (c) 2015, Google Inc. 36 | SPDX-License-Identifier: OpenSSL + ISC 37 | https://github.com/google/boringssl 38 | 39 | fatfs 40 | BSD-style 41 | Copyright (C) 20xx, ChaN 42 | https://github.com/abbrev/fatfs 43 | 44 | AOSP-Trusty 45 | The Android Open Source Project, primarily licensed under the Apache License, Version 2.0 46 | SPDX-License-Identifier: Apache-2.0 47 | https://android.googlesource.com/trusty/external/trusty/+/master/ql-tipc 48 | 49 | -------------------------------------------------------------------------------- /avb/libavb/avb_footer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #include "avb_footer.h" 26 | #include "avb_util.h" 27 | 28 | bool avb_footer_validate_and_byteswap(const AvbFooter* src, AvbFooter* dest) { 29 | avb_memcpy(dest, src, sizeof(AvbFooter)); 30 | 31 | dest->version_major = avb_be32toh(dest->version_major); 32 | dest->version_minor = avb_be32toh(dest->version_minor); 33 | 34 | dest->original_image_size = avb_be64toh(dest->original_image_size); 35 | dest->vbmeta_offset = avb_be64toh(dest->vbmeta_offset); 36 | dest->vbmeta_size = avb_be64toh(dest->vbmeta_size); 37 | 38 | /* Check that magic is correct. */ 39 | if (avb_safe_memcmp(dest->magic, AVB_FOOTER_MAGIC, AVB_FOOTER_MAGIC_LEN) != 40 | 0) { 41 | avb_error("Footer magic is incorrect.\n"); 42 | return false; 43 | } 44 | 45 | /* Ensure we don't attempt to access any fields if the footer major 46 | * version is not supported. 47 | */ 48 | if (dest->version_major > AVB_FOOTER_VERSION_MAJOR) { 49 | avb_error("No support for footer version.\n"); 50 | return false; 51 | } 52 | 53 | return true; 54 | } 55 | -------------------------------------------------------------------------------- /avb/libavb/avb_version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #include "avb_version.h" 26 | 27 | #define AVB_QUOTE(str) #str 28 | #define AVB_EXPAND_AND_QUOTE(str) AVB_QUOTE(str) 29 | 30 | /* Keep in sync with get_release_string() in avbtool. */ 31 | const char* avb_version_string(void) { 32 | return AVB_EXPAND_AND_QUOTE(AVB_VERSION_MAJOR) "." AVB_EXPAND_AND_QUOTE( 33 | AVB_VERSION_MINOR) "." AVB_EXPAND_AND_QUOTE(AVB_VERSION_SUB); 34 | } 35 | -------------------------------------------------------------------------------- /avb/libavb/avb_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #if !defined(AVB_INSIDE_LIBAVB_H) && !defined(AVB_COMPILATION) 26 | #error "Never include this file directly, include libavb.h instead." 27 | #endif 28 | 29 | #ifndef AVB_VERSION_H_ 30 | #define AVB_VERSION_H_ 31 | 32 | #include "avb_sysdeps.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /* The version number of AVB - keep in sync with avbtool. */ 39 | #define AVB_VERSION_MAJOR 1 40 | #define AVB_VERSION_MINOR 1 41 | #define AVB_VERSION_SUB 0 42 | 43 | /* Returns a NUL-terminated string for the libavb version in use. The 44 | * returned string usually looks like "%d.%d.%d". Applications must 45 | * not make assumptions about the content of this string. 46 | * 47 | * Boot loaders should display this string in debug/diagnostics output 48 | * to aid with debugging. 49 | * 50 | * This is similar to the string put in the |release_string| string 51 | * field in the VBMeta struct by avbtool. 52 | */ 53 | const char* avb_version_string(void); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif /* AVB_VERSION_H_ */ 60 | -------------------------------------------------------------------------------- /avb/libavb/libavb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #ifndef LIBAVB_H_ 26 | #define LIBAVB_H_ 27 | 28 | /* The AVB_INSIDE_LIBAVB_H preprocessor symbol is used to enforce 29 | * library users to include only this file. All public interfaces, and 30 | * only public interfaces, must be included here. 31 | */ 32 | 33 | #define AVB_INSIDE_LIBAVB_H 34 | #include "avb_chain_partition_descriptor.h" 35 | #include "avb_crypto.h" 36 | #include "avb_descriptor.h" 37 | #include "avb_footer.h" 38 | #include "avb_hash_descriptor.h" 39 | #include "avb_hashtree_descriptor.h" 40 | #include "avb_kernel_cmdline_descriptor.h" 41 | #include "avb_ops.h" 42 | #include "avb_property_descriptor.h" 43 | #include "avb_slot_verify.h" 44 | #include "avb_sysdeps.h" 45 | #include "avb_util.h" 46 | #include "avb_vbmeta_image.h" 47 | #include "avb_version.h" 48 | #undef AVB_INSIDE_LIBAVB_H 49 | 50 | #endif /* LIBAVB_H_ */ 51 | -------------------------------------------------------------------------------- /avb/libavb_ab/libavb_ab.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #ifndef LIBAVB_AB_H_ 26 | #define LIBAVB_AB_H_ 27 | 28 | #include 29 | 30 | /* The libavb_ab/ and boot_control/ code has been marked for some time 31 | * as experimental in anticipation of being removed in the future. It 32 | * is now deprecated and to continue using it you must define 33 | * AVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED. It will be removed Jun 34 | * 1 2018. 35 | */ 36 | #ifndef AVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED 37 | #error \ 38 | "You must define AVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED to use this library." 39 | #endif 40 | 41 | /* The AVB_INSIDE_LIBAVB_AB_H preprocessor symbol is used to enforce 42 | * library users to include only this file. All public interfaces, and 43 | * only public interfaces, must be included here. 44 | */ 45 | 46 | #define AVB_INSIDE_LIBAVB_AB_H 47 | #include "avb_ab_flow.h" 48 | #include "avb_ab_ops.h" 49 | #undef AVB_INSIDE_LIBAVB_AB_H 50 | 51 | #endif /* LIBAVB_AB_H_ */ 52 | -------------------------------------------------------------------------------- /avb/libavb_atx/libavb_atx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #ifndef LIBAVB_ATX_H_ 26 | #define LIBAVB_ATX_H_ 27 | 28 | #include 29 | 30 | /* The AVB_INSIDE_LIBAVB_ATX_H preprocessor symbol is used to enforce 31 | * library users to include only this file. All public interfaces, and 32 | * only public interfaces, must be included here. 33 | */ 34 | 35 | #define AVB_INSIDE_LIBAVB_ATX_H 36 | #include "avb_atx_ops.h" 37 | #include "avb_atx_types.h" 38 | #include "avb_atx_validate.h" 39 | #undef AVB_INSIDE_LIBAVB_ATX_H 40 | 41 | #endif /* LIBAVB_ATX_H_ */ 42 | -------------------------------------------------------------------------------- /avb/libavb_user/uefi_avb_ops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #ifndef UEFI_AVB_OPS_H_ 26 | #define UEFI_AVB_OPS_H_ 27 | 28 | #include 29 | #include "libavb/libavb.h" 30 | /* The |user_data| member of AvbOps points to a struct of this type. */ 31 | typedef struct UEFIAvbOpsData { 32 | AvbOps ops; 33 | //AVbops_AB ops_ab; 34 | EFI_BLOCK_IO* block_io; 35 | EFI_DISK_IO* disk_io; 36 | } UEFIAvbOpsData; 37 | 38 | /* Returns an AvbOps for use with UEFI. */ 39 | AvbOps* uefi_avb_ops_new(void); 40 | 41 | /* Frees the AvbOps allocated with uefi_avb_ops_new(). */ 42 | void uefi_avb_ops_free(AvbOps* ops); 43 | 44 | #endif /* UEFI_AVB_OPS_H_ */ 45 | -------------------------------------------------------------------------------- /avb/libavb_user/uefi_avb_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | // NOTE: See avb_sysdeps.h 26 | 27 | #ifndef UEFI_AVB_UTIL_H_ 28 | #define UEFI_AVB_UTIL_H_ 29 | 30 | #include 31 | 32 | /* Converts UTF-8 to UCS-2. Returns |false| if invalid UTF-8 or if a 33 | * rune cannot be represented as UCS-2. 34 | */ 35 | bool uefi_avb_utf8_to_ucs2(const uint8_t* utf8_data, 36 | size_t utf8_num_bytes, 37 | uint16_t* ucs2_data, 38 | size_t ucs2_data_capacity_num_bytes, 39 | size_t* out_ucs2_data_num_bytes); 40 | 41 | #endif /* UEFI_AVB_UTIL_H_ */ 42 | -------------------------------------------------------------------------------- /build/README: -------------------------------------------------------------------------------- 1 | Files in this directory is used to build fastboot elf without Android 2 | build environment. 3 | 4 | The build out "fastboot" is positioned as basic flash tool only. Thus, 5 | limited fastboot commands are supported: 6 | 7 | fastboot flash //flash gpt or flash some data to 8 | a disk partition or some special data. 9 | fastboot erase //erase a partition. 10 | fastboot gatvar |all //get a var value or all vars value. 11 | fastboot reboot //Reboot the device. 12 | fastboot reboot-bootloader //Reboot the device to fastboot mode. 13 | 14 | Tested on ubuntu 16.04, cmake3.5 and clang6.0 or above are needed. 15 | for ubuntu 14.04, cmake3 and clang3.9 should be installed by apt-get. 16 | 17 | To compile fastboot.elf standalone, in your workdir 18 | cmake path-to-kernelflinger/build 19 | dependent sources will be cloned by git automatically, then 20 | cmake --build . 21 | 22 | The default target platform is broxton, optional target platform is 23 | broxton, icelake, tigerlake, kabylake, to set target platform, set variable 24 | TARGET_BOARD_PLATFORM in config.cmake 25 | 26 | The generated fastboot.sym.elf in workdir is an elf executable with system symbols, 27 | no ui, and doesn't support x86_64 for the time being. 28 | -------------------------------------------------------------------------------- /build/config.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2018, Intel Corporation 3 | # All rights reserved. 4 | # 5 | # Author: Meng Xianglin 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions 9 | # are met: 10 | # 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer 15 | # in the documentation and/or other materials provided with the 16 | # distribution. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | # OF THE POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # This file defines bootlogic data structures, try to keep it without 32 | # any external definitions in order to ease export of it. 33 | # 34 | 35 | set(CAPSULE_SOURCE CAPSULE4ABL) 36 | set(TARGET_PRODUCT \"standalone\") 37 | set(PRODUCT_MANUFACTURER \"Intel\") 38 | # optional platform: PLATFORM_BROXTON, PLATFORM_ICELAKE 39 | # PLATFORM_TIGERLAKE, PLATFORM_KABYLAKE 40 | set(TARGET_BOARD_PLATFORM PLATFORM_BROXTON) 41 | 42 | set(EFIWRAPPER_LIB_DEF 43 | ${CAPSULE_SOURCE} 44 | ${TARGET_BOARD_PLATFOMR} 45 | PRODUCT_NAME=${TARGET_PRODUCT} 46 | PRODUCT_MANUFACTURER=${PRODUCT_MANUFACTURER} 47 | ) 48 | if(${LOADER_ARCH} STREQUAL "x86_64") 49 | set(EFIWRAPPER_LIB_DEF ${EFIWRAPPER_LIB_DEF} EFI_FUNCTION_WRAPPER GNU_EFI_USE_MS_ABI) 50 | endif() 51 | 52 | # optional drivers 53 | set(LIBEFIWRAPPER_DRIVERS 54 | s8250mem32 55 | sdhci_mmc 56 | dw3 57 | lpmemmap 58 | lprtc 59 | acpi 60 | cf9 61 | lifecycle 62 | abl 63 | ioc_uart 64 | heci 65 | tco_wdt 66 | mmc_serial 67 | ) 68 | -------------------------------------------------------------------------------- /doc/autodetect.md: -------------------------------------------------------------------------------- 1 | Autodetect 2 | ========== 3 | 4 | Overview 5 | -------- 6 | 7 | Autodetect can be activated with the Kernelflinger `HAL_AUTODETECT` 8 | compilation flag. 9 | 10 | If Autodetect is enabled, Kernelflinger prepends some `androidboot` 11 | parameter to the kernel command line: 12 | 13 | - `androidboot.brand`: Combines the value of the DMI Board 14 | `manufacturer` and Product `manufacturer` fields. 15 | - `androidboot.name`: Combines the value of the DMI Product 16 | `product_name` and Board `product_name`. 17 | - `androidboot.device`: Combines the value of the DMI Board 18 | `product_name` and Board `version`. 19 | - `androidboot.model`: same value than `androidboot.device`. 20 | 21 | The init process is converting these command line parameters to 22 | properties that can be used to identify the device product. 23 | 24 | If Autodetect is enabled, Kernelflinger also loads the Blobstore 25 | stored in the second stage area of the boot image, extract the OEMVARS 26 | blob for the current device variant and flash these product dependent 27 | EFI variables. 28 | 29 | Blobstore 30 | --------- 31 | 32 | Blobstore is a structure storing any kind of data inside the second 33 | stage area of the bootimage. The data is organized as a dictionary in 34 | which the key is the string: `//`. 35 | (Cf. [blobstore.c](../libkernelflinger/blobstore.c). 36 | 37 | Blobstore current support the following data type: device tree blob, 38 | OEMVARS (Cf. [Fastboot](./fastboot.md)) and Kernel command line 39 | parameters. Kernelflinger does not make use of the device tree blob 40 | type. 41 | -------------------------------------------------------------------------------- /include/aes_gcm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Intel Corporation 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _AES_GCM_H_ 18 | #define _AES_GCM_H_ 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #define GCM_IV_SIZE 12 29 | #define GCM_TAG_SIZE 16 30 | #define GCM_KEY_SIZE 32 31 | 32 | struct gcm_key { 33 | uint8_t byte[GCM_KEY_SIZE]; 34 | }; 35 | 36 | struct gcm_tag { 37 | uint8_t byte[GCM_TAG_SIZE]; 38 | }; 39 | 40 | #define AES_GCM_NO_ERROR 0 41 | #define AES_GCM_ERR_GENERIC -1 42 | #define AES_GCM_ERR_AUTH_FAILED -2 43 | 44 | int aes_256_gcm_encrypt(const struct gcm_key *key, 45 | const void *iv, size_t iv_size, 46 | const void *aad, size_t aad_size, 47 | const void *plain, size_t plain_size, 48 | void *out, size_t *out_size); 49 | 50 | int aes_256_gcm_decrypt(const struct gcm_key *key, 51 | const void *iv, size_t iv_size, 52 | const void *aad, size_t aad_size, 53 | const void *cipher, size_t cipher_size, 54 | void *out, size_t *out_size); 55 | #endif 56 | -------------------------------------------------------------------------------- /include/blobstore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Andrew Boie 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef BLOBSTORE_H_ 34 | #define BLOBSTORE_H_ 35 | 36 | struct blobstore; 37 | 38 | enum blobtype { 39 | BLOB_TYPE_DTB, 40 | BLOB_TYPE_OEMVARS, 41 | BLOB_TYPE_BOOTVARS 42 | }; 43 | 44 | /* Cast an arbitray pointer to a blobstore pointer. This just does some 45 | * sanity checking, nothing is heap-allocated or changed in the data. 46 | * Returns NULL if this isn't a blobstore or is corrupted */ 47 | struct blobstore *blobstore_get(void *mem, unsigned int size); 48 | 49 | /* Fetch an item out of the blobstore. Returns nonzero if it isn't found 50 | * or the blobstore is corrupted */ 51 | int blobstore_get_item(struct blobstore *bs, char *key, enum blobtype type, 52 | void **data, unsigned int *size); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/dt_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DT_TABLE_H 18 | #define DT_TABLE_H 19 | 20 | #include 21 | /* 22 | * For the image layout, refer README.md for the detail 23 | */ 24 | 25 | #define DT_TABLE_MAGIC 0xd7b7ab1e 26 | #define DT_TABLE_DEFAULT_PAGE_SIZE 2048 27 | #define DT_TABLE_DEFAULT_VERSION 0 28 | 29 | struct dt_table_header { 30 | UINT32 magic; /* DT_TABLE_MAGIC */ 31 | UINT32 total_size; /* includes dt_table_header + all dt_table_entry 32 | and all dtb/dtbo */ 33 | UINT32 header_size; /* sizeof(dt_table_header) */ 34 | 35 | UINT32 dt_entry_size; /* sizeof(dt_table_entry) */ 36 | UINT32 dt_entry_count; /* number of dt_table_entry */ 37 | UINT32 dt_entries_offset; /* offset to the first dt_table_entry 38 | from head of dt_table_header. 39 | The value will be equal to header_size if 40 | no padding is appended */ 41 | 42 | UINT32 page_size; /* flash page size we assume */ 43 | UINT32 version; /* DTBO image version, the current version is 0. 44 | The version will be incremented when the 45 | dt_table_header struct is updated. */ 46 | }; 47 | 48 | struct dt_table_entry { 49 | UINT32 dt_size; 50 | UINT32 dt_offset; /* offset from head of dt_table_header */ 51 | 52 | UINT32 id; /* optional, must be zero if unused */ 53 | UINT32 rev; /* optional, must be zero if unused */ 54 | UINT32 custom[4]; /* optional, must be zero if unused */ 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /include/em.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _EM_H_ 34 | #define _EM_H_ 35 | 36 | BOOLEAN is_charger_plugged_in(void); 37 | BOOLEAN is_battery_below_boot_OS_threshold(void); 38 | EFI_STATUS get_battery_voltage(UINTN *voltage); 39 | 40 | #endif /* _EM_H_ */ 41 | -------------------------------------------------------------------------------- /include/embedded_controller.h: -------------------------------------------------------------------------------- 1 | /* 2 | *Copyright (C) 2024 Intel Corporation 3 | *SPDX-License-Identifier: BSD-3-Clause 4 | */ 5 | 6 | #ifndef _EMBEDDED_CONTROLLLER_ 7 | #define _EMBEDDED_CONTROLLLER_ 8 | 9 | UINT8 get_ec_sub_ver(UINT8 Port); 10 | void output_ec_version(void); 11 | EFI_STATUS update_ec(void *data, uint32_t len); 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /include/endian.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * This file defines bootlogic data structures, try to keep it without 30 | * any external definitions in order to ease export of it. 31 | */ 32 | 33 | #ifndef _ENDIAN_H_ 34 | #define _ENDIAN_H_ 35 | 36 | #include 37 | 38 | #define htobe16 __builtin_bswap16 39 | #define htobe32 __builtin_bswap32 40 | #define htobe64 __builtin_bswap64 41 | 42 | #define be16toh __builtin_bswap16 43 | #define be32toh __builtin_bswap32 44 | #define be64toh __builtin_bswap64 45 | 46 | #define le32toh(x) (x) 47 | #define htole32(x) (x) 48 | 49 | typedef UINT8 __be8; 50 | typedef UINT16 __be16; 51 | typedef UINT32 __be32; 52 | typedef UINT64 __be64; 53 | 54 | #endif /* _ENDIAN_H_ */ 55 | -------------------------------------------------------------------------------- /include/firststage_mount.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Haoyu Tang 6 | * Chen, ZhiminX 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer 16 | * in the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 | * OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | #ifndef _FIRSTSTAGE_MOUNT_H_ 35 | #define _FIRSTSTAGE_MOUNT_H_ 36 | 37 | EFI_STATUS install_firststage_mount_aml(enum boot_target target); 38 | #ifdef AUTO_DISKBUS 39 | EFI_STATUS revise_diskbus_from_ssdt(CHAR8 *ssdt, UINTN ssdt_len); 40 | #endif 41 | 42 | #endif /* ifndef _FIRSTSTAGE_MOUNT_H_ */ 43 | -------------------------------------------------------------------------------- /include/gpt_bin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Sylvain Chouleur 6 | * Jeremy Compostella 7 | * Jocelyn Falempe 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #ifndef __GPT_BIN_H__ 36 | #define __GPT_BIN_H__ 37 | 38 | #include 39 | 40 | #define GPT_BIN_MAGIC 0x6a8b0da1 41 | 42 | /* length unit is MiB */ 43 | #define MiB (1024 * 1024) 44 | 45 | struct gpt_bin_header { 46 | UINT32 magic; 47 | UINT32 start_lba; 48 | UINT32 npart; 49 | }; 50 | 51 | struct gpt_bin_part { 52 | INT32 length; 53 | CHAR16 label[36]; 54 | EFI_GUID type; 55 | EFI_GUID uuid; 56 | }; 57 | 58 | #endif /* __GPT_BIN_H__ */ 59 | -------------------------------------------------------------------------------- /include/hecisupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef _HECISUPPORT_H_ 31 | #define _HECISUPPORT_H_ 32 | 33 | #include "Heci.h" 34 | #include "MkhiMsgs.h" 35 | 36 | #define EOP_GROUP_ID 0xFF 37 | #define EOP_CMD_ID 0xC 38 | #define EOP_GET_STATUS_ID 0X1D 39 | 40 | //EOP-REQ 41 | typedef struct _GEN_END_OF_POST 42 | { 43 | MKHI_MESSAGE_HEADER MKHIHeader; 44 | } GEN_END_OF_POST; 45 | 46 | extern BOOLEAN heci_is_eop_received(void); 47 | extern EFI_STATUS heci_end_of_post(void); 48 | 49 | #endif /* _HECISUPPORT_H_ */ 50 | -------------------------------------------------------------------------------- /include/ioc_can.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: kui.wen@intel.com 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _IOC_CAN_H_ 34 | #define _IOC_CAN_H_ 35 | 36 | #include 37 | 38 | EFI_STATUS notify_ioc_ready(); 39 | EFI_STATUS set_suppress_heart_beat_timeout(UINT32 timeout); 40 | 41 | #endif /* _IOC_CAN_H_ */ -------------------------------------------------------------------------------- /include/keybox_provision.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Intel Corporation 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _KEYBOX_PROVISION_H_ 18 | #define _KEYBOX_PROVISION_H_ 19 | 20 | EFI_STATUS flash_keybox(VOID *data, UINTN size); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /include/libelfloader.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Intel Corporation 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | #ifndef _LIBELFLOADER_H_ 18 | #define _LIBELFLOADER_H_ 19 | 20 | #include "efi.h" 21 | #include "efilib.h" 22 | 23 | BOOLEAN relocate_elf_image( IN uint64_t ld_addr, 24 | IN uint64_t ld_size, 25 | IN uint64_t rt_addr, 26 | IN uint64_t rt_size, 27 | OUT uint64_t *p_entry); 28 | 29 | #endif /* _LIBELFLOADER_H_ */ 30 | -------------------------------------------------------------------------------- /include/libtipc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | #ifndef TRUSTY_LIBTIPC_H_ 25 | #define TRUSTY_LIBTIPC_H_ 26 | 27 | 28 | /* 29 | * Initialize TIPC library 30 | */ 31 | int trusty_ipc_init(void); 32 | /* 33 | * Shutdown TIPC library 34 | */ 35 | void trusty_ipc_shutdown(void); 36 | 37 | #endif /* TRUSTY_LIBTIPC_H_ */ 38 | -------------------------------------------------------------------------------- /include/life_cycle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Leo Sartre 6 | * Jeremy Compostella 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer 16 | * in the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 | * OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | #ifndef _LIFE_CYCLE_H_ 35 | #define _LIFE_CYCLE_H_ 36 | 37 | #include 38 | #include 39 | 40 | EFI_STATUS life_cycle_is_enduser(BOOLEAN *enduser); 41 | 42 | #endif /* _LIFE_CYCLE_H_ */ 43 | -------------------------------------------------------------------------------- /include/oemvars.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef __OEMVARS_H__ 34 | #define __OEMVARS_H__ 35 | 36 | #include 37 | 38 | EFI_STATUS flash_oemvars(VOID *data, UINTN size); 39 | EFI_STATUS flash_oemvars_silent_write_error(VOID *data, UINTN size, 40 | const EFI_GUID *restricted_guid); 41 | 42 | #endif /* __OEMVARS_H__ */ 43 | -------------------------------------------------------------------------------- /include/options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Andrew Boie 6 | * Some Linux bootstrapping code adapted from efilinux by 7 | * Matt Fleming 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #ifndef _OPTIONS_H_ 36 | #define _OPTIONS_H_ 37 | 38 | #include 39 | #include 40 | 41 | EFI_STATUS get_argv(EFI_LOADED_IMAGE *image, UINTN *argc_p, CHAR16 ***argv_p, CHAR16 **options); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/pae.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _PAE_H_ 34 | #define _PAE_H_ 35 | 36 | EFI_STATUS pae_init(CHAR8 *entries, UINTN nr_entries, UINTN entry_sz); 37 | EFI_STATUS pae_map(EFI_PHYSICAL_ADDRESS addr, unsigned char **to, UINT64 *len); 38 | EFI_STATUS pae_exit(void); 39 | 40 | #endif /* _PAE_H_ */ 41 | -------------------------------------------------------------------------------- /include/security_interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _SECURITY_INTERFACE_H_ 32 | #define _SECURITY_INTERFACE_H_ 33 | 34 | #include 35 | 36 | EFI_STATUS set_device_security_info(IN VOID *security_data); 37 | 38 | #endif /* _SECURITY_INTERFACE_H_ */ 39 | -------------------------------------------------------------------------------- /include/security_vb2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _SECURITY_VB2_H_ 18 | #define _SECURITY_VB2_H_ 19 | 20 | EFI_STATUS rot_pub_key_sha256(IN VBDATA *vb_data, 21 | OUT UINT8 **hash_p); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /include/smbios.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _SMBIOS_H_ 34 | #define _SMBIOS_H_ 35 | 36 | #define TYPE_BIOS 0 37 | #define TYPE_PRODUCT 1 38 | #define TYPE_BOARD 2 39 | #define TYPE_CHASSIS 3 40 | 41 | extern char *SMBIOS_UNDEFINED; 42 | 43 | char *smbios_get_string(UINT8 type, UINT8 offset); 44 | 45 | #define SMBIOS_GET_STRING(type, field) \ 46 | smbios_get_string(type, offsetof(SMBIOS_TYPE##type, field)) 47 | 48 | #endif /* _SMBIOS_H_ */ 49 | -------------------------------------------------------------------------------- /include/targets.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Andrew Boie 6 | * Jeremy Compostella 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer 16 | * in the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 | * OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | #ifndef _TARGETS_H_ 35 | #define _TARGETS_H_ 36 | 37 | #include 38 | #include 39 | 40 | enum boot_target { 41 | UNKNOWN_TARGET = -1, 42 | NORMAL_BOOT, 43 | FASTBOOT, 44 | ELK, 45 | RECOVERY, 46 | CRASHMODE, 47 | DNX, 48 | ESP_BOOTIMAGE, 49 | ESP_EFI_BINARY, 50 | MEMORY, 51 | CHARGER, 52 | POWER_OFF, 53 | EXIT_SHELL 54 | }; 55 | 56 | #define is_bootimg_target(target) \ 57 | (target == NORMAL_BOOT || target == CHARGER || target == RECOVERY) 58 | 59 | const CHAR16 *boot_target_name(enum boot_target bt); 60 | const CHAR16 *boot_target_description(enum boot_target bt); 61 | enum boot_target name_to_boot_target(const CHAR16 *str); 62 | EFI_STATUS reboot_to_target(enum boot_target bt, EFI_RESET_TYPE type); 63 | 64 | #endif /* _TARGETS_H_ */ 65 | -------------------------------------------------------------------------------- /include/tcp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _TCP_H_ 34 | #define _TCP_H_ 35 | 36 | #include 37 | #include 38 | 39 | EFI_STATUS tcp_start(UINT32 port, start_callback_t start_cb, 40 | data_callback_t rx_cb, data_callback_t tx_cb, 41 | EFI_IPv4_ADDRESS *station_address); 42 | EFI_STATUS tcp_stop(void); 43 | EFI_STATUS tcp_run(UINT32 *state); 44 | EFI_STATUS tcp_read(void *buf, UINT32 size); 45 | EFI_STATUS tcp_write(void *buf, UINT32 size); 46 | 47 | #endif /* _TCP_H_ */ 48 | -------------------------------------------------------------------------------- /include/text_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _TEXT_PARSER_H_ 34 | #define _TEXT_PARSER_H_ 35 | 36 | #include 37 | #include 38 | 39 | void skip_whitespace(char **line); 40 | EFI_STATUS parse_text_buffer(VOID *data, UINTN size, 41 | EFI_STATUS (*parse_line)(char *line, VOID *ctx), 42 | VOID *context); 43 | 44 | #endif /* _TEXT_PARSER_H_ */ 45 | -------------------------------------------------------------------------------- /include/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | #ifndef _TIMER_H_ 31 | #define _TIMER_H_ 32 | 33 | #include 34 | #include 35 | #include "lib.h" 36 | 37 | enum TM_POINT { 38 | TM_EFI_MAIN = 0, 39 | TM_AVB_START, 40 | TM_VERIFY_BOOT_DONE, 41 | TM_LOAD_TOS_DONE, 42 | TM_LAUNCH_TRUSTY_DONE, 43 | TM_PROCRSS_TRUSTY_DONE, 44 | TM_JMP_KERNEL, 45 | TM_POINT_LAST 46 | }; 47 | 48 | uint32_t get_cpu_freq(void); /* cpu freq, mhz */ 49 | uint32_t get_tsc_mhz(void); /* tsc hz, mhz*/ 50 | uint64_t rdtsc(void); 51 | uint32_t boottime_in_msec(void); 52 | void set_boottime_stamp(int num); 53 | void set_efi_enter_point(unsigned int value); 54 | void construct_stages_boottime(CHAR8 *time_str, size_t buf_len); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /include/trusty_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _TRUSTY_COMMON_H_ 32 | #define _TRUSTY_COMMON_H_ 33 | 34 | #include "efi.h" 35 | #include "efilib.h" 36 | 37 | EFI_STATUS load_tos_image(OUT VOID **bootimage); 38 | 39 | VOID trusty_late_init(VOID); 40 | 41 | #endif /* _TRUSTY_COMMON_H_ */ 42 | -------------------------------------------------------------------------------- /include/trusty_interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _TRUSTY_INTERFACE_H_ 32 | #define _TRUSTY_INTERFACE_H_ 33 | 34 | #include "efi.h" 35 | #include "efilib.h" 36 | #include "vars.h" 37 | #include 38 | 39 | #define LENGTH_TRUSTY_PARAM_STRING 18 40 | #define TRUSTY_PARAM_STRING "trusty.param_addr=" 41 | 42 | EFI_STATUS start_trusty(VOID *trusty_image); 43 | EFI_STATUS set_trusty_param(IN VOID *param_data); 44 | 45 | #endif /* _TRUSTY_INTERFACE_H_ */ 46 | -------------------------------------------------------------------------------- /include/upng.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _UPNG_H_ 34 | #define _UPNG_H_ 35 | 36 | #include 37 | 38 | EFI_STATUS upng_load(const char *data, UINTN size, 39 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL **blt, 40 | UINTN *width, UINTN *height); 41 | 42 | #endif /* _UPNG_H_ */ 43 | -------------------------------------------------------------------------------- /include/usb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Sylvain Chouleur 6 | * Jeremy Compostella 7 | * Jocelyn Falempe 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #ifndef _USB_H_ 36 | #define _USB_H_ 37 | 38 | #include 39 | 40 | EFI_STATUS usb_start(UINT8 subclass, 41 | UINT8 protocol, 42 | CHAR16 *str_configuration, 43 | CHAR16 *str_interface, 44 | start_callback_t start_cb, 45 | data_callback_t rx_cb, 46 | data_callback_t tx_cb); 47 | EFI_STATUS usb_stop(void); 48 | EFI_STATUS usb_run(UINT32 *state); 49 | EFI_STATUS usb_read(void *buf, UINT32 size); 50 | EFI_STATUS usb_write(void *buf, UINT32 size); 51 | 52 | #endif /* _USB_H_ */ 53 | -------------------------------------------------------------------------------- /include/vbmeta_ias.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Wu Ji Zhang, GaofengX 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | #ifndef _VBMETA_IAS_H 32 | #define _VBMETA_IAS_H 33 | EFI_STATUS verify_vbmeta_ias(CHAR16 *label, CHAR16* fileName, BOOLEAN *verify_pass); 34 | #endif 35 | -------------------------------------------------------------------------------- /include/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Andrew Boie 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef KERNELFLINGER_VERSION_H 34 | #define KERNELFLINGER_VERSION_H 35 | 36 | #define WIDE_STR2(x) L ## x 37 | #define WIDE_STR(x) WIDE_STR2(x) 38 | 39 | #if defined(USER) 40 | #define BUILD_VARIANT "" 41 | #elif defined(USERDEBUG) 42 | #define BUILD_VARIANT "-userdebug" 43 | #else 44 | #define BUILD_VARIANT "-eng" 45 | #endif 46 | 47 | #ifdef FASTBOOT_FOR_NON_ANDROID 48 | #define KERNELFLINGER_VERSION_8 "fastboot-NonAndroid-1.0" BUILD_VARIANT 49 | #else 50 | #define KERNELFLINGER_VERSION_8 "kernelflinger-07.02" BUILD_VARIANT 51 | #endif 52 | #define KERNELFLINGER_VERSION WIDE_STR(KERNELFLINGER_VERSION_8) 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/watchdog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _WATCHDOG_H_ 32 | #define _WATCHDOG_H_ 33 | 34 | #include 35 | 36 | #define TCO_DEFAULT_TIMEOUT 60 37 | #define TCO_MIN_TIMEOUT 4 38 | #define TCO_OPT_DISABLED "iTCO_wdt.force_no_reboot=1" 39 | 40 | EFI_STATUS start_watchdog(UINT32 seconds); 41 | BOOLEAN watchdog_disabled_from_cmdline(CHAR8 *); 42 | 43 | #endif /* _WATCHDOG_H_ */ 44 | -------------------------------------------------------------------------------- /libadb/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libadb-$(TARGET_BUILD_VARIANT) 6 | LOCAL_CFLAGS := $(KERNELFLINGER_CFLAGS) 7 | LOCAL_STATIC_LIBRARIES := \ 8 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 9 | libefiusb-$(TARGET_BUILD_VARIANT) \ 10 | libefitcp-$(TARGET_BUILD_VARIANT) \ 11 | libtransport-$(TARGET_BUILD_VARIANT) \ 12 | libkernelflinger-$(TARGET_BUILD_VARIANT) 13 | 14 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include/libadb 15 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include/libadb 16 | LOCAL_SRC_FILES := \ 17 | adb.c \ 18 | adb_socket.c \ 19 | reboot_service.c \ 20 | sync_service.c \ 21 | reader.c \ 22 | shell_service.c \ 23 | devmem.c \ 24 | lsacpi.c \ 25 | hexdump.c \ 26 | ioport.c \ 27 | lspartition.c \ 28 | pci_class.c \ 29 | lspci.c 30 | 31 | include $(BUILD_EFI_STATIC_LIBRARY) 32 | -------------------------------------------------------------------------------- /libadb/adb_socket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _ADB_SOCKET_H_ 34 | #define _ADB_SOCKET_H_ 35 | 36 | #include 37 | #include 38 | 39 | #include "adb.h" 40 | 41 | typedef struct asock * asock_t; 42 | 43 | struct service; 44 | 45 | #define MAX_ADB_SOCKET 5 46 | 47 | /* Host to device */ 48 | EFI_STATUS asock_open(UINT32 remote, struct service *service, char *arg); 49 | EFI_STATUS asock_close(asock_t s); 50 | EFI_STATUS asock_okay(asock_t s); 51 | EFI_STATUS asock_read(asock_t s, unsigned char *data, UINT32 length); 52 | 53 | /* Device to host */ 54 | EFI_STATUS asock_write(asock_t s, unsigned char *data, UINT32 length); 55 | EFI_STATUS asock_send_okay(asock_t s); 56 | EFI_STATUS asock_send_close(asock_t s); 57 | 58 | /* Tools */ 59 | void *asock_context(asock_t s); 60 | asock_t asock_find(UINT32 local, UINT32 remote); 61 | void asock_close_all(); 62 | 63 | #endif /* _ADB_SOCKET_H_ */ 64 | -------------------------------------------------------------------------------- /libadb/devmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _DEVMEM_H_ 34 | #define _DEVMEM_H_ 35 | 36 | #include "shell_service.h" 37 | 38 | extern shcmd_t devmem_shcmd; 39 | 40 | #endif /* _DEVMEM_H_ */ 41 | -------------------------------------------------------------------------------- /libadb/hexdump.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _HEXDUMP_H_ 34 | #define _HEXDUMP_H_ 35 | 36 | #include "shell_service.h" 37 | 38 | extern shcmd_t hexdump_shcmd; 39 | 40 | #endif /* _HEXDUMP_H_ */ 41 | -------------------------------------------------------------------------------- /libadb/ioport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _IOPORT_H_ 34 | #define _IOPORT_H_ 35 | 36 | #include "shell_service.h" 37 | 38 | static inline UINT32 inl(int port) 39 | { 40 | UINT32 val; 41 | 42 | __asm__ __volatile__("inl %w1, %0" : "=a"(val) : "Nd"(port)); 43 | return val; 44 | } 45 | 46 | static inline void outl(UINT32 val, int port) 47 | { 48 | __asm__ __volatile__("outl %0, %w1" : : "a"(val), "Nd"(port)); 49 | } 50 | 51 | extern shcmd_t inb_shcmd; 52 | extern shcmd_t inw_shcmd; 53 | extern shcmd_t inl_shcmd; 54 | extern shcmd_t outb_shcmd; 55 | extern shcmd_t outw_shcmd; 56 | extern shcmd_t outl_shcmd; 57 | 58 | #endif /* _IOPORT_H_ */ 59 | -------------------------------------------------------------------------------- /libadb/lsacpi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _LSACPI_H_ 34 | #define _LSACPI_H_ 35 | 36 | #include "shell_service.h" 37 | 38 | extern shcmd_t lsacpi_shcmd; 39 | 40 | #endif /* _LSACPI_H_ */ 41 | -------------------------------------------------------------------------------- /libadb/lspartition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _LSPARTITION_H_ 34 | #define _LSPARTITION_H_ 35 | 36 | #include "shell_service.h" 37 | 38 | extern shcmd_t lspartition_shcmd; 39 | 40 | #endif /* _LSPARTITION_H_ */ 41 | -------------------------------------------------------------------------------- /libadb/lspci.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _LSPCI_H_ 34 | #define _LSPCI_H_ 35 | 36 | #include "shell_service.h" 37 | 38 | extern shcmd_t lspci_shcmd; 39 | 40 | #endif /* _LSPCI_H_ */ 41 | -------------------------------------------------------------------------------- /libadb/pci_class.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _PCI_CLASS_H_ 34 | #define _PCI_CLASS_H_ 35 | 36 | #include 37 | 38 | const char *pci_class_string(UINT8 base, UINT8 sub); 39 | 40 | #endif /* _PCI_CLASS_H_ */ 41 | -------------------------------------------------------------------------------- /libadb/reader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _READER_H_ 34 | #define _READER_H_ 35 | 36 | #include 37 | 38 | typedef struct reader_context { 39 | struct reader *reader; 40 | UINT64 cur; 41 | UINT64 len; 42 | void *private; 43 | } reader_ctx_t; 44 | 45 | EFI_STATUS reader_open(reader_ctx_t *reader, char *args); 46 | EFI_STATUS reader_read(reader_ctx_t *reader, unsigned char **buf, UINT64 *len); 47 | void reader_close(reader_ctx_t *reader); 48 | 49 | #endif /* _READER_H_ */ 50 | -------------------------------------------------------------------------------- /libadb/service.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _SERVICE_H_ 34 | #define _SERVICE_H_ 35 | 36 | #include 37 | #include 38 | 39 | #include "adb_socket.h" 40 | 41 | /* adb service interface */ 42 | typedef struct service { 43 | const char *name; 44 | EFI_STATUS (*open)(const char *arg, void **context); 45 | EFI_STATUS (*ready)(asock_t s); 46 | EFI_STATUS (*close)(asock_t s); 47 | EFI_STATUS (*okay)(asock_t s); 48 | EFI_STATUS (*read)(asock_t s, unsigned char *data, UINT32 length); 49 | } service_t; 50 | 51 | extern service_t sync_service; 52 | extern service_t reboot_service; 53 | extern service_t shell_service; 54 | 55 | #endif /* _SERVICE_H_ */ 56 | -------------------------------------------------------------------------------- /libadb/shell_service.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _SHELL_SERVICE_H_ 34 | #define _SHELL_SERVICE_H_ 35 | 36 | #include 37 | 38 | EFI_STATUS ss_printf(const CHAR16 *fmt, ...); 39 | EFI_STATUS ss_read_number(const char *arg, const char *name, UINT64 *value); 40 | void ss_hexdump(unsigned char *buf, UINTN length, 41 | EFI_PHYSICAL_ADDRESS address, BOOLEAN canonical); 42 | 43 | #ifndef __LP64__ 44 | EFI_STATUS ss_pae_map(EFI_PHYSICAL_ADDRESS *address, UINT64 length); 45 | #endif 46 | 47 | typedef struct { 48 | const char *name; 49 | const char *summary; 50 | const char *help; 51 | EFI_STATUS (*main)(INTN argc, const char **argv); 52 | } shcmd_t; 53 | 54 | #endif /* _SHELL_SERVICE_H_ */ 55 | -------------------------------------------------------------------------------- /libedk2_tpm/Android.mk: -------------------------------------------------------------------------------- 1 | LIBEDK2_LOCAL_PATH := $(call my-dir) 2 | include $(call all-subdir-makefiles) 3 | LOCAL_PATH := $(LIBEDK2_LOCAL_PATH) 4 | 5 | include $(CLEAR_VARS) 6 | 7 | LOCAL_MODULE := libedk2_tpm 8 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include \ 9 | $(LOCAL_PATH)/../include/libkernelflinger 10 | LOCAL_CFLAGS := -Wall -Wextra -Werror -mrdrnd \ 11 | -DTARGET_BOOTLOADER_BOARD_NAME=\"$(TARGET_BOOTLOADER_BOARD_NAME)\" 12 | LOCAL_STATIC_LIBRARIES := libgnuefi \ 13 | libefi 14 | 15 | LOCAL_SRC_FILES := \ 16 | Tpm2NVStorage.c \ 17 | Tpm2Random.c \ 18 | Tpm2Help.c \ 19 | Tpm2Context.c \ 20 | Tpm2EnhancedAuthorization.c \ 21 | Tpm2Hierarchy.c \ 22 | Tpm2Integrity.c \ 23 | Tpm2Sequences.c \ 24 | Tpm2Session.c \ 25 | Tpm2Capability.c 26 | 27 | ifeq ($(TARGET_USE_SBL),true) 28 | LOCAL_SRC_FILES += \ 29 | RegisterFilterLibNull.c \ 30 | Tpm2Ptp.c \ 31 | IoLib.c \ 32 | Tpm2Tis.c 33 | else 34 | LOCAL_SRC_FILES += Tpm2DeviceLib.c 35 | endif 36 | 37 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \ 38 | $(LOCAL_PATH)/../include \ 39 | $(res_intermediates) 40 | 41 | include $(BUILD_EFI_STATIC_LIBRARY) 42 | -------------------------------------------------------------------------------- /libedk2_tpm/README: -------------------------------------------------------------------------------- 1 | EDK2 Functionality 2 | 3 | We use the edk2 library for creating and managing the TPM 4 | entities in kernelflinger. The necessary TPM functions are 5 | ported to kernelflinger/edk2. The Tcg2 protocol headers are 6 | ported to edk2/include. 7 | 8 | Github link : https://github.com/tianocore/edk2 -------------------------------------------------------------------------------- /libedk2_tpm/Tpm2DeviceLib.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Implement TPM2 SubmitCommand. 3 | 4 | Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | #include 17 | #include "Tpm2Help.h" 18 | #include "Tcg2Protocol.h" 19 | #include "Tpm2DeviceLib.h" 20 | 21 | EFI_STATUS 22 | EFIAPI 23 | Tpm2SubmitCommand ( 24 | IN UINT32 InputParameterBlockSize, 25 | IN UINT8 *InputParameterBlock, 26 | IN OUT UINT32 *OutputParameterBlockSize, 27 | IN UINT8 *OutputParameterBlock 28 | ) 29 | { 30 | EFI_STATUS Status; 31 | TPM2_RESPONSE_HEADER *Header; 32 | 33 | EFI_GUID gEfiTcg2ProtocolGuid = EFI_TCG2_PROTOCOL_GUID; 34 | EFI_TCG2_PROTOCOL *mTcg2Protocol; 35 | 36 | Status = LibLocateProtocol (&gEfiTcg2ProtocolGuid, (void **) &mTcg2Protocol); 37 | if (EFI_ERROR (Status) || mTcg2Protocol == NULL ) { 38 | // 39 | // Tcg2 protocol is not installed. So, TPM2 is not present. 40 | // 41 | return EFI_NOT_FOUND; 42 | } 43 | // 44 | // Assume when Tcg2 Protocol is ready, RequestUseTpm already done. 45 | // 46 | Status = mTcg2Protocol->SubmitCommand ( 47 | mTcg2Protocol, 48 | InputParameterBlockSize, 49 | InputParameterBlock, 50 | *OutputParameterBlockSize, 51 | OutputParameterBlock 52 | ); 53 | if (EFI_ERROR (Status)) { 54 | return Status; 55 | } 56 | 57 | Header = (TPM2_RESPONSE_HEADER *)OutputParameterBlock; 58 | *OutputParameterBlockSize = SwapBytes32 (Header->paramSize); 59 | 60 | return EFI_SUCCESS; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /libedk2_tpm/Tpm2Random.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | 3 | Copyright (c) 2012, Intel Corporation. All rights reserved.
4 | This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | **/ 13 | 14 | #include "UefiTcgPlatform.h" 15 | #include "Tpm2DeviceLib.h" 16 | #include "Tpm2Help.h" 17 | 18 | #pragma pack(1) 19 | 20 | typedef struct { 21 | TPM2_COMMAND_HEADER Header; 22 | UINT16 BytesRequested; 23 | } TPM2_GETRANDOM_COMMAND; 24 | 25 | typedef struct { 26 | TPM2_RESPONSE_HEADER Header; 27 | TPM2B_DIGEST RandomBytes; 28 | } TPM2_GETRANDOM_RESPONSE; 29 | 30 | #pragma pack() 31 | 32 | /** 33 | Send GetRandom command to TPM2. 34 | 35 | @param BytesRequested BytesRequested 36 | @param RandomBytes RandomBytes 37 | 38 | @retval EFI_SUCCESS Operation completed successfully. 39 | @retval EFI_DEVICE_ERROR Unexpected device behavior. 40 | **/ 41 | EFI_STATUS 42 | EFIAPI 43 | Tpm2GetRandom ( 44 | IN UINT16 BytesRequested, 45 | OUT TPM2B_DIGEST *RandomBytes 46 | ) 47 | { 48 | EFI_STATUS Status; 49 | TPM2_GETRANDOM_COMMAND Cmd; 50 | TPM2_GETRANDOM_RESPONSE Res; 51 | UINT32 ResultBufSize; 52 | 53 | Cmd.Header.tag = SwapBytes16(TPM_ST_NO_SESSIONS); 54 | Cmd.Header.paramSize = SwapBytes32(sizeof(Cmd)); 55 | Cmd.Header.commandCode = SwapBytes32(TPM_CC_GetRandom); 56 | Cmd.BytesRequested = SwapBytes16(BytesRequested); 57 | 58 | ResultBufSize = sizeof(Res); 59 | Status = Tpm2SubmitCommand (sizeof(Cmd), (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res); 60 | if (EFI_ERROR (Status)) { 61 | return Status; 62 | } 63 | RandomBytes->size = SwapBytes16(Res.RandomBytes.size); 64 | CopyMem (RandomBytes->buffer, Res.RandomBytes.buffer, RandomBytes->size); 65 | 66 | return Status; 67 | } 68 | -------------------------------------------------------------------------------- /libedk2_tpm/include/BaseIoLibIntrinsicInternal.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Common header file shared by all source files. 3 | 4 | This file includes package header files, dependent library classes. 5 | 6 | Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | **/ 9 | 10 | #ifndef __BASEIOLIB_INTRINSIC_INTERNAL_H_ 11 | #define __BASEIOLIB_INTRINSIC_INTERNAL_H_ 12 | 13 | 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/Acpi.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file contains the latest ACPI definitions that are 3 | consumed by drivers that do not care about ACPI versions. 4 | 5 | Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
6 | Copyright (c) 2019 - 2021, ARM Ltd. All rights reserved.
7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | 9 | **/ 10 | 11 | #ifndef _ACPI_H_ 12 | #define _ACPI_H_ 13 | 14 | #include 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/Bluetooth.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file contains the Bluetooth definitions that are consumed by drivers. 3 | These definitions are from Bluetooth Core Specification Version 4.0 June, 2010 4 | 5 | Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | 8 | **/ 9 | 10 | #ifndef _BLUETOOTH_H_ 11 | #define _BLUETOOTH_H_ 12 | 13 | #pragma pack(1) 14 | 15 | /// 16 | /// BLUETOOTH_ADDRESS 17 | /// 18 | typedef struct { 19 | /// 20 | /// 48bit Bluetooth device address. 21 | /// 22 | UINT8 Address[6]; 23 | } BLUETOOTH_ADDRESS; 24 | 25 | /// 26 | /// BLUETOOTH_CLASS_OF_DEVICE. See Bluetooth specification for detail. 27 | /// 28 | typedef struct { 29 | UINT8 FormatType:2; 30 | UINT8 MinorDeviceClass: 6; 31 | UINT16 MajorDeviceClass: 5; 32 | UINT16 MajorServiceClass:11; 33 | } BLUETOOTH_CLASS_OF_DEVICE; 34 | 35 | /// 36 | /// BLUETOOTH_LE_ADDRESS 37 | /// 38 | typedef struct { 39 | /// 40 | /// 48-bit Bluetooth device address 41 | /// 42 | UINT8 Address[6]; 43 | /// 44 | /// 0x00 - Public Device Address 45 | /// 0x01 - Random Device Address 46 | /// 47 | UINT8 Type; 48 | } BLUETOOTH_LE_ADDRESS; 49 | 50 | #pragma pack() 51 | 52 | #define BLUETOOTH_HCI_COMMAND_LOCAL_READABLE_NAME_MAX_SIZE 248 53 | 54 | #define BLUETOOTH_HCI_LINK_KEY_SIZE 16 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/Bmp.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file defines BMP file header data structures. 3 | 4 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #ifndef _BMP_H_ 10 | #define _BMP_H_ 11 | 12 | #pragma pack(1) 13 | 14 | typedef struct { 15 | UINT8 Blue; 16 | UINT8 Green; 17 | UINT8 Red; 18 | UINT8 Reserved; 19 | } BMP_COLOR_MAP; 20 | 21 | typedef struct { 22 | CHAR8 CharB; 23 | CHAR8 CharM; 24 | UINT32 Size; 25 | UINT16 Reserved[2]; 26 | UINT32 ImageOffset; 27 | UINT32 HeaderSize; 28 | UINT32 PixelWidth; 29 | UINT32 PixelHeight; 30 | UINT16 Planes; ///< Must be 1 31 | UINT16 BitPerPixel; ///< 1, 4, 8, or 24 32 | UINT32 CompressionType; 33 | UINT32 ImageSize; ///< Compressed image size in bytes 34 | UINT32 XPixelsPerMeter; 35 | UINT32 YPixelsPerMeter; 36 | UINT32 NumberOfColors; 37 | UINT32 ImportantColors; 38 | } BMP_IMAGE_HEADER; 39 | 40 | #pragma pack() 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/HighPrecisionEventTimerTable.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | ACPI high precision event timer table definition, at www.intel.com 3 | Specification name is IA-PC HPET (High Precision Event Timers) Specification. 4 | 5 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #ifndef _HIGH_PRECISION_EVENT_TIMER_TABLE_H_ 10 | #define _HIGH_PRECISION_EVENT_TIMER_TABLE_H_ 11 | 12 | #include 13 | 14 | // 15 | // Ensure proper structure formats 16 | // 17 | #pragma pack(1) 18 | 19 | /// 20 | /// HPET Event Timer Block ID described in IA-PC HPET Specification, 3.2.4. 21 | /// 22 | typedef union { 23 | struct { 24 | UINT32 Revision : 8; 25 | UINT32 NumberOfTimers : 5; 26 | UINT32 CounterSize : 1; 27 | UINT32 Reserved : 1; 28 | UINT32 LegacyRoute : 1; 29 | UINT32 VendorId : 16; 30 | } Bits; 31 | UINT32 Uint32; 32 | } EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_BLOCK_ID; 33 | 34 | 35 | /// 36 | /// High Precision Event Timer Table header definition. 37 | /// 38 | typedef struct { 39 | EFI_ACPI_DESCRIPTION_HEADER Header; 40 | UINT32 EventTimerBlockId; 41 | EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE BaseAddressLower32Bit; 42 | UINT8 HpetNumber; 43 | UINT16 MainCounterMinimumClockTickInPeriodicMode; 44 | UINT8 PageProtectionAndOemAttribute; 45 | } EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER; 46 | 47 | /// 48 | /// HPET Revision (defined in spec) 49 | /// 50 | #define EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_REVISION 0x01 51 | 52 | // 53 | // Page protection setting 54 | // Values 3 through 15 are reserved for use by the specification 55 | // 56 | #define EFI_ACPI_NO_PAGE_PROTECTION 0 57 | #define EFI_ACPI_4KB_PAGE_PROTECTION 1 58 | #define EFI_ACPI_64KB_PAGE_PROTECTION 2 59 | 60 | #pragma pack() 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/Mbr.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Legacy Master Boot Record Format Definition. 3 | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #ifndef _MBR_H_ 10 | #define _MBR_H_ 11 | 12 | #define MBR_SIGNATURE 0xaa55 13 | 14 | #define EXTENDED_DOS_PARTITION 0x05 15 | #define EXTENDED_WINDOWS_PARTITION 0x0F 16 | 17 | #define MAX_MBR_PARTITIONS 4 18 | 19 | #define PMBR_GPT_PARTITION 0xEE 20 | #define EFI_PARTITION 0xEF 21 | 22 | #define MBR_SIZE 512 23 | 24 | #pragma pack(1) 25 | /// 26 | /// MBR Partition Entry 27 | /// 28 | typedef struct { 29 | UINT8 BootIndicator; 30 | UINT8 StartHead; 31 | UINT8 StartSector; 32 | UINT8 StartTrack; 33 | UINT8 OSIndicator; 34 | UINT8 EndHead; 35 | UINT8 EndSector; 36 | UINT8 EndTrack; 37 | UINT8 StartingLBA[4]; 38 | UINT8 SizeInLBA[4]; 39 | } MBR_PARTITION_RECORD; 40 | 41 | /// 42 | /// MBR Partition Table 43 | /// 44 | typedef struct { 45 | UINT8 BootStrapCode[440]; 46 | UINT8 UniqueMbrSignature[4]; 47 | UINT8 Unknown[2]; 48 | MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS]; 49 | UINT16 Signature; 50 | } MASTER_BOOT_RECORD; 51 | 52 | #pragma pack() 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | ACPI memory mapped configuration space access table definition, defined at 3 | in the PCI Firmware Specification, version 3.0. 4 | Specification is available at http://www.pcisig.com. 5 | 6 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | **/ 9 | 10 | #ifndef _MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_H_ 11 | #define _MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_H_ 12 | 13 | #include 14 | 15 | // 16 | // Ensure proper structure formats 17 | // 18 | #pragma pack(1) 19 | 20 | /// 21 | /// Memory Mapped Configuration Space Access Table (MCFG) 22 | /// This table is a basic description table header followed by 23 | /// a number of base address allocation structures. 24 | /// 25 | typedef struct { 26 | UINT64 BaseAddress; 27 | UINT16 PciSegmentGroupNumber; 28 | UINT8 StartBusNumber; 29 | UINT8 EndBusNumber; 30 | UINT32 Reserved; 31 | } EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE; 32 | 33 | /// 34 | /// MCFG Table header definition. The rest of the table 35 | /// must be defined in a platform specific manner. 36 | /// 37 | typedef struct { 38 | EFI_ACPI_DESCRIPTION_HEADER Header; 39 | UINT64 Reserved; 40 | } EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER; 41 | 42 | /// 43 | /// MCFG Revision (defined in spec) 44 | /// 45 | #define EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION 0x01 46 | 47 | #pragma pack() 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/Pci.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Support for the latest PCI standard. 3 | 4 | Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #ifndef _PCI_H_ 10 | #define _PCI_H_ 11 | 12 | #include 13 | #include 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/Pci30.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Support for PCI 3.0 standard. 3 | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #ifndef __PCI30_H__ 10 | #define __PCI30_H__ 11 | 12 | 13 | #include 14 | 15 | /// 16 | /// PCI_CLASS_MASS_STORAGE, Base Class 01h. 17 | /// 18 | ///@{ 19 | #define PCI_CLASS_MASS_STORAGE_SATADPA 0x06 20 | #define PCI_IF_MASS_STORAGE_SATA 0x00 21 | #define PCI_IF_MASS_STORAGE_AHCI 0x01 22 | ///@} 23 | 24 | /// 25 | /// PCI_CLASS_WIRELESS, Base Class 0Dh. 26 | /// 27 | ///@{ 28 | #define PCI_SUBCLASS_ETHERNET_80211A 0x20 29 | #define PCI_SUBCLASS_ETHERNET_80211B 0x21 30 | ///@} 31 | 32 | /** 33 | Macro that checks whether device is a SATA controller. 34 | 35 | @param _p Specified device. 36 | 37 | @retval TRUE Device is a SATA controller. 38 | @retval FALSE Device is not a SATA controller. 39 | 40 | **/ 41 | #define IS_PCI_SATADPA(_p) IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SATADPA) 42 | 43 | /// 44 | /// PCI Capability List IDs and records 45 | /// 46 | #define EFI_PCI_CAPABILITY_ID_PCIEXP 0x10 47 | 48 | #pragma pack(1) 49 | 50 | /// 51 | /// PCI Data Structure Format 52 | /// Section 5.1.2, PCI Firmware Specification, Revision 3.0 53 | /// 54 | typedef struct { 55 | UINT32 Signature; ///< "PCIR" 56 | UINT16 VendorId; 57 | UINT16 DeviceId; 58 | UINT16 DeviceListOffset; 59 | UINT16 Length; 60 | UINT8 Revision; 61 | UINT8 ClassCode[3]; 62 | UINT16 ImageLength; 63 | UINT16 CodeRevision; 64 | UINT8 CodeType; 65 | UINT8 Indicator; 66 | UINT16 MaxRuntimeImageLength; 67 | UINT16 ConfigUtilityCodeHeaderOffset; 68 | UINT16 DMTFCLPEntryPointOffset; 69 | } PCI_3_0_DATA_STRUCTURE; 70 | 71 | #pragma pack() 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/PciExpress30.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Support for the PCI Express 3.0 standard. 3 | 4 | This header file may not define all structures. Please extend as required. 5 | 6 | Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | 9 | **/ 10 | 11 | #ifndef _PCIEXPRESS30_H_ 12 | #define _PCIEXPRESS30_H_ 13 | 14 | #include 15 | 16 | #pragma pack(1) 17 | 18 | #define PCI_EXPRESS_EXTENDED_CAPABILITY_SECONDARY_PCIE_ID 0x0019 19 | #define PCI_EXPRESS_EXTENDED_CAPABILITY_SECONDARY_PCIE_VER1 0x1 20 | 21 | typedef union { 22 | struct { 23 | UINT32 PerformEqualization : 1; 24 | UINT32 LinkEqualizationRequestInterruptEnable : 1; 25 | UINT32 Reserved : 30; 26 | } Bits; 27 | UINT32 Uint32; 28 | } PCI_EXPRESS_REG_LINK_CONTROL3; 29 | 30 | typedef union { 31 | struct { 32 | UINT16 DownstreamPortTransmitterPreset : 4; 33 | UINT16 DownstreamPortReceiverPresetHint : 3; 34 | UINT16 Reserved : 1; 35 | UINT16 UpstreamPortTransmitterPreset : 4; 36 | UINT16 UpstreamPortReceiverPresetHint : 3; 37 | UINT16 Reserved2 : 1; 38 | } Bits; 39 | UINT16 Uint16; 40 | } PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL; 41 | 42 | typedef struct { 43 | PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER Header; 44 | PCI_EXPRESS_REG_LINK_CONTROL3 LinkControl3; 45 | UINT32 LaneErrorStatus; 46 | PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL EqualizationControl[2]; 47 | } PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE; 48 | 49 | #pragma pack() 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/PciExpress31.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Support for the PCI Express 3.1 standard. 3 | 4 | This header file may not define all structures. Please extend as required. 5 | 6 | Copyright (c) 2016, Intel Corporation. All rights reserved.
7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | 9 | **/ 10 | 11 | #ifndef _PCIEXPRESS31_H_ 12 | #define _PCIEXPRESS31_H_ 13 | 14 | #include 15 | 16 | #pragma pack(1) 17 | 18 | #define PCI_EXPRESS_EXTENDED_CAPABILITY_L1_PM_SUBSTATES_ID 0x001E 19 | #define PCI_EXPRESS_EXTENDED_CAPABILITY_L1_PM_SUBSTATES_VER1 0x1 20 | 21 | typedef union { 22 | struct { 23 | UINT32 PciPmL12 : 1; 24 | UINT32 PciPmL11 : 1; 25 | UINT32 AspmL12 : 1; 26 | UINT32 AspmL11 : 1; 27 | UINT32 L1PmSubstates : 1; 28 | UINT32 Reserved : 3; 29 | UINT32 CommonModeRestoreTime : 8; 30 | UINT32 TPowerOnScale : 2; 31 | UINT32 Reserved2 : 1; 32 | UINT32 TPowerOnValue : 5; 33 | UINT32 Reserved3 : 8; 34 | } Bits; 35 | UINT32 Uint32; 36 | } PCI_EXPRESS_REG_L1_PM_SUBSTATES_CAPABILITY; 37 | 38 | typedef union { 39 | struct { 40 | UINT32 PciPmL12 : 1; 41 | UINT32 PciPmL11 : 1; 42 | UINT32 AspmL12 : 1; 43 | UINT32 AspmL11 : 1; 44 | UINT32 Reserved : 4; 45 | UINT32 CommonModeRestoreTime : 8; 46 | UINT32 LtrL12ThresholdValue : 10; 47 | UINT32 Reserved2 : 3; 48 | UINT32 LtrL12ThresholdScale : 3; 49 | } Bits; 50 | UINT32 Uint32; 51 | } PCI_EXPRESS_REG_L1_PM_SUBSTATES_CONTROL1; 52 | 53 | typedef union { 54 | struct { 55 | UINT32 TPowerOnScale : 2; 56 | UINT32 Reserved : 1; 57 | UINT32 TPowerOnValue : 5; 58 | UINT32 Reserved2 : 24; 59 | } Bits; 60 | UINT32 Uint32; 61 | } PCI_EXPRESS_REG_L1_PM_SUBSTATES_CONTROL2; 62 | 63 | typedef struct { 64 | PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER Header; 65 | PCI_EXPRESS_REG_L1_PM_SUBSTATES_CAPABILITY Capability; 66 | PCI_EXPRESS_REG_L1_PM_SUBSTATES_CONTROL1 Control1; 67 | PCI_EXPRESS_REG_L1_PM_SUBSTATES_CONTROL2 Control2; 68 | } PCI_EXPRESS_EXTENDED_CAPABILITIES_L1_PM_SUBSTATES; 69 | 70 | #pragma pack() 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/SmBus.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file declares the SMBus definitions defined in SmBus Specification V2.0 3 | and defined in PI1.0 specification volume 5. 4 | 5 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | 8 | **/ 9 | 10 | #ifndef _SMBUS_H_ 11 | #define _SMBUS_H_ 12 | 13 | 14 | /// 15 | /// UDID of SMBUS device. 16 | /// 17 | typedef struct { 18 | UINT32 VendorSpecificId; 19 | UINT16 SubsystemDeviceId; 20 | UINT16 SubsystemVendorId; 21 | UINT16 Interface; 22 | UINT16 DeviceId; 23 | UINT16 VendorId; 24 | UINT8 VendorRevision; 25 | UINT8 DeviceCapabilities; 26 | } EFI_SMBUS_UDID; 27 | 28 | /// 29 | /// Smbus Device Address 30 | /// 31 | typedef struct { 32 | /// 33 | /// The SMBUS hardware address to which the SMBUS device is preassigned or allocated. 34 | /// 35 | UINTN SmbusDeviceAddress : 7; 36 | } EFI_SMBUS_DEVICE_ADDRESS; 37 | 38 | typedef struct { 39 | /// 40 | /// The SMBUS hardware address to which the SMBUS device is preassigned or 41 | /// allocated. Type EFI_SMBUS_DEVICE_ADDRESS is defined in EFI_PEI_SMBUS2_PPI.Execute(). 42 | /// 43 | EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress; 44 | /// 45 | /// The SMBUS Unique Device Identifier (UDID) as defined in EFI_SMBUS_UDID. 46 | /// Type EFI_SMBUS_UDID is defined in EFI_PEI_SMBUS2_PPI.ArpDevice(). 47 | /// 48 | EFI_SMBUS_UDID SmbusDeviceUdid; 49 | } EFI_SMBUS_DEVICE_MAP; 50 | 51 | /// 52 | /// Smbus Operations 53 | /// 54 | typedef enum _EFI_SMBUS_OPERATION { 55 | EfiSmbusQuickRead, 56 | EfiSmbusQuickWrite, 57 | EfiSmbusReceiveByte, 58 | EfiSmbusSendByte, 59 | EfiSmbusReadByte, 60 | EfiSmbusWriteByte, 61 | EfiSmbusReadWord, 62 | EfiSmbusWriteWord, 63 | EfiSmbusReadBlock, 64 | EfiSmbusWriteBlock, 65 | EfiSmbusProcessCall, 66 | EfiSmbusBWBRProcessCall 67 | } EFI_SMBUS_OPERATION; 68 | 69 | /// 70 | /// EFI_SMBUS_DEVICE_COMMAND 71 | /// 72 | typedef UINTN EFI_SMBUS_DEVICE_COMMAND; 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /libedk2_tpm/include/IndustryStandard/Tpm2Acpi.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | TPM2 ACPI table definition. 3 | 4 | Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
5 | Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | 8 | **/ 9 | 10 | #ifndef _TPM2_ACPI_H_ 11 | #define _TPM2_ACPI_H_ 12 | 13 | #include 14 | 15 | #pragma pack (1) 16 | 17 | #define EFI_TPM2_ACPI_TABLE_REVISION_3 3 18 | #define EFI_TPM2_ACPI_TABLE_REVISION_4 4 19 | #define EFI_TPM2_ACPI_TABLE_REVISION EFI_TPM2_ACPI_TABLE_REVISION_4 20 | 21 | typedef struct { 22 | EFI_ACPI_DESCRIPTION_HEADER Header; 23 | // Flags field is replaced in version 4 and above 24 | // BIT0~15: PlatformClass This field is only valid for version 4 and above 25 | // BIT16~31: Reserved 26 | UINT32 Flags; 27 | UINT64 AddressOfControlArea; 28 | UINT32 StartMethod; 29 | UINT8 PlatformSpecificParameters[12]; 30 | UINT32 LogAreaMinimumLen; 31 | UINT64 LogAreaStartAddress; 32 | } EFI_TPM2_ACPI_TABLE; 33 | 34 | #define EFI_TPM2_ACPI_TABLE_START_METHOD_ACPI 2 35 | #define EFI_TPM2_ACPI_TABLE_START_METHOD_TIS 6 36 | #define EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE 7 37 | #define EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_ACPI 8 38 | #define EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_SMC 11 39 | 40 | typedef struct { 41 | UINT32 Reserved; 42 | UINT32 Error; 43 | UINT32 Cancel; 44 | UINT32 Start; 45 | UINT64 InterruptControl; 46 | UINT32 CommandSize; 47 | UINT64 Command; 48 | UINT32 ResponseSize; 49 | UINT64 Response; 50 | } EFI_TPM2_ACPI_CONTROL_AREA; 51 | 52 | // 53 | // Start Method Specific Parameters for ARM SMC Start Method (11) 54 | // Refer to Table 9: Start Method Specific Parameters for ARM SMC 55 | // 56 | typedef struct { 57 | UINT32 Interrupt; 58 | UINT8 Flags; 59 | UINT8 OperationFlags; 60 | UINT8 Reserved[2]; 61 | UINT32 SmcFunctionId; 62 | } EFI_TPM2_ACPI_START_METHOD_SPECIFIC_PARAMETERS_ARM_SMC; 63 | 64 | #pragma pack () 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /libefitcp/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libefitcp-$(TARGET_BUILD_VARIANT) 6 | LOCAL_CFLAGS := $(KERNELFLINGER_CFLAGS) 7 | LOCAL_STATIC_LIBRARIES := \ 8 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 9 | libkernelflinger-$(TARGET_BUILD_VARIANT) \ 10 | libtransport-$(TARGET_BUILD_VARIANT) 11 | 12 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include/libefitcp 13 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include/libefitcp 14 | LOCAL_SRC_FILES := \ 15 | tcp.c 16 | 17 | include $(BUILD_EFI_STATIC_LIBRARY) 18 | -------------------------------------------------------------------------------- /libefiusb/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libefiusb-$(TARGET_BUILD_VARIANT) 6 | LOCAL_CFLAGS := $(KERNELFLINGER_CFLAGS) 7 | LOCAL_STATIC_LIBRARIES := \ 8 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 9 | libtransport-$(TARGET_BUILD_VARIANT) \ 10 | libkernelflinger-$(TARGET_BUILD_VARIANT) 11 | 12 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include/libefiusb 13 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include/libefiusb 14 | LOCAL_SRC_FILES := \ 15 | usb.c 16 | 17 | ifeq ($(KERNELFLINGER_SUPPORT_SELF_USB_DEVICE_MODE_PROTOCOL),true) 18 | LOCAL_CFLAGS += -DUSE_SELF_USB_DEVICE_MODE_PROTOCOL 19 | LOCAL_SRC_FILES += \ 20 | device_mode/cpuio.c \ 21 | device_mode/UsbDeviceDxe.c \ 22 | device_mode/UsbDeviceMode.c \ 23 | device_mode/XdciDevice.c \ 24 | device_mode/XdciDWC.c \ 25 | device_mode/XdciTable.c \ 26 | device_mode/XdciUtility.c 27 | endif 28 | 29 | include $(BUILD_EFI_STATIC_LIBRARY) 30 | -------------------------------------------------------------------------------- /libefiusb/device_mode/UsbDeviceMode.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
3 | 4 | This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php. 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | **/ 13 | 14 | #ifndef _USB_DEVICE_MODE_DXE_H_ 15 | #define _USB_DEVICE_MODE_DXE_H_ 16 | 17 | #include "protocol/UsbIo.h" 18 | #include "protocol/UsbDeviceModeProtocol.h" 19 | 20 | 21 | /// 22 | /// Function declaration 23 | /// 24 | EFI_STATUS 25 | UsbdSetupHdlr ( 26 | IN EFI_USB_DEVICE_REQUEST *CtrlRequest 27 | ); 28 | 29 | extern EFI_USB_DEVICE_MODE_PROTOCOL mUsbDeviceModeProtocol; 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /libefiusb/device_mode/XdciTable.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
3 | 4 | This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php. 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | **/ 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "XdciCommon.h" 19 | #include "XdciDevice.h" 20 | #include "XdciInterface.h" 21 | #include "XdciDWC.h" 22 | #include "UsbDeviceDxe.h" 23 | 24 | static const struct UsbDeviceCoreDriver CoreDriverTbl[USB_CORE_ID_MAX] = { { 25 | DwcXdciCoreInit, 26 | DwcXdciCoreDeinit, 27 | DwcXdciCoreRegisterCallback, 28 | DwcXdciCoreUnregisterCallback, 29 | DwcXdciCoreIsrRoutine, 30 | DwcXdciCoreIsrRoutineTimerBased, 31 | DwcXdciCoreConnect, 32 | DwcXdciCoreDisconnect, 33 | DwcXdciCoreGetSpeed, 34 | DwcXdciCoreSetAddress, 35 | DwcXdciCoreSetConfig, 36 | DwcXdciSetLinkState, 37 | DwcXdciInitEp, 38 | DwcXdciEpEnable, 39 | DwcXdciEpDisable, 40 | DwcXdciEpStall, 41 | DwcXdciEpClearStall, 42 | DwcXdciEpSetNrdy, 43 | DwcXdciEp0ReceiveSetupPkt, 44 | DwcXdciEp0ReceiveStatusPkt, 45 | DwcXdciEp0SendStatusPkt, 46 | DwcXdciEpTxData, 47 | DwcXdciEpRxData, 48 | DwcXdciEpCancelTransfer} 49 | }; 50 | 51 | const struct UsbDeviceCoreDriver *UsbDeviceGetCoreDriver(USB_CONTROLLER_ID id) 52 | { 53 | if (id >= USB_CORE_ID_MAX) 54 | return NULL; 55 | 56 | return &CoreDriverTbl[id]; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /libefiusb/device_mode/XdciUtility.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
3 | 4 | This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php. 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | **/ 13 | 14 | #ifndef _XDCI_UTILITY_H_ 15 | #define _XDCI_UTILITY_H_ 16 | 17 | #include "protocol/UsbDeviceLib.h" 18 | 19 | VOID 20 | PrintDeviceDescriptor ( 21 | IN USB_DEVICE_DESCRIPTOR *DevDesc 22 | ); 23 | 24 | VOID 25 | PrintConfigDescriptor ( 26 | IN EFI_USB_CONFIG_DESCRIPTOR *ConfigDesc 27 | ); 28 | 29 | VOID 30 | PrintInterfaceDescriptor ( 31 | IN EFI_USB_INTERFACE_DESCRIPTOR *IfDesc 32 | ); 33 | 34 | VOID 35 | PrintEpDescriptor ( 36 | IN EFI_USB_ENDPOINT_DESCRIPTOR *EpDesc 37 | ); 38 | 39 | VOID 40 | PrintEpCompDescriptor ( 41 | IN EFI_USB_ENDPOINT_COMPANION_DESCRIPTOR *EpDesc 42 | ); 43 | 44 | VOID 45 | PrintStringDescriptor ( 46 | IN USB_STRING_DESCRIPTOR *StrDesc 47 | ); 48 | 49 | VOID 50 | PrintDeviceRequest ( 51 | IN EFI_USB_DEVICE_REQUEST *DevReq 52 | ); 53 | 54 | VOID 55 | PrintBOSDescriptor ( 56 | IN EFI_USB_BOS_DESCRIPTOR *BosDesc 57 | ); 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /libelfloader/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libelfloader-$(TARGET_BUILD_VARIANT) 6 | LOCAL_CFLAGS := $(KERNELFLINGER_CFLAGS) 7 | LOCAL_STATIC_LIBRARIES := \ 8 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 9 | libkernelflinger-$(TARGET_BUILD_VARIANT) 10 | 11 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include/libelfloader 12 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 13 | 14 | LOCAL_SRC_FILES := \ 15 | elf32_ld.c \ 16 | elf64_ld.c \ 17 | elf_ld.c 18 | 19 | include $(BUILD_EFI_STATIC_LIBRARY) 20 | -------------------------------------------------------------------------------- /libfastboot/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | SHARED_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include 4 | SHARED_CFLAGS := \ 5 | $(KERNELFLINGER_CFLAGS) \ 6 | -DTARGET_BOOTLOADER_BOARD_NAME=\"$(TARGET_BOOTLOADER_BOARD_NAME)\" 7 | 8 | SHARED_C_INCLUDES := $(LOCAL_PATH)/../include \ 9 | $(KERNELFLINGER_LOCAL_PATH)/libkernelflinger/fatfs/source \ 10 | $(KERNELFLINGER_LOCAL_PATH)/avb 11 | SHARED_STATIC_LIBRARIES := \ 12 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 13 | libefiusb-$(TARGET_BUILD_VARIANT) \ 14 | libefitcp-$(TARGET_BUILD_VARIANT) \ 15 | libtransport-$(TARGET_BUILD_VARIANT) \ 16 | libkernelflinger-$(TARGET_BUILD_VARIANT) \ 17 | libavb_kernelflinger-$(TARGET_BUILD_VARIANT) 18 | 19 | SHARED_STATIC_LIBRARIES += libedk2_tpm 20 | 21 | SHARED_SRC_FILES := \ 22 | fastboot.c \ 23 | fastboot_oem.c \ 24 | fastboot_flashing.c \ 25 | flash.c \ 26 | sparse.c \ 27 | info.c \ 28 | intel_variables.c \ 29 | bootmgr.c \ 30 | hashes.c \ 31 | bootloader.c \ 32 | keybox_provision.c 33 | 34 | include $(CLEAR_VARS) 35 | 36 | LOCAL_MODULE := libfastboot-$(TARGET_BUILD_VARIANT) 37 | LOCAL_CFLAGS := $(SHARED_CFLAGS) 38 | LOCAL_STATIC_LIBRARIES := $(SHARED_STATIC_LIBRARIES) 39 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(SHARED_EXPORT_C_INCLUDE_DIRS) 40 | LOCAL_C_INCLUDES := $(SHARED_C_INCLUDES) \ 41 | $(addprefix $(LOCAL_PATH)/../,avb) \ 42 | $(addprefix $(LOCAL_PATH)/../,libsslsupport) 43 | LOCAL_SRC_FILES := $(SHARED_SRC_FILES) \ 44 | fastboot_transport.c 45 | ifneq ($(strip $(KERNELFLINGER_USE_UI)),false) 46 | LOCAL_SRC_FILES += fastboot_ui.c 47 | endif 48 | 49 | ifeq ($(TARGET_USE_SBL),true) 50 | LOCAL_CFLAGS += -DUSE_SBL 51 | endif 52 | 53 | include $(BUILD_EFI_STATIC_LIBRARY) 54 | 55 | include $(CLEAR_VARS) 56 | 57 | LOCAL_MODULE := libfastboot-for-installer-$(TARGET_BUILD_VARIANT) 58 | LOCAL_CFLAGS := $(SHARED_CFLAGS) 59 | LOCAL_STATIC_LIBRARIES := $(SHARED_STATIC_LIBRARIES) 60 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(SHARED_EXPORT_C_INCLUDE_DIRS) 61 | LOCAL_C_INCLUDES := $(SHARED_C_INCLUDES) \ 62 | $(addprefix $(LOCAL_PATH)/../,libsslsupport) 63 | LOCAL_SRC_FILES := $(SHARED_SRC_FILES) 64 | 65 | ifneq ($(strip $(KERNELFLINGER_USE_UI)),false) 66 | LOCAL_SRC_FILES += \ 67 | installer_ui.c 68 | endif 69 | 70 | ifeq ($(TARGET_USE_SBL),true) 71 | LOCAL_CFLAGS += -DUSE_SBL 72 | endif 73 | 74 | include $(BUILD_EFI_STATIC_LIBRARY) 75 | 76 | -------------------------------------------------------------------------------- /libfastboot/authenticated_action.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _AUTHENTICATED_ACTION_H_ 34 | #define _AUTHENTICATED_ACTION_H_ 35 | 36 | #define ACTION_AUTHORIZATION "action-authorization" 37 | 38 | char *authenticated_action_new_nonce(char *action_name); 39 | EFI_STATUS authenticated_action(void *data, UINTN size); 40 | 41 | #endif /* _AUTHENTICATED_ACTION_H_ */ 42 | -------------------------------------------------------------------------------- /libfastboot/bootloader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _BOOTLOADER_H_ 34 | #define _BOOTLOADER_H_ 35 | 36 | EFI_STATUS flash_bootloader(VOID *data, UINTN size); 37 | 38 | EFI_STATUS flash_bootloader_a(VOID *data, UINTN size); 39 | 40 | EFI_STATUS flash_bootloader_b(VOID *data, UINTN size); 41 | 42 | EFI_STATUS flash_esp(VOID *data, UINTN size); 43 | 44 | #endif /* _BOOTLOADER_H_ */ 45 | -------------------------------------------------------------------------------- /libfastboot/bootmgr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _BOOTMGR_H_ 34 | #define _BOOTMGR_H_ 35 | 36 | #include 37 | 38 | typedef struct load_option { 39 | CHAR16 *description; 40 | CHAR16 *path; 41 | CHAR16 *opt_params; 42 | } load_option_t; 43 | 44 | /* Create or update the load options described by LOAD_OPTIONS and set 45 | these load options as the first ones in the boot order. PART_LABEL 46 | is the partition label where the load options PATH apply. */ 47 | EFI_STATUS bootmgr_register_entries(CHAR16 *part_label, 48 | load_option_t *load_options, UINTN load_option_nb); 49 | 50 | #endif /* _BOOTMGR_H_ */ 51 | -------------------------------------------------------------------------------- /libfastboot/fastboot_flashing.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _FASTBOOT_FLASHING_H_ 32 | #define _FASTBOOT_FLASHING_H_ 33 | 34 | EFI_STATUS fastboot_flashing_init(void); 35 | void fastboot_flashing_free(); 36 | 37 | /* Change the current device state to NEW_STATE. If INTERACTIVE is 38 | * TRUE, UI confirmation is active and fastboot protocol response will 39 | * be sent. */ 40 | EFI_STATUS change_device_state(enum device_state new_state, BOOLEAN interactive); 41 | 42 | EFI_STATUS fastboot_flashing_publish(void); 43 | #endif /* _FASTBOOT_FLASHING_H_ */ 44 | -------------------------------------------------------------------------------- /libfastboot/fastboot_oem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Sylvain Chouleur 6 | * Jeremy Compostella 7 | * Jocelyn Falempe 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #ifndef _FASTBOOT_OEM_H_ 36 | #define _FASTBOOT_OEM_H_ 37 | 38 | EFI_STATUS fastboot_oem_init(void); 39 | void fastboot_oem_free(); 40 | 41 | #endif /* _FASTBOOT_OEM_H_ */ 42 | -------------------------------------------------------------------------------- /libfastboot/fastboot_transport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _FASTBOOT_TRANSPORT_H_ 34 | #define _FASTBOOT_TRANSPORT_H_ 35 | 36 | EFI_STATUS fastboot_transport_register(void); 37 | void fastboot_transport_unregister(void); 38 | 39 | #endif /* _FASTBOOT_TRANSPORT_H_ */ 40 | -------------------------------------------------------------------------------- /libfastboot/fastboot_ui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef _FASTBOOT_UI_H_ 34 | #define _FASTBOOT_UI_H_ 35 | 36 | #include 37 | 38 | #include "fastboot_oem.h" 39 | 40 | EFI_STATUS fastboot_ui_init(void); 41 | void fastboot_ui_destroy(void); 42 | enum boot_target fastboot_ui_event_handler(void); 43 | BOOLEAN fastboot_ui_confirm_for_state(enum device_state target); 44 | void fastboot_ui_refresh(void); 45 | 46 | #endif /* _FASTBOOT_UI_H_ */ 47 | -------------------------------------------------------------------------------- /libfastboot/flash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Sylvain Chouleur 6 | * Jeremy Compostella 7 | * Jocelyn Falempe 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #ifndef _FLASH_H_ 36 | #define _FLASH_H_ 37 | 38 | #include 39 | 40 | extern BOOLEAN new_install_device; 41 | 42 | EFI_STATUS flash_skip(UINT64 size); 43 | EFI_STATUS flash_write(VOID *data, UINTN size); 44 | EFI_STATUS flash_fill(UINT32 pattern, UINTN size); 45 | 46 | /* return value for flash() function */ 47 | 48 | #define REFRESH_PARTITION_VAR 0x1 49 | 50 | EFI_STATUS flash(VOID *data, UINTN size, CHAR16 *label); 51 | EFI_STATUS flash_file(EFI_HANDLE image, CHAR16 *filename, CHAR16 *label); 52 | EFI_STATUS erase_by_label(CHAR16 *label); 53 | EFI_STATUS garbage_disk(void); 54 | EFI_STATUS flash_partition(VOID *data, UINTN size, CHAR16 *label); 55 | EFI_STATUS fill_zero(EFI_BLOCK_IO *bio, UINT64 start, UINT64 end); 56 | EFI_STATUS dump_to_partition(EFI_GUID * uuid); 57 | 58 | #endif /* _FLASH_H_ */ 59 | -------------------------------------------------------------------------------- /libfastboot/hashes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Sylvain Chouleur 6 | * Jeremy Compostella 7 | * Jocelyn Falempe 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #ifndef _HASHES_H_ 36 | #define _HASHES_H_ 37 | 38 | #ifdef USE_MULTIBOOT 39 | EFI_STATUS get_ias_image_hash(const CHAR16 *label); 40 | #endif 41 | EFI_STATUS get_vbmeta_image_hash(const CHAR16 *label); 42 | EFI_STATUS get_boot_image_hash(const CHAR16 *label); 43 | EFI_STATUS get_bootloader_hash(const CHAR16 *label); 44 | EFI_STATUS get_fs_hash(const CHAR16 *label); 45 | EFI_STATUS set_hash_algorithm(const CHAR8 *algo); 46 | #if defined(USE_ACPIO) || defined(USE_ACPI) 47 | EFI_STATUS get_acpi_hash(const CHAR16 *label); 48 | #endif 49 | #ifdef DYNAMIC_PARTITIONS 50 | EFI_STATUS get_super_image_hash(const CHAR16 *label); 51 | #endif 52 | #endif /* _HASHES_H_ */ 53 | -------------------------------------------------------------------------------- /libfastboot/info.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "info.h" 39 | 40 | const char *info_bootloader_version(void) 41 | { 42 | return KERNELFLINGER_VERSION_8; 43 | } 44 | 45 | const char *info_baseband_version(void) 46 | { 47 | return "N/A"; 48 | } 49 | 50 | const char *info_variant(void) 51 | { 52 | #ifdef HAL_AUTODETECT 53 | return get_property_device(); 54 | #else 55 | return "N/A"; 56 | #endif 57 | 58 | } 59 | 60 | const char *info_product(void) 61 | { 62 | return TARGET_BOOTLOADER_BOARD_NAME; 63 | } 64 | 65 | const char *info_hw_revision(void) 66 | { 67 | return SMBIOS_GET_STRING(1, Version); 68 | } 69 | -------------------------------------------------------------------------------- /libfastboot/info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef __INFO_H__ 34 | #define __INFO_H__ 35 | 36 | const char *info_bootloader_version(void); 37 | const char *info_baseband_version(void); 38 | const char *info_variant(void); 39 | const char *info_product(void); 40 | const char *info_hw_revision(void); 41 | 42 | #endif /* __INFO_H__ */ 43 | -------------------------------------------------------------------------------- /libfastboot/installer_ui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _INSTALLER_UI_H_ 32 | #define _INSTALLER_UI_H_ 33 | 34 | #include 35 | #include 36 | 37 | EFI_STATUS ux_prompt_user_confirm(VOID); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /libfastboot/intel_variables.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef __INTEL_VARIABLES_H__ 34 | #define __INTEL_VARIABLES_H__ 35 | 36 | EFI_STATUS publish_intel_variables(void); 37 | 38 | #endif /* __INTEL_VARIABLES_H__ */ 39 | -------------------------------------------------------------------------------- /libfastboot/sparse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Sylvain Chouleur 6 | * Jeremy Compostella 7 | * Jocelyn Falempe 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #ifndef _SPARSE_H_ 36 | #define _SPARSE_H_ 37 | 38 | #include 39 | 40 | int is_sparse_image(void *data, UINT64 size); 41 | EFI_STATUS flash_sparse(void *data, UINT64 size); 42 | 43 | #endif /* _SPARSE_H_ */ 44 | -------------------------------------------------------------------------------- /libheci/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libheci-$(TARGET_BUILD_VARIANT) 6 | LOCAL_CFLAGS := $(KERNELFLINGER_CFLAGS) 7 | 8 | ifeq ($(KERNELFLINGER_DISABLE_DEBUG_PRINT),true) 9 | LOCAL_CFLAGS += -D__DISABLE_DEBUG_PRINT 10 | endif 11 | 12 | LOCAL_STATIC_LIBRARIES := \ 13 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 14 | libkernelflinger-$(TARGET_BUILD_VARIANT) 15 | 16 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include/libheci 17 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include/libheci \ 18 | $(LOCAL_PATH)/../libkernelflinger/protocol 19 | 20 | 21 | LOCAL_SRC_FILES := \ 22 | hecisupport.c 23 | 24 | include $(BUILD_EFI_STATIC_LIBRARY) 25 | -------------------------------------------------------------------------------- /libkernelflinger/README: -------------------------------------------------------------------------------- 1 | All PNG files in this directory MUST be PNG RGBA non-interlaced 2 | encoded. The file name MUST NOT have any spaces or dash but only use 3 | underscore characters. -------------------------------------------------------------------------------- /libkernelflinger/fatfs/LICENSE.txt: -------------------------------------------------------------------------------- 1 | FatFs License 2 | 3 | FatFs has being developped as a personal project of the author, ChaN. It is free from the code anyone else wrote at current release. Following code block shows a copy of the FatFs license document that heading the source files. 4 | 5 | /*----------------------------------------------------------------------------/ 6 | / FatFs - Generic FAT Filesystem Module Rx.xx / 7 | /-----------------------------------------------------------------------------/ 8 | / 9 | / Copyright (C) 20xx, ChaN, all right reserved. 10 | / 11 | / FatFs module is an open source software. Redistribution and use of FatFs in 12 | / source and binary forms, with or without modification, are permitted provided 13 | / that the following condition is met: 14 | / 15 | / 1. Redistributions of source code must retain the above copyright notice, 16 | / this condition and the following disclaimer. 17 | / 18 | / This software is provided by the copyright holder and contributors "AS IS" 19 | / and any warranties related to this software are DISCLAIMED. 20 | / The copyright owner or contributors be NOT LIABLE for any damages caused 21 | / by use of this software. 22 | /----------------------------------------------------------------------------*/ 23 | 24 | Therefore FatFs license is one of the BSD-style licenses, but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, do not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses include GNU GPL. When you redistribute the FatFs source code with changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that not conflict with FatFs license. 25 | -------------------------------------------------------------------------------- /libkernelflinger/fatfs/README.asc: -------------------------------------------------------------------------------- 1 | = FatFs 2 | 3 | This is a copy of FatFs, a "generic FAT file system module for small embedded 4 | systems", by ChaN. See http://elm-chan.org/fsw/ff/00index_e.html. 5 | 6 | Please submit bug reports to the http://elm-chan.org/fsw/ff/bd/[FatFs 7 | User Forum], not to this repo. 8 | 9 | == License 10 | 11 | Copyright (C) 2022, ChaN, all right reserved. 12 | 13 | FatFs module is an open source software. Redistribution and use of FatFs in 14 | source and binary forms, with or without modification, are permitted provided 15 | that the following condition is met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, 18 | this condition and the following disclaimer. 19 | 20 | This software is provided by the copyright holder and contributors "AS IS" 21 | and any warranties related to this software are DISCLAIMED. 22 | The copyright owner or contributors be NOT LIABLE for any damages caused 23 | by use of this software. 24 | -------------------------------------------------------------------------------- /libkernelflinger/fatfs/source/00readme.txt: -------------------------------------------------------------------------------- 1 | FatFs Module Source Files R0.15 2 | 3 | 4 | FILES 5 | 6 | 00readme.txt This file. 7 | 00history.txt Revision history. 8 | ff.c FatFs module. 9 | ffconf.h Configuration file of FatFs module. 10 | ff.h Common include file for FatFs and application module. 11 | diskio.h Common include file for FatFs and disk I/O module. 12 | diskio.c An example of glue function to attach existing disk I/O module to FatFs. 13 | ffunicode.c Optional Unicode utility functions. 14 | ffsystem.c An example of optional O/S related functions. 15 | 16 | 17 | Low level disk I/O module is not included in this archive because the FatFs 18 | module is only a generic file system layer and it does not depend on any specific 19 | storage device. You need to provide a low level disk I/O module written to 20 | control the storage device that attached to the target system. 21 | 22 | -------------------------------------------------------------------------------- /libkernelflinger/protocol/AcpiTableProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _ACPI_TABLE_PROTOCOL_H_ 32 | #define _ACPI_TABLE_PROTOCOL_H_ 33 | 34 | #define EFI_ACPI_TABLE_PROTOCOL_GUID \ 35 | {0xffe06bdd, 0x6107, 0x46a6, {0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c}} 36 | 37 | typedef struct _EFI_ACPI_TABLE_PROTOCOL EFI_ACPI_TABLE_PROTOCOL; 38 | 39 | typedef 40 | EFI_STATUS 41 | (EFIAPI *EFI_ACPI_TABLE_INSTALL_ACPI_TABLE) ( 42 | IN EFI_ACPI_TABLE_PROTOCOL *This, 43 | IN VOID *AcpiTableBuffer, 44 | IN UINTN AcpiTableBufferSize, 45 | OUT UINTN *TableKey 46 | ); 47 | 48 | typedef 49 | EFI_STATUS 50 | (EFIAPI *EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE) ( 51 | IN EFI_ACPI_TABLE_PROTOCOL *This, 52 | IN UINTN TableKey 53 | ); 54 | 55 | struct _EFI_ACPI_TABLE_PROTOCOL { 56 | EFI_ACPI_TABLE_INSTALL_ACPI_TABLE InstallAcpiTable; 57 | EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE UninstallAcpiTable; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /libkernelflinger/protocol/DevicePath.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation. All rights reserved.
4 | This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | DevicePath.h 15 | 16 | Abstract: 17 | 18 | The device path protocol as defined in EFI 1.0. 19 | 20 | The device path represents a programatic path to a device. It's the view 21 | from a software point of view. It also must persist from boot to boot, so 22 | it can not contain things like PCI bus numbers that change from boot to boot. 23 | 24 | 25 | --*/ 26 | 27 | #ifndef _DEVICE_PATH_H_ 28 | #define _DEVICE_PATH_H_ 29 | 30 | // 31 | // Device Path protocol 32 | // 33 | #define EFI_DEVICE_PATH_PROTOCOL_GUID \ 34 | { \ 35 | 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \ 36 | } 37 | 38 | #pragma pack(1) 39 | 40 | typedef EFI_DEVICE_PATH EFI_DEVICE_PATH_PROTOCOL; 41 | 42 | #pragma pack() 43 | 44 | #define EFI_END_ENTIRE_DEVICE_PATH 0xff 45 | #define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff 46 | #define EFI_END_INSTANCE_DEVICE_PATH 0x01 47 | #define EFI_END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL)) 48 | 49 | #define EfiDevicePathNodeLength(a) (((a)->Length[0]) | ((a)->Length[1] << 8)) 50 | #define EfiNextDevicePathNode(a) ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a))) 51 | 52 | #define EfiDevicePathType(a) (((a)->Type) & 0x7f) 53 | #define EfiIsDevicePathEndType(a) (EfiDevicePathType (a) == 0x7f) 54 | 55 | #define EfiIsDevicePathEndSubType(a) ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE) 56 | #define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH) 57 | 58 | #define EfiIsDevicePathEnd(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a)) 59 | #define EfiIsDevicePathEndInstance(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a)) 60 | 61 | extern EFI_GUID gEfiDevicePathProtocolGuid; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /libkernelflinger/protocol/LifeCycleProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _LIFE_CYCLE_PROTOCOL_H_ 32 | #define _LIFE_CYCLE_PROTOCOL_H_ 33 | 34 | #include 35 | 36 | #define EFI_LIFE_CYCLE_STATE_PROTOCOL_GUID \ 37 | {0xf3c1138e, 0xcd89, 0x4e20,{0x9e, 0x68, 0x25, 0xa6, 0x76, 0x95, 0xa5, 0x6a}} 38 | 39 | #define EFI_LIFE_CYCLE_STATE_PROTOCOL_REVISION1 0x00000001 40 | 41 | typedef enum life_cycle_state { 42 | LC_STATE_MANUFACTURING, 43 | LC_STATE_ENDUSER, 44 | LC_STATE_RND, 45 | LC_STATE_CARE 46 | } EFI_LIFE_CYCLE_STATE; 47 | 48 | typedef struct _EFI_LIFE_CYCLE_STATE_PROTOCOL EFI_LIFE_CYCLE_STATE_PROTOCOL; 49 | 50 | typedef 51 | EFI_STATUS 52 | (EFIAPI *EFI_GET_LIFE_CYCLE_STATE) ( 53 | IN EFI_LIFE_CYCLE_STATE_PROTOCOL *This, 54 | OUT EFI_LIFE_CYCLE_STATE *LifeCycleState 55 | ); 56 | 57 | struct _EFI_LIFE_CYCLE_STATE_PROTOCOL { 58 | UINT32 Revision; 59 | EFI_GET_LIFE_CYCLE_STATE GetLifeCycleState; 60 | } __attribute__((packed)); 61 | 62 | #endif /* _LIFE_CYCLE_PROTOCOL_H_ */ 63 | -------------------------------------------------------------------------------- /libkernelflinger/protocol/tco_protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef _TCO_PROTOCOL_H_ 32 | #define _TCO_PROTOCOL_H_ 33 | 34 | #include 35 | 36 | #define EFI_TCO_RESET_PROTOCOL_GUID \ 37 | {0xa6a79162, 0xe325, 0x4c30,{0xbc, 0xc3, 0x59, 0x37, 0x30, 0x64, 0xef, 0xb3}} 38 | 39 | typedef struct _EFI_TCO_RESET_PROTOCOL EFI_TCO_RESET_PROTOCOL; 40 | 41 | typedef 42 | EFI_STATUS 43 | (EFIAPI *EFI_TCO_RESET_PROTOCOL_ENABLE_WATCHDOG) ( 44 | IN OUT UINT32 *RcrbGcsValue 45 | ); 46 | 47 | typedef 48 | EFI_STATUS 49 | (EFIAPI *EFI_TCO_RESET_PROTOCOL_DISABLE_WATCHDOG) ( 50 | IN UINT32 RcrbGcsValue 51 | ); 52 | 53 | struct _EFI_TCO_RESET_PROTOCOL { 54 | EFI_TCO_RESET_PROTOCOL_ENABLE_WATCHDOG EnableTcoReset; 55 | EFI_TCO_RESET_PROTOCOL_DISABLE_WATCHDOG DisableTcoReset; 56 | }; 57 | 58 | #endif /* _TCO_PROTOCOL_H_ */ 59 | -------------------------------------------------------------------------------- /libkernelflinger/res/fonts/12x22_font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/fonts/12x22_font.png -------------------------------------------------------------------------------- /libkernelflinger/res/fonts/18x32_font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/fonts/18x32_font.png -------------------------------------------------------------------------------- /libkernelflinger/res/fonts/README: -------------------------------------------------------------------------------- 1 | The images in this directory were generated using the font 2 | Inconsolata, which is released under the OFL license and was obtained 3 | from: 4 | 5 | https://code.google.com/p/googlefontdirectory/source/browse/ofl/inconsolata/ 6 | 7 | -------------------------------------------------------------------------------- /libkernelflinger/res/images/bootloader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/bootloader.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/crash_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/crash_event.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/crashmode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/crashmode.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/droid_operation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/droid_operation.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/empty_battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/empty_battery.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/low_battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/low_battery.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/power_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/power_off.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/reboot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/reboot.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/recoverymode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/recoverymode.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/restartbootloader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/restartbootloader.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/splash_intel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/splash_intel.png -------------------------------------------------------------------------------- /libkernelflinger/res/images/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/libkernelflinger/res/images/start.png -------------------------------------------------------------------------------- /libkernelflinger/sdio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Jérémy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * This file defines bootlogic data structures, try to keep it without 32 | * any external definitions in order to ease export of it. 33 | */ 34 | 35 | #ifndef _SDIO_H_ 36 | #define _SDIO_H_ 37 | 38 | #include 39 | #include "protocol/SdHostIo.h" 40 | #include "protocol/CardInfo.h" 41 | 42 | #define SDIO_DFLT_TIMEOUT 3000 43 | 44 | EFI_STATUS sdio_get(EFI_DEVICE_PATH *p, 45 | EFI_HANDLE *handle, 46 | EFI_SD_HOST_IO_PROTOCOL **sdio); 47 | EFI_STATUS sdio_get_card_info(EFI_SD_HOST_IO_PROTOCOL *sdio, 48 | EFI_HANDLE handle, 49 | CARD_TYPE *type, 50 | UINT16 *address); 51 | EFI_STATUS sdio_erase(EFI_SD_HOST_IO_PROTOCOL *sdio, EFI_BLOCK_IO *bio, 52 | UINT64 start, UINT64 end, UINT16 card_address, 53 | UINTN erase_grp_size, UINTN erase_timeout, 54 | BOOLEAN emmc); 55 | 56 | #endif /* _SDIO_H_ */ 57 | -------------------------------------------------------------------------------- /libkernelflinger/security_efi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Ming Tan 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef _SECURITY_EFI_H_ 33 | #define _SECURITY_EFI_H_ 34 | 35 | #include 36 | #include 37 | 38 | #define SECURITY_EFI_TRUSTY_SEED_LEN 64 39 | 40 | EFI_STATUS get_seed(OUT VOID *seed); 41 | 42 | EFI_STATUS stop_bls_proto(void); 43 | 44 | #endif // _SECURITY_EFI_H_ 45 | -------------------------------------------------------------------------------- /libkernelflinger/security_vb2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Genshen Li 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #include "security.h" 33 | #include "security_vb2.h" 34 | 35 | EFI_STATUS rot_pub_key_sha256(IN VBDATA *vb_data, 36 | OUT UINT8 **hash_p) 37 | { 38 | EFI_STATUS ret = EFI_SUCCESS; 39 | const uint8_t *vbmeta_pub_key; 40 | UINTN vbmeta_pub_key_len; 41 | 42 | if (vb_data && hash_p) { 43 | ret = avb_vbmeta_image_verify(vb_data->vbmeta_images[0].vbmeta_data, 44 | vb_data->vbmeta_images[0].vbmeta_size, 45 | &vbmeta_pub_key, 46 | &vbmeta_pub_key_len); 47 | 48 | if (EFI_ERROR(ret)) { 49 | efi_perror(ret, L"Failed to get the vbmeta_pub_key"); 50 | return ret; 51 | } 52 | 53 | ret = raw_pub_key_sha256(vbmeta_pub_key, vbmeta_pub_key_len, hash_p); 54 | if (EFI_ERROR(ret)) 55 | efi_perror(ret, L"Failed to compute key hash"); 56 | } else 57 | ret = EFI_INVALID_PARAMETER; 58 | 59 | return ret; 60 | } 61 | -------------------------------------------------------------------------------- /libkernelflinger/tools/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | ################################ 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES := png2c.c 7 | LOCAL_STATIC_LIBRARIES := libpng libz 8 | LOCAL_C_INCLUDES += external/libpng 9 | LOCAL_CFLAGS += -O2 -g -Wall -Werror -pedantic 10 | LOCAL_MODULE := png2c 11 | 12 | include $(BUILD_HOST_EXECUTABLE) 13 | -------------------------------------------------------------------------------- /libkernelflinger/tools/gen_fonts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | header="/* This is an autogenerated header file. Please use gen_fonts.sh */\n\n" 4 | images=($1/*.png) 5 | output=$2 6 | 7 | echo -e "$header" > $output 8 | 9 | for file in ${images[*]} 10 | do 11 | name=$(basename ${file%_font.png}) 12 | png2c -i $file -o - -f GRAY -p "__"$name >> $output 13 | done 14 | 15 | echo -en "\nui_font_t ui_fonts[] = {" >> $output 16 | prefix="" 17 | fonts_nb=0 18 | for file in ${images[*]} 19 | do 20 | name=$(basename ${file%_font.png}) 21 | 22 | if [ $file != ${images[0]} ] 23 | then 24 | prefix="," 25 | fi 26 | 27 | cwidth=$(echo $name | cut -d 'x' -f 1) 28 | cheight=$(echo $name | cut -d 'x' -f 2 | cut -d '_' -f 1) 29 | width=$(file $file | cut -d ' ' -f 5) 30 | height=$(file $file | cut -d ' ' -f 7 | sed 's/,//') 31 | echo -en "$prefix\n\t{ \"$name\", $width, $height, $cwidth, $cheight, __"$name"_dat }" >> $output 32 | fonts_nb=$((fonts_nb+1)) 33 | done 34 | echo -e "\n};" >> $output 35 | echo -e "UINTN ui_fonts_nb = $fonts_nb;" >> $output 36 | -------------------------------------------------------------------------------- /libkernelflinger/trusty_sbl.c: -------------------------------------------------------------------------------- 1 | trusty_abl.c -------------------------------------------------------------------------------- /libkernelflinger/ui_color.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_BLACK = { 0, 0, 0, 0 }; 40 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_WHITE = { 255, 255, 255, 0 }; 41 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_LIGHTGRAY = { 127, 127, 127, 0 }; 42 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_LIGHTRED = { 0, 0, 127, 0 }; 43 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_YELLOW = { 0, 255, 255, 0 }; 44 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_RED = { 0, 0, 255, 0 }; 45 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_GREEN = { 0, 255, 0, 0 }; 46 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_HIGHLIGHT = { 157, 106, 0, 0 }; 47 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL COLOR_ORANGE = { 0, 157, 255, 0 }; 48 | -------------------------------------------------------------------------------- /libkernelflinger/ui_font.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Authors: Jeremy Compostella 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | * OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #include 36 | #include 37 | 38 | #include "res/font_res.h" 39 | 40 | #define DEFAULT_FONT_NAME "18x32" 41 | 42 | ui_font_t *ui_font_get_default(void) 43 | { 44 | static ui_font_t *default_font = NULL; 45 | 46 | if (!default_font) 47 | default_font = ui_font_get(DEFAULT_FONT_NAME); 48 | 49 | if (!default_font) 50 | error(L"Unable to get %a default font", DEFAULT_FONT_NAME); 51 | 52 | return default_font; 53 | } 54 | 55 | ui_font_t *ui_font_get(char *name) 56 | { 57 | UINTN i; 58 | 59 | for (i = 0; i < ARRAY_SIZE(ui_fonts); i++) 60 | if (!strcmp((CHAR8 *)ui_fonts[i].name, (CHAR8 *)name)) 61 | return &ui_fonts[i]; 62 | 63 | return NULL; 64 | } 65 | -------------------------------------------------------------------------------- /libqltipc/Android.mk: -------------------------------------------------------------------------------- 1 | 2 | include $(all-subdir-makefiles) 3 | -------------------------------------------------------------------------------- /libqltipc/ql-tipc/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libqltipc-$(TARGET_BUILD_VARIANT) 6 | LOCAL_CFLAGS := $(KERNELFLINGER_CFLAGS) 7 | 8 | ifeq ($(TARGET_UEFI_ARCH),x86_64) 9 | LOCAL_CFLAGS += -DARCH_X86_64=1 10 | else 11 | LOCAL_CFLAGS += -DARCH_X86_32=1 12 | endif 13 | 14 | LOCAL_STATIC_LIBRARIES := \ 15 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 16 | libkernelflinger-$(TARGET_BUILD_VARIANT) 17 | 18 | LOCAL_C_INCLUDES := $(KERNELFLINGER_LOCAL_PATH) \ 19 | $(LOCAL_PATH)/include \ 20 | $(LOCAL_PATH)/arch/x86 \ 21 | $(LOCAL_PATH)/../interface/include \ 22 | $(KERNELFLINGER_LOCAL_PATH)/libsslsupport \ 23 | $(KERNELFLINGER_LOCAL_PATH)/avb 24 | 25 | LOCAL_SRC_FILES := \ 26 | ipc.c \ 27 | ipc_dev.c \ 28 | libtipc.c \ 29 | avb.c \ 30 | trusty_dev_common.c \ 31 | arch/x86/trusty_dev.c \ 32 | arch/x86/trusty_mem.c \ 33 | arch/x86/sysdeps_osloader.c \ 34 | util.c \ 35 | keymaster.c \ 36 | keymaster_serializable.c \ 37 | 38 | ifeq ($(KERNELFLINGER_TRUSTY_PLATFORM),vsbl) 39 | LOCAL_CFLAGS += -DHYPERVISOR_ACRN 40 | endif 41 | 42 | include $(BUILD_EFI_STATIC_LIBRARY) 43 | -------------------------------------------------------------------------------- /libqltipc/ql-tipc/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016, The Android Open Source Project 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /libqltipc/ql-tipc/README.md: -------------------------------------------------------------------------------- 1 | # Queueless Trusty IPC 2 | 3 | ql-tipc is a portable client library that implements Trusty queueless IPC. 4 | It is intended to enable Trusty IPC in bootloader environments. 5 | 6 | ## Code organization 7 | 8 | ### IPC components 9 | 10 | - libtipc - Functions to be called by library user 11 | - ipc - IPC library 12 | - ipc_dev - Helper functions for sending requests to the secure OS 13 | 14 | ### Misc 15 | 16 | - examples/ - Implementations of bootloader-specific code. 17 | - arch/$ARCH/ - Architecture dependent implementation of Trusty device 18 | (see trusty_dev.h). Implements SMCs on ARM for example. 19 | 20 | ## Portability Notes 21 | 22 | The suggested approach to porting ql-tipc is to copy all header and C files 23 | into the bootloader and integrate as needed. RPMB storage operations and 24 | functions defined in trusty/sysdeps.h require system dependent implementations. 25 | 26 | If the TIPC_ENABLE_DEBUG preprocessor symbol is set, the code will include 27 | debug information and run-time checks. Production builds should not use this. 28 | 29 | -------------------------------------------------------------------------------- /libqltipc/ql-tipc/arch/x86/compiler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer 13 | * in the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef TRUSTY_QL_TIPC_COMPILER_H_ 31 | #define TRUSTY_QL_TIPC_COMPILER_H_ 32 | 33 | #pragma GCC diagnostic ignored "-Wunused-parameter" 34 | 35 | #ifndef offsetof 36 | #if __GNUC__ > 3 37 | #define offsetof(type, member) __builtin_offsetof(type, member) 38 | #else 39 | #define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 )) 40 | #endif 41 | #endif 42 | 43 | #define TRUSTY_QL_TIPC_MAX_BUFFER_LEN PAGE_SIZE 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /libqltipc/ql-tipc/include/trusty/libtipc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | #ifndef TRUSTY_LIBTIPC_H_ 25 | #define TRUSTY_LIBTIPC_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | /* 32 | * Initialize TIPC library 33 | */ 34 | int trusty_ipc_init(void); 35 | /* 36 | * Shutdown TIPC library 37 | */ 38 | void trusty_ipc_shutdown(void); 39 | 40 | #endif /* TRUSTY_LIBTIPC_H_ */ 41 | -------------------------------------------------------------------------------- /libqltipc/ql-tipc/include/trusty/smc.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2016 The Android Open Source Project 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, copy, 9 | * modify, merge, publish, distribute, sublicense, and/or sell copies 10 | * of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | /* 27 | * Execute SMC call into trusty or el3 28 | */ 29 | 30 | struct smc_ret8 { 31 | unsigned long r0; 32 | unsigned long r1; 33 | unsigned long r2; 34 | unsigned long r3; 35 | unsigned long r4; 36 | unsigned long r5; 37 | unsigned long r6; 38 | unsigned long r7; 39 | }; 40 | 41 | struct smc_ret8 smc8(unsigned long r0, 42 | unsigned long r1, 43 | unsigned long r2, 44 | unsigned long r3, 45 | unsigned long r4, 46 | unsigned long r5, 47 | unsigned long r6, 48 | unsigned long r7); 49 | 50 | static inline unsigned long smc(unsigned long r0, 51 | unsigned long r1, 52 | unsigned long r2, 53 | unsigned long r3) { 54 | return smc8(r0, r1, r2, r3, 0, 0, 0, 0).r0; 55 | } 56 | -------------------------------------------------------------------------------- /libqltipc/ql-tipc/include/trusty/trusty_mem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #ifndef TRUSTY_TRUSTY_MEM_H_ 26 | #define TRUSTY_TRUSTY_MEM_H_ 27 | 28 | #include 29 | 30 | /* 31 | * Encodes the memory attributes of @va into @inf 32 | * 33 | * @inf: ns_mem_page_info allocated by the caller 34 | * @va: virtual addresses to retrieve attributes for 35 | * 36 | * Returns 0 on success and -1 on failure 37 | */ 38 | 39 | int trusty_encode_page_info(struct ns_mem_page_info* inf, void* va); 40 | 41 | #endif /* TRUSTY_TRUSTY_MEM_H_ */ 42 | -------------------------------------------------------------------------------- /libqltipc/ql-tipc/util.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #include 26 | 27 | const char* trusty_basename(const char* str) { 28 | int64_t n; 29 | size_t len; 30 | 31 | len = trusty_strlen(str); 32 | if (len >= 2) { 33 | for (n = len - 2; n >= 0; n--) { 34 | if (str[n] == '/') { 35 | return str + n + 1; 36 | } 37 | } 38 | } 39 | return str; 40 | } 41 | -------------------------------------------------------------------------------- /libsslsupport/borningssl/sys/syscall.h: -------------------------------------------------------------------------------- 1 | /* 2 | function needed for compiling borningssl on Android O 3 | */ 4 | #pragma once 5 | long syscall(long __number, ...){return 0;}; 6 | -------------------------------------------------------------------------------- /libsslsupport/errno.h: -------------------------------------------------------------------------------- 1 | #include "openssl_support.h" 2 | -------------------------------------------------------------------------------- /libsslsupport/inttypes.h: -------------------------------------------------------------------------------- 1 | #include "openssl_support.h" 2 | -------------------------------------------------------------------------------- /libsslsupport/limits.h: -------------------------------------------------------------------------------- 1 | #include "openssl_support.h" 2 | -------------------------------------------------------------------------------- /libsslsupport/openssl_support.h: -------------------------------------------------------------------------------- 1 | #ifndef _OPENSSL_SUPPORT_H_ 2 | #define _OPENSSL_SUPPORT_H_ 3 | 4 | #include 5 | #include 6 | 7 | typedef UINTN size_t; 8 | #define DEFINED_SIZE_T 9 | 10 | typedef long time_t; 11 | typedef VOID *FILE; 12 | 13 | typedef struct { 14 | #if defined(__LP64__) 15 | int32_t __private[14]; 16 | #else 17 | int32_t __private[10]; 18 | #endif 19 | } pthread_rwlock_t; 20 | 21 | struct tm; 22 | 23 | #endif /* _OPENSSL_SUPPORT_H_ */ 24 | -------------------------------------------------------------------------------- /libsslsupport/stdarg.h: -------------------------------------------------------------------------------- 1 | #include "openssl_support.h" 2 | -------------------------------------------------------------------------------- /libsslsupport/stdio.h: -------------------------------------------------------------------------------- 1 | #include "openssl_support.h" 2 | -------------------------------------------------------------------------------- /libsslsupport/stdlib.h: -------------------------------------------------------------------------------- 1 | #include "openssl_support.h" 2 | -------------------------------------------------------------------------------- /libsslsupport/sys/types.h: -------------------------------------------------------------------------------- 1 | #include "openssl_support.h" 2 | -------------------------------------------------------------------------------- /libsslsupport/time.h: -------------------------------------------------------------------------------- 1 | #include "openssl_support.h" 2 | -------------------------------------------------------------------------------- /libtransport/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libtransport-$(TARGET_BUILD_VARIANT) 6 | LOCAL_CFLAGS := $(KERNELFLINGER_CFLAGS) 7 | LOCAL_STATIC_LIBRARIES := \ 8 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 9 | libkernelflinger-$(TARGET_BUILD_VARIANT) 10 | 11 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include/libtransport 12 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include/libtransport 13 | LOCAL_SRC_FILES := \ 14 | transport.c 15 | 16 | include $(BUILD_EFI_STATIC_LIBRARY) 17 | -------------------------------------------------------------------------------- /libxbc/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := libxbc-$(TARGET_BUILD_VARIANT) 6 | LOCAL_CFLAGS := $(KERNELFLINGER_CFLAGS) 7 | 8 | LOCAL_STATIC_LIBRARIES := \ 9 | $(KERNELFLINGER_STATIC_LIBRARIES) \ 10 | libkernelflinger-$(TARGET_BUILD_VARIANT) 11 | 12 | LOCAL_C_INCLUDES := $(KERNELFLINGER_LOCAL_PATH) \ 13 | $(LOCAL_PATH)/include 14 | 15 | LOCAL_SRC_FILES := \ 16 | libxbc.c 17 | 18 | include $(BUILD_EFI_STATIC_LIBRARY) 19 | -------------------------------------------------------------------------------- /prebuilt/board/APL_UP2/fastboot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/prebuilt/board/APL_UP2/fastboot.elf -------------------------------------------------------------------------------- /prebuilt/board/RPL_IVI/blizzard_ivi/installer.efi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/prebuilt/board/RPL_IVI/blizzard_ivi/installer.efi -------------------------------------------------------------------------------- /prebuilt/board/RPL_IVI/blizzard_ivi/kernelflinger.efi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/prebuilt/board/RPL_IVI/blizzard_ivi/kernelflinger.efi -------------------------------------------------------------------------------- /prebuilt/board/RPL_IVI/installer.efi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/prebuilt/board/RPL_IVI/installer.efi -------------------------------------------------------------------------------- /prebuilt/board/RPL_IVI/kernelflinger.efi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectceladon/kernelflinger/3be0f99b87b2e8c10b37450964b24f65ab3cb61f/prebuilt/board/RPL_IVI/kernelflinger.efi -------------------------------------------------------------------------------- /unittest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Author: Andrew Boie 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef UNITTEST_H 34 | #define UNITTEST_H 35 | 36 | VOID unittest_main(CHAR16 *testname); 37 | 38 | #endif 39 | --------------------------------------------------------------------------------