1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2015 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #include <linux/kernel.h>
25 #include <linux/module.h>
26 
27 #include "nv-pci-table.h"
28 #include "cpuopsys.h"
29 
30 #if defined(NV_BSD)
31 /* Define PCI classes that FreeBSD's linuxkpi is missing */
32 #define PCI_VENDOR_ID_NVIDIA 0x10de
33 #define PCI_CLASS_DISPLAY_VGA 0x0300
34 #define PCI_CLASS_DISPLAY_3D 0x0302
35 #define PCI_CLASS_BRIDGE_OTHER 0x0680
36 #endif
37 
38 /* Devices supported by RM */
39 struct pci_device_id nv_pci_table[] = {
40     {
41         .vendor      = PCI_VENDOR_ID_NVIDIA,
42         .device      = PCI_ANY_ID,
43         .subvendor   = PCI_ANY_ID,
44         .subdevice   = PCI_ANY_ID,
45         .class       = (PCI_CLASS_DISPLAY_VGA << 8),
46         .class_mask  = ~0
47     },
48     {
49         .vendor      = PCI_VENDOR_ID_NVIDIA,
50         .device      = PCI_ANY_ID,
51         .subvendor   = PCI_ANY_ID,
52         .subdevice   = PCI_ANY_ID,
53         .class       = (PCI_CLASS_DISPLAY_3D << 8),
54         .class_mask  = ~0
55     },
56     { }
57 };
58 
59 /* Devices supported by all drivers in nvidia.ko */
60 struct pci_device_id nv_module_device_table[4] = {
61     {
62         .vendor      = PCI_VENDOR_ID_NVIDIA,
63         .device      = PCI_ANY_ID,
64         .subvendor   = PCI_ANY_ID,
65         .subdevice   = PCI_ANY_ID,
66         .class       = (PCI_CLASS_DISPLAY_VGA << 8),
67         .class_mask  = ~0
68     },
69     {
70         .vendor      = PCI_VENDOR_ID_NVIDIA,
71         .device      = PCI_ANY_ID,
72         .subvendor   = PCI_ANY_ID,
73         .subdevice   = PCI_ANY_ID,
74         .class       = (PCI_CLASS_DISPLAY_3D << 8),
75         .class_mask  = ~0
76     },
77     {
78         .vendor      = PCI_VENDOR_ID_NVIDIA,
79         .device      = PCI_ANY_ID,
80         .subvendor   = PCI_ANY_ID,
81         .subdevice   = PCI_ANY_ID,
82         .class       = (PCI_CLASS_BRIDGE_OTHER << 8),
83         .class_mask  = ~0
84     },
85     { }
86 };
87 
88 #if defined(NV_LINUX)
89 MODULE_DEVICE_TABLE(pci, nv_module_device_table);
90 #endif
91