pci.c revision 88b44bf4e73233af70877930178dbff7f1c2992b
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CDDL HEADER START
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The contents of this file are subject to the terms of the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Common Development and Distribution License (the "License").
199767f8919635c4928607450d9e0abb932109ceToomas Soome * You may not use this file except in compliance with the License.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * See the License for the specific language governing permissions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * and limitations under the License.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * When distributing Covered Code, include this CDDL HEADER in each
199767f8919635c4928607450d9e0abb932109ceToomas Soome * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * If applicable, add the following below this CDDL HEADER, with the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * fields enclosed by brackets "[]" replaced with your own identifying
199767f8919635c4928607450d9e0abb932109ceToomas Soome * information: Portions Copyright [yyyy] [name of copyright owner]
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CDDL HEADER END
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Use is subject to license terms.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Host to PCI local bus driver
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Save minimal state. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Bus Operation functions
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_bus_map(dev_info_t *, dev_info_t *, ddi_map_req_t *,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_ctlops(dev_info_t *, dev_info_t *, ddi_ctl_enum_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soome void *, void *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_intr_ops(dev_info_t *, dev_info_t *, ddi_intr_op_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_fm_init(dev_info_t *, dev_info_t *, int,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_fm_callback(dev_info_t *, ddi_fm_error_t *, const void *);
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, /* (*bus_get_eventcookie)(); */
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, /* (*bus_add_eventcall)(); */
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, /* (*bus_remove_eventcall)(); */
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, /* (*bus_post_event)(); */
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, /* (*bus_intr_ctl)(); */
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, /* (*bus_config)(); */
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, /* (*bus_unconfig)(); */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * One goal here is to leverage off of the pcihp.c source without making
199767f8919635c4928607450d9e0abb932109ceToomas Soome * changes to it. Call into it's cb_ops directly if needed, piggybacking
199767f8919635c4928607450d9e0abb932109ceToomas Soome * anything else needed by the pci_tools.c module. Only pci_tools and pcihp
199767f8919635c4928607450d9e0abb932109ceToomas Soome * will be opening PCI nexus driver file descriptors.
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_open(dev_t *, int, int, cred_t *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_close(dev_t, int, int, cred_t *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_ioctl(dev_t, int, intptr_t, int, cred_t *, int *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_prop_op(dev_t, dev_info_t *, ddi_prop_op_t, int, char *,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int pci_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic void pci_peekpoke_cb(dev_info_t *, ddi_fm_error_t *);
(void *)&modldrv,
_init(void)
_fini(void)
int rc;
if (rc != 0)
return (rc);
return (rc);
switch (cmd) {
case DDI_ATTACH:
case DDI_RESUME:
return (DDI_SUCCESS);
return (DDI_FAILURE);
!= DDI_PROP_SUCCESS) {
goto bad_soft_state;
goto bad_pcihp_init;
goto bad_pcitool_init;
return (DDI_SUCCESS);
return (DDI_FAILURE);
switch (cmd) {
case DDI_DETACH:
return (DDI_SUCCESS);
case DDI_SUSPEND:
return (DDI_SUCCESS);
return (DDI_FAILURE);
int rnumber;
int length;
int space;
case DDI_MT_REGSPEC:
return (DDI_FAILURE);
case DDI_MT_RNUMBER:
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_ME_INVAL);
if (len != 0)
switch (space) {
case PCI_ADDR_CONFIG:
return (DDI_SUCCESS);
case PCI_ADDR_IO:
case PCI_ADDR_MEM64:
case PCI_ADDR_MEM32:
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_FAILURE);
if (len != 0)
switch (space) {
case PCI_ADDR_IO:
case PCI_ADDR_MEM64:
return (DDI_FAILURE);
case PCI_ADDR_MEM32:
return (DDI_FAILURE);
int rn;
int totreg;
switch (ctlop) {
case DDI_CTLOPS_REPORTDEV:
return (DDI_FAILURE);
return (DDI_SUCCESS);
case DDI_CTLOPS_INITCHILD:
case DDI_CTLOPS_UNINITCHILD:
case DDI_CTLOPS_SIDDEV:
return (DDI_SUCCESS);
case DDI_CTLOPS_REGSIZE:
case DDI_CTLOPS_NREGS:
return (DDI_FAILURE);
*(int *)result = 0;
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_SUCCESS);
case DDI_CTLOPS_POWER: {
return (DDI_SUCCESS);
case DDI_CTLOPS_PEEK:
case DDI_CTLOPS_POKE:
case DDI_CTLOPS_ATTACH:
return (DDI_FAILURE);
case DDI_CTLOPS_DETACH:
return (DDI_FAILURE);
return (DDI_FAILURE);
extern int pci_allow_pseudo_children;
DDI_SUCCESS) {
return (DDI_FAILURE);
if (pci_allow_pseudo_children) {
return (DDI_SUCCESS);
return (DDI_SUCCESS);
return (DDI_NOT_WELL_FORMED);
return (DDI_FAILURE);
return (DDI_SUCCESS);
return (DDI_SUCCESS);
return (ENXIO);
case PCI_TOOL_REG_MINOR_NUM:
case PCI_TOOL_INTR_MINOR_NUM:
return (ret);