4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #include <sys/dditypes.h>
37 #define PCI_GETBDF(b, d, f) \
39 ((((uint16_t)b & 0xff) << 8) + (((uint8_t)d & 0x1f) << 3) + \
40 ((uint8_t)f & 0x7)) : \
41 ((((uint16_t)b & 0xff) << 8) + ((uint8_t)f & 0xff)))
43 typedef union pci_cfg_data
{
50 typedef enum pci_config_size
{
51 PCI_CFG_SIZE_BYTE
= 1,
52 PCI_CFG_SIZE_WORD
= 2,
53 PCI_CFG_SIZE_DWORD
= 4,
54 PCI_CFG_SIZE_QWORD
= 8
57 typedef struct pci_cfgacc_req
{
66 #define VAL8(req) ((req)->value.b)
67 #define VAL16(req) ((req)->value.w)
68 #define VAL32(req) ((req)->value.dw)
69 #define VAL64(req) ((req)->value.qw)
71 extern uint8_t pci_cfgacc_get8(dev_info_t
*, uint16_t, uint16_t);
72 extern uint16_t pci_cfgacc_get16(dev_info_t
*, uint16_t, uint16_t);
73 extern uint32_t pci_cfgacc_get32(dev_info_t
*, uint16_t, uint16_t);
74 extern uint64_t pci_cfgacc_get64(dev_info_t
*, uint16_t, uint16_t);
75 extern void pci_cfgacc_put8(dev_info_t
*, uint16_t, uint16_t, uint8_t);
76 extern void pci_cfgacc_put16(dev_info_t
*, uint16_t, uint16_t, uint16_t);
77 extern void pci_cfgacc_put32(dev_info_t
*, uint16_t, uint16_t, uint32_t);
78 extern void pci_cfgacc_put64(dev_info_t
*, uint16_t, uint16_t, uint64_t);
79 extern void pci_cfgacc_acc(pci_cfgacc_req_t
*);
87 #endif /* _PCI_CFGACC_H */