aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2023-03-28Fix remaining typos in various foldersThomas Huth1-1/+1
Found with the "codespell" utility Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2021-02-12libhv: Compile with -WextraAlexey Kardashevskiy1-1/+1
-Wextra enables a bunch of rather useful checks which this fixes. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2021-02-12elf: Compile with -WextraAlexey Kardashevskiy1-3/+3
-Wextra enables a bunch of rather useful checks which this fixes. This changes the return value for the case when no ELF headers were found to avoid (ugly-ish) cast of -1 to unsigned. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- Changes: v2: * cast the return value to (int) * added missing (long)
2021-01-28helpers: Define MIN()Alexey Kardashevskiy1-0/+1
We already have MAX() defined, add MIN() to the common helpers header. Using the common helper also fixes a bug in tpmdrivers's MIN() where it was reverted. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- Changes: v2: * updated the comment about a fixed bug
2020-05-13elf: Implement elf_get_file_size to determine size of an ELF imageStefan Berger2-0/+16
Implement elf_get_file_size to determine the size of an ELF image that has been loaded into a buffer much larger than the actual size of the original file. We determine the size by searching for the farthest offset declared by the ELF headers. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2020-02-21tcgbios: Add TPM 2.0 support and firmware APIStefan Berger1-0/+1
This patch adds TPM 2.0 support along with the firmware API that Linux uses to transfer the firmware log. The firmware API follows the "PFW Virtual TPM Driver" specification. The API has callers in existing Linux code (prom_init.c) from TPM 1.2 times but the API also works for TPM 2.0 without modifications. The TPM 2.0 support logs PCR extensions of measurements of code and data. For this part we follow the TCG specification "TCG PC Client Platform Firmware Profile Specification" (section "Event Logging"). Other relevant specs for the construction of TPM commands are: - Trusted Platform Module Library; Part 2 Structures - Trusted Platform Module Library; Part 3 Commands Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net> [aik: removed new blank lines at EOF] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2020-02-21tpm: Add TPM CRQ driver implementationStefan Berger1-0/+1
This patch adds a TPM driver for the CRQ interface as used by the QEMU PAPR implementation. Also add a Readme that explains the benefits and installation procedure for the vTPM. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2020-02-21slof: Implement SLOF_get_keystroke() and SLOF_reset()Stefan Berger1-0/+2
Implement SLOF_get_keystroke() and SLOF_reset() helper functions. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-07-20romfs/tools: Remove superfluous union around the rom header structThomas Huth1-1/+0
Accessing the struct with memset and memcpy can also be done without the union wrapper. While we're at it, also remove the FLASHFS_HEADER_DATA_SIZE macre and use sizeof(stHeader) instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-29slof: Add a helper function to get the contents of a property in C codeThomas Huth1-0/+2
We will need to retrieve the UUID of the VM in the libnet code, so we need a function to get the contents from a device tree property. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-29libnet: Wire up pxelinux.cfg network bootingThomas Huth1-0/+2
In case the normal network loading failed, try to load a pxelinux.cfg config file. If that succeeds, load the kernel and initrd with the information that could be found in this file. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-09-26netboot: Create bootp-response when bootp is usedNikunj A Dadhania1-0/+2
According to TFTP Booting extension, after the success of BOOTP, BOOTREPLY packet should be copied to bootp-response property under "/chosen" While in current case, even when DHCP was used, bootp-response was being set. So set bootp-response when BOOTP is used and dhcp-response for DHCP Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14paflof: Add a write_mm_log helper functionThomas Huth1-0/+1
The code in lib/libnet/netload.c uses write_mm_log() to write error messages to the management module log, thus we need to provide this function in Paflof, too, when we want to link the netload code to Paflof later. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-16Remove misleading padding fields from ROM header definitionThomas Huth1-4/+2
The first two bytes of the date field are unused - and the date is indeed encoded in the following six bytes, i.e. also using the padding bytes. So the header definition is currently very confusing. Let's simply remove the padding fields and make the date field a little bit bigger instead - and add a proper comment about the encoding of the date field. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Adrian Reber <areber@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-16Improve indentation in calculatecrc.hThomas Huth1-23/+21
Since this header file is not included from assembler files anymore, we can remove the "#ifndef __ASSEMBLER__" here now and get rid of the unnecessary indentation in this file. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Adrian Reber <areber@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-16Remove unused defines in calculatecrc.hThomas Huth1-12/+0
Seems like they are completely unused, thus can be removed without problems. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Adrian Reber <areber@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08virtio: add virtio 1.0 related struct and definesNikunj A Dadhania1-0/+4
Traditionally, struct virtio_device is shared between SLOF and C code. This still remains shared with the addition of virtio_cap structure as well. Now both virtio_device and virtio_cap structures are shared. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08fix code style in byteorder.hNikunj A Dadhania1-12/+6
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08pci: add byte read/write helper routinesNikunj A Dadhania1-0/+2
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-12-01Move the code for rfill into a separate functionThomas Huth1-11/+2
The code from the FAST_RFILL macro uses a local array as a temporary buffer - which gets allocated in the stack frame of the engine() function. Since engine() can be called recursively, this can cause stack overflows. So let's move the rfill code into a separate function to avoid these problems. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-08-05Add missing half word access case to _FASTRMOVE and _FASTMOVEThomas Huth2-8/+8
The _FASTRMOVE and _FASTMOVE macros are missing the case where the alignment matches "6" - in this case, the copying can also be done with 16-bit accesses. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-08-05fbuffer: Implement RFILL as an accelerated primitiveThomas Huth2-0/+36
By implementing RFILL as an primitive, we can get a huge speed-up of the screen erasing function. On board-js2x, it writes the pattern directly into the IO region, and on board-qemu it uses the KVMPPC_H_LOGICAL_MEMOP hypercall to copy the pattern from a temporary buffer into the IO region. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-08-05fbuffer: Implement MRMOVE as an accelerated primitiveThomas Huth2-0/+20
The character drawing function fb8-draw-character uses "mrmove" (which moves main memory contents to IO memory) to copy the data of the character from main memory to the frame buffer. However, the current implementation of "mrmove" performs quite badly on board-qemu since it triggers a hypercall for each memory access (e.g. for each 8 bytes that are transfered). But since the KVMPPC_H_LOGICAL_MEMOP hypercall can transfer bigger regions at once, we can accelerate the character drawing quite a bit by simply mapping the "mrmove" to the same macro that is already used for the "rmove" (which is normally only used for copying from IO memory to IO memory, but on board-qemu it does not matter). For keeping board-js2x in sync, this patch also transforms the "mrmove" for js2x into primitives. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-13helpers: Fix SLOF_alloc_mem_aligned to meet callers expectationAlexey Kardashevskiy1-1/+1
Every caller of SLOF_alloc_mem_aligned() assumes the size is the first argument while it is not. This switches align and size and fixes random memory corruptions. This is grep for SLOF_alloc_mem_aligned with this patch applied: include/helpers.h|27| extern void *SLOF_alloc_mem_aligned(long size, long align); lib/libveth/veth.c|103| buffer_list = SLOF_alloc_mem_aligned(8192, 4096); lib/libveth/veth.c|105| rx_queue = SLOF_alloc_mem_aligned(rx_queue_len, 16); lib/libvirtio/virtio-net.c|101| vq[i].desc = SLOF_alloc_mem_aligned(virtio_vring_size(vq[i].size), 4096); slof/helpers.c|70| void *SLOF_alloc_mem_aligned(long size, long align) Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2014-04-25virtio-blk: support variable block sizeNikunj A Dadhania1-0/+5
Current code only works with 512 bytes read. Moreover, Qemu ignores the guest set features request. In the set features request SLOF indicates to qemu that it is not support VIRTIO_BLK_F_BLK_SIZE feature. Code in qemu suggests that virtio-blk is not implementing set_guest_feature. Tested-by: Bharata B Rao <bharata@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-03-18ELF: Enter LE binary in LE modeNikunj A Dadhania1-0/+1
Trampoline code in the LE binary were helping fix this. This patch now takes care of switching the mode to LE for LE elf binaries. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-02-04Add support for 64bit LE ABI v1 and v2 supportNikunj A Dadhania1-0/+1
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> -- v2: With the parameters changed for go-64, kernel loading from commandline broke v3: (client-exec) calls start-elf64 directly, fix args
2013-12-06Add support for loading little endian ELF binaries.Anton Blanchard1-0/+7
We byte swap the entire header in place in elf_check_file. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-06Add bswap_{16,32,64}pAnton Blanchard1-0/+18
Add byte swap macros that take a pointer and byte swap in place. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04Implement range allocatorNikunj A Dadhania1-0/+23
Use the allocator with dma-map-in so it does not create duplicate TCE entries. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04Add veth driver in libvethAvik Sil1-0/+24
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04Add SLOF usleep wrapperAvik Sil1-0/+1
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04Add SLOF pci wrapper functionsAvik Sil1-0/+5
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-07-25Use a global definition of sync() and mb()Benjamin Herrenschmidt3-12/+27
For memory barriers accross the board. Also move the compiler barrier to cpu.h Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2013-07-24usb: unmap buffersNikunj A Dadhania1-0/+3
Clean up all the dma allocated buffers and remove their mappings. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2013-07-24usb-slof: forth support routines for CNikunj A Dadhania1-0/+34
Code inherited from libusb code written by former SLOF team Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2013-07-24Use __builtin_bswap routines for endianness swappingAvik Sil1-3/+5
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Acked-by: Thomas Huth <thuth@de.ibm.com>
2013-01-04Spelling fixes in comments and debug messagesStefan Weil1-1/+1
Most of these errors were found by codespell: controler -> controller appropiate -> appropriate devide -> divide comming -> coming seperate -> separate reponsible -> responsible initialization -> initialization successfull -> successful whithin -> within recieve -> receive wich -> which occurence -> occurrence beggining -> beginning accessable -> accessible proccess -> process succesfuly -> successfully immediatly -> immediately prefered -> preferred avaliable -> available threshhold -> threshold statistsics -> statistics endianess -> endianness positon -> position writen -> written occurence -> occurrence upto -> up to overwriten -> overwritten availabe -> available enviroment -> environment intruction -> instruction thru -> through substract -> subtract occured -> occurred begining -> beginning lenght -> length atributes -> attributes preceeding -> preceding defintion -> definition decriptor -> descriptor Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2012-02-22Move _FASTRMOVE implementation into headers & support new hcallBenjamin Herrenschmidt2-1/+106
This moves _FASTREMOVE to the cache.h header, 970 uses the existing code, p7 now uses the new memop hcall. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-01-11Fix inline asm for ci_write_xxBenjamin Herrenschmidt1-19/+31
It was clobbering r4 and not marking it as such, causing problems among others in virtio-blk Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2011-12-20Silenced some compiler warnings that occur when compiling with prototype checksThomas Huth2-4/+4
The compiler flags -Wmissing-prototypes and -Wstrict-prototypes generally help to write code with proper prototypes. This way one can avoid some ugly bugs because it helps to identify functions that do not have prototypes in headers. It also helps to improve performance since local functions then have to be declared "static", so the compiler can do better optimizations. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24Support for virtio-block PCI devicesThomas Huth1-0/+5
The virtio devices are preferred way of providing virtualized devices on KVM/qemu. Here's now the basic support for virtio block devices. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12Improved cache-inhibited access functionsThomas Huth1-10/+27
Implemented the CI functions in cache.h (which are required by net-snk) and fixed a bug in hv_logical_ci_store in libhvcall. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12Removed obsolete types.h header filesThomas Huth1-28/+0
Our "portable" types are defined in stdint.h, so there is no need for the types.h header files anymore. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12Got rid of the ELF loader functions written in Forth, using libelf instead.Thomas Huth1-0/+2
It's cumbersome to maintain code twice, in Forth and in C, and now that libelf has a new important feature (relocation), I removed most of the old Forth functions for ELF loading and use the libelf everywhere instead. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12Reworked libelf to support relocationThomas Huth1-2/+72
Split elf.c into elf32.c and elf64.c for better readability. Added relocation code to libelf for 64-bit ELF images, modified the Paflof Makefile to link the executable with relocation information and load Paflof now to the upper end of the memory. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12Move functions for byte-swapping into common header file.Thomas Huth1-0/+78
The byte-swapping functions were scattered all over the source tree, now they are merged into a new common header file called byteswap.h. Signed-off-by: <thuth@linux.vnet.ibm.com>
2011-03-22Initial qemu/KVM board supportBenjamin Herrenschmidt2-0/+112
Added a new board for SLOF running on KVM/qemu. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2010-12-01Initial import of slof-JX-1.7.0-4Benjamin Herrenschmidt13-0/+614
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>