dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / cfgadm_plugins / ac / common / mema_test.h
blob929eebabcac5c0880dd93bedf0fdc4a0530458a5
1 /*
2 * CDDL HEADER START
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
7 * with the License.
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]
20 * CDDL HEADER END
23 * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _MEMA_TEST_H
28 #define _MEMA_TEST_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 struct mtest_alloc_ent {
37 struct mtest_alloc_ent *next;
38 void *buf;
41 struct mtest_handle {
42 u_longlong_t bank_size;
43 ulong_t page_size;
44 ulong_t line_size;
45 ulong_t lines_per_page;
46 cfga_cond_t condition;
47 int fd;
48 ulong_t max_errors;
49 struct mtest_alloc_ent *alloc_list;
50 void *drvhandle;
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))
72 struct mtest_error {
73 int error_type;
77 * Error types.
79 #define MTEST_ERR_NONE 0
80 #define MTEST_ERR_UE 1
81 #define MTEST_ERR_CE 2
84 * Test routine return codes.
86 #define MTEST_DONE 0
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
94 #define MAX_ERRORS 32
95 #define REPORT_SEC 5
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 *);
123 #ifdef __cplusplus
125 #endif
127 #endif /* _MEMA_TEST_H */