Port-powerpc archive

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

Bebox revives



Hi! all,


I know bebox cannot be booted.  However, I came to be able to boot with
the serial console by doing some corrections. 

I will commit this patch after a few days. 

However, the user land did not execute.  init(8) did not execute though
I tried with binary 4.0 and 2.1 of prep. 


By the way, I have the my great plan.  It is to remove my i386 machine
(PenIII 1G), and to make bebox the main machine.  ;-) 
I do the cleanup of GENERIC as follows for this.  And try to boot on vga.

Thanks,
--
kiyohara

? arch/bebox/compile/GENERIC
? arch/bebox/stand/typescript
? arch/bebox/stand/boot/.gdbinit
? arch/bebox/stand/boot/boot
? arch/bebox/stand/boot/lib
? arch/bebox/stand/boot/vers.c
Index: arch/bebox/bebox/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/bebox/bebox/machdep.c,v
retrieving revision 1.91
diff -u -r1.91 machdep.c
--- arch/bebox/bebox/machdep.c  9 Dec 2007 03:33:29 -0000       1.91
+++ arch/bebox/bebox/machdep.c  3 Feb 2008 15:02:06 -0000
@@ -55,6 +55,7 @@
 #include <sys/syslog.h>
 #include <sys/systm.h>
 #include <sys/user.h>
+#include <sys/ksyms.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -70,6 +71,7 @@
 #include <machine/trap.h>
 
 #include <powerpc/oea/bat.h>
+#include <powerpc/pic/picvar.h> 
 
 #include <dev/cons.h>
 
@@ -108,15 +110,14 @@
 char bootpath[256];
 paddr_t avail_end;                     /* XXX temporary */
 struct pic_ops *isa_pic;
-void initppc(u_long, u_long, void *);
-void consinit(void);
-void ext_intr(void);
+extern int primary_pic;
+void initppc(u_long, u_long, u_int, void *);
 void setup_bebox_intr(void);
 
 extern void *startsym, *endsym;
 
 void
-initppc(u_long startkernel, u_long endkernel, void *btinfo)
+initppc(u_long startkernel, u_long endkernel, u_int args, void *btinfo)
 {
        /*
         * copy bootinfo
@@ -160,8 +161,7 @@
         * boothowto
         */
        /*      boothowto = args; */
-       
-       setup_bebox_intr();
+       prep_initppc(startkernel, endkernel, args);
 }
 
 /*
@@ -176,23 +176,35 @@
        bebox_mb_reg = (vaddr_t) mapiodev(BEBOX_INTR_REG, PAGE_SIZE);
        if (!bebox_mb_reg)
                panic("cpu_startup: no room for interrupt register");
-  
+
        /*
         * Do common VM initialization
         */
        oea_startup(NULL);
-  
+
+       pic_init();
+       isa_pic = setup_i8259();
+       setup_bebox_intr();
+       primary_pic = 1;
+
+       /*
+        * set up i8259 as a cascade on BeInterruptController irq 26.
+        */
+       intr_establish(16 + 26, IST_LEVEL, IPL_NONE, pic_handle_intr, isa_pic);
+
+       oea_install_extint(pic_ext_intr);
+
        /*
         * Now that we have VM, malloc's are OK in bus_space.
         */
        bus_space_mallocok();
-  
+
        /*
         * Now allow hardware interrupts.
         */
        {
                int msr;
-    
+
                splhigh();
                __asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0"
                    : "=r"(msr) : "K"(PSL_EE));
@@ -242,8 +254,8 @@
 #if (NPC > 0) || (NVGA > 0)
        if (!strcmp(consinfo->devname, "vga")) {
 #if (NVGA > 0)
-               if (!vga_cnattach(&genppc_isa_io_space_tag, 
&genppc_isa_mem_space_tag,
-                       -1, 1))
+               if (!vga_cnattach(&prep_io_space_tag, &prep_mem_space_tag,
+                   -1, 1))
                        goto dokbd;
 #endif
 #if (NPC > 0)
@@ -275,24 +287,6 @@
        panic("invalid console device %s", consinfo->devname);
 }
 
-#if (NPCKBC > 0) && (NPCKBD == 0)
-/*
- * glue code to support old console code with the
- * mi keyboard controller driver
- */
-int
-pckbport_machdep_cnattach(kbctag, kbcslot)
-       pckbport_tag_t kbctag;
-       pckbport_slot_t kbcslot;
-{
-#if (NPC > 0)
-       return (pcconskbd_cnattach(kbctag, kbcslot));
-#else
-       return (ENXIO);
-#endif
-}
-#endif
-
 /*
  * Halt or reboot the machine after syncing/dumping according to howto.
  */
Index: arch/bebox/bebox/mainbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/bebox/bebox/mainbus.c,v
retrieving revision 1.21
diff -u -r1.21 mainbus.c
--- arch/bebox/bebox/mainbus.c  9 Dec 2007 03:33:29 -0000       1.21
+++ arch/bebox/bebox/mainbus.c  3 Feb 2008 15:02:06 -0000
@@ -60,7 +60,6 @@
 union mainbus_attach_args {
        const char *mba_busname;                /* first elem of all */
        struct pcibus_attach_args mba_pba;
-       /*struct pnpbus_attach_args mba_paa;*/
 };
 
 
@@ -121,8 +120,8 @@
        genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF,
            M_NOWAIT);
        KASSERT(genppc_pct != NULL);
-       /*prep_pci_get_chipset_tag(genppc_pct);
-        */
+       bebox_pci_get_chipset_tag(genppc_pct);
+
        pbi = malloc(sizeof(struct genppc_pci_chipset_businfo),
            M_DEVBUF, M_NOWAIT);
        KASSERT(pbi != NULL);
@@ -148,15 +147,6 @@
 #endif /* PCI_NETBSD_CONFIGURE */
 #endif /* NPCI */
 
-/* scan pnpbus first */
-#if NPNPBUS > 0
-       mba.mba_paa.paa_iot = &genppc_isa_io_space_tag;
-       mba.mba_paa.paa_memt = &genppc_isa_mem_space_tag;
-       mba.mba_paa.paa_ic = &genppc_ict;
-       mba.mba_paa.paa_dmat = &isa_bus_dma_tag;
-       config_found_ia(self, "mainbus", &mba.mba_pba, mainbus_print);
-#endif /* NPNPBUS */
-
 #if NPCI > 0
        bzero(&mba, sizeof(mba));
        mba.mba_pba.pba_iot = &prep_io_space_tag;
Index: arch/bebox/bebox/pic_bebox.c
===================================================================
RCS file: /cvsroot/src/sys/arch/bebox/bebox/pic_bebox.c,v
retrieving revision 1.3
diff -u -r1.3 pic_bebox.c
--- arch/bebox/bebox/pic_bebox.c        11 Dec 2007 18:04:18 -0000      1.3
+++ arch/bebox/bebox/pic_bebox.c        3 Feb 2008 15:02:06 -0000
@@ -50,8 +50,9 @@
 #include <arch/powerpc/pic/picvar.h>
 
 extern paddr_t bebox_mb_reg;
+static int mask;
 
-#define BEBOX_INTR_MASK                0x0fffffdc
+#define BEBOX_INTR_MASK                0x0ffffffc
 #define BEBOX_SET_MASK         0x80000000
 #define BEBOX_INTR(x)          (0x80000000 >> x)
 #define CPU0_INT_MASK          0x0f0
@@ -88,26 +89,35 @@
 static void
 bebox_enable_irq(struct pic_ops *pic, int irq, int type)
 {
-       out32rb(bebox_mb_reg + CPU0_INT_MASK, BEBOX_INTR_MASK);
-       out32rb(bebox_mb_reg + CPU0_INT_MASK,  BEBOX_SET_MASK | (1 << (31 - 
irq)) );
+
+       mask |= (1 << (31 - irq));
+       *(volatile unsigned int *)(bebox_mb_reg + CPU0_INT_MASK) =
+           BEBOX_INTR_MASK;
+       *(volatile unsigned int *)(bebox_mb_reg + CPU0_INT_MASK) =
+           BEBOX_SET_MASK | mask;
 }
 
 static void
 bebox_disable_irq(struct pic_ops *pic, int irq)
 {
-       out32rb(bebox_mb_reg + CPU0_INT_MASK, BEBOX_INTR_MASK);
-       out32rb(bebox_mb_reg + CPU0_INT_MASK, (1 << (31 - irq)));
+
+       mask &= ~(1 << (31 - irq));
+       *(volatile unsigned int *)(bebox_mb_reg + CPU0_INT_MASK) =
+           BEBOX_INTR_MASK;
+       *(volatile unsigned int *)(bebox_mb_reg + CPU0_INT_MASK) =
+           BEBOX_SET_MASK | mask;
 }
 
 static int
 bebox_get_irq(struct pic_ops *pic, int mode)
 {
-       int irq;
+       unsigned int state;
 
-       irq = in32rb(bebox_mb_reg + INT_STATE_REG);
-       if (irq == 0)
+       state = *(volatile unsigned int *)(bebox_mb_reg + INT_STATE_REG);
+       state &= (mask & BEBOX_INTR_MASK);
+       if (state == 0)
                return 255;
-       return irq;
+       return __builtin_clz(state);
 }
 
 static void
Index: arch/bebox/conf/std.bebox
===================================================================
RCS file: /cvsroot/src/sys/arch/bebox/conf/std.bebox,v
retrieving revision 1.14
diff -u -r1.14 std.bebox
--- arch/bebox/conf/std.bebox   11 Dec 2005 12:17:03 -0000      1.14
+++ arch/bebox/conf/std.bebox   3 Feb 2008 15:02:06 -0000
@@ -11,6 +11,8 @@
 options        EXEC_ELF32      # exec ELF binaries
 options        EXEC_SCRIPT     # exec #! scripts
 
+options                PIC_I8259
+
 options        INTSTK=0x2000
 
 makeoptions    TEXTADDR=0x3100
Index: arch/bebox/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/bebox/include/intr.h,v
retrieving revision 1.26
diff -u -r1.26 intr.h
--- arch/bebox/include/intr.h   17 Oct 2007 19:53:59 -0000      1.26
+++ arch/bebox/include/intr.h   3 Feb 2008 15:02:06 -0000
@@ -50,12 +50,12 @@
 extern int imask[];
 extern paddr_t bebox_mb_reg;
 
-#define ICU_LEN         32
-#define IRQ_SLAVE       2
-#define LEGAL_IRQ(x)    ((x) >= 0 && (x) < ICU_LEN && (x) != IRQ_SLAVE)
+#define ICU_LEN                32
+#define IRQ_SLAVE      2
+#define LEGAL_IRQ(x)   ((x) >= 0 && (x) < ICU_LEN && (x) != IRQ_SLAVE)
 
-#define BEBOX_INTR_REG        0xbffff000
-#define INTR_VECTOR_REG 0xff0
+#define BEBOX_INTR_REG 0x7ffff000
+#define INTR_VECTOR_REG        0xff0
 
 #endif /* !_LOCORE */
 
Index: arch/bebox/stand/README
===================================================================
RCS file: /cvsroot/src/sys/arch/bebox/stand/README,v
retrieving revision 1.2
diff -u -r1.2 README
--- arch/bebox/stand/README     8 Apr 2002 16:12:18 -0000       1.2
+++ arch/bebox/stand/README     3 Feb 2008 15:02:06 -0000
@@ -44,7 +44,7 @@
        % cd /sys/arch/bebox/stand
        % $(TOOLDIR)/bin/nbmake-bebox
        % gzip -c ../compile/GENERIC/netbsd > /tmp/netbsd.gz
-       % elf2pef/elf2pef boot/boot /tmp/boot.pef /tmp/netbsd.gz
+       % nbbebox-elf2pef boot/boot /tmp/boot.pef /tmp/netbsd.gz
        [insert formatted floppy disk]
-       % mkbootimage/mkbootimage /tmp/boot.pef > /dev/rfd0a
+       % nbbebox-mkbootimage /tmp/boot.pef > /dev/rfd0a
 
>> NetBSD/bebox BOOT, Revision 1.5
>> (dagger%highpriestess.fool@localhost, Sun Feb  3 21:59:46 JST 2008)
>> Memory: 155648 k

Boot: Loading in()
2461364+195564 [153760+152766]=0x2d3bcc
start=0x3100

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 4.99.44 (GENERIC) #39: Sun Feb  3 23:39:05 JST 2008
        
dagger%highpriestess.fool@localhost:/usr/src/sys/arch/bebox/compile/GENERIC
total memory = 152 MB
avail memory = 143 MB
mainbus0 (root)
cpu0 at mainbus0: 603e (Revision 0.0), ID 0 (primary)
cpu0: HID0 90d000<DOZE,DPM,ICE,DCE,DLOCK>, powersave: 1
pci0 at mainbus0 bus 0: indirect configuration space access
pchb0 at pci0 dev 0 function 0
pchb0: Motorola MPC105 "Eagle" Host Bridge (rev. 0x24)
pchb0: L2 cache: 256K, multiprocessor mode
pcib0 at pci0 dev 11 function 0: Intel 82378ZB System I/O (rev. 0x43)
Symbios Logic 53c810 (SCSI mass storage, revision 0x02) at pci0 dev 12 function 
0 not configured
Texas Instruments product 0x8025 (Firewire serial bus, interface 0x10, revision 
0x01) at pci0 dev 13 function 0 not configured
vga0 at pci0 dev 14 function 0: Matrox MGA Millennium II 2164W (rev. 0x00)
wsdisplay0 at vga0 kbdmux 1
direct rendering for vga0 unsupported
Brooktree Bt848 Video Capture (video multimedia, revision 0x11) at pci0 dev 15 
function 0 not configured
isa0 at pcib0
lpt0 at isa0 port 0x378-0x37b irq 7
ne0 at isa0 port 0x300-0x31f irq 5
ne0: NE2000 (RTL8019) Ethernet
ne0: Ethernet address 00:c0:26:38:61:94
ne0: 10base2, 10baseT, 10baseT-FDX, auto, default [0x00 0x30] auto
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com0: console
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
pckbc0 at isa0 port 0x60-0x64
mcclock0 at isa0 port 0x70-0x71: mc146818 compatible time-of-day clock
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
biomask 800004c netmask 800004c ttymask 800004c
fd0 at fdc0 drive 1: 1.44MB, 80 cyl, 2 head, 18 sec
Kernelized RAIDframe activated
boot device: <unknown>
root device: ne0
dump device: 
file system (default generic): 
root on ne0
nfs_boot: trying BOOTP
nfs_boot: BOOTP next-server: 192.168.1.2
nfs_boot: my_domain=fool
nfs_boot: my_addr=192.168.1.127
nfs_boot: my_mask=255.255.255.0
nfs_boot: gateway=192.168.1.21
root on 192.168.1.2:/export/prep
root file system type: nfs
WARNING: preposterous TOD clock time
WARNING: using filesystem time
WARNING: CHECK AND RESET THE DATE!
warning: no /dev/console
init path (default /sbin/init): 
init: trying /sbin/init
exec /sbin/init: error 2
init path (default /sbin/oinit): 
init: trying /sbin/oinit
exec /sbin/oinit: error 2
init path (default /sbin/init.bak): /bin/sh
init: trying /bin/sh
exec /bin/sh: error 2
init path (default /sbin/init.bak): /bin/hoge
init: trying /bin/hoge
exec /bin/hoge: error 2
init path (default /sbin/init.bak): 
init: trying /sbin/init.bak
exec /sbin/init.bak: error 2
init path: ~


Home | Main Index | Thread Index | Old Index