Skip to content

Commit

Permalink
Merge branch 'master' into vm3
Browse files Browse the repository at this point in the history
  • Loading branch information
mcb30 committed May 12, 2016
2 parents ff81c1d + 6017066 commit 25e703c
Show file tree
Hide file tree
Showing 469 changed files with 28,161 additions and 4,016 deletions.
15 changes: 12 additions & 3 deletions src/Makefile
Expand Up @@ -9,6 +9,7 @@ ASFLAGS :=
LDFLAGS :=
HOST_CFLAGS :=
MAKEDEPS := Makefile
CROSS_COMPILE ?= $(CROSS)

###############################################################################
#
Expand Down Expand Up @@ -52,9 +53,6 @@ EINFO := ./util/einfo
GENKEYMAP := ./util/genkeymap.pl
DOXYGEN := doxygen
LCAB := lcab
BINUTILS_DIR := /usr
BFD_DIR := $(BINUTILS_DIR)
ZLIB_DIR := /usr

###############################################################################
#
Expand Down Expand Up @@ -83,6 +81,14 @@ SRCDIRS += drivers/block
SRCDIRS += drivers/nvs
SRCDIRS += drivers/bitbash
SRCDIRS += drivers/infiniband
SRCDIRS += drivers/infiniband/mlx_utils_flexboot/src
SRCDIRS += drivers/infiniband/mlx_utils/src/public
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_reg_access
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_nvconfig
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_vmac
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_blink_leds
SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_link_speed
SRCDIRS += drivers/infiniband/mlx_nodnic/src
SRCDIRS += drivers/usb
SRCDIRS += interface/pxe interface/efi interface/smbios
SRCDIRS += interface/bofm
Expand Down Expand Up @@ -151,6 +157,9 @@ all : $(ALL)
everything :
$(Q)$(MAKE) --no-print-directory $(ALL) \
bin/3c509.rom bin/intel.rom bin/intel.mrom \
bin-x86_64-pcbios/8086100e.mrom bin-x86_64-pcbios/intel.rom \
bin-x86_64-pcbios/ipxe.usb bin-x86_64-pcbios/ipxe.pxe \
bin-x86_64-pcbios/undionly.kpxe \
bin-i386-efi/ipxe.efi bin-i386-efi/ipxe.efidrv \
bin-i386-efi/ipxe.efirom \
bin-x86_64-efi/ipxe.efi bin-x86_64-efi/ipxe.efidrv \
Expand Down
46 changes: 46 additions & 0 deletions src/Makefile.efi
@@ -0,0 +1,46 @@
# -*- makefile -*- : Force emacs to use Makefile mode

# The EFI linker script
#
LDSCRIPT = scripts/efi.lds

# Retain relocation information for elf2efi
#
LDFLAGS += -q -S

# Media types.
#
NON_AUTO_MEDIA += efi
NON_AUTO_MEDIA += efidrv
NON_AUTO_MEDIA += drv.efi
NON_AUTO_MEDIA += efirom

# Include SNP driver in the all-drivers build
#
DRIVERS_net += snp

# Rules for building EFI files
#
$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)
$(QM)$(ECHO) " [FINISH] $@"
$(Q)$(ELF2EFI) --subsystem=10 $< $@

$(BIN)/%.efidrv : $(BIN)/%.efidrv.tmp $(ELF2EFI)
$(QM)$(ECHO) " [FINISH] $@"
$(Q)$(ELF2EFI) --subsystem=11 $< $@

$(BIN)/%.drv.efi : $(BIN)/%.efidrv
$(QM)$(ECHO) " [FINISH] $@"
$(Q)$(CP) $< $@

$(BIN)/%.efirom : $(BIN)/%.efidrv $(EFIROM)
$(QM)$(ECHO) " [FINISH] $@"
$(Q)$(EFIROM) -v $(TGT_PCI_VENDOR) -d $(TGT_PCI_DEVICE) $< $@

$(BIN)/efidrv.cab : $(BIN)/alldrv.efis # $(ALL_drv.efi) is not yet defined
$(QM)$(ECHO) " [CAB] $@"
$(Q)$(LCAB) -n -q $(ALL_drv.efi) $@

$(BIN)/%.usb : $(BIN)/%.efi
$(QM)$(ECHO) " [GENEFIDSK] $@"
$(Q)bash util/genefidsk -o $@ -b $(EFI_BOOT_FILE) $<
17 changes: 8 additions & 9 deletions src/Makefile.housekeeping
Expand Up @@ -491,6 +491,11 @@ LDFLAGS += -static
#
CFLAGS += -include include/compiler.h

# The section type character (e.g. "@" in "@progbits") varies by
# architecture.
#
CFLAGS += -DASM_TCHAR='$(ASM_TCHAR)' -DASM_TCHAR_OPS='$(ASM_TCHAR_OPS)'

# CFLAGS for specific object types
#
CFLAGS_c +=
Expand Down Expand Up @@ -896,7 +901,7 @@ endif
# Device ID tables (using IDs from ROM definition file)
#
define obj_pci_id_asm
.section ".pci_devlist.$(1)", "a", @progbits
.section ".pci_devlist.$(1)", "a", $(ASM_TCHAR)progbits
.globl pci_devlist_$(1)
pci_devlist_$(1):
.short ( 0x$(1) & 0xffff )
Expand Down Expand Up @@ -1298,21 +1303,15 @@ CLEANUP += $(ZBIN)
#
# The EFI image converter
#
ELF2EFI_CFLAGS := -I$(BINUTILS_DIR)/include -I$(BFD_DIR)/include \
-I$(ZLIB_DIR)/include -idirafter include
ELF2EFI_LDFLAGS := -L$(BINUTILS_DIR)/lib -L$(BFD_DIR)/lib -L$(ZLIB_DIR)/lib \
-lbfd -ldl -lz -Wl,--no-warn-search-mismatch

$(ELF2EFI32) : util/elf2efi.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) $(HOST_CFLAGS) $(ELF2EFI_CFLAGS) -DEFI_TARGET_IA32 $< \
$(ELF2EFI_LDFLAGS) -o $@
$(Q)$(HOST_CC) $(HOST_CFLAGS) -idirafter include -DEFI_TARGET32 $< -o $@
CLEANUP += $(ELF2EFI32)

$(ELF2EFI64) : util/elf2efi.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) $(HOST_CFLAGS) $(ELF2EFI_CFLAGS) -DEFI_TARGET_X64 $< \
$(ELF2EFI_LDFLAGS) -o $@
$(Q)$(HOST_CC) $(HOST_CFLAGS) -idirafter include -DEFI_TARGET64 $< -o $@
CLEANUP += $(ELF2EFI64)

$(EFIROM) : util/efirom.c $(MAKEDEPS)
Expand Down
12 changes: 12 additions & 0 deletions src/arch/arm/Makefile
@@ -0,0 +1,12 @@
# Assembler section type character
#
ASM_TCHAR := %
ASM_TCHAR_OPS := %%

# Include common ARM headers
#
INCDIRS += arch/arm/include

# ARM-specific directories containing source files
#
SRCDIRS += arch/arm/interface/efi
6 changes: 6 additions & 0 deletions src/arch/arm/Makefile.efi
@@ -0,0 +1,6 @@
# -*- makefile -*- : Force emacs to use Makefile mode

# Include generic EFI Makefile
#
MAKEDEPS += Makefile.efi
include Makefile.efi
93 changes: 93 additions & 0 deletions src/arch/arm/core/arm_io.c
@@ -0,0 +1,93 @@
/*
* Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#include <ipxe/io.h>
#include <ipxe/arm_io.h>

/** @file
*
* iPXE I/O API for ARM
*
*/

/** An ARM I/O qword */
union arm32_io_qword {
uint64_t qword;
uint32_t dword[2];
};

/**
* Read 64-bit qword from memory-mapped device
*
* @v io_addr I/O address
* @ret data Value read
*
* This is not atomic for ARM32.
*/
static uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
volatile union arm32_io_qword *ptr =
container_of ( io_addr, union arm32_io_qword, qword );
union arm32_io_qword tmp;

tmp.dword[0] = readl ( &ptr->dword[0] );
tmp.dword[1] = readl ( &ptr->dword[1] );
return tmp.qword;
}

/**
* Write 64-bit qword to memory-mapped device
*
* @v data Value to write
* @v io_addr I/O address
*
* This is not atomic for ARM32.
*/
static void arm32_writeq ( uint64_t data, volatile uint64_t *io_addr ) {
volatile union arm32_io_qword *ptr =
container_of ( io_addr, union arm32_io_qword, qword );
union arm32_io_qword tmp;

tmp.qword = data;
writel ( tmp.dword[0], &ptr->dword[0] );
writel ( tmp.dword[1], &ptr->dword[1] );
}

PROVIDE_IOAPI_INLINE ( arm, phys_to_bus );
PROVIDE_IOAPI_INLINE ( arm, bus_to_phys );
PROVIDE_IOAPI_INLINE ( arm, readb );
PROVIDE_IOAPI_INLINE ( arm, readw );
PROVIDE_IOAPI_INLINE ( arm, readl );
PROVIDE_IOAPI_INLINE ( arm, writeb );
PROVIDE_IOAPI_INLINE ( arm, writew );
PROVIDE_IOAPI_INLINE ( arm, writel );
PROVIDE_IOAPI_INLINE ( arm, iodelay );
PROVIDE_IOAPI_INLINE ( arm, mb );
#ifdef __aarch64__
PROVIDE_IOAPI_INLINE ( arm, readq );
PROVIDE_IOAPI_INLINE ( arm, writeq );
#else
PROVIDE_IOAPI ( arm, readq, arm32_readq );
PROVIDE_IOAPI ( arm, writeq, arm32_writeq );
#endif
13 changes: 13 additions & 0 deletions src/arch/arm/include/bits/endian.h
@@ -0,0 +1,13 @@
#ifndef _BITS_ENDIAN_H
#define _BITS_ENDIAN_H

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

/* ARM may be either little-endian or big-endian */
#ifdef __ARM_BIG_ENDIAN
#define __BYTE_ORDER __BIG_ENDIAN
#else
#define __BYTE_ORDER __LITTLE_ENDIAN
#endif

#endif /* _BITS_ENDIAN_H */
Expand Up @@ -3,7 +3,7 @@

/** @file
*
* x86_64-specific entropy API implementations
* ARM-specific entropy API implementations
*
*/

Expand Down
19 changes: 19 additions & 0 deletions src/arch/arm/include/bits/errfile.h
@@ -0,0 +1,19 @@
#ifndef _BITS_ERRFILE_H
#define _BITS_ERRFILE_H

/** @file
*
* ARM-specific error file identifiers
*
*/

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

/**
* @addtogroup errfile Error file identifiers
* @{
*/

/** @} */

#endif /* _BITS_ERRFILE_H */
12 changes: 12 additions & 0 deletions src/arch/arm/include/bits/hyperv.h
@@ -0,0 +1,12 @@
#ifndef _BITS_HYPERV_H
#define _BITS_HYPERV_H

/** @file
*
* Hyper-V interface
*
*/

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#endif /* _BITS_HYPERV_H */
14 changes: 14 additions & 0 deletions src/arch/arm/include/bits/io.h
@@ -0,0 +1,14 @@
#ifndef _BITS_IO_H
#define _BITS_IO_H

/** @file
*
* ARM-specific I/O API implementations
*
*/

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#include <ipxe/arm_io.h>

#endif /* _BITS_IO_H */
12 changes: 12 additions & 0 deletions src/arch/arm/include/bits/iomap.h
@@ -0,0 +1,12 @@
#ifndef _BITS_IOMAP_H
#define _BITS_IOMAP_H

/** @file
*
* ARM-specific I/O mapping API implementations
*
*/

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#endif /* _BITS_IOMAP_H */
14 changes: 14 additions & 0 deletions src/arch/arm/include/bits/nap.h
@@ -0,0 +1,14 @@
#ifndef _BITS_NAP_H
#define _BITS_NAP_H

/** @file
*
* ARM-specific CPU sleeping API implementations
*
*/

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#include <ipxe/efi/efiarm_nap.h>

#endif /* _BITS_MAP_H */
14 changes: 14 additions & 0 deletions src/arch/arm/include/bits/pci_io.h
@@ -0,0 +1,14 @@
#ifndef _BITS_PCI_IO_H
#define _BITS_PCI_IO_H

/** @file
*
* ARM PCI I/O API implementations
*
*/

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#include <ipxe/io.h>

#endif /* _BITS_PCI_IO_H */
Expand Up @@ -3,7 +3,7 @@

/** @file
*
* x86_64-specific reboot API implementations
* ARM-specific reboot API implementations
*
*/

Expand Down
Expand Up @@ -3,7 +3,7 @@

/** @file
*
* x86_64-specific sanboot API implementations
* ARM-specific sanboot API implementations
*
*/

Expand Down
Expand Up @@ -3,8 +3,10 @@

/** @file
*
* i386-specific SMBIOS API implementations
* ARM-specific SMBIOS API implementations
*
*/

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#endif /* _BITS_SMBIOS_H */

0 comments on commit 25e703c

Please sign in to comment.