Commit 100e8989 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: atomisp: change the type returned by mmgr alloc



The mmgr alloc code returns a different type than hmm, due to
some abstraction layer.

Change the driver to use just one type to represent the
hmm memory.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent dc50fa18
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -18,8 +18,9 @@
#include <type_support.h>
#include <system_types.h>
#include <ia_css_err.h>
#include <ia_css_types.h>

typedef void (*clear_func)(hrt_vaddress ptr);
typedef void (*clear_func)(ia_css_ptr ptr);

/*! \brief Function for initializing refcount list
 *
@@ -38,9 +39,9 @@ void ia_css_refcount_uninit(void);
 *
 * \param[in]	id		ID of the object.
 * \param[in]	ptr		Data of the object (ptr).
 * \return				hrt_vaddress (saved address)
 * \return				ia_css_ptr (saved address)
 */
hrt_vaddress ia_css_refcount_increment(s32 id, hrt_vaddress ptr);
ia_css_ptr ia_css_refcount_increment(s32 id, ia_css_ptr ptr);

/*! \brief Function for decrease reference by 1.
 *
@@ -50,7 +51,7 @@ hrt_vaddress ia_css_refcount_increment(s32 id, hrt_vaddress ptr);
 *	- true, if it is successful.
 *	- false, otherwise.
 */
bool ia_css_refcount_decrement(s32 id, hrt_vaddress ptr);
bool ia_css_refcount_decrement(s32 id, ia_css_ptr ptr);

/*! \brief Function to check if reference count is 1.
 *
@@ -59,7 +60,7 @@ bool ia_css_refcount_decrement(s32 id, hrt_vaddress ptr);
 *	- true, if it is successful.
 *	- false, otherwise.
 */
bool ia_css_refcount_is_single(hrt_vaddress ptr);
bool ia_css_refcount_is_single(ia_css_ptr ptr);

/*! \brief Function to clear reference list objects.
 *
@@ -78,6 +79,6 @@ void ia_css_refcount_clear(s32 id,
 *      - true, if valid
 *      - false, if invalid
 */
bool ia_css_refcount_is_valid(hrt_vaddress ptr);
bool ia_css_refcount_is_valid(ia_css_ptr ptr);

#endif /* _IA_CSS_REFCOUNT_H_ */
+7 −7
Original line number Diff line number Diff line
@@ -23,10 +23,10 @@
#include "ia_css_debug.h"

/* TODO: enable for other memory aswell
	 now only for hrt_vaddress */
	 now only for ia_css_ptr */
struct ia_css_refcount_entry {
	u32 count;
	hrt_vaddress data;
	ia_css_ptr data;
	s32 id;
};

@@ -37,7 +37,7 @@ struct ia_css_refcount_list {

static struct ia_css_refcount_list myrefcount;

static struct ia_css_refcount_entry *refcount_find_entry(hrt_vaddress ptr,
static struct ia_css_refcount_entry *refcount_find_entry(ia_css_ptr ptr,
	bool firstfree)
{
	u32 i;
@@ -121,7 +121,7 @@ void ia_css_refcount_uninit(void)
			    "ia_css_refcount_uninit() leave\n");
}

hrt_vaddress ia_css_refcount_increment(s32 id, hrt_vaddress ptr)
ia_css_ptr ia_css_refcount_increment(s32 id, ia_css_ptr ptr)
{
	struct ia_css_refcount_entry *entry;

@@ -158,7 +158,7 @@ hrt_vaddress ia_css_refcount_increment(s32 id, hrt_vaddress ptr)
	return ptr;
}

bool ia_css_refcount_decrement(s32 id, hrt_vaddress ptr)
bool ia_css_refcount_decrement(s32 id, ia_css_ptr ptr)
{
	struct ia_css_refcount_entry *entry;

@@ -201,7 +201,7 @@ bool ia_css_refcount_decrement(s32 id, hrt_vaddress ptr)
	return false;
}

bool ia_css_refcount_is_single(hrt_vaddress ptr)
bool ia_css_refcount_is_single(ia_css_ptr ptr)
{
	struct ia_css_refcount_entry *entry;

@@ -262,7 +262,7 @@ void ia_css_refcount_clear(s32 id, clear_func clear_func_ptr)
			    count);
}

bool ia_css_refcount_is_valid(hrt_vaddress ptr)
bool ia_css_refcount_is_valid(ia_css_ptr ptr)
{
	struct ia_css_refcount_entry *entry;

+2 −2
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@

/* The address of the remote copy */
hrt_address	debug_buffer_address = (hrt_address) - 1;
hrt_vaddress	debug_buffer_ddr_address = (hrt_vaddress)-1;
ia_css_ptr	debug_buffer_ddr_address = (ia_css_ptr)-1;
/* The local copy */
static debug_data_t		debug_data;
debug_data_t		*debug_data_ptr = &debug_data;
@@ -40,7 +40,7 @@ void debug_buffer_init(const hrt_address addr)
	debug_data.tail = 0;
}

void debug_buffer_ddr_init(const hrt_vaddress addr)
void debug_buffer_ddr_init(const ia_css_ptr addr)
{
	debug_buf_mode_t mode = DEBUG_BUFFER_MODE_LINEAR;
	u32 enable = 1;
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#define __DEBUG_PUBLIC_H_INCLUDED__

#include <type_support.h>
#include <ia_css_types.h>
#include "system_types.h"

/*! brief
@@ -42,7 +43,7 @@ typedef struct debug_data_ddr_s debug_data_ddr_t;

extern debug_data_t				*debug_data_ptr;
extern hrt_address				debug_buffer_address;
extern hrt_vaddress				debug_buffer_ddr_address;
extern ia_css_ptr				debug_buffer_ddr_address;

/*! Check the empty state of the local debug data buffer

@@ -86,7 +87,7 @@ void debug_buffer_init(
 \return none
 */
void debug_buffer_ddr_init(
    const hrt_vaddress		addr);
    const ia_css_ptr		addr);

/*! Set the (remote) operating mode of the debug buffer

+5 −5
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
 * those defined in <stdint.h>
 *
 * The address representation is private to the system
 * and represented as "hrt_vaddress" rather than a
 * and represented as "ia_css_ptr" rather than a
 * pointer, as the memory allocation cannot be accessed
 * by dereferencing but reaquires load and store access
 * functions
@@ -49,7 +49,7 @@

/*
 * User provided file that defines the (sub)system address types:
 *	- hrt_vaddress	a type that can hold the (sub)system virtual address range
 *	- ia_css_ptr	a type that can hold the (sub)system virtual address range
 */
#include "system_types.h"

@@ -77,8 +77,8 @@
 * returned pointer/address.
 */

#define mmgr_NULL		((hrt_vaddress)0)
#define mmgr_EXCEPTION		((hrt_vaddress)-1)
#define mmgr_NULL		((ia_css_ptr)0)
#define mmgr_EXCEPTION		((ia_css_ptr)-1)

/*! Return the address of an allocation in memory

@@ -89,6 +89,6 @@
 \return vaddress
 */

hrt_vaddress mmgr_alloc_attr(const size_t size, const uint16_t attribute);
ia_css_ptr mmgr_alloc_attr(const size_t size, const uint16_t attribute);

#endif /* __MEMORY_ACCESS_H_INCLUDED__ */
Loading