Exemplo n.º 1
0
static UINT8 *
OpcEncodePldBuffer (
    ACPI_PLD_INFO           *PldInfo)
{
    UINT32                  *Buffer;
    UINT32                  Dword;


    Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
    if (!Buffer)
    {
        return (NULL);
    }

    /* First 32 bits */

    Dword = 0;
    ACPI_PLD_SET_REVISION       (&Dword, PldInfo->Revision);
    ACPI_PLD_SET_IGNORE_COLOR   (&Dword, PldInfo->IgnoreColor);
    ACPI_PLD_SET_RED            (&Dword, PldInfo->Red);
    ACPI_PLD_SET_GREEN          (&Dword, PldInfo->Green);
    ACPI_PLD_SET_BLUE           (&Dword, PldInfo->Blue);
    ACPI_MOVE_32_TO_32          (&Buffer[0], &Dword);

    /* Second 32 bits */

    Dword = 0;
    ACPI_PLD_SET_WIDTH          (&Dword, PldInfo->Width);
    ACPI_PLD_SET_HEIGHT         (&Dword, PldInfo->Height);
    ACPI_MOVE_32_TO_32          (&Buffer[1], &Dword);

    /* Third 32 bits */

    Dword = 0;
    ACPI_PLD_SET_USER_VISIBLE   (&Dword, PldInfo->UserVisible);
    ACPI_PLD_SET_DOCK           (&Dword, PldInfo->Dock);
    ACPI_PLD_SET_LID            (&Dword, PldInfo->Lid);
    ACPI_PLD_SET_PANEL          (&Dword, PldInfo->Panel);
    ACPI_PLD_SET_VERTICAL       (&Dword, PldInfo->VerticalPosition);
    ACPI_PLD_SET_HORIZONTAL     (&Dword, PldInfo->HorizontalPosition);
    ACPI_PLD_SET_SHAPE          (&Dword, PldInfo->Shape);
    ACPI_PLD_SET_ORIENTATION    (&Dword, PldInfo->GroupOrientation);
    ACPI_PLD_SET_TOKEN          (&Dword, PldInfo->GroupToken);
    ACPI_PLD_SET_POSITION       (&Dword, PldInfo->GroupPosition);
    ACPI_PLD_SET_BAY            (&Dword, PldInfo->Bay);
    ACPI_MOVE_32_TO_32          (&Buffer[2], &Dword);

    /* Fourth 32 bits */

    Dword = 0;
    ACPI_PLD_SET_EJECTABLE      (&Dword, PldInfo->Ejectable);
    ACPI_PLD_SET_OSPM_EJECT     (&Dword, PldInfo->OspmEjectRequired);
    ACPI_PLD_SET_CABINET        (&Dword, PldInfo->CabinetNumber);
    ACPI_PLD_SET_CARD_CAGE      (&Dword, PldInfo->CardCageNumber);
    ACPI_PLD_SET_REFERENCE      (&Dword, PldInfo->Reference);
    ACPI_PLD_SET_ROTATION       (&Dword, PldInfo->Rotation);
    ACPI_PLD_SET_ORDER          (&Dword, PldInfo->Order);
    ACPI_MOVE_32_TO_32          (&Buffer[3], &Dword);

    if (PldInfo->Revision >= 2)
    {
        /* Fifth 32 bits */

        Dword = 0;
        ACPI_PLD_SET_VERT_OFFSET    (&Dword, PldInfo->VerticalOffset);
        ACPI_PLD_SET_HORIZ_OFFSET   (&Dword, PldInfo->HorizontalOffset);
        ACPI_MOVE_32_TO_32          (&Buffer[4], &Dword);
    }

    return (ACPI_CAST_PTR (UINT8, Buffer));
}
Exemplo n.º 2
0
u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info)
{
	u32 *buffer;
	u32 dword;

	buffer = ACPI_ALLOCATE_ZEROED(ACPI_PLD_BUFFER_SIZE);
	if (!buffer) {
		return (NULL);
	}

	/* First 32 bits */

	dword = 0;
	ACPI_PLD_SET_REVISION(&dword, pld_info->revision);
	ACPI_PLD_SET_IGNORE_COLOR(&dword, pld_info->ignore_color);
	ACPI_PLD_SET_RED(&dword, pld_info->red);
	ACPI_PLD_SET_GREEN(&dword, pld_info->green);
	ACPI_PLD_SET_BLUE(&dword, pld_info->blue);
	ACPI_MOVE_32_TO_32(&buffer[0], &dword);

	/* Second 32 bits */

	dword = 0;
	ACPI_PLD_SET_WIDTH(&dword, pld_info->width);
	ACPI_PLD_SET_HEIGHT(&dword, pld_info->height);
	ACPI_MOVE_32_TO_32(&buffer[1], &dword);

	/* Third 32 bits */

	dword = 0;
	ACPI_PLD_SET_USER_VISIBLE(&dword, pld_info->user_visible);
	ACPI_PLD_SET_DOCK(&dword, pld_info->dock);
	ACPI_PLD_SET_LID(&dword, pld_info->lid);
	ACPI_PLD_SET_PANEL(&dword, pld_info->panel);
	ACPI_PLD_SET_VERTICAL(&dword, pld_info->vertical_position);
	ACPI_PLD_SET_HORIZONTAL(&dword, pld_info->horizontal_position);
	ACPI_PLD_SET_SHAPE(&dword, pld_info->shape);
	ACPI_PLD_SET_ORIENTATION(&dword, pld_info->group_orientation);
	ACPI_PLD_SET_TOKEN(&dword, pld_info->group_token);
	ACPI_PLD_SET_POSITION(&dword, pld_info->group_position);
	ACPI_PLD_SET_BAY(&dword, pld_info->bay);
	ACPI_MOVE_32_TO_32(&buffer[2], &dword);

	/* Fourth 32 bits */

	dword = 0;
	ACPI_PLD_SET_EJECTABLE(&dword, pld_info->ejectable);
	ACPI_PLD_SET_OSPM_EJECT(&dword, pld_info->ospm_eject_required);
	ACPI_PLD_SET_CABINET(&dword, pld_info->cabinet_number);
	ACPI_PLD_SET_CARD_CAGE(&dword, pld_info->card_cage_number);
	ACPI_PLD_SET_REFERENCE(&dword, pld_info->reference);
	ACPI_PLD_SET_ROTATION(&dword, pld_info->rotation);
	ACPI_PLD_SET_ORDER(&dword, pld_info->order);
	ACPI_MOVE_32_TO_32(&buffer[3], &dword);

	if (pld_info->revision >= 2) {

		/* Fifth 32 bits */

		dword = 0;
		ACPI_PLD_SET_VERT_OFFSET(&dword, pld_info->vertical_offset);
		ACPI_PLD_SET_HORIZ_OFFSET(&dword, pld_info->horizontal_offset);
		ACPI_MOVE_32_TO_32(&buffer[4], &dword);
	}

	return (ACPI_CAST_PTR(u8, buffer));
}