pci_impl.h revision c2e7b48d563d0e56b74d853118918af352e75cbb
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_PCI_IMPL_H
#define _SYS_PCI_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/dditypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* There are two ways to access the PCI configuration space on X86
* Access method 2 is the older method
* Access method 1 is the newer method and is preferred because
* of the problems in trying to lock the configuration space
* for MP machines using method 2. See PCI Local BUS Specification
* Revision 2.0 section 3.6.4.1 for more details.
*
* In addition, on IBM Sandalfoot and a few related machines there's
* still another mechanism. See PReP 1.1 section 6.1.7.
*/
#define PCI_MECHANISM_UNKNOWN -1
#define PCI_MECHANISM_NONE 0
#define PCI_MECHANISM_1 1
#define PCI_MECHANISM_2 2
#else
#error "Unknown processor type"
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define PCI_FUNC_MASK 0x07
/* these macros apply to Configuration Mechanism #1 */
#define PCI_CONFADD 0xcf8
#define PCI_PMC 0xcfb
#define PCI_CONFDATA 0xcfc
#define PCI_CONE 0x80000000
/* these macros apply to Configuration Mechanism #2 */
#define PCI_CSE_PORT 0xcf8
#define PCI_FORW_PORT 0xcfa
typedef struct pci_acc_cfblk {
struct pci_bus_resource {
struct memlist *pmem_space;
void *privdata; /* private data for configuration */
#ifdef _LP64
#endif
};
extern struct pci_bus_resource *pci_bus_res;
/*
* For now, x86-only to avoid conflicts with <sys/memlist_impl.h>
*/
extern struct memlist *memlist_alloc(void);
extern void memlist_free(struct memlist *);
extern void memlist_dump(struct memlist *);
extern int memlist_count(struct memlist *);
#endif /* __i386 || __amd64 */
/*
* PCI capability related definitions.
*/
/*
* Minimum number of dwords to be saved.
*/
#define PCI_MSI_MIN_WORDS 3
#define PCI_PCIX_MIN_WORDS 2
#define PCI_PCIE_MIN_WORDS 5
/*
* Total number of dwords to be saved.
*/
#define PCI_PMCAP_NDWORDS 2
#define PCI_AGP_NDWORDS 3
#define PCI_SLOTID_NDWORDS 1
#define PCI_MSIX_NDWORDS 3
#define PCI_CAP_SZUNKNOWN 0
((xspace) ? 0 : \
extern int pci_resource_setup(dev_info_t *);
extern void pci_resource_destroy(dev_info_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PCI_IMPL_H */