amd_iommu_cmd.c revision 7125fcbd464abbefeb0c10e07d1a93245fc59863
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/amd_iommu.h>
#include "amd_iommu_impl.h"
static void
{
}
static int
{
const char *f = "create_compl_wait_cmd";
if (flags & AMD_IOMMU_CMD_FLAGS_COMPL_WAIT_S) {
"not supported for completion wait command",
return (DDI_FAILURE);
}
(flags & AMD_IOMMU_CMD_FLAGS_COMPL_WAIT_F) != 0);
cmdptr[2] = 0;
cmdptr[3] = 0;
return (DDI_SUCCESS);
}
static int
{
const char *f = "create_inval_devtab_entry_cmd";
if (flags != AMD_IOMMU_CMD_FLAGS_NONE) {
return (DDI_FAILURE);
}
deviceid);
cmdptr[2] = 0;
cmdptr[3] = 0;
return (DDI_SUCCESS);
}
/*ARGSUSED*/
static int
{
cmdptr[0] = 0;
(flags & AMD_IOMMU_CMD_FLAGS_PAGE_PDE_INVAL) != 0);
(flags & AMD_IOMMU_CMD_FLAGS_PAGE_INVAL_S) != 0);
addr_lo);
return (DDI_SUCCESS);
}
/*ARGSUSED*/
static int
{
addr_lo);
(flags & AMD_IOMMU_CMD_FLAGS_IOTLB_INVAL_S) != 0);
return (DDI_SUCCESS);
}
static int
{
const char *f = "create_inval_intr_table_cmd";
if (flags != AMD_IOMMU_CMD_FLAGS_NONE) {
"for invalidate interrupt table command",
return (DDI_FAILURE);
}
cmdptr[2] = 0;
cmdptr[3] = 0;
return (DDI_SUCCESS);
}
int
{
int error;
int i;
const char *f = "amd_iommu_cmd";
if (!lock_held)
/*
* Prepare the command
*/
switch (cmd) {
case AMD_IOMMU_CMD_COMPL_WAIT:
if (flags & AMD_IOMMU_CMD_FLAGS_COMPL_WAIT) {
" after completion wait command",
error = DDI_FAILURE;
goto out;
}
break;
break;
break;
break;
break;
default:
error = DDI_FAILURE;
goto out;
}
if (error != DDI_SUCCESS) {
error = DDI_FAILURE;
goto out;
}
for (i = 0; i < 4; i++) {
}
/* check for overflow */
#ifdef DEBUG
"drain");
#endif
goto wait_for_drain;
}
/*
* Update the tail pointer in soft state
* and the tail pointer register
*/
+ iommu->aiomt_cmdbuf_sz)) {
/* wraparound */
/*LINTED*/
cmdtail_off = 0;
} else {
/*LINTED*/
- iommu->aiomt_cmdbuf;
}
if (cmd == AMD_IOMMU_CMD_COMPL_WAIT) {
} else if (flags & AMD_IOMMU_CMD_FLAGS_COMPL_WAIT) {
}
out:
if (!lock_held)
return (error);
}