1c4266a9cSBen Skeggs /* 2c4266a9cSBen Skeggs * Copyright 2015 Red Hat Inc. 3c4266a9cSBen Skeggs * 4c4266a9cSBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a 5c4266a9cSBen Skeggs * copy of this software and associated documentation files (the "Software"), 6c4266a9cSBen Skeggs * to deal in the Software without restriction, including without limitation 7c4266a9cSBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8c4266a9cSBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the 9c4266a9cSBen Skeggs * Software is furnished to do so, subject to the following conditions: 10c4266a9cSBen Skeggs * 11c4266a9cSBen Skeggs * The above copyright notice and this permission notice shall be included in 12c4266a9cSBen Skeggs * all copies or substantial portions of the Software. 13c4266a9cSBen Skeggs * 14c4266a9cSBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15c4266a9cSBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16c4266a9cSBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17c4266a9cSBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18c4266a9cSBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19c4266a9cSBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20c4266a9cSBen Skeggs * OTHER DEALINGS IN THE SOFTWARE. 21c4266a9cSBen Skeggs * 22c4266a9cSBen Skeggs * Authors: Ben Skeggs <bskeggs@redhat.com> 23c4266a9cSBen Skeggs */ 24c4266a9cSBen Skeggs #include "priv.h" 25c4266a9cSBen Skeggs 26c4266a9cSBen Skeggs #include <core/pci.h> 27c4266a9cSBen Skeggs 28c4266a9cSBen Skeggs /* MSI re-arm through the PRI appears to be broken on NV46/NV50/G84/G86/G92, 29c4266a9cSBen Skeggs * so we access it via alternate PCI config space mechanisms. 30c4266a9cSBen Skeggs */ 31c4266a9cSBen Skeggs void 32c4266a9cSBen Skeggs nv46_pci_msi_rearm(struct nvkm_pci *pci) 33c4266a9cSBen Skeggs { 34c4266a9cSBen Skeggs struct nvkm_device *device = pci->subdev.device; 35c4266a9cSBen Skeggs struct pci_dev *pdev = device->func->pci(device)->pdev; 36c4266a9cSBen Skeggs pci_write_config_byte(pdev, 0x68, 0xff); 37c4266a9cSBen Skeggs } 38c4266a9cSBen Skeggs 39c4266a9cSBen Skeggs static const struct nvkm_pci_func 40c4266a9cSBen Skeggs nv46_pci_func = { 41c4266a9cSBen Skeggs .rd32 = nv40_pci_rd32, 42c4266a9cSBen Skeggs .wr08 = nv40_pci_wr08, 43c4266a9cSBen Skeggs .wr32 = nv40_pci_wr32, 44c4266a9cSBen Skeggs .msi_rearm = nv46_pci_msi_rearm, 45c4266a9cSBen Skeggs }; 46c4266a9cSBen Skeggs 47c4266a9cSBen Skeggs int 48c4266a9cSBen Skeggs nv46_pci_new(struct nvkm_device *device, int index, struct nvkm_pci **ppci) 49c4266a9cSBen Skeggs { 50c4266a9cSBen Skeggs return nvkm_pci_new_(&nv46_pci_func, device, index, ppci); 51c4266a9cSBen Skeggs } 52