summaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-06-01 03:16:17 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-06-01 03:16:17 +0000
commitd8d9b8f76f22b7a16a83e261e64f89ee611f49df (patch)
tree3067bc130b80d52808e6390c9fc7fc087ec1e33c /arch/m68k
parent19c9bba94152148523ba0f7ef7cffe3d45656b11 (diff)
Initial revision
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/Makefile14
-rw-r--r--arch/m68k/amiga/amifb.c6
-rw-r--r--arch/m68k/amiga/amiints.c3
-rw-r--r--arch/m68k/amiga/amikeyb.c3
-rw-r--r--arch/m68k/amiga/amisound.c5
-rw-r--r--arch/m68k/amiga/chipram.c10
-rw-r--r--arch/m68k/amiga/cia.c3
-rw-r--r--arch/m68k/amiga/config.c9
-rw-r--r--arch/m68k/amiga/cyberfb.c7
-rw-r--r--arch/m68k/amiga/retz3fb.c1754
-rw-r--r--arch/m68k/amiga/retz3fb.h286
-rw-r--r--arch/m68k/amiga/zorro.c10
-rw-r--r--arch/m68k/atari/atafb.c5
-rw-r--r--arch/m68k/atari/ataints.c21
-rw-r--r--arch/m68k/atari/atakeyb.c3
-rw-r--r--arch/m68k/atari/config.c21
-rw-r--r--arch/m68k/atari/joystick.c3
-rw-r--r--arch/m68k/atari/stdma.c4
-rw-r--r--arch/m68k/atari/stram.c3
-rw-r--r--arch/m68k/boot/amiga/linuxboot.c17
-rw-r--r--arch/m68k/boot/amiga/linuxboot.h2
-rw-r--r--arch/m68k/fpsp040/skeleton.S26
-rw-r--r--arch/m68k/ifpsp060/iskeleton.S15
-rw-r--r--arch/m68k/kernel/entry.S109
-rw-r--r--arch/m68k/kernel/head.S14
-rw-r--r--arch/m68k/kernel/ints.c3
-rw-r--r--arch/m68k/kernel/m68k_ksyms.c4
-rw-r--r--arch/m68k/kernel/process.c39
-rw-r--r--arch/m68k/kernel/ptrace.c30
-rw-r--r--arch/m68k/kernel/setup.c29
-rw-r--r--arch/m68k/kernel/signal.c6
-rw-r--r--arch/m68k/kernel/sys_m68k.c5
-rw-r--r--arch/m68k/kernel/time.c21
-rw-r--r--arch/m68k/kernel/traps.c10
-rw-r--r--arch/m68k/lib/semaphore.S7
-rw-r--r--arch/m68k/mm/fault.c16
-rw-r--r--arch/m68k/mm/init.c42
-rw-r--r--arch/m68k/mm/memory.c8
-rw-r--r--arch/m68k/vmlinux.lds60
39 files changed, 389 insertions, 2244 deletions
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 939a80387..7548a8dc8 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -24,19 +24,9 @@ ifneq ($(COMPILE_ARCH),$(ARCH))
CROSS_COMPILE = m68k-linux-
endif
-#
-# Set these to indicate how to link it..
-#
-# -zmagic:
-#
-# LINKFLAGS = -Ttext 0x100000
-#
-# -qmagic (we need to remove the 32 byte header for bootup purposes)
-#
-
-LINKFLAGS = -Ttext 0x1000
+LINKFLAGS = -T $(TOPDIR)/arch/m68k/vmlinux.lds
-CFLAGS := $(CFLAGS) -pipe -fno-strength-reduce
+CFLAGS += -pipe -fno-strength-reduce -ffixed-a2
ifdef CONFIG_OPTIMIZE_040
CFLAGS := $(CFLAGS) -m68040
diff --git a/arch/m68k/amiga/amifb.c b/arch/m68k/amiga/amifb.c
index c97609611..eb72970d7 100644
--- a/arch/m68k/amiga/amifb.c
+++ b/arch/m68k/amiga/amifb.c
@@ -50,12 +50,14 @@
#include <linux/delay.h>
#include <linux/config.h>
#include <linux/interrupt.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/irq.h>
#include <asm/amigahw.h>
#include <asm/amigaints.h>
-#include <linux/fb.h>
#define DEBUG
@@ -1802,7 +1804,7 @@ static int amiga_fb_set_cursorstate(struct fb_cursorstate *state, int con)
* Initialisation
*/
-struct fb_info *amiga_fb_init(long *mem_start)
+__initfunc(struct fb_info *amiga_fb_init(long *mem_start))
{
int err, tag, i;
u_long chipptr;
diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c
index b527a8c6c..9df5083c1 100644
--- a/arch/m68k/amiga/amiints.c
+++ b/arch/m68k/amiga/amiints.c
@@ -25,6 +25,7 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/kernel_stat.h>
+#include <linux/init.h>
#include <asm/system.h>
#include <asm/irq.h>
@@ -68,7 +69,7 @@ static void ami_badint(int irq, void *dev_id, struct pt_regs *fp)
* the amiga IRQ handling routines.
*/
-void amiga_init_IRQ(void)
+__initfunc(void amiga_init_IRQ(void))
{
int i;
diff --git a/arch/m68k/amiga/amikeyb.c b/arch/m68k/amiga/amikeyb.c
index f2e826023..1058270dd 100644
--- a/arch/m68k/amiga/amikeyb.c
+++ b/arch/m68k/amiga/amikeyb.c
@@ -22,6 +22,7 @@
#include <linux/kd.h>
#include <linux/random.h>
#include <linux/kernel.h>
+#include <linux/init.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
@@ -295,7 +296,7 @@ static void keyboard_interrupt(int irq, void *dummy, struct pt_regs *fp)
}
}
-int amiga_keyb_init(void)
+__initfunc(int amiga_keyb_init(void))
{
if (!AMIGAHW_PRESENT(AMI_KEYBOARD))
return -EIO;
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index b2b2e3055..d5656d170 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -10,6 +10,7 @@
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/init.h>
#include <asm/system.h>
#include <asm/amigahw.h>
@@ -39,7 +40,7 @@ u_short amiga_audio_period = MAX_PERIOD;
static u_long clock_constant;
-static void init_sound(void)
+__initfunc(static void init_sound(void))
{
snd_data = amiga_chip_alloc(sizeof(sine_data));
if (!snd_data) {
@@ -84,7 +85,7 @@ void amiga_mksound( unsigned int hz, unsigned int ticks )
custom.aud[2].audlc = snd_data;
custom.aud[2].audlen = sizeof(sine_data)/2;
custom.aud[2].audper = (u_short)period;
- custom.aud[2].audvol = 64; /* maxvol */
+ custom.aud[2].audvol = 32; /* 50% of maxvol */
if (ticks) {
sound_timer.expires = jiffies + ticks;
diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c
index 237662c93..50d5a0de0 100644
--- a/arch/m68k/amiga/chipram.c
+++ b/arch/m68k/amiga/chipram.c
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include <linux/kernel.h>
+#include <linux/init.h>
#include <asm/amigahw.h>
struct chip_desc {
@@ -21,19 +22,18 @@ struct chip_desc {
#define DP(ptr) ((struct chip_desc *)(ptr))
u_long amiga_chip_size;
-static unsigned long chipavail; /*MILAN*/
+static unsigned long chipavail;
-/*MILAN*/
unsigned long amiga_chip_avail( void )
{
#ifdef DEBUG
- printk("chip_avail : %ld bytes\n",chipavail);
+ printk("chip_avail : %ld bytes\n",chipavail);
#endif
- return chipavail;
+ return chipavail;
}
-void amiga_chip_init (void)
+__initfunc(void amiga_chip_init (void))
{
struct chip_desc *dp;
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index 02b1ad564..408dcbf5a 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -15,6 +15,7 @@
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/kernel_stat.h>
+#include <linux/init.h>
#include <asm/irq.h>
#include <asm/amigahw.h>
@@ -152,7 +153,7 @@ static void cia_handler(int irq, void *dev_id, struct pt_regs *fp)
amiga_do_irq_list(base->server_irq, fp, &base->server);
}
-void cia_init_IRQ(struct ciabase *base)
+__initfunc(void cia_init_IRQ(struct ciabase *base))
{
int i;
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 8e6ae531c..08396a5bc 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -20,6 +20,7 @@
#include <linux/kd.h>
#include <linux/tty.h>
#include <linux/console.h>
+#include <linux/init.h>
#include <asm/bootinfo.h>
#include <asm/setup.h>
@@ -148,7 +149,7 @@ int amiga_parse_bootinfo(const struct bi_record *record)
* Setup the Amiga configuration info
*/
-void config_amiga(void)
+__initfunc(void config_amiga(void))
{
/* Fill in some default values, if necessary */
if (amiga_eclock == 0)
@@ -376,8 +377,8 @@ void config_amiga(void)
static unsigned short jiffy_ticks;
-static void amiga_sched_init(void (*timer_routine)(int, void *,
- struct pt_regs *))
+__initfunc(static void amiga_sched_init(void (*timer_routine)(int, void *,
+ struct pt_regs *)))
{
jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
@@ -796,7 +797,7 @@ void amiga_serial_gets(char *s, int len)
}
#endif
-static void amiga_debug_init(void)
+__initfunc(static void amiga_debug_init(void))
{
if (!strcmp( m68k_debug_device, "ser" )) {
/* no initialization required (?) */
diff --git a/arch/m68k/amiga/cyberfb.c b/arch/m68k/amiga/cyberfb.c
index d74d52c4f..31e2a4608 100644
--- a/arch/m68k/amiga/cyberfb.c
+++ b/arch/m68k/amiga/cyberfb.c
@@ -29,12 +29,13 @@
#include <linux/tty.h>
#include <linux/malloc.h>
#include <linux/delay.h>
+#include <linux/zorro.h>
+#include <linux/fb.h>
+#include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/irq.h>
-#include <linux/zorro.h>
#include <asm/pgtable.h>
-#include <linux/fb.h>
#include "s3blit.h"
@@ -1157,7 +1158,7 @@ void Cyber_video_setup(char *options, int *ints)
* Initialization
*/
-struct fb_info *Cyber_fb_init(long *mem_start)
+__initfunc(struct fb_info *Cyber_fb_init(long *mem_start))
{
int err;
struct Cyber_fb_par par;
diff --git a/arch/m68k/amiga/retz3fb.c b/arch/m68k/amiga/retz3fb.c
index 4885e48f7..49a0853bc 100644
--- a/arch/m68k/amiga/retz3fb.c
+++ b/arch/m68k/amiga/retz3fb.c
@@ -30,1762 +30,12 @@
#include <linux/malloc.h>
#include <linux/delay.h>
#include <linux/fb.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/irq.h>
#include <linux/zorro.h>
-#include <asm/pgtable.h>
-
-#include "retz3fb.h"
-
-/* #define DEBUG if(1) */
-#define DEBUG if(0)
-
-/*
- * Reserve space for one pattern line.
- *
- * For the time being we only support 4MB boards!
- */
-
-#define PAT_MEM_SIZE 16*3
-#define PAT_MEM_OFF (4*1024*1024 - PAT_MEM_SIZE)
-
-#define arraysize(x) (sizeof(x)/sizeof(*(x)))
-
-struct retz3_fb_par {
- int xres;
- int yres;
- int xres_vir;
- int yres_vir;
- int xoffset;
- int yoffset;
- int bpp;
-
- struct fb_bitfield red;
- struct fb_bitfield green;
- struct fb_bitfield blue;
- struct fb_bitfield transp;
-
- int pixclock;
- int left_margin; /* time from sync to picture */
- int right_margin; /* time from picture to sync */
- int upper_margin; /* time from sync to picture */
- int lower_margin;
- int hsync_len; /* length of horizontal sync */
- int vsync_len; /* length of vertical sync */
- int vmode;
-};
-
-struct display_data {
- long h_total; /* Horizontal Total */
- long h_sstart; /* Horizontal Sync Start */
- long h_sstop; /* Horizontal Sync Stop */
- long h_bstart; /* Horizontal Blank Start */
- long h_bstop; /* Horizontal Blank Stop */
- long h_dispend; /* Horizontal Display End */
- long v_total; /* Vertical Total */
- long v_sstart; /* Vertical Sync Start */
- long v_sstop; /* Vertical Sync Stop */
- long v_bstart; /* Vertical Blank Start */
- long v_bstop; /* Vertical Blank Stop */
- long v_dispend; /* Horizontal Display End */
-};
-
-static struct retz3_fb_par current_par;
-
-static int current_par_valid = 0;
-static int currcon = 0;
-
-static struct display disp[MAX_NR_CONSOLES];
-static struct fb_info fb_info;
-
-static int node; /* node of the /dev/fb?current file */
-
-
-/*
- * Switch for Chipset Independency
- */
-
-static struct fb_hwswitch {
-
- /* Initialisation */
-
- int (*init)(void);
-
- /* Display Control */
-
- int (*encode_fix)(struct fb_fix_screeninfo *fix, struct retz3_fb_par *par);
- int (*decode_var)(struct fb_var_screeninfo *var, struct retz3_fb_par *par);
- int (*encode_var)(struct fb_var_screeninfo *var, struct retz3_fb_par *par);
- int (*getcolreg)(unsigned int regno, unsigned int *red, unsigned
- int *green, unsigned int *blue, unsigned int *transp);
- int (*setcolreg)(unsigned int regno, unsigned int red, unsigned int
- green, unsigned int blue, unsigned int transp);
- void (*blank)(int blank);
-} *fbhw;
-
-
-/*
- * Frame Buffer Name
- */
-
-static char retz3_fb_name[16] = "RetinaZ3";
-
-
-static int z3_key = 0;
-static unsigned char retz3_color_table [256][4];
-static unsigned long z3_mem;
-static unsigned long z3_fbmem;
-static unsigned long z3_size;
-static volatile unsigned char *z3_regs;
-
-static long *memstart;
-
-
-/*
- * Predefined Video Mode Names
- */
-
-static char *retz3_fb_modenames[] = {
-
- /*
- * Autodetect (Default) Video Mode
- */
-
- "default",
-
- /*
- * Predefined Video Modes
- */
-
- "640x480", /* RetinaZ3 8 bpp */
- "800x600", /* RetinaZ3 8 bpp */
- "1024x768i",
- "640x480-16", /* RetinaZ3 16 bpp */
- "640x480-24", /* RetinaZ3 24 bpp */
-
- /*
- * Dummy Video Modes
- */
-
- "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy",
- "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy",
- "dummy", "dummy", "dummy", "dummy", "dummy", "dummy",
-
- /*
- * User Defined Video Modes
- *
- * This doesn't work yet!!
- */
-
- "user0", "user1", "user2", "user3",
- "user4", "user5", "user6", "user7"
-};
-
-/*
- * A small info on how to convert XFree86 timing values into fb
- * timings - by Frank Neumann:
- *
-An XFree86 mode line consists of the following fields:
- "800x600" 50 800 856 976 1040 600 637 643 666
- < name > DCF HR SH1 SH2 HFL VR SV1 SV2 VFL
-
-The fields in the fb_var_screeninfo structure are:
- unsigned long pixclock; * pixel clock in ps (pico seconds) *
- unsigned long left_margin; * time from sync to picture *
- unsigned long right_margin; * time from picture to sync *
- unsigned long upper_margin; * time from sync to picture *
- unsigned long lower_margin;
- unsigned long hsync_len; * length of horizontal sync *
- unsigned long vsync_len; * length of vertical sync *
-
-1) Pixelclock:
- xfree: in MHz
- fb: In Picoseconds (ps)
-
- pixclock = 1000000 / DCF
-
-2) horizontal timings:
- left_margin = HFL - SH2
- right_margin = SH1 - HR
- hsync_len = SH2 - SH1
-
-3) vertical timings:
- upper_margin = VFL - SV2
- lower_margin = SV1 - VR
- vsync_len = SV2 - SV1
-
-Good examples for VESA timings can be found in the XFree86 source tree,
-under "programs/Xserver/hw/xfree86/doc/modeDB.txt".
-*/
-
-/*
- * Predefined Video Mode Definitions
- */
-
-static struct fb_var_screeninfo retz3_fb_predefined[] = {
-
- /*
- * Autodetect (Default) Video Mode
- */
-
- { 0, },
-
- /*
- * Predefined Video Modes
- */
-
- /*
- * NB: it is very important to adjust the pixel-clock to the color-depth.
- */
-
- {
- 640, 480, 640, 480, 0, 0, 8, 0,
- {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_RETINAZ3, 38461, 28, 32, 12, 10, 96, 2,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
- },
- /*
- ModeLine "800x600" 36 800 824 896 1024 600 601 603 625
- < name > DCF HR SH1 SH2 HFL VR SV1 SV2 VFL
- */
- {
- /* 800 x 600, 8 bpp */
- 800, 600, 800, 600, 0, 0, 8, 0,
- {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_RETINAZ3, 27778, 64, 24, 22, 1, 120, 2,
- FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
- },
- /*
- ModeLine "1024x768i" 45 1024 1064 1224 1264 768 777 785 817 interlace
- < name > DCF HR SH1 SH2 HFL VR SV1 SV2 VFL
- */
- {
- /* 1024 x 768, 8 bpp, interlaced */
- 1024, 768, 1024, 768, 0, 0, 8, 0,
- {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_RETINAZ3, 22222, 40, 40, 32, 9, 160, 8,
- FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED
- },
- {
- 640, 480, 640, 480, 0, 0, 16, 0,
- {11, 5, 0}, {5, 6, 0}, {0, 5, 0}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_RETINAZ3, 38461/2, 28, 32, 12, 10, 96, 2,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
- },
- {
- 640, 480, 640, 480, 0, 0, 24, 0,
- {8, 8, 8}, {8, 8, 8}, {8, 8, 8}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_RETINAZ3, 38461/3, 28, 32, 12, 10, 96, 2,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
- },
-
- /*
- * Dummy Video Modes
- */
-
- { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, },
- { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, },
- { 0, }, { 0, },
-
- /*
- * User Defined Video Modes
- */
-
- { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }, { 0, }
-};
-
-
-#define NUM_TOTAL_MODES arraysize(retz3_fb_predefined)
-#define NUM_PREDEF_MODES (5)
-
-
-static int z3fb_inverse = 0;
-static int z3fb_mode = 0;
-
-
-/*
- * Interface used by the world
- */
-
-int retz3_probe(void);
-void retz3_video_setup(char *options, int *ints);
-
-static int retz3_fb_get_fix(struct fb_fix_screeninfo *fix, int con);
-static int retz3_fb_get_var(struct fb_var_screeninfo *var, int con);
-static int retz3_fb_set_var(struct fb_var_screeninfo *var, int con);
-static int retz3_fb_get_cmap(struct fb_cmap *cmap, int kspc, int con);
-static int retz3_fb_set_cmap(struct fb_cmap *cmap, int kspc, int con);
-static int retz3_fb_pan_display(struct fb_var_screeninfo *var, int con);
-static int retz3_fb_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg, int con);
-
-
-/*
- * Interface to the low level console driver
- */
-
-struct fb_info *retz3_fb_init(long *mem_start); /* Through amiga_fb_init() */
-static int z3fb_switch(int con);
-static int z3fb_updatevar(int con);
-static void z3fb_blank(int blank);
-static int z3fb_setcmap(struct fb_cmap *cmap, int con);
-
-
-/*
- * Accelerated Functions used by the low level console driver
- */
-
-void retz3_bitblt(struct fb_var_screeninfo *scr,
- unsigned short curx, unsigned short cury, unsigned
- short destx, unsigned short desty, unsigned short
- width, unsigned short height, unsigned short cmd,
- unsigned short mask);
-void retz3_fill(unsigned short x, unsigned short y, unsigned short
- width, unsigned short height, unsigned short mode,
- unsigned short color);
-
-/*
- * Hardware Specific Routines
- */
-
-static int retz3_init(void);
-static int retz3_encode_fix(struct fb_fix_screeninfo *fix,
- struct retz3_fb_par *par);
-static int retz3_decode_var(struct fb_var_screeninfo *var,
- struct retz3_fb_par *par);
-static int retz3_encode_var(struct fb_var_screeninfo *var,
- struct retz3_fb_par *par);
-static int retz3_getcolreg(unsigned int regno, unsigned int *red,
- unsigned int *green, unsigned int *blue,
- unsigned int *transp);
-static int retz3_setcolreg(unsigned int regno, unsigned int red,
- unsigned int green, unsigned int blue,
- unsigned int transp);
-static void retz3_blank(int blank);
-
-
-/*
- * Internal routines
- */
-
-static void retz3_fb_get_par(struct retz3_fb_par *par);
-static void retz3_fb_set_par(struct retz3_fb_par *par);
-static int do_fb_set_var(struct fb_var_screeninfo *var, int isactive);
-static struct fb_cmap *get_default_colormap(int bpp);
-static int do_fb_get_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var,
- int kspc);
-static int do_fb_set_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var,
- int kspc);
-static void do_install_cmap(int con);
-static void memcpy_fs(int fsfromto, void *to, void *from, int len);
-static void copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto);
-static int alloc_cmap(struct fb_cmap *cmap, int len, int transp);
-static void retz3_fb_set_disp(int con);
-static int get_video_mode(const char *name);
-
-
-/* -------------------- Hardware specific routines -------------------------- */
-
-static unsigned short find_fq(unsigned int freq)
-{
- unsigned long f;
- long tmp;
- long prev = 0x7fffffff;
- long n2, n1 = 3;
- unsigned long m;
- unsigned short res = 0;
-
- if (freq <= 31250000)
- n2 = 3;
- else if (freq <= 62500000)
- n2 = 2;
- else if (freq <= 125000000)
- n2 = 1;
- else if (freq <= 250000000)
- n2 = 0;
- else
- return(0);
-
-
- do {
- f = freq >> (10 - n2);
-
- m = (f * n1) / (14318180/1024);
-
- if (m > 129)
- break;
-
- tmp = (((m * 14318180) >> n2) / n1) - freq;
- if (tmp < 0)
- tmp = -tmp;
-
- if (tmp < prev) {
- prev = tmp;
- res = (((n2 << 5) | (n1-2)) << 8) | (m-2);
- }
-
- } while ( (++n1) <= 21);
-
- return res;
-}
-
-
-static int retz3_set_video(struct fb_var_screeninfo *var,
- struct retz3_fb_par *par)
-{
- float freq_f;
- long freq;
-
- int xres, hfront, hsync, hback;
- int yres, vfront, vsync, vback;
- unsigned char tmp;
- unsigned short best_freq;
- struct display_data data;
-
- short clocksel = 0; /* Apparantly this is always zero */
-
- int bpp = var->bits_per_pixel;
-
- /*
- * XXX
- */
- if (bpp == 24)
- return 0;
-
- if ((bpp != 8) && (bpp != 16) && (bpp != 24))
- return -EFAULT;
-
- par->xoffset = 0;
- par->yoffset = 0;
-
- xres = var->xres * bpp / 4;
- hfront = var->right_margin * bpp / 4;
- hsync = var->hsync_len * bpp / 4;
- hback = var->left_margin * bpp / 4;
-
- if (var->vmode & FB_VMODE_DOUBLE)
- {
- yres = var->yres * 2;
- vfront = var->lower_margin * 2;
- vsync = var->vsync_len * 2;
- vback = var->upper_margin * 2;
- }
- else if (var->vmode & FB_VMODE_INTERLACED)
- {
- yres = (var->yres + 1) / 2;
- vfront = (var->lower_margin + 1) / 2;
- vsync = (var->vsync_len + 1) / 2;
- vback = (var->upper_margin + 1) / 2;
- }
- else
- {
- yres = var->yres; /* -1 ? */
- vfront = var->lower_margin;
- vsync = var->vsync_len;
- vback = var->upper_margin;
- }
-
- data.h_total = (hback / 8) + (xres / 8)
- + (hfront / 8) + (hsync / 8) - 1 /* + 1 */;
- data.h_dispend = ((xres + bpp - 1)/ 8) - 1;
- data.h_bstart = xres / 8 /* + 1 */;
-
- data.h_bstop = data.h_total+1 + 2 + 1;
- data.h_sstart = (xres / 8) + (hfront / 8) + 1;
- data.h_sstop = (xres / 8) + (hfront / 8) + (hsync / 8) + 1;
-
- data.v_total = yres + vfront + vsync + vback - 1;
-
- data.v_dispend = yres - 1;
- data.v_bstart = yres;
-
- data.v_bstop = data.v_total;
- data.v_sstart = yres + vfront - 1 - 2;
- data.v_sstop = yres + vfront + vsync - 1;
-
-#if 0 /* testing */
-
- printk("HBS: %i\n", data.h_bstart);
- printk("HSS: %i\n", data.h_sstart);
- printk("HSE: %i\n", data.h_sstop);
- printk("HBE: %i\n", data.h_bstop);
- printk("HT: %i\n", data.h_total);
-
- printk("hsync: %i\n", hsync);
- printk("hfront: %i\n", hfront);
- printk("hback: %i\n", hback);
-
- printk("VBS: %i\n", data.v_bstart);
- printk("VSS: %i\n", data.v_sstart);
- printk("VSE: %i\n", data.v_sstop);
- printk("VBE: %i\n", data.v_bstop);
- printk("VT: %i\n", data.v_total);
-
- printk("vsync: %i\n", vsync);
- printk("vfront: %i\n", vfront);
- printk("vback: %i\n", vback);
-#endif
-
- if (data.v_total >= 1024)
- printk("MAYDAY: v_total >= 1024; bailing out!\n");
-
- reg_w(GREG_MISC_OUTPUT_W, 0xe3 | ((clocksel & 3) * 0x04));
- reg_w(GREG_FEATURE_CONTROL_W, 0x00);
-
- seq_w(SEQ_RESET, 0x00);
- seq_w(SEQ_RESET, 0x03); /* reset sequencer logic */
-
- /*
- * CLOCKING_MODE bits:
- * 2: This one is only set for certain text-modes, wonder if
- * it may be for EGA-lines? (it was referred to as CLKDIV2)
- * (The CL drivers sets it to 0x21 with the comment:
- * FullBandwidth (video off) and 8/9 dot clock)
- */
- seq_w(SEQ_CLOCKING_MODE, 0x01 | 0x00 /* 0x08 */);
-
- seq_w(SEQ_MAP_MASK, 0x0f); /* enable writing to plane 0-3 */
- seq_w(SEQ_CHAR_MAP_SELECT, 0x00); /* doesn't matter in gfx-mode */
- seq_w(SEQ_MEMORY_MODE, 0x06); /* CL driver says 0x0e for 256 col mode*/
- seq_w(SEQ_RESET, 0x01);
- seq_w(SEQ_RESET, 0x03);
-
- seq_w(SEQ_EXTENDED_ENABLE, 0x05);
-
- seq_w(SEQ_CURSOR_CONTROL, 0x00); /* disable cursor */
- seq_w(SEQ_PRIM_HOST_OFF_HI, 0x00);
- seq_w(SEQ_PRIM_HOST_OFF_HI, 0x00);
- seq_w(SEQ_LINEAR_0, 0x4a);
- seq_w(SEQ_LINEAR_1, 0x00);
-
- seq_w(SEQ_SEC_HOST_OFF_HI, 0x00);
- seq_w(SEQ_SEC_HOST_OFF_LO, 0x00);
- seq_w(SEQ_EXTENDED_MEM_ENA, 0x3 | 0x4 | 0x10 | 0x40);
-
- /*
- * The lower 4 bits (0-3) are used to set the font-width for
- * text-mode - DON'T try to set this for gfx-mode.
- */
- seq_w(SEQ_EXT_CLOCK_MODE, 0x10);
- seq_w(SEQ_EXT_VIDEO_ADDR, 0x03);
-
- /*
- * Extended Pixel Control:
- * bit 0: text-mode=0, gfx-mode=1 (Graphics Byte ?)
- * bit 1: (Packed/Nibble Pixel Format ?)
- * bit 4-5: depth, 0=1-8bpp, 1=9-16bpp, 2=17-24bpp
- */
- seq_w(SEQ_EXT_PIXEL_CNTL, 0x01 | (((bpp / 8) - 1) << 4));
-
- seq_w(SEQ_BUS_WIDTH_FEEDB, 0x04);
- seq_w(SEQ_COLOR_EXP_WFG, 0x01);
- seq_w(SEQ_COLOR_EXP_WBG, 0x00);
- seq_w(SEQ_EXT_RW_CONTROL, 0x00);
- seq_w(SEQ_MISC_FEATURE_SEL, (0x51 | (clocksel & 8)));
- seq_w(SEQ_COLOR_KEY_CNTL, 0x40);
- seq_w(SEQ_COLOR_KEY_MATCH0, 0x00);
- seq_w(SEQ_COLOR_KEY_MATCH1, 0x00);
- seq_w(SEQ_COLOR_KEY_MATCH2, 0x00);
- seq_w(SEQ_CRC_CONTROL, 0x00);
- seq_w(SEQ_PERF_SELECT, 0x10);
- seq_w(SEQ_ACM_APERTURE_1, 0x00);
- seq_w(SEQ_ACM_APERTURE_2, 0x30);
- seq_w(SEQ_ACM_APERTURE_3, 0x00);
- seq_w(SEQ_MEMORY_MAP_CNTL, 0x03);
-
-
- /* unlock register CRT0..CRT7 */
- crt_w(CRT_END_VER_RETR, (data.v_sstop & 0x0f) | 0x20);
-
- /* Zuerst zu schreibende Werte nur per printk ausgeben */
- DEBUG printk("CRT_HOR_TOTAL: %ld\n", data.h_total);
- crt_w(CRT_HOR_TOTAL, data.h_total & 0xff);
-
- DEBUG printk("CRT_HOR_DISP_ENA_END: %ld\n", data.h_dispend);
- crt_w(CRT_HOR_DISP_ENA_END, (data.h_dispend) & 0xff);
-
- DEBUG printk("CRT_START_HOR_BLANK: %ld\n", data.h_bstart);
- crt_w(CRT_START_HOR_BLANK, data.h_bstart & 0xff);
-
- DEBUG printk("CRT_END_HOR_BLANK: 128+%ld\n", data.h_bstop % 32);
- crt_w(CRT_END_HOR_BLANK, 0x80 | (data.h_bstop & 0x1f));
-
- DEBUG printk("CRT_START_HOR_RETR: %ld\n", data.h_sstart);
- crt_w(CRT_START_HOR_RETR, data.h_sstart & 0xff);
-
- tmp = (data.h_sstop & 0x1f);
- if (data.h_bstop & 0x20)
- tmp |= 0x80;
- DEBUG printk("CRT_END_HOR_RETR: %d\n", tmp);
- crt_w(CRT_END_HOR_RETR, tmp);
-
- DEBUG printk("CRT_VER_TOTAL: %ld\n", data.v_total & 0xff);
- crt_w(CRT_VER_TOTAL, (data.v_total & 0xff));
-
- tmp = 0x10; /* LineCompare bit #9 */
- if (data.v_total & 256)
- tmp |= 0x01;
- if (data.v_dispend & 256)
- tmp |= 0x02;
- if (data.v_sstart & 256)
- tmp |= 0x04;
- if (data.v_bstart & 256)
- tmp |= 0x08;
- if (data.v_total & 512)
- tmp |= 0x20;
- if (data.v_dispend & 512)
- tmp |= 0x40;
- if (data.v_sstart & 512)
- tmp |= 0x80;
- DEBUG printk("CRT_OVERFLOW: %d\n", tmp);
- crt_w(CRT_OVERFLOW, tmp);
-
- crt_w(CRT_PRESET_ROW_SCAN, 0x00); /* not CL !!! */
-
- tmp = 0x40; /* LineCompare bit #8 */
- if (data.v_bstart & 512)
- tmp |= 0x20;
- if (var->vmode & FB_VMODE_DOUBLE)
- tmp |= 0x80;
- DEBUG printk("CRT_MAX_SCAN_LINE: %d\n", tmp);
- crt_w(CRT_MAX_SCAN_LINE, tmp);
-
- crt_w(CRT_CURSOR_START, 0x00);
- crt_w(CRT_CURSOR_END, 8 & 0x1f); /* font height */
-
- crt_w(CRT_START_ADDR_HIGH, 0x00);
- crt_w(CRT_START_ADDR_LOW, 0x00);
-
- crt_w(CRT_CURSOR_LOC_HIGH, 0x00);
- crt_w(CRT_CURSOR_LOC_LOW, 0x00);
-
- DEBUG printk("CRT_START_VER_RETR: %ld\n", data.v_sstart & 0xff);
- crt_w(CRT_START_VER_RETR, (data.v_sstart & 0xff));
-
-#if 1
- /* 5 refresh cycles per scanline */
- DEBUG printk("CRT_END_VER_RETR: 64+32+%ld\n", data.v_sstop % 16);
- crt_w(CRT_END_VER_RETR, ((data.v_sstop & 0x0f) | 0x40 | 0x20));
-#else
- DEBUG printk("CRT_END_VER_RETR: 128+32+%ld\n", data.v_sstop % 16);
- crt_w(CRT_END_VER_RETR, ((data.v_sstop & 0x0f) | 128 | 32));
-#endif
- DEBUG printk("CRT_VER_DISP_ENA_END: %ld\n", data.v_dispend & 0xff);
- crt_w(CRT_VER_DISP_ENA_END, (data.v_dispend & 0xff));
-
- DEBUG printk("CRT_START_VER_BLANK: %ld\n", data.v_bstart & 0xff);
- crt_w(CRT_START_VER_BLANK, (data.v_bstart & 0xff));
-
- DEBUG printk("CRT_END_VER_BLANK: %ld\n", data.v_bstop & 0xff);
- crt_w(CRT_END_VER_BLANK, (data.v_bstop & 0xff));
-
- DEBUG printk("CRT_MODE_CONTROL: 0xe3\n");
- crt_w(CRT_MODE_CONTROL, 0xe3);
-
- DEBUG printk("CRT_LINE_COMPARE: 0xff\n");
- crt_w(CRT_LINE_COMPARE, 0xff);
-
- tmp = (var->xres_virtual / 8) * (bpp / 8);
- crt_w(CRT_OFFSET, tmp);
-
- crt_w(CRT_UNDERLINE_LOC, 0x07); /* probably font-height - 1 */
-
- tmp = 0x20; /* Enable extended end bits */
- if (data.h_total & 0x100)
- tmp |= 0x01;
- if ((data.h_dispend) & 0x100)
- tmp |= 0x02;
- if (data.h_bstart & 0x100)
- tmp |= 0x04;
- if (data.h_sstart & 0x100)
- tmp |= 0x08;
- if (var->vmode & FB_VMODE_INTERLACED)
- tmp |= 0x10;
- DEBUG printk("CRT_EXT_HOR_TIMING1: %d\n", tmp);
- crt_w(CRT_EXT_HOR_TIMING1, tmp);
-
- tmp = 0x00;
- if (((var->xres_virtual / 8) * (bpp / 8)) & 0x100)
- tmp |= 0x10;
- crt_w(CRT_EXT_START_ADDR, tmp);
-
- tmp = 0x00;
- if (data.h_total & 0x200)
- tmp |= 0x01;
- if ((data.h_dispend) & 0x200)
- tmp |= 0x02;
- if (data.h_bstart & 0x200)
- tmp |= 0x04;
- if (data.h_sstart & 0x200)
- tmp |= 0x08;
- tmp |= ((data.h_bstop & 0xc0) >> 2);
- tmp |= ((data.h_sstop & 0x60) << 1);
- crt_w(CRT_EXT_HOR_TIMING2, tmp);
- DEBUG printk("CRT_EXT_HOR_TIMING2: %d\n", tmp);
-
- tmp = 0x10; /* Line compare bit 10 */
- if (data.v_total & 0x400)
- tmp |= 0x01;
- if ((data.v_dispend) & 0x400)
- tmp |= 0x02;
- if (data.v_bstart & 0x400)
- tmp |= 0x04;
- if (data.v_sstart & 0x400)
- tmp |= 0x08;
- tmp |= ((data.v_bstop & 0x300) >> 3);
- if (data.v_sstop & 0x10)
- tmp |= 0x80;
- crt_w(CRT_EXT_VER_TIMING, tmp);
- DEBUG printk("CRT_EXT_VER_TIMING: %d\n", tmp);
-
- crt_w(CRT_MONITOR_POWER, 0x00);
-
- /*
- * Convert from ps to Hz.
- */
- freq_f = (1.0/(float)var->pixclock) * 1000000000;
- freq = ((long)freq_f) * 1000;
-
- best_freq = find_fq(freq);
- pll_w(0x02, best_freq);
- best_freq = find_fq(61000000);
- pll_w(0x0a, best_freq);
- pll_w(0x0e, 0x22);
-
- gfx_w(GFX_SET_RESET, 0x00);
- gfx_w(GFX_ENABLE_SET_RESET, 0x00);
- gfx_w(GFX_COLOR_COMPARE, 0x00);
- gfx_w(GFX_DATA_ROTATE, 0x00);
- gfx_w(GFX_READ_MAP_SELECT, 0x00);
- gfx_w(GFX_GRAPHICS_MODE, 0x00);
- gfx_w(GFX_MISC, 0x05);
- gfx_w(GFX_COLOR_XCARE, 0x0f);
- gfx_w(GFX_BITMASK, 0xff);
-
- reg_r(ACT_ADDRESS_RESET);
- attr_w(ACT_PALETTE0 , 0x00);
- attr_w(ACT_PALETTE1 , 0x01);
- attr_w(ACT_PALETTE2 , 0x02);
- attr_w(ACT_PALETTE3 , 0x03);
- attr_w(ACT_PALETTE4 , 0x04);
- attr_w(ACT_PALETTE5 , 0x05);
- attr_w(ACT_PALETTE6 , 0x06);
- attr_w(ACT_PALETTE7 , 0x07);
- attr_w(ACT_PALETTE8 , 0x08);
- attr_w(ACT_PALETTE9 , 0x09);
- attr_w(ACT_PALETTE10, 0x0a);
- attr_w(ACT_PALETTE11, 0x0b);
- attr_w(ACT_PALETTE12, 0x0c);
- attr_w(ACT_PALETTE13, 0x0d);
- attr_w(ACT_PALETTE14, 0x0e);
- attr_w(ACT_PALETTE15, 0x0f);
- reg_r(ACT_ADDRESS_RESET);
-
- attr_w(ACT_ATTR_MODE_CNTL, 0x09); /* 0x01 for CL */
-
- attr_w(ACT_OVERSCAN_COLOR, 0x00);
- attr_w(ACT_COLOR_PLANE_ENA, 0x0f);
- attr_w(ACT_HOR_PEL_PANNING, 0x00);
- attr_w(ACT_COLOR_SELECT, 0x00);
-
- reg_r(ACT_ADDRESS_RESET);
- reg_w(ACT_DATA, 0x20);
-
- reg_w(VDAC_MASK, 0xff);
-
- /*
- * Extended palette adressing ???
- */
- switch (bpp){
- case 8:
- reg_w(0x83c6, 0x00);
- break;
- case 16:
- reg_w(0x83c6, 0x60);
- break;
- case 24:
- reg_w(0x83c6, 0xe0);
- break;
- default:
- printk("Illegal color-depth: %i\n", bpp);
- }
-
- reg_w(VDAC_ADDRESS, 0x00);
-
- seq_w(SEQ_MAP_MASK, 0x0f );
-
- return 0;
-}
-
-/*
- * Initialization
- *
- * Set the default video mode for this chipset. If a video mode was
- * specified on the command line, it will override the default mode.
- */
-
-static int retz3_init(void)
-{
- int i;
-#if 0
- volatile unsigned long *CursorBase;
-#endif
- unsigned long board_addr, board_size;
- struct ConfigDev *cd;
-
- cd = zorro_get_board (z3_key);
- zorro_config_board (z3_key, 0);
- board_addr = (unsigned long)cd->cd_BoardAddr;
- board_size = (unsigned long)cd->cd_BoardSize;
-
- for (i = 0; i < 256; i++){
- for (i = 0; i < 256; i++){
- retz3_color_table [i][0] = i;
- retz3_color_table [i][1] = i;
- retz3_color_table [i][2] = i;
- retz3_color_table [i][3] = 0;
- }
- }
-
- *memstart = (*memstart + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
-
- z3_mem = kernel_map (board_addr, board_size,
- KERNELMAP_NOCACHE_SER, memstart);
-
- z3_regs = (char*) z3_mem;
- z3_fbmem = z3_mem + VIDEO_MEM_OFFSET;
-
- /* Get memory size - for now we asume its a 4MB board */
-
- z3_size = 0x00400000; /* 4 MB */
-
- memset ((char*)z3_fbmem, 0, z3_size);
-
- /* Disable hardware cursor */
-
- seq_w(SEQ_CURSOR_Y_INDEX, 0x00);
-
-
-#if 0
- /* Initialize hardware cursor */
- CursorBase = (unsigned long *)((char *)(z3_mem) + z3_size - 0x400);
- for (i=0; i < 8; i++){
- *(CursorBase +(i*4)) = 0xffffff00;
- *(CursorBase+1+(i*4)) = 0xffff0000;
- *(CursorBase+2+(i*4)) = 0xffff0000;
- *(CursorBase+3+(i*4)) = 0xffff0000;
- }
- for (i=8; i < 64; i++){
- *(CursorBase +(i*4)) = 0xffff0000;
- *(CursorBase+1+(i*4)) = 0xffff0000;
- *(CursorBase+2+(i*4)) = 0xffff0000;
- *(CursorBase+3+(i*4)) = 0xffff0000;
- }
-#endif
-
- retz3_setcolreg (255, 56, 100, 160, 0);
- retz3_setcolreg (254, 0, 0, 0, 0);
-
- return 0;
-}
-
-
-/*
- * This function should fill in the `fix' structure based on the
- * values in the `par' structure.
- */
-
-static int retz3_encode_fix(struct fb_fix_screeninfo *fix,
- struct retz3_fb_par *par)
-{
- int i;
-
- strcpy(fix->id, retz3_fb_name);
- fix->smem_start = z3_fbmem;
- fix->smem_len = z3_size;
-
- fix->type = FB_TYPE_PACKED_PIXELS;
- fix->type_aux = 0;
- if (par->bpp == 8)
- fix->visual = FB_VISUAL_PSEUDOCOLOR;
- else
- fix->visual = FB_VISUAL_DIRECTCOLOR;
-
- fix->xpanstep = 0;
- fix->ypanstep = 0;
- fix->ywrapstep = 0;
- fix->line_length = 0;
-
- for (i = 0; i < arraysize(fix->reserved); i++)
- fix->reserved[i] = 0;
-
- return 0;
-}
-
-
-/*
- * Get the video params out of `var'. If a value doesn't fit, round
- * it up, if it's too big, return -EINVAL.
- */
-
-static int retz3_decode_var(struct fb_var_screeninfo *var,
- struct retz3_fb_par *par)
-{
- par->xres = var->xres;
- par->yres = var->yres;
- par->xres_vir = var->xres_virtual;
- par->yres_vir = var->yres_virtual;
- par->bpp = var->bits_per_pixel;
- par->pixclock = var->pixclock;
- par->vmode = var->vmode;
-
- par->red = var->red;
- par->green = var->green;
- par->blue = var->blue;
- par->transp = var->transp;
-
- par->left_margin = var->left_margin;
- par->right_margin = var->right_margin;
- par->upper_margin = var->upper_margin;
- par->lower_margin = var->lower_margin;
- par->hsync_len = var->hsync_len;
- par->vsync_len = var->vsync_len;
-
- return 0;
-}
-
-
-/*
- * Fill the `var' structure based on the values in `par' and maybe
- * other values read out of the hardware.
- */
-
-static int retz3_encode_var(struct fb_var_screeninfo *var,
- struct retz3_fb_par *par)
-{
- int i;
-
- var->xres = par->xres;
- var->yres = par->yres;
- var->xres_virtual = par->xres_vir;
- var->yres_virtual = par->yres_vir;
- var->xoffset = 0;
- var->yoffset = 0;
-
- var->bits_per_pixel = par->bpp;
- var->grayscale = 0;
-
- var->red = par->red;
- var->green = par->green;
- var->blue = par->blue;
- var->transp = par->transp;
-
- var->nonstd = 0;
- var->activate = 0;
-
- var->height = -1;
- var->width = -1;
-
- var->accel = FB_ACCEL_RETINAZ3;
-
- var->pixclock = par->pixclock;
-
- var->sync = 0; /* ??? */
- var->left_margin = par->left_margin;
- var->right_margin = par->right_margin;
- var->upper_margin = par->upper_margin;
- var->lower_margin = par->lower_margin;
- var->hsync_len = par->hsync_len;
- var->vsync_len = par->vsync_len;
-
- for (i = 0; i < arraysize(var->reserved); i++)
- var->reserved[i] = 0;
-
- var->vmode = par->vmode;
- return 0;
-}
-
-
-/*
- * Set a single color register. The values supplied are already
- * rounded down to the hardware's capabilities (according to the
- * entries in the var structure). Return != 0 for invalid regno.
- */
-
-static int retz3_setcolreg(unsigned int regno, unsigned int red,
- unsigned int green, unsigned int blue,
- unsigned int transp)
-{
- /* We'll get to this */
-
- if (regno > 255)
- return 1;
-
- retz3_color_table [regno][0] = red & 0xff;
- retz3_color_table [regno][1] = green & 0xff;
- retz3_color_table [regno][2] = blue & 0xff;
- retz3_color_table [regno][3] = transp;
-
- reg_w(VDAC_ADDRESS_W, regno);
- reg_w(VDAC_DATA, (red & 0xff) >> 2);
- reg_w(VDAC_DATA, (green & 0xff) >> 2);
- reg_w(VDAC_DATA, (blue & 0xff) >> 2);
-
- return 0;
-}
-
-
-/*
- * Read a single color register and split it into
- * colors/transparent. Return != 0 for invalid regno.
- */
-
-static int retz3_getcolreg(unsigned int regno, unsigned int *red,
- unsigned int *green, unsigned int *blue,
- unsigned int *transp)
-{
- if (regno > 255)
- return 1;
- *red = retz3_color_table [regno][0];
- *green = retz3_color_table [regno][1];
- *blue = retz3_color_table [regno][2];
- *transp = retz3_color_table [regno][3];
- return 0;
-}
-
-
-/*
- * (Un)Blank the screen
- */
-
-void retz3_blank(int blank)
-{
- int i;
-
- if (blank)
- for (i = 0; i < 256; i++){
- reg_w(VDAC_ADDRESS_W, i);
- reg_w(VDAC_DATA, 0);
- reg_w(VDAC_DATA, 0);
- reg_w(VDAC_DATA, 0);
- }
- else
- for (i = 0; i < 256; i++){
- reg_w(VDAC_ADDRESS_W, i);
- reg_w(VDAC_DATA, retz3_color_table [i][0] >> 2);
- reg_w(VDAC_DATA, retz3_color_table [i][1] >> 2);
- reg_w(VDAC_DATA, retz3_color_table [i][2] >> 2);
- }
-}
-
-
-void retz3_bitblt (struct fb_var_screeninfo *var,
- unsigned short srcx, unsigned short srcy, unsigned
- short destx, unsigned short desty, unsigned short
- width, unsigned short height, unsigned short cmd,
- unsigned short mask)
-{
-
- volatile unsigned long *acm = (unsigned long *) (z3_mem + ACM_OFFSET);
- unsigned long *pattern = (unsigned long *)(z3_fbmem + PAT_MEM_OFF);
-
- unsigned short mod;
- unsigned long tmp;
- unsigned long pat, src, dst;
- unsigned char blt_status;
-
- int i, xres_virtual = var->xres_virtual;
- short bpp = (var->bits_per_pixel & 0xff);
-
- if (bpp < 8)
- bpp = 8;
-
- tmp = mask | (mask << 16);
-
-#if 0
- /*
- * Check for blitter finished before we start messing with the
- * pattern.
- */
- do{
- blt_status = *(((volatile unsigned char *)acm) +
- (ACM_START_STATUS + 2));
- }while ((blt_status & 1) == 0);
-#endif
-
- i = 0;
- do{
- *pattern++ = tmp;
- }while(i++ < bpp/4);
-
- tmp = cmd << 8;
- *(acm + ACM_RASTEROP_ROTATION/4) = tmp;
-
- mod = 0xc0c2;
-
- pat = 8 * PAT_MEM_OFF;
- dst = bpp * (destx + desty * xres_virtual);
-
- /*
- * Source is not set for clear.
- */
- if ((cmd != Z3BLTclear) && (cmd != Z3BLTset)) {
- src = bpp * (srcx + srcy * xres_virtual);
-
- if (destx > srcx) {
- mod &= ~0x8000;
- src += bpp * (width - 1);
- dst += bpp * (width - 1);
- pat += bpp * 2;
- }
- if (desty > srcy) {
- mod &= ~0x4000;
- src += bpp * (height - 1) * xres_virtual;
- dst += bpp * (height - 1) * xres_virtual;
- pat += bpp * 4;
- }
-
- *(acm + ACM_SOURCE/4) = cpu_to_le32(src);
- }
-
- *(acm + ACM_PATTERN/4) = cpu_to_le32(pat);
-
- *(acm + ACM_DESTINATION/4) = cpu_to_le32(dst);
-
- tmp = mod << 16;
- *(acm + ACM_CONTROL/4) = tmp;
-
- tmp = width | (height << 16);
-
- *(acm + ACM_BITMAP_DIMENSION/4) = cpu_to_le32(tmp);
-
- *(((volatile unsigned char *)acm) + ACM_START_STATUS) = 0x00;
- *(((volatile unsigned char *)acm) + ACM_START_STATUS) = 0x01;
-
- /*
- * No reason to wait for the blitter to finish, it is better
- * just to check if it has finished before we use it again.
- */
-#if 1
-#if 0
- while ((*(((volatile unsigned char *)acm) +
- (ACM_START_STATUS + 2)) & 1) == 0);
-#else
- do{
- blt_status = *(((volatile unsigned char *)acm) +
- (ACM_START_STATUS + 2));
- }
- while ((blt_status & 1) == 0);
-#endif
-#endif
-}
+#include <linux/init.h>
-#if 0
-void retz3_fill (unsigned short x, unsigned short y, unsigned
- short width, unsigned short height,
- unsigned short mode, unsigned short color)
-{
-
-}
-#endif
-
-
-/**************************************************************
- * Move cursor to x, y
- */
-void retz3_MoveCursor (unsigned short x, unsigned short y)
-{
- /* Guess we gotta deal with the cursor at some point */
-}
-
-
-/* -------------------- Interfaces to hardware functions -------------------- */
-
-
-static struct fb_hwswitch retz3_switch = {
- retz3_init, retz3_encode_fix, retz3_decode_var, retz3_encode_var,
- retz3_getcolreg, retz3_setcolreg, retz3_blank
-};
-
-
-/* -------------------- Generic routines ------------------------------------ */
-
-
-/*
- * Fill the hardware's `par' structure.
- */
-
-static void retz3_fb_get_par(struct retz3_fb_par *par)
-{
- if (current_par_valid)
- *par = current_par;
- else
- fbhw->decode_var(&retz3_fb_predefined[z3fb_mode], par);
-}
-
-
-static void retz3_fb_set_par(struct retz3_fb_par *par)
-{
- current_par = *par;
- current_par_valid = 1;
-}
-
-
-static int do_fb_set_var(struct fb_var_screeninfo *var, int isactive)
-{
- int err, activate;
- struct retz3_fb_par par;
-
- if ((err = fbhw->decode_var(var, &par)))
- return err;
- activate = var->activate;
- if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW && isactive)
- retz3_fb_set_par(&par);
- fbhw->encode_var(var, &par);
- var->activate = activate;
-
-#if 1
- retz3_set_video(var, &current_par);
-#endif
- return 0;
-}
-
-
-/*
- * Default Colormaps
- */
-
-static unsigned short red16[] =
- { 0x0000, 0x0000, 0x0000, 0x0000, 0xc000, 0xc000, 0xc000, 0xc000,
- 0x8000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff };
-static unsigned short green16[] =
- { 0x0000, 0x0000, 0xc000, 0xc000, 0x0000, 0x0000, 0xc000, 0xc000,
- 0x8000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff };
-static unsigned short blue16[] =
- { 0x0000, 0xc000, 0x0000, 0xc000, 0x0000, 0xc000, 0x0000, 0xc000,
- 0x8000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff };
-
-
-static struct fb_cmap default_16_colors =
- { 0, 16, red16, green16, blue16, NULL };
-
-
-static struct fb_cmap *get_default_colormap(int bpp)
-{
- return &default_16_colors;
-}
-
-
-#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7fff-(val))>>16)
-#define CNVT_FROMHW(val,width) (((width) ? ((((val)<<16)-(val)) / \
- ((1<<(width))-1)) : 0))
-
-static int do_fb_get_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var,
- int kspc)
-{
- int i, start;
- unsigned short *red, *green, *blue, *transp;
- unsigned int hred, hgreen, hblue, htransp;
-
- red = cmap->red;
- green = cmap->green;
- blue = cmap->blue;
- transp = cmap->transp;
- start = cmap->start;
-
- if (start < 0)
- return -EINVAL;
- for (i = 0; i < cmap->len; i++) {
- if (fbhw->getcolreg(start++, &hred, &hgreen, &hblue, &htransp))
- return 0;
- hred = CNVT_FROMHW(hred, var->red.length);
- hgreen = CNVT_FROMHW(hgreen, var->green.length);
- hblue = CNVT_FROMHW(hblue, var->blue.length);
- htransp = CNVT_FROMHW(htransp, var->transp.length);
- if (kspc) {
- *red = hred;
- *green = hgreen;
- *blue = hblue;
- if (transp)
- *transp = htransp;
- } else {
- put_user(hred, red);
- put_user(hgreen, green);
- put_user(hblue, blue);
- if (transp)
- put_user(htransp, transp);
- }
- red++;
- green++;
- blue++;
- if (transp)
- transp++;
- }
- return 0;
-}
-
-
-static int do_fb_set_cmap(struct fb_cmap *cmap, struct fb_var_screeninfo *var,
- int kspc)
-{
- int i, start;
- unsigned short *red, *green, *blue, *transp;
- unsigned int hred, hgreen, hblue, htransp;
-
- red = cmap->red;
- green = cmap->green;
- blue = cmap->blue;
- transp = cmap->transp;
- start = cmap->start;
-
- if (start < 0)
- return -EINVAL;
- for (i = 0; i < cmap->len; i++) {
- if (kspc) {
- hred = *red;
- hgreen = *green;
- hblue = *blue;
- htransp = transp ? *transp : 0;
- } else {
- get_user(hred, red);
- get_user(hgreen, green);
- get_user(hblue, blue);
- if (transp)
- get_user(htransp, transp);
- else
- htransp = 0;
- }
- hred = CNVT_TOHW(hred, var->red.length);
- hgreen = CNVT_TOHW(hgreen, var->green.length);
- hblue = CNVT_TOHW(hblue, var->blue.length);
- htransp = CNVT_TOHW(htransp, var->transp.length);
- red++;
- green++;
- blue++;
- if (transp)
- transp++;
- if (fbhw->setcolreg(start++, hred, hgreen, hblue, htransp))
- return 0;
- }
- return 0;
-}
-
-
-static void do_install_cmap(int con)
-{
- if (con != currcon)
- return;
- if (disp[con].cmap.len)
- do_fb_set_cmap(&disp[con].cmap, &disp[con].var, 1);
- else
- do_fb_set_cmap(get_default_colormap(disp[con].var.bits_per_pixel),
- &disp[con].var, 1);
-}
-
-
-static void memcpy_fs(int fsfromto, void *to, void *from, int len)
-{
- switch (fsfromto) {
- case 0:
- memcpy(to, from, len);
- return;
- case 1:
- copy_from_user(to, from, len);
- return;
- case 2:
- copy_to_user(to, from, len);
- return;
- }
-}
-
-
-static void copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto)
-{
- int size;
- int tooff = 0, fromoff = 0;
-
- if (to->start > from->start)
- fromoff = to->start-from->start;
- else
- tooff = from->start-to->start;
- size = to->len-tooff;
- if (size > from->len-fromoff)
- size = from->len-fromoff;
- if (size < 0)
- return;
- size *= sizeof(unsigned short);
- memcpy_fs(fsfromto, to->red+tooff, from->red+fromoff, size);
- memcpy_fs(fsfromto, to->green+tooff, from->green+fromoff, size);
- memcpy_fs(fsfromto, to->blue+tooff, from->blue+fromoff, size);
- if (from->transp && to->transp)
- memcpy_fs(fsfromto, to->transp+tooff,
- from->transp+fromoff, size);
-}
-
-
-static int alloc_cmap(struct fb_cmap *cmap, int len, int transp)
-{
- int size = len*sizeof(unsigned short);
-
- if (cmap->len != len) {
- if (cmap->red)
- kfree(cmap->red);
- if (cmap->green)
- kfree(cmap->green);
- if (cmap->blue)
- kfree(cmap->blue);
- if (cmap->transp)
- kfree(cmap->transp);
- cmap->red = cmap->green = cmap->blue = cmap->transp = NULL;
- cmap->len = 0;
- if (!len)
- return 0;
- if (!(cmap->red = kmalloc(size, GFP_ATOMIC)))
- return -1;
- if (!(cmap->green = kmalloc(size, GFP_ATOMIC)))
- return -1;
- if (!(cmap->blue = kmalloc(size, GFP_ATOMIC)))
- return -1;
- if (transp) {
- if (!(cmap->transp = kmalloc(size, GFP_ATOMIC)))
- return -1;
- } else
- cmap->transp = NULL;
- }
- cmap->start = 0;
- cmap->len = len;
- copy_cmap(get_default_colormap(len), cmap, 0);
- return 0;
-}
-
-
-/*
- * Get the Fixed Part of the Display
- */
-
-static int retz3_fb_get_fix(struct fb_fix_screeninfo *fix, int con)
-{
- struct retz3_fb_par par;
- int error = 0;
-
- if (con == -1)
- retz3_fb_get_par(&par);
- else
- error = fbhw->decode_var(&disp[con].var, &par);
- return(error ? error : fbhw->encode_fix(fix, &par));
-}
-
-
-/*
- * Get the User Defined Part of the Display
- */
-
-static int retz3_fb_get_var(struct fb_var_screeninfo *var, int con)
-{
- struct retz3_fb_par par;
- int error = 0;
-
- if (con == -1) {
- retz3_fb_get_par(&par);
- error = fbhw->encode_var(var, &par);
- } else
- *var = disp[con].var;
- return error;
-}
-
-
-static void retz3_fb_set_disp(int con)
-{
- struct fb_fix_screeninfo fix;
-
- retz3_fb_get_fix(&fix, con);
- if (con == -1)
- con = 0;
- disp[con].screen_base = (unsigned char *)fix.smem_start;
- disp[con].visual = fix.visual;
- disp[con].type = fix.type;
- disp[con].type_aux = fix.type_aux;
- disp[con].ypanstep = fix.ypanstep;
- disp[con].ywrapstep = fix.ywrapstep;
- disp[con].can_soft_blank = 1;
- disp[con].inverse = z3fb_inverse;
-}
-
-
-/*
- * Set the User Defined Part of the Display
- */
-
-static int retz3_fb_set_var(struct fb_var_screeninfo *var, int con)
-{
- int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp;
-
- if ((err = do_fb_set_var(var, con == currcon)))
- return err;
- if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
- oldxres = disp[con].var.xres;
- oldyres = disp[con].var.yres;
- oldvxres = disp[con].var.xres_virtual;
- oldvyres = disp[con].var.yres_virtual;
- oldbpp = disp[con].var.bits_per_pixel;
- disp[con].var = *var;
- if (oldxres != var->xres || oldyres != var->yres ||
- oldvxres != var->xres_virtual ||
- oldvyres != var->yres_virtual ||
- oldbpp != var->bits_per_pixel) {
- retz3_fb_set_disp(con);
- (*fb_info.changevar)(con);
- alloc_cmap(&disp[con].cmap, 0, 0);
- do_install_cmap(con);
- }
- }
- var->activate = 0;
- return 0;
-}
-
-
-/*
- * Get the Colormap
- */
-
-static int retz3_fb_get_cmap(struct fb_cmap *cmap, int kspc, int con)
-{
- if (con == currcon) /* current console? */
- return(do_fb_get_cmap(cmap, &disp[con].var, kspc));
- else if (disp[con].cmap.len) /* non default colormap? */
- copy_cmap(&disp[con].cmap, cmap, kspc ? 0 : 2);
- else
- copy_cmap(get_default_colormap(disp[con].var.bits_per_pixel),
- cmap, kspc ? 0 : 2);
- return 0;
-}
-
-
-/*
- * Set the Colormap
- */
-
-static int retz3_fb_set_cmap(struct fb_cmap *cmap, int kspc, int con)
-{
- int err;
-
- if (!disp[con].cmap.len) { /* no colormap allocated? */
- if ((err = alloc_cmap(&disp[con].cmap,
- 1<<disp[con].var.bits_per_pixel, 0)))
- return err;
- }
- if (con == currcon) /* current console? */
- return(do_fb_set_cmap(cmap, &disp[con].var, kspc));
- else
- copy_cmap(cmap, &disp[con].cmap, kspc ? 0 : 1);
- return 0;
-}
-
-
-/*
- * Pan or Wrap the Display
- *
- * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
- */
-
-static int retz3_fb_pan_display(struct fb_var_screeninfo *var, int con)
-{
- return -EINVAL;
-}
-
-
-/*
- * RetinaZ3 Frame Buffer Specific ioctls
- */
-
-static int retz3_fb_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg, int con)
-{
- return -EINVAL;
-}
-
-
-static struct fb_ops retz3_fb_ops = {
- retz3_fb_get_fix, retz3_fb_get_var, retz3_fb_set_var, retz3_fb_get_cmap,
- retz3_fb_set_cmap, retz3_fb_pan_display, retz3_fb_ioctl
-};
-
-
-int retz3_probe(void)
-{
- z3_key = zorro_find(MANUF_MACROSYSTEMS2, PROD_RETINA_Z3, 0, 0);
- return(z3_key);
-}
-
-
-void retz3_video_setup(char *options, int *ints)
-{
- char *this_opt;
- int i;
-
- fb_info.fontname[0] = '\0';
-
- if (!options || !*options)
- return;
-
- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")){
- if (!strcmp(this_opt, "inverse")) {
- z3fb_inverse = 1;
- for (i = 0; i < 16; i++) {
- red16[i] = ~red16[i];
- green16[i] = ~green16[i];
- blue16[i] = ~blue16[i];
- }
- } else if (!strncmp(this_opt, "font:", 5))
- strcpy(fb_info.fontname, this_opt+5);
- else
- z3fb_mode = get_video_mode(this_opt);
- }
-}
-
-
-/*
- * Initialization
- */
-
-struct fb_info *retz3_fb_init(long *mem_start)
-{
- int err;
- struct retz3_fb_par par;
-
- memstart = mem_start;
-
- fbhw = &retz3_switch;
-
- err = register_framebuffer(retz3_fb_name, &node, &retz3_fb_ops,
- NUM_TOTAL_MODES, retz3_fb_predefined);
- if (err < 0)
- panic("Cannot register frame buffer\n");
-
- fbhw->init();
-
- if (z3fb_mode == -1)
- z3fb_mode = 1;
-
- fbhw->decode_var(&retz3_fb_predefined[z3fb_mode], &par);
- fbhw->encode_var(&retz3_fb_predefined[0], &par);
-
- strcpy(fb_info.modename, retz3_fb_name);
- fb_info.disp = disp;
- fb_info.switch_con = &z3fb_switch;
- fb_info.updatevar = &z3fb_updatevar;
- fb_info.blank = &z3fb_blank;
- fb_info.setcmap = &z3fb_setcmap;
-
- do_fb_set_var(&retz3_fb_predefined[0], 0);
- retz3_fb_get_var(&disp[0].var, -1);
- retz3_fb_set_disp(-1);
- do_install_cmap(0);
-
- return &fb_info;
-}
-
-
-static int z3fb_switch(int con)
-{
- /* Do we have to save the colormap? */
- if (disp[currcon].cmap.len)
- do_fb_get_cmap(&disp[currcon].cmap, &disp[currcon].var, 1);
-
- do_fb_set_var(&disp[con].var, 1);
- currcon = con;
- /* Install new colormap */
- do_install_cmap(con);
- return 0;
-}
-
-
-/*
- * Update the `var' structure (called by fbcon.c)
- *
- * This call looks only at yoffset and the FB_VMODE_YWRAP flag in `var'.
- * Since it's called by a kernel driver, no range checking is done.
- */
-
-static int z3fb_updatevar(int con)
-{
- return 0;
-}
-
-
-/*
- * Blank the display.
- */
-
-static void z3fb_blank(int blank)
-{
- fbhw->blank(blank);
-}
-
-
-/*
- * Set the colormap
- */
-
-static int z3fb_setcmap(struct fb_cmap *cmap, int con)
-{
- return(retz3_fb_set_cmap(cmap, 1, con));
-}
-
-
-/*
- * Get a Video Mode
- */
-
-static int get_video_mode(const char *name)
-{
- int i;
-
- for (i = 1; i <= NUM_PREDEF_MODES; i++)
- if (!strcmp(name, retz3_fb_modenames[i])){
- retz3_fb_predefined[0] = retz3_fb_predefined[i];
- return i;
- }
- return -1;
-}
-/*
- * Linux/arch/m68k/amiga/retz3fb.c -- Low level implementation of the
- * RetinaZ3 frame buffer device
- *
- * Copyright (C) 1997 Jes Sorensen
- *
- * This file is based on the CyberVision64 frame buffer device and
- * the generic Cirrus Logic driver.
- *
- * cyberfb.c: Copyright (C) 1996 Martin Apel,
- * Geert Uytterhoeven
- * clgen.c: Copyright (C) 1996 Frank Neumann
- *
- * History:
- * - 22 Jan 97: Initial work
- * - 14 Feb 97: Screen initialization works somewhat, still only
- * 8-bit packed pixel is supported.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file COPYING in the main directory of this archive
- * for more details.
- */
-
-
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/tty.h>
-#include <linux/malloc.h>
-#include <linux/delay.h>
-#include <linux/fb.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/irq.h>
-#include <linux/zorro.h>
#include <asm/pgtable.h>
#include "retz3fb.h"
@@ -3402,7 +1652,7 @@ void retz3_video_setup(char *options, int *ints)
* Initialization
*/
-struct fb_info *retz3_fb_init(long *mem_start)
+__initfunc(struct fb_info *retz3_fb_init(long *mem_start))
{
int err;
struct retz3_fb_par par;
diff --git a/arch/m68k/amiga/retz3fb.h b/arch/m68k/amiga/retz3fb.h
index 9ff209060..0cb03c324 100644
--- a/arch/m68k/amiga/retz3fb.h
+++ b/arch/m68k/amiga/retz3fb.h
@@ -284,289 +284,3 @@
#define Z3BLTorInverted 0xb0 /* NOT src OR dst */
#define Z3BLTnand 0x70 /* NOT src OR NOT dst */
#define Z3BLTset 0xf0 /* 1 */
-/*
- * Linux/arch/m68k/amiga/retz3fb.h -- Defines and macros for the
- * RetinaZ3 frame buffer device
- *
- * Copyright (C) 1997 Jes Sorensen
- *
- * History:
- * - 22 Jan 97: Initial work
- *
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file COPYING in the main directory of this archive
- * for more details.
- */
-
-/*
- * Macros to read and write to registers.
- */
-#define reg_w(reg,dat) (*(z3_regs + reg) = dat)
-#define reg_r(reg) (*(z3_regs + reg))
-
-/*
- * Macro to access the sequencer.
- */
-#define seq_w(sreg,sdat) \
- do{ reg_w(SEQ_IDX, sreg); reg_w(SEQ_DATA, sdat); } while(0)
-
-/*
- * Macro to access the CRT controller.
- */
-#define crt_w(creg,cdat) \
- do{ reg_w(CRT_IDX, creg); reg_w(CRT_DATA, cdat); } while(0)
-
-/*
- * Macro to access the graphics controller.
- */
-#define gfx_w(greg,gdat) \
- do{ reg_w(GFX_IDX, greg); reg_w(GFX_DATA, gdat); } while(0)
-
-/*
- * Macro to access the attribute controller.
- */
-#define attr_w(areg,adat) \
- do{ reg_w(ACT_IDX, areg); reg_w(ACT_DATA, adat); } while(0)
-
-/*
- * Macro to access the pll.
- */
-#define pll_w(preg,pdat) \
- do{ reg_w(PLL_IDX, preg); \
- reg_w(PLL_DATA, (pdat & 0xff)); \
- reg_w(PLL_DATA, (pdat >> 8));\
- } while(0)
-
-/*
- * Offsets
- */
-#define VIDEO_MEM_OFFSET 0x00c00000
-#define ACM_OFFSET 0x00b00000
-
-/*
- * Accelerator Control Menu
- */
-#define ACM_PRIMARY_OFFSET 0x00
-#define ACM_SECONDARY_OFFSET 0x04
-#define ACM_MODE_CONTROL 0x08
-#define ACM_CURSOR_POSITION 0x0c
-#define ACM_START_STATUS 0x30
-#define ACM_CONTROL 0x34
-#define ACM_RASTEROP_ROTATION 0x38
-#define ACM_BITMAP_DIMENSION 0x3c
-#define ACM_DESTINATION 0x40
-#define ACM_SOURCE 0x44
-#define ACM_PATTERN 0x48
-#define ACM_FOREGROUND 0x4c
-#define ACM_BACKGROUND 0x50
-
-/*
- * Video DAC addresses
- */
-#define VDAC_ADDRESS 0x03c8
-#define VDAC_ADDRESS_W 0x03c8
-#define VDAC_ADDRESS_R 0x03c7
-#define VDAC_STATE 0x03c7
-#define VDAC_DATA 0x03c9
-#define VDAC_MASK 0x03c6
-
-/*
- * Sequencer
- */
-#define SEQ_IDX 0x03c4 /* Sequencer Index */
-#define SEQ_DATA 0x03c5
-#define SEQ_RESET 0x00
-#define SEQ_CLOCKING_MODE 0x01
-#define SEQ_MAP_MASK 0x02
-#define SEQ_CHAR_MAP_SELECT 0x03
-#define SEQ_MEMORY_MODE 0x04
-#define SEQ_EXTENDED_ENABLE 0x05 /* NCR extensions */
-#define SEQ_UNKNOWN1 0x06
-#define SEQ_UNKNOWN2 0x07
-#define SEQ_CHIP_ID 0x08
-#define SEQ_UNKNOWN3 0x09
-#define SEQ_CURSOR_COLOR1 0x0a
-#define SEQ_CURSOR_COLOR0 0x0b
-#define SEQ_CURSOR_CONTROL 0x0c
-#define SEQ_CURSOR_X_LOC_HI 0x0d
-#define SEQ_CURSOR_X_LOC_LO 0x0e
-#define SEQ_CURSOR_Y_LOC_HI 0x0f
-#define SEQ_CURSOR_Y_LOC_LO 0x10
-#define SEQ_CURSOR_X_INDEX 0x11
-#define SEQ_CURSOR_Y_INDEX 0x12
-#define SEQ_CURSOR_STORE_HI 0x13
-#define SEQ_CURSOR_STORE_LO 0x14
-#define SEQ_CURSOR_ST_OFF_HI 0x15
-#define SEQ_CURSOR_ST_OFF_LO 0x16
-#define SEQ_CURSOR_PIXELMASK 0x17
-#define SEQ_PRIM_HOST_OFF_HI 0x18
-#define SEQ_PRIM_HOST_OFF_LO 0x19
-#define SEQ_LINEAR_0 0x1a
-#define SEQ_LINEAR_1 0x1b
-#define SEQ_SEC_HOST_OFF_HI 0x1c
-#define SEQ_SEC_HOST_OFF_LO 0x1d
-#define SEQ_EXTENDED_MEM_ENA 0x1e
-#define SEQ_EXT_CLOCK_MODE 0x1f
-#define SEQ_EXT_VIDEO_ADDR 0x20
-#define SEQ_EXT_PIXEL_CNTL 0x21
-#define SEQ_BUS_WIDTH_FEEDB 0x22
-#define SEQ_PERF_SELECT 0x23
-#define SEQ_COLOR_EXP_WFG 0x24
-#define SEQ_COLOR_EXP_WBG 0x25
-#define SEQ_EXT_RW_CONTROL 0x26
-#define SEQ_MISC_FEATURE_SEL 0x27
-#define SEQ_COLOR_KEY_CNTL 0x28
-#define SEQ_COLOR_KEY_MATCH0 0x29
-#define SEQ_COLOR_KEY_MATCH1 0x2a
-#define SEQ_COLOR_KEY_MATCH2 0x2b
-#define SEQ_UNKNOWN6 0x2c
-#define SEQ_CRC_CONTROL 0x2d
-#define SEQ_CRC_DATA_LOW 0x2e
-#define SEQ_CRC_DATA_HIGH 0x2f
-#define SEQ_MEMORY_MAP_CNTL 0x30
-#define SEQ_ACM_APERTURE_1 0x31
-#define SEQ_ACM_APERTURE_2 0x32
-#define SEQ_ACM_APERTURE_3 0x33
-#define SEQ_BIOS_UTILITY_0 0x3e
-#define SEQ_BIOS_UTILITY_1 0x3f
-
-/*
- * Graphics Controller
- */
-#define GFX_IDX 0x03ce
-#define GFX_DATA 0x03cf
-#define GFX_SET_RESET 0x00
-#define GFX_ENABLE_SET_RESET 0x01
-#define GFX_COLOR_COMPARE 0x02
-#define GFX_DATA_ROTATE 0x03
-#define GFX_READ_MAP_SELECT 0x04
-#define GFX_GRAPHICS_MODE 0x05
-#define GFX_MISC 0x06
-#define GFX_COLOR_XCARE 0x07
-#define GFX_BITMASK 0x08
-
-/*
- * CRT Controller
- */
-#define CRT_IDX 0x03d4
-#define CRT_DATA 0x03d5
-#define CRT_HOR_TOTAL 0x00
-#define CRT_HOR_DISP_ENA_END 0x01
-#define CRT_START_HOR_BLANK 0x02
-#define CRT_END_HOR_BLANK 0x03
-#define CRT_START_HOR_RETR 0x04
-#define CRT_END_HOR_RETR 0x05
-#define CRT_VER_TOTAL 0x06
-#define CRT_OVERFLOW 0x07
-#define CRT_PRESET_ROW_SCAN 0x08
-#define CRT_MAX_SCAN_LINE 0x09
-#define CRT_CURSOR_START 0x0a
-#define CRT_CURSOR_END 0x0b
-#define CRT_START_ADDR_HIGH 0x0c
-#define CRT_START_ADDR_LOW 0x0d
-#define CRT_CURSOR_LOC_HIGH 0x0e
-#define CRT_CURSOR_LOC_LOW 0x0f
-#define CRT_START_VER_RETR 0x10
-#define CRT_END_VER_RETR 0x11
-#define CRT_VER_DISP_ENA_END 0x12
-#define CRT_OFFSET 0x13
-#define CRT_UNDERLINE_LOC 0x14
-#define CRT_START_VER_BLANK 0x15
-#define CRT_END_VER_BLANK 0x16
-#define CRT_MODE_CONTROL 0x17
-#define CRT_LINE_COMPARE 0x18
-#define CRT_UNKNOWN1 0x19
-#define CRT_UNKNOWN2 0x1a
-#define CRT_UNKNOWN3 0x1b
-#define CRT_UNKNOWN4 0x1c
-#define CRT_UNKNOWN5 0x1d
-#define CRT_UNKNOWN6 0x1e
-#define CRT_UNKNOWN7 0x1f
-#define CRT_UNKNOWN8 0x20
-#define CRT_UNKNOWN9 0x21
-#define CRT_UNKNOWN10 0x22
-#define CRT_UNKNOWN11 0x23
-#define CRT_UNKNOWN12 0x24
-#define CRT_UNKNOWN13 0x25
-#define CRT_UNKNOWN14 0x26
-#define CRT_UNKNOWN15 0x27
-#define CRT_UNKNOWN16 0x28
-#define CRT_UNKNOWN17 0x29
-#define CRT_UNKNOWN18 0x2a
-#define CRT_UNKNOWN19 0x2b
-#define CRT_UNKNOWN20 0x2c
-#define CRT_UNKNOWN21 0x2d
-#define CRT_UNKNOWN22 0x2e
-#define CRT_UNKNOWN23 0x2f
-#define CRT_EXT_HOR_TIMING1 0x30 /* NCR crt extensions */
-#define CRT_EXT_START_ADDR 0x31
-#define CRT_EXT_HOR_TIMING2 0x32
-#define CRT_EXT_VER_TIMING 0x33
-#define CRT_MONITOR_POWER 0x34
-
-/*
- * General Registers
- */
-#define GREG_STATUS0_R 0x03c2
-#define GREG_STATUS1_R 0x03da
-#define GREG_MISC_OUTPUT_R 0x03cc
-#define GREG_MISC_OUTPUT_W 0x03c2
-#define GREG_FEATURE_CONTROL_R 0x03ca
-#define GREG_FEATURE_CONTROL_W 0x03da
-#define GREG_POS 0x0102
-
-/*
- * Attribute Controller
- */
-#define ACT_IDX 0x03C0
-#define ACT_ADDRESS_R 0x03C0
-#define ACT_DATA 0x03C0
-#define ACT_ADDRESS_RESET 0x03DA
-#define ACT_PALETTE0 0x00
-#define ACT_PALETTE1 0x01
-#define ACT_PALETTE2 0x02
-#define ACT_PALETTE3 0x03
-#define ACT_PALETTE4 0x04
-#define ACT_PALETTE5 0x05
-#define ACT_PALETTE6 0x06
-#define ACT_PALETTE7 0x07
-#define ACT_PALETTE8 0x08
-#define ACT_PALETTE9 0x09
-#define ACT_PALETTE10 0x0A
-#define ACT_PALETTE11 0x0B
-#define ACT_PALETTE12 0x0C
-#define ACT_PALETTE13 0x0D
-#define ACT_PALETTE14 0x0E
-#define ACT_PALETTE15 0x0F
-#define ACT_ATTR_MODE_CNTL 0x10
-#define ACT_OVERSCAN_COLOR 0x11
-#define ACT_COLOR_PLANE_ENA 0x12
-#define ACT_HOR_PEL_PANNING 0x13
-#define ACT_COLOR_SELECT 0x14
-
-/*
- * PLL
- */
-#define PLL_IDX 0x83c8
-#define PLL_DATA 0x83c9
-
-/*
- * Blitter operations
- */
-#define Z3BLTclear 0x00 /* 0 */
-#define Z3BLTand 0x80 /* src AND dst */
-#define Z3BLTandReverse 0x40 /* src AND NOT dst */
-#define Z3BLTcopy 0xc0 /* src */
-#define Z3BLTandInverted 0x20 /* NOT src AND dst */
-#define Z3BLTnoop 0xa0 /* dst */
-#define Z3BLTxor 0x60 /* src XOR dst */
-#define Z3BLTor 0xe0 /* src OR dst */
-#define Z3BLTnor 0x10 /* NOT src AND NOT dst */
-#define Z3BLTequiv 0x90 /* NOT src XOR dst */
-#define Z3BLTinvert 0x50 /* NOT dst */
-#define Z3BLTorReverse 0xd0 /* src OR NOT dst */
-#define Z3BLTcopyInverted 0x30 /* NOT src */
-#define Z3BLTorInverted 0xb0 /* NOT src OR dst */
-#define Z3BLTnand 0x70 /* NOT src OR NOT dst */
-#define Z3BLTset 0xf0 /* 1 */
diff --git a/arch/m68k/amiga/zorro.c b/arch/m68k/amiga/zorro.c
index acca3e6bc..d64ad8ce3 100644
--- a/arch/m68k/amiga/zorro.c
+++ b/arch/m68k/amiga/zorro.c
@@ -13,10 +13,11 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/zorro.h>
#include <asm/setup.h>
#include <asm/bitops.h>
#include <asm/amigahw.h>
-#include <linux/zorro.h>
#ifdef CONFIG_ZORRO
@@ -415,10 +416,6 @@ BEGIN_PROD(MASOBOSHI)
PROD("MVD 819", MVD_819)
END
-BEGIN_PROD(DELACOMP)
- PROD("RAM Expansion 2000", DELACOMP_RAM_2000)
-END
-
BEGIN_PROD(VILLAGE_TRONIC)
PROD("Domino Graphics Board (RAM)", DOMINO_RAM)
PROD("Domino Graphics Board (REG)", DOMINO_REG)
@@ -656,7 +653,6 @@ BEGIN_MANUF
MANUF("Helfrich", HELFRICH1)
MANUF("Software Result Enterprises", SW_RESULT_ENTS)
MANUF("Masoboshi", MASOBOSHI)
- MANUF("DelaComp", DELACOMP)
MANUF("Village Tronic", VILLAGE_TRONIC)
MANUF("Utilities Unlimited", UTILITIES_ULTD)
MANUF("Amitrix", AMITRIX)
@@ -992,7 +988,7 @@ static void mark_region(u_long addr, u_long size, int flag)
* Initialization
*/
-void zorro_init(void)
+__initfunc(void zorro_init(void))
{
int i;
struct ConfigDev *cd;
diff --git a/arch/m68k/atari/atafb.c b/arch/m68k/atari/atafb.c
index 64c9a62d3..efa6fc8b8 100644
--- a/arch/m68k/atari/atafb.c
+++ b/arch/m68k/atari/atafb.c
@@ -46,6 +46,7 @@
#include <linux/tty.h>
#include <linux/malloc.h>
#include <linux/delay.h>
+#include <linux/init.h>
#include <asm/setup.h>
#include <asm/uaccess.h>
@@ -2911,8 +2912,8 @@ atafb_setcmap(struct fb_cmap *cmap, int con)
return(atari_fb_set_cmap(cmap, 1, con));
}
-struct fb_info *
-atari_fb_init(long *mem_start)
+__initfunc(struct fb_info *
+atari_fb_init(long *mem_start))
{
int err;
int pad;
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index b65beefb1..b2887f7da 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -39,6 +39,7 @@
#include <linux/kernel.h>
#include <linux/ptrace.h>
#include <linux/kernel_stat.h>
+#include <linux/init.h>
#include <asm/system.h>
#include <asm/traps.h>
@@ -162,15 +163,19 @@ static int free_vme_vec_bitmap = 0;
#define MFP_MK_BASE "0xfa13"
-/* This must agree with head.S. */
-#define ORIG_DO "0x20"
-#define FORMATVEC "0x2E"
-#define SR "0x28"
+/* This must agree with entry.S. */
+#define ORIG_DO "0x24"
+#define FORMATVEC "0x32"
+#define SR "0x2C"
#define SAVE_ALL \
"clrl %%sp@-;" /* stk_adj */ \
"pea -1:w;" /* orig d0 = -1 */ \
"movel %%d0,%%sp@-;" /* d0 */ \
- "moveml %%d1-%%d5/%%a0-%%a1,%%sp@-"
+ "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
+#define GET_CURRENT(tmp) \
+ "movel %%sp,"#tmp";" \
+ "andw #-8192,"#tmp";" \
+ "movel "#tmp",%%a2"
#define BUILD_SLOW_IRQ(n) \
asmlinkage void IRQ_NAME(n); \
@@ -180,6 +185,7 @@ __asm__ (ALIGN_STR "\n" \
SYMBOL_NAME_STR(atari_slow_irq_) #n "_handler:\t" \
" addql #1,"SYMBOL_NAME_STR(local_irq_count)"\n" \
SAVE_ALL "\n" \
+ GET_CURRENT(%%d0) "\n" \
" andb #~(1<<(" #n "&7))," /* mask this interrupt */ \
"("MFP_MK_BASE"+(((" #n "&8)^8)>>2)+((" #n "&16)<<3)):w\n" \
" bfextu %%sp@("SR"){#5,#3},%%d0\n" /* get old IPL from stack frame */ \
@@ -282,7 +288,8 @@ SYMBOL_NAME_STR(atari_fast_irq_handler) ":
orw #0x700,%%sr /* disable all interrupts */
"SYMBOL_NAME_STR(atari_prio_irq_handler) ":\t
addql #1,"SYMBOL_NAME_STR(local_irq_count)"\n"
- SAVE_ALL "
+ SAVE_ALL "\n"
+ GET_CURRENT(%%d0) "
/* get vector number from stack frame and convert to source */
bfextu %%sp@(" FORMATVEC "){#4,#10},%%d0
subw #(0x40-8),%%d0
@@ -331,7 +338,7 @@ extern void atari_microwire_cmd( int cmd );
* the atari IRQ handling routines.
*/
-void atari_init_IRQ(void)
+__initfunc(void atari_init_IRQ(void))
{
int i;
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 4f57cb928..beccf9a84 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -22,6 +22,7 @@
#include <linux/timer.h>
#include <linux/kd.h>
#include <linux/random.h>
+#include <linux/init.h>
#include <asm/atariints.h>
#include <asm/atarihw.h>
@@ -804,7 +805,7 @@ void atari_kbd_leds (unsigned int leds)
* Martin Rogge, 20 Aug 1995
*/
-int atari_keyb_init(void)
+__initfunc(int atari_keyb_init(void))
{
/* setup key map */
key_maps[0] = ataplain_map;
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 0d0607da0..3cc2a840a 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -32,6 +32,7 @@
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/interrupt.h>
+#include <linux/init.h>
#include <asm/bootinfo.h>
#include <asm/setup.h>
@@ -106,7 +107,7 @@ extern void (*kd_mksound)(unsigned int, unsigned int);
* a temporary VBR and a vector table for the duration of the test.
*/
-static int hwreg_present( volatile void *regp )
+__initfunc(static int hwreg_present( volatile void *regp ))
{
int ret = 0;
long save_sp, save_vbr;
@@ -132,9 +133,8 @@ static int hwreg_present( volatile void *regp )
}
#if 0
-static int hwreg_present_bywrite( volatile void *regp,
- unsigned char val )
-
+__initfunc(static int
+hwreg_present_bywrite(volatile void *regp, unsigned char val))
{
int ret;
long save_sp, save_vbr;
@@ -166,7 +166,7 @@ static int hwreg_present_bywrite( volatile void *regp,
/* Basically the same, but writes a value into a word register, protected
* by a bus error handler */
-static int hwreg_write( volatile void *regp, unsigned short val )
+__initfunc(static int hwreg_write( volatile void *regp, unsigned short val ))
{
int ret;
long save_sp, save_vbr;
@@ -201,7 +201,7 @@ static int hwreg_write( volatile void *regp, unsigned short val )
* should be readable without trouble (from channel A!).
*/
-static int scc_test( volatile char *ctla )
+__initfunc(static int scc_test( volatile char *ctla ))
{
if (!hwreg_present( ctla ))
return( 0 );
@@ -228,7 +228,7 @@ static int scc_test( volatile char *ctla )
* Parse an Atari-specific record in the bootinfo
*/
-int atari_parse_bootinfo(const struct bi_record *record)
+__initfunc(int atari_parse_bootinfo(const struct bi_record *record))
{
int unknown = 0;
const u_long *data = record->data;
@@ -247,7 +247,7 @@ int atari_parse_bootinfo(const struct bi_record *record)
* Setup the Atari configuration info
*/
-void config_atari(void)
+__initfunc(void config_atari(void))
{
memset(&atari_hw_present, 0, sizeof(atari_hw_present));
@@ -493,7 +493,8 @@ void config_atari(void)
}
}
-static void atari_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
+__initfunc(static void
+atari_sched_init(void (*timer_routine)(int, void *, struct pt_regs *)))
{
/* set Timer C data Register */
mfp.tim_dt_c = INT_TICKS;
@@ -976,7 +977,7 @@ static void atari_par_console_write (const char *str, unsigned int count)
}
-static void atari_debug_init(void)
+__initfunc(static void atari_debug_init(void))
{
#ifdef CONFIG_KGDB
/* if the m68k_debug_device is used by the GDB stub, do nothing here */
diff --git a/arch/m68k/atari/joystick.c b/arch/m68k/atari/joystick.c
index de6014171..2e33b151f 100644
--- a/arch/m68k/atari/joystick.c
+++ b/arch/m68k/atari/joystick.c
@@ -11,6 +11,7 @@
#include <linux/errno.h>
#include <linux/major.h>
#include <linux/poll.h>
+#include <linux/init.h>
#include <asm/atarikb.h>
#include <asm/atari_joystick.h>
@@ -128,7 +129,7 @@ struct file_operations atari_joystick_fops = {
release_joystick
};
-int atari_joystick_init(void)
+__initfunc(int atari_joystick_init(void))
{
joystick[0].active = joystick[1].active = 0;
joystick[0].ready = joystick[1].ready = 0;
diff --git a/arch/m68k/atari/stdma.c b/arch/m68k/atari/stdma.c
index 247b9f684..9dc82de18 100644
--- a/arch/m68k/atari/stdma.c
+++ b/arch/m68k/atari/stdma.c
@@ -32,6 +32,8 @@
#include <linux/types.h>
#include <linux/genhd.h>
#include <linux/sched.h>
+#include <linux/init.h>
+
#include <asm/atari_stdma.h>
#include <asm/atariints.h>
#include <asm/atarihw.h>
@@ -171,7 +173,7 @@ int stdma_islocked(void)
*
*/
-void stdma_init(void)
+__initfunc(void stdma_init(void))
{
stdma_isr = NULL;
request_irq(IRQ_MFP_FDC, stdma_int, IRQ_TYPE_SLOW,
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 565b20535..4e5f57bc9 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -149,6 +149,7 @@ atari_stram_free (void *ptr)
#else
#include <linux/mm.h>
+#include <linux/init.h>
/* ++roman:
*
@@ -190,7 +191,7 @@ static unsigned long stram_end;
/* Overall end of ST-Ram */
-void atari_stram_init( void )
+__initfunc(void atari_stram_init( void ))
{ int i;
diff --git a/arch/m68k/boot/amiga/linuxboot.c b/arch/m68k/boot/amiga/linuxboot.c
index d35966686..23b7fa9d0 100644
--- a/arch/m68k/boot/amiga/linuxboot.c
+++ b/arch/m68k/boot/amiga/linuxboot.c
@@ -22,6 +22,8 @@
* for more details.
*
* History:
+ * 27 Mar 1997 FPU-less machines couldn't boot kernels that use bootinfo
+ * interface version 1.0 (Geert)
* 03 Feb 1997 Implemented kernel decompression (Geert, based on Roman's
* code for ataboot)
* 30 Dec 1996 Reverted the CPU detection to the old scheme
@@ -791,6 +793,7 @@ static u_long get_chipset(void)
static void get_processor(u_long *cpu, u_long *fpu, u_long *mmu)
{
*cpu = *fpu = 0;
+
if (SysBase->AttnFlags & AFF_68060)
*cpu = CPU_68060;
else if (SysBase->AttnFlags & AFF_68040)
@@ -799,15 +802,15 @@ static void get_processor(u_long *cpu, u_long *fpu, u_long *mmu)
*cpu = CPU_68030;
else if (SysBase->AttnFlags & AFF_68020)
*cpu = CPU_68020;
+
if (*cpu == CPU_68040 || *cpu == CPU_68060) {
if (SysBase->AttnFlags & AFF_FPU40)
*fpu = *cpu;
- } else {
- if (SysBase->AttnFlags & AFF_68882)
- *fpu = FPU_68882;
- else if (SysBase->AttnFlags & AFF_68881)
- *fpu = FPU_68881;
- }
+ } else if (SysBase->AttnFlags & AFF_68882)
+ *fpu = FPU_68882;
+ else if (SysBase->AttnFlags & AFF_68881)
+ *fpu = FPU_68881;
+
*mmu = *cpu;
}
@@ -1047,7 +1050,7 @@ static int create_compat_bootinfo(void)
compat_bootinfo.cputype |= COMPAT_FPU_68040;
else if (bi.fputype & FPU_68060)
compat_bootinfo.cputype |= COMPAT_FPU_68060;
- else {
+ else if (bi.fputype) {
Printf("FPU type 0x%08lx not supported by kernel\n", bi.fputype);
return(0);
}
diff --git a/arch/m68k/boot/amiga/linuxboot.h b/arch/m68k/boot/amiga/linuxboot.h
index 8ebfe63b4..e04425a3a 100644
--- a/arch/m68k/boot/amiga/linuxboot.h
+++ b/arch/m68k/boot/amiga/linuxboot.h
@@ -31,7 +31,7 @@
* Amiboot Version
*/
-#define AMIBOOT_VERSION "5.4"
+#define AMIBOOT_VERSION "5.5"
/*
diff --git a/arch/m68k/fpsp040/skeleton.S b/arch/m68k/fpsp040/skeleton.S
index 5768516bd..466cf3fbc 100644
--- a/arch/m68k/fpsp040/skeleton.S
+++ b/arch/m68k/fpsp040/skeleton.S
@@ -51,13 +51,23 @@
.include "fpsp.h"
-LOFF_ORIG_D0 = 0x20
+/*
+ * This has to match entry.S
+ */
+LOFF_ORIG_D0 = 0x24
+
+#define curptr a2
#define SAVE_ALL \
clrl %sp@-; /* stk_adj */ \
movel %d0,%sp@-; /* orig d0 */ \
movel %d0,%sp@-; /* d0 */ \
- moveml %d1-%d5/%a0-%a1,%sp@-
+ moveml %d1-%d5/%a0-%a1/%curptr,%sp@-;
+
+#define GET_CURRENT(tmp) \
+ movel %sp,tmp; \
+ andw &-8192,tmp; \
+ movel tmp,%curptr;
|xref b1238_fix
@@ -81,6 +91,7 @@ real_dz:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -175,6 +186,7 @@ inex_done:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -204,6 +216,7 @@ ovfl_done:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -233,6 +246,7 @@ unfl_done:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -258,6 +272,7 @@ real_snan:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -283,6 +298,7 @@ real_operr:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -314,6 +330,7 @@ real_bsun:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -338,6 +355,7 @@ real_fline:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -363,6 +381,7 @@ real_unsupp:
movel %d0,%sp@(LOFF_ORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -419,6 +438,7 @@ Lmustsched:
SAVE_ALL
moveq #-1,%d0
movel %d0,%sp@(LOFF_ORIG_D0) | indicate stack frame not for syscall
+ GET_CURRENT(%d0)
bral SYMBOL_NAME(ret_from_exception) | deliver signals, reschedule etc..
@@ -497,7 +517,7 @@ user_read:
movel %d0,-(%sp)
movel %a1,-(%sp)
movel %a0,-(%sp)
- jsr copyin
+ jsr copyin
addw #12,%sp
movel (%sp)+,%d1
rts
diff --git a/arch/m68k/ifpsp060/iskeleton.S b/arch/m68k/ifpsp060/iskeleton.S
index 5940a374a..3c310c237 100644
--- a/arch/m68k/ifpsp060/iskeleton.S
+++ b/arch/m68k/ifpsp060/iskeleton.S
@@ -36,13 +36,23 @@
#include <linux/linkage.h>
-LOFF_ORIG_D0 = 0x20
+/*
+ * This has to match entry.S
+ */
+LOFF_ORIG_D0 = 0x24
+
+#define curptr a2
#define SAVE_ALL \
clrl %sp@-; /* stk_adj */ \
movel %d0,%sp@-; /* orig d0 */ \
movel %d0,%sp@-; /* d0 */ \
- moveml %d1-%d5/%a0-%a1,%sp@-
+ moveml %d1-%d5/%a0-%a1/%curptr,%sp@-;
+
+#define GET_CURRENT(tmp) \
+ movel %sp,tmp; \
+ andw &-8192,tmp; \
+ movel tmp,%curptr;
|################################
| (1) EXAMPLE CALL-OUTS #
@@ -85,6 +95,7 @@ Lmustsched:
SAVE_ALL
moveq #-1,%d0
movel %d0,%sp@(LOFF_ORIG_D0) | indicate stack frame not for syscall
+ GET_CURRENT(%d0)
bral SYMBOL_NAME(ret_from_exception) | deliver signals, reschedule etc..
|
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 2cb35e67f..ef5ef46d6 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -33,12 +33,13 @@
* 10(sp) - d5
* 14(sp) - a0
* 18(sp) - a1
- * 1C(sp) - d0
- * 20(sp) - orig_d0
- * 24(sp) - stack adjustment
- * 28(sp) - sr
- * 2A(sp) - pc
- * 2E(sp) - format & vector
+ * 1C(sp) - a2
+ * 20(sp) - d0
+ * 24(sp) - orig_d0
+ * 28(sp) - stack adjustment
+ * 2C(sp) - sr
+ * 2E(sp) - pc
+ * 32(sp) - format & vector
*/
/*
@@ -47,6 +48,11 @@
* number 0 in the 'current_set' list.
*/
+/*
+ * 97/05/14 Andreas: Register %a2 is now set to the current task throughout
+ * the whole kernel.
+ */
+
#include <linux/sys.h>
#include <linux/config.h>
#include <linux/linkage.h>
@@ -57,6 +63,8 @@
.globl SYMBOL_NAME(kgdb_registers)
#endif
+#define curptr a2
+
LENOSYS = 38
/*
@@ -80,15 +88,15 @@ LTASK_FLAGS = 20
#define MAX_NOINT_IPL 0
#endif /* machine compilation types */
-LD0 = 0x1C
-LORIG_D0 = 0x20
-LSR = 0x28
-LFORMATVEC = 0x2E
+LD0 = 0x20
+LORIG_D0 = 0x24
+LSR = 0x2C
+LFORMATVEC = 0x32
/*
* This defines the normal kernel pt-regs layout.
*
- * regs are a2-a6 and d6-d7 preserved by C code
+ * regs a3-a6 and d6-d7 are preserved by C code
* the kernel doesn't mess with usp unless it needs to
*/
#ifndef CONFIG_KGDB
@@ -96,7 +104,7 @@ LFORMATVEC = 0x2E
clrl %sp@-; /* stk_adj */ \
movel %d0,%sp@-; /* orig d0 */ \
movel %d0,%sp@-; /* d0 */ \
- moveml %d1-%d5/%a0-%a1,%sp@-
+ moveml %d1-%d5/%a0-%a1/%curptr,%sp@-;
#else
/* Need to save the "missing" registers for kgdb...
*/
@@ -104,25 +112,30 @@ LFORMATVEC = 0x2E
clrl %sp@-; /* stk_adj */ \
movel %d0,%sp@-; /* orig d0 */ \
movel %d0,%sp@-; /* d0 */ \
- moveml %d1-%d5/%a0-%a1,%sp@-; \
+ moveml %d1-%d5/%a0-%a1/%curptr,%sp@-; \
moveml %d6-%d7,SYMBOL_NAME(kgdb_registers)+GDBOFFA_D6; \
- moveml %a2-%a6,SYMBOL_NAME(kgdb_registers)+GDBOFFA_A2
+ moveml %a3-%a6,SYMBOL_NAME(kgdb_registers)+GDBOFFA_A3;
#endif
#define RESTORE_ALL \
- moveml %sp@+,%a0-%a1/%d1-%d5; \
+ moveml %sp@+,%a0-%a1/%curptr/%d1-%d5; \
movel %sp@+,%d0; \
addql #4,%sp; /* orig d0 */ \
addl %sp@+,%sp; /* stk adj */ \
rte
-#define SWITCH_STACK_SIZE (7*4+4) /* includes return address */
+#define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
#define SAVE_SWITCH_STACK \
- moveml %a2-%a6/%d6-%d7,%sp@-
+ moveml %a3-%a6/%d6-%d7,%sp@-
#define RESTORE_SWITCH_STACK \
- moveml %sp@+,%a2-%a6/%d6-%d7
+ moveml %sp@+,%a3-%a6/%d6-%d7
+
+#define GET_CURRENT(tmp) \
+ movel %sp,tmp; \
+ andw &-8192,tmp; \
+ movel tmp,%curptr;
.globl SYMBOL_NAME(system_call), SYMBOL_NAME(buserr), SYMBOL_NAME(trap)
.globl SYMBOL_NAME(resume), SYMBOL_NAME(ret_from_exception)
@@ -139,6 +152,7 @@ ENTRY(buserr)
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(buserr_c)
addql #4,%sp
@@ -150,6 +164,7 @@ ENTRY(trap)
movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
movel %sp,%sp@- | stack frame pointer argument
bsrl SYMBOL_NAME(trap_c)
addql #4,%sp
@@ -190,6 +205,7 @@ ENTRY(system_call)
SAVE_ALL
movel %d0,%d2
+ GET_CURRENT(%d0)
| save top of frame
pea %sp@
jbsr SYMBOL_NAME(set_esp0)
@@ -197,8 +213,7 @@ ENTRY(system_call)
cmpl #NR_syscalls,%d2
jcc badsys
- movel SYMBOL_NAME(current_set),%a0
- btst #5,%a0@(LTASK_FLAGS+3) | PF_TRACESYS
+ btst #5,%curptr@(LTASK_FLAGS+3) | PF_TRACESYS
jne do_trace
jbsr @(SYMBOL_NAME(sys_call_table),%d2:l:4)@(0)
movel %d0,%sp@(LD0) | save the return value
@@ -208,24 +223,23 @@ SYMBOL_NAME_LABEL(ret_from_exception)
bnes 2f | if so, skip resched, signals
tstl SYMBOL_NAME(need_resched)
jne SYMBOL_NAME(reschedule)
- movel SYMBOL_NAME(current_set),%a0
- cmpl #SYMBOL_NAME(task),%a0 | task[0] cannot have signals
+ cmpl #SYMBOL_NAME(task),%curptr | task[0] cannot have signals
jeq 2f
- bclr #5,%a0@(LTASK_FLAGS+1) | check for delayed trace
+ bclr #5,%curptr@(LTASK_FLAGS+1) | check for delayed trace
jne do_delayed_trace
5:
- tstl %a0@(LTASK_STATE) | state
+ tstl %curptr@(LTASK_STATE) | state
jne SYMBOL_NAME(reschedule)
- tstl %a0@(LTASK_COUNTER) | counter
+ tstl %curptr@(LTASK_COUNTER) | counter
jeq SYMBOL_NAME(reschedule)
- movel %a0@(LTASK_BLOCKED),%d0
+ movel %curptr@(LTASK_BLOCKED),%d0
movel %d0,%d1 | save blocked in d1 for sig handling
notl %d0
- btst #4,%a0@(LTASK_FLAGS+3) | PF_PTRACED
+ btst #4,%curptr@(LTASK_FLAGS+3) | PF_PTRACED
jeq 1f
moveq #-1,%d0 | let the debugger see all signals
-1: andl %a0@(LTASK_SIGNAL),%d0
+1: andl %curptr@(LTASK_SIGNAL),%d0
jne Lsignal_return
2: RESTORE_ALL
@@ -248,7 +262,6 @@ do_delayed_trace:
jbsr SYMBOL_NAME(send_sig)
addql #8,%sp
addql #4,%sp
- movel SYMBOL_NAME(current_set),%a0
jra 5b
/*
@@ -260,6 +273,7 @@ SYMBOL_NAME_LABEL(inthandler)
movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field
| signifies that the stack frame
| is NOT for syscall
+ GET_CURRENT(%d0)
addql #1,SYMBOL_NAME(local_irq_count)
| put exception # in d0
bfextu %sp@(LFORMATVEC){#4,#10},%d0
@@ -270,28 +284,31 @@ SYMBOL_NAME_LABEL(inthandler)
addql #8,%sp | pop parameters off stack
SYMBOL_NAME_LABEL(ret_from_interrupt)
- /* check if we need to do software interrupts */
- movel SYMBOL_NAME(local_irq_count),%d1
- subql #1,%d1
- jne 4f
-#if 0
- bfextu %sp@(LSR){#5,#3},%d0 | Check for nested interrupt.
+ subql #1,SYMBOL_NAME(local_irq_count)
+ jeq 1f
+2:
+ RESTORE_ALL
+1:
+#if 1
+ bfextu %sp@(LSR){#5,#3},%d0 | Check for nested interrupt.
#if MAX_NOINT_IPL > 0
cmpiw #MAX_NOINT_IPL,%d0
#endif
- jhi 4f
+ jhi 2b
#endif
+ /* Let the rest run with interrupts allowed. This is safe since
+ the kernel never uses a non-standard ipl and this is the outer
+ level interrupt. */
+ andw #ALLOWINT,%sr
+
+ /* check if we need to do software interrupts */
+
movel SYMBOL_NAME(bh_active),%d0
andl SYMBOL_NAME(bh_mask),%d0
- jeq 3f
+ jeq SYMBOL_NAME(ret_from_exception)
- jbsr SYMBOL_NAME(do_bottom_half)
-3:
- clrl SYMBOL_NAME(local_irq_count)
- jra SYMBOL_NAME(ret_from_exception)
-4:
- movel %d1,SYMBOL_NAME(local_irq_count)
- RESTORE_ALL
+ pea SYMBOL_NAME(ret_from_exception)
+ jra SYMBOL_NAME(do_bottom_half)
/* Handler for uninitialized and spurious interrupts */
@@ -398,7 +415,7 @@ SYMBOL_NAME_LABEL(resume)
3:
/* get pointer to tss struct (a1 contains new task) */
- movel %a1,SYMBOL_NAME(current_set)
+ movel %a1,%curptr
addl %d1,%a1
/* Skip address space switching if they are the same. */
@@ -419,7 +436,7 @@ SYMBOL_NAME_LABEL(resume)
movec %cacr,%d0
oriw #LFLUSH_I_AND_D,%d0
movec %d0,%cacr
-
+
/* switch the root pointer */
pmove %a1@(LTSS_CRP),%crp
#endif
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index c2b72aa2d..36a4072ac 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -223,17 +223,9 @@ ENTRY(_start)
movel %d0,%a0@ /* save cache mode for page tables */
/*
- * raise interrupt level with MASTER bit set, copy isp to msp (if not 68060)
+ * raise interrupt level
*/
-#ifdef FROM_PL9
- movew #0x3700,%sr
- is_060(1f)
- movec %isp,%d0
- movel %d0,%sp
-1:
-#else
movew #0x2700,%sr
-#endif
/*
If running on an Atari, determine the I/O base of the
@@ -896,8 +888,10 @@ Lcache68060:
/*
* Setup initial stack pointer
+ * We need to get current loaded up with our first task...
*/
- lea SYMBOL_NAME(init_user_stack)+PAGESIZE,%sp
+ lea SYMBOL_NAME(init_task_union),%a2
+ lea 8192(%a2),%sp
/* jump to the kernel start */
putr()
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index f49c38cd3..39e1fbce6 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -29,6 +29,7 @@
#include <linux/sched.h>
#include <linux/kernel_stat.h>
#include <linux/errno.h>
+#include <linux/init.h>
#include <asm/system.h>
#include <asm/irq.h>
@@ -79,7 +80,7 @@ void (*mach_free_irq) (unsigned int, void *) = dummy_free_irq;
* the IRQ handling routines.
*/
-void init_IRQ(void)
+__initfunc(void init_IRQ(void))
{
int i;
diff --git a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c
index 3138d99df..f6bb0689b 100644
--- a/arch/m68k/kernel/m68k_ksyms.c
+++ b/arch/m68k/kernel/m68k_ksyms.c
@@ -6,6 +6,8 @@
#include <linux/mm.h>
#include <linux/user.h>
#include <linux/elfcore.h>
+#include <linux/in6.h>
+#include <linux/interrupt.h>
#include <asm/setup.h>
#include <asm/machdep.h>
@@ -14,6 +16,7 @@
#include <asm/semaphore.h>
#include <asm/checksum.h>
#include <asm/hardirq.h>
+#include <asm/softirq.h>
asmlinkage long long __ashrdi3 (long long, int);
extern char m68k_debug_device[];
@@ -40,6 +43,7 @@ EXPORT_SYMBOL(strnlen);
EXPORT_SYMBOL(strrchr);
EXPORT_SYMBOL(strstr);
EXPORT_SYMBOL(local_irq_count);
+EXPORT_SYMBOL(__m68k_bh_counter);
/* Networking helper routines. */
EXPORT_SYMBOL(csum_partial_copy);
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 5422831a8..ad0662f22 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -10,6 +10,7 @@
* This file handles the architecture-dependent parts of process handling..
*/
+#include <linux/config.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
@@ -29,6 +30,23 @@
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/setup.h>
+#include <asm/pgtable.h>
+
+/*
+ * Initial task structure. Make this a per-architecture thing,
+ * because different architectures tend to have different
+ * alignment requirements and potentially different initial
+ * setup.
+ */
+static struct vm_area_struct init_mmap = INIT_MMAP;
+static struct fs_struct init_fs = INIT_FS;
+static struct files_struct init_files = INIT_FILES;
+static struct signal_struct init_signals = INIT_SIGNALS;
+struct mm_struct init_mm = INIT_MM;
+
+union task_union init_task_union
+ __attribute__((section("init_task"), aligned(2*PAGE_SIZE)))
+ = { task: INIT_TASK };
asmlinkage void ret_from_exception(void);
@@ -46,8 +64,17 @@ asmlinkage int sys_idle(void)
/* endless idle loop with no priority at all */
current->priority = -100;
current->counter = -100;
- for (;;)
+ for (;;){
+ if (!need_resched)
+#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC)
+ /* block out HSYNC on the atari (falcon) */
+ __asm__("stop #0x2200" : : : "cc");
+#else /* portable version */
+ __asm__("stop #0x2000" : : : "cc");
+#endif /* machine compilation types */
+ run_task_queue(&tq_scheduler);
schedule();
+ }
ret = 0;
out:
unlock_kernel();
@@ -76,8 +103,8 @@ void show_regs(struct pt_regs * regs)
printk("\n");
printk("Format %02x Vector: %04x PC: %08lx Status: %04x\n",
regs->format, regs->vector, regs->pc, regs->sr);
- printk("ORIG_D0: %08lx D0: %08lx A1: %08lx\n",
- regs->orig_d0, regs->d0, regs->a1);
+ printk("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
+ regs->orig_d0, regs->d0, regs->a2, regs->a1);
printk("A0: %08lx D5: %08lx D4: %08lx\n",
regs->a0, regs->d5, regs->d4);
printk("D3: %08lx D2: %08lx D1: %08lx\n",
@@ -144,8 +171,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
struct switch_stack * childstack, *stack;
unsigned long stack_offset, *retp;
- stack_offset = PAGE_SIZE - sizeof(struct pt_regs);
- childregs = (struct pt_regs *) (p->kernel_stack_page + stack_offset);
+ stack_offset = 2*PAGE_SIZE - sizeof(struct pt_regs);
+ childregs = (struct pt_regs *) ((unsigned long) p + stack_offset);
*childregs = *regs;
childregs->d0 = 0;
@@ -231,7 +258,7 @@ void dump_thread(struct pt_regs * regs, struct user * dump)
dump->regs.d7 = sw->d7;
dump->regs.a0 = regs->a0;
dump->regs.a1 = regs->a1;
- dump->regs.a2 = sw->a2;
+ dump->regs.a2 = regs->a2;
dump->regs.a3 = sw->a3;
dump->regs.a4 = sw->a4;
dump->regs.a5 = sw->a5;
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
index 70e341b31..be4149cbb 100644
--- a/arch/m68k/kernel/ptrace.c
+++ b/arch/m68k/kernel/ptrace.c
@@ -47,23 +47,11 @@
static int regoff[] = {
PT_REG(d1), PT_REG(d2), PT_REG(d3), PT_REG(d4),
PT_REG(d5), SW_REG(d6), SW_REG(d7), PT_REG(a0),
- PT_REG(a1), SW_REG(a2), SW_REG(a3), SW_REG(a4),
+ PT_REG(a1), PT_REG(a2), SW_REG(a3), SW_REG(a4),
SW_REG(a5), SW_REG(a6), PT_REG(d0), -1,
PT_REG(orig_d0), PT_REG(sr), PT_REG(pc),
};
-/* change a pid into a task struct. */
-static inline struct task_struct * get_task(int pid)
-{
- int i;
-
- for (i = 1; i < NR_TASKS; i++) {
- if (task[i] != NULL && (task[i]->pid == pid))
- return task[i];
- }
- return NULL;
-}
-
/*
* Get contents of register REGNO in task TASK.
*/
@@ -116,7 +104,7 @@ static unsigned long get_long(struct task_struct * tsk,
repeat:
pgdir = pgd_offset(vma->vm_mm, addr);
if (pgd_none(*pgdir)) {
- do_no_page(tsk, vma, addr, 0);
+ handle_mm_fault(tsk, vma, addr, 0);
goto repeat;
}
if (pgd_bad(*pgdir)) {
@@ -126,7 +114,7 @@ repeat:
}
pgmiddle = pmd_offset(pgdir,addr);
if (pmd_none(*pgmiddle)) {
- do_no_page(tsk, vma, addr, 0);
+ handle_mm_fault(tsk, vma, addr, 0);
goto repeat;
}
if (pmd_bad(*pgmiddle)) {
@@ -137,7 +125,7 @@ repeat:
}
pgtable = pte_offset(pgmiddle, addr);
if (!pte_present(*pgtable)) {
- do_no_page(tsk, vma, addr, 0);
+ handle_mm_fault(tsk, vma, addr, 0);
goto repeat;
}
page = pte_page(*pgtable);
@@ -168,7 +156,7 @@ static void put_long(struct task_struct * tsk, struct vm_area_struct * vma, unsi
repeat:
pgdir = pgd_offset(vma->vm_mm, addr);
if (!pgd_present(*pgdir)) {
- do_no_page(tsk, vma, addr, 1);
+ handle_mm_fault(tsk, vma, addr, 1);
goto repeat;
}
if (pgd_bad(*pgdir)) {
@@ -178,7 +166,7 @@ repeat:
}
pgmiddle = pmd_offset(pgdir,addr);
if (pmd_none(*pgmiddle)) {
- do_no_page(tsk, vma, addr, 1);
+ handle_mm_fault(tsk, vma, addr, 1);
goto repeat;
}
if (pmd_bad(*pgmiddle)) {
@@ -189,12 +177,12 @@ repeat:
}
pgtable = pte_offset(pgmiddle, addr);
if (!pte_present(*pgtable)) {
- do_no_page(tsk, vma, addr, 1);
+ handle_mm_fault(tsk, vma, addr, 1);
goto repeat;
}
page = pte_page(*pgtable);
if (!pte_write(*pgtable)) {
- do_wp_page(tsk, vma, addr, 2);
+ handle_mm_fault(tsk, vma, addr, 1);
goto repeat;
}
/* this is a hack for non-kernel-mapped video buffers and similar */
@@ -340,7 +328,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
if (pid == 1) /* you may not mess with init */
goto out;
ret = -ESRCH;
- if (!(child = get_task(pid)))
+ if (!(child = find_task_by_pid(pid)))
goto out;
ret = -EPERM;
if (request == PTRACE_ATTACH) {
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index dfd91d0d4..def50a747 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -18,6 +18,7 @@
#include <linux/genhd.h>
#include <linux/errno.h>
#include <linux/string.h>
+#include <linux/init.h>
#include <asm/bootinfo.h>
#include <asm/setup.h>
@@ -55,13 +56,13 @@ static struct mem_info m68k_ramdisk = { 0, 0 };
static char m68k_command_line[CL_SIZE];
char saved_command_line[CL_SIZE];
-void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *));
+void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata;
/* machine dependent keyboard functions */
-int (*mach_keyb_init) (void);
+int (*mach_keyb_init) (void) __initdata;
int (*mach_kbdrate) (struct kbd_repeat *) = NULL;
void (*mach_kbd_leds) (unsigned int) = NULL;
/* machine dependent irq functions */
-void (*mach_init_IRQ) (void);
+void (*mach_init_IRQ) (void) __initdata;
void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL;
void (*mach_get_model) (char *model) = NULL;
int (*mach_get_hardware_list) (char *buffer) = NULL;
@@ -73,12 +74,12 @@ void (*mach_gettod) (int*, int*, int*, int*, int*, int*);
int (*mach_hwclk) (int, struct hwclk_time*) = NULL;
int (*mach_set_clock_mmss) (unsigned long) = NULL;
void (*mach_reset)( void );
-struct fb_info *(*mach_fb_init)(long *);
+struct fb_info *(*mach_fb_init)(long *) __initdata;
long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
-void (*mach_video_setup) (char *, int *);
+void (*mach_video_setup) (char *, int *) __initdata;
#ifdef CONFIG_BLK_DEV_FD
-int (*mach_floppy_init) (void) = NULL;
-void (*mach_floppy_setup) (char *, int *) = NULL;
+int (*mach_floppy_init) (void) __initdata = NULL;
+void (*mach_floppy_setup) (char *, int *) __initdata = NULL;
void (*mach_floppy_eject) (void) = NULL;
#endif
@@ -94,7 +95,7 @@ extern void config_apollo(void);
#define MASK_256K 0xfffc0000
-static void m68k_parse_bootinfo(const struct bi_record *record)
+__initfunc(static void m68k_parse_bootinfo(const struct bi_record *record))
{
while (record->tag != BI_LAST) {
int unknown = 0;
@@ -141,8 +142,8 @@ static void m68k_parse_bootinfo(const struct bi_record *record)
}
}
-void setup_arch(char **cmdline_p, unsigned long * memory_start_p,
- unsigned long * memory_end_p)
+ __initfunc(void setup_arch(char **cmdline_p, unsigned long * memory_start_p,
+ unsigned long * memory_end_p))
{
unsigned long memory_start, memory_end;
extern int _etext, _edata, _end;
@@ -337,7 +338,7 @@ int get_hardware_list(char *buffer)
}
#ifdef CONFIG_BLK_DEV_FD
-int floppy_init(void)
+__initfunc(int floppy_init(void))
{
if (mach_floppy_init)
return mach_floppy_init();
@@ -345,7 +346,7 @@ int floppy_init(void)
return 0;
}
-void floppy_setup(char *str, int *ints)
+__initfunc(void floppy_setup(char *str, int *ints))
{
if (mach_floppy_setup)
mach_floppy_setup (str, ints);
@@ -358,7 +359,7 @@ void floppy_eject(void)
}
#endif
-unsigned long arch_kbd_init(void)
+__initfunc(unsigned long arch_kbd_init(void))
{
return mach_keyb_init();
}
@@ -372,7 +373,7 @@ void arch_gettod(int *year, int *mon, int *day, int *hour,
*year = *mon = *day = *hour = *min = *sec = 0;
}
-void video_setup (char *options, int *ints)
+__initfunc(void video_setup (char *options, int *ints))
{
if (mach_video_setup)
mach_video_setup (options, ints);
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index c60e82b0b..52c13445d 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -42,7 +42,9 @@
#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))
-asmlinkage int sys_waitpid(pid_t pid,unsigned long * stat_addr, int options);
+asmlinkage int sys_wait4(pid_t pid, unsigned long *stat_addr,
+ int options, unsigned long *ru);
+
asmlinkage int do_signal(unsigned long oldmask, struct pt_regs *regs);
const int frame_extra_sizes[16] = {
@@ -466,7 +468,7 @@ asmlinkage int do_signal(unsigned long oldmask, struct pt_regs *regs)
if (signr != SIGCHLD)
continue;
/* check for SIGCHLD: it's special */
- while (sys_waitpid(-1,NULL,WNOHANG) > 0)
+ while (sys_wait4(-1,NULL,WNOHANG, NULL) > 0)
/* nothing */;
continue;
}
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 5acfd1cbd..e29509cac 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -532,12 +532,15 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
*/
vma = find_vma (current->mm, addr);
ret = -EINVAL;
+ /* Check for overflow. */
+ if (addr + len < addr)
+ goto out;
if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end)
goto out;
}
if (CPU_IS_020_OR_030) {
- if (scope == FLUSH_SCOPE_LINE) {
+ if (scope == FLUSH_SCOPE_LINE && len < 256) {
unsigned long cacr;
__asm__ ("movec %%cacr, %0" : "=r" (cacr));
if (cache & FLUSH_CACHE_INSN)
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index dbff49276..7b3acdfa6 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -27,6 +27,24 @@ static inline int set_rtc_mmss(unsigned long nowtime)
return -1;
}
+static inline void do_profile (unsigned long pc)
+{
+ if (prof_buffer && current->pid) {
+ extern int _stext;
+ pc -= (unsigned long) &_stext;
+ pc >>= prof_shift;
+ if (pc < prof_len)
+ ++prof_buffer[pc];
+ else
+ /*
+ * Dont ignore out-of-bounds PC values silently,
+ * put them into the last histogram slot, so if
+ * present, they will show up as a sharp peak.
+ */
+ ++prof_buffer[prof_len-1];
+ }
+}
+
/*
* timer_interrupt() needs to keep up the real-time clock,
* as well as call the "do_timer()" routine every clocktick
@@ -38,6 +56,9 @@ static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
do_timer(regs);
+ if (!user_mode(regs))
+ do_profile(regs->pc);
+
/*
* If we have an externally synchronized Linux clock, then update
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index 1cc547907..25be40007 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -27,6 +27,7 @@
#include <linux/user.h>
#include <linux/string.h>
#include <linux/linkage.h>
+#include <linux/init.h>
#include <asm/setup.h>
#include <asm/fpu.h>
@@ -63,7 +64,7 @@ asm(".text\n"
__ALIGN_STR "\n"
SYMBOL_NAME_STR(nmihandler) ": rte");
-void trap_init (void)
+__initfunc(void trap_init (void))
{
int i;
@@ -932,16 +933,15 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr)
#endif
console_verbose();
printk("%s: %08x\n",str,nr);
- printk("PC: [<%08lx>]\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
+ printk("PC: [<%08lx>]\nSR: %04x SP: %p a2: %08lx\n",
+ fp->pc, fp->sr, fp, fp->a2);
printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
fp->d0, fp->d1, fp->d2, fp->d3);
printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
fp->d4, fp->d5, fp->a0, fp->a1);
- if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
- printk("Corrupted stack page\n");
printk("Process %s (pid: %d, stackpage=%08lx)\n",
- current->comm, current->pid, current->kernel_stack_page);
+ current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
#ifdef CONFIG_KGDB
}
#endif
diff --git a/arch/m68k/lib/semaphore.S b/arch/m68k/lib/semaphore.S
index 76ffc3cc5..8e4141149 100644
--- a/arch/m68k/lib/semaphore.S
+++ b/arch/m68k/lib/semaphore.S
@@ -19,8 +19,7 @@ ENTRY(__down_failed)
movel %a1,-(%sp)
jbsr SYMBOL_NAME(__down)
movel (%sp)+,%a1
- movel (%sp)+,%d0
- movel (%sp)+,%d1
+ moveml (%sp)+,%a0/%d0/%d1
rts
ENTRY(__down_failed_interruptible)
@@ -30,6 +29,7 @@ ENTRY(__down_failed_interruptible)
jbsr SYMBOL_NAME(__down_interruptible)
movel (%sp)+,%a1
movel (%sp)+,%d1
+ movel (%sp)+,%a0
rts
ENTRY(__up_wakeup)
@@ -37,6 +37,5 @@ ENTRY(__up_wakeup)
movel %a1,-(%sp)
jbsr SYMBOL_NAME(__up)
movel (%sp)+,%a1
- movel (%sp)+,%d0
- movel (%sp)+,%d1
+ moveml (%sp)+,%a0/%d0/%d1
rts
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index 71b46e2d9..193c6baee 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -32,14 +32,10 @@ extern const int frame_extra_sizes[]; /* in m68k/kernel/signal.c */
asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
unsigned long error_code)
{
- void (*handler)(struct task_struct *,
- struct vm_area_struct *,
- unsigned long,
- int);
struct task_struct *tsk = current;
struct mm_struct *mm = tsk->mm;
struct vm_area_struct * vma;
- unsigned long fixup, fault_pc;
+ unsigned long fixup;
int write;
#ifdef DEBUG
@@ -73,10 +69,8 @@ asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
*/
good_area:
write = 0;
- handler = do_no_page;
switch (error_code & 3) {
default: /* 3: write, present */
- handler = do_wp_page;
/* fall through */
case 2: /* write, not present */
if (!(vma->vm_flags & VM_WRITE))
@@ -89,7 +83,7 @@ good_area:
if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area;
}
- handler(tsk, vma, address, write);
+ handle_mm_fault(current, vma, address, write);
up(&mm->mmap_sem);
/* There seems to be a missing invalidate somewhere in do_no_page.
@@ -108,10 +102,10 @@ bad_area:
up(&mm->mmap_sem);
/* Are we prepared to handle this fault? */
- fault_pc = regs->pc;
- if ((fixup = search_exception_table(fault_pc)) != 0) {
+ if ((fixup = search_exception_table(regs->pc)) != 0) {
struct pt_regs *tregs;
- printk(KERN_DEBUG "Exception at [<%lx>] (%lx)\n", fault_pc, fixup);
+ printk(KERN_DEBUG "%s: Exception at [<%lx>] (%lx)\n",
+ current->comm, regs->pc, fixup);
/* Create a new four word stack frame, discarding the old
one. */
regs->stkadj = frame_extra_sizes[regs->format];
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 01cd315dd..b46037f80 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/types.h>
+#include <linux/init.h>
#ifdef CONFIG_BLK_DEV_RAM
#include <linux/blk.h>
#endif
@@ -116,9 +117,8 @@ pte_t *kernel_page_table (unsigned long *memavailp)
return ptablep;
}
-static unsigned long map_chunk (unsigned long addr,
- unsigned long size,
- unsigned long *memavailp)
+__initfunc(static unsigned long
+map_chunk (unsigned long addr, unsigned long size, unsigned long *memavailp))
{
#define ONEMEG (1024*1024)
#define L3TREESIZE (256*1024)
@@ -283,6 +283,11 @@ static unsigned long map_chunk (unsigned long addr,
extern unsigned long free_area_init(unsigned long, unsigned long);
+/* References to section boundaries */
+
+extern char _text, _etext, _edata, __bss_start, _end;
+extern char __init_begin, __init_end;
+
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
/*
@@ -291,7 +296,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
* The parameters are pointers to where to stick the starting and ending
* addresses of available kernel virtual memory.
*/
-unsigned long paging_init(unsigned long start_mem, unsigned long end_mem)
+__initfunc(unsigned long paging_init(unsigned long start_mem, unsigned long end_mem))
{
int chunk;
unsigned long mem_avail = 0;
@@ -395,12 +400,12 @@ unsigned long paging_init(unsigned long start_mem, unsigned long end_mem)
return PAGE_ALIGN(free_area_init (start_mem, end_mem));
}
-void mem_init(unsigned long start_mem, unsigned long end_mem)
+__initfunc(void mem_init(unsigned long start_mem, unsigned long end_mem))
{
int codepages = 0;
int datapages = 0;
+ int initpages = 0;
unsigned long tmp;
- extern int _etext;
end_mem &= PAGE_MASK;
high_memory = (void *) end_mem;
@@ -448,8 +453,15 @@ void mem_init(unsigned long start_mem, unsigned long end_mem)
if (VTOP (tmp) >= mach_max_dma_address)
clear_bit(PG_DMA, &mem_map[MAP_NR(tmp)].flags);
if (PageReserved(mem_map+MAP_NR(tmp))) {
- if (tmp < (unsigned long)&_etext)
- codepages++;
+ if (tmp >= (unsigned long)&_text
+ && tmp < (unsigned long)&_edata) {
+ if (tmp < (unsigned long) &_etext)
+ codepages++;
+ else
+ datapages++;
+ } else if (tmp >= (unsigned long) &__init_begin
+ && tmp < (unsigned long) &__init_end)
+ initpages++;
else
datapages++;
continue;
@@ -461,16 +473,24 @@ void mem_init(unsigned long start_mem, unsigned long end_mem)
#endif
free_page(tmp);
}
- printk("Memory: %luk/%luk available (%dk kernel code, %dk data)\n",
+ printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
(unsigned long) nr_free_pages << (PAGE_SHIFT-10),
max_mapnr << (PAGE_SHIFT-10),
codepages << (PAGE_SHIFT-10),
- datapages << (PAGE_SHIFT-10));
+ datapages << (PAGE_SHIFT-10),
+ initpages << (PAGE_SHIFT-10));
}
void free_initmem(void)
{
- /* To be written */
+ unsigned long addr;
+
+ addr = (unsigned long)&__init_begin;
+ for (; addr < (unsigned long)&__init_end; addr += PAGE_SIZE) {
+ mem_map[MAP_NR(addr)].flags &= ~(1 << PG_reserved);
+ atomic_set(&mem_map[MAP_NR(addr)].count, 1);
+ free_page(addr);
+ }
}
void si_meminfo(struct sysinfo *val)
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
index 55d5e98f3..77eb2dbfe 100644
--- a/arch/m68k/mm/memory.c
+++ b/arch/m68k/mm/memory.c
@@ -280,6 +280,8 @@ static unsigned long transp_transl_matches( unsigned long regval,
return( (vaddr & mask) == (base & mask) );
}
+static unsigned long mm_vtop_fallback (unsigned long);
+
/*
* The following two routines map from a physical address to a kernel
* virtual address and vice versa.
@@ -301,7 +303,13 @@ unsigned long mm_vtop (unsigned long vaddr)
offset += m68k_memory[i].size;
i++;
}while (i < m68k_num_memory);
+ return mm_vtop_fallback(vaddr);
+}
+/* Separate function to make the common case faster (needs to save less
+ registers) */
+static unsigned long mm_vtop_fallback (unsigned long vaddr)
+{
/* not in one of the memory chunks; test for applying transparent
* translation */
diff --git a/arch/m68k/vmlinux.lds b/arch/m68k/vmlinux.lds
new file mode 100644
index 000000000..cc5b1e20e
--- /dev/null
+++ b/arch/m68k/vmlinux.lds
@@ -0,0 +1,60 @@
+/* ld script to make m68k Linux kernel */
+OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
+OUTPUT_ARCH(m68k)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0x1000;
+ _text = .; /* Text and read-only data */
+ .text : {
+ *(.text)
+ *(.fixup)
+ *(.text.lock) /* out-of-line lock text */
+ *(.gnu.warning)
+ } = 0x4e75
+ .rodata : { *(.rodata) }
+ .kstrtab : { *(.kstrtab) }
+
+ . = ALIGN(16); /* Exception table */
+ __start___ex_table = .;
+ __ex_table : { *(__ex_table) }
+ __stop___ex_table = .;
+
+ __start___ksymtab = .; /* Kernel symbol table */
+ __ksymtab : { *(__ksymtab) }
+ __stop___ksymtab = .;
+
+ _etext = .; /* End of text section */
+
+ .data : { /* Data */
+ *(.data)
+ CONSTRUCTORS
+ }
+
+ . = ALIGN(8192);
+ init_task : { *(init_task) } /* The initial task and kernel stack */
+
+ _edata = .; /* End of data section */
+
+ . = ALIGN(4096); /* Init code and data */
+ __init_begin = .;
+ .text.init : { *(.text.init) }
+ .data.init : { *(.data.init) }
+ . = ALIGN(4096);
+ __init_end = .;
+
+ __bss_start = .; /* BSS */
+ .bss : {
+ *(.bss)
+ }
+ _end = . ;
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+}