-
-
Notifications
You must be signed in to change notification settings - Fork 48
Use libpci to retrieve some basic PCI data #440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
4bcb37f
Add pci dep
stsdc c3d652a
Add libpci dep
stsdc 0e473c7
libpci-dev
stsdc 0cded21
missed space
stsdc 4e76d37
Try to use LIB_VERSION
stsdc de6631f
Add Access and Dev structs
stsdc 2ae3a75
wip
stsdc d28b3b7
Use struct in cname
stsdc 3ad5375
Merge branch 'main' into stsdc/libpci
stsdc 14ba09b
Add pci_scan_bus
stsdc db42263
Merge branch 'main' into stsdc/libpci
stsdc 0225d12
Update structs according to ver. 3.10.0
stsdc 709aa5f
Make pci_init a standalone function
stsdc 79b6341
list all pci addresses
stsdc f04f8b2
Introduce pci_lookup_name
stsdc e9a2c54
remove ref
stsdc b9175ce
Merge branch 'main' into stsdc/libpci
stsdc 1d5b3e2
convert Access to class
stsdc 803e0cc
Reintroduce pci_cleanup as destroy_function for Access class
stsdc 866a188
standalone functions are now methods of Access class
stsdc f40af61
Introduce class Dev; use free_function
stsdc 3c84ebf
Return unowned nullable string in lookup_name
stsdc 7b208dc
Introduce fill_info
stsdc 275330a
Add Version annotations
stsdc 377dc0a
Add subsys_vendor_id and subsys_id; add missing FILL consts
stsdc aee4527
Drop SessionManager and use libpci to get GPU name
stsdc 0e653a5
fix lint
stsdc 88c4809
Merge branch 'main' into stsdc/libpci
stsdc d520256
Reintroduce GPU monitoring; introduce multiple GPU support foundament
stsdc a144858
Fix for Intel graphics
stsdc 3d731c6
A bit better debug messages
stsdc a53d166
Consider 3D cotroller as a GPU
stsdc b3d94a6
Update Resources.vala
stsdc 5b63050
Add Intel GPU dummy class
stsdc e525adc
Add proper vendor name to the GPU name
stsdc 2619151
Display not supported label for Intel and Nvidia gpus
stsdc b037a45
lint
stsdc b556be3
Improve comment styling for hints and docs
stsdc 1a11d19
Add comment
stsdc 6d3e51b
Merge branch 'main' into stsdc/libpci
stsdc 889b100
Remove obsolete code
stsdc 7b78697
Update src/Views/SystemView/SystemView.vala
stsdc f50b8ef
Refactoring: atomize comments; put literals into consts
stsdc 0718cc9
Remove space at the start of the file
stsdc fd47986
Make it clear that Intel GPU needs implementation.
stsdc 585ba6c
Add libpci-dev to readme
stsdc e03f0b5
Use pci consts from Utils
stsdc fa2c3c2
Use switch-case for GPU detection
stsdc 62fbc45
Use for loop for detecting GPU
stsdc 4478ad7
make sysfs path in nvidia protected
stsdc b933672
Explicit setting properties without digging into the method in the in…
ryonakano acff8e4
Compare GPU types instead of string properties
stsdc fc97d56
Merge branch 'stsdc/libpci' into ryonakano/libpci-proposal
stsdc 3804207
Update names of IGPU methods
stsdc 7175da7
Display pretty version of libpci
stsdc 5bc7216
Use LIBPCI_* consts to display pretty version
stsdc e6e746f
Move PCI defines to independant source
ryonakano c18f0c0
Add Flags attribute to enum LookupMode
stsdc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| [CCode (cheader_filename = "pci/pci.h", cprefix = "pci_", has_type_id = false)] | ||
| namespace Pci { | ||
|
|
||
| public const int LIB_VERSION; | ||
|
|
||
| [CCode (cname = "int", cprefix = "PCI_ACCESS_", has_type_id = false)] | ||
| public enum AccessType { | ||
| AUTO, /* Autodetection */ | ||
| SYS_BUS_PCI, /* Linux /sys/bus/pci */ | ||
| PROC_BUS_PCI, /* Linux /proc/bus/pci */ | ||
| I386_TYPE1, /* i386 ports, type 1 */ | ||
| I386_TYPE2, /* i386 ports, type 2 */ | ||
| FBSD_DEVICE, /* FreeBSD /dev/pci */ | ||
| AIX_DEVICE, /* /dev/pci0, /dev/bus0, etc. */ | ||
| NBSD_LIBPCI, /* NetBSD libpci */ | ||
| OBSD_DEVICE, /* OpenBSD /dev/pci */ | ||
| DUMP, /* Dump file */ | ||
| DARWIN, /* Darwin */ | ||
| SYLIXOS_DEVICE, /* SylixOS pci */ | ||
| HURD, /* GNU/Hurd */ | ||
| WIN32_CFGMGR32, /* Win32 cfgmgr32.dll */ | ||
| WIN32_KLDBG, /* Win32 kldbgdrv.sys */ | ||
| WIN32_SYSDBG, /* Win32 NT SysDbg */ | ||
| MMIO_TYPE1, /* MMIO ports, type 1 */ | ||
| MMIO_TYPE1_EXT, /* MMIO ports, type 1 extended */ | ||
| // ECAM, /* PCIe ECAM via /dev/mem */ | ||
stsdc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| AOS_EXPANSION, /* AmigaOS Expansion library */ | ||
| MAX | ||
| } | ||
|
|
||
| [SimpleType, CCode (cname = "pciaddr_t", has_type_id = false)] | ||
| public struct PciAddr : uint64 { } | ||
|
|
||
| [CCode (cname = "pci_cap", has_type_id = false)] | ||
| public struct Cap { | ||
| Cap *next; | ||
| uint16 id; /* PCI_CAP_ID_xxx */ | ||
| uint16 type; /* PCI_CAP_xxx */ | ||
| uint addr; /* Position in the config space */ | ||
| } | ||
|
|
||
| [CCode (cname = "struct pci_access", destroy_function = "pci_cleanup", has_type_id = false)] | ||
| public struct Access { | ||
| /* Options you can change: */ | ||
| uint method; /* Access method */ | ||
| int writeable; /* Open in read/write mode */ | ||
| int buscentric; /* Bus-centric view of the world */ | ||
|
|
||
| char *id_file_name; /* Name of ID list file (use pci_set_name_list_path()) */ | ||
| int free_id_name; /* Set if id_file_name is malloced */ | ||
| int numeric_ids; /* Enforce PCI_LOOKUP_NUMERIC (>1 => PCI_LOOKUP_MIXED) */ | ||
|
|
||
| uint id_lookup_mode; /* pci_lookup_mode flags which are set automatically */ | ||
| /* Default: PCI_LOOKUP_CACHE */ | ||
|
|
||
| int debugging; /* Turn on debugging messages */ | ||
|
|
||
| /* Functions you can override: */ | ||
| // void (*error)(char *msg, ...) PCI_PRINTF (1,2) PCI_NONRET; /* Write error message and quit */ | ||
| // void (*warning)(char *msg, ...) PCI_PRINTF (1,2); /* Write a warning message */ | ||
| // void (*debug)(char *msg, ...) PCI_PRINTF (1,2); /* Write a debugging message */ | ||
stsdc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Dev *devices; /* Devices found on this bus */ | ||
|
|
||
stsdc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [CCode (cname = "pci_init")] | ||
| public Access (Access acess); | ||
| } | ||
|
|
||
| /* Initialize PCI access */ | ||
| [CCode (cname = "pci_alloc")] | ||
| Access *pci_alloc (); | ||
|
|
||
| /* Scanning of devices */ | ||
| [CCode (cname = "pci_scan_bus")] | ||
| void pci_scan_bus(Access *acc); | ||
|
|
||
|
|
||
| [CCode (cname = "struct pci_dev", has_type_id = false)] | ||
| public struct Dev { | ||
| Dev *next; /* Next device in the chain */ | ||
| uint16 domain_16; /* 16-bit version of the PCI domain for backward compatibility */ | ||
| /* 0xffff if the real domain doesn't fit in 16 bits */ | ||
|
|
||
| /* Bus inside domain, device and function */ | ||
| uint8 bus; | ||
| uint8 dev; | ||
| uint8 func; | ||
|
|
||
| /* These fields are set by pci_fill_info() */ | ||
| uint known_fields; /* Set of info fields already known (see pci_fill_info()) */ | ||
|
|
||
| /* Identity of the device */ | ||
| uint16 vendor_id; | ||
| uint16 device_id; | ||
|
|
||
| uint16 device_class; /* PCI device class */ | ||
| int irq; /* IRQ number */ | ||
| PciAddr base_addr[6]; /* Base addresses including flags in lower bits */ | ||
| PciAddr size[6]; /* Region sizes */ | ||
| PciAddr rom_base_addr; /* Expansion ROM base address */ | ||
| PciAddr rom_size; /* Expansion ROM size */ | ||
| Cap *first_cap; /* List of capabilities */ | ||
| char *phy_slot; /* Physical slot */ | ||
| char *module_alias; /* Linux kernel module alias */ | ||
| char *label; /* Device name as exported by BIOS */ | ||
| int numa_node; /* NUMA node */ | ||
| PciAddr flags[6]; /* PCI_IORESOURCE_* flags for regions */ | ||
| PciAddr rom_flags; /* PCI_IORESOURCE_* flags for expansion ROM */ | ||
| int domain; /* PCI domain (host bridge) */ | ||
| PciAddr bridge_base_addr[4]; /* Bridge base addresses (without flags) */ | ||
| PciAddr bridge_size[4]; /* Bridge sizes */ | ||
| PciAddr bridge_flags[4]; /* PCI_IORESOURCE_* flags for bridge addresses */ | ||
|
|
||
| /* Programming interface for device_class and revision id */ | ||
| uint8 prog_if; | ||
| uint8 rev_id; | ||
|
|
||
| /* Subsystem vendor id and subsystem id */ | ||
| uint16 subsys_vendor_id; | ||
| uint16 subsys_id; | ||
| Dev *parent; /* Parent device, does not have to be always accessible */ | ||
| int no_config_access; /* No access to config space for this device */ | ||
| uint32 rcd_link_cap; /* Link Capabilities register for Restricted CXL Devices */ | ||
| uint16 rcd_link_status; /* Link Status register for RCD */ | ||
| uint16 rcd_link_ctrl; /* Link Control register for RCD */ | ||
stsdc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.