RFC: Kill off addRamDisk

David Gibson david at gibson.dropbear.id.au
Thu Jul 28 13:31:18 EST 2005


Can anyone think of any problems with abolishing addRamDisk - the icky
iSeries-specific method of loading an initial ramdisk.  If not, I'll
push this to Andrew.

iSeries has a home-built method of attaching an initial ramdisk, which
relies on an addRamDisk helper program poking the data, location and
offset into the vmlinux after build.  Both SLES and RHEL now use the
normal initramfs mechanisms instead of the iSeries specific initrd on
2.6 kernels, so let's get rid of this obsolete mechanism.

Removing this functionality in turn means the NACA, which used to
contain the ramdisk parameters no longer needs to have a fixed
address.  So, this patch removes the fixed NACA from head.S and
replaces it with an ordinary C initializer.

For good measure, this patch also eliminates an old version of
addRamDisk.c which was sitting, unused, in the ppc32 tree.

Signed-off-by: David Gibson <dwg at au1.ibm.com>

 arch/ppc/boot/utils/addRamDisk.c  |  203 -------------------------
 arch/ppc64/boot/Makefile          |   10 -
 arch/ppc64/boot/addRamDisk.c      |  300 --------------------------------------
 arch/ppc64/kernel/LparData.c      |    9 +
 arch/ppc64/kernel/head.S          |   18 --
 arch/ppc64/kernel/iSeries_setup.c |   38 ----
 include/asm-ppc64/naca.h          |   10 -
 7 files changed, 18 insertions(+), 570 deletions(-)

Index: working-2.6/arch/ppc64/boot/Makefile
===================================================================
--- working-2.6.orig/arch/ppc64/boot/Makefile	2005-07-28 13:02:04.000000000 +1000
+++ working-2.6/arch/ppc64/boot/Makefile	2005-07-28 13:02:49.000000000 +1000
@@ -52,24 +52,18 @@
 src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
 gz-sec  = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
 
-hostprogs-y		:= addnote addRamDisk
+hostprogs-y		:= addnote
 targets 		+= zImage zImage.initrd imagesize.c \
 			   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
 			   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
-			   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
-			   vmlinux.initrd
+			   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd)))
 extra-y			:= initrd.o
 
-quiet_cmd_ramdisk = RAMDISK $@
-      cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@
-
 quiet_cmd_stripvm = STRIP $@
       cmd_stripvm = $(STRIP) -s $< -o $@
 
 vmlinux.strip: vmlinux FORCE
 	$(call if_changed,stripvm)
-$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE
-	$(call if_changed,ramdisk)
 
 addsection = $(CROSS32OBJCOPY) $(1) \
 		--add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(patsubst %.o,%.gz, $(1)) \
Index: working-2.6/arch/ppc64/boot/addRamDisk.c
===================================================================
--- working-2.6.orig/arch/ppc64/boot/addRamDisk.c	2005-07-28 13:02:04.000000000 +1000
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,300 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-
-#define ElfHeaderSize  (64 * 1024)
-#define ElfPages  (ElfHeaderSize / 4096)
-#define KERNELBASE (0xc000000000000000)
-
-void get4k(FILE *file, char *buf )
-{
-	unsigned j;
-	unsigned num = fread(buf, 1, 4096, file);
-	for ( j=num; j<4096; ++j )
-		buf[j] = 0;
-}
-
-void put4k(FILE *file, char *buf )
-{
-	fwrite(buf, 1, 4096, file);
-}
-
-void death(const char *msg, FILE *fdesc, const char *fname) 
-{
-	fprintf(stderr, msg);
-	fclose(fdesc);
-	unlink(fname);
-	exit(1);
-}
-
-int main(int argc, char **argv)
-{
-	char inbuf[4096];
-	FILE *ramDisk = NULL;
-	FILE *sysmap = NULL;
-	FILE *inputVmlinux = NULL;
-	FILE *outputVmlinux = NULL;
-  
-	unsigned i = 0;
-	unsigned long ramFileLen = 0;
-	unsigned long ramLen = 0;
-	unsigned long roundR = 0;
-  
-	unsigned long sysmapFileLen = 0;
-	unsigned long sysmapLen = 0;
-	unsigned long sysmapPages = 0;
-	char* ptr_end = NULL; 
-	unsigned long offset_end = 0;
-
-	unsigned long kernelLen = 0;
-	unsigned long actualKernelLen = 0;
-	unsigned long round = 0;
-	unsigned long roundedKernelLen = 0;
-	unsigned long ramStartOffs = 0;
-	unsigned long ramPages = 0;
-	unsigned long roundedKernelPages = 0;
-	unsigned long hvReleaseData = 0;
-	u_int32_t eyeCatcher = 0xc8a5d9c4;
-	unsigned long naca = 0;
-	unsigned long xRamDisk = 0;
-	unsigned long xRamDiskSize = 0;
-	long padPages = 0;
-  
-  
-	if (argc < 2) {
-		fprintf(stderr, "Name of RAM disk file missing.\n");
-		exit(1);
-	}
-
-	if (argc < 3) {
-		fprintf(stderr, "Name of System Map input file is missing.\n");
-		exit(1);
-	}
-  
-	if (argc < 4) {
-		fprintf(stderr, "Name of vmlinux file missing.\n");
-		exit(1);
-	}
-
-	if (argc < 5) {
-		fprintf(stderr, "Name of vmlinux output file missing.\n");
-		exit(1);
-	}
-
-
-	ramDisk = fopen(argv[1], "r");
-	if ( ! ramDisk ) {
-		fprintf(stderr, "RAM disk file \"%s\" failed to open.\n", argv[1]);
-		exit(1);
-	}
-
-	sysmap = fopen(argv[2], "r");
-	if ( ! sysmap ) {
-		fprintf(stderr, "System Map file \"%s\" failed to open.\n", argv[2]);
-		exit(1);
-	}
-  
-	inputVmlinux = fopen(argv[3], "r");
-	if ( ! inputVmlinux ) {
-		fprintf(stderr, "vmlinux file \"%s\" failed to open.\n", argv[3]);
-		exit(1);
-	}
-  
-	outputVmlinux = fopen(argv[4], "w+");
-	if ( ! outputVmlinux ) {
-		fprintf(stderr, "output vmlinux file \"%s\" failed to open.\n", argv[4]);
-		exit(1);
-	}
-  
-  
-  
-	/* Input Vmlinux file */
-	fseek(inputVmlinux, 0, SEEK_END);
-	kernelLen = ftell(inputVmlinux);
-	fseek(inputVmlinux, 0, SEEK_SET);
-	printf("kernel file size = %d\n", kernelLen);
-	if ( kernelLen == 0 ) {
-		fprintf(stderr, "You must have a linux kernel specified as argv[3]\n");
-		exit(1);
-	}
-
-	actualKernelLen = kernelLen - ElfHeaderSize;
-
-	printf("actual kernel length (minus ELF header) = %d\n", actualKernelLen);
-
-	round = actualKernelLen % 4096;
-	roundedKernelLen = actualKernelLen;
-	if ( round )
-		roundedKernelLen += (4096 - round);
-	printf("Vmlinux length rounded up to a 4k multiple = %ld/0x%lx \n", roundedKernelLen, roundedKernelLen);
-	roundedKernelPages = roundedKernelLen / 4096;
-	printf("Vmlinux pages to copy = %ld/0x%lx \n", roundedKernelPages, roundedKernelPages);
-
-
-
-	/* Input System Map file */
-	/* (needs to be processed simply to determine if we need to add pad pages due to the static variables not being included in the vmlinux) */
-	fseek(sysmap, 0, SEEK_END);
-	sysmapFileLen = ftell(sysmap);
-	fseek(sysmap, 0, SEEK_SET);
-	printf("%s file size = %ld/0x%lx \n", argv[2], sysmapFileLen, sysmapFileLen);
-
-	sysmapLen = sysmapFileLen;
-
-	roundR = 4096 - (sysmapLen % 4096);
-	if (roundR) {
-		printf("Rounding System Map file up to a multiple of 4096, adding %ld/0x%lx \n", roundR, roundR);
-		sysmapLen += roundR;
-	}
-	printf("Rounded System Map size is %ld/0x%lx \n", sysmapLen, sysmapLen);
-  
-	/* Process the Sysmap file to determine where _end is */
-	sysmapPages = sysmapLen / 4096;
-	/* read the whole file line by line, expect that it doesn't fail */
-	while ( fgets(inbuf, 4096, sysmap) )  ;
-	/* search for _end in the last page of the system map */
-	ptr_end = strstr(inbuf, " _end");
-	if (!ptr_end) {
-		fprintf(stderr, "Unable to find _end in the sysmap file \n");
-		fprintf(stderr, "inbuf: \n");
-		fprintf(stderr, "%s \n", inbuf);
-		exit(1);
-	}
-	printf("Found _end in the last page of the sysmap - backing up 10 characters it looks like %s", ptr_end-10);
-	/* convert address of _end in system map to hex offset. */
-	offset_end = (unsigned int)strtol(ptr_end-10, NULL, 16);
-	/* calc how many pages we need to insert between the vmlinux and the start of the ram disk */
-	padPages = offset_end/4096 - roundedKernelPages;
-
-	/* Check and see if the vmlinux is already larger than _end in System.map */
-	if (padPages < 0) {
-		/* vmlinux is larger than _end - adjust the offset to the start of the embedded ram disk */ 
-		offset_end = roundedKernelLen;
-		printf("vmlinux is larger than _end indicates it needs to be - offset_end = %lx \n", offset_end);
-		padPages = 0;
-		printf("will insert %lx pages between the vmlinux and the start of the ram disk \n", padPages);
-	}
-	else {
-		/* _end is larger than vmlinux - use the offset to _end that we calculated from the system map */
-		printf("vmlinux is smaller than _end indicates is needed - offset_end = %lx \n", offset_end);
-		printf("will insert %lx pages between the vmlinux and the start of the ram disk \n", padPages);
-	}
-
-
-
-	/* Input Ram Disk file */
-	// Set the offset that the ram disk will be started at.
-	ramStartOffs = offset_end;  /* determined from the input vmlinux file and the system map */
-	printf("Ram Disk will start at offset = 0x%lx \n", ramStartOffs);
-  
-	fseek(ramDisk, 0, SEEK_END);
-	ramFileLen = ftell(ramDisk);
-	fseek(ramDisk, 0, SEEK_SET);
-	printf("%s file size = %ld/0x%lx \n", argv[1], ramFileLen, ramFileLen);
-
-	ramLen = ramFileLen;
-
-	roundR = 4096 - (ramLen % 4096);
-	if ( roundR ) {
-		printf("Rounding RAM disk file up to a multiple of 4096, adding %ld/0x%lx \n", roundR, roundR);
-		ramLen += roundR;
-	}
-
-	printf("Rounded RAM disk size is %ld/0x%lx \n", ramLen, ramLen);
-	ramPages = ramLen / 4096;
-	printf("RAM disk pages to copy = %ld/0x%lx\n", ramPages, ramPages);
-
-
-
-  // Copy 64K ELF header
-	for (i=0; i<(ElfPages); ++i) {
-		get4k( inputVmlinux, inbuf );
-		put4k( outputVmlinux, inbuf );
-	}
-
-	/* Copy the vmlinux (as full pages). */
-	fseek(inputVmlinux, ElfHeaderSize, SEEK_SET);
-	for ( i=0; i<roundedKernelPages; ++i ) {
-		get4k( inputVmlinux, inbuf );
-		put4k( outputVmlinux, inbuf );
-	}
-  
-	/* Insert pad pages (if appropriate) that are needed between */
-	/* | the end of the vmlinux and the ram disk. */
-	for (i=0; i<padPages; ++i) {
-		memset(inbuf, 0, 4096);
-		put4k(outputVmlinux, inbuf);
-	}
-
-	/* Copy the ram disk (as full pages). */
-	for ( i=0; i<ramPages; ++i ) {
-		get4k( ramDisk, inbuf );
-		put4k( outputVmlinux, inbuf );
-	}
-
-	/* Close the input files */
-	fclose(ramDisk);
-	fclose(inputVmlinux);
-	/* And flush the written output file */
-	fflush(outputVmlinux);
-
-
-
-	/* Fixup the new vmlinux to contain the ram disk starting offset (xRamDisk) and the ram disk size (xRamDiskSize) */
-	/* fseek to the hvReleaseData pointer */
-	fseek(outputVmlinux, ElfHeaderSize + 0x24, SEEK_SET);
-	if (fread(&hvReleaseData, 4, 1, outputVmlinux) != 1) {
-		death("Could not read hvReleaseData pointer\n", outputVmlinux, argv[4]);
-	}
-	hvReleaseData = ntohl(hvReleaseData); /* Convert to native int */
-	printf("hvReleaseData is at %08x\n", hvReleaseData);
-
-	/* fseek to the hvReleaseData */
-	fseek(outputVmlinux, ElfHeaderSize + hvReleaseData, SEEK_SET);
-	if (fread(inbuf, 0x40, 1, outputVmlinux) != 1) {
-		death("Could not read hvReleaseData\n", outputVmlinux, argv[4]);
-	}
-	/* Check hvReleaseData sanity */
-	if (memcmp(inbuf, &eyeCatcher, 4) != 0) {
-		death("hvReleaseData is invalid\n", outputVmlinux, argv[4]);
-	}
-	/* Get the naca pointer */
-	naca = ntohl(*((u_int32_t*) &inbuf[0x0C])) - KERNELBASE;
-	printf("Naca is at offset 0x%lx \n", naca);
-
-	/* fseek to the naca */
-	fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET);
-	if (fread(inbuf, 0x18, 1, outputVmlinux) != 1) {
-		death("Could not read naca\n", outputVmlinux, argv[4]);
-	}
-	xRamDisk = ntohl(*((u_int32_t *) &inbuf[0x0c]));
-	xRamDiskSize = ntohl(*((u_int32_t *) &inbuf[0x14]));
-	/* Make sure a RAM disk isn't already present */
-	if ((xRamDisk != 0) || (xRamDiskSize != 0)) {
-		death("RAM disk is already attached to this kernel\n", outputVmlinux, argv[4]);
-	}
-	/* Fill in the values */
-	*((u_int32_t *) &inbuf[0x0c]) = htonl(ramStartOffs);
-	*((u_int32_t *) &inbuf[0x14]) = htonl(ramPages);
-
-	/* Write out the new naca */
-	fflush(outputVmlinux);
-	fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET);
-	if (fwrite(inbuf, 0x18, 1, outputVmlinux) != 1) {
-		death("Could not write naca\n", outputVmlinux, argv[4]);
-	}
-	printf("Ram Disk of 0x%lx pages is attached to the kernel at offset 0x%08x\n",
-	       ramPages, ramStartOffs);
-
-	/* Done */
-	fclose(outputVmlinux);
-	/* Set permission to executable */
-	chmod(argv[4], S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
-
-	return 0;
-}
-
Index: working-2.6/arch/ppc/boot/utils/addRamDisk.c
===================================================================
--- working-2.6.orig/arch/ppc/boot/utils/addRamDisk.c	2005-05-24 14:12:22.000000000 +1000
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,203 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-
-#define ElfHeaderSize  (64 * 1024)
-#define ElfPages  (ElfHeaderSize / 4096)
-#define KERNELBASE (0xc0000000)
-
-void get4k(FILE *file, char *buf )
-{
-    unsigned j;
-    unsigned num = fread(buf, 1, 4096, file);
-    for (  j=num; j<4096; ++j )
-	buf[j] = 0;
-}
-
-void put4k(FILE *file, char *buf )
-{
-    fwrite(buf, 1, 4096, file);
-}
-
-void death(const char *msg, FILE *fdesc, const char *fname)
-{
-    printf(msg);
-    fclose(fdesc);
-    unlink(fname);
-    exit(1);
-}
-
-int main(int argc, char **argv)
-{
-    char inbuf[4096];
-    FILE *ramDisk = NULL;
-    FILE *inputVmlinux = NULL;
-    FILE *outputVmlinux = NULL;
-    unsigned i = 0;
-    u_int32_t ramFileLen = 0;
-    u_int32_t ramLen = 0;
-    u_int32_t roundR = 0;
-    u_int32_t kernelLen = 0;
-    u_int32_t actualKernelLen = 0;
-    u_int32_t round = 0;
-    u_int32_t roundedKernelLen = 0;
-    u_int32_t ramStartOffs = 0;
-    u_int32_t ramPages = 0;
-    u_int32_t roundedKernelPages = 0;
-    u_int32_t hvReleaseData = 0;
-    u_int32_t eyeCatcher = 0xc8a5d9c4;
-    u_int32_t naca = 0;
-    u_int32_t xRamDisk = 0;
-    u_int32_t xRamDiskSize = 0;
-    if ( argc < 2 ) {
-	printf("Name of RAM disk file missing.\n");
-	exit(1);
-    }
-
-    if ( argc < 3 ) {
-	printf("Name of vmlinux file missing.\n");
-	exit(1);
-    }
-
-    if ( argc < 4 ) {
-	printf("Name of vmlinux output file missing.\n");
-	exit(1);
-    }
-
-    ramDisk = fopen(argv[1], "r");
-    if ( ! ramDisk ) {
-	printf("RAM disk file \"%s\" failed to open.\n", argv[1]);
-	exit(1);
-    }
-    inputVmlinux = fopen(argv[2], "r");
-    if ( ! inputVmlinux ) {
-	printf("vmlinux file \"%s\" failed to open.\n", argv[2]);
-	exit(1);
-    }
-    outputVmlinux = fopen(argv[3], "w+");
-    if ( ! outputVmlinux ) {
-	printf("output vmlinux file \"%s\" failed to open.\n", argv[3]);
-	exit(1);
-    }
-    fseek(ramDisk, 0, SEEK_END);
-    ramFileLen = ftell(ramDisk);
-    fseek(ramDisk, 0, SEEK_SET);
-    printf("%s file size = %d\n", argv[1], ramFileLen);
-
-    ramLen = ramFileLen;
-
-    roundR = 4096 - (ramLen % 4096);
-    if ( roundR ) {
-	printf("Rounding RAM disk file up to a multiple of 4096, adding %d\n", roundR);
-	ramLen += roundR;
-    }
-
-    printf("Rounded RAM disk size is %d\n", ramLen);
-    fseek(inputVmlinux, 0, SEEK_END);
-    kernelLen = ftell(inputVmlinux);
-    fseek(inputVmlinux, 0, SEEK_SET);
-    printf("kernel file size = %d\n", kernelLen);
-    if ( kernelLen == 0 ) {
-	printf("You must have a linux kernel specified as argv[2]\n");
-	exit(1);
-    }
-
-    actualKernelLen = kernelLen - ElfHeaderSize;
-
-    printf("actual kernel length (minus ELF header) = %d\n", actualKernelLen);
-
-    round = actualKernelLen % 4096;
-    roundedKernelLen = actualKernelLen;
-    if ( round )
-	roundedKernelLen += (4096 - round);
-
-    printf("actual kernel length rounded up to a 4k multiple = %d\n", roundedKernelLen);
-
-    ramStartOffs = roundedKernelLen;
-    ramPages = ramLen / 4096;
-
-    printf("RAM disk pages to copy = %d\n", ramPages);
-
-    // Copy 64K ELF header
-      for (i=0; i<(ElfPages); ++i) {
-	  get4k( inputVmlinux, inbuf );
-	  put4k( outputVmlinux, inbuf );
-      }
-
-    roundedKernelPages = roundedKernelLen / 4096;
-
-    fseek(inputVmlinux, ElfHeaderSize, SEEK_SET);
-
-    for ( i=0; i<roundedKernelPages; ++i ) {
-	get4k( inputVmlinux, inbuf );
-	put4k( outputVmlinux, inbuf );
-    }
-
-    for ( i=0; i<ramPages; ++i ) {
-	get4k( ramDisk, inbuf );
-	put4k( outputVmlinux, inbuf );
-    }
-
-    /* Close the input files */
-    fclose(ramDisk);
-    fclose(inputVmlinux);
-    /* And flush the written output file */
-    fflush(outputVmlinux);
-
-    /* fseek to the hvReleaseData pointer */
-    fseek(outputVmlinux, ElfHeaderSize + 0x24, SEEK_SET);
-    if (fread(&hvReleaseData, 4, 1, outputVmlinux) != 1) {
-        death("Could not read hvReleaseData pointer\n", outputVmlinux, argv[3]);
-    }
-    hvReleaseData = ntohl(hvReleaseData); /* Convert to native int */
-    printf("hvReleaseData is at %08x\n", hvReleaseData);
-
-    /* fseek to the hvReleaseData */
-    fseek(outputVmlinux, ElfHeaderSize + hvReleaseData, SEEK_SET);
-    if (fread(inbuf, 0x40, 1, outputVmlinux) != 1) {
-        death("Could not read hvReleaseData\n", outputVmlinux, argv[3]);
-    }
-    /* Check hvReleaseData sanity */
-    if (memcmp(inbuf, &eyeCatcher, 4) != 0) {
-        death("hvReleaseData is invalid\n", outputVmlinux, argv[3]);
-    }
-    /* Get the naca pointer */
-    naca = ntohl(*((u_int32_t *) &inbuf[0x0c])) - KERNELBASE;
-    printf("naca is at %08x\n", naca);
-
-    /* fseek to the naca */
-    fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET);
-    if (fread(inbuf, 0x18, 1, outputVmlinux) != 1) {
-        death("Could not read naca\n", outputVmlinux, argv[3]);
-    }
-    xRamDisk = ntohl(*((u_int32_t *) &inbuf[0x0c]));
-    xRamDiskSize = ntohl(*((u_int32_t *) &inbuf[0x14]));
-    /* Make sure a RAM disk isn't already present */
-    if ((xRamDisk != 0) || (xRamDiskSize != 0)) {
-        death("RAM disk is already attached to this kernel\n", outputVmlinux, argv[3]);
-    }
-    /* Fill in the values */
-    *((u_int32_t *) &inbuf[0x0c]) = htonl(ramStartOffs);
-    *((u_int32_t *) &inbuf[0x14]) = htonl(ramPages);
-
-    /* Write out the new naca */
-    fflush(outputVmlinux);
-    fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET);
-    if (fwrite(inbuf, 0x18, 1, outputVmlinux) != 1) {
-        death("Could not write naca\n", outputVmlinux, argv[3]);
-    }
-    printf("RAM Disk of 0x%x pages size is attached to the kernel at offset 0x%08x\n",
-            ramPages, ramStartOffs);
-
-    /* Done */
-    fclose(outputVmlinux);
-    /* Set permission to executable */
-    chmod(argv[3], S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
-
-    return 0;
-}
-
Index: working-2.6/arch/ppc64/kernel/head.S
===================================================================
--- working-2.6.orig/arch/ppc64/kernel/head.S	2005-07-28 10:49:37.000000000 +1000
+++ working-2.6/arch/ppc64/kernel/head.S	2005-07-28 13:23:14.000000000 +1000
@@ -30,7 +30,6 @@
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
-#include <asm/naca.h>
 #include <asm/systemcfg.h>
 #include <asm/ppc_asm.h>
 #include <asm/offsets.h>
@@ -510,24 +509,9 @@
 	mfspr	r12,SPRG2
 	EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted)
 
-	
-	/* Space for the naca.  Architected to be located at real address
-	 * NACA_PHYS_ADDR.  Various tools rely on this location being fixed.
-	 * The first dword of the naca is required by iSeries LPAR to
-	 * point to itVpdAreas.  On pSeries native, this value is not used.
-	 */
-	. = NACA_PHYS_ADDR
-	.globl __end_interrupts
-__end_interrupts:
-#ifdef CONFIG_PPC_ISERIES
-	.globl naca
-naca:
-	.llong	itVpdAreas
-	.llong	0		/* xRamDisk */
-	.llong	0		/* xRamDiskSize */
-
 	. = 0x6100
 
+#ifdef CONFIG_PPC_ISERIES
 /***  ISeries-LPAR interrupt handlers ***/
 
 	STD_EXCEPTION_ISERIES(0x200, machine_check, PACA_EXMC)
Index: working-2.6/arch/ppc64/kernel/iSeries_setup.c
===================================================================
--- working-2.6.orig/arch/ppc64/kernel/iSeries_setup.c	2005-07-28 10:41:40.000000000 +1000
+++ working-2.6/arch/ppc64/kernel/iSeries_setup.c	2005-07-28 13:11:07.000000000 +1000
@@ -316,23 +316,7 @@
 
 	ppcdbg_initialize();
 
-#if defined(CONFIG_BLK_DEV_INITRD)
-	/*
-	 * If the init RAM disk has been configured and there is
-	 * a non-zero starting address for it, set it up
-	 */
-	if (naca.xRamDisk) {
-		initrd_start = (unsigned long)__va(naca.xRamDisk);
-		initrd_end = initrd_start + naca.xRamDiskSize * PAGE_SIZE;
-		initrd_below_start_ok = 1;	// ramdisk in kernel space
-		ROOT_DEV = Root_RAM0;
-		if (((rd_size * 1024) / PAGE_SIZE) < naca.xRamDiskSize)
-			rd_size = (naca.xRamDiskSize * PAGE_SIZE) / 1024;
-	} else
-#endif /* CONFIG_BLK_DEV_INITRD */
-	{
-	    /* ROOT_DEV = MKDEV(VIODASD_MAJOR, 1); */
-	}
+	/* ROOT_DEV = MKDEV(VIODASD_MAJOR, 1); */
 
 	iSeries_recal_tb = get_tb();
 	iSeries_recal_titan = HvCallXm_loadTod();
@@ -805,22 +789,12 @@
 static void __init iSeries_fixup_klimit(void)
 {
 	/*
-	 * Change klimit to take into account any ram disk
-	 * that may be included
+	 * Check and see if there was an embedded system map.  Change
+	 * klimit to take into account any embedded system map
 	 */
-	if (naca.xRamDisk)
-		klimit = KERNELBASE + (u64)naca.xRamDisk +
-			(naca.xRamDiskSize * PAGE_SIZE);
-	else {
-		/*
-		 * No ram disk was included - check and see if there
-		 * was an embedded system map.  Change klimit to take
-		 * into account any embedded system map
-		 */
-		if (embedded_sysmap_end)
-			klimit = KERNELBASE + ((embedded_sysmap_end + 4095) &
-					0xfffffffffffff000);
-	}
+	if (embedded_sysmap_end)
+		klimit = KERNELBASE + ((embedded_sysmap_end + 4095) &
+				       0xfffffffffffff000);
 }
 
 static int __init iSeries_src_init(void)
Index: working-2.6/include/asm-ppc64/naca.h
===================================================================
--- working-2.6.orig/include/asm-ppc64/naca.h	2005-05-24 14:12:25.000000000 +1000
+++ working-2.6/include/asm-ppc64/naca.h	2005-07-28 13:17:14.000000000 +1000
@@ -12,20 +12,10 @@
 
 #include <asm/types.h>
 
-#ifndef __ASSEMBLY__
-
 struct naca_struct {
-	/* Kernel only data - undefined for user space */
 	void *xItVpdAreas;              /* VPD Data                  0x00 */
-	void *xRamDisk;                 /* iSeries ramdisk           0x08 */
-	u64   xRamDiskSize;		/* In pages                  0x10 */
 };
 
 extern struct naca_struct naca;
 
-#endif /* __ASSEMBLY__ */
-
-#define NACA_PAGE      0x4
-#define NACA_PHYS_ADDR (NACA_PAGE<<PAGE_SHIFT)
-
 #endif /* _NACA_H */
Index: working-2.6/arch/ppc64/kernel/LparData.c
===================================================================
--- working-2.6.orig/arch/ppc64/kernel/LparData.c	2005-07-28 10:41:40.000000000 +1000
+++ working-2.6/arch/ppc64/kernel/LparData.c	2005-07-28 13:22:59.000000000 +1000
@@ -128,6 +128,15 @@
 	},
 };
 
+/*
+ * The NACA.  The first dword of the naca is required by the iSeries
+ * hypervisor to point to itVpdAreas.  The hypervisor finds the NACA
+ * through the pointer in hvReleaseData.
+ */
+struct naca_struct naca = {
+	.xItVpdAreas = &itVpdAreas,
+};
+
 extern void system_reset_iSeries(void);
 extern void machine_check_iSeries(void);
 extern void data_access_iSeries(void);


-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/people/dgibson



More information about the Linuxppc64-dev mailing list