hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/pci/access.c
....@@ -33,7 +33,7 @@
3333 #endif
3434
3535 #define PCI_OP_READ(size, type, len) \
36
-int pci_bus_read_config_##size \
36
+int noinline pci_bus_read_config_##size \
3737 (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
3838 { \
3939 int res; \
....@@ -48,7 +48,7 @@
4848 }
4949
5050 #define PCI_OP_WRITE(size, type, len) \
51
-int pci_bus_write_config_##size \
51
+int noinline pci_bus_write_config_##size \
5252 (struct pci_bus *bus, unsigned int devfn, int pos, type value) \
5353 { \
5454 int res; \
....@@ -332,15 +332,6 @@
332332 return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS;
333333 }
334334
335
-static bool pcie_downstream_port(const struct pci_dev *dev)
336
-{
337
- int type = pci_pcie_type(dev);
338
-
339
- return type == PCI_EXP_TYPE_ROOT_PORT ||
340
- type == PCI_EXP_TYPE_DOWNSTREAM ||
341
- type == PCI_EXP_TYPE_PCIE_BRIDGE;
342
-}
343
-
344335 bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
345336 {
346337 int type = pci_pcie_type(dev);
....@@ -360,7 +351,7 @@
360351 pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT;
361352 }
362353
363
-static inline bool pcie_cap_has_rtctl(const struct pci_dev *dev)
354
+bool pcie_cap_has_rtctl(const struct pci_dev *dev)
364355 {
365356 int type = pci_pcie_type(dev);
366357
....@@ -414,7 +405,7 @@
414405
415406 *val = 0;
416407 if (pos & 1)
417
- return -EINVAL;
408
+ return PCIBIOS_BAD_REGISTER_NUMBER;
418409
419410 if (pcie_capability_reg_implemented(dev, pos)) {
420411 ret = pci_read_config_word(dev, pci_pcie_cap(dev) + pos, val);
....@@ -449,7 +440,7 @@
449440
450441 *val = 0;
451442 if (pos & 3)
452
- return -EINVAL;
443
+ return PCIBIOS_BAD_REGISTER_NUMBER;
453444
454445 if (pcie_capability_reg_implemented(dev, pos)) {
455446 ret = pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, val);
....@@ -474,7 +465,7 @@
474465 int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val)
475466 {
476467 if (pos & 1)
477
- return -EINVAL;
468
+ return PCIBIOS_BAD_REGISTER_NUMBER;
478469
479470 if (!pcie_capability_reg_implemented(dev, pos))
480471 return 0;
....@@ -486,7 +477,7 @@
486477 int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val)
487478 {
488479 if (pos & 3)
489
- return -EINVAL;
480
+ return PCIBIOS_BAD_REGISTER_NUMBER;
490481
491482 if (!pcie_capability_reg_implemented(dev, pos))
492483 return 0;