[coreboot-gerrit] New patch to review for coreboot: amdfwtool: Complete the PSP2 directory layout

Zheng Bao (zheng.bao@amd.com) gerrit at coreboot.org
Thu Nov 19 12:35:15 CET 2015


Zheng Bao (zheng.bao at amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12474

-gerrit

commit 98c07439d22627c7c36fbde4a2c2dbcbf3aa33af
Author: Zheng Bao <fishbaozi at gmail.com>
Date:   Thu Nov 19 19:33:47 2015 +0800

    amdfwtool: Complete the PSP2 directory layout
    
    PSP2 is for Combo BIOS, which is the idea that one image supports 2
    kinds of APU.
    
    The PSP2 feature is for the future, not for current products.
    The newest document about PSP2 is not available. I made it from the
    draft code I made when I was in AMD.
    
    Change-Id: I65328db197c02ee67f3e99faf4ab8acabd339657
    Signed-off-by: Zheng Bao <fishbaozi at gmail.com>
---
 util/amdfwtool/amdfwtool.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c
index f090411..8f0343e 100644
--- a/util/amdfwtool/amdfwtool.c
+++ b/util/amdfwtool/amdfwtool.c
@@ -40,9 +40,22 @@
  *  |                                                          |
  *  |                                                          |
  *  +------------+---------------+----------------+------------+
+ *
+ *  PSP2 directory
+ *  +------------+---------------+----------------+------------+
+ *  | 'PSP2'     | Fletcher      |    Count       | Reserved   |
+ *  +------------+---------------+----------------+------------+
+ *  |     1      | PSP ID        |   Base address |            | 2nd PSP directory
+ *  +------------+---------------+----------------+------------+
+ *  |     2      | PSP ID        |   Base address |            | 3rd PSP directory
+ *  +------------+---------------+----------------+------------+
+ *  |                                                          |
+ *  |        Other PSP                                         |
+ *  |                                                          |
+ *  +------------+---------------+----------------+------------+
+ *
  */
 
-
 #include <fcntl.h>
 #include <errno.h>
 #include <stdio.h>
@@ -348,7 +361,7 @@ int main(int argc, char **argv)
 #endif
 	void *rom = NULL;
 	uint32_t current;
-	uint32_t *amd_romsig, *pspdir;
+	uint32_t *amd_romsig, *pspdir, *psp2dir;
 
 	int targetfd;
 	char *output;
@@ -511,11 +524,25 @@ int main(int argc, char **argv)
 
 #if PSP2
 		if (psp2flag == 1) {
-			current = ALIGN(current, 0x10000);
-			pspdir = rom + current;
+			current = ALIGN(current, 0x10000); /* PSP2 dir */
+			psp2dir = rom + current;
 			amd_romsig[5] = current + ROM_BASE_ADDRESS;
-			current += 0x200;	/* Conservative size of pspdir */
 
+			/* TODO: remove the hardcode. */
+			count = 1;
+			psp2dir[0] = 1347637298;  /* 'PSP2' */
+			psp2dir[2] = count;		  /* Count */
+			psp2dir[3] = 0;
+			psp2dir[4] = count;		/* PSP No.1 */
+			psp2dir[5] = 0x10220b00; /* PSP ID. Documentation is needed. */
+
+			current += 0x100;	/* Add conservative size of psp2dir. 2nd PSP dir. */
+			pspdir = rom + current;
+
+			psp2dir[6] = current + ROM_BASE_ADDRESS;
+			psp2dir[1] = fletcher32((uint16_t *)&psp2dir[1], (count*16 + 16)/2 - 2);
+
+			current += 0x200;	/* Add conservative size of pspdir. Start of 2nd PSP entries. */
 			for (count = 0; count < sizeof(amd_psp2_fw_table) / sizeof(amd_fw_entry); count ++) {
 				current = integerate_one_psp(rom, current, pspdir, count);
 			}



More information about the coreboot-gerrit mailing list