Suspend broadcom cards in order to stop their DMA.

* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add pci.h on x86 EFI.
	* grub-core/Makefile.core.def (kernel): Add pci.c on x86 EFI.
	(pci): Don't build on x86 EFI.
	* grub-core/bus/pci.c (grub_pci_find_capability): New function.
	* grub-core/kern/efi/mm.c (stop_broadcom) [__i386__ || __x86_64__]:
	New function.
	(grub_efi_finish_boot_services) [__i386__ || __x86_64__]: Call
	stop_broadcom if running on EFI.
	* include/grub/pci.h (GRUB_PCI_CLASS_NETWORK): New enum value.
	(GRUB_PCI_CAP_POWER_MANAGEMENT): Likewise.
	(GRUB_PCI_VENDOR_BROADCOM): Likewise.
	(grub_pci_find_capability): New proto.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
This commit is contained in:
Matthew Garrett 2012-05-03 17:26:55 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent 01aab9978f
commit 9d34bb85da
6 changed files with 122 additions and 2 deletions

View file

@ -140,3 +140,34 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
}
}
}
grub_uint8_t
grub_pci_find_capability (grub_pci_device_t dev, grub_uint8_t cap)
{
grub_uint8_t pos = 0x34;
int ttl = 48;
while (ttl--)
{
grub_uint8_t id;
grub_pci_address_t addr;
addr = grub_pci_make_address (dev, pos);
pos = grub_pci_read_byte (addr);
if (pos < 0x40)
break;
pos &= ~3;
addr = grub_pci_make_address (dev, pos);
id = grub_pci_read_byte (addr);
if (id == 0xff)
break;
if (id == cap)
return pos;
pos++;
}
return 0;
}