Exemplo n.º 1
0
static int __init
agp_hp_init (void)
{

	acpi_get_devices("HWP0003", zx1_gart_probe, "HWP0003", NULL);
	if (hp_zx1_gart_found)
		return 0;

	acpi_get_devices("HWP0007", zx1_gart_probe, "HWP0007", NULL);
	if (hp_zx1_gart_found)
		return 0;

	return -ENODEV;
}
Exemplo n.º 2
0
int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
			  struct resource *res)
{
	struct acpi_device *adev;
	acpi_status status;
	acpi_handle handle;
	int ret;

	status = acpi_get_devices(hid, acpi_match_rc, &segment, &handle);
	if (ACPI_FAILURE(status)) {
		dev_err(dev, "can't find _HID %s device to locate resources\n",
			hid);
		return -ENODEV;
	}

	ret = acpi_bus_get_device(handle, &adev);
	if (ret)
		return ret;

	ret = acpi_get_rc_addr(adev, res);
	if (ret) {
		dev_err(dev, "can't get resource from %s\n",
			dev_name(&adev->dev));
		return ret;
	}

	return 0;
}
Exemplo n.º 3
0
static int snd_cht_mc_probe(struct platform_device *pdev)
{
    int ret_val = 0;
    bool found = false;
    struct cht_mc_private *drv;

    drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
    if (!drv)
        return -ENOMEM;

    if (ACPI_SUCCESS(acpi_get_devices(
                         "104C227E",
                         snd_acpi_codec_match,
                         &found, NULL)) && found) {
        drv->ts3a227e_present = true;
    } else {
        /* no need probe TI jack detection chip */
        snd_soc_card_cht.aux_dev = NULL;
        snd_soc_card_cht.num_aux_devs = 0;
        drv->ts3a227e_present = false;
    }

    /* register the soc card */
    snd_soc_card_cht.dev = &pdev->dev;
    snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
    ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
    if (ret_val) {
        dev_err(&pdev->dev,
                "snd_soc_register_card failed %d\n", ret_val);
        return ret_val;
    }
    platform_set_drvdata(pdev, &snd_soc_card_cht);
    return ret_val;
}
static int __init check_acpi_ids(struct acpi_processor *pr_backup)
{

	if (!pr_backup)
		return -ENODEV;

	/* All online CPUs have been processed at this stage. Now verify
	 * whether in fact "online CPUs" == physical CPUs.
	 */
	acpi_id_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL);
	if (!acpi_id_present)
		return -ENOMEM;

	acpi_id_cst_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL);
	if (!acpi_id_cst_present) {
		kfree(acpi_id_present);
		return -ENOMEM;
	}

	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
			    ACPI_UINT32_MAX,
			    read_acpi_id, NULL, NULL, NULL);
	acpi_get_devices("ACPI0007", read_acpi_id, NULL, NULL);

	if (!bitmap_equal(acpi_id_present, acpi_ids_done, nr_acpi_bits)) {
		unsigned int i;
		for_each_set_bit(i, acpi_id_present, nr_acpi_bits) {
			pr_backup->acpi_id = i;
			/* Mask out C-states if there are no _CST or PBLK */
			pr_backup->flags.power = test_bit(i, acpi_id_cst_present);
			(void)upload_pm_data(pr_backup);
		}
static int __init check_acpi_ids(struct acpi_processor *pr_backup)
{

	if (!pr_backup)
		return -ENODEV;

	acpi_id_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL);
	if (!acpi_id_present)
		return -ENOMEM;

	acpi_id_cst_present = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL);
	if (!acpi_id_cst_present) {
		kfree(acpi_id_present);
		return -ENOMEM;
	}

	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
			    ACPI_UINT32_MAX,
			    read_acpi_id, NULL, NULL, NULL);
	acpi_get_devices("ACPI0007", read_acpi_id, NULL, NULL);

	if (!bitmap_equal(acpi_id_present, acpi_ids_done, nr_acpi_bits)) {
		unsigned int i;
		for_each_set_bit(i, acpi_id_present, nr_acpi_bits) {
			pr_backup->acpi_id = i;
			
			pr_backup->flags.power = test_bit(i, acpi_id_cst_present);
			(void)upload_pm_data(pr_backup);
		}
void __init acpi_early_processor_set_pdc(void)
{
	dmi_check_system(processor_idle_dmi_table);

	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
			    ACPI_UINT32_MAX,
			    early_init_pdc, NULL, NULL, NULL);
	acpi_get_devices("ACPI0007", early_init_pdc, NULL, NULL);
}
Exemplo n.º 7
0
void __init acpi_early_processor_set_pdc(void)
{
	processor_dmi_check();

	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
			    ACPI_UINT32_MAX,
			    early_init_pdc, NULL, NULL, NULL);
	acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, early_init_pdc, NULL, NULL);
}
Exemplo n.º 8
0
static void __init acpi_processor_check_duplicates(void)
{
	/* check the correctness for all processors in ACPI namespace */
	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
						ACPI_UINT32_MAX,
						acpi_processor_ids_walk,
						NULL, NULL, NULL);
	acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_ids_walk,
						NULL, NULL);
}
Exemplo n.º 9
0
/** \brief get a different video handle in ACPI namespace
 * \param handle acpi handle for current video handle
 * \return alternate acpi video handle
 */
KCL_ACPI_DevHandle ATI_API_CALL KCL_ACPI_GetAlternateHandle(KCL_ACPI_DevHandle pHandle)
{
	acpi_status status;
    KCL_ACPI_DevHandle retHandle = NULL;
    status = acpi_get_devices(NULL, (acpi_walk_callback)KCL_ACPI_SearchAlternateHandle, pHandle, &retHandle);
    if ( ACPI_FAILURE(status) )
    {
        return NULL;
    }
    return retHandle;
}
Exemplo n.º 10
0
static int eeepc_wmi_check_atkd(void)
{
	acpi_status status;
	bool found = false;

	status = acpi_get_devices(EEEPC_ACPI_HID, eeepc_wmi_parse_device,
				  &found, NULL);

	if (ACPI_FAILURE(status) || !found)
		return 0;
	return -1;
}
Exemplo n.º 11
0
int __init pnpacpi_init(void)
{
	if (acpi_disabled || pnpacpi_disabled) {
		pnp_info("PnP ACPI: disabled");
		return 0;
	}
	pnp_info("PnP ACPI init");
	pnp_register_protocol(&pnpacpi_protocol);
	acpi_get_devices(NULL, pnpacpi_add_device_handler, NULL, NULL);
	pnp_info("PnP ACPI: found %d devices", num);
	return 0;
}
Exemplo n.º 12
0
bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
				struct snd_soc_acpi_package_context *ctx)
{
	acpi_status status;

	status = acpi_get_devices(hid, snd_soc_acpi_find_package, ctx, NULL);

	if (ACPI_FAILURE(status) || !ctx->data_valid)
		return false;

	return true;
}
Exemplo n.º 13
0
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
{
	struct sst_acpi_mach *mach;
	bool found = false;

	for (mach = machines; mach->id[0]; mach++)
		if (ACPI_SUCCESS(acpi_get_devices(mach->id,
						  sst_acpi_mach_match,
						  &found, NULL)) && found)
			return mach;
	return NULL;
}
Exemplo n.º 14
0
void __init acpi_early_processor_set_pdc(void)
{
	/*
	 * Check whether the system is DMI table. If yes, OSPM
	 * should not use mwait for CPU-states.
	 */
	dmi_check_system(processor_idle_dmi_table);

	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
			    ACPI_UINT32_MAX,
			    early_init_pdc, NULL, NULL, NULL);
	acpi_get_devices("ACPI0007", early_init_pdc, NULL, NULL);
}
Exemplo n.º 15
0
const char *sst_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
{
	const char *name = NULL;
	acpi_status status;

	status = acpi_get_devices(hid, sst_acpi_find_name, NULL,
				  (void **)&name);

	if (ACPI_FAILURE(status) || name[0] == '\0')
		return NULL;

	return name;
}
Exemplo n.º 16
0
Arquivo: core.c Projeto: 274914765/C
static int __init pnpacpi_init(void)
{
    if (acpi_disabled || pnpacpi_disabled) {
        pnp_info("PnP ACPI: disabled");
        return 0;
    }
    pnp_info("PnP ACPI init");
    pnp_register_protocol(&pnpacpi_protocol);
    register_acpi_bus_type(&acpi_pnp_bus);
    acpi_get_devices(NULL, pnpacpi_add_device_handler, NULL, NULL);
    pnp_info("PnP ACPI: found %d devices", num);
    unregister_acpi_bus_type(&acpi_pnp_bus);
    pnp_platform_devices = 1;
    return 0;
}
Exemplo n.º 17
0
/**
 * pci_osc_support_set - register OS support to Firmware
 * @flags: OS support bits
 *
 * Update OS support fields and doing a _OSC Query to obtain an update
 * from Firmware on supported control bits.
 **/
acpi_status pci_osc_support_set(u32 flags)
{
    u32 temp;

    if (!(flags & OSC_SUPPORT_MASKS)) {
        return AE_TYPE;
    }
    ctrlset_buf[OSC_SUPPORT_TYPE] |= (flags & OSC_SUPPORT_MASKS);

    /* do _OSC query for all possible controls */
    temp = ctrlset_buf[OSC_CONTROL_TYPE];
    ctrlset_buf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
    ctrlset_buf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS;
    acpi_get_devices ( PCI_ROOT_HID_STRING,
                       acpi_query_osc,
                       ctrlset_buf,
                       NULL );
    ctrlset_buf[OSC_QUERY_TYPE] = !OSC_QUERY_ENABLE;
    ctrlset_buf[OSC_CONTROL_TYPE] = temp;
    return AE_OK;
}
Exemplo n.º 18
0
unsigned int ATI_API_CALL KCL_ACPI_GetHandles(kcl_match_info_t *pInfo)
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
    pInfo->video_handle = pInfo->pcidev->dev.acpi_node.handle;
#else
    pInfo->video_handle = pInfo->pcidev->dev.acpi_node.companion;
#endif
    #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
        pInfo->video_handle = pInfo->pcidev->dev.archdata.acpi_handle;
    #else 
        pInfo->video_handle = pInfo->pcidev->dev.firmware_data;
    #endif    
    if ( pInfo->video_handle &&
        (KCL_ACPI_videoDevice(pInfo->video_handle) != KCL_ACPI_OK) )
    {
        KCL_DEBUG1(FN_FIREGL_KCL, "Video handle doesn't have ACPI function: %p for video device: %p\n", pInfo->video_handle, pInfo->pcidev);
        pInfo->video_handle = NULL;
    }
#endif
    return acpi_get_devices(NULL, (acpi_walk_callback)KCL_ACPI_SearchHandles, pInfo, NULL);
}
Exemplo n.º 19
0
/**
 * pci_osc_control_set - commit requested control to Firmware
 * @flags: driver's requested control bits
 *
 * Attempt to take control from Firmware on requested control bits.
 **/
acpi_status pci_osc_control_set(u32 flags)
{
    acpi_status	status;
    u32		ctrlset;

    ctrlset = (flags & OSC_CONTROL_MASKS);
    if (!ctrlset) {
        return AE_TYPE;
    }
    if (ctrlset_buf[OSC_SUPPORT_TYPE] &&
            ((global_ctrlsets & ctrlset) != ctrlset)) {
        return AE_SUPPORT;
    }
    ctrlset_buf[OSC_CONTROL_TYPE] |= ctrlset;
    status = acpi_get_devices ( PCI_ROOT_HID_STRING,
                                acpi_run_osc,
                                ctrlset_buf,
                                NULL );
    if (ACPI_FAILURE (status)) {
        ctrlset_buf[OSC_CONTROL_TYPE] &= ~ctrlset;
    }

    return status;
}
Exemplo n.º 20
0
Arquivo: fwdt.c Projeto: acelan/fwdt
static int fwdt_setup(struct platform_device *device)
{
	int err;
	acpi_status status;

	err = device_create_file(&device->dev, &dev_attr_acpi_method);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_acpi_arg0);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_acpi_method_1_1);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_acpi_method_0_1);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_acpi_method_0_0);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_video_device);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_video_brightness);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_mem_address);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_mem_data);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_iow_address);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_iow_data);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_iob_address);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_iob_data);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_pci_id);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_pci_reg);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_pci_data);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_cmos);
	if (err)
		goto add_sysfs_error;
	err = device_create_file(&device->dev, &dev_attr_msr);
	if (err)
		goto add_sysfs_error;

	status = acpi_get_devices("PNP0C09", acpi_handle_locate_callback,
				  NULL, &ec_device);
	if (ACPI_SUCCESS(status)) {
		if (!ec_device)
			goto add_sysfs_done;
		err = device_create_file(&device->dev, &dev_attr_ec_address);
		if (err)
			goto add_sysfs_error;
		err = device_create_file(&device->dev, &dev_attr_ec_data);
		if (err)
			goto add_sysfs_error;
		err = device_create_file(&device->dev, &dev_attr_ec_qmethod);
		if (err)
			goto add_sysfs_error;
	}

add_sysfs_done:

	return 0;

add_sysfs_error:
	cleanup_sysfs(device);
	return err;
}
Exemplo n.º 21
0
static int __init
acpi_map_iosapics (void)
{
	acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL);
	return 0;
}
Exemplo n.º 22
0
static acpi_status __init acpi_hwp_native_thermal_lvt_osc(acpi_handle handle,
							  u32 lvl,
							  void *context,
							  void **rv)
{
	u8 sb_uuid_str[] = "4077A616-290C-47BE-9EBD-D87058713953";
	u32 capbuf[2];
	struct acpi_osc_context osc_context = {
		.uuid_str = sb_uuid_str,
		.rev = 1,
		.cap.length = 8,
		.cap.pointer = capbuf,
	};

	if (acpi_hwp_native_thermal_lvt_set)
		return AE_CTRL_TERMINATE;

	capbuf[0] = 0x0000;
	capbuf[1] = 0x1000; /* set bit 12 */

	if (ACPI_SUCCESS(acpi_run_osc(handle, &osc_context))) {
		if (osc_context.ret.pointer && osc_context.ret.length > 1) {
			u32 *capbuf_ret = osc_context.ret.pointer;

			if (capbuf_ret[1] & 0x1000) {
				acpi_handle_info(handle,
					"_OSC native thermal LVT Acked\n");
				acpi_hwp_native_thermal_lvt_set = true;
			}
		}
		kfree(osc_context.ret.pointer);
	}

	return AE_OK;
}

void __init acpi_early_processor_osc(void)
{
	if (boot_cpu_has(X86_FEATURE_HWP)) {
		acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
				    ACPI_UINT32_MAX,
				    acpi_hwp_native_thermal_lvt_osc,
				    NULL, NULL, NULL);
		acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID,
				 acpi_hwp_native_thermal_lvt_osc,
				 NULL, NULL);
	}
}
#endif

/*
 * The following ACPI IDs are known to be suitable for representing as
 * processor devices.
 */
static const struct acpi_device_id processor_device_ids[] = {

	{ ACPI_PROCESSOR_OBJECT_HID, },
	{ ACPI_PROCESSOR_DEVICE_HID, },

	{ }
};

static struct acpi_scan_handler processor_handler = {
	.ids = processor_device_ids,
	.attach = acpi_processor_add,
#ifdef CONFIG_ACPI_HOTPLUG_CPU
	.detach = acpi_processor_remove,
#endif
	.hotplug = {
		.enabled = true,
	},
};

static int acpi_processor_container_attach(struct acpi_device *dev,
					   const struct acpi_device_id *id)
{
	return 1;
}

static const struct acpi_device_id processor_container_ids[] = {
	{ ACPI_PROCESSOR_CONTAINER_HID, },
	{ }
};

static struct acpi_scan_handler processor_container_handler = {
	.ids = processor_container_ids,
	.attach = acpi_processor_container_attach,
};

/* The number of the unique processor IDs */
static int nr_unique_ids __initdata;

/* The number of the duplicate processor IDs */
static int nr_duplicate_ids;

/* Used to store the unique processor IDs */
static int unique_processor_ids[] __initdata = {
	[0 ... NR_CPUS - 1] = -1,
};

/* Used to store the duplicate processor IDs */
static int duplicate_processor_ids[] = {
	[0 ... NR_CPUS - 1] = -1,
};

static void __init processor_validated_ids_update(int proc_id)
{
	int i;

	if (nr_unique_ids == NR_CPUS||nr_duplicate_ids == NR_CPUS)
		return;

	/*
	 * Firstly, compare the proc_id with duplicate IDs, if the proc_id is
	 * already in the IDs, do nothing.
	 */
	for (i = 0; i < nr_duplicate_ids; i++) {
		if (duplicate_processor_ids[i] == proc_id)
			return;
	}

	/*
	 * Secondly, compare the proc_id with unique IDs, if the proc_id is in
	 * the IDs, put it in the duplicate IDs.
	 */
	for (i = 0; i < nr_unique_ids; i++) {
		if (unique_processor_ids[i] == proc_id) {
			duplicate_processor_ids[nr_duplicate_ids] = proc_id;
			nr_duplicate_ids++;
			return;
		}
	}

	/*
	 * Lastly, the proc_id is a unique ID, put it in the unique IDs.
	 */
	unique_processor_ids[nr_unique_ids] = proc_id;
	nr_unique_ids++;
}

static acpi_status __init acpi_processor_ids_walk(acpi_handle handle,
						  u32 lvl,
						  void *context,
						  void **rv)
{
	acpi_status status;
	acpi_object_type acpi_type;
	unsigned long long uid;
	union acpi_object object = { 0 };
	struct acpi_buffer buffer = { sizeof(union acpi_object), &object };

	status = acpi_get_type(handle, &acpi_type);
	if (ACPI_FAILURE(status))
		return status;

	switch (acpi_type) {
	case ACPI_TYPE_PROCESSOR:
		status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
		if (ACPI_FAILURE(status))
			goto err;
		uid = object.processor.proc_id;
		break;

	case ACPI_TYPE_DEVICE:
		status = acpi_evaluate_integer(handle, "_UID", NULL, &uid);
		if (ACPI_FAILURE(status))
			goto err;
		break;
	default:
		goto err;
	}

	processor_validated_ids_update(uid);
	return AE_OK;

err:
	/* Exit on error, but don't abort the namespace walk */
	acpi_handle_info(handle, "Invalid processor object\n");
	return AE_OK;

}
Exemplo n.º 23
0
static void acpi_map_iosapics(void)
{
	acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL);
}