]> git.ozlabs.org Git - yaboot.git/commitdiff
Update addnote for newer pSeries hardware
authorEthan Benson <erbenson@alaska.net>
Wed, 2 Feb 2005 05:26:31 +0000 (05:26 +0000)
committerEthan Benson <erbenson@alaska.net>
Wed, 2 Feb 2005 05:26:31 +0000 (05:26 +0000)
* util/addnote.c: Patch from Paul Mackerras to add second .note
  required by more recent pSeries hardware.

git-archimport-id: erbenson@alaska.net--public/yaboot--devel--1.3--patch-78

0arch-timestamps0
ChangeLog
util/addnote.c

index 63174f397e5fbcaa5c7e77557cb9e9a7015ffca2..abcf6243b2d27cf92502e812a57d966e4f0cd7b1 100644 (file)
-./0arch-timestamps0    1096051430      1096186229
-./BUGS 1096051430      1000991730
-./COPYING      1096051430      1000991730
-./ChangeLog    1096186221      1096186209
-./Config       1096051430      1002101497
-./INSTALL      1096051430      1000991730
-./Makefile     1096051430      1089576723
-./README       1096051430      1044766458
-./README.man.patch     1096051430      1000991730
-./THANKS       1096051430      1006350263
-./TODO 1096051430      1044766566
-./changelog    1096051430      1089576078
-./doc/Makefile 1096051430      1019310768
-./doc/README.ofboot    1096051430      1000991730
-./doc/README.ofpath    1096051430      1000991730
-./doc/README.rs6000    1096051430      1007200689
-./doc/examples/README.dualboot.chrp    1096051430      1000991730
-./doc/examples/README.mbicons  1096051430      1000991730
-./doc/examples/README.simpleboot.chrp  1096051430      1000991730
-./doc/examples/dualboot.chrp   1096051430      1068017741
-./doc/examples/large-penguin.mbicon    1096051430      1000991730
-./doc/examples/simpleboot.chrp 1096051430      1068017750
-./doc/examples/yaboot.conf.multi-boot  1096051430      1006348765
-./doc/examples/yaboot.conf.rs6000      1096051430      1006348765
-./doc/examples 1096186229      1068017750
-./doc/yaboot-howto.de.sgml     1096186222      1096186109
-./doc/yaboot-howto.sgml        1096186222      1096186082
-./doc  1096186229      1096186109
-./etc/yaboot.conf      1096051430      1006348765
-./etc  1096186229      1007269243
-./first/ofboot 1096051430      1065311880
-./first        1096186229      1071492158
-./include/asm/elf.h    1096051430      1000991730
-./include/asm/ppc_asm.tmpl     1096051430      1000991730
-./include/asm/processor.h      1096051430      1000991730
-./include/asm  1096186229      1007269243
-./include/bootinfo.h   1096051430      1007200690
-./include/byteorder.h  1096051430      1000991730
-./include/cfg.h        1096051430      1007200690
-./include/cmdline.h    1096051430      1007200690
-./include/ctype.h      1096051430      1003656411
-./include/debug.h      1096051430      1007200690
-./include/errors.h     1096051430      1007200690
-./include/et/com_err.h 1096051430      1000991731
-./include/et   1096186229      1007269243
-./include/ext2fs/bitops.h      1096051430      1003927524
-./include/ext2fs/ext2_err.h    1096051430      1003927524
-./include/ext2fs/ext2_io.h     1096051430      1003927524
-./include/ext2fs/ext2fs.h      1096051430      1003927524
-./include/ext2fs       1096186229      1007269243
-./include/fdisk-part.h 1096051430      1007200690
-./include/file.h       1096051430      1007200690
-./include/fs.h 1096051430      1007200690
-./include/linux/elf.h  1096051430      1000991731
-./include/linux/ext2_fs.h      1096051430      1000991731
-./include/linux/iso_fs.h       1096051430      1000991731
-./include/linux/stat.h 1096051430      1000991731
-./include/linux/types.h        1096051430      1000991731
-./include/linux        1096186229      1007269243
-./include/mac-part.h   1096051430      1007200690
-./include/md5.h        1096051430      1000991730
-./include/partition.h  1096051430      1007200690
-./include/prom.h       1096051430      1007200690
-./include/reiserfs/reiserfs.h  1096051430      1025684115
-./include/reiserfs     1096186229      1025684115
-./include/setjm2.h     1096051430      1000991730
-./include/setjmp.h     1096051430      1000991730
-./include/stdlib.h     1096051430      1000991730
-./include/string.h     1096051430      1002620217
-./include/swab.h       1096051430      1000991730
-./include/types.h      1096051430      1000991730
-./include/xfs/xfs.h    1096051430      1002101334
-./include/xfs  1096186229      1007269244
-./include/yaboot.h     1096051430      1007200690
-./include      1096186229      1007269244
-./lib/ctype.c  1096051430      1000991731
-./lib/libext2fs.a      1096051430      1003927524
-./lib/malloc.c 1096051430      1007200690
-./lib/nosys.c  1096051430      1000991731
-./lib/string.S 1096051430      1007200690
-./lib/strstr.c 1096051430      1000991731
-./lib/strtol.c 1096051430      1000991731
-./lib/vsprintf.c       1096051430      1000991731
-./lib  1096186229      1069320301
-./man/bootstrap.8      1096051431      1000991731
-./man/mkofboot.8       1096051431      1006348765
-./man/ofpath.8 1096051431      1000991731
-./man/yaboot.conf.5    1096051431      1004256691
-./man/yabootconfig.8   1096051431      1027929577
-./man/ybin.8   1096051431      1006348765
-./man/yaboot.8 1096051431      1090699543
-./man  1096186229      1090699543
-./man.patch    1096051431      1006348761
-./second/cache.S       1096051431      1007200690
-./second/cfg.c 1096051431      1007200690
-./second/cmdline.c     1096051431      1032059589
-./second/crt0.S        1096051431      1000991731
-./second/file.c        1096051431      1044868693
-./second/fs.c  1096051431      1032059574
-./second/fs_ext2.c     1096051431      1032059564
-./second/fs_iso.c      1096051431      1007200690
-./second/fs_of.c       1096051431      1089575693
-./second/fs_reiserfs.c 1096051431      1007200690
-./second/fs_xfs.c      1096051431      1032059541
-./second/iso_util.c    1096051431      1003656415
-./second/md5.c 1096051431      1032059532
-./second/partition.c   1096051431      1032059525
-./second/prom.c        1096051431      1067937197
-./second/setjmp.S      1096051431      1000991732
-./second/yaboot.c      1096051431      1032059504
-./second       1096186229      1089575693
-./util/addnote.c       1096051431      1007200691
-./util/elfextract.c    1096051431      1007303237
-./util 1096186229      1069320301
-./ybin/mkofboot        1096186229      1073219938
-./ybin/ofpath  1096051431      1089576762
-./ybin/ybin    1096051431      1089576732
-./ybin/yabootconfig    1096051431      1089576743
-./ybin 1096186229      1089576762
-.      1096186229      1096186221
+./0arch-timestamps0    1107321971      1107321987
+./BUGS 1107321971      1000991730
+./COPYING      1107321971      1000991730
+./ChangeLog    1107321966      1107321962
+./Config       1107321971      1002101497
+./INSTALL      1107321971      1000991730
+./Makefile     1107321503      1089576723
+./README       1107321971      1044766458
+./README.man.patch     1107321971      1000991730
+./THANKS       1107321971      1006350263
+./TODO 1107321971      1044766566
+./changelog    1107321971      1089576078
+./doc/Makefile 1107321978      1019310768
+./doc/README.ofboot    1107321971      1000991730
+./doc/README.ofpath    1107321971      1000991730
+./doc/README.rs6000    1107321971      1007200689
+./doc/examples/README.dualboot.chrp    1107321971      1000991730
+./doc/examples/README.mbicons  1107321971      1000991730
+./doc/examples/README.simpleboot.chrp  1107321971      1000991730
+./doc/examples/dualboot.chrp   1107321971      1068017741
+./doc/examples/large-penguin.mbicon    1107321971      1000991730
+./doc/examples/simpleboot.chrp 1107321971      1068017750
+./doc/examples/yaboot.conf.multi-boot  1107321971      1006348765
+./doc/examples/yaboot.conf.rs6000      1107321971      1006348765
+./doc/examples 1107321966      1068017750
+./doc/yaboot-howto.de.sgml     1107321978      1096186109
+./doc/yaboot-howto.sgml        1107321978      1096186082
+./doc  1107321966      1096186109
+./etc/yaboot.conf      1107321971      1006348765
+./etc  1107321967      1007269243
+./first/ofboot 1107321971      1065311880
+./first        1107321967      1071492158
+./include/asm/elf.h    1107321971      1000991730
+./include/asm/ppc_asm.tmpl     1107321971      1000991730
+./include/asm/processor.h      1107321971      1000991730
+./include/asm  1107321967      1007269243
+./include/bootinfo.h   1107321971      1007200690
+./include/byteorder.h  1107321971      1000991730
+./include/cfg.h        1107321971      1007200690
+./include/cmdline.h    1107321971      1007200690
+./include/ctype.h      1107321971      1003656411
+./include/debug.h      1107321978      1007200690
+./include/errors.h     1107321971      1007200690
+./include/et/com_err.h 1107321971      1000991731
+./include/et   1107321967      1007269243
+./include/ext2fs/bitops.h      1107321972      1003927524
+./include/ext2fs/ext2_err.h    1107321972      1003927524
+./include/ext2fs/ext2_io.h     1107321972      1003927524
+./include/ext2fs/ext2fs.h      1107321972      1003927524
+./include/ext2fs       1107321967      1007269243
+./include/fdisk-part.h 1107321972      1007200690
+./include/file.h       1107321972      1007200690
+./include/fs.h 1107321972      1007200690
+./include/linux/elf.h  1107321973      1000991731
+./include/linux/ext2_fs.h      1107321973      1000991731
+./include/linux/iso_fs.h       1107321973      1000991731
+./include/linux/stat.h 1107321973      1000991731
+./include/linux/types.h        1107321973      1000991731
+./include/linux        1107321967      1007269243
+./include/mac-part.h   1107321973      1007200690
+./include/md5.h        1107321973      1000991730
+./include/partition.h  1107321973      1007200690
+./include/prom.h       1107321974      1007200690
+./include/reiserfs/reiserfs.h  1107321974      1025684115
+./include/reiserfs     1107321967      1025684115
+./include/setjm2.h     1107321974      1000991730
+./include/setjmp.h     1107321974      1000991730
+./include/stdlib.h     1107321974      1000991730
+./include/string.h     1107321974      1002620217
+./include/swab.h       1107321974      1000991730
+./include/types.h      1107321974      1000991730
+./include/xfs/xfs.h    1107321971      1002101334
+./include/xfs  1107321967      1007269244
+./include/yaboot.h     1107321974      1007200690
+./include      1107321967      1007269244
+./lib/ctype.c  1107321974      1000991731
+./lib/libext2fs.a      1107321975      1003927524
+./lib/malloc.c 1107321975      1007200690
+./lib/nosys.c  1107321975      1000991731
+./lib/string.S 1107321975      1007200690
+./lib/strstr.c 1107321975      1000991731
+./lib/strtol.c 1107321975      1000991731
+./lib/vsprintf.c       1107321975      1000991731
+./lib  1107321967      1069320301
+./man/bootstrap.8      1107321975      1000991731
+./man/mkofboot.8       1107321976      1006348765
+./man/ofpath.8 1107321976      1000991731
+./man/yaboot.conf.5    1107321976      1004256691
+./man/yabootconfig.8   1107321976      1027929577
+./man/ybin.8   1107321977      1006348765
+./man/yaboot.8 1107321976      1090699543
+./man  1107321967      1090699543
+./man.patch    1107321977      1006348761
+./second/cache.S       1107321977      1007200690
+./second/cfg.c 1107321977      1007200690
+./second/cmdline.c     1107321977      1032059589
+./second/crt0.S        1107320453      1000991731
+./second/file.c        1107321977      1044868693
+./second/fs.c  1107321977      1032059574
+./second/fs_ext2.c     1107321977      1032059564
+./second/fs_iso.c      1107321977      1007200690
+./second/fs_of.c       1107321977      1089575693
+./second/fs_reiserfs.c 1107321977      1007200690
+./second/fs_xfs.c      1107321971      1032059541
+./second/iso_util.c    1107321977      1003656415
+./second/md5.c 1107321977      1032059532
+./second/partition.c   1107321977      1032059525
+./second/prom.c        1107321977      1067937197
+./second/setjmp.S      1107321977      1000991732
+./second/yaboot.c      1107321977      1032059504
+./second       1107320452      1089575693
+./util/elfextract.c    1107321977      1007303237
+./util/addnote.c       1107321977      1107321884
+./util 1107321967      1107321884
+./ybin/mkofboot        1107321967      1073219938
+./ybin/ofpath  1107321977      1089576762
+./ybin/ybin    1107321978      1089576732
+./ybin/yabootconfig    1107321978      1089576743
+./ybin 1107321967      1089576762
+.      1107321968      1107321967
index f72fff48dbbfee532944c47a73f407b1b2885b8d..d28c86af0c066e2b50e1941122c3e3225c7032a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
 # arch-tag: automatic-ChangeLog--erbenson@alaska.net--public/yaboot--devel--1.3
 #
 
+2005-02-02 05:26:31 GMT        Ethan Benson <erbenson@alaska.net>      patch-78
+
+    Summary:
+      Update addnote for newer pSeries hardware
+    Revision:
+      yaboot--devel--1.3--patch-78
+
+    * util/addnote.c: Patch from Paul Mackerras to add second .note
+      required by more recent pSeries hardware.
+    
+
+    modified files:
+     0arch-timestamps0 ChangeLog util/addnote.c
+
+
 2004-09-26 08:10:31 GMT        Ethan Benson <erbenson@alaska.net>      patch-77
 
     Summary:
index 90434c8c2a3a63259e115ee8bc82bb5f2e88d038..741bf8a0b76cef0b5e579bd44ad6d5167e9e17f4 100644 (file)
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <string.h>
 
+/* CHRP note section */
 char arch[] = "PowerPC";
 
 #define N_DESCR        6
@@ -40,6 +41,29 @@ unsigned int descr[N_DESCR] = {
      0x4000,                   /* load-base */
 };
 
+/* RPA note section */
+char rpaname[] = "IBM,RPA-Client-Config";
+
+/*
+ * Note: setting ignore_my_client_config *should* mean that OF ignores
+ * all the other fields, but there is a firmware bug which means that
+ * it looks at the splpar field at least.  So these values need to be
+ * reasonable.
+ */
+#define N_RPA_DESCR    8
+unsigned int rpanote[N_RPA_DESCR] = {
+     0,                                /* lparaffinity */
+     64,                       /* min_rmo_size */
+     0,                                /* min_rmo_percent */
+     40,                       /* max_pft_size */
+     1,                                /* splpar */
+     -1,                       /* min_load */
+     0,                                /* new_mem_def */
+     1,                                /* ignore_my_client_config */
+};
+
+#define ROUNDUP(len)   (((len) + 3) & ~3)
+
 unsigned char buf[512];
 
 #define GET_16BE(off)  ((buf[off] << 8) + (buf[(off)+1]))
@@ -77,7 +101,7 @@ main(int ac, char **av)
 {
      int fd, n, i;
      int ph, ps, np;
-     int nnote, ns;
+     int nnote, nnote2, ns;
 
      if (ac != 2) {
          fprintf(stderr, "Usage: %s elf-file\n", av[0]);
@@ -89,7 +113,8 @@ main(int ac, char **av)
          exit(1);
      }
 
-     nnote = strlen(arch) + 1 + (N_DESCR + 3) * 4;
+     nnote = 12 + ROUNDUP(strlen(arch) + 1) + sizeof(descr);
+     nnote2 = 12 + ROUNDUP(strlen(rpaname) + 1) + sizeof(rpanote);
 
      n = read(fd, buf, sizeof(buf));
      if (n < 0) {
@@ -112,7 +137,7 @@ main(int ac, char **av)
      np = GET_16BE(E_PHNUM);
      if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
          goto notelf;
-     if (ph + (np + 1) * ps + nnote > n)
+     if (ph + (np + 2) * ps + nnote + nnote2 > n)
          goto nospace;
 
      for (i = 0; i < np; ++i) {
@@ -125,12 +150,12 @@ main(int ac, char **av)
      }
 
      /* XXX check that the area we want to use is all zeroes */
-     for (i = 0; i < ps + nnote; ++i)
+     for (i = 0; i < 2 * ps + nnote + nnote2; ++i)
          if (buf[ph + i] != 0)
               goto nospace;
 
      /* fill in the program header entry */
-     ns = ph + ps;
+     ns = ph + 2 * ps;
      PUT_32BE(ph + PH_TYPE, PT_NOTE);
      PUT_32BE(ph + PH_OFFSET, ns);
      PUT_32BE(ph + PH_FILESZ, nnote);
@@ -142,11 +167,26 @@ main(int ac, char **av)
      PUT_32BE(ns + 8, 0x1275);
      strcpy(&buf[ns + 12], arch);
      ns += 12 + strlen(arch) + 1;
-     for (i = 0; i < N_DESCR; ++i)
-         PUT_32BE(ns + i * 4, descr[i]);
+     for (i = 0; i < N_DESCR; ++i, ns += 4)
+         PUT_32BE(ns, descr[i]);
+
+     /* fill in the second program header entry and the RPA note area */
+     ph += ps;
+     PUT_32BE(ph + PH_TYPE, PT_NOTE);
+     PUT_32BE(ph + PH_OFFSET, ns);
+     PUT_32BE(ph + PH_FILESZ, nnote2);
+
+     /* fill in the note area we point to */
+     PUT_32BE(ns, strlen(rpaname) + 1);
+     PUT_32BE(ns + 4, sizeof(rpanote));
+     PUT_32BE(ns + 8, 0x12759999);
+     strcpy(&buf[ns + 12], rpaname);
+     ns += 12 + ROUNDUP(strlen(rpaname) + 1);
+     for (i = 0; i < N_RPA_DESCR; ++i, ns += 4)
+         PUT_32BE(ns, rpanote[i]);
 
      /* Update the number of program headers */
-     PUT_16BE(E_PHNUM, np + 1);
+     PUT_16BE(E_PHNUM, np + 2);
 
      /* write back */
      lseek(fd, (long) 0, SEEK_SET);