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.
36 typedef struct px_msi
{
37 dev_info_t
*msi_dip
; /* MSI consumer dip */
38 int msi_inum
; /* INUM for this device */
39 uint_t msi_state
; /* MSI alloc state */
40 msinum_t msi_msinum
; /* MSI number */
41 msiqid_t msi_msiq_id
; /* MSIQ used */
44 #define MSI_STATE_FREE 0x1
45 #define MSI_STATE_INUSE 0x2
48 * MSI soft state structure.
50 typedef struct px_msi_state
{
51 uint_t msi_cnt
; /* No of MSIs */
52 msinum_t msi_1st_msinum
; /* First MSI number */
53 uint_t msi_data_mask
; /* MSI data mask */
54 uint_t msi_data_width
; /* MSI data width */
55 uint64_t msi_addr32
; /* MSI 32 address */
56 uint64_t msi_addr32_len
; /* MSI 32 length */
57 uint64_t msi_addr64
; /* MSI 64 address */
58 uint64_t msi_addr64_len
; /* MSI 64 length */
60 px_msi_t
*msi_p
; /* Pointer to MSIs array */
61 kmutex_t msi_mutex
; /* Mutex for MSI alloc/free */
62 uint_t msi_type
; /* MSI or MSI-X */
63 boolean_t msi_mem_flg
; /* TRUE if driver allocates memory */
65 ddi_irm_pool_t
*msi_pool_p
; /* IRM Pool */
71 typedef struct px_msi_ranges
{
77 * px_msi_address_ranges
79 typedef struct px_msi_address_ranges
{
80 uint32_t msi_addr32_hi
;
81 uint32_t msi_addr32_lo
;
82 uint32_t msi_addr32_len
;
83 uint32_t msi_addr64_hi
;
84 uint32_t msi_addr64_lo
;
85 uint32_t msi_addr64_len
;
86 } px_msi_address_ranges_t
;
88 #define PX_MSI_WIDTH 16
89 #define PX_MSIX_WIDTH 32
91 extern int px_msi_attach(px_t
*px_p
);
92 extern void px_msi_detach(px_t
*px_p
);
94 extern int px_msi_alloc(px_t
*px_p
, dev_info_t
*rdip
, int type
, int inum
,
95 int msi_count
, int flag
, int *actual_msi_count_p
);
96 extern int px_msi_free(px_t
*px_p
, dev_info_t
*rdip
, int inum
,
99 extern int px_msi_get_msinum(px_t
*px_p
, dev_info_t
*rdip
,
100 int inum
, msinum_t
*msi_num_p
);
106 #endif /* _SYS_PX_MSI_H */