summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/sunpci.c
diff options
context:
space:
mode:
authoryf149591 <none@none>2008-07-22 22:15:01 -0700
committeryf149591 <none@none>2008-07-22 22:15:01 -0700
commitc602bc24e8d76a3d7cbd977c2a8fdc21c0aa019e (patch)
treeec0b23d4722d0236f884df2a2316974cc61e356c /usr/src/uts/common/os/sunpci.c
parentc971fb7ec0a19c6cd00c5614a94c97f953b6e8b1 (diff)
downloadillumos-joyent-c602bc24e8d76a3d7cbd977c2a8fdc21c0aa019e.tar.gz
6533720 system hung after print out "pci_save_config_regs ata:2"
Diffstat (limited to 'usr/src/uts/common/os/sunpci.c')
-rw-r--r--usr/src/uts/common/os/sunpci.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/usr/src/uts/common/os/sunpci.c b/usr/src/uts/common/os/sunpci.c
index 4eb3ad7491..e5689e5046 100644
--- a/usr/src/uts/common/os/sunpci.c
+++ b/usr/src/uts/common/os/sunpci.c
@@ -335,6 +335,8 @@ pci_save_config_regs(dev_info_t *dip)
off_t offset = 0;
uint8_t cap_ptr, cap_id;
int pcie = 0;
+ uint16_t status;
+
PMD(PMD_SX, ("pci_save_config_regs %s:%d\n", ddi_driver_name(dip),
ddi_get_instance(dip)))
@@ -344,6 +346,14 @@ pci_save_config_regs(dev_info_t *dip)
return (DDI_FAILURE);
}
+
+ /*
+ * Determine if it implements capabilities
+ */
+ status = pci_config_get16(confhdl, PCI_CONF_STAT);
+ if (!(status & 0x10)) {
+ goto no_cap;
+ }
/*
* Determine if it is a pci express device. If it is, save entire
* 4k config space treating it as a array of 32 bit integers.
@@ -363,7 +373,7 @@ pci_save_config_regs(dev_info_t *dip)
cap_ptr = pci_config_get8(confhdl,
cap_ptr + PCI_CAP_NEXT_PTR);
}
-
+no_cap:
if (pcie) {
/* PCI express device. Can have data in all 4k space */
regbuf = (uint32_t *)kmem_zalloc((size_t)PCIE_CONF_HDR_SIZE,
@@ -501,11 +511,20 @@ cap_walk_and_save(ddi_acc_handle_t confhdl, uint32_t *regbuf,
pci_cap_save_desc_t *cap_descp, uint32_t *ncapsp, int xspace)
{
pci_cap_entry_t *pci_cap_entp;
- uint16_t cap_id, offset;
+ uint16_t cap_id, offset, status;
uint32_t words_saved = 0, nwords = 0;
uint16_t cap_ptr = PCI_CAP_NEXT_PTR_NULL;
*ncapsp = 0;
+
+ /*
+ * Determine if it implements capabilities
+ */
+ status = pci_config_get16(confhdl, PCI_CONF_STAT);
+ if (!(status & 0x10)) {
+ return (words_saved);
+ }
+
if (!xspace)
cap_ptr = pci_config_get8(confhdl, PCI_BCNF_CAP_PTR);
/*