Wed Jul 14 17:53:50 2021 UTC ()
Pull up following revision(s) (requested by tsutsui in ticket #1689):

	sys/arch/hppa/dev/sti_sgc.c: revision 1.3

Fix silent freeze on probing sti(4) framebuffer on 712/60.  PR/52162

Ok'ed by skrll@.
Should be pulled up to netbsd-9 and netbsd-8.


(martin)
diff -r1.1 -r1.1.28.1 src/sys/arch/hppa/dev/sti_sgc.c

cvs diff -r1.1 -r1.1.28.1 src/sys/arch/hppa/dev/sti_sgc.c (expand / switch to unified diff)

--- src/sys/arch/hppa/dev/sti_sgc.c 2014/02/24 07:23:43 1.1
+++ src/sys/arch/hppa/dev/sti_sgc.c 2021/07/14 17:53:50 1.1.28.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sti_sgc.c,v 1.1 2014/02/24 07:23:43 skrll Exp $ */ 1/* $NetBSD: sti_sgc.c,v 1.1.28.1 2021/07/14 17:53:50 martin Exp $ */
2 2
3/* $OpenBSD: sti_sgc.c,v 1.38 2009/02/06 22:51:04 miod Exp $ */ 3/* $OpenBSD: sti_sgc.c,v 1.38 2009/02/06 22:51:04 miod Exp $ */
4 4
5/* 5/*
6 * Copyright (c) 2000-2003 Michael Shalayeff 6 * Copyright (c) 2000-2003 Michael Shalayeff
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE. 28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30/* 30/*
31 * These cards has to be known to work so far: 31 * These cards has to be known to work so far:
32 * - HPA1991AGrayscale rev 0.02 (705/35) (byte-wide) 32 * - HPA1991AGrayscale rev 0.02 (705/35) (byte-wide)
33 * - HPA1991AC19 rev 0.02 (715/33) (byte-wide) 33 * - HPA1991AC19 rev 0.02 (715/33) (byte-wide)
34 * - HPA208LC1280 rev 8.04 (712/80) just works 34 * - HPA208LC1280 rev 8.04 (712/80) just works
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.1 2014/02/24 07:23:43 skrll Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.1.28.1 2021/07/14 17:53:50 martin Exp $");
39 39
40#include "opt_cputype.h" 40#include "opt_cputype.h"
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/device.h> 44#include <sys/device.h>
45 45
46#include <uvm/uvm.h> 46#include <uvm/uvm.h>
47 47
48#include <sys/bus.h> 48#include <sys/bus.h>
49#include <machine/cpu.h> 49#include <machine/cpu.h>
50#include <machine/iomod.h> 50#include <machine/iomod.h>
51#include <machine/autoconf.h> 51#include <machine/autoconf.h>
@@ -63,26 +63,36 @@ __KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v  @@ -63,26 +63,36 @@ __KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v
63#define DPRINTF(s) do { \ 63#define DPRINTF(s) do { \
64 if (stidebug) \ 64 if (stidebug) \
65 printf s; \ 65 printf s; \
66} while(0) 66} while(0)
67 67
68extern int stidebug; 68extern int stidebug;
69#else 69#else
70#define DPRINTF(s) /* */ 70#define DPRINTF(s) /* */
71#endif 71#endif
72 72
73#define STI_ROMSIZE (sizeof(struct sti_dd) * 4) 73#define STI_ROMSIZE (sizeof(struct sti_dd) * 4)
74#define STI_ID_FDDI 0x280b31af /* Medusa FDDI ROM id */ 74#define STI_ID_FDDI 0x280b31af /* Medusa FDDI ROM id */
75 75
 76/*
 77 * hpa addresses to check on-board variants
 78 * XXX should check via device_register(9)?
 79 *
 80 * 0xf4000000: HPA1991AC19 on 715/33, 715/50
 81 * 0xf8000000: HPA1439A on 735/99, HPA208LCxxx on 715/80, 715/100, 712
 82 */
 83#define STI_ONBOARD_HPA0 0xf4000000
 84#define STI_ONBOARD_HPA1 0xf8000000
 85
76/* gecko optional graphics */ 86/* gecko optional graphics */
77#define STI_GOPT1_REV 0x17 87#define STI_GOPT1_REV 0x17
78#define STI_GOPT2_REV 0x70 88#define STI_GOPT2_REV 0x70
79#define STI_GOPT3_REV 0xd0 89#define STI_GOPT3_REV 0xd0
80#define STI_GOPT4_REV 0x00 90#define STI_GOPT4_REV 0x00
81#define STI_GOPT5_REV 0x20 91#define STI_GOPT5_REV 0x20
82#define STI_GOPT6_REV 0x40 92#define STI_GOPT6_REV 0x40
83#define STI_GOPT7_REV 0x30 93#define STI_GOPT7_REV 0x30
84 94
85const char sti_sgc_opt[] = { 95const char sti_sgc_opt[] = {
86 STI_GOPT1_REV, 96 STI_GOPT1_REV,
87 STI_GOPT2_REV, 97 STI_GOPT2_REV,
88 STI_GOPT3_REV, 98 STI_GOPT3_REV,
@@ -108,27 +118,29 @@ paddr_t sti_sgc_getrom(struct confargs * @@ -108,27 +118,29 @@ paddr_t sti_sgc_getrom(struct confargs *
108 * Locate STI ROM. 118 * Locate STI ROM.
109 * On some machines it may not be part of the HPA space. 119 * On some machines it may not be part of the HPA space.
110 */ 120 */
111paddr_t 121paddr_t
112sti_sgc_getrom(struct confargs *ca) 122sti_sgc_getrom(struct confargs *ca)
113{ 123{
114 paddr_t rom; 124 paddr_t rom;
115 int pagezero_cookie; 125 int pagezero_cookie;
116 126
117 pagezero_cookie = hppa_pagezero_map(); 127 pagezero_cookie = hppa_pagezero_map();
118 rom = PAGE0->pd_resv2[1]; 128 rom = PAGE0->pd_resv2[1];
119 hppa_pagezero_unmap(pagezero_cookie); 129 hppa_pagezero_unmap(pagezero_cookie);
120 130
121 if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC) { 131 if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC &&
 132 ca->ca_hpa != STI_ONBOARD_HPA0 &&
 133 ca->ca_hpa != STI_ONBOARD_HPA1) {
122 int i; 134 int i;
123 for (i = sizeof(sti_sgc_opt); i--; ) 135 for (i = sizeof(sti_sgc_opt); i--; )
124 if (sti_sgc_opt[i] == ca->ca_type.iodc_revision) 136 if (sti_sgc_opt[i] == ca->ca_type.iodc_revision)
125 break; 137 break;
126 if (i < 0) 138 if (i < 0)
127 rom = 0; 139 rom = 0;
128 } 140 }
129  141
130 if (rom < HPPA_IOBEGIN) { 142 if (rom < HPPA_IOBEGIN) {
131 if (ca->ca_naddrs > 0) 143 if (ca->ca_naddrs > 0)
132 rom = ca->ca_addrs[0].addr; 144 rom = ca->ca_addrs[0].addr;
133 else 145 else
134 rom = ca->ca_hpa; 146 rom = ca->ca_hpa;