4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
24 * All rights reserved.
30 #pragma ident "%Z%%M% %I% %E% SMI"
36 struct mtest_alloc_ent
{
37 struct mtest_alloc_ent
*next
;
42 u_longlong_t bank_size
;
45 ulong_t lines_per_page
;
46 cfga_cond_t condition
;
49 struct mtest_alloc_ent
*alloc_list
;
51 struct cfga_msg
*msgp
;
54 typedef struct mtest_handle
*mtest_handle_t
;
56 typedef int mtest_func_t(mtest_handle_t
);
58 struct mtest_table_ent
{
59 const char *test_name
;
60 mtest_func_t
*test_func
;
62 extern struct mtest_table_ent mtest_table
[];
63 #define MTEST_DEFAULT_TEST (0)
64 extern char **mtest_build_opts(int *maxerr_idx
);
66 #define BANK_SIZE(H) ((H)->bank_size)
67 #define PAGE_SIZE(H) ((H)->page_size)
68 #define LINE_SIZE(H) ((H)->line_size)
69 #define LINES_PER_PAGE(H) ((H)->lines_per_page)
70 #define SET_CONDITION(H, C) ((H)->condition = (C))
79 #define MTEST_ERR_NONE 0
80 #define MTEST_ERR_UE 1
81 #define MTEST_ERR_CE 2
84 * Test routine return codes.
87 #define MTEST_LIB_ERROR 1
88 #define MTEST_DEV_ERROR 2
91 * Each test is allowed maximum number of errors and the index has
92 * to be coordinated with the token table size in mema_test_config.c
98 * Test functions should use this buffer allocation interface.
99 * The test framework will deallocate them on return.
101 extern void *mtest_allocate_buf(mtest_handle_t
, size_t);
102 #define mtest_allocate_page_buf(H) mtest_allocate_buf((H), \
103 (size_t)PAGE_SIZE(H))
104 extern void mtest_deallocate_buf(mtest_handle_t
, void *);
105 extern void mtest_deallocate_buf_all(mtest_handle_t
);
108 * Test write: mtest_write(handle, buffer, page_num, line_offset, line_count)
109 * A line count of 0 indicates the whole page.
110 * A return of 0 indicates success. A return of -1 indicates a failure of
111 * the device interface.
113 extern int mtest_write(mtest_handle_t
, void *, u_longlong_t
, uint_t
, uint_t
);
114 extern int mtest_read(mtest_handle_t
, void *, u_longlong_t
, uint_t
, uint_t
,
115 struct mtest_error
*);
118 * Message interface. If the upper layer has verbose on, the
119 * message will be seen by the user.
121 extern void mtest_message(mtest_handle_t
, const char *);
127 #endif /* _MEMA_TEST_H */