summaryrefslogtreecommitdiff
path: root/gpxe
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-06-27 15:05:14 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-06-27 15:05:14 -0700
commit81fe1de46aa4ae26a08ade0caa851beba47e901e (patch)
treecd59c640db4ad42fe29baf0cd397ee6797e05ef7 /gpxe
parent94d0e102ccb4c7bdf63eff16391b14fc547e4780 (diff)
downloadsyslinux-81fe1de46aa4ae26a08ade0caa851beba47e901e.tar.gz
Update gPXE to current gitsyslinux-3.70-pre28
There are some build fixes which may be relevant, so pull in the latest gPXE git.
Diffstat (limited to 'gpxe')
-rw-r--r--gpxe/src/arch/i386/include/bits/endian.h3
-rw-r--r--gpxe/src/arch/i386/include/librm.h17
-rw-r--r--gpxe/src/arch/i386/prefix/romprefix.S16
-rw-r--r--gpxe/src/drivers/net/tg3.c1
-rw-r--r--gpxe/src/hci/commands/image_cmd.c13
-rw-r--r--gpxe/src/image/embedded.c5
-rw-r--r--gpxe/src/image/script.c47
-rw-r--r--gpxe/src/include/compiler.h2
-rw-r--r--gpxe/src/include/gpxe/spi.h9
-rw-r--r--gpxe/src/interface/pxe/pxe_tftp.c2
10 files changed, 72 insertions, 43 deletions
diff --git a/gpxe/src/arch/i386/include/bits/endian.h b/gpxe/src/arch/i386/include/bits/endian.h
index b23b233a..413e702d 100644
--- a/gpxe/src/arch/i386/include/bits/endian.h
+++ b/gpxe/src/arch/i386/include/bits/endian.h
@@ -3,7 +3,4 @@
#define __BYTE_ORDER __LITTLE_ENDIAN
-#define le32_to_cpup(x) (*(uint32_t *)(x))
-#define cpu_to_le16p(x) (*(uint16_t*)(x))
-
#endif /* ETHERBOOT_BITS_ENDIAN_H */
diff --git a/gpxe/src/arch/i386/include/librm.h b/gpxe/src/arch/i386/include/librm.h
index 32dceed6..31b50979 100644
--- a/gpxe/src/arch/i386/include/librm.h
+++ b/gpxe/src/arch/i386/include/librm.h
@@ -211,6 +211,23 @@ strlen_user ( userptr_t buffer, off_t offset ) {
}
/**
+ * Find character in user buffer
+ *
+ * @v buffer User buffer
+ * @v offset Starting offset within buffer
+ * @v c Character to search for
+ * @v len Length of user buffer
+ * @ret offset Offset of character, or <0 if not found
+ */
+static inline __attribute__ (( always_inline )) off_t
+memchr_user ( userptr_t buffer, off_t offset, int c, size_t len ) {
+ void *found;
+
+ found = memchr ( ( ( void * ) buffer + offset ), c, len );
+ return ( found ? ( found - ( void * ) buffer ) : -1 );
+}
+
+/**
* Convert virtual address to user buffer
*
* @v virtual Virtual address
diff --git a/gpxe/src/arch/i386/prefix/romprefix.S b/gpxe/src/arch/i386/prefix/romprefix.S
index 19e6a9b3..1eb87c37 100644
--- a/gpxe/src/arch/i386/prefix/romprefix.S
+++ b/gpxe/src/arch/i386/prefix/romprefix.S
@@ -173,6 +173,8 @@ hook_int19:
call print_message
xorw %ax, %ax
movw %ax, %es
+ pushl %es:( 0x19 * 4 )
+ popl orig_int19
pushw %cs
pushw $int19_entry
popl %es:( 0x19 * 4 )
@@ -345,14 +347,24 @@ bev_entry:
/* INT19 entry point
*
- * Called via the hooked INT 19 if we detected a non-PnP BIOS.
+ * Called via the hooked INT 19 if we detected a non-PnP BIOS. We
+ * attempt to return via the original INT 19 vector (if we were able to
+ * store it).
*/
int19_entry:
pushw %cs
call exec
- /* No real way to return from INT19 */
+ movl %cs:orig_int19, %eax
+ testl %eax, %eax
+ je 1f
+ /* Chain to original INT 19 vector */
+ ljmp *%cs:orig_int19
+1: /* No chained vector: issue INT 18 as a last resort */
int $0x18
.size int19_entry, . - int19_entry
+orig_int19:
+ .long 0
+ .size orig_int19, . - orig_int19
/* Execute as a boot device
*
diff --git a/gpxe/src/drivers/net/tg3.c b/gpxe/src/drivers/net/tg3.c
index ba228d72..5d1bf407 100644
--- a/gpxe/src/drivers/net/tg3.c
+++ b/gpxe/src/drivers/net/tg3.c
@@ -3372,6 +3372,7 @@ PCI_ROM(0x14e4, 0x165e, "tg3-5705M_2", "Broadcom Tigon 3 5705M_2"),
PCI_ROM(0x14e4, 0x1677, "tg3-5751", "Broadcom Tigon 3 5751"),
PCI_ROM(0x14e4, 0x1696, "tg3-5782", "Broadcom Tigon 3 5782"),
PCI_ROM(0x14e4, 0x169c, "tg3-5788", "Broadcom Tigon 3 5788"),
+PCI_ROM(0x14e4, 0x169d, "tg3-5789", "Broadcom Tigon 3 5789"),
PCI_ROM(0x14e4, 0x16a6, "tg3-5702X", "Broadcom Tigon 3 5702X"),
PCI_ROM(0x14e4, 0x16a7, "tg3-5703X", "Broadcom Tigon 3 5703X"),
PCI_ROM(0x14e4, 0x16a8, "tg3-5704S", "Broadcom Tigon 3 5704S"),
diff --git a/gpxe/src/hci/commands/image_cmd.c b/gpxe/src/hci/commands/image_cmd.c
index 23843a7e..b651078b 100644
--- a/gpxe/src/hci/commands/image_cmd.c
+++ b/gpxe/src/hci/commands/image_cmd.c
@@ -55,18 +55,21 @@ static int imgfill_cmdline ( struct image *image, unsigned int nargs,
/* Determine total length of command line */
len = 1; /* NUL */
for ( i = 0 ; i < nargs ; i++ )
- len += ( 1 /* space */ + strlen ( args[i] ) );
+ len += ( 1 /* possible space */ + strlen ( args[i] ) );
{
char buf[len];
char *ptr = buf;
/* Assemble command line */
- for ( i = 0 ; i < nargs ; i++ )
- ptr += sprintf ( ptr, " %s", args[i] );
- assert ( ptr == ( buf + len - 1 ) );
+ buf[0] = '\0';
+ for ( i = 0 ; i < nargs ; i++ ) {
+ ptr += sprintf ( ptr, "%s%s", ( i ? " " : "" ),
+ args[i] );
+ }
+ assert ( ptr < ( buf + len ) );
- return image_set_cmdline ( image, &buf[1] );
+ return image_set_cmdline ( image, buf );
}
}
diff --git a/gpxe/src/image/embedded.c b/gpxe/src/image/embedded.c
index 97833130..0ce09783 100644
--- a/gpxe/src/image/embedded.c
+++ b/gpxe/src/image/embedded.c
@@ -4,7 +4,6 @@
* data structure.
*/
-#include <stdio.h>
#include <gpxe/image.h>
#include <gpxe/malloc.h>
#include <gpxe/uaccess.h>
@@ -25,8 +24,8 @@ struct image *embedded_image(void)
if ( reclaimed )
return NULL; /* Already reclaimed */
- printf("Embedded image: %d bytes at %p\n",
- eisize, _embedded_image_start);
+ DBG ( "Embedded image: %zd bytes at %p\n",
+ eisize, _embedded_image_start );
image = alloc_image();
if (!image)
diff --git a/gpxe/src/image/script.c b/gpxe/src/image/script.c
index a24bc09a..749131d6 100644
--- a/gpxe/src/image/script.c
+++ b/gpxe/src/image/script.c
@@ -37,11 +37,9 @@ struct image_type script_image_type __image_type ( PROBE_NORMAL );
* @ret rc Return status code
*/
static int script_exec ( struct image *image ) {
- char cmdbuf[256];
size_t offset = 0;
- size_t remaining;
+ off_t eol;
size_t len;
- char *eol;
int rc;
/* Temporarily de-register image, so that a "boot" command
@@ -53,36 +51,29 @@ static int script_exec ( struct image *image ) {
while ( offset < image->len ) {
- /* Read up to cmdbuf bytes from script into buffer */
- remaining = ( image->len - offset );
- len = sizeof ( cmdbuf );
- if ( len > remaining )
- len = remaining;
- memset ( cmdbuf, 0, sizeof ( cmdbuf ) );
- copy_from_user ( cmdbuf, image->data, offset, len );
+ /* Find length of next line, excluding any terminating '\n' */
+ eol = memchr_user ( image->data, offset, '\n',
+ ( image->len - offset ) );
+ if ( eol < 0 )
+ eol = image->len;
+ len = ( eol - offset );
- /* Find end of line */
- eol = memchr ( cmdbuf, '\n', sizeof ( cmdbuf ) );
- if ( ! eol )
- eol = memchr ( cmdbuf, '\0', sizeof ( cmdbuf ) );
- if ( ! eol ) {
- DBG ( "Script line too long (max %zd bytes)\n",
- sizeof ( cmdbuf ) );
- rc = -ENOEXEC;
- goto done;
- }
+ /* Copy line, terminate with NUL, and execute command */
+ {
+ char cmdbuf[ len + 1 ];
- /* Mark end of line and execute command */
- *eol = '\0';
- DBG ( "$ %s\n", cmdbuf );
- if ( ( rc = system ( cmdbuf ) ) != 0 ) {
- DBG ( "Command \"%s\" failed: %s\n",
- cmdbuf, strerror ( rc ) );
- goto done;
+ copy_from_user ( cmdbuf, image->data, offset, len );
+ cmdbuf[len] = '\0';
+ DBG ( "$ %s\n", cmdbuf );
+ if ( ( rc = system ( cmdbuf ) ) != 0 ) {
+ DBG ( "Command \"%s\" failed: %s\n",
+ cmdbuf, strerror ( rc ) );
+ goto done;
+ }
}
/* Move to next line */
- offset += ( ( eol - cmdbuf ) + 1 );
+ offset += ( len + 1 );
}
rc = 0;
diff --git a/gpxe/src/include/compiler.h b/gpxe/src/include/compiler.h
index 1d4312a6..8ab7b8ae 100644
--- a/gpxe/src/include/compiler.h
+++ b/gpxe/src/include/compiler.h
@@ -345,7 +345,7 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr,
* @endcode
*
*/
-#define __shared __asm__ ( "_shared_bss" )
+#define __shared __asm__ ( "_shared_bss" ) __aligned
/**
* Optimisation barrier
diff --git a/gpxe/src/include/gpxe/spi.h b/gpxe/src/include/gpxe/spi.h
index fe38cb6b..8f90e3d4 100644
--- a/gpxe/src/include/gpxe/spi.h
+++ b/gpxe/src/include/gpxe/spi.h
@@ -225,6 +225,15 @@ init_at25040 ( struct spi_device *device ) {
init_spi ( device );
}
+/** ST M25P32 serial flash */
+static inline __attribute__ (( always_inline )) void
+init_m25p32 ( struct spi_device *device ) {
+ device->address_len = 24;
+ device->nvs.size = ( 4 * 1024 * 1024 );
+ device->nvs.block_size = 256;
+ init_spi ( device );
+}
+
/** Microchip 25XX640 serial EEPROM */
static inline __attribute__ (( always_inline )) void
init_mc25xx640 ( struct spi_device *device ) {
diff --git a/gpxe/src/interface/pxe/pxe_tftp.c b/gpxe/src/interface/pxe/pxe_tftp.c
index 976298a8..f5e76206 100644
--- a/gpxe/src/interface/pxe/pxe_tftp.c
+++ b/gpxe/src/interface/pxe/pxe_tftp.c
@@ -189,7 +189,7 @@ static int pxe_tftp_open ( uint32_t ipaddress, unsigned int port,
if ( blksize < TFTP_DEFAULT_BLKSIZE )
blksize = TFTP_DEFAULT_BLKSIZE;
snprintf ( uri_string, sizeof ( uri_string ),
- "tftp://%s:%d%s%s?blksize=%d",
+ "tftp://%s:%d%s%s?blksize=%zd",
inet_ntoa ( address ), ntohs ( port ),
( ( filename[0] == '/' ) ? "" : "/" ), filename, blksize );
DBG ( " %s", uri_string );