]> 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>
Thu, 25 Feb 2021 20:50:13 +0000 (14:50 -0600)
commit5001c579baff78719919d79ec054207aa2938dbd
tree70a7f19191d60a0baed523497827a2f0c7bffb99
parentd7671ad8d6ebe205933628466dc0a52d32eea2e8
[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.
MFC after: 3 days
sys/powerpc/pseries/phyp_console.c