1 /* $NetBSD: device_test.c,v 1.3 2007/02/21 22:59:42 thorpej Exp $ */
4 * Copyright (c) 2004 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <lib/libsa/stand.h>
33 #include <lib/libkern/libkern.h>
35 #include <machine/sbd.h>
36 #include <machine/gavar.h>
38 #include "console.h" /* zskbd_print_keyscan */
45 extern bool lance_test(void);
47 int i82589_test(void);
48 int picnic_test(void);
53 cmd_ga_test(int argc
, char *argp
[], int interactive
)
57 switch (strtoul(argp
[1], 0, 0)) {
61 if (SBD_INFO
->machine
== MACHINE_TR2A
)
66 for (i
= 0; i
< 256; i
++)
67 fb_clear(240, 240, 240, 240, i
);
70 ga_plane_mask_test(&ga
);
78 cmd_kbd_scancode(int argc
, char *argp
[], int interactive
)
82 printf("ks on/off\n");
86 if (argp
[1][1] == 'n')
87 zskbd_print_keyscan(1);
88 else if (argp
[1][1] == 'f')
89 zskbd_print_keyscan(0);
95 cmd_ether_test(int argc
, char *argp
[], int interactive
)
98 if (SBD_INFO
->machine
== MACHINE_TR2
)
100 if (SBD_INFO
->machine
== MACHINE_TR2A
)
109 #define SCP_ADDR 0xa0800000
110 #define IEE_ADDR ((volatile uint32_t *)0xbb060000)
111 volatile uint32_t cmd
;
112 volatile uint16_t u16
;
119 for (i
= 0; i
< 100; i
++)
122 /* Board self test */
123 *(uint32_t *)(SCP_ADDR
+ 4) = 0xffffffff;
124 cmd
= (SCP_ADDR
& 0x0ffffff0) | /* i82586-mode, A24-A31 are omitted */
126 cmd
= (cmd
<< 16) | (cmd
>> 16);
127 printf("self test command 0x%x\n", cmd
);
130 for (i
= 0; i
< 0x60000; i
++) /* 393216 */
131 if ((u16
= *(volatile uint16_t *)(SCP_ADDR
+ 6)) == 0)
135 printf("i82596 self test success. (loop %d)\n", i
);
137 printf("i82586 self test failed.\n");
141 u16
= *(uint16_t *)(SCP_ADDR
+ 4);
142 printf("SCP_ADDR+4=0x%x\n", u16
);
143 if ((u16
& 0x103c) != 0) {
144 printf("i82589 self test data error.\n");
147 printf("i82589 self test data OK.\n");
158 printf("--------------------\n");
159 printf("%x ", *(uint8_t *)0xbb000000); /* 0x00 */
160 printf("%x ", *(uint8_t *)0xbb000004); /* 0xc0 */
161 printf("%x ", *(uint8_t *)0xbb000008); /* 0x00 */
162 printf("%x ", *(uint8_t *)0xbb000010); /* 0x01 */
164 printf("%x ", *(uint8_t *)0xbb001000); /* 0x00 */
165 printf("%x ", *(uint8_t *)0xbb001004); /* 0x00 */
166 printf("%x ", *(uint8_t *)0xbb001008); /* 0x00 */
167 printf("%x\n", *(uint8_t *)0xbb001010);/* 0x01 */
168 printf("--------------------\n");
169 *(uint8_t *)0xbb001010 = 0;
171 *(uint32_t *)0xbb060000 = 0;
173 printf("--------------------\n");
174 printf("%x ", *(uint8_t *)0xbb000000);
175 printf("%x ", *(uint8_t *)0xbb000004);
176 printf("%x ", *(uint8_t *)0xbb000008);
177 printf("%x ", *(uint8_t *)0xbb000010);
179 printf("%x ", *(uint8_t *)0xbb001000);
180 printf("%x ", *(uint8_t *)0xbb001004);
181 printf("%x ", *(uint8_t *)0xbb001008);
182 printf("%x\n", *(uint8_t *)0xbb001010);
183 printf("--------------------\n");
194 *(volatile uint8_t *)0xbb007000 = 0xff;
203 /* ROM_FDRDWR test */
208 for (i
= 0; i
< 1989; i
++) {
210 blk_to_2d_position(i
, &pos
, &cnt
);
211 err
= ROM_FD_RW(0, pos
, cnt
, buf
);
212 printf("%d err=%d\n", i
, err
);
216 for (j
= 0; j
< 512; j
++)
217 printf("%x", buf
[j
]);