本文整理汇总了C++中ACPI_MOVE_64_TO_64函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_MOVE_64_TO_64函数的具体用法?C++ ACPI_MOVE_64_TO_64怎么用?C++ ACPI_MOVE_64_TO_64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_MOVE_64_TO_64函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acpi_hw_get_access_bit_width
static u8
acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)
{
u64 address;
if (!reg->access_width) {
/*
* Detect old register descriptors where only the bit_width field
* makes senses. The target address is copied to handle possible
* alignment issues.
*/
ACPI_MOVE_64_TO_64(&address, ®->address);
if (!reg->bit_offset && reg->bit_width &&
ACPI_IS_POWER_OF_TWO(reg->bit_width) &&
ACPI_IS_ALIGNED(reg->bit_width, 8) &&
ACPI_IS_ALIGNED(address, reg->bit_width)) {
return (reg->bit_width);
} else {
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
return (32);
} else {
return (max_bit_width);
}
}
} else {
return (1 << (reg->access_width + 2));
}
}
示例2: acpi_tb_init_generic_address
static void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
u8 space_id,
u8 byte_width, u64 address, char *register_name)
{
u8 bit_width;
/* Bit width field in the GAS is only one byte long, 255 max */
bit_width = (u8)(byte_width * 8);
if (byte_width > 31) { /* (31*8)=248 */
ACPI_ERROR((AE_INFO,
"%s - 32-bit FADT register is too long (%u bytes, %u bits) "
"to convert to GAS struct - 255 bits max, truncating",
register_name, byte_width, (byte_width * 8)));
bit_width = 255;
}
/*
* The 64-bit Address field is non-aligned in the byte packed
* GAS struct.
*/
ACPI_MOVE_64_TO_64(&generic_address->address, &address);
/* All other fields are byte-wide */
generic_address->space_id = space_id;
generic_address->bit_width = bit_width;
generic_address->bit_offset = 0;
generic_address->access_width = 0; /* Access width ANY */
}
示例3: AcpiHwValidateRegister
ACPI_STATUS
AcpiHwValidateRegister (
ACPI_GENERIC_ADDRESS *Reg,
UINT8 MaxBitWidth,
UINT64 *Address)
{
/* Must have a valid pointer to a GAS structure */
if (!Reg)
{
return (AE_BAD_PARAMETER);
}
/*
* Copy the target address. This handles possible alignment issues.
* Address must not be null. A null address also indicates an optional
* ACPI register that is not supported, so no error message.
*/
ACPI_MOVE_64_TO_64 (Address, &Reg->Address);
if (!(*Address))
{
return (AE_BAD_ADDRESS);
}
/* Validate the SpaceID */
if ((Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
(Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_IO))
{
ACPI_ERROR ((AE_INFO,
"Unsupported address space: 0x%X", Reg->SpaceId));
return (AE_SUPPORT);
}
/* Validate the BitWidth */
if ((Reg->BitWidth != 8) &&
(Reg->BitWidth != 16) &&
(Reg->BitWidth != 32) &&
(Reg->BitWidth != MaxBitWidth))
{
ACPI_ERROR ((AE_INFO,
"Unsupported register bit width: 0x%X", Reg->BitWidth));
return (AE_SUPPORT);
}
/* Validate the BitOffset. Just a warning for now. */
if (Reg->BitOffset != 0)
{
ACPI_WARNING ((AE_INFO,
"Unsupported register bit offset: 0x%X", Reg->BitOffset));
}
return (AE_OK);
}
示例4: acpi_hw_validate_register
acpi_status
acpi_hw_validate_register(struct acpi_generic_address *reg,
u8 max_bit_width, u64 *address)
{
u8 bit_width;
u8 access_width;
/* Must have a valid pointer to a GAS structure */
if (!reg) {
return (AE_BAD_PARAMETER);
}
/*
* Copy the target address. This handles possible alignment issues.
* Address must not be null. A null address also indicates an optional
* ACPI register that is not supported, so no error message.
*/
ACPI_MOVE_64_TO_64(address, ®->address);
if (!(*address)) {
return (AE_BAD_ADDRESS);
}
/* Validate the space_ID */
if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
(reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
ACPI_ERROR((AE_INFO,
"Unsupported address space: 0x%X", reg->space_id));
return (AE_SUPPORT);
}
/* Validate the access_width */
if (reg->access_width > 4) {
ACPI_ERROR((AE_INFO,
"Unsupported register access width: 0x%X",
reg->access_width));
return (AE_SUPPORT);
}
/* Validate the bit_width, convert access_width into number of bits */
access_width =
acpi_hw_get_access_bit_width(*address, reg, max_bit_width);
bit_width =
ACPI_ROUND_UP(reg->bit_offset + reg->bit_width, access_width);
if (max_bit_width < bit_width) {
ACPI_WARNING((AE_INFO,
"Requested bit width 0x%X is smaller than register bit width 0x%X",
max_bit_width, bit_width));
return (AE_SUPPORT);
}
return (AE_OK);
}
示例5: AcpiRsMoveData
void
AcpiRsMoveData (
void *Destination,
void *Source,
UINT16 ItemCount,
UINT8 MoveType)
{
UINT32 i;
ACPI_FUNCTION_ENTRY ();
/* One move per item */
for (i = 0; i < ItemCount; i++)
{
switch (MoveType)
{
/*
* For the 8-bit case, we can perform the move all at once
* since there are no alignment or endian issues
*/
case ACPI_RSC_MOVE8:
case ACPI_RSC_MOVE_GPIO_RES:
case ACPI_RSC_MOVE_SERIAL_VEN:
case ACPI_RSC_MOVE_SERIAL_RES:
ACPI_MEMCPY (Destination, Source, ItemCount);
return;
/*
* 16-, 32-, and 64-bit cases must use the move macros that perform
* endian conversion and/or accomodate hardware that cannot perform
* misaligned memory transfers
*/
case ACPI_RSC_MOVE16:
case ACPI_RSC_MOVE_GPIO_PIN:
ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i],
&ACPI_CAST_PTR (UINT16, Source)[i]);
break;
case ACPI_RSC_MOVE32:
ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
&ACPI_CAST_PTR (UINT32, Source)[i]);
break;
case ACPI_RSC_MOVE64:
ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i],
&ACPI_CAST_PTR (UINT64, Source)[i]);
break;
default:
return;
}
}
}
示例6: acpi_rs_move_data
void
acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
{
u32 i;
ACPI_FUNCTION_ENTRY();
/* One move per item */
for (i = 0; i < item_count; i++) {
switch (move_type) {
/*
* For the 8-bit case, we can perform the move all at once
* since there are no alignment or endian issues
*/
case ACPI_RSC_MOVE8:
case ACPI_RSC_MOVE_GPIO_RES:
case ACPI_RSC_MOVE_SERIAL_VEN:
case ACPI_RSC_MOVE_SERIAL_RES:
ACPI_MEMCPY(destination, source, item_count);
return;
/*
* 16-, 32-, and 64-bit cases must use the move macros that perform
* endian conversion and/or accommodate hardware that cannot perform
* misaligned memory transfers
*/
case ACPI_RSC_MOVE16:
case ACPI_RSC_MOVE_GPIO_PIN:
ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i],
&ACPI_CAST_PTR(u16, source)[i]);
break;
case ACPI_RSC_MOVE32:
ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i],
&ACPI_CAST_PTR(u32, source)[i]);
break;
case ACPI_RSC_MOVE64:
ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i],
&ACPI_CAST_PTR(u64, source)[i]);
break;
default:
return;
}
}
}
示例7: acpi_hw_validate_register
acpi_status
acpi_hw_validate_register(struct acpi_generic_address *reg,
u8 max_bit_width, u64 *address)
{
/* Must have a valid pointer to a GAS structure */
if (!reg) {
return (AE_BAD_PARAMETER);
}
/*
* Copy the target address. This handles possible alignment issues.
* Address must not be null. A null address also indicates an optional
* ACPI register that is not supported, so no error message.
*/
ACPI_MOVE_64_TO_64(address, ®->address);
if (!(*address)) {
return (AE_BAD_ADDRESS);
}
/* Validate the space_ID */
if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
(reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
ACPI_ERROR((AE_INFO,
"Unsupported address space: 0x%X", reg->space_id));
return (AE_SUPPORT);
}
/* Validate the bit_width */
if ((reg->bit_width != 8) &&
(reg->bit_width != 16) &&
(reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
ACPI_ERROR((AE_INFO,
"Unsupported register bit width: 0x%X",
reg->bit_width));
return (AE_SUPPORT);
}
/* Validate the bit_offset. Just a warning for now. */
if (reg->bit_offset != 0) {
ACPI_WARNING((AE_INFO,
"Unsupported register bit offset: 0x%X",
reg->bit_offset));
}
return (AE_OK);
}
示例8: acpi_ex_set_buffer_datum
void
acpi_ex_set_buffer_datum (
acpi_integer merged_datum,
void *buffer,
u32 buffer_length,
u32 byte_granularity,
u32 buffer_offset)
{
u32 index;
ACPI_FUNCTION_TRACE_U32 ("ex_set_buffer_datum", byte_granularity);
/* Get proper index into buffer (handles big/little endian) */
index = ACPI_BUFFER_INDEX (buffer_length, buffer_offset, byte_granularity);
/* Move the requested number of bytes */
switch (byte_granularity) {
case ACPI_FIELD_BYTE_GRANULARITY:
((u8 *) buffer) [index] = (u8) merged_datum;
break;
case ACPI_FIELD_WORD_GRANULARITY:
ACPI_MOVE_64_TO_16 (&(((u16 *) buffer)[index]), &merged_datum);
break;
case ACPI_FIELD_DWORD_GRANULARITY:
ACPI_MOVE_64_TO_32 (&(((u32 *) buffer)[index]), &merged_datum);
break;
case ACPI_FIELD_QWORD_GRANULARITY:
ACPI_MOVE_64_TO_64 (&(((u64 *) buffer)[index]), &merged_datum);
break;
default:
/* Should not get here */
break;
}
return_VOID;
}
示例9: AcpiTbInitGenericAddress
static void
AcpiTbInitGenericAddress (
ACPI_GENERIC_ADDRESS *GenericAddress,
UINT8 SpaceId,
UINT8 ByteWidth,
UINT64 Address,
char *RegisterName,
UINT8 Flags)
{
UINT8 BitWidth;
/*
* Bit width field in the GAS is only one byte long, 255 max.
* Check for BitWidth overflow in GAS.
*/
BitWidth = (UINT8) (ByteWidth * 8);
if (ByteWidth > 31) /* (31*8)=248, (32*8)=256 */
{
/*
* No error for GPE blocks, because we do not use the BitWidth
* for GPEs, the legacy length (ByteWidth) is used instead to
* allow for a large number of GPEs.
*/
if (!(Flags & ACPI_FADT_GPE_REGISTER))
{
ACPI_ERROR ((AE_INFO,
"%s - 32-bit FADT register is too long (%u bytes, %u bits) "
"to convert to GAS struct - 255 bits max, truncating",
RegisterName, ByteWidth, (ByteWidth * 8)));
}
BitWidth = 255;
}
/*
* The 64-bit Address field is non-aligned in the byte packed
* GAS struct.
*/
ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
/* All other fields are byte-wide */
GenericAddress->SpaceId = SpaceId;
GenericAddress->BitWidth = BitWidth;
GenericAddress->BitOffset = 0;
GenericAddress->AccessWidth = 0; /* Access width ANY */
}
示例10: acpi_tb_check_xsdt
static acpi_status
acpi_tb_check_xsdt(acpi_physical_address address)
{
struct acpi_table_header *table;
u32 length;
u64 xsdt_entry_address;
u8 *table_entry;
u32 table_count;
int i;
/* map table header, verify length */
table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
if (!table)
return AE_NO_MEMORY;
length = table->length; /* length of entire table, incl header */
acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
if (length < sizeof(struct acpi_table_header))
return AE_INVALID_TABLE_LENGTH;
/* map entire table, not just header */
table = acpi_os_map_memory(address, length);
if (!table)
return AE_NO_MEMORY;
/* Calculate the number of tables described in XSDT */
table_count =
(u32) ((table->length -
sizeof(struct acpi_table_header)) / sizeof(u64));
table_entry =
ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header);
for (i = 0; i < table_count; i++) {
ACPI_MOVE_64_TO_64(&xsdt_entry_address, table_entry);
if (!xsdt_entry_address) {
/* XSDT has NULL entry */
break;
}
table_entry += sizeof(u64);
}
acpi_os_unmap_memory(table, length);
if (i < table_count)
return AE_NULL_ENTRY;
else
return AE_OK;
}
示例11: acpi_tb_init_generic_address
static void inline
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
u8 bit_width, u64 address)
{
/*
* The 64-bit Address field is non-aligned in the byte packed
* GAS struct.
*/
ACPI_MOVE_64_TO_64(&generic_address->address, &address);
/* All other fields are byte-wide */
generic_address->space_id = ACPI_ADR_SPACE_SYSTEM_IO;
generic_address->bit_width = bit_width;
generic_address->bit_offset = 0;
generic_address->access_width = 0;
}
示例12: acpi_tb_init_generic_address
static ACPI_INLINE void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
u8 space_id, u8 byte_width, u64 address)
{
/*
* The 64-bit Address field is non-aligned in the byte packed
* GAS struct.
*/
ACPI_MOVE_64_TO_64(&generic_address->address, &address);
/* All other fields are byte-wide */
generic_address->space_id = space_id;
generic_address->bit_width = (u8)ACPI_MUL_8(byte_width);
generic_address->bit_offset = 0;
generic_address->access_width = 0; /* Access width ANY */
}
示例13: acpi_tb_check_xsdt
static acpi_status
acpi_tb_check_xsdt(acpi_physical_address address)
{
struct acpi_table_header *table;
u32 length;
u64 xsdt_entry_address;
u8 *table_entry;
u32 table_count;
int i;
table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
if (!table)
return AE_NO_MEMORY;
length = table->length;
acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
if (length < sizeof(struct acpi_table_header))
return AE_INVALID_TABLE_LENGTH;
table = acpi_os_map_memory(address, length);
if (!table)
return AE_NO_MEMORY;
table_count =
(u32) ((table->length -
sizeof(struct acpi_table_header)) / sizeof(u64));
table_entry =
ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header);
for (i = 0; i < table_count; i++) {
ACPI_MOVE_64_TO_64(&xsdt_entry_address, table_entry);
if (!xsdt_entry_address) {
break;
}
table_entry += sizeof(u64);
}
acpi_os_unmap_memory(table, length);
if (i < table_count)
return AE_NULL_ENTRY;
else
return AE_OK;
}
示例14: AcpiTbGetRootTableEntry
static ACPI_PHYSICAL_ADDRESS
AcpiTbGetRootTableEntry (
UINT8 *TableEntry,
UINT32 TableEntrySize)
{
UINT64 Address64;
/*
* Get the table physical address (32-bit for RSDT, 64-bit for XSDT):
* Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT
*/
if (TableEntrySize == ACPI_RSDT_ENTRY_SIZE)
{
/*
* 32-bit platform, RSDT: Return 32-bit table entry
* 64-bit platform, RSDT: Expand 32-bit to 64-bit and return
*/
return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (
UINT32, TableEntry)));
}
else
{
/*
* 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return
* 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
* return 64-bit
*/
ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
#if ACPI_MACHINE_WIDTH == 32
if (Address64 > ACPI_UINT32_MAX)
{
/* Will truncate 64-bit address to 32 bits, issue warning */
ACPI_BIOS_WARNING ((AE_INFO,
"64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X),"
" truncating",
ACPI_FORMAT_UINT64 (Address64)));
}
#endif
return ((ACPI_PHYSICAL_ADDRESS) (Address64));
}
}
示例15: acpi_tb_init_generic_address
static void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
u8 space_id,
u8 byte_width,
u64 address, const char *register_name, u8 flags)
{
u8 bit_width;
/*
* Bit width field in the GAS is only one byte long, 255 max.
* Check for bit_width overflow in GAS.
*/
bit_width = (u8)(byte_width * 8);
if (byte_width > 31) { /* (31*8)=248, (32*8)=256 */
/*
* No error for GPE blocks, because we do not use the bit_width
* for GPEs, the legacy length (byte_width) is used instead to
* allow for a large number of GPEs.
*/
if (!(flags & ACPI_FADT_GPE_REGISTER)) {
ACPI_ERROR((AE_INFO,
"%s - 32-bit FADT register is too long (%u bytes, %u bits) "
"to convert to GAS struct - 255 bits max, truncating",
register_name, byte_width,
(byte_width * 8)));
}
bit_width = 255;
}
/*
* The 64-bit Address field is non-aligned in the byte packed
* GAS struct.
*/
ACPI_MOVE_64_TO_64(&generic_address->address, &address);
/* All other fields are byte-wide */
generic_address->space_id = space_id;
generic_address->bit_width = bit_width;
generic_address->bit_offset = 0;
generic_address->access_width = 0; /* Access width ANY */
}