ia64/xen-unstable

changeset 17491:84b5dee690f5

AMD IOV: Fix xen boot on non-iommu systems.
Signed-off-by: Wei Wang <wei.wang2@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Apr 21 14:59:25 2008 +0100 (2008-04-21)
parents d03f1c098a1e
children 8d20c24238ad
files xen/drivers/passthrough/amd/iommu_detect.c
line diff
     1.1 --- a/xen/drivers/passthrough/amd/iommu_detect.c	Mon Apr 21 14:55:15 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/amd/iommu_detect.c	Mon Apr 21 14:59:25 2008 +0100
     1.3 @@ -216,24 +216,24 @@ static int __init scan_functions_for_iom
     1.4      int bus, int dev, iommu_detect_callback_ptr_t iommu_detect_callback)
     1.5  {
     1.6      int func, hdr_type;
     1.7 -    int count, error = 0;
     1.8 +    int count = 1, error = 0;
     1.9  
    1.10 -    func = 0;
    1.11 -    count = 1;
    1.12 -    while ( VALID_PCI_VENDOR_ID(pci_conf_read16(bus, dev, func,
    1.13 -                                                PCI_VENDOR_ID)) &&
    1.14 -            !error && (func < count) )
    1.15 +    for ( func = 0;
    1.16 +          (func < count) && !error &&
    1.17 +              VALID_PCI_VENDOR_ID(pci_conf_read16(bus, dev, func,
    1.18 +                                                  PCI_VENDOR_ID));
    1.19 +          func++ )
    1.20 +
    1.21      {
    1.22          hdr_type = pci_conf_read8(bus, dev, func, PCI_HEADER_TYPE);
    1.23  
    1.24 -        if ( func == 0 && IS_PCI_MULTI_FUNCTION(hdr_type) )
    1.25 +        if ( (func == 0) && IS_PCI_MULTI_FUNCTION(hdr_type) )
    1.26              count = PCI_MAX_FUNC_COUNT;
    1.27  
    1.28          if ( IS_PCI_TYPE0_HEADER(hdr_type) ||
    1.29               IS_PCI_TYPE1_HEADER(hdr_type) )
    1.30              error = scan_caps_for_iommu(bus, dev, func,
    1.31                                          iommu_detect_callback);
    1.32 -        func++;
    1.33      }
    1.34  
    1.35      return error;