Skip to content

Commit

Permalink
Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze
Browse files Browse the repository at this point in the history
Pull microblaze arch updates from Michal Simek.

* 'next' of git://git.monstr.eu/linux-2.6-microblaze:
  Revert "microblaze_mmu_v2: Update signal returning address"
  microblaze: Added more support for PCI
  microblaze: Prefer to use pr_XXX instead of printk(KERN_XX)
  microblaze: Fix bug with passing command line
  microblaze: Remove PAGE properties duplication
  microblaze: Remove additional andi which has been already done
  microblaze: Use predefined macro for ESR_DIZ
  microblaze: Support 4k/16k/64k pages
  microblaze: Do not used hardcoded value in exception handler
  microblaze: Added fdt chosen capability for timer
  microblaze: Add support for ioreadXX/iowriteXX_rep
  microblaze: Improve failure handling for GPIO reset
  microblaze: clinkage.h
  • Loading branch information
torvalds committed Oct 7, 2012
2 parents 638c87a + 94fda49 commit 5cad359
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 80 deletions.
7 changes: 2 additions & 5 deletions arch/microblaze/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,11 @@ choice
config MICROBLAZE_4K_PAGES
bool "4k page size"

config MICROBLAZE_8K_PAGES
bool "8k page size"

config MICROBLAZE_16K_PAGES
bool "16k page size"

config MICROBLAZE_32K_PAGES
bool "32k page size"
config MICROBLAZE_64K_PAGES
bool "64k page size"

endchoice

Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/include/asm/clinkage.h

This file was deleted.

94 changes: 94 additions & 0 deletions arch/microblaze/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ extern resource_size_t isa_mem_base;

#define IO_SPACE_LIMIT (0xFFFFFFFF)

/* the following is needed to support PCI with some drivers */

#define mmiowb()

static inline unsigned char __raw_readb(const volatile void __iomem *addr)
{
return *(volatile unsigned char __force *)addr;
Expand Down Expand Up @@ -248,4 +252,94 @@ static inline void __iomem *__ioremap(phys_addr_t address, unsigned long size,
#define ioport_map(port, nr) ((void __iomem *)(port))
#define ioport_unmap(addr)

/* from asm-generic/io.h */
#ifndef insb
static inline void insb(unsigned long addr, void *buffer, int count)
{
if (count) {
u8 *buf = buffer;
do {
u8 x = inb(addr);
*buf++ = x;
} while (--count);
}
}
#endif

#ifndef insw
static inline void insw(unsigned long addr, void *buffer, int count)
{
if (count) {
u16 *buf = buffer;
do {
u16 x = inw(addr);
*buf++ = x;
} while (--count);
}
}
#endif

#ifndef insl
static inline void insl(unsigned long addr, void *buffer, int count)
{
if (count) {
u32 *buf = buffer;
do {
u32 x = inl(addr);
*buf++ = x;
} while (--count);
}
}
#endif

#ifndef outsb
static inline void outsb(unsigned long addr, const void *buffer, int count)
{
if (count) {
const u8 *buf = buffer;
do {
outb(*buf++, addr);
} while (--count);
}
}
#endif

#ifndef outsw
static inline void outsw(unsigned long addr, const void *buffer, int count)
{
if (count) {
const u16 *buf = buffer;
do {
outw(*buf++, addr);
} while (--count);
}
}
#endif

#ifndef outsl
static inline void outsl(unsigned long addr, const void *buffer, int count)
{
if (count) {
const u32 *buf = buffer;
do {
outl(*buf++, addr);
} while (--count);
}
}
#endif

#define ioread8_rep(p, dst, count) \
insb((unsigned long) (p), (dst), (count))
#define ioread16_rep(p, dst, count) \
insw((unsigned long) (p), (dst), (count))
#define ioread32_rep(p, dst, count) \
insl((unsigned long) (p), (dst), (count))

#define iowrite8_rep(p, src, count) \
outsb((unsigned long) (p), (src), (count))
#define iowrite16_rep(p, src, count) \
outsw((unsigned long) (p), (src), (count))
#define iowrite32_rep(p, src, count) \
outsl((unsigned long) (p), (src), (count))

#endif /* _ASM_MICROBLAZE_IO_H */
9 changes: 4 additions & 5 deletions arch/microblaze/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
#ifdef __KERNEL__

/* PAGE_SHIFT determines the page size */
#if defined(CONFIG_MICROBLAZE_32K_PAGES)
#define PAGE_SHIFT 15
#if defined(CONFIG_MICROBLAZE_64K_PAGES)
#define PAGE_SHIFT 16
#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
#define PAGE_SHIFT 14
#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
#define PAGE_SHIFT 13
#else
#define PAGE_SHIFT 12
#endif
Expand All @@ -37,6 +35,8 @@

#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))

#define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */

#ifndef __ASSEMBLY__

/* MS be sure that SLAB allocates aligned objects */
Expand Down Expand Up @@ -71,7 +71,6 @@ extern unsigned int __page_offset;
* The basic type of a PTE - 32 bit physical addressing.
*/
typedef unsigned long pte_basic_t;
#define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */
#define PTE_FMT "%.8lx"

#endif /* CONFIG_MMU */
Expand Down
2 changes: 2 additions & 0 deletions arch/microblaze/include/asm/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <asm/prom.h>
#include <asm/pci-bridge.h>

#include <asm-generic/pci-dma-compat.h>

#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000

Expand Down
6 changes: 0 additions & 6 deletions arch/microblaze/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,6 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
#ifndef _PAGE_SHARED
#define _PAGE_SHARED 0
#endif
#ifndef _PAGE_HWWRITE
#define _PAGE_HWWRITE 0
#endif
#ifndef _PAGE_HWEXEC
#define _PAGE_HWEXEC 0
#endif
#ifndef _PAGE_EXEC
#define _PAGE_EXEC 0
#endif
Expand Down
14 changes: 9 additions & 5 deletions arch/microblaze/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,24 @@ no_fdt_arg:
#ifndef CONFIG_CMDLINE_BOOL
/*
* handling command line
* copy command line to __init_end. There is space for storing command line.
* copy command line directly to cmd_line placed in data section.
*/
beqid r5, skip /* Skip if NULL pointer */
or r6, r0, r0 /* incremment */
ori r4, r0, __init_end /* load address of command line */
ori r4, r0, cmd_line /* load address of command line */
tophys(r4,r4) /* convert to phys address */
ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */
_copy_command_line:
lbu r2, r5, r6 /* r2=r5+r6 - r5 contain pointer to command line */
sb r2, r4, r6 /* addr[r4+r6]= r2*/
/* r2=r5+r6 - r5 contain pointer to command line */
lbu r2, r5, r6
beqid r2, skip /* Skip if no data */
sb r2, r4, r6 /* addr[r4+r6]= r2*/
addik r6, r6, 1 /* increment counting */
bgtid r3, _copy_command_line /* loop for all entries */
addik r3, r3, -1 /* descrement loop */
addik r3, r3, -1 /* decrement loop */
addik r5, r4, 0 /* add new space for command line */
tovirt(r5,r5)
skip:
#endif /* CONFIG_CMDLINE_BOOL */

#ifdef NOT_COMPILE
Expand Down
61 changes: 36 additions & 25 deletions arch/microblaze/kernel/hw_exception_handler.S
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#include <asm/mmu.h>
#include <asm/pgtable.h>
#include <asm/signal.h>
#include <asm/registers.h>
#include <asm/asm-offsets.h>

#undef DEBUG
Expand Down Expand Up @@ -581,7 +582,7 @@ ex_handler_done:
* tried to access a kernel or read-protected page - always
* a SEGV). All other faults here must be stores, so no
* need to check ESR_S as well. */
andi r4, r4, 0x800 /* ESR_Z - zone protection */
andi r4, r4, ESR_DIZ /* ESR_Z - zone protection */
bnei r4, ex2

ori r4, r0, swapper_pg_dir
Expand All @@ -595,25 +596,25 @@ ex_handler_done:
* tried to access a kernel or read-protected page - always
* a SEGV). All other faults here must be stores, so no
* need to check ESR_S as well. */
andi r4, r4, 0x800 /* ESR_Z */
andi r4, r4, ESR_DIZ /* ESR_Z */
bnei r4, ex2
/* get current task address */
addi r4 ,CURRENT_TASK, TOPHYS(0);
lwi r4, r4, TASK_THREAD+PGDIR
ex4:
tophys(r4,r4)
BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
andi r5, r5, 0xffc
/* Create L1 (pgdir/pmd) address */
BSRLI(r5,r3, PGDIR_SHIFT - 2)
andi r5, r5, PAGE_SIZE - 4
/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
or r4, r4, r5
lwi r4, r4, 0 /* Get L1 entry */
andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
beqi r5, ex2 /* Bail if no table */

tophys(r5,r5)
BSRLI(r6,r3,10) /* Compute PTE address */
andi r6, r6, 0xffc
andi r5, r5, 0xfffff003
BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
andi r6, r6, PAGE_SIZE - 4
or r5, r5, r6
lwi r4, r5, 0 /* Get Linux PTE */

Expand All @@ -632,7 +633,9 @@ ex_handler_done:
* Many of these bits are software only. Bits we don't set
* here we (properly should) assume have the appropriate value.
*/
andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
/* Ignore memory coherent, just LSB on ZSEL is used + EX/WR */
andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
TLB_ZSEL(1) | TLB_ATTR_MASK
ori r4, r4, _PAGE_HWEXEC /* make it executable */

/* find the TLB index that caused the fault. It has to be here*/
Expand Down Expand Up @@ -701,18 +704,18 @@ ex_handler_done:
lwi r4, r4, TASK_THREAD+PGDIR
ex6:
tophys(r4,r4)
BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
andi r5, r5, 0xffc
/* Create L1 (pgdir/pmd) address */
BSRLI(r5,r3, PGDIR_SHIFT - 2)
andi r5, r5, PAGE_SIZE - 4
/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
or r4, r4, r5
lwi r4, r4, 0 /* Get L1 entry */
andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
beqi r5, ex7 /* Bail if no table */

tophys(r5,r5)
BSRLI(r6,r3,10) /* Compute PTE address */
andi r6, r6, 0xffc
andi r5, r5, 0xfffff003
BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
andi r6, r6, PAGE_SIZE - 4
or r5, r5, r6
lwi r4, r5, 0 /* Get Linux PTE */

Expand All @@ -731,7 +734,8 @@ ex_handler_done:
* here we (properly should) assume have the appropriate value.
*/
brid finish_tlb_load
andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
TLB_ZSEL(1) | TLB_ATTR_MASK
ex7:
/* The bailout. Restore registers to pre-exception conditions
* and call the heavyweights to help us out.
Expand Down Expand Up @@ -771,18 +775,18 @@ ex_handler_done:
lwi r4, r4, TASK_THREAD+PGDIR
ex9:
tophys(r4,r4)
BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
andi r5, r5, 0xffc
/* Create L1 (pgdir/pmd) address */
BSRLI(r5,r3, PGDIR_SHIFT - 2)
andi r5, r5, PAGE_SIZE - 4
/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
or r4, r4, r5
lwi r4, r4, 0 /* Get L1 entry */
andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
beqi r5, ex10 /* Bail if no table */

tophys(r5,r5)
BSRLI(r6,r3,10) /* Compute PTE address */
andi r6, r6, 0xffc
andi r5, r5, 0xfffff003
BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
andi r6, r6, PAGE_SIZE - 4
or r5, r5, r6
lwi r4, r5, 0 /* Get Linux PTE */

Expand All @@ -801,7 +805,8 @@ ex_handler_done:
* here we (properly should) assume have the appropriate value.
*/
brid finish_tlb_load
andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
TLB_ZSEL(1) | TLB_ATTR_MASK
ex10:
/* The bailout. Restore registers to pre-exception conditions
* and call the heavyweights to help us out.
Expand Down Expand Up @@ -854,8 +859,14 @@ ex_handler_done:
* set of bits. These are size, valid, E, U0, and ensure
* bits 20 and 21 are zero.
*/
andi r3, r3, 0xfffff000
ori r3, r3, 0x0c0
andi r3, r3, PAGE_MASK
#ifdef CONFIG_MICROBLAZE_64K_PAGES
ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_64K)
#elif CONFIG_MICROBLAZE_16K_PAGES
ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_16K)
#else
ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_4K)
#endif
mts rtlbhi, r3 /* Load TLB HI */
nop

Expand Down
Loading

0 comments on commit 5cad359

Please sign in to comment.