All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
Cc: xen-devel@lists.xensource.com, Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: [PATCH] Add device-path command.
Date: Mon, 6 Apr 2009 15:06:00 +0100	[thread overview]
Message-ID: <20090406140600.GA18640@redhat.com> (raw)
In-Reply-To: <20090406170119.04B2.27C06F64@necst.nec.co.jp>

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

  reply	other threads:[~2009-04-06 14:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-06  8:03 [PATCH] Add device-path command Yuji Shimada
2009-04-06 14:06 ` Daniel P. Berrange [this message]
2009-04-06 14:45   ` Keir Fraser
2009-04-07  7:29   ` Yuji Shimada
2009-04-07  8:15     ` Keir Fraser
2009-04-07  8:16     ` Yuji Shimada
2009-04-07 16:42 ` Ian Jackson
2009-04-09  8:49 ` [PATCH v2] Add sbdf2devicepath command Yuji Shimada
2009-04-15  6:00   ` [PATCH] Modify makefiles to install/uninstall " Yuji Shimada
2009-04-15  7:42     ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090406140600.GA18640@redhat.com \
    --to=berrange@redhat.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=shimada-yxb@necst.nec.co.jp \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.