diff options
author | Edward O'Callaghan <funfunctor@folklore1984.net> | 2017-01-06 14:37:22 +1100 |
---|---|---|
committer | Edward O'Callaghan <funfunctor@folklore1984.net> | 2017-01-06 14:37:22 +1100 |
commit | 04fb5b9d608338752413ff8fb849bf9042184928 (patch) | |
tree | 39be5fcdd83d83d9490d0272262910d7e34a00e9 | |
parent | bd5f2aa44843a70125ff97622d27adef6f5d1869 (diff) |
nva: add support for blackmagic design devicesdecklink
Not actually Nvidia hardware.
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
-rw-r--r-- | include/nva.h | 1 | ||||
-rw-r--r-- | nva/nva.c | 22 | ||||
-rw-r--r-- | nva/nvalist.c | 7 |
3 files changed, 30 insertions, 0 deletions
diff --git a/include/nva.h b/include/nva.h index 0fc918b7..1d2f4363 100644 --- a/include/nva.h +++ b/include/nva.h @@ -37,6 +37,7 @@ enum nva_card_type { NVA_DEVICE_APU, NVA_DEVICE_SMU, NVA_DEVICE_ETH, + NVA_DEVICE_BMD, /* BlackMagicDesign */ }; enum nva_bus_type { @@ -122,6 +122,10 @@ struct pci_id_match nv_eth_match[] = { {0x10de, 0x0d7d, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0}, /* MCP89 */ }; +struct pci_id_match nv_bmd_match[] = { + {0xbdbd, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0}, +}; + struct nva_card *nva_init_gpu(struct pci_device *dev) { struct nva_card *card = calloc(sizeof *card, 1); if (!card) @@ -227,6 +231,23 @@ struct nva_card *nva_init_eth(struct pci_device *dev) { return card; } +struct nva_card *nva_init_bmd(struct pci_device *dev) { + struct nva_card *card = calloc(sizeof *card, 1); + if (!card) + return 0; + card->type = NVA_DEVICE_BMD; + card->bus_type = NVA_BUS_PCI; + card->bus.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; +} + static int check_modalias(const char *node_name) { char path[PATH_MAX]; char buffer[255] = { 0 }; @@ -328,6 +349,7 @@ struct { { nv_smu_match, ARRAY_SIZE(nv_smu_match), nva_init_smu }, { nv_apu_match, ARRAY_SIZE(nv_apu_match), nva_init_apu }, { nv_eth_match, ARRAY_SIZE(nv_eth_match), nva_init_eth }, + { nv_bmd_match, ARRAY_SIZE(nv_bmd_match), nva_init_bmd }, }; int nva_init() { diff --git a/nva/nvalist.c b/nva/nvalist.c index b78e901c..363ec17a 100644 --- a/nva/nvalist.c +++ b/nva/nvalist.c @@ -43,6 +43,10 @@ void list_eth(struct nva_card *card) { printf (" ETH\n"); } +void list_bmd(struct nva_card *card) { + printf (" BMD\n"); +} + int main() { if (nva_init()) { fprintf (stderr, "PCI init failure!\n"); @@ -76,6 +80,9 @@ int main() { case NVA_DEVICE_ETH: list_eth(card); break; + case NVA_DEVICE_BMD: + list_bmd(card); + break; default: abort(); } |