1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 2d0ebbc0cSBrijesh Singh /* 3d0ebbc0cSBrijesh Singh * AMD Secure Processor device driver 4d0ebbc0cSBrijesh Singh * 533960accSRijo Thomas * Copyright (C) 2013,2019 Advanced Micro Devices, Inc. 6d0ebbc0cSBrijesh Singh * 7d0ebbc0cSBrijesh Singh * Author: Tom Lendacky <thomas.lendacky@amd.com> 8d0ebbc0cSBrijesh Singh * Author: Gary R Hook <gary.hook@amd.com> 9d0ebbc0cSBrijesh Singh */ 10d0ebbc0cSBrijesh Singh 11d0ebbc0cSBrijesh Singh #include <linux/module.h> 12d0ebbc0cSBrijesh Singh #include <linux/kernel.h> 13d0ebbc0cSBrijesh Singh #include <linux/device.h> 14d0ebbc0cSBrijesh Singh #include <linux/pci.h> 15d0ebbc0cSBrijesh Singh #include <linux/pci_ids.h> 16d0ebbc0cSBrijesh Singh #include <linux/dma-mapping.h> 17d0ebbc0cSBrijesh Singh #include <linux/kthread.h> 18d0ebbc0cSBrijesh Singh #include <linux/sched.h> 19d0ebbc0cSBrijesh Singh #include <linux/interrupt.h> 20d0ebbc0cSBrijesh Singh #include <linux/spinlock.h> 21d0ebbc0cSBrijesh Singh #include <linux/delay.h> 22d0ebbc0cSBrijesh Singh #include <linux/ccp.h> 23d0ebbc0cSBrijesh Singh 24d0ebbc0cSBrijesh Singh #include "ccp-dev.h" 25b93566f1SRijo Thomas #include "psp-dev.h" 26d0ebbc0cSBrijesh Singh 27d0ebbc0cSBrijesh Singh #define MSIX_VECTORS 2 28d0ebbc0cSBrijesh Singh 29d0ebbc0cSBrijesh Singh struct sp_pci { 30d0ebbc0cSBrijesh Singh int msix_count; 31d0ebbc0cSBrijesh Singh struct msix_entry msix_entry[MSIX_VECTORS]; 32d0ebbc0cSBrijesh Singh }; 332a6170dfSBrijesh Singh static struct sp_device *sp_dev_master; 34d0ebbc0cSBrijesh Singh 35d0ebbc0cSBrijesh Singh static int sp_get_msix_irqs(struct sp_device *sp) 36d0ebbc0cSBrijesh Singh { 37d0ebbc0cSBrijesh Singh struct sp_pci *sp_pci = sp->dev_specific; 38d0ebbc0cSBrijesh Singh struct device *dev = sp->dev; 39d0ebbc0cSBrijesh Singh struct pci_dev *pdev = to_pci_dev(dev); 40d0ebbc0cSBrijesh Singh int v, ret; 41d0ebbc0cSBrijesh Singh 42d0ebbc0cSBrijesh Singh for (v = 0; v < ARRAY_SIZE(sp_pci->msix_entry); v++) 43d0ebbc0cSBrijesh Singh sp_pci->msix_entry[v].entry = v; 44d0ebbc0cSBrijesh Singh 45d0ebbc0cSBrijesh Singh ret = pci_enable_msix_range(pdev, sp_pci->msix_entry, 1, v); 46d0ebbc0cSBrijesh Singh if (ret < 0) 47d0ebbc0cSBrijesh Singh return ret; 48d0ebbc0cSBrijesh Singh 49d0ebbc0cSBrijesh Singh sp_pci->msix_count = ret; 50d0ebbc0cSBrijesh Singh sp->use_tasklet = true; 51d0ebbc0cSBrijesh Singh 52d0ebbc0cSBrijesh Singh sp->psp_irq = sp_pci->msix_entry[0].vector; 53d0ebbc0cSBrijesh Singh sp->ccp_irq = (sp_pci->msix_count > 1) ? sp_pci->msix_entry[1].vector 54d0ebbc0cSBrijesh Singh : sp_pci->msix_entry[0].vector; 55d0ebbc0cSBrijesh Singh return 0; 56d0ebbc0cSBrijesh Singh } 57d0ebbc0cSBrijesh Singh 58d0ebbc0cSBrijesh Singh static int sp_get_msi_irq(struct sp_device *sp) 59d0ebbc0cSBrijesh Singh { 60d0ebbc0cSBrijesh Singh struct device *dev = sp->dev; 61d0ebbc0cSBrijesh Singh struct pci_dev *pdev = to_pci_dev(dev); 62d0ebbc0cSBrijesh Singh int ret; 63d0ebbc0cSBrijesh Singh 64d0ebbc0cSBrijesh Singh ret = pci_enable_msi(pdev); 65d0ebbc0cSBrijesh Singh if (ret) 66d0ebbc0cSBrijesh Singh return ret; 67d0ebbc0cSBrijesh Singh 68d0ebbc0cSBrijesh Singh sp->ccp_irq = pdev->irq; 69d0ebbc0cSBrijesh Singh sp->psp_irq = pdev->irq; 70d0ebbc0cSBrijesh Singh 71d0ebbc0cSBrijesh Singh return 0; 72d0ebbc0cSBrijesh Singh } 73d0ebbc0cSBrijesh Singh 74d0ebbc0cSBrijesh Singh static int sp_get_irqs(struct sp_device *sp) 75d0ebbc0cSBrijesh Singh { 76d0ebbc0cSBrijesh Singh struct device *dev = sp->dev; 77d0ebbc0cSBrijesh Singh int ret; 78d0ebbc0cSBrijesh Singh 79d0ebbc0cSBrijesh Singh ret = sp_get_msix_irqs(sp); 80d0ebbc0cSBrijesh Singh if (!ret) 81d0ebbc0cSBrijesh Singh return 0; 82d0ebbc0cSBrijesh Singh 83d0ebbc0cSBrijesh Singh /* Couldn't get MSI-X vectors, try MSI */ 84d0ebbc0cSBrijesh Singh dev_notice(dev, "could not enable MSI-X (%d), trying MSI\n", ret); 85d0ebbc0cSBrijesh Singh ret = sp_get_msi_irq(sp); 86d0ebbc0cSBrijesh Singh if (!ret) 87d0ebbc0cSBrijesh Singh return 0; 88d0ebbc0cSBrijesh Singh 89d0ebbc0cSBrijesh Singh /* Couldn't get MSI interrupt */ 90d0ebbc0cSBrijesh Singh dev_notice(dev, "could not enable MSI (%d)\n", ret); 91d0ebbc0cSBrijesh Singh 92d0ebbc0cSBrijesh Singh return ret; 93d0ebbc0cSBrijesh Singh } 94d0ebbc0cSBrijesh Singh 95d0ebbc0cSBrijesh Singh static void sp_free_irqs(struct sp_device *sp) 96d0ebbc0cSBrijesh Singh { 97d0ebbc0cSBrijesh Singh struct sp_pci *sp_pci = sp->dev_specific; 98d0ebbc0cSBrijesh Singh struct device *dev = sp->dev; 99d0ebbc0cSBrijesh Singh struct pci_dev *pdev = to_pci_dev(dev); 100d0ebbc0cSBrijesh Singh 101d0ebbc0cSBrijesh Singh if (sp_pci->msix_count) 102d0ebbc0cSBrijesh Singh pci_disable_msix(pdev); 103d0ebbc0cSBrijesh Singh else if (sp->psp_irq) 104d0ebbc0cSBrijesh Singh pci_disable_msi(pdev); 105d0ebbc0cSBrijesh Singh 106d0ebbc0cSBrijesh Singh sp->ccp_irq = 0; 107d0ebbc0cSBrijesh Singh sp->psp_irq = 0; 108d0ebbc0cSBrijesh Singh } 109d0ebbc0cSBrijesh Singh 1102a6170dfSBrijesh Singh static bool sp_pci_is_master(struct sp_device *sp) 1112a6170dfSBrijesh Singh { 1122a6170dfSBrijesh Singh struct device *dev_cur, *dev_new; 1132a6170dfSBrijesh Singh struct pci_dev *pdev_cur, *pdev_new; 1142a6170dfSBrijesh Singh 1152a6170dfSBrijesh Singh dev_new = sp->dev; 1162a6170dfSBrijesh Singh dev_cur = sp_dev_master->dev; 1172a6170dfSBrijesh Singh 1182a6170dfSBrijesh Singh pdev_new = to_pci_dev(dev_new); 1192a6170dfSBrijesh Singh pdev_cur = to_pci_dev(dev_cur); 1202a6170dfSBrijesh Singh 1212a6170dfSBrijesh Singh if (pdev_new->bus->number < pdev_cur->bus->number) 1222a6170dfSBrijesh Singh return true; 1232a6170dfSBrijesh Singh 1242a6170dfSBrijesh Singh if (PCI_SLOT(pdev_new->devfn) < PCI_SLOT(pdev_cur->devfn)) 1252a6170dfSBrijesh Singh return true; 1262a6170dfSBrijesh Singh 1272a6170dfSBrijesh Singh if (PCI_FUNC(pdev_new->devfn) < PCI_FUNC(pdev_cur->devfn)) 1282a6170dfSBrijesh Singh return true; 1292a6170dfSBrijesh Singh 1302a6170dfSBrijesh Singh return false; 1312a6170dfSBrijesh Singh } 1322a6170dfSBrijesh Singh 1332a6170dfSBrijesh Singh static void psp_set_master(struct sp_device *sp) 1342a6170dfSBrijesh Singh { 1352a6170dfSBrijesh Singh if (!sp_dev_master) { 1362a6170dfSBrijesh Singh sp_dev_master = sp; 1372a6170dfSBrijesh Singh return; 1382a6170dfSBrijesh Singh } 1392a6170dfSBrijesh Singh 1402a6170dfSBrijesh Singh if (sp_pci_is_master(sp)) 1412a6170dfSBrijesh Singh sp_dev_master = sp; 1422a6170dfSBrijesh Singh } 1432a6170dfSBrijesh Singh 1442a6170dfSBrijesh Singh static struct sp_device *psp_get_master(void) 1452a6170dfSBrijesh Singh { 1462a6170dfSBrijesh Singh return sp_dev_master; 1472a6170dfSBrijesh Singh } 1482a6170dfSBrijesh Singh 14915f7a4c6SJohn Allen static void psp_clear_master(struct sp_device *sp) 15015f7a4c6SJohn Allen { 15115f7a4c6SJohn Allen if (sp == sp_dev_master) { 15215f7a4c6SJohn Allen sp_dev_master = NULL; 15315f7a4c6SJohn Allen dev_dbg(sp->dev, "Cleared sp_dev_master\n"); 15415f7a4c6SJohn Allen } 15515f7a4c6SJohn Allen } 15615f7a4c6SJohn Allen 157d0ebbc0cSBrijesh Singh static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 158d0ebbc0cSBrijesh Singh { 159d0ebbc0cSBrijesh Singh struct sp_device *sp; 160d0ebbc0cSBrijesh Singh struct sp_pci *sp_pci; 161d0ebbc0cSBrijesh Singh struct device *dev = &pdev->dev; 162d0ebbc0cSBrijesh Singh void __iomem * const *iomap_table; 163d0ebbc0cSBrijesh Singh int bar_mask; 164d0ebbc0cSBrijesh Singh int ret; 165d0ebbc0cSBrijesh Singh 166d0ebbc0cSBrijesh Singh ret = -ENOMEM; 167d0ebbc0cSBrijesh Singh sp = sp_alloc_struct(dev); 168d0ebbc0cSBrijesh Singh if (!sp) 169d0ebbc0cSBrijesh Singh goto e_err; 170d0ebbc0cSBrijesh Singh 171d0ebbc0cSBrijesh Singh sp_pci = devm_kzalloc(dev, sizeof(*sp_pci), GFP_KERNEL); 172d0ebbc0cSBrijesh Singh if (!sp_pci) 173d0ebbc0cSBrijesh Singh goto e_err; 174d0ebbc0cSBrijesh Singh 175d0ebbc0cSBrijesh Singh sp->dev_specific = sp_pci; 176d0ebbc0cSBrijesh Singh sp->dev_vdata = (struct sp_dev_vdata *)id->driver_data; 177d0ebbc0cSBrijesh Singh if (!sp->dev_vdata) { 178d0ebbc0cSBrijesh Singh ret = -ENODEV; 179d0ebbc0cSBrijesh Singh dev_err(dev, "missing driver data\n"); 180d0ebbc0cSBrijesh Singh goto e_err; 181d0ebbc0cSBrijesh Singh } 182d0ebbc0cSBrijesh Singh 183d0ebbc0cSBrijesh Singh ret = pcim_enable_device(pdev); 184d0ebbc0cSBrijesh Singh if (ret) { 185d0ebbc0cSBrijesh Singh dev_err(dev, "pcim_enable_device failed (%d)\n", ret); 186d0ebbc0cSBrijesh Singh goto e_err; 187d0ebbc0cSBrijesh Singh } 188d0ebbc0cSBrijesh Singh 189d0ebbc0cSBrijesh Singh bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); 190d0ebbc0cSBrijesh Singh ret = pcim_iomap_regions(pdev, bar_mask, "ccp"); 191d0ebbc0cSBrijesh Singh if (ret) { 192d0ebbc0cSBrijesh Singh dev_err(dev, "pcim_iomap_regions failed (%d)\n", ret); 193d0ebbc0cSBrijesh Singh goto e_err; 194d0ebbc0cSBrijesh Singh } 195d0ebbc0cSBrijesh Singh 196d0ebbc0cSBrijesh Singh iomap_table = pcim_iomap_table(pdev); 197d0ebbc0cSBrijesh Singh if (!iomap_table) { 198d0ebbc0cSBrijesh Singh dev_err(dev, "pcim_iomap_table failed\n"); 199d0ebbc0cSBrijesh Singh ret = -ENOMEM; 200d0ebbc0cSBrijesh Singh goto e_err; 201d0ebbc0cSBrijesh Singh } 202d0ebbc0cSBrijesh Singh 203d0ebbc0cSBrijesh Singh sp->io_map = iomap_table[sp->dev_vdata->bar]; 204d0ebbc0cSBrijesh Singh if (!sp->io_map) { 205d0ebbc0cSBrijesh Singh dev_err(dev, "ioremap failed\n"); 206d0ebbc0cSBrijesh Singh ret = -ENOMEM; 207d0ebbc0cSBrijesh Singh goto e_err; 208d0ebbc0cSBrijesh Singh } 209d0ebbc0cSBrijesh Singh 210d0ebbc0cSBrijesh Singh ret = sp_get_irqs(sp); 211d0ebbc0cSBrijesh Singh if (ret) 212d0ebbc0cSBrijesh Singh goto e_err; 213d0ebbc0cSBrijesh Singh 214d0ebbc0cSBrijesh Singh pci_set_master(pdev); 2152a6170dfSBrijesh Singh sp->set_psp_master_device = psp_set_master; 2162a6170dfSBrijesh Singh sp->get_psp_master_device = psp_get_master; 21715f7a4c6SJohn Allen sp->clear_psp_master_device = psp_clear_master; 218d0ebbc0cSBrijesh Singh 219d0ebbc0cSBrijesh Singh ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)); 220d0ebbc0cSBrijesh Singh if (ret) { 221d0ebbc0cSBrijesh Singh ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); 222d0ebbc0cSBrijesh Singh if (ret) { 223d0ebbc0cSBrijesh Singh dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", 224d0ebbc0cSBrijesh Singh ret); 225*a6f8e68eSChristophe JAILLET goto free_irqs; 226d0ebbc0cSBrijesh Singh } 227d0ebbc0cSBrijesh Singh } 228d0ebbc0cSBrijesh Singh 229d0ebbc0cSBrijesh Singh dev_set_drvdata(dev, sp); 230d0ebbc0cSBrijesh Singh 231d0ebbc0cSBrijesh Singh ret = sp_init(sp); 232d0ebbc0cSBrijesh Singh if (ret) 233*a6f8e68eSChristophe JAILLET goto free_irqs; 234d0ebbc0cSBrijesh Singh 235d0ebbc0cSBrijesh Singh return 0; 236d0ebbc0cSBrijesh Singh 237*a6f8e68eSChristophe JAILLET free_irqs: 238*a6f8e68eSChristophe JAILLET sp_free_irqs(sp); 239d0ebbc0cSBrijesh Singh e_err: 240d0ebbc0cSBrijesh Singh dev_notice(dev, "initialization failed\n"); 241d0ebbc0cSBrijesh Singh return ret; 242d0ebbc0cSBrijesh Singh } 243d0ebbc0cSBrijesh Singh 244d0ebbc0cSBrijesh Singh static void sp_pci_remove(struct pci_dev *pdev) 245d0ebbc0cSBrijesh Singh { 246d0ebbc0cSBrijesh Singh struct device *dev = &pdev->dev; 247d0ebbc0cSBrijesh Singh struct sp_device *sp = dev_get_drvdata(dev); 248d0ebbc0cSBrijesh Singh 249d0ebbc0cSBrijesh Singh if (!sp) 250d0ebbc0cSBrijesh Singh return; 251d0ebbc0cSBrijesh Singh 252d0ebbc0cSBrijesh Singh sp_destroy(sp); 253d0ebbc0cSBrijesh Singh 254d0ebbc0cSBrijesh Singh sp_free_irqs(sp); 255d0ebbc0cSBrijesh Singh } 256d0ebbc0cSBrijesh Singh 257f892a21fSVaibhav Gupta static int __maybe_unused sp_pci_suspend(struct device *dev) 258d0ebbc0cSBrijesh Singh { 259d0ebbc0cSBrijesh Singh struct sp_device *sp = dev_get_drvdata(dev); 260d0ebbc0cSBrijesh Singh 261f892a21fSVaibhav Gupta return sp_suspend(sp); 262d0ebbc0cSBrijesh Singh } 263d0ebbc0cSBrijesh Singh 264f892a21fSVaibhav Gupta static int __maybe_unused sp_pci_resume(struct device *dev) 265d0ebbc0cSBrijesh Singh { 266d0ebbc0cSBrijesh Singh struct sp_device *sp = dev_get_drvdata(dev); 267d0ebbc0cSBrijesh Singh 268d0ebbc0cSBrijesh Singh return sp_resume(sp); 269d0ebbc0cSBrijesh Singh } 270d0ebbc0cSBrijesh Singh 2712a6170dfSBrijesh Singh #ifdef CONFIG_CRYPTO_DEV_SP_PSP 2726eb0cc72SRijo Thomas static const struct sev_vdata sevv1 = { 273ad01a984STom Lendacky .cmdresp_reg = 0x10580, 274ad01a984STom Lendacky .cmdbuff_addr_lo_reg = 0x105e0, 275ad01a984STom Lendacky .cmdbuff_addr_hi_reg = 0x105e4, 2766eb0cc72SRijo Thomas }; 2776eb0cc72SRijo Thomas 2786eb0cc72SRijo Thomas static const struct sev_vdata sevv2 = { 2796eb0cc72SRijo Thomas .cmdresp_reg = 0x10980, 2806eb0cc72SRijo Thomas .cmdbuff_addr_lo_reg = 0x109e0, 2816eb0cc72SRijo Thomas .cmdbuff_addr_hi_reg = 0x109e4, 2826eb0cc72SRijo Thomas }; 2836eb0cc72SRijo Thomas 28433960accSRijo Thomas static const struct tee_vdata teev1 = { 28533960accSRijo Thomas .cmdresp_reg = 0x10544, 28633960accSRijo Thomas .cmdbuff_addr_lo_reg = 0x10548, 28733960accSRijo Thomas .cmdbuff_addr_hi_reg = 0x1054c, 28833960accSRijo Thomas .ring_wptr_reg = 0x10550, 28933960accSRijo Thomas .ring_rptr_reg = 0x10554, 29033960accSRijo Thomas }; 29133960accSRijo Thomas 2926eb0cc72SRijo Thomas static const struct psp_vdata pspv1 = { 2936eb0cc72SRijo Thomas .sev = &sevv1, 294ad01a984STom Lendacky .feature_reg = 0x105fc, 295ad01a984STom Lendacky .inten_reg = 0x10610, 296ad01a984STom Lendacky .intsts_reg = 0x10614, 2972a6170dfSBrijesh Singh }; 298dcbc0c6eSTom Lendacky 299dcbc0c6eSTom Lendacky static const struct psp_vdata pspv2 = { 3006eb0cc72SRijo Thomas .sev = &sevv2, 301dcbc0c6eSTom Lendacky .feature_reg = 0x109fc, 302dcbc0c6eSTom Lendacky .inten_reg = 0x10690, 303dcbc0c6eSTom Lendacky .intsts_reg = 0x10694, 304dcbc0c6eSTom Lendacky }; 30533960accSRijo Thomas 30633960accSRijo Thomas static const struct psp_vdata pspv3 = { 30733960accSRijo Thomas .tee = &teev1, 30833960accSRijo Thomas .feature_reg = 0x109fc, 30933960accSRijo Thomas .inten_reg = 0x10690, 31033960accSRijo Thomas .intsts_reg = 0x10694, 31133960accSRijo Thomas }; 3122a6170dfSBrijesh Singh #endif 3132a6170dfSBrijesh Singh 314d0ebbc0cSBrijesh Singh static const struct sp_dev_vdata dev_vdata[] = { 315dcbc0c6eSTom Lendacky { /* 0 */ 316d0ebbc0cSBrijesh Singh .bar = 2, 317d0ebbc0cSBrijesh Singh #ifdef CONFIG_CRYPTO_DEV_SP_CCP 318d0ebbc0cSBrijesh Singh .ccp_vdata = &ccpv3, 319d0ebbc0cSBrijesh Singh #endif 320d0ebbc0cSBrijesh Singh }, 321dcbc0c6eSTom Lendacky { /* 1 */ 322d0ebbc0cSBrijesh Singh .bar = 2, 323d0ebbc0cSBrijesh Singh #ifdef CONFIG_CRYPTO_DEV_SP_CCP 324d0ebbc0cSBrijesh Singh .ccp_vdata = &ccpv5a, 325d0ebbc0cSBrijesh Singh #endif 3262a6170dfSBrijesh Singh #ifdef CONFIG_CRYPTO_DEV_SP_PSP 327dcbc0c6eSTom Lendacky .psp_vdata = &pspv1, 3282a6170dfSBrijesh Singh #endif 329d0ebbc0cSBrijesh Singh }, 330dcbc0c6eSTom Lendacky { /* 2 */ 331d0ebbc0cSBrijesh Singh .bar = 2, 332d0ebbc0cSBrijesh Singh #ifdef CONFIG_CRYPTO_DEV_SP_CCP 333d0ebbc0cSBrijesh Singh .ccp_vdata = &ccpv5b, 334d0ebbc0cSBrijesh Singh #endif 335d0ebbc0cSBrijesh Singh }, 336dcbc0c6eSTom Lendacky { /* 3 */ 337dcbc0c6eSTom Lendacky .bar = 2, 338dcbc0c6eSTom Lendacky #ifdef CONFIG_CRYPTO_DEV_SP_CCP 339dcbc0c6eSTom Lendacky .ccp_vdata = &ccpv5a, 340dcbc0c6eSTom Lendacky #endif 341dcbc0c6eSTom Lendacky #ifdef CONFIG_CRYPTO_DEV_SP_PSP 342dcbc0c6eSTom Lendacky .psp_vdata = &pspv2, 343dcbc0c6eSTom Lendacky #endif 344dcbc0c6eSTom Lendacky }, 34533960accSRijo Thomas { /* 4 */ 34633960accSRijo Thomas .bar = 2, 34733960accSRijo Thomas #ifdef CONFIG_CRYPTO_DEV_SP_CCP 34833960accSRijo Thomas .ccp_vdata = &ccpv5a, 34933960accSRijo Thomas #endif 35033960accSRijo Thomas #ifdef CONFIG_CRYPTO_DEV_SP_PSP 35133960accSRijo Thomas .psp_vdata = &pspv3, 35233960accSRijo Thomas #endif 35333960accSRijo Thomas }, 354d0ebbc0cSBrijesh Singh }; 355d0ebbc0cSBrijesh Singh static const struct pci_device_id sp_pci_table[] = { 356d0ebbc0cSBrijesh Singh { PCI_VDEVICE(AMD, 0x1537), (kernel_ulong_t)&dev_vdata[0] }, 357d0ebbc0cSBrijesh Singh { PCI_VDEVICE(AMD, 0x1456), (kernel_ulong_t)&dev_vdata[1] }, 358d0ebbc0cSBrijesh Singh { PCI_VDEVICE(AMD, 0x1468), (kernel_ulong_t)&dev_vdata[2] }, 359dcbc0c6eSTom Lendacky { PCI_VDEVICE(AMD, 0x1486), (kernel_ulong_t)&dev_vdata[3] }, 36033960accSRijo Thomas { PCI_VDEVICE(AMD, 0x15DF), (kernel_ulong_t)&dev_vdata[4] }, 361195ec383SDevaraj Rangasamy { PCI_VDEVICE(AMD, 0x1649), (kernel_ulong_t)&dev_vdata[4] }, 362d0ebbc0cSBrijesh Singh /* Last entry must be zero */ 363d0ebbc0cSBrijesh Singh { 0, } 364d0ebbc0cSBrijesh Singh }; 365d0ebbc0cSBrijesh Singh MODULE_DEVICE_TABLE(pci, sp_pci_table); 366d0ebbc0cSBrijesh Singh 367f892a21fSVaibhav Gupta static SIMPLE_DEV_PM_OPS(sp_pci_pm_ops, sp_pci_suspend, sp_pci_resume); 368f892a21fSVaibhav Gupta 369d0ebbc0cSBrijesh Singh static struct pci_driver sp_pci_driver = { 370d0ebbc0cSBrijesh Singh .name = "ccp", 371d0ebbc0cSBrijesh Singh .id_table = sp_pci_table, 372d0ebbc0cSBrijesh Singh .probe = sp_pci_probe, 373d0ebbc0cSBrijesh Singh .remove = sp_pci_remove, 374f892a21fSVaibhav Gupta .driver.pm = &sp_pci_pm_ops, 375d0ebbc0cSBrijesh Singh }; 376d0ebbc0cSBrijesh Singh 377d0ebbc0cSBrijesh Singh int sp_pci_init(void) 378d0ebbc0cSBrijesh Singh { 379d0ebbc0cSBrijesh Singh return pci_register_driver(&sp_pci_driver); 380d0ebbc0cSBrijesh Singh } 381d0ebbc0cSBrijesh Singh 382d0ebbc0cSBrijesh Singh void sp_pci_exit(void) 383d0ebbc0cSBrijesh Singh { 384d0ebbc0cSBrijesh Singh pci_unregister_driver(&sp_pci_driver); 385d0ebbc0cSBrijesh Singh } 386