Re: [coreboot] Fixing usage of vendor, device to devid

2008-01-20 Thread Carl-Daniel Hailfinger
On 19.01.2008 08:44, ron minnich wrote:
> This change resolves the earlier report of 'can't find southbridge'
> which was due to dev_find_device not being able
> to find a device in the static tree.
>
> ron
>   
> include/device/device.h
> Remove old vendor,device struct members since we are now using the device_id 
> struct. 
> Change declaration of dev_find_device to use device_id struct. 
>
> device/device_util.c
> Change dev_find_device to use device_id struct instead of vendor, device 
> parameters.
> Add convenience function, dev_find_pci_device, to make it easier for users. 
>
> device/pci_device.c
> Change uses of dev->vendor and dev->device to dev->id. 
> Change prints of dev->vendor, dev->device to use the 
> dev_id_string function. 
>
> device/pci_rom.c
> Change uses of dev->vendor and dev->device to dev->id. 
>
> southbridge/amd/cs5536/cs5536.c
> Change uses of dev_find_device to dev_find_pci_device
>
> southbridge/amd/cs5536/dts
> Add pciid of the cs5536
>
> northbridge/amd/geodelx/dts
> add pciid of the geodelx northbridge. 
>
> util/x86emu/vm86.c
> Change uses of dev_find_device to dev_find_pci_device
>
> With these changes, the chipsetinit function now finds the southbridge in the 
> static tree, which is the first time this has worked in v3. This success
> in turn means that the chipsetinit code is running for the first time. 
> We are still failing in
> "Finding PCI configuration type"
>
> Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>
>   

Acked-by: Carl-Daniel Hailfinger <[EMAIL PROTECTED]>

Committed in r558 with one compile warning fixed.


Regards,
Carl-Daniel

-- 
coreboot mailing list
coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] Fixing usage of vendor, device to devid

2008-01-18 Thread ron minnich
This change resolves the earlier report of 'can't find southbridge'
which was due to dev_find_device not being able
to find a device in the static tree.

ron
include/device/device.h
Remove old vendor,device struct members since we are now using the device_id struct. 
Change declaration of dev_find_device to use device_id struct. 

device/device_util.c
Change dev_find_device to use device_id struct instead of vendor, device parameters.
Add convenience function, dev_find_pci_device, to make it easier for users. 

device/pci_device.c
Change uses of dev->vendor and dev->device to dev->id. 
Change prints of dev->vendor, dev->device to use the 
dev_id_string function. 

device/pci_rom.c
Change uses of dev->vendor and dev->device to dev->id. 

southbridge/amd/cs5536/cs5536.c
Change uses of dev_find_device to dev_find_pci_device

southbridge/amd/cs5536/dts
Add pciid of the cs5536

northbridge/amd/geodelx/dts
add pciid of the geodelx northbridge. 

util/x86emu/vm86.c
Change uses of dev_find_device to dev_find_pci_device

With these changes, the chipsetinit function now finds the southbridge in the 
static tree, which is the first time this has worked in v3. This success
in turn means that the chipsetinit code is running for the first time. 
We are still failing in
"Finding PCI configuration type"

Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>

Index: southbridge/amd/cs5536/cs5536.c
===
--- southbridge/amd/cs5536/cs5536.c	(revision 556)
+++ southbridge/amd/cs5536/cs5536.c	(working copy)
@@ -227,7 +227,7 @@
 	u32 gpio_addr;
 	struct device *dev;
 
-	dev = dev_find_device(PCI_VENDOR_ID_AMD,
+	dev = dev_find_pci_device(PCI_VENDOR_ID_AMD,
 			  PCI_DEVICE_ID_AMD_CS5536_ISA, 0);
 
 	gpio_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_1);
@@ -389,7 +389,7 @@
 	struct msr msr;
 	struct device *dev;
 
-	dev = dev_find_device(PCI_VENDOR_ID_AMD,
+	dev = dev_find_pci_device(PCI_VENDOR_ID_AMD,
 			  PCI_DEVICE_ID_AMD_CS5536_EHCI, 0);
 	if (dev) {
 		/* Serial short detect enable */
@@ -409,7 +409,7 @@
 		*(bar + HCCPARAMS) = 0x5012;
 	}
 
-	dev = dev_find_device(PCI_VENDOR_ID_AMD,
+	dev = dev_find_pci_device(PCI_VENDOR_ID_AMD,
 			  PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
 	if (dev) {
 		bar = (u32 *) pci_read_config32(dev, PCI_BASE_ADDRESS_0);
@@ -434,14 +434,14 @@
 	 *  - Set APU bit in uoc register
 	 */
 	if (sb->enable_USBP4_device) {
-		dev = dev_find_device(PCI_VENDOR_ID_AMD,
+		dev = dev_find_pci_device(PCI_VENDOR_ID_AMD,
   PCI_DEVICE_ID_AMD_CS5536_UDC, 0);
 		if (dev) {
 			bar = (u32 *)pci_read_config32(dev, PCI_BASE_ADDRESS_0);
 			*(bar + UDCDEVCTL) |= UDC_SD_SET;
 		}
 
-		dev = dev_find_device(PCI_VENDOR_ID_AMD,
+		dev = dev_find_pci_device(PCI_VENDOR_ID_AMD,
   PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
 		if (dev) {
 			bar = (u32 *)pci_read_config32(dev, PCI_BASE_ADDRESS_0);
@@ -451,12 +451,12 @@
 	}
 
 	/* Disable virtual PCI UDC and OTG headers. */
-	dev = dev_find_device(PCI_VENDOR_ID_AMD,
+	dev = dev_find_pci_device(PCI_VENDOR_ID_AMD,
 			  PCI_DEVICE_ID_AMD_CS5536_UDC, 0);
 	if (dev)
 		pci_write_config32(dev, 0x7C, 0xDEADBEEF);
 
-	dev = dev_find_device(PCI_VENDOR_ID_AMD,
+	dev = dev_find_pci_device(PCI_VENDOR_ID_AMD,
 			  PCI_DEVICE_ID_AMD_CS5536_OTG, 0);
 	if (dev)
 		pci_write_config32(dev, 0x7C, 0xDEADBEEF);
@@ -479,7 +479,7 @@
 	const struct msrinit *csi;
 
 	post_code(P80_CHIPSET_INIT);
-	dev = dev_find_device(PCI_VENDOR_ID_AMD,
+	dev = dev_find_pci_device(PCI_VENDOR_ID_AMD,
 			  PCI_DEVICE_ID_AMD_CS5536_ISA, 0);
 	if (!dev) {
 		printk(BIOS_ERR, "%s: Could not find the south bridge!\n",
Index: southbridge/amd/cs5536/dts
===
--- southbridge/amd/cs5536/dts	(revision 556)
+++ southbridge/amd/cs5536/dts	(working copy)
@@ -20,6 +20,7 @@
 
 {
 	constructor = "cs5536_constructors";
+	pciid = "PCI_VENDOR_ID_AMD,PCI_DEVICE_ID_AMD_CS5536_ISA";
 
 	/* Interrupt enables for LPC bus. Each bit is an IRQ 0-15. */
 	lpc_serirq_enable = "0";
Index: include/device/device.h
===
--- include/device/device.h	(revision 557)
+++ include/device/device.h	(working copy)
@@ -197,9 +197,6 @@
 	struct device_path path;
 	struct device_id id;
 	char 		dtsname[MAX_DTSNAME_SIZE];	/* the name from the dts */
-	/* XXX remove this soon */
-	unsigned 	device, vendor;
-	/* XXX */
 	u16 status;
 	u8 revision;
 	u8 cache_line;
@@ -266,7 +263,8 @@
 /* Helper functions */
 struct device * find_dev_path(struct bus *parent, struct device_path *path);
 struct device * alloc_find_dev(struct bus *parent, struct device_path *path, struct device_id *id);
-struct device * dev_find_device (unsigned int vendor, unsigned int device, struct device * from);
+struct device * dev_find_device (struct device_id *devid, struct device * from);
+struct device *dev_find_pci_device(u16 vendor, u16 device, struct device *from);
 struct