libpciaccess: implementation of boot_vga in Solaris
authorHenry Zhao <henry.zhao@oracle.com>
Fri, 5 Oct 2012 19:41:36 +0000 (12:41 -0700)
committerAlan Coopersmith <alan.coopersmith@oracle.com>
Sun, 21 Oct 2012 18:36:23 +0000 (11:36 -0700)
Signed-off-by: Henry Zhao <henry.zhao@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
src/pciaccess_private.h
src/solx_devfs.c

index fea9c9f..339ec0f 100644 (file)
@@ -146,6 +146,9 @@ struct pci_device_private {
     struct pci_device_mapping *mappings;
     unsigned num_mappings;
     /*@}*/
+#ifdef __sun
+    int is_primary;
+#endif
 };
 
 
index bb97f56..b096d7e 100644 (file)
@@ -796,10 +796,13 @@ pci_device_solx_devfs_probe( struct pci_device * dev )
     }
 
     if (args.node != DI_NODE_NIL) {
+       int *prop;
 #ifdef __sparc
        di_minor_t minor;
 #endif
 
+       priv->is_primary = 0;
+
 #ifdef __sparc
        if (minor = di_minor_next(args.node, DI_MINOR_NIL))
            MAPPING_DEV_PATH(dev) = di_devfs_minor_path (minor);
@@ -807,6 +810,12 @@ pci_device_solx_devfs_probe( struct pci_device * dev )
            MAPPING_DEV_PATH(dev) = NULL;
 #endif
 
+       if (di_prop_lookup_ints(DDI_DEV_T_ANY, args.node,
+                               "primary-controller", &prop) >= 1) {
+           if (prop[0])
+               priv->is_primary = 1;
+       }
+
        /*
         * It will succeed for sure, because it was
         * successfully called in find_target_node
@@ -1131,6 +1140,15 @@ pci_device_solx_devfs_write( struct pci_device * dev, const void * data,
     return (err);
 }
 
+static int pci_device_solx_devfs_boot_vga(struct pci_device *dev)
+{
+    struct pci_device_private *priv =
+       (struct pci_device_private *) dev;
+
+    return (priv->is_primary);
+
+}
+
 static struct pci_io_handle *
 pci_device_solx_devfs_open_legacy_io(struct pci_io_handle *ret,
                                     struct pci_device *dev,
@@ -1263,6 +1281,7 @@ static const struct pci_system_methods solx_devfs_methods = {
     .write = pci_device_solx_devfs_write,
 
     .fill_capabilities = pci_fill_capabilities_generic,
+    .boot_vga = pci_device_solx_devfs_boot_vga,
 
     .open_legacy_io = pci_device_solx_devfs_open_legacy_io,
     .read32 = pci_device_solx_devfs_read32,