PCIe Registers¶
Machinery for defining registers for the PCIe capability structures and configuration space.
- class bakeneko.types.configuration.registers.PCIOnlyField(description: str = '', *, default: Any = 0, length=1)¶
PCI Only Field
This field only has meaning for PCI and PCI-X devices, but due to the backwards compatibility is also present in the PCIe registers and control structures.
- class bakeneko.types.configuration.registers.RegisterField(type: RegisterType, description: str, *, default: Any | None = None, length: int | None = None) None¶
PCIe Register Field
This is a wrapper
construct.Subconstructto allow for some metadata and automatic type deduction to be preformed based on the field name.By default PCIe register fields don’t have any type prefixing in their name, however this class allows for names with a prefix to automatically set the size and type.
The following table lists the field name prefixes and their type information:
Prefix
Type
u8lconstruct.Int8ulu16lconstruct.Int16ulu24lconstruct.Int24ulu32lconstruct.Int32ulu64lconstruct.Int64uls8lconstruct.Int8sls16lconstruct.Int16sls24lconstruct.Int24sls32lconstruct.Int32sls64lconstruct.Int64slu8bconstruct.Int8ubu16bconstruct.Int16ubu24bconstruct.Int24ubu32bconstruct.Int32ubu64bconstruct.Int64ubs8bconstruct.Int8sbs16bconstruct.Int16sbs24bconstruct.Int24bls32bconstruct.Int32sbs64bconstruct.Int64sbb#construct.BitsIntegerAn example prefixed field name would be
u8lAllocLenwhich would define an unsigned eight-bit unsigned little-endian integer calledAllocLen.However, if the
lengthargument is passed, that will override the prefix calculated by the name if any is present.- Parameters:
type (RegisterType) – The type of this Register field.
description (str) – The description of this field.
- Keyword Arguments:
default (Any) – The default value for this field if any.
length (int) – The length of the field in bits.
- class bakeneko.types.configuration.registers.RegisterType(value)¶
Describes the type of the PCIe register/field and how it behaves.
- HWINIT = 1¶
Hardware Initialized Register/Field
Bits are initialized by firmware or hardware such as pin strapping or EEPROM values.
Values are read-only after initialization, and can only be reset with a fundamental bus reset.
- RO = 2¶
Read-Only Register/Field
Bits are read-only and can not be altered by software, and may be set via pin strapping or EEPROM initialization.
- RW = 3¶
Read/Write Register/Field
Bits are read/write and may be set or cleared by software to the desired state.
- RW1C = 4¶
Read-Only Status, Write 1 to clear
Bits indicate some status when read, and status is reset/cleared when writing a 1 value to the register/field. Writing a 0 has no effect.
- ROS = 5¶
Read-Only, Sticky
Bits are read-only and can not be altered by software, they are not initialized or modified by a hot reset.
If noted, devices that consume auxiliary power must preserve sticky register values when auxiliary power is enabled. When this is the case, bits are not initialized or modified by hot, warm, or cold resets.
- RWS = 6¶
Read/Write, Sticky
Bits are read/write and may be set or cleared by software, they are not initialized or modified by a hot reset.
If noted, devices that consume auxiliary power must preserve sticky register values when auxiliary power is enabled. When this is the case, bits are not initialized or modified by hot, warm, or cold resets.
- RW1CS = 7¶
Read-Only Status, Write 1 to clear, Sticky
Bits indicate some status when read, and status is reset/cleared when writing a 1 value to the register/field. Writing a 0 has no effect, they are not initialized or modified by a hot reset.
If noted, devices that consume auxiliary power must preserve sticky register values when auxiliary power is enabled. When this is the case, bits are not initialized or modified by hot, warm, or cold resets.
- RSVDP = 8¶
Reserved and Preserved
Reserved for future Read/Write fields.
Bits are read-only and must return 0 when read, software must preserve the value read for writes to bits.
- RSVDZ = 9¶
Reserved and Zero
Reserved for future RW1C fields.
Bits are read-only and must return 0 when read, software must write these bits with 0.