Changeset 732 for GPL/branches/uniaud32-next/lib32/pci.c
- Timestamp:
- Sep 11, 2022, 3:09:04 AM (3 years ago)
- File:
-
- 1 edited
-
GPL/branches/uniaud32-next/lib32/pci.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/lib32/pci.c
r730 r732 1156 1156 } 1157 1157 EXPORT_SYMBOL(__devm_request_region); 1158 1159 /* 1160 * Managed PCI resources. This manages device on/off, INTx/MSI/MSI-X 1161 * on/off and BAR regions. pci_dev itself records MSI/MSI-X status, so 1162 * there's no need to track it separately. pci_devres is initialized 1163 * when a device is enabled using managed PCI device enable interface. 1164 */ 1165 struct pci_devres { 1166 unsigned int enabled:1; 1167 unsigned int pinned:1; 1168 unsigned int orig_intx:1; 1169 unsigned int restore_intx:1; 1170 unsigned int mwi:1; 1171 u32 region_mask; 1172 }; 1173 1174 static void pcim_release(struct device *gendev, void *res) 1175 { 1176 } 1177 1178 static struct pci_devres *find_pci_dr(struct pci_dev *pdev) 1179 { 1180 if (pci_is_managed(pdev)) 1181 return devres_find(&pdev->dev, pcim_release, NULL, NULL); 1182 return NULL; 1183 } 1184 1185 /** 1186 * pci_intx - enables/disables PCI INTx for device dev 1187 * @pdev: the PCI device to operate on 1188 * @enable: boolean: whether to enable or disable PCI INTx 1189 * 1190 * Enables/disables PCI INTx for device @pdev 1191 */ 1192 void pci_intx(struct pci_dev *pdev, int enable) 1193 { 1194 u16 pci_command, new; 1195 1196 pci_read_config_word(pdev, PCI_COMMAND, &pci_command); 1197 1198 if (enable) 1199 new = pci_command & ~PCI_COMMAND_INTX_DISABLE; 1200 else 1201 new = pci_command | PCI_COMMAND_INTX_DISABLE; 1202 1203 if (new != pci_command) { 1204 struct pci_devres *dr; 1205 1206 pci_write_config_word(pdev, PCI_COMMAND, new); 1207 1208 dr = find_pci_dr(pdev); 1209 if (dr && !dr->restore_intx) { 1210 dr->restore_intx = 1; 1211 dr->orig_intx = !enable; 1212 } 1213 } 1214 } 1215 EXPORT_SYMBOL_GPL(pci_intx);
Note:
See TracChangeset
for help on using the changeset viewer.
