| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: sti.c,v 1.28 2021/03/07 14:31:20 skrll Exp $ */ | | 1 | /* $NetBSD: sti.c,v 1.29 2021/03/14 08:13:58 skrll Exp $ */ |
2 | | | 2 | |
3 | /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $ */ | | 3 | /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 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 | * TODO: | | 31 | * TODO: |
32 | * call sti procs asynchronously; | | 32 | * call sti procs asynchronously; |
33 | * implement console scroll-back; | | 33 | * implement console scroll-back; |
34 | * X11 support on more models. | | 34 | * X11 support on more models. |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.28 2021/03/07 14:31:20 skrll Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.29 2021/03/14 08:13:58 skrll Exp $"); |
39 | | | 39 | |
40 | #include "wsdisplay.h" | | 40 | #include "wsdisplay.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 | #include <sys/malloc.h> | | 45 | #include <sys/malloc.h> |
46 | | | 46 | |
47 | #include <uvm/uvm_extern.h> | | 47 | #include <uvm/uvm_extern.h> |
48 | | | 48 | |
49 | #include <sys/bus.h> | | 49 | #include <sys/bus.h> |
50 | | | 50 | |
51 | #include <dev/wscons/wsdisplayvar.h> | | 51 | #include <dev/wscons/wsdisplayvar.h> |
| @@ -1417,29 +1417,28 @@ sti_alloc_attr(void *v, int fg, int bg, | | | @@ -1417,29 +1417,28 @@ sti_alloc_attr(void *v, int fg, int bg, |
1417 | return EINVAL; | | 1417 | return EINVAL; |
1418 | if ((flags & WSATTR_REVERSE) != 0) { | | 1418 | if ((flags & WSATTR_REVERSE) != 0) { |
1419 | fg = STI_COLOUR_BLACK; | | 1419 | fg = STI_COLOUR_BLACK; |
1420 | bg = STI_COLOUR_WHITE; | | 1420 | bg = STI_COLOUR_WHITE; |
1421 | } else { | | 1421 | } else { |
1422 | fg = STI_COLOUR_WHITE; | | 1422 | fg = STI_COLOUR_WHITE; |
1423 | bg = STI_COLOUR_BLACK; | | 1423 | bg = STI_COLOUR_BLACK; |
1424 | } | | 1424 | } |
1425 | | | 1425 | |
1426 | *pattr = WSATTR_PACK(fg, bg, flags); | | 1426 | *pattr = WSATTR_PACK(fg, bg, flags); |
1427 | return 0; | | 1427 | return 0; |
1428 | } | | 1428 | } |
1429 | | | 1429 | |
1430 | #ifdef hp300 /* XXX */ | | | |
1431 | /* | | 1430 | /* |
1432 | * Early console support. Only used on hp300. | | 1431 | * Early console support. Only used on hp300, currently |
1433 | */ | | 1432 | */ |
1434 | int | | 1433 | int |
1435 | sti_cnattach(struct sti_rom *rom, struct sti_screen *scr, bus_space_tag_t memt, | | 1434 | sti_cnattach(struct sti_rom *rom, struct sti_screen *scr, bus_space_tag_t memt, |
1436 | bus_addr_t *bases, u_int codebase) | | 1435 | bus_addr_t *bases, u_int codebase) |
1437 | { | | 1436 | { |
1438 | bus_space_handle_t romh; | | 1437 | bus_space_handle_t romh; |
1439 | u_int romend; | | 1438 | u_int romend; |
1440 | int error; | | 1439 | int error; |
1441 | long defattr; | | 1440 | long defattr; |
1442 | | | 1441 | |
1443 | if ((error = bus_space_map(memt, bases[0], PAGE_SIZE, 0, &romh)) != 0) | | 1442 | if ((error = bus_space_map(memt, bases[0], PAGE_SIZE, 0, &romh)) != 0) |
1444 | return error; | | 1443 | return error; |
1445 | | | 1444 | |
| @@ -1455,27 +1454,26 @@ sti_cnattach(struct sti_rom *rom, struct | | | @@ -1455,27 +1454,26 @@ sti_cnattach(struct sti_rom *rom, struct |
1455 | | | 1454 | |
1456 | bases[0] = romh; | | 1455 | bases[0] = romh; |
1457 | if (sti_rom_setup(rom, memt, memt, romh, bases, codebase) != 0) | | 1456 | if (sti_rom_setup(rom, memt, memt, romh, bases, codebase) != 0) |
1458 | return -1; | | 1457 | return -1; |
1459 | scr->scr_rom = rom; | | 1458 | scr->scr_rom = rom; |
1460 | if (sti_screen_setup(scr, STI_CLEARSCR) != 0) | | 1459 | if (sti_screen_setup(scr, STI_CLEARSCR) != 0) |
1461 | return -1; | | 1460 | return -1; |
1462 | | | 1461 | |
1463 | sti_alloc_attr(scr, 0, 0, 0, &defattr); | | 1462 | sti_alloc_attr(scr, 0, 0, 0, &defattr); |
1464 | wsdisplay_cnattach(&scr->scr_wsd, scr, 0, 0, defattr); | | 1463 | wsdisplay_cnattach(&scr->scr_wsd, scr, 0, 0, defattr); |
1465 | | | 1464 | |
1466 | return 0; | | 1465 | return 0; |
1467 | } | | 1466 | } |
1468 | #endif | | | |
1469 | | | 1467 | |
1470 | int | | 1468 | int |
1471 | ngle_default_putcmap(struct sti_screen *scr, u_int idx, u_int count) | | 1469 | ngle_default_putcmap(struct sti_screen *scr, u_int idx, u_int count) |
1472 | { | | 1470 | { |
1473 | int i, ret; | | 1471 | int i, ret; |
1474 | | | 1472 | |
1475 | for (i = idx + count - 1; i >= (int)idx; i--) | | 1473 | for (i = idx + count - 1; i >= (int)idx; i--) |
1476 | if ((ret = sti_setcment(scr, i, scr->scr_rcmap[i], | | 1474 | if ((ret = sti_setcment(scr, i, scr->scr_rcmap[i], |
1477 | scr->scr_gcmap[i], scr->scr_bcmap[i]))) | | 1475 | scr->scr_gcmap[i], scr->scr_bcmap[i]))) |
1478 | return EINVAL; | | 1476 | return EINVAL; |
1479 | | | 1477 | |
1480 | return 0; | | 1478 | return 0; |
1481 | } | | 1479 | } |