pci_cfgacc_x86.c revision 137632774395dba0eb9b77257da1d8732bd5413d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/pci_cfgacc.h>
#include <sys/pci_cfgspace.h>
#include <sys/pci_cfgspace_impl.h>
#include <sys/sysmacros.h>
#include <sys/x86_archext.h>
#include <vm/seg_kmem.h>
#include <vm/kboot_mmu.h>
/* patchable variables */
void pci_cfgacc_acc(pci_cfgacc_req_t *);
/*
* IS_P2ALIGNED() is used to make sure offset is 'size'-aligned, so
* it's guaranteed that the access will not cross 4k page boundary.
* Thus only 1 page is allocated for all config space access, and the
* virtual address of that page is cached in pci_cfgacc_virt_base.
*/
static caddr_t
{
#ifdef __xpv
(phys_addr & MMU_PAGEOFFSET);
#endif
if (khat_running) {
/*
* pci_cfgacc_virt_base may hold address left from early
* boot, which points to low mem. Realloc virtual address
* in kernel space since it's already late in boot now.
* Note: no need to unmap first, clear_boot_mappings() will
* do that for us.
*/
return (NULL);
}
} else {
if (pci_cfgacc_virt_base == NULL) {
if ((pci_cfgacc_virt_base = (caddr_t)
return (NULL);
}
}
}
static void
{
if (khat_running)
}
static void
{
return;
}
case 1:
else
break;
case 2:
else
break;
case 4:
else
break;
default:
return;
}
}
static int
{
int rval = DDI_SUCCESS;
return (DDI_FAILURE);
}
case 1:
else
break;
case 2:
else
break;
case 4:
else
break;
case 8:
else
break;
default:
rval = DDI_FAILURE;
}
return (rval);
}
static boolean_t
{
}
void
{
if (!pci_cfgacc_valid(req)) {
return;
}
goto ioacc;
goto ioacc;
/* check if workaround is needed */
goto ioacc;
goto ioacc;
return;
}
typedef struct cfgacc_bus_range {
struct cfgacc_bus_range *next;
/*
* This function is only supposed to be called in device tree setup time,
* thus no lock is needed.
*/
void
{
}
{
/* found a device which is known to be broken */
return (B_TRUE);
}
/*
* found a device whose parent/grandparent is
* known to be broken.
*/
return (B_TRUE);
}
}
return (B_FALSE);
}