Generate warnings instead of errors for unknown device / class ids in the PCI database.

Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
This commit is contained in:
Christopher Desiniotis 2023-07-31 11:33:00 -07:00
parent 2c8c6ab21c
commit 114da86794

View File

@ -39,6 +39,10 @@ const (
PCI3dControllerClass uint32 = 0x030200
// PCINvSwitchClass represents the PCI class for NVSwitches
PCINvSwitchClass uint32 = 0x068000
// UnknownDeviceString is the device name to set for devices not found in the PCI database
UnknownDeviceString = "UNKNOWN_DEVICE"
// UnknownClassString is the class name to set for devices not found in the PCI database
UnknownClassString = "UNKNOWN_CLASS"
)
// Interface allows us to get a list of all NVIDIA PCI devices
@ -304,11 +308,13 @@ func (p *nvpci) GetGPUByPciBusID(address string) (*NvidiaPCIDevice, error) {
deviceName, err := pciDB.GetDeviceName(uint16(vendorID), uint16(deviceID))
if err != nil {
return nil, fmt.Errorf("unable to get device name: %v", err)
fmt.Printf("WARNING: unable to get device name: %v\n", err)
deviceName = UnknownDeviceString
}
className, err := pciDB.GetClassName(uint32(classID))
if err != nil {
return nil, fmt.Errorf("unable to get class name for device: %v", err)
fmt.Printf("WARNING: unable to get class name for device: %v\n", err)
className = UnknownClassString
}
nvdevice := &NvidiaPCIDevice{