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.Subconstruct
to 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
u8l
construct.Int8ul
u16l
construct.Int16ul
u24l
construct.Int24ul
u32l
construct.Int32ul
u64l
construct.Int64ul
s8l
construct.Int8sl
s16l
construct.Int16sl
s24l
construct.Int24sl
s32l
construct.Int32sl
s64l
construct.Int64sl
u8b
construct.Int8ub
u16b
construct.Int16ub
u24b
construct.Int24ub
u32b
construct.Int32ub
u64b
construct.Int64ub
s8b
construct.Int8sb
s16b
construct.Int16sb
s24b
construct.Int24bl
s32b
construct.Int32sb
s64b
construct.Int64sb
b#
construct.BitsInteger
An example prefixed field name would be
u8lAllocLen
which would define an unsigned eight-bit unsigned little-endian integer calledAllocLen
.However, if the
length
argument 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.