mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 18:05:07 +07:00
6d80f20c53
As said in commit f2c2cbcc35
("powerpc: Use pr_warn instead of
pr_warning"), removing pr_warning so all logging messages use a
consistent <prefix>_warn style. Let's do it.
Link: http://lkml.kernel.org/r/20191018031850.48498-5-wangkefeng.wang@huawei.com
To: linux-kernel@vger.kernel.org
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
68 lines
1.6 KiB
C
68 lines
1.6 KiB
C
/*
|
|
* Copyright (C) 2004 - 2007 Paul Mundt
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
#include <linux/mm.h>
|
|
#include <linux/init.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/dma-mapping.h>
|
|
#include <linux/io.h>
|
|
|
|
static int __init memchunk_setup(char *str)
|
|
{
|
|
return 1; /* accept anything that begins with "memchunk." */
|
|
}
|
|
__setup("memchunk.", memchunk_setup);
|
|
|
|
static void __init memchunk_cmdline_override(char *name, unsigned long *sizep)
|
|
{
|
|
char *p = boot_command_line;
|
|
int k = strlen(name);
|
|
|
|
while ((p = strstr(p, "memchunk."))) {
|
|
p += 9; /* strlen("memchunk.") */
|
|
if (!strncmp(name, p, k) && p[k] == '=') {
|
|
p += k + 1;
|
|
*sizep = memparse(p, NULL);
|
|
pr_info("%s: forcing memory chunk size to 0x%08lx\n",
|
|
name, *sizep);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
int __init platform_resource_setup_memory(struct platform_device *pdev,
|
|
char *name, unsigned long memsize)
|
|
{
|
|
struct resource *r;
|
|
dma_addr_t dma_handle;
|
|
void *buf;
|
|
|
|
r = pdev->resource + pdev->num_resources - 1;
|
|
if (r->flags) {
|
|
pr_warn("%s: unable to find empty space for resource\n", name);
|
|
return -EINVAL;
|
|
}
|
|
|
|
memchunk_cmdline_override(name, &memsize);
|
|
if (!memsize)
|
|
return 0;
|
|
|
|
buf = dma_alloc_coherent(&pdev->dev, memsize, &dma_handle, GFP_KERNEL);
|
|
if (!buf) {
|
|
pr_warn("%s: unable to allocate memory\n", name);
|
|
return -ENOMEM;
|
|
}
|
|
|
|
memset(buf, 0, memsize);
|
|
|
|
r->flags = IORESOURCE_MEM;
|
|
r->start = dma_handle;
|
|
r->end = r->start + memsize - 1;
|
|
r->name = name;
|
|
return 0;
|
|
}
|