20 if ((
Value - 1) &
Value)
for (SquaredResult = 1; (SquaredResult <
Value) && (SquaredResult); SquaredResult *= 2);
29 if ((
Value - 1) &
Value)
for (SquaredResult = 1; (SquaredResult <
Value) && (SquaredResult); SquaredResult *= 2);
39 USHORT TrampolineMemorySegment, TrampolineMemoryOffset;
48 if (VgaExtension->Int10Interface.Size)
return 0;
52 if (!VbeModeInfo)
return 0;
53 Context = VgaExtension->Int10Interface.Context;
54 Status = VgaExtension->Int10Interface.Int10AllocateBuffer(
Context,
55 &TrampolineMemorySegment,
56 &TrampolineMemoryOffset,
63 BiosArguments.
Edi = TrampolineMemorySegment;
64 BiosArguments.
SegEs = TrampolineMemoryOffset;
66 Status = VgaExtension->Int10Interface.Int10CallBios(
Context, &BiosArguments);
70 Status = VgaExtension->Int10Interface.Int10ReadMemory(
Context,
71 TrampolineMemorySegment,
72 TrampolineMemoryOffset,
79 VgaExtension->Int10Interface.Int10FreeBuffer(
Context,
80 TrampolineMemorySegment,
81 TrampolineMemoryOffset);
135 BiosArguments.
Ebx = 0;
150 *PhysPtrChange =
TRUE;
169 USHORT TrampolineMemorySegment;
170 USHORT TrampolineMemoryOffset;
188 VgaExtension->Int10Interface.Size = 0;
189 VgaExtension->Int10Interface.Version = 0;
200 VgaExtension->Int10Interface.Size = 0;
201 VgaExtension->Int10Interface.Version = 0;
206 VgaExtension->Int10Interface.InterfaceReference(VgaExtension->Int10Interface.Context);
207 Context = VgaExtension->Int10Interface.Context;
210 Status = VgaExtension->Int10Interface.Int10AllocateBuffer(
Context,
211 &TrampolineMemorySegment,
212 &TrampolineMemoryOffset,
216 if (!VbeInfo)
return;
218 VbeModeInfo = &VbeInfo->Modes;
222 VbeInfo->ModeArray[128] = 0xFFFF;
224 Status = VgaExtension->Int10Interface.Int10WriteMemory(
Context,
225 TrampolineMemorySegment,
226 TrampolineMemoryOffset,
233 BiosArguments.
Edi = TrampolineMemoryOffset;
234 BiosArguments.
SegEs = TrampolineMemorySegment;
236 Status = VgaExtension->Int10Interface.Int10CallBios(
Context, &BiosArguments);
243 Status = VgaExtension->Int10Interface.Int10ReadMemory(
Context,
244 TrampolineMemorySegment,
245 TrampolineMemoryOffset,
253 VbeVersion = VbeInfo->Info.
Version;
254 VideoDebugPrint((0,
"vbe version %lx memory %lx\n", VbeVersion, TotalMemory));
259 Status = VgaExtension->Int10Interface.Int10ReadMemory(
Context,
268 ThisMode = VbeInfo->ModeArray;
269 ModeResult = VbeInfo->ModeArray[0];
270 while (ModeResult != 0xFFFF)
272 Mode = ModeResult & 0x1FF;
274 if ((
Mode == 0x102) || (
Mode == 0x6A)) FourBppModeFound =
TRUE;
275 ModeResult = *++ThisMode;
298 ThisMode = VbeInfo->ModeArray;
306 BiosArguments.
Ecx = *ThisMode;
307 BiosArguments.
Edi = TrampolineMemoryOffset;
308 BiosArguments.
SegEs = TrampolineMemorySegment;
309 Status = VgaExtension->Int10Interface.Int10CallBios(
Context, &BiosArguments);
312 Status = VgaExtension->Int10Interface.Int10ReadMemory(
Context,
313 TrampolineMemorySegment,
314 TrampolineMemoryOffset,
323 LinearAddressing = ((VbeVersion >= 0x200) &&
362 if (!LinearAddressing)
371 ScreenSize =
VgaMode->hres * ScreenStride;
373 Size = (ScreenSize + ((64 * 1024) - 1)) & ((64 * 1024) - 1);
375 if (
Size > TotalMemory)
Size = (
Size + ((4 * 1024) - 1)) & ((4 * 1024) - 1);
383 VgaMode->FrameBufferSize = 64 * 1024;
403 if (
Size > TotalMemory)
Size = (
Size + ((4 * 1024) - 1)) & ((4 * 1024) - 1);
423 if (ScreenSize <= TotalMemory)
435 VideoDebugPrint((0,
"mode scan complete. Total modes: %d\n", ModeCount));
454 VgaExtension->Int10Interface.Int10FreeBuffer(
Context,
455 TrampolineMemorySegment,
456 TrampolineMemoryOffset);
464 VgaExtension->Int10Interface.Int10FreeBuffer(
Context,
465 TrampolineMemorySegment,
466 TrampolineMemoryOffset);
#define ERROR_INVALID_PARAMETER
static const WCHAR Cleanup[]
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define VIDEO_MODE_GRAPHICS
#define VIDEO_MODE_LINEAR
#define VIDEO_MODE_BANKED
struct _VIDEO_PORT_INT10_INTERFACE VIDEO_PORT_INT10_INTERFACE
VPAPI VOID NTAPI VideoPortZeroMemory(IN PVOID Destination, IN ULONG Length)
VPAPI PVOID NTAPI VideoPortGetDeviceBase(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfUchars, IN UCHAR InIoSpace)
VPAPI VOID NTAPI VideoPortFreeDeviceBase(IN PVOID HwDeviceExtension, IN PVOID MappedAddress)
VPAPI BOOLEAN NTAPI VideoPortIsNoVesa(VOID)
VPAPI VOID NTAPI VideoPortFreePool(IN PVOID HwDeviceExtension, IN PVOID Ptr)
VPAPI VP_STATUS NTAPI VideoPortInt10(IN PVOID HwDeviceExtension, IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
VPAPI VP_STATUS NTAPI VideoPortQueryServices(IN PVOID HwDeviceExtension, IN VIDEO_PORT_SERVICES ServicesType, IN OUT PINTERFACE Interface)
VPAPI VOID NTAPI VideoPortMoveMemory(IN PVOID Destination, IN PVOID Source, IN ULONG Length)
#define VIDEO_PORT_INT10_INTERFACE_VERSION_1
VPAPI PVOID NTAPI VideoPortAllocatePool(IN PVOID HwDeviceExtension, IN VP_POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
#define VideoDebugPrint(x)
USHORT LinBytesPerScanLine
VOID NTAPI InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
VP_STATUS NTAPI VbeSetMode(IN PHW_DEVICE_EXTENSION VgaDeviceExtension, IN PVIDEOMODE VgaMode, OUT PULONG PhysPtrChange)
ULONG NTAPI RaiseToPower2Ulong(IN ULONG Value)
ULONG NTAPI VbeGetVideoMemoryBaseAddress(IN PHW_DEVICE_EXTENSION VgaExtension, IN PVIDEOMODE VgaMode)
ULONG NTAPI RaiseToPower2(IN USHORT Value)
#define VBE_GETRETURNCODE(x)
#define VBE_GET_MODE_INFORMATION
#define VBE_GET_CURRENT_VBE_MODE
#define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH
#define VBE_GET_CONTROLLER_INFORMATION
#define VBE_MODEATTR_LINEAR
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
BOOLEAN g_bIntelBrookdaleBIOS
BOOLEAN NTAPI ValidateVbeInfo(IN PHW_DEVICE_EXTENSION VgaExtension, IN PVBE_INFO VbeInfo)
#define VBE_MODEATTR_NO_BANK_SWITCH
#define VBE_MODEATTR_COLOR
#define VBE_MODEATTR_NON_VGA
#define VBE_MODEATTR_GRAPHICS
#define VBE_MODEATTR_VALID
#define VBE_MODE_LINEAR_FRAMEBUFFER
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress