17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5023ccc1eSegillett * Common Development and Distribution License (the "License"). 6023ccc1eSegillett * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*d17daf0bSScott Carter, SD IOSW * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_PX_MSIQ_H 277c478bd9Sstevel@tonic-gate #define _SYS_PX_MSIQ_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * MSIQ data structure. 357c478bd9Sstevel@tonic-gate */ 367c478bd9Sstevel@tonic-gate struct px_msiq { 377c478bd9Sstevel@tonic-gate msiqid_t msiq_id; /* MSIQ ID */ 38b0fc0e77Sgovinda ushort_t msiq_state; /* MSIQ alloc state */ 39b0fc0e77Sgovinda ushort_t msiq_refcnt; /* # of MSIQ users */ 40023ccc1eSegillett msiqhead_t *msiq_base_p; /* MSIQ base pointer */ 41b0fc0e77Sgovinda 42b0fc0e77Sgovinda /* Fields accessed under interrupt context */ 43b0fc0e77Sgovinda msiqhead_t msiq_curr_head_index; /* MSIQ Curr head index */ 44b0fc0e77Sgovinda msiqhead_t msiq_new_head_index; /* MSIQ new head index */ 45b0fc0e77Sgovinda ushort_t msiq_recs2process; /* # of MSIQ records to process */ 467c478bd9Sstevel@tonic-gate }; 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #define MSIQ_STATE_FREE 0x1 497c478bd9Sstevel@tonic-gate #define MSIQ_STATE_INUSE 0x2 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* 527c478bd9Sstevel@tonic-gate * MSIQ soft state structure. 537c478bd9Sstevel@tonic-gate */ 547c478bd9Sstevel@tonic-gate typedef struct px_msiq_state { 557c478bd9Sstevel@tonic-gate /* Available MSIQs */ 567c478bd9Sstevel@tonic-gate uint_t msiq_cnt; /* # of MSIQs */ 577c478bd9Sstevel@tonic-gate uint_t msiq_rec_cnt; /* # of records per MSIQ */ 587c478bd9Sstevel@tonic-gate msiqid_t msiq_1st_msiq_id; /* First MSIQ ID */ 597c478bd9Sstevel@tonic-gate devino_t msiq_1st_devino; /* First devino */ 6009b1eac2SEvan Yan boolean_t msiq_redist_flag; /* Flag to redist MSIQs */ 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate /* MSIQs specific reserved for MSI/Xs */ 637c478bd9Sstevel@tonic-gate uint_t msiq_msi_qcnt; /* # of MSIQs for MSI/Xs */ 647c478bd9Sstevel@tonic-gate msiqid_t msiq_1st_msi_qid; /* First MSIQ ID for MSI/Xs */ 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* MSIQs specific reserved for PCIe messages */ 677c478bd9Sstevel@tonic-gate uint_t msiq_msg_qcnt; /* # of MSIQs for PCIe msgs */ 687c478bd9Sstevel@tonic-gate msiqid_t msiq_1st_msg_qid; /* First MSIQ ID for PCIe msgs */ 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate px_msiq_t *msiq_p; /* Pointer to MSIQs array */ 717c478bd9Sstevel@tonic-gate void *msiq_buf_p; /* Pointer to MSIQs array */ 727c478bd9Sstevel@tonic-gate } px_msiq_state_t; 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate /* 757c478bd9Sstevel@tonic-gate * px_msi_eq_to_devino 767c478bd9Sstevel@tonic-gate */ 777c478bd9Sstevel@tonic-gate typedef struct px_msi_eq_to_devino { 787c478bd9Sstevel@tonic-gate int msi_eq_no; 797c478bd9Sstevel@tonic-gate int no_msi_eqs; 807c478bd9Sstevel@tonic-gate int devino_no; 817c478bd9Sstevel@tonic-gate } px_msi_eq_to_devino_t; 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate extern int px_msiq_attach(px_t *px_p); 847c478bd9Sstevel@tonic-gate extern void px_msiq_detach(px_t *px_p); 85023ccc1eSegillett extern void px_msiq_resume(px_t *px_p); 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate extern int px_msiq_alloc(px_t *px_p, msiq_rec_type_t rec_type, 8818191143SAlan Adamson, SD OSSD msgcode_t msg_code, msiqid_t *msiq_id_p); 8909b1eac2SEvan Yan extern int px_msiq_alloc_based_on_cpuid(px_t *px_p, 9009b1eac2SEvan Yan msiq_rec_type_t rec_type, cpuid_t cpuid, 9109b1eac2SEvan Yan msiqid_t *msiq_id_p); 927c478bd9Sstevel@tonic-gate extern int px_msiq_free(px_t *px_p, msiqid_t msiq_id); 9309b1eac2SEvan Yan extern void px_msiq_redist(px_t *px_p); 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate extern devino_t px_msiqid_to_devino(px_t *px_p, msiqid_t msiq_id); 967c478bd9Sstevel@tonic-gate extern msiqid_t px_devino_to_msiqid(px_t *px_p, devino_t devino); 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate #ifdef __cplusplus 997c478bd9Sstevel@tonic-gate } 1007c478bd9Sstevel@tonic-gate #endif 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate #endif /* _SYS_PX_MSIQ_H */ 103