diff options
| author | Peter Bergner <bergner@brule.rchland.ibm.com> | 2003-03-31 01:44:08 -0600 |
|---|---|---|
| committer | Peter Bergner <bergner@brule.rchland.ibm.com> | 2003-03-31 01:44:08 -0600 |
| commit | a2c584bb26012d197f52ee53a5a3728f08dd283f (patch) | |
| tree | 632f25e64ad030fafbbb85f05ef61c00a53fe52c /include | |
| parent | c03cd46714957945017a69664f1a1f2f646d74ce (diff) | |
| parent | b9c4e8df932dbf7cb5abf76df3be1e18a0ac2b56 (diff) | |
Merge bk://ppc.bkbits.net/for-linus-ppc64
into brule.rchland.ibm.com:/u3/ppc64/linux-2.5-bergner
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-ppc64/machdep.h | 2 | ||||
| -rw-r--r-- | include/asm-ppc64/mmu.h | 7 | ||||
| -rw-r--r-- | include/asm-ppc64/naca.h | 50 | ||||
| -rw-r--r-- | include/asm-ppc64/page.h | 34 | ||||
| -rw-r--r-- | include/asm-ppc64/proc_fs.h | 13 | ||||
| -rw-r--r-- | include/asm-ppc64/processor.h | 10 | ||||
| -rw-r--r-- | include/asm-ppc64/ptrace.h | 5 | ||||
| -rw-r--r-- | include/asm-ppc64/rtas.h | 2 | ||||
| -rw-r--r-- | include/asm-ppc64/sigcontext.h | 6 | ||||
| -rw-r--r-- | include/asm-ppc64/systemcfg.h | 109 | ||||
| -rw-r--r-- | include/asm-ppc64/types.h | 5 | ||||
| -rw-r--r-- | include/asm-ppc64/ucontext.h | 10 |
12 files changed, 200 insertions, 53 deletions
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index 15c6a59e43e6..f0df83756768 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h @@ -90,6 +90,8 @@ struct machdep_calls { unsigned char (*udbg_getc)(void); int (*udbg_getc_poll)(void); + /* this is for modules, since _machine can be a define -- Cort */ + int ppc_machine; #ifdef CONFIG_SMP /* functions for dealing with other cpus */ struct smp_ops_t smp_ops; diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index 9f81ab9ac9f6..b01c3cddbcf4 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h @@ -221,6 +221,13 @@ static inline void _tlbiel(unsigned long va) #endif /* __ASSEMBLY__ */ +/* + * Location of cpu0's segment table + */ +#define STAB0_PAGE 0x9 +#define STAB0_PHYS_ADDR (STAB0_PAGE<<PAGE_SHIFT) +#define STAB0_VIRT_ADDR (KERNELBASE+STAB0_PHYS_ADDR) + /* Block size masks */ #define BL_128K 0x000 #define BL_256K 0x001 diff --git a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h index 082d5bfa15fe..fdefd38d44ac 100644 --- a/include/asm-ppc64/naca.h +++ b/include/asm-ppc64/naca.h @@ -11,29 +11,41 @@ */ #include <asm/types.h> +#include <asm/systemcfg.h> + +#ifndef __ASSEMBLY__ struct naca_struct { - void *xItVpdAreas; - void *xRamDisk; - u64 xRamDiskSize; /* In pages */ - struct paca_struct *paca; /* Ptr to an array of pacas */ - u64 debug_switch; /* Bits to control debug printing */ - u16 dCacheL1LineSize; /* Line size of L1 DCache in bytes */ - u16 dCacheL1LogLineSize; /* Log-2 of DCache line size */ - u16 dCacheL1LinesPerPage; /* DCache lines per page */ - u16 iCacheL1LineSize; /* Line size of L1 ICache in bytes */ - u16 iCacheL1LogLineSize; /* Log-2 of ICache line size */ - u16 iCacheL1LinesPerPage; /* ICache lines per page */ - u16 slb_size; /* SLB size in entries */ - u64 physicalMemorySize; /* Size of real memory in bytes */ - u64 pftSize; /* Log base 2 of page table size */ - u64 serialPortAddr; /* Phyical address of serial port */ - u8 interrupt_controller; /* Type of interrupt controller */ - u8 resv0; /* Type of interrupt controller */ - u16 platform; /* Platform flags */ - u8 resv1[12]; /* Padding */ + /*================================================================== + * Cache line 1: 0x0000 - 0x007F + * Kernel only data - undefined for user space + *================================================================== + */ + void *xItVpdAreas; /* VPD Data 0x00 */ + void *xRamDisk; /* iSeries ramdisk 0x08 */ + u64 xRamDiskSize; /* In pages 0x10 */ + struct paca_struct *paca; /* Ptr to an array of pacas 0x18 */ + u64 debug_switch; /* Debug print control 0x20 */ + u64 banner; /* Ptr to banner string 0x28 */ + u64 log; /* Ptr to log buffer 0x30 */ + u64 serialPortAddr; /* Phy addr of serial port 0x38 */ + u64 interrupt_controller; /* Type of int controller 0x40 */ + u64 slb_size; /* SLB size in entries 0x48 */ + u64 pftSize; /* Log 2 of page table size 0x50 */ + void *systemcfg; /* Pointer to systemcfg data 0x58 */ + u32 dCacheL1LogLineSize; /* L1 d-cache line size Log2 0x60 */ + u32 dCacheL1LinesPerPage; /* L1 d-cache lines / page 0x64 */ + u32 iCacheL1LogLineSize; /* L1 i-cache line size Log2 0x68 */ + u32 iCacheL1LinesPerPage; /* L1 i-cache lines / page 0x6c */ + u64 resv0[2]; /* Reserved 0x70 - 0x7F */ }; extern struct naca_struct *naca; +#endif /* __ASSEMBLY__ */ + +#define NACA_PAGE 0x4 +#define NACA_PHYS_ADDR (NACA_PAGE<<PAGE_SHIFT) +#define NACA_VIRT_ADDR (KERNELBASE+NACA_PHYS_ADDR) + #endif /* _NACA_H */ diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index ab3fc4b61cd2..ad0d35a89377 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h @@ -14,7 +14,11 @@ /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#ifndef __ASSEMBLY__ +# define PAGE_SIZE (1UL << PAGE_SHIFT) +#else +# define PAGE_SIZE (1 << PAGE_SHIFT) +#endif #define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_OFFSET_MASK (PAGE_SIZE-1) @@ -22,6 +26,19 @@ #define SID_MASK 0xfffffffff #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) +/* align addr on a size boundary - adjust address up/down if needed */ +#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) +#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) + +/* align addr on a size boundary - adjust address up if needed */ +#define _ALIGN(addr,size) _ALIGN_UP(addr,size) + +/* to align the pointer to the (next) double word boundary */ +#define DOUBLEWORD_ALIGN(addr) _ALIGN(addr,sizeof(unsigned long)) + +/* to align the pointer to the (next) page boundary */ +#define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) + #ifdef __KERNEL__ #ifndef __ASSEMBLY__ #include <asm/naca.h> @@ -37,7 +54,7 @@ static __inline__ void clear_page(void *addr) { unsigned long lines, line_size; - line_size = naca->dCacheL1LineSize; + line_size = systemcfg->dCacheL1LineSize; lines = naca->dCacheL1LinesPerPage; __asm__ __volatile__( @@ -114,19 +131,6 @@ static inline int get_order(unsigned long size) #endif /* __ASSEMBLY__ */ -/* align addr on a size boundary - adjust address up/down if needed */ -#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) -#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) - -/* align addr on a size boundary - adjust address up if needed */ -#define _ALIGN(addr,size) _ALIGN_UP(addr,size) - -/* to align the pointer to the (next) double word boundary */ -#define DOUBLEWORD_ALIGN(addr) _ALIGN(addr,sizeof(unsigned long)) - -/* to align the pointer to the (next) page boundary */ -#define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) - #ifdef MODULE #define __page_aligned __attribute__((__aligned__(PAGE_SIZE))) #else diff --git a/include/asm-ppc64/proc_fs.h b/include/asm-ppc64/proc_fs.h index fe8317a6958d..aff9577da53a 100644 --- a/include/asm-ppc64/proc_fs.h +++ b/include/asm-ppc64/proc_fs.h @@ -25,9 +25,14 @@ #include <linux/proc_fs.h> -void pmc_proc_init(struct proc_dir_entry *iSeries_proc); -void proc_ppc64_init(void); +struct proc_ppc64_t { + struct proc_dir_entry *root; + struct proc_dir_entry *naca; + struct proc_dir_entry *paca; + struct proc_dir_entry *systemcfg; + struct proc_dir_entry *rtas; +}; -#include <asm/iSeries/iSeries_proc.h> +extern struct proc_ppc64_t proc_ppc64; -#endif +#endif /* _PPC64_PROC_FS_H */ diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h index 822d15ead564..a2342b779dcc 100644 --- a/include/asm-ppc64/processor.h +++ b/include/asm-ppc64/processor.h @@ -469,8 +469,6 @@ #define IOCR_SPC 0x00000001 -/* Processor Version Register */ - /* Processor Version Register (PVR) field extraction */ #define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ @@ -656,8 +654,10 @@ struct thread_struct { struct pt_regs *regs; /* Pointer to saved register state */ mm_segment_t fs; /* for get_fs() validation */ double fpr[32]; /* Complete floating point set */ - unsigned long fpscr; /* Floating point status */ - unsigned int fpexc_mode; /* Floating-point exception mode */ + unsigned long fpscr; /* Floating point status (plus pad) */ + unsigned long fpexc_mode; /* Floating-point exception mode */ + unsigned long saved_msr; /* Save MSR across signal handlers */ + unsigned long saved_softe; /* Ditto for Soft Enable/Disable */ }; #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) @@ -704,7 +704,7 @@ static inline unsigned int __unpack_fe01(unsigned long msr_bits) return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8); } -static inline unsigned int __pack_fe01(unsigned int fpmode) +static inline unsigned long __pack_fe01(unsigned int fpmode) { return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1); } diff --git a/include/asm-ppc64/ptrace.h b/include/asm-ppc64/ptrace.h index 17d15d0ad813..0fc245bde03a 100644 --- a/include/asm-ppc64/ptrace.h +++ b/include/asm-ppc64/ptrace.h @@ -64,9 +64,8 @@ struct pt_regs32 { #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ -/* Size of stack frame allocated when calling signal handler. */ -/* FIXME: What should this be on 64-bit kernel (64 for 32-bit) */ -#define __SIGNAL_FRAMESIZE 64 +/* Size of dummy stack frame allocated when calling signal handler. */ +#define __SIGNAL_FRAMESIZE 128 #define __SIGNAL_FRAMESIZE32 64 #define instruction_pointer(regs) ((regs)->nip) diff --git a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h index 205e3856e456..e53a33c289e2 100644 --- a/include/asm-ppc64/rtas.h +++ b/include/asm-ppc64/rtas.h @@ -166,8 +166,6 @@ extern void rtas_restart(char *cmd); extern void rtas_power_off(void); extern void rtas_halt(void); -extern struct proc_dir_entry *rtas_proc_dir; - /* Some RTAS ops require a data buffer and that buffer must be < 4G. * Rather than having a memory allocator, just use this buffer * (get the lock first), make the RTAS call. Copy the data instead diff --git a/include/asm-ppc64/sigcontext.h b/include/asm-ppc64/sigcontext.h index 467be1a3d86b..2ea36ea8279f 100644 --- a/include/asm-ppc64/sigcontext.h +++ b/include/asm-ppc64/sigcontext.h @@ -9,6 +9,8 @@ */ #include <asm/ptrace.h> +#include <asm/elf.h> + struct sigcontext { unsigned long _unused[4]; @@ -16,7 +18,9 @@ struct sigcontext { int _pad0; unsigned long handler; unsigned long oldmask; - struct pt_regs *regs; + struct pt_regs *regs; + elf_gregset_t gp_regs; + elf_fpregset_t fp_regs; }; #endif /* _ASM_PPC64_SIGCONTEXT_H */ diff --git a/include/asm-ppc64/systemcfg.h b/include/asm-ppc64/systemcfg.h new file mode 100644 index 000000000000..b78c5a2828ca --- /dev/null +++ b/include/asm-ppc64/systemcfg.h @@ -0,0 +1,109 @@ +#ifndef _SYSTEMCFG_H +#define _SYSTEMCFG_H + +/* + * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +/* Change Activity: + * 2002/09/30 : bergner : Created + * End Change Activity + */ + + +#ifndef __KERNEL__ +#include <unistd.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <linux/types.h> +#endif + +/* + * If the major version changes we are incompatible. + * Minor version changes are a hint. + */ +#define SYSTEMCFG_MAJOR 1 +#define SYSTEMCFG_MINOR 0 + +#ifndef __ASSEMBLY__ + +struct systemcfg { + __u8 eye_catcher[16]; /* Eyecatcher: SYSTEMCFG:PPC64 0x00 */ + struct { /* Systemcfg version numbers */ + __u32 major; /* Major number 0x10 */ + __u32 minor; /* Minor number 0x14 */ + } version; + + __u32 platform; /* Platform flags 0x18 */ + __u32 processor; /* Processor type 0x1C */ + __u64 processorCount; /* # of physical processors 0x20 */ + __u64 physicalMemorySize; /* Size of real memory(B) 0x28 */ + __u64 tb_orig_stamp; /* Timebase at boot 0x30 */ + __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */ + __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */ + __u64 stamp_xsec; /* 0x48 */ + __u64 tb_update_count; /* Timebase atomicity ctr 0x50 */ + __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */ + __u32 tz_dsttime; /* Type of dst correction 0x5C */ + __u32 dCacheL1Size; /* L1 d-cache size 0x60 */ + __u32 dCacheL1LineSize; /* L1 d-cache line size 0x64 */ + __u32 iCacheL1Size; /* L1 i-cache size 0x68 */ + __u32 iCacheL1LineSize; /* L1 i-cache line size 0x6C */ + __u8 reserved0[3984]; /* Reserve rest of page 0x70 */ +}; + +#ifdef __KERNEL__ +extern struct systemcfg *systemcfg; +#else + +/* Processor Version Register (PVR) field extraction */ +#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ +#define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ + +/* Processor Version Numbers */ +#define PV_NORTHSTAR 0x0033 +#define PV_PULSAR 0x0034 +#define PV_POWER4 0x0035 +#define PV_ICESTAR 0x0036 +#define PV_SSTAR 0x0037 +#define PV_POWER4p 0x0038 +#define PV_630 0x0040 +#define PV_630p 0x0041 + +/* Platforms supported by PPC64 */ +#define PLATFORM_PSERIES 0x0100 +#define PLATFORM_PSERIES_LPAR 0x0101 +#define PLATFORM_ISERIES_LPAR 0x0201 + + +static inline volatile struct systemcfg *systemcfg_init(void) +{ + int fd = open("/proc/ppc64/systemcfg", O_RDONLY); + volatile struct systemcfg *ret; + + if (fd == -1) + return 0; + ret = mmap(0, sizeof(struct systemcfg), PROT_READ, MAP_SHARED, fd, 0); + close(fd); + if (!ret) + return 0; + if (ret->version.major != SYSTEMCFG_MAJOR || ret->version.minor < SYSTEMCFG_MINOR) { + munmap((void *)ret, sizeof(struct systemcfg)); + return 0; + } + return ret; +} +#endif /* __KERNEL__ */ + +#endif /* __ASSEMBLY__ */ + +#define SYSTEMCFG_PAGE 0x5 +#define SYSTEMCFG_PHYS_ADDR (SYSTEMCFG_PAGE<<PAGE_SHIFT) +#define SYSTEMCFG_VIRT_ADDR (KERNELBASE+SYSTEMCFG_PHYS_ADDR) + +#endif /* _SYSTEMCFG_H */ diff --git a/include/asm-ppc64/types.h b/include/asm-ppc64/types.h index 08b5757e3d07..0fb0412a5394 100644 --- a/include/asm-ppc64/types.h +++ b/include/asm-ppc64/types.h @@ -66,6 +66,11 @@ typedef __vector128 vector128; typedef u32 dma_addr_t; typedef u64 dma64_addr_t; +typedef struct { + unsigned long entry; + unsigned long toc; + unsigned long env; +} func_descr_t; #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-ppc64/ucontext.h b/include/asm-ppc64/ucontext.h index 09e30c91d24e..ef8cc5b37542 100644 --- a/include/asm-ppc64/ucontext.h +++ b/include/asm-ppc64/ucontext.h @@ -1,8 +1,9 @@ #ifndef _ASMPPC64_UCONTEXT_H #define _ASMPPC64_UCONTEXT_H -/* Copied from i386. - * +#include <asm/sigcontext.h> + +/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -13,8 +14,9 @@ struct ucontext { unsigned long uc_flags; struct ucontext *uc_link; stack_t uc_stack; - struct sigcontext uc_mcontext; - sigset_t uc_sigmask; /* mask last for extensibility */ + sigset_t uc_sigmask; + sigset_t __unsued[15]; /* Allow for uc_sigmask growth */ + struct sigcontext uc_mcontext; /* last for extensibility */ }; #endif /* _ASMPPC64_UCONTEXT_H */ |
