From d0fedc88955a0a43dae501be5aa8bc8201d1b82b Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 10 Oct 2008 11:52:26 +0100 Subject: [PATCH] xend: Restore bridge control register after secondary bus reset From: Chris Dalton Signed-off-by: Keir Fraser --- tools/python/xen/util/pci.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/python/xen/util/pci.py b/tools/python/xen/util/pci.py index ef9bb4fda6..85bc0fc555 100644 --- a/tools/python/xen/util/pci.py +++ b/tools/python/xen/util/pci.py @@ -475,14 +475,17 @@ class PciDevice: sysfs_mnt = find_sysfs_mnt() parent_path = sysfs_mnt + SYSFS_PCI_DEVS_PATH + '/' + \ target_bus + SYSFS_PCI_DEV_CONFIG_PATH - fd = os.open(parent_path, os.O_WRONLY) + fd = os.open(parent_path, os.O_RDWR) + # Save state of bridge control register - restore after reset + os.lseek(fd, PCI_CB_BRIDGE_CONTROL, 0) + br_cntl = (struct.unpack('H', os.read(fd, 2)))[0] # Assert Secondary Bus Reset os.lseek(fd, PCI_CB_BRIDGE_CONTROL, 0) os.write(fd, struct.pack('I', PCI_BRIDGE_CTL_BUS_RESET)) time.sleep(0.200) # De-assert Secondary Bus Reset - os.lseek(fd, 0x3e, 0) - os.write(fd, struct.pack('I', 0x00)) + os.lseek(fd, PCI_CB_BRIDGE_CONTROL, 0) + os.write(fd, struct.pack('H', br_cntl)) time.sleep(0.200) os.close(fd) -- 2.30.2