|
From: Kenn H. <ke...@us...> - 2001-01-26 00:26:37
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/boot
In directory usw-pr-cvs1:/tmp/cvs-serv25353/arch/vax/boot
Modified Files:
Makefile cpu_sel.S head.S lib.S tmp_init.c
Log Message:
Bring forward all 2.2 work from before new year. This should give us
all a (somewhat) bootable kernel.
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile 2001/01/20 11:24:50 1.2
+++ Makefile 2001/01/26 00:27:00 1.3
@@ -18,6 +18,6 @@
all: head.o libboot.a
L_TARGET := libboot.a
-L_OBJS := tmp_init.o lib.o hexdump.o mmstart.o cpu_sel.o
+obj-y := tmp_init.o lib.o hexdump.o mmstart.o cpu_sel.o
include $(TOPDIR)/Rules.make
Index: cpu_sel.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/cpu_sel.S,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cpu_sel.S 2001/01/17 16:13:57 1.1
+++ cpu_sel.S 2001/01/26 00:27:00 1.2
@@ -142,6 +142,9 @@
cmpl $UVAX2_SID_SUBTYPE_KA410, r0
beql uvax2_ka410
+ cmpl $UVAX2_SID_SUBTYPE_CHARON, r0
+ beql uvax2_ka630
+
# Type E/I PR$_SID at console to get SID register value and report to
# lin...@mi...
.globl unsupported_uvax2
Index: head.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/head.S,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- head.S 2001/01/17 16:13:57 1.1
+++ head.S 2001/01/26 00:27:00 1.2
@@ -84,9 +84,9 @@
#inside one chunk the data is moved bottom-to-top.
#Assumed that 1MB - load_address > 65535B otherwise
#it will break.
- movl $__init_data_end,r6
+ movl $__bss_start,r6
subl2 $start,r6 # byte count to r6
- movab __init_data_end,r1
+ movab __bss_start,r1
subl2 $0xffff, r1 # r1 points to top chunk of source
movl phys_start, r3 # dest address to r3
addl2 r6,r3
@@ -197,16 +197,12 @@
# longword aligned
addl3 $4, phys_kern_end, r5
bicl2 $3, r5
- movl r5, pg0 # save address of base of system page table
+ moval swapper_pg_dir, r0
+ movl r5, 16(r0) # save address of base of system page table
-# First entry in SPT is kept invalid to make a guard page (this speeds
-# up argument list validation in syscalls). It does mean that the first
-# page of physical RAM will be inaccessible. Oh well...
- clrl (r5)+
-
# Fill in the main part of the SPT (the entries that map physical
# memory)
- movl $1, r6 # pfn number
+ movl $0, r6 # pfn number
movl 76(r11), r7 # pfncnt from vmb.
sysfill:
bisl3 $_PAGE_VALID + _PAGE_UW, r6, (r5)+
@@ -226,8 +222,9 @@
blssu sparefill
# system page table is setup. Save SPT length and zap processor registers
- movl r7, spt_size
- mtpr pg0, $PR_SBR # set SBR
+ moval swapper_pg_dir, r0
+ movl r7, 20(r0)
+ mtpr 16(r0), $PR_SBR # set SBR
mtpr r7, $PR_SLR # set SLR
# no need to TBIA - memory mapping not enabled
moval msg_starting_vm, r10
@@ -235,7 +232,8 @@
jsb crlf
calls $0, VAX_start_mm
# made it
- addl2 $PAGE_OFFSET, pg0 # fix up our reference to the system page tbl.
+ moval swapper_pg_dir, r0
+ addl2 $PAGE_OFFSET, 16(r0) # fix up our reference to the system page tbl.
addl2 $PAGE_OFFSET, iomap_base # ... and the IOMAP PTEs
addl2 $PAGE_OFFSET, mv # fix up machine vector pointer
movl mv, r3
@@ -251,8 +249,23 @@
moval interrupt_stack, r0
addl2 $INT_STACK_SIZE, r0
movl r0, sp
+
+# Now that we have ISP (the interrupt stack pointer) sorted,
+# we need to move over to working on the kernel stack. We do this
+# my loading KSP with the top of the kernel stack for the 'init task'
+# and faking a saved PC/PSL on the interrupt stack which we then
+# 'return' to
+ moval init_task_union, r0
+ addl2 $8192, r0 # taken from <linux/sched.h>
+ mtpr r0,$PR_KSP
+
+ pushl $0x001f0000 # IS=0, accmode=prevmode=K, IPL=31
+ pushab now_on_kstack
+ rei
+ halt
- calls $0, tmp_start_kernel
+now_on_kstack:
+ calls $0, tmp_start_kernel # should never return
halt
msg_loaded:
@@ -316,12 +329,12 @@
# pg0 is the PHYSICAL ADDRESS of the system page table directory.
# This is immediately after the end of the bss section
# Once VM is enabled, this is replaced with the VIRTUAL address
-.globl pg0
-pg0: .int 0x00000000
+#.globl pg0
+#pg0: .int 0x00000000
# spt_size holds the length of the SPT (in entries, not bytes)
-.globl spt_size
-spt_size: .int 0x00000000
+#.globl spt_size
+#spt_size: .int 0x00000000
.globl phys_kern_end
phys_kern_end: .int 0x00000000
Index: lib.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/lib.S,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lib.S 2001/01/17 16:13:57 1.1
+++ lib.S 2001/01/26 00:27:00 1.2
@@ -5,93 +5,16 @@
.section .vaxbootlib
-// r2 contains ASCII code of character to print to console,
+# r2 contains ASCII code of character to print to console,
.globl boot_putchar
boot_putchar:
-# movl boot_putchar_func, r0
-# jmp (r0)
movl mv, r0
pushl r2
calls $1, *MV_PRE_VM_PUTCHAR(r0)
rsb
-// This will contain the address of a function that can be
-// used to print a char to the console before MM is setup
-// The actual function will be one of:
-//
-// putchar_prom
-// putchar_mtpr
-// putchar_nop
-
-boot_putchar_func:
- .long 0
-
-// Currently, the function is chosen by specifying an argument
-// to the BOOT command at the console. The lower 4 bits should
-// be one of:
-//
-// 1 use putchar_nop (do nothing for putchar)
-// 2 use putchar_mtpr
-// 3 use PROM routine at 20040058
-// 4 to 15 reserved
-//
-// A value of zero means use the compiled-in default.
-//
-// Eventually, the boot code will identify the CPU and choose
-// the correct one automatically. For now, head.S loads the
-// boot argument into R5 before calling this routine
-
-.globl select_boot_putchar
-select_boot_putchar:
-
- bicl2 $0xfffffff0, r5
- caseb r5, $0, $3
-$1:
- .word select_putchar_mtpr - $1 # tweak this to choose default
- .word select_putchar_nop - $1
- .word select_putchar_mtpr - $1
- .word select_putchar_prom - $1
-
- halt
-
-select_putchar_mtpr:
- moval putchar_mtpr, boot_putchar_func
- brb select_putchar_done
-
-select_putchar_prom:
- movl $0x20040058, boot_putchar_func
- brb select_putchar_done
-
-select_putchar_nop:
- moval putchar_nop, boot_putchar_func
-
-select_putchar_done:
- rsb
-
-putchar_nop:
- rsb
-
- .equ REGMASK_R8, 1<<8
- .equ REGMASK_R9, 1<<9
- .equ GC_V_RDY, 7
-
-.globl putchar_mtpr
-putchar_mtpr:
- movzbl r2, r2 # make sure high bytes are 0
- pushr $(REGMASK_R8 + REGMASK_R9) # save R8 and R9 on stack
- movl $10000, r8
-wait_for_ready:
- mfpr $PR_TXCS, r9 # PR_TXCS = 34
- bbs $GC_V_RDY, r9, tx_ready # GC_V_RDY is bit 7
- decl r8
- bneq wait_for_ready
-tx_ready:
- mtpr r2, $PR_TXDB
- popr $(REGMASK_R8 + REGMASK_R9) # restore R8 and R9
- rsb
-
-// print a long integer in hex. integer is in r10, uses r2 and r8
-//
+# print a long integer in hex. integer is in r10, uses r2 and r8
+#
.globl printint
printint:
clrl r8
@@ -113,9 +36,9 @@
cmpl r8,$0x04
bneq L1
rsb
-//
-// crlf
-//
+#
+# crlf
+#
.globl crlf
crlf:
clrl r2
@@ -124,10 +47,10 @@
movzbl $0x0D, r2
jsb boot_putchar
rsb
-//
-// printstr
-// inputs: Address of ascii string in r10
-//
+#
+# printstr
+# inputs: Address of ascii string in r10
+#
.globl printstr
printstr:
clrl r8
Index: tmp_init.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/tmp_init.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tmp_init.c 2001/01/17 16:13:57 1.1
+++ tmp_init.c 2001/01/26 00:27:00 1.2
@@ -21,9 +21,13 @@
#include <asm/mv.h>
#include <asm/scb.h>
#include <asm/system.h>
+#include <asm/smplock.h>
#include <linux/interrupt.h>
#include <linux/reboot.h>
+#include <linux/delay.h>
+#include <linux/iobuf.h>
+#include <linux/init.h>
#include <asm/bugs.h>
@@ -39,12 +43,23 @@
extern void buffer_init(unsigned long);
extern void page_cache_init(unsigned long);
extern void signals_init(void);
-extern void inode_init(void);
extern void file_table_init(void);
extern void ipc_init(void);
extern void dquot_init_hash(void);
+extern int bdflush(void *);
+extern int kupdate(void *);
+extern int kswapd(void *);
+extern int kpiod(void *);
+extern void kswapd_setup(void);
+extern void sock_init(void);
+extern void net_dev_init(void);
+extern void device_setup(void);
+extern void binfmt_setup(void);
+extern void filesystem_setup(void);
+extern void mount_root(void);
+extern void fork_init(unsigned long);
-extern int cpu_idle(void *);
+extern void cpu_idle(void);
/* stuff that is declared in head.S */
extern unsigned long int phys_start; /* physical address of kernel*/
@@ -60,11 +75,12 @@
way because we can't use sizeof() in assembly :-( */
unsigned int rpb_size = sizeof(struct rpb_struct);
-extern void setup_arch(char **, unsigned long *, unsigned long *);
-extern void trap_init(void );
-extern unsigned long console_init(unsigned long, unsigned long);
+extern void setup_arch(char **);
+extern void trap_init(void);
+extern void console_init(void);
extern char *linux_banner;
+extern struct task_struct *child_reaper;
static int tmp_init(void * unused);
@@ -85,9 +101,13 @@
void tmp_start_kernel(void)
{
char * command_line;
- unsigned long memory_start = 0;
- unsigned long memory_end = 0;
+ unsigned long mempages;
+/*
+ * Interrupts are still disabled. Do necessary setups, then
+ * enable them
+ */
+
/* Protect us from interrupt stack overflows */
guard_int_stack();
@@ -110,6 +130,7 @@
* enable them
*/
+ lock_kernel();
printk(linux_banner);
printk("RPB info: l_pfncnt: %08x, .l_vmb_version: %08x .l_badpgs: %08x\n",
@@ -118,33 +139,29 @@
printk("Physical memory: %08x pages (%dKB)\n",
boot_rpb.l_pfncnt, boot_rpb.l_pfncnt / 2);
- setup_arch(&command_line, &memory_start, &memory_end);
+ setup_arch(&command_line);
- printk("setup_arch returned: %08lx, %08lx\n", memory_start, memory_end);
printk("CPU type: %s, SID: %08x\n", mv->cpu_type_str(), vax_cpu.sid);
- memory_start = paging_init(memory_start,memory_end);
- printk("paging_init returned: %08lx\n", memory_start);
-
trap_init();
-
init_IRQ();
sched_init();
time_init();
+ softirq_init();
- memory_start = console_init(memory_start, memory_end);
+ console_init();
- memory_start = kmem_cache_init(memory_start, memory_end);
+ kmem_cache_init();
printk("Dropping IPL to 0 to allow clock interrupts\n");
- setipl(0);
+ sti();
calibrate_delay();
/* mem_init finishes up memory init. It places all remaining
memory on the free list */
- mem_init(memory_start,memory_end);
+ mem_init();
kmem_cache_sizes_init();
@@ -152,15 +169,16 @@
proc_root_init();
#endif
- uidcache_init();
- filescache_init();
- dcache_init();
- vma_init();
- buffer_init(memory_end-memory_start);
- page_cache_init(memory_end-memory_start);
+ mempages = num_physpages;
+
+ fork_init(mempages);
+ proc_caches_init();
+ vfs_caches_init(mempages);
+ buffer_init(mempages);
+ page_cache_init(mempages);
+ kiobuf_setup();
signals_init();
- inode_init();
- file_table_init();
+ inode_init(mempages);
#if defined(CONFIG_SYSVIPC)
ipc_init();
@@ -172,31 +190,79 @@
check_bugs();
printk("POSIX conformance testing by UNIFIX\n");
- if (mv->init_devices) {
- mv->init_devices();
- }
-
kernel_thread(tmp_init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ unlock_kernel();
+
current->need_resched = 1;
- cpu_idle(NULL);
+ cpu_idle();
printk("\nThis is as far as we've got... - halting\n");
machine_halt();
}
-static int tmp_init(void * unused)
+static void __init do_initcalls(void)
{
- printk("tmp_init: in init thread\n");
+ initcall_t *call;
-#if defined(CONFIG_VSABUS)
- vsa_setup();
-#endif
+ call = &__initcall_start;
+ do {
+ (*call)();
+ call++;
+ } while (call < &__initcall_end);
+ /* Make sure there is no pending stuff from the initcall sequence */
+ flush_scheduled_tasks();
+}
+
+static void tmp_do_basic_setup(void)
+{
+ /*
+ * Tell the world that we're going to be the grim
+ * reaper of innocent orphaned children.
+ *
+ * We don't want people to have to make incorrect
+ * assumptions about where in the task array this
+ * can be found.
+ */
+ child_reaper = current;
+
+ if (mv->init_devices) {
+ mv->init_devices();
+ }
+
#if defined(CONFIG_NET)
sock_init();
net_dev_init();
#endif
+
+ device_setup();
+
+ start_context_thread();
+ do_initcalls();
+
+ /* .. filesystems .. */
+ filesystem_setup();
+
+ /* Mount the root filesystem.. */
+ mount_root();
+
+}
+
+static int tmp_init(void * unused)
+{
+ printk("tmp_init: in init thread\n");
+
+ tmp_do_basic_setup();
+
+#if 0
+ kernel_thread(bdflush, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ kernel_thread(kupdate, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ kswapd_setup();
+ kernel_thread(kpiod, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ kernel_thread(kswapd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+#endif
+
panic("No init found.");
}
|