HomeFreeBSD

[PowerPC64LE] pseries: Fix input buffering logic.

Description

[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)

Details

Provenance
bdragonAuthored on Feb 25 2021, 6:55 PM
Parents
rGcc24f5bc6f6e: riscv: fix errors in some atomic type aliases
Branches
Unknown
Tags
Unknown