[v0.11] Handle the case where the GPU is not found in the pci LUT

This commit is contained in:
Dr-Noob
2021-12-18 20:11:02 +01:00
parent bfb9738132
commit a397eb398e
5 changed files with 11 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
typedef uint32_t GPUCHIP;
enum {
CHIP_UNKNOWN,
CHIP_UNKNOWN_CUDA,
CHIP_G80,
CHIP_G80GL,
CHIP_G84,

View File

@@ -8,7 +8,7 @@
#define CHECK_PCI_START if (false) {}
#define CHECK_PCI(pci, id, chip) \
else if (pci->device_id == id) return chip;
#define CHECK_PCI_END else { printBug("TODOO"); return CHIP_UNKNOWN; }
#define CHECK_PCI_END else { printBug("Unkown CUDA device id: 0x%.4X", pci->device_id); return CHIP_UNKNOWN_CUDA; }
/*
* pci ids were retrieved using https://github.com/pciutils/pciids

View File

@@ -39,7 +39,7 @@ static const char *uarch_str[] = {
#define CHECK_UARCH_START if (false) {}
#define CHECK_UARCH(arch, chip_, str, uarch, process) \
else if (arch->chip == chip_) fill_uarch(arch, str, uarch, process);
#define CHECK_UARCH_END else { printBug("map_chip_to_uarch_cuda: Unknown chip id: %d", arch->chip); fill_uarch(arch, STRING_UNKNOWN, UARCH_UNKNOWN, 0); }
#define CHECK_UARCH_END else { if(arch->chip != CHIP_UNKNOWN_CUDA) printBug("map_chip_to_uarch_cuda: Unknown chip id: %d", arch->chip); fill_uarch(arch, STRING_UNKNOWN, UARCH_UNKNOWN, 0); }
void fill_uarch(struct uarch* arch, char const *str, MICROARCH u, uint32_t process) {
arch->chip_str = (char *) emalloc(sizeof(char) * (strlen(str)+1));

View File

@@ -8,7 +8,7 @@
#define CHECK_PCI_START if (false) {}
#define CHECK_PCI(pci, id, chip) \
else if (pci->device_id == id) return chip;
#define CHECK_PCI_END else { printBug("TODOO"); return CHIP_UNKNOWN_INTEL; }
#define CHECK_PCI_END else { printBug("Unkown Intel device id: 0x%.4X", pci->device_id); return CHIP_UNKNOWN_INTEL; }
/*
* https://github.com/mesa3d/mesa/blob/main/include/pci_ids/i965_pci_ids.h

View File

@@ -149,9 +149,13 @@ struct uarch* get_uarch_from_pci(struct pci* pci) {
arch->chip_str = NULL;
arch->chip = get_chip_from_pci_intel(pci);
map_chip_to_uarch_intel(arch);
return arch;
if(arch->chip == CHIP_UNKNOWN_INTEL) {
return NULL;
}
else {
map_chip_to_uarch_intel(arch);
return arch;
}
}
char* get_name_from_uarch(struct uarch* arch) {