Hi,
On 4/30/19 11:45 PM, Ralf Ramsauer wrote:
> Definitions on C-side are in place, so let the generator produce those
> definitions.
>
> Signed-off-by: Ralf Ramsauer <[email protected]>
> ---
> pyjailhouse/sysfs_parser.py | 79 +++++++++++++++++++++++++++++++----
> tools/root-cell-config.c.tmpl | 6 +--
> 2 files changed, 72 insertions(+), 13 deletions(-)
>
> diff --git a/pyjailhouse/sysfs_parser.py b/pyjailhouse/sysfs_parser.py
> index 4bb50605..368714b0 100644
> --- a/pyjailhouse/sysfs_parser.py
> +++ b/pyjailhouse/sysfs_parser.py
> @@ -22,6 +22,8 @@ import struct
> import os
> import fnmatch
>
> +from enum import Enum
> +
> root_dir = "/"
>
> def set_root_dir(dir):
> @@ -542,6 +544,65 @@ class PCIBARs:
> f.close()
>
>
> +class PCI_CAP_ID(Enum):
> + PM = 0x01 # Power Management
> + VPD = 0x03 # Vital Product Data
> + MSI = 0x05 # Message Signalled Interrupts
> + HT = 0x08 # HyperTransport
> + VNDR = 0x09 # Vendor-Specific
> + DBG = 0x0A # Debug port
> + SSVID = 0x0D # Bridge subsystem vendor/device ID
> + SECDEV = 0x0F # Secure Device
> + EXP = 0x10 # PCI Express
> + MSIX = 0x11 # MSI-X
> + SATA = 0x12 # SATA Data/Index Conf.
> + AF = 0x13 # PCI Advanced Features
> +
> + def __str__(self):
> + return "PCI_CAP_ID_" + self.name
> +
> +
> +class PCI_EXT_CAP_ID(Enum):
> + ZERO = 0x00 # ???
> +
> + ERR = 0x01 # Advanced Error Reporting
> + VC = 0x02 # Virtual Channel Capability
> + DSN = 0x03 # Device Serial Number
> + PWR = 0x04 # Power Budgeting
> + RCLD = 0x05 # Root Complex Link Declaration
> + RCILC = 0x06 # Root Complex Internal Link Control
> + RCEC = 0x07 # Root Complex Event Collector
> + MFVC = 0x08 # Multi-Function VC Capability
> + VC9 = 0x09 # same as _VC
> + RCRB = 0x0A # Root Complex RB?
> + VNDR = 0x0B # Vendor-Specific
> + CAC = 0x0C # Config Access - obsolete
> + ACS = 0x0D # Access Control Services
> + ARI = 0x0E # Alternate Routing ID
> + ATS = 0x0F # Address Translation Services
> + SRIOV = 0x10 # Single Root I/O Virtualization
> + MRIOV = 0x11 # Multi Root I/O Virtualization
> + MCAST = 0x12 # Multicast
> + PRI = 0x13 # Page Request Interface
> + AMD_XXX = 0x14 # Reserved for AMD
> + REBAR = 0x15 # Resizable BAR
> + DPA = 0x16 # Dynamic Power Allocation
> + TPH = 0x17 # TPH Requester
> + LTR = 0x18 # Latency Tolerance Reporting
> + SECPCI = 0x19 # Secondary PCIe Capability
> + PMUX = 0x1A # Protocol Multiplexing
> + PASID = 0x1B # Process Address Space ID
> + DPC = 0x1D # Downstream Port Containment
> + L1SS = 0x1E # L1 PM Substates
> + PTM = 0x1F # Precision Time Measurement
Just ran the config creator on a machine with non-standardised ext.
capability id. lspci explains:
Capabilities: [3c4 v1] Designated Vendor-Specific <?>
Its id is 0x23, nothing standardised (besides Intel, they use this id
for DVSEC, but the device behind is an AMD PCIe GPP bridge, well...). So
it seems there are vendor specific multiple definitions for
non-standardised cap ids.
This lets the python generator crashes with a ValueError. While this
crash was actually intended (in order to expand the generator), I found
a case where this is not possible.
If there's no speaking name behind an entry, the generator should warn
and fall back to the hexadecimal representation. And seems this won't
work with python enums. I need to fix this before the next revision.
Ralf
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.