From: Keir Fraser Date: Fri, 10 Oct 2008 10:52:26 +0000 (+0100) Subject: xend: Restore bridge control register after secondary bus reset X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14089 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d0fedc88955a0a43dae501be5aa8bc8201d1b82b;p=xen.git xend: Restore bridge control register after secondary bus reset From: Chris Dalton Signed-off-by: Keir Fraser --- 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)