| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: smg.c,v 1.61.6.3 2023/02/15 19:14:50 martin Exp $ */ | | 1 | /* $NetBSD: smg.c,v 1.61.6.4 2024/02/03 12:56:02 martin Exp $ */ |
2 | /* $OpenBSD: smg.c,v 1.28 2014/12/23 21:39:12 miod Exp $ */ | | 2 | /* $OpenBSD: smg.c,v 1.28 2014/12/23 21:39:12 miod Exp $ */ |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006, Miodrag Vallat | | 4 | * Copyright (c) 2006, Miodrag Vallat |
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 | * |
| @@ -107,27 +107,27 @@ | | | @@ -107,27 +107,27 @@ |
107 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 107 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
108 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 108 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
109 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 109 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
110 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 110 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
111 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 111 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
112 | * SUCH DAMAGE. | | 112 | * SUCH DAMAGE. |
113 | * | | 113 | * |
114 | * from: Utah $Hdr: grf_hy.c 1.2 93/08/13$ | | 114 | * from: Utah $Hdr: grf_hy.c 1.2 93/08/13$ |
115 | * | | 115 | * |
116 | * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94 | | 116 | * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94 |
117 | */ | | 117 | */ |
118 | | | 118 | |
119 | #include <sys/cdefs.h> | | 119 | #include <sys/cdefs.h> |
120 | __KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.61.6.3 2023/02/15 19:14:50 martin Exp $"); | | 120 | __KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.61.6.4 2024/02/03 12:56:02 martin Exp $"); |
121 | | | 121 | |
122 | #include "dzkbd.h" | | 122 | #include "dzkbd.h" |
123 | #include "wsdisplay.h" | | 123 | #include "wsdisplay.h" |
124 | | | 124 | |
125 | #include <sys/param.h> | | 125 | #include <sys/param.h> |
126 | #include <sys/device.h> | | 126 | #include <sys/device.h> |
127 | #include <sys/systm.h> | | 127 | #include <sys/systm.h> |
128 | #include <sys/kmem.h> | | 128 | #include <sys/kmem.h> |
129 | #include <sys/conf.h> | | 129 | #include <sys/conf.h> |
130 | | | 130 | |
131 | #include <machine/vsbus.h> | | 131 | #include <machine/vsbus.h> |
132 | #include <machine/sid.h> | | 132 | #include <machine/sid.h> |
133 | #include <machine/cpu.h> | | 133 | #include <machine/cpu.h> |
| @@ -465,27 +465,27 @@ smg_ioctl(void *v, void *vs, u_long cmd, | | | @@ -465,27 +465,27 @@ smg_ioctl(void *v, void *vs, u_long cmd, |
465 | default: | | 465 | default: |
466 | return EPASSTHROUGH; | | 466 | return EPASSTHROUGH; |
467 | } | | 467 | } |
468 | return 0; | | 468 | return 0; |
469 | } | | 469 | } |
470 | | | 470 | |
471 | static paddr_t | | 471 | static paddr_t |
472 | smg_mmap(void *v, void *vs, off_t offset, int prot) | | 472 | smg_mmap(void *v, void *vs, off_t offset, int prot) |
473 | { | | 473 | { |
474 | | | 474 | |
475 | if (offset >= SMSIZE || offset < 0) | | 475 | if (offset >= SMSIZE || offset < 0) |
476 | return -1; | | 476 | return -1; |
477 | | | 477 | |
478 | return SMADDR + offset; | | 478 | return (SMADDR + offset) >> PGSHIFT; |
479 | } | | 479 | } |
480 | | | 480 | |
481 | static int | | 481 | static int |
482 | smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, | | 482 | smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, |
483 | int *curxp, int *curyp, long *defattrp) | | 483 | int *curxp, int *curyp, long *defattrp) |
484 | { | | 484 | { |
485 | struct smg_softc *sc = v; | | 485 | struct smg_softc *sc = v; |
486 | struct smg_screen *ss = sc->sc_scr; | | 486 | struct smg_screen *ss = sc->sc_scr; |
487 | struct rasops_info *ri = &ss->ss_ri; | | 487 | struct rasops_info *ri = &ss->ss_ri; |
488 | | | 488 | |
489 | if (sc->sc_nscreens > 0) | | 489 | if (sc->sc_nscreens > 0) |
490 | return ENOMEM; | | 490 | return ENOMEM; |
491 | | | 491 | |