ReactOS 0.4.16-dev-1990-gfa5cf28
machuefi.h File Reference
#include <machine.h>
Include dependency graph for machuefi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

VOID UefiConsPutChar (int Ch)
 
BOOLEAN UefiConsKbHit (VOID)
 
int UefiConsGetCh (void)
 
EFI_STATUS UefiInitializeVideo (VOID)
 
VOID UefiVideoClearScreen (UCHAR Attr)
 
VIDEODISPLAYMODE UefiVideoSetDisplayMode (PCSTR DisplayMode, BOOLEAN Init)
 
VOID UefiVideoGetDisplaySize (PULONG Width, PULONG Height, PULONG Depth)
 
ULONG UefiVideoGetBufferSize (VOID)
 
VOID UefiVideoGetFontsFromFirmware (PULONG RomFontPointers)
 
VOID UefiVideoSetTextCursorPosition (UCHAR X, UCHAR Y)
 
VOID UefiVideoHideShowTextCursor (BOOLEAN Show)
 
VOID UefiVideoPutChar (int Ch, UCHAR Attr, unsigned X, unsigned Y)
 
VOID UefiVideoCopyOffScreenBufferToVRAM (PVOID Buffer)
 
BOOLEAN UefiVideoIsPaletteFixed (VOID)
 
VOID UefiVideoSetPaletteColor (UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 
VOID UefiVideoGetPaletteColor (UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
 
VOID UefiVideoSync (VOID)
 
VOID UefiPcBeep (VOID)
 
PFREELDR_MEMORY_DESCRIPTOR UefiMemGetMemoryMap (ULONG *MemoryMapSize)
 
VOID UefiGetExtendedBIOSData (PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
 
UCHAR UefiGetFloppyCount (VOID)
 
BOOLEAN UefiDiskReadLogicalSectors (IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
 
BOOLEAN UefiDiskGetDriveGeometry (UCHAR DriveNumber, PGEOMETRY Geometry)
 
ULONG UefiDiskGetCacheableBlockCount (UCHAR DriveNumber)
 
TIMEINFOUefiGetTime (VOID)
 
BOOLEAN UefiInitializeBootDevices (VOID)
 
PCONFIGURATION_COMPONENT_DATA UefiHwDetect (_In_opt_ PCSTR Options)
 
VOID UefiPrepareForReactOS (VOID)
 
VOID UefiHwIdle (VOID)
 
VOID UefiInitializeFileSystemSupport (_In_ EFI_HANDLE ImageHandle, _In_ EFI_SYSTEM_TABLE *SystemTable)
 
VOID UefiVideoScrollUp (VOID)
 

Function Documentation

◆ UefiConsGetCh()

int UefiConsGetCh ( void  )

Definition at line 125 of file ueficon.c.

126{
127 UCHAR KeyOutput = 0;
128
129 /* If an extended key press was detected the last time we were called
130 * then return the scan code of that key. */
131 if (ExtendedKey)
132 {
134 return ExtendedScanCode;
135 }
136
137 if (Key.UnicodeChar != 0)
138 {
139 KeyOutput = Key.UnicodeChar;
140 }
141 else
142 {
145 KeyOutput = KEY_EXTENDED;
146 }
147
148 /* UEFI will stack input requests, we have to clear it */
149 Key.UnicodeChar = 0;
150 Key.ScanCode = 0;
151 return KeyOutput;
152}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define KEY_EXTENDED
Definition: keycodes.h:38
static UCHAR ConvertToBiosExtValue(UCHAR KeyIn)
Definition: ueficon.c:65
static BOOLEAN ExtendedKey
Definition: ueficon.c:17
static char ExtendedScanCode
Definition: ueficon.c:18
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by MachInit().

◆ UefiConsKbHit()

BOOLEAN UefiConsKbHit ( VOID  )

Definition at line 119 of file ueficon.c.

120{
122}
#define EFI_NOT_READY
Definition: UefiBaseType.h:126
EFI_SIMPLE_TEXT_INPUT_PROTOCOL * ConIn
Definition: UefiSpec.h:1932
EFI_INPUT_READ_KEY ReadKeyStroke
Definition: SimpleTextIn.h:125
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16

Referenced by MachInit().

◆ UefiConsPutChar()

VOID UefiConsPutChar ( int  Ch)

Definition at line 23 of file ueficon.c.

24{
26 BOOLEAN NeedScroll;
27
29
30 NeedScroll = (CurrentCursorY >= Height);
31 if (NeedScroll)
32 {
35 }
36 if (c == '\r')
37 {
39 }
40 else if (c == '\n')
41 {
43
44 if (!NeedScroll)
46 }
47 else if (c == '\t')
48 {
49 CurrentCursorX = (CurrentCursorX + 8) & ~7;
50 }
51 else
52 {
55 }
56 if (CurrentCursorX >= Width)
57 {
60 }
61}
unsigned char BOOLEAN
const GLubyte * c
Definition: glext.h:8905
#define Unused(x)
Definition: atlwin.h:28
uint32_t ULONG
Definition: typedefs.h:59
static unsigned CurrentAttr
Definition: ueficon.c:15
static unsigned CurrentCursorX
Definition: ueficon.c:13
static unsigned CurrentCursorY
Definition: ueficon.c:14
VOID UefiVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: uefivid.c:152
VOID UefiVideoScrollUp(VOID)
Definition: uefivid.c:189
VOID UefiVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: uefivid.c:140
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88

Referenced by MachInit().

◆ UefiDiskGetCacheableBlockCount()

ULONG UefiDiskGetCacheableBlockCount ( UCHAR  DriveNumber)

Definition at line 584 of file uefidisk.c.

585{
586 ULONG UefiDriveNumber = InternalUefiDisk[DriveNumber - FIRST_BIOS_DISK].UefiRootNumber;
587 TRACE("UefiDiskGetCacheableBlockCount: DriveNumber: %d\n", UefiDriveNumber);
588
589 GlobalSystemTable->BootServices->HandleProtocol(handles[UefiDriveNumber], &bioGuid, (void**)&bio);
590 return (bio->Media->LastBlock + 1);
591}
#define TRACE(s)
Definition: solgame.cpp:4
EFI_LBA LastBlock
Definition: BlockIo.h:184
EFI_HANDLE_PROTOCOL HandleProtocol
Definition: UefiSpec.h:1832
EFI_BOOT_SERVICES * BootServices
Definition: UefiSpec.h:1959
EFI_BLOCK_IO_MEDIA * Media
Definition: BlockIo.h:230
UCHAR UefiRootNumber
Definition: uefidisk.c:33
static EFI_GUID bioGuid
Definition: uefidisk.c:60
static EFI_BLOCK_IO * bio
Definition: uefidisk.c:61
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16
#define FIRST_BIOS_DISK
Definition: uefidisk.c:17
static INTERNAL_UEFI_DISK * InternalUefiDisk
Definition: uefidisk.c:59
static EFI_HANDLE * handles
Definition: uefidisk.c:62

Referenced by MachInit().

◆ UefiDiskGetDriveGeometry()

BOOLEAN UefiDiskGetDriveGeometry ( UCHAR  DriveNumber,
PGEOMETRY  Geometry 
)

Definition at line 568 of file uefidisk.c.

569{
570 ULONG UefiDriveNumber;
571
572 UefiDriveNumber = InternalUefiDisk[DriveNumber - FIRST_BIOS_DISK].UefiRootNumber;
573 GlobalSystemTable->BootServices->HandleProtocol(handles[UefiDriveNumber], &bioGuid, (void**)&bio);
574 Geometry->Cylinders = 1; // Not relevant for the UEFI BIO protocol
575 Geometry->Heads = 1; // Not relevant for the UEFI BIO protocol
576 Geometry->SectorsPerTrack = (bio->Media->LastBlock + 1);
577 Geometry->BytesPerSector = bio->Media->BlockSize;
578 Geometry->Sectors = (bio->Media->LastBlock + 1);
579
580 return TRUE;
581}
UINT32 BlockSize
Definition: BlockIo.h:173
ULONG BytesPerSector
Number of bytes per sector.
Definition: disk.h:30
ULONG Cylinders
Number of cylinders on the disk.
Definition: disk.h:27
ULONGLONG Sectors
Total number of disk sectors/LBA blocks.
Definition: disk.h:31
ULONG SectorsPerTrack
Number of sectors per track.
Definition: disk.h:29
ULONG Heads
Number of heads on the disk.
Definition: disk.h:28

Referenced by MachInit().

◆ UefiDiskReadLogicalSectors()

BOOLEAN UefiDiskReadLogicalSectors ( IN UCHAR  DriveNumber,
IN ULONGLONG  SectorNumber,
IN ULONG  SectorCount,
OUT PVOID  Buffer 
)

Definition at line 550 of file uefidisk.c.

555{
556 ULONG UefiDriveNumber;
557
558 UefiDriveNumber = InternalUefiDisk[DriveNumber - FIRST_BIOS_DISK].UefiRootNumber;
559 TRACE("UefiDiskReadLogicalSectors: DriveNumber: %d\n", UefiDriveNumber);
560 GlobalSystemTable->BootServices->HandleProtocol(handles[UefiDriveNumber], &bioGuid, (void**)&bio);
561
562 /* Devices setup */
564 return TRUE;
565}
Definition: bufpool.h:45
ULONG SectorCount
Definition: part_xbox.c:31
EFI_BLOCK_READ ReadBlocks
Definition: BlockIo.h:233

Referenced by MachInit().

◆ UefiGetExtendedBIOSData()

VOID UefiGetExtendedBIOSData ( PULONG  ExtendedBIOSDataArea,
PULONG  ExtendedBIOSDataSize 
)

Definition at line 38 of file stubs.c.

40{
41
42}

Referenced by MachInit().

◆ UefiGetFloppyCount()

UCHAR UefiGetFloppyCount ( VOID  )

Definition at line 543 of file uefidisk.c.

544{
545 /* No floppy for you for now... */
546 return 0;
547}

Referenced by MachInit().

◆ UefiGetTime()

TIMEINFO * UefiGetTime ( VOID  )

Definition at line 20 of file uefiutil.c.

21{
22 static TIMEINFO TimeInfo;
24 EFI_TIME time = {0};
25
27 if (Status != EFI_SUCCESS)
28 ERR("UefiGetTime: cannot get time status %d\n", Status);
29
30 TimeInfo.Year = time.Year;
31 TimeInfo.Month = time.Month;
32 TimeInfo.Day = time.Day;
33 TimeInfo.Hour = time.Hour;
34 TimeInfo.Minute = time.Minute;
35 TimeInfo.Second = time.Second;
36 return &TimeInfo;
37}
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:31
#define EFI_SUCCESS
Definition: UefiBaseType.h:120
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
__u16 time
Definition: mkdosfs.c:8
EFI_GET_TIME GetTime
Definition: UefiSpec.h:1752
EFI_RUNTIME_SERVICES * RuntimeServices
Definition: UefiSpec.h:1955
Definition: fw.h:10
USHORT Month
Definition: fw.h:12
USHORT Day
Definition: fw.h:13
USHORT Minute
Definition: fw.h:15
USHORT Hour
Definition: fw.h:14
USHORT Second
Definition: fw.h:16
USHORT Year
Definition: fw.h:11
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16

Referenced by MachInit().

◆ UefiHwDetect()

PCONFIGURATION_COMPONENT_DATA UefiHwDetect ( _In_opt_ PCSTR  Options)

Definition at line 131 of file uefihw.c.

133{
135 ULONG BusNumber = 0;
136
137 TRACE("DetectHardware()\n");
138
139 /* Create the 'System' key */
140#if defined(_M_IX86) || defined(_M_AMD64)
141 FldrCreateSystemKey(&SystemKey, "AT/AT COMPATIBLE");
142#elif defined(_M_IA64)
143 FldrCreateSystemKey(&SystemKey, "Intel Itanium processor family");
144#elif defined(_M_ARM) || defined(_M_ARM64)
145 FldrCreateSystemKey(&SystemKey, "ARM processor family");
146#else
147 #error Please define a system key for your architecture
148#endif
149
150 /* Detect ACPI */
151 DetectAcpiBios(SystemKey, &BusNumber);
152
153 TRACE("DetectHardware() Done\n");
154 return SystemKey;
155}
VOID FldrCreateSystemKey(_Out_ PCONFIGURATION_COMPONENT_DATA *SystemNode, _In_ PCSTR IdentifierString)
Definition: archwsup.c:135
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: uefihw.c:54
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by MachInit().

◆ UefiHwIdle()

VOID UefiHwIdle ( VOID  )

Definition at line 51 of file stubs.c.

52{
53
54}

Referenced by MachInit().

◆ UefiInitializeBootDevices()

BOOLEAN UefiInitializeBootDevices ( VOID  )

Definition at line 494 of file uefidisk.c.

495{
500
501 /* Add it, if it's a cdrom */
503 if (bio->Media->RemovableMedia == TRUE && bio->Media->BlockSize == 2048)
504 {
507 ULONG Checksum = 0;
509 ULONG i;
510
511 /* Read the MBR */
513 {
514 ERR("Reading MBR failed\n");
515 return FALSE;
516 }
517
520
521 Signature = Mbr->Signature;
522 TRACE("Signature: %x\n", Signature);
523
524 /* Calculate the MBR checksum */
525 for (i = 0; i < 2048 / sizeof(ULONG); i++)
526 {
527 Checksum += Buffer[i];
528 }
529 Checksum = ~Checksum + 1;
530 TRACE("Checksum: %x\n", Checksum);
531
532 /* Fill out the ARC disk block */
534
536 PcBiosDiskCount++; // This is not accounted for in the number of pre-enumerated BIOS drives!
537 TRACE("Additional boot drive detected: 0x%02X\n", (int)FrldrBootDrive);
538 }
539 return TRUE;
540}
#define EFI_PAGE_SIZE
Definition: UefiBaseType.h:189
VOID AddReactOSArcDiskInfo(IN PSTR ArcName, IN ULONG Signature, IN ULONG Checksum, IN BOOLEAN ValidPartitionTable)
Definition: archwsup.c:77
struct _MASTER_BOOT_RECORD * PMASTER_BOOT_RECORD
VOID FsRegisterDevice(_In_ PCSTR DeviceName, _In_ const DEVVTBL *FuncTable)
Definition: fs.c:673
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
Definition: machine.h:120
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:31
static const WCHAR Signature[]
Definition: parser.c:141
CCHAR FrLdrBootPath[MAX_PATH]
Definition: freeldr.c:29
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
Definition: glfuncs.h:248
@ LoaderFirmwareTemporary
Definition: arc.h:298
BOOLEAN RemovableMedia
Definition: BlockIo.h:143
ULONG Signature
Definition: disk.h:60
uint32_t * PULONG
Definition: typedefs.h:59
PVOID Buffer
Definition: uefidisk.c:50
PVOID DiskReadBuffer
Definition: uefidisk.c:44
static ULONG UefiBootRootIdentifier
Definition: uefidisk.c:56
static const DEVVTBL UefiDiskVtbl
Definition: uefidisk.c:289
static VOID UefiSetupBlockDevices(VOID)
Definition: uefidisk.c:389
UCHAR PcBiosDiskCount
Definition: uefidisk.c:45
SIZE_T DiskReadBufferSize
Definition: uefidisk.c:49
UCHAR FrldrBootDrive
Definition: uefidisk.c:47
static BOOLEAN UefiSetBootpath(VOID)
Definition: uefidisk.c:461

Referenced by MachInit().

◆ UefiInitializeFileSystemSupport()

VOID UefiInitializeFileSystemSupport ( _In_ EFI_HANDLE  ImageHandle,
_In_ EFI_SYSTEM_TABLE SystemTable 
)

◆ UefiInitializeVideo()

EFI_STATUS UefiInitializeVideo ( VOID  )

Definition at line 29 of file uefivid.c.

30{
33
36 if (Status != EFI_SUCCESS)
37 {
38 TRACE("Failed to find GOP with status %d\n", Status);
39 return Status;
40 }
41
42 /* We don't need high resolutions for freeldr */
43 gop->SetMode(gop, LOWEST_SUPPORTED_RES);
44
45 framebufferData.BaseAddress = (ULONG_PTR)gop->Mode->FrameBufferBase;
46 framebufferData.BufferSize = gop->Mode->FrameBufferSize;
47 framebufferData.ScreenWidth = gop->Mode->Info->HorizontalResolution;
48 framebufferData.ScreenHeight = gop->Mode->Info->VerticalResolution;
49 framebufferData.PixelsPerScanLine = gop->Mode->Info->PixelsPerScanLine;
50 framebufferData.PixelFormat = gop->Mode->Info->PixelFormat;
51
52 return Status;
53}
#define ULONG_PTR
Definition: config.h:101
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:1873
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
EFI_GUID EfiGraphicsOutputProtocol
Definition: uefivid.c:24
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16
#define LOWEST_SUPPORTED_RES
Definition: uefivid.c:15
REACTOS_INTERNAL_BGCONTEXT framebufferData
Definition: uefivid.c:23

Referenced by MachInit().

◆ UefiMemGetMemoryMap()

PFREELDR_MEMORY_DESCRIPTOR UefiMemGetMemoryMap ( ULONG MemoryMapSize)

Definition at line 145 of file uefimem.c.

146{
147 EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
148 UINT32 DescriptorVersion;
149 SIZE_T FreeldrMemMapSize;
152 UINTN MapSize;
153 UINTN MapKey;
155
157 PFREELDR_MEMORY_DESCRIPTOR FreeldrMem = NULL;
158 EFI_MEMORY_DESCRIPTOR* MapEntry = NULL;
159 UINT32 EntryCount = 0;
161
164 (VOID**)&LoadedImage);
165 if (Status != EFI_SUCCESS)
166 {
167 TRACE("Failed to find LoadedImageHandle with status: %d\n", Status);
168 UiMessageBoxCritical("Unable to initialize memory manager.");
169 return NULL;
170 }
171 OsLoaderBase = LoadedImage->ImageBase;
172 OsLoaderSize = LoadedImage->ImageSize;
173 PublicBootHandle = LoadedImage->DeviceHandle;
175
176 TRACE("UefiMemGetMemoryMap: Gather memory map\n");
177 PUEFI_LoadMemoryMap(&MapKey,
178 &MapSize,
180 &DescriptorVersion);
181
182 TRACE("Value of MapKey: %d\n", MapKey);
183 TRACE("Value of MapSize: %d\n", MapSize);
184 TRACE("Value of DescriptorSize: %d\n", DescriptorSize);
185 TRACE("Value of DescriptorVersion: %d\n", DescriptorVersion);
186
187 EntryCount = (MapSize / DescriptorSize);
188
189 FreeldrMemMapSize = (sizeof(FREELDR_MEMORY_DESCRIPTOR) * EntryCount);
191 FreeldrMemMapSize,
192 (void**)&FreeldrMem);
193 if (Status != EFI_SUCCESS)
194 {
195 TRACE("Failed to allocate pool with status %d\n", Status);
196 UiMessageBoxCritical("Unable to initialize memory manager.");
197 return NULL;
198 }
199
200 RtlZeroMemory(FreeldrMem, FreeldrMemMapSize);
201 MapEntry = EfiMemoryMap;
202 for (Index = 0; Index < EntryCount; ++Index)
203 {
204 TYPE_OF_MEMORY MemoryType = UefiConvertToFreeldrDesc(MapEntry->Type);
205 if (MemoryType == LoaderFree)
206 {
209 MapEntry->NumberOfPages,
210 &MapEntry->PhysicalStart);
211 if (Status != EFI_SUCCESS)
212 {
213 /* We failed to reserve the page, so change its type */
214 MemoryType = LoaderFirmwareTemporary;
215 }
216 }
217
218 /* Sometimes our loader can be loaded into higher memory than we ever allocate */
219 if (MemoryType == LoaderLoadedProgram)
220 {
221 if (((MapEntry->PhysicalStart + (MapEntry->NumberOfPages * PAGE_SIZE)) >> EFI_PAGE_SHIFT) > LoaderPagesSpanned)
222 {
223 /* This value needs to be adjusted if this occurs */
224 LoaderPagesSpanned = ((MapEntry->PhysicalStart + (MapEntry->NumberOfPages * PAGE_SIZE)) >> EFI_PAGE_SHIFT);
225 }
226 }
227
228 /* We really don't want to touch these reserved spots at all */
229 if (MemoryType != LoaderReserve)
230 {
231 UefiSetMemory(FreeldrMem,
232 MapEntry->PhysicalStart,
233 MapEntry->NumberOfPages,
234 MemoryType);
235 }
236
237 MapEntry = NEXT_MEMORY_DESCRIPTOR(MapEntry, DescriptorSize);
238 }
239
240 /* Windows expects the first page to be reserved, otherwise it asserts.
241 * However it can be just a free page on some UEFI systems. */
242 UefiSetMemory(FreeldrMem, 0x000000, 1, LoaderFirmwarePermanent);
243 *MemoryMapSize = FreeldrDescCount;
244 return FreeldrMem;
245}
#define EFI_LOADED_IMAGE_PROTOCOL_GUID
Definition: LoadedImage.h:21
UINT32 UINTN
unsigned int UINT32
#define EFI_PAGE_SHIFT
Definition: UefiBaseType.h:191
@ EfiLoaderData
@ AllocateAddress
Definition: UefiSpec.h:45
EFI_GUID EfiLoadedImageProtocol
Definition: firmware.c:30
struct _FREELDR_MEMORY_DESCRIPTOR FREELDR_MEMORY_DESCRIPTOR
VOID UiMessageBoxCritical(_In_ PCSTR MessageText)
Definition: ui.c:372
#define PAGE_SIZE
Definition: env_spec_w32.h:49
@ LoaderReserve
Definition: arc.h:317
@ LoaderFree
Definition: arc.h:295
@ LoaderLoadedProgram
Definition: arc.h:297
@ LoaderFirmwarePermanent
Definition: arc.h:299
enum _TYPE_OF_MEMORY TYPE_OF_MEMORY
EFI_ALLOCATE_PAGES AllocatePages
Definition: UefiSpec.h:1810
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1813
EFI_PHYSICAL_ADDRESS PhysicalStart
Definition: UefiSpec.h:99
_In_ SIZE_T DescriptorSize
Definition: nls.c:40
ULONG_PTR SIZE_T
Definition: typedefs.h:80
UINT32 FreeldrDescCount
Definition: uefimem.c:35
EFI_MEMORY_DESCRIPTOR * EfiMemoryMap
Definition: uefimem.c:34
static VOID PUEFI_LoadMemoryMap(_Out_ UINTN *LocMapKey, _Out_ UINTN *LocMapSize, _Out_ UINTN *LocDescriptorSize, _Out_ UINT32 *LocDescriptorVersion)
Definition: uefimem.c:48
EFI_HANDLE PublicBootHandle
Definition: uefimem.c:38
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16
static TYPE_OF_MEMORY UefiConvertToFreeldrDesc(EFI_MEMORY_TYPE EfiMemoryType)
Definition: uefimem.c:108
PVOID OsLoaderBase
Definition: uefimem.c:36
static VOID UefiSetMemory(_Inout_ PFREELDR_MEMORY_DESCRIPTOR MemoryMap, _In_ ULONG_PTR BaseAddress, _In_ PFN_COUNT SizeInPages, _In_ TYPE_OF_MEMORY MemoryType)
Definition: uefimem.c:87
EFI_HANDLE GlobalImageHandle
Definition: uefildr.c:15
SIZE_T OsLoaderSize
Definition: uefimem.c:37
ULONG LoaderPagesSpanned
Definition: mm.c:29
#define NEXT_MEMORY_DESCRIPTOR(Descriptor, DescriptorSize)
Definition: uefimem.c:15
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by MachInit().

◆ UefiPcBeep()

VOID UefiPcBeep ( VOID  )

Definition at line 45 of file stubs.c.

46{
47 /* Not possible on UEFI, for now */
48}

Referenced by MachInit().

◆ UefiPrepareForReactOS()

VOID UefiPrepareForReactOS ( VOID  )

Definition at line 283 of file uefimem.c.

284{
285 _exituefi();
286}
void _exituefi(VOID)

Referenced by MachInit().

◆ UefiVideoClearScreen()

VOID UefiVideoClearScreen ( UCHAR  Attr)

Definition at line 105 of file uefivid.c.

106{
107 ULONG FgColor, BgColor;
108
109 UefiVideoAttrToColors(Attr, &FgColor, &BgColor);
111}
static VOID UefiVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: uefivid.c:87
static VOID UefiVideoAttrToColors(UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
Definition: uefivid.c:79

Referenced by MachInit().

◆ UefiVideoCopyOffScreenBufferToVRAM()

VOID UefiVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 173 of file uefivid.c.

174{
175 PUCHAR OffScreenBuffer = (PUCHAR)Buffer;
176
177 ULONG Col, Line;
179 {
180 for (Col = 0; Col < framebufferData.ScreenWidth / CHAR_WIDTH; Col++)
181 {
182 UefiVideoPutChar(OffScreenBuffer[0], OffScreenBuffer[1], Col, Line);
183 OffScreenBuffer += 2;
184 }
185 }
186}
Definition: ncftp.h:79
unsigned char * PUCHAR
Definition: typedefs.h:53
#define TOP_BOTTOM_LINES
Definition: uefivid.c:14
#define CHAR_WIDTH
Definition: vgafont.h:10
#define CHAR_HEIGHT
Definition: vgafont.h:11

Referenced by MachInit().

◆ UefiVideoGetBufferSize()

ULONG UefiVideoGetBufferSize ( VOID  )

Definition at line 167 of file uefivid.c.

Referenced by MachInit().

◆ UefiVideoGetDisplaySize()

VOID UefiVideoGetDisplaySize ( PULONG  Width,
PULONG  Height,
PULONG  Depth 
)

Definition at line 152 of file uefivid.c.

153{
156 *Depth = 0;
157}
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819

Referenced by MachInit(), and UefiConsPutChar().

◆ UefiVideoGetFontsFromFirmware()

VOID UefiVideoGetFontsFromFirmware ( PULONG  RomFontPointers)

Definition at line 26 of file stubs.c.

27{
28
29}

Referenced by MachInit().

◆ UefiVideoGetPaletteColor()

VOID UefiVideoGetPaletteColor ( UCHAR  Color,
UCHAR Red,
UCHAR Green,
UCHAR Blue 
)

Definition at line 234 of file uefivid.c.

236{
237 /* Not supported */
238}

Referenced by MachInit().

◆ UefiVideoHideShowTextCursor()

VOID UefiVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 215 of file uefivid.c.

216{
217 /* We don't have a cursor yet */
218}

Referenced by MachInit().

◆ UefiVideoIsPaletteFixed()

BOOLEAN UefiVideoIsPaletteFixed ( VOID  )

Definition at line 221 of file uefivid.c.

222{
223 return 0;
224}

Referenced by MachInit().

◆ UefiVideoPutChar()

VOID UefiVideoPutChar ( int  Ch,
UCHAR  Attr,
unsigned  X,
unsigned  Y 
)

Definition at line 140 of file uefivid.c.

141{
142 ULONG FgColor = 0;
143 ULONG BgColor = 0;
144 if (Ch != 0)
145 {
146 UefiVideoAttrToColors(Attr, &FgColor, &BgColor);
147 UefiVideoOutputChar(Ch, X, Y, FgColor, BgColor);
148 }
149}
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
VOID UefiVideoOutputChar(UCHAR Char, unsigned X, unsigned Y, ULONG FgColor, ULONG BgColor)
Definition: uefivid.c:114

Referenced by MachInit(), UefiConsPutChar(), and UefiVideoCopyOffScreenBufferToVRAM().

◆ UefiVideoScrollUp()

VOID UefiVideoScrollUp ( VOID  )

Definition at line 189 of file uefivid.c.

190{
191 ULONG BgColor, Dummy;
192 ULONG Delta;
193 Delta = (framebufferData.PixelsPerScanLine * 4 + 3) & ~ 0x3;
198
200
201 while (PixelCount--)
202 *Dst++ = *Src++;
203
204 for (PixelCount = 0; PixelCount < framebufferData.ScreenWidth * CHAR_HEIGHT; PixelCount++)
205 *Dst++ = BgColor;
206}
#define ATTR(cFore, cBack)
Definition: ui.h:323
#define COLOR_WHITE
Definition: ui.h:344
#define COLOR_BLACK
Definition: ui.h:328
#define Dst
Definition: mesh.h:153
static ULONG Delta
Definition: xboxvideo.c:34

Referenced by UefiConsPutChar().

◆ UefiVideoSetDisplayMode()

VIDEODISPLAYMODE UefiVideoSetDisplayMode ( PCSTR  DisplayMode,
BOOLEAN  Init 
)

Definition at line 160 of file uefivid.c.

161{
162 /* We only have one mode, semi-text */
163 return VideoTextMode;
164}
@ VideoTextMode
Definition: machine.h:35

Referenced by MachInit().

◆ UefiVideoSetPaletteColor()

VOID UefiVideoSetPaletteColor ( UCHAR  Color,
UCHAR  Red,
UCHAR  Green,
UCHAR  Blue 
)

Definition at line 227 of file uefivid.c.

229{
230 /* Not supported */
231}

Referenced by MachInit().

◆ UefiVideoSetTextCursorPosition()

VOID UefiVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 209 of file uefivid.c.

210{
211 /* We don't have a cursor yet */
212}

Referenced by MachInit().

◆ UefiVideoSync()

VOID UefiVideoSync ( VOID  )

Definition at line 32 of file stubs.c.

33{
34
35}

Referenced by MachInit().