0
0
mirror of https://github.com/edk2-porting/edk2-msm synced 2024-05-16 20:19:30 +00:00

fixup! Project: Move GPL code into a dedicated folder

This commit is contained in:
Molly Sophia 2022-11-13 21:31:31 +08:00
parent b467e32d0c
commit 2f3d0f197f
13 changed files with 0 additions and 590 deletions

View File

@ -1,128 +0,0 @@
/* Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __BSL_BLOCK_UTILS_H__
#define __BSL_BLOCK_UTILS_H__
#include <Uefi.h>
#include <Guid/FileSystemInfo.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Protocol/BlockIo.h>
#include <Protocol/SimpleFileSystem.h>
/* Selection attributes for selecting the BlkIo handles */
#define BLK_IO_SEL_MEDIA_TYPE_REMOVABLE 0x0001
#define BLK_IO_SEL_MEDIA_TYPE_NON_REMOVABLE 0x0002
#define BLK_IO_SEL_PARTITIONED_GPT 0x0004
#define BLK_IO_SEL_PARTITIONED_MBR 0x0008
#define BLK_IO_SEL_MATCH_PARTITION_TYPE_GUID 0x0010
#define BLK_IO_SEL_SELECT_MOUNTED_FILESYSTEM 0x0020
#define BLK_IO_SEL_SELECT_BY_VOLUME_NAME 0x0040
/* Select only the root device handle indicated. Doesn't return
* any partitions within.
* Currently this filter applies only for eMMC device, not the external
* device connected via USB */
#define BLK_IO_SEL_SELECT_ROOT_DEVICE_ONLY 0x0080
/* Select the handle that's on the indicated root device.
* Currently this filter applies only for eMMC device, not the external
* device connected via USB */
#define BLK_IO_SEL_MATCH_ROOT_DEVICE 0x0100
/* Select through partition name*/
#define BLK_IO_SEL_MATCH_PARTITION_LABEL 0x0200
/* Do case insensetive string comparisons */
#define BLK_IO_SEL_STRING_CASE_INSENSITIVE 0x0400
/* Partitioning scheme types for selecting the BlkIo handles */
#define PARTITIONED_TYPE_MBR 0x01
#define PARTITIONED_TYPE_GPT 0x02
#define MAX_HANDLE_INFO_LIST 128
#define BOOT_DEV_NAME_SIZE_MAX 10
/* Output data providing more information about the device handle */
typedef struct {
/* Handle that has BlkIO protocol installed, returned for all type of filters
*/
EFI_HANDLE *Handle;
/* Block IO protocol interface is returned for all type of filters */
EFI_BLOCK_IO_PROTOCOL *BlkIo;
/* This HDD dev path is returned only if Matching Partition type is requested
* It should be noted that the contents of this memory should NOT be changed
*/
const HARDDRIVE_DEVICE_PATH *PartitionInfo;
} HandleInfo;
/* Return True if integer overflow will occur */
#define CHECK_ADD64(a, b) ((MAX_UINT64 - b < a) ? TRUE : FALSE)
/* Any data specific to additional attributes can be added here. */
typedef struct {
EFI_GUID *RootDeviceType; /* GUID Selecting the root device type */
EFI_GUID *PartitionType; /* Partition Type to match */
CHAR8 * VolumeName; /* Mounted filesystem volume name to match */
CHAR16 * PartitionLabel; /* Partition label to match */
} PartiSelectFilter;
EFI_STATUS
EFIAPI
GetPartitionEntry(IN EFI_HANDLE Handle, OUT EFI_PARTITION_ENTRY **PartEntry);
/**
Returns a list of BlkIo handles based on required criteria
SelectionAttrib : Bitmask representing the conditions that need
to be met for the handles returned. Based on the
selections filter members should have valid values.
FilterData : Instance of Partition Select Filter structure that
needs extended data for certain type flags. For example
Partition type and/or Volume name can be specified.
HandleInfoPtr : Pointer Handle info where the information can be returned
MaxBlkIopCnt : On input, max number of handles the buffer can hold,
On output, the number of handles returned.
@retval EFI_SUCCESS if the operation was successful
*/
EFI_STATUS
EFIAPI
GetBlkIOHandles(
IN UINT32 SelectionAttrib, IN PartiSelectFilter *FilterData,
OUT HandleInfo *HandleInfoPtr, IN OUT UINT32 *MaxBlkIopCnt);
#endif

View File

@ -1,168 +0,0 @@
/* Copyright (c) 2015-2016,2019 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __BSL_EFICARDINFO_H__
#define __BSL_EFICARDINFO_H__
/*===========================================================================
INCLUDE FILES
===========================================================================*/
/*===========================================================================
MACRO DECLARATIONS
===========================================================================*/
/** @addtogroup efi_cardInfo_constants
@{ */
/**
Protocol version.
*/
#define EFI_MEM_CARD_INFO_PROTOCOL_REVISION 0x0000000000010003
/** @} */ /* end_addtogroup efi_cardInfo_constants */
/* Protocol GUID definition */
/** @ingroup efi_cardInfo_protocol */
#define EFI_CARD_INFO_PROTOCOL_GUID \
{ 0x85C1F7D2, 0xBCE6, 0x4F31, { 0x8F, 0x4D, 0xD3, 0x7E, 0x03, 0xD0, 0x5E, 0xAA } }
/** @cond */
/*===========================================================================
EXTERNAL VARIABLES
===========================================================================*/
/**
External reference to the EFICardInfo Protocol GUID.
*/
extern EFI_GUID gEfiMemCardInfoProtocolGuid;
/*===========================================================================
TYPE DEFINITIONS
===========================================================================*/
/**
Protocol declaration.
*/
typedef struct _EFI_MEM_CARDINFO_PROTOCOL EFI_MEM_CARDINFO_PROTOCOL;
/** @endcond */
/** @addtogroup efi_cardInfo_data_types
@{ */
/**
SDCC/UFS unified Card information.
*/
typedef struct _CARD_INFO {
UINT16 mfr_id; /**< Manufacturer ID. */
UINT16 oem_id; /**< Original equipment manufacturer ID. */
UINT8 mfr_date[8]; /**< Manufacture date. */
UINT8 product_serial_num[252]; /**< Product serial number. */
UINT32 serial_num_len; /**< Product serial number length. */
UINT8 inquiry_str[29]; /**< Output from SCSI inquiry command. */
UINT32 rpmb_size_in_byte; /**< Replay protected memory block partition
size in bytes. */
UINT32 reliable_write_count; /**< Reliable write count. */
UINT8 card_type[4]; /**< Type of the card. 'UFS' or 'MMC' */
} /** @cond */ MEM_CARD_INFO /** @endcond */;
/** @} */ /* end_addtogroup efi_cardInfo_data_types */
/*===========================================================================
FUNCTION DEFINITIONS
===========================================================================*/
/* GET_MEM_CARD_INFO */
/** @ingroup efi_cardInfo_get_card_info
@par Summary
Gets the card information.
@param[in] This Pointer to the
EFI_MEM_CARDINFO_PROTOCOL
instance.
@param[out] card_info Pointer to a variable that the driver returns
with the retrieved card information; see
#_MEM_CARD_INFO for details.
@return
EFI_SUCCESS -- Function completed successfully. \n
EFI_INVALID_PARAMETER -- Parameter is invalid.
*/
typedef EFI_STATUS (EFIAPI *GET_MEM_CARD_INFO) (
IN EFI_MEM_CARDINFO_PROTOCOL *This,
OUT MEM_CARD_INFO *card_info);
/* GET_BOOT_LU */
/** @ingroup efi_cardInfo_get_boot_lu
@par Summary
Gets the BOOT LU
@param[in] This Pointer to the
EFI_MEM_CARDINFO_PROTOCOL
instance.
@param[out] BootLU Pointer to a variable
that indicates the BOOT LU
(0 = disable BOOT LU, 1 = BOOT for A,
2 = BOOT for B)
@return
EFI_SUCCESS -- Function completed successfully. \n
EFI_INVALID_PARAMETER -- Parameter is invalid.
*/
typedef EFI_STATUS (EFIAPI *GET_BOOT_LU) (IN EFI_MEM_CARDINFO_PROTOCOL *This,
OUT UINT32 *BootLU);
/* SET_BOOT_LU */
/** @ingroup efi_cardInfo_set_boot_lu
@par Summary
Set the BOOT LU.
@param[in] This Pointer to the
EFI_MEM_CARDINFO_PROTOCOL
instance.
@param[in] BootLU Boot LU to switch to
(0 = disable BOOT LU, 1 = BOOT for A,
2 = BOOT for B)
@return
EFI_SUCCESS -- Function completed successfully. \n
EFI_INVALID_PARAMETER -- Parameter is invalid.
*/
typedef EFI_STATUS (EFIAPI *SET_BOOT_LU) (IN EFI_MEM_CARDINFO_PROTOCOL *This,
IN UINT32 BootLU);
/*===========================================================================
PROTOCOL INTERFACE
===========================================================================*/
/** @ingroup efi_cardInfo_protocol
@par Summary
Secure Digital Card Controller (SDCC) Card/Universal Flash Storage (UFS) Card
Information Protocol interface.
@par Parameters
@inputprotoparams{card_info_proto_params.tex}
*/
struct _EFI_MEM_CARDINFO_PROTOCOL {
UINT64 Revision;
GET_MEM_CARD_INFO GetCardInfo;
GET_BOOT_LU GetBootLU;
SET_BOOT_LU SetBootLU;
};
#endif /* __EFICARDINFO_H__ */

View File

@ -1,29 +0,0 @@
/*
* SwitchSlotsApp Module
* Copyright (C) 2021 Renard Gold <goldrenard@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/
*/
#ifndef __BSL_EFIUTILS_H__
#define __BSL_EFIUTILS_H__
#include <Uefi.h>
void WaitAnyKey(EFI_SYSTEM_TABLE *mSystemTable);
void PrintAndWaitAnyKey(EFI_SYSTEM_TABLE *mSystemTable, CHAR16 *Message);
#endif

View File

@ -1,211 +0,0 @@
/*
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of The Linux Foundation nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __BSL_PARTITION_TABLE_H__
#define __BSL_PARTITION_TABLE_H__
#include <Library/BootSlotLib/BlockIoUtils.h>
enum ReturnVal {
SUCCESS = 0,
FAILURE,
};
typedef enum {
PARTITION_ATTRIBUTES = 1,
PARTITION_GUID,
PARTITION_ALL,
} UPDATE_TYPE;
typedef enum {
PTN_ENTRIES_TO_MISC = 1,
PTN_ENTRIES_FROM_MISC,
} NANDAB_UPDATE_TYPE;
#define NANDAB_MAX_SLOTNAME_LEN 7
#define PARTITION_ATTRIBUTES_MASK 0x1
#define PARTITION_GUID_MASK 0x2
#define MAX_HANDLEINF_LST_SIZE 128
#define PARTITION_TYPE_MBR 0
#define PARTITION_TYPE_GPT 1
#define PARTITION_TYPE_GPT_BACKUP 2
#define GPT_PROTECTIVE 0xEE
#define MBR_PARTITION_RECORD 446
#define OS_TYPE 4
#define MBR_SIGNATURE 510
#define MBR_SIGNATURE_BYTE_0 0x55
#define MBR_SIGNATURE_BYTE_1 0xAA
#define MIBIB_MAGIC1 0xFE569FAC
#define MIBIB_MAGIC2 0xCD7F127A
/* GPT Signature should be 0x5452415020494645 */
#define GPT_SIGNATURE_1 0x54524150
#define GPT_SIGNATURE_2 0x20494645
#define GPT_HEADER_SIZE 92
#define GPT_LBA 1
#define GPT_PART_ENTRY_SIZE 128
#define MAX_GPT_NAME_SIZE 72
/* GPT Offsets */
#define HEADER_SIZE_OFFSET 12
#define HEADER_CRC_OFFSET 16
#define PRIMARY_HEADER_OFFSET 24
#define BACKUP_HEADER_OFFSET 32
#define FIRST_USABLE_LBA_OFFSET 40
#define LAST_USABLE_LBA_OFFSET 48
#define PARTITION_ENTRIES_OFFSET 72
#define PARTITION_COUNT_OFFSET 80
#define PENTRY_SIZE_OFFSET 84
#define PARTITION_CRC_OFFSET 88
#define PARTITION_ENTRY_LAST_LBA 40
#define PARTITION_TYPE_GUID_SIZE 4
#define UNIQUE_PARTITION_GUID_SIZE 16
#define PARTITION_ENTRY_SIZE 128
#define PART_ATT_READONLY_OFFSET 60
/*
The attributes like Priority, Active bit,
Max retry count, Success bit and Unabootable bits will be
stored in attributes filed of the each partition in partition
table in the respective position mentioned below.
*/
/* Partition Attribute fields*/
#define PART_ATT_PRIORITY_BIT 48
#define PART_ATT_ACTIVE_BIT 50
#define PART_ATT_MAX_RETRY_CNT_BIT 51
#define PART_ATT_SUCCESS_BIT 54
#define PART_ATT_UNBOOTABLE_BIT 55
#define PART_ATT_PRIORITY_VAL ((UINT64)0x3 << PART_ATT_PRIORITY_BIT)
#define PART_ATT_ACTIVE_VAL ((UINT64)0x1 << PART_ATT_ACTIVE_BIT)
#define PART_ATT_MAX_RETRY_COUNT_VAL ((UINT64)0x7 << PART_ATT_MAX_RETRY_CNT_BIT)
#define PART_ATT_SUCCESSFUL_VAL ((UINT64)0x1 << PART_ATT_SUCCESS_BIT)
#define PART_ATT_UNBOOTABLE_VAL ((UINT64)0x1 << PART_ATT_UNBOOTABLE_BIT)
#define MAX_PRIORITY 3
#define MAX_RETRY_COUNT 7
#define MAX_NUM_PARTITIONS 128
#define MIN_PARTITION_ARRAY_SIZE 0x4000
#define ATTRIBUTE_FLAG_OFFSET 48
#define INVALID_PTN -1
#define GPT_HDR_BLOCKS 0x1
#define MAX_PARTITION_ENTRIES_SZ (MAX_NUM_PARTITIONS * PARTITION_ENTRY_SIZE)
#define GUID_SIZE 16
#define PRIMARY_HDR_LBA 0x1
#define BOOT_PART_SIZE 32
/*Slot specific macros*/
#define MAX_SLOT_SUFFIX_SZ 3
#define MIN_SLOTS 1
#define MAX_SLOTS 2
#define MAX_LUNS 8
#define NO_LUN -1
#define GET_LWORD_FROM_BYTE(x) \
((UINT32) * (x) | ((UINT32) * (x + 1) << 8) | ((UINT32) * (x + 2) << 16) | \
((UINT32) * (x + 3) << 24))
#define GET_LLWORD_FROM_BYTE(x) \
((UINT64) * (x) | ((UINT64) * (x + 1) << 8) | ((UINT64) * (x + 2) << 16) | \
((UINT64) * (x + 3) << 24) | ((UINT64) * (x + 4) << 32) | \
((UINT64) * (x + 5) << 40) | ((UINT64) * (x + 6) << 48) | \
((UINT64) * (x + 7) << 56))
#define GET_LONG(x) \
((UINT32) * (x) | ((UINT32) * (x + 1) << 8) | ((UINT32) * (x + 2) << 16) | \
((UINT32) * (x + 3) << 24))
#define PUT_LONG(x, y) \
*(x) = y & 0xff; \
*(x + 1) = (y >> 8) & 0xff; \
*(x + 2) = (y >> 16) & 0xff; \
*(x + 3) = (y >> 24) & 0xff;
#define PUT_LONG_LONG(x, y) \
(*(x) = (y)&0xff); \
(*((x) + 1) = (((y) >> 8) & 0xff)); \
(*((x) + 2) = (((y) >> 16) & 0xff)); \
(*((x) + 3) = (((y) >> 24) & 0xff)); \
(*((x) + 4) = (((y) >> 32) & 0xff)); \
(*((x) + 5) = (((y) >> 40) & 0xff)); \
(*((x) + 6) = (((y) >> 48) & 0xff)); \
(*((x) + 7) = (((y) >> 56) & 0xff));
#define GUARD(code) \
do { \
Status = (code); \
if (Status != EFI_SUCCESS) { \
DEBUG( \
(EFI_D_ERROR, "Err: line:%d %a() status: %r\n", __LINE__, \
__FUNCTION__, Status)); \
return Status; \
} \
} while (0)
struct StoragePartInfo {
HandleInfo HandleInfoList[MAX_NUM_PARTITIONS];
UINT32 MaxHandles;
};
extern struct StoragePartInfo Ptable[MAX_LUNS];
typedef struct {
CHAR16 Suffix[MAX_SLOT_SUFFIX_SZ];
} Slot;
Slot GetCurrentSlotSuffix();
UINT32 GetMaxLuns();
VOID GetPartitionCount(UINT32 *Val);
VOID SetMultiSlotBootVal(BOOLEAN Val);
struct PartitionEntry {
EFI_PARTITION_ENTRY PartEntry;
UINT32 lun;
};
extern struct PartitionEntry PtnEntries[MAX_NUM_PARTITIONS];
struct BootPartsLinkedList {
CHAR16 PartName[BOOT_PART_SIZE];
struct BootPartsLinkedList *Next;
};
INT32 GetPartitionIndex(CHAR16 *PartitionName);
BOOLEAN PartitionHasMultiSlot(CONST CHAR16 *Pname);
EFI_STATUS EnumeratePartitions(VOID);
VOID UpdatePartitionEntries(VOID);
VOID UpdatePartitionAttributes(UINT32 UpdateType);
BOOLEAN IsSuffixEmpty(Slot *CheckSlot);
EFI_STATUS
SetActiveSlot(Slot *NewSlot, BOOLEAN ResetSuccessBit, BOOLEAN SetSuccessBit);
BOOLEAN IsSlotBootable(Slot *CheckSlot);
EFI_STATUS ClearUnbootable(Slot *CheckSlot);
UINT64 GetPartitionSize(EFI_BLOCK_IO_PROTOCOL *BlockIo);
#endif

View File

@ -1,54 +0,0 @@
/* Copyright (c) 2015-2018, 2020-2021, The Linux Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __BSL_BOARD_H__
#define __BSL_BOARD_H__
#include <Library/BootSlotLib/EFICardInfo.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Uefi.h>
#define HANDLE_MAX_INFO_LIST 128
typedef enum {
EMMC = 0,
UFS = 1,
UNKNOWN,
} MemCardType;
VOID GetRootDeviceType(CHAR8 *StrDeviceType, UINT32 Len);
MemCardType CheckRootDeviceType(VOID);
EFI_STATUS
UfsGetSetBootLun(UINT32 *UfsBootlun, BOOLEAN IsGet);
#endif