34 #include <linux/errno.h>
35 #include <linux/pci.h>
37 #include <linux/slab.h>
55 #define MLX4_RESET_BASE 0xf0000
56 #define MLX4_RESET_SIZE 0x400
57 #define MLX4_SEM_OFFSET 0x3fc
58 #define MLX4_RESET_OFFSET 0x10
59 #define MLX4_RESET_VALUE swab32(1)
61 #define MLX4_SEM_TIMEOUT_JIFFIES (10 * HZ)
62 #define MLX4_RESET_TIMEOUT_JIFFIES (2 * HZ)
75 mlx4_err(dev,
"Couldn't allocate memory to save HCA "
76 "PCI header, aborting.\n");
80 pcie_cap = pci_pcie_cap(dev->
pdev);
82 for (i = 0; i < 64; ++
i) {
83 if (i == 22 || i == 23)
85 if (pci_read_config_dword(dev->
pdev, i * 4, hca_header + i)) {
88 "PCI header, aborting.\n");
97 mlx4_err(dev,
"Couldn't map HCA reset register, aborting.\n");
112 mlx4_err(dev,
"Failed to obtain HW semaphore, aborting\n");
134 if (vendor == 0xffff) {
136 mlx4_err(dev,
"PCI device did not come back after reset, "
147 mlx4_err(dev,
"Couldn't restore HCA PCI Express "
148 "Device Control register, aborting.\n");
155 mlx4_err(dev,
"Couldn't restore HCA PCI Express "
156 "Link control register, aborting.\n");
161 for (i = 0; i < 16; ++
i) {
165 if (pci_write_config_dword(dev->
pdev, i * 4, hca_header[i])) {
167 mlx4_err(dev,
"Couldn't restore HCA reg %x, "
176 mlx4_err(dev,
"Couldn't restore HCA COMMAND, "