/** Helper macro for stringification. */
#define FSW_EFI_STRINGIFY(x) #x
/** Expands to the EFI driver name given the file system type name. */
-#define FSW_EFI_DRIVER_NAME(t) L"rEFInd 0.9.1 " FSW_EFI_STRINGIFY(t) L" File System Driver"
+#define FSW_EFI_DRIVER_NAME(t) L"rEFInd 0.10.3 " FSW_EFI_STRINGIFY(t) L" File System Driver"
// function prototypes
IN CHAR8 *Language,
OUT CHAR16 **ControllerName);
-void fsw_efi_change_blocksize(struct fsw_volume *vol,
+void EFIAPI fsw_efi_change_blocksize(struct fsw_volume *vol,
fsw_u32 old_phys_blocksize, fsw_u32 old_log_blocksize,
fsw_u32 new_phys_blocksize, fsw_u32 new_log_blocksize);
-fsw_status_t fsw_efi_read_block(struct fsw_volume *vol, fsw_u64 phys_bno, void *buffer);
+fsw_status_t EFIAPI fsw_efi_read_block(struct fsw_volume *vol, fsw_u64 phys_bno, void *buffer);
EFI_STATUS fsw_efi_map_status(fsw_status_t fsw_status, FSW_VOLUME_DATA *Volume);
{
EFI_STATUS Status;
-#ifndef HOST_EFI_EDK2
+#ifndef __MAKEWITH_TIANO
// Not available in EDK2 toolkit
InitializeLib(ImageHandle, SystemTable);
#endif
This->DriverBindingHandle,
ControllerHandle);
}
-
return Status;
}
* when the file system driver changes the block sizes for the volume.
*/
-void fsw_efi_change_blocksize(struct fsw_volume *vol,
+void EFIAPI fsw_efi_change_blocksize(struct fsw_volume *vol,
fsw_u32 old_phys_blocksize, fsw_u32 old_log_blocksize,
fsw_u32 new_phys_blocksize, fsw_u32 new_log_blocksize)
{
* disk.
*/
-fsw_status_t fsw_efi_read_block(struct fsw_volume *vol, fsw_u64 phys_bno, void *buffer) {
+fsw_status_t EFIAPI fsw_efi_read_block(struct fsw_volume *vol, fsw_u64 phys_bno, void *buffer) {
int i, ReadCache = -1;
FSW_VOLUME_DATA *Volume = (FSW_VOLUME_DATA *)vol->host_data;
EFI_STATUS Status = EFI_SUCCESS;
BOOLEAN ReadOneBlock = FALSE;
- fsw_u64 StartRead = phys_bno * vol->phys_blocksize;
+ UINT64 StartRead = (UINT64) phys_bno * (UINT64) vol->phys_blocksize;
if (buffer == NULL)
return (fsw_status_t) EFI_BAD_BUFFER_SIZE;
i = 0;
do {
if ((Caches[i].Volume == Volume) &&
- (Caches[i].CacheValid == TRUE) &&
+ (Caches[i].CacheValid == TRUE) &&
(StartRead >= Caches[i].CacheStart) &&
((StartRead + vol->phys_blocksize) <= (Caches[i].CacheStart + CACHE_SIZE))) {
ReadCache = i;
if (Caches[ReadCache].Cache == NULL)
Caches[ReadCache].Cache = AllocatePool(CACHE_SIZE);
if (Caches[ReadCache].Cache != NULL) {
+ // TODO: Below call hangs on my 32-bit Mac Mini when compiled with GNU-EFI.
+ // The same binary is fine under VirtualBox, and the same call is fine when
+ // compiled with Tianocore. Further clue: Omitting "Status =" avoids the
+ // hang but produces a failure to mount the filesystem, even when the same
+ // change is made to later similar call. Calling Volume->DiskIo->ReadDisk()
+ // directly (without refit_call5_wrapper()) changes nothing. Placing Print()
+ // statements at the start and end of the function, and before and after the
+ // ReadDisk() call, suggests that when it fails, the program is executing
+ // code starting mid-function, so there seems to be something messed up in
+ // the way the function is being called. FIGURE THIS OUT!
Status = refit_call5_wrapper(Volume->DiskIo->ReadDisk, Volume->DiskIo, Volume->MediaId,
- StartRead, CACHE_SIZE, Caches[ReadCache].Cache);
+ StartRead, (UINTN) CACHE_SIZE, (VOID*) Caches[ReadCache].Cache);
if (!EFI_ERROR(Status)) {
Caches[ReadCache].CacheStart = StartRead;
Caches[ReadCache].CacheValid = TRUE;
if (ReadOneBlock) { // Something's failed, so try a simple disk read of one block....
Status = refit_call5_wrapper(Volume->DiskIo->ReadDisk, Volume->DiskIo, Volume->MediaId,
phys_bno * vol->phys_blocksize,
- vol->phys_blocksize,
- buffer);
+ (UINTN) vol->phys_blocksize,
+ (VOID*) buffer);
}
Volume->LastIOStatus = Status;