/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/ddi_impldefs.h>
#include <sys/sysmacros.h>
#include <sys/machsystm.h>
#include <sys/machparam.h>
#include <sys/cpu_module.h>
#include <sys/spitregs.h>
#include <vm/seg_kmem.h>
#include <vm/hat_sfmmu.h>
/* memory setup parameters */
struct test_info {
};
/* list of tests in progress (list protected test_mutex) */
void
{
}
void
{
}
int
{
/* XXX if ac ever detaches... */
if (test_mutex_initialized == FALSE) {
}
/*
* Is the specified bank testable?
*/
return (EINVAL);
}
/* verify the board is of the correct type */
case CPU_BOARD:
case MEM_BOARD:
break;
default:
return (EINVAL);
}
/*
* Memory must be in the spare state to be testable.
* However, spare memory that is testing can't be tested
* again, instead return the current test info.
*/
if (!MEM_BOARD_VISIBLE(board) ||
return (EINVAL);
}
/*
* find the test entry
*/
break;
}
/* Not busy testing. */
return (EINVAL);
}
/*
* return the current test information to the new caller
*/
sizeof (ac_mem_test_start_t), flag) != 0) {
return (EFAULT); /* !broken user app */
}
return (EBUSY); /* signal bank in use */
}
/*
* at this point, we have an available bank to test.
* create a test buffer
*/
/* fill in all the test info details now */
/* If Blackbird ever gets a variable line size, this will change. */
/* return the information to the user */
sizeof (ac_mem_test_start_t), flag) != 0) {
/* oh well, tear down the test now */
return (EFAULT);
}
/* finally link us into the test database */
#ifdef DEBUG
#endif /* DEBUG */
return (DDI_SUCCESS);
}
int
{
/* get test result information */
sizeof (ac_mem_test_stop_t), flag) != 0)
return (EFAULT);
/* bdlist protects all state changes... */
(void) fhc_bdlist_lock(-1);
/* find the test */
break; /* found the test */
}
return (EINVAL);
}
#ifdef DEBUG
"!memtest: stop test[%u]: board %d, bank %d,"
" condition %d",
#endif /* DEBUG */
/* first unlink us from the test list (to allow no more entries) */
/* then, wait for current tests to complete */
delay(1);
/* clean up the test related allocations */
/* update the bank condition accordingly */
/* finally, delete the test element */
return (DDI_SUCCESS);
}
void
{
/* bdlist protects all state changes... */
(void) fhc_bdlist_lock(-1);
/* find the test */
break; /* found the test */
}
/* No test running, nothing to do. */
return;
}
#ifdef DEBUG
#endif /* DEBUG */
/* first unlink us from the test list (to allow no more entries) */
/* clean up the test related allocations */
/* update the bank condition accordingly */
/* finally, delete the test element */
}
int
{
int error_found;
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
sizeof (ac_mem_test_read32_t), flag) != 0)
return (EFAULT);
break;
}
case DDI_MODEL_NONE:
sizeof (ac_mem_test_read_t), flag) != 0)
return (EFAULT);
break;
}
#else /* _MULTI_DATAMODEL */
sizeof (ac_mem_test_read_t), flag) != 0)
return (EFAULT);
#endif /* _MULTI_DATAMODEL */
/* verify the handle */
break;
}
return (EINVAL);
}
/* bump the busy bit */
/* verify the remaining parameters */
goto read_done;
}
/* time to go quiet */
/* we need a va for the block instructions */
/* disable errors */
orig_err = get_error_enable();
/* copy the data again (using our very special copy) */
/* process errors (if any) */
&(error_buf.udbl_error_reg));
/*
* clean up after our no-error copy but before enabling ints.
* XXX what to do about other error types?
*/
extern void clr_datapath(void); /* XXX */
clr_datapath();
error_found = TRUE;
} else {
error_found = FALSE;
}
/* errors back on */
/* tear down translation (who needs an mmu) */
/* we're back! */
/*
* If there was a data error, attempt to return the error_buf
* to the user.
*/
if (error_found) {
sizeof (sunfire_processor_error_regs_t), flag) != 0) {
/* Keep going */
}
}
/*
* Then, return the page to the user (always)
*/
}
return (retval);
}
int
{
#ifdef _MULTI_DATAMODEL
case DDI_MODEL_ILP32: {
sizeof (ac_mem_test_write32_t), flag) != 0)
return (EFAULT);
break;
}
case DDI_MODEL_NONE:
sizeof (ac_mem_test_write_t), flag) != 0)
return (EFAULT);
break;
}
#else /* _MULTI_DATAMODEL */
sizeof (ac_mem_test_write_t), flag) != 0)
return (EFAULT);
#endif /* _MULTI_DATAMODEL */
/* verify the handle */
break;
}
return (EINVAL);
}
/* bump the busy bit */
/* verify the remaining parameters */
goto write_done;
}
/* copy in the specified user data */
goto write_done;
}
/* time to go quiet */
/* we need a va for the block instructions */
/* copy the data again (using our very special copy) */
/* tear down translation (who needs an mmu) */
/* we're back! */
return (retval);
}