Commit a128bbfa authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/flcn: export existing funcs

These will be used in upcoming commits which will provide more customisation.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent de048192
#ifndef __NVKM_FALCON_H__
#define __NVKM_FALCON_H__
#include <engine/falcon.h>
int nvkm_falcon_ctor(const struct nvkm_falcon_func *, struct nvkm_subdev *owner,
const char *name, u32 addr, struct nvkm_falcon *);
void nvkm_falcon_dtor(struct nvkm_falcon *);
void nvkm_falcon_v1_load_imem(struct nvkm_falcon *,
void *, u32, u32, u16, u8, bool);
void nvkm_falcon_v1_load_dmem(struct nvkm_falcon *, void *, u32, u32, u8);
void nvkm_falcon_v1_read_dmem(struct nvkm_falcon *, u32, u32, u8, void *);
void nvkm_falcon_v1_bind_context(struct nvkm_falcon *, struct nvkm_memory *);
int nvkm_falcon_v1_wait_for_halt(struct nvkm_falcon *, u32);
int nvkm_falcon_v1_clear_interrupt(struct nvkm_falcon *, u32);
void nvkm_falcon_v1_set_start_addr(struct nvkm_falcon *, u32 start_addr);
void nvkm_falcon_v1_start(struct nvkm_falcon *);
int nvkm_falcon_v1_enable(struct nvkm_falcon *);
void nvkm_falcon_v1_disable(struct nvkm_falcon *);
#endif
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
#ifndef __NVKM_FALCON_H__ #ifndef __NVKM_FLCNEN_H__
#define __NVKM_FALCON_H__ #define __NVKM_FLCNEN_H__
#define nvkm_falcon(p) container_of((p), struct nvkm_falcon, engine) #define nvkm_falcon(p) container_of((p), struct nvkm_falcon, engine)
#include <core/engine.h> #include <core/engine.h>
struct nvkm_fifo_chan; struct nvkm_fifo_chan;
...@@ -124,5 +124,4 @@ int nvkm_falcon_clear_interrupt(struct nvkm_falcon *, u32); ...@@ -124,5 +124,4 @@ int nvkm_falcon_clear_interrupt(struct nvkm_falcon *, u32);
int nvkm_falcon_enable(struct nvkm_falcon *); int nvkm_falcon_enable(struct nvkm_falcon *);
void nvkm_falcon_disable(struct nvkm_falcon *); void nvkm_falcon_disable(struct nvkm_falcon *);
int nvkm_falcon_reset(struct nvkm_falcon *); int nvkm_falcon_reset(struct nvkm_falcon *);
#endif #endif
...@@ -226,6 +226,11 @@ nvkm_falcon_get(struct nvkm_falcon *falcon, const struct nvkm_subdev *user) ...@@ -226,6 +226,11 @@ nvkm_falcon_get(struct nvkm_falcon *falcon, const struct nvkm_subdev *user)
} }
void void
nvkm_falcon_dtor(struct nvkm_falcon *falcon)
{
}
int
nvkm_falcon_ctor(const struct nvkm_falcon_func *func, nvkm_falcon_ctor(const struct nvkm_falcon_func *func,
struct nvkm_subdev *subdev, const char *name, u32 addr, struct nvkm_subdev *subdev, const char *name, u32 addr,
struct nvkm_falcon *falcon) struct nvkm_falcon *falcon)
...@@ -236,12 +241,14 @@ nvkm_falcon_ctor(const struct nvkm_falcon_func *func, ...@@ -236,12 +241,14 @@ nvkm_falcon_ctor(const struct nvkm_falcon_func *func,
falcon->addr = addr; falcon->addr = addr;
mutex_init(&falcon->mutex); mutex_init(&falcon->mutex);
mutex_init(&falcon->dmem_mutex); mutex_init(&falcon->dmem_mutex);
return 0;
} }
void void
nvkm_falcon_del(struct nvkm_falcon **pfalcon) nvkm_falcon_del(struct nvkm_falcon **pfalcon)
{ {
if (*pfalcon) { if (*pfalcon) {
nvkm_falcon_dtor(*pfalcon);
kfree(*pfalcon); kfree(*pfalcon);
*pfalcon = NULL; *pfalcon = NULL;
} }
......
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
#ifndef __NVKM_FALCON_PRIV_H__ #ifndef __NVKM_FALCON_PRIV_H__
#define __NVKM_FALCON_PRIV_H__ #define __NVKM_FALCON_PRIV_H__
#include <engine/falcon.h> #include <core/falcon.h>
void
nvkm_falcon_ctor(const struct nvkm_falcon_func *, struct nvkm_subdev *,
const char *, u32, struct nvkm_falcon *);
#endif #endif
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <core/memory.h> #include <core/memory.h>
#include <subdev/timer.h> #include <subdev/timer.h>
static void void
nvkm_falcon_v1_load_imem(struct nvkm_falcon *falcon, void *data, u32 start, nvkm_falcon_v1_load_imem(struct nvkm_falcon *falcon, void *data, u32 start,
u32 size, u16 tag, u8 port, bool secure) u32 size, u16 tag, u8 port, bool secure)
{ {
...@@ -91,9 +91,9 @@ nvkm_falcon_v1_load_emem(struct nvkm_falcon *falcon, void *data, u32 start, ...@@ -91,9 +91,9 @@ nvkm_falcon_v1_load_emem(struct nvkm_falcon *falcon, void *data, u32 start,
static const u32 EMEM_START_ADDR = 0x1000000; static const u32 EMEM_START_ADDR = 0x1000000;
static void void
nvkm_falcon_v1_load_dmem(struct nvkm_falcon *falcon, void *data, u32 start, nvkm_falcon_v1_load_dmem(struct nvkm_falcon *falcon, void *data, u32 start,
u32 size, u8 port) u32 size, u8 port)
{ {
u8 rem = size % 4; u8 rem = size % 4;
int i; int i;
...@@ -148,7 +148,7 @@ nvkm_falcon_v1_read_emem(struct nvkm_falcon *falcon, u32 start, u32 size, ...@@ -148,7 +148,7 @@ nvkm_falcon_v1_read_emem(struct nvkm_falcon *falcon, u32 start, u32 size,
} }
} }
static void void
nvkm_falcon_v1_read_dmem(struct nvkm_falcon *falcon, u32 start, u32 size, nvkm_falcon_v1_read_dmem(struct nvkm_falcon *falcon, u32 start, u32 size,
u8 port, void *data) u8 port, void *data)
{ {
...@@ -179,7 +179,7 @@ nvkm_falcon_v1_read_dmem(struct nvkm_falcon *falcon, u32 start, u32 size, ...@@ -179,7 +179,7 @@ nvkm_falcon_v1_read_dmem(struct nvkm_falcon *falcon, u32 start, u32 size,
} }
} }
static void void
nvkm_falcon_v1_bind_context(struct nvkm_falcon *falcon, struct nvkm_memory *ctx) nvkm_falcon_v1_bind_context(struct nvkm_falcon *falcon, struct nvkm_memory *ctx)
{ {
struct nvkm_device *device = falcon->owner->device; struct nvkm_device *device = falcon->owner->device;
...@@ -271,13 +271,13 @@ nvkm_falcon_v1_bind_context(struct nvkm_falcon *falcon, struct nvkm_memory *ctx) ...@@ -271,13 +271,13 @@ nvkm_falcon_v1_bind_context(struct nvkm_falcon *falcon, struct nvkm_memory *ctx)
} }
} }
static void void
nvkm_falcon_v1_set_start_addr(struct nvkm_falcon *falcon, u32 start_addr) nvkm_falcon_v1_set_start_addr(struct nvkm_falcon *falcon, u32 start_addr)
{ {
nvkm_falcon_wr32(falcon, 0x104, start_addr); nvkm_falcon_wr32(falcon, 0x104, start_addr);
} }
static void void
nvkm_falcon_v1_start(struct nvkm_falcon *falcon) nvkm_falcon_v1_start(struct nvkm_falcon *falcon)
{ {
u32 reg = nvkm_falcon_rd32(falcon, 0x100); u32 reg = nvkm_falcon_rd32(falcon, 0x100);
...@@ -288,7 +288,7 @@ nvkm_falcon_v1_start(struct nvkm_falcon *falcon) ...@@ -288,7 +288,7 @@ nvkm_falcon_v1_start(struct nvkm_falcon *falcon)
nvkm_falcon_wr32(falcon, 0x100, 0x2); nvkm_falcon_wr32(falcon, 0x100, 0x2);
} }
static int int
nvkm_falcon_v1_wait_for_halt(struct nvkm_falcon *falcon, u32 ms) nvkm_falcon_v1_wait_for_halt(struct nvkm_falcon *falcon, u32 ms)
{ {
struct nvkm_device *device = falcon->owner->device; struct nvkm_device *device = falcon->owner->device;
...@@ -301,7 +301,7 @@ nvkm_falcon_v1_wait_for_halt(struct nvkm_falcon *falcon, u32 ms) ...@@ -301,7 +301,7 @@ nvkm_falcon_v1_wait_for_halt(struct nvkm_falcon *falcon, u32 ms)
return 0; return 0;
} }
static int int
nvkm_falcon_v1_clear_interrupt(struct nvkm_falcon *falcon, u32 mask) nvkm_falcon_v1_clear_interrupt(struct nvkm_falcon *falcon, u32 mask)
{ {
struct nvkm_device *device = falcon->owner->device; struct nvkm_device *device = falcon->owner->device;
...@@ -330,7 +330,7 @@ falcon_v1_wait_idle(struct nvkm_falcon *falcon) ...@@ -330,7 +330,7 @@ falcon_v1_wait_idle(struct nvkm_falcon *falcon)
return 0; return 0;
} }
static int int
nvkm_falcon_v1_enable(struct nvkm_falcon *falcon) nvkm_falcon_v1_enable(struct nvkm_falcon *falcon)
{ {
struct nvkm_device *device = falcon->owner->device; struct nvkm_device *device = falcon->owner->device;
...@@ -352,7 +352,7 @@ nvkm_falcon_v1_enable(struct nvkm_falcon *falcon) ...@@ -352,7 +352,7 @@ nvkm_falcon_v1_enable(struct nvkm_falcon *falcon)
return 0; return 0;
} }
static void void
nvkm_falcon_v1_disable(struct nvkm_falcon *falcon) nvkm_falcon_v1_disable(struct nvkm_falcon *falcon)
{ {
/* disable IRQs and wait for any previous code to complete */ /* disable IRQs and wait for any previous code to complete */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment