aboutsummaryrefslogtreecommitdiff
path: root/include/helpers.h
AgeCommit message (Collapse)AuthorFilesLines
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 Berger1-0/+2
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-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-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-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>
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 Herrenschmidt1-6/+0
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>