hdt: irq have to be in dev_info
authorErwan Velu <erwan.velu@free.fr>
Sat, 14 Mar 2009 07:17:39 +0000 (08:17 +0100)
committerErwan Velu <erwan.velu@free.fr>
Sat, 14 Mar 2009 07:17:39 +0000 (08:17 +0100)
Moving irq stuff to the dev_info structure to keep coherent

com32/hdt/hdt-cli-pci.c
com32/hdt/hdt-menu-pci.c
com32/include/sys/pci.h
com32/lib/pci/scan.c

index 0c649e9..06eea9f 100644 (file)
@@ -101,8 +101,8 @@ void show_pci_device(struct s_hardware *hardware, const char *item) {
  more_printf("SubProduct ID : %04x\n",pci_device->sub_product);
  more_printf("Class ID      : %02x.%02x.%02x\n",pci_device->class[2], pci_device->class[1],pci_device->class[0]);
  more_printf("Revision      : %02x\n",pci_device->revision);
- if ((pci_device->irq>0) && (pci_device->irq<255))
-   more_printf("IRQ           : %0d\n",pci_device->irq);
+ if ((pci_device->dev_info->irq>0) && (pci_device->dev_info->irq<255))
+   more_printf("IRQ           : %0d\n",pci_device->dev_info->irq);
  more_printf("PCI Bus       : %02d\n",bus);
  more_printf("PCI Slot      : %02d\n",slot);
  more_printf("PCI Func      : %02d\n",func);
@@ -194,15 +194,15 @@ void show_pci_irq(struct s_hardware *hardware) {
   /* For every detected pci device, compute its submenu */
  for_each_pci_func(pci_device, hardware->pci_domain) {
    /* Only display valid IRQs*/
-   if ((pci_device->irq>0) && (pci_device->irq<255)) {
+   if ((pci_device->dev_info->irq>0) && (pci_device->dev_info->irq<255)) {
      if (nopciids == false)  {
         more_printf("%02d  : %s %s \n",
-               pci_device->irq,pci_device->dev_info->vendor_name,
+               pci_device->dev_info->irq,pci_device->dev_info->vendor_name,
                pci_device->dev_info->product_name);
 
      } else {
        more_printf("%02d  : %04x:%04x [%04x:%04x] \n",
-               pci_device->irq, pci_device->vendor, pci_device->product,
+               pci_device->dev_info->irq, pci_device->vendor, pci_device->product,
                pci_device->sub_vendor, pci_device->sub_product);
      }
    }
index 77ea266..5c16a6a 100644 (file)
@@ -64,9 +64,9 @@ void compute_pci_device(struct s_my_menu *menu,struct pci_device *pci_device,int
    add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
    menu->items_count++;
 
-   if ((pci_device->irq>0) && (pci_device->irq<255)) {
-     snprintf(buffer,sizeof buffer,"IRQ     : %02d",pci_device->irq);
-     snprintf(statbuffer,sizeof statbuffer,"IRQ : %02d",pci_device->irq);
+   if ((pci_device->dev_info->irq>0) && (pci_device->dev_info->irq<255)) {
+     snprintf(buffer,sizeof buffer,"IRQ     : %02d",pci_device->dev_info->irq);
+     snprintf(statbuffer,sizeof statbuffer,"IRQ : %02d",pci_device->dev_info->irq);
      add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
      menu->items_count++;
     }
index d736304..48b56af 100644 (file)
@@ -30,6 +30,7 @@ struct pci_dev_info {
   int linux_kernel_module_count;
   char class_name[PCI_CLASS_NAME_SIZE]; /* The most precise class name */
   char category_name[PCI_CLASS_NAME_SIZE]; /*The general category*/
+  uint8_t  irq;
 };
 
 /* PCI device (really, function) */
@@ -47,7 +48,6 @@ struct pci_device {
       uint32_t vid_did;
       uint32_t svid_sdid;
       uint32_t rid_class;
-      uint8_t  irq;
     };
   };
   struct pci_dev_info *dev_info;
index 0c52100..1e1dce2 100644 (file)
@@ -532,7 +532,13 @@ void gather_additional_pci_config(struct pci_domain *domain)
 
       for (nfunc = 0; nfunc < maxfunc; nfunc++) {
         a = pci_mkaddr(nbus, ndev, nfunc, 0);
-        domain->bus[nbus]->slot[ndev]->func[nfunc]->irq = pci_readb(a + 0x3c);
+       struct pci_device *dev = domain->bus[nbus]->slot[ndev]->func[nfunc];
+        if (! dev->dev_info) {
+          dev->dev_info = zalloc(sizeof *dev->dev_info);
+          if (!dev->dev_info)
+            return;
+          }
+        dev->dev_info->irq = pci_readb(a + 0x3c);
       }
     }
   }