2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A */
2N/A
2N/A#ifndef _MEMA_TEST_H
2N/A#define _MEMA_TEST_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/Astruct mtest_alloc_ent {
2N/A struct mtest_alloc_ent *next;
2N/A void *buf;
2N/A};
2N/A
2N/Astruct mtest_handle {
2N/A u_longlong_t bank_size;
2N/A ulong_t page_size;
2N/A ulong_t line_size;
2N/A ulong_t lines_per_page;
2N/A cfga_cond_t condition;
2N/A int fd;
2N/A ulong_t max_errors;
2N/A struct mtest_alloc_ent *alloc_list;
2N/A void *drvhandle;
2N/A struct cfga_msg *msgp;
2N/A};
2N/A
2N/Atypedef struct mtest_handle *mtest_handle_t;
2N/A
2N/Atypedef int mtest_func_t(mtest_handle_t);
2N/A
2N/Astruct mtest_table_ent {
2N/A const char *test_name;
2N/A mtest_func_t *test_func;
2N/A};
2N/Aextern struct mtest_table_ent mtest_table[];
2N/A#define MTEST_DEFAULT_TEST (0)
2N/Aextern char **mtest_build_opts(int *maxerr_idx);
2N/A
2N/A#define BANK_SIZE(H) ((H)->bank_size)
2N/A#define PAGE_SIZE(H) ((H)->page_size)
2N/A#define LINE_SIZE(H) ((H)->line_size)
2N/A#define LINES_PER_PAGE(H) ((H)->lines_per_page)
2N/A#define SET_CONDITION(H, C) ((H)->condition = (C))
2N/A
2N/Astruct mtest_error {
2N/A int error_type;
2N/A};
2N/A
2N/A/*
2N/A * Error types.
2N/A */
2N/A#define MTEST_ERR_NONE 0
2N/A#define MTEST_ERR_UE 1
2N/A#define MTEST_ERR_CE 2
2N/A
2N/A/*
2N/A * Test routine return codes.
2N/A */
2N/A#define MTEST_DONE 0
2N/A#define MTEST_LIB_ERROR 1
2N/A#define MTEST_DEV_ERROR 2
2N/A
2N/A/*
2N/A * Each test is allowed maximum number of errors and the index has
2N/A * to be coordinated with the token table size in mema_test_config.c
2N/A */
2N/A#define MAX_ERRORS 32
2N/A#define REPORT_SEC 5
2N/A
2N/A/*
2N/A * Test functions should use this buffer allocation interface.
2N/A * The test framework will deallocate them on return.
2N/A */
2N/Aextern void *mtest_allocate_buf(mtest_handle_t, size_t);
2N/A#define mtest_allocate_page_buf(H) mtest_allocate_buf((H), \
2N/A (size_t)PAGE_SIZE(H))
2N/Aextern void mtest_deallocate_buf(mtest_handle_t, void *);
2N/Aextern void mtest_deallocate_buf_all(mtest_handle_t);
2N/A
2N/A/*
2N/A * Test write: mtest_write(handle, buffer, page_num, line_offset, line_count)
2N/A * A line count of 0 indicates the whole page.
2N/A * A return of 0 indicates success. A return of -1 indicates a failure of
2N/A * the device interface.
2N/A */
2N/Aextern int mtest_write(mtest_handle_t, void *, u_longlong_t, uint_t, uint_t);
2N/Aextern int mtest_read(mtest_handle_t, void *, u_longlong_t, uint_t, uint_t,
2N/A struct mtest_error *);
2N/A
2N/A/*
2N/A * Message interface. If the upper layer has verbose on, the
2N/A * message will be seen by the user.
2N/A */
2N/Aextern void mtest_message(mtest_handle_t, const char *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _MEMA_TEST_H */