From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 1/3] mfd: ahc1ec0: Add support for Advantech embedded controller
Date: Wed, 14 Oct 2020 23:23:43 +0800 [thread overview]
Message-ID: <202010142309.oFBGfewK-lkp@intel.com> (raw)
In-Reply-To: <20201014083549.25465-1-shihlun.lin@advantech.com.tw>
[-- Attachment #1: Type: text/plain, Size: 13371 bytes --]
Hi Shihlun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on linux/master v5.9]
[cannot apply to lee-mfd/for-mfd-next next-20201013]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b5fc7a89e58bcc059a3d5e4db79c481fb437de59
config: parisc-randconfig-r003-20201014 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f939b81446bccbb73682a795ea5422386d6b15bb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627
git checkout f939b81446bccbb73682a795ea5422386d6b15bb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> drivers/mfd/ahc1ec0.c:71:5: warning: no previous prototype for 'wait_ibf' [-Wmissing-prototypes]
71 | int wait_ibf(void)
| ^~~~~~~~
>> drivers/mfd/ahc1ec0.c:86:5: warning: no previous prototype for 'wait_obf' [-Wmissing-prototypes]
86 | int wait_obf(void)
| ^~~~~~~~
>> drivers/mfd/ahc1ec0.c:101:5: warning: no previous prototype for 'read_hw_ram' [-Wmissing-prototypes]
101 | int read_hw_ram(uchar addr, uchar *data)
| ^~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:182:5: warning: no previous prototype for 'wait_smbus_protocol_finish' [-Wmissing-prototypes]
182 | int wait_smbus_protocol_finish(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:203:5: warning: no previous prototype for 'adv_get_dynamic_tab' [-Wmissing-prototypes]
203 | int adv_get_dynamic_tab(struct adv_ec_platform_data *pdata)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:409:5: warning: no previous prototype for 'write_acpi_value' [-Wmissing-prototypes]
409 | int write_acpi_value(uchar addr, uchar value)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:442:5: warning: no previous prototype for 'read_gpio_status' [-Wmissing-prototypes]
442 | int read_gpio_status(uchar PinNumber, uchar *pvalue)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:493:5: warning: no previous prototype for 'write_gpio_status' [-Wmissing-prototypes]
493 | int write_gpio_status(uchar PinNumber, uchar value)
| ^~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:538:5: warning: no previous prototype for 'read_gpio_dir' [-Wmissing-prototypes]
538 | int read_gpio_dir(uchar PinNumber, uchar *pvalue)
| ^~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:585:5: warning: no previous prototype for 'write_gpio_dir' [-Wmissing-prototypes]
585 | int write_gpio_dir(uchar PinNumber, uchar value)
| ^~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:631:5: warning: no previous prototype for 'write_hw_extend_ram' [-Wmissing-prototypes]
631 | int write_hw_extend_ram(uchar addr, uchar data)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:866:5: warning: no previous prototype for 'smbus_write_byte' [-Wmissing-prototypes]
866 | int smbus_write_byte(struct EC_SMBUS_WRITE_BYTE *ptr_ec_smbus_write_byte)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:946:5: warning: no previous prototype for 'read_onekey_status' [-Wmissing-prototypes]
946 | int read_onekey_status(uchar addr, uchar *pdata)
| ^~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:990:5: warning: no previous prototype for 'write_onekey_status' [-Wmissing-prototypes]
990 | int write_onekey_status(uchar addr)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:1024:5: warning: no previous prototype for 'ec_oem_get_status' [-Wmissing-prototypes]
1024 | int ec_oem_get_status(uchar addr, uchar *pdata)
| ^~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:1076:5: warning: no previous prototype for 'ec_oem_set_status' [-Wmissing-prototypes]
1076 | int ec_oem_set_status(uchar addr, uchar pdata)
| ^~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c: In function 'adv_ec_get_productname':
>> drivers/mfd/ahc1ec0.c:1167:13: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
1167 | (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
| ^~~~~~~~~~~~~
| ioremap_uc
At top level:
drivers/mfd/ahc1ec0.c:1244:30: warning: 'adv_ec_util_cells' defined but not used [-Wunused-const-variable=]
1244 | static const struct mfd_cell adv_ec_util_cells[] = {
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +1167 drivers/mfd/ahc1ec0.c
988
989 /* Set One Key Recovery status */
> 990 int write_onekey_status(uchar addr)
991 {
992 int ret;
993
994 mutex_lock(&lock);
995
996 /* Step 0. Wait IBF clear */
997 ret = wait_ibf();
998 if (ret)
999 goto error;
1000
1001 /* Step 1. Send "One Key Recovery" command to EC Command port */
1002 outb(EC_ONE_KEY_FLAG, EC_COMMAND_PORT);
1003
1004 /* Step 2. Wait IBF clear */
1005 ret = wait_ibf();
1006 if (ret)
1007 goto error;
1008
1009 /* Step 3. Send "One Key Recovery function" address to EC Data port */
1010 outb(addr, EC_STATUS_PORT);
1011
1012 mutex_unlock(&lock);
1013
1014 pr_debug("%s: addr= %d, line: %d", __func__, addr, __LINE__);
1015 return 0;
1016
1017 error:
1018 mutex_unlock(&lock);
1019 pr_debug("%s: Wait for IBF too long. line: %d", __func__, __LINE__);
1020 return ret;
1021 }
1022
1023 /* EC OEM get status */
> 1024 int ec_oem_get_status(uchar addr, uchar *pdata)
1025 {
1026 int ret;
1027
1028 mutex_lock(&lock);
1029
1030 /* Init return value */
1031 *pdata = 0;
1032
1033 /* Step 0. Wait IBF clear */
1034 ret = wait_ibf();
1035 if (ret)
1036 goto error;
1037
1038 /* Step 1. Send "ASG OEM" command to EC Command port */
1039 outb(EC_ASG_OEM, EC_COMMAND_PORT);
1040
1041 /* Step 2. Wait IBF clear */
1042 ret = wait_ibf();
1043 if (ret)
1044 goto error;
1045
1046 /* Step 3. Send "ASG OEM STATUS READ" address to EC Data port */
1047 outb(EC_ASG_OEM_READ, EC_STATUS_PORT);
1048
1049 /* Step 4. Wait IBF clear */
1050 ret = wait_ibf();
1051 if (ret)
1052 goto error;
1053
1054 /* Step 5. Send "OEM STATUS" address to EC Data port */
1055 outb(addr, EC_STATUS_PORT);
1056
1057 /* Step 6. Wait OBF set */
1058 ret = wait_obf();
1059 if (ret)
1060 goto error;
1061
1062 /* Step 7. Get "OEM STATUS" data from EC Data port */
1063 *pdata = inb(EC_STATUS_PORT);
1064
1065 pr_debug("%s: data= %d, line: %d", __func__, *pdata, __LINE__);
1066 mutex_unlock(&lock);
1067 return 0;
1068
1069 error:
1070 mutex_unlock(&lock);
1071 pr_warn("%s: Wait for IBF or OBF too long. line: %d", __func__, __LINE__);
1072 return ret;
1073 }
1074
1075 /* EC OEM set status */
> 1076 int ec_oem_set_status(uchar addr, uchar pdata)
1077 {
1078 int ret;
1079
1080 mutex_lock(&lock);
1081
1082 /* Step 0. Wait IBF clear */
1083 ret = wait_ibf();
1084 if (ret)
1085 goto error;
1086
1087 /* Step 1. Send "ASG OEM" command to EC Command port */
1088 outb(EC_ASG_OEM, EC_COMMAND_PORT);
1089
1090 /* Step 2. Wait IBF clear */
1091 ret = wait_ibf();
1092 if (ret)
1093 goto error;
1094
1095 /* Step 3. Send "ASG OEM STATUS WRITE" address to EC Data port */
1096 outb(EC_ASG_OEM_WRITE, EC_STATUS_PORT);
1097
1098 /* Step 4. Wait IBF clear */
1099 ret = wait_ibf();
1100 if (ret)
1101 goto error;
1102
1103 /* Step 5. Send "OEM STATUS" address to EC Data port */
1104 outb(addr, EC_STATUS_PORT);
1105
1106 /* Step 6. Wait IBF clear */
1107 ret = wait_ibf();
1108 if (ret)
1109 goto error;
1110
1111 /* Step 7. Send "OEM STATUS" status to EC Data port */
1112 outb(pdata, EC_STATUS_PORT);
1113
1114 pr_debug("%s: data= %d, line: %d", __func__, pdata, __LINE__);
1115 mutex_unlock(&lock);
1116 return 0;
1117
1118 error:
1119 mutex_unlock(&lock);
1120 pr_warn("%s: Wait for IBF or OBF too long. line: %d", __func__, __LINE__);
1121
1122 return ret;
1123 }
1124
1125 static int adv_ec_get_productname(char *product)
1126 {
1127 static unsigned char *uc_ptaddr;
1128 static unsigned char *uc_epsaddr;
1129 int index = 0, eps_table;
1130 int i = 0;
1131 int length = 0;
1132 int type0_str = 0;
1133 int type1_str = 0;
1134 int is_advantech = 0;
1135
1136 uc_ptaddr = ioremap(AMI_UEFI_ADVANTECH_BOARD_NAME_ADDRESS,
1137 AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH);
1138 if (!uc_ptaddr) {
1139 pr_err("Error: ioremap_nocache()");
1140 return -ENXIO;
1141 }
1142
1143 /* Try to Read the product name from UEFI BIOS(DMI) EPS table */
1144 for (index = 0; index < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH; index++) {
1145 if (uc_ptaddr[index] == '_'
1146 && uc_ptaddr[index+0x1] == 'S'
1147 && uc_ptaddr[index+0x2] == 'M'
1148 && uc_ptaddr[index+0x3] == '_'
1149 && uc_ptaddr[index+0x10] == '_'
1150 && uc_ptaddr[index+0x11] == 'D'
1151 && uc_ptaddr[index+0x12] == 'M'
1152 && uc_ptaddr[index+0x13] == 'I'
1153 && uc_ptaddr[index+0x14] == '_'
1154 ) {
1155 eps_table = 1;
1156 break;
1157 }
1158 }
1159
1160 /* If EPS table exist, read type1(system information) */
1161 if (eps_table) {
1162 uc_epsaddr =
1163 (char *)ioremap(((unsigned int *)&uc_ptaddr[index+0x18])[0],
1164 ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
1165 if (!uc_epsaddr) {
1166 uc_epsaddr =
> 1167 (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
1168 ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
1169 if (!uc_epsaddr) {
1170 pr_err("Error: both ioremap() and ioremap_cache() exec failed!");
1171 return -ENXIO;
1172 }
1173 }
1174
1175 type0_str = (int)uc_epsaddr[1];
1176 for (i = type0_str; i < (type0_str+512); i++) {
1177 if (uc_epsaddr[i] == 0 && uc_epsaddr[i+1] == 0 && uc_epsaddr[i+2] == 1) {
1178 type1_str = i + uc_epsaddr[i+3];
1179 break;
1180 }
1181 }
1182 for (i = type1_str; i < (type1_str+512); i++) {
1183 if (!strncmp(&uc_epsaddr[i], "Advantech", 9))
1184 is_advantech = 1;
1185
1186 if (uc_epsaddr[i] == 0) {
1187 i++;
1188 type1_str = i;
1189 break;
1190 }
1191 }
1192 length = 2;
1193 while ((uc_epsaddr[type1_str + length] != 0)
1194 && (length < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH)) {
1195 length += 1;
1196 }
1197 memmove(product, &uc_epsaddr[type1_str], length);
1198 iounmap((void *)uc_epsaddr);
1199 if (is_advantech) {
1200 iounmap((void *)uc_ptaddr);
1201 return 0;
1202 }
1203 }
1204
1205 /* It is an old BIOS, read from 0x000F0000 */
1206 for (index = 0; index < (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3); index++) {
1207 if (!strncmp(&uc_ptaddr[index], "TPC", 3)
1208 || !strncmp(&uc_ptaddr[index], "UNO", 3)
1209 || !strncmp(&uc_ptaddr[index], "ITA", 3)
1210 || !strncmp(&uc_ptaddr[index], "MIO", 3)
1211 || !strncmp(&uc_ptaddr[index], "ECU", 3)
1212 || !strncmp(&uc_ptaddr[index], "APAX", 4))
1213 break;
1214 }
1215
1216 if (index == (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3)) {
1217 pr_err("%s: Can't find the product name, line: %d", __func__, __LINE__);
1218 product[0] = '\0';
1219 iounmap((void *)uc_ptaddr);
1220 return -ENODATA;
1221 }
1222
1223 /* Use char "Space" (ASCII code: 32) to check the end of the Product Name. */
1224 for (i = 0; (uc_ptaddr[index+i] != 32) && (i < 31); i++)
1225 product[i] = uc_ptaddr[index+i];
1226
1227 product[i] = '\0';
1228 pr_info("%s: BIOS Product Name = %s, line: %d", __func__, product, __LINE__);
1229
1230 iounmap((void *)uc_ptaddr);
1231
1232 return 0;
1233 }
1234
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25583 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Shihlun Lin <shihlun.lin@advantech.com.tw>,
Lee Jones <lee.jones@linaro.org>,
linux-kernel@vger.kernel.org,
Campion Kang <campion.kang@advantech.com.tw>,
AceLan Kao <chia-lin.kao@canonical.com>
Cc: kbuild-all@lists.01.org
Subject: Re: [PATCH 1/3] mfd: ahc1ec0: Add support for Advantech embedded controller
Date: Wed, 14 Oct 2020 23:23:43 +0800 [thread overview]
Message-ID: <202010142309.oFBGfewK-lkp@intel.com> (raw)
In-Reply-To: <20201014083549.25465-1-shihlun.lin@advantech.com.tw>
[-- Attachment #1: Type: text/plain, Size: 13029 bytes --]
Hi Shihlun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on linux/master v5.9]
[cannot apply to lee-mfd/for-mfd-next next-20201013]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b5fc7a89e58bcc059a3d5e4db79c481fb437de59
config: parisc-randconfig-r003-20201014 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f939b81446bccbb73682a795ea5422386d6b15bb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627
git checkout f939b81446bccbb73682a795ea5422386d6b15bb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> drivers/mfd/ahc1ec0.c:71:5: warning: no previous prototype for 'wait_ibf' [-Wmissing-prototypes]
71 | int wait_ibf(void)
| ^~~~~~~~
>> drivers/mfd/ahc1ec0.c:86:5: warning: no previous prototype for 'wait_obf' [-Wmissing-prototypes]
86 | int wait_obf(void)
| ^~~~~~~~
>> drivers/mfd/ahc1ec0.c:101:5: warning: no previous prototype for 'read_hw_ram' [-Wmissing-prototypes]
101 | int read_hw_ram(uchar addr, uchar *data)
| ^~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:182:5: warning: no previous prototype for 'wait_smbus_protocol_finish' [-Wmissing-prototypes]
182 | int wait_smbus_protocol_finish(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:203:5: warning: no previous prototype for 'adv_get_dynamic_tab' [-Wmissing-prototypes]
203 | int adv_get_dynamic_tab(struct adv_ec_platform_data *pdata)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:409:5: warning: no previous prototype for 'write_acpi_value' [-Wmissing-prototypes]
409 | int write_acpi_value(uchar addr, uchar value)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:442:5: warning: no previous prototype for 'read_gpio_status' [-Wmissing-prototypes]
442 | int read_gpio_status(uchar PinNumber, uchar *pvalue)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:493:5: warning: no previous prototype for 'write_gpio_status' [-Wmissing-prototypes]
493 | int write_gpio_status(uchar PinNumber, uchar value)
| ^~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:538:5: warning: no previous prototype for 'read_gpio_dir' [-Wmissing-prototypes]
538 | int read_gpio_dir(uchar PinNumber, uchar *pvalue)
| ^~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:585:5: warning: no previous prototype for 'write_gpio_dir' [-Wmissing-prototypes]
585 | int write_gpio_dir(uchar PinNumber, uchar value)
| ^~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:631:5: warning: no previous prototype for 'write_hw_extend_ram' [-Wmissing-prototypes]
631 | int write_hw_extend_ram(uchar addr, uchar data)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:866:5: warning: no previous prototype for 'smbus_write_byte' [-Wmissing-prototypes]
866 | int smbus_write_byte(struct EC_SMBUS_WRITE_BYTE *ptr_ec_smbus_write_byte)
| ^~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:946:5: warning: no previous prototype for 'read_onekey_status' [-Wmissing-prototypes]
946 | int read_onekey_status(uchar addr, uchar *pdata)
| ^~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:990:5: warning: no previous prototype for 'write_onekey_status' [-Wmissing-prototypes]
990 | int write_onekey_status(uchar addr)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:1024:5: warning: no previous prototype for 'ec_oem_get_status' [-Wmissing-prototypes]
1024 | int ec_oem_get_status(uchar addr, uchar *pdata)
| ^~~~~~~~~~~~~~~~~
>> drivers/mfd/ahc1ec0.c:1076:5: warning: no previous prototype for 'ec_oem_set_status' [-Wmissing-prototypes]
1076 | int ec_oem_set_status(uchar addr, uchar pdata)
| ^~~~~~~~~~~~~~~~~
drivers/mfd/ahc1ec0.c: In function 'adv_ec_get_productname':
>> drivers/mfd/ahc1ec0.c:1167:13: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
1167 | (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
| ^~~~~~~~~~~~~
| ioremap_uc
At top level:
drivers/mfd/ahc1ec0.c:1244:30: warning: 'adv_ec_util_cells' defined but not used [-Wunused-const-variable=]
1244 | static const struct mfd_cell adv_ec_util_cells[] = {
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +1167 drivers/mfd/ahc1ec0.c
988
989 /* Set One Key Recovery status */
> 990 int write_onekey_status(uchar addr)
991 {
992 int ret;
993
994 mutex_lock(&lock);
995
996 /* Step 0. Wait IBF clear */
997 ret = wait_ibf();
998 if (ret)
999 goto error;
1000
1001 /* Step 1. Send "One Key Recovery" command to EC Command port */
1002 outb(EC_ONE_KEY_FLAG, EC_COMMAND_PORT);
1003
1004 /* Step 2. Wait IBF clear */
1005 ret = wait_ibf();
1006 if (ret)
1007 goto error;
1008
1009 /* Step 3. Send "One Key Recovery function" address to EC Data port */
1010 outb(addr, EC_STATUS_PORT);
1011
1012 mutex_unlock(&lock);
1013
1014 pr_debug("%s: addr= %d, line: %d", __func__, addr, __LINE__);
1015 return 0;
1016
1017 error:
1018 mutex_unlock(&lock);
1019 pr_debug("%s: Wait for IBF too long. line: %d", __func__, __LINE__);
1020 return ret;
1021 }
1022
1023 /* EC OEM get status */
> 1024 int ec_oem_get_status(uchar addr, uchar *pdata)
1025 {
1026 int ret;
1027
1028 mutex_lock(&lock);
1029
1030 /* Init return value */
1031 *pdata = 0;
1032
1033 /* Step 0. Wait IBF clear */
1034 ret = wait_ibf();
1035 if (ret)
1036 goto error;
1037
1038 /* Step 1. Send "ASG OEM" command to EC Command port */
1039 outb(EC_ASG_OEM, EC_COMMAND_PORT);
1040
1041 /* Step 2. Wait IBF clear */
1042 ret = wait_ibf();
1043 if (ret)
1044 goto error;
1045
1046 /* Step 3. Send "ASG OEM STATUS READ" address to EC Data port */
1047 outb(EC_ASG_OEM_READ, EC_STATUS_PORT);
1048
1049 /* Step 4. Wait IBF clear */
1050 ret = wait_ibf();
1051 if (ret)
1052 goto error;
1053
1054 /* Step 5. Send "OEM STATUS" address to EC Data port */
1055 outb(addr, EC_STATUS_PORT);
1056
1057 /* Step 6. Wait OBF set */
1058 ret = wait_obf();
1059 if (ret)
1060 goto error;
1061
1062 /* Step 7. Get "OEM STATUS" data from EC Data port */
1063 *pdata = inb(EC_STATUS_PORT);
1064
1065 pr_debug("%s: data= %d, line: %d", __func__, *pdata, __LINE__);
1066 mutex_unlock(&lock);
1067 return 0;
1068
1069 error:
1070 mutex_unlock(&lock);
1071 pr_warn("%s: Wait for IBF or OBF too long. line: %d", __func__, __LINE__);
1072 return ret;
1073 }
1074
1075 /* EC OEM set status */
> 1076 int ec_oem_set_status(uchar addr, uchar pdata)
1077 {
1078 int ret;
1079
1080 mutex_lock(&lock);
1081
1082 /* Step 0. Wait IBF clear */
1083 ret = wait_ibf();
1084 if (ret)
1085 goto error;
1086
1087 /* Step 1. Send "ASG OEM" command to EC Command port */
1088 outb(EC_ASG_OEM, EC_COMMAND_PORT);
1089
1090 /* Step 2. Wait IBF clear */
1091 ret = wait_ibf();
1092 if (ret)
1093 goto error;
1094
1095 /* Step 3. Send "ASG OEM STATUS WRITE" address to EC Data port */
1096 outb(EC_ASG_OEM_WRITE, EC_STATUS_PORT);
1097
1098 /* Step 4. Wait IBF clear */
1099 ret = wait_ibf();
1100 if (ret)
1101 goto error;
1102
1103 /* Step 5. Send "OEM STATUS" address to EC Data port */
1104 outb(addr, EC_STATUS_PORT);
1105
1106 /* Step 6. Wait IBF clear */
1107 ret = wait_ibf();
1108 if (ret)
1109 goto error;
1110
1111 /* Step 7. Send "OEM STATUS" status to EC Data port */
1112 outb(pdata, EC_STATUS_PORT);
1113
1114 pr_debug("%s: data= %d, line: %d", __func__, pdata, __LINE__);
1115 mutex_unlock(&lock);
1116 return 0;
1117
1118 error:
1119 mutex_unlock(&lock);
1120 pr_warn("%s: Wait for IBF or OBF too long. line: %d", __func__, __LINE__);
1121
1122 return ret;
1123 }
1124
1125 static int adv_ec_get_productname(char *product)
1126 {
1127 static unsigned char *uc_ptaddr;
1128 static unsigned char *uc_epsaddr;
1129 int index = 0, eps_table;
1130 int i = 0;
1131 int length = 0;
1132 int type0_str = 0;
1133 int type1_str = 0;
1134 int is_advantech = 0;
1135
1136 uc_ptaddr = ioremap(AMI_UEFI_ADVANTECH_BOARD_NAME_ADDRESS,
1137 AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH);
1138 if (!uc_ptaddr) {
1139 pr_err("Error: ioremap_nocache()");
1140 return -ENXIO;
1141 }
1142
1143 /* Try to Read the product name from UEFI BIOS(DMI) EPS table */
1144 for (index = 0; index < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH; index++) {
1145 if (uc_ptaddr[index] == '_'
1146 && uc_ptaddr[index+0x1] == 'S'
1147 && uc_ptaddr[index+0x2] == 'M'
1148 && uc_ptaddr[index+0x3] == '_'
1149 && uc_ptaddr[index+0x10] == '_'
1150 && uc_ptaddr[index+0x11] == 'D'
1151 && uc_ptaddr[index+0x12] == 'M'
1152 && uc_ptaddr[index+0x13] == 'I'
1153 && uc_ptaddr[index+0x14] == '_'
1154 ) {
1155 eps_table = 1;
1156 break;
1157 }
1158 }
1159
1160 /* If EPS table exist, read type1(system information) */
1161 if (eps_table) {
1162 uc_epsaddr =
1163 (char *)ioremap(((unsigned int *)&uc_ptaddr[index+0x18])[0],
1164 ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
1165 if (!uc_epsaddr) {
1166 uc_epsaddr =
> 1167 (char *)ioremap_cache(((unsigned int *)&uc_ptaddr[index+0x18])[0],
1168 ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
1169 if (!uc_epsaddr) {
1170 pr_err("Error: both ioremap() and ioremap_cache() exec failed!");
1171 return -ENXIO;
1172 }
1173 }
1174
1175 type0_str = (int)uc_epsaddr[1];
1176 for (i = type0_str; i < (type0_str+512); i++) {
1177 if (uc_epsaddr[i] == 0 && uc_epsaddr[i+1] == 0 && uc_epsaddr[i+2] == 1) {
1178 type1_str = i + uc_epsaddr[i+3];
1179 break;
1180 }
1181 }
1182 for (i = type1_str; i < (type1_str+512); i++) {
1183 if (!strncmp(&uc_epsaddr[i], "Advantech", 9))
1184 is_advantech = 1;
1185
1186 if (uc_epsaddr[i] == 0) {
1187 i++;
1188 type1_str = i;
1189 break;
1190 }
1191 }
1192 length = 2;
1193 while ((uc_epsaddr[type1_str + length] != 0)
1194 && (length < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH)) {
1195 length += 1;
1196 }
1197 memmove(product, &uc_epsaddr[type1_str], length);
1198 iounmap((void *)uc_epsaddr);
1199 if (is_advantech) {
1200 iounmap((void *)uc_ptaddr);
1201 return 0;
1202 }
1203 }
1204
1205 /* It is an old BIOS, read from 0x000F0000 */
1206 for (index = 0; index < (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3); index++) {
1207 if (!strncmp(&uc_ptaddr[index], "TPC", 3)
1208 || !strncmp(&uc_ptaddr[index], "UNO", 3)
1209 || !strncmp(&uc_ptaddr[index], "ITA", 3)
1210 || !strncmp(&uc_ptaddr[index], "MIO", 3)
1211 || !strncmp(&uc_ptaddr[index], "ECU", 3)
1212 || !strncmp(&uc_ptaddr[index], "APAX", 4))
1213 break;
1214 }
1215
1216 if (index == (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3)) {
1217 pr_err("%s: Can't find the product name, line: %d", __func__, __LINE__);
1218 product[0] = '\0';
1219 iounmap((void *)uc_ptaddr);
1220 return -ENODATA;
1221 }
1222
1223 /* Use char "Space" (ASCII code: 32) to check the end of the Product Name. */
1224 for (i = 0; (uc_ptaddr[index+i] != 32) && (i < 31); i++)
1225 product[i] = uc_ptaddr[index+i];
1226
1227 product[i] = '\0';
1228 pr_info("%s: BIOS Product Name = %s, line: %d", __func__, product, __LINE__);
1229
1230 iounmap((void *)uc_ptaddr);
1231
1232 return 0;
1233 }
1234
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25583 bytes --]
next prev parent reply other threads:[~2020-10-14 15:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 8:35 [PATCH 1/3] mfd: ahc1ec0: Add support for Advantech embedded controller Shihlun Lin
2020-10-14 8:35 ` [PATCH 2/3] mfd: ahc1ec0-hwmon: Add sub-device hwmon " Shihlun Lin
2020-10-14 14:26 ` kernel test robot
2020-10-14 14:26 ` kernel test robot
2020-10-14 8:35 ` [PATCH 3/3] mfd: ahc1ec0-wdt: Add sub-device watchdog " Shihlun Lin
2020-10-14 17:23 ` kernel test robot
2020-10-14 17:23 ` kernel test robot
2020-10-14 14:16 ` [PATCH 1/3] mfd: ahc1ec0: Add support " kernel test robot
2020-10-14 14:16 ` kernel test robot
2020-10-14 15:23 ` kernel test robot [this message]
2020-10-14 15:23 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202010142309.oFBGfewK-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.