Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2019 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  */
0022 #include "priv.h"
0023 #include <core/falcon.h>
0024 #include <core/firmware.h>
0025 #include <subdev/acr.h>
0026 #include <subdev/top.h>
0027 
0028 static void *
0029 nvkm_gsp_dtor(struct nvkm_subdev *subdev)
0030 {
0031     struct nvkm_gsp *gsp = nvkm_gsp(subdev);
0032     nvkm_falcon_dtor(&gsp->falcon);
0033     return gsp;
0034 }
0035 
0036 static const struct nvkm_subdev_func
0037 nvkm_gsp = {
0038     .dtor = nvkm_gsp_dtor,
0039 };
0040 
0041 int
0042 nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
0043           enum nvkm_subdev_type type, int inst, struct nvkm_gsp **pgsp)
0044 {
0045     struct nvkm_gsp *gsp;
0046 
0047     if (!(gsp = *pgsp = kzalloc(sizeof(*gsp), GFP_KERNEL)))
0048         return -ENOMEM;
0049 
0050     nvkm_subdev_ctor(&nvkm_gsp, device, type, inst, &gsp->subdev);
0051 
0052     fwif = nvkm_firmware_load(&gsp->subdev, fwif, "Gsp", gsp);
0053     if (IS_ERR(fwif))
0054         return PTR_ERR(fwif);
0055 
0056     return nvkm_falcon_ctor(fwif->flcn, &gsp->subdev, gsp->subdev.name, 0, &gsp->falcon);
0057 }