Lines Matching refs:dev

124 static bool memory_decoded(const struct pci_dev *dev)  in memory_decoded()  argument
128 if ( !dev->info.is_virtfn ) in memory_decoded()
130 bus = dev->bus; in memory_decoded()
131 slot = PCI_SLOT(dev->devfn); in memory_decoded()
132 func = PCI_FUNC(dev->devfn); in memory_decoded()
136 bus = dev->info.physfn.bus; in memory_decoded()
137 slot = PCI_SLOT(dev->info.physfn.devfn); in memory_decoded()
138 func = PCI_FUNC(dev->info.physfn.devfn); in memory_decoded()
141 return !!(pci_conf_read16(dev->seg, bus, slot, func, PCI_COMMAND) & in memory_decoded()
145 static bool msix_memory_decoded(const struct pci_dev *dev, unsigned int pos) in msix_memory_decoded() argument
147 u16 control = pci_conf_read16(dev->seg, dev->bus, PCI_SLOT(dev->devfn), in msix_memory_decoded()
148 PCI_FUNC(dev->devfn), msix_control_reg(pos)); in msix_memory_decoded()
153 return memory_decoded(dev); in msix_memory_decoded()
200 struct pci_dev *dev = entry->dev; in read_msi_msg() local
202 u16 data, seg = dev->seg; in read_msi_msg()
203 u8 bus = dev->bus; in read_msi_msg()
204 u8 slot = PCI_SLOT(dev->devfn); in read_msi_msg()
205 u8 func = PCI_FUNC(dev->devfn); in read_msi_msg()
229 if ( unlikely(!msix_memory_decoded(entry->dev, in read_msi_msg()
265 struct pci_dev *dev = entry->dev; in write_msi_msg() local
267 u16 seg = dev->seg; in write_msi_msg()
268 u8 bus = dev->bus; in write_msi_msg()
269 u8 slot = PCI_SLOT(dev->devfn); in write_msi_msg()
270 u8 func = PCI_FUNC(dev->devfn); in write_msi_msg()
295 if ( unlikely(!msix_memory_decoded(entry->dev, in write_msi_msg()
347 static void msi_set_enable(struct pci_dev *dev, int enable) in msi_set_enable() argument
350 u16 seg = dev->seg; in msi_set_enable()
351 u8 bus = dev->bus; in msi_set_enable()
352 u8 slot = PCI_SLOT(dev->devfn); in msi_set_enable()
353 u8 func = PCI_FUNC(dev->devfn); in msi_set_enable()
360 static void msix_set_enable(struct pci_dev *dev, int enable) in msix_set_enable() argument
363 u16 control, seg = dev->seg; in msix_set_enable()
364 u8 bus = dev->bus; in msix_set_enable()
365 u8 slot = PCI_SLOT(dev->devfn); in msix_set_enable()
366 u8 func = PCI_FUNC(dev->devfn); in msix_set_enable()
395 BUG_ON(!entry || !entry->dev); in msi_set_mask_bit()
396 pdev = entry->dev; in msi_set_mask_bit()
470 if ( !entry->dev ) in msi_get_mask_bit()
478 return (pci_conf_read32(entry->dev->seg, entry->dev->bus, in msi_get_mask_bit()
479 PCI_SLOT(entry->dev->devfn), in msi_get_mask_bit()
480 PCI_FUNC(entry->dev->devfn), in msi_get_mask_bit()
484 if ( unlikely(!msix_memory_decoded(entry->dev, in msi_get_mask_bit()
578 entry[nr].dev = NULL; in alloc_msi_entry()
590 const struct pci_dev *pdev = msidesc->dev; in setup_msi_irq()
652 msix_put_fixmap(entry->dev->msix, in msi_free_irq()
660 static struct msi_desc *find_msi_entry(struct pci_dev *dev, in find_msi_entry() argument
665 list_for_each_entry( entry, &dev->msi_list, list ) in find_msi_entry()
684 static int msi_capability_init(struct pci_dev *dev, in msi_capability_init() argument
692 u16 control, seg = dev->seg; in msi_capability_init()
693 u8 bus = dev->bus; in msi_capability_init()
694 u8 slot = PCI_SLOT(dev->devfn); in msi_capability_init()
695 u8 func = PCI_FUNC(dev->devfn); in msi_capability_init()
709 msi_set_enable(dev, 0); /* Ensure msi is disabled as I set it up */ in msi_capability_init()
728 entry[i].dev = dev; in msi_capability_init()
741 list_add_tail(&entry->list, &dev->msi_list); in msi_capability_init()
836 static int msix_capability_init(struct pci_dev *dev, in msix_capability_init() argument
842 struct arch_msix *msix = dev->msix; in msix_capability_init()
849 u16 seg = dev->seg; in msix_capability_init()
850 u8 bus = dev->bus; in msix_capability_init()
851 u8 slot = PCI_SLOT(dev->devfn); in msix_capability_init()
852 u8 func = PCI_FUNC(dev->devfn); in msix_capability_init()
869 if ( unlikely(!memory_decoded(dev)) ) in msix_capability_init()
894 if ( !dev->info.is_virtfn ) in msix_capability_init()
903 pbus = dev->info.physfn.bus; in msix_capability_init()
904 pslot = PCI_SLOT(dev->info.physfn.devfn); in msix_capability_init()
905 pfunc = PCI_FUNC(dev->info.physfn.devfn); in msix_capability_init()
906 vf = PCI_BDF2(dev->bus, dev->devfn); in msix_capability_init()
977 entry->dev = dev; in msix_capability_init()
980 list_add_tail(&entry->list, &dev->msi_list); in msix_capability_init()
1002 struct domain *d = dev->domain ?: currd; in msix_capability_init()
1072 struct pci_dev *dev; in __pci_disable_msi() local
1074 dev = entry->dev; in __pci_disable_msi()
1075 msi_set_enable(dev, 0); in __pci_disable_msi()
1077 BUG_ON(list_empty(&dev->msi_list)); in __pci_disable_msi()
1152 struct pci_dev *dev = entry->dev; in __pci_disable_msix() local
1153 u16 seg = dev->seg; in __pci_disable_msix()
1154 u8 bus = dev->bus; in __pci_disable_msix()
1155 u8 slot = PCI_SLOT(dev->devfn); in __pci_disable_msix()
1156 u8 func = PCI_FUNC(dev->devfn); in __pci_disable_msix()
1161 bool maskall = dev->msix->host_maskall; in __pci_disable_msix()
1165 dev->msix->host_maskall = 1; in __pci_disable_msix()
1171 BUG_ON(list_empty(&dev->msi_list)); in __pci_disable_msix()
1173 if ( likely(memory_decoded(dev)) ) in __pci_disable_msix()
1179 entry->irq, dev->seg, dev->bus, in __pci_disable_msix()
1180 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); in __pci_disable_msix()
1183 dev->msix->host_maskall = maskall; in __pci_disable_msix()
1184 if ( maskall || dev->msix->guest_maskall ) in __pci_disable_msix()
1188 _pci_cleanup_msix(dev->msix); in __pci_disable_msix()
1255 static void msi_free_irqs(struct pci_dev* dev) in msi_free_irqs() argument
1259 list_for_each_entry_safe( entry, tmp, &dev->msi_list, list ) in msi_free_irqs()