Revision: linuxbios@linuxbios.org--devel/freebios--devel--2.0--patch-10
authorarch import user (historical) <svn@openbios.org>
Wed, 6 Jul 2005 16:49:59 +0000 (16:49 +0000)
committerarch import user (historical) <svn@openbios.org>
Wed, 6 Jul 2005 16:49:59 +0000 (16:49 +0000)
Creator:  Yinghai Lu <yhlu@tyan.com>

pci_rom.h  smbus device parent device print

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1929 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/devices/device.c
src/devices/emulator/pcbios/pcibios.c
src/devices/pci_rom.c
src/devices/root_device.c
src/drivers/generic/debug/debug_dev.c
src/include/device/pci_rom.h

index 8ad489b11a67fc303a9e9e9ae90eba9ee7e8a5cb..ba4a2f49014ee1a4efeda6c1514c0431dcc35d72 100644 (file)
@@ -613,10 +613,13 @@ void dev_initialize(void)
        struct device *dev;
 
        printk_info("Initializing devices...\n");
+
         for (dev = all_devices; dev; dev = dev->next) {
                 if (dev->enabled && !dev->initialized &&
                         dev->ops && dev->ops->init)
                 {
+                       if(dev->path.type == DEVICE_PATH_I2C)
+                               printk_debug("smbus: %s[%d]->",  dev_path(dev->bus->dev), dev->bus->link );
                         printk_debug("%s init\n", dev_path(dev));
                         dev->initialized = 1;
                         dev->ops->init(dev);
index 1517d2a7fb73431c6bf24cef3b3d1a98e4e4e657..be5c91a0f1f2d3347a91efbbabf701fd0952e65e 100644 (file)
@@ -16,7 +16,7 @@ int pcibios_handler()
        case PCI_BIOS_PRESENT:
                X86_AH  = 0x00;         /* no config space/special cycle support */
                X86_AL  = 0x01;         /* config mechanism 1 */
-               X86_EDX = 'P' | 'C' << 8 | 'I' | ' ' << 24;
+               X86_EDX = 'P' | 'C' << 8 | 'I' << 16 | ' ' << 24;
                X86_EBX = 0x0210;       /* Version 2.10 */
                X86_ECX = 0xFF00;       /* FixME: Max bus number */
                X86_EFLAGS &= ~FB_CF;   /* clear carry flag */
index 557553ab5adacbc077f204d09b5de0be3bd612b0..e0a7138464288206d406c592c0f32cc967067891 100644 (file)
@@ -10,15 +10,15 @@ struct rom_header * pci_rom_probe(struct device *dev)
        struct rom_header *rom_header;
        struct pci_data *rom_data;
 
-       rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
+        if (dev->on_mainboard) {
+                // in case some device PCI_ROM_ADDRESS can not be set or readonly 
+               rom_address = dev->rom_address;
+        } else {
+               rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
+       }
 
        if (rom_address == 0x00000000 || rom_address == 0xffffffff) {
-               if (dev->on_mainboard && (dev->rom_address!=0) ) {
-                       // in case some device PCI_ROM_ADDRESS can not be set 
-                       rom_address = dev->rom_address;
-               } else {
-                       return NULL;
-               }
+               return NULL;
        }
 
        printk_debug("rom address for %s = %x\n", dev_path(dev), rom_address);
@@ -71,16 +71,25 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade
        struct pci_data * rom_data;
        unsigned long rom_address;
        unsigned int rom_size;
+       unsigned int image_size=0;
 
        rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
-       rom_data = (unsigned char *) rom_header + le32_to_cpu(rom_header->data);
-       rom_size = rom_header->size*512;
+
+       do {
+               rom_header = (unsigned char *) rom_header + image_size; // get next image
+               rom_data = (unsigned char *) rom_header + le32_to_cpu(rom_header->data);
+               image_size = le32_to_cpu(rom_data->ilen) * 512;
+       } while ((rom_data->type!=0) && (rom_data->indicator!=0));  // make sure we got x86 version
+
+       if(rom_data->type!=0) return NULL;
+
+       rom_size = rom_header->size * 512;
 
        if (PCI_CLASS_DISPLAY_VGA == rom_data->class_hi) {
 #if CONFIG_CONSOLE_VGA == 1
                if (dev != vga_pri) return NULL; // only one VGA supported
-               printk_spew("%s, copying VGA ROM Image from %x to %x, %x bytes\n",
-                           __func__, rom_header, PCI_VGA_RAM_IMAGE_START, rom_size);
+               printk_debug("copying VGA ROM Image from %x to %x, %x bytes\n",
+                           rom_header, PCI_VGA_RAM_IMAGE_START, rom_size);
                memcpy(PCI_VGA_RAM_IMAGE_START, rom_header, rom_size);
                vga_inited = 1;
                return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START);
index 2c641a2260b74891e7d6a27fb13e981569b20433..91c706e4b6ab605db93e476ac988bca998ad89bd 100644 (file)
@@ -89,6 +89,8 @@ unsigned int scan_static_bus(device_t root, unsigned int max)
                        if (child->ops && child->ops->enable) {
                                child->ops->enable(child);
                        }
+                       if (child->path.type == DEVICE_PATH_I2C)        
+                               printk_debug("smbus: %s[%d]->",  dev_path(child->bus->dev), child->bus->link );
                        printk_debug("%s %s\n", dev_path(child),
                                     child->enabled?"enabled": "disabled");
                }
index 8454051602eec56affa81979e1f3bddaa59f6f9d..600b1fcf60ddecb246a7415635f002140749f9f8 100644 (file)
@@ -35,9 +35,9 @@ static void print_mem(void)
 static void print_pci_regs_all(void)
 {
         struct device *dev;
-       unsigned char bus, device, function;
+       unsigned bus, device, function;
 
-       for(bus=0; bus<=256; bus++) {
+       for(bus=0; bus<256; bus++) {
                for(device=0; device<=0x1f; device++) {
                        for (function=0; function<=7; function++){
                                unsigned devfn;
index 3236254697c9d118da9293619db4e4da5b9c566d..e0cbf408068049ef364b4e8ffcb34eec2c114555 100644 (file)
@@ -36,4 +36,6 @@ struct  pci_data {
 extern struct rom_header * pci_rom_probe(struct device *dev);
 extern struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header);
 
+extern void pci_dev_init(struct device *dev);
+
 #endif