summaryrefslogtreecommitdiff
path: root/tools/quick_dump/chipset_macro_wrap.c
blob: ee79777e68a6e3b749df5f8a455de0c906292c0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdbool.h>
#include <stdlib.h>
#include <pciaccess.h>
#include "intel_chipset.h"

int is_sandybridge(unsigned short pciid)
{
	return IS_GEN6(pciid);
}

int is_ivybridge(unsigned short pciid)
{
	return IS_IVYBRIDGE(pciid);
}

int is_valleyview(unsigned short pciid)
{
	return IS_VALLEYVIEW(pciid);
}

int is_haswell(unsigned short pciid)
{
	return IS_HASWELL(pciid);
}

int is_broadwell(unsigned short pciid)
{
	return IS_BROADWELL(pciid);
}

/* Simple helper because I couldn't make this work in the script */
unsigned short pcidev_to_devid(struct pci_device *pdev)
{
	return pdev->device_id;
}

bool igt_check_boolean_env_var(const char *env_var, bool default_value)
{
	char *val;

	val = getenv(env_var);
	if (!val)
		return default_value;

	return atoi(val) != 0;
}