sp-dev.c (f4d18d656f882a7ca558313d5f1b18b1fd01f759) sp-dev.c (d0ebbc0c407a10485a8672ef370dfe55c666d57f)
1/*
2 * AMD Secure Processor driver
3 *
4 * Copyright (C) 2017 Advanced Micro Devices, Inc.
5 *
6 * Author: Tom Lendacky <thomas.lendacky@amd.com>
7 * Author: Gary R Hook <gary.hook@amd.com>
8 * Author: Brijesh Singh <brijesh.singh@amd.com>

--- 228 unchanged lines hidden (view full) ---

237}
238#endif
239
240static int __init sp_mod_init(void)
241{
242#ifdef CONFIG_X86
243 int ret;
244
1/*
2 * AMD Secure Processor driver
3 *
4 * Copyright (C) 2017 Advanced Micro Devices, Inc.
5 *
6 * Author: Tom Lendacky <thomas.lendacky@amd.com>
7 * Author: Gary R Hook <gary.hook@amd.com>
8 * Author: Brijesh Singh <brijesh.singh@amd.com>

--- 228 unchanged lines hidden (view full) ---

237}
238#endif
239
240static int __init sp_mod_init(void)
241{
242#ifdef CONFIG_X86
243 int ret;
244
245 ret = ccp_pci_init();
245 ret = sp_pci_init();
246 if (ret)
247 return ret;
248
249 /* Don't leave the driver loaded if init failed */
250 if (ccp_present() != 0) {
246 if (ret)
247 return ret;
248
249 /* Don't leave the driver loaded if init failed */
250 if (ccp_present() != 0) {
251 ccp_pci_exit();
251 sp_pci_exit();
252 return -ENODEV;
253 }
254
255 return 0;
256#endif
257
258#ifdef CONFIG_ARM64
259 int ret;
260
252 return -ENODEV;
253 }
254
255 return 0;
256#endif
257
258#ifdef CONFIG_ARM64
259 int ret;
260
261 ret = ccp_platform_init();
261 ret = sp_platform_init();
262 if (ret)
263 return ret;
264
265 /* Don't leave the driver loaded if init failed */
266 if (ccp_present() != 0) {
262 if (ret)
263 return ret;
264
265 /* Don't leave the driver loaded if init failed */
266 if (ccp_present() != 0) {
267 ccp_platform_exit();
267 sp_platform_exit();
268 return -ENODEV;
269 }
270
271 return 0;
272#endif
273
274 return -ENODEV;
275}
276
277static void __exit sp_mod_exit(void)
278{
279#ifdef CONFIG_X86
268 return -ENODEV;
269 }
270
271 return 0;
272#endif
273
274 return -ENODEV;
275}
276
277static void __exit sp_mod_exit(void)
278{
279#ifdef CONFIG_X86
280 ccp_pci_exit();
280 sp_pci_exit();
281#endif
282
283#ifdef CONFIG_ARM64
281#endif
282
283#ifdef CONFIG_ARM64
284 ccp_platform_exit();
284 sp_platform_exit();
285#endif
286}
287
288module_init(sp_mod_init);
289module_exit(sp_mod_exit);
285#endif
286}
287
288module_init(sp_mod_init);
289module_exit(sp_mod_exit);