Mon Jan 4 15:13:50 2021 UTC ()
Trailing whitespace


(skrll)
diff -r1.22 -r1.23 src/sys/arch/arm/xscale/pxa2x0_intr.c
diff -r1.30 -r1.31 src/sys/arch/sparc64/doc/TODO
diff -r1.304 -r1.305 src/sys/dev/ic/wdc.c

cvs diff -r1.22 -r1.23 src/sys/arch/arm/xscale/pxa2x0_intr.c (expand / switch to unified diff)

--- src/sys/arch/arm/xscale/pxa2x0_intr.c 2021/01/04 15:13:06 1.22
+++ src/sys/arch/arm/xscale/pxa2x0_intr.c 2021/01/04 15:13:50 1.23
@@ -1,55 +1,55 @@ @@ -1,55 +1,55 @@
1/* $NetBSD: pxa2x0_intr.c,v 1.22 2021/01/04 15:13:06 skrll Exp $ */ 1/* $NetBSD: pxa2x0_intr.c,v 1.23 2021/01/04 15:13:50 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2002 Genetec Corporation. All rights reserved. 4 * Copyright (c) 2002 Genetec Corporation. All rights reserved.
5 * Written by Hiroyuki Bessho for Genetec Corporation. 5 * Written by Hiroyuki Bessho for Genetec Corporation.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software 15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement: 16 * must display the following acknowledgement:
17 * This product includes software developed for the NetBSD Project by 17 * This product includes software developed for the NetBSD Project by
18 * Genetec Corporation. 18 * Genetec Corporation.
19 * 4. The name of Genetec Corporation may not be used to endorse or  19 * 4. The name of Genetec Corporation may not be used to endorse or
20 * promote products derived from this software without specific prior 20 * promote products derived from this software without specific prior
21 * written permission. 21 * written permission.
22 * 22 *
23 * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND 23 * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION 26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION
27 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE. 33 * POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36/* 36/*
37 * IRQ handler for the Intel PXA2X0 processor. 37 * IRQ handler for the Intel PXA2X0 processor.
38 * It has integrated interrupt controller. 38 * It has integrated interrupt controller.
39 */ 39 */
40 40
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42__KERNEL_RCSID(0, "$NetBSD: pxa2x0_intr.c,v 1.22 2021/01/04 15:13:06 skrll Exp $"); 42__KERNEL_RCSID(0, "$NetBSD: pxa2x0_intr.c,v 1.23 2021/01/04 15:13:50 skrll Exp $");
43 43
44#include <sys/param.h> 44#include <sys/param.h>
45#include <sys/systm.h> 45#include <sys/systm.h>
46#include <sys/malloc.h> 46#include <sys/malloc.h>
47 47
48#include <sys/bus.h> 48#include <sys/bus.h>
49#include <machine/intr.h> 49#include <machine/intr.h>
50#include <machine/lock.h> 50#include <machine/lock.h>
51 51
52#include <arm/xscale/pxa2x0cpu.h> 52#include <arm/xscale/pxa2x0cpu.h>
53#include <arm/xscale/pxa2x0reg.h> 53#include <arm/xscale/pxa2x0reg.h>
54#include <arm/xscale/pxa2x0var.h> 54#include <arm/xscale/pxa2x0var.h>
55#include <arm/xscale/pxa2x0_intr.h> 55#include <arm/xscale/pxa2x0_intr.h>
@@ -60,27 +60,27 @@ __KERNEL_RCSID(0, "$NetBSD: pxa2x0_intr. @@ -60,27 +60,27 @@ __KERNEL_RCSID(0, "$NetBSD: pxa2x0_intr.
60 */ 60 */
61static int pxaintc_match(device_t, cfdata_t, void *); 61static int pxaintc_match(device_t, cfdata_t, void *);
62static void pxaintc_attach(device_t, device_t, void *); 62static void pxaintc_attach(device_t, device_t, void *);
63 63
64CFATTACH_DECL_NEW(pxaintc, 0, 64CFATTACH_DECL_NEW(pxaintc, 0,
65 pxaintc_match, pxaintc_attach, NULL, NULL); 65 pxaintc_match, pxaintc_attach, NULL, NULL);
66 66
67static int pxaintc_attached; 67static int pxaintc_attached;
68 68
69static int stray_interrupt(void *); 69static int stray_interrupt(void *);
70static void init_interrupt_masks(void); 70static void init_interrupt_masks(void);
71 71
72/* 72/*
73 * interrupt dispatch table.  73 * interrupt dispatch table.
74 */ 74 */
75#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ 75#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
76struct intrhand { 76struct intrhand {
77 TAILQ_ENTRY(intrhand) ih_list; /* link on intrq list */ 77 TAILQ_ENTRY(intrhand) ih_list; /* link on intrq list */
78 int (*ih_func)(void *); /* handler */ 78 int (*ih_func)(void *); /* handler */
79 void *ih_arg; /* arg for handler */ 79 void *ih_arg; /* arg for handler */
80}; 80};
81#endif 81#endif
82 82
83static struct intrhandler { 83static struct intrhandler {
84#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ 84#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
85 TAILQ_HEAD(,intrhand) list; 85 TAILQ_HEAD(,intrhand) list;
86#else 86#else
@@ -163,34 +163,34 @@ pxa2x0_irq_handler(void *arg) @@ -163,34 +163,34 @@ pxa2x0_irq_handler(void *arg)
163 irqbits = read_icu(SAIPIC_IP); 163 irqbits = read_icu(SAIPIC_IP);
164 164
165 while ((irqno = find_first_bit(irqbits)) >= 0) { 165 while ((irqno = find_first_bit(irqbits)) >= 0) {
166 /* XXX: Shuould we handle IRQs in priority order? */ 166 /* XXX: Shuould we handle IRQs in priority order? */
167 167
168 /* raise spl to stop interrupts of lower priorities */ 168 /* raise spl to stop interrupts of lower priorities */
169 if (saved_spl_level < extirq_level[irqno]) 169 if (saved_spl_level < extirq_level[irqno])
170 pxa2x0_setipl(extirq_level[irqno]); 170 pxa2x0_setipl(extirq_level[irqno]);
171 171
172#ifdef notyet 172#ifdef notyet
173 /* Enable interrupt */ 173 /* Enable interrupt */
174#endif 174#endif
175#ifndef MULTIPLE_HANDLERS_ON_ONE_IRQ 175#ifndef MULTIPLE_HANDLERS_ON_ONE_IRQ
176 (* handler[irqno].func)(  176 (* handler[irqno].func)(
177 handler[irqno].cookie == 0 177 handler[irqno].cookie == 0
178 ? frame : handler[irqno].cookie ); 178 ? frame : handler[irqno].cookie );
179#else 179#else
180 /* process all handlers for this interrupt. 180 /* process all handlers for this interrupt.
181 XXX not yet */ 181 XXX not yet */
182#endif 182#endif
183  183
184#ifdef notyet 184#ifdef notyet
185 /* Disable interrupt */ 185 /* Disable interrupt */
186#endif 186#endif
187 187
188 irqbits &= ~(1<<irqno); 188 irqbits &= ~(1<<irqno);
189 } 189 }
190 190
191 /* restore spl to that was when this interrupt happen */ 191 /* restore spl to that was when this interrupt happen */
192 pxa2x0_setipl(saved_spl_level); 192 pxa2x0_setipl(saved_spl_level);
193 193
194#ifdef __HAVE_FAST_SOFTINTS 194#ifdef __HAVE_FAST_SOFTINTS
195 cpu_dosoftints(); 195 cpu_dosoftints();
196#endif 196#endif

cvs diff -r1.30 -r1.31 src/sys/arch/sparc64/doc/TODO (expand / switch to unified diff)

--- src/sys/arch/sparc64/doc/TODO 2021/01/04 15:13:06 1.30
+++ src/sys/arch/sparc64/doc/TODO 2021/01/04 15:13:50 1.31
@@ -1,27 +1,27 @@ @@ -1,27 +1,27 @@
1 /* $NetBSD: TODO,v 1.30 2021/01/04 15:13:06 skrll Exp $ */ 1/* $NetBSD: TODO,v 1.31 2021/01/04 15:13:50 skrll Exp $ */
2 2
3Things to be done: 3Things to be done:
4 4
5common: 5common:
6- make %g6 point to curcpu 6- make %g6 point to curcpu
7- make %g7 point to curlwp 7- make %g7 point to curlwp
8- change run-time checks for cpu type to function pointers 8- change run-time checks for cpu type to function pointers
9 9
10sun4u: 10sun4u:
11- GENERIC.UP kernel hangs on v445 (missing interrupt?) 11- GENERIC.UP kernel hangs on v445 (missing interrupt?)
12 12
13sun4v: 13sun4v:
14 - current status: The kernel boots and starts the init process.  14 - current status: The kernel boots and starts the init process.
15 The following processes seem to crash on and on so more debugging to be done... 15 The following processes seem to crash on and on so more debugging to be done...
16 16
17- 64-bit kernel support 17- 64-bit kernel support
18- 32-bit kernel support 18- 32-bit kernel support
19- libkvm 19- libkvm
20- ofwboot: tlb_init_sun4v() hardcodes number of slots to 64 20- ofwboot: tlb_init_sun4v() hardcodes number of slots to 64
21- locore.s: sun4v_datatrap missing implementation for trap level 1 21- locore.s: sun4v_datatrap missing implementation for trap level 1
22- check build without SUN4V defined 22- check build without SUN4V defined
23- replace relevant references to %ver with GET_MAXCWP 23- replace relevant references to %ver with GET_MAXCWP
24- pmap_mp_init(): sun4v missing handling 24- pmap_mp_init(): sun4v missing handling
25- replace constructs like "wrpr %g0, PSTATE_KERN, %pstate" with NORMAL_GLOBALS 25- replace constructs like "wrpr %g0, PSTATE_KERN, %pstate" with NORMAL_GLOBALS
26- replace constructs line "wrpr %g0, PSTATE_INTR, %pstate" with ALTERNATE_GOBALS 26- replace constructs line "wrpr %g0, PSTATE_INTR, %pstate" with ALTERNATE_GOBALS
27- sun4v tsb no need to lock... per cpu... anyway... 27- sun4v tsb no need to lock... per cpu... anyway...

cvs diff -r1.304 -r1.305 src/sys/dev/ic/wdc.c (expand / switch to unified diff)

--- src/sys/dev/ic/wdc.c 2021/01/04 15:13:06 1.304
+++ src/sys/dev/ic/wdc.c 2021/01/04 15:13:50 1.305
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wdc.c,v 1.304 2021/01/04 15:13:06 skrll Exp $ */ 1/* $NetBSD: wdc.c,v 1.305 2021/01/04 15:13:50 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved. 4 * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -48,27 +48,27 @@ @@ -48,27 +48,27 @@
48 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 48 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
49 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 49 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
50 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 50 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
51 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 51 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 52 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53 * POSSIBILITY OF SUCH DAMAGE. 53 * POSSIBILITY OF SUCH DAMAGE.
54 */ 54 */
55 55
56/* 56/*
57 * CODE UNTESTED IN THE CURRENT REVISION: 57 * CODE UNTESTED IN THE CURRENT REVISION:
58 */ 58 */
59 59
60#include <sys/cdefs.h> 60#include <sys/cdefs.h>
61__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.304 2021/01/04 15:13:06 skrll Exp $"); 61__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.305 2021/01/04 15:13:50 skrll Exp $");
62 62
63#include "opt_ata.h" 63#include "opt_ata.h"
64#include "opt_wdc.h" 64#include "opt_wdc.h"
65 65
66#include <sys/param.h> 66#include <sys/param.h>
67#include <sys/systm.h> 67#include <sys/systm.h>
68#include <sys/kernel.h> 68#include <sys/kernel.h>
69#include <sys/conf.h> 69#include <sys/conf.h>
70#include <sys/buf.h> 70#include <sys/buf.h>
71#include <sys/device.h> 71#include <sys/device.h>
72#include <sys/malloc.h> 72#include <sys/malloc.h>
73#include <sys/kmem.h> 73#include <sys/kmem.h>
74#include <sys/syslog.h> 74#include <sys/syslog.h>
@@ -708,28 +708,28 @@ wdcprobe1(struct ata_channel *chp, int p @@ -708,28 +708,28 @@ wdcprobe1(struct ata_channel *chp, int p
708 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 708 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh],
709 0, WDSD_IBM | 0x10); 709 0, WDSD_IBM | 0x10);
710 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_command], 0, 710 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_command], 0,
711 ATAPI_SOFT_RESET); 711 ATAPI_SOFT_RESET);
712 } 712 }
713 713
714 delay(5000); 714 delay(5000);
715#endif 715#endif
716 716
717 wdc->reset(chp, RESET_POLL); 717 wdc->reset(chp, RESET_POLL);
718 DELAY(2000); 718 DELAY(2000);
719 (void) bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_error], 0); 719 (void) bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_error], 0);
720 720
721 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))  721 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))
722 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr,  722 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr,
723 WDCTL_4BIT); 723 WDCTL_4BIT);
724 724
725#ifdef WDC_NO_IDS 725#ifdef WDC_NO_IDS
726 ret_value = __wdcwait_reset(chp, ret_value, RESET_POLL); 726 ret_value = __wdcwait_reset(chp, ret_value, RESET_POLL);
727#else 727#else
728 ret_value = __wdcwait_reset(chp, ret_value, poll); 728 ret_value = __wdcwait_reset(chp, ret_value, poll);
729#endif 729#endif
730 ATADEBUG_PRINT(("%s:%d: after reset, ret_value=%#x\n", 730 ATADEBUG_PRINT(("%s:%d: after reset, ret_value=%#x\n",
731 __func__, chp->ch_channel, ret_value), DEBUG_PROBE); 731 __func__, chp->ch_channel, ret_value), DEBUG_PROBE);
732 732
733 /* if reset failed, there's nothing here */ 733 /* if reset failed, there's nothing here */
734 if (ret_value == 0) { 734 if (ret_value == 0) {
735 return 0; 735 return 0;
@@ -1028,69 +1028,69 @@ wdcreset(struct ata_channel *chp, int po @@ -1028,69 +1028,69 @@ wdcreset(struct ata_channel *chp, int po
1028 struct wdc_softc *wdc = CHAN_TO_WDC(chp); 1028 struct wdc_softc *wdc = CHAN_TO_WDC(chp);
1029 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; 1029 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel];
1030 int drv_mask1, drv_mask2; 1030 int drv_mask1, drv_mask2;
1031 1031
1032 ata_channel_lock_owned(chp); 1032 ata_channel_lock_owned(chp);
1033 1033
1034#ifdef WDC_NO_IDS 1034#ifdef WDC_NO_IDS
1035 poll = RESET_POLL; 1035 poll = RESET_POLL;
1036#endif 1036#endif
1037 wdc->reset(chp, poll); 1037 wdc->reset(chp, poll);
1038 1038
1039 drv_mask1 = (chp->ch_drive[0].drive_type != ATA_DRIVET_NONE) 1039 drv_mask1 = (chp->ch_drive[0].drive_type != ATA_DRIVET_NONE)
1040 ? 0x01 : 0x00; 1040 ? 0x01 : 0x00;
1041 if (chp->ch_ndrives > 1)  1041 if (chp->ch_ndrives > 1)
1042 drv_mask1 |= (chp->ch_drive[1].drive_type != ATA_DRIVET_NONE) 1042 drv_mask1 |= (chp->ch_drive[1].drive_type != ATA_DRIVET_NONE)
1043 ? 0x02 : 0x00; 1043 ? 0x02 : 0x00;
1044 drv_mask2 = __wdcwait_reset(chp, drv_mask1, 1044 drv_mask2 = __wdcwait_reset(chp, drv_mask1,
1045 (poll == RESET_SLEEP) ? 0 : 1); 1045 (poll == RESET_SLEEP) ? 0 : 1);
1046 if (drv_mask2 != drv_mask1) { 1046 if (drv_mask2 != drv_mask1) {
1047 aprint_error("%s channel %d: reset failed for", 1047 aprint_error("%s channel %d: reset failed for",
1048 device_xname(atac->atac_dev), chp->ch_channel); 1048 device_xname(atac->atac_dev), chp->ch_channel);
1049 if ((drv_mask1 & 0x01) != 0 && (drv_mask2 & 0x01) == 0) 1049 if ((drv_mask1 & 0x01) != 0 && (drv_mask2 & 0x01) == 0)
1050 aprint_normal(" drive 0"); 1050 aprint_normal(" drive 0");
1051 if ((drv_mask1 & 0x02) != 0 && (drv_mask2 & 0x02) == 0) 1051 if ((drv_mask1 & 0x02) != 0 && (drv_mask2 & 0x02) == 0)
1052 aprint_normal(" drive 1"); 1052 aprint_normal(" drive 1");
1053 aprint_normal("\n"); 1053 aprint_normal("\n");
1054 } 1054 }
1055 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))  1055 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))
1056 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr,  1056 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr,
1057 WDCTL_4BIT); 1057 WDCTL_4BIT);
1058 1058
1059 return (drv_mask1 != drv_mask2) ? 1 : 0; 1059 return (drv_mask1 != drv_mask2) ? 1 : 0;
1060} 1060}
1061 1061
1062void 1062void
1063wdc_do_reset(struct ata_channel *chp, int poll) 1063wdc_do_reset(struct ata_channel *chp, int poll)
1064{ 1064{
1065 struct wdc_softc *wdc = CHAN_TO_WDC(chp); 1065 struct wdc_softc *wdc = CHAN_TO_WDC(chp);
1066 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; 1066 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel];
1067 int s = 0; 1067 int s = 0;
1068 1068
1069 if (poll != RESET_SLEEP) 1069 if (poll != RESET_SLEEP)
1070 s = splbio(); 1070 s = splbio();
1071 if (wdc->select) 1071 if (wdc->select)
1072 wdc->select(chp,0); 1072 wdc->select(chp,0);
1073 /* master */ 1073 /* master */
1074 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, WDSD_IBM); 1074 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, WDSD_IBM);
1075 delay(10); /* 400ns delay */ 1075 delay(10); /* 400ns delay */
1076 /* assert SRST, wait for reset to complete */ 1076 /* assert SRST, wait for reset to complete */
1077 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) { 1077 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) {
1078 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr, 1078 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr,
1079 WDCTL_RST | WDCTL_IDS | WDCTL_4BIT); 1079 WDCTL_RST | WDCTL_IDS | WDCTL_4BIT);
1080 delay(2000); 1080 delay(2000);
1081 } 1081 }
1082 (void) bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_error], 0); 1082 (void) bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_error], 0);
1083 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))  1083 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))
1084 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr, 1084 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr,
1085 WDCTL_4BIT | WDCTL_IDS); 1085 WDCTL_4BIT | WDCTL_IDS);
1086 delay(10); /* 400ns delay */ 1086 delay(10); /* 400ns delay */
1087 if (poll != RESET_SLEEP) { 1087 if (poll != RESET_SLEEP) {
1088 /* ACK interrupt in case there is one pending left */ 1088 /* ACK interrupt in case there is one pending left */
1089 if (wdc->irqack) 1089 if (wdc->irqack)
1090 wdc->irqack(chp); 1090 wdc->irqack(chp);
1091 splx(s); 1091 splx(s);
1092 } 1092 }
1093} 1093}
1094 1094
1095static int 1095static int
1096__wdcwait_reset(struct ata_channel *chp, int drv_mask, int poll) 1096__wdcwait_reset(struct ata_channel *chp, int drv_mask, int poll)
@@ -1441,28 +1441,28 @@ __wdccommand_start(struct ata_channel *c @@ -1441,28 +1441,28 @@ __wdccommand_start(struct ata_channel *c
1441 WDSD_IBM | (drive << 4)); 1441 WDSD_IBM | (drive << 4));
1442 switch(wdcwait(chp, ata_c->r_st_bmask | WDCS_DRQ, 1442 switch(wdcwait(chp, ata_c->r_st_bmask | WDCS_DRQ,
1443 ata_c->r_st_bmask, ata_c->timeout, wait_flags, &tfd)) { 1443 ata_c->r_st_bmask, ata_c->timeout, wait_flags, &tfd)) {
1444 case WDCWAIT_OK: 1444 case WDCWAIT_OK:
1445 break; 1445 break;
1446 case WDCWAIT_TOUT: 1446 case WDCWAIT_TOUT:
1447 ata_c->flags |= AT_TIMEOU; 1447 ata_c->flags |= AT_TIMEOU;
1448 return ATASTART_ABORT; 1448 return ATASTART_ABORT;
1449 case WDCWAIT_THR: 1449 case WDCWAIT_THR:
1450 return ATASTART_TH; 1450 return ATASTART_TH;
1451 } 1451 }
1452 if (ata_c->flags & AT_POLL) { 1452 if (ata_c->flags & AT_POLL) {
1453 /* polled command, disable interrupts */ 1453 /* polled command, disable interrupts */
1454 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))  1454 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))
1455 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh,  1455 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh,
1456 wd_aux_ctlr, WDCTL_4BIT | WDCTL_IDS); 1456 wd_aux_ctlr, WDCTL_4BIT | WDCTL_IDS);
1457 } 1457 }
1458 if ((ata_c->flags & AT_LBA48) != 0) { 1458 if ((ata_c->flags & AT_LBA48) != 0) {
1459 wdccommandext(chp, drive, ata_c->r_command, 1459 wdccommandext(chp, drive, ata_c->r_command,
1460 ata_c->r_lba, ata_c->r_count, ata_c->r_features, 1460 ata_c->r_lba, ata_c->r_count, ata_c->r_features,
1461 ata_c->r_device & ~0x10); 1461 ata_c->r_device & ~0x10);
1462 } else { 1462 } else {
1463 wdccommand(chp, drive, ata_c->r_command, 1463 wdccommand(chp, drive, ata_c->r_command,
1464 (ata_c->r_lba >> 8) & 0xffff, 1464 (ata_c->r_lba >> 8) & 0xffff,
1465 WDSD_IBM | (drive << 4) | 1465 WDSD_IBM | (drive << 4) |
1466 (((ata_c->flags & AT_LBA) != 0) ? WDSD_LBA : 0) | 1466 (((ata_c->flags & AT_LBA) != 0) ? WDSD_LBA : 0) |
1467 ((ata_c->r_lba >> 24) & 0x0f), 1467 ((ata_c->r_lba >> 24) & 0x0f),
1468 ata_c->r_lba & 0xff, 1468 ata_c->r_lba & 0xff,
@@ -1646,68 +1646,68 @@ __wdccommand_done(struct ata_channel *ch @@ -1646,68 +1646,68 @@ __wdccommand_done(struct ata_channel *ch
1646 wdr->cmd_iohs[wd_seccnt], 0); 1646 wdr->cmd_iohs[wd_seccnt], 0);
1647 ata_c->r_lba = (uint64_t)bus_space_read_1(wdr->cmd_iot, 1647 ata_c->r_lba = (uint64_t)bus_space_read_1(wdr->cmd_iot,
1648 wdr->cmd_iohs[wd_sector], 0) << 0; 1648 wdr->cmd_iohs[wd_sector], 0) << 0;
1649 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, 1649 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot,
1650 wdr->cmd_iohs[wd_cyl_lo], 0) << 8; 1650 wdr->cmd_iohs[wd_cyl_lo], 0) << 8;
1651 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, 1651 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot,
1652 wdr->cmd_iohs[wd_cyl_hi], 0) << 16; 1652 wdr->cmd_iohs[wd_cyl_hi], 0) << 16;
1653 ata_c->r_device = bus_space_read_1(wdr->cmd_iot, 1653 ata_c->r_device = bus_space_read_1(wdr->cmd_iot,
1654 wdr->cmd_iohs[wd_sdh], 0); 1654 wdr->cmd_iohs[wd_sdh], 0);
1655 1655
1656 if ((ata_c->flags & AT_LBA48) != 0) { 1656 if ((ata_c->flags & AT_LBA48) != 0) {
1657 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) { 1657 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) {
1658 if ((ata_c->flags & AT_POLL) != 0) 1658 if ((ata_c->flags & AT_POLL) != 0)
1659 bus_space_write_1(wdr->ctl_iot,  1659 bus_space_write_1(wdr->ctl_iot,
1660 wdr->ctl_ioh, wd_aux_ctlr, 1660 wdr->ctl_ioh, wd_aux_ctlr,
1661 WDCTL_HOB|WDCTL_4BIT|WDCTL_IDS); 1661 WDCTL_HOB|WDCTL_4BIT|WDCTL_IDS);
1662 else 1662 else
1663 bus_space_write_1(wdr->ctl_iot,  1663 bus_space_write_1(wdr->ctl_iot,
1664 wdr->ctl_ioh, wd_aux_ctlr,  1664 wdr->ctl_ioh, wd_aux_ctlr,
1665 WDCTL_HOB|WDCTL_4BIT); 1665 WDCTL_HOB|WDCTL_4BIT);
1666 } 1666 }
1667 ata_c->r_count |= bus_space_read_1(wdr->cmd_iot, 1667 ata_c->r_count |= bus_space_read_1(wdr->cmd_iot,
1668 wdr->cmd_iohs[wd_seccnt], 0) << 8; 1668 wdr->cmd_iohs[wd_seccnt], 0) << 8;
1669 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, 1669 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot,
1670 wdr->cmd_iohs[wd_sector], 0) << 24; 1670 wdr->cmd_iohs[wd_sector], 0) << 24;
1671 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, 1671 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot,
1672 wdr->cmd_iohs[wd_cyl_lo], 0) << 32; 1672 wdr->cmd_iohs[wd_cyl_lo], 0) << 32;
1673 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, 1673 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot,
1674 wdr->cmd_iohs[wd_cyl_hi], 0) << 40; 1674 wdr->cmd_iohs[wd_cyl_hi], 0) << 40;
1675 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) { 1675 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) {
1676 if ((ata_c->flags & AT_POLL) != 0) 1676 if ((ata_c->flags & AT_POLL) != 0)
1677 bus_space_write_1(wdr->ctl_iot,  1677 bus_space_write_1(wdr->ctl_iot,
1678 wdr->ctl_ioh, wd_aux_ctlr,  1678 wdr->ctl_ioh, wd_aux_ctlr,
1679 WDCTL_4BIT|WDCTL_IDS); 1679 WDCTL_4BIT|WDCTL_IDS);
1680 else 1680 else
1681 bus_space_write_1(wdr->ctl_iot,  1681 bus_space_write_1(wdr->ctl_iot,
1682 wdr->ctl_ioh, wd_aux_ctlr,  1682 wdr->ctl_ioh, wd_aux_ctlr,
1683 WDCTL_4BIT); 1683 WDCTL_4BIT);
1684 } 1684 }
1685 } else { 1685 } else {
1686 ata_c->r_lba |= 1686 ata_c->r_lba |=
1687 (uint64_t)(ata_c->r_device & 0x0f) << 24; 1687 (uint64_t)(ata_c->r_device & 0x0f) << 24;
1688 } 1688 }
1689 ata_c->r_device &= 0xf0; 1689 ata_c->r_device &= 0xf0;
1690 } 1690 }
1691 1691
1692 __wdccommand_done_end(chp, xfer); 1692 __wdccommand_done_end(chp, xfer);
1693 1693
1694 ata_deactivate_xfer(chp, xfer); 1694 ata_deactivate_xfer(chp, xfer);
1695 1695
1696out: 1696out:
1697 if (ata_c->flags & AT_POLL) { 1697 if (ata_c->flags & AT_POLL) {
1698 /* enable interrupts */ 1698 /* enable interrupts */
1699 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))  1699 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL))
1700 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh,  1700 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh,
1701 wd_aux_ctlr, WDCTL_4BIT); 1701 wd_aux_ctlr, WDCTL_4BIT);
1702 delay(10); /* some drives need a little delay here */ 1702 delay(10); /* some drives need a little delay here */
1703 } 1703 }
1704 1704
1705 if (start) 1705 if (start)
1706 atastart(chp); 1706 atastart(chp);
1707} 1707}
1708 1708
1709static void 1709static void
1710__wdccommand_done_end(struct ata_channel *chp, struct ata_xfer *xfer) 1710__wdccommand_done_end(struct ata_channel *chp, struct ata_xfer *xfer)
1711{ 1711{
1712 struct ata_command *ata_c = &xfer->c_ata_c; 1712 struct ata_command *ata_c = &xfer->c_ata_c;
1713 1713