Update gPXE to current git syslinux-3.70-pre28
authorH. Peter Anvin <hpa@zytor.com>
Fri, 27 Jun 2008 22:05:14 +0000 (15:05 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 27 Jun 2008 22:05:14 +0000 (15:05 -0700)
There are some build fixes which may be relevant, so pull in the
latest gPXE git.

gpxe/src/arch/i386/include/bits/endian.h
gpxe/src/arch/i386/include/librm.h
gpxe/src/arch/i386/prefix/romprefix.S
gpxe/src/drivers/net/tg3.c
gpxe/src/hci/commands/image_cmd.c
gpxe/src/image/embedded.c
gpxe/src/image/script.c
gpxe/src/include/compiler.h
gpxe/src/include/gpxe/spi.h
gpxe/src/interface/pxe/pxe_tftp.c

index b23b233..413e702 100644 (file)
@@ -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 */
index 32dceed..31b5097 100644 (file)
@@ -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
index 19e6a9b..1eb87c3 100644 (file)
@@ -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
  *
index ba228d7..5d1bf40 100644 (file)
@@ -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"),
index 23843a7..b651078 100644 (file)
@@ -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 );
        }
 }
 
index 9783313..0ce0978 100644 (file)
@@ -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)
index a24bc09..749131d 100644 (file)
@@ -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;
index 1d4312a..8ab7b8a 100644 (file)
@@ -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
index fe38cb6..8f90e3d 100644 (file)
@@ -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 ) {
index 976298a..f5e7620 100644 (file)
@@ -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 );