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
	src/net/netdev_settings.c
	src/net/tcp.c
  • Loading branch information
Jarrod Johnson committed Aug 15, 2013
2 parents f411dce + c692a69 commit dde0935
Show file tree
Hide file tree
Showing 127 changed files with 7,829 additions and 6,159 deletions.
4 changes: 2 additions & 2 deletions src/Makefile
Expand Up @@ -61,7 +61,7 @@ ZLIB_DIR := /usr
SRCDIRS :=
SRCDIRS += libgcc
SRCDIRS += core
SRCDIRS += net net/tcp net/udp net/infiniband net/80211
SRCDIRS += net net/oncrpc net/tcp net/udp net/infiniband net/80211
SRCDIRS += image
SRCDIRS += drivers/bus
SRCDIRS += drivers/net
Expand Down Expand Up @@ -108,7 +108,7 @@ INCDIRS += include .
# helpfully suggestive message
#
ALL := bin/blib.a bin/ipxe.dsk bin/ipxe.lkrn bin/ipxe.iso \
bin/ipxe.usb bin/undionly.kpxe bin/rtl8139.rom
bin/ipxe.usb bin/ipxe.pxe bin/undionly.kpxe bin/rtl8139.rom
all : $(ALL)
@$(ECHO) '==========================================================='
@$(ECHO)
Expand Down
11 changes: 8 additions & 3 deletions src/Makefile.housekeeping
Expand Up @@ -1011,15 +1011,20 @@ $(BIN)/%.nodeps : $(BIN)/%.tmp
# Get licensing verdict for the specified target
#
define licensable_deps_list
$(filter-out config/local/%.h,$(call deps_list,$(1)))
$(filter-out config/local/%.h,\
$(filter-out $(BIN)/.%.list,\
$(call deps_list,$(1))))
endef
define unlicensed_deps_list
$(shell grep -L FILE_LICENCE $(call licensable_deps_list,$(1)))
endef
define licence_list
$(patsubst __licence_%,%,\
$(filter __licence_%,$(shell $(NM) $(1) | cut -d" " -f3)))
$(sort $(foreach LICENCE,\
$(filter __licence__%,$(shell $(NM) $(1) | cut -d" " -f3)),\
$(word 2,$(subst __, ,$(LICENCE)))))
endef
$(BIN)/%.licence_list : $(BIN)/%.tmp
$(Q)$(ECHO) $(call licence_list,$<)
$(BIN)/%.licence : $(BIN)/%.tmp
$(QM)$(ECHO) " [LICENCE] $@"
$(Q)$(if $(strip $(call unlicensed_deps_list,$<)),\
Expand Down
108 changes: 108 additions & 0 deletions src/arch/i386/interface/pcbios/apm.c
@@ -0,0 +1,108 @@
/*
* Copyright (C) 2013 Marin Hannache <ipxe@mareo.fr>.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/

FILE_LICENCE ( GPL2_OR_LATER );

/**
* @file
*
* Advanced Power Management
*
*/

#include <errno.h>
#include <realmode.h>
#include <ipxe/reboot.h>

/**
* Power off the computer using APM
*
* @ret rc Return status code
*/
static int apm_poweroff ( void ) {
uint16_t apm_version;
uint16_t apm_signature;
uint16_t apm_flags;
uint16_t carry;

/* APM check */
__asm__ __volatile__ ( REAL_CODE ( "int $0x15\n\t"
"adc %%edx,0\n\t" )
: "=a" ( apm_version ), "=b" ( apm_signature ),
"=c" ( apm_flags ), "=d" ( carry )
: "a" ( 0x5300 ), "b" ( 0x0000 ),
"d" ( 0x0000 ) );
if ( carry ) {
DBG ( "APM not present\n" );
return -ENOTSUP;
}
if ( apm_signature != 0x504d ) { /* signature 'PM' */
DBG ( "APM not present\n" );
return -ENOTSUP;
}
if ( apm_version < 0x0101 ) { /* Need version 1.1+ */
DBG ( "APM 1.1+ not supported\n" );
return -ENOTSUP;
}
if ( ( apm_flags & 0x8 ) == 0x8 ) {
DBG ( "APM power management disabled\n" );
return -EPERM;
}
DBG2 ( "APM check completed\n" );

/* APM initialisation */
__asm__ __volatile__ ( REAL_CODE ( "int $0x15\n\t"
"adc %%edx,0\n\t" )
: "=d" ( carry )
: "a" ( 0x5301 ), "b" ( 0x0000 ),
"d" ( 0x0000 ) );
if ( carry ) {
DBG ( "APM initialisation failed\n" );
return -EIO;
}
DBG2 ( "APM initialisation completed\n" );

/* Set APM driver version */
__asm__ __volatile__ ( REAL_CODE ( "int $0x15\n\t"
"adc %%edx,0\n\t" )
: "=d" ( carry )
: "a" ( 0x530e ), "b" ( 0x0000 ),
"c" ( 0x0101 ), "d" ( 0x0000 ) );
if ( carry ) {
DBG ( "APM setting driver version failed\n" );
return -EIO;
}
DBG2 ( "APM driver version set\n" );

/* Setting power state to off */
__asm__ __volatile__ ( REAL_CODE ( "int $0x15\n\t"
"adc %%edx,0\n\t" )
: "=d" ( carry )
: "a" ( 0x5307 ), "b" ( 0x0001 ),
"c" ( 0x0003 ), "d" ( 0x0000) );
if ( carry ) {
DBG ( "APM setting power state failed\n" );
return -ENOTTY;
}

/* Should never happen */
return -ECANCELED;
}

PROVIDE_REBOOT ( pcbios, poweroff, apm_poweroff );
9 changes: 4 additions & 5 deletions src/arch/i386/interface/vmware/guestinfo.c
Expand Up @@ -58,7 +58,7 @@ static int guestinfo_fetch_type ( struct settings *settings,
strlen ( parent_name ) + 1 /* "." */ +
strlen ( setting->name ) + 1 /* "." */ +
( type ? strlen ( type->name ) : 0 ) + 1 /* NUL */ ];
struct setting *named_setting;
struct setting *predefined;
char *info;
int info_len;
int check_len;
Expand All @@ -82,9 +82,8 @@ static int guestinfo_fetch_type ( struct settings *settings,

/* Determine default type if necessary */
if ( ! type ) {
named_setting = find_setting ( setting->name );
type = ( named_setting ?
named_setting->type : &setting_type_string );
predefined = find_setting ( setting->name );
type = ( predefined ? predefined->type : &setting_type_string );
}
assert ( type != NULL );

Expand Down Expand Up @@ -115,7 +114,7 @@ static int guestinfo_fetch_type ( struct settings *settings,
settings, &command[9] /* Skip "info-get " */, info );

/* Parse GuestInfo value according to type */
ret = type->parse ( info, data, len );
ret = setting_parse ( type, info, data, len );
if ( ret < 0 ) {
DBGC ( settings, "GuestInfo %p could not parse \"%s\" as %s: "
"%s\n", settings, info, type->name, strerror ( ret ) );
Expand Down
2 changes: 2 additions & 0 deletions src/arch/i386/scripts/i386-kir.lds
Expand Up @@ -98,6 +98,8 @@ SECTIONS {
*(.data)
*(.data.*)
KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */
KEEP(*(.provided))
KEEP(*(.provided.*))
_edata16_progbits = .;
}
.bss16 : AT ( _data16_load_offset + __bss16 ) {
Expand Down
2 changes: 2 additions & 0 deletions src/arch/i386/scripts/i386.lds
Expand Up @@ -109,6 +109,8 @@ SECTIONS {
*(.data)
*(.data.*)
KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */
KEEP(*(.provided))
KEEP(*(.provided.*))
_mtextdata = .;
} .bss.textdata (NOLOAD) : AT ( _end_lma ) {
*(.bss)
Expand Down
2 changes: 2 additions & 0 deletions src/arch/i386/scripts/linux.lds
Expand Up @@ -53,6 +53,8 @@ SECTIONS {
*(.data)
*(.data.*)
KEEP(*(SORT(.tbl.*)))
KEEP(*(.provided))
KEEP(*(.provided.*))
_edata = .;
}

Expand Down
20 changes: 1 addition & 19 deletions src/arch/x86/core/cpuid.c
Expand Up @@ -33,7 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
* @ret is_supported CPUID instruction is supported
*/
static int cpuid_is_supported ( void ) {
int cpuid_is_supported ( void ) {
unsigned long original;
unsigned long inverted;

Expand All @@ -52,24 +52,6 @@ static int cpuid_is_supported ( void ) {
return ( ( original ^ inverted ) & CPUID_FLAG );
}

/**
* Issue CPUID instruction
*
* @v operation CPUID operation
* @v eax Output via %eax
* @v ebx Output via %ebx
* @v ecx Output via %ecx
* @v edx Output via %edx
*/
static inline __attribute__ (( always_inline )) void
cpuid ( uint32_t operation, uint32_t *eax, uint32_t *ebx, uint32_t *ecx,
uint32_t *edx ) {

__asm__ ( "cpuid"
: "=a" ( *eax ), "=b" ( *ebx ), "=c" ( *ecx ), "=d" ( *edx )
: "0" ( operation ) );
}

/**
* Get Intel-defined x86 CPU features
*
Expand Down

0 comments on commit dde0935

Please sign in to comment.