[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.