fbc211a255
efi_block_io_media struct needs padding on x86.
uint64_t is aligned on 4 bytes in Haiku toolchain for 32-bit EFI loader.
But the EFI firmware expects it to be aligned on 8 bytes.
Same padding in u-boot:
https://github.com/u-boot/u-boot/blob/v2021.10/include/efi_api.h#L638
and in Illumos:
feff18a41e
Change-Id: I1b95cbe4cc1e7d96fde3ba52862a05f8a94aab79
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4840
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
59 lines
1.7 KiB
C
59 lines
1.7 KiB
C
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#pragma once
|
|
|
|
#include <efi/types.h>
|
|
#include <efi/boot-services.h>
|
|
#include <efi/runtime-services.h>
|
|
|
|
#define EFI_BLOCK_IO_PROTOCOL_GUID \
|
|
{0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
|
|
|
extern efi_guid BlockIoProtocol;
|
|
|
|
#define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001
|
|
#define EFI_BLOCK_IO_PROTOCOL_REVISION3 0x00020031
|
|
|
|
typedef struct efi_block_io_media efi_block_io_media;
|
|
typedef struct efi_block_io_protocol efi_block_io_protocol;
|
|
|
|
struct efi_block_io_protocol {
|
|
uint64_t Revision;
|
|
efi_block_io_media* Media;
|
|
efi_status (*Reset)(efi_block_io_protocol* self,
|
|
bool ExtendedVerification) EFIAPI;
|
|
efi_status (*ReadBlocks)(efi_block_io_protocol* self,
|
|
uint32_t MediaId, uint64_t LBA,
|
|
size_t BufferSize, void* Buffer) EFIAPI;
|
|
efi_status (*WriteBlocks)(efi_block_io_protocol* self,
|
|
uint32_t MediaId, uint64_t LBA,
|
|
size_t BufferSize, const void* Buffer) EFIAPI;
|
|
efi_status (*FlushBlocks)(efi_block_io_protocol* self);
|
|
|
|
|
|
};
|
|
|
|
struct efi_block_io_media {
|
|
// present in rev1
|
|
uint32_t MediaId;
|
|
bool RemovableMedia;
|
|
bool MediaPresent;
|
|
bool LogicalPartition;
|
|
bool ReadOnly;
|
|
bool WriteCaching;
|
|
uint8_t pad1[3];
|
|
uint32_t BlockSize;
|
|
uint32_t IoAlign;
|
|
uint8_t pad2[4];
|
|
uint64_t LastBlock;
|
|
|
|
// present in rev2
|
|
uint64_t LowestAlignedLba;
|
|
uint32_t LogicalBlocksPerPhysicalBlock;
|
|
|
|
// present in rev3
|
|
uint32_t OptimalTransferLengthGranularity;
|
|
};
|