patch-2.4.9 linux/arch/arm/boot/compressed/ofw-shark.c

Next file: linux/arch/arm/config.in
Previous file: linux/arch/arm/boot/compressed/misc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.8/linux/arch/arm/boot/compressed/ofw-shark.c linux/arch/arm/boot/compressed/ofw-shark.c
@@ -20,14 +20,20 @@
 create_params (unsigned long *buffer)
 {
 	/* Is there a better address? Also change in mach-shark/arch.c */
-	struct param_struct *params = (struct param_struct *) 0x08003000;
+	struct tag *tag = (struct tag *) 0x08003000;
 	int j,i,m,k,nr_banks,size;
+	unsigned char *c;
 
-	for (j=0;j<256;j++) params->u1.unused[j]=0;
+	/* Head of the taglist */
+	tag->hdr.tag  = ATAG_CORE;
+	tag->hdr.size = tag_size(tag_core);
+	tag->u.core.flags = FLAG_READONLY;
+	tag->u.core.pagesize = PAGE_SIZE;
+	tag->u.core.rootdev = 0;
 
+	/* Build up one tagged block for each memory region */
 	size=0;
 	nr_banks=(unsigned int) buffer[0];
-	if (nr_banks > NR_BANKS) nr_banks = NR_BANKS;
 	for (j=0;j<nr_banks;j++){
 		/* search the lowest address and put it into the next entry   */
 		/* not a fast sort algorithm, but there are at most 8 entries */
@@ -40,23 +46,38 @@
 			}
 		}
 	  
-		/* using pages_in_bank for startaddress and size               */
-		/* start is in bytes, size in pages and not bigger than 0x2000 */
-		/* This is decoded in fixup_shark in arch/arm/kernel/arch.c    */
-		params->u1.s.pages_in_bank[j]=buffer[2*k+1]|(buffer[2*k+2]/PAGE_SIZE);
+		tag = tag_next(tag);
+		tag->hdr.tag = ATAG_MEM;
+		tag->hdr.size = tag_size(tag_mem32);
+		tag->u.mem.size = buffer[2*k+2];
+		tag->u.mem.start = buffer[2*k+1];
+
 		size += buffer[2*k+2];
 
-		buffer[2*k+1]=0xffffffff;                    /* mark as copied             */
+		buffer[2*k+1]=0xffffffff;                    /* mark as copied */
 	}
 	
-	params->u1.s.page_size = PAGE_SIZE;
-	params->u1.s.nr_pages  = size/PAGE_SIZE;
-	params->u1.s.flags     = FLAG_READONLY;
+	/* The command line */
+	tag = tag_next(tag);
+	tag->hdr.tag = ATAG_CMDLINE;
 	
-	/* Copy over the bootargs */
-	for (j=0;j<128/4;j++) {
-		((unsigned long *) params->commandline)[j]=buffer[33+j];
-	}
+	c=(unsigned char *)(&buffer[34]);
+	j=0;
+	while (*c) tag->u.cmdline.cmdline[j++]=*c++;
+
+	tag->u.cmdline.cmdline[j]=0;
+	tag->hdr.size = (j + 7 + sizeof(struct tag_header)) >> 2;
+
+	/* Hardware revision */
+	tag = tag_next(tag);
+	tag->hdr.tag = ATAG_REVISION;
+	tag->hdr.size = tag_size(tag_revision);
+	tag->u.revision.rev = ((unsigned char) buffer[33])-'0';
+
+	/* End of the taglist */
+	tag = tag_next(tag);
+	tag->hdr.tag = 0;
+	tag->hdr.size = 0;
 }
 
 
@@ -165,7 +186,7 @@
 asmlinkage void ofw_init(ofw_handle_t o, int *nomr, int *pointer)
 {
 	int phandle,i,mem_len,buffer[32];
-	char temp[12];
+	char temp[15];
   
 	temp[0]='/';
 	temp[1]='m';
@@ -212,6 +233,26 @@
 
 	mem_len = OF_getproplen(o,phandle, temp);
 	OF_getprop(o,phandle, temp, buffer, mem_len);
-	for (i=0; i<=mem_len/4; i++) pointer[i+32]=buffer[i];
-  
+	if (mem_len > 128) mem_len=128;
+	for (i=0; i<=mem_len/4; i++) pointer[i+33]=buffer[i];
+	pointer[i+33]=0;
+
+	temp[0]='/';
+	temp[1]='\0';
+	phandle=OF_finddevice(o,temp);
+	temp[0]='b';
+	temp[1]='a';
+	temp[2]='n';
+	temp[3]='n';
+	temp[4]='e';
+	temp[5]='r';
+	temp[6]='-';
+	temp[7]='n';
+	temp[8]='a';
+	temp[9]='m';
+	temp[10]='e';
+	temp[11]='\0';
+	mem_len = OF_getproplen(o,phandle, temp);
+	OF_getprop(o,phandle, temp, buffer, mem_len);
+	(unsigned char) pointer[32] = ((unsigned char *) buffer)[mem_len-2];
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)