Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/atari/pci Add Milan console initialisation code.



details:   https://anonhg.NetBSD.org/src/rev/bef89304eb26
branches:  trunk
changeset: 510407:bef89304eb26
user:      leo <leo%NetBSD.org@localhost>
date:      Mon May 28 08:30:03 2001 +0000

description:
Add Milan console initialisation code.

diffstat:

 sys/arch/atari/pci/pci_milan.c |  57 +++++++++++++++++++++++++++++++++++++++++-
 sys/arch/atari/pci/pci_vga.c   |   8 +++++-
 2 files changed, 63 insertions(+), 2 deletions(-)

diffs (104 lines):

diff -r 61c8c5c9303e -r bef89304eb26 sys/arch/atari/pci/pci_milan.c
--- a/sys/arch/atari/pci/pci_milan.c    Mon May 28 08:12:47 2001 +0000
+++ b/sys/arch/atari/pci/pci_milan.c    Mon May 28 08:30:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_milan.c,v 1.1 2001/05/15 14:14:49 leo Exp $        */
+/*     $NetBSD: pci_milan.c,v 1.2 2001/05/28 08:30:03 leo Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -46,6 +46,9 @@
 
 #include <machine/bswap.h>
 
+#include <atari/pci/pci_vga.h>
+#include <atari/dev/grf_etreg.h>
+
 int
 pci_bus_maxdevs(pc, busno)
        pci_chipset_tag_t pc;
@@ -108,3 +111,55 @@
        void *cookie;
 {
 }
+
+/*
+ * 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 };
+
+/*
+ * XXX: Why are we repeating this everywhere! (Leo)
+ */
+#define PCI_LINMEMBASE  0x0e000000
+
+void
+milan_vga_init(pc, tag, id, ba, fb)
+       pci_chipset_tag_t       pc;
+       pcitag_t                tag;
+       int                     id;
+       volatile u_char         *ba;
+       u_char                  *fb;
+{
+       int                     i, csr;
+
+       /* Turn on the card */
+       pci_conf_write(pc, tag, PCI_MAPREG_START, PCI_LINMEMBASE);
+       csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
+       csr |= (PCI_COMMAND_MEM_ENABLE|PCI_COMMAND_IO_ENABLE);
+       csr |= PCI_COMMAND_MASTER_ENABLE;
+       pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
+
+       /*
+        * Make sure we're allowed to write all crt-registers and reload them.
+        */
+       WCrt(ba, CRT_ID_END_VER_RETR, (RCrt(ba, CRT_ID_END_VER_RETR) & 0x7f));
+
+       for (i = 0; i < 0x18; i++)
+               WCrt(ba, i, crt_tab[i]);
+
+       /*
+        * The Milan has a white border... make it black
+        */
+       WAttr(ba, 0x11, 0|0x20);
+}
diff -r 61c8c5c9303e -r bef89304eb26 sys/arch/atari/pci/pci_vga.c
--- a/sys/arch/atari/pci/pci_vga.c      Mon May 28 08:12:47 2001 +0000
+++ b/sys/arch/atari/pci/pci_vga.c      Mon May 28 08:30:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_vga.c,v 1.4 2001/05/28 08:12:48 leo Exp $  */
+/*     $NetBSD: pci_vga.c,v 1.5 2001/05/28 08:30:03 leo Exp $  */
 
 /*
  * Copyright (c) 1999 Leo Weppelman.  All rights reserved.
@@ -128,6 +128,11 @@
                if (i == 0)
                        continue;
 
+#if _MILANHW_
+               /* Don't need to be more specific */
+               milan_vga_init(pc, tag, id, regs, fb);
+               found = 1;
+#else
                switch (id = PCI_PRODUCT(id)) {
 
                        /*
@@ -145,6 +150,7 @@
                        default:
                                break;
                }
+#endif /* _MILANHW_ */
        }
        if (!found)
                goto bad;



Home | Main Index | Thread Index | Old Index