mirror of
https://github.com/reactos/reactos.git
synced 2025-05-29 14:08:22 +00:00
[BOOTMGFW]
- Fix more device I/O bugs. - Silence some dbgprints. - Implement DiskOpen and DiskClose. - Refactor block cache in its own file. - We successfully open our boot device (which appears as a floppy, as expected with the new UEFI boot)! svn path=/trunk/; revision=69153
This commit is contained in:
parent
c1c6314688
commit
ef4c84c805
6 changed files with 755 additions and 662 deletions
|
@ -19,6 +19,7 @@ list(APPEND BOOTLIB_SOURCE
|
||||||
lib/mm/blkalloc.c
|
lib/mm/blkalloc.c
|
||||||
lib/mm/descriptor.c
|
lib/mm/descriptor.c
|
||||||
lib/platform/time.c
|
lib/platform/time.c
|
||||||
|
lib/io/blkcache.c
|
||||||
lib/io/io.c
|
lib/io/io.c
|
||||||
lib/io/device.c
|
lib/io/device.c
|
||||||
lib/io/file.c
|
lib/io/file.c
|
||||||
|
|
|
@ -50,6 +50,8 @@ BmFwInitializeBootDirectoryPath (
|
||||||
Status = BlpDeviceOpen(BlpBootDevice, 1u, 0, &DeviceHandle);
|
Status = BlpDeviceOpen(BlpBootDevice, 1u, 0, &DeviceHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
EfiPrintf(L"Device open failed: %lx\r\n", Status);
|
||||||
|
EfiStall(2000000);
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,9 +178,6 @@ BmMain (
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
EfiPrintf(L"We are A-OK!\n");
|
|
||||||
EfiStall(10000000);
|
|
||||||
|
|
||||||
/* Get the application identifier */
|
/* Get the application identifier */
|
||||||
AppIdentifier = BlGetApplicationIdentifier();
|
AppIdentifier = BlGetApplicationIdentifier();
|
||||||
if (!AppIdentifier)
|
if (!AppIdentifier)
|
||||||
|
@ -195,7 +194,7 @@ BmMain (
|
||||||
|
|
||||||
//Status = BmOpenDataStore(&BcdHandle);
|
//Status = BmOpenDataStore(&BcdHandle);
|
||||||
|
|
||||||
EfiPrintf(L"We are A-OK!\n");
|
EfiPrintf(L"We are A-OK!\r\n");
|
||||||
EfiStall(10000000);
|
EfiStall(10000000);
|
||||||
|
|
||||||
Quickie:
|
Quickie:
|
||||||
|
|
|
@ -81,6 +81,8 @@
|
||||||
|
|
||||||
#define BL_FS_REGISTER_AT_HEAD_FLAG 1
|
#define BL_FS_REGISTER_AT_HEAD_FLAG 1
|
||||||
|
|
||||||
|
#define BL_BLOCK_DEVICE_REMOVABLE_FLAG 0x01
|
||||||
|
|
||||||
#define BL_MEMORY_CLASS_SHIFT 28
|
#define BL_MEMORY_CLASS_SHIFT 28
|
||||||
|
|
||||||
/* ENUMERATIONS **************************************************************/
|
/* ENUMERATIONS **************************************************************/
|
||||||
|
@ -899,6 +901,11 @@ BlDestroyLibrary (
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
BcInitialize (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
/* FIRMWARE ROUTINES *********************************************************/
|
/* FIRMWARE ROUTINES *********************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
111
reactos/boot/environ/lib/io/blkcache.c
Normal file
111
reactos/boot/environ/lib/io/blkcache.c
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||||
|
* PROJECT: ReactOS UEFI Boot Library
|
||||||
|
* FILE: boot/environ/lib/io/blkcache.c
|
||||||
|
* PURPOSE: Boot Library Block Cache Management Routines
|
||||||
|
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
|
#include "bl.h"
|
||||||
|
|
||||||
|
/* DATA VARIABLES ************************************************************/
|
||||||
|
|
||||||
|
ULONG BcpBlockAllocatorHandle;
|
||||||
|
ULONG BcpHashTableId;
|
||||||
|
|
||||||
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
BcpDestroy (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//BcpPurgeCacheEntries();
|
||||||
|
//return BlpMmDeleteBlockAllocator(BcpBlockAllocatorHandle);
|
||||||
|
EfiPrintf(L"Destructor for block cache not yet implemented\r\n");
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
BcpCompareKey (
|
||||||
|
_In_ PBL_HASH_ENTRY Entry1,
|
||||||
|
_In_ PBL_HASH_ENTRY Entry2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
PULONG Value1, Value2;
|
||||||
|
|
||||||
|
Value1 = Entry1->Value;
|
||||||
|
Value2 = Entry2->Value;
|
||||||
|
return Entry1->Size == Entry2->Size && Entry1->Flags == Entry2->Flags && *Value1 == *Value2 && Value1[1] == Value2[1] && Value1[2] == Value2[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
BcpHashFunction (
|
||||||
|
_In_ PBL_HASH_ENTRY Entry,
|
||||||
|
_In_ ULONG TableSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ULONG i, j, ValueHash;
|
||||||
|
PUCHAR ValueBuffer;
|
||||||
|
|
||||||
|
j = 0;
|
||||||
|
ValueHash = 0;
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
ValueBuffer = Entry->Value;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ValueHash += ValueBuffer[i++];
|
||||||
|
} while (i < 8);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ValueHash += ValueBuffer[j++ + 8];
|
||||||
|
} while (j < 4);
|
||||||
|
|
||||||
|
return ValueHash % TableSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
BcInitialize (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = BlHtCreate(50, BcpHashFunction, BcpCompareKey, &BcpHashTableId);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
goto Quickie;
|
||||||
|
}
|
||||||
|
|
||||||
|
BcpBlockAllocatorHandle = BlpMmCreateBlockAllocator();
|
||||||
|
if (BcpBlockAllocatorHandle == -1)
|
||||||
|
{
|
||||||
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
|
goto Quickie;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = BlpIoRegisterDestroyRoutine(BcpDestroy);
|
||||||
|
if (Status >= 0)
|
||||||
|
{
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Quickie:
|
||||||
|
EfiPrintf(L"Failure path not yet implemented\n");
|
||||||
|
#if 0
|
||||||
|
if (BcpHashTableId != -1)
|
||||||
|
{
|
||||||
|
BlHtDestroy(BcpHashTableId);
|
||||||
|
}
|
||||||
|
if (BcpBlockAllocatorHandle != -1)
|
||||||
|
{
|
||||||
|
BlpMmDeleteBlockAllocator(BcpBlockAllocatorHandle);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Status;
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -653,7 +653,7 @@ BlMmAllocateHeap (
|
||||||
BusyEntry->BufferNext.P = MmHapDecodeLink(BusyEntry->BufferNext);
|
BusyEntry->BufferNext.P = MmHapDecodeLink(BusyEntry->BufferNext);
|
||||||
|
|
||||||
/* Return the entry's data buffer */
|
/* Return the entry's data buffer */
|
||||||
EfiPrintf(L"Returning buffer at 0x%p\r\n", &BusyEntry->Buffer);
|
//EfiPrintf(L"Returning buffer at 0x%p\r\n", &BusyEntry->Buffer);
|
||||||
return &BusyEntry->Buffer;
|
return &BusyEntry->Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,7 +673,7 @@ BlMmFreeHeap (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the heap header */
|
/* Get the heap header */
|
||||||
EfiPrintf(L"Freeing entry at: %p\r\n", Buffer);
|
//EfiPrintf(L"Freeing entry at: %p\r\n", Buffer);
|
||||||
if (Buffer)
|
if (Buffer)
|
||||||
{
|
{
|
||||||
/* Don't free heap until we discover the corruption */
|
/* Don't free heap until we discover the corruption */
|
||||||
|
|
Loading…
Reference in a new issue