WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] Expose HID, UID, SEG, BBN of PCI root

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] Expose HID, UID, SEG, BBN of PCI root bridge via sysfs.
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 05 Jan 2009 11:50:10 -0800
Delivery-date: Mon, 05 Jan 2009 11:49:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1231152786 0
# Node ID fad85221407bf32df2574bca54cba730748343a2
# Parent  618fc299e2f1e222686bc234c48ac70e1104e18d
Expose HID, UID, SEG, BBN of PCI root bridge via sysfs.

Signed-off-by: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
---
 drivers/acpi/pci_root.c |   36 ++++++++++++++++++++++++++++++++++++
 drivers/acpi/scan.c     |   47 +++++++++++++++++++++++++++++++++++++----------
 include/acpi/acpi_bus.h |   10 ++++++++++
 3 files changed, 83 insertions(+), 10 deletions(-)

diff -r 618fc299e2f1 -r fad85221407b drivers/acpi/pci_root.c
--- a/drivers/acpi/pci_root.c   Thu Dec 18 11:51:36 2008 +0000
+++ b/drivers/acpi/pci_root.c   Mon Jan 05 10:53:06 2009 +0000
@@ -151,6 +151,36 @@ static acpi_status try_get_root_bridge_b
        return AE_OK;
 }
 
+ssize_t
+acpi_device_seg_show(struct acpi_device *acpi_dev, char *buf) 
+{
+       struct list_head *entry;
+
+       list_for_each(entry, &acpi_pci_roots) {
+               struct acpi_pci_root *root;
+               root = list_entry(entry, struct acpi_pci_root, node);
+               if (root->device == acpi_dev)
+                       return sprintf(buf, "%04x\n", root->id.segment);
+       }
+       return 0;
+}
+ACPI_DEVICE_ATTR(seg, 0444, acpi_device_seg_show, NULL);
+
+ssize_t
+acpi_device_bbn_show(struct acpi_device *acpi_dev, char *buf) 
+{
+       struct list_head *entry;
+
+       list_for_each(entry, &acpi_pci_roots) {
+               struct acpi_pci_root *root;
+               root = list_entry(entry, struct acpi_pci_root, node);
+               if (root->device == acpi_dev)
+                       return sprintf(buf, "%02x\n", root->id.bus);
+       }
+       return 0;
+}
+ACPI_DEVICE_ATTR(bbn, 0444, acpi_device_bbn_show, NULL);
+
 static int acpi_pci_root_add(struct acpi_device *device)
 {
        int result = 0;
@@ -298,6 +328,12 @@ static int acpi_pci_root_add(struct acpi
        if (ACPI_SUCCESS(status))
                result = acpi_pci_irq_add_prt(device->handle, root->id.segment,
                                              root->id.bus);
+       if (result)
+               goto end;
+
+       sysfs_create_file(&device->kobj, &acpi_device_attr_seg.attr);
+
+       sysfs_create_file(&device->kobj, &acpi_device_attr_bbn.attr);
 
       end:
        if (result) {
diff -r 618fc299e2f1 -r fad85221407b drivers/acpi/scan.c
--- a/drivers/acpi/scan.c       Thu Dec 18 11:51:36 2008 +0000
+++ b/drivers/acpi/scan.c       Mon Jan 05 10:53:06 2009 +0000
@@ -31,12 +31,6 @@ static void acpi_device_release(struct k
        kfree(dev->pnp.cid_list);
        kfree(dev);
 }
-
-struct acpi_device_attribute {
-       struct attribute attr;
-        ssize_t(*show) (struct acpi_device *, char *);
-        ssize_t(*store) (struct acpi_device *, const char *, size_t);
-};
 
 typedef void acpi_device_sysfs_files(struct kobject *,
                                     const struct attribute *);
@@ -110,6 +104,42 @@ static struct kset acpi_namespace_kset =
        .ktype = &ktype_acpi_ns,
        .uevent_ops = &namespace_uevent_ops,
 };
+
+static ssize_t
+acpi_device_hid_show(struct acpi_device *acpi_dev, char *buf) 
+{
+       return sprintf(buf, "%s\n", acpi_dev->pnp.hardware_id);
+}
+ACPI_DEVICE_ATTR(hid, 0444, acpi_device_hid_show, NULL);
+
+static ssize_t
+acpi_device_uid_show(struct acpi_device *acpi_dev, char *buf) 
+{
+       return sprintf(buf, "%s\n", acpi_dev->pnp.unique_id);
+}
+ACPI_DEVICE_ATTR(uid, 0444, acpi_device_uid_show, NULL);
+
+static int acpi_device_setup_files(struct acpi_device *dev)
+{
+       int result = 0;
+
+       if (dev->flags.hardware_id) {
+               result = sysfs_create_file(&dev->kobj,
+                                       &acpi_device_attr_hid.attr);
+               if (result)
+                       goto end;
+       }
+
+       if (dev->flags.unique_id) {
+               result = sysfs_create_file(&dev->kobj,
+                                       &acpi_device_attr_uid.attr);
+               if (result)
+                       goto end;
+       }
+
+      end:
+       return result;
+}
 
 static void acpi_device_register(struct acpi_device *device,
                                 struct acpi_device *parent)
@@ -146,6 +176,7 @@ static void acpi_device_register(struct 
                printk(KERN_WARNING "%s: kobject_register error: %d\n",
                        __FUNCTION__, err);
        create_sysfs_device_files(device);
+       acpi_device_setup_files(device);
 }
 
 static void acpi_device_unregister(struct acpi_device *device, int type)
@@ -343,10 +374,6 @@ static int acpi_bus_get_wakeup_device_fl
    -------------------------------------------------------------------------- 
*/
 static ssize_t acpi_eject_store(struct acpi_device *device,
                                const char *buf, size_t count);
-
-#define ACPI_DEVICE_ATTR(_name,_mode,_show,_store) \
-static struct acpi_device_attribute acpi_device_attr_##_name = \
-               __ATTR(_name, _mode, _show, _store)
 
 ACPI_DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store);
 
diff -r 618fc299e2f1 -r fad85221407b include/acpi/acpi_bus.h
--- a/include/acpi/acpi_bus.h   Thu Dec 18 11:51:36 2008 +0000
+++ b/include/acpi/acpi_bus.h   Mon Jan 05 10:53:06 2009 +0000
@@ -359,6 +359,16 @@ acpi_handle acpi_get_pci_rootbridge_hand
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data))
 
+#define ACPI_DEVICE_ATTR(_name,_mode,_show,_store) \
+static struct acpi_device_attribute acpi_device_attr_##_name = \
+               __ATTR(_name, _mode, _show, _store)
+
+struct acpi_device_attribute {
+       struct attribute attr;
+       ssize_t(*show) (struct acpi_device *, char *);
+       ssize_t(*store) (struct acpi_device *, const char *, size_t);
+};
+
 #endif /* CONFIG_ACPI */
 
 #endif /*__ACPI_BUS_H__*/

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] Expose HID, UID, SEG, BBN of PCI root bridge via sysfs., Xen patchbot-linux-2.6.18-xen <=