Using flashrom-trunk on PCEngines' ALIX2D13 board running 
OpenBSD-5.3 (current) doesn't work.

The chipset is AMD Geode CS5536.

Here the steps:

 1. Applied patch amdmsr.patch to openbsd kernel 
(/usr/src/sys/arch/i386/i386/amdmsr.c)
Explaination: the original code checks for GPU presence (alix has no GPU) and 
fails; I
just skip the check. 

 2. got last flashrom version (trunk)

 3. applied given patch http://patchwork.coreboot.org/patch/3932/ 
 4. applied given patch http://patchwork.coreboot.org/patch/3933/

 5. applied patch hwaccess.patch
Explaination: openbsd uses a different way to retrieve IO Priviledge Level, see 
i386_iopl(2) man page.

 6. applied patch physmap.patch 
Explaination: minor code mismatches fixed and /dev/amdmsr0 changed to 
/dev/amdmsr.

The 3 patches are attached.

I confirm running "./flashrom -p internal -r bios.bin" extracts the same bios 
image
got from flashrom run on linux. (md5 checks)

Thank You.

Leonardo.
--- amdmsr.c    2013-04-10 19:18:05.038996550 +0200
+++ amdmsr-fix.c        2013-04-10 19:22:13.508890253 +0200
@@ -77,8 +77,8 @@
                /* Check for graphics processor presence */
                gld_msr_cap = rdmsr(GLX_CPU_GLD_MSR_CAP);
                if (((gld_msr_cap >> 8) & 0x0fff) == GLX_CPU_DID) {
-                       gld_msr_cap = rdmsr(GLX_GP_GLD_MSR_CAP);
-                       if (((gld_msr_cap >> 8) & 0x0fff) == GLX_GP_DID)
+                       //gld_msr_cap = rdmsr(GLX_GP_GLD_MSR_CAP);
+                       //if (((gld_msr_cap >> 8) & 0x0fff) == GLX_GP_DID)
                                return 1;
                }
        }
--- ../hwaccess.c       Wed Apr 10 20:11:35 2013
+++ hwaccess-fix.c      Wed Apr 10 20:10:45 2013
@@ -86,6 +86,8 @@
 #if IS_X86 && !(defined(__DJGPP__) || defined(__LIBPAYLOAD__))
 #if defined (__sun)
        if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) {
+#elif defined (__OpenBSD__)
+       if (i386_iopl(3) == -1)  {
 #elif IS_BSD
        if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
 #elif IS_LINUX || IS_MACOSX
--- ../physmap.c        Wed Apr 10 19:58:38 2013
+++ physmap-fix.c       Wed Apr 10 20:15:50 2013
@@ -388,11 +388,16 @@
 #include <sys/ioctl.h>
 #include <machine/amdmsr.h>
 
+typedef struct {
+       int msr;
+       uint64_t data;
+} cpu_msr_args_t;
+
 static int fd_msr = -1;
 
 msr_t rdmsr(int addr)
 {
-       amdmsr_req args;
+       struct amdmsr_req args;
 
        msr_t msr = { 0xffffffff, 0xffffffff };
 
@@ -415,7 +420,7 @@
        cpu_msr_args_t args;
 
        args.msr = addr;
-       args.val = (((uint64_t)msr.hi) << 32) | msr.lo;
+       args.data = (((uint64_t)msr.hi) << 32) | msr.lo;
 
        if (ioctl(fd_msr, WRMSR, &args) < 0) {
                msg_perr("Error while executing WRMSR ioctl: %s\n", 
strerror(errno));
@@ -430,7 +435,7 @@
 {
        char msrfilename[64];
        memset(msrfilename, 0, sizeof(msrfilename));
-       snprintf(msrfilename, sizeof(msrfilename), "/dev/amdmsr%d", cpu);
+       snprintf(msrfilename, sizeof(msrfilename), "/dev/amdmsr");
 
        if (fd_msr != -1) {
                msg_pinfo("MSR was already initialized\n");
_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to