]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
[PowerPC64LE] pseries: Fix input buffering logic.
authorBrandon Bergren <bdragon@FreeBSD.org>
Thu, 25 Feb 2021 18:55:58 +0000 (12:55 -0600)
committerBrandon Bergren <bdragon@FreeBSD.org>
Mon, 8 Mar 2021 18:35:56 +0000 (12:35 -0600)
commit102e7117bcf32f9bee513f948815213575cfebd4
tree5761bd1c5bc8a4cf16871a8d4cb27b0fa5dfcb34
parentcc24f5bc6f6eb56a959bd23ebb051d3bf6ebf670
[PowerPC64LE] pseries: Fix input buffering logic.

In uart_phyp_get(), when the internal buffer is empty, we make a
hypercall to retrieve up to 16 bytes of input data from the
hypervisor. As this is specified to be returned in BE format, we need
to do a 64-bit byte swap on the first and second half of the data.

If the buffer being passed in was insufficient to return the fetched
data, we store the remainder in the internal buffer and use it to
satisfy the following calls to uart_phyp_get() until it is drained.

However, in this case, we were accidentally byteswapping the internal
buffer again.

Move the byteswapping code to just after the hypercall so it only gets
swapped when we're filling the buffer.

Fixes arrow keys in qemu on pseries, among other console oddities.

Sponsored by: Tag1 Consulting, Inc.

(cherry picked from commit 5001c579baff78719919d79ec054207aa2938dbd)
sys/powerpc/pseries/phyp_console.c