Skip to content

Commit

Permalink
Merge branch 'master' of https://git.ipxe.org/ipxe
Browse files Browse the repository at this point in the history
Conflicts:
	src/config/general.h
  • Loading branch information
Jarrod Johnson committed Nov 3, 2011
2 parents 36becca + be90241 commit 377a851
Show file tree
Hide file tree
Showing 99 changed files with 44,273 additions and 209 deletions.
4 changes: 3 additions & 1 deletion src/Makefile
Expand Up @@ -68,7 +68,9 @@ SRCDIRS += drivers/net/igb
SRCDIRS += drivers/net/igbvf
SRCDIRS += drivers/net/phantom
SRCDIRS += drivers/net/rtl818x
SRCDIRS += drivers/net/ath5k
SRCDIRS += drivers/net/ath
SRCDIRS += drivers/net/ath/ath5k
SRCDIRS += drivers/net/ath/ath9k
SRCDIRS += drivers/net/vxge
SRCDIRS += drivers/net/efi
SRCDIRS += drivers/block
Expand Down
1 change: 1 addition & 0 deletions src/arch/i386/drivers/net/undinet.c
Expand Up @@ -539,6 +539,7 @@ int undinet_probe ( struct undi_device *undi ) {
&undi_info, sizeof ( undi_info ) ) ) != 0 )
goto err_undi_get_information;
memcpy ( netdev->hw_addr, undi_info.PermNodeAddress, ETH_ALEN );
memcpy ( netdev->ll_addr, undi_info.CurrentNodeAddress, ETH_ALEN );
undinic->irq = undi_info.IntNumber;
if ( undinic->irq > IRQ_MAX ) {
DBGC ( undinic, "UNDINIC %p has invalid IRQ %d\n",
Expand Down
12 changes: 10 additions & 2 deletions src/arch/i386/drivers/net/undionly.c
Expand Up @@ -20,9 +20,11 @@ FILE_LICENCE ( GPL2_OR_LATER );

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ipxe/device.h>
#include <ipxe/init.h>
#include <ipxe/pci.h>
#include <undi.h>
#include <undinet.h>
#include <undipreload.h>
Expand Down Expand Up @@ -62,15 +64,21 @@ static int undibus_probe ( struct root_device *rootdev ) {
}

/* Add to device hierarchy */
strncpy ( undi->dev.name, "UNDI",
( sizeof ( undi->dev.name ) - 1 ) );
undi->dev.driver_name = "undionly";
if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
undi->dev.desc.bus_type = BUS_TYPE_PCI;
undi->dev.desc.location = undi->pci_busdevfn;
undi->dev.desc.vendor = undi->pci_vendor;
undi->dev.desc.device = undi->pci_device;
snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
"UNDI-PCI%02x:%02x.%x",
PCI_BUS ( undi->pci_busdevfn ),
PCI_SLOT ( undi->pci_busdevfn ),
PCI_FUNC ( undi->pci_busdevfn ) );
} else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
undi->dev.desc.bus_type = BUS_TYPE_ISAPNP;
snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
"UNDI-ISAPNP" );
}
undi->dev.parent = &rootdev->dev;
list_add ( &undi->dev.siblings, &rootdev->dev.children);
Expand Down
4 changes: 2 additions & 2 deletions src/arch/i386/interface/syslinux/comboot_call.c
Expand Up @@ -185,7 +185,7 @@ static int comboot_fetch_kernel ( char *kernel_file, char *cmdline ) {

/* Fetch initrd */
if ( ( rc = imgdownload_string ( initrd_file, NULL, NULL,
register_and_put_image ))!=0){
NULL ) ) != 0 ) {
DBG ( "COMBOOT: could not fetch initrd: %s\n",
strerror ( rc ) );
return rc;
Expand All @@ -200,7 +200,7 @@ static int comboot_fetch_kernel ( char *kernel_file, char *cmdline ) {

/* Allocate and fetch kernel */
if ( ( rc = imgdownload_string ( kernel_file, NULL, cmdline,
register_and_replace_image ) ) != 0 ) {
image_replace ) ) != 0 ) {
DBG ( "COMBOOT: could not fetch kernel: %s\n",
strerror ( rc ) );
return rc;
Expand Down
9 changes: 6 additions & 3 deletions src/arch/i386/transitions/liba20.S
Expand Up @@ -96,8 +96,11 @@ test_a20_long:
.section ".text16.early", "awx", @progbits
.code16
enable_a20_bios:
/* Preserve registers */
pushw %ax

/* Preserve registers. Be very paranoid, since some BIOSes
* are reported to clobber %ebx
*/
pushal

/* Attempt INT 15,2401 */
movw $0x2401, %ax
Expand All @@ -108,7 +111,7 @@ enable_a20_bios:
call test_a20_short

99: /* Restore registers and return */
popw %ax
popal
ret
.size enable_a20_bios, . - enable_a20_bios

Expand Down
28 changes: 14 additions & 14 deletions src/arch/i386/transitions/librm.S
Expand Up @@ -97,36 +97,36 @@ init_librm:
pushl %eax
pushl %ebx

/* Store _virt_offset and set up virtual_cs and virtual_ds segments */
/* Store virt_offset and set up virtual_cs and virtual_ds segments */
movl %edi, %eax
movw $virtual_cs, %bx
call set_seg_base
movw $virtual_ds, %bx
call set_seg_base
movl %edi, _virt_offset
movl %edi, rm_virt_offset

/* Negate virt_offset */
negl %edi

/* Store rm_cs and _text16, set up real_cs segment */
/* Store rm_cs and text16, set up real_cs segment */
xorl %eax, %eax
movw %cs, %ax
movw %ax, rm_cs
shll $4, %eax
movw $real_cs, %bx
call set_seg_base
addr32 leal (%eax, %edi), %ebx
movl %ebx, _text16
movl %ebx, rm_text16

/* Store rm_ds and _data16, set up real_ds segment */
/* Store rm_ds and data16, set up real_ds segment */
xorl %eax, %eax
movw %ds, %ax
movw %ax, %cs:rm_ds
shll $4, %eax
movw $real_ds, %bx
call set_seg_base
addr32 leal (%eax, %edi), %ebx
movl %ebx, _data16
movl %ebx, rm_data16

/* Set GDT and IDT base */
movl %eax, gdt_base
Expand Down Expand Up @@ -182,12 +182,12 @@ real_to_prot:
movw %cs:rm_ds, %ax
movw %ax, %ds

/* Add _virt_offset, _text16 and _data16 to stack to be
/* Add virt_offset, text16 and data16 to stack to be
* copied, and also copy the return address.
*/
pushl _virt_offset
pushl _text16
pushl _data16
pushl rm_virt_offset
pushl rm_text16
pushl rm_data16
addw $16, %cx /* %ecx must be less than 64kB anyway */

/* Real-mode %ss:%sp => %ebp:%edx and virtual address => %esi */
Expand All @@ -197,7 +197,7 @@ real_to_prot:
movl %ebp, %eax
shll $4, %eax
addr32 leal (%eax,%edx), %esi
subl _virt_offset, %esi
subl rm_virt_offset, %esi

/* Switch to protected mode */
cli
Expand Down Expand Up @@ -557,9 +557,9 @@ pm_esp: .long _estack
*/
/* Internal copies, created by init_librm (which runs in real mode) */
.section ".data16", "aw", @progbits
_virt_offset: .long 0
_text16: .long 0
_data16: .long 0
rm_virt_offset: .long 0
rm_text16: .long 0
rm_data16: .long 0

/* Externally-visible copies, created by real_to_prot */
.section ".data", "aw", @progbits
Expand Down
2 changes: 2 additions & 0 deletions src/config/defaults/pcbios.h
Expand Up @@ -34,4 +34,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define SANBOOT_PROTO_IB_SRP /* Infiniband SCSI RDMA protocol */
#define SANBOOT_PROTO_FCP /* Fibre Channel protocol */

#define REBOOT_CMD /* Reboot command */

#endif /* CONFIG_DEFAULTS_PCBIOS_H */
30 changes: 30 additions & 0 deletions src/core/assert.c
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2011 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

FILE_LICENCE ( GPL2_OR_LATER );

/** @file
*
* Assertions
*
*/

#include <assert.h>

/** Number of assertion failures triggered */
unsigned int assertion_failures = 0;
55 changes: 55 additions & 0 deletions src/core/exec.c
Expand Up @@ -31,6 +31,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/settings.h>
#include <ipxe/console.h>
#include <ipxe/keys.h>
#include <ipxe/process.h>
#include <ipxe/nap.h>
#include <ipxe/shell.h>

/** @file
Expand Down Expand Up @@ -527,3 +531,54 @@ struct command iseq_command __command = {
.name = "iseq",
.exec = iseq_exec,
};

/** "sleep" options */
struct sleep_options {};

/** "sleep" option list */
static struct option_descriptor sleep_opts[] = {};

/** "sleep" command descriptor */
static struct command_descriptor sleep_cmd =
COMMAND_DESC ( struct sleep_options, sleep_opts, 1, 1, "<seconds>" );

/**
* "sleep" command
*
* @v argc Argument count
* @v argv Argument list
* @ret rc Return status code
*/
static int sleep_exec ( int argc, char **argv ) {
struct sleep_options opts;
unsigned int seconds;
unsigned long start;
unsigned long delay;
int rc;

/* Parse options */
if ( ( rc = parse_options ( argc, argv, &sleep_cmd, &opts ) ) != 0 )
return rc;

/* Parse number of seconds */
if ( ( rc = parse_integer ( argv[optind], &seconds ) ) != 0 )
return rc;

/* Delay for specified number of seconds */
start = currticks();
delay = ( seconds * TICKS_PER_SEC );
while ( ( currticks() - start ) <= delay ) {
step();
if ( iskey() && ( getchar() == CTRL_C ) )
return -ECANCELED;
cpu_nap();
}

return 0;
}

/** "sleep" command */
struct command sleep_command __command = {
.name = "sleep",
.exec = sleep_exec,
};
5 changes: 5 additions & 0 deletions src/core/getopt.c
Expand Up @@ -239,6 +239,11 @@ int getopt_long ( int argc, char * const argv[], const char *optstring,

/* Check for long options */
if ( *(opttext++) == '-' ) {
/* "--" indicates end of options */
if ( *opttext == '\0' ) {
optind++;
return -1;
}
for ( longopt = longopts ; longopt->name ; longopt++ ) {
if ( ! match_long_option ( argc, argv, opttext,
longopt, &option ) )
Expand Down
8 changes: 6 additions & 2 deletions src/core/image.c
Expand Up @@ -224,8 +224,8 @@ int image_exec ( struct image *image ) {
/* Sanity check */
assert ( image->flags & IMAGE_REGISTERED );

/* Check that this image can be executed */
if ( ( rc = image_probe ( image ) ) != 0 )
/* Check that this image can be selected for execution */
if ( ( rc = image_select ( image ) ) != 0 )
return rc;

/* Switch current working directory to be that of the image itself */
Expand Down Expand Up @@ -302,6 +302,10 @@ int image_replace ( struct image *replacement ) {
return rc;
}

/* Check that the replacement image can be executed */
if ( ( rc = image_probe ( replacement ) ) != 0 )
return rc;

/* Clear any existing replacement */
image_put ( image->replacement );

Expand Down

0 comments on commit 377a851

Please sign in to comment.