MacBook Pro, EFI and Nvidia setpci IDs

I finally solved the problem when setpci doesn't change the value of PCI-E bridge.

If you are unable to set the value of PCI-E brigde registers using setpci command in order to get nVidia GeForce drivers working on your Apple MacBook machine try these steps:

1. Find your PCI-E bus identifiers

lshw -businfo -class bridge -class display

[root@kernelLinux]# lshw -businfo -class bridge -class display
Bus info          Device      Class          Description
========================================================
pci@0000:00:00.0              bridge         MCP89 HOST Bridge
pci@0000:00:03.0              bridge         MCP89 LPC Bridge
pci@0000:00:15.0              bridge         NVIDIA Corporation
pci@0000:00:17.0              bridge         MCP89 PCI Express Bridge
pci@0000:02:00.0              display        MCP89 [GeForce 320M]

You will need the ID's of PCI Express Bridge and your display in format XX:XX.X

Your ID's can be different.

In this example our ID's are 00:17.0 for PCI-E brige and 02:00.0 for display [GPU].

2. Create a GRUB script

Our script will be slightly different than in mentioned post above.

I have noticed of two things. Grub2 installed using distro (mine is Centos) installation process doesn't contain setpci grub module. It's the reason why grub do not change registers while boot. Then It is necessary to load setpci module into grub before we run commands to change registers.

Download grub2-efi-modules

Ubuntu Linux

sudo apt-get install grub-efi-amd64-bin

Fedora Linux

sudo dnf install grub2-efi-modules

CentOS Linux

sudo yum install grub2-efi-modules

Modules will be installed in /usr/lib/grub/x86_64-efi/ but the setpci module files needs to be present in /boot/efi/EFI/centos/x86_64-efi/

Create x86_64-efi folder

sudo mkdir /boot/EFI/centos/x86_64-efi

Copy setpci module files into grub2 folder

sudo cp /usr/lib/grub/x86_64-efi/setpci.* /boot/EFI/centos/x86_64-efi

Create the 01_enable_vga.conf file.

The file should contain these lines of code:

Do not forget replace 00:17.0 for PCI-bridge and 02:00.0 for display [GPU] with your values.

sudo nano /etc/grub.d/01_enable_vga.conf

cat << EOF
insmod setpci
setpci -s "00:17.0" 3e.b=8
setpci -s "02:00.0" 04.b=7
EOF

Then repair permissions

sudo chmod 755 /etc/grub.d/01_enable_vga.conf

and update the /boot/efi/EFI/centos/grub.cfg

Ubuntu Linux

sudo update-grub

Do this command only on other distributions (not necessary on Ubuntu after update-grub):

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

3. Reboot your system and check registers

Reboot your machine and check if it's working. Replace ID's with yours again. Your terminal should finally show 08 (PCI-E bridge) and 07 (GPU).

sudo setpci -s "00:17.0" 3e.b
08

sudo setpci -s "02:00.0" 04.b
07

4. Install nVidia drivers

Screenshot: http://imgur.com/a/YiBXi