10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52588Segillett * Common Development and Distribution License (the "License"). 62588Segillett * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*11520SScott.Carter@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_PX_MSIQ_H 270Sstevel@tonic-gate #define _SYS_PX_MSIQ_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate /* 340Sstevel@tonic-gate * MSIQ data structure. 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate struct px_msiq { 370Sstevel@tonic-gate msiqid_t msiq_id; /* MSIQ ID */ 382973Sgovinda ushort_t msiq_state; /* MSIQ alloc state */ 392973Sgovinda ushort_t msiq_refcnt; /* # of MSIQ users */ 402588Segillett msiqhead_t *msiq_base_p; /* MSIQ base pointer */ 412973Sgovinda 422973Sgovinda /* Fields accessed under interrupt context */ 432973Sgovinda msiqhead_t msiq_curr_head_index; /* MSIQ Curr head index */ 442973Sgovinda msiqhead_t msiq_new_head_index; /* MSIQ new head index */ 452973Sgovinda ushort_t msiq_recs2process; /* # of MSIQ records to process */ 460Sstevel@tonic-gate }; 470Sstevel@tonic-gate 480Sstevel@tonic-gate #define MSIQ_STATE_FREE 0x1 490Sstevel@tonic-gate #define MSIQ_STATE_INUSE 0x2 500Sstevel@tonic-gate 510Sstevel@tonic-gate /* 520Sstevel@tonic-gate * MSIQ soft state structure. 530Sstevel@tonic-gate */ 540Sstevel@tonic-gate typedef struct px_msiq_state { 550Sstevel@tonic-gate /* Available MSIQs */ 560Sstevel@tonic-gate uint_t msiq_cnt; /* # of MSIQs */ 570Sstevel@tonic-gate uint_t msiq_rec_cnt; /* # of records per MSIQ */ 580Sstevel@tonic-gate msiqid_t msiq_1st_msiq_id; /* First MSIQ ID */ 590Sstevel@tonic-gate devino_t msiq_1st_devino; /* First devino */ 6010053SEvan.Yan@Sun.COM boolean_t msiq_redist_flag; /* Flag to redist MSIQs */ 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* MSIQs specific reserved for MSI/Xs */ 630Sstevel@tonic-gate uint_t msiq_msi_qcnt; /* # of MSIQs for MSI/Xs */ 640Sstevel@tonic-gate msiqid_t msiq_1st_msi_qid; /* First MSIQ ID for MSI/Xs */ 650Sstevel@tonic-gate 660Sstevel@tonic-gate /* MSIQs specific reserved for PCIe messages */ 670Sstevel@tonic-gate uint_t msiq_msg_qcnt; /* # of MSIQs for PCIe msgs */ 680Sstevel@tonic-gate msiqid_t msiq_1st_msg_qid; /* First MSIQ ID for PCIe msgs */ 690Sstevel@tonic-gate 700Sstevel@tonic-gate px_msiq_t *msiq_p; /* Pointer to MSIQs array */ 710Sstevel@tonic-gate void *msiq_buf_p; /* Pointer to MSIQs array */ 720Sstevel@tonic-gate } px_msiq_state_t; 730Sstevel@tonic-gate 740Sstevel@tonic-gate /* 750Sstevel@tonic-gate * px_msi_eq_to_devino 760Sstevel@tonic-gate */ 770Sstevel@tonic-gate typedef struct px_msi_eq_to_devino { 780Sstevel@tonic-gate int msi_eq_no; 790Sstevel@tonic-gate int no_msi_eqs; 800Sstevel@tonic-gate int devino_no; 810Sstevel@tonic-gate } px_msi_eq_to_devino_t; 820Sstevel@tonic-gate 830Sstevel@tonic-gate extern int px_msiq_attach(px_t *px_p); 840Sstevel@tonic-gate extern void px_msiq_detach(px_t *px_p); 852588Segillett extern void px_msiq_resume(px_t *px_p); 860Sstevel@tonic-gate 870Sstevel@tonic-gate extern int px_msiq_alloc(px_t *px_p, msiq_rec_type_t rec_type, 8810841SAlan.Adamson@Sun.COM msgcode_t msg_code, msiqid_t *msiq_id_p); 8910053SEvan.Yan@Sun.COM extern int px_msiq_alloc_based_on_cpuid(px_t *px_p, 9010053SEvan.Yan@Sun.COM msiq_rec_type_t rec_type, cpuid_t cpuid, 9110053SEvan.Yan@Sun.COM msiqid_t *msiq_id_p); 920Sstevel@tonic-gate extern int px_msiq_free(px_t *px_p, msiqid_t msiq_id); 9310053SEvan.Yan@Sun.COM extern void px_msiq_redist(px_t *px_p); 940Sstevel@tonic-gate 950Sstevel@tonic-gate extern devino_t px_msiqid_to_devino(px_t *px_p, msiqid_t msiq_id); 960Sstevel@tonic-gate extern msiqid_t px_devino_to_msiqid(px_t *px_p, devino_t devino); 970Sstevel@tonic-gate 980Sstevel@tonic-gate #ifdef __cplusplus 990Sstevel@tonic-gate } 1000Sstevel@tonic-gate #endif 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate #endif /* _SYS_PX_MSIQ_H */ 103