Lines Matching +full:sub +full:- +full:processor

1 // SPDX-License-Identifier: GPL-2.0-only
3 * AMD Secure Processor driver
5 * Copyright (C) 2017-2018 Advanced Micro Devices, Inc.
22 #include "ccp-dev.h"
23 #include "sp-dev.h"
29 MODULE_DESCRIPTION("AMD Secure Processor driver");
31 /* List of SPs, SP count, read-write access lock, and access functions
39 /* Ever-increasing value to produce unique unit numbers */
48 list_add_tail(&sp->entry, &sp_units); in sp_add_device()
59 list_del(&sp->entry); in sp_del_device()
68 if (sp->ccp_irq_handler) in sp_irq_handler()
69 sp->ccp_irq_handler(irq, sp->ccp_irq_data); in sp_irq_handler()
71 if (sp->psp_irq_handler) in sp_irq_handler()
72 sp->psp_irq_handler(irq, sp->psp_irq_data); in sp_irq_handler()
82 if ((sp->psp_irq == sp->ccp_irq) && sp->dev_vdata->psp_vdata) { in sp_request_ccp_irq()
84 sp->ccp_irq_data = data; in sp_request_ccp_irq()
85 sp->ccp_irq_handler = handler; in sp_request_ccp_irq()
87 if (!sp->irq_registered) { in sp_request_ccp_irq()
88 ret = request_irq(sp->ccp_irq, sp_irq_handler, 0, in sp_request_ccp_irq()
89 sp->name, sp); in sp_request_ccp_irq()
93 sp->irq_registered = true; in sp_request_ccp_irq()
96 /* Each sub-device can manage it's own interrupt */ in sp_request_ccp_irq()
97 ret = request_irq(sp->ccp_irq, handler, 0, name, data); in sp_request_ccp_irq()
110 if ((sp->psp_irq == sp->ccp_irq) && sp->dev_vdata->ccp_vdata) { in sp_request_psp_irq()
112 sp->psp_irq_data = data; in sp_request_psp_irq()
113 sp->psp_irq_handler = handler; in sp_request_psp_irq()
115 if (!sp->irq_registered) { in sp_request_psp_irq()
116 ret = request_irq(sp->psp_irq, sp_irq_handler, 0, in sp_request_psp_irq()
117 sp->name, sp); in sp_request_psp_irq()
121 sp->irq_registered = true; in sp_request_psp_irq()
124 /* Each sub-device can manage it's own interrupt */ in sp_request_psp_irq()
125 ret = request_irq(sp->psp_irq, handler, 0, name, data); in sp_request_psp_irq()
135 if ((sp->psp_irq == sp->ccp_irq) && sp->dev_vdata->psp_vdata) { in sp_free_ccp_irq()
137 if (!sp->psp_irq_handler) { in sp_free_ccp_irq()
139 free_irq(sp->ccp_irq, sp); in sp_free_ccp_irq()
141 sp->irq_registered = false; in sp_free_ccp_irq()
144 sp->ccp_irq_handler = NULL; in sp_free_ccp_irq()
145 sp->ccp_irq_data = NULL; in sp_free_ccp_irq()
147 /* Each sub-device can manage it's own interrupt */ in sp_free_ccp_irq()
148 free_irq(sp->ccp_irq, data); in sp_free_ccp_irq()
154 if ((sp->psp_irq == sp->ccp_irq) && sp->dev_vdata->ccp_vdata) { in sp_free_psp_irq()
156 if (!sp->ccp_irq_handler) { in sp_free_psp_irq()
158 free_irq(sp->psp_irq, sp); in sp_free_psp_irq()
160 sp->irq_registered = false; in sp_free_psp_irq()
163 sp->psp_irq_handler = NULL; in sp_free_psp_irq()
164 sp->psp_irq_data = NULL; in sp_free_psp_irq()
166 /* Each sub-device can manage it's own interrupt */ in sp_free_psp_irq()
167 free_irq(sp->psp_irq, data); in sp_free_psp_irq()
172 * sp_alloc_struct - allocate and initialize the sp_device struct
184 sp->dev = dev; in sp_alloc_struct()
185 sp->ord = atomic_inc_return(&sp_ordinal); in sp_alloc_struct()
186 snprintf(sp->name, SP_MAX_NAME_LEN, "sp-%u", sp->ord); in sp_alloc_struct()
195 if (sp->dev_vdata->ccp_vdata) in sp_init()
198 if (sp->dev_vdata->psp_vdata) in sp_init()
205 if (sp->dev_vdata->ccp_vdata) in sp_destroy()
208 if (sp->dev_vdata->psp_vdata) in sp_destroy()
216 if (sp->dev_vdata->ccp_vdata) { in sp_suspend()
225 if (sp->dev_vdata->ccp_vdata) { in sp_resume()
242 if (i->psp_data && i->get_psp_master_device) { in sp_get_psp_master_device()
243 ret = i->get_psp_master_device(); in sp_get_psp_master_device()
279 return -ENODEV; in sp_mod_init()