.. | .. |
---|
10 | 10 | * Author: Ryan Wilson <hap9@epoch.ncsc.mil> |
---|
11 | 11 | */ |
---|
12 | 12 | |
---|
| 13 | +#define dev_fmt(fmt) DRV_NAME ": " fmt |
---|
| 14 | + |
---|
13 | 15 | #include <linux/kernel.h> |
---|
14 | 16 | #include <linux/moduleparam.h> |
---|
15 | 17 | #include <linux/pci.h> |
---|
.. | .. |
---|
154 | 156 | * (as if device didn't respond) */ |
---|
155 | 157 | u32 value = 0, tmp_val; |
---|
156 | 158 | |
---|
157 | | - if (unlikely(verbose_request)) |
---|
158 | | - printk(KERN_DEBUG DRV_NAME ": %s: read %d bytes at 0x%x\n", |
---|
159 | | - pci_name(dev), size, offset); |
---|
| 159 | + dev_dbg(&dev->dev, "read %d bytes at 0x%x\n", size, offset); |
---|
160 | 160 | |
---|
161 | 161 | if (!valid_request(offset, size)) { |
---|
162 | 162 | err = XEN_PCI_ERR_invalid_offset; |
---|
.. | .. |
---|
195 | 195 | } |
---|
196 | 196 | |
---|
197 | 197 | out: |
---|
198 | | - if (unlikely(verbose_request)) |
---|
199 | | - printk(KERN_DEBUG DRV_NAME ": %s: read %d bytes at 0x%x = %x\n", |
---|
200 | | - pci_name(dev), size, offset, value); |
---|
| 198 | + dev_dbg(&dev->dev, "read %d bytes at 0x%x = %x\n", size, offset, value); |
---|
201 | 199 | |
---|
202 | 200 | *ret_val = value; |
---|
203 | 201 | return xen_pcibios_err_to_errno(err); |
---|
.. | .. |
---|
212 | 210 | u32 tmp_val; |
---|
213 | 211 | int field_start, field_end; |
---|
214 | 212 | |
---|
215 | | - if (unlikely(verbose_request)) |
---|
216 | | - printk(KERN_DEBUG |
---|
217 | | - DRV_NAME ": %s: write request %d bytes at 0x%x = %x\n", |
---|
218 | | - pci_name(dev), size, offset, value); |
---|
| 213 | + dev_dbg(&dev->dev, "write request %d bytes at 0x%x = %x\n", |
---|
| 214 | + size, offset, value); |
---|
219 | 215 | |
---|
220 | 216 | if (!valid_request(offset, size)) |
---|
221 | 217 | return XEN_PCI_ERR_invalid_offset; |
---|
.. | .. |
---|
286 | 282 | return xen_pcibios_err_to_errno(err); |
---|
287 | 283 | } |
---|
288 | 284 | |
---|
| 285 | +int xen_pcibk_get_interrupt_type(struct pci_dev *dev) |
---|
| 286 | +{ |
---|
| 287 | + int err; |
---|
| 288 | + u16 val; |
---|
| 289 | + int ret = 0; |
---|
| 290 | + |
---|
| 291 | + err = pci_read_config_word(dev, PCI_COMMAND, &val); |
---|
| 292 | + if (err) |
---|
| 293 | + return err; |
---|
| 294 | + if (!(val & PCI_COMMAND_INTX_DISABLE)) |
---|
| 295 | + ret |= INTERRUPT_TYPE_INTX; |
---|
| 296 | + |
---|
| 297 | + /* |
---|
| 298 | + * Do not trust dev->msi(x)_enabled here, as enabling could be done |
---|
| 299 | + * bypassing the pci_*msi* functions, by the qemu. |
---|
| 300 | + */ |
---|
| 301 | + if (dev->msi_cap) { |
---|
| 302 | + err = pci_read_config_word(dev, |
---|
| 303 | + dev->msi_cap + PCI_MSI_FLAGS, |
---|
| 304 | + &val); |
---|
| 305 | + if (err) |
---|
| 306 | + return err; |
---|
| 307 | + if (val & PCI_MSI_FLAGS_ENABLE) |
---|
| 308 | + ret |= INTERRUPT_TYPE_MSI; |
---|
| 309 | + } |
---|
| 310 | + if (dev->msix_cap) { |
---|
| 311 | + err = pci_read_config_word(dev, |
---|
| 312 | + dev->msix_cap + PCI_MSIX_FLAGS, |
---|
| 313 | + &val); |
---|
| 314 | + if (err) |
---|
| 315 | + return err; |
---|
| 316 | + if (val & PCI_MSIX_FLAGS_ENABLE) |
---|
| 317 | + ret |= INTERRUPT_TYPE_MSIX; |
---|
| 318 | + } |
---|
| 319 | + return ret ?: INTERRUPT_TYPE_NONE; |
---|
| 320 | +} |
---|
| 321 | + |
---|
289 | 322 | void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev) |
---|
290 | 323 | { |
---|
291 | 324 | struct xen_pcibk_dev_data *dev_data = pci_get_drvdata(dev); |
---|