aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amdfalconx86/recipes-kernel/linux/files/0002-yocto-amd-i2c-dev-add-calls-to-enable-and-disable-IMC-from-fetching-BIOS-code.patch
blob: 3fd0e5a4ccac49fd7780f316de0667f70a2c30f6 (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
The patch adds support to disable IMC from fetching BIOS code when
we first open the SMBus device. We can perform SMBus transaction
safely once IMC is disabled. Then when we close the device after
the operation, we enable IMC to start fetching from BIOS ROM again.

upstream status: None

Signed-off-by: Arindam Nath <arindam.nath@amd.com>
Signed-off-by: Sanjay Mehta <sanju.mehta@amd.com>
diff -Naur a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c	2014-03-31 09:10:15.000000000 +0530
+++ b/drivers/i2c/i2c-dev.c	2014-11-17 15:31:14.564077551 +0530
@@ -39,6 +39,7 @@
 #include <linux/i2c-dev.h>
 #include <linux/jiffies.h>
 #include <linux/uaccess.h>
+#include <linux/amd_imc.h>
 
 /*
  * An i2c_dev represents an i2c_adapter ... an I2C or SMBus master, not a
@@ -518,6 +519,8 @@
 	client->adapter = adap;
 	file->private_data = client;
 
+	amd_imc_enter_scratch_ram();
+
 	return 0;
 }
 
@@ -529,6 +532,8 @@
 	kfree(client);
 	file->private_data = NULL;
 
+	amd_imc_exit_scratch_ram();
+
 	return 0;
 }