[grub] Disable Broadcom network devices on Apple hardware (mjg59)

Peter Jones pjones at fedoraproject.org
Wed Apr 18 16:44:23 UTC 2012


commit 8beb4d000220c7d299410795273b056ee67e8d3d
Author: Peter Jones <pjones at redhat.com>
Date:   Wed Apr 18 12:44:09 2012 -0400

    Disable Broadcom network devices on Apple hardware (mjg59)

 grub-fedora-18.patch |  107 +++++++++++++++++++++++++++++++++++++++++++++++--
 grub.spec            |    5 ++-
 2 files changed, 106 insertions(+), 6 deletions(-)
---
diff --git a/grub-fedora-18.patch b/grub-fedora-18.patch
index db4fb35..3a024dd 100644
--- a/grub-fedora-18.patch
+++ b/grub-fedora-18.patch
@@ -1,5 +1,5 @@
 From: Peter Jones <pjones at redhat.com>" 
-Date: Mon Apr 16 16:52:38 EDT 2012
+Date: Wed Apr 18 12:43:07 EDT 2012
 Subject: [PATCH] Changes from grub-0.97 to master
 
 This patch is a bundle of the changes between grub-0.97 and master.
@@ -79,7 +79,7 @@ git diff grub-0.97 master
  efi/x86_64/elf_efi.lds         |   58 
  efi/x86_64/loader/Makefile     |   20 
  efi/x86_64/loader/bin_to_h.c   |   29 
- efi/x86_64/loader/linux.c      |  663 +++
+ efi/x86_64/loader/linux.c      |  760 ++++
  efi/x86_64/loader/switch.S     |   92 
  efi/x86_64/loader/switch.h     |   25 
  efi/x86_64/reloc.c             |   79 
@@ -153,7 +153,7 @@ git diff grub-0.97 master
  util/Makefile.in               |  478 --
  util/grub-crypt.in             |   80 
  util/grub-install.in           |  334 +
- 142 files changed, 26313 insertions(+), 17652 deletions(-)
+ 142 files changed, 26410 insertions(+), 17652 deletions(-)
 
 diff --git a/.gitignore b/.gitignore
 new file mode 100644
@@ -29643,10 +29643,10 @@ index 0000000..4cff104
 +
 diff --git a/efi/x86_64/loader/linux.c b/efi/x86_64/loader/linux.c
 new file mode 100644
-index 0000000..d3f07da
+index 0000000..f1fcd74
 --- /dev/null
 +++ b/efi/x86_64/loader/linux.c
-@@ -0,0 +1,663 @@
+@@ -0,0 +1,760 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2006  Free Software Foundation, Inc.
@@ -29833,6 +29833,101 @@ index 0000000..d3f07da
 +}
 +
 +void
++grub_efi_disable_network (void)
++{
++  grub_efi_guid_t pci_io_guid = GRUB_EFI_PCI_IO_GUID;
++  grub_efi_pci_io_t *pci_proto;
++  grub_efi_uintn_t num_handles;
++  grub_efi_handle_t *handle, *handles;
++
++  handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL,
++					  &pci_io_guid,
++					  NULL, &num_handles);
++  if (!handles || !num_handles)
++    return;
++
++  for (handle = handles; num_handles--; handle++)
++    {
++      grub_efi_uint8_t class, pos, id, pm = 0;
++      grub_efi_uint16_t pm_state, vendor;
++      int ttl = 48;
++
++      pci_proto = grub_efi_open_protocol (*handle, &pci_io_guid,
++					  GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
++
++      if (!pci_proto)
++	continue;
++
++      Call_Service_5 (pci_proto->pci.read, pci_proto,
++		      grub_efi_pci_io_width_uint8, 0x0b, 1, &class);
++
++      /* Not a network device */
++      if (class != 0x02)
++	continue;
++
++      Call_Service_5 (pci_proto->pci.read, pci_proto,
++		      grub_efi_pci_io_width_uint16, 0x00, 1, &vendor);
++
++      /* Not a Broadcom */
++      if (vendor != 0x14e4)
++	continue;
++
++      Call_Service_5 (pci_proto->pci.read, pci_proto,
++		      grub_efi_pci_io_width_uint16, 0x2c, 1, &vendor);
++
++      /* Not an Apple */
++      if (vendor != 0x106b)
++	continue;
++
++      pos = 0x34;
++
++      /* Find the power management registers */
++      while (ttl--)
++	{
++	  Call_Service_5 (pci_proto->pci.read, pci_proto,
++			  grub_efi_pci_io_width_uint8, pos, 1, &pos);
++
++	  if (pos < 0x40)
++	    break;
++
++	  pos &= ~3;
++
++	  Call_Service_5 (pci_proto->pci.read, pci_proto,
++			  grub_efi_pci_io_width_uint8, pos, 1, &id);
++
++	  if (id == 0xff)
++	    break;
++
++	  if (id == 0x01)
++	    {
++	      pm = pos;
++	      break;
++	    }
++
++	  pos += 1;
++	}
++
++      if (pm)
++	{
++	  Call_Service_5 (pci_proto->pci.read, pci_proto,
++			  grub_efi_pci_io_width_uint16, pm + 4, 1, &pm_state);
++
++	  pm_state &= ~0x03;
++	  pm_state |= 0x03;
++
++	  /* Set to D3 */
++
++	  Call_Service_5 (pci_proto->pci.write, pci_proto,
++			  grub_efi_pci_io_width_uint16, pm + 4, 1, &pm_state);
++
++	  Call_Service_5 (pci_proto->pci.read, pci_proto,
++			  grub_efi_pci_io_width_uint16, pm + 4, 1,
++			  &pm_state);
++	}
++    }
++}
++
++void
 +big_linux_boot (void)
 +{
 +  struct linux_kernel_params *params;
@@ -29854,6 +29949,8 @@ index 0000000..d3f07da
 +			 mmap_buf, desc_size, mmap_size);
 +  params->e820_nr_map = e820_nr_map;
 +
++  grub_efi_disable_network();
++
 +  if (! grub_efi_exit_boot_services (map_key))
 +    grub_fatal ("cannot exit boot services");
 +
diff --git a/grub.spec b/grub.spec
index 9e2886f..997242f 100644
--- a/grub.spec
+++ b/grub.spec
@@ -1,6 +1,6 @@
 Name: grub
 Version: 0.97
-Release: 90%{?dist}
+Release: 91%{?dist}
 Epoch: 1
 Summary: Grand Unified Boot Loader.
 Group: System Environment/Base
@@ -120,6 +120,9 @@ fi
 /sbin/grub-crypt
 
 %changelog
+* Wed Apr 18 2012 Peter Jones <pjones at redhat.com> - 0.97-91
+- Disable Broadcom network devices on Apple hardware (mjg59)
+
 * Mon Apr 16 2012 Peter Jones <pjones at redhat.com> - 0.97-90
 - Add symbolic link support for the uefi filesystem (mjg59)
 


More information about the scm-commits mailing list