qemu/hw/s390x/s390-pci-inst.c
/**
 * Swap data contained in s390x big endian registers to little endian
 * PCI bars.
 *
 * @ptr: a pointer to a uint64_t data field
 * @len: the length of the valid data, must be 1,2,4 or 8
 */
Swap data contained in s390x big endian registers to little endian
PCI bars.

@ptr: a pointer to a uint64_t data field
@len: the length of the valid data, must be 1,2,4 or 8
Swap data contained in s390x big endian registers to little endian PCI bars . @ptr : a pointer to a uint64_t data field @len : the length of the valid data must be 1 2 4 or 8
static int zpci_endian_swap(uint64_t *ptr, uint8_t len)
{
    uint64_t data = *ptr;
    switch (len) {
    case 1:
        break;
    case 2:
        data = bswap16(data);
        break;
    case 4:
        data = bswap32(data);
        break;
    case 8:
        data = bswap64(data);
        break;
    default:
        return -EINVAL;
    }
    *ptr = data;
    return 0;
}
static int zpci_endian_swap ( uint64_t * ptr , uint8_t len ) { uint64_t data = * ptr ; switch ( len ) { case 1 : break ; case 2 : data = bswap16 ( data ) ; break ; case 4 : data = bswap32 ( data ) ; break ; case 8 : data = bswap64 ( data ) ; break ; default : return - EINVAL ; } * ptr = data ; return 0 ; }
Swap data contained in s390x big endian registers to little endian
 PCI bars.
Swap data contained in s390x big endian registers to little endian PCI bars .