OSDN Git Service

Open the pci device read-write so we can read and write config regs.
authorEric Anholt <eric@anholt.net>
Fri, 12 Jan 2007 22:15:29 +0000 (14:15 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 12 Jan 2007 22:15:29 +0000 (14:15 -0800)
With this, we can hook up the IRQ line information.  It would probably be nice
to have an unpriveleged mode, but for now, write access is required.

src/freebsd_pci.c

index 8b846e8..d3b0018 100644 (file)
@@ -185,10 +185,18 @@ pci_device_freebsd_write( struct pci_device * dev, const void * data,
 static int
 pci_device_freebsd_probe( struct pci_device * dev )
 {
+    uint8_t irq;
+    int err;
+
     /* Many of the fields were filled in during initial device enumeration.
      * At this point, we need to fill in regions, rom_size, and irq.
      */
 
+    err = pci_device_cfg_read_u8( dev, &irq, 60 );
+    if (err)
+       return errno;
+    dev->irq = irq;
+
     return 0;
 }
 
@@ -216,7 +224,7 @@ pci_system_freebsd_create( void )
     int i;
 
     /* Try to open the PCI device */
-    pcidev = open( "/dev/pci", O_RDONLY );
+    pcidev = open( "/dev/pci", O_RDWR );
     if ( pcidev == -1 )
        return ENXIO;