summaryrefslogtreecommitdiffstats
path: root/drivers/sbus
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-05-07 02:55:41 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-05-07 02:55:41 +0000
commitdcec8a13bf565e47942a1751a9cec21bec5648fe (patch)
tree548b69625b18cc2e88c3e68d0923be546c9ebb03 /drivers/sbus
parent2e0f55e79c49509b7ff70ff1a10e1e9e90a3dfd4 (diff)
o Merge with Linux 2.1.99.
o Fix ancient bug in the ELF loader making ldd crash. o Fix ancient bug in the keyboard code for SGI, SNI and Jazz.
Diffstat (limited to 'drivers/sbus')
-rw-r--r--drivers/sbus/char/Makefile8
-rw-r--r--drivers/sbus/char/bwtwo.c11
-rw-r--r--drivers/sbus/char/cgfourteen.c5
-rw-r--r--drivers/sbus/char/cgsix.c8
-rw-r--r--drivers/sbus/char/cgthree.c5
-rw-r--r--drivers/sbus/char/creator.c7
-rw-r--r--drivers/sbus/char/envctrl.c241
-rw-r--r--drivers/sbus/char/flash.c6
-rw-r--r--drivers/sbus/char/leo.c5
-rw-r--r--drivers/sbus/char/mach64.c75
-rw-r--r--drivers/sbus/char/mach64.h15
-rw-r--r--drivers/sbus/char/pcicons.c48
-rw-r--r--drivers/sbus/char/pcikbd.c23
-rw-r--r--drivers/sbus/char/sab82532.c109
-rw-r--r--drivers/sbus/char/sbuscons.c105
-rw-r--r--drivers/sbus/char/su.c36
-rw-r--r--drivers/sbus/char/suncons.c11
-rw-r--r--drivers/sbus/char/sunkbd.c1
-rw-r--r--drivers/sbus/char/tcx.c12
-rw-r--r--drivers/sbus/char/vfc_dev.c3
-rw-r--r--drivers/sbus/char/weitek.c5
-rw-r--r--drivers/sbus/char/zs.c55
-rw-r--r--drivers/sbus/dvma.c130
-rw-r--r--drivers/sbus/sbus.c91
24 files changed, 741 insertions, 274 deletions
diff --git a/drivers/sbus/char/Makefile b/drivers/sbus/char/Makefile
index 5251d5090..84253cf03 100644
--- a/drivers/sbus/char/Makefile
+++ b/drivers/sbus/char/Makefile
@@ -68,6 +68,14 @@ else
endif
endif
+ifeq ($(CONFIG_ENVCTRL),y)
+O_OBJS += envctrl.o
+else
+ ifeq ($(CONFIG_ENVCTRL),m)
+ M_OBJS += envctrl.o
+ endif
+endif
+
endif # eq($(CONFIG_PCI,y)
ifeq ($(CONFIG_OBP_FLASH),y)
diff --git a/drivers/sbus/char/bwtwo.c b/drivers/sbus/char/bwtwo.c
index 615fef33d..c8b8a04d7 100644
--- a/drivers/sbus/char/bwtwo.c
+++ b/drivers/sbus/char/bwtwo.c
@@ -1,10 +1,12 @@
-/* $Id: bwtwo.c,v 1.18 1997/07/17 02:21:43 davem Exp $
+/* $Id: bwtwo.c,v 1.20 1998/03/10 20:18:22 jj Exp $
* bwtwo.c: bwtwo console driver
*
* Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
+ * Copyright (C) 1998 Pavel Machek (pavel@ucw.cz)
*/
+#include <linux/config.h>
#include <linux/kd.h>
#include <linux/tty.h>
#include <linux/malloc.h>
@@ -95,7 +97,8 @@ bwtwo_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma,
if (r)
return -EAGAIN;
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
@@ -156,15 +159,17 @@ __initfunc(void bwtwo_setup (fbinfo_t *fb, int slot, u32 bwtwo, int bw2_io,
fb->loadcmap = 0;
fb->ioctl = 0;
fb->reset = 0;
+#ifndef CONFIG_SUN4
fb->blank = bwtwo_blank;
fb->unblank = bwtwo_unblank;
+#endif
fb->info.bwtwo.regs =
sparc_alloc_io (bwtwo + BWTWO_REGISTER_OFFSET,
0, sizeof (struct bwtwo_regs),
"bwtwo_regs", bw2_io, 0);
- if (!prom_getbool(sbdp->prom_node, "width")) {
+ if (sbdp && !prom_getbool(sbdp->prom_node, "width")) {
/* Ugh, broken PROM didn't initialize us.
* Let's deal with this ourselves.
*/
diff --git a/drivers/sbus/char/cgfourteen.c b/drivers/sbus/char/cgfourteen.c
index dbe071b98..315d9561f 100644
--- a/drivers/sbus/char/cgfourteen.c
+++ b/drivers/sbus/char/cgfourteen.c
@@ -1,4 +1,4 @@
-/* $Id: cgfourteen.c,v 1.25 1997/08/20 07:38:36 davem Exp $
+/* $Id: cgfourteen.c,v 1.26 1998/03/10 20:18:23 jj Exp $
* cgfourteen.c: Sun SparcStation console support.
*
* Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
@@ -274,7 +274,8 @@ cg14_mmap (struct inode *inode, struct file *file,
page += map_size;
}
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
diff --git a/drivers/sbus/char/cgsix.c b/drivers/sbus/char/cgsix.c
index 4c24a8c0b..ca328ee53 100644
--- a/drivers/sbus/char/cgsix.c
+++ b/drivers/sbus/char/cgsix.c
@@ -1,4 +1,4 @@
-/* $Id: cgsix.c,v 1.37 1997/08/22 15:55:20 jj Exp $
+/* $Id: cgsix.c,v 1.39 1998/03/10 20:18:25 jj Exp $
* cgsix.c: cgsix frame buffer driver
*
* Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
@@ -326,7 +326,8 @@ cg6_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma,
page += map_size;
}
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
@@ -395,11 +396,14 @@ static void
cg6_blank (fbinfo_t *fb)
{
fb->info.cg6.thc->thc_misc &= ~CG6_THC_MISC_VIDEO;
+ /* This should put us in power-save */
+ fb->info.cg6.thc->thc_misc &= ~CG6_THC_MISC_SYNC_ENAB;
}
static void
cg6_unblank (fbinfo_t *fb)
{
+ fb->info.cg6.thc->thc_misc |= CG6_THC_MISC_SYNC_ENAB;
fb->info.cg6.thc->thc_misc |= CG6_THC_MISC_VIDEO;
}
diff --git a/drivers/sbus/char/cgthree.c b/drivers/sbus/char/cgthree.c
index 95d8a07f4..568ae99bf 100644
--- a/drivers/sbus/char/cgthree.c
+++ b/drivers/sbus/char/cgthree.c
@@ -1,4 +1,4 @@
-/* $Id: cgthree.c,v 1.24 1997/08/20 07:38:37 davem Exp $
+/* $Id: cgthree.c,v 1.25 1998/03/10 20:18:27 jj Exp $
* cgtree.c: cg3 frame buffer driver
*
* Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
@@ -133,7 +133,8 @@ cg3_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma,
page += map_size;
}
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
diff --git a/drivers/sbus/char/creator.c b/drivers/sbus/char/creator.c
index 8b6ddf40f..c7935f713 100644
--- a/drivers/sbus/char/creator.c
+++ b/drivers/sbus/char/creator.c
@@ -1,4 +1,4 @@
-/* $Id: creator.c,v 1.13 1997/10/17 04:14:40 davem Exp $
+/* $Id: creator.c,v 1.14 1998/03/10 20:18:32 jj Exp $
* creator.c: Creator/Creator3D frame buffer driver
*
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -244,7 +244,8 @@ ffb_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma,
page += map_size;
}
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
@@ -702,8 +703,8 @@ static void ffb_fill(int attrib, int count, int *boxes)
while (count-- > 0) {
ffb->by = boxes[1];
ffb->bx = boxes[0];
- ffb->bw = boxes[2];
ffb->bh = boxes[3];
+ ffb->bw = boxes[2];
boxes += 4;
}
FFB_FILL_END
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
new file mode 100644
index 000000000..be5bafb07
--- /dev/null
+++ b/drivers/sbus/char/envctrl.c
@@ -0,0 +1,241 @@
+/* $Id: envctrl.c,v 1.3 1998/04/10 08:42:24 jj Exp $
+ * envctrl.c: Temperature and Fan monitoring on Machines providing it.
+ *
+ * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/delay.h>
+#include <linux/ioport.h>
+#include <linux/init.h>
+
+#include <asm/ebus.h>
+
+#define PCF8584_ADDRESS 0x55
+
+#define CONTROL_PIN 0x80
+#define CONTROL_ES0 0x40
+#define CONTROL_ES1 0x20
+#define CONTROL_ES2 0x10
+#define CONTROL_ENI 0x08
+#define CONTROL_STA 0x04
+#define CONTROL_STO 0x02
+#define CONTROL_ACK 0x01
+
+#define STATUS_PIN 0x80
+#define STATUS_STS 0x20
+#define STATUS_BER 0x10
+#define STATUS_LRB 0x08
+#define STATUS_AD0 0x08
+#define STATUS_AAB 0x04
+#define STATUS_LAB 0x02
+#define STATUS_BB 0x01
+
+/*
+ * CLK Mode Register.
+ */
+#define BUS_CLK_90 0x00
+#define BUS_CLK_45 0x01
+#define BUS_CLK_11 0x02
+#define BUS_CLK_1_5 0x03
+
+#define CLK_3 0x00
+#define CLK_4_43 0x10
+#define CLK_6 0x14
+#define CLK_8 0x18
+#define CLK_12 0x1c
+
+
+#define I2C_WRITE 0x00
+#define I2C_READ 0x01
+
+struct pcf8584_reg
+{
+ __volatile__ unsigned char data;
+ __volatile__ unsigned char csr;
+};
+
+static struct pcf8584_reg *i2c;
+
+
+struct i2c_addr_map {
+ unsigned char addr;
+ unsigned char mask;
+ char *name;
+};
+
+static struct i2c_addr_map devmap[] = {
+ { 0x38, 0x78, "PCF8574A" },
+ { 0x20, 0x78, "TDA8444" },
+ { 0x48, 0x78, "PCF8591" },
+};
+#define NR_DEVMAP (sizeof(devmap) / sizeof(devmap[0]))
+
+static int
+envctrl_read(unsigned char dev, char *buffer, int len)
+{
+ unsigned char dummy;
+ unsigned char stat;
+ int error = -ENODEV;
+ int count = -1;
+
+ if (len == 0)
+ return 0;
+
+ i2c->data = (dev << 1) | I2C_READ;
+
+ while (!(i2c->csr & STATUS_BB))
+ udelay(1);
+
+ i2c->csr = CONTROL_PIN | CONTROL_ES0 | CONTROL_STA | CONTROL_ACK;
+
+ do {
+ udelay(1);
+ while ((stat = i2c->csr) & STATUS_PIN)
+ udelay(1);
+
+ if (stat & STATUS_LRB)
+ goto stop;
+ error = 0;
+ if (count == (len - 2))
+ goto final;
+
+ if (++count > 0)
+ *buffer++ = i2c->data;
+ else
+ dummy = i2c->data;
+ } while (1);
+
+final:
+ i2c->csr = CONTROL_ES0;
+ if (++count > 0)
+ *buffer++ = i2c->data;
+ else
+ dummy = i2c->data;
+
+ udelay(1);
+ while ((stat = i2c->csr) & STATUS_PIN)
+ udelay(1);
+
+stop:
+ i2c->csr = CONTROL_PIN | CONTROL_ES0 | CONTROL_STO | CONTROL_ACK;
+ if (++count > 0)
+ *buffer++ = i2c->data;
+ else
+ dummy = i2c->data;
+
+ if (error)
+ return error;
+ return count;
+}
+
+static int
+envctrl_write(unsigned char dev, char *buffer, int len)
+{
+ int error = -ENODEV;
+ int count = 0;
+
+ while (!(i2c->csr & STATUS_BB))
+ udelay(1);
+
+ i2c->data = (dev << 1) | I2C_WRITE;
+ i2c->csr = CONTROL_PIN | CONTROL_ES0 | CONTROL_STA | CONTROL_ACK;
+
+ do {
+ unsigned char stat;
+
+ udelay(1);
+ while ((stat = i2c->csr) & STATUS_PIN)
+ udelay(1);
+
+ if (stat & STATUS_LRB)
+ goto stop;
+ error = count;
+ if (count == len)
+ goto stop;
+
+ i2c->data = *buffer++;
+ count++;
+ } while (1);
+
+stop:
+ i2c->csr = CONTROL_PIN | CONTROL_ES0 | CONTROL_STO | CONTROL_ACK;
+ return error;
+}
+
+__initfunc(static int scan_bus(void))
+{
+ unsigned char dev;
+ int count = 0;
+ int i;
+
+ /* scan */
+ for (dev = 1; dev < 128; dev++)
+ if (envctrl_write(dev, 0, 0) == 0) {
+ for (i = 0; i < NR_DEVMAP; i++)
+ if ((dev & devmap[i].mask) == devmap[i].addr)
+ break;
+ printk("envctrl: i2c device at %02x: %s\n", dev,
+ i < NR_DEVMAP ? devmap[i].name : "unknown");
+{
+ unsigned char buf[4];
+ if (envctrl_read(dev, buf, 4) == 4)
+ printk("envctrl: read %02x %02x %02x %02x\n",
+ buf[0], buf[1], buf[2], buf[3]);
+}
+ count++;
+ }
+ return count ? 0 : -ENODEV;
+}
+
+#ifdef MODULE
+int init_module(void)
+#else
+__initfunc(int envctrl_init(void))
+#endif
+{
+#ifdef CONFIG_PCI
+ struct linux_ebus *ebus;
+ struct linux_ebus_device *edev;
+
+ for_all_ebusdev(edev, ebus)
+ if (!strcmp(edev->prom_name, "SUNW,envctrl"))
+ break;
+
+ if (!edev)
+ return -ENODEV;
+
+ if (check_region(edev->base_address[0], sizeof(*i2c))) {
+ prom_printf("%s: Can't get region %lx, %d\n",
+ __FUNCTION__, edev->base_address[0],
+ sizeof(*i2c));
+ prom_halt();
+ }
+
+ request_region(edev->base_address[0],
+ sizeof(*i2c), "i2c");
+
+ i2c = (struct pcf8584_reg *)edev->base_address[0];
+
+ i2c->csr = CONTROL_PIN;
+ i2c->data = PCF8584_ADDRESS;
+ i2c->csr = CONTROL_PIN | CONTROL_ES1;
+ i2c->data = CLK_4_43 | BUS_CLK_90;
+ i2c->csr = CONTROL_PIN | CONTROL_ES0 | CONTROL_ACK;
+ udelay(10000);
+
+ return scan_bus();
+#else
+ return -ENODEV;
+#endif
+}
+
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+}
+#endif
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index ba67381a0..435a0f57b 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -1,4 +1,4 @@
-/* $Id: flash.c,v 1.5 1997/11/01 10:22:13 ecd Exp $
+/* $Id: flash.c,v 1.7 1998/03/10 20:19:05 jj Exp $
* flash.c: Allow mmap access to the OBP Flash, for OBP updates.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
@@ -71,7 +71,9 @@ flash_mmap(struct file *file, struct vm_area_struct *vma)
if (remap_page_range(vma->vm_start, addr, size, vma->vm_page_prot))
return -EAGAIN;
- vma->vm_dentry = dget(file->f_dentry);
+
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
diff --git a/drivers/sbus/char/leo.c b/drivers/sbus/char/leo.c
index e08cf1822..fcbbd3e53 100644
--- a/drivers/sbus/char/leo.c
+++ b/drivers/sbus/char/leo.c
@@ -1,4 +1,4 @@
-/* $Id: leo.c,v 1.25 1997/08/22 17:33:58 jj Exp $
+/* $Id: leo.c,v 1.26 1998/03/10 20:18:29 jj Exp $
* leo.c: SUNW,leo 24/8bit frame buffer driver
*
* Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -224,7 +224,8 @@ leo_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma,
page += map_size;
}
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
diff --git a/drivers/sbus/char/mach64.c b/drivers/sbus/char/mach64.c
index 05ed175d3..fcce8887d 100644
--- a/drivers/sbus/char/mach64.c
+++ b/drivers/sbus/char/mach64.c
@@ -1,4 +1,4 @@
-/* $Id: mach64.c,v 1.11 1997/10/17 04:13:35 davem Exp $
+/* $Id: mach64.c,v 1.17 1998/04/06 06:42:23 davem Exp $
* mach64.c: Ultra/PCI Mach64 console driver.
*
* Just about all of this is from the PPC/mac driver, see that for
@@ -12,7 +12,6 @@
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
-#include <linux/bios32.h>
#include <linux/string.h>
#include <linux/tty.h>
#include <linux/console.h>
@@ -81,8 +80,8 @@ mach64_mmap(struct inode *inode, struct file *file, struct vm_area_struct *vma,
if (vma->vm_offset & ~PAGE_MASK)
return -ENXIO;
- if (vma->vm_offset == mach64_pci_iobase) {
- addr = __pa(pcivga_iobase);
+ if (vma->vm_offset == (mach64_pci_iobase & PAGE_MASK)) {
+ addr = __pa((pcivga_iobase & PAGE_MASK));
size = PAGE_SIZE;
} else if (vma->vm_offset >= (mach64_pci_membase + 0x800000)) {
addr = __pa(pcivga_membase) - mach64_pci_membase
@@ -102,7 +101,8 @@ mach64_mmap(struct inode *inode, struct file *file, struct vm_area_struct *vma,
if (remap_page_range(vma->vm_start, addr, size, vma->vm_page_prot))
return -EAGAIN;
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
@@ -123,6 +123,7 @@ mach64_loadcmap(fbinfo_t *fb, int index, int count)
pcivga_writeb(fb->color_map CM(i, 1), MACH64_REGOFF + DAC_DATA);
pcivga_writeb(fb->color_map CM(i, 2), MACH64_REGOFF + DAC_DATA);
}
+ mach64_idle();
}
static void
@@ -172,11 +173,11 @@ int mach64_init(fbinfo_t *fb)
unsigned int tmp;
memset(&mach64, 0, sizeof(mach64));
- for(pdev = pci_devices; pdev; pdev = pdev->next) {
- if((pdev->vendor == PCI_VENDOR_ID_ATI) &&
- (pdev->device == PCI_DEVICE_ID_ATI_264VT))
- break;
- }
+
+ pdev = pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_264VT, 0);
+ if(!pdev)
+ pdev = pci_find_device(PCI_VENDOR_ID_ATI,
+ PCI_DEVICE_ID_ATI_215GT, 0);
if(!pdev)
return -1;
@@ -222,15 +223,15 @@ int mach64_init(fbinfo_t *fb)
fb->info.private = (void *)&mach64;
fb->base = pcivga_membase + MACH64_BE_FBOFF;
- if ((pcivga_readl(MACH64_REGOFF + CONFIG_CHIP_ID)
- & CFG_CHIP_TYPE) == MACH64_VT_ID)
- mach64.flags |= MACH64_MASK_VT;
+ mach64.chip_type = pcivga_readl(MACH64_REGOFF + CONFIG_CHIP_ID)
+ & CFG_CHIP_TYPE;
- /*
- * Fix the PROM's idea of MEM_CNTL settings...
- */
- tmp = pcivga_readl(MACH64_REGOFF + MEM_CNTL);
- switch (tmp & 0xf) {
+ if (mach64.chip_type == MACH64_VT_ID) {
+ /*
+ * Fix the PROM's idea of MEM_CNTL settings...
+ */
+ tmp = pcivga_readl(MACH64_REGOFF + MEM_CNTL);
+ switch (tmp & 0xf) {
case 3:
tmp = (tmp & ~(0xf)) | 2;
break;
@@ -245,11 +246,14 @@ int mach64_init(fbinfo_t *fb)
break;
default:
break;
+ }
+ tmp &= ~(0x00f00000);
+ pcivga_writel(tmp, MACH64_REGOFF + MEM_CNTL);
}
- tmp &= ~(0x00f00000);
- pcivga_writel(tmp, MACH64_REGOFF + MEM_CNTL);
- switch(tmp & MEM_SIZE_ALIAS) {
+ tmp = pcivga_readl(MACH64_REGOFF + MEM_CNTL);
+ if (mach64.chip_type != MACH64_GT_ID) {
+ switch(tmp & MEM_SIZE_ALIAS) {
case MEM_SIZE_512K:
mach64.total_vram = 0x80000;
break;
@@ -271,10 +275,35 @@ int mach64_init(fbinfo_t *fb)
default:
mach64.total_vram = 0x80000;
break;
+ }
+ } else {
+ switch(tmp & MEM_SIZE_ALIAS_GTB) {
+ case MEM_SIZE_512K_GTB:
+ mach64.total_vram = 0x80000;
+ break;
+ case MEM_SIZE_1M_GTB:
+ mach64.total_vram = 0x100000;
+ break;
+ case MEM_SIZE_2M_GTB:
+ mach64.total_vram = 0x200000;
+ break;
+ case MEM_SIZE_4M_GTB:
+ mach64.total_vram = 0x400000;
+ break;
+ case MEM_SIZE_6M_GTB:
+ mach64.total_vram = 0x600000;
+ break;
+ case MEM_SIZE_8M_GTB:
+ mach64.total_vram = 0x800000;
+ break;
+ default:
+ mach64.total_vram = 0x80000;
+ break;
+ }
}
- printk("mach64_init: total_vram[%08x] is_vt_chip[%d]\n",
- mach64.total_vram, mach64.flags & MACH64_MASK_VT ? 1 : 0);
+ printk("mach64_init: chip_type[%04x], total_vram[%08x]\n",
+ mach64.chip_type, mach64.total_vram);
#if 0
mach64_test(fb);
diff --git a/drivers/sbus/char/mach64.h b/drivers/sbus/char/mach64.h
index 02593fa7b..2b30888e8 100644
--- a/drivers/sbus/char/mach64.h
+++ b/drivers/sbus/char/mach64.h
@@ -1,4 +1,4 @@
-/* $Id: mach64.h,v 1.4 1997/10/04 08:51:30 ecd Exp $
+/* $Id: mach64.h,v 1.5 1998/04/01 05:52:58 ecd Exp $
* mach64.h: Ultra/PCI mach64 driver constants etc.
*
* Copyright 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -9,12 +9,10 @@
struct mach64_info {
unsigned int color_mode;
- unsigned int flags;
+ unsigned int chip_type;
unsigned int total_vram;
};
-/* The mach64_info flag bits. */
-#define MACH64_MASK_VT 0x00000001
/* NON-GUI MEMORY MAPPED Registers - expressed in BYTE offsets */
@@ -376,15 +374,6 @@ struct mach64_info {
#define MEM_BNDRY_1M 0x00030000
#define MEM_BNDRY_EN 0x00040000
-/* ATI PCI constants */
-#define PCI_ATI_VENDOR_ID 0x1002
-#define PCI_MACH64_GX 0x4758
-#define PCI_MACH64_CX 0x4358
-#define PCI_MACH64_CT 0x4354
-#define PCI_MACH64_ET 0x4554
-#define PCI_MACH64_VT 0x5654
-#define PCI_MACH64_GT 0x4754
-
/* CONFIG_CHIP_ID register constants */
#define CFG_CHIP_TYPE 0x0000FFFF
#define CFG_CHIP_CLASS 0x00FF0000
diff --git a/drivers/sbus/char/pcicons.c b/drivers/sbus/char/pcicons.c
index c20796e63..5117c2c8e 100644
--- a/drivers/sbus/char/pcicons.c
+++ b/drivers/sbus/char/pcicons.c
@@ -1,4 +1,4 @@
-/* $Id: pcicons.c,v 1.10 1997/10/04 08:52:57 ecd Exp $
+/* $Id: pcicons.c,v 1.13 1998/04/01 06:55:11 ecd Exp $
* pcicons.c: PCI specific probing and console operations layer.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -42,6 +42,7 @@ static __u64 cursor_bits[2];
static int cursor_pos = -1;
extern int serial_console;
+extern struct console vt_console_driver;
static void pci_install_consops(void);
static int (*fbuf_offset)(int);
@@ -191,24 +192,32 @@ static unsigned short pci_scr_readw(unsigned short *addr)
static void pci_get_scrmem(int currcons)
{
+ struct vc_data *vcd = vc_cons[currcons].d;
+
memcpyw((unsigned short *)vc_scrbuf[currcons],
- (unsigned short *)origin, video_screen_size);
- origin = video_mem_start = (unsigned long)vc_scrbuf[currcons];
- scr_end = video_mem_end = video_mem_start + video_screen_size;
- pos = origin + y * video_size_row + (x << 1);
+ (unsigned short *)vcd->vc_origin, video_screen_size);
+ vcd->vc_origin = vcd->vc_video_mem_start =
+ (unsigned long)vc_scrbuf[currcons];
+ vcd->vc_scr_end = vcd->vc_video_mem_end =
+ vcd->vc_video_mem_start + video_screen_size;
+ vcd->vc_pos =
+ vcd->vc_origin + vcd->vc_y * video_size_row + (vcd->vc_x << 1);
}
static void pci_set_scrmem(int currcons, long offset)
{
+ struct vc_data *vcd = vc_cons[currcons].d;
+
if (video_mem_term - video_mem_base < offset + video_screen_size)
offset = 0;
memcpyw((unsigned short *)(video_mem_base + offset),
- (unsigned short *) origin, video_screen_size);
- video_mem_start = video_mem_base;
- video_mem_end = video_mem_term;
- origin = video_mem_base + offset;
- scr_end = origin + video_screen_size;
- pos = origin + y * video_size_row + (x << 1);
+ (unsigned short *) vcd->vc_origin, video_screen_size);
+ vcd->vc_video_mem_start = video_mem_base;
+ vcd->vc_video_mem_end = video_mem_term;
+ vcd->vc_origin = video_mem_base + offset;
+ vcd->vc_scr_end = vcd->vc_origin + video_screen_size;
+ vcd->vc_pos =
+ vcd->vc_origin + vcd->vc_y * video_size_row + (vcd->vc_x << 1);
}
static void pci_invert_cursor(int cpos)
@@ -252,15 +261,17 @@ static void pci_set_cursor(int currcons)
unsigned long flags;
int old_cursor;
- if (currcons != fg_console || console_blanked || vcmode == KD_GRAPHICS)
+ if (currcons != fg_console || console_blanked ||
+ vt_cons[currcons]->vc_mode == KD_GRAPHICS)
return;
save_flags(flags); cli();
- if (!deccm) {
+ if (!vc_cons[currcons].d->vc_deccm) {
pci_hide_cursor();
} else {
old_cursor = cursor_pos;
- cursor_pos = (pos - video_mem_base) >> 1;
+ cursor_pos =
+ (vc_cons[currcons].d->vc_pos - video_mem_base) >> 1;
if (old_cursor != -1)
pci_invert_cursor(-1);
pci_invert_cursor(cursor_pos);
@@ -412,9 +423,12 @@ static void pci_clear_fb(int n)
{
fbinfo_t *fb = &fbinfo[n];
+#if 0
if (!n) {
pci_clear_screen();
- } else if (fb->base) {
+ } else
+#endif
+ if (fb->base) {
memset((void *)fb->base,
(fb->type.fb_depth == 1) ?
~(0) : reverse_color_table[0],
@@ -545,7 +559,7 @@ __initfunc(static void pci_con_type_init_finish(void))
+ 10 * (ncpus - 1);
for (p = logo_banner; *p; p++, ush++) {
- *ush = (attr << 8) + *p;
+ *ush = (vc_cons[currcons].d->vc_attr << 8) + *p;
pci_blitc(*ush, (unsigned long)ush);
}
@@ -553,6 +567,8 @@ __initfunc(static void pci_con_type_init_finish(void))
ush = (unsigned short *)video_mem_base + i * video_num_columns;
memset(ush, 0xff, 20);
}
+
+ register_console(&vt_console_driver);
}
unsigned long pcivga_iobase = 0;
diff --git a/drivers/sbus/char/pcikbd.c b/drivers/sbus/char/pcikbd.c
index 31485aac8..eca0149c5 100644
--- a/drivers/sbus/char/pcikbd.c
+++ b/drivers/sbus/char/pcikbd.c
@@ -1,4 +1,4 @@
-/* $Id: pcikbd.c,v 1.12 1997/12/27 16:28:27 jj Exp $
+/* $Id: pcikbd.c,v 1.16 1998/04/01 04:12:40 davem Exp $
* pcikbd.c: Ultra/AX PC keyboard support.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
@@ -953,14 +953,18 @@ __initfunc(int ps2kbd_probe(unsigned long *memory_start))
return -ENODEV;
len = prom_getproperty(node, "keyboard", prop, sizeof(prop));
- if (len > 0)
- kbnode = prom_pathtoinode(prop);
+ if (len > 0) {
+ prop[len] = 0;
+ kbnode = prom_finddevice(prop);
+ }
if (!kbnode)
return -ENODEV;
len = prom_getproperty(node, "mouse", prop, sizeof(prop));
- if (len > 0)
- msnode = prom_pathtoinode(prop);
+ if (len > 0) {
+ prop[len] = 0;
+ msnode = prom_finddevice(prop);
+ }
if (!msnode)
return -ENODEV;
@@ -971,6 +975,15 @@ __initfunc(int ps2kbd_probe(unsigned long *memory_start))
pnode = prom_searchsiblings(node, "pci");
/*
+ * Check for SUNW,sabre on Ultra5/10/AXi.
+ */
+ len = prom_getproperty(pnode, "model", prop, sizeof(prop));
+ if ((len > 0) && !strncmp(prop, "SUNW,sabre", len)) {
+ pnode = prom_getchild(pnode);
+ pnode = prom_searchsiblings(pnode, "pci");
+ }
+
+ /*
* For each PCI bus...
*/
while (pnode) {
diff --git a/drivers/sbus/char/sab82532.c b/drivers/sbus/char/sab82532.c
index 9eed1d7f6..773f69f47 100644
--- a/drivers/sbus/char/sab82532.c
+++ b/drivers/sbus/char/sab82532.c
@@ -1,4 +1,4 @@
-/* $Id: sab82532.c,v 1.13 1997/12/30 09:37:49 ecd Exp $
+/* $Id: sab82532.c,v 1.17 1998/04/01 06:55:12 ecd Exp $
* sab82532.c: ASYNC Driver for the SIEMENS SAB82532 DUSCC.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
@@ -46,9 +46,10 @@ static int sab82532_refcount;
/* Set of debugging defines */
#undef SERIAL_DEBUG_OPEN
-#undef SERIAL_DEBUG_INTR
#undef SERIAL_DEBUG_FLOW
#undef SERIAL_DEBUG_WAIT_UNTIL_SENT
+#undef SERIAL_DEBUG_SEND_BREAK
+#undef SERIAL_DEBUG_INTR
static void change_speed(struct sab82532 *info);
static void sab82532_wait_until_sent(struct tty_struct *tty, int timeout);
@@ -159,6 +160,47 @@ static struct ebrg_struct ebrg_table[] = {
#define NR_EBRG_VALUES (sizeof(ebrg_table)/sizeof(struct ebrg_struct))
+#define SAB82532_MAX_TEC_DELAY 2000 /* 2 ms */
+
+static __inline__ void sab82532_tec_wait(struct sab82532 *info)
+{
+ int count = SAB82532_MAX_TEC_DELAY;
+ while ((info->regs->r.star & SAB82532_STAR_TEC) && --count)
+ udelay(1);
+}
+
+static __inline__ void sab82532_start_tx(struct sab82532 *info)
+{
+ unsigned long flags;
+ int i;
+
+ save_flags(flags); cli();
+
+ if (info->xmit_cnt <= 0)
+ goto out;
+
+ if (!(info->regs->r.star & SAB82532_STAR_XFW))
+ goto out;
+
+ info->all_sent = 0;
+ for (i = 0; i < info->xmit_fifo_size; i++) {
+ info->regs->w.xfifo[i] = info->xmit_buf[info->xmit_tail++];
+ info->xmit_tail &= (SERIAL_XMIT_SIZE - 1);
+ info->icount.tx++;
+ if (--info->xmit_cnt <= 0)
+ break;
+ }
+
+ /* Issue a Transmit Frame command. */
+ if (info->regs->r.star & SAB82532_STAR_CEC)
+ udelay(1);
+ info->regs->w.cmdr = SAB82532_CMDR_XF;
+
+out:
+ restore_flags(flags);
+}
+
+
/*
* ------------------------------------------------------------
* sab82532_stop() and sab82532_start()
@@ -192,6 +234,7 @@ static void sab82532_start(struct tty_struct *tty)
save_flags(flags); cli();
info->interrupt_mask1 &= ~(SAB82532_IMR1_XPR);
info->regs->w.imr1 = info->interrupt_mask1;
+ sab82532_start_tx(info);
restore_flags(flags);
}
@@ -356,6 +399,11 @@ static inline void transmit_chars(struct sab82532 *info,
{
int i;
+ if (stat->sreg.isr1 & SAB82532_ISR1_ALLS)
+ info->all_sent = 1;
+ if (!(info->regs->r.star & SAB82532_STAR_XFW))
+ return;
+
if (!info->tty) {
info->interrupt_mask1 |= SAB82532_IMR1_XPR;
info->regs->w.imr1 = info->interrupt_mask1;
@@ -364,8 +412,6 @@ static inline void transmit_chars(struct sab82532 *info,
if ((info->xmit_cnt <= 0) || info->tty->stopped ||
info->tty->hw_stopped) {
- if (stat->sreg.isr1 & SAB82532_ISR1_ALLS)
- info->all_sent = 1;
info->interrupt_mask1 |= SAB82532_IMR1_XPR;
info->regs->w.imr1 = info->interrupt_mask1;
return;
@@ -494,6 +540,7 @@ check_modem:
RS_EVENT_WRITE_WAKEUP);
info->interrupt_mask1 &= ~(SAB82532_IMR1_XPR);
info->regs->w.imr1 = info->interrupt_mask1;
+ sab82532_start_tx(info);
}
} else {
if (!(info->cts)) {
@@ -641,8 +688,7 @@ sab82532_init_line(struct sab82532 *info)
*/
if (info->regs->r.star & SAB82532_STAR_CEC)
udelay(1);
- while (info->regs->r.star & SAB82532_STAR_TEC)
- udelay(1);
+ sab82532_tec_wait(info);
/*
* Clear the FIFO buffers.
@@ -939,8 +985,7 @@ static void change_speed(struct sab82532 *info)
save_flags(flags); cli();
if (info->regs->r.star & SAB82532_STAR_CEC)
udelay(1);
- while (info->regs->r.star & SAB82532_STAR_TEC)
- udelay(1);
+ sab82532_tec_wait(info);
info->regs->w.dafo = dafo;
info->regs->w.bgr = ebrg & 0xff;
info->regs->rw.ccr2 &= ~(0xc0);
@@ -996,6 +1041,7 @@ static void sab82532_flush_chars(struct tty_struct *tty)
save_flags(flags); cli();
info->interrupt_mask1 &= ~(SAB82532_IMR1_XPR);
info->regs->w.imr1 = info->interrupt_mask1;
+ sab82532_start_tx(info);
restore_flags(flags);
}
@@ -1044,10 +1090,10 @@ static int sab82532_write(struct tty_struct * tty, int from_user,
if (from_user)
up(&tmp_buf_sem);
- if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped &&
- (info->interrupt_mask1 & SAB82532_IMR1_XPR)) {
+ if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) {
info->interrupt_mask1 &= ~(SAB82532_IMR1_XPR);
info->regs->w.imr1 = info->interrupt_mask1;
+ sab82532_start_tx(info);
}
restore_flags(flags);
@@ -1098,13 +1144,15 @@ static void sab82532_flush_buffer(struct tty_struct *tty)
static void sab82532_send_xchar(struct tty_struct *tty, char ch)
{
struct sab82532 *info = (struct sab82532 *)tty->driver_data;
+ unsigned long flags;
if (serial_paranoia_check(info, tty->device, "sab82532_send_xchar"))
return;
- while (info->regs->r.star & SAB82532_STAR_TEC)
- udelay(1);
+ save_flags(flags); cli();
+ sab82532_tec_wait(info);
info->regs->w.tic = ch;
+ restore_flags(flags);
}
/*
@@ -1308,6 +1356,9 @@ static void begin_break(struct sab82532 * info)
if (!info->regs)
return;
info->regs->rw.dafo |= SAB82532_DAFO_XBRK;
+#ifdef SERIAL_DEBUG_SEND_BREAK
+ printk("begin_break: jiffies=%lu\n", jiffies);
+#endif
}
/*
@@ -1318,6 +1369,9 @@ static void end_break(struct sab82532 * info)
if (!info->regs)
return;
info->regs->rw.dafo &= ~(SAB82532_DAFO_XBRK);
+#ifdef SERIAL_DEBUG_SEND_BREAK
+ printk("end_break: jiffies=%lu\n", jiffies);
+#endif
}
static int sab82532_ioctl(struct tty_struct *tty, struct file * file,
@@ -1850,6 +1904,7 @@ static int sab82532_open(struct tty_struct *tty, struct file * filp)
#ifdef SERIAL_DEBUG_OPEN
printk("sab82532_open: count = %d\n", info->count);
#endif
+
line = MINOR(tty->device) - tty->driver.minor_start;
if ((line < 0) || (line >= NR_PORTS))
return -ENODEV;
@@ -1991,7 +2046,7 @@ int sab82532_read_proc(char *page, char **start, off_t off, int count,
int i, len = 0;
off_t begin = 0;
- len += sprintf(page, "serinfo:1.0 driver:%s\n", "$Revision: 1.13 $");
+ len += sprintf(page, "serinfo:1.0 driver:%s\n", "$Revision: 1.17 $");
for (i = 0; i < NR_PORTS && len < 4000; i++) {
len += line_info(page + len, sab82532_table[i]);
if (len+begin > off+count)
@@ -2082,7 +2137,7 @@ sab82532_kgdb_hook(int line))
__initfunc(static inline void show_serial_version(void))
{
- char *revision = "$Revision: 1.13 $";
+ char *revision = "$Revision: 1.17 $";
char *version, *p;
version = strchr(revision, ' ');
@@ -2219,11 +2274,22 @@ __initfunc(int sab82532_init(void))
__initfunc(int sab82532_probe(unsigned long *memory_start))
{
int node, enode, snode;
+ char model[32];
+ int len;
node = prom_getchild(prom_root_node);
node = prom_searchsiblings(node, "pci");
/*
+ * Check for SUNW,sabre on Ultra 5/10/AXi.
+ */
+ len = prom_getproperty(node, "model", model, sizeof(model));
+ if ((len > 0) && !strncmp(model, "SUNW,sabre", len)) {
+ node = prom_getchild(node);
+ node = prom_searchsiblings(node, "pci");
+ }
+
+ /*
* For each PCI bus...
*/
while (node) {
@@ -2299,12 +2365,15 @@ void cleanup_module(void)
#ifdef CONFIG_SERIAL_CONSOLE
-static void
+static __inline__ void
sab82532_console_putchar(struct sab82532 *info, char c)
{
- while (info->regs->r.star & SAB82532_STAR_TEC)
- udelay(1);
+ unsigned long flags;
+
+ save_flags(flags); cli();
+ sab82532_tec_wait(info);
info->regs->w.tic = c;
+ restore_flags(flags);
}
static void
@@ -2320,8 +2389,7 @@ sab82532_console_write(struct console *con, const char *s, unsigned n)
sab82532_console_putchar(info, '\r');
sab82532_console_putchar(info, *s++);
}
- while (info->regs->r.star & SAB82532_STAR_TEC)
- udelay(1);
+ sab82532_tec_wait(info);
}
static int
@@ -2440,8 +2508,7 @@ sab82532_console_setup(struct console *con, char *options)
save_flags(flags); cli();
if (info->regs->r.star & SAB82532_STAR_CEC)
udelay(1);
- while (info->regs->r.star & SAB82532_STAR_TEC)
- udelay(1);
+ sab82532_tec_wait(info);
info->regs->w.dafo = dafo;
info->regs->w.bgr = ebrg & 0xff;
info->regs->rw.ccr2 &= ~(0xc0);
diff --git a/drivers/sbus/char/sbuscons.c b/drivers/sbus/char/sbuscons.c
index eda06fa76..2b7822c4d 100644
--- a/drivers/sbus/char/sbuscons.c
+++ b/drivers/sbus/char/sbuscons.c
@@ -1,11 +1,11 @@
-/* $Id: sbuscons.c,v 1.10 1998/01/07 06:37:22 baccala Exp $
+/* $Id: sbuscons.c,v 1.15 1998/03/31 01:49:50 davem Exp $
* sbuscons.c: Routines specific to SBUS frame buffer consoles.
*
* Copyright (C) 1995 Peter Zaitcev (zaitcev@lab.ipmce.su)
* Copyright (C) 1995,1996,1997 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1995, 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
* Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk)
- * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
+ * Copyright (C) 1996,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
* Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
*
* Added font loading Nov/21, Miguel de Icaza (miguel@nuclecu.unam.mx)
@@ -46,6 +46,7 @@
*
*/
+#include <linux/config.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
@@ -72,6 +73,9 @@
#include <asm/fbio.h>
#include <asm/io.h>
#include <asm/smp.h>
+#ifndef __sparc_v9__
+#include <asm/sun4paddr.h>
+#endif
#include <linux/kbd_kern.h>
#include <linux/vt_kern.h>
@@ -96,7 +100,6 @@ static int sbus_blitc(uint, unsigned long);
static void sbus_install_consops(void);
-extern void register_console(void (*proc)(const char *));
extern void console_print(const char *);
extern void putconsxy(int, char *);
extern unsigned char vga_font[];
@@ -277,14 +280,15 @@ static void sbus_set_cursor(int currcons)
int j, idx, oldpos;
unsigned long flags;
- if (currcons != fg_console || console_blanked || vcmode == KD_GRAPHICS)
+ if (currcons != fg_console || console_blanked ||
+ vt_cons[currcons]->vc_mode == KD_GRAPHICS)
return;
if (fbinfo[0].setcursor) {
- if (!deccm)
+ if (!vc_cons[currcons].d->vc_deccm)
sbus_hide_cursor();
else {
- idx = (pos - video_mem_base) >> 1;
+ idx = (vc_cons[currcons].d->vc_pos - video_mem_base) >> 1;
sbus_hw_set_cursor(x_margin + ((idx % video_num_columns) << 3), y_margin + ((idx / video_num_columns) * CHAR_HEIGHT));
}
@@ -293,9 +297,9 @@ static void sbus_set_cursor(int currcons)
__save_and_cli(flags);
- idx = (pos - video_mem_base) >> 1;
+ idx = (vc_cons[currcons].d->vc_pos - video_mem_base) >> 1;
oldpos = cursor_pos;
- if (!deccm) {
+ if (!vc_cons[currcons].d->vc_deccm) {
sbus_hide_cursor ();
__restore_flags (flags);
return;
@@ -420,7 +424,7 @@ __initfunc(static void sbus_con_type_init_finish(void))
p = logo_banner;
for (; *p; p++, ush++) {
- *ush = (attr << 8) + *p;
+ *ush = (vc_cons[currcons].d->vc_attr << 8) + *p;
sbus_blitc (*ush, (unsigned long) ush);
}
for (i = 0; i < 5; i++) {
@@ -435,24 +439,34 @@ __initfunc(static void sbus_con_type_init_finish(void))
*/
static void sbus_get_scrmem(int currcons)
{
+ struct vc_data *vcd = vc_cons[currcons].d;
+
memcpyw((unsigned short *)vc_scrbuf[currcons],
- (unsigned short *)origin, video_screen_size);
- origin = video_mem_start = (unsigned long)vc_scrbuf[currcons];
- scr_end = video_mem_end = video_mem_start + video_screen_size;
- pos = origin + y*video_size_row + (x<<1);
+ (unsigned short *)vcd->vc_origin,
+ video_screen_size);
+ vcd->vc_origin = vcd->vc_video_mem_start =
+ (unsigned long)vc_scrbuf[currcons];
+ vcd->vc_scr_end = vcd->vc_video_mem_end =
+ vcd->vc_video_mem_start + video_screen_size;
+ vcd->vc_pos =
+ vcd->vc_origin + vcd->vc_y*video_size_row + (vcd->vc_x<<1);
}
static void sbus_set_scrmem(int currcons, long offset)
{
+ struct vc_data *vcd = vc_cons[currcons].d;
+
if (video_mem_term - video_mem_base < offset + video_screen_size)
offset = 0;
memcpyw((unsigned short *)(video_mem_base + offset),
- (unsigned short *) origin, video_screen_size);
- video_mem_start = video_mem_base;
- video_mem_end = video_mem_term;
- origin = video_mem_base + offset;
- scr_end = origin + video_screen_size;
- pos = origin + y*video_size_row + (x<<1);
+ (unsigned short *) vcd->vc_origin,
+ video_screen_size);
+ vcd->vc_video_mem_start = video_mem_base;
+ vcd->vc_video_mem_end = video_mem_term;
+ vcd->vc_origin = video_mem_base + offset;
+ vcd->vc_scr_end = vcd->vc_origin + video_screen_size;
+ vcd->vc_pos =
+ vcd->vc_origin + vcd->vc_y*video_size_row + (vcd->vc_x<<1);
}
/*
@@ -545,7 +559,20 @@ static int sbus_set_get_cmap(unsigned char * arg, int set)
return 0;
}
-static void sbus_clear_screen(void)
+#ifdef CONFIG_SUN4
+extern __inline__ void memset_screen(void *s, unsigned c, size_t n)
+{
+ unsigned *p = (unsigned *)s;
+ int i;
+
+ for (i = n / 4; i > 0; i--)
+ *p++ = c;
+}
+#else
+#define memset_screen memset
+#endif
+
+void sbus_clear_screen(void)
{
if (fbinfo[0].fill) {
int rects [4];
@@ -556,7 +583,7 @@ static void sbus_clear_screen(void)
rects [3] = con_height;
(*fbinfo[0].fill)(reverse_color_table[0], 1, rects);
} else if (fbinfo[0].base && fbinfo[0].base_depth)
- memset (con_fb_base,
+ memset_screen(con_fb_base,
(con_depth == 1) ? ~(0) : reverse_color_table[0],
(con_depth * con_height * con_width) / 8);
/* also clear out the "shadow" screen memory */
@@ -769,8 +796,7 @@ __initfunc(static void
fbinfo [n].type.fb_height = prom_getintdefault(con_node, "height", 900);
fbinfo [n].type.fb_width = prom_getintdefault(con_node, "width", 1152);
fbinfo [n].type.fb_depth = (type == FBTYPE_SUN2BW) ? 1 : 8;
- linebytes = prom_getint(con_node, "linebytes");
- if (linebytes == -1) linebytes = fbinfo [n].type.fb_width;
+ linebytes = prom_getintdefault(con_node, "linebytes", fbinfo[n].type.fb_width * fbinfo[n].type.fb_depth / 8);
fbinfo [n].type.fb_size = PAGE_ALIGN((linebytes) * (fbinfo [n].type.fb_height));
fbinfo [n].space = io;
fbinfo [n].blanked = 0;
@@ -925,12 +951,22 @@ __initfunc(int sbus_console_probe(void))
u32 tmp;
u32 prom_console_node = 0;
- if(SBus_chain == 0)
- return -1;
-
- sbdprom = 0;
- switch(prom_vers) {
- case PROM_V0:
+ if(SBus_chain == 0) {
+#ifdef CONFIG_SUN4
+ sparc_framebuffer_setup (1,0,FBTYPE_SUN2BW,NULL,SUN4_300_BWTWO_PHYSADDR,0,0,0);
+#else
+ creator = creator_present();
+ if (!creator)
+ return -1;
+ sparc_framebuffer_setup (1, creator, FBTYPE_CREATOR,
+ 0, 0, 0, 0, prom_root_node);
+#endif
+ } else {
+ sbdprom = 0;
+
+ switch(prom_vers) {
+
+ case PROM_V0:
/* V0 proms are at sun4c only. Can skip many checks. */
con_type = FBTYPE_NOTYPE;
for_each_sbusdev(sbdp, SBus_chain) {
@@ -965,9 +1001,10 @@ __initfunc(int sbus_console_probe(void))
break;
}
break;
- case PROM_V2:
- case PROM_V3:
- case PROM_P1275:
+
+ case PROM_V2:
+ case PROM_V3:
+ case PROM_P1275:
if (console_fb_path) {
char *q, c;
@@ -1073,8 +1110,10 @@ __initfunc(int sbus_console_probe(void))
prom_root_node);
}
break;
- default:
+
+ default:
return -1;
+ }
}
if (fbinfo [0].type.fb_type == FBTYPE_NOTYPE) {
diff --git a/drivers/sbus/char/su.c b/drivers/sbus/char/su.c
index beba2e7e6..42a233753 100644
--- a/drivers/sbus/char/su.c
+++ b/drivers/sbus/char/su.c
@@ -1,4 +1,4 @@
-/* $Id: su.c,v 1.4 1997/09/07 15:40:19 ecd Exp $
+/* $Id: su.c,v 1.8 1998/04/01 05:07:50 ecd Exp $
* su.c: Small serial driver for keyboard/mouse interface on Ultra/AX
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
@@ -580,7 +580,7 @@ __initfunc(int su_init(void))
__initfunc(int su_probe (unsigned long *memory_start))
{
struct su_struct *info = su_table;
- int node, enode, sunode;
+ int node, enode, tnode, sunode;
int kbnode = 0, msnode = 0;
int devices = 0;
char prop[128];
@@ -595,14 +595,18 @@ __initfunc(int su_probe (unsigned long *memory_start))
return -ENODEV;
len = prom_getproperty(node, "keyboard", prop, sizeof(prop));
- if (len > 0)
- kbnode = prom_pathtoinode(prop);
+ if (len > 0) {
+ prop[len] = 0;
+ kbnode = prom_finddevice(prop);
+ }
if (!kbnode)
return -ENODEV;
len = prom_getproperty(node, "mouse", prop, sizeof(prop));
- if (len > 0)
- msnode = prom_pathtoinode(prop);
+ if (len > 0) {
+ prop[len] = 0;
+ msnode = prom_finddevice(prop);
+ }
if (!msnode)
return -ENODEV;
@@ -613,6 +617,15 @@ __initfunc(int su_probe (unsigned long *memory_start))
node = prom_searchsiblings(node, "pci");
/*
+ * Check for SUNW,sabre on Ultra 5/10/AXi.
+ */
+ len = prom_getproperty(node, "model", prop, sizeof(prop));
+ if ((len > 0) && !strncmp(prop, "SUNW,sabre", len)) {
+ node = prom_getchild(node);
+ node = prom_searchsiblings(node, "pci");
+ }
+
+ /*
* For each PCI bus...
*/
while (node) {
@@ -624,7 +637,10 @@ __initfunc(int su_probe (unsigned long *memory_start))
*/
while (enode) {
sunode = prom_getchild(enode);
- sunode = prom_searchsiblings(sunode, "su");
+ tnode = prom_searchsiblings(sunode, "su");
+ if (!tnode)
+ tnode = prom_searchsiblings(sunode, "su_pnp");
+ sunode = tnode;
/*
* For each 'su' on this EBus...
@@ -651,7 +667,11 @@ __initfunc(int su_probe (unsigned long *memory_start))
goto found;
sunode = prom_getsibling(sunode);
- sunode = prom_searchsiblings(sunode, "su");
+ tnode = prom_searchsiblings(sunode, "su");
+ if (!tnode)
+ tnode = prom_searchsiblings(sunode,
+ "su_pnp");
+ sunode = tnode;
}
enode = prom_getsibling(enode);
enode = prom_searchsiblings(enode, "ebus");
diff --git a/drivers/sbus/char/suncons.c b/drivers/sbus/char/suncons.c
index 586ac28c0..32062371e 100644
--- a/drivers/sbus/char/suncons.c
+++ b/drivers/sbus/char/suncons.c
@@ -1,4 +1,4 @@
-/* $Id: suncons.c,v 1.77 1997/12/19 07:32:59 ecd Exp $
+/* $Id: suncons.c,v 1.79 1998/01/30 10:59:23 jj Exp $
* suncons.c: Sparc platform console generic layer.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -28,6 +28,9 @@ fbinfo_t *fbinfo;
int fbinfos;
unsigned int linux_logo_colors __initdata = LINUX_LOGO_COLORS;
char logo_banner[] __initdata = linux_logo_banner;
+#ifdef CONFIG_PCI
+static int cons_type __initdata = 0;
+#endif
extern struct console vt_console_driver;
@@ -344,6 +347,7 @@ __initfunc(unsigned long sun_console_init(unsigned long memory_start))
if(sbus_console_probe()) {
#ifdef CONFIG_PCI
+ cons_type = 1;
pci_console_inithook();
return memory_start;
#else
@@ -363,6 +367,11 @@ __initfunc(unsigned long pci_console_init(unsigned long memory_start))
/* Nothing to do in this case. */
if (!con_is_present())
return memory_start;
+
+ if (!cons_type) {
+ /* Some console was already found on SBUS or UPA */
+ return memory_start;
+ }
if(pci_console_probe()) {
prom_printf("Could not probe PCI console, bailing out...\n");
diff --git a/drivers/sbus/char/sunkbd.c b/drivers/sbus/char/sunkbd.c
index d55fb5ba5..a0dcb6c74 100644
--- a/drivers/sbus/char/sunkbd.c
+++ b/drivers/sbus/char/sunkbd.c
@@ -37,7 +37,6 @@
#ifdef CONFIG_PCI
#include <linux/pci.h>
-#include <linux/bios32.h>
#include <asm/pbm.h>
#include <asm/ebus.h>
#endif
diff --git a/drivers/sbus/char/tcx.c b/drivers/sbus/char/tcx.c
index ec0736ff0..18533652d 100644
--- a/drivers/sbus/char/tcx.c
+++ b/drivers/sbus/char/tcx.c
@@ -1,4 +1,4 @@
-/* $Id: tcx.c,v 1.20 1997/08/22 15:55:14 jj Exp $
+/* $Id: tcx.c,v 1.22 1998/03/10 20:18:47 jj Exp $
* tcx.c: SUNW,tcx 24/8bit frame buffer driver
*
* Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -33,6 +33,8 @@
/* THC definitions */
#define TCX_THC_MISC_REV_SHIFT 16
#define TCX_THC_MISC_REV_MASK 15
+#define TCX_THC_MISC_VSYNC_DIS (1 << 25)
+#define TCX_THC_MISC_HSYNC_DIS (1 << 24)
#define TCX_THC_MISC_RESET (1 << 12)
#define TCX_THC_MISC_VIDEO (1 << 10)
#define TCX_THC_MISC_SYNC (1 << 9)
@@ -174,7 +176,8 @@ tcx_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma,
page += map_size;
}
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
@@ -246,11 +249,16 @@ static void
tcx_blank (fbinfo_t *fb)
{
fb->info.tcx.thc->thc_misc &= ~TCX_THC_MISC_VIDEO;
+ /* This should put us in power-save */
+ fb->info.tcx.thc->thc_misc |= TCX_THC_MISC_VSYNC_DIS;
+ fb->info.tcx.thc->thc_misc |= TCX_THC_MISC_HSYNC_DIS;
}
static void
tcx_unblank (fbinfo_t *fb)
{
+ fb->info.tcx.thc->thc_misc &= ~TCX_THC_MISC_VSYNC_DIS;
+ fb->info.tcx.thc->thc_misc &= ~TCX_THC_MISC_HSYNC_DIS;
fb->info.tcx.thc->thc_misc |= TCX_THC_MISC_VIDEO;
}
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index d144c7823..cb822dd2a 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -582,7 +582,8 @@ static int vfc_mmap(struct inode *inode, struct file *file,
if(ret)
return -EAGAIN;
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
diff --git a/drivers/sbus/char/weitek.c b/drivers/sbus/char/weitek.c
index 7de26c2f7..4662bbbb7 100644
--- a/drivers/sbus/char/weitek.c
+++ b/drivers/sbus/char/weitek.c
@@ -1,4 +1,4 @@
-/* $Id: weitek.c,v 1.15 1997/07/22 06:14:11 davem Exp $
+/* $Id: weitek.c,v 1.16 1998/03/10 20:18:54 jj Exp $
* weitek.c: Tadpole P9100/P9000 console driver
*
* Copyright (C) 1996 David Redman (djhr@tadpole.co.uk)
@@ -84,7 +84,8 @@ weitek_mmap(struct inode *inode, struct file *file, struct vm_area_struct *vma,
page += map_size;
}
- vma->vm_dentry = dget(file->f_dentry);
+ vma->vm_file = file;
+ file->f_count++;
return 0;
}
#endif
diff --git a/drivers/sbus/char/zs.c b/drivers/sbus/char/zs.c
index 6162ed4ad..f7c477ea4 100644
--- a/drivers/sbus/char/zs.c
+++ b/drivers/sbus/char/zs.c
@@ -1,4 +1,4 @@
-/* $Id: zs.c,v 1.15 1997/12/22 16:09:34 jj Exp $
+/* $Id: zs.c,v 1.20 1998/02/25 23:51:57 ecd Exp $
* zs.c: Zilog serial port driver for the Sparc.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -37,7 +37,7 @@
#ifdef __sparc_v9__
#include <asm/fhc.h>
#ifdef CONFIG_PCI
-#include <linux/bios32.h>
+#include <linux/pci.h>
#endif
#endif
@@ -70,7 +70,12 @@ struct tty_struct *zs_ttys;
#ifdef CONFIG_SERIAL_CONSOLE
static struct console zs_console;
static int zs_console_init(void);
-#endif
+
+/*
+ * Define this to get the zs_fair_output() functionality.
+ */
+#undef SERIAL_CONSOLE_FAIR_OUTPUT
+#endif /* CONFIG_SERIAL_CONSOLE */
static unsigned char kgdb_regs[16] = {
0, 0, 0, /* write 0, 1, 2 */
@@ -256,14 +261,14 @@ static inline void load_zsregs(struct sun_serial *info, unsigned char *regs)
restore_flags(flags);
}
+#define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */
+
static inline void zs_put_char(struct sun_zschannel *channel, char ch)
{
- int loops = 0;
+ int loops = ZS_PUT_CHAR_MAX_DELAY;
- while((channel->control & Tx_BUF_EMP) == 0 && loops < 10000) {
- loops++;
+ while((channel->control & Tx_BUF_EMP) == 0 && --loops)
udelay(5);
- }
channel->data = ch;
udelay(5);
}
@@ -408,6 +413,10 @@ static _INLINE_ void zs_sched_event(struct sun_serial *info,
extern void breakpoint(void); /* For the KGDB frame character */
#endif
+#ifdef CONFIG_MAGIC_SYSRQ
+static int serial_sysrq;
+#endif
+
static _INLINE_ void receive_chars(struct sun_serial *info, struct pt_regs *regs)
{
struct tty_struct *tty = info->tty;
@@ -447,8 +456,6 @@ static _INLINE_ void receive_chars(struct sun_serial *info, struct pt_regs *regs
}
if(info->is_cons) {
#ifdef CONFIG_MAGIC_SYSRQ
- static int serial_sysrq;
-
if (!ch) {
serial_sysrq = 1;
return;
@@ -566,8 +573,13 @@ static _INLINE_ void status_handle(struct sun_serial *info)
* 'break asserted' status change interrupt, call
* the boot prom.
*/
- if((status & BRK_ABRT) && info->break_abort)
+ if((status & BRK_ABRT) && info->break_abort) {
+#ifdef CONFIG_MAGIC_SYSRQ
+ serial_sysrq = 1;
+#else
batten_down_hatches();
+#endif
+ }
/* XXX Whee, put in a buffer somewhere, the status information
* XXX whee whee whee... Where does the information go...
@@ -1037,12 +1049,12 @@ static void zs_flush_chars(struct tty_struct *tty)
if (serial_paranoia_check(info, tty->device, "zs_flush_chars"))
return;
+ save_flags(flags); cli();
if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
!info->xmit_buf)
- return;
+ goto out;
/* Enable transmitter */
- save_flags(flags); cli();
info->curregs[1] |= TxINT_ENAB|EXT_INT_ENAB;
write_zsreg(info->zs_channel, 1, info->curregs[1]);
info->curregs[5] |= TxENAB;
@@ -1059,6 +1071,7 @@ static void zs_flush_chars(struct tty_struct *tty)
info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1);
info->xmit_cnt--;
+out:
restore_flags(flags);
}
@@ -1100,21 +1113,21 @@ static int zs_write(struct tty_struct * tty, int from_user,
total += c;
}
+ cli();
if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) {
/* Enable transmitter */
info->curregs[1] |= TxINT_ENAB|EXT_INT_ENAB;
write_zsreg(info->zs_channel, 1, info->curregs[1]);
info->curregs[5] |= TxENAB;
write_zsreg(info->zs_channel, 5, info->curregs[5]);
- }
#if 1
- if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) {
zs_put_char(info->zs_channel,
info->xmit_buf[info->xmit_tail++]);
info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1);
info->xmit_cnt--;
- }
#endif
+ }
+
restore_flags(flags);
return total;
}
@@ -1819,7 +1832,7 @@ int zs_open(struct tty_struct *tty, struct file * filp)
static void show_serial_version(void)
{
- char *revision = "$Revision: 1.15 $";
+ char *revision = "$Revision: 1.20 $";
char *version, *p;
version = strchr(revision, ' ');
@@ -2220,7 +2233,7 @@ __initfunc(int zs_init(void))
#endif
#ifdef CONFIG_PCI
- if (pcibios_present())
+ if (pci_present())
return 0;
#endif
@@ -2514,6 +2527,7 @@ zs_kgdb_hook(int tty_num))
static void
zs_console_putchar(struct sun_serial *info, char ch)
{
+ int loops = ZS_PUT_CHAR_MAX_DELAY;
unsigned long flags;
if(!info->zs_channel)
@@ -2521,9 +2535,12 @@ zs_console_putchar(struct sun_serial *info, char ch)
save_flags(flags); cli();
zs_put_char(info->zs_channel, ch);
+ while (!(read_zsreg(info->zs_channel, R1) & ALL_SNT) && --loops)
+ udelay(5);
restore_flags(flags);
}
+#ifdef SERIAL_CONSOLE_FAIR_OUTPUT
/*
* Fair output driver allows a process to speak.
*/
@@ -2557,6 +2574,7 @@ static void zs_fair_output(struct sun_serial *info)
restore_flags(flags);
return;
}
+#endif
/*
* zs_console_write is registered for printk.
@@ -2574,9 +2592,10 @@ zs_console_write(struct console *con, const char *s, unsigned count)
zs_console_putchar(info, '\r');
zs_console_putchar(info, *s);
}
-
+#ifdef SERIAL_CONSOLE_FAIR_OUTPUT
/* Comment this if you want to have a strict interrupt-driven output */
zs_fair_output(info);
+#endif
}
static int
diff --git a/drivers/sbus/dvma.c b/drivers/sbus/dvma.c
index faa450eeb..f4ff7e539 100644
--- a/drivers/sbus/dvma.c
+++ b/drivers/sbus/dvma.c
@@ -3,6 +3,7 @@
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*/
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/malloc.h>
#include <linux/init.h>
@@ -16,7 +17,7 @@
struct Linux_SBus_DMA *dma_chain;
/* Print out the current values in the DMA control registers */
-static __inline__ void
+extern __inline__ void
dump_dma_regs(struct sparc_dma_registers *dregs)
{
printk("DMA CONTROL<%08lx> ADDR<%08lx> CNT<%08lx> TEST<%08lx>\n",
@@ -27,6 +28,50 @@ dump_dma_regs(struct sparc_dma_registers *dregs)
return;
}
+__initfunc(void
+init_one_dvma(struct Linux_SBus_DMA *dma, int num_dma))
+{
+ printk("dma%d: ", num_dma);
+
+ dma->next = 0;
+ dma->running=0; /* No transfers going on as of yet */
+ dma->allocated=0; /* No one has allocated us yet */
+ switch((dma->regs->cond_reg)&DMA_DEVICE_ID) {
+ case DMA_VERS0:
+ dma->revision=dvmarev0;
+ printk("Revision 0 ");
+ break;
+ case DMA_ESCV1:
+ dma->revision=dvmaesc1;
+ printk("ESC Revision 1 ");
+ break;
+ case DMA_VERS1:
+ dma->revision=dvmarev1;
+ printk("Revision 1 ");
+ break;
+ case DMA_VERS2:
+ dma->revision=dvmarev2;
+ printk("Revision 2 ");
+ break;
+ case DMA_VERHME:
+ dma->revision=dvmahme;
+ printk("HME DVMA gate array ");
+ break;
+ case DMA_VERSPLUS:
+ dma->revision=dvmarevplus;
+ printk("Revision 1 PLUS ");
+ break;
+ default:
+ printk("unknown dma version %x",
+ (dma->regs->cond_reg)&DMA_DEVICE_ID);
+ dma->allocated = 1;
+ break;
+ }
+ printk("\n");
+#if 0 /* Clutters up the screen */
+ dump_dma_regs(dma->regs);
+#endif
+}
/* Probe this SBus DMA module(s) */
__initfunc(unsigned long
@@ -40,11 +85,11 @@ dvma_init(struct linux_sbus *sbus, unsigned long memory_start))
for_each_sbusdev(this_dev, sbus) {
int hme = 0;
- if(!strcmp(this_dev->prom_name, "SUNW,fas")) {
+ if(!strcmp(this_dev->prom_name, "SUNW,fas"))
hme = 1;
- } else if(strcmp(this_dev->prom_name, "dma") &&
- strcmp(this_dev->prom_name, "ledma") &&
- strcmp(this_dev->prom_name, "espdma"))
+ else if(strcmp(this_dev->prom_name, "dma") &&
+ strcmp(this_dev->prom_name, "ledma") &&
+ strcmp(this_dev->prom_name, "espdma"))
continue;
/* Found one... */
@@ -62,10 +107,6 @@ dvma_init(struct linux_sbus *sbus, unsigned long memory_start))
/* We're the first in line */
dma_chain=dma;
}
- dma->next = 0;
-
- printk("dma%d: ", num_dma);
- num_dma++;
/* The constant PAGE_SIZE that is passed to sparc_alloc_io makes the
* routine only alloc 1 page, that was what the original code did
@@ -82,45 +123,42 @@ dvma_init(struct linux_sbus *sbus, unsigned long memory_start))
dma->SBus_dev->reg_addrs[0].which_io, 0x0);
dma->node = dma->SBus_dev->prom_node;
- dma->running=0; /* No transfers going on as of yet */
- dma->allocated=0; /* No one has allocated us yet */
- switch((dma->regs->cond_reg)&DMA_DEVICE_ID) {
- case DMA_VERS0:
- dma->revision=dvmarev0;
- printk("Revision 0 ");
- break;
- case DMA_ESCV1:
- dma->revision=dvmaesc1;
- printk("ESC Revision 1 ");
- break;
- case DMA_VERS1:
- dma->revision=dvmarev1;
- printk("Revision 1 ");
- break;
- case DMA_VERS2:
- dma->revision=dvmarev2;
- printk("Revision 2 ");
- break;
- case DMA_VERHME:
- dma->revision=dvmahme;
- printk("HME DVMA gate array ");
- break;
- case DMA_VERSPLUS:
- dma->revision=dvmarevplus;
- printk("Revision 1 PLUS ");
- break;
- default:
- printk("unknown dma version %x",
- (dma->regs->cond_reg)&DMA_DEVICE_ID);
- dma->allocated = 1;
- break;
- }
- printk("\n");
-#if 0 /* Clutters up the screen */
- dump_dma_regs(dma->regs);
-#endif
+
+ init_one_dvma(dma, num_dma++);
+
}; /* while(this_dev) */
return memory_start;
}
+#ifdef CONFIG_SUN4
+
+#include <asm/sun4paddr.h>
+
+__initfunc(unsigned long
+sun4_dvma_init(unsigned long memory_start))
+{
+ struct Linux_SBus_DMA *dma;
+ struct Linux_SBus_DMA *dchain;
+
+ dma = (struct Linux_SBus_DMA *) memory_start;
+ memory_start += sizeof(struct Linux_SBus_DMA);
+
+ /* No SBUS */
+ dma->SBus_dev = 0x0;
+
+ /* Only one DMA device */
+ dma_chain=dma;
+
+ dma->regs = (struct sparc_dma_registers *)
+ sparc_alloc_io (SUN4_300_DMA_PHYSADDR, 0,
+ PAGE_SIZE, "dma", 0x0, 0x0);
+
+ /* No prom node */
+ dma->node = 0x0;
+
+ init_one_dvma(dma, 0);
+ return memory_start;
+}
+
+#endif
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c
index 3f1984542..93713c94f 100644
--- a/drivers/sbus/sbus.c
+++ b/drivers/sbus/sbus.c
@@ -186,12 +186,10 @@ extern unsigned long iommu_init(int iommu_node, unsigned long memstart,
unsigned long memend, struct linux_sbus *sbus);
extern unsigned long iounit_init(int sbi_node, int iounit_node, unsigned long memstart,
unsigned long memend, struct linux_sbus *sbus);
+unsigned long sun4_init(unsigned long memory_start, unsigned long memory_end);
#ifdef CONFIG_SUN_OPENPROMIO
extern int openprom_init(void);
#endif
-#ifdef CONFIG_SUN_MOSTEK_RTC
-extern int rtc_init(void);
-#endif
#ifdef CONFIG_SUN_AUXIO
extern void auxio_probe(void);
#endif
@@ -234,8 +232,6 @@ sbus_do_child_siblings(unsigned long memory_start, int start_node,
return memory_start;
}
-/* #define E3000_DEBUG */
-
__initfunc(unsigned long
sbus_init(unsigned long memory_start, unsigned long memory_end))
{
@@ -244,10 +240,11 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
struct linux_sbus *sbus;
struct linux_sbus_device *this_dev;
int num_sbus = 0; /* How many did we find? */
-
-#ifdef E3000_DEBUG
- prom_printf("sbus_init: Radek, record following output for me. -DaveM\n");
+
+#ifdef CONFIG_SUN4
+ return sun4_init(memory_start, memory_end);
#endif
+
memory_start = ((memory_start + 7) & (~7));
topnd = prom_getchild(prom_root_node);
@@ -280,9 +277,6 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
}
}
-#ifdef E3000_DEBUG
- prom_printf("sbus_init: 1st sbus node(%x)\n", nd);
-#endif
/* Ok, we've found the first one, allocate first SBus struct
* and place in chain.
*/
@@ -299,9 +293,6 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
/* Loop until we find no more SBUS's */
while(this_sbus) {
/* IOMMU hides inside SBUS/SYSIO prom node on Ultra. */
-#ifdef E3000_DEBUG
- prom_printf("sbus%d: [ii()", num_sbus);
-#endif
if(sparc_cpu_model == sun4u)
memory_start = iommu_init(this_sbus,
memory_start, memory_end,
@@ -312,9 +303,6 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
memory_start, memory_end,
sbus);
#endif
-#ifdef E3000_DEBUG
- prom_printf("1");
-#endif
printk("sbus%d: ", num_sbus);
sbus_clock = prom_getint(this_sbus, "clock-frequency");
if(sbus_clock==-1) sbus_clock = (25*1000*1000);
@@ -334,15 +322,9 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
}
#endif
-#ifdef E3000_DEBUG
- prom_printf("psri()");
-#endif
prom_sbus_ranges_init (iommund, sbus);
sbus_devs = prom_getchild(this_sbus);
-#ifdef E3000_DEBUG
- prom_printf("chld(%x)", sbus_devs);
-#endif
sbus->devices = (struct linux_sbus_device *) memory_start;
memory_start += sizeof(struct linux_sbus_device);
@@ -350,9 +332,6 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
this_dev = sbus->devices;
this_dev->next = 0;
-#ifdef E3000_DEBUG
- prom_printf("fsd()");
-#endif
fill_sbus_device(sbus_devs, this_dev);
this_dev->my_bus = sbus;
@@ -362,14 +341,9 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
this_dev->child = (struct linux_sbus_device *) memory_start;
memory_start += sizeof(struct linux_sbus_device);
/* Fill it */
-#ifdef E3000_DEBUG
- prom_printf("fsd(chld)");
-#endif
+
fill_sbus_device(prom_getchild(sbus_devs), this_dev->child);
this_dev->child->my_bus = sbus;
-#ifdef E3000_DEBUG
- prom_printf("sdcs()");
-#endif
memory_start = sbus_do_child_siblings(memory_start,
prom_getchild(sbus_devs),
this_dev->child,
@@ -378,9 +352,6 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
this_dev->child = 0;
}
-#ifdef E3000_DEBUG
- prom_printf("2");
-#endif
while((sbus_devs = prom_getsibling(sbus_devs)) != 0) {
/* Allocate device node */
this_dev->next = (struct linux_sbus_device *) memory_start;
@@ -389,9 +360,6 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
this_dev->next=0;
/* Fill it */
-#ifdef E3000_DEBUG
- prom_printf("fsd()");
-#endif
fill_sbus_device(sbus_devs, this_dev);
this_dev->my_bus = sbus;
@@ -403,15 +371,9 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
memory_start += sizeof(struct linux_sbus_device);
/* Fill it */
-#ifdef E3000_DEBUG
- prom_printf("fsd()");
-#endif
fill_sbus_device(prom_getchild(sbus_devs),
this_dev->child);
this_dev->child->my_bus = sbus;
-#ifdef E3000_DEBUG
- prom_printf("sdcs()");
-#endif
memory_start = sbus_do_child_siblings(
memory_start,
prom_getchild(sbus_devs),
@@ -422,26 +384,14 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
}
}
-#ifdef E3000_DEBUG
- prom_printf("di()");
-#endif
memory_start = dvma_init(sbus, memory_start);
num_sbus++;
-#ifdef E3000_DEBUG
- prom_printf("3, off to next sbus\n");
-#endif
if(sparc_cpu_model == sun4u) {
this_sbus = prom_getsibling(this_sbus);
-#ifdef E3000_DEBUG
- prom_printf("sbus_init: sibling(%x), ", this_sbus);
-#endif
if(!this_sbus)
break;
this_sbus = prom_searchsiblings(this_sbus, "sbus");
-#ifdef E3000_DEBUG
- prom_printf("next sbus node(%x),", this_sbus);
-#endif
} else if(sparc_cpu_model == sun4d) {
iommund = prom_getsibling(iommund);
if(!iommund) break;
@@ -454,9 +404,6 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
this_sbus = prom_searchsiblings(this_sbus, "sbus");
}
if(this_sbus) {
-#ifdef E3000_DEBUG
- prom_printf(" scanning another sbus\n");
-#endif
sbus->next = (struct linux_sbus *) memory_start;
memory_start += sizeof(struct linux_sbus);
sbus = sbus->next;
@@ -471,19 +418,10 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
memory_start = sun4d_init_sbi_irq(memory_start);
}
-#ifdef E3000_DEBUG
- prom_printf("sbus_init: No more sbus's, calling sun_console_init()\n");
-#endif
memory_start = sun_console_init(memory_start); /* whee... */
-#ifdef E3000_DEBUG
- prom_printf("sbus_init: back from sun_console_init()\n");
-#endif
#ifdef CONFIG_SUN_OPENPROMIO
openprom_init();
#endif
-#ifdef CONFIG_SUN_MOSTEK_RTC
- rtc_init();
-#endif
#ifdef CONFIG_SUN_BPP
bpp_init();
#endif
@@ -505,3 +443,20 @@ sbus_init(unsigned long memory_start, unsigned long memory_end))
#endif
return memory_start;
}
+
+#ifdef CONFIG_SUN4
+
+extern unsigned long sun4_dvma_init(unsigned long);
+
+__initfunc(unsigned long
+sun4_init(unsigned long memory_start, unsigned long memory_end))
+{
+ memory_start = ((memory_start + 7) & (~7));
+
+ memory_start = sun_console_init(memory_start);
+
+ memory_start = sun4_dvma_init(memory_start);
+
+ return memory_start;
+}
+#endif