15#define TAG_HW_RESOURCE_LIST 'lRwH'
16#define TAG_HW_DISK_CONTEXT 'cDwH'
17#define FIRST_BIOS_DISK 0x80
18#define FIRST_PARTITION 1
52static const CHAR Hex[] =
"0123456789abcdef";
69 TRACE(
"GetHarddiskIdentifier: DriveNumber: %d\n", DriveNumber);
97 if (PartitionNum == 0)
99 TRACE(
"Boot PartitionNumber is 0\n");
104 *BootPartition = PartitionNum;
105 TRACE(
"UefiGetBootPartitionEntry: Boot Partition is: %d\n", PartitionNum);
149 ULONG UefiDriveNumber = 0;
152 TRACE(
"UefiDiskOpen: File ID: %d, Path: %s\n", FileId,
Path);
156 ERR(
"DiskOpen(): DiskReadBufferSize is 0, something is wrong.\n");
164 TRACE(
"Opening disk: DriveNumber: %d, DrivePartition: %d\n", DriveNumber, DrivePartition);
169 if (DrivePartition != 0xff && DrivePartition != 0)
185 ERR(
"SectorSize (%lu) != Geometry.BytesPerSector (%lu), expect problems!\n",
197 Context->DriveNumber = DriveNumber;
212 ULONG Length, TotalSectors, MaxSectors, ReadSectors;
230 ReadSectors =
min(TotalSectors, MaxSectors);
247 TotalSectors -= ReadSectors;
318 ERR(
"Reading MBR failed\n");
332 for (
i = 0;
i < 512 /
sizeof(
ULONG);
i++)
336 Checksum = ~Checksum + 1;
337 TRACE(
"Checksum: %x\n", Checksum);
382 Identifier[18] = (ValidPartitionTable ?
'A' :
'X');
391 ULONG BlockDeviceIndex;
392 ULONG SystemHandleCount;
396 UINTN handle_size = 0;
404 SystemHandleCount = handle_size /
sizeof(
EFI_HANDLE);
407 BlockDeviceIndex = 0;
409 for (
i = 0;
i < SystemHandleCount; ++
i)
422 TRACE(
"UefiSetupBlockDevices: UEFI has found a block device that failed, skipping\n");
427 TRACE(
"Found root of a HDD\n");
441 TRACE(
"Found root at index %u\n",
i);
451 TRACE(
"Found Boot drive\n");
463 TRACE(
"UefiSetBootpath: Setting up boot path\n");
481 ERR(
"Failed to get boot partition entry\n");
486 "multi(0)disk(0)rdisk(%u)partition(%lu)",
514 ERR(
"Reading MBR failed\n");
525 for (
i = 0;
i < 2048 /
sizeof(
ULONG);
i++)
529 Checksum = ~Checksum + 1;
530 TRACE(
"Checksum: %x\n", Checksum);
556 ULONG UefiDriveNumber;
559 TRACE(
"UefiDiskReadLogicalSectors: DriveNumber: %d\n", UefiDriveNumber);
570 ULONG UefiDriveNumber;
587 TRACE(
"UefiDiskGetCacheableBlockCount: DriveNumber: %d\n", UefiDriveNumber);
#define BLOCK_IO_PROTOCOL
PRTL_UNICODE_STRING_BUFFER Path
VOID AddReactOSArcDiskInfo(IN PSTR ArcName, IN ULONG Signature, IN ULONG Checksum, IN BOOLEAN ValidPartitionTable)
BOOLEAN DissectArcPath(IN PCSTR ArcPath, OUT PCSTR *Path OPTIONAL, OUT PUCHAR DriveNumber, OUT PULONG PartitionNumber)
BOOLEAN DiskGetPartitionEntry(IN UCHAR DriveNumber, IN ULONG PartitionNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry)
VOID DiskDetectPartitionType(IN UCHAR DriveNumber)
#define DBG_DEFAULT_CHANNEL(ch)
#define PARTITION_ENTRY_UNUSED
struct _MASTER_BOOT_RECORD * PMASTER_BOOT_RECORD
PVOID FsGetDeviceSpecific(ULONG FileId)
VOID FsSetDeviceSpecific(ULONG FileId, PVOID Specific)
VOID FsRegisterDevice(_In_ PCSTR DeviceName, _In_ const DEVVTBL *FuncTable)
#define MachDiskGetDriveGeometry(Drive, Geom)
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
static const WCHAR Signature[]
CCHAR FrLdrBootPath[MAX_PATH]
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
@ LoaderFirmwareTemporary
EFI_LOCATE_HANDLE LocateHandle
EFI_HANDLE_PROTOCOL HandleProtocol
EFI_BOOT_SERVICES * BootServices
ULONG PartitionSectorCount
ULONG SectorCountBeforePartition
EFI_BLOCK_IO_MEDIA * Media
EFI_BLOCK_READ ReadBlocks
ULONG BytesPerSector
Number of bytes per sector.
ULONG Cylinders
Number of cylinders on the disk.
ULONGLONG Sectors
Total number of disk sectors/LBA blocks.
ULONG SectorsPerTrack
Number of sectors per track.
ULONG Heads
Number of heads on the disk.
BOOLEAN IsThisTheBootDrive
USHORT MasterBootRecordMagic
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
static ULONG PublicBootArcDisk
static EFI_BLOCK_IO * bio
BOOLEAN UefiDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
#define TAG_HW_DISK_CONTEXT
static BOOLEAN UefiGetBootPartitionEntry(IN UCHAR DriveNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry, OUT PULONG BootPartition)
BOOLEAN UefiDiskReadLogicalSectors(IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
struct tagDISKCONTEXT DISKCONTEXT
static CHAR PcDiskIdentifier[32][20]
BOOLEAN UefiInitializeBootDevices(VOID)
static ARC_STATUS UefiDiskGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
static ULONG UefiBootRootIdentifier
EFI_HANDLE PublicBootHandle
EFI_SYSTEM_TABLE * GlobalSystemTable
LONG DiskReportError(BOOLEAN bShowError)
static const DEVVTBL UefiDiskVtbl
static VOID UefiSetupBlockDevices(VOID)
static ARC_STATUS UefiDiskOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
static ARC_STATUS UefiDiskSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
static INTERNAL_UEFI_DISK * InternalUefiDisk
static ARC_STATUS UefiDiskClose(ULONG FileId)
static VOID GetHarddiskInformation(UCHAR DriveNumber)
PCHAR GetHarddiskIdentifier(UCHAR DriveNumber)
static ARC_STATUS UefiDiskRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
EFI_HANDLE GlobalImageHandle
struct _INTERNAL_UEFI_DISK INTERNAL_UEFI_DISK
static ULONG OffsetToBoot
static EFI_HANDLE * handles
UCHAR UefiGetFloppyCount(VOID)
SIZE_T DiskReadBufferSize
ULONG UefiDiskGetCacheableBlockCount(UCHAR DriveNumber)
static BOOLEAN UefiSetBootpath(VOID)
struct _INTERNAL_UEFI_DISK * PINTERNAL_UEFI_DISK
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information