aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/Kconfig3
-rw-r--r--arch/sparc64/Kconfig.debug2
-rw-r--r--arch/sparc64/kernel/Makefile2
-rw-r--r--arch/sparc64/kernel/ftrace.c26
-rw-r--r--arch/sparc64/kernel/pci.c10
-rw-r--r--arch/sparc64/kernel/time.c34
-rw-r--r--arch/sparc64/lib/PeeCeeI.c139
-rw-r--r--arch/sparc64/lib/mcount.S4
8 files changed, 72 insertions, 148 deletions
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 035b15af90d8..3b96e70b4670 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -11,8 +11,7 @@ config SPARC
config SPARC64
bool
default y
- select HAVE_DYNAMIC_FTRACE
- select HAVE_FTRACE
+ select HAVE_FUNCTION_TRACER
select HAVE_IDE
select HAVE_LMB
select HAVE_ARCH_KGDB
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
index d6d32d178fc8..c40515c06690 100644
--- a/arch/sparc64/Kconfig.debug
+++ b/arch/sparc64/Kconfig.debug
@@ -33,7 +33,7 @@ config DEBUG_PAGEALLOC
config MCOUNT
bool
- depends on STACK_DEBUG || FTRACE
+ depends on STACK_DEBUG || FUNCTION_TRACER
default y
config FRAME_POINTER
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index c0b8009ab196..b3e0b986bef8 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -5,6 +5,8 @@
EXTRA_AFLAGS := -ansi
EXTRA_CFLAGS := -Werror
+CFLAGS_REMOVE_ftrace.o = -pg
+
extra-y := head.o init_task.o vmlinux.lds
obj-y := process.o setup.o cpu.o idprom.o reboot.o \
diff --git a/arch/sparc64/kernel/ftrace.c b/arch/sparc64/kernel/ftrace.c
index 4298d0aee713..d0218e73f982 100644
--- a/arch/sparc64/kernel/ftrace.c
+++ b/arch/sparc64/kernel/ftrace.c
@@ -9,12 +9,12 @@
static const u32 ftrace_nop = 0x01000000;
-notrace unsigned char *ftrace_nop_replace(void)
+unsigned char *ftrace_nop_replace(void)
{
return (char *)&ftrace_nop;
}
-notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
+unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
{
static u32 call;
s32 off;
@@ -25,7 +25,7 @@ notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
return (unsigned char *) &call;
}
-notrace int
+int
ftrace_modify_code(unsigned long ip, unsigned char *old_code,
unsigned char *new_code)
{
@@ -59,7 +59,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
return faulted;
}
-notrace int ftrace_update_ftrace_func(ftrace_func_t func)
+int ftrace_update_ftrace_func(ftrace_func_t func)
{
unsigned long ip = (unsigned long)(&ftrace_call);
unsigned char old[MCOUNT_INSN_SIZE], *new;
@@ -69,24 +69,6 @@ notrace int ftrace_update_ftrace_func(ftrace_func_t func)
return ftrace_modify_code(ip, old, new);
}
-notrace int ftrace_mcount_set(unsigned long *data)
-{
- unsigned long ip = (long)(&mcount_call);
- unsigned long *addr = data;
- unsigned char old[MCOUNT_INSN_SIZE], *new;
-
- /*
- * Replace the mcount stub with a pointer to the
- * ip recorder function.
- */
- memcpy(old, &mcount_call, MCOUNT_INSN_SIZE);
- new = ftrace_call_replace(ip, *addr);
- *addr = ftrace_modify_code(ip, old, new);
-
- return 0;
-}
-
-
int __init ftrace_dyn_arch_init(void *data)
{
ftrace_mcount_set(data);
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 242ac1ccae7d..bdb7c0a6d83d 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -889,6 +889,7 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev,
for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
struct resource *rp = &pdev->resource[i];
+ resource_size_t aligned_end;
/* Active? */
if (!rp->flags)
@@ -906,8 +907,15 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev,
continue;
}
+ /* Align the resource end to the next page address.
+ * PAGE_SIZE intentionally added instead of (PAGE_SIZE - 1),
+ * because actually we need the address of the next byte
+ * after rp->end.
+ */
+ aligned_end = (rp->end + PAGE_SIZE) & PAGE_MASK;
+
if ((rp->start <= user_paddr) &&
- (user_paddr + user_size) <= (rp->end + 1UL))
+ (user_paddr + user_size) <= aligned_end)
break;
}
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 80d71a5ce1e3..141da3759091 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -490,6 +490,7 @@ static struct of_device_id __initdata bq4802_match[] = {
.name = "rtc",
.compatible = "bq4802",
},
+ {},
};
static struct of_platform_driver bq4802_driver = {
@@ -503,39 +504,16 @@ static struct of_platform_driver bq4802_driver = {
static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
{
struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = pdev->dev.platform_data;
- void __iomem *regs;
- unsigned char val;
-
- regs = (void __iomem *) pdev->resource[0].start;
- val = readb(regs + ofs);
-
- /* the year 0 is 1968 */
- if (ofs == pdata->offset + M48T59_YEAR) {
- val += 0x68;
- if ((val & 0xf) > 9)
- val += 6;
- }
- return val;
+ void __iomem *regs = (void __iomem *) pdev->resource[0].start;
+
+ return readb(regs + ofs);
}
static void mostek_write_byte(struct device *dev, u32 ofs, u8 val)
{
struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = pdev->dev.platform_data;
- void __iomem *regs;
-
- regs = (void __iomem *) pdev->resource[0].start;
- if (ofs == pdata->offset + M48T59_YEAR) {
- if (val < 0x68)
- val += 0x32;
- else
- val -= 0x68;
- if ((val & 0xf) > 9)
- val += 6;
- if ((val & 0xf0) > 0x9A)
- val += 0x60;
- }
+ void __iomem *regs = (void __iomem *) pdev->resource[0].start;
+
writeb(val, regs + ofs);
}
diff --git a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc64/lib/PeeCeeI.c
index 8b313f11bc8d..46053e6ddd7b 100644
--- a/arch/sparc64/lib/PeeCeeI.c
+++ b/arch/sparc64/lib/PeeCeeI.c
@@ -20,107 +20,62 @@ void outsw(unsigned long __addr, const void *src, unsigned long count)
{
void __iomem *addr = (void __iomem *) __addr;
- if (count) {
- u16 *ps = (u16 *)src;
- u32 *pi;
-
- if (((u64)src) & 0x2) {
- u16 val = le16_to_cpup(ps);
- outw(val, addr);
- ps++;
- count--;
- }
- pi = (u32 *)ps;
- while (count >= 2) {
- u32 w = le32_to_cpup(pi);
-
- pi++;
- outw(w >> 0, addr);
- outw(w >> 16, addr);
- count -= 2;
- }
- ps = (u16 *)pi;
- if (count) {
- u16 val = le16_to_cpup(ps);
- outw(val, addr);
- }
+ while (count--) {
+ __raw_writew(*(u16 *)src, addr);
+ src += sizeof(u16);
}
}
void outsl(unsigned long __addr, const void *src, unsigned long count)
{
void __iomem *addr = (void __iomem *) __addr;
+ u32 l, l2;
- if (count) {
- if ((((u64)src) & 0x3) == 0) {
- u32 *p = (u32 *)src;
- while (count--) {
- u32 val = cpu_to_le32p(p);
- outl(val, addr);
- p++;
- }
- } else {
- u8 *pb;
- u16 *ps = (u16 *)src;
- u32 l = 0, l2;
- u32 *pi;
-
- switch (((u64)src) & 0x3) {
- case 0x2:
- count -= 1;
- l = cpu_to_le16p(ps) << 16;
- ps++;
- pi = (u32 *)ps;
- while (count--) {
- l2 = cpu_to_le32p(pi);
- pi++;
- outl(((l >> 16) | (l2 << 16)), addr);
- l = l2;
- }
- ps = (u16 *)pi;
- l2 = cpu_to_le16p(ps);
- outl(((l >> 16) | (l2 << 16)), addr);
- break;
-
- case 0x1:
- count -= 1;
- pb = (u8 *)src;
- l = (*pb++ << 8);
- ps = (u16 *)pb;
- l2 = cpu_to_le16p(ps);
- ps++;
- l |= (l2 << 16);
- pi = (u32 *)ps;
- while (count--) {
- l2 = cpu_to_le32p(pi);
- pi++;
- outl(((l >> 8) | (l2 << 24)), addr);
- l = l2;
- }
- pb = (u8 *)pi;
- outl(((l >> 8) | (*pb << 24)), addr);
- break;
+ if (!count)
+ return;
- case 0x3:
- count -= 1;
- pb = (u8 *)src;
- l = (*pb++ << 24);
- pi = (u32 *)pb;
- while (count--) {
- l2 = cpu_to_le32p(pi);
- pi++;
- outl(((l >> 24) | (l2 << 8)), addr);
- l = l2;
- }
- ps = (u16 *)pi;
- l2 = cpu_to_le16p(ps);
- ps++;
- pb = (u8 *)ps;
- l2 |= (*pb << 16);
- outl(((l >> 24) | (l2 << 8)), addr);
- break;
- }
+ switch (((unsigned long)src) & 0x3) {
+ case 0x0:
+ /* src is naturally aligned */
+ while (count--) {
+ __raw_writel(*(u32 *)src, addr);
+ src += sizeof(u32);
+ }
+ break;
+ case 0x2:
+ /* 2-byte alignment */
+ while (count--) {
+ l = (*(u16 *)src) << 16;
+ l |= *(u16 *)(src + sizeof(u16));
+ __raw_writel(l, addr);
+ src += sizeof(u32);
+ }
+ break;
+ case 0x1:
+ /* Hold three bytes in l each time, grab a byte from l2 */
+ l = (*(u8 *)src) << 24;
+ l |= (*(u16 *)(src + sizeof(u8))) << 8;
+ src += sizeof(u8) + sizeof(u16);
+ while (count--) {
+ l2 = *(u32 *)src;
+ l |= (l2 >> 24);
+ __raw_writel(l, addr);
+ l = l2 << 8;
+ src += sizeof(u32);
+ }
+ break;
+ case 0x3:
+ /* Hold a byte in l each time, grab 3 bytes from l2 */
+ l = (*(u8 *)src) << 24;
+ src += sizeof(u8);
+ while (count--) {
+ l2 = *(u32 *)src;
+ l |= (l2 >> 8);
+ __raw_writel(l, addr);
+ l = l2 << 24;
+ src += sizeof(u32);
}
+ break;
}
}
diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc64/lib/mcount.S
index fad90ddb3a28..7ce9c65f3592 100644
--- a/arch/sparc64/lib/mcount.S
+++ b/arch/sparc64/lib/mcount.S
@@ -93,7 +93,7 @@ mcount:
nop
1:
#endif
-#ifdef CONFIG_FTRACE
+#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
mov %o7, %o0
.globl mcount_call
@@ -119,7 +119,7 @@ mcount_call:
.size _mcount,.-_mcount
.size mcount,.-mcount
-#ifdef CONFIG_FTRACE
+#ifdef CONFIG_FUNCTION_TRACER
.globl ftrace_stub
.type ftrace_stub,#function
ftrace_stub: