>From ca8c930ebfe44ba4c724b4593a32f4c4dc4ad9cb Mon Sep 17 00:00:00 2001
From: Henry Zhao <[email protected]>
Date: Fri, 5 Oct 2012 12:41:36 -0700
Subject: [PATCH] libpciaccess: implementation of boot_vga in Solaris

Signed-off-by: Henry Zhao <[email protected]>

---
 src/pciaccess_private.h |    3 +++
 src/solx_devfs.c        |   20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/pciaccess_private.h b/src/pciaccess_private.h
index fea9c9f..339ec0f 100644
--- a/src/pciaccess_private.h
+++ b/src/pciaccess_private.h
@@ -146,6 +146,9 @@ struct pci_device_private {
     struct pci_device_mapping *mappings;
     unsigned num_mappings;
     /*@}*/
+#ifdef __sun
+    int is_primary;
+#endif
 };
 
 
diff --git a/src/solx_devfs.c b/src/solx_devfs.c
index 3eefefb..27942de 100644
--- a/src/solx_devfs.c
+++ b/src/solx_devfs.c
@@ -793,10 +793,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);
@@ -804,6 +807,13 @@ 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
@@ -1128,6 +1138,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,
@@ -1260,6 +1279,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,
-- 
1.5.6.5

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to