ia64/xen-unstable

changeset 19781:85fdfb7da88c

xend: pass-through: Use common parsing code in parse_pci_configuration()

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 17 07:38:42 2009 +0100 (2009-06-17)
parents d8b2b1712ea6
children 902df7680e2e
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Wed Jun 17 07:38:03 2009 +0100
     1.2 +++ b/tools/python/xen/xm/main.py	Wed Jun 17 07:38:42 2009 +0100
     1.3 @@ -2489,36 +2489,16 @@ def parse_pci_configuration(args, state,
     1.4      dom = args[0]
     1.5      pci_dev_str = args[1]
     1.6      if len(args) == 3:
     1.7 -        vslot = args[2]
     1.8 -    else:
     1.9 -        vslot = AUTO_PHP_SLOT_STR
    1.10 -    pci=['pci']
    1.11 -    pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \
    1.12 -            r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \
    1.13 -            r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + \
    1.14 -            r"(?P<func>[0-7])$", pci_dev_str)
    1.15 -    if pci_match == None:
    1.16 -        raise OptionError("Invalid argument: %s %s" % (pci_dev_str, vslot))
    1.17 -    pci_dev_info = pci_match.groupdict('0')
    1.18 +        pci_dev_str += '@' + args[2]
    1.19 +    if len(opts) > 0:
    1.20 +        pci_dev_str += ',' + serialise_pci_opts(opts)
    1.21  
    1.22      try:
    1.23 -        pci_bdf =['dev', ['domain', '0x'+ pci_dev_info['domain']], \
    1.24 -                ['bus', '0x'+ pci_dev_info['bus']],
    1.25 -                ['slot', '0x'+ pci_dev_info['slot']],
    1.26 -                ['func', '0x'+ pci_dev_info['func']],
    1.27 -                ['vslot', '0x%x' % int(vslot, 16)]]
    1.28 -    except:
    1.29 -        raise OptionError("Invalid argument: %s %s" % (pci_dev_str, vslot))
    1.30 -
    1.31 -    try:
    1.32 -        check_pci_opts(opts)
    1.33 +        pci_dev = parse_pci_name_extended(pci_dev_str)
    1.34      except PciDeviceParseError, ex:
    1.35          raise OptionError(str(ex))
    1.36  
    1.37 -    pci.append(sxp.merge(pci_bdf, pci_opts_list_to_sxp(opts)))
    1.38 -    pci.append(['state', state])
    1.39 -
    1.40 -    return (dom, pci)
    1.41 +    return (dom, pci_convert_dict_to_sxp(pci_dev, state))
    1.42  
    1.43  def xm_pci_attach(args):
    1.44      config_pci_opts = []