1
- /* $NetBSD: summitfb.c,v 1.21 2024/12/26 17:41:27 riastradh Exp $ */
1
+ /* $NetBSD: summitfb.c,v 1.22 2024/12/27 13:46:12 skrll Exp $ */
2
2
3
3
/* $OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $ */
4
4
27
27
*/
28
28
29
29
#include <sys/cdefs.h>
30
- __KERNEL_RCSID (0 , "$NetBSD: summitfb.c,v 1.21 2024/12/26 17:41:27 riastradh Exp $" );
30
+ __KERNEL_RCSID (0 , "$NetBSD: summitfb.c,v 1.22 2024/12/27 13:46:12 skrll Exp $" );
31
31
32
32
#include <sys/param.h>
33
33
#include <sys/systm.h>
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: summitfb.c,v 1.21 2024/12/26 17:41:27 riastradh Exp
54
54
55
55
#include "opt_summitfb.h"
56
56
57
+ #define SUMMITFB_DEBUG
57
58
#ifdef SUMMITFB_DEBUG
58
59
#define DPRINTF (s ) printf s
59
60
#else
@@ -260,11 +261,11 @@ summitfb_attach(device_t parent, device_t self, void *aux)
260
261
261
262
sc -> sc_scr .scr_rom = sc -> sc_base .sc_rom ;
262
263
ret = sti_screen_setup (& sc -> sc_scr , STI_FBMODE );
263
- {
264
- struct sti_dd * dd = & rom -> rom_dd ;
265
- sti_fetchfonts (& sc -> sc_scr , NULL , dd -> dd_fntaddr , 0 );
266
- summitfb_copyfont (sc );
267
- }
264
+
265
+ struct sti_dd * dd = & rom -> rom_dd ;
266
+ sti_fetchfonts (& sc -> sc_scr , NULL , dd -> dd_fntaddr , 0 );
267
+ summitfb_copyfont (sc );
268
+
268
269
sc -> sc_width = sc -> sc_scr .scr_cfg .scr_width ;
269
270
sc -> sc_height = sc -> sc_scr .scr_cfg .scr_height ;
270
271
sc -> sc_write_mode = 0xffffffff ;
@@ -399,10 +400,10 @@ summitfb_check_rom(struct summitfb_softc *spc, struct pci_attach_args *pa)
399
400
}
400
401
401
402
summitfb_disable_rom_internal (spc );
403
+
402
404
/*
403
405
* Iterate over the ROM images, pick the best candidate.
404
406
*/
405
-
406
407
selected = (bus_addr_t )- 1 ;
407
408
for (offs = 0 ; offs < romsize ; offs += subsize ) {
408
409
summitfb_enable_rom_internal (spc );
@@ -454,7 +455,7 @@ summitfb_check_rom(struct summitfb_softc *spc, struct pci_attach_args *pa)
454
455
* code is for.
455
456
*/
456
457
457
- suboffs = offs + ( bus_addr_t ) bus_space_read_2 (pa -> pa_memt , romh ,
458
+ suboffs = offs + bus_space_read_2 (pa -> pa_memt , romh ,
458
459
offs + 0x18 );
459
460
tmp = bus_space_read_4 (pa -> pa_memt , romh , suboffs + 0 );
460
461
tmp = le32toh (tmp );
@@ -509,8 +510,7 @@ summitfb_check_rom(struct summitfb_softc *spc, struct pci_attach_args *pa)
509
510
*/
510
511
511
512
summitfb_enable_rom_internal (spc );
512
- offs = selected +
513
- (bus_addr_t )bus_space_read_2 (pa -> pa_memt , romh , selected + 0x0e );
513
+ offs = selected + bus_space_read_2 (pa -> pa_memt , romh , selected + 0x0e );
514
514
for (i = 0 ; i < STI_REGION_MAX ; i ++ ) {
515
515
rc = summitfb_readbar (sc , pa , i ,
516
516
bus_space_read_1 (pa -> pa_memt , romh , offs + i ));
@@ -523,9 +523,8 @@ summitfb_check_rom(struct summitfb_softc *spc, struct pci_attach_args *pa)
523
523
*/
524
524
525
525
offs = selected +
526
- (bus_addr_t )bus_space_read_4 (pa -> pa_memt , romh , selected + 0x08 );
527
- stiromsize = (bus_addr_t )bus_space_read_4 (pa -> pa_memt , romh ,
528
- offs + 0x18 );
526
+ bus_space_read_4 (pa -> pa_memt , romh , selected + 0x08 );
527
+ stiromsize = bus_space_read_4 (pa -> pa_memt , romh , offs + 0x18 );
529
528
stiromsize = le32toh (stiromsize );
530
529
summitfb_disable_rom_internal (spc );
531
530
@@ -664,7 +663,8 @@ summitfb_wait(struct summitfb_softc *sc)
664
663
static inline void
665
664
summitfb_write_mode (struct summitfb_softc * sc , uint32_t mode )
666
665
{
667
- if (sc -> sc_write_mode == mode ) return ;
666
+ if (sc -> sc_write_mode == mode )
667
+ return ;
668
668
summitfb_wait (sc );
669
669
summitfb_write4 (sc , VISFX_VRAM_WRITE_MODE , mode );
670
670
summitfb_write4 (sc , VISFX_VRAM_READ_MODE ,mode & 0x07fff000 );
@@ -1359,7 +1359,7 @@ summitfb_copycols(void *cookie, int row, int srccol, int dstcol, int ncols)
1359
1359
struct summitfb_softc * sc = scr -> scr_cookie ;
1360
1360
int32_t xs , xd , y , width , height ;
1361
1361
1362
- if (( sc -> sc_locked == 0 ) && ( sc -> sc_mode == WSDISPLAYIO_MODE_EMUL ) ) {
1362
+ if (sc -> sc_locked == 0 && sc -> sc_mode == WSDISPLAYIO_MODE_EMUL ) {
1363
1363
1364
1364
if (ri -> ri_crow == row &&
1365
1365
ri -> ri_ccol >= srccol && ri -> ri_ccol < (srccol + ncols ) &&
@@ -1389,7 +1389,7 @@ summitfb_erasecols(void *cookie, int row, int startcol, int ncols,
1389
1389
struct summitfb_softc * sc = scr -> scr_cookie ;
1390
1390
int32_t x , y , width , height , fg , bg , ul ;
1391
1391
1392
- if (( sc -> sc_locked == 0 ) && ( sc -> sc_mode == WSDISPLAYIO_MODE_EMUL ) ) {
1392
+ if (sc -> sc_locked == 0 && sc -> sc_mode == WSDISPLAYIO_MODE_EMUL ) {
1393
1393
x = ri -> ri_xorigin + ri -> ri_font -> fontwidth * startcol ;
1394
1394
y = ri -> ri_yorigin + ri -> ri_font -> fontheight * row ;
1395
1395
width = ri -> ri_font -> fontwidth * ncols ;
@@ -1413,7 +1413,7 @@ summitfb_copyrows(void *cookie, int srcrow, int dstrow, int nrows)
1413
1413
struct summitfb_softc * sc = scr -> scr_cookie ;
1414
1414
int32_t x , ys , yd , width , height ;
1415
1415
1416
- if (( sc -> sc_locked == 0 ) && ( sc -> sc_mode == WSDISPLAYIO_MODE_EMUL ) ) {
1416
+ if (sc -> sc_locked == 0 && sc -> sc_mode == WSDISPLAYIO_MODE_EMUL ) {
1417
1417
1418
1418
if (ri -> ri_crow >= srcrow && ri -> ri_crow < (srcrow + nrows ) &&
1419
1419
(ri -> ri_flg & RI_CURSOR )) {
@@ -1440,7 +1440,7 @@ summitfb_eraserows(void *cookie, int row, int nrows, long fillattr)
1440
1440
struct summitfb_softc * sc = scr -> scr_cookie ;
1441
1441
int32_t x , y , width , height , fg , bg , ul ;
1442
1442
1443
- if (( sc -> sc_locked == 0 ) && ( sc -> sc_mode == WSDISPLAYIO_MODE_EMUL ) ) {
1443
+ if (sc -> sc_locked == 0 && sc -> sc_mode == WSDISPLAYIO_MODE_EMUL ) {
1444
1444
x = ri -> ri_xorigin ;
1445
1445
y = ri -> ri_yorigin + ri -> ri_font -> fontheight * row ;
1446
1446
width = ri -> ri_emuwidth ;
@@ -1464,10 +1464,13 @@ summitfb_move_cursor(struct summitfb_softc *sc, int x, int y)
1464
1464
sc -> sc_cursor_y = y ;
1465
1465
y -= sc -> sc_hot_y ;
1466
1466
1467
- if (x < 0 ) x = 0x1000 - x ;
1468
- if (y < 0 ) y = 0x1000 - y ;
1467
+ if (x < 0 )
1468
+ x = 0x1000 - x ;
1469
+ if (y < 0 )
1470
+ y = 0x1000 - y ;
1469
1471
pos = (x << 16 ) | y ;
1470
- if (sc -> sc_enabled ) pos |= 0x80000000 ;
1472
+ if (sc -> sc_enabled )
1473
+ pos |= 0x80000000 ;
1471
1474
summitfb_write4 (sc , VISFX_CURSOR_POS , pos );
1472
1475
}
1473
1476
@@ -1618,11 +1621,13 @@ summitfb_copyfont(struct summitfb_softc *sc)
1618
1621
struct wsdisplay_font * f ;
1619
1622
int bufsize , i , si ;
1620
1623
1621
- if (font == NULL ) return ;
1624
+ if (font == NULL )
1625
+ return ;
1622
1626
bufsize = sizeof (struct wsdisplay_font ) + 32 + fp -> bpc * ( fp -> last - fp -> first );
1623
1627
DPRINTF (("%s: %dx%d %d\n" , __func__ , fp -> width , fp -> height , bufsize ));
1624
1628
fontbuf = kmem_alloc (bufsize , KM_NOSLEEP );
1625
- if (fontbuf == NULL ) return ;
1629
+ if (fontbuf == NULL )
1630
+ return ;
1626
1631
f = (struct wsdisplay_font * )fontbuf ;
1627
1632
f -> name = fontbuf + sizeof (struct wsdisplay_font );
1628
1633
fontdata = fontbuf + sizeof (struct wsdisplay_font ) + 32 ;
0 commit comments