Changeset View
Changeset View
Standalone View
Standalone View
stable/10/sys/dev/ixl/i40e_lan_hmc.c
Show First 20 Lines • Show All 764 Lines • ▼ Show 20 Lines | static void i40e_write_byte(u8 *hmc_bits, | ||||
u8 *from, *dest; | u8 *from, *dest; | ||||
u16 shift_width; | u16 shift_width; | ||||
/* copy from the next struct field */ | /* copy from the next struct field */ | ||||
from = src + ce_info->offset; | from = src + ce_info->offset; | ||||
/* prepare the bits and mask */ | /* prepare the bits and mask */ | ||||
shift_width = ce_info->lsb % 8; | shift_width = ce_info->lsb % 8; | ||||
mask = BIT(ce_info->width) - 1; | mask = (u8)(BIT(ce_info->width) - 1); | ||||
src_byte = *from; | src_byte = *from; | ||||
src_byte &= mask; | src_byte &= mask; | ||||
/* shift to correct alignment */ | /* shift to correct alignment */ | ||||
mask <<= shift_width; | mask <<= shift_width; | ||||
src_byte <<= shift_width; | src_byte <<= shift_width; | ||||
▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | static void i40e_read_byte(u8 *hmc_bits, | ||||
u8 *dest) | u8 *dest) | ||||
{ | { | ||||
u8 dest_byte, mask; | u8 dest_byte, mask; | ||||
u8 *src, *target; | u8 *src, *target; | ||||
u16 shift_width; | u16 shift_width; | ||||
/* prepare the bits and mask */ | /* prepare the bits and mask */ | ||||
shift_width = ce_info->lsb % 8; | shift_width = ce_info->lsb % 8; | ||||
mask = BIT(ce_info->width) - 1; | mask = (u8)(BIT(ce_info->width) - 1); | ||||
/* shift to correct alignment */ | /* shift to correct alignment */ | ||||
mask <<= shift_width; | mask <<= shift_width; | ||||
/* get the current bits from the src bit string */ | /* get the current bits from the src bit string */ | ||||
src = hmc_bits + (ce_info->lsb / 8); | src = hmc_bits + (ce_info->lsb / 8); | ||||
i40e_memcpy(&dest_byte, src, sizeof(dest_byte), I40E_DMA_TO_NONDMA); | i40e_memcpy(&dest_byte, src, sizeof(dest_byte), I40E_DMA_TO_NONDMA); | ||||
▲ Show 20 Lines • Show All 446 Lines • Show Last 20 Lines |