Shawn Anastasio has uploaded this change for review. ( https://review.coreboot.org/23050
Change subject: buspirate_spi: Add support for variable serial speeds
......................................................................
buspirate_spi: Add support for variable serial speeds
This patch introduces the ability to set the baud rate for communication
between the host device and the Bus Pirate via the added 'serialspeed'
programmer parameter.
This is done in two parts. Firstly, the requested serial speed is looked up
in a table to determine the appropriate clock divisor and the divisor is sent
to the bus pirate. Then, the system's baud rate for the selected serial port
is set using serial.c's 'serialport_config'. This function's prototype had to
be added to programmer.h.
In testing, using the 2M baud rate was able to significantly decrease
flash times (down from 20+ minutes to less than 2 minutes for an 8MB flash).
Change-Id: I3706f17a94fdf056063f2ad4a5f0a219665cdcbf
Signed-off-by: Shawn Anastasio <shawnanastasio(a)yahoo.com>
---
M buspirate_spi.c
M programmer.h
2 files changed, 91 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/50/23050/1
diff --git a/buspirate_spi.c b/buspirate_spi.c
index b6554ac..aa71dfe 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -35,6 +35,12 @@
const int speed;
};
+struct buspirate_serialspeeds {
+ const char *name;
+ const int speed;
+ const int divisor;
+};
+
#ifndef FAKE_COMMUNICATION
static int buspirate_serialport_setup(char *dev)
{
@@ -154,7 +160,20 @@
{"2.6M", 0x5},
{"4M", 0x6},
{"8M", 0x7},
- {NULL, 0x0},
+ {NULL, 0x0}
+};
+
+static const struct buspirate_serialspeeds serialspeeds[] = {
+ {"9600", 9600, 415},
+ {"19200", 19200, 207},
+ {"38400", 38400, 103},
+ {"57600", 57600, 68},
+ /* 115200 is not included because it is the default setting */
+ {"230400", 230400, 16},
+ {"250000", 250000, 15},
+ {"2000000", 2000000, 1},
+ {"2M", 2000000, 1},
+ {NULL, 0, 0}
};
static int buspirate_spi_shutdown(void *data)
@@ -179,6 +198,8 @@
/* Reset Bus Pirate (return to user terminal) */
bp_commbuf[0] = 0x0f;
ret = buspirate_sendrecv(bp_commbuf, 1, 0);
+ if ((ret = serialport_config(sp_fd, 115200)))
+ goto out_shutdown;
out_shutdown:
/* Shut down serial port communication */
@@ -204,9 +225,11 @@
char *tmp;
char *dev;
int i;
+ int cnt;
unsigned int fw_version_major = 0;
unsigned int fw_version_minor = 0;
int spispeed = 0x7;
+ int serialspeed_index = -1;
int ret = 0;
int pullup = 0;
@@ -222,7 +245,7 @@
tmp = extract_programmer_param("spispeed");
if (tmp) {
- for (i = 0; spispeeds[i].name; i++) {
+ for (i = 0; spispeeds[i].name ; i++) {
if (!strncasecmp(spispeeds[i].name, tmp, strlen(spispeeds[i].name))) {
spispeed = spispeeds[i].speed;
break;
@@ -233,6 +256,21 @@
}
free(tmp);
+ /* Extract serialspeed paramater and ignore requests for the default 115200 baud speed */
+ tmp = extract_programmer_param("serialspeed");
+ if (tmp && strncmp("115200", tmp, 6)) {
+ /* Ignore requests for 115200 baud as it is already the default */
+ for (i = 0; serialspeeds[i].name; i++) {
+ if (!strncasecmp(serialspeeds[i].name, tmp, strlen(serialspeeds[i].name))) {
+ serialspeed_index = i;
+ break;
+ }
+ }
+ if (!serialspeeds[i].name)
+ msg_perr("Invalid serial speed %s, using default.\n", tmp);
+ }
+ free(tmp);
+
tmp = extract_programmer_param("pullups");
if (tmp) {
if (strcasecmp("on", tmp) == 0)
@@ -341,7 +379,7 @@
if ((ret = buspirate_wait_for_string(bp_commbuf, "HiZ>")))
return ret;
-
+
/* Tell the user about missing SPI binary mode in firmware 2.3 and older. */
if (BP_FWVERSION(fw_version_major, fw_version_minor) < BP_FWVERSION(2, 4)) {
msg_pinfo("Bus Pirate firmware 2.3 and older does not support binary SPI access.\n");
@@ -351,7 +389,7 @@
/* Use fast SPI mode in firmware 5.5 and newer. */
if (BP_FWVERSION(fw_version_major, fw_version_minor) >= BP_FWVERSION(5, 5)) {
- msg_pdbg("Using SPI command set v2.\n");
+ msg_pdbg("Using SPI command set v2.\n");
/* Sensible default buffer size. */
if (buspirate_commbuf_grow(260 + 5))
return ERROR_OOM;
@@ -378,10 +416,54 @@
msg_pinfo("It is recommended to upgrade to firmware 6.2 or newer.\n");
spispeed = 0x4;
}
-
+
/* This works because speeds numbering starts at 0 and is contiguous. */
msg_pdbg("SPI speed is %sHz\n", spispeeds[spispeed].name);
+ /* Set custom serial speed if specified */
+ if (serialspeed_index != -1) {
+ /* This feature requires firmware 5.5 or newer */
+ if (BP_FWVERSION(fw_version_major, fw_version_minor) < BP_FWVERSION(5, 5)) {
+ msg_perr("Bus Pirate firmware 5.4 and older does not support custom serial speeds."
+ "Using default speed of 115200 baud.\n");
+ } else {
+ /* Enter baud rate configuration mode */
+ cnt = snprintf((char *)bp_commbuf, DEFAULT_BUFSIZE, "b\n");
+ if ((ret = buspirate_sendrecv(bp_commbuf, cnt, 0)))
+ return ret;
+ if ((ret = buspirate_wait_for_string(bp_commbuf, ">")))
+ return ret;
+
+ /* Enter manual clock divisor entry mode */
+ cnt = snprintf((char *)bp_commbuf, DEFAULT_BUFSIZE, "10\n");
+ if ((ret = buspirate_sendrecv(bp_commbuf, cnt, 0)))
+ return ret;
+ if ((ret=buspirate_wait_for_string(bp_commbuf, ">")))
+ return ret;
+
+ /* Set the clock divisor to the value calculated from the user's input */
+ cnt = snprintf((char *)bp_commbuf, DEFAULT_BUFSIZE, "%d\n", serialspeeds[serialspeed_index].divisor);
+ if ((ret = buspirate_sendrecv(bp_commbuf, cnt, 0)))
+ return ret;
+ sleep(1);
+
+ /* Reconfigure the host's serial baud rate to the new value */
+ if ((ret = serialport_config(sp_fd, serialspeeds[serialspeed_index].speed))) {
+ msg_perr("Unable to configure system baud rate to specified value.");
+ return ret;
+ }
+
+ /* Return to the main prompt */
+ bp_commbuf[0] = ' ';
+ if ((ret = buspirate_sendrecv(bp_commbuf, 1, 0)))
+ return ret;
+ if ((ret = buspirate_wait_for_string(bp_commbuf, "HiZ>")))
+ return ret;
+
+ msg_pdbg("Serial speed is %d baud\n", serialspeeds[serialspeed_index].speed);
+ }
+ }
+
/* Enter raw bitbang mode */
for (i = 0; i < 20; i++) {
bp_commbuf[0] = 0x00;
@@ -433,7 +515,7 @@
msg_perr("Protocol error while setting SPI speed!\n");
return 1;
}
-
+
/* Set SPI config: output type, idle, clock edge, sample */
bp_commbuf[0] = 0x80 | 0xa;
ret = buspirate_sendrecv(bp_commbuf, 1, 1);
@@ -533,7 +615,7 @@
bp_commbuf[i++] = (readcnt >> 8) & 0xff;
bp_commbuf[i++] = readcnt & 0xff;
memcpy(bp_commbuf + i, writearr, writecnt);
-
+
ret = buspirate_sendrecv(bp_commbuf, i + writecnt, 1 + readcnt);
if (ret) {
@@ -550,4 +632,4 @@
memcpy(readarr, bp_commbuf + 1, readcnt);
return ret;
-}
+}
\ No newline at end of file
diff --git a/programmer.h b/programmer.h
index a98b713..bed799d 100644
--- a/programmer.h
+++ b/programmer.h
@@ -754,6 +754,7 @@
void sp_flush_incoming(void);
fdtype sp_openserport(char *dev, int baud);
extern fdtype sp_fd;
+int serialport_config(fdtype fd, int baud);
int serialport_shutdown(void *data);
int serialport_write(const unsigned char *buf, unsigned int writecnt);
int serialport_write_nonblock(const unsigned char *buf, unsigned int writecnt, unsigned int timeout, unsigned int *really_wrote);
--
To view, visit https://review.coreboot.org/23050
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: staging
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3706f17a94fdf056063f2ad4a5f0a219665cdcbf
Gerrit-Change-Number: 23050
Gerrit-PatchSet: 1
Gerrit-Owner: Shawn Anastasio <shawnanastasio(a)yahoo.com>
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23044 )
Change subject: Fix the documentation and DOS port
......................................................................
Patch Set 2:
Build Successful
https://qa.coreboot.org/job/flashrom-customrules/984/ : SUCCESS
--
To view, visit https://review.coreboot.org/23044
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Gerrit-Change-Number: 23044
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Rudolf Marek <r.marek(a)assembler.cz>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sat, 30 Dec 2017 12:21:32 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No
Nico Huber has submitted this change and it was merged. ( https://review.coreboot.org/23044 )
Change subject: Fix the documentation and DOS port
......................................................................
Fix the documentation and DOS port
Update the DOS cross-compile documentation,
and workaround issue with valloc() with the
latest DJGPP.
Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Signed-off-by: Rudolf Marek <r.marek(a)assembler.cz>
Reviewed-on: https://review.coreboot.org/23044
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
---
M README
M physmap.c
2 files changed, 53 insertions(+), 26 deletions(-)
Approvals:
build bot (Jenkins): Verified
Nico Huber: Looks good to me, approved
diff --git a/README b/README
index 449103d..b5ed946 100644
--- a/README
+++ b/README
@@ -97,27 +97,43 @@
Get packages of the DJGPP cross compiler and install them:
djgpp-filesystem djgpp-gcc djgpp-cpp djgpp-runtime djgpp-binutils
As an alternative, the DJGPP web site offers packages for download as well:
- djcross-binutils-2.19.1-10ap.i386.rpm
- djcross-gcc-4.3.2-8ap.i686.rpm
- djcrx-2.04pre_20090725-13ap.i386.rpm
+ djcross-binutils-2.29.1-1ap.x86_64.rpm
+ djcross-gcc-7.2.0-1ap.x86_64.rpm
+ djcrx-2.05-5.x86_64.rpm
The cross toolchain packages for your distribution may have slightly different
names (look for packages named *djgpp*).
- You will need the following library source trees containing their compiled
- static libraries either in the parent directory of the flashrom source or
- specify the base folder on compile time with the LIBS_BASE parameter.
- The default as described above is equal to calling
- 'make djgpp-dos LIBS_BASE=..'
+ Alternatively, you could use a script to build it from scratch:
+ https://github.com/andrewwutw/build-djgpp
- To get and build said libraries...
- Download pciutils 3.1.5 and apply http://flashrom.org/File:Pciutils.patch.gz
- Compile pciutils, see README.DJGPP for instructions.
- Download and compile http://flashrom.org/File:Libgetopt.tar.gz
+ You will need the libpci and libgetopt library source trees and
+ their compiled static libraries and header files installed in some
+ directory say libpci-libgetopt/, which will be later specified with
+ LIBS_BASE parameter during flashrom compilation. Easiest way to
+ handle it is to put pciutils, libgetopt and flashrom directories
+ in one subdirectory. There will be an extra subdirectory libpci-libgetopt
+ created, which will contain compiled libpci and libgetopt.
+
+ Download pciutils 3.5.6 and apply http://flashrom.org/File:Pciutils-3.5.6.patch.gz
+ Compile pciutils, using following command line:
+
+ make ZLIB=no DNS=no HOST=i386-djgpp-djgpp CROSS_COMPILE=i586-pc-msdosdjgpp- \
+ PREFIX=/ DESTDIR=$PWD/../libpci-libgetopt \
+ STRIP="--strip-program=i586-pc-msdosdjgpp-strip -s" install install-lib
+
+ Download and compile with 'make' http://flashrom.org/File:Libgetopt.tar.gz
+
+ Copy the libgetopt.a to ../libpci-libgetopt/lib and
+ getopt.h to ../libpci-libgetopt/include
+
Enter the flashrom directory.
- Run either (change settings where appropriate)
- make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip
- or (above settings hardcoded)
- make djgpp-dos
+
+ make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip LIBS_BASE=../libpci-libgetopt/ strip
+
+ If you like, you can compress the resulting executable with UPX:
+
+ upx -9 flashrom.exe
+
To run flashrom.exe, download http://flashrom.org/File:Csdpmi7b.zip and
unpack CWSDPMI.EXE into the current directory or one in PATH.
diff --git a/physmap.c b/physmap.c
index a261ccd..3338b62 100644
--- a/physmap.c
+++ b/physmap.c
@@ -38,29 +38,40 @@
#ifdef __DJGPP__
#include <dpmi.h>
+#include <malloc.h>
#include <sys/nearptr.h>
+#define ONE_MEGABYTE (1024 * 1024)
#define MEM_DEV "dpmi"
-static void *realmem_map;
+static void *realmem_map_aligned;
static void *map_first_meg(uintptr_t phys_addr, size_t len)
{
- if (realmem_map)
- return realmem_map + phys_addr;
+ void *realmem_map;
+ size_t pagesize;
- realmem_map = valloc(1024 * 1024);
+ if (realmem_map_aligned)
+ return realmem_map_aligned + phys_addr;
+
+ /* valloc() from DJGPP 2.05 does not work properly */
+ pagesize = getpagesize();
+
+ realmem_map = malloc(ONE_MEGABYTE + pagesize);
if (!realmem_map)
return ERROR_PTR;
- if (__djgpp_map_physical_memory(realmem_map, (1024 * 1024), 0)) {
+ realmem_map_aligned = (void *)(((size_t) realmem_map +
+ (pagesize - 1)) & ~(pagesize - 1));
+
+ if (__djgpp_map_physical_memory(realmem_map_aligned, ONE_MEGABYTE, 0)) {
free(realmem_map);
- realmem_map = NULL;
+ realmem_map_aligned = NULL;
return ERROR_PTR;
}
- return realmem_map + phys_addr;
+ return realmem_map_aligned + phys_addr;
}
static void *sys_physmap(uintptr_t phys_addr, size_t len)
@@ -72,7 +83,7 @@
if (!__djgpp_nearptr_enable())
return ERROR_PTR;
- if ((phys_addr + len - 1) < (1024 * 1024)) {
+ if ((phys_addr + len - 1) < ONE_MEGABYTE) {
/* We need to use another method to map first 1MB. */
return map_first_meg(phys_addr, len);
}
@@ -97,8 +108,8 @@
/* There is no known way to unmap the first 1 MB. The DPMI server will
* do this for us on exit.
*/
- if ((virt_addr >= realmem_map) &&
- ((virt_addr + len) <= (realmem_map + (1024 * 1024)))) {
+ if ((virt_addr >= realmem_map_aligned) &&
+ ((virt_addr + len) <= (realmem_map_aligned + ONE_MEGABYTE))) {
return;
}
--
To view, visit https://review.coreboot.org/23044
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-MessageType: merged
Gerrit-Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Gerrit-Change-Number: 23044
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Rudolf Marek <r.marek(a)assembler.cz>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Nico Huber has posted comments on this change. ( https://review.coreboot.org/23044 )
Change subject: Fix the documentation and DOS port
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/23044
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Gerrit-Change-Number: 23044
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Rudolf Marek <r.marek(a)assembler.cz>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sat, 30 Dec 2017 12:21:16 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23044 )
Change subject: Fix the documentation and DOS port
......................................................................
Patch Set 1: Verified+1
Build Successful
https://qa.coreboot.org/job/flashrom-customrules/983/ : SUCCESS
https://qa.coreboot.org/job/flashrom_gerrit/843/ : SUCCESS
--
To view, visit https://review.coreboot.org/23044
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Gerrit-Change-Number: 23044
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Rudolf Marek <r.marek(a)assembler.cz>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sat, 30 Dec 2017 12:18:45 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
Hello Rudolf Marek,
I'd like you to do a code review. Please visit
https://review.coreboot.org/23044
to review the following change.
Change subject: Fix the documentation and DOS port
......................................................................
Fix the documentation and DOS port
Update the DOS cross-compile documentation,
and workaround issue with valloc() with the
latest DJGPP.
Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Signed-off-by: Rudolf Marek <r.marek(a)assembler.cz>
---
M README
M physmap.c
2 files changed, 53 insertions(+), 26 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/44/23044/1
diff --git a/README b/README
index 449103d..b5ed946 100644
--- a/README
+++ b/README
@@ -97,27 +97,43 @@
Get packages of the DJGPP cross compiler and install them:
djgpp-filesystem djgpp-gcc djgpp-cpp djgpp-runtime djgpp-binutils
As an alternative, the DJGPP web site offers packages for download as well:
- djcross-binutils-2.19.1-10ap.i386.rpm
- djcross-gcc-4.3.2-8ap.i686.rpm
- djcrx-2.04pre_20090725-13ap.i386.rpm
+ djcross-binutils-2.29.1-1ap.x86_64.rpm
+ djcross-gcc-7.2.0-1ap.x86_64.rpm
+ djcrx-2.05-5.x86_64.rpm
The cross toolchain packages for your distribution may have slightly different
names (look for packages named *djgpp*).
- You will need the following library source trees containing their compiled
- static libraries either in the parent directory of the flashrom source or
- specify the base folder on compile time with the LIBS_BASE parameter.
- The default as described above is equal to calling
- 'make djgpp-dos LIBS_BASE=..'
+ Alternatively, you could use a script to build it from scratch:
+ https://github.com/andrewwutw/build-djgpp
- To get and build said libraries...
- Download pciutils 3.1.5 and apply http://flashrom.org/File:Pciutils.patch.gz
- Compile pciutils, see README.DJGPP for instructions.
- Download and compile http://flashrom.org/File:Libgetopt.tar.gz
+ You will need the libpci and libgetopt library source trees and
+ their compiled static libraries and header files installed in some
+ directory say libpci-libgetopt/, which will be later specified with
+ LIBS_BASE parameter during flashrom compilation. Easiest way to
+ handle it is to put pciutils, libgetopt and flashrom directories
+ in one subdirectory. There will be an extra subdirectory libpci-libgetopt
+ created, which will contain compiled libpci and libgetopt.
+
+ Download pciutils 3.5.6 and apply http://flashrom.org/File:Pciutils-3.5.6.patch.gz
+ Compile pciutils, using following command line:
+
+ make ZLIB=no DNS=no HOST=i386-djgpp-djgpp CROSS_COMPILE=i586-pc-msdosdjgpp- \
+ PREFIX=/ DESTDIR=$PWD/../libpci-libgetopt \
+ STRIP="--strip-program=i586-pc-msdosdjgpp-strip -s" install install-lib
+
+ Download and compile with 'make' http://flashrom.org/File:Libgetopt.tar.gz
+
+ Copy the libgetopt.a to ../libpci-libgetopt/lib and
+ getopt.h to ../libpci-libgetopt/include
+
Enter the flashrom directory.
- Run either (change settings where appropriate)
- make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip
- or (above settings hardcoded)
- make djgpp-dos
+
+ make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip LIBS_BASE=../libpci-libgetopt/ strip
+
+ If you like, you can compress the resulting executable with UPX:
+
+ upx -9 flashrom.exe
+
To run flashrom.exe, download http://flashrom.org/File:Csdpmi7b.zip and
unpack CWSDPMI.EXE into the current directory or one in PATH.
diff --git a/physmap.c b/physmap.c
index a261ccd..3338b62 100644
--- a/physmap.c
+++ b/physmap.c
@@ -38,29 +38,40 @@
#ifdef __DJGPP__
#include <dpmi.h>
+#include <malloc.h>
#include <sys/nearptr.h>
+#define ONE_MEGABYTE (1024 * 1024)
#define MEM_DEV "dpmi"
-static void *realmem_map;
+static void *realmem_map_aligned;
static void *map_first_meg(uintptr_t phys_addr, size_t len)
{
- if (realmem_map)
- return realmem_map + phys_addr;
+ void *realmem_map;
+ size_t pagesize;
- realmem_map = valloc(1024 * 1024);
+ if (realmem_map_aligned)
+ return realmem_map_aligned + phys_addr;
+
+ /* valloc() from DJGPP 2.05 does not work properly */
+ pagesize = getpagesize();
+
+ realmem_map = malloc(ONE_MEGABYTE + pagesize);
if (!realmem_map)
return ERROR_PTR;
- if (__djgpp_map_physical_memory(realmem_map, (1024 * 1024), 0)) {
+ realmem_map_aligned = (void *)(((size_t) realmem_map +
+ (pagesize - 1)) & ~(pagesize - 1));
+
+ if (__djgpp_map_physical_memory(realmem_map_aligned, ONE_MEGABYTE, 0)) {
free(realmem_map);
- realmem_map = NULL;
+ realmem_map_aligned = NULL;
return ERROR_PTR;
}
- return realmem_map + phys_addr;
+ return realmem_map_aligned + phys_addr;
}
static void *sys_physmap(uintptr_t phys_addr, size_t len)
@@ -72,7 +83,7 @@
if (!__djgpp_nearptr_enable())
return ERROR_PTR;
- if ((phys_addr + len - 1) < (1024 * 1024)) {
+ if ((phys_addr + len - 1) < ONE_MEGABYTE) {
/* We need to use another method to map first 1MB. */
return map_first_meg(phys_addr, len);
}
@@ -97,8 +108,8 @@
/* There is no known way to unmap the first 1 MB. The DPMI server will
* do this for us on exit.
*/
- if ((virt_addr >= realmem_map) &&
- ((virt_addr + len) <= (realmem_map + (1024 * 1024)))) {
+ if ((virt_addr >= realmem_map_aligned) &&
+ ((virt_addr + len) <= (realmem_map_aligned + ONE_MEGABYTE))) {
return;
}
--
To view, visit https://review.coreboot.org/23044
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-MessageType: newchange
Gerrit-Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Gerrit-Change-Number: 23044
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Rudolf Marek <r.marek(a)assembler.cz>
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23039 )
Change subject: Fix the documentation and DOS port
......................................................................
Patch Set 3: Verified+1
Build Successful
https://qa.coreboot.org/job/flashrom-customrules/982/ : SUCCESS
https://qa.coreboot.org/job/flashrom_gerrit/842/ : SUCCESS
--
To view, visit https://review.coreboot.org/23039
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Gerrit-Change-Number: 23039
Gerrit-PatchSet: 3
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Rudolf Marek <r.marek(a)assembler.cz>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sat, 30 Dec 2017 12:02:30 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
Hello Rudolf Marek, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/23039
to look at the new patch set (#3).
Change subject: Fix the documentation and DOS port
......................................................................
Fix the documentation and DOS port
Update the DOS cross-compile documentation,
and workaround issue with valloc() with the
latest DJGPP.
Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Signed-off-by: Rudolf Marek <r.marek(a)assembler.cz>
---
M README
M physmap.c
2 files changed, 54 insertions(+), 26 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/39/23039/3
--
To view, visit https://review.coreboot.org/23039
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Gerrit-Change-Number: 23039
Gerrit-PatchSet: 3
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Rudolf Marek <r.marek(a)assembler.cz>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23039 )
Change subject: Fix the documentation and DOS port
......................................................................
Patch Set 2:
Build Successful
https://qa.coreboot.org/job/flashrom-customrules/981/ : SUCCESS
https://qa.coreboot.org/job/flashrom_gerrit/841/ : SUCCESS
--
To view, visit https://review.coreboot.org/23039
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I909c5635aec5076440d2fde73d943f8ad10b8051
Gerrit-Change-Number: 23039
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Rudolf Marek <r.marek(a)assembler.cz>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sat, 30 Dec 2017 12:02:00 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No