Tue Jan 26 14:49:41 2021 UTC ()
There is not much point in of_compatible() returning -1 for "no match"
and >= 0 for "match".  Just make it return 0 for "no match" and >0 for
"match" so it can be treated like a boolean expression.

As such of_match_compatible() (a wrapper around of_compatible()) is now
obsolete, and will be removed once all call sites are converted to an
appropriate replacement.


(thorpej)
diff -r1.48 -r1.49 src/sys/arch/macppc/dev/awacs.c
diff -r1.22 -r1.23 src/sys/arch/macppc/dev/mediabay.c
diff -r1.47 -r1.48 src/sys/arch/macppc/dev/obio.c
diff -r1.34 -r1.35 src/sys/arch/macppc/dev/pmu.c
diff -r1.61 -r1.62 src/sys/arch/macppc/dev/wdc_obio.c
diff -r1.7 -r1.8 src/sys/arch/macppc/macppc/interrupts.c
diff -r1.171 -r1.172 src/sys/arch/macppc/macppc/machdep.c
diff -r1.11 -r1.12 src/sys/arch/macppc/macppc/pic_heathrow.c
diff -r1.9 -r1.10 src/sys/arch/macppc/macppc/pic_u3_ht.c
diff -r1.42 -r1.43 src/sys/arch/macppc/pci/pci_machdep.c
diff -r1.51 -r1.52 src/sys/dev/ofw/ofw_subr.c

cvs diff -r1.48 -r1.49 src/sys/arch/macppc/dev/awacs.c (expand / switch to unified diff)

--- src/sys/arch/macppc/dev/awacs.c 2019/06/08 08:02:37 1.48
+++ src/sys/arch/macppc/dev/awacs.c 2021/01/26 14:49:41 1.49
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: awacs.c,v 1.48 2019/06/08 08:02:37 isaki Exp $ */ 1/* $NetBSD: awacs.c,v 1.49 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000 Tsubai Masanari. All rights reserved. 4 * Copyright (c) 2000 Tsubai Masanari. 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 * 3. The name of the author may not be used to endorse or promote products 14 * 3. The name of the author may not be used to endorse or promote products
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.48 2019/06/08 08:02:37 isaki Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.49 2021/01/26 14:49:41 thorpej Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/audioio.h> 33#include <sys/audioio.h>
34#include <sys/device.h> 34#include <sys/device.h>
35#include <sys/systm.h> 35#include <sys/systm.h>
36#include <sys/kthread.h> 36#include <sys/kthread.h>
37#include <sys/kernel.h> 37#include <sys/kernel.h>
38#include <sys/mutex.h> 38#include <sys/mutex.h>
39#include <sys/condvar.h> 39#include <sys/condvar.h>
40 40
41#include <dev/audio/audio_if.h> 41#include <dev/audio/audio_if.h>
42 42
43#include <uvm/uvm_extern.h> 43#include <uvm/uvm_extern.h>
@@ -363,36 +363,35 @@ awacs_attach(device_t parent, device_t s @@ -363,36 +363,35 @@ awacs_attach(device_t parent, device_t s
363 cirq_type = oirq_type = iirq_type = IST_EDGE; 363 cirq_type = oirq_type = iirq_type = IST_EDGE;
364 } 364 }
365 365
366 intr_establish(cirq, cirq_type, IPL_BIO, awacs_status_intr, sc); 366 intr_establish(cirq, cirq_type, IPL_BIO, awacs_status_intr, sc);
367 intr_establish(oirq, oirq_type, IPL_AUDIO, awacs_intr, sc); 367 intr_establish(oirq, oirq_type, IPL_AUDIO, awacs_intr, sc);
368 intr_establish(iirq, iirq_type, IPL_AUDIO, awacs_intr, sc); 368 intr_establish(iirq, iirq_type, IPL_AUDIO, awacs_intr, sc);
369 369
370 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); 370 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
371 mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO); 371 mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
372 372
373 cv_init(&sc->sc_event, "awacs_wait"); 373 cv_init(&sc->sc_event, "awacs_wait");
374 374
375 /* check if the chip is a screamer */ 375 /* check if the chip is a screamer */
376 sc->sc_screamer = (of_compatible(ca->ca_node, screamer) != -1); 376 sc->sc_screamer = of_compatible(ca->ca_node, screamer);
377 if (!sc->sc_screamer) { 377 if (!sc->sc_screamer) {
378 /* look for 'sound' child node */ 378 /* look for 'sound' child node */
379 int sound_node; 379 int sound_node;
380 380
381 sound_node = OF_child(ca->ca_node); 381 sound_node = OF_child(ca->ca_node);
382 while ((sound_node != 0) && (!sc->sc_screamer)) { 382 while ((sound_node != 0) && (!sc->sc_screamer)) {
383 383
384 sc->sc_screamer =  384 sc->sc_screamer = of_compatible(sound_node, screamer);
385 (of_compatible(sound_node, screamer) != -1); 
386 sound_node = OF_peer(sound_node); 385 sound_node = OF_peer(sound_node);
387 } 386 }
388 } 387 }
389 388
390 if (sc->sc_screamer) { 389 if (sc->sc_screamer) {
391 printf(" Screamer"); 390 printf(" Screamer");
392 } 391 }
393 392
394 printf(": irq %d,%d,%d\n", cirq, oirq, iirq); 393 printf(": irq %d,%d,%d\n", cirq, oirq, iirq);
395 394
396 sc->vol_l = 0; 395 sc->vol_l = 0;
397 sc->vol_r = 0; 396 sc->vol_r = 0;
398 397
@@ -416,51 +415,50 @@ awacs_attach(device_t parent, device_t s @@ -416,51 +415,50 @@ awacs_attach(device_t parent, device_t s
416 415
417 printf("%s: ", device_xname(sc->sc_dev)); 416 printf("%s: ", device_xname(sc->sc_dev));
418 417
419 /* 418 /*
420 * all(?) awacs have GPIOs to detect if there's something plugged into 419 * all(?) awacs have GPIOs to detect if there's something plugged into
421 * the headphone jack. The other GPIOs are either used for other jacks 420 * the headphone jack. The other GPIOs are either used for other jacks
422 * ( the PB3400c's microphone jack for instance ) or unused. 421 * ( the PB3400c's microphone jack for instance ) or unused.
423 * The problem is that there are at least three different ways how 422 * The problem is that there are at least three different ways how
424 * those GPIOs are wired to the actual jacks. 423 * those GPIOs are wired to the actual jacks.
425 * For now we bother only with headphone detection 424 * For now we bother only with headphone detection
426 */ 425 */
427 perch = OF_finddevice("/perch"); 426 perch = OF_finddevice("/perch");
428 root_node = OF_finddevice("/"); 427 root_node = OF_finddevice("/");
429 if (of_compatible(root_node, detect_reversed) != -1) { 428 if (of_compatible(root_node, detect_reversed)) {
430 429
431 /* 0x02 is for the microphone jack, high active */ 430 /* 0x02 is for the microphone jack, high active */
432 /* 431 /*
433 * for some reason the gpio for the headphones jack is low 432 * for some reason the gpio for the headphones jack is low
434 * active on the PB3400 and similar machines 433 * active on the PB3400 and similar machines
435 */ 434 */
436 sc->sc_headphones_mask = 0x8; 435 sc->sc_headphones_mask = 0x8;
437 sc->sc_headphones_in = 0x0; 436 sc->sc_headphones_in = 0x0;
438 } else if ((perch != -1) || 437 } else if ((perch != -1) || of_compatible(root_node, use_gpio4)) {
439 (of_compatible(root_node, use_gpio4) != -1)) { 
440 /* 438 /*
441 * this is for the beige G3's 'personality card' which uses 439 * this is for the beige G3's 'personality card' which uses
442 * yet another wiring of the headphone detect GPIOs 440 * yet another wiring of the headphone detect GPIOs
443 * some G4s use it as well 441 * some G4s use it as well
444 */ 442 */
445 sc->sc_headphones_mask = 0x04; 443 sc->sc_headphones_mask = 0x04;
446 sc->sc_headphones_in = 0x04; 444 sc->sc_headphones_in = 0x04;
447 } else { 445 } else {
448 /* while on most machines it's high active as well */ 446 /* while on most machines it's high active as well */
449 sc->sc_headphones_mask = 0x8; 447 sc->sc_headphones_mask = 0x8;
450 sc->sc_headphones_in = 0x8; 448 sc->sc_headphones_in = 0x8;
451 } 449 }
452 450
453 if (of_compatible(root_node, no_parallel_output) != -1) 451 if (of_compatible(root_node, no_parallel_output))
454 sc->sc_need_parallel_output = 0; 452 sc->sc_need_parallel_output = 0;
455 else { 453 else {
456 sc->sc_need_parallel_output = 1; 454 sc->sc_need_parallel_output = 1;
457 sc->sc_codecctl1 |= AWACS_PARALLEL_OUTPUT; 455 sc->sc_codecctl1 |= AWACS_PARALLEL_OUTPUT;
458 } 456 }
459  457
460 if (awacs_check_headphones(sc)) { 458 if (awacs_check_headphones(sc)) {
461 459
462 /* default output to headphones */ 460 /* default output to headphones */
463 printf("headphones\n"); 461 printf("headphones\n");
464 sc->sc_output_mask = OUTPUT_HEADPHONES; 462 sc->sc_output_mask = OUTPUT_HEADPHONES;
465 } else { 463 } else {
466 464

cvs diff -r1.22 -r1.23 src/sys/arch/macppc/dev/mediabay.c (expand / switch to unified diff)

--- src/sys/arch/macppc/dev/mediabay.c 2011/07/26 08:36:02 1.22
+++ src/sys/arch/macppc/dev/mediabay.c 2021/01/26 14:49:41 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mediabay.c,v 1.22 2011/07/26 08:36:02 macallan Exp $ */ 1/* $NetBSD: mediabay.c,v 1.23 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (C) 1999 Tsubai Masanari. All rights reserved. 4 * Copyright (C) 1999 Tsubai Masanari. 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 * 3. The name of the author may not be used to endorse or promote products 14 * 3. The name of the author may not be used to endorse or promote products
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: mediabay.c,v 1.22 2011/07/26 08:36:02 macallan Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: mediabay.c,v 1.23 2021/01/26 14:49:41 thorpej Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/device.h> 33#include <sys/device.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/kthread.h> 35#include <sys/kthread.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37 37
38#include <dev/ofw/openfirm.h> 38#include <dev/ofw/openfirm.h>
39 39
40#include <machine/autoconf.h> 40#include <machine/autoconf.h>
41#include <machine/pio.h> 41#include <machine/pio.h>
42 42
43enum mediabay_controller { 43enum mediabay_controller {
@@ -122,27 +122,27 @@ mediabay_attach(device_t parent, device_ @@ -122,27 +122,27 @@ mediabay_attach(device_t parent, device_
122 struct confargs *ca = aux; 122 struct confargs *ca = aux;
123 int irq, itype; 123 int irq, itype;
124 124
125 sc->sc_dev = self; 125 sc->sc_dev = self;
126 ca->ca_reg[0] += ca->ca_baseaddr; 126 ca->ca_reg[0] += ca->ca_baseaddr;
127 127
128 sc->sc_addr = mapiodev(ca->ca_reg[0], PAGE_SIZE, false); 128 sc->sc_addr = mapiodev(ca->ca_reg[0], PAGE_SIZE, false);
129 sc->sc_node = ca->ca_node; 129 sc->sc_node = ca->ca_node;
130 sc->sc_baseaddr = ca->ca_baseaddr; 130 sc->sc_baseaddr = ca->ca_baseaddr;
131 sc->sc_tag = ca->ca_tag; 131 sc->sc_tag = ca->ca_tag;
132 irq = ca->ca_intr[0]; 132 irq = ca->ca_intr[0];
133 itype = IST_EDGE; 133 itype = IST_EDGE;
134 134
135 if (of_compatible(ca->ca_node, mediabay_keylargo) != -1) { 135 if (of_compatible(ca->ca_node, mediabay_keylargo)) {
136 sc->sc_type = MB_CONTROLLER_KEYLARGO; 136 sc->sc_type = MB_CONTROLLER_KEYLARGO;
137 sc->sc_fcr = sc->sc_addr + 2; 137 sc->sc_fcr = sc->sc_addr + 2;
138 } else { 138 } else {
139 sc->sc_type = MB_CONTROLLER_OTHER; 139 sc->sc_type = MB_CONTROLLER_OTHER;
140 sc->sc_fcr = sc->sc_addr + 1; 140 sc->sc_fcr = sc->sc_addr + 1;
141 } 141 }
142 142
143 if (ca->ca_nintr == 8 && ca->ca_intr[1] != 0) 143 if (ca->ca_nintr == 8 && ca->ca_intr[1] != 0)
144 itype = IST_LEVEL; 144 itype = IST_LEVEL;
145 145
146 printf(" irq %d %s\n", irq, intr_typename(itype)); 146 printf(" irq %d %s\n", irq, intr_typename(itype));
147 147
148 intr_establish(irq, itype, IPL_BIO, mediabay_intr, sc); 148 intr_establish(irq, itype, IPL_BIO, mediabay_intr, sc);

cvs diff -r1.47 -r1.48 src/sys/arch/macppc/dev/obio.c (expand / switch to unified diff)

--- src/sys/arch/macppc/dev/obio.c 2020/10/25 16:39:00 1.47
+++ src/sys/arch/macppc/dev/obio.c 2021/01/26 14:49:41 1.48
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: obio.c,v 1.47 2020/10/25 16:39:00 nia Exp $ */ 1/* $NetBSD: obio.c,v 1.48 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (C) 1998 Internet Research Institute, Inc. 4 * Copyright (C) 1998 Internet Research Institute, Inc.
5 * All rights reserved. 5 * All rights reserved.
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.
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.47 2020/10/25 16:39:00 nia Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.48 2021/01/26 14:49:41 thorpej Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/device.h> 40#include <sys/device.h>
41#include <sys/sysctl.h> 41#include <sys/sysctl.h>
42 42
43#include <dev/pci/pcivar.h> 43#include <dev/pci/pcivar.h>
44#include <dev/pci/pcidevs.h> 44#include <dev/pci/pcidevs.h>
45 45
46#include <dev/ofw/openfirm.h> 46#include <dev/ofw/openfirm.h>
47 47
48#include <machine/autoconf.h> 48#include <machine/autoconf.h>
@@ -358,27 +358,27 @@ obio_setup_cpufreq(device_t dev) @@ -358,27 +358,27 @@ obio_setup_cpufreq(device_t dev)
358 if (ret != 0) 358 if (ret != 0)
359 aprint_error_dev(sc->sc_dev, "cpufreq_register() failed, error %d\n", ret); 359 aprint_error_dev(sc->sc_dev, "cpufreq_register() failed, error %d\n", ret);
360} 360}
361 361
362static void 362static void
363obio_setup_gpios(struct obio_softc *sc, int node) 363obio_setup_gpios(struct obio_softc *sc, int node)
364{ 364{
365 uint32_t gpio_base, reg[6]; 365 uint32_t gpio_base, reg[6];
366 const struct sysctlnode *sysctl_node, *me, *freq; 366 const struct sysctlnode *sysctl_node, *me, *freq;
367 struct cpufreq *cf = &sc->sc_cf; 367 struct cpufreq *cf = &sc->sc_cf;
368 char name[32]; 368 char name[32];
369 int child, use_dfs, cpunode, hiclock; 369 int child, use_dfs, cpunode, hiclock;
370 370
371 if (of_compatible(sc->sc_node, keylargo) == -1) 371 if (! of_compatible(sc->sc_node, keylargo))
372 return; 372 return;
373 373
374 if (OF_getprop(node, "reg", reg, sizeof(reg)) < 4) 374 if (OF_getprop(node, "reg", reg, sizeof(reg)) < 4)
375 return; 375 return;
376 376
377 gpio_base = reg[0]; 377 gpio_base = reg[0];
378 DPRINTF("gpio_base: %02x\n", gpio_base); 378 DPRINTF("gpio_base: %02x\n", gpio_base);
379 379
380 /* now look for voltage and bus speed gpios */ 380 /* now look for voltage and bus speed gpios */
381 use_dfs = 0; 381 use_dfs = 0;
382 for (child = OF_child(node); child; child = OF_peer(child)) { 382 for (child = OF_child(node); child; child = OF_peer(child)) {
383 383
384 if (OF_getprop(child, "name", name, sizeof(name)) < 1) 384 if (OF_getprop(child, "name", name, sizeof(name)) < 1)

cvs diff -r1.34 -r1.35 src/sys/arch/macppc/dev/pmu.c (expand / switch to unified diff)

--- src/sys/arch/macppc/dev/pmu.c 2020/07/14 08:58:03 1.34
+++ src/sys/arch/macppc/dev/pmu.c 2021/01/26 14:49:41 1.35
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmu.c,v 1.34 2020/07/14 08:58:03 martin Exp $ */ 1/* $NetBSD: pmu.c,v 1.35 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Michael Lorenz 4 * Copyright (c) 2006 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
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.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.34 2020/07/14 08:58:03 martin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.35 2021/01/26 14:49:41 thorpej Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/proc.h> 36#include <sys/proc.h>
37#include <sys/kthread.h> 37#include <sys/kthread.h>
38#include <sys/atomic.h> 38#include <sys/atomic.h>
39#include <sys/mutex.h> 39#include <sys/mutex.h>
40 40
41#include <sys/bus.h> 41#include <sys/bus.h>
42#include <machine/pio.h> 42#include <machine/pio.h>
43#include <machine/autoconf.h> 43#include <machine/autoconf.h>
@@ -418,30 +418,30 @@ next: @@ -418,30 +418,30 @@ next:
418 if (OF_finddevice("/bandit/ohare") != -1) { 418 if (OF_finddevice("/bandit/ohare") != -1) {
419 aprint_normal_dev(self, "enabling ohare backlight control\n"); 419 aprint_normal_dev(self, "enabling ohare backlight control\n");
420 sc->sc_flags |= PMU_HAS_BACKLIGHT_CONTROL; 420 sc->sc_flags |= PMU_HAS_BACKLIGHT_CONTROL;
421 cmd[0] = 0; 421 cmd[0] = 0;
422 cmd[1] = 0; 422 cmd[1] = 0;
423 memset(resp, 0, 6); 423 memset(resp, 0, 6);
424 if (pmu_send(sc, PMU_READ_BRIGHTNESS, 1, cmd, 16, resp) > 1) { 424 if (pmu_send(sc, PMU_READ_BRIGHTNESS, 1, cmd, 16, resp) > 1) {
425 sc->sc_brightness_wanted = resp[1]; 425 sc->sc_brightness_wanted = resp[1];
426 pmu_update_brightness(sc); 426 pmu_update_brightness(sc);
427 } 427 }
428 } 428 }
429 429
430 /* attach batteries */ 430 /* attach batteries */
431 if (of_compatible(root_node, has_legacy_battery) != -1) { 431 if (of_compatible(root_node, has_legacy_battery)) {
432 432
433 pmu_attach_legacy_battery(sc); 433 pmu_attach_legacy_battery(sc);
434 } else if (of_compatible(root_node, has_two_smart_batteries) != -1) { 434 } else if (of_compatible(root_node, has_two_smart_batteries)) {
435 435
436 pmu_attach_smart_battery(sc, 0); 436 pmu_attach_smart_battery(sc, 0);
437 pmu_attach_smart_battery(sc, 1); 437 pmu_attach_smart_battery(sc, 1);
438 } else { 438 } else {
439 439
440 /* check how many batteries we have */ 440 /* check how many batteries we have */
441 pmnode = of_getnode_byname(ca->ca_node, "power-mgt"); 441 pmnode = of_getnode_byname(ca->ca_node, "power-mgt");
442 if (pmnode == -1) 442 if (pmnode == -1)
443 goto bat_done; 443 goto bat_done;
444 if (OF_getprop(pmnode, "prim-info", regs, sizeof(regs)) < 24) 444 if (OF_getprop(pmnode, "prim-info", regs, sizeof(regs)) < 24)
445 goto bat_done; 445 goto bat_done;
446 nbat = regs[6] >> 16; 446 nbat = regs[6] >> 16;
447 for (i = 0; i < nbat; i++) 447 for (i = 0; i < nbat; i++)

cvs diff -r1.61 -r1.62 src/sys/arch/macppc/dev/wdc_obio.c (expand / switch to unified diff)

--- src/sys/arch/macppc/dev/wdc_obio.c 2017/10/20 07:06:07 1.61
+++ src/sys/arch/macppc/dev/wdc_obio.c 2021/01/26 14:49:41 1.62
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wdc_obio.c,v 1.61 2017/10/20 07:06:07 jdolecek Exp $ */ 1/* $NetBSD: wdc_obio.c,v 1.62 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum and by Onno van der Linden. 8 * by Charles M. Hannum and by Onno van der Linden.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 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 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 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 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.61 2017/10/20 07:06:07 jdolecek Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.62 2021/01/26 14:49:41 thorpej Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/device.h> 37#include <sys/device.h>
38#include <sys/kmem.h> 38#include <sys/kmem.h>
39 39
40#include <uvm/uvm_extern.h> 40#include <uvm/uvm_extern.h>
41 41
42#include <sys/bus.h> 42#include <sys/bus.h>
43#include <machine/autoconf.h> 43#include <machine/autoconf.h>
44#include <machine/pio.h> 44#include <machine/pio.h>
45 45
46#include <dev/ata/atareg.h> 46#include <dev/ata/atareg.h>
@@ -97,27 +97,27 @@ static const char * const ata_names[] =  @@ -97,27 +97,27 @@ static const char * const ata_names[] =
97 97
98int 98int
99wdc_obio_match(device_t parent, cfdata_t match, void *aux) 99wdc_obio_match(device_t parent, cfdata_t match, void *aux)
100{ 100{
101 struct confargs *ca = aux; 101 struct confargs *ca = aux;
102 102
103 /* XXX should not use name */ 103 /* XXX should not use name */
104 if (strcmp(ca->ca_name, "ATA") == 0 || 104 if (strcmp(ca->ca_name, "ATA") == 0 ||
105 strcmp(ca->ca_name, "ata") == 0 || 105 strcmp(ca->ca_name, "ata") == 0 ||
106 strcmp(ca->ca_name, "ata0") == 0 || 106 strcmp(ca->ca_name, "ata0") == 0 ||
107 strcmp(ca->ca_name, "ide") == 0) 107 strcmp(ca->ca_name, "ide") == 0)
108 return 1; 108 return 1;
109 109
110 if (of_compatible(ca->ca_node, ata_names) >= 0) 110 if (of_compatible(ca->ca_node, ata_names))
111 return 1; 111 return 1;
112 112
113 return 0; 113 return 0;
114} 114}
115 115
116void 116void
117wdc_obio_attach(device_t parent, device_t self, void *aux) 117wdc_obio_attach(device_t parent, device_t self, void *aux)
118{ 118{
119 struct wdc_obio_softc *sc = device_private(self); 119 struct wdc_obio_softc *sc = device_private(self);
120 struct wdc_regs *wdr; 120 struct wdc_regs *wdr;
121 struct confargs *ca = aux; 121 struct confargs *ca = aux;
122 struct ata_channel *chp = &sc->sc_channel; 122 struct ata_channel *chp = &sc->sc_channel;
123 int intr, i, type = IST_EDGE; 123 int intr, i, type = IST_EDGE;

cvs diff -r1.7 -r1.8 src/sys/arch/macppc/macppc/interrupts.c (expand / switch to unified diff)

--- src/sys/arch/macppc/macppc/interrupts.c 2018/05/11 22:48:38 1.7
+++ src/sys/arch/macppc/macppc/interrupts.c 2021/01/26 14:49:41 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: interrupts.c,v 1.7 2018/05/11 22:48:38 macallan Exp $ */ 1/* $NetBSD: interrupts.c,v 1.8 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Michael Lorenz 4 * Copyright (c) 2007 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
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.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: interrupts.c,v 1.7 2018/05/11 22:48:38 macallan Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: interrupts.c,v 1.8 2021/01/26 14:49:41 thorpej Exp $");
31 31
32#include "opt_multiprocessor.h" 32#include "opt_multiprocessor.h"
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/malloc.h> 35#include <sys/malloc.h>
36#include <sys/kernel.h> 36#include <sys/kernel.h>
37 37
38#include <prop/proplib.h> 38#include <prop/proplib.h>
39 39
40#include <machine/intr.h> 40#include <machine/intr.h>
41#include <machine/autoconf.h> 41#include <machine/autoconf.h>
42#include <powerpc/pic/picvar.h> 42#include <powerpc/pic/picvar.h>
43#include <powerpc/pic/ipivar.h> 43#include <powerpc/pic/ipivar.h>
@@ -71,27 +71,27 @@ init_openpic(int pass_through) @@ -71,27 +71,27 @@ init_openpic(int pass_through)
71 int pic, macio; 71 int pic, macio;
72 72
73 macio = OF_finddevice("/pci/mac-io"); 73 macio = OF_finddevice("/pci/mac-io");
74 if (macio == -1) 74 if (macio == -1)
75 macio = OF_finddevice("mac-io"); 75 macio = OF_finddevice("mac-io");
76 if (macio == -1) 76 if (macio == -1)
77 macio = OF_finddevice("/ht/pci/mac-io"); 77 macio = OF_finddevice("/ht/pci/mac-io");
78 if (macio == -1) 78 if (macio == -1)
79 return FALSE; 79 return FALSE;
80 80
81 aprint_debug("macio: %08x\n", macio); 81 aprint_debug("macio: %08x\n", macio);
82 82
83 pic = OF_child(macio); 83 pic = OF_child(macio);
84 while ((pic != 0) && (of_compatible(pic, compat) == -1)) 84 while ((pic != 0) && !of_compatible(pic, compat))
85 pic = OF_peer(pic); 85 pic = OF_peer(pic);
86 86
87 aprint_debug("pic: %08x\n", pic); 87 aprint_debug("pic: %08x\n", pic);
88 if ((pic == -1) || (pic == 0)) 88 if ((pic == -1) || (pic == 0))
89 return FALSE; 89 return FALSE;
90 90
91 if (OF_getprop(macio, "assigned-addresses", reg, sizeof(reg)) != 20)  91 if (OF_getprop(macio, "assigned-addresses", reg, sizeof(reg)) != 20)
92 return FALSE; 92 return FALSE;
93 93
94 obio_base = reg[2]; 94 obio_base = reg[2];
95 aprint_debug("obio-base: %08x\n", obio_base); 95 aprint_debug("obio-base: %08x\n", obio_base);
96 96
97 if (OF_getprop(pic, "reg", reg, 8) < 8)  97 if (OF_getprop(pic, "reg", reg, 8) < 8)

cvs diff -r1.171 -r1.172 src/sys/arch/macppc/macppc/machdep.c (expand / switch to unified diff)

--- src/sys/arch/macppc/macppc/machdep.c 2020/07/14 08:55:07 1.171
+++ src/sys/arch/macppc/macppc/machdep.c 2021/01/26 14:49:41 1.172
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machdep.c,v 1.171 2020/07/14 08:55:07 martin Exp $ */ 1/* $NetBSD: machdep.c,v 1.172 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH. 5 * Copyright (C) 1995, 1996 TooLs GmbH.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.171 2020/07/14 08:55:07 martin Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.172 2021/01/26 14:49:41 thorpej Exp $");
36 36
37#include "opt_compat_netbsd.h" 37#include "opt_compat_netbsd.h"
38#include "opt_ddb.h" 38#include "opt_ddb.h"
39#include "opt_kgdb.h" 39#include "opt_kgdb.h"
40#include "opt_altivec.h" 40#include "opt_altivec.h"
41#include "opt_multiprocessor.h" 41#include "opt_multiprocessor.h"
42#include "adb.h" 42#include "adb.h"
43#include "zsc.h" 43#include "zsc.h"
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/buf.h> 46#include <sys/buf.h>
47#include <sys/boot_flag.h> 47#include <sys/boot_flag.h>
48#include <sys/bus.h> 48#include <sys/bus.h>
@@ -401,47 +401,47 @@ add_model_specifics(prop_dictionary_t di @@ -401,47 +401,47 @@ add_model_specifics(prop_dictionary_t di
401 "PowerBook4,3", "PowerBook6,3", "PowerBook6,5", NULL}; 401 "PowerBook4,3", "PowerBook6,3", "PowerBook6,5", NULL};
402 const char *clamshell[] = { 402 const char *clamshell[] = {
403 "PowerBook2,1", "PowerBook2,2", NULL}; 403 "PowerBook2,1", "PowerBook2,2", NULL};
404 const char *pismo[] = { 404 const char *pismo[] = {
405 "PowerBook3,1", NULL}; 405 "PowerBook3,1", NULL};
406 const char *mini1[] = { 406 const char *mini1[] = {
407 "PowerMac10,1", NULL}; 407 "PowerMac10,1", NULL};
408 const char *mini2[] = { 408 const char *mini2[] = {
409 "PowerMac10,2", NULL}; 409 "PowerMac10,2", NULL};
410 int node; 410 int node;
411 411
412 node = OF_finddevice("/"); 412 node = OF_finddevice("/");
413 413
414 if (of_compatible(node, bl_rev_models) != -1) { 414 if (of_compatible(node, bl_rev_models)) {
415 prop_dictionary_set_bool(dict, "backlight_level_reverted", 1); 415 prop_dictionary_set_bool(dict, "backlight_level_reverted", 1);
416 } 416 }
417 if (of_compatible(node, clamshell) != -1) { 417 if (of_compatible(node, clamshell)) {
418 prop_data_t edid; 418 prop_data_t edid;
419 419
420 edid = prop_data_create_nocopy(edid_clamshell, sizeof(edid_clamshell)); 420 edid = prop_data_create_nocopy(edid_clamshell, sizeof(edid_clamshell));
421 prop_dictionary_set(dict, "EDID", edid); 421 prop_dictionary_set(dict, "EDID", edid);
422 prop_object_release(edid); 422 prop_object_release(edid);
423 } 423 }
424 if (of_compatible(node, pismo) != -1) { 424 if (of_compatible(node, pismo)) {
425 prop_data_t edid; 425 prop_data_t edid;
426 426
427 edid = prop_data_create_nocopy(edid_pismo, sizeof(edid_pismo)); 427 edid = prop_data_create_nocopy(edid_pismo, sizeof(edid_pismo));
428 prop_dictionary_set(dict, "EDID", edid); 428 prop_dictionary_set(dict, "EDID", edid);
429 prop_object_release(edid); 429 prop_object_release(edid);
430 } 430 }
431 if (of_compatible(node, mini1) != -1) { 431 if (of_compatible(node, mini1)) {
432 prop_dictionary_set_bool(dict, "dvi-internal", 1); 432 prop_dictionary_set_bool(dict, "dvi-internal", 1);
433 } 433 }
434 if (of_compatible(node, mini2) != -1) { 434 if (of_compatible(node, mini2)) {
435 prop_dictionary_set_bool(dict, "dvi-external", 1); 435 prop_dictionary_set_bool(dict, "dvi-external", 1);
436 } 436 }
437} 437}
438 438
439static void 439static void
440of_set_palette(void *cookie, int index, int r, int g, int b) 440of_set_palette(void *cookie, int index, int r, int g, int b)
441{ 441{
442 int ih = (int)cookie; 442 int ih = (int)cookie;
443 443
444 OF_call_method_1("color!", ih, 4, r, g, b, index); 444 OF_call_method_1("color!", ih, 4, r, g, b, index);
445} 445}
446 446
447static int 447static int

cvs diff -r1.11 -r1.12 src/sys/arch/macppc/macppc/pic_heathrow.c (expand / switch to unified diff)

--- src/sys/arch/macppc/macppc/pic_heathrow.c 2017/06/16 18:48:22 1.11
+++ src/sys/arch/macppc/macppc/pic_heathrow.c 2021/01/26 14:49:41 1.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pic_heathrow.c,v 1.11 2017/06/16 18:48:22 macallan Exp $ */ 1/* $NetBSD: pic_heathrow.c,v 1.12 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Michael Lorenz 4 * Copyright (c) 2007 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
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.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: pic_heathrow.c,v 1.11 2017/06/16 18:48:22 macallan Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: pic_heathrow.c,v 1.12 2021/01/26 14:49:41 thorpej Exp $");
31 31
32#include "opt_interrupt.h" 32#include "opt_interrupt.h"
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/kmem.h> 35#include <sys/kmem.h>
36#include <sys/kernel.h> 36#include <sys/kernel.h>
37 37
38#include <machine/pio.h> 38#include <machine/pio.h>
39 39
40#include <dev/ofw/openfirm.h> 40#include <dev/ofw/openfirm.h>
41 41
42#include <machine/autoconf.h> 42#include <machine/autoconf.h>
43#include <arch/powerpc/pic/picvar.h> 43#include <arch/powerpc/pic/picvar.h>
@@ -78,27 +78,27 @@ static const char *compat[] = { @@ -78,27 +78,27 @@ static const char *compat[] = {
78 78
79int init_heathrow(void) 79int init_heathrow(void)
80{ 80{
81 uint32_t reg[5]; 81 uint32_t reg[5];
82 uint32_t obio_base; 82 uint32_t obio_base;
83 int heathrow; 83 int heathrow;
84 84
85 heathrow = OF_finddevice("/pci/mac-io"); 85 heathrow = OF_finddevice("/pci/mac-io");
86 if (heathrow == -1) 86 if (heathrow == -1)
87 heathrow = OF_finddevice("mac-io"); 87 heathrow = OF_finddevice("mac-io");
88 if (heathrow == -1) 88 if (heathrow == -1)
89 return FALSE; 89 return FALSE;
90 90
91 if (of_compatible(heathrow, compat) == -1) 91 if (! of_compatible(heathrow, compat))
92 return FALSE; 92 return FALSE;
93 93
94 if (OF_getprop(heathrow, "assigned-addresses", reg, sizeof(reg)) != 20)  94 if (OF_getprop(heathrow, "assigned-addresses", reg, sizeof(reg)) != 20)
95 return FALSE; 95 return FALSE;
96 96
97 obio_base = reg[2]; 97 obio_base = reg[2];
98 aprint_normal("found heathrow PIC at %08x\n", obio_base); 98 aprint_normal("found heathrow PIC at %08x\n", obio_base);
99 setup_heathrow(obio_base); 99 setup_heathrow(obio_base);
100 /* TODO: look for 2nd Heathrow */ 100 /* TODO: look for 2nd Heathrow */
101 return TRUE; 101 return TRUE;
102} 102}
103 103
104static struct heathrow_ops * 104static struct heathrow_ops *

cvs diff -r1.9 -r1.10 src/sys/arch/macppc/macppc/pic_u3_ht.c (expand / switch to unified diff)

--- src/sys/arch/macppc/macppc/pic_u3_ht.c 2020/07/15 09:58:34 1.9
+++ src/sys/arch/macppc/macppc/pic_u3_ht.c 2021/01/26 14:49:41 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pic_u3_ht.c,v 1.9 2020/07/15 09:58:34 rin Exp $ */ 1/* $NetBSD: pic_u3_ht.c,v 1.10 2021/01/26 14:49:41 thorpej Exp $ */
2/*- 2/*-
3 * Copyright (c) 2013 Phileas Fogg 3 * Copyright (c) 2013 Phileas Fogg
4 * All rights reserved. 4 * 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 *
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: pic_u3_ht.c,v 1.9 2020/07/15 09:58:34 rin Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: pic_u3_ht.c,v 1.10 2021/01/26 14:49:41 thorpej Exp $");
30 30
31#include "opt_openpic.h" 31#include "opt_openpic.h"
32#include "opt_interrupt.h" 32#include "opt_interrupt.h"
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/kmem.h> 35#include <sys/kmem.h>
36#include <sys/kernel.h> 36#include <sys/kernel.h>
37#include <sys/atomic.h> 37#include <sys/atomic.h>
38#include <sys/cpu.h> 38#include <sys/cpu.h>
39 39
40#include <machine/pio.h> 40#include <machine/pio.h>
41#include <powerpc/openpic.h> 41#include <powerpc/openpic.h>
42 42
@@ -130,31 +130,31 @@ static void u3_ht_establish_ipi(int, int @@ -130,31 +130,31 @@ static void u3_ht_establish_ipi(int, int
130 130
131int init_u3_ht(void) 131int init_u3_ht(void)
132{ 132{
133 int u4, pic; 133 int u4, pic;
134 uint32_t reg[2]; 134 uint32_t reg[2];
135 uint32_t base, len, tmp; 135 uint32_t base, len, tmp;
136 int bigendian; 136 int bigendian;
137 volatile uint8_t *unin_reg; 137 volatile uint8_t *unin_reg;
138 138
139 u4 = OF_finddevice("/u4"); 139 u4 = OF_finddevice("/u4");
140 if (u4 == -1) 140 if (u4 == -1)
141 return FALSE; 141 return FALSE;
142 142
143 if (of_compatible(u4, u3_compat) == -1) 143 if (! of_compatible(u4, u3_compat))
144 return FALSE; 144 return FALSE;
145 145
146 pic = OF_child(u4); 146 pic = OF_child(u4);
147 while ((pic != 0) && (of_compatible(pic, pic_compat) == -1)) 147 while ((pic != 0) && !of_compatible(pic, pic_compat))
148 pic = OF_peer(pic); 148 pic = OF_peer(pic);
149 149
150 if ((pic == -1) || (pic == 0)) 150 if ((pic == -1) || (pic == 0))
151 return FALSE; 151 return FALSE;
152 152
153 if (OF_getprop(u4, "reg", reg, sizeof(reg)) != 8)  153 if (OF_getprop(u4, "reg", reg, sizeof(reg)) != 8)
154 return FALSE; 154 return FALSE;
155 155
156 base = reg[1]; 156 base = reg[1];
157 157
158 /* Enable and reset PIC */ 158 /* Enable and reset PIC */
159 159
160 unin_reg = mapiodev(base, PAGE_SIZE, false); 160 unin_reg = mapiodev(base, PAGE_SIZE, false);

cvs diff -r1.42 -r1.43 src/sys/arch/macppc/pci/pci_machdep.c (expand / switch to unified diff)

--- src/sys/arch/macppc/pci/pci_machdep.c 2019/03/01 09:25:59 1.42
+++ src/sys/arch/macppc/pci/pci_machdep.c 2021/01/26 14:49:41 1.43
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pci_machdep.c,v 1.42 2019/03/01 09:25:59 msaitoh Exp $ */ 1/* $NetBSD: pci_machdep.c,v 1.43 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 4 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
5 * Copyright (c) 1994 Charles M. Hannum. All rights reserved. 5 * Copyright (c) 1994 Charles M. Hannum. All rights reserved.
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.
@@ -33,27 +33,27 @@ @@ -33,27 +33,27 @@
33/* 33/*
34 * Machine-specific functions for PCI autoconfiguration. 34 * Machine-specific functions for PCI autoconfiguration.
35 * 35 *
36 * On PCs, there are two methods of generating PCI configuration cycles. 36 * On PCs, there are two methods of generating PCI configuration cycles.
37 * We try to detect the appropriate mechanism for this machine and set 37 * We try to detect the appropriate mechanism for this machine and set
38 * up a few function pointers to access the correct method directly. 38 * up a few function pointers to access the correct method directly.
39 * 39 *
40 * The configuration method can be hard-coded in the config file by 40 * The configuration method can be hard-coded in the config file by
41 * using `options PCI_CONF_MODE=N', where `N' is the configuration mode 41 * using `options PCI_CONF_MODE=N', where `N' is the configuration mode
42 * as defined section 3.6.4.1, `Generating Configuration Cycles'. 42 * as defined section 3.6.4.1, `Generating Configuration Cycles'.
43 */ 43 */
44 44
45#include <sys/cdefs.h> 45#include <sys/cdefs.h>
46__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.42 2019/03/01 09:25:59 msaitoh Exp $"); 46__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.43 2021/01/26 14:49:41 thorpej Exp $");
47 47
48#include <sys/types.h> 48#include <sys/types.h>
49#include <sys/param.h> 49#include <sys/param.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <sys/systm.h> 51#include <sys/systm.h>
52#include <sys/errno.h> 52#include <sys/errno.h>
53#include <sys/device.h> 53#include <sys/device.h>
54 54
55#define _POWERPC_BUS_DMA_PRIVATE 55#define _POWERPC_BUS_DMA_PRIVATE
56#include <sys/bus.h> 56#include <sys/bus.h>
57 57
58#include <machine/autoconf.h> 58#include <machine/autoconf.h>
59#include <machine/intr.h> 59#include <machine/intr.h>
@@ -329,27 +329,27 @@ fixpci(int parent, pci_chipset_tag_t pc) @@ -329,27 +329,27 @@ fixpci(int parent, pci_chipset_tag_t pc)
329 329
330static void 330static void
331fix_cardbus_bridge(int node, pci_chipset_tag_t pc, pcitag_t tag) 331fix_cardbus_bridge(int node, pci_chipset_tag_t pc, pcitag_t tag)
332{ 332{
333 uint32_t bus_number = 0xffffffff; 333 uint32_t bus_number = 0xffffffff;
334 pcireg_t bi; 334 pcireg_t bi;
335 int bus, dev, fn, ih, len; 335 int bus, dev, fn, ih, len;
336 char path[256]; 336 char path[256];
337 337
338#if PB3400_CARDBUS_HACK 338#if PB3400_CARDBUS_HACK
339 int root_node; 339 int root_node;
340 340
341 root_node = OF_finddevice("/"); 341 root_node = OF_finddevice("/");
342 if (of_compatible(root_node, pb3400_compat) != -1) { 342 if (of_compatible(root_node, pb3400_compat)) {
343 343
344 bus_number = cardbus_number; 344 bus_number = cardbus_number;
345 cardbus_number++; 345 cardbus_number++;
346 } else { 346 } else {
347#endif  347#endif
348 ih = OF_open(path); 348 ih = OF_open(path);
349 OF_call_method("load-ata", ih, 0, 0); 349 OF_call_method("load-ata", ih, 0, 0);
350 OF_close(ih); 350 OF_close(ih);
351 351
352 OF_getprop(node, "AAPL,bus-id", &bus_number, 352 OF_getprop(node, "AAPL,bus-id", &bus_number,
353 sizeof(bus_number)); 353 sizeof(bus_number));
354#if PB3400_CARDBUS_HACK 354#if PB3400_CARDBUS_HACK
355 } 355 }

cvs diff -r1.51 -r1.52 src/sys/dev/ofw/ofw_subr.c (expand / switch to unified diff)

--- src/sys/dev/ofw/ofw_subr.c 2021/01/26 14:09:11 1.51
+++ src/sys/dev/ofw/ofw_subr.c 2021/01/26 14:49:41 1.52
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ofw_subr.c,v 1.51 2021/01/26 14:09:11 thorpej Exp $ */ 1/* $NetBSD: ofw_subr.c,v 1.52 2021/01/26 14:49:41 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright 1998 4 * Copyright 1998
5 * Digital Equipment Corporation. All rights reserved. 5 * Digital Equipment Corporation. All rights reserved.
6 * 6 *
7 * This software is furnished under license and may be used and 7 * This software is furnished under license and may be used and
8 * copied only in accordance with the following terms and conditions. 8 * copied only in accordance with the following terms and conditions.
9 * Subject to these conditions, you may download, copy, install, 9 * Subject to these conditions, you may download, copy, install,
10 * use, modify and distribute this software in source and/or binary 10 * use, modify and distribute this software in source and/or binary
11 * form. No title or ownership is transferred hereby. 11 * form. No title or ownership is transferred hereby.
12 * 12 *
13 * 1) Any source code used, modified or distributed must reproduce 13 * 1) Any source code used, modified or distributed must reproduce
14 * and retain this copyright notice and list of conditions as 14 * and retain this copyright notice and list of conditions as
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * 3) This software is provided "AS-IS" and any express or implied 24 * 3) This software is provided "AS-IS" and any express or implied
25 * warranties, including but not limited to, any implied warranties 25 * warranties, including but not limited to, any implied warranties
26 * of merchantability, fitness for a particular purpose, or 26 * of merchantability, fitness for a particular purpose, or
27 * non-infringement are disclaimed. In no event shall DIGITAL be 27 * non-infringement are disclaimed. In no event shall DIGITAL be
28 * liable for any damages whatsoever, and in particular, DIGITAL 28 * liable for any damages whatsoever, and in particular, DIGITAL
29 * shall not be liable for special, indirect, consequential, or 29 * shall not be liable for special, indirect, consequential, or
30 * incidental damages or damages for lost profits, loss of 30 * incidental damages or damages for lost profits, loss of
31 * revenue or loss of use, whether such damages arise in contract, 31 * revenue or loss of use, whether such damages arise in contract,
32 * negligence, tort, under statute, in equity, at law or otherwise, 32 * negligence, tort, under statute, in equity, at law or otherwise,
33 * even if advised of the possibility of such damage. 33 * even if advised of the possibility of such damage.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.51 2021/01/26 14:09:11 thorpej Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.52 2021/01/26 14:49:41 thorpej Exp $");
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/device.h> 40#include <sys/device.h>
41#include <sys/kmem.h> 41#include <sys/kmem.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <dev/ofw/openfirm.h> 43#include <dev/ofw/openfirm.h>
44#include <dev/i2c/i2cvar.h> 44#include <dev/i2c/i2cvar.h>
45 45
46#define OFW_MAX_STACK_BUF_SIZE 256 46#define OFW_MAX_STACK_BUF_SIZE 256
47#define OFW_PATH_BUF_SIZE 512 47#define OFW_PATH_BUF_SIZE 512
48 48
49/* 49/*
50 * int of_decode_int(p) 50 * int of_decode_int(p)
@@ -70,102 +70,85 @@ of_decode_int(const unsigned char *p) @@ -70,102 +70,85 @@ of_decode_int(const unsigned char *p)
70{ 70{
71 unsigned int i = *p++ << 8; 71 unsigned int i = *p++ << 8;
72 i = (i + *p++) << 8; 72 i = (i + *p++) << 8;
73 i = (i + *p++) << 8; 73 i = (i + *p++) << 8;
74 return (i + *p); 74 return (i + *p);
75} 75}
76 76
77/* 77/*
78 * int of_compatible(phandle, strings) 78 * int of_compatible(phandle, strings)
79 * 79 *
80 * This routine checks an OFW node's "compatible" entry to see if 80 * This routine checks an OFW node's "compatible" entry to see if
81 * it matches any of the provided strings. 81 * it matches any of the provided strings.
82 * 82 *
83 * It should be used when determining whether a driver can drive 83 * of_match_compat_data() is the preferred way to perform driver
84 * a particular device. 84 * compatibility match. However, this routine that deals with
 85 * only strings is useful in some situations and is provided for
 86 * convenience.
85 * 87 *
86 * Arguments: 88 * Arguments:
87 * phandle OFW phandle of device to be checked for 89 * phandle OFW phandle of device to be checked for
88 * compatibility. 90 * compatibility.
89 * strings Array of containing expected "compatibility" 91 * strings Array of containing expected "compatibility"
90 * property values, presence of any of which 92 * property values, presence of any of which
91 * indicates compatibility. 93 * indicates compatibility.
92 * 94 *
93 * Return Value: 95 * Return Value:
94 * -1 if none of the strings are found in phandle's "compatibility" 96 * 0 if none of the strings are found in phandle's "compatibility"
95 * property, or the reverse index of the matching string in the 97 * property, or the reverse index of the matching string in the
96 * phandle's "compatibility" property. 98 * phandle's "compatibility" property plus 1.
97 * 99 *
98 * Side Effects: 100 * Side Effects:
99 * None. 101 * None.
100 */ 102 */
101int 103int
102of_compatible(int phandle, const char * const *strings) 104of_compatible(int phandle, const char * const *strings)
103{ 105{
104 char *prop, propbuf[OFW_MAX_STACK_BUF_SIZE]; 106 char *prop, propbuf[OFW_MAX_STACK_BUF_SIZE];
105 const char *cp; 107 const char *cp;
106 int proplen, match, rv = -1; 108 int proplen, match = 0;
107 109
108 proplen = OF_getproplen(phandle, "compatible"); 110 proplen = OF_getproplen(phandle, "compatible");
109 if (proplen <= 0) { 111 if (proplen <= 0) {
110 return -1; 112 return 0;
111 } 113 }
112 114
113 prop = kmem_tmpbuf_alloc(proplen, propbuf, sizeof(propbuf), KM_SLEEP); 115 prop = kmem_tmpbuf_alloc(proplen, propbuf, sizeof(propbuf), KM_SLEEP);
114 116
115 if (OF_getprop(phandle, "compatible", prop, proplen) != proplen) { 117 if (OF_getprop(phandle, "compatible", prop, proplen) != proplen) {
116 goto out; 118 goto out;
117 } 119 }
118 120
119 for (; (cp = *strings) != NULL; strings++) { 121 for (; (cp = *strings) != NULL; strings++) {
120 if ((match = strlist_match(prop, proplen, cp)) != 0) { 122 if ((match = strlist_match(prop, proplen, cp)) != 0) {
121 rv = match - 1; 
122 break; 123 break;
123 } 124 }
124 } 125 }
125 126
126 out: 127 out:
127 kmem_tmpbuf_free(prop, proplen, propbuf); 128 kmem_tmpbuf_free(prop, proplen, propbuf);
128 return rv; 129 return match;
129} 130}
130 131
131/* 132/*
132 * int of_match_compatible(phandle, strings) 133 * int of_match_compatible(phandle, strings)
133 * 134 *
134 * This routine checks an OFW node's "compatible" entry to see if 135 * This function is equivalent to of_compatible(), and its use
135 * it matches any of the provided strings. 136 * is deprecated.
136 * 
137 * It should be used when determining whether a driver can drive 
138 * a particular device. 
139 * 
140 * Arguments: 
141 * phandle OFW phandle of device to be checked for 
142 * compatibility. 
143 * strings Array of containing expected "compatibility" 
144 * property values, presence of any of which 
145 * indicates compatibility. 
146 * 
147 * Return Value: 
148 * 0 if none of the strings are found in phandle's "compatibility" 
149 * property, or a positive number based on the reverse index of the 
150 * matching string in the phandle's "compatibility" property, plus 1. 
151 * 
152 * Side Effects: 
153 * None. 
154 */ 137 */
155int 138int
156of_match_compatible(int phandle, const char * const *strings) 139of_match_compatible(int phandle, const char * const *strings)
157{ 140{
158 return of_compatible(phandle, strings) + 1; 141 return of_compatible(phandle, strings);
159} 142}
160 143
161/* 144/*
162 * int of_match_compat_data(phandle, compat_data) 145 * int of_match_compat_data(phandle, compat_data)
163 * 146 *
164 * This routine searches an array of device_compatible_entry structures 147 * This routine searches an array of device_compatible_entry structures
165 * for a matching "compatible" entry matching the supplied OFW node, 148 * for a matching "compatible" entry matching the supplied OFW node,
166 * and returns a weighted match value corresponding to which string 149 * and returns a weighted match value corresponding to which string
167 * from the "compatible" property was matched, which more weight given 150 * from the "compatible" property was matched, which more weight given
168 * to the first string than the last. 151 * to the first string than the last.
169 * 152 *
170 * It should be used when determining whether a driver can drive 153 * It should be used when determining whether a driver can drive
171 * a particular device. 154 * a particular device.