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-devel

Re: [Xen-devel] [PATCH] Add device-path command.

To: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Add device-path command.
From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Date: Mon, 6 Apr 2009 15:06:00 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Mon, 06 Apr 2009 07:06:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20090406170119.04B2.27C06F64@xxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20090406170119.04B2.27C06F64@xxxxxxxxxxxxxxx>
Reply-to: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
On Mon, Apr 06, 2009 at 05:03:37PM +0900, Yuji Shimada wrote:
> This patch adds device-path command that converts SBDF into device
> path.

[snip]

> diff -r 5a60eb7fad79 tools/misc/device-path
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/tools/misc/device-path  Mon Apr 06 16:30:11 2009 +0900


[snip]

> +SYSFS_ACPI_DEVS_PATH = '/firmware/acpi/namespace/ACPI/_SB'
> +
> +def find_hid_uid(dom, b, d, f):
> +    sb_path = find_sysfs_mnt() + SYSFS_ACPI_DEVS_PATH
> +    obj_list = os.listdir(sb_path)
> +    for obj in obj_list:
> +        obj_path = sb_path + '/' + obj.strip() + '/'
> +        if os.path.exists(obj_path + 'seg') and \
> +            os.path.exists(obj_path + 'bbn'):
> +            seg = open(obj_path + 'seg').read()
> +            bbn = open(obj_path + 'bbn').read()
> +            if int(seg) == dom and int(bbn) == b:
> +                hid = open(obj_path + 'hid').read()
> +                if os.path.exists(obj_path + 'uid') is False:
> +                    path_str = hid.strip()
> +                else:
> +                    uid = open(obj_path + 'uid').read()
> +                    path_str = hid.strip() + ':' + uid.strip()
> +                return path_str
> +    return None

I don't know how critical this piece of code is to the overall functionality
in this tool, but be warned that the path being used here was removed from
sysfs in upstream kernel quite a while ago

To quote an old copy of  Documentation/feature-removal-schedule.txt

  What:  /sys/firmware/acpi/namespace
  When:  2.6.21
  Why:   The ACPI namespace is effectively the symbol list for
         the BIOS.  The device names are completely arbitrary
         and have no place being exposed to user-space.
  
         For those interested in the BIOS ACPI namespace,
         the BIOS can be extracted and disassembled with acpidump
         and iasl as documented in the pmtools package here:
         http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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