aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-10-17Do not link libnet to net-snk anymore, and remove net-snk from board-qemuThomas Huth7-8/+5
Since libnet is now linked to Paflof directly, we do not have to link it into net-snk anymore. So for board-qemu, we can now even exclude net-snk completely from the build (for board-js2x, it is still required for the biosemu, so we can not erase the net-snk folder completely yet). Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-17Add a Forth-to-C wrapper for the ping command, tooThomas Huth4-3/+22
Now that we link libnet to Paflof, we can call the ping function there directly instead of using the one from net-snk. We add a similar Forth-to-C wrapper like it has already been done for netboot() - simplification and clean-up will be done in a later patch once we do not link against net-snk anymore. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-17Link libnet code to Paflof and add a wrapper for netboot()Thomas Huth5-8/+30
Now that all necessary functions are provided by Paflof, too, we can finally link the libnet code to this binary. To be able to call the netboot() function from the Forth code now, we also add a wrapper that takes the parameter string from the obp-tftp package and converts it to an argv array that is expected by the netboot() function. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-17Remember execution tokens of "write" and "read" for socket operationsThomas Huth1-9/+36
The recv() and send() functions are currently assuming that the dictionary of the NIC node is available, so that they can call "read" or "write" directly. While this is working fine when only doing network loading from the Open Firmware prompt, this does not work anymore when a client like yaboot is trying to load additional files. Fix this issue by looking up the execution tokens of "read" and "write" while opening the socket, so we can use these XT values during recv() and send() later. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-13Add virtio-serial device supportNikunj A Dadhania10-7/+424
Add support for virtio serial device to be used as a console device. Currently, SLOF only supports spapr-vty device. With this addition virtio console can be used during boot. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-13Generalize output banner write routineNikunj A Dadhania1-6/+12
Initial display output is replayed to vga/vnc display, similar facility will be needed for virtio-serial console as the enumeration would only happen during PCI discovery. Generalize the write routine that could be used accordingly for virtio-serial driver as well. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-13Improve indentation in OF.fsNikunj A Dadhania1-55/+55
Make uniform indentation(width = 4) everywhere in the file. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-13scsi: implement READ (16) commandNikunj A Dadhania2-1/+35
For disks bigger than 2TB(512B sector size), read-10 would fail as it is limited by the block address(4bytes). Add and use SCSI command READ(16) when max blocks is more than 0xFFFFFFFF. 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-10-12rtas: Improve rtas-do-config-@ and rtas-do-config-! a little bitThomas Huth1-6/+4
As soon as we are booting with at least one PCI device, the rtas-do-config-@ Forth word is called quite often, so it makes sense that we look up the corresponding RTAS token only once instead of each time the function is called. Also the "ffffffff and" operation on the lower half of the PUID is not really required and can be removed, since the "l!" Forth word is storing the lower four bytes only anyway. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-10libnet: Make netapps.h includable from .code filesThomas Huth3-9/+12
Unfortunately netapps.h currently can't be included from .code Forth-to-C wrapper files - it includes tftp.h which in turn includes ipv6.h, and that header contains some constructs which can't be used in .code files. So let's make netapps.h independent from tftp.h and add some "extern" keywords like it is done with the other header files already that are included from .code files. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-10libnet: Remove unused prototypes from netapps.hThomas Huth1-3/+0
These functions do not exist anymore, thus their prototypes can be removed nowadays. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-10libnet: Fix the printout of the ping commandThomas Huth1-3/+1
Commit 7e31382cca5fb988b ("Improve printed text when booting via network") moved the "Requesting information via DHCP..." printf statement from the netboot() function into the dhcp() function. However, it did not take into account that the ping() function should be changed in the same way, so with ping, the message is currently printed out twice. So let's re-arrange the printout of ping() now accordingly. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-10libnet: Make sure to close sockets when we're doneThomas Huth2-0/+10
If libnet is linked to the net-snk, it does not matter since the whole stack is completely reloaded each time. But if we are linking libnet to Paflof, we've got to make sure to properly release the resources that we've allocated before, since the code and data stays in memory. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-10scsi: implement read-capacity-16Nikunj A Dadhania1-0/+19
For disks bigger than 2TB(512B sector size), read-capacity-10 would fail and return FFFFFFFF, as it only has 4byte block address field. Detect this and use read-capacity-16 which returns 8byte block address. 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-10-10pci: Fix secondary and subordinate PCI bus enumeration with board-qemuThomas Huth3-5/+14
SLOF currently fails to correctly initialize the secondary and subordinate bus number registers in the config space of PCI bridges, so that for example with the following command line, none of the PCI devices is usable: qemu-system-ppc64 -nodefaults -nographic -serial mon:stdio \ -device pci-bridge,chassis_nr=1,id=bridge0,addr=0x3 \ -device pci-bridge,chassis_nr=2,id=bridge1,addr=0x4 \ -device virtio-balloon,bus=bridge1,addr=0x1 \ -device virtio-net,bus=bridge0,addr=0x2 \ -device virtio-rng,bus=bridge0,addr=0x5 \ -device pci-bridge,chassis_nr=3,id=br2,addr=0x6,bus=bridge1 \ -device e1000,bus=br2,addr=0x1 This is because SLOF tries to enumerate the PCI bus numbers that are reachable via a bridge. In the function pci-bridge-probe, it increases the pci-bus-number counter and writes that value into the secondary bus number register of the PCI config space, and after probing all attached bridges, it fills the number of the last enumerated bus number into the subordinate bus number register. This works fine if the whole bus enumeration is done by SLOF, however on board-qemu, we nowadays rely on the pre-initialized PCI device tree from QEMU - and the numbers that SLOF is trying to use here do not match with the bus numbers that QEMU already assigned to the bus segments (QEMU provides the device tree nodes in descending order, but SLOF tries to enumerate the bus numbers in ascending order here instead). To fix this issue, we should simply stop setting up the secondary and subordinate config space registers of the bridge in SLOF - since this is done by QEMU already! Thus we replace the "pci-bridge-probe" function with a board-qemu-specific function "phb-pci-bridge-probe", that does not call "pci-bus!" and "pci-bus-subo!" anymore. (And since pci-bridge-probe was the only spot that called phb-pci-probe-bus, we can get rid of that wrapper now, too, and call phb-pci-walk-bridge from phb-pci-bridge-probe directly instead). Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1377083 Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-10pci-phb: Fix stack underflow in phb-pci-walk-bridgeThomas Huth1-1/+1
The sequence "my-space pci-htype@ pci-out" in phb-pci-walk-bridge is bugged: pci-htype@ already consumes the my-space item from the stack, only leaving one item for pci-out. But pci-out needs two input items on the stack, the PCI address and a character item. So this rather should be "my-space dup pci-htype@ pci-out" instead. However, using the output of pci-htype@ as input character for pci-out also does not make much sense, since this is likely an unprintable character. So let's simply use a question mark here instead to indicate that we did not recognize the type of the PCI device. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1377083 Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14paflof: Add a read() function to read keyboard inputThomas Huth1-0/+26
The libnet code uses read() to check for keyboard input (so that it can abort the network loading when the user pressed ESC). So to be able to use the libnet code with Paflof, too, we have got to provide a read() function here. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14paflof: Add socket(), send() and recv() functions to paflofThomas Huth2-0/+110
Code is slightly based on the implementation from net-snk, but has been adapted to use the forth_eval() and forth_push/pop() macros instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14paflof: Provide get_timer() and set_timer() helper functionsThomas Huth2-0/+24
They are needed for libnet, too. This implementation uses SLOF_GetTimer() instead of using the decrementer like it is done in the net-snk functions. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14paflof: Add a write_mm_log helper functionThomas Huth2-0/+10
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-09-14paflof: Copy sbrk code from net-snkThomas Huth2-4/+48
sbrk() is needed for the malloc() implementation of our libc, so to be able to use malloc() from the Paflof code, we need to provide sbrk() here, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14paflof: Use CFLAGS from make.rules instead of completely redefining themThomas Huth4-12/+12
It's cumbersome to change the CFLAGS in multiple places in case they have to be changed. So let's use the global CFLAGS from make.rules for building Paflof, too. Since the global rules use some additional compiler warning flags, fix the now occuring compiler warnings in the Paflof code, too (mostly about missing or wrong prototypes). Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14Do not include the FCode evaluator by default anymoreThomas Huth7-107/+54
Commit 2fed5652819ad26627a8 ("Always include evaluator, move framebuffer token init to fbuffer.fs") made sure that the FCode evaluator is always included, during each boot cycle. The basic idea was that we would soon be starting to support PCI cards with FCode drivers on them. However, this has never happened, and so this change was in vain. The bad thing is now that the inclusion of the FCode evaluator also takes a lot of precious boot time, e.g. when running in QEMU TCG mode, it is more than a second. So to be able to boot faster again, disable the FCode evaluator by default again and put it into the ROM-fs instead (so it still can be loaded manually with "include evaluator.fs" if necessary). Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14Source code beautification of board-qemu/slof/pci-interrupts.fsThomas Huth1-26/+26
No functional change in this patch, only cosmetics: Use indentation width = 4 spaces everywhere, fix typo in one of the comments ("Child pin" instead of "Chile pin"), and rename "swizzledpin" in the return stack comments to "parentpin" to match the non-return stack comments. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14Allow PCI devices in PCI bridge slots greater than 4Thomas Huth1-1/+1
PCI bridges can have up to 31 slots. If we limit the value from pci-addr2dev with "modulo 4", all devices in slots 4 and higher won't work correctly since the interrupt-map property then contains wrong values in this case. For example, when QEMU is started with the following command line, Linux is not able to use the balloon device: qemu-system-ppc64 ... \ -device pci-bridge,bus=pci.0,id=bridge1,chassis_nr=1,addr=0x6 \ -device virtio-balloon-pci,id=balloon0,bus=bridge1,addr=5 To fix this issue, simply remove the bogus "4 mod" calculation. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1366953 Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14Fix bad interrupt pin numbering in interrupt-map property of PCI bridgesThomas Huth1-1/+1
The legacy PCI interrupts in the device tree are enumerated from 1 to 4. However, the code in pci-gen-irq-map-one generates numbers between 0 and 3 instead. This renders devices unusable by Linux in case they should use IRQ 4. For example, when starting QEMU with qemu-system-ppc64 ... \ -device pci-bridge,bus=pci.0,id=bridge1,chassis_nr=1,addr=0x6 \ -device virtio-balloon-pci,id=balloon0,bus=bridge1,addr=3 Linux can not use the balloon device since it is unable to determine the right IRQ number in this case. To fix this issue, we've simply got to make sure that the IRQ numbers are in the range from 1 to 4 instead of 0 to 3. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1366953 Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14Improve SLOF_alloc_mem_aligned()Thomas Huth1-3/+8
When loading a file via the spapr-vlan network interface, SLOF currently leaks quite a lot of memory, about 12kB each time. This happens mainly because veth_init() uses for example SLOF_alloc_mem_aligned(8192, 4096) and similar calls to get the memory, but the space for the additional alignment is never returned anymore later. An easy way to ease this situation is to improve SLOF_alloc_mem_aligned() a little bit. We normally get memory from SLOF_alloc_mem() which is aligned pretty well already, thanks to the buddy allocator in SLOF. So we can try to first get a memory block with the exact size first, and only do the alignment dance if the first allocation was not aligned yet. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-24instance: Fix set-my-args for empty argumentsAlexey Kardashevskiy1-7/+3
It would put the pointer and len in the wrong order in the instance>args buffer. As alloc-mem can handle zero length itself (and return NULL), this also removes "if" to make the code simpler. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [aik: removed "if" as Segher suggested; removed pipe from comment as Thomas suggested] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-08-16Fix remaining compiler warnings in sloffs.cThomas Huth1-21/+15
With my version of GCC (v4.8.5 - Advance-Toolchain 7.0) there are currently two warnings when compiling sloffs.c: sloffs.c: In function 'sloffs_dump': sloffs.c:437:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] printf("%04x", be16_to_cpu(*(uint16_t *)(header->date + 2))); ^ sloffs.c:449:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] printf("%04x", be16_to_cpu(*(uint16_t *)(header->mdate + 2))); ^ These can be easily fixed by accessing the memory byte by byte instead of casting the pointer to (uint16_t *). And while we're at it, let's also simplify the code a little bit by consolidating the date print code into a separate function which can be used by the two spots that print a date. 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-16Do not include calculatecrc.h from assembler filesThomas Huth2-3/+0
The defines from calculatecrc.h are not used in any of the assembler files anymore. So there's no need anymore to include this file here. 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-08-16libnet: Re-initialize global variables at the beginning of tftp()Thomas Huth1-15/+23
When we will link the TFTP code to paflof instead of net-snk later, the executable won't be reloaded each time we want to do an TFTP transfer, so we got to make sure to initialize global variables properly instead of relying on the ELF loader to do this job. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-03Remove dependency on cpu/@0 for bootingNikunj A Dadhania1-2/+11
With the addition of cpu hotplug in QEMU, cpu@0 can be removed as well. SLOF should not depend on it. Find the first child in the "/cpus" node and get the timer base frequency and set it as the chosen cpu as well Reported-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-03usb: Set XHCI slot speed according to port statusThomas Huth3-7/+22
So far, the code was always assuming SuperSpeed for all devices, which seemed to work OK with QEMU ... but let's better play safe instead and use the speed from the port status instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-03usb: Build correct route string for USB3 devices behind a hubThomas Huth1-4/+10
To support USB3 devices attached to a hub, we've got to set the so-called "route string" in the slot context, which is a concatenation of the hub port numbers that need to be traversed between the root hub port and the destination device. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-03usb: Initialize USB3 devices on a hub and keep track of hub topologyThomas Huth4-11/+39
USB3 devices need to be initialized with usb3_dev_init(), so that they get assigned a proper slot ID. And for USB3 devices that are attached to a (non-root) hub, we also need to keep track of the hub topology, so a new field called "hub" is added to the struct usb_dev which references the hub devices where the current USB devices is attached to. The hub topology will be used later to build the so-called "route string" for the USB3 devices. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-03usb: Increase amount of maximum slot IDs and add a sanity checkThomas Huth2-1/+7
SLOF should be able to support more than just four devices on the four root hub ports. So we've got to increase the amount of possible slot IDs. Since QEMU supports up to 44 devices (four devices at the root ports + 5 tiers of hubs with 8 ports each), this seems to be a good new value instead. And to make sure that we do not accidentially get a buffer overflow when accessing the xhcd->xdevs[slot_id] array, this patch also add a sanity check at the beginning of the xhci_alloc_dev() function here. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-08-03usb: Move XHCI port state arrays from header to .c fileThomas Huth2-18/+17
Arrays should not be declared in a header (to avoid that it gets declared multiple times when the header is included more than once), so the ps_array_usbX settings should reside in the .c file instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-07-27tools: add copy functionalityAdrian Reber1-1/+63
sloffs can now copy a SLOF flash image from one file to another. This is especially useful when the input is not a regular file, but the slof_flash device. The -c, --copy parameter copies only the actual SLOF flash image instead of the whole device. This should result in a file, which is identical to the file from the SLOF build process. (cherry picked from commit 587eb035ac1fb17c3b8ab236bb06e793f08bb3ea) Cherry picked from https://lisas.de/~adrian/slof/slof.git/ Signed-off-by: Adrian Reber <adrian@lisas.de> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-07-27tools: added support to sloffs to read from /dev/slof_flashAdrian Reber1-48/+216
Rewrote all code accessing the input file to not mmap it anymore, because the crappy slof_flash driver does not support mmap but only read/lseek. Using read/lseek sloffs can now operate on a flash file image or directly use the slof_flash device using the same code. (cherry picked from commit 23fa80154b22b14147467160bd33ebc23b9275d1) Cherry picked from https://lisas.de/~adrian/slof/slof.git/ Signed-off-by: Adrian Reber <adrian@lisas.de> [aik: squashed f2aa0523c] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-07-27tools: added file append functionalityAdrian Reber1-9/+219
The -a, --append can now be used to append any file to flash image filesystem. It is required that -o, --output specifies an output file name. (cherry picked from commit 339c6f4d17cae84526c7cba63928bf7769de5abe) Cherry picked from https://lisas.de/~adrian/slof/slof.git/ Signed-off-by: Adrian Reber <adrian@lisas.de> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-07-27tools: use crc checking code from romfs/toolsAdrian Reber2-3/+21
Added CRC check of the header and complete image when dumping the header. (cherry picked from commit 645bc2cbd550829d43b460663b998b9d4685a2d2) Cherry picked from https://lisas.de/~adrian/slof/slof.git/ Signed-off-by: Adrian Reber <adrian@lisas.de> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-07-27tools: added initial version of sloffsAdrian Reber3-5/+299
sloffs is a tool to get information about the flash images created by the SLOF build process and it will also be able to modify those flash images (cherry picked from commit ec9f4acc3977a81289704fae0ad8bb62f3a93ab1) Cherry picked from https://lisas.de/~adrian/slof/slof.git/ Signed-off-by: Adrian Reber <adrian@lisas.de> [aik: squashed e1e52adb5, e6369bb10b, 4d6f40c47d, 82532ec08; fixed warnings] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-07-27romfs: factored out crc code, to make it usable from other locationsAdrian Reber4-263/+285
This moves the CRC code to its own files without dependencies on board specific parts of SLOF. That why it can also be used from other parts of the code. (cherry picked from commit e0c2a1d61a66309fd6f0cec7efadd7e988bd03ab) Cherry picked from https://lisas.de/~adrian/slof/slof.git/ Signed-off-by: Adrian Reber <adrian@lisas.de> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-07-27tools: remove unused parts from the MakefileAdrian Reber1-4/+1
(cherry picked from commit 56b5525adf5473195f890b2e932f39f0d17fed49) Cherry picked from https://lisas.de/~adrian/slof/slof.git/ Signed-off-by: Adrian Reber <adrian@lisas.de> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-07-25usb-hid: Fix non-working comma keyThomas Huth1-7/+0
Commit c8bd0cdce2bd ("Caps is not always shift") introduced a global "ctrl" variable and two new cases to handle the shift key in check_key_code() in usb-hid.c. However, one of these cases uses the key code for the "," key and thus prevents that key from working in the VGA console. The global ctrl variable that is set by these two cases is never read again, so this is apparently completely useless code, likely just an accidential leftover from debugging the original issue. So let's simply remove that bad code to get the comma key working again. Fixes: c8bd0cdce2bd7c4498d61079553c89747656614d Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-06-27fat-files: Fix access to FAT32 dir/files when cluster > 16-bitsBenjamin Herrenschmidt1-2/+11
On FAT32, the directory entry contains a new field providing the top 16-bits of the cluster number. We didn't use it, thus reading the wrong sectors when trying to access files or directories beyond block 0x10000. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reviewed-by: Thomas Huth <thuth@redhat.com> [aik: removed unrelated empty lines] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-06-27virtio-net: fix ring handling in receiveNikunj A Dadhania1-2/+4
A bug crept in while doing the virtio 1.0 enablement in commit 6e4d62c2 (virtio-net: enable virtio 1.0) + idx = virtio_modern16_to_cpu(&virtiodev, vq_rx.used->idx); [...] - vq_rx.avail->ring[vq_rx.avail->idx % vq_rx.size] = id - 1; + vq_rx.avail->ring[idx % vq_rx.size] = virtio_cpu_to_modern16(&virtiodev, id - 1); sync(); - vq_rx.avail->idx += 1; + vq_rx.avail->idx = virtio_cpu_to_modern16(&virtiodev, idx + 1); Should be using avail->idx in place of used->idx. 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>