2 /* $NecBSD: dp83932subr.c,v 1.5.6.2 1999/10/09 05:47:23 kmatsuda Exp $ */
6 * Copyright (c) 1997, 1998, 1999
7 * Kouichi Matsuda. All rights reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Kouichi Matsuda for
21 * 4. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 * Routines of NEC PC-9801-83, 84, 103, 104, PC-9801N-25 and PC-9801N-J02, J02R
37 * Ethernet interface for NetBSD/pc98, ported by Kouichi Matsuda.
39 * These cards use National Semiconductor DP83934AVQB as Ethernet Controller
40 * and National Semiconductor NS46C46 as (64 * 16 bits) Microwire Serial EEPROM.
44 * Modified for FreeBSD(98) 4.0 from NetBSD/pc98 1.4.2 by Motomichi Matsuzaki.
47 #include <sys/param.h>
48 #include <sys/systm.h>
49 #include <sys/protosw.h>
50 #include <sys/socket.h>
52 #include <net/ethernet.h>
54 #include <net/if_arp.h>
55 #include <net/if_media.h>
58 #include <netinet/in.h>
59 #include <netinet/in_systm.h>
60 #include <netinet/in_var.h>
61 #include <netinet/ip.h>
62 #include <netinet/if_inarp.h>
67 #include <machine/bus.h>
69 #include <dev/snc/dp83932reg.h>
70 #include <dev/snc/dp83932var.h>
71 #include <dev/snc/if_sncreg.h>
72 #include <dev/snc/dp83932subr.h>
74 integrate u_int16_t snc_nec16_select_bank
75 (struct snc_softc *, u_int32_t, u_int32_t);
78 * Interface exists: make available by filling in network interface
79 * record. System will initialize the interface when it is ready
92 * Put the pup in reset mode (sncinit() will fix it later),
93 * stop the timer, disable all interrupts and clear any interrupts.
95 NIC_PUT(sc, SNCR_CR, CR_STP);
97 NIC_PUT(sc, SNCR_CR, CR_RST);
99 NIC_PUT(sc, SNCR_IMR, 0);
101 NIC_PUT(sc, SNCR_ISR, ISR_ALL);
105 * because the SONIC is basically 16bit device it 'concatenates'
106 * a higher buffer address to a 16 bit offset--this will cause wrap
107 * around problems near the end of 64k !!
111 for (i = 0; i < NRRA; i++) {
112 sc->v_rra[i] = SONIC_GETDMA(p);
113 p += RXRSRC_SIZE(sc);
115 sc->v_rea = SONIC_GETDMA(p);
119 sc->v_cda = SONIC_GETDMA(p);
124 for (i = 0; i < NTDA; i++) {
125 struct mtd *mtdp = &sc->mtda[i];
126 mtdp->mtd_vtxp = SONIC_GETDMA(p);
132 if ((p - pp) > NBPG) {
133 device_printf (sc->sc_dev, "sizeof RRA (%ld) + CDA (%ld) +"
134 "TDA (%ld) > NBPG (%d). Punt!\n",
135 (ulong)sc->v_cda - (ulong)sc->v_rra[0],
136 (ulong)sc->mtda[0].mtd_vtxp - (ulong)sc->v_cda,
137 (ulong)p - (ulong)sc->mtda[0].mtd_vtxp,
145 sc->sc_nrda = NBPG / RXPKT_SIZE(sc);
146 sc->v_rda = SONIC_GETDMA(p);
150 for (i = 0; i < NRBA; i++) {
157 for (i = 0; i < NTDA; i++) {
158 struct mtd *mtdp = &sc->mtda[i];
160 mtdp->mtd_vbuf = SONIC_GETDMA(p);
175 * miscellaneous NEC/SONIC detect functions.
179 * check if a specified irq is acceptable.
182 snc_nec16_validate_irq(irq)
185 const u_int8_t encoded_irq[16] = {
186 -1, -1, -1, 0, -1, 1, 2, -1, -1, 3, 4, -1, 5, 6, -1, -1
189 return encoded_irq[irq];
193 * specify irq to board.
196 snc_nec16_register_irq(sc, irq)
197 struct snc_softc *sc;
200 bus_space_tag_t iot = sc->sc_iot;
201 bus_space_handle_t ioh = sc->sc_ioh;
202 u_int8_t encoded_irq;
204 encoded_irq = snc_nec16_validate_irq(irq);
205 if (encoded_irq == (u_int8_t) -1) {
206 printf("snc_nec16_register_irq: unsupported irq (%d)\n", irq);
210 /* select SNECR_IRQSEL register */
211 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_IRQSEL);
212 /* write encoded irq value */
213 bus_space_write_1(iot, ioh, SNEC_CTRLB, encoded_irq);
219 * check if a specified memory base address is acceptable.
222 snc_nec16_validate_mem(maddr)
226 /* Check on Normal mode with max range, only */
227 if ((maddr & ~0x1E000) != 0xC0000) {
228 printf("snc_nec16_validate_mem: "
229 "unsupported window base (0x%x)\n", maddr);
237 * specify memory base address to board and map to first bank.
240 snc_nec16_register_mem(sc, maddr)
241 struct snc_softc *sc;
244 bus_space_tag_t iot = sc->sc_iot;
245 bus_space_handle_t ioh = sc->sc_ioh;
247 if (snc_nec16_validate_mem(maddr) == 0)
250 /* select SNECR_MEMSEL register */
251 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMSEL);
252 /* write encoded memory base select value */
253 bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_MEMSEL_PHYS2EN(maddr));
256 * set current bank to 0 (bottom) and map
258 /* select SNECR_MEMBS register */
259 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS);
260 /* select new bank */
261 bus_space_write_1(iot, ioh, SNEC_CTRLB,
262 SNECR_MEMBS_B2EB(0) | SNECR_MEMBS_BSEN);
263 /* set current bank to 0 */
270 snc_nec16_check_memory(iot, ioh, memt, memh)
272 bus_space_handle_t ioh;
273 bus_space_tag_t memt;
274 bus_space_handle_t memh;
280 for (i = 0; i < SNEC_NBANK; i++) {
281 /* select new bank */
282 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS);
283 bus_space_write_1(iot, ioh, SNEC_CTRLB,
284 SNECR_MEMBS_B2EB(i) | SNECR_MEMBS_BSEN);
286 /* write test pattern */
287 for (j = 0; j < SNEC_NMEMS / 2; j++) {
288 bus_space_write_2(memt, memh, j * 2, val + j);
294 for (i = 0; i < SNEC_NBANK; i++) {
295 /* select new bank */
296 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS);
297 bus_space_write_1(iot, ioh, SNEC_CTRLB,
298 SNECR_MEMBS_B2EB(i) | SNECR_MEMBS_BSEN);
300 /* read test pattern */
301 for (j = 0; j < SNEC_NMEMS / 2; j++) {
302 if (bus_space_read_2(memt, memh, j * 2) != val + j)
306 if (j < SNEC_NMEMS / 2) {
307 printf("snc_nec16_check_memory: "
308 "memory check failed at 0x%04x%04x"
309 "val 0x%04x != expected 0x%04x\n", i, j,
310 bus_space_read_2(memt, memh, j * 2),
318 for (i = 0; i < SNEC_NBANK; i++) {
319 /* select new bank */
320 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS);
321 bus_space_write_1(iot, ioh, SNEC_CTRLB,
322 SNECR_MEMBS_B2EB(i) | SNECR_MEMBS_BSEN);
324 bus_space_set_region_4(memt, memh, 0, 0, SNEC_NMEMS >> 2);
327 /* again read test if these are 0 */
328 for (i = 0; i < SNEC_NBANK; i++) {
329 /* select new bank */
330 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS);
331 bus_space_write_1(iot, ioh, SNEC_CTRLB,
332 SNECR_MEMBS_B2EB(i) | SNECR_MEMBS_BSEN);
334 /* check if cleared */
335 for (j = 0; j < SNEC_NMEMS; j += 2) {
336 if (bus_space_read_2(memt, memh, j) != 0)
340 if (j != SNEC_NMEMS) {
341 printf("snc_nec16_check_memory: "
342 "memory zero clear failed at 0x%04x%04x\n", i, j);
351 snc_nec16_detectsubr(iot, ioh, memt, memh, irq, maddr, type)
353 bus_space_handle_t ioh;
354 bus_space_tag_t memt;
355 bus_space_handle_t memh;
364 if (snc_nec16_validate_irq(irq) == (u_int8_t) -1)
366 /* XXX: maddr already checked */
367 if (snc_nec16_validate_mem(maddr) == 0)
370 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_IDENT);
371 ident = bus_space_read_1(iot, ioh, SNEC_CTRLB);
372 if (ident == 0xff || ident == 0x00) {
378 case SNEC_TYPE_LEGACY:
379 rv = (ident == SNECR_IDENT_LEGACY_CBUS);
382 rv = ((ident == SNECR_IDENT_PNP_CBUS) ||
383 (ident == SNECR_IDENT_PNP_PCMCIABUS));
390 printf("snc_nec16_detectsubr: parent bus mismatch\n");
394 /* select SONIC register SNCR_CR */
395 bus_space_write_1(iot, ioh, SNEC_ADDR, SNCR_CR);
396 bus_space_write_2(iot, ioh, SNEC_CTRL, CR_RXDIS | CR_STP | CR_RST);
399 cr = bus_space_read_2(iot, ioh, SNEC_CTRL);
400 if (cr != (CR_RXDIS | CR_STP | CR_RST)) {
402 printf("snc_nec16_detectsubr: card reset failed, cr = 0x%04x\n",
408 if (snc_nec16_check_memory(iot, ioh, memt, memh) == 0)
415 #define SNC_VENDOR_NEC 0x00004c
416 #define SNC_NEC_SERIES_LEGACY_CBUS 0xa5
417 #define SNC_NEC_SERIES_PNP_PCMCIA 0xd5
418 #define SNC_NEC_SERIES_PNP_PCMCIA2 0x6d /* XXX */
419 #define SNC_NEC_SERIES_PNP_CBUS 0x0d
420 #define SNC_NEC_SERIES_PNP_CBUS2 0x3d
423 snc_nec16_detect_type(myea)
426 u_int32_t vendor = (myea[0] << 16) | (myea[1] << 8) | myea[2];
427 u_int8_t series = myea[3];
428 u_int8_t type = myea[4] & 0x80;
434 case SNC_NEC_SERIES_LEGACY_CBUS:
436 typestr = "NEC PC-9801-84";
438 typestr = "NEC PC-9801-83";
440 case SNC_NEC_SERIES_PNP_CBUS:
441 case SNC_NEC_SERIES_PNP_CBUS2:
443 typestr = "NEC PC-9801-104";
445 typestr = "NEC PC-9801-103";
447 case SNC_NEC_SERIES_PNP_PCMCIA:
448 case SNC_NEC_SERIES_PNP_PCMCIA2:
451 typestr = "NEC PC-9801N-J02R";
453 typestr = "NEC PC-9801N-J02";
456 typestr = "NEC unknown (PC-9801N-25?)";
461 typestr = "unknown (3rd vendor?)";
469 snc_nec16_get_enaddr(iot, ioh, myea)
471 bus_space_handle_t ioh;
474 u_int8_t eeprom[SNEC_EEPROM_SIZE];
475 u_int8_t rom_sum, sum = 0x00;
478 snc_nec16_read_eeprom(iot, ioh, eeprom);
480 for (i = SNEC_EEPROM_KEY0; i < SNEC_EEPROM_CKSUM; i++) {
481 sum = sum ^ eeprom[i];
484 rom_sum = eeprom[SNEC_EEPROM_CKSUM];
486 if (sum != rom_sum) {
487 printf("snc_nec16_get_enaddr: "
488 "checksum mismatch; calculated %02x != read %02x",
493 for (i = 0; i < ETHER_ADDR_LEN; i++)
494 myea[i] = eeprom[SNEC_EEPROM_SA0 + i];
500 * read from NEC/SONIC NIC register.
503 snc_nec16_nic_get(sc, reg)
504 struct snc_softc *sc;
509 /* select SONIC register */
510 bus_space_write_1(sc->sc_iot, sc->sc_ioh, SNEC_ADDR, reg);
511 val = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SNEC_CTRL);
517 * write to NEC/SONIC NIC register.
520 snc_nec16_nic_put(sc, reg, val)
521 struct snc_softc *sc;
526 /* select SONIC register */
527 bus_space_write_1(sc->sc_iot, sc->sc_ioh, SNEC_ADDR, reg);
528 bus_space_write_2(sc->sc_iot, sc->sc_ioh, SNEC_CTRL, val);
533 * select memory bank and map
534 * where exists specified (internal buffer memory) offset.
537 snc_nec16_select_bank(sc, base, offset)
538 struct snc_softc *sc;
542 bus_space_tag_t iot = sc->sc_iot;
543 bus_space_handle_t ioh = sc->sc_ioh;
547 /* bitmode is fixed to 16 bit. */
548 bank = (base + offset * 2) >> 13;
549 noffset = (base + offset * 2) & (SNEC_NMEMS - 1);
553 device_printf(sc->sc_dev, "noffset is odd (0x%04x)\n",
556 #endif /* SNCDEBUG */
558 if (sc->curbank != bank) {
559 /* select SNECR_MEMBS register */
560 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS);
561 /* select new bank */
562 bus_space_write_1(iot, ioh, SNEC_CTRLB,
563 SNECR_MEMBS_B2EB(bank) | SNECR_MEMBS_BSEN);
564 /* update current bank */
572 * write to SONIC descriptors.
575 snc_nec16_writetodesc(sc, base, offset, val)
576 struct snc_softc *sc;
581 bus_space_tag_t memt = sc->sc_memt;
582 bus_space_handle_t memh = sc->sc_memh;
585 noffset = snc_nec16_select_bank(sc, base, offset);
587 bus_space_write_2(memt, memh, noffset, val);
591 * read from SONIC descriptors.
594 snc_nec16_readfromdesc(sc, base, offset)
595 struct snc_softc *sc;
599 bus_space_tag_t memt = sc->sc_memt;
600 bus_space_handle_t memh = sc->sc_memh;
603 noffset = snc_nec16_select_bank(sc, base, offset);
605 return bus_space_read_2(memt, memh, noffset);
609 * read from SONIC data buffer.
612 snc_nec16_copyfrombuf(sc, dst, offset, size)
613 struct snc_softc *sc;
618 bus_space_tag_t memt = sc->sc_memt;
619 bus_space_handle_t memh = sc->sc_memh;
621 u_int8_t* bptr = dst;
623 noffset = snc_nec16_select_bank(sc, offset, 0);
625 /* XXX: should check if offset + size < 0x2000. */
627 bus_space_barrier(memt, memh, noffset, size,
628 BUS_SPACE_BARRIER_READ);
632 size_t asize = (~noffset & 3);
634 bus_space_read_region_1(memt, memh, noffset,
640 bus_space_read_region_4(memt, memh, noffset,
641 (u_int32_t *) bptr, size >> 2);
643 noffset += size & ~3;
647 bus_space_read_region_1(memt, memh, noffset, bptr, size);
651 * write to SONIC data buffer.
654 snc_nec16_copytobuf(sc, src, offset, size)
655 struct snc_softc *sc;
660 bus_space_tag_t memt = sc->sc_memt;
661 bus_space_handle_t memh = sc->sc_memh;
662 u_int16_t noffset, onoffset;
664 u_int8_t* bptr = src;
666 noffset = snc_nec16_select_bank(sc, offset, 0);
669 /* XXX: should check if offset + size < 0x2000. */
673 size_t asize = (~noffset & 3);
675 bus_space_write_region_1(memt, memh, noffset,
681 bus_space_write_region_4(memt, memh, noffset,
682 (u_int32_t *)bptr, size >> 2);
684 noffset += size & ~3;
688 bus_space_write_region_1(memt, memh, noffset, bptr, size);
690 bus_space_barrier(memt, memh, onoffset, osize,
691 BUS_SPACE_BARRIER_WRITE);
695 * write (fill) 0 to SONIC data buffer.
698 snc_nec16_zerobuf(sc, offset, size)
699 struct snc_softc *sc;
703 bus_space_tag_t memt = sc->sc_memt;
704 bus_space_handle_t memh = sc->sc_memh;
705 u_int16_t noffset, onoffset;
708 noffset = snc_nec16_select_bank(sc, offset, 0);
711 /* XXX: should check if offset + size < 0x2000. */
715 size_t asize = (~noffset & 3);
717 bus_space_set_region_1(memt, memh, noffset, 0, asize);
721 bus_space_set_region_4(memt, memh, noffset, 0, size >> 2);
722 noffset += size & ~3;
726 bus_space_set_region_1(memt, memh, noffset, 0, size);
728 bus_space_barrier(memt, memh, onoffset, osize,
729 BUS_SPACE_BARRIER_WRITE);
734 * Routines to read bytes sequentially from EEPROM through NEC PC-9801-83,
735 * 84, 103, 104, PC-9801N-25 and PC-9801N-J02, J02R for NetBSD/pc98.
736 * Ported by Kouichi Matsuda.
738 * This algorism is generic to read data sequentially from 4-Wire
739 * Microwire Serial EEPROM.
742 #define SNEC_EEP_DELAY 1000
745 snc_nec16_read_eeprom(iot, ioh, data)
747 bus_space_handle_t ioh;
750 u_int8_t n, val, bit;
752 /* Read bytes from EEPROM; two bytes per an iteration. */
753 for (n = 0; n < SNEC_EEPROM_SIZE / 2; n++) {
754 /* select SNECR_EEP */
755 bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_EEP);
757 bus_space_write_1(iot, ioh, SNEC_CTRLB, 0x00);
758 delay(SNEC_EEP_DELAY);
760 /* Start EEPROM access. */
761 bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS);
762 delay(SNEC_EEP_DELAY);
764 bus_space_write_1(iot, ioh, SNEC_CTRLB,
765 SNECR_EEP_CS | SNECR_EEP_SK);
766 delay(SNEC_EEP_DELAY);
768 bus_space_write_1(iot, ioh, SNEC_CTRLB,
769 SNECR_EEP_CS | SNECR_EEP_DI);
770 delay(SNEC_EEP_DELAY);
772 bus_space_write_1(iot, ioh, SNEC_CTRLB,
773 SNECR_EEP_CS | SNECR_EEP_SK | SNECR_EEP_DI);
774 delay(SNEC_EEP_DELAY);
776 bus_space_write_1(iot, ioh, SNEC_CTRLB,
777 SNECR_EEP_CS | SNECR_EEP_DI);
778 delay(SNEC_EEP_DELAY);
780 bus_space_write_1(iot, ioh, SNEC_CTRLB,
781 SNECR_EEP_CS | SNECR_EEP_SK | SNECR_EEP_DI);
782 delay(SNEC_EEP_DELAY);
784 bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS);
785 delay(SNEC_EEP_DELAY);
787 bus_space_write_1(iot, ioh, SNEC_CTRLB,
788 SNECR_EEP_CS | SNECR_EEP_SK);
789 delay(SNEC_EEP_DELAY);
791 /* Pass the iteration count to the chip. */
792 for (bit = 0x20; bit != 0x00; bit >>= 1) {
793 bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS |
794 ((n & bit) ? SNECR_EEP_DI : 0x00));
795 delay(SNEC_EEP_DELAY);
797 bus_space_write_1(iot, ioh, SNEC_CTRLB,
798 SNECR_EEP_CS | SNECR_EEP_SK |
799 ((n & bit) ? SNECR_EEP_DI : 0x00));
800 delay(SNEC_EEP_DELAY);
803 bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS);
804 (void) bus_space_read_1(iot, ioh, SNEC_CTRLB); /* ACK */
805 delay(SNEC_EEP_DELAY);
809 for (bit = 0x80; bit != 0x00; bit >>= 1) {
810 bus_space_write_1(iot, ioh, SNEC_CTRLB,
811 SNECR_EEP_CS | SNECR_EEP_SK);
812 delay(SNEC_EEP_DELAY);
814 bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS);
816 if (bus_space_read_1(iot, ioh, SNEC_CTRLB) & SNECR_EEP_DO)
821 /* Read one more byte. */
823 for (bit = 0x80; bit != 0x00; bit >>= 1) {
824 bus_space_write_1(iot, ioh, SNEC_CTRLB,
825 SNECR_EEP_CS | SNECR_EEP_SK);
826 delay(SNEC_EEP_DELAY);
828 bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS);
830 if (bus_space_read_1(iot, ioh, SNEC_CTRLB) & SNECR_EEP_DO)
835 bus_space_write_1(iot, ioh, SNEC_CTRLB, 0x00);
836 delay(SNEC_EEP_DELAY);
840 /* Report what we got. */
841 data -= SNEC_EEPROM_SIZE;
842 log(LOG_INFO, "%s: EEPROM:"
843 " %02x%02x%02x%02x %02x%02x%02x%02x -"
844 " %02x%02x%02x%02x %02x%02x%02x%02x -"
845 " %02x%02x%02x%02x %02x%02x%02x%02x -"
846 " %02x%02x%02x%02x %02x%02x%02x%02x\n",
847 "snc_nec16_read_eeprom",
848 data[ 0], data[ 1], data[ 2], data[ 3],
849 data[ 4], data[ 5], data[ 6], data[ 7],
850 data[ 8], data[ 9], data[10], data[11],
851 data[12], data[13], data[14], data[15],
852 data[16], data[17], data[18], data[19],
853 data[20], data[21], data[22], data[23],
854 data[24], data[25], data[26], data[27],
855 data[28], data[29], data[30], data[31]);
861 snc_nec16_dump_reg(iot, ioh)
863 bus_space_handle_t ioh;
868 printf("SONIC registers (word):");
869 for (n = 0; n < SNC_NREGS; n++) {
870 /* select required SONIC register */
871 bus_space_write_1(iot, ioh, SNEC_ADDR, n);
873 val = bus_space_read_2(iot, ioh, SNEC_CTRL);
875 printf("\n%04x ", val);
877 printf("%04x ", val);
881 printf("NEC/SONIC registers (byte):\n");
882 for (n = SNECR_MEMBS; n <= SNECR_IDENT; n += 2) {
883 /* select required SONIC register */
884 bus_space_write_1(iot, ioh, SNEC_ADDR, n);
886 val = (u_int16_t) bus_space_read_1(iot, ioh, SNEC_CTRLB);
887 printf("%04x ", val);
892 #endif /* SNCDEBUG */