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 53c4226f9Spjha * Common Development and Distribution License (the "License"). 63c4226f9Spjha * 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*26947304SEvan Yan * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 2370025d76Sjohnny * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_HOTPLUG_PCI_PCIHP_H 277c478bd9Sstevel@tonic-gate #define _SYS_HOTPLUG_PCI_PCIHP_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 333c4226f9Spjha #ifdef _KERNEL 347c478bd9Sstevel@tonic-gate /* 357c478bd9Sstevel@tonic-gate * Interfaces exported by PCI Nexus extension module, kernel/misc/pcihp. 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate int pcihp_init(dev_info_t *); 387c478bd9Sstevel@tonic-gate int pcihp_uninit(dev_info_t *); 397c478bd9Sstevel@tonic-gate int pcihp_info(dev_info_t *, ddi_info_cmd_t, void *, void **); 407c478bd9Sstevel@tonic-gate struct cb_ops *pcihp_get_cb_ops(void); 413c4226f9Spjha #endif 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* definitions for minor numbers */ 447c478bd9Sstevel@tonic-gate #define PCIHP_AP_MINOR_NUM(x, y) (((uint_t)(x) << 8) | \ 457c478bd9Sstevel@tonic-gate ((y) & 0xFF)) 467c478bd9Sstevel@tonic-gate #define PCIHP_AP_MINOR_NUM_TO_PCI_DEVNUM(x) ((x) & 0xFF) 477c478bd9Sstevel@tonic-gate #define PCIHP_AP_MINOR_NUM_TO_INSTANCE(x) ((x) >> 8) 487c478bd9Sstevel@tonic-gate #define PCIHP_DEVCTL_MINOR 0xFF 497c478bd9Sstevel@tonic-gate #define PCIHP_DEBUG_MINOR 0xFE 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* definitons for cPCI platforms */ 527c478bd9Sstevel@tonic-gate #define PCI_CONF_EXTCAP 0x34 /* Extended Capabilities Pointer */ 537c478bd9Sstevel@tonic-gate #define PCI_ECP_CAPID 0x00 /* Capability ID */ 547c478bd9Sstevel@tonic-gate #define PCI_ECP_NEXT 0x01 /* Pointer to Next Capability */ 557c478bd9Sstevel@tonic-gate #define PCI_ECP_HS_CSR 0x02 /* Hot Swap Control and Status Reg */ 567c478bd9Sstevel@tonic-gate #define CPCI_HOTSWAP_CAPID 0x06 /* Hot Swap Capability ID */ 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate #define HS_CSR_INS 0x80 /* ENUM Status - Insertion */ 597c478bd9Sstevel@tonic-gate #define HS_CSR_EXT 0x40 /* ENUM Status - Extraction */ 607c478bd9Sstevel@tonic-gate #define HS_CSR_LOO 0x08 /* LED ON/OFF 1=ON 0=OFF */ 617c478bd9Sstevel@tonic-gate #define HS_CSR_EIM 0x02 /* ENUM# Signal Mask */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #define PCIHP_MAKE_REG_HIGH(busnum, devnum, funcnum, register)\ 647c478bd9Sstevel@tonic-gate (\ 657c478bd9Sstevel@tonic-gate ((ulong_t)(busnum & 0xff) << 16) |\ 667c478bd9Sstevel@tonic-gate ((ulong_t)(devnum & 0x1f) << 11) |\ 677c478bd9Sstevel@tonic-gate ((ulong_t)(funcnum & 0x7) << 8) |\ 687c478bd9Sstevel@tonic-gate ((ulong_t)(register & 0x3f))) 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate #define PCIHP_SUCCESS DDI_SUCCESS 717c478bd9Sstevel@tonic-gate #define PCIHP_FAILURE DDI_FAILURE 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* cPCI hotswap definitions */ 747c478bd9Sstevel@tonic-gate #define PCIHP_HANDLE_ENUM 1 /* clear interrupt and take action */ 757c478bd9Sstevel@tonic-gate #define PCIHP_CLEAR_ENUM 2 /* clear interrupt only. */ 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate #ifdef __cplusplus 787c478bd9Sstevel@tonic-gate } 797c478bd9Sstevel@tonic-gate #endif 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate #endif /* _SYS_HOTPLUG_PCI_PCIHP_H */ 82