summaryrefslogtreecommitdiff
path: root/usr/src/cmd/pcitool
diff options
context:
space:
mode:
authorZhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>2010-04-22 15:10:46 +0800
committerZhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>2010-04-22 15:10:46 +0800
commit8d7fafffed373567f52062b634e61fd50858b8d9 (patch)
treecb77823b1668cdc1d8277f0e4ffa5858f2a721fc /usr/src/cmd/pcitool
parentc6698ca1e2450f37cc5ee4cdded3e5472088ba41 (diff)
downloadillumos-joyent-8d7fafffed373567f52062b634e61fd50858b8d9.tar.gz
6910668 the code for 6831378 should do better error handling
Diffstat (limited to 'usr/src/cmd/pcitool')
-rw-r--r--usr/src/cmd/pcitool/pcitool.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr/src/cmd/pcitool/pcitool.c b/usr/src/cmd/pcitool/pcitool.c
index 4f575eae08..951980ef4a 100644
--- a/usr/src/cmd/pcitool/pcitool.c
+++ b/usr/src/cmd/pcitool/pcitool.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* This file is the main module for the pcitool. */
@@ -476,7 +475,7 @@ supports_ari(int fd, uint8_t bus_no)
cfg_prg.func_no = func_no;
cfg_prg.barnum = 0;
cfg_prg.user_version = PCITOOL_VERSION;
- cfg_prg.offset = PCI_CONF_COMM;
+ cfg_prg.offset = 0;
cfg_prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_4 + PCITOOL_ACC_ATTR_ENDN_LTL;
if (ioctl(fd, PCITOOL_DEVICE_GET_REG, &cfg_prg) != SUCCESS) {
@@ -484,7 +483,15 @@ supports_ari(int fd, uint8_t bus_no)
}
data = (uint32_t)cfg_prg.data;
+ if (data == (uint32_t)(-1))
+ return (FAILURE);
+ cfg_prg.offset = PCI_CONF_COMM;
+ if (ioctl(fd, PCITOOL_DEVICE_GET_REG, &cfg_prg) != SUCCESS) {
+ return (FAILURE);
+ }
+
+ data = (uint32_t)cfg_prg.data;
if (!((data >> 16) & PCI_STAT_CAP))
return (FAILURE);