Permalink
Browse files

nva: Add support for APU devices.

  • Loading branch information...
1 parent 37ba21c commit dcff6a02d35f0c5f49011bd581fba15a9fdc264c @koriakin koriakin committed Mar 8, 2014
Showing with 30 additions and 0 deletions.
  1. +1 −0 include/nva.h
  2. +22 −0 nva/nva.c
  3. +7 −0 nva/nvalist.c
View
@@ -31,6 +31,7 @@
struct nva_card {
enum {
NVA_DEVICE_GPU,
+ NVA_DEVICE_APU,
NVA_DEVICE_SMU,
} type;
struct pci_device *pci;
View
@@ -41,6 +41,11 @@ struct pci_id_match nv_gpu_match[] = {
{0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0x48000, 0xffffff00},
};
+struct pci_id_match nv_apu_match[] = {
+ {0x10de, 0x01b0, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0},
+ {0x10de, 0x006b, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0},
+};
+
struct pci_id_match nv_smu_match[] = {
{0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0xb4000, 0xffffff00},
};
@@ -114,13 +119,30 @@ struct nva_card *nva_init_smu(struct pci_device *dev) {
return card;
}
+struct nva_card *nva_init_apu(struct pci_device *dev) {
+ struct nva_card *card = calloc(sizeof *card, 1);
+ if (!card)
+ return 0;
+ card->type = NVA_DEVICE_APU;
+ card->pci = dev;
+ int ret = pci_device_map_range(dev, dev->regions[0].base_addr, dev->regions[0].size, PCI_DEV_MAP_FLAG_WRITABLE, &card->bar0);
+ if (ret) {
+ fprintf (stderr, "WARN: Can't probe %04x:%02x:%02x.%x\n", dev->domain, dev->bus, dev->dev, dev->func);
+ free(card);
+ return 0;
+ }
+ card->bar0len = dev->regions[0].size;
+ return card;
+}
+
struct {
struct pci_id_match *match;
size_t len;
struct nva_card *(*func) (struct pci_device *dev);
} nva_types[] = {
{ nv_gpu_match, ARRAY_SIZE(nv_gpu_match), nva_init_gpu },
{ nv_smu_match, ARRAY_SIZE(nv_smu_match), nva_init_smu },
+ { nv_apu_match, ARRAY_SIZE(nv_apu_match), nva_init_apu },
};
int nva_init() {
View
@@ -31,6 +31,10 @@ void list_gpu(struct nva_card *card) {
printf (" %s %08x\n", card->chipset.name, card->chipset.pmc_id);
}
+void list_apu(struct nva_card *card) {
+ printf (" APU\n");
+}
+
void list_smu(struct nva_card *card) {
printf (" SMU\n");
}
@@ -52,6 +56,9 @@ int main() {
case NVA_DEVICE_SMU:
list_smu(card);
break;
+ case NVA_DEVICE_APU:
+ list_apu(card);
+ break;
default:
abort();
}

0 comments on commit dcff6a0

Please sign in to comment.