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 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
39 #include <sys/dditypes.h>
40 #include <sys/param.h>
41 #include <sys/obpdefs.h>
43 #include <sys/sysctrl.h>
45 #include <sys/spitregs.h>
46 #include <config_admin.h>
47 #include "mema_util.h"
48 #include "mema_test.h"
49 #include "mema_prom.h"
52 #define DBG (void) printf
53 #define DBG1 (void) printf
54 #define DBG3 (void) printf
55 #define DBG4 (void) printf
60 #define DBG4(a, b, c, d)
65 * <sys/spitregs.h> has these defines inside 'ifdef _KERNEL' at the
66 * time of writing. Re-define here if that is still the case.
69 #define P_DER_UE 0x00000000000000200ULL /* UE has occurred */
70 #define P_DER_CE 0x00000000000000100ULL /* CE has occurred */
71 #define P_DER_E_SYND 0x000000000000000FFULL /* SYND<7:0>: ECC syndrome */
72 #endif /* ! P_DER_UE */
79 static FILE *debug_fp
;
80 static int debugging(void);
81 static void dump_ioctl(int, void *);
82 static void dump_ioctl_res(int, void *, int, int);
84 #define dump_ioctl(CMD, ARG)
85 #define dump_ioctl_res(CMD, ARG, RET, ERRNO)
86 #endif /* DEV_DEBUG */
93 static char *mema_opts
[] = {
94 #define OPT_BOOT_DISABLE 0
96 #define OPT_BOOT_ENABLE 1
103 #define OPT_NEEDS_VALUE(O) ((O) == OPT_TIMEOUT)
105 #define MAX_OPT_LENGTH (sizeof ("disable-at-boot"))
108 * For each function there is an array of opt_control structures giving
109 * the valid options. The array is terminated by an element with the
110 * subopt field set to -1. The group field is used to identify
111 * mutually exclusive options, with zero meaning no grouping.
119 * Returned set of options.
120 * If the option takes a value, it will be set in 'val'
121 * if the corresponding bit is set in 'bits' is set,
122 * otherwise the pointer in 'val' is undefined.
124 #define OPT_VAL_ARRAY_SIZE 32 /* # bits in 'bits' */
127 char *val
[OPT_VAL_ARRAY_SIZE
];
130 #define OPTSET_INIT(S) ((S).bits = 0)
131 #define _OPT_TO_BIT(O) (1 << (O))
132 #define OPTSET_SET_VAL(S, O, V) ((S).bits |= _OPT_TO_BIT(O), \
134 #define OPTSET_TEST(S, O) (((S).bits & _OPT_TO_BIT(O)) != 0)
135 #define OPTSET_VAL(S, O) ((S).val[(O)])
136 #define OPTSET_IS_EMPTY(S) ((S).bits == 0)
138 static option_set_t
process_options(const char *, struct opt_control
*,
141 static struct opt_control add_opts
[] = {
142 {OPT_BOOT_ENABLE
, 1},
143 {OPT_BOOT_DISABLE
, 1},
147 static struct opt_control del_opts
[] = {
148 {OPT_BOOT_ENABLE
, 1},
149 {OPT_BOOT_DISABLE
, 1},
154 static struct opt_control stat_opts
[] = {
155 {OPT_BOOT_ENABLE
, 1},
156 {OPT_BOOT_DISABLE
, 1},
160 #if !defined(TEXT_DOMAIN)
161 #define TEXT_DOMAIN "SYS_TEST"
164 static const char still_testing
[] = "bank %s being tested by process %d";
165 static const char no_value
[] = "sub-option \"%s\" does not take a value";
166 static const char missing_value
[] = "sub-option \"%s\" needs a value";
167 static const char conflict_opt
[] = "sub-option \"%s\" conflicts with \"%s\"";
168 static const char unk_subopt
[] = "sub-option \"%s\" unknown\n"
170 static const char not_valid
[] =
171 "sub-option \"%s\" not valid for this operation\n"
173 static const char timeout_notnum
[] =
174 "timeout value not a positive integer \"%s\"";
175 static const char calloc_fail
[] = "memory allocation failed (%d*%d bytes)";
176 static const char unk_test
[] = "test \"%s\" unknown\n"
178 static const char dup_test
[] = "more than one test type specified (\"%s\")";
179 static const char dup_num
[] = "option specified more than once (\"%s\")";
180 static const char no_num
[] = "invalid number specified for max_errors(\"%s\")";
181 static const char mtest_rw_error
[] = "memory test read/write error";
182 static const char mtest_lib_error
[] = "memory test library error";
183 static const char dlist_invalid
[] = "invalid disabled-memory-list";
184 static const char dlist_write_failed
[] = "disabled-memory-list write failed";
185 static const char mtest_unknown_error
[] = "unknown memory test error";
186 static const char ap_invalid
[] = "invalid attachment point: %s";
187 static const char trans_illegal
[] = "illegal transition";
188 static const char open_failed
[] = "open failed: %s: %s";
189 static const char mema_help
[] = "\nAc specific options:\n";
190 static const char disable_opts
[] = "\t-o disable-at-boot\n";
191 static const char enable_opts
[] = "\t-o enable-at-boot\n";
192 static const char timeout_opts
[] = "\t-o timeout=# (seconds)\n";
193 static const char test_opts
[] =
194 "\t-o {quick, normal, extended},[max_errors=#] -t ap_id [ap_id...]\n";
195 static const char private_funcs
[] = "\t-x relocate-test ap_id [ap_id...]\n";
196 static const char add_is_disabled
[] = "memory is disabled at boot";
197 static const char add_willbe_disabled
[] =
198 "memory will be disabled at boot";
199 static const char add_disab_err
[] = "cannot get memory disabled status";
200 static const char pfunc_unknown
[] = "private function \"%s\" unknown";
203 #define mema_eid(a, b) (((a) << 8) + (b))
204 #define mema_str(i) mema_strs[(i)]
210 #define AC_BD_STATE 4
211 #define AC_MEM_TEST_ID 5
212 #define AC_MEM_TEST_PAR 6
213 #define AC_MEM_PERM 7
214 #define AC_KPM_CANCELLED 8
215 #define AC_KPM_REFUSED 9
216 #define AC_KPM_SPAN 10
217 #define AC_KPM_DUP 11
218 #define AC_KPM_FAULT 12
219 #define AC_KPM_RESOURCE 13
220 #define AC_KPM_NOTSUP 14
221 #define AC_KPM_NOHANDLES 15
222 #define AC_KPM_NONRELOC 16
223 #define AC_KPM_HANDLE 17
224 #define AC_KPM_BUSY 18
225 #define AC_KPM_NOTVIABLE 19
226 #define AC_KPM_SEQUENCE 20
227 #define AC_KPM_NOWORK 21
228 #define AC_KPM_NOTFINISHED 22
229 #define AC_KPM_NOTRUNNING 23
231 #define CMD_MEM_STAT 25
232 #define CMD_MEM_ADD 26
233 #define CMD_MEM_DEL 27
234 #define CMD_MEM_TEST_START 28
235 #define CMD_MEM_TEST_STOP 29
236 #define AC_UNKNOWN 30
238 #define AC_TIMEOUT 32
239 #define CMD_MEM_RELOCTEST 33
240 #define AC_DEINTLV 34
245 "invalid memory bank",
247 "invalid board type",
248 "invalid board state",
249 "invalid memory test id",
250 "invalid memory test parameter(s)",
251 "no write permission",
252 "memory operation cancelled",
253 "memory operation refused",
254 "memory already in use (add)",
255 "memory span duplicate (delete)",
256 "memory access test failed (add)",
257 "some resource was not available",
258 "operation not supported",
259 "cannot allocate any more handles",
260 "non-relocatable pages in span",
261 "bad handle supplied",
262 "memory in span is being deleted",
263 "VM viability test failed",
264 "function called out of sequence",
265 "no memory to delete",
266 "delete processing not finished",
267 "delete processing not running",
268 "insufficient virtual memory",
269 "memory stat failed: %s",
270 "memory add failed: %s",
271 "memory delete failed: %s",
272 "memory test start failed: %s",
273 "memory test stop failed: %s",
275 "memory delete killed",
276 "memory delete timeout",
277 "memory relocate-test failed: %s",
278 "memory cannot be de-interleaved"
282 * AC_MEM_PERM, EBADF, AC_ERR_MEM_PERM
283 * AC_BK_BUSY, EBUSY, AC_ERR_MEM_BK
284 * AC_KPM_CANCELLED, EINTR, AC_ERR_KPM_CANCELLED
285 * AC_KPM_REFUSED, EINTR, AC_ERR_KPM_REFUSED
286 * AC_BK_ID, EINVAL, AC_ERR_MEM_BK
287 * AC_BD_ID, EINVAL, AC_ERR_BD
288 * AC_BD_TYPE, EINVAL, AC_ERR_BD_TYPE
289 * AC_BD_STATE, EINVAL, AC_ERR_BD_STATE
290 * AC_MEM_TEST_ID, EINVAL, AC_ERR_MEM_TEST
291 * AC_MEM_TEST_PAR, EINVAL, AC_ERR_MEM_TEST_PAR
292 * AC_KPM_SPAN, EINVAL, AC_ERR_KPM_SPAN
293 * AC_KPM_DUP, EINVAL, AC_ERR_KPM_DUP?
294 * AC_KPM_FAULT, EINVAL, AC_ERR_KPM_FAULT
295 * AC_KPM_RESOURCE, EINVAL, AC_ERR_KPM_RESOURCE
296 * AC_KPM_NOTSUP, EINVAL, AC_ERR_KPM_NOTSUP
297 * AC_KPM_NOHANDLES, EINVAL, AC_ERR_KPM_NOHANDLES
298 * AC_KPM_NONRELOC, EINVAL, AC_ERR_KPM_NONRELOC
299 * AC_KPM_HANDLE, EINVAL, AC_ERR_KPM_HANDLE
300 * AC_KPM_BUSY, EINVAL, AC_ERR_KPM_BUSY
301 * AC_KPM_NOTVIABLE, EINVAL, AC_ERR_KPM_NOTVIABLE
302 * AC_KPM_SEQUENCE, EINVAL, AC_ERR_KPM_SEQUENCE
303 * AC_KPM_NOWORK, EINVAL, AC_ERR_KPM_NOWORK
304 * AC_KPM_NOTFINISHED, EINVAL, AC_ERR_KPM_NOTFINISHED
305 * AC_KPM_NOTRUNNING, EINVAL, AC_ERR_KPM_NOTRUNNING
306 * AC_VMEM, ENOMEM, AC_ERR_VMEM
307 * AC_INTR, EINTR, AC_ERR_INTR
308 * AC_TIMEOUT, EINTR, AC_ERR_TIMEOUT
309 * AC_DEINTLV, EINVAL, AC_ERR_MEM_DEINTLV
312 mema_sid(int err
, int acerr
)
314 if (acerr
== AC_ERR_DEFAULT
)
317 switch (mema_eid(err
, acerr
)) {
318 case mema_eid(EBADF
, AC_ERR_MEM_PERM
):
319 return (AC_MEM_PERM
);
320 case mema_eid(EBUSY
, AC_ERR_MEM_BK
):
322 case mema_eid(EINTR
, AC_ERR_KPM_CANCELLED
):
323 return (AC_KPM_CANCELLED
);
324 case mema_eid(EINTR
, AC_ERR_KPM_REFUSED
):
325 return (AC_KPM_REFUSED
);
326 case mema_eid(EINVAL
, AC_ERR_MEM_BK
):
328 case mema_eid(EINVAL
, AC_ERR_BD
):
330 case mema_eid(EINVAL
, AC_ERR_BD_TYPE
):
332 case mema_eid(EINVAL
, AC_ERR_BD_STATE
):
333 return (AC_BD_STATE
);
334 case mema_eid(EINVAL
, AC_ERR_MEM_TEST
):
335 return (AC_MEM_TEST_ID
);
336 case mema_eid(EINVAL
, AC_ERR_MEM_TEST_PAR
):
337 return (AC_MEM_TEST_PAR
);
338 case mema_eid(EINVAL
, AC_ERR_KPM_SPAN
):
339 return (AC_KPM_SPAN
);
340 case mema_eid(EINVAL
, AC_ERR_KPM_DUP
):
342 case mema_eid(EINVAL
, AC_ERR_KPM_FAULT
):
343 return (AC_KPM_FAULT
);
344 case mema_eid(EINVAL
, AC_ERR_KPM_RESOURCE
):
345 return (AC_KPM_RESOURCE
);
346 case mema_eid(EINVAL
, AC_ERR_KPM_NOTSUP
):
347 return (AC_KPM_NOTSUP
);
348 case mema_eid(EINVAL
, AC_ERR_KPM_NOHANDLES
):
349 return (AC_KPM_NOHANDLES
);
350 case mema_eid(EINVAL
, AC_ERR_KPM_NONRELOC
):
351 return (AC_KPM_NONRELOC
);
352 case mema_eid(EINVAL
, AC_ERR_KPM_HANDLE
):
353 return (AC_KPM_HANDLE
);
354 case mema_eid(EINVAL
, AC_ERR_KPM_BUSY
):
355 return (AC_KPM_BUSY
);
356 case mema_eid(EINVAL
, AC_ERR_KPM_NOTVIABLE
):
357 return (AC_KPM_NOTVIABLE
);
358 case mema_eid(EINVAL
, AC_ERR_KPM_SEQUENCE
):
359 return (AC_KPM_SEQUENCE
);
360 case mema_eid(EINVAL
, AC_ERR_KPM_NOWORK
):
361 return (AC_KPM_NOWORK
);
362 case mema_eid(EINVAL
, AC_ERR_KPM_NOTFINISHED
):
363 return (AC_KPM_NOTFINISHED
);
364 case mema_eid(EINVAL
, AC_ERR_KPM_NOTRUNNING
):
365 return (AC_KPM_NOTRUNNING
);
366 case mema_eid(ENOMEM
, AC_ERR_VMEM
):
368 case mema_eid(EINTR
, AC_ERR_INTR
):
370 case mema_eid(EINTR
, AC_ERR_TIMEOUT
):
372 case mema_eid(EINVAL
, AC_ERR_MEM_DEINTLV
):
382 mema_err(ac_cfga_cmd_t
*ac
, int ret_errno
, char **errstring
, int cmd
)
384 char *cname
= mema_str(cmd
);
389 syserr
= mema_str(mema_sid(ret_errno
, ac
->errtype
));
390 syserr
= dgettext(TEXT_DOMAIN
, syserr
);
392 syserr
= strerror(ret_errno
);
393 /* strerror() does its own gettext(). */
394 if (syserr
== NULL
) {
395 (void) sprintf(syserr_num
, "errno=%d", errno
);
400 __fmt_errstring(errstring
, strlen(syserr
),
401 dgettext(TEXT_DOMAIN
, cname
), syserr
);
405 mema_cmd_init(ac_cfga_cmd_t
*ac
, void *cmd
, char *outputstr
, int force
)
407 (void) memset(ac
, 0, sizeof (*ac
));
409 ac
->errtype
= AC_ERR_DEFAULT
;
412 ac
->outputstr
= outputstr
;
414 (void) memset(outputstr
, 0, AC_OUTPUT_LEN
);
418 ap_bk_idx(const char *ap_id
)
422 static char *bank
= "bank";
424 DBG("ap_bk_idx(%s)\n", ap_id
);
426 if ((s
= strstr(ap_id
, bank
)) == NULL
)
434 DBG3("ap_bk_idx: s=%s, n=%d\n", s
, n
);
436 if ((n
!= 1) || !isdigit(s
[0]))
442 if (id
< 0 || id
> 1)
445 DBG3("ap_bk_idx(%s)=%d\n", s
, id
);
452 const char *bank_spec
,
464 char outputstr
[AC_OUTPUT_LEN
];
466 if ((bank
= ap_bk_idx(bank_spec
)) == -1) {
467 __fmt_errstring(errstring
, strlen(bank_spec
),
468 dgettext(TEXT_DOMAIN
, ap_invalid
), bank_spec
);
474 if ((fd
= open(bank_spec
, ((fdp
!= NULL
) ? O_RDWR
: O_RDONLY
), 0)) ==
479 syserr
= strerror(errno
);
480 if (syserr
== NULL
) {
481 (void) sprintf(syserr_num
, "errno=%d", errno
);
484 __fmt_errstring(errstring
, strlen(syserr
) +
486 dgettext(TEXT_DOMAIN
, open_failed
), bank_spec
, syserr
);
490 mema_cmd_init(&cmd
, &stat
, outputstr
, 0);
491 dump_ioctl(AC_MEM_STAT
, NULL
);
492 ret
= ioctl(fd
, AC_MEM_STAT
, &cmd
);
494 dump_ioctl_res(AC_MEM_STAT
, &stat
, ret
, ret_errno
);
497 mema_err(&cmd
, ret_errno
, errstring
, CMD_MEM_STAT
);
512 bkp
->board
= stat
.board
;
519 set_disabled_bits(mema_disabled_t
*dp
, int value
)
522 *dp
&= ~PROM_MEMORY_DISABLED
;
524 *dp
|= PROM_MEMORY_DISABLED
;
528 set_present_bits(mema_disabled_t
*dp
, ac_stat_t
*asp
)
530 if (asp
->ostate
== SYSC_CFGA_OSTATE_CONFIGURED
)
531 *dp
|= PROM_MEMORY_PRESENT
;
533 *dp
&= ~PROM_MEMORY_DISABLED
;
538 option_set_t do_option
,
544 mema_disabled_t disab
;
546 if (!prom_read_disabled_list(&disab
, board
))
549 set_present_bits(&disab
, asp
);
553 if (OPTSET_TEST(do_option
, OPT_BOOT_ENABLE
)) {
554 set_disabled_bits(&disab
, 0);
555 if (!prom_viable_disabled_list(&disab
)) {
556 __fmt_errstring(errstring
, 0,
557 dgettext(TEXT_DOMAIN
, dlist_invalid
));
559 } else if (!prom_write_disabled_list(&disab
, board
)) {
560 __fmt_errstring(errstring
, 0,
561 dgettext(TEXT_DOMAIN
, dlist_write_failed
));
564 } else if (OPTSET_TEST(do_option
, OPT_BOOT_DISABLE
)) {
565 set_disabled_bits(&disab
, 1);
566 if (!prom_viable_disabled_list(&disab
)) {
567 __fmt_errstring(errstring
, 0,
568 dgettext(TEXT_DOMAIN
, dlist_invalid
));
570 } else if (!prom_write_disabled_list(&disab
, board
)) {
571 __fmt_errstring(errstring
, 0,
572 dgettext(TEXT_DOMAIN
, dlist_write_failed
));
582 const char *bank_spec
,
588 int fd
, ret
, ret_errno
;
589 option_set_t do_option
;
592 char outputstr
[AC_OUTPUT_LEN
];
595 do_option
= process_options(options
, add_opts
, &ret
, errstring
);
600 ret
= ap_stat(bank_spec
, &fd
, &bk
, &stat
, errstring
);
605 if (stat
.rstate
!= SYSC_CFGA_RSTATE_CONNECTED
||
606 stat
.ostate
!= SYSC_CFGA_OSTATE_UNCONFIGURED
) {
607 __fmt_errstring(errstring
, 0,
608 dgettext(TEXT_DOMAIN
, trans_illegal
));
614 mema_disabled_t disab
;
616 if (prom_read_disabled_list(&disab
, bk
.board
)) {
618 !OPTSET_TEST(do_option
, OPT_BOOT_ENABLE
)) {
619 __fmt_errstring(errstring
, 0,
620 dgettext(TEXT_DOMAIN
, add_is_disabled
));
625 OPTSET_TEST(do_option
, OPT_BOOT_DISABLE
)) {
626 __fmt_errstring(errstring
, 0,
627 dgettext(TEXT_DOMAIN
, add_willbe_disabled
));
632 __fmt_errstring(errstring
, 0,
633 dgettext(TEXT_DOMAIN
, add_disab_err
));
639 mema_cmd_init(&cmd
, NULL
, outputstr
, force
);
640 dump_ioctl(AC_MEM_CONFIGURE
, NULL
);
641 ret
= ioctl(fd
, AC_MEM_CONFIGURE
, &cmd
);
643 dump_ioctl_res(AC_MEM_CONFIGURE
, NULL
, ret
, ret_errno
);
647 mema_err(&cmd
, ret_errno
, errstring
, CMD_MEM_ADD
);
651 ret
= prom_do_options(do_option
, bk
.board
, &stat
, errstring
);
658 const char *bank_spec
,
664 int fd
, ret
, ret_errno
;
665 option_set_t do_option
;
668 char outputstr
[AC_OUTPUT_LEN
];
669 int timeout_secs
= -1; /* Init to 'use default'. */
672 do_option
= process_options(options
, del_opts
, &ret
, errstring
);
677 if (OPTSET_TEST(do_option
, OPT_TIMEOUT
)) {
681 to_val
= OPTSET_VAL(do_option
, OPT_TIMEOUT
);
682 timeout_secs
= (int)strtol(to_val
, &ep
, 10);
683 if (*ep
!= '\0' || ep
== to_val
|| timeout_secs
< 0) {
684 __fmt_errstring(errstring
, strlen(to_val
),
685 dgettext(TEXT_DOMAIN
, timeout_notnum
), to_val
);
690 ret
= ap_stat(bank_spec
, &fd
, &bk
, &stat
, errstring
);
694 if (stat
.rstate
!= SYSC_CFGA_RSTATE_CONNECTED
||
695 stat
.ostate
!= SYSC_CFGA_OSTATE_CONFIGURED
) {
696 __fmt_errstring(errstring
, 0,
697 dgettext(TEXT_DOMAIN
, trans_illegal
));
702 mema_cmd_init(&cmd
, NULL
, outputstr
, force
);
703 cmd
.arg
= timeout_secs
;
704 dump_ioctl(AC_MEM_UNCONFIGURE
, NULL
);
705 ret
= ioctl(fd
, AC_MEM_UNCONFIGURE
, &cmd
);
707 dump_ioctl_res(AC_MEM_UNCONFIGURE
, NULL
, ret
, ret_errno
);
711 mema_err(&cmd
, ret_errno
, errstring
, CMD_MEM_DEL
);
715 ret
= prom_do_options(do_option
, bk
.board
, &stat
, errstring
);
723 cfga_cmd_t state_change_cmd
,
726 struct cfga_confirm
*confp
,
727 struct cfga_msg
*msgp
,
734 if (errstring
!= NULL
)
737 force
= flags
& CFGA_FLAG_FORCE
;
739 switch (state_change_cmd
) {
740 case CFGA_CMD_CONFIGURE
:
741 rc
= mema_add(ap_id
, options
, errstring
, force
);
744 case CFGA_CMD_UNCONFIGURE
:
745 rc
= mema_delete(ap_id
, options
, errstring
, force
);
759 const char *function
,
762 struct cfga_confirm
*confp
,
763 struct cfga_msg
*msgp
,
769 int fd
, ret
, ret_errno
;
771 char outputstr
[AC_OUTPUT_LEN
];
773 if (errstring
!= NULL
)
776 ret
= ap_stat(ap_id
, &fd
, &bk
, &stat
, errstring
);
780 if (strcmp(function
, "relocate-test") == 0) {
781 struct ac_memx_relocate_stats rstat
;
783 mema_cmd_init(&cmd
, NULL
, outputstr
,
784 (flags
& CFGA_FLAG_FORCE
));
785 cmd
.arg
= AC_MEMX_RELOCATE_ALL
;
786 cmd
.private = &rstat
;
787 (void) memset(&rstat
, 0, sizeof (rstat
));
788 dump_ioctl(AC_MEM_EXERCISE
, &cmd
);
789 ret
= ioctl(fd
, AC_MEM_EXERCISE
, &cmd
);
791 dump_ioctl_res(AC_MEM_EXERCISE
, &cmd
, ret
, ret_errno
);
795 mema_err(&cmd
, ret_errno
, errstring
, CMD_MEM_RELOCTEST
);
801 __fmt_errstring(errstring
, strlen(function
),
802 dgettext(TEXT_DOMAIN
, pfunc_unknown
), function
);
812 struct cfga_msg
*msgp
,
816 ac_mem_test_start_t test_start
;
817 ac_mem_test_stop_t test_stop
;
818 struct mtest_handle handle
;
822 char outputstr
[AC_OUTPUT_LEN
];
824 (void) memset(&test_start
, 0, sizeof (test_start
));
825 mema_cmd_init(&cmd
, &test_start
, outputstr
, 0);
826 dump_ioctl(AC_MEM_TEST_START
, &test_start
);
827 ret
= ioctl(fd
, AC_MEM_TEST_START
, &cmd
);
829 dump_ioctl_res(AC_MEM_TEST_START
, &test_start
, ret
, ret_errno
);
832 if (ret_errno
== ENOTSUP
) {
833 mema_err(&cmd
, ret_errno
, errstring
,
835 return (CFGA_OPNOTSUPP
);
837 if (ret_errno
== EBUSY
&& test_start
.tester_pid
> 0) {
839 * Bank appears to be being tested. Check that
840 * process 'tester_pid' is still running.
842 if (kill(test_start
.tester_pid
, 0) != -1 ||
844 cfga_ap_log_id_t bname
;
846 /* Process still exists. */
847 (void) sprintf(bname
, "board %d bank%d",
848 abkp
->board
, abkp
->bank
);
849 __fmt_errstring(errstring
, strlen(bname
),
850 dgettext(TEXT_DOMAIN
, still_testing
),
851 bname
, test_start
.tester_pid
);
855 * Do a test stop and re-try the start.
857 (void) memset(&test_stop
, 0,
859 test_stop
.handle
= test_start
.handle
;
860 test_stop
.condition
= SYSC_CFGA_COND_UNKNOWN
;
861 mema_cmd_init(&cmd
, &test_stop
, outputstr
, 0);
862 dump_ioctl(AC_MEM_TEST_STOP
, &test_stop
);
863 ret
= ioctl(fd
, AC_MEM_TEST_STOP
, &cmd
);
865 dump_ioctl_res(AC_MEM_TEST_STOP
, &test_stop
,
868 * Ignore test stop error processing and re-try the
869 * start. The error return will be derived from the
872 (void) memset(&test_start
, 0,
873 sizeof (test_start
));
874 mema_cmd_init(&cmd
, &test_start
, outputstr
, 0);
875 dump_ioctl(AC_MEM_TEST_START
, &test_start
);
876 ret
= ioctl(fd
, AC_MEM_TEST_START
, &cmd
);
878 dump_ioctl_res(AC_MEM_TEST_START
, &test_start
,
881 /* Test return code again to cover the case of a re-try. */
883 mema_err(&cmd
, ret_errno
, errstring
,
888 (void) memset(&handle
, 0, sizeof (handle
));
890 handle
.drvhandle
= (void *)&test_start
;
892 handle
.bank_size
= test_start
.bank_size
;
893 handle
.page_size
= test_start
.page_size
;
894 handle
.line_size
= test_start
.line_size
;
895 handle
.lines_per_page
= test_start
.page_size
/ test_start
.line_size
;
896 handle
.condition
= CFGA_COND_UNKNOWN
;
897 handle
.max_errors
= max_errors
;
899 res
= (*mtest_table
[test_fun
].test_func
)(&handle
);
901 mtest_deallocate_buf_all(&handle
);
904 * Convert memory test code to MEMA_ code.
910 case MTEST_LIB_ERROR
:
911 __fmt_errstring(errstring
, 0, dgettext(TEXT_DOMAIN
,
915 case MTEST_DEV_ERROR
:
916 __fmt_errstring(errstring
, 0, dgettext(TEXT_DOMAIN
,
921 __fmt_errstring(errstring
, 0, dgettext(TEXT_DOMAIN
,
922 mtest_unknown_error
));
928 (void) memset(&test_stop
, 0, sizeof (test_stop
));
929 test_stop
.handle
= test_start
.handle
;
930 switch (handle
.condition
) {
932 test_stop
.condition
= SYSC_CFGA_COND_OK
;
934 case CFGA_COND_FAILING
:
935 test_stop
.condition
= SYSC_CFGA_COND_FAILING
;
937 case CFGA_COND_FAILED
:
938 test_stop
.condition
= SYSC_CFGA_COND_FAILED
;
940 case CFGA_COND_UNKNOWN
:
941 test_stop
.condition
= SYSC_CFGA_COND_UNKNOWN
;
944 test_stop
.condition
= SYSC_CFGA_COND_UNKNOWN
;
949 mema_cmd_init(&cmd
, &test_stop
, outputstr
, 0);
950 dump_ioctl(AC_MEM_TEST_STOP
, &test_stop
);
951 ret
= ioctl(fd
, AC_MEM_TEST_STOP
, &cmd
);
953 dump_ioctl_res(AC_MEM_TEST_STOP
, &test_stop
, ret
, ret_errno
);
955 mema_err(&cmd
, ret_errno
, errstring
,
962 #define DRVHANDLE(H) (((ac_mem_test_start_t *)(H)->drvhandle)->handle)
966 mtest_handle_t handle
,
968 u_longlong_t page_no
,
972 ac_mem_test_write_t test_write
;
973 int fd
, ret
, ret_errno
;
975 char outputstr
[AC_OUTPUT_LEN
];
977 (void) memset(&test_write
, 0, sizeof (test_write
));
979 test_write
.handle
= DRVHANDLE(handle
);
980 test_write
.page_buf
= page_buf
;
981 test_write
.address
.page_num
= page_no
;
982 test_write
.address
.line_offset
= line_offset
;
984 test_write
.address
.line_count
= handle
->lines_per_page
;
986 test_write
.address
.line_count
= line_count
;
988 mema_cmd_init(&cmd
, &test_write
, outputstr
, 0);
989 dump_ioctl(AC_MEM_TEST_WRITE
, &test_write
);
990 ret
= ioctl(fd
, AC_MEM_TEST_WRITE
, &cmd
);
992 dump_ioctl_res(AC_MEM_TEST_WRITE
, &test_write
, ret
, ret_errno
);
1001 mtest_handle_t handle
,
1003 u_longlong_t page_no
,
1006 struct mtest_error
*errp
)
1008 ac_mem_test_read_t test_read
;
1009 sunfire_processor_error_regs_t errbuf
;
1010 int fd
, ret
, ret_errno
;
1012 char outputstr
[AC_OUTPUT_LEN
];
1014 (void) memset(&test_read
, 0, sizeof (test_read
));
1015 (void) memset(&errbuf
, 0, sizeof (errbuf
));
1017 test_read
.handle
= DRVHANDLE(handle
);
1018 test_read
.page_buf
= page_buf
;
1019 test_read
.address
.page_num
= page_no
;
1020 test_read
.address
.line_offset
= line_offset
;
1021 test_read
.error_buf
= &errbuf
;
1022 if (line_count
== 0)
1023 test_read
.address
.line_count
= handle
->lines_per_page
;
1025 test_read
.address
.line_count
= line_count
;
1027 mema_cmd_init(&cmd
, &test_read
, outputstr
, 0);
1028 dump_ioctl(AC_MEM_TEST_READ
, &test_read
);
1029 ret
= ioctl(fd
, AC_MEM_TEST_READ
, &cmd
);
1031 dump_ioctl_res(AC_MEM_TEST_READ
, &test_read
, ret
, ret_errno
);
1034 if (ret_errno
== EIO
) {
1036 * Special case indicating CE or UE.
1038 if (((errbuf
.udbh_error_reg
| errbuf
.udbl_error_reg
) &
1040 errp
->error_type
= MTEST_ERR_UE
;
1042 errp
->error_type
= MTEST_ERR_CE
;
1047 errp
->error_type
= MTEST_ERR_NONE
;
1053 subopt_help_str(char *opts
[])
1059 static const char help_sep
[] = ", ";
1060 static const char help_nil
[] = "???";
1064 for (i
= 0; opts
[i
] != NULL
; i
++) {
1066 len
+= strlen(opts
[i
]);
1069 return (strdup(help_nil
));
1070 len
+= (n
- 1) * strlen(help_sep
);
1072 str
= (char *)malloc(len
);
1077 for (i
= 0; opts
[i
] != NULL
; i
++) {
1078 (void) strcat(str
, sep
);
1079 (void) strcat(str
, opts
[i
]);
1089 const char *options
,
1090 struct cfga_msg
*msgp
,
1099 long max_errors
= -1;
1102 if (errstring
!= NULL
)
1106 * Decode test level and max error number.
1108 if (options
!= NULL
&& *options
!= '\0') {
1114 /* getsubopt() modifies the input string, so copy it. */
1115 cp
= strdup(options
);
1117 return (CFGA_LIB_ERROR
);
1120 opts
= mtest_build_opts(&maxerr_idx
);
1122 free((void *)free_cp
);
1123 return (CFGA_LIB_ERROR
);
1126 while (*cp
!= '\0') {
1127 subopt
= getsubopt(&cp
, opts
, &value
);
1131 hlp
= subopt_help_str(opts
);
1133 __fmt_errstring(errstring
,
1134 strlen(value
) + strlen(hlp
),
1135 dgettext(TEXT_DOMAIN
, unk_test
),
1139 __fmt_errstring(errstring
, 20,
1140 dgettext(TEXT_DOMAIN
, calloc_fail
),
1141 strlen(options
) + 1, 1);
1143 /* Free after printing value. */
1144 free((void *)free_cp
);
1145 return (CFGA_ERROR
);
1148 if (test_fun
!= -1 && subopt
!= test_fun
&&
1149 subopt
!= maxerr_idx
) {
1150 __fmt_errstring(errstring
,
1151 strlen(opts
[subopt
]),
1152 dgettext(TEXT_DOMAIN
, dup_test
),
1154 free((void *)free_cp
);
1155 return (CFGA_ERROR
);
1158 if (subopt
< maxerr_idx
)
1162 if (max_errors
!= -1 && subopt
== maxerr_idx
) {
1163 __fmt_errstring(errstring
,
1164 strlen(opts
[subopt
]),
1165 dgettext(TEXT_DOMAIN
, dup_num
),
1167 free((void *)free_cp
);
1168 return (CFGA_ERROR
);
1171 if (value
== NULL
) {
1172 __fmt_errstring(errstring
,
1174 dgettext(TEXT_DOMAIN
, no_num
),
1176 free((void *)free_cp
);
1177 return (CFGA_ERROR
);
1180 max_errors
= strtol(value
, &ret_p
, 10);
1181 if ((ret_p
== value
) || (*ret_p
!= '\0') ||
1183 __fmt_errstring(errstring
,
1185 dgettext(TEXT_DOMAIN
, no_num
),
1187 free((void *)free_cp
);
1188 return (CFGA_ERROR
);
1192 free((void *)free_cp
);
1196 test_fun
= MTEST_DEFAULT_TEST
;
1197 if (max_errors
== -1)
1198 max_errors
= MAX_ERRORS
;
1200 ret
= ap_stat(ap_id
, &fd
, &bk
, &stat
, errstring
);
1204 if (stat
.rstate
!= SYSC_CFGA_RSTATE_CONNECTED
||
1205 stat
.ostate
!= SYSC_CFGA_OSTATE_UNCONFIGURED
) {
1206 __fmt_errstring(errstring
, 0,
1207 dgettext(TEXT_DOMAIN
, trans_illegal
));
1209 return (CFGA_ERROR
);
1212 ret
= mtest_run(fd
, test_fun
, &bk
,
1213 ((flags
& CFGA_FLAG_VERBOSE
) != 0) ? msgp
: NULL
, errstring
,
1214 (ulong_t
)max_errors
);
1222 rstate_cvt(sysc_cfga_rstate_t rs
)
1227 case SYSC_CFGA_RSTATE_EMPTY
:
1228 cs
= CFGA_STAT_EMPTY
;
1230 case SYSC_CFGA_RSTATE_DISCONNECTED
:
1231 cs
= CFGA_STAT_DISCONNECTED
;
1233 case SYSC_CFGA_RSTATE_CONNECTED
:
1234 cs
= CFGA_STAT_CONNECTED
;
1237 cs
= CFGA_STAT_NONE
;
1245 ostate_cvt(sysc_cfga_ostate_t os
)
1250 case SYSC_CFGA_OSTATE_UNCONFIGURED
:
1251 cs
= CFGA_STAT_UNCONFIGURED
;
1253 case SYSC_CFGA_OSTATE_CONFIGURED
:
1254 cs
= CFGA_STAT_CONFIGURED
;
1257 cs
= CFGA_STAT_NONE
;
1265 cond_cvt(sysc_cfga_cond_t sc
)
1270 case SYSC_CFGA_COND_OK
:
1273 case SYSC_CFGA_COND_FAILING
:
1274 cc
= CFGA_COND_FAILING
;
1276 case SYSC_CFGA_COND_FAILED
:
1277 cc
= CFGA_COND_FAILED
;
1279 case SYSC_CFGA_COND_UNUSABLE
:
1280 cc
= CFGA_COND_UNUSABLE
;
1282 case SYSC_CFGA_COND_UNKNOWN
:
1284 cc
= CFGA_COND_UNKNOWN
;
1292 info_set(ac_stat_t
*asp
, mema_bank_t
*bkp
, cfga_info_t info
)
1294 mema_disabled_t disab
;
1297 u_longlong_t decode
;
1302 end
= &info
[sizeof (cfga_info_t
)];
1307 /* Print the board number in a way that matches the sysctrl AP. */
1308 info
+= snprintf(info
, end
- info
, "slot%d", board
);
1310 if (asp
->real_size
== 0) {
1311 info
+= snprintf(info
, end
- info
, " empty");
1315 if ((n
= asp
->real_size
) >= 1024) {
1320 info
+= snprintf(info
, end
- info
, " %d%s", n
, f
);
1322 if (asp
->rstate
== SYSC_CFGA_RSTATE_CONNECTED
&&
1323 asp
->ostate
== SYSC_CFGA_OSTATE_CONFIGURED
&&
1324 asp
->use_size
!= asp
->real_size
) {
1325 if ((n
= asp
->use_size
) >= 1024) {
1330 info
+= snprintf(info
, end
- info
, " (%d%s used)", n
, f
);
1334 decode
= asp
->ac_decode0
;
1336 decode
= asp
->ac_decode1
;
1338 info
+= snprintf(info
, end
- info
, " base 0x%llx",
1339 GRP_REALBASE(decode
));
1342 intlv
= INTLV0(asp
->ac_memctl
);
1344 intlv
= INTLV1(asp
->ac_memctl
);
1347 info
+= snprintf(info
, end
- info
, " interleaved %u-way",
1350 if (prom_read_disabled_list(&disab
, board
)) {
1352 info
+= snprintf(info
, end
- info
, " disabled at boot");
1357 if (asp
->rstate
== SYSC_CFGA_RSTATE_CONNECTED
&&
1358 asp
->ostate
== SYSC_CFGA_OSTATE_CONFIGURED
&&
1359 asp
->nonrelocatable
)
1360 info
+= snprintf(info
, end
- info
, " permanent");
1364 mema_cvt(ac_stat_t
*ac
, mema_bank_t
*bkp
, cfga_stat_data_t
*cs
)
1366 (void) strcpy(cs
->ap_type
, "memory");
1367 cs
->ap_r_state
= rstate_cvt(ac
->rstate
);
1368 cs
->ap_o_state
= ostate_cvt(ac
->ostate
);
1369 cs
->ap_cond
= cond_cvt(ac
->condition
);
1370 cs
->ap_busy
= (cfga_busy_t
)ac
->busy
;
1371 cs
->ap_status_time
= ac
->status_time
;
1372 info_set(ac
, bkp
, cs
->ap_info
);
1373 cs
->ap_log_id
[0] = NULL
;
1374 cs
->ap_phys_id
[0] = NULL
;
1381 struct cfga_stat_data
*cs
,
1382 const char *options
,
1388 option_set_t do_option
;
1390 if (errstring
!= NULL
)
1394 do_option
= process_options(options
, stat_opts
, &ret
, errstring
);
1398 ret
= ap_stat(ap_id
, NULL
, &bk
, &stat
, errstring
);
1402 mema_cvt(&stat
, &bk
, cs
);
1404 ret
= prom_do_options(do_option
, bk
.board
, &stat
, errstring
);
1413 cfga_stat_data_t
**ap_list
,
1415 const char *options
,
1418 if (errstring
!= NULL
)
1421 return (CFGA_NOTSUPP
);
1425 * cfga_ap_id_cmp -- use default_ap_id_cmp() in libcfgadm
1430 cfga_help(struct cfga_msg
*msgp
, const char *options
, cfga_flags_t flags
)
1434 (*msgp
->message_routine
)(msgp
->appdata_ptr
, mema_help
);
1435 (*msgp
->message_routine
)(msgp
->appdata_ptr
, disable_opts
);
1436 (*msgp
->message_routine
)(msgp
->appdata_ptr
, enable_opts
);
1437 (*msgp
->message_routine
)(msgp
->appdata_ptr
, timeout_opts
);
1438 (*msgp
->message_routine
)(msgp
->appdata_ptr
, test_opts
);
1439 (*msgp
->message_routine
)(msgp
->appdata_ptr
, private_funcs
);
1445 static ac_mem_version_t
1448 ac_mem_version_t ver
;
1452 dump_ioctl(AC_MEM_ADMIN_VER
, &ver
);
1453 ret
= ioctl(fd
, AC_MEM_ADMIN_VER
, &ver
);
1455 dump_ioctl_res(AC_MEM_ADMIN_VER
, &ver
, ret
, ret_errno
);
1461 opt_help_str(struct opt_control
*opts
)
1467 static const char help_sep
[] = ", ";
1468 static const char help_nil
[] = "???";
1472 for (i
= 0; opts
[i
].subopt
!= -1; i
++) {
1474 len
+= strlen(mema_opts
[opts
[i
].subopt
]);
1477 return (strdup(help_nil
));
1478 len
+= (n
- 1) * strlen(help_sep
);
1480 str
= (char *)malloc(len
);
1485 for (i
= 0; opts
[i
].subopt
!= -1; i
++) {
1486 (void) strcat(str
, sep
);
1487 (void) strcat(str
, mema_opts
[opts
[i
].subopt
]);
1495 const char *options
,
1496 struct opt_control
*opts
,
1500 option_set_t opt_set
;
1501 char *optcopy
, *optcopy_alloc
;
1509 OPTSET_INIT(opt_set
);
1511 if (options
== NULL
|| *options
== '\0') {
1515 optcopy
= optcopy_alloc
= strdup(options
);
1516 if (optcopy_alloc
== NULL
) {
1517 __fmt_errstring(errstring
, 20,
1518 dgettext(TEXT_DOMAIN
, calloc_fail
), strlen(options
) + 1, 1);
1519 *retp
= CFGA_LIB_ERROR
;
1524 while (*optcopy
!= '\0' && subopt_err
== 0) {
1525 subopt
= getsubopt(&optcopy
, mema_opts
, &value
);
1529 hlp
= opt_help_str(opts
);
1530 __fmt_errstring(errstring
, strlen(value
) + strlen(hlp
),
1531 dgettext(TEXT_DOMAIN
, unk_subopt
), value
, hlp
);
1536 for (i
= 0; opts
[i
].subopt
!= -1; i
++) {
1537 if (opts
[i
].subopt
== subopt
) {
1538 group
= opts
[i
].group
;
1542 if (opts
[i
].subopt
== -1) {
1545 hlp
= opt_help_str(opts
);
1546 __fmt_errstring(errstring
,
1547 MAX_OPT_LENGTH
+ strlen(hlp
),
1548 dgettext(TEXT_DOMAIN
, not_valid
),
1549 mema_opts
[subopt
], hlp
);
1554 need_value
= OPT_NEEDS_VALUE(subopt
);
1555 if (!need_value
&& value
!= NULL
) {
1556 __fmt_errstring(errstring
, MAX_OPT_LENGTH
,
1557 dgettext(TEXT_DOMAIN
, no_value
),
1562 if (need_value
&& value
== NULL
) {
1563 __fmt_errstring(errstring
, MAX_OPT_LENGTH
,
1564 dgettext(TEXT_DOMAIN
, missing_value
),
1569 if (OPTSET_TEST(opt_set
, subopt
)) {
1570 /* Ignore repeated options. */
1573 if (group
!= 0 && !OPTSET_IS_EMPTY(opt_set
)) {
1574 for (i
= 0; opts
[i
].subopt
!= -1; i
++) {
1577 if (opts
[i
].group
== group
&&
1578 OPTSET_TEST(opt_set
, opts
[i
].subopt
))
1581 if (opts
[i
].subopt
!= -1) {
1582 __fmt_errstring(errstring
, MAX_OPT_LENGTH
* 2,
1583 dgettext(TEXT_DOMAIN
, conflict_opt
),
1585 mema_opts
[opts
[i
].subopt
]);
1590 OPTSET_SET_VAL(opt_set
, subopt
, value
);
1592 free((void *)optcopy_alloc
);
1609 return (debug_fp
!= NULL
);
1612 if ((ep
= getenv("MEMADM_DEBUG")) == NULL
) {
1618 if ((debug_fp
= fopen(ep
, "a")) == NULL
)
1621 (void) fprintf(debug_fp
, "\nDebug started, pid=%d\n", (int)getpid());
1634 case AC_MEM_CONFIGURE
:
1635 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_CONFIGURE\n");
1638 case AC_MEM_UNCONFIGURE
:
1639 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_UNCONFIGURE\n");
1642 case AC_MEM_TEST_START
:
1643 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_TEST_START\n");
1646 case AC_MEM_TEST_STOP
: {
1647 ac_mem_test_stop_t
*tstop
;
1649 tstop
= (ac_mem_test_stop_t
*)arg
;
1650 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_TEST_STOP handle=%#x "
1651 "condition=%d\n", tstop
->handle
, tstop
->condition
);
1654 case AC_MEM_TEST_READ
: {
1655 ac_mem_test_read_t
*tread
;
1657 tread
= (ac_mem_test_read_t
*)arg
;
1658 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_TEST_READ handle=%#x "
1659 "buf=%#p page=%#llx off=%#x count=%#x\n",
1660 tread
->handle
, tread
->page_buf
,
1661 tread
->address
.page_num
,
1662 tread
->address
.line_offset
, tread
->address
.line_count
);
1665 case AC_MEM_TEST_WRITE
: {
1666 ac_mem_test_write_t
*twrite
;
1668 twrite
= (ac_mem_test_write_t
*)arg
;
1669 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_TEST_WRITE handle=%#x "
1670 "buf=%#p page=%#llx off=%#x count=%#x\n",
1671 twrite
->handle
, twrite
->page_buf
,
1672 twrite
->address
.page_num
,
1673 twrite
->address
.line_offset
, twrite
->address
.line_count
);
1676 case AC_MEM_ADMIN_VER
:
1677 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_ADMIN_VER:\n");
1680 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_STAT\n");
1682 case AC_MEM_EXERCISE
: {
1683 ac_cfga_cmd_t
*cmdp
;
1686 (void) fprintf(debug_fp
, "IOCTL: AC_MEM_EXERCISE arg=%d\n",
1691 (void) fprintf(debug_fp
, "IOCTL: unknown (%#x)\n", cmd
);
1694 (void) fflush(debug_fp
);
1708 (void) fprintf(debug_fp
, "IOCTL failed, \"%s\" (errno=%d)\n",
1709 strerror(ret_errno
), ret_errno
);
1710 (void) fflush(debug_fp
);
1713 (void) fprintf(debug_fp
, "IOCTL succeeded, ret=%d\n", ret
);
1717 case AC_MEM_CONFIGURE
:
1718 case AC_MEM_UNCONFIGURE
:
1720 case AC_MEM_TEST_START
: {
1721 ac_mem_test_start_t
*tstart
;
1723 tstart
= (ac_mem_test_start_t
*)arg
;
1724 (void) fprintf(debug_fp
, " handle=%#x tester_pid=%d "
1725 "prev_condition=%d bank_size=%#llx "
1726 "page_size=%#x line_size=%#x afar_base=%#llx\n",
1727 tstart
->handle
, (int)tstart
->tester_pid
,
1728 tstart
->prev_condition
,
1729 tstart
->bank_size
, tstart
->page_size
,
1730 tstart
->line_size
, tstart
->afar_base
);
1733 case AC_MEM_TEST_STOP
:
1735 case AC_MEM_TEST_READ
: {
1736 ac_mem_test_read_t
*tread
;
1737 sunfire_processor_error_regs_t
*err
;
1739 tread
= (ac_mem_test_read_t
*)arg
;
1740 err
= tread
->error_buf
;
1741 if (ret_errno
== EIO
) {
1742 (void) fprintf(debug_fp
, "module_id=%#llx afsr=%#llx "
1743 "afar=%#llx udbh_error_reg=%#llx "
1744 "udbl_error_reg=%#llx\n",
1745 (longlong_t
)err
->module_id
, (longlong_t
)err
->afsr
,
1746 (longlong_t
)err
->afar
,
1747 (longlong_t
)err
->udbh_error_reg
,
1748 (longlong_t
)err
->udbl_error_reg
);
1750 (void) fprintf(debug_fp
, "\n");
1754 case AC_MEM_TEST_WRITE
:
1756 case AC_MEM_ADMIN_VER
: {
1757 ac_mem_version_t
*ver
;
1759 ver
= (ac_mem_version_t
*)arg
;
1760 (void) fprintf(debug_fp
, " version %d\n", *ver
);
1766 tstat
= (ac_stat_t
*)arg
;
1767 (void) fprintf(debug_fp
, " rstate=%u ostate=%u "
1768 "condition=%u status_time=%#lx board=%u\n",
1769 (uint_t
)tstat
->rstate
, (uint_t
)tstat
->ostate
,
1770 (uint_t
)tstat
->condition
, (ulong_t
)tstat
->status_time
,
1772 (void) fprintf(debug_fp
, " real_size=%u use_size=%u "
1774 tstat
->real_size
, tstat
->use_size
, tstat
->busy
);
1775 (void) fprintf(debug_fp
, " page_size=%#x "
1776 "phys_pages=%#llx managed=%#llx nonrelocatable=%#llx\n",
1777 tstat
->page_size
, (longlong_t
)tstat
->phys_pages
,
1778 (longlong_t
)tstat
->managed
,
1779 (longlong_t
)tstat
->nonrelocatable
);
1780 (void) fprintf(debug_fp
, " memctl=%#llx "
1781 "decode0=%#llx decode1=%#llx\n",
1782 (longlong_t
)tstat
->ac_memctl
, (longlong_t
)tstat
->ac_decode0
,
1783 (longlong_t
)tstat
->ac_decode1
);
1786 case AC_MEM_EXERCISE
: {
1787 ac_cfga_cmd_t
*cmdp
;
1790 switch (cmdp
->arg
) {
1791 case AC_MEMX_RELOCATE_ALL
: {
1792 struct ac_memx_relocate_stats
*stp
;
1794 if ((stp
= cmdp
->private) != NULL
) {
1795 (void) fprintf(debug_fp
, " base=%u npgs=%u"
1796 " nopaget=%u nolock=%u isfree=%u reloc=%u"
1798 stp
->base
, stp
->npgs
, stp
->nopaget
,
1799 stp
->nolock
, stp
->isfree
, stp
->reloc
,
1812 (void) fflush(debug_fp
);
1814 #endif /* DEV_DEBUG */