Skip to content

Instantly share code, notes, and snippets.

@startergo
Last active April 11, 2024 17:05
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 startergo/5e36b5b5697f65cb85b8b7ac4d104757 to your computer and use it in GitHub Desktop.
Save startergo/5e36b5b5697f65cb85b8b7ac4d104757 to your computer and use it in GitHub Desktop.
enable the registers on the Macbook Pro 5,3

Put the EFI Shell as EFI_System_Partition/EFI/BOOT/Bootx64.efi and the following script as EFI_System_Partition/EFI/BOOT/Startup.nsh

REM Enabling VGA on the PCI Bridge that the NVidia card is connected to
REM Setting Bridge Control Register (0x3e) to 8
mm 0010003E 8 -PCI

REM Enabling NVidia Card "I/O Space Access" and setting it as Bus Master
REM Setting Command Register (0x04) to 7
mm 03000004 7 -PCI

REM Disabling the integrated NVidia Card.
REM Having only one VGA card is less confusing for Windows. It's on the gMux.
mm 750 2 -IO

REM Switch to the EFI System Partition
fs1:
REM Run Microsoft's Bootloader
EFI\Microsoft\Boot\Bootmgfw.efi

Explanation:

  1. start efi shell

  2. find the vga controller: (the -b flag reduces output to one page) Code: pci -b here you can see all devices, find the display (vga) controller, in my case: Code: 00 01 00 00

  3. check the device config: Code: pci -i 00 01 00 -b

a) on page 1 (in my case) i can see the values for the Command Register (4), the bits (00) I/O space enabled and (02) bus master are set to 1, so nothing to change here.

b) on page 3 (in my case) i can see the values for the Bridge Control Register (3E), the bit (03) VGA Enable is set to 0, this should be 1

  1. set the bit mentioned in 3b): Code: mm 0001003E -PCI 8 explanation: a) device is on 000100 (see 2)) b) the Bridge Control Register is 3E (see 3b)) c) the VGA Enable bit is (03), so if you imagine an 8 bit register (00001000 = Bit (07) to Bit (00)) and you want to set bit (03) to 1, you have to feed the register with 00001000 binary, which is 8 decimal).

  2. check pci device config again (same code as for 3)) and you should see that the VGA Enable bit (03) in register (3E) is now set to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment