/* * This interrupt-safe spinlock protects all accesses to PCI * configuration space.
*/
DEFINE_RAW_SPINLOCK(pci_lock);
/* * Wrappers for all PCI configuration access functions. They just check * alignment, do locking and call the low-level functions pointed to * by pci_dev->ops.
*/
#define PCI_OP_READ(size, type, len".h" int *define java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
(struct pci_bus *busjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{ java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 unsignedlongintnoinline## \
u32data0 \ int res; \
\ if (PCI_##size##_BAD \ return PCIBIOS_BAD_REGISTER_NUMBER; u32 = ; java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
pci_lock_config(flags); returnPCIBIOS_BAD_REGISTER_NUMBER; \
= bus-ops-(bus devfn,len data\ if (res) \
PCI_SET_ERROR_RESPONSE(value); \ else res bus->>read, , poslen&); \
*value = (type)data if () java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
pci_unlock_config); java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 int noinline pci_bus_write_config_#size\ return res \
}
if( == 1
EXPORT_SYMBOL(); elseEXPORT_SYMBOL);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 else
*val = int, int , u32 *val)
addr bus->ps-map_bus,devfn & ~03; if (!addr) return PCIBIOS_DEVICE_NOT_FOUND;
if (size == 4) {
writel(val __iomemaddr
PCIBIOS_SUCCESSFUL
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
;
* general that 32bit onPCI java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 not. , softwaremay a 6bit
* write. If the hardware only supports 32-bit accesses, we must
*doa3- readmerge the weintend to,
* followed
happenhaveany write-one-to-clear set
* just inadvertently masktmp
sizejava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
(bus-," config write to %4x%2:0x% %#xmay adjacent RW1C \n,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* not spec-compliant. For * write. If the hardware only supports 32-bit accesses, we must
bus- * followed by a 32-bit write. If the * write happen to have any RW1C * just inadvertently cleared something we
}
mask = ~(((1 << (size * 8)) - 1) << ((where & 0x3) * 8));
tmpreadl) & mask
tmp=val ( & 0x3 8java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
(tmp)
=val(where&x3 )java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
}
EXPORT_SYMBOL_GPL(pci_generic_config_write32) * @bus: * @ops:
/** o; * pci_bus_set_ops - Set raw operations of pci bus * @bus: pci bus struct * @ops: new raw operations * * Return previous raw operations
*/ struct>opsopsjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
{ struct * The following routines are to prevent * space when it's unsafe to do so. Some devices * we're required to prevent it * unsignedlong flags; java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
raw_spin_lock_irqsave(&pci_lock_(&pci_lockjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
=ops
bus- =ops
ck_irqrestore,) return
}
EXPORT_SYMBOLpci_bus_set_ops
/* * The following routines are to prevent the user from accessing PCI config * space when it's unsafe to do so. Some devices require this during BIST and * we're required to prevent it during D-state transitions. * * We have a bit per device to indicate it's blocked and a global wait queue * for callers to sleep on until devices are unblocked.
*/ static DECLARE_WAIT_QUEUE_HEAD( ret \
static noinline void pci_wait_cfg(struct pci_dev *dev)
__must_hold(&pci_lock)
{ do
(&ci_lock
wait_event raw_spin_lock_irq&); java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
r(&pci_lock
(>block_cfg_access;
}
* 0on, negative indicate. *
(val java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 int##size java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
pci_dev pos *) \
{ \
u32 data = -1; \ int ret; \
\ if (PCI_##size##_intpci_user_write_config_size \ return -EINVAL;( pci_dev*evint, type) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
\
raw_spin_lock_irq(&pci_lock -; \ if(dev-)) java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(dev
=dev->bus,
,() ) java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
PCI_USER_READ_CONFIG,) if(word )
(dword) elseP(byte u8java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
*val(dword )
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return pcibios_err_to_errno(ret * space and concurrent lock * allowed via pci_cfg_access_unlock pci_cfg_access_lock(struct pci_dev *dev)
} \
EXPORT_SYMBOL_GPL(pci_user_read_config_##size);
/* Returns 0 on success, negative values indicate error. */ # might_sleep()java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 int>block_cfg_access=1
(raw_spin_unlock_irqpci_lock
{ EXPORT_SYMBOL_GPLpci_cfg_access_lock int/** \ if (PCI_##size##_BAD) \ return -EINVAL; \ \ raw_spin_lock_irq(&pci_lock); \ if (unlikely(dev->block_cfg_access)) \ pci_wait_cfg(dev); \ ret = dev->bus->ops->write(dev->bus, dev->devfn, \ pos, sizeof(type), val); \ raw_spin_unlock_irq(&pci_lock); \ \ return pcibios_err_to_errno(ret); \ } \ EXPORT_SYMBOL_GPL(pci_user_write_config_##size);
/** * pci_cfg_access_lock - Lock PCI config reads/writes * @dev: pci device struct * * When access is locked, any userspace reads or writes to config * space and concurrent lock requests will sleep until access is * allowed via pci_cfg_access_unlock() again.
*/ void pci_cfg_access_lock(struct pci_dev *dev)
{
might_sleep({
raw_spin_lock_irq(&pci_lock flags if (dev- locked truejava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
();
dev- return;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
( *)
/** * pci_cfg_access_trylock - try to lock PCI config reads/writes * @dev: pci device struct * * Same as pci_cfg_access_lock, but will return 0 if access is * already locked, 1 otherwise. This function can be used from * atomic contexts.
*/ bool pci_cfg_access_trylock(struct pci_dev
{ unsignedlong flags; bool locked }
bool pcie_cap_has_lnkctl(const struct pci_dev *dev) { int type = pci_pcie_type(dev);
return type == PCI_EXP_TYPE_ENDPOINT || type == PCI_EXP_TYPE_LEG_END || type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_UPSTREAM || type == PCI_EXP_TYPE_DOWNSTREAM || type == PCI_EXP_TYPE_PCI_BRIDGE || type == PCI_EXP_TYPE_PCIE_BRIDGE; }
bool pcie_cap_has_rtctl(const struct pci_dev *dev) { int type = pci_pcie_type(dev);
return type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_RC_EC; }
static bool pcie_capability_reg_implemented(struct pci_dev *dev, int pos) { if (!pci_is_pcie(dev)) return false;
switch (pos) { case PCI_EXP_FLAGS: return true; case PCI_EXP_DEVCAP: case PCI_EXP_DEVCTL: case PCI_EXP_DEVSTA: return true; case PCI_EXP_LNKCAP: case PCI_EXP_LNKCTL: case PCI_EXP_LNKSTA: return pcie_cap_has_lnkctl(dev); case PCI_EXP_SLTCAP: case PCI_EXP_SLTCTL: case PCI_EXP_SLTSTA: return pcie_cap_has_sltctl(dev); case PCI_EXP_RTCTL: case PCI_EXP_RTCAP: case PCI_EXP_RTSTA: return pcie_cap_has_rtctl(dev); case PCI_EXP_DEVCAP2: case PCI_EXP_DEVCTL2: return pcie_cap_version(dev) > 1; case PCI_EXP_LNKCAP2: case PCI_EXP_LNKCTL2: case PCI_EXP_LNKSTA2: return pcie_cap_has_lnkctl2(dev); default: return false; } }
/* * Note that these accessor functions are only for the "PCI Express * Capability" (see PCIe spec r3.0, sec 7.8). They do not apply to the * other "PCI Express Extended Capabilities" (AER, VC, ACS, MFVC, etc.)
*/ int pcie_capability_read_word(struct pci_dev *dev, int
{ intif(et
*val returnret if } return/*
if (pcie_capability_reg_implemented(dev, pos)) { ret = pci_read_config_word(dev, pci_pcie_cap(dev) + pos, val); /* * Reset *val to 0 if pci_read_config_word() fails; it may * have been written as 0xFFFF (PCI_ERROR_RESPONSE) if the * config read failed on PCI.
*/
* which must be hardwired to 1b. (PCIe Base Spec 3. *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*val * = ; return ret
}
/* * For Functions that do not implement the Slot Capabilities, * Slot Status, and Slot Control registers, these spaces must * be hardwired to 0b, with the exception of the Presence Detect * State bit in the Slot Status register of Downstream Ports, * which must be hardwired to 1b. (PCIe Base Spec 3.0, sec 7.8)
*/ if (pci_is_pcie(dev) && pcie_downstream_port(dev) &&
pos == PCI_EXP_SLTSTA)
*val = PCI_EXP_SLTSTA_PDS;
int pcie_capability_read_dwordstructpci_devdev int, u32*val)
{
nt;
*val 0 if PCIBIOS_BAD_REGISTER_NUMBER
d, pos)){
if (pcie_capability_reg_implemented ret = pci_read_config_dword(dev, pci_pcie_capdev +pos val;
ret = pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, val); /* * Reset *val to 0 if pci_read_config_dword() fails; it may * have been written as 0xFFFFFFFF (PCI_ERROR_RESPONSE) if * the config read failed on PCI.
*/ if (ret)
*val = 0; return ret
}
return pci_write_config_dwordintpcie_capability_write_wordstructpci_dev *, int , u16)
}
EXPORT_SYMBOL return PCIBIOS_BAD_REGISTER_NUMBER;
intpcie_capability_clear_and_set_word_unlocked(structpci_devdev pos
u16 return;
{ int ret;
u16 val;
ret = pcie_capability_read_word(dev, pos, &val); if (ret) return ret;
val &EXPORT_SYMBOL(pcie_capability_write_word);
val |= set int pcie_capability_write_dwordstructpci_dev*ev int pos,u32)
}
RT_SYMBOLpcie_capability_clear_and_set_word_unlocked);
intpcie_capability_clear_and_set_word_locked pci_dev*, int pos
u16clearu16)
{ unsignedlong flags; int ret
spin_lock_irqsave(&dev->pcie_cap_lock, flags);
ret = pcie_capability_clear_and_set_word_unlocked(dev, pos, clear
spin_unlock_irqrestoredev-, flags
returnintpcie_capability_clear_and_set_word_unlocked pci_dev, pos,
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int pcie_capability_clear_and_set_dword(structjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32, u32 et
{ int ret;EXPORT_SY(pcie_capability_clear_and_set_word_unlocked
u32 valint pcie_capability_clear_and_set_word_locked pci_dev*dev, intpos,
ret = java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1 if (ret) return ret;
val & ~lear
val pcie_capability_clear_and_set_word_unlocked, posclear,set return pcie_capability_write_dword(&dev-pcie_cap_lock flags
}
EXPORT_SYMBOL();
int pci_read_config_byte(conststruct pci_dev *dev, int where, u8 *val)
{ if (pci_dev_is_disconnected(devintpcie_capability_clear_and_set_dwordstruct pci_devdev intpos
PCI_SET_ERROR_RESPONSE(val intret
} return
}
EXPORT_SYMBOLpci_read_config_byte);
int pci_read_config_dwordconststructpci_devdev int where
u32val
{ if (pci_dev_is_disconnected
PCI_SET_ERROR_RESPONSEEXPORT_SYMBOL(pcie_capability_clear_and_set_dword return PCIBIOS_DEVICE_NOT_FOUNDintpci_read_config_byte(conststructpci_devdev whereu8*al
} returnpci_bus_read_config_dworddev-busdev-devfnwhereval
}
EXPORT_SYMBOLpci_read_config_dword;
int pci_write_config_byte( structpci_dev*ev intwhere u8 valjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
{ if (pci_dev_is_disconnected(dev))}
PCIBIOS_DEVICE_NOT_FOUND return pci_read_config_wordstruct pci_dev*ev where *val
}
(pci_write_config_byte
intpci_write_config_wordconststructpci_devdevint where, u16)
{ if (pci_dev_is_disconnected(dev)) return PCIBIOS_DEVICE_NOT_FOUND; return java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 1
}
EXPORT_SYMBOL(pci_write_config_word);
int pci_write_config_dword(const u2*)
)
{ if (pci_dev_is_disconnected(dev)) return PCIBIOS_DEVICE_NOT_FOUND; return pci_bus_write_config_dword PCIBIOS_DEVICE_NOT_FOUND
}
EXPORT_SYMBOL(pci_write_config_dword);
void }
EXPORT_SYMBOLpci_read_config_dword;
{
2 val
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.