コード例 #1
0
ファイル: tbfadt.c プロジェクト: oza/FreeBSD-7.3-dyntick
static void
AcpiTbConvertFadt (
    void)
{
    UINT8                       Pm1RegisterLength;
    ACPI_GENERIC_ADDRESS        *Target;
    ACPI_NATIVE_UINT            i;


    /* Update the local FADT table header length */

    AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);

    /* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */

    if (!AcpiGbl_FADT.XFacs)
    {
        AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;
    }

    if (!AcpiGbl_FADT.XDsdt)
    {
        AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;
    }

    /*
     * Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address
     * structures as necessary.
     */
    for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
    {
        Target = ACPI_ADD_PTR (
            ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, FadtInfoTable[i].Target);

        /* Expand only if the X target is null */

        if (!Target->Address)
        {
            AcpiTbInitGenericAddress (Target,
                *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length),
                (UINT64) *ACPI_ADD_PTR (UINT32, &AcpiGbl_FADT, FadtInfoTable[i].Source));
        }
    }

    /*
     * Calculate separate GAS structs for the PM1 Enable registers.
     * These addresses do not appear (directly) in the FADT, so it is
     * useful to calculate them once, here.
     *
     * The PM event blocks are split into two register blocks, first is the
     * PM Status Register block, followed immediately by the PM Enable Register
     * block. Each is of length (Pm1EventLength/2)
     */
    Pm1RegisterLength = (UINT8) ACPI_DIV_2 (AcpiGbl_FADT.Pm1EventLength);

    /* The PM1A register block is required */

    AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable, Pm1RegisterLength,
        (AcpiGbl_FADT.XPm1aEventBlock.Address + Pm1RegisterLength));

    /* The PM1B register block is optional, ignore if not present */

    if (AcpiGbl_FADT.XPm1bEventBlock.Address)
    {
        AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable, Pm1RegisterLength,
            (AcpiGbl_FADT.XPm1bEventBlock.Address + Pm1RegisterLength));
    }
}
コード例 #2
0
ファイル: tbfadt.c プロジェクト: 0day-ci/xen
static void __init acpi_tb_convert_fadt(void)
{
	u8 pm1_register_length;
	struct acpi_generic_address *target;
	acpi_native_uint i;

	/* Update the local FADT table header length */

	acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt);

	/* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */

	if (!acpi_gbl_FADT.Xfacs) {
		acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs;
	}

	if (!acpi_gbl_FADT.Xdsdt) {
		acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt;
	}

	/*
	 * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
	 * should be zero are indeed zero. This will workaround BIOSs that
	 * inadvertently place values in these fields.
	 *
	 * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at
	 * offset 45, 55, 95, and the word located at offset 109, 110.
	 */
	if (acpi_gbl_FADT.header.revision < 3) {
		acpi_gbl_FADT.preferred_profile = 0;
		acpi_gbl_FADT.pstate_control = 0;
		acpi_gbl_FADT.cst_control = 0;
		acpi_gbl_FADT.boot_flags = 0;
	}

	/*
	 * Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X"
	 * generic address structures as necessary.
	 */
	for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) {
		target =
		    ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT,
				 fadt_info_table[i].target);

		/* Expand only if the X target is null */

		if (!target->address) {
			acpi_tb_init_generic_address(target,
						     *ACPI_ADD_PTR(u8,
								   &acpi_gbl_FADT,
								   fadt_info_table
								   [i].length),
						     (u64) * ACPI_ADD_PTR(u32,
									  &acpi_gbl_FADT,
									  fadt_info_table
									  [i].
									  source));
		}
	}

	/*
	 * Calculate separate GAS structs for the PM1 Enable registers.
	 * These addresses do not appear (directly) in the FADT, so it is
	 * useful to calculate them once, here.
	 *
	 * The PM event blocks are split into two register blocks, first is the
	 * PM Status Register block, followed immediately by the PM Enable Register
	 * block. Each is of length (pm1_event_length/2)
	 */
	pm1_register_length = (u8) ACPI_DIV_2(acpi_gbl_FADT.pm1_event_length);

	/* The PM1A register block is required */

	acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable,
				     pm1_register_length,
				     (acpi_gbl_FADT.xpm1a_event_block.address +
				      pm1_register_length));
	/* Don't forget to copy space_id of the GAS */
	acpi_gbl_xpm1a_enable.space_id =
	    acpi_gbl_FADT.xpm1a_event_block.space_id;

	/* The PM1B register block is optional, ignore if not present */

	if (acpi_gbl_FADT.xpm1b_event_block.address) {
		acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
					     pm1_register_length,
					     (acpi_gbl_FADT.xpm1b_event_block.
					      address + pm1_register_length));
		/* Don't forget to copy space_id of the GAS */
		acpi_gbl_xpm1b_enable.space_id =
		    acpi_gbl_FADT.xpm1a_event_block.space_id;

	}
}
コード例 #3
0
ファイル: tbconvrt.c プロジェクト: andreiw/polaris
static void
AcpiTbConvertFadt1 (
    FADT_DESCRIPTOR         *LocalFadt,
    FADT_DESCRIPTOR_REV1    *OriginalFadt)
{

    /* ACPI 1.0 FACS */
    /* The BIOS stored FADT should agree with Revision 1.0 */

    /*
     * Copy the table header and the common part of the tables.
     *
     * The 2.0 table is an extension of the 1.0 table, so the entire 1.0
     * table can be copied first, then expand some fields to 64 bits.
     */
    ACPI_MEMCPY (LocalFadt, OriginalFadt, sizeof (FADT_DESCRIPTOR_REV1));

    /* Convert table pointers to 64-bit fields */

    ACPI_STORE_ADDRESS (LocalFadt->XFirmwareCtrl, LocalFadt->V1_FirmwareCtrl);
    ACPI_STORE_ADDRESS (LocalFadt->XDsdt, LocalFadt->V1_Dsdt);

    /*
     * System Interrupt Model isn't used in ACPI 2.0
     * (LocalFadt->Reserved1 = 0;)
     */

    /*
     * This field is set by the OEM to convey the preferred power management
     * profile to OSPM. It doesn't have any 1.0 equivalence.  Since we don't
     * know what kind of 32-bit system this is, we will use "unspecified".
     */
    LocalFadt->Prefer_PM_Profile = PM_UNSPECIFIED;

    /*
     * Processor Performance State Control. This is the value OSPM writes to
     * the SMI_CMD register to assume processor performance state control
     * responsibility. There isn't any equivalence in 1.0, leave it zeroed.
     */
    LocalFadt->PstateCnt = 0;

    /*
     * Support for the _CST object and C States change notification.
     * This data item hasn't any 1.0 equivalence so leave it zero.
     */
    LocalFadt->CstCnt = 0;

    /*
     * FADT Rev 2 was an interim FADT released between ACPI 1.0 and ACPI 2.0.
     * It primarily adds the FADT reset mechanism.
     */
    if ((OriginalFadt->Revision == 2) &&
        (OriginalFadt->Length == sizeof (FADT_DESCRIPTOR_REV2_MINUS)))
    {
        /*
         * Grab the entire generic address struct, plus the 1-byte reset value
         * that immediately follows.
         */
        ACPI_MEMCPY (&LocalFadt->ResetRegister,
            &(ACPI_CAST_PTR (FADT_DESCRIPTOR_REV2_MINUS,
                OriginalFadt))->ResetRegister,
            sizeof (ACPI_GENERIC_ADDRESS) + 1);
    }
    else
    {
        /*
         * Since there isn't any equivalence in 1.0 and since it is highly
         * likely that a 1.0 system has legacy support.
         */
        LocalFadt->IapcBootArch = BAF_LEGACY_DEVICES;
    }

    /*
     * Convert the V1.0 block addresses to V2.0 GAS structures
     */
    AcpiTbInitGenericAddress (&LocalFadt->XPm1aEvtBlk, LocalFadt->Pm1EvtLen,
                             (ACPI_PHYSICAL_ADDRESS)   LocalFadt->V1_Pm1aEvtBlk);
    AcpiTbInitGenericAddress (&LocalFadt->XPm1bEvtBlk, LocalFadt->Pm1EvtLen,
                             (ACPI_PHYSICAL_ADDRESS)   LocalFadt->V1_Pm1bEvtBlk);
    AcpiTbInitGenericAddress (&LocalFadt->XPm1aCntBlk, LocalFadt->Pm1CntLen,
                             (ACPI_PHYSICAL_ADDRESS)   LocalFadt->V1_Pm1aCntBlk);
    AcpiTbInitGenericAddress (&LocalFadt->XPm1bCntBlk, LocalFadt->Pm1CntLen,
                             (ACPI_PHYSICAL_ADDRESS)   LocalFadt->V1_Pm1bCntBlk);
    AcpiTbInitGenericAddress (&LocalFadt->XPm2CntBlk,  LocalFadt->Pm2CntLen,
                             (ACPI_PHYSICAL_ADDRESS)   LocalFadt->V1_Pm2CntBlk);
    AcpiTbInitGenericAddress (&LocalFadt->XPmTmrBlk,   LocalFadt->PmTmLen,
                             (ACPI_PHYSICAL_ADDRESS)   LocalFadt->V1_PmTmrBlk);
    AcpiTbInitGenericAddress (&LocalFadt->XGpe0Blk,    0,
                             (ACPI_PHYSICAL_ADDRESS)   LocalFadt->V1_Gpe0Blk);
    AcpiTbInitGenericAddress (&LocalFadt->XGpe1Blk,    0,
                             (ACPI_PHYSICAL_ADDRESS)   LocalFadt->V1_Gpe1Blk);

    /* Create separate GAS structs for the PM1 Enable registers */

    AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable,
         (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
         (ACPI_PHYSICAL_ADDRESS)
            (ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address) +
            ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));

    /* PM1B is optional; leave null if not present */

    if (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address))
    {
        AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable,
             (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
             (ACPI_PHYSICAL_ADDRESS)
                (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address) +
                ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
    }
}
コード例 #4
0
ファイル: tbconvrt.c プロジェクト: andreiw/polaris
static void
AcpiTbConvertFadt2 (
    FADT_DESCRIPTOR         *LocalFadt,
    FADT_DESCRIPTOR         *OriginalFadt)
{

    /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */

    ACPI_MEMCPY (LocalFadt, OriginalFadt, sizeof (FADT_DESCRIPTOR));

    /*
     * "X" fields are optional extensions to the original V1.0 fields, so
     * we must selectively expand V1.0 fields if the corresponding X field
     * is zero.
     */
    if (!(ACPI_GET_ADDRESS (LocalFadt->XFirmwareCtrl)))
    {
        ACPI_STORE_ADDRESS (LocalFadt->XFirmwareCtrl,
            LocalFadt->V1_FirmwareCtrl);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XDsdt)))
    {
        ACPI_STORE_ADDRESS (LocalFadt->XDsdt, LocalFadt->V1_Dsdt);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address)))
    {
        AcpiTbInitGenericAddress (&LocalFadt->XPm1aEvtBlk,
            LocalFadt->Pm1EvtLen,
            (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aEvtBlk);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address)))
    {
        AcpiTbInitGenericAddress (&LocalFadt->XPm1bEvtBlk,
            LocalFadt->Pm1EvtLen,
            (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bEvtBlk);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1aCntBlk.Address)))
    {
        AcpiTbInitGenericAddress (&LocalFadt->XPm1aCntBlk,
            LocalFadt->Pm1CntLen,
            (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aCntBlk);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1bCntBlk.Address)))
    {
        AcpiTbInitGenericAddress (&LocalFadt->XPm1bCntBlk,
            LocalFadt->Pm1CntLen,
            (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bCntBlk);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XPm2CntBlk.Address)))
    {
        AcpiTbInitGenericAddress (&LocalFadt->XPm2CntBlk,
            LocalFadt->Pm2CntLen,
            (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm2CntBlk);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XPmTmrBlk.Address)))
    {
        AcpiTbInitGenericAddress (&LocalFadt->XPmTmrBlk,
            LocalFadt->PmTmLen,
            (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_PmTmrBlk);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XGpe0Blk.Address)))
    {
        AcpiTbInitGenericAddress (&LocalFadt->XGpe0Blk,
            0, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe0Blk);
    }

    if (!(ACPI_GET_ADDRESS (LocalFadt->XGpe1Blk.Address)))
    {
        AcpiTbInitGenericAddress (&LocalFadt->XGpe1Blk,
            0, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe1Blk);
    }

    /* Create separate GAS structs for the PM1 Enable registers */

    AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable,
        (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
        (ACPI_PHYSICAL_ADDRESS)
            (ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address) +
            ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));

    AcpiGbl_XPm1aEnable.AddressSpaceId =
        LocalFadt->XPm1aEvtBlk.AddressSpaceId;

    /* PM1B is optional; leave null if not present */

    if (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address))
    {
        AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable,
            (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
            (ACPI_PHYSICAL_ADDRESS)
                (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address) +
                ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));

        AcpiGbl_XPm1bEnable.AddressSpaceId =
            LocalFadt->XPm1bEvtBlk.AddressSpaceId;
    }
}
コード例 #5
0
ファイル: tbfadt.c プロジェクト: samueldotj/AceOS
static void
AcpiTbConvertFadt (
    void)
{
    UINT8                       Pm1RegisterLength;
    ACPI_GENERIC_ADDRESS        *Target;
    ACPI_NATIVE_UINT            i;


    /* Update the local FADT table header length */

    AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);

    /* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */

    if (!AcpiGbl_FADT.XFacs)
    {
        AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;
    }

    if (!AcpiGbl_FADT.XDsdt)
    {
        AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;
    }

    /*
     * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
     * should be zero are indeed zero. This will workaround BIOSs that
     * inadvertently place values in these fields.
     *
     * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at
     * offset 45, 55, 95, and the word located at offset 109, 110.
     */
    if (AcpiGbl_FADT.Header.Revision < 3)
    {
        AcpiGbl_FADT.PreferredProfile = 0;
        AcpiGbl_FADT.PstateControl = 0;
        AcpiGbl_FADT.CstControl = 0;
        AcpiGbl_FADT.BootFlags = 0;
    }

    /*
     * Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X"
     * generic address structures as necessary.
     */
    for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
    {
        Target = ACPI_ADD_PTR (
            ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, FadtInfoTable[i].Target);

        /* Expand only if the X target is null */

        if (!Target->Address)
        {
            AcpiTbInitGenericAddress (Target,
                *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length),
                (UINT64) *ACPI_ADD_PTR (UINT32, &AcpiGbl_FADT, FadtInfoTable[i].Source));
        }
    }

    /*
     * Calculate separate GAS structs for the PM1 Enable registers.
     * These addresses do not appear (directly) in the FADT, so it is
     * useful to calculate them once, here.
     *
     * The PM event blocks are split into two register blocks, first is the
     * PM Status Register block, followed immediately by the PM Enable Register
     * block. Each is of length (Pm1EventLength/2)
     */
    Pm1RegisterLength = (UINT8) ACPI_DIV_2 (AcpiGbl_FADT.Pm1EventLength);

    /* The PM1A register block is required */

    AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable, Pm1RegisterLength,
        (AcpiGbl_FADT.XPm1aEventBlock.Address + Pm1RegisterLength));

    /* The PM1B register block is optional, ignore if not present */

    if (AcpiGbl_FADT.XPm1bEventBlock.Address)
    {
        AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable, Pm1RegisterLength,
            (AcpiGbl_FADT.XPm1bEventBlock.Address + Pm1RegisterLength));
    }
}