Allow the payload to enable a PCI device as a bus master.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Index: libpayload/drivers/pci.c
===================================================================
--- libpayload.orig/drivers/pci.c	2008-10-17 14:37:39.000000000 -0600
+++ libpayload/drivers/pci.c	2008-10-17 14:39:52.000000000 -0600
@@ -112,3 +112,11 @@
 {
 	return pci_read_config32(dev, 0x10 + (bar * 4));
 }
+
+void pci_set_bus_master(pcidev_t dev)
+{
+	u16 val = pci_read_config16(dev, REG_COMMAND);
+	val |= REG_COMMAND_BM;
+	pci_write_config16(dev, REG_COMMAND, val);
+}
+
Index: libpayload/include/pci.h
===================================================================
--- libpayload.orig/include/pci.h	2008-10-17 14:37:39.000000000 -0600
+++ libpayload/include/pci.h	2008-10-17 14:40:17.000000000 -0600
@@ -35,10 +35,12 @@
 typedef u32 pcidev_t;
 
 #define REG_VENDOR_ID   0x00
-#define REG_DEVICE_ID   0x04
+#define REG_COMMAND     0x04
 #define REG_HEADER_TYPE 0x0E
 #define REG_PRIMARY_BUS 0x18
 
+#define REG_COMMAND_BM  (1 << 2)
+
 #define HEADER_TYPE_NORMAL  0
 #define HEADER_TYPE_BRIDGE  1
 #define HEADER_TYPE_CARDBUS 2
@@ -64,4 +66,6 @@
 int pci_find_device(u16 vid, u16 did, pcidev_t *dev);
 u32 pci_read_resource(pcidev_t dev, int bar);
 
+void pci_set_bus_master(pcidev_t dev);
+
 #endif

-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.



