/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/ddi_impldefs.h>
#include <sys/sysmacros.h>
extern void *ioat_statep;
#ifdef DEBUG
#endif
/*
* ioat_ioctl()
*/
/*ARGSUSED*/
int
{
int instance;
int e;
if (e != 0) {
return (EPERM);
}
if (instance == -1) {
return (EBADF);
}
return (EBADF);
}
switch (cmd) {
case IOAT_IOCTL_READ_REG:
break;
#ifdef DEBUG
case IOAT_IOCTL_WRITE_REG:
break;
case IOAT_IOCTL_TEST:
break;
#endif
default:
e = ENXIO;
}
return (e);
}
/*
* ioat_ioctl_rdreg()
*/
static int
{
int e;
if (e != 0) {
return (EFAULT);
}
/*
* read a device register, where size is read size in bits, addr is
* the offset into MMIO registers.
*/
case 8:
break;
case 16:
break;
case 32:
break;
case 64:
break;
default:
return (EFAULT);
}
if (e != 0) {
return (EFAULT);
}
return (0);
}
#ifdef DEBUG
/*
* ioat_ioctl_wrreg()
*/
static int
{
int e;
if (e != 0) {
return (EFAULT);
}
/*
* write a device register, where size is write size in bits, addr is
* the offset into MMIO registers.
*/
case 8:
break;
case 16:
break;
case 32:
break;
case 64:
break;
default:
return (EFAULT);
}
return (0);
}
/*
* ioat_ioctl_test()
*/
/*ARGSUSED*/
static int
{
int flags;
int i;
int e;
/* allocate 2 paged aligned 4k pages */
buf_size = 0x1000;
/* Init source buffer */
for (i = 0; i < buf_size; i++) {
}
/* allocate a DMA channel */
if (e != DCOPY_SUCCESS) {
goto testfail_alloc;
}
/*
* post 32 DMA copy's from dest to dest. These will complete in order
* so they won't stomp on each other. We don't care about the data
* right now which is why we go dest to dest.
*/
flags = DCOPY_SLEEP;
for (i = 0; i < 32; i++) {
/*
* if this is the second command, link the commands from here
* on out. We only want to keep track of the last command. We
* will poll on the last command completing (which infers that
* the other commands completed). If any of the previous
* commands fail, so will the last one. Linking the commands
* also allows us to only call free for the last command. free
* will free up the entire chain of commands.
*/
if (i == 1) {
}
if (e != DCOPY_SUCCESS) {
goto testfail_alloc;
}
/* do a bunch of dest to dest DMA's */
e = dcopy_cmd_post(cmd);
if (e != DCOPY_SUCCESS) {
goto testfail_post;
}
}
if (e != DCOPY_SUCCESS) {
goto testfail_alloc;
}
/* now queue up the DMA we are going to check status and data for */
e = dcopy_cmd_post(cmd);
if (e != DCOPY_SUCCESS) {
goto testfail_post;
}
/* check the status of the last command */
poll_cnt = 0;
poll_cnt++;
if (poll_cnt >= 16) {
}
}
if (e != DCOPY_COMPLETED) {
goto testfail_poll;
}
/* since the cmd's are linked we only need to pass in the last cmd */
/* verify the data */
for (i = 0; i < PAGESIZE; i++) {
"dcopy_data_compare() failed, %p[%d]: %x, %x\n",
return (-1);
}
}
return (0);
return (-1);
}
#endif