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 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 26*2a1fd0ffSPeter Tribble /* 27*2a1fd0ffSPeter Tribble * Copyright 2019 Peter Tribble. 28*2a1fd0ffSPeter Tribble */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifndef _SYS_PCI_CB_H 317c478bd9Sstevel@tonic-gate #define _SYS_PCI_CB_H 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #ifdef __cplusplus 347c478bd9Sstevel@tonic-gate extern "C" { 357c478bd9Sstevel@tonic-gate #endif 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate typedef uint16_t cb_nid_t; 387c478bd9Sstevel@tonic-gate enum cb_nintr_index { 397c478bd9Sstevel@tonic-gate CBNINTR_PBM = 0, /* all not shared */ 407c478bd9Sstevel@tonic-gate CBNINTR_PBM66 = 0, /* all not shared */ 417c478bd9Sstevel@tonic-gate CBNINTR_PBM33 = 0, /* all not shared */ 427c478bd9Sstevel@tonic-gate CBNINTR_UE = 1, /* all shared */ 437c478bd9Sstevel@tonic-gate CBNINTR_CE = 2, /* all shared */ 447c478bd9Sstevel@tonic-gate CBNINTR_POWER_FAIL = 3, /* psycho shared */ 457c478bd9Sstevel@tonic-gate CBNINTR_POWER_BUTTON = 3, /* sabre N/A */ 467c478bd9Sstevel@tonic-gate CBNINTR_PME_HB = 3, /* hummingbird N/A */ 477c478bd9Sstevel@tonic-gate CBNINTR_BUS_ERROR = 3, /* schizo shared */ 487c478bd9Sstevel@tonic-gate CBNINTR_THERMAL = 4, /* psycho shared */ 497c478bd9Sstevel@tonic-gate CBNINTR_PME = 4, /* schizo not shared */ 507c478bd9Sstevel@tonic-gate CBNINTR_CDMA = 4, /* schizo not shared */ 517c478bd9Sstevel@tonic-gate CBNINTR_PWR_MANAGE = 5, /* psycho shared */ 527c478bd9Sstevel@tonic-gate CBNINTR_MAX /* count coding */ 537c478bd9Sstevel@tonic-gate }; 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * control block soft state structure: 577c478bd9Sstevel@tonic-gate * 587c478bd9Sstevel@tonic-gate * Each pci node contains shares a control block structure with its peer 597c478bd9Sstevel@tonic-gate * node. The control block node contains csr and id registers for chip 607c478bd9Sstevel@tonic-gate * and acts as a "catch all" for other functionality that does not cleanly 617c478bd9Sstevel@tonic-gate * fall into other functional blocks. This block is also used to handle 627c478bd9Sstevel@tonic-gate * software workarounds for known hardware bugs in different chip revs. 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate typedef struct cb cb_t; 657c478bd9Sstevel@tonic-gate struct cb { 667c478bd9Sstevel@tonic-gate pci_common_t *cb_pci_cmn_p; 677c478bd9Sstevel@tonic-gate cb_nid_t cb_node_id; 687c478bd9Sstevel@tonic-gate pci_ign_t cb_ign; /* 1st-attached-side interrupt grp# */ 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate kmutex_t cb_intr_lock; /* guards add/rem intr and intr dist */ 717c478bd9Sstevel@tonic-gate uint32_t cb_no_of_inos; /* # of actual inos, including PBM */ 727c478bd9Sstevel@tonic-gate uint32_t cb_inos[CBNINTR_MAX]; /* subset of pci_p->pci_inos array */ 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate uint64_t cb_base_pa; /* PA of schizo CSR bank, 2nd "reg" */ 757c478bd9Sstevel@tonic-gate uint64_t cb_icbase_pa; /* PA of tomatillo IChip register */ 767c478bd9Sstevel@tonic-gate /* bank, 4th "reg" entry */ 777c478bd9Sstevel@tonic-gate uint64_t cb_map_pa; /* 1st-attached-side map reg base PA */ 787c478bd9Sstevel@tonic-gate uint64_t cb_clr_pa; /* 1st-attached-side clr reg base PA */ 797c478bd9Sstevel@tonic-gate uint64_t cb_obsta_pa; /* 1st-attached-side sta reg base PA */ 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate uint64_t *cb_imr_save; 827c478bd9Sstevel@tonic-gate }; 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate #define CB_INO_TO_MONDO(cb_p, ino) ((cb_p)->cb_ign << PCI_INO_BITS | (ino)) 857c478bd9Sstevel@tonic-gate #define CB_MONDO_TO_XMONDO(cb_p, mondo) /* local mondo to global mondo */ \ 867c478bd9Sstevel@tonic-gate ((cb_p)->cb_node_id << (PCI_IGN_BITS + PCI_INO_BITS) | (mondo)) 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate extern void cb_create(pci_t *pci_p); 897c478bd9Sstevel@tonic-gate extern void cb_destroy(pci_t *pci_p); 907c478bd9Sstevel@tonic-gate extern void cb_suspend(cb_t *cb_p); 917c478bd9Sstevel@tonic-gate extern void cb_resume(cb_t *cb_p); 927c478bd9Sstevel@tonic-gate extern void cb_enable_nintr(pci_t *pci_p, enum cb_nintr_index idx); 937c478bd9Sstevel@tonic-gate extern void cb_disable_nintr(cb_t *cb_p, enum cb_nintr_index idx, int wait); 947c478bd9Sstevel@tonic-gate extern void cb_clear_nintr(cb_t *cb_p, enum cb_nintr_index idx); 957c478bd9Sstevel@tonic-gate extern void cb_intr_dist(void *arg); 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #ifdef __cplusplus 987c478bd9Sstevel@tonic-gate } 997c478bd9Sstevel@tonic-gate #endif 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate #endif /* _SYS_PCI_CB_H */ 102