| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pci.h,v 1.1.2.10 2013/07/24 03:16:47 riastradh Exp $ */ | | 1 | /* $NetBSD: pci.h,v 1.1.2.11 2013/07/24 03:18:24 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Taylor R. Campbell. | | 8 | * by Taylor R. Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -56,38 +56,44 @@ struct pci_device_id { | | | @@ -56,38 +56,44 @@ struct pci_device_id { |
56 | }; | | 56 | }; |
57 | | | 57 | |
58 | #define PCI_ANY_ID ((pcireg_t)-1) | | 58 | #define PCI_ANY_ID ((pcireg_t)-1) |
59 | | | 59 | |
60 | #define PCI_BASE_CLASS_DISPLAY PCI_CLASS_DISPLAY | | 60 | #define PCI_BASE_CLASS_DISPLAY PCI_CLASS_DISPLAY |
61 | | | 61 | |
62 | #define PCI_CLASS_BRIDGE_ISA PCI_SUBCLASS_BRIDGE_ISA | | 62 | #define PCI_CLASS_BRIDGE_ISA PCI_SUBCLASS_BRIDGE_ISA |
63 | | | 63 | |
64 | #define PCI_VENDOR_ID_INTEL PCI_VENDOR_INTEL | | 64 | #define PCI_VENDOR_ID_INTEL PCI_VENDOR_INTEL |
65 | | | 65 | |
66 | struct pci_dev { | | 66 | struct pci_dev { |
67 | struct pci_attach_args pd_pa; | | 67 | struct pci_attach_args pd_pa; |
68 | bool pd_kludged; /* XXX pci_kludgey_find_dev */ | | 68 | bool pd_kludged; /* XXX pci_kludgey_find_dev */ |
69 | device_t dev; | | 69 | device_t pd_dev; |
70 | struct pci_bus *bus; | | 70 | struct pci_bus *bus; |
71 | uint32_t devfn; | | 71 | uint32_t devfn; |
72 | uint16_t vendor; | | 72 | uint16_t vendor; |
73 | uint16_t device; | | 73 | uint16_t device; |
74 | uint16_t subsystem_vendor; | | 74 | uint16_t subsystem_vendor; |
75 | uint16_t subsystem_device; | | 75 | uint16_t subsystem_device; |
76 | uint8_t revision; | | 76 | uint8_t revision; |
77 | uint32_t class; | | 77 | uint32_t class; |
78 | bool msi_enabled; | | 78 | bool msi_enabled; |
79 | }; | | 79 | }; |
80 | | | 80 | |
| | | 81 | static inline device_t |
| | | 82 | pci_dev_dev(struct pci_dev *pdev) |
| | | 83 | { |
| | | 84 | return pdev->pd_dev; |
| | | 85 | } |
| | | 86 | |
81 | #define PCI_DEVFN(DEV, FN) \ | | 87 | #define PCI_DEVFN(DEV, FN) \ |
82 | (__SHIFTIN((DEV), __BITS(3, 7)) | __SHIFTIN((FN), __BITS(0, 2))) | | 88 | (__SHIFTIN((DEV), __BITS(3, 7)) | __SHIFTIN((FN), __BITS(0, 2))) |
83 | #define PCI_SLOT(DEVFN) __SHIFTOUT((DEVFN), __BITS(3, 7)) | | 89 | #define PCI_SLOT(DEVFN) __SHIFTOUT((DEVFN), __BITS(3, 7)) |
84 | #define PCI_FUNC(DEVFN) __SHIFTOUT((DEVFN), __BITS(0, 2)) | | 90 | #define PCI_FUNC(DEVFN) __SHIFTOUT((DEVFN), __BITS(0, 2)) |
85 | | | 91 | |
86 | #define PCI_CAP_ID_AGP PCI_CAP_AGP | | 92 | #define PCI_CAP_ID_AGP PCI_CAP_AGP |
87 | | | 93 | |
88 | static inline int | | 94 | static inline int |
89 | pci_find_capability(struct pci_dev *pdev, int cap) | | 95 | pci_find_capability(struct pci_dev *pdev, int cap) |
90 | { | | 96 | { |
91 | return pci_get_capability(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, cap, | | 97 | return pci_get_capability(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, cap, |
92 | NULL, NULL); | | 98 | NULL, NULL); |
93 | } | | 99 | } |