Re: Patch for IBM PRePs

2002-07-10 Thread Steve Gore
On Wed, Jul 10, 2002 at 01:57:17PM +0200, Olaf Hering wrote:
> begin  On Wed, Jul 10, Olaf Hering wrote:
> 
> > begin  On Tue, Jul 09, Tom Rini wrote:
> > 
> > > On Tue, Jul 09, 2002 at 03:26:37PM +0200, Olaf Hering wrote:
> > > 
> > > > But it seems zImage.initrd.prep is broken since at least 2.4.16:
> > > 
> > > Well, with 2.4.19-rc1 (from linuxppc_2_4, common_config + the initrd
> > > from http://penguinppc.org/~olaf/2.4.16/ramdisk.install.gz):
> > 
> > It works also on mtx+, seems to be related to 43p 140 or to IBM PReP in
> > general...
> 
> I tried it on a 43p 133 and that can mount the initrd as well. So
> something corrupts the initrd data on 140.

On a possibly related note, I had to use the Woody CHRP ramdisk.  PReP
would fail every time (sorry, don't have the error data available now).
And I've seen docs that state the 140 was an "intermediate" stage
between PReP and CHRP (I'll dig through my files and try to find them).

Have Debian running fabulously on a 7043-140 233mhz now.

Regards,
Steve


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Patch for IBM PRePs

2002-07-10 Thread Olaf Hering
begin  On Wed, Jul 10, Olaf Hering wrote:

> begin  On Tue, Jul 09, Tom Rini wrote:
> 
> > On Tue, Jul 09, 2002 at 03:26:37PM +0200, Olaf Hering wrote:
> > 
> > > But it seems zImage.initrd.prep is broken since at least 2.4.16:
> > 
> > Well, with 2.4.19-rc1 (from linuxppc_2_4, common_config + the initrd
> > from http://penguinppc.org/~olaf/2.4.16/ramdisk.install.gz):
> 
> It works also on mtx+, seems to be related to 43p 140 or to IBM PReP in
> general...

I tried it on a 43p 133 and that can mount the initrd as well. So
something corrupts the initrd data on 140.


Gruss Olaf

-- 
 $ man clone

BUGS
   Main feature not yet implemented...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Patch for IBM PRePs

2002-07-10 Thread Olaf Hering
begin  On Tue, Jul 09, Tom Rini wrote:

> On Tue, Jul 09, 2002 at 03:26:37PM +0200, Olaf Hering wrote:
> 
> > But it seems zImage.initrd.prep is broken since at least 2.4.16:
> 
> Well, with 2.4.19-rc1 (from linuxppc_2_4, common_config + the initrd
> from http://penguinppc.org/~olaf/2.4.16/ramdisk.install.gz):

It works also on mtx+, seems to be related to 43p 140 or to IBM PReP in
general...

Gruss Olaf

-- 
 $ man clone

BUGS
   Main feature not yet implemented...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Patch for IBM PRePs

2002-07-09 Thread Tom Rini
On Tue, Jul 09, 2002 at 03:26:37PM +0200, Olaf Hering wrote:

> But it seems zImage.initrd.prep is broken since at least 2.4.16:

Well, with 2.4.19-rc1 (from linuxppc_2_4, common_config + the initrd
from http://penguinppc.org/~olaf/2.4.16/ramdisk.install.gz):
Bytes Received =&2325367, Bytes Loaded =&2325367
Bytes/Second   =&465073, Elapsed Time =5 Second(s)  
loaded at: 001F 0042FBCC
relocated to:  0080 00A3FBCC
No residual data found. 
zimage at: 0080A400 00936BC0
initrd at: 00937000 00A35D0C
avail ram: 0040 0080

Linux/PPC load: console=ttyS0,9600 start_shell  
Uncompressing Linux...done. 
Now booting the kernel  
Memory BAT mapping: BAT2=128Mb, BAT3=0Mb, residual: 0Mb 
Total memory = 128MB; using 512kB for hash table (at c030)  
Linux version 2.4.19-rc1 ([EMAIL PROTECTED]) (gcc version 2.95.4 20011002 (Debi
an prerelease)) #5 Tue Jul 9 10:15:56 MST 2002  
[snip]
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize   
loop: loaded (max 8 devices)
[snip]
RAMDISK: Compressed image found at block 0  
Freeing initrd memory: 1019k freed  
VFS: Mounted root (ext2 filesystem) readonly.   
Freeing unused kernel memory: 300k init 48k pmac 8k chrp 12k openfirmware   
Moving into tmpfs...>>> SuSE installation program v1.3 (c) 1996-2001 SuSE GmbH 
<<<
[snip]

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Patch for IBM PRePs

2002-07-09 Thread Tom Rini
On Tue, Jul 09, 2002 at 03:26:37PM +0200, Olaf Hering wrote:
> begin  On Wed, Jul 03, Tom Rini wrote:
> 
> > On Wed, Jul 03, 2002 at 09:02:32PM +0200, Olaf Hering wrote:
> > 
> > > On Mon, Jul 01, Tom Rini wrote:
> > > 
> > > > Lemme know if you still have the correct ammount of memory reported
> > > > still.  Thanks.
> > >
> > > ocan you provide a new patch for _devel? I used that one and it doesnt
> > > compile
> > 
> > D'oh.  I forgot to add  to prep_setup.c.  New patches
> > attached.
> 
> It does detect the memory, seems to work fine on 43p 140.

Good.

> But it seems zImage.initrd.prep is broken since at least 2.4.16:

I'll look into this, thanks.

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Patch for IBM PRePs

2002-07-09 Thread Olaf Hering
begin  On Wed, Jul 03, Tom Rini wrote:

> On Wed, Jul 03, 2002 at 09:02:32PM +0200, Olaf Hering wrote:
> 
> > On Mon, Jul 01, Tom Rini wrote:
> > 
> > > Lemme know if you still have the correct ammount of memory reported
> > > still.  Thanks.
> >
> > ocan you provide a new patch for _devel? I used that one and it doesnt
> > compile
> 
> D'oh.  I forgot to add  to prep_setup.c.  New patches
> attached.

It does detect the memory, seems to work fine on 43p 140.

But it seems zImage.initrd.prep is broken since at least 2.4.16:


loaded at: 00600400 00879FCC
relocated to:  0080 00A79BCC
board data at: 00231370 00237D7C
relocated to:  00A70130 00A76B3C
zimage at: 0080A400 009684D5
initrd at: 00969000 00A6FBCC
avail ram: 0040 0080

Linux/PPC load: console=ttyS0,9600 start_shell
Uncompressing Linux...done.
Now booting the kernel
Memory BAT mapping: BAT2=256Mb, BAT3=128Mb, residual: 256Mb
Total memory = 384MB; using 1024kB for hash table (at c040)
...
RAMDISK: Compressed image found at block 0
invalid compressed format (err=2)<6>Freeing initrd memory: 1050k freed
...

Memory BAT mapping: BAT2=256Mb, BAT3=128Mb, residual: 256Mb
Total memory = 384MB; using 1024kB for hash table (at c040)
Linux version 2.4.19-rc1 ([EMAIL PROTECTED]) (gcc version 2.95.3 20010319 
(2.95.4 CVS + prerelease/franzo/20010912)) #7 Tue Jul 9 15:15:51 CEST 2002
PReP architecture
IBM planar ID: 00d5
MPIC at 0xf7fc (0x37fc), length 0x0004 mapped to 0xeffc
On node 0 totalpages: 98304
zone(0): 98304 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: console=ttyS0,9600 start_shell
OpenPIC Version 1.0 (4 CPUs and 16 IRQ sources) at effc
time_init: decrementer frequency = 16.617493 MHz
Console: colour dummy device 80x25
Calibrating delay loop... 398.13 BogoMIPS
Memory: 382832k available (2324k kernel code, 1032k data, 308k init, 0k highmem)
Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
Inode cache hash table entries: 32768 (order: 6, 262144 bytes)
Mount-cache hash table entries: 8192 (order: 4, 65536 bytes)
Buffer-cache hash table entries: 32768 (order: 5, 131072 bytes)
Page-cache hash table entries: 131072 (order: 7, 524288 bytes)
POSIX conformance testing by UNIFIX
PCI: Probing PCI hardware
Bridge 00:17.0 resource 0 was deactivated by firmware
Bridge 00:17.0 resource 1 was deactivated by firmware
Bridge 00:17.0 resource 2 was deactivated by firmware
Setting PCI interrupts for a "IBM 43P-140 (Tiger1)"
PCI: Cannot allocate resource region 0 of device 00:0b.0
PCI: Cannot allocate resource region 0 of device 00:0c.0
PCI: Cannot allocate resource region 0 of device 00:10.0
PCI: moved device 00:0b.0 resource 0 (101) to 1000
PCI: moved device 00:0c.0 resource 0 (101) to 1020
PCI: moved device 00:10.0 resource 0 (101) to 1400
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Thermal assist unit not available
Starting kswapd
Journalled Block Device driver loaded
Detected PS/2 Mouse Port.
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI 
enabled
ttyS00 at 0x03f8 (irq = 4) is a 16550A
ttyS01 at 0x02f8 (irq = 3) is a 16550A
Uniform Multi-Platform E-IDE driver Revision: 6.31
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
ide-floppy driver 0.99.newide
Floppy drive(s): fd0 is 2.88M
FDC 0 is a National Semiconductor PC87306
RAMDISK driver initialized: 16 RAM disks of 128000K size 1024 blocksize
loop: loaded (max 8 devices)
pcnet32.c:v1.27a 10.02.2002 [EMAIL PROTECTED]
PCI: Enabling device 00:0c.0 ( -> 0003)
pcnet32: PCnet/PCI II 79C970A at 0x1020, 00 06 29 21 17 5a assigned IRQ 22.
eth0: registered as PCnet/PCI II 79C970A
pcnet32: 1 cards_found.
ide-floppy driver 0.99.newide
SCSI subsystem driver Revision: 1.00
PCI: Enabling device 00:10.0 (0016 -> 0017)
sym.0.16.0: setting PCI_COMMAND_PARITY...
sym0: <825a> rev 0x13 on pci bus 0 device 16 function 0 irq 23
sym0: No NVRAM, ID 7, Fast-10, SE, parity checking
sym0: SCSI BUS has been reset.
scsi0 : sym-2.1.17a
  Vendor: IBM   Model: CDRM00203 !K  Rev: 8B08
  Type:   CD-ROM ANSI SCSI revision: 02
sym0:5: FAST-10 WIDE SCSI 20.0 MB/s ST (100.0 ns, offset 8)
  Vendor: IBM   Model: DCAS-32160W   !#  Rev: S63A
  Type:   Direct-Access  ANSI SCSI revision: 02
sym0:6: FAST-10 WIDE SCSI 20.0 MB/s ST (100.0 ns, offset 8)
  Vendor: IBM   Model: DCAS-32160W   !#  Rev: S63A
  Type:   Direct-Access  ANSI SCSI revision: 02
sym0:5:0: tagged command queuing enabled, command queue depth 16.
sym0:6:0: tagged command queuing enabled, command queue depth 16.
scsi1 : SCSI host adapter emulation for IDE ATAPI devices
mesh: configured for synchronous 5 MB/s
Attached scsi disk sda at scsi0, channel 0, id 5, lun 0
Attached scsi disk sdb at scsi0, channel 0, id 6, lun 0
SCSI device sda: 4226725 512-byte hdwr sectors 

Re: Patch for IBM PRePs

2002-07-05 Thread Tom Rini
On Wed, Jul 03, 2002 at 04:58:17PM -0700, Tom Rini wrote:
> On Wed, Jul 03, 2002 at 09:02:32PM +0200, Olaf Hering wrote:
> 
> > On Mon, Jul 01, Tom Rini wrote:
> > 
> > > Lemme know if you still have the correct ammount of memory reported
> > > still.  Thanks.
> >
> > ocan you provide a new patch for _devel? I used that one and it doesnt
> > compile
> 
> D'oh.  I forgot to add  to prep_setup.c.  New patches
> attached.

D'oh again.  Attached are the missing files.  I hate regenerating
patches :)

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
/*
 * arch/ppc/boot/common/mpc10x_common.c
 * 
 * A routine to find out how much memory the machine has.
 *
 * Based on:
 * arch/ppc/kernel/mpc10x_common.c
 *
 * Author: Mark A. Greer
 * [EMAIL PROTECTED]
 *
 * Copyright 2001-2002 MontaVista Software Inc.
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

#include 
#include 
#include 
#include "mpc10x.h"

/*
 * *** WARNING - A BAT MUST be set to access the PCI config addr/data regs ***
 */


/*
 * PCI config space macros, similar to indirect_xxx and early_xxx macros.
 * We assume bus 0.
 */
#define MPC10X_CFG_read(val, addr, type, op)	*val = op((type)(addr))
#define MPC10X_CFG_write(val, addr, type, op)	op((type *)(addr), (val))

#define MPC10X_PCI_OP(rw, size, type, op, mask)			 	\
static void\
mpc10x_##rw##_config_##size(unsigned int *cfg_addr, 			\
		unsigned int *cfg_data, int devfn, int offset,		\
		type val)		\
{	\
	out_be32(cfg_addr, 		\
		 ((offset & 0xfc) << 24) | (devfn << 16)		\
		 | (0 << 8) | 0x80);	\
	MPC10X_CFG_##rw(val, cfg_data + (offset & mask), type, op);	\
	return;	 		\
}

MPC10X_PCI_OP(read, byte,  u8 *, in_8, 3)
MPC10X_PCI_OP(read, dword, u32 *, in_le32, 0)

/*
 * Read the memory controller registers to determine the amount of memory in
 * the system.  This assumes that the firmware has correctly set up the memory
 * controller registers.
 */
unsigned long
mpc10x_get_mem_size(unsigned int mem_map)
{
	unsigned int *config_addr, *config_data, val;
	unsigned long start, end, total, offset;
	int i;
	unsigned char bank_enables;

	switch (mem_map) {
		case MPC10X_MEM_MAP_A:
			config_addr = (unsigned int *)MPC10X_MAPA_CNFG_ADDR;
			config_data = (unsigned int *)MPC10X_MAPA_CNFG_DATA;
			break;
		case MPC10X_MEM_MAP_B:
			config_addr = (unsigned int *)MPC10X_MAPB_CNFG_ADDR;
			config_data = (unsigned int *)MPC10X_MAPB_CNFG_DATA;
			break;
		default:
			return 0;
	}

	mpc10x_read_config_byte(config_addr, config_data, PCI_DEVFN(0,0),
			MPC10X_MCTLR_MEM_BANK_ENABLES, &bank_enables);

	total = 0;

	for (i = 0; i < 8; i++) {
		if (bank_enables & (1 << i)) {
			offset = MPC10X_MCTLR_MEM_START_1 + ((i > 3) ? 4 : 0);
			mpc10x_read_config_dword(config_addr, config_data,
	PCI_DEVFN(0,0), offset, &val);
			start = (val >> ((i & 3) << 3)) & 0xff;

			offset = MPC10X_MCTLR_EXT_MEM_START_1 + ((i>3) ? 4 : 0);
			mpc10x_read_config_dword(config_addr, config_data,
	PCI_DEVFN(0,0), offset, &val);
			val = (val >> ((i & 3) << 3)) & 0x03;
			start = (val << 28) | (start << 20);

			offset = MPC10X_MCTLR_MEM_END_1 + ((i > 3) ? 4 : 0);
			mpc10x_read_config_dword(config_addr, config_data,
	PCI_DEVFN(0,0), offset, &val);
			end = (val >> ((i & 3) << 3)) & 0xff;

			offset = MPC10X_MCTLR_EXT_MEM_END_1 + ((i > 3) ? 4 : 0);
			mpc10x_read_config_dword(config_addr, config_data,
	PCI_DEVFN(0,0), offset, &val);
			val = (val >> ((i & 3) << 3)) & 0x03;
			end = (val << 28) | (end << 20) | 0xf;

			total += (end - start + 1);
		}
	}

	return total;
}
/*
 * arch/ppc/boot/include/mpc10.h
 *
 * Common defines for the Motorola SPS MPC106/8240/107 Host bridge/Mem
 * ctrl/EPIC/etc.
 *
 * Author: Tom Rini <[EMAIL PROTECTED]>
 *
 * This is a heavily stripped down version of:
 * include/asm-ppc/mpc10x.h
 *
 * Author: Mark A. Greer
 * [EMAIL PROTECTED]
 *
 * Copyright 2001-2002 MontaVista Software Inc.
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */
#ifndef __BOOT_MPC10X_H__
#define __BOOT_MPC10X_H__

/*
 * The values here don't completely map everything but should work in most
 * cases.
 *
 * MAP A (PReP Map)
 *   Processor: 0x8000 - 0x807f -> PCI I/O: 0x - 0x007f
 *   Processor: 0xc000 - 0xdfff -> PCI MEM: 0x - 0x1fff
 *   PCI MEM:   0x8000 -> Processor System Memory: 0x
 *   EUMB mapped to: ioremap_base - 0x0010 (ioremap_base - 1 MB)
 *
 * MAP B (CHRP Map)
 *   Processor: 0xfe00 - 0xfebf -> PCI I/O: 0x - 0x00bf
 *   Processor: 0x8000 - 0xbfff -> PCI MEM:

Re: Patch for IBM PRePs

2002-07-03 Thread Tom Rini
On Wed, Jul 03, 2002 at 09:02:32PM +0200, Olaf Hering wrote:

> On Mon, Jul 01, Tom Rini wrote:
> 
> > Lemme know if you still have the correct ammount of memory reported
> > still.  Thanks.
>
> ocan you provide a new patch for _devel? I used that one and it doesnt
> compile

D'oh.  I forgot to add  to prep_setup.c.  New patches
attached.

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
= arch/ppc/boot/prep/Makefile 1.31 vs edited =
--- 1.31/arch/ppc/boot/prep/MakefileThu Mar  7 13:42:37 2002
+++ edited/arch/ppc/boot/prep/Makefile  Wed Jul  3 09:20:04 2002
@@ -23,9 +23,10 @@
 endif
 
 LD_ARGS= -T ../ld.script -Ttext 0x0080 
-Bstatic
-obj-y  := head.o ../simple/legacy.o misc.o of1275.o \
+obj-y  := head.o ../simple/legacy.o misc.o \
../common/util.o ../common/string.o \
-   ../common/misc-common.o
+   ../common/misc-common.o \
+   ../common/mpc10x_memory.o
 OBJCOPY_ARGS   = -O elf32-powerpc
 LIBS   = ../lib/zlib.a
 
@@ -55,7 +56,7 @@
$(LD) $(LD_ARGS) -o $@ $(obj-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $@ ../images/[EMAIL PROTECTED]
-   rm -f $@
+   #rm -f $@
 
 zImage.initrd: $(obj-y) $(LIBS) ../ld.script ../images/vmlinux.gz $(MKPREP) \
../common/dummy.o
= arch/ppc/boot/prep/head.S 1.14 vs edited =
--- 1.14/arch/ppc/boot/prep/head.S  Thu Mar  7 13:42:37 2002
+++ edited/arch/ppc/boot/prep/head.SWed Jul  3 09:20:04 2002
@@ -38,10 +38,6 @@
isync
 
mr  r11,r3  /* Save pointer to residual/board data */
-   mr  r25,r5  /* Save OFW pointer */
-
-   /* Save the original MSR value */
-   mfmsr   r26
 
/* Establish default MSR value */
li  r3,MSR_IP|MSR_FP
@@ -114,17 +110,11 @@
li  r2,0x000F   /* Mask pointer to 16-byte boundary */
andcr1,r1,r2
 
-   /* Store the original MSR into 'orig_MSR' */
-   lis r3,[EMAIL PROTECTED]
-   ori r3,r3,[EMAIL PROTECTED]
-   stw r26,0(r3)
-
 /* Run loader */
mr  r3,r8   /* Load point */
mr  r4,r7   /* Program length */
mr  r5,r6   /* Checksum */
mr  r6,r11  /* Residual data */
-   mr  r7,r25  /* OFW interfaces */
bl  decompress_kernel
 
/*
= arch/ppc/boot/prep/misc.c 1.27 vs edited =
--- 1.27/arch/ppc/boot/prep/misc.c  Thu Mar  7 13:42:37 2002
+++ edited/arch/ppc/boot/prep/misc.cWed Jul  3 09:27:37 2002
@@ -20,6 +20,8 @@
 #include 
 #include 
 #include 
+
+#include "mpc10x.h"
 #include "nonstdio.h"
 #include "zlib.h"
 
@@ -51,7 +53,6 @@
 RESIDUAL hold_resid_buf;
 RESIDUAL *hold_residual = &hold_resid_buf;
 unsigned long initrd_size = 0;
-unsigned long orig_MSR;
 
 char *zimage_start;
 int zimage_size;
@@ -66,16 +67,11 @@
 #endif /* CONFIG_VGA_CONSOLE */
 
 extern int CRT_tstc(void);
-extern void of_init(void *handler);
-extern int of_finddevice(const char *device_specifier, int *phandle);
-extern int of_getprop(int phandle, const char *name, void *buf, int buflen,
-   int *size);
 extern int vga_init(unsigned char *ISA_mem);
 extern void gunzip(void *, int, unsigned char *, int *);
-
-extern void _put_MSR(unsigned int val);
 extern unsigned long serial_init(int chan, void *ignored);
 extern void serial_fixups(void);
+extern unsigned long mpc10x_get_mem_size(int mem_map);
 
 void
 writel(unsigned int val, unsigned int address)
@@ -120,15 +116,12 @@
 
 unsigned long
 decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
- RESIDUAL *residual, void *OFW_interface)
+ RESIDUAL *residual)
 {
int timer = 0;
extern unsigned long start;
char *cp, ch;
unsigned long TotalMemory;
-   int dev_handle;
-   int mem_info[2];
-   int res, size;
unsigned char board_type;
unsigned char base_mod;
int start_multi = 0;
@@ -142,6 +135,11 @@
vga_init((unsigned char *)0xC000);
 #endif /* CONFIG_VGA_CONSOLE */
 
+   /* 
+* Find out how much memory we have.
+*/
+   TotalMemory = mpc10x_get_mem_size(MPC10X_MEM_MAP_A);
+
/*
 * Tell the user where we were loaded at and where we were relocated
 * to for debugging this process.
@@ -218,47 +216,6 @@
} else {
/* Tell the user we didn't find anything. */
puts("No residual data found.\n");
-
-   /* Assume 32M in the absence of more info... */
-   TotalMemory = 0x0200;
-
-   /*
-