Skip to content

Instantly share code, notes, and snippets.

@jessicah
Created December 15, 2016 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessicah/6c993f46556048b44fd710cdbc81bd50 to your computer and use it in GitHub Desktop.
Save jessicah/6c993f46556048b44fd710cdbc81bd50 to your computer and use it in GitHub Desktop.
diff --git a/src/system/boot/platform/efi/console.cpp b/src/system/boot/platform/efi/console.cpp
index 35500e7..ebfd21f 100644
--- a/src/system/boot/platform/efi/console.cpp
+++ b/src/system/boot/platform/efi/console.cpp
@@ -243,5 +243,4 @@ platform_switch_to_text_mode(void)
{
kSystemTable->ConOut->Reset(kSystemTable->ConOut, false);
kSystemTable->ConOut->SetMode(kSystemTable->ConOut, sScreenMode);
- gKernelArgs.frame_buffer.enabled = false;
}
diff --git a/src/system/boot/platform/efi/devices.cpp b/src/system/boot/platform/efi/devices.cpp
index 8538ddd..4e68b53 100644
--- a/src/system/boot/platform/efi/devices.cpp
+++ b/src/system/boot/platform/efi/devices.cpp
@@ -120,7 +120,7 @@ add_boot_devices(NodeList *devicesList)
node = NextDevicePathNode(node);
if (DevicePathType(node) == MEDIA_DEVICE_PATH
- && DevicePathSubType(node) == MEDIA_CDROM_DP) {
+ /*&& DevicePathSubType(node) == MEDIA_CDROM_DP*/) {
targetDevicePath = find_device_path(devicePath,
MESSAGING_DEVICE_PATH, 0xFFFF);
continue;
@@ -233,7 +233,7 @@ platform_register_boot_device(Node *device)
identifier.device.unknown.check_sums[i].sum = compute_check_sum(device, offset);
}
- gBootVolume.SetInt32(BOOT_METHOD, BOOT_METHOD_CD);
+ gBootVolume.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK);
gBootVolume.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, true);
gBootVolume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
&identifier, sizeof(disk_identifier));
diff --git a/src/system/boot/platform/efi/video.cpp b/src/system/boot/platform/efi/video.cpp
index 9c21c01..93ca107 100644
--- a/src/system/boot/platform/efi/video.cpp
+++ b/src/system/boot/platform/efi/video.cpp
@@ -8,6 +8,7 @@
#include <boot/platform.h>
#include <boot/platform/generic/video.h>
#include <boot/stage2.h>
+#include <boot/stdio.h>
#include "efi_platform.h"
@@ -20,7 +21,8 @@ static UINTN sGraphicsMode;
extern "C" status_t
platform_init_video(void)
{
- // we don't support VESA modes or EDID
+ printf("platform_init_video()\n");
+ // we don't support VESA modes or EDID
gKernelArgs.vesa_modes = NULL;
gKernelArgs.vesa_modes_size = 0;
gKernelArgs.edid_info = NULL;
@@ -30,6 +32,7 @@ platform_init_video(void)
EFI_STATUS status = kBootServices->LocateProtocol(&sGraphicsOutputGuid,
NULL, (void **)&sGraphicsOutput);
if (sGraphicsOutput == NULL || status != EFI_SUCCESS) {
+ printf(" unable to locate graphics output protocol\n");
gKernelArgs.frame_buffer.enabled = false;
sGraphicsOutput = NULL;
return B_ERROR;
@@ -43,30 +46,47 @@ platform_init_video(void)
UINTN size, depth;
sGraphicsOutput->QueryMode(sGraphicsOutput, mode, &size, &info);
UINTN area = info->HorizontalResolution * info->VerticalResolution;
+ printf(" mode: %u\n", mode);
+ printf(" width: %u\n",
+ info->HorizontalResolution);
+ printf(" height: %u\n",
+ info->VerticalResolution);
if (info->PixelFormat == PixelRedGreenBlueReserved8BitPerColor)
depth = 32;
+ else if (info->PixelFormat == PixelBlueGreenRedReserved8BitPerColor)
+ // yes, this exists, like stupid macbook air...
+ depth = 32;
else if (info->PixelFormat == PixelBitMask
&& info->PixelInformation.RedMask == 0xFF0000
&& info->PixelInformation.GreenMask == 0x00FF00
&& info->PixelInformation.BlueMask == 0x0000FF
&& info->PixelInformation.ReservedMask == 0)
depth = 24;
- else
+ else {
+ printf(" depth: unsupported (%x)\n", info->PixelFormat);
continue;
+ }
+ printf(" depth: %u\n", depth);
area *= depth;
if (area >= bestArea) {
bestArea = area;
bestDepth = depth;
sGraphicsMode = mode;
+ printf(" selected mode as best\n");
}
}
if (bestArea == 0 || bestDepth == 0) {
+ printf(" unable to find suitable graphics mode\n");
sGraphicsOutput = NULL;
+ gKernelArgs.frame_buffer.enabled = false;
return B_ERROR;
}
+ gKernelArgs.frame_buffer.enabled = true;
+ platform_switch_to_logo();
+
return B_OK;
}
@@ -74,11 +94,10 @@ platform_init_video(void)
extern "C" void
platform_switch_to_logo(void)
{
- if (sGraphicsOutput == NULL || gKernelArgs.frame_buffer.enabled)
+ if (sGraphicsOutput == NULL || !gKernelArgs.frame_buffer.enabled)
return;
sGraphicsOutput->SetMode(sGraphicsOutput, sGraphicsMode);
- gKernelArgs.frame_buffer.enabled = true;
gKernelArgs.frame_buffer.physical_buffer.start =
sGraphicsOutput->Mode->FrameBufferBase;
gKernelArgs.frame_buffer.physical_buffer.size =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment