aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2016-03-08[ipoib] Simplify test for received broadcast packetsMichael Brown1-4/+2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[ipoib] Avoid unnecessary path record lookup for broadcast addressMichael Brown1-15/+27
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Parse MLID, rate, and SL from multicast membership recordMichael Brown3-62/+74
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Record multicast GID attachment as part of group membershipMichael Brown3-18/+16
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Do not use GRH for local pathsMichael Brown1-7/+6
Avoid including an unnecessary GRH in packets sent to unicast destinations within the local subnet. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Use correct transaction identifier in CM responsesMichael Brown3-17/+31
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Use connection's local ID as debug message identifierMichael Brown2-25/+33
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Use "%d" as format specifier for LIDsMichael Brown2-4/+4
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Use "%#lx" as format specifier for queue pair numbersMichael Brown4-12/+12
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Assign names to Infiniband devices for debug messagesMichael Brown8-118/+140
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Add support for performing service record lookupsMichael Brown3-1/+106
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08[infiniband] Avoid multiple calls to ib_cmrc_shutdown()Michael Brown1-0/+3
When a CMRC connection is closed, the deferred shutdown process calls ib_destroy_qp(). This will cause the receive work queue entries to complete in error (since they are being cancelled), which will in turn reschedule the deferred shutdown process. This eventually leads to ib_destroy_conn() being called on a connection that has already been freed. Fix by explicitly cancelling any pending shutdown process after the shutdown process has completed. Ironically, this almost exactly reverts commit 019d4c1 ("[infiniband] Use a one-shot process for CMRC shutdown"); prior to the introduction of one-shot processes the only way to achieve a one-shot process was for the process to cancel itself. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-07[infiniband] Remove concept of whole-device owner dataMichael Brown2-35/+45
Remove the implicit assumption that the IPoIB protocol owns the whole Infiniband device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-07[netdevice] Refuse to create duplicate network device namesMichael Brown1-0/+8
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-26[librm] Support ioremap() for addresses above 4GB in a 64-bit buildMichael Brown6-1/+216
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-26[ioapi] Split ioremap() out to a separate IOMAP APIMichael Brown9-44/+163
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-24[librm] Add support for running in 64-bit long modeMichael Brown4-61/+498
Add support for running the BIOS version of iPXE in 64-bit long mode. A 64-bit BIOS version of iPXE can be built using e.g. make bin-x86_64-pcbios/ipxe.usb make bin-x86_64-pcbios/8086100e.mrom The 64-bit BIOS version should appear to function identically to the normal 32-bit BIOS version. The physical memory layout is unaltered: iPXE is still relocated to the top of the available 32-bit address space. The code is linked to a virtual address of 0xffffffffeb000000 (in the negative 2GB as required by -mcmodel=kernel), with 4kB pages created to cover the whole of .textdata. 2MB pages are created to cover the whole of the 32-bit address space. The 32-bit portions of the code run with VIRTUAL_CS and VIRTUAL_DS configured such that truncating a 64-bit virtual address gives a 32-bit virtual address pointing to the same physical location. The stack pointer remains as a physical address when running in long mode (although the .stack section is accessible via the negative 2GB virtual address); this is done in order to simplify the handling of interrupts occurring while executing a portion of 32-bit code with flat physical addressing via PHYS_CODE(). Interrupts may be enabled in either 64-bit long mode, 32-bit protected mode with virtual addresses, 32-bit protected mode with physical addresses, or 16-bit real mode. Interrupts occurring in any mode other than real mode will be reflected down to real mode and handled by whichever ISR is hooked into the BIOS interrupt vector table. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-22[librm] Rename prot_call() to virt_call()Michael Brown4-39/+39
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-21[librm] Support userptr_t in 64-bit buildsMichael Brown1-1/+23
In a 64-bit build, the entirety of the 32-bit address space is identity-mapped and so any valid physical address may immediately be used as a virtual address. Conversely, a virtual address that is already within the 32-bit address space may immediately be used as a physical address. A valid virtual address that lies outside the 32-bit address space must be an address within .textdata, and so can be converted to a physical address by adding virt_offset. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-21[librm] Mark virt_offset, text16, data16, rm_cs, and rm_ds as constantMichael Brown1-5/+5
The physical locations of .textdata, .text16 and .data16 are constant from the point of view of C code. Mark the relevant variables as constant to allow gcc to optimise out redundant reads. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-21[librm] Do not preserve flags unnecessarilyMichael Brown1-17/+11
No callers of prot_to_phys, phys_to_prot, or intr_to_prot require the flags to be preserved. Remove the unnecessary pushfl/popfl pairs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-20[librm] Add phys_call() wrapper for calling code with physical addressingMichael Brown3-153/+212
Add a phys_call() wrapper function (analogous to the existing real_call() wrapper function) for calling code with flat physical addressing, and use this wrapper within the PHYS_CODE() macro. Move the relevant functionality inside librm.S, where it more naturally belongs. The COMBOOT code currently uses explicit calls to _virt_to_phys and _phys_to_virt. These will need to be rewritten if our COMBOOT support is ever generalised to be able to run in a 64-bit build. Specifically: - com32_exec_loop() should be restructured to use PHYS_CODE() - com32_wrapper.S should be restructured to use an equivalent of prot_call(), passing parameters via a struct i386_all_regs - there appears to be no need for com32_wrapper.S to switch between external and internal stacks; this could be omitted to simplify the design. For now, librm.S continues to expose _virt_to_phys and _phys_to_virt for use by com32.c and com32_wrapper.S. Similarly, librm.S continues to expose _intr_to_virt for use by gdbidt.S. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-19[build] Fix building on older versions of binutilsMichael Brown2-10/+20
Some older versions of binutils have issues with both the use of PROVIDE() and the interpretation of numeric literals within a section description. Work around these older versions by defining the required numeric literals outside of any section description, and by automatically determining whether or not to generate extra space for page tables rather than relying on LDFLAGS. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-19[librm] Generate page tables for 64-bit buildsMichael Brown3-2/+197
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-19[librm] Prepare for long-mode memory mapMichael Brown6-35/+96
The bulk of the iPXE binary (the .textdata section) is physically relocated at runtime to the top of the 32-bit address space in order to allow space for an OS to be loaded. The relocation is achieved with the assistance of segmentation: we adjust the code and data segment bases so that the link-time addresses remain valid. Segmentation is not available (for normal code and data segments) in long mode. We choose to compile the C code with -mcmodel=kernel and use a link-time address of 0xffffffffeb000000. This choice allows us to identity-map the entirety of the 32-bit address space, and to alias our chosen link-time address to the physical location of our .textdata section. (This requires the .textdata section to always be aligned to a page boundary.) We simultaneously choose to set the 32-bit virtual address segment bases such that the link-time addresses may simply be truncated to 32 bits in order to generate a valid 32-bit virtual address. This allows symbols in .textdata to be trivially accessed by both 32-bit and 64-bit code. There is no (sensible) way in 32-bit assembly code to generate the required R_X86_64_32S relocation records for these truncated symbols. However, subtracting the fixed constant 0xffffffff00000000 has the same effect as truncation, and can be represented in a standard R_X86_64_32 relocation record. We define the VIRTUAL() macro to abstract away this truncation operation, and apply it to all references by 32-bit (or 16-bit) assembly code to any symbols within the .textdata section. We define "virt_offset" for a 64-bit build as "the value to be added to an address within .textdata in order to obtain its physical address". With this definition, the low 32 bits of "virt_offset" can be treated by 32-bit code as functionally equivalent to "virt_offset" in a 32-bit build. We define "text16" and "data16" for a 64-bit build as the physical addresses of the .text16 and .data16 sections. Since a physical address within the 32-bit address space may be used directly as a 64-bit virtual address (thanks to the identity map), this definition provides the most natural access to variables in .text16 and .data16. Note that this requires a minor adjustment in prot_to_real(), which accesses .text16 using 32-bit virtual addresses. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-19[relocate] Preserve page alignment during relocationMichael Brown1-12/+10
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-19[librm] Transition to protected mode within init_librm()Michael Brown2-107/+127
Long-mode operation will require page tables, which are too large to sensibly fit in our .data16 segment in base memory. Add a portion of init_librm() running in 32-bit protected mode to provide access to high memory. Use this portion of init_librm() to initialise the .textdata variables "virt_offset", "text16", and "data16", eliminating the redundant (re)initialisation currently performed on every mode transition as part of real_to_prot(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[librm] Provide an abstraction wrapper for prot_callMichael Brown20-60/+77
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[librm] Convert prot_call() to a real-mode near callMichael Brown16-23/+6
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[prefix] Standardise calls to prot_call()Michael Brown2-11/+28
Use the standard "pushl $function ; pushw %cs ; call prot_call" sequence everywhere that prot_call() is used. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[librm] Simplify definitions for prot_call() and real_call() stack framesMichael Brown1-14/+17
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[prefix] Use garbage-collectable section namesMichael Brown1-20/+20
Allow unused sections of libprefix.o to be removed via --gc-sections. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[bios] Use an 8kB stack for x86_64Michael Brown1-1/+7
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[librm] Use garbage-collectable section namesMichael Brown1-22/+26
Allow unused sections of librm.o to be removed via --gc-sections. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[bios] Make uses of REAL_CODE() and PHYS_CODE() 64-bit cleanMichael Brown5-13/+17
On a 64-bit CPU, any modification of a register by 32-bit or 16-bit code will destroy the invisible upper 32 bits of the corresponding 64-bit register. For example: a 32-bit "pushl %eax" followed by a "popl %eax" will zero the upper half of %rax. This differs from the treatment of upper halves of 32-bit registers by 16-bit code: a "pushw %ax" followed by a "popw %ax" will leave the upper 16 bits of %eax unmodified. Inline assembly generated using REAL_CODE() or PHYS_CODE() will therefore have to preserve the upper halves of all registers, to avoid clobbering registers that gcc expects to be preserved. Output operands from REAL_CODE() and PHYS_CODE() assembly may therefore contain undefined values in the upper 32 bits. Fix by using explicit variable widths (e.g. uint32_t) for non-discarded output operands, to ensure that undefined values in the upper 32 bits of 64-bit registers are ignored. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[romprefix] Align PMM temporary decompression area to a page boundaryMichael Brown1-6/+9
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18[prefix] Align INT 15,88 temporary decompression area to a page boundaryMichael Brown1-0/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[librm] Discard argument as part of return from real_call()Michael Brown2-2/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[librm] Discard argument as part of return from prot_call()Michael Brown15-22/+6
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Add bin-x86_64-pcbios build platformMichael Brown155-240/+198
Move most arch/i386 files to arch/x86, and adjust the contents of the Makefiles and the include/bits/*.h headers to reflect the new locations. This patch makes no substantive code changes, as can be seen using a rename-aware diff (e.g. "git show -M5"). This patch does not make the pcbios platform functional for x86_64; it merely allows it to compile without errors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Move isolinux definitions to Makefile.pcbiosMichael Brown2-22/+22
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Allow librm to be compiled for x86_64Michael Brown3-15/+30
This commit does not make librm functional for x86_64; it merely allows it to compile without errors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Allow memmap.c to be compiled for x86_64Michael Brown1-1/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Allow bios_console.c to be compiled for x86_64Michael Brown1-1/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Allow bzimage.c to be compiled for x86_64Michael Brown1-3/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Allow rtc_entropy.c to be compiled for x86_64Michael Brown1-16/+13
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Allow relocate.c to be compiled for x86_64Michael Brown1-12/+12
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Use size_t when casting _text16_memsz and _data16_memszMichael Brown2-6/+7
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[bios] Use intptr_t when casting .text16 function pointersMichael Brown9-32/+24
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16[libc] Split rmsetjmp() and rmlongjmp() into a separate rmsetjmp.hMichael Brown7-25/+33
Signed-off-by: Michael Brown <mcb30@ipxe.org>