summaryrefslogtreecommitdiff
path: root/arch/metag/kernel/tcm.c
diff options
context:
space:
mode:
authorJames Hogan <jhogan@kernel.org>2017-10-24 13:07:54 +0100
committerJames Hogan <jhogan@kernel.org>2018-02-22 11:07:21 +0000
commitbb6fb6dfcc17cddac11ac295861f7608194447a7 (patch)
tree47ee071a415546dd01adbf628f61acb80473d476 /arch/metag/kernel/tcm.c
parent91ab883eb21325ad80f3473633f794c78ac87f51 (diff)
metag: Remove arch/metag/
The earliest Meta architecture port of Linux I have a record of was an import of a Meta port of Linux v2.4.1 in February 2004, which was worked on significantly over the next few years by Graham Whaley, Will Newton, Matt Fleming, myself and others. Eventually the port was merged into mainline in v3.9 in March 2013, not long after Imagination Technologies bought MIPS Technologies and shifted its CPU focus over to the MIPS architecture. As a result, though the port was maintained for a while, kept on life support for a while longer, and useful for testing a few specific drivers for which I don't have ready access to the equivalent MIPS hardware, it is now essentially dead with no users. It is also stuck using an out-of-tree toolchain based on GCC 4.2.4 which is no longer maintained, now struggles to build modern kernels due to toolchain bugs, and doesn't itself build with a modern GCC. The latest buildroot port is still using an old uClibc snapshot which is no longer served, and the latest uClibc doesn't build with GCC 4.2.4. So lets call it a day and drop the Meta architecture port from the kernel. RIP Meta. Signed-off-by: James Hogan <jhogan@kernel.org> Link: https://lkml.kernel.org/r/95906b76-6ce1-3f84-eaba-c29b4ae952eb@roeck-us.net Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Graham Whaley <graham.whaley@gmail.com> Cc: linux-metag@vger.kernel.org
Diffstat (limited to 'arch/metag/kernel/tcm.c')
-rw-r--r--arch/metag/kernel/tcm.c152
1 files changed, 0 insertions, 152 deletions
diff --git a/arch/metag/kernel/tcm.c b/arch/metag/kernel/tcm.c
deleted file mode 100644
index 1d7b4e33b114..000000000000
--- a/arch/metag/kernel/tcm.c
+++ /dev/null
@@ -1,152 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2010 Imagination Technologies Ltd.
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/spinlock.h>
-#include <linux/stddef.h>
-#include <linux/genalloc.h>
-#include <linux/string.h>
-#include <linux/list.h>
-#include <linux/slab.h>
-#include <asm/page.h>
-#include <asm/tcm.h>
-
-struct tcm_pool {
- struct list_head list;
- unsigned int tag;
- unsigned long start;
- unsigned long end;
- struct gen_pool *pool;
-};
-
-static LIST_HEAD(pool_list);
-
-static struct tcm_pool *find_pool(unsigned int tag)
-{
- struct list_head *lh;
- struct tcm_pool *pool;
-
- list_for_each(lh, &pool_list) {
- pool = list_entry(lh, struct tcm_pool, list);
- if (pool->tag == tag)
- return pool;
- }
-
- return NULL;
-}
-
-/**
- * tcm_alloc - allocate memory from a TCM pool
- * @tag: tag of the pool to allocate memory from
- * @len: number of bytes to be allocated
- *
- * Allocate the requested number of bytes from the pool matching
- * the specified tag. Returns the address of the allocated memory
- * or zero on failure.
- */
-unsigned long tcm_alloc(unsigned int tag, size_t len)
-{
- unsigned long vaddr;
- struct tcm_pool *pool;
-
- pool = find_pool(tag);
- if (!pool)
- return 0;
-
- vaddr = gen_pool_alloc(pool->pool, len);
- if (!vaddr)
- return 0;
-
- return vaddr;
-}
-
-/**
- * tcm_free - free a block of memory to a TCM pool
- * @tag: tag of the pool to free memory to
- * @addr: address of the memory to be freed
- * @len: number of bytes to be freed
- *
- * Free the requested number of bytes at a specific address to the
- * pool matching the specified tag.
- */
-void tcm_free(unsigned int tag, unsigned long addr, size_t len)
-{
- struct tcm_pool *pool;
-
- pool = find_pool(tag);
- if (!pool)
- return;
- gen_pool_free(pool->pool, addr, len);
-}
-
-/**
- * tcm_lookup_tag - find the tag matching an address
- * @p: memory address to lookup the tag for
- *
- * Find the tag of the tcm memory region that contains the
- * specified address. Returns %TCM_INVALID_TAG if no such
- * memory region could be found.
- */
-unsigned int tcm_lookup_tag(unsigned long p)
-{
- struct list_head *lh;
- struct tcm_pool *pool;
- unsigned long addr = (unsigned long) p;
-
- list_for_each(lh, &pool_list) {
- pool = list_entry(lh, struct tcm_pool, list);
- if (addr >= pool->start && addr < pool->end)
- return pool->tag;
- }
-
- return TCM_INVALID_TAG;
-}
-
-/**
- * tcm_add_region - add a memory region to TCM pool list
- * @reg: descriptor of region to be added
- *
- * Add a region of memory to the TCM pool list. Returns 0 on success.
- */
-int __init tcm_add_region(struct tcm_region *reg)
-{
- struct tcm_pool *pool;
-
- pool = kmalloc(sizeof(*pool), GFP_KERNEL);
- if (!pool) {
- pr_err("Failed to alloc memory for TCM pool!\n");
- return -ENOMEM;
- }
-
- pool->tag = reg->tag;
- pool->start = reg->res.start;
- pool->end = reg->res.end;
-
- /*
- * 2^3 = 8 bytes granularity to allow for 64bit access alignment.
- * -1 = NUMA node specifier.
- */
- pool->pool = gen_pool_create(3, -1);
-
- if (!pool->pool) {
- pr_err("Failed to create TCM pool!\n");
- kfree(pool);
- return -ENOMEM;
- }
-
- if (gen_pool_add(pool->pool, reg->res.start,
- reg->res.end - reg->res.start + 1, -1)) {
- pr_err("Failed to add memory to TCM pool!\n");
- return -ENOMEM;
- }
- pr_info("Added %s TCM pool (%08x bytes @ %08x)\n",
- reg->res.name, reg->res.end - reg->res.start + 1,
- reg->res.start);
-
- list_add_tail(&pool->list, &pool_list);
-
- return 0;
-}