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

Commit 528a33e3 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: danipc: Cleanup driver code"

parents 513f0c17 270b4100
Loading
Loading
Loading
Loading
+27 −31
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ void send_pkt(struct sk_buff *skb)
	netdev_dbg(skb->dev, "%s: pair={dst=0x%x src=0x%x}\n", __func__,
		pair->dst, pair->src);

	msg = IPC_msg_alloc(pair->src,
	msg = ipc_msg_alloc(pair->src,
			pair->dst,
			skb->data,
			skb->len,
@@ -52,11 +52,11 @@ void send_pkt(struct sk_buff *skb)
		);

	if (likely(msg)) {
		IPC_msg_send(msg, pair->prio);
		ipc_msg_send(msg, pair->prio);
		skb->dev->stats.tx_packets++;
		skb->dev->stats.tx_bytes += skb->len;
	} else {
		pr_err("%s: IPC_msg_alloc failed!", __func__);
		pr_err("%s: ipc_msg_alloc failed!", __func__);
		skb->dev->stats.tx_dropped++;
	}

@@ -80,7 +80,6 @@ static int delay_skb(struct sk_buff *skb, struct ipc_to_virt_map *map)
		spin_unlock_irqrestore(&skbs_lock, flags);

		schedule_work(&delayed_skbs_work);
		skb->dev->stats.tx_fifo_errors++;
		rc = NETDEV_TX_OK;
	} else {
		netdev_err(skb->dev, "cannot allocate struct delayed_skb\n");
@@ -94,7 +93,7 @@ int danipc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct danipc_pair	*pair = (struct danipc_pair *)
						&(skb->cb[HADDR_CB_OFFSET]);
	struct ipc_to_virt_map	*map = &ipc_to_virt_map[IPC_GetNode(pair->dst)]
	struct ipc_to_virt_map	*map = &ipc_to_virt_map[ipc_get_node(pair->dst)]
								[pair->prio];
	int			rc = NETDEV_TX_OK;

@@ -105,7 +104,7 @@ int danipc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
	 * handle them properly.
	 * Vladik, 27.11.2013
	 */
	if (pair->prio == 13) {
	if (pair->prio == 13) {	/* TODO: replace to ">= IPC_trns_prio_1 */
		printk(
			"%s: unknown packet; pair {src=0x%x dst=0x%x prio=%u}, ignoring\n",
				__func__, pair->src, pair->dst, pair->prio);
@@ -124,35 +123,34 @@ int danipc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)

static void
read_ipc_message(char *const packet, char *buf,
		struct IPC_message_hdr *const first_hdr, const unsigned len,
		u8 cpu_id,
		enum IPC_trns_priority pri)
		struct ipc_msg_hdr *const first_hdr, const unsigned len,
		u8 cpu_id, enum ipc_trns_prio prio)
{
	unsigned		data_len = IPC_FIRST_BUF_DATA_SIZE_MAX;
	unsigned		total_len = 0;
	unsigned		rest_len = len;
	uint8_t			*data_ptr = (uint8_t *)(first_hdr) +
						sizeof(struct IPC_message_hdr);
	struct IPC_buffer_hdr	*next_ptr = NULL;
						sizeof(struct ipc_msg_hdr);
	struct ipc_buf_hdr	*next_ptr = NULL;

	if (first_hdr->nextBufPtr)
		first_hdr->nextBufPtr = ipc_to_virt(cpu_id, pri,
						(u32)first_hdr->nextBufPtr);
	next_ptr = first_hdr->nextBufPtr;
	if (first_hdr->next)
		first_hdr->next = ipc_to_virt(cpu_id, prio,
						(u32)first_hdr->next);
	next_ptr = first_hdr->next;

	do {
		if (total_len != 0) {
			data_len = IPC_NEXT_BUF_DATA_SIZE_MAX;
			data_ptr = (uint8_t *)(next_ptr) +
						sizeof(struct IPC_buffer_hdr);
			if (next_ptr->nextBufPtr)
				next_ptr->nextBufPtr = ipc_to_virt(cpu_id, pri,
						(u32)next_ptr->nextBufPtr);
			next_ptr = next_ptr->nextBufPtr;
						sizeof(struct ipc_buf_hdr);
			if (next_ptr->next)
				next_ptr->next = ipc_to_virt(cpu_id, prio,
						(u32)next_ptr->next);
			next_ptr = next_ptr->next;
		}

		/* Clean 2 last bits (service information) */
		next_ptr = (struct IPC_buffer_hdr *)(((uint32_t)next_ptr) &
		next_ptr = (struct ipc_buf_hdr *)(((uint32_t)next_ptr) &
							(~IPC_BUF_TYPE_BITS));
		data_len = min(rest_len, data_len);
		rest_len -= data_len;
@@ -160,16 +158,14 @@ read_ipc_message(char *const packet, char *buf,
		total_len += data_len;
	} while ((next_ptr != NULL) && (rest_len != 0));

	IPC_buf_free(packet, pri);
	ipc_buf_free(packet, prio);
}

void
handle_incoming_packet(char *const packet, u8 cpu_id,
						enum IPC_trns_priority pri)
handle_incoming_packet(char *const packet, u8 cpu_id, enum ipc_trns_prio prio)
{
	struct IPC_message_hdr *const first_hdr =
					    (struct IPC_message_hdr *)packet;
	const unsigned			msg_len = first_hdr->msgLen;
	struct ipc_msg_hdr *const first_hdr = (struct ipc_msg_hdr *)packet;
	const unsigned			msg_len = first_hdr->msg_len;

	struct sk_buff *skb = netdev_alloc_skb(danipc_dev, msg_len);

@@ -177,11 +173,11 @@ handle_incoming_packet(char *const packet, u8 cpu_id,
		struct danipc_pair	*pair = (struct danipc_pair *)
						&(skb->cb[HADDR_CB_OFFSET]);

		pair->dst = first_hdr->destAgentId;
		pair->src = first_hdr->srcAgentId;
		pair->dst = first_hdr->dest_aid;
		pair->src = first_hdr->src_aid;

		read_ipc_message(packet, skb->data, first_hdr, msg_len, cpu_id,
					pri);
					prio);

		netdev_dbg(danipc_dev, "%s() pair={dst=0x%x src=0x%x}\n",
			__func__, pair->dst, pair->src);
@@ -189,7 +185,7 @@ handle_incoming_packet(char *const packet, u8 cpu_id,
		skb_put(skb, msg_len);
		skb_reset_mac_header(skb);

		skb->protocol = cpu_to_be16(AGENTID_TO_COOKIE(pair->dst, pri));
		skb->protocol = cpu_to_be16(AGENTID_TO_COOKIE(pair->dst, prio));

		netif_rx(skb);
		danipc_dev->stats.rx_packets++;
+26 −31
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@
#include <linux/ioctl.h>

#include "danipc_k.h"
#include <linux/danipc_ioctl.h>

#include "ipc_api.h"
#include "danipc_lowlevel.h"

@@ -86,7 +84,7 @@ static int
second_registration(struct danipc_reg *danipc_reg_p, const int aid,
			const unsigned lid)
{
	return (danipc_strncmp(agentTable[aid].agentName, danipc_reg_p->name,
	return (danipc_strncmp(agent_table[aid].name, danipc_reg_p->name,
			MAX_AGENT_NAME_LEN, MAX_AGENT_NAME) &&
		agent_data[lid].task == current) ? 1 : 0;
}
@@ -107,14 +105,13 @@ register_agent(struct net_device *dev, struct danipc_reg *danipc_reg_p)
	r_lid = danipc_reg.requested_lid;

	if (r_lid != INVALID_ID) {
		const unsigned r_aid = __IPC_AGENT_ID(PLATFORM_my_ipc_id,
							r_lid);
		const unsigned r_aid = __IPC_AGENT_ID(LOCAL_IPC_ID, r_lid);

		/* Requested ID is not used, so assign it */
		if (!*agentTable[r_aid].agentName ||
		if (!*agent_table[r_aid].name ||
		    second_registration(&danipc_reg, r_aid, r_lid) ||
		    (danipc_strncmp(danipc_reg.name,
			agentTable[r_aid].agentName,
				agent_table[r_aid].name,
				MAX_AGENT_NAME, MAX_AGENT_NAME_LEN) &&
			 agent_data[r_lid].task == NULL)) {
			if (put_user(r_lid, &danipc_reg_p->assigned_lid))
@@ -127,10 +124,9 @@ register_agent(struct net_device *dev, struct danipc_reg *danipc_reg_p)
		unsigned	lid;
		/* Scan for the ID already assigned */
		for (lid = 0; lid < MAX_LOCAL_AGENT; lid++) {
			const unsigned aid = __IPC_AGENT_ID(PLATFORM_my_ipc_id,
								lid);
			const unsigned aid = __IPC_AGENT_ID(LOCAL_IPC_ID, lid);
			if (danipc_strncmp(danipc_reg.name,
				agentTable[aid].agentName,
				agent_table[aid].name,
					MAX_AGENT_NAME, MAX_AGENT_NAME_LEN)
					&& agent_data[lid].task == NULL) {
				if (put_user(lid, &danipc_reg_p->assigned_lid))
@@ -145,9 +141,8 @@ register_agent(struct net_device *dev, struct danipc_reg *danipc_reg_p)
		unsigned	lid;
		/* Scan for the 1st free ID */
		for (lid = 0; lid < MAX_LOCAL_AGENT; lid++) {
			const unsigned aid = __IPC_AGENT_ID(PLATFORM_my_ipc_id,
								lid);
			if (!*agentTable[aid].agentName ||
			const unsigned aid = __IPC_AGENT_ID(LOCAL_IPC_ID, lid);
			if (!*agent_table[aid].name ||
				second_registration(&danipc_reg, aid, lid)) {
				if (put_user(lid, &danipc_reg_p->assigned_lid))
					return -EFAULT;
@@ -158,19 +153,20 @@ register_agent(struct net_device *dev, struct danipc_reg *danipc_reg_p)
	}

	if (agent_id != INVALID_ID) {
		const unsigned an_siz = sizeof(agentTable[agent_id].agentName);
		const unsigned an_siz = sizeof(agent_table[agent_id].name);
		const uint16_t cookie = cpu_to_be16(AGENTID_TO_COOKIE(agent_id,
							danipc_reg.prio));
		strlcpy(agentTable[agent_id].agentName, danipc_reg.name,
		strlcpy(agent_table[agent_id].name, danipc_reg.name,
			an_siz);
		agentTable[agent_id].agentName[an_siz-1] = 0;
		agent_table[agent_id].name[an_siz-1] = 0;
		if (put_user(cookie, &danipc_reg_p->cookie))
			rc = -EFAULT;
		agent_data[IPC_LocalId(agent_id)].task	= current;
		agent_data[IPC_LocalId(agent_id)].pid	= current->pid;
		netdev_dbg(dev, "%s(): agent_id=0x%x assigned_lid=0x%x agentTable[]=\"%s\"\n",
		agent_data[ipc_lid(agent_id)].task	= current;
		agent_data[ipc_lid(agent_id)].pid	= current->pid;
		netdev_dbg(dev,
			"%s: agent_id=0x%x assigned_lid=0x%x agent_table[]=\"%s\"\n",
			__func__, agent_id, danipc_reg.assigned_lid,
			agentTable[agent_id].agentName);
			agent_table[agent_id].name);
	} else
		rc = -ENOBUFS;

@@ -187,15 +183,15 @@ get_name_by_addr(struct net_device *dev, struct danipc_name *danipc_name_p)
	if (get_user(addr, &danipc_name_p->addr))
		return -EFAULT;

	if (*agentTable[addr].agentName) {
	if (*agent_table[addr].name) {
		if (copy_to_user(danipc_name_p->name,
				agentTable[danipc_name_p->addr].agentName,
				agent_table[danipc_name_p->addr].name,
				sizeof(danipc_name_p->name)))
			rc = -EFAULT;
		else
			rc = 0;
		netdev_dbg(dev, "%s(): addr=0x%x -> name=%s\n", __func__,
			addr, agentTable[danipc_name_p->addr].agentName);
			addr, agent_table[danipc_name_p->addr].name);
	}

	return rc;
@@ -213,7 +209,7 @@ get_addr_by_name(struct net_device *dev, struct danipc_name *danipc_name_p)
		return -EFAULT;

	for (aid = 0; aid < MAX_AGENTS; aid++) {
		if (danipc_strncmp(name, agentTable[aid].agentName,
		if (danipc_strncmp(name, agent_table[aid].name,
				MAX_AGENT_NAME, MAX_AGENT_NAME_LEN)) {
			const unsigned cpuid = aid / MAX_LOCAL_AGENT;
			const unsigned lid = aid % MAX_LOCAL_AGENT;
@@ -222,9 +218,8 @@ get_addr_by_name(struct net_device *dev, struct danipc_name *danipc_name_p)
				rc = -EFAULT;
			else
				rc = 0;
			netdev_dbg(dev,
				"%s(): name=%s -> addr=0x%x\n", __func__,
				agentTable[aid].agentName, aid);
			netdev_dbg(dev, "%s: name=%s -> addr=0x%x\n", __func__,
				agent_table[aid].name, aid);
		}
	}

+31 −35
Original line number Diff line number Diff line
@@ -67,9 +67,9 @@ static void __iomem *krait_ipc_mux;
static void init_own_ipc_to_virt_map(struct danipc_priv *priv)
{
	struct ipc_to_virt_map *high_map =
		&ipc_to_virt_map[PLATFORM_my_ipc_id][IPC_trns_prio_1];
		&ipc_to_virt_map[LOCAL_IPC_ID][ipc_trns_prio_1];
	struct ipc_to_virt_map *low_map =
		&ipc_to_virt_map[PLATFORM_my_ipc_id][IPC_trns_prio_0];
		&ipc_to_virt_map[LOCAL_IPC_ID][ipc_trns_prio_0];

	/* This prevents remapping by remap_fifo_mem() */
	high_map->vaddr		= &ipc_buffers[0];
@@ -87,12 +87,12 @@ static void unmap_ipc_to_virt_map(void)
	int		cpuid;

	for (cpuid = 0; cpuid < PLATFORM_MAX_NUM_OF_NODES; cpuid++) {
		if (cpuid == PLATFORM_my_ipc_id)
		if (cpuid == LOCAL_IPC_ID)
			continue;
		if (ipc_to_virt_map[cpuid][IPC_trns_prio_1].vaddr)
			iounmap(ipc_to_virt_map[cpuid][IPC_trns_prio_1].vaddr);
		if (ipc_to_virt_map[cpuid][IPC_trns_prio_0].vaddr)
			iounmap(ipc_to_virt_map[cpuid][IPC_trns_prio_0].vaddr);
		if (ipc_to_virt_map[cpuid][ipc_trns_prio_1].vaddr)
			iounmap(ipc_to_virt_map[cpuid][ipc_trns_prio_1].vaddr);
		if (ipc_to_virt_map[cpuid][ipc_trns_prio_0].vaddr)
			iounmap(ipc_to_virt_map[cpuid][ipc_trns_prio_0].vaddr);
	}
}

@@ -100,8 +100,8 @@ static void remap_fifo_mem(const int cpuid, const unsigned prio,
				const uint32_t paddr)
{
	struct ipc_to_virt_map *const map = ipc_to_virt_map[cpuid];
	unsigned other_prio = (prio == IPC_trns_prio_0) ?
				IPC_trns_prio_1 : IPC_trns_prio_0;
	unsigned other_prio = (prio == ipc_trns_prio_0) ?
				ipc_trns_prio_1 : ipc_trns_prio_0;
	uint32_t start_addr;
	uint32_t map_size;
	uint32_t map_mask;
@@ -110,8 +110,8 @@ static void remap_fifo_mem(const int cpuid, const unsigned prio,
	 * Since shared memory is used for both FIFO priorities, remap
	 * only once for this CPU.
	 */
	if (IPC_shared_mem_sizes[cpuid]) {
		map_size = IPC_shared_mem_sizes[cpuid];
	if (ipc_shared_mem_sizes[cpuid]) {
		map_size = ipc_shared_mem_sizes[cpuid];
		map_mask = map_size - 1;
		start_addr = ((paddr + map_mask) & ~map_mask) - map_size;
		map[prio].paddr = map[other_prio].paddr = start_addr;
@@ -135,7 +135,7 @@ static void remap_fifo_mem(const int cpuid, const unsigned prio,

uint32_t virt_to_ipc(const int cpuid, const unsigned prio, void *vaddr)
{
	if (likely(prio <= IPC_trns_prio_1)) {
	if (likely(prio <= ipc_trns_prio_1)) {
		struct ipc_to_virt_map	*map = &ipc_to_virt_map[cpuid][prio];
		int		offset;

@@ -157,7 +157,7 @@ uint32_t virt_to_ipc(const int cpuid, const unsigned prio, void *vaddr)

void *ipc_to_virt(const int cpuid, const unsigned prio, const uint32_t ipc_addr)
{
	if (likely(prio <= IPC_trns_prio_1 ||
	if (likely(prio <= ipc_trns_prio_1 ||
			cpuid < PLATFORM_MAX_NUM_OF_NODES)) {
		struct ipc_to_virt_map	*map = &ipc_to_virt_map[cpuid][prio];
		const uint32_t	paddr = ipc_addr;
@@ -179,15 +179,14 @@ void *ipc_to_virt(const int cpuid, const unsigned prio, const uint32_t ipc_addr)
void high_prio_rx(unsigned long data)
{
	struct net_device	*dev = (struct net_device *)data;
	const unsigned	base_addr =
			(unsigned)IPC_array_hw_access[PLATFORM_my_ipc_id];
	const unsigned	base_addr = ipc_regs[LOCAL_IPC_ID];

	/* Clear interrupt source. */
	__raw_writel_no_log(IPC_INTR(IPC_INTR_FIFO_AF),
				(void *)(base_addr + CDU_INT0_CLEAR_F0));

	/* Process all messages. */
	IPC_receive(IPC_FIFO_BUF_NUM_HIGH, IPC_trns_prio_1);
	ipc_recv(IPC_FIFO_BUF_NUM_HIGH, ipc_trns_prio_1);

	/* Unmask IPC AF interrupt again. */
	__raw_writel_no_log(~IPC_INTR(IPC_INTR_FIFO_AF),
@@ -200,8 +199,7 @@ irqreturn_t danipc_interrupt(int irq, void *data)
{
	struct net_device	*dev = (struct net_device *)data;
	struct danipc_priv	*priv = netdev_priv(dev);
	const unsigned	base_addr =
			(unsigned)IPC_array_hw_access[PLATFORM_my_ipc_id];
	const unsigned	base_addr = ipc_regs[LOCAL_IPC_ID];

	/* Mask all IPC interrupts. */
	__raw_writel_no_log(~0, (void *)(base_addr + CDU_INT0_MASK_F0));
@@ -215,8 +213,7 @@ irqreturn_t danipc_interrupt(int irq, void *data)

void danipc_init_irq(struct net_device *dev, struct danipc_priv *priv)
{
	const unsigned	base_addr =
			(unsigned)IPC_array_hw_access[PLATFORM_my_ipc_id];
	const unsigned	base_addr = ipc_regs[LOCAL_IPC_ID];

	__raw_writel_no_log(AF_THRESHOLD,
				(void *)(base_addr + FIFO_THR_AF_CFG_F0));
@@ -234,9 +231,9 @@ void danipc_init_irq(struct net_device *dev, struct danipc_priv *priv)

static void remap_agent_table(struct danipc_priv *priv)
{
	agentTable = ioremap_nocache(priv->res_start[AGENT_TABLE_RES],
	agent_table = ioremap_nocache(priv->res_start[AGENT_TABLE_RES],
					priv->res_len[AGENT_TABLE_RES]);
	if (!agentTable) {
	if (!agent_table) {
		pr_err("%s: cannot remap IPC global agent table\n", __func__);
		BUG();
	}
@@ -244,21 +241,20 @@ static void remap_agent_table(struct danipc_priv *priv)

static void unmap_agent_table(void)
{
	if (agentTable)
		iounmap(agentTable);
	if (agent_table)
		iounmap(agent_table);
}

static void prepare_node(const int cpuid)
{
	struct ipc_to_virt_map	*map;

	IPC_array_hw_access[cpuid] =
		ioremap_nocache(IPC_array_hw_access_phys[cpuid],
						IPC_hw_access_phys_len[cpuid]);
	map = &ipc_to_virt_map[cpuid][IPC_trns_prio_0];
	ipc_regs[cpuid] = (uintptr_t)ioremap_nocache(ipc_regs_phys[cpuid],
							ipc_regs_len[cpuid]);
	map = &ipc_to_virt_map[cpuid][ipc_trns_prio_0];
	atomic_set(&map->pending_skbs, 0);

	map = &ipc_to_virt_map[cpuid][IPC_trns_prio_1];
	map = &ipc_to_virt_map[cpuid][ipc_trns_prio_1];
	atomic_set(&map->pending_skbs, 0);
}

@@ -267,7 +263,7 @@ static void prepare_nodes(void)
	int		n;

	for (n = 0; n < PLATFORM_MAX_NUM_OF_NODES; n++)
		if (IPC_array_hw_access_phys[n])
		if (ipc_regs_phys[n])
			prepare_node(n);
}

@@ -276,8 +272,8 @@ static void unmap_nodes_memory(void)
	int		n;

	for (n = 0; n < PLATFORM_MAX_NUM_OF_NODES; n++)
		if (IPC_array_hw_access[n])
			iounmap(IPC_array_hw_access[n]);
		if (ipc_regs[n])
			iounmap((void __iomem *)ipc_regs[n]);
}

static void *alloc_ipc_buffers(struct danipc_priv *priv)
@@ -326,7 +322,7 @@ int danipc_ll_init(struct danipc_priv *priv)
		remap_agent_table(priv);
		init_own_ipc_to_virt_map(priv);
		remap_krait_ipc_mux(priv);
		rc = IPC_init();
		rc = ipc_init();
	}

	return rc;
@@ -346,5 +342,5 @@ void danipc_ll_cleanup(void)
void danipc_poll(struct net_device *dev)
{
	(void)dev;
	IPC_receive(IPC_FIFO_BUF_NUM_LOW, IPC_trns_prio_0);
	ipc_recv(IPC_FIFO_BUF_NUM_LOW, ipc_trns_prio_0);
}
+26 −26
Original line number Diff line number Diff line
@@ -32,13 +32,13 @@
						IPC_BUF_SIZE_MAX)

extern uint8_t __iomem			*ipc_buffers;
extern uint32_t				IPC_array_hw_access_phys[];
extern unsigned				IPC_hw_access_phys_len[];
extern void __iomem			*IPC_array_hw_access[];
extern uint32_t				IPC_shared_mem_sizes[];
extern struct agentNameEntry __iomem	*agentTable;
extern uint32_t				ipc_regs_phys[];
extern unsigned				ipc_regs_len[];
extern uintptr_t			ipc_regs[];
extern uint32_t				ipc_shared_mem_sizes[];
extern struct agent_entry __iomem	*agent_table;

#define PLATFORM_my_ipc_id	/*CHIP_IPC_KRAIT_ADDR*/ 8
#define LOCAL_IPC_ID		8 /*CHIP_IPC_KRAIT_ADDR*/

struct ipc_to_virt_map {
	/* Physical address of the FIFO data buffer *without* bit 31 set. */
@@ -59,30 +59,30 @@ extern void *ipc_to_virt(const int cpuid, const unsigned prio,
			(((cpuid&(PLATFORM_MAX_NUM_OF_NODES-1)) << 4) +	\
				(0x0f & (lid)))

extern unsigned	IPC_init(void);
extern void	IPC_trns_fifo_buff_init(uint8_t cpu_id);
extern void	IPC_routeTableInit(struct IPC_transport_func const *ptr);
extern char	*IPC_trns_fifo_buffer_alloc(uint8_t dest_agent_id,
						   enum IPC_trns_priority pri);
extern void	IPC_trns_fifo_buffer_free(char *ptr, uint8_t dest_agent_id,
						enum IPC_trns_priority pri);
extern int32_t	IPC_trns_fifo_buf_send(char *ptr, uint8_t destId,
						enum IPC_trns_priority pri);
extern char	*IPC_trns_fifo2eth_buffer_alloc(uint8_t dest_agent_id,
						enum IPC_trns_priority pri);
extern void	IPC_trns_fifo2eth_buffer_free(char *ptr, uint8_t dest_agent_id,
						enum IPC_trns_priority pri);
extern int32_t	IPC_trns_fifo2eth_buffer_send(char *ptr, uint8_t destId,
						enum IPC_trns_priority pri);
extern char	*IPC_trns_fifo_buf_read(enum IPC_trns_priority pri);
extern void	IPC_agent_table_clean(void);
extern uint8_t	IPC_getOwnNode(void);
extern struct IPC_transport_func const *IPC_getUtilFuncVector(uint8_t nodeId);
extern unsigned	ipc_init(void);
extern void	ipc_trns_fifo_buf_init(uint8_t cpu_id);
extern void	ipc_route_table_init(struct ipc_trns_func const *ptr);
extern char	*ipc_trns_fifo_buf_alloc(uint8_t dest_aid,
						   enum ipc_trns_prio pri);
extern void	ipc_trns_fifo_buf_free(char *ptr, uint8_t dest_aid,
						enum ipc_trns_prio pri);
extern int32_t	ipc_trns_fifo_buf_send(char *ptr, uint8_t destId,
						enum ipc_trns_prio pri);
extern char	*ipc_trns_fifo2eth_buf_alloc(uint8_t dest_aid,
						enum ipc_trns_prio pri);
extern void	ipc_trns_fifo2eth_buf_free(char *ptr, uint8_t dest_aid,
						enum ipc_trns_prio pri);
extern int32_t	ipc_trns_fifo2eth_buf_send(char *ptr, uint8_t destId,
						enum ipc_trns_prio pri);
extern char	*ipc_trns_fifo_buf_read(enum ipc_trns_prio pri);
extern void	ipc_agent_table_clean(void);
extern uint8_t	ipc_get_own_node(void);
extern struct ipc_trns_func const *get_trns_funcs(uint8_t cpuid);


extern void	handle_incoming_packet(char *const packet,
					uint8_t cpu_id,
					enum IPC_trns_priority pri);
					enum ipc_trns_prio pri);

extern struct ipc_to_virt_map	ipc_to_virt_map[PLATFORM_MAX_NUM_OF_NODES][2];

+9 −11
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@
#include <linux/ioctl.h>

#include "danipc_k.h"
#include <linux/danipc_ioctl.h>
#include "ipc_api.h"
#include "danipc_lowlevel.h"

@@ -236,8 +235,8 @@ static int parse_resources(struct platform_device *pdev,
								IORESOURCE_MEM,
								regs[r]);
			if (res) {
				IPC_array_hw_access_phys[r] = res->start;
				IPC_hw_access_phys_len[r] = resource_size(res);
				ipc_regs_phys[r] = res->start;
				ipc_regs_len[r] = resource_size(res);
			} else {
				pr_err("cannot get resource %s\n", regs[r]);
				parse_err = true;
@@ -245,11 +244,10 @@ static int parse_resources(struct platform_device *pdev,

			if (of_property_read_u32((&pdev->dev)->of_node,
					shm_sizes[r],
					&shm_size)) {
				IPC_shared_mem_sizes[r] = 0;
			} else {
				IPC_shared_mem_sizes[r] = shm_size;
			}
					&shm_size))
				ipc_shared_mem_sizes[r] = 0;
			else
				ipc_shared_mem_sizes[r] = shm_size;
		}

		rc = (!parse_err) ? 0 : -ENOMEM;
Loading