CVS commit: src/sys/arch/atari/pci

2022-08-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Aug 15 04:37:47 UTC 2022

Modified Files:
src/sys/arch/atari/pci: pci_vga.c

Log Message:
Improve VGA console settings for Milan, especially for sysinst.

- use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
  (so that box drawing characters are rendered properly)
- set ATC and DAC palette settings for proper colors
  (copied from MI vga_subr.c for now because HADES doesn't use mi vga(4))

Tested on Milan with S3 Trio64.  (XXX: needs working HADES with ET4000)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/atari/pci/pci_vga.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/pci/pci_vga.c
diff -u src/sys/arch/atari/pci/pci_vga.c:1.18 src/sys/arch/atari/pci/pci_vga.c:1.19
--- src/sys/arch/atari/pci/pci_vga.c:1.18	Sat Jul 31 20:51:32 2021
+++ src/sys/arch/atari/pci/pci_vga.c	Mon Aug 15 04:37:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_vga.c,v 1.18 2021/07/31 20:51:32 andvar Exp $	*/
+/*	$NetBSD: pci_vga.c,v 1.19 2022/08/15 04:37:46 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1999 Leo Weppelman.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.18 2021/07/31 20:51:32 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.19 2022/08/15 04:37:46 tsutsui Exp $");
 
 #include 
 #include 
@@ -55,11 +55,51 @@ extern font_info	font_info_8x8;
 extern font_info	font_info_8x16;
 
 /* Console colors */
-static const uint8_t conscolors[3][3] = {
-	/* background, foreground, hilite */
-	{ 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x30 },
-	{ 0x3f, 0x3f, 0x3f }
+/* attribute controller registers */
+static const uint8_t vga_atc[] = {
+	0x00,	/* 00: internal palette  0 */
+	0x01,	/* 01: internal palette  1 */
+	0x02,	/* 02: internal palette  2 */
+	0x03,	/* 03: internal palette  3 */
+	0x04,	/* 04: internal palette  4 */
+	0x05,	/* 05: internal palette  5 */
+	0x14,	/* 06: internal palette  6 */
+	0x07,	/* 07: internal palette  7 */
+	0x38,	/* 08: internal palette  8 */
+	0x39,	/* 09: internal palette  9 */
+	0x3a,	/* 0A: internal palette 10 */
+	0x3b,	/* 0B: internal palette 11 */
+	0x3c,	/* 0C: internal palette 12 */
+	0x3d,	/* 0D: internal palette 13 */
+	0x3e,	/* 0E: internal palette 14 */
+	0x3f,	/* 0F: internal palette 15 */
+	0x0c,	/* 10: attribute mode control */
+	0x00,	/* 11: overscan color */
+	0x0f,	/* 12: color plane enable */
+	0x08,	/* 13: horizontal PEL panning */
+	0x00	/* 14: color select */
+};
+
+/* video DAC palette registers */
+/* XXX only set up 16 colors used by internal palette in ATC regsters */
+static const uint8_t vga_dacpal[] = {
+	/* R G B */
+	0x00, 0x00, 0x00,	/* BLACK*/
+	0x00, 0x00, 0x2a,	/* BLUE	*/
+	0x00, 0x2a, 0x00,	/* GREEN*/
+	0x00, 0x2a, 0x2a,	/* CYAN */
+	0x2a, 0x00, 0x00,	/* RED  */
+	0x2a, 0x00, 0x2a,	/* MAGENTA  */
+	0x2a, 0x15, 0x00,	/* BROWN*/
+	0x2a, 0x2a, 0x2a,	/* LIGHTGREY*/
+	0x15, 0x15, 0x15,	/* DARKGREY */
+	0x15, 0x15, 0x3f,	/* LIGHTBLUE*/
+	0x15, 0x3f, 0x15,	/* LIGHTGREEN   */
+	0x15, 0x3f, 0x3f,	/* LIGHTCYAN*/
+	0x3f, 0x15, 0x15,	/* LIGHTRED */
+	0x3f, 0x15, 0x3f,	/* LIGHTMAGENTA */
+	0x3f, 0x3f, 0x15,	/* YELLOW   */
+	0x3f, 0x3f, 0x3f	/* WHITE*/
 };
 
 static bus_space_tag_t	vga_iot, vga_memt;
@@ -79,7 +119,7 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	pci_chipset_tag_t	pc = NULL; /* XXX */
 	bus_space_handle_t	ioh_regs, memh_fb;
 	pcitag_t		tag;
-	int			device, found, maxndevs, i, j;
+	int			device, found, maxndevs, i;
 	int			got_ioh, got_memh, rv;
 	uint32_t		id, class;
 	volatile uint8_t	*regs;
@@ -176,16 +216,23 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	 * Generic parts of the initialization...
 	 */
 	
-	/* B colors */
-	vgaw(regs, VDAC_ADDRESS_W, 0);
-	for (i = 0; i < 256; i++) {
-		j = (i & 1) ? ((i > 7) ? 2 : 1) : 0;
-		vgaw(regs, VDAC_DATA, conscolors[j][0]);
-		vgaw(regs, VDAC_DATA, conscolors[j][1]);
-		vgaw(regs, VDAC_DATA, conscolors[j][2]);
+	/* set ATC registers */
+	for (i = 0; i < 21; i++)
+		WAttr(regs, i, vga_atc[i]);
+
+	/* set DAC palette */
+	for (i = 0; i < 16; i++) {
+		vgaw(regs, VDAC_ADDRESS_W, vga_atc[i]);
+		vgaw(regs, VDAC_DATA, vga_dacpal[i * 3 + 0]);
+		vgaw(regs, VDAC_DATA, vga_dacpal[i * 3 + 1]);
+		vgaw(regs, VDAC_DATA, vga_dacpal[i * 3 + 2]);
 	}
 
 	loadfont(regs, fb);
+#if NVGA_PCI > 0
+	/* use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes */
+	vga_no_builtinfont = 1;
+#endif
 
 	/*
 	 * Clear the screen and print a message. The latter



CVS commit: src/sys/arch/atari/pci

2022-08-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Aug 15 04:37:47 UTC 2022

Modified Files:
src/sys/arch/atari/pci: pci_vga.c

Log Message:
Improve VGA console settings for Milan, especially for sysinst.

- use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
  (so that box drawing characters are rendered properly)
- set ATC and DAC palette settings for proper colors
  (copied from MI vga_subr.c for now because HADES doesn't use mi vga(4))

Tested on Milan with S3 Trio64.  (XXX: needs working HADES with ET4000)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/atari/pci/pci_vga.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/atari/pci

2019-05-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May  4 09:03:08 UTC 2019

Modified Files:
src/sys/arch/atari/pci: pci_hades.c pci_tseng.c pci_vga.c

Log Message:
Use const for register values.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/pci/pci_hades.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/atari/pci/pci_tseng.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/atari/pci/pci_vga.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/pci/pci_hades.c
diff -u src/sys/arch/atari/pci/pci_hades.c:1.15 src/sys/arch/atari/pci/pci_hades.c:1.16
--- src/sys/arch/atari/pci/pci_hades.c:1.15	Sat May  4 08:20:05 2019
+++ src/sys/arch/atari/pci/pci_hades.c	Sat May  4 09:03:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_hades.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $	*/
+/*	$NetBSD: pci_hades.c,v 1.16 2019/05/04 09:03:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_hades.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_hades.c,v 1.16 2019/05/04 09:03:08 tsutsui Exp $");
 
 #include 
 #include 
@@ -206,21 +206,21 @@ pci_intr_disestablish(pci_chipset_tag_t 
  */
 #define PCI_LINMEMBASE  0x0e00
 
-static uint8_t crt_tab[] = {
+static const uint8_t crt_tab[] = {
 	0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
 	0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
 	0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
 	0xff };
 
-static uint8_t seq_tab[] = {
+static const uint8_t seq_tab[] = {
 	0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00
 };
 
-static uint8_t attr_tab[] = {
+static const uint8_t attr_tab[] = {
 	0x0c, 0x00, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00
 };
 
-static uint8_t gdc_tab[] = {
+static const uint8_t gdc_tab[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, 0xff
 };
 

Index: src/sys/arch/atari/pci/pci_tseng.c
diff -u src/sys/arch/atari/pci/pci_tseng.c:1.12 src/sys/arch/atari/pci/pci_tseng.c:1.13
--- src/sys/arch/atari/pci/pci_tseng.c:1.12	Sat May  4 08:20:05 2019
+++ src/sys/arch/atari/pci/pci_tseng.c	Sat May  4 09:03:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_tseng.c,v 1.12 2019/05/04 08:20:05 tsutsui Exp $	*/
+/*	$NetBSD: pci_tseng.c,v 1.13 2019/05/04 09:03:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1999 Leo Weppelman.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_tseng.c,v 1.12 2019/05/04 08:20:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_tseng.c,v 1.13 2019/05/04 09:03:08 tsutsui Exp $");
 
 #include 
 #include 
@@ -44,19 +44,19 @@ static void et6000_init(volatile uint8_t
 /*
  * Use tables for the card init...
  */
-static uint8_t seq_tab[] = {
+static const uint8_t seq_tab[] = {
  	0x03, 0x01, 0x03, 0x00, 0x02, 0x00, 0x00, 0xb4
 };
 
-static uint8_t gfx_tab[] = {
+static const uint8_t gfx_tab[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x0f, 0xff
 };
 
-static uint8_t attr_tab[] = {
+static const uint8_t attr_tab[] = {
 	0x0a, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-static uint8_t crt_tab[] = {
+static const uint8_t crt_tab[] = {
 	0x60, 0x53, 0x4f, 0x94, 0x56, 0x05, 0xc1, 0x1f,
 	0x00, 0x4f, 0x00, 0x0f, 0x00, 0x00, 0x07, 0x80,
 	0x98, 0x3d, 0x8f, 0x28, 0x0f, 0x8f, 0xc2, 0xa3,
@@ -71,7 +71,7 @@ static uint8_t crt_tab[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-static uint8_t ras_cas_tab[] = {
+static const uint8_t ras_cas_tab[] = {
 	0x11, 0x14, 0x15
 };
 

Index: src/sys/arch/atari/pci/pci_vga.c
diff -u src/sys/arch/atari/pci/pci_vga.c:1.16 src/sys/arch/atari/pci/pci_vga.c:1.17
--- src/sys/arch/atari/pci/pci_vga.c:1.16	Sat May  4 08:30:06 2019
+++ src/sys/arch/atari/pci/pci_vga.c	Sat May  4 09:03:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_vga.c,v 1.16 2019/05/04 08:30:06 tsutsui Exp $	*/
+/*	$NetBSD: pci_vga.c,v 1.17 2019/05/04 09:03:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1999 Leo Weppelman.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.16 2019/05/04 08:30:06 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.17 2019/05/04 09:03:08 tsutsui Exp $");
 
 #include 
 #include 
@@ -55,8 +55,11 @@ extern font_info	font_info_8x8;
 extern font_info	font_info_8x16;
 
 /* Console colors */
-static uint8_t conscolors[3][3] = {	/* background, foreground, hilite */
-	{0x0, 0x0, 0x0}, {0x30, 0x30, 0x30}, { 0x3f,  0x3f,  0x3f}
+static const uint8_t conscolors[3][3] = {
+	/* background, foreground, hilite */
+	{ 0x00, 0x00, 0x00 },
+	{ 0x30, 0x30, 0x30 },
+	{ 0x3f, 0x3f, 0x3f }
 };
 
 static bus_space_tag_t	vga_iot, vga_memt;



CVS commit: src/sys/arch/atari/pci

2019-05-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May  4 09:03:08 UTC 2019

Modified Files:
src/sys/arch/atari/pci: pci_hades.c pci_tseng.c pci_vga.c

Log Message:
Use const for register values.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/pci/pci_hades.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/atari/pci/pci_tseng.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/atari/pci/pci_vga.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/atari/pci

2019-05-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May  4 08:30:06 UTC 2019

Modified Files:
src/sys/arch/atari/pci: pci_machdep.c pci_vga.c

Log Message:
Use proper integer types for PCI configuration registers.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/atari/pci/pci_machdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/pci/pci_vga.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/pci/pci_machdep.c
diff -u src/sys/arch/atari/pci/pci_machdep.c:1.57 src/sys/arch/atari/pci/pci_machdep.c:1.58
--- src/sys/arch/atari/pci/pci_machdep.c:1.57	Sat May  4 08:20:05 2019
+++ src/sys/arch/atari/pci/pci_machdep.c	Sat May  4 08:30:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.57 2019/05/04 08:20:05 tsutsui Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.58 2019/05/04 08:30:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.57 2019/05/04 08:20:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.58 2019/05/04 08:30:06 tsutsui Exp $");
 
 #include "opt_mbtype.h"
 
@@ -228,7 +228,7 @@ init_pci_bus(void)
 	pcitag_t		tag;
 	pcireg_t		csr;
 	int			device, maxndevs;
-	int			id;
+	uint32_t		id;
 
 	tag   = 0;
 	id= 0;
@@ -328,7 +328,7 @@ enable_pci_devices(void)
 	PCI_MEMREG iolist;
 	struct pci_memreg *p, *q;
 	int dev, reg;
-	int id, class;
+	uint32_t id, class;
 	pcitag_t tag;
 	pcireg_t csr, address, mask;
 	pci_chipset_tag_t pc;

Index: src/sys/arch/atari/pci/pci_vga.c
diff -u src/sys/arch/atari/pci/pci_vga.c:1.15 src/sys/arch/atari/pci/pci_vga.c:1.16
--- src/sys/arch/atari/pci/pci_vga.c:1.15	Sat May  4 08:20:05 2019
+++ src/sys/arch/atari/pci/pci_vga.c	Sat May  4 08:30:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_vga.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $	*/
+/*	$NetBSD: pci_vga.c,v 1.16 2019/05/04 08:30:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1999 Leo Weppelman.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.16 2019/05/04 08:30:06 tsutsui Exp $");
 
 #include 
 #include 
@@ -76,9 +76,9 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	pci_chipset_tag_t	pc = NULL; /* XXX */
 	bus_space_handle_t	ioh_regs, memh_fb;
 	pcitag_t		tag;
-	int			device, found, id, maxndevs, i, j;
+	int			device, found, maxndevs, i, j;
 	int			got_ioh, got_memh, rv;
-	int		class;
+	uint32_t		id, class;
 	volatile uint8_t	*regs;
 	uint8_t			*fb;
 	const char		*nbd = "NetBSD/Atari";



CVS commit: src/sys/arch/atari/pci

2019-05-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May  4 08:30:06 UTC 2019

Modified Files:
src/sys/arch/atari/pci: pci_machdep.c pci_vga.c

Log Message:
Use proper integer types for PCI configuration registers.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/atari/pci/pci_machdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/pci/pci_vga.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/atari/pci

2019-05-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May  4 08:20:06 UTC 2019

Modified Files:
src/sys/arch/atari/pci: pci_hades.c pci_machdep.c pci_milan.c
pci_tseng.c pci_vga.c pci_vga.h pciide_machdep.c

Log Message:
Misc KNF.

No binary changes on HADES and MILAN-PCIIDE kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/atari/pci/pci_hades.c \
src/sys/arch/atari/pci/pci_vga.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/atari/pci/pci_machdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/pci/pci_milan.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/atari/pci/pci_tseng.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/atari/pci/pci_vga.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/atari/pci/pciide_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/pci/pci_hades.c
diff -u src/sys/arch/atari/pci/pci_hades.c:1.14 src/sys/arch/atari/pci/pci_hades.c:1.15
--- src/sys/arch/atari/pci/pci_hades.c:1.14	Fri Oct  2 05:22:50 2015
+++ src/sys/arch/atari/pci/pci_hades.c	Sat May  4 08:20:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_hades.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $	*/
+/*	$NetBSD: pci_hades.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_hades.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_hades.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $");
 
 #include 
 #include 
@@ -58,7 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_hades.c,
 int
 pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
 {
-	return (4);
+
+	return 4;
 }
 
 static int pci_config_offset(pcitag_t);
@@ -66,35 +67,37 @@ static int pci_config_offset(pcitag_t);
 /*
  * Atari_init.c maps the config areas PAGE_SIZE bytes apart
  */
-static int pci_config_offset(pcitag_t tag)
+static int
+pci_config_offset(pcitag_t tag)
 {
-	int	device;
+	int device;
 
 	device = (tag >> 11) & 0x1f;
-	return(device * PAGE_SIZE);
+
+	return device * PAGE_SIZE;
 }
 
 pcireg_t
 pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
 {
-	u_long	data;
+	uint32_t data;
 
-	if ((unsigned int)reg >= PCI_CONF_SIZE)
-		return ((pcireg_t) -1);
+	if ((uint32_t)reg >= PCI_CONF_SIZE)
+		return 0x;
 
-	data = *(u_long *)(pci_conf_addr + pci_config_offset(tag) + reg);
-	return (bswap32(data));
+	data = *(uint32_t *)(pci_conf_addr + pci_config_offset(tag) + reg);
+	return bswap32(data);
 }
 
 void
 pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
 {
 
-	if ((unsigned int)reg >= PCI_CONF_SIZE)
+	if ((uint32_t)reg >= PCI_CONF_SIZE)
 		return;
 
-	*((u_long *)(pci_conf_addr + pci_config_offset(tag) + reg))
-		= bswap32(data);
+	*((uint32_t *)(pci_conf_addr + pci_config_offset(tag) + reg))
+	= bswap32(data);
 }
 
 /*
@@ -105,13 +108,13 @@ pci_conf_write(pci_chipset_tag_t pc, pci
  */
 static pci_intr_info_t iinfo[4] = { { -1 }, { -1 }, { -1 }, { -1 } };
 
-static int	iifun(int, int);
+static int iifun(int, int);
 
 static int
 iifun(int slot, int sr)
 {
 	pci_intr_info_t *iinfo_p;
-	int		s;
+	int s;
 
 	iinfo_p = [slot];
 
@@ -125,10 +128,9 @@ iifun(int slot, int sr)
 		 * We're running at a too high priority now.
 		 */
 		add_sicallback((si_farg)iifun, (void*)slot, 0);
-	}
-	else {
+	} else {
 		s = splx(iinfo_p->ipl);
-		(void) (iinfo_p->ifunc)(iinfo_p->iarg);
+		(void)(iinfo_p->ifunc)(iinfo_p->iarg);
 		splx(s);
 
 		/*
@@ -141,7 +143,7 @@ iifun(int slot, int sr)
 
 int
 pci_intr_setattr(pci_chipset_tag_t pc, pci_intr_handle_t *ih,
-		 int attr, uint64_t data)
+int attr, uint64_t data)
 {
 
 	switch (attr) {
@@ -153,20 +155,21 @@ pci_intr_setattr(pci_chipset_tag_t pc, p
 }
 
 void *
-pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level, int (*ih_fun)(void *), void *ih_arg)
+pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
+int (*ih_fun)(void *), void *ih_arg)
 {
 	pci_intr_info_t *iinfo_p;
 	struct intrhand	*ihand;
-	int		slot;
+	int slot;
 
 	slot= ih;
 	iinfo_p = [slot];
 
 	if (iinfo_p->ipl > 0)
-	panic("pci_intr_establish: interrupt was already established");
+		panic("pci_intr_establish: interrupt was already established");
 
 	ihand = intr_establish((slot == 3) ? 23 : 16 + slot, USER_VEC, 0,
-(hw_ifun_t)iifun, (void *)slot);
+	(hw_ifun_t)iifun, (void *)slot);
 	if (ihand != NULL) {
 		iinfo_p->ipl   = level;
 		iinfo_p->imask = (slot == 3) ? 0x80 : (0x01 << slot);
@@ -179,7 +182,7 @@ pci_intr_establish(pci_chipset_tag_t pc,
 		 */
 		MFP2->mf_imrb |= iinfo_p->imask;
 		MFP2->mf_ierb |= iinfo_p->imask;
-		return(iinfo_p);
+		return iinfo_p;
 	}
 	return NULL;
 }
@@ -190,11 +193,11 @@ pci_intr_disestablish(pci_chipset_tag_t 
 	pci_intr_info_t *iinfo_p = (pci_intr_info_t *)cookie;
 
 	if (iinfo->ipl < 0)
-	panic("pci_intr_disestablish: interrupt was not 

CVS commit: src/sys/arch/atari/pci

2019-05-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May  4 08:20:06 UTC 2019

Modified Files:
src/sys/arch/atari/pci: pci_hades.c pci_machdep.c pci_milan.c
pci_tseng.c pci_vga.c pci_vga.h pciide_machdep.c

Log Message:
Misc KNF.

No binary changes on HADES and MILAN-PCIIDE kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/atari/pci/pci_hades.c \
src/sys/arch/atari/pci/pci_vga.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/atari/pci/pci_machdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/pci/pci_milan.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/atari/pci/pci_tseng.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/atari/pci/pci_vga.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/atari/pci/pciide_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/atari/pci

2018-02-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  9 15:24:35 UTC 2018

Modified Files:
src/sys/arch/atari/pci: pci_machdep.c

Log Message:
On Milan, also explicitly disable MBIRQ1 on PIIX.

Milan's ROM bootloader v1.2 and v1.4 incorrectly set MBIRQ0 connected
to the secondary IDE to IRQ14 (not 15) and unused MBIRQ1 to IRQ15,
so both IDE channels don't work properly.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/atari/pci/pci_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/pci/pci_machdep.c
diff -u src/sys/arch/atari/pci/pci_machdep.c:1.55 src/sys/arch/atari/pci/pci_machdep.c:1.56
--- src/sys/arch/atari/pci/pci_machdep.c:1.55	Wed Jan 31 15:36:29 2018
+++ src/sys/arch/atari/pci/pci_machdep.c	Fri Feb  9 15:24:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.55 2018/01/31 15:36:29 tsutsui Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.56 2018/02/09 15:24:35 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.55 2018/01/31 15:36:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.56 2018/02/09 15:24:35 tsutsui Exp $");
 
 #include "opt_mbtype.h"
 
@@ -454,10 +454,15 @@ enable_pci_devices(void)
 #define PIIX_PCIB_MBIRQ0	0x70
 	if ((PCI_VENDOR(id) == PCI_VENDOR_INTEL) &&
 	(PCI_PRODUCT(id) == PCI_PRODUCT_INTEL_82371FB_ISA)) {
-		/* Set Interrupt Routing for MBIRQ0 to IRQ15 */
+		/*
+		 * Set Interrupt Routing for MBIRQ0 to IRQ15.
+		 * Note Milan's ROM bootloader v1.2 and v1.4 incorrectly
+		 * set MBIRQ0 to IRQ14 (not 15) and unused MBIRQ1 to IRQ 15,
+		 * so explicitly disable MBIRQ1.
+		 */
 		csr = pci_conf_read(pc, tag, PIIX_PCIB_MBIRQ0);
-		csr &= ~0x0ff;
-		csr |=  0x00f;	/* IRQ15 */
+		csr &= ~0x000;
+		csr |=  0x000800f;	/* MBIRQ1: disable, MBIRQ0: IRQ15 */
 		pci_conf_write(pc, tag, PIIX_PCIB_MBIRQ0, csr);
 #ifdef DEBUG_PCI_MACHDEP
 		printf("\npcib0: enable and route MBIRQ0 to irq 15\n");



CVS commit: src/sys/arch/atari/pci

2018-02-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  9 15:24:35 UTC 2018

Modified Files:
src/sys/arch/atari/pci: pci_machdep.c

Log Message:
On Milan, also explicitly disable MBIRQ1 on PIIX.

Milan's ROM bootloader v1.2 and v1.4 incorrectly set MBIRQ0 connected
to the secondary IDE to IRQ14 (not 15) and unused MBIRQ1 to IRQ15,
so both IDE channels don't work properly.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/atari/pci/pci_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/atari/pci

2018-01-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jan 31 15:36:29 UTC 2018

Modified Files:
src/sys/arch/atari/pci: pci_machdep.c

Log Message:
Explicitly setup the secondary IDE interrupt of PIIX on Milan.

The secondary IDE interrupt is connected to MBIRQ0 on PIIX, but
the Milan's ROM bootloader (at least version 0.99.7) doesn't seem
to setup the MBIRQ0 register to route it to IRQ15.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/atari/pci/pci_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/atari/pci

2018-01-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jan 31 15:36:29 UTC 2018

Modified Files:
src/sys/arch/atari/pci: pci_machdep.c

Log Message:
Explicitly setup the secondary IDE interrupt of PIIX on Milan.

The secondary IDE interrupt is connected to MBIRQ0 on PIIX, but
the Milan's ROM bootloader (at least version 0.99.7) doesn't seem
to setup the MBIRQ0 register to route it to IRQ15.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/atari/pci/pci_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/pci/pci_machdep.c
diff -u src/sys/arch/atari/pci/pci_machdep.c:1.54 src/sys/arch/atari/pci/pci_machdep.c:1.55
--- src/sys/arch/atari/pci/pci_machdep.c:1.54	Sat Mar 29 19:28:26 2014
+++ src/sys/arch/atari/pci/pci_machdep.c	Wed Jan 31 15:36:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.54 2014/03/29 19:28:26 christos Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.55 2018/01/31 15:36:29 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.54 2014/03/29 19:28:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.55 2018/01/31 15:36:29 tsutsui Exp $");
 
 #include "opt_mbtype.h"
 
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -449,6 +450,19 @@ enable_pci_devices(void)
 	/*
 	 * On the Milan, we accept the BIOS's choice.
 	 */
+	/* ..except the secondary IDE interrupt that the BIOS doesn't setup. */
+#define PIIX_PCIB_MBIRQ0	0x70
+	if ((PCI_VENDOR(id) == PCI_VENDOR_INTEL) &&
+	(PCI_PRODUCT(id) == PCI_PRODUCT_INTEL_82371FB_ISA)) {
+		/* Set Interrupt Routing for MBIRQ0 to IRQ15 */
+		csr = pci_conf_read(pc, tag, PIIX_PCIB_MBIRQ0);
+		csr &= ~0x0ff;
+		csr |=  0x00f;	/* IRQ15 */
+		pci_conf_write(pc, tag, PIIX_PCIB_MBIRQ0, csr);
+#ifdef DEBUG_PCI_MACHDEP
+		printf("\npcib0: enable and route MBIRQ0 to irq 15\n");
+#endif
+	}
 #endif
 }
 



CVS commit: src/sys/arch/atari/pci

2018-01-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jan 28 14:22:23 UTC 2018

Modified Files:
src/sys/arch/atari/pci: pci_milan.c

Log Message:
Replace CRTC register values with ones taken from sys/dev/ic/vga_subr.c.

This fixes noise around column 3 and 4 and makes screen output clearer
on Milan with S3 Trio64V.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/atari/pci/pci_milan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/atari/pci

2018-01-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jan 28 14:22:23 UTC 2018

Modified Files:
src/sys/arch/atari/pci: pci_milan.c

Log Message:
Replace CRTC register values with ones taken from sys/dev/ic/vga_subr.c.

This fixes noise around column 3 and 4 and makes screen output clearer
on Milan with S3 Trio64V.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/atari/pci/pci_milan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/pci/pci_milan.c
diff -u src/sys/arch/atari/pci/pci_milan.c:1.14 src/sys/arch/atari/pci/pci_milan.c:1.15
--- src/sys/arch/atari/pci/pci_milan.c:1.14	Fri Oct  2 05:22:50 2015
+++ src/sys/arch/atari/pci/pci_milan.c	Sun Jan 28 14:22:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_milan.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $	*/
+/*	$NetBSD: pci_milan.c,v 1.15 2018/01/28 14:22:23 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_milan.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_milan.c,v 1.15 2018/01/28 14:22:23 tsutsui Exp $");
 
 #include 
 #include 
@@ -120,19 +120,41 @@ pci_intr_disestablish(pci_chipset_tag_t 
 
 /*
  * VGA related stuff...
- * XXX: Currently, you can only boot the Milan through loadbsd.ttp, hence the
- *  text mode ;-)
+ *  
  * It looks like the Milan BIOS is initializing the VGA card in a reasonably
  * standard text mode. However, the screen mode is 640*480 instead of 640*400.
  * Since wscons does not handle the right by default, the card is reprogrammed
  * to 640*400 using only 'standard' VGA registers (I hope!). So this ought to
  * work on cards other than the S3Trio card I have tested it on.
  */
-static u_char crt_tab[] = {
-	0x60, 0x53, 0x4f, 0x14, 0x56, 0x05, 0xc1, 0x1f,
-	0x00, 0x4f, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00,
-	0x98, 0x3d, 0x8f, 0x28, 0x0f, 0x8f, 0xc1, 0xc3,
-	0xff };
+static const uint8_t crt_tab[] = {
+	/* taken from vga_crtc[] in sys/dev/ic/vga_subr.c */
+	0x5f,	/* 00: horizontal total */
+	0x4f,	/* 01: horizontal display-enable end */
+	0x50,	/* 02: start horizontal blanking */
+	0x82,	/* 03: display skew control / end horizontal blanking */
+	0x55,	/* 04: start horizontal retrace pulse */
+	0x81,	/* 05: horizontal retrace delay / end horizontal retrace */
+	0xbf,	/* 06: vertical total */
+	0x1f,	/* 07: overflow register */
+	0x00,	/* 08: preset row scan */
+	0x4f,	/* 09: overflow / maximum scan line */
+	0x0d,	/* 0A: cursor off / cursor start */
+	0x0e,	/* 0B: cursor skew / cursor end */
+	0x00,	/* 0C: start regenerative buffer address high */
+	0x00,	/* 0D: start regenerative buffer address low */
+	0x00,	/* 0E: cursor location high */
+	0x00,	/* 0F: cursor location low */
+	0x9c,	/* 10: vertical retrace start */
+	0x8e,	/* 11: vertical interrupt / vertical retrace end */
+	0x8f,	/* 12: vertical display enable end */
+	0x28,	/* 13: logical line width */
+	0x00,	/* 14: underline location */
+	0x96,	/* 15: start vertical blanking */
+	0xb9,	/* 16: end vertical blanking */
+	0xa3,	/* 17: CRT mode control */
+	0xff	/* 18: line compare */
+};
 
 /*
  * XXX: Why are we repeating this everywhere! (Leo)



CVS commit: src/sys/arch/atari/pci

2012-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug 12 20:50:39 UTC 2012

Modified Files:
src/sys/arch/atari/pci: pci_milan.c

Log Message:
Add a missing extern to apeas -fno-common.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/atari/pci/pci_milan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/pci/pci_milan.c
diff -u src/sys/arch/atari/pci/pci_milan.c:1.12 src/sys/arch/atari/pci/pci_milan.c:1.13
--- src/sys/arch/atari/pci/pci_milan.c:1.12	Mon Mar 16 23:11:10 2009
+++ src/sys/arch/atari/pci/pci_milan.c	Sun Aug 12 20:50:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_milan.c,v 1.12 2009/03/16 23:11:10 dsl Exp $	*/
+/*	$NetBSD: pci_milan.c,v 1.13 2012/08/12 20:50:39 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_milan.c,v 1.12 2009/03/16 23:11:10 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_milan.c,v 1.13 2012/08/12 20:50:39 martin Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -60,7 +60,7 @@ pci_bus_maxdevs(pci_chipset_tag_t pc, in
  */
 pcireg_t	milan_pci_confread(pcitag_t);
 void		milan_pci_confwrite(u_long, pcireg_t);
-u_long		plx_status;
+extern u_long	plx_status;
 
 pcireg_t
 pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)



CVS commit: src/sys/arch/atari/pci

2012-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug 12 20:50:39 UTC 2012

Modified Files:
src/sys/arch/atari/pci: pci_milan.c

Log Message:
Add a missing extern to apeas -fno-common.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/atari/pci/pci_milan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.