Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d3bb7e0 authored by Dinesh K Garg's avatar Dinesh K Garg
Browse files

mink: reset server id



CB Server id starts from 0x10 which is incremented by 1 for any new
server created. Once it reaches max i.e. ((1<<16) - 1), it wraps to
0 which is incorrect value to start again. Hence fixing this issue
by assigning server id to 0x10 once max server id is reached.

Change-Id: If6f7d072b0e4cbbeb3f99b1cd5247787537833d6
Signed-off-by: default avatarDinesh K Garg <dineshg@codeaurora.org>
parent 0c32dae3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@
#define MEM_RGN_SRVR_ID 1
#define MEM_MAP_SRVR_ID 2
#define CBOBJ_SERVER_ID_START 0x10
#define CBOBJ_SERVER_ID_END ((1<<16) - 1)
/* local obj id is represented by 15 bits */
#define MAX_LOCAL_OBJ_ID ((1<<15) - 1)
/* CBOBJs will be served by server id 0x10 onwards */
@@ -258,6 +259,9 @@ static struct smcinvoke_server_info *find_cb_server_locked(uint16_t server_id)

static uint16_t next_cb_server_id_locked(void)
{
	if (g_last_cb_server_id == CBOBJ_SERVER_ID_END)
		g_last_cb_server_id = CBOBJ_SERVER_ID_START;

	while (find_cb_server_locked(++g_last_cb_server_id))
		;