[lib][uefi] Mark bio functions as WEAK
OEMs may want to override certain bio functions, hence mark `open_block_device` and `open_async_block_device` as WEAK. This allows OEMs to customize any of the bio functions
This commit is contained in:
committed by
Kelvin Zhang
parent
72c92b5d81
commit
848fbfefe7
@@ -27,7 +27,6 @@
|
||||
#include <uefi/protocols/block_io2_protocol.h>
|
||||
#include <uefi/types.h>
|
||||
|
||||
#include "defer.h"
|
||||
#include "events.h"
|
||||
#include "io_stack.h"
|
||||
#include "memory_protocols.h"
|
||||
@@ -134,7 +133,7 @@ EfiStatus flush_blocks_ex(EfiBlockIo2Protocol* self, EfiBlockIo2Token* token) {
|
||||
|
||||
} // namespace
|
||||
|
||||
EfiStatus open_async_block_device(EfiHandle handle, void** intf) {
|
||||
__WEAK EfiStatus open_async_block_device(EfiHandle handle, void** intf) {
|
||||
auto dev = bio_open(reinterpret_cast<const char*>(handle));
|
||||
printf("%s(%s)\n", __FUNCTION__, dev->name);
|
||||
auto interface = reinterpret_cast<EfiBlockIo2Interface*>(
|
||||
|
||||
@@ -75,7 +75,7 @@ EfiStatus reset(EfiBlockIoProtocol *self, bool extended_verification) {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
EfiStatus open_block_device(EfiHandle handle, void **intf) {
|
||||
__WEAK EfiStatus open_block_device(EfiHandle handle, void** intf) {
|
||||
printf("%s(%p)\n", __FUNCTION__, handle);
|
||||
auto io_stack = get_io_stack();
|
||||
if (io_stack == nullptr) {
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <uefi/types.h>
|
||||
|
||||
#include "defer.h"
|
||||
#include "memory_protocols.h"
|
||||
|
||||
#define LOCAL_TRACE 0
|
||||
|
||||
@@ -173,6 +172,7 @@ const char* GetImageType(const char16_t* ImageType) {
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T clamp(T n, T lower, T upper) {
|
||||
if (n < lower) {
|
||||
@@ -241,8 +241,7 @@ __WEAK EfiStatus get_buffer(struct GblEfiImageLoadingProtocol* self,
|
||||
return EFI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
__WEAK
|
||||
EfiStatus open_efi_erase_block_protocol(const EfiHandle handle, void** intf) {
|
||||
__WEAK EfiStatus open_efi_erase_block_protocol(EfiHandle handle, void** intf) {
|
||||
auto* device_name = static_cast<const char*>(handle);
|
||||
LTRACEF("handle=%p (%s)\n", handle, device_name);
|
||||
auto* p = reinterpret_cast<EfiEraseBlockInterface*>(
|
||||
|
||||
@@ -75,6 +75,6 @@ void setup_heap();
|
||||
// Caled by LK once after executing UEFI application to tear down the heap
|
||||
void reset_heap();
|
||||
|
||||
EfiStatus open_efi_erase_block_protocol(const EfiHandle handle, void** intf);
|
||||
EfiStatus open_efi_erase_block_protocol(EfiHandle handle, void** intf);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user