diff --git a/[refs] b/[refs] index 4f0445a7052d..7296426dc8ef 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9db908806b85c1430150fbafe269a7b21b07d15d +refs/heads/master: 1bbb3095a5912be4b9c90397ef2182a5a328865b diff --git a/trunk/Documentation/ABI/testing/sysfs-bus-fcoe b/trunk/Documentation/ABI/testing/sysfs-bus-fcoe index 50e2a80ea28f..469d09c02f6b 100644 --- a/trunk/Documentation/ABI/testing/sysfs-bus-fcoe +++ b/trunk/Documentation/ABI/testing/sysfs-bus-fcoe @@ -9,19 +9,19 @@ Attributes: this value will change the dev_loss_tmo for all FCFs discovered by this controller. - lesb/link_fail: Link Error Status Block (LESB) link failure count. + lesb_link_fail: Link Error Status Block (LESB) link failure count. - lesb/vlink_fail: Link Error Status Block (LESB) virtual link + lesb_vlink_fail: Link Error Status Block (LESB) virtual link failure count. - lesb/miss_fka: Link Error Status Block (LESB) missed FCoE + lesb_miss_fka: Link Error Status Block (LESB) missed FCoE Initialization Protocol (FIP) Keep-Alives (FKA). - lesb/symb_err: Link Error Status Block (LESB) symbolic error count. + lesb_symb_err: Link Error Status Block (LESB) symbolic error count. - lesb/err_block: Link Error Status Block (LESB) block error count. + lesb_err_block: Link Error Status Block (LESB) block error count. - lesb/fcs_error: Link Error Status Block (LESB) Fibre Channel + lesb_fcs_error: Link Error Status Block (LESB) Fibre Channel Serivces error count. Notes: ctlr_X (global increment starting at 0) diff --git a/trunk/Documentation/device-mapper/dm-raid.txt b/trunk/Documentation/device-mapper/dm-raid.txt index 728c38c242d6..1c1844957166 100644 --- a/trunk/Documentation/device-mapper/dm-raid.txt +++ b/trunk/Documentation/device-mapper/dm-raid.txt @@ -132,12 +132,3 @@ Here we can see the RAID type is raid4, there are 5 devices - all of which are 'A'live, and the array is 2/490221568 complete with recovery. Faulty or missing devices are marked 'D'. Devices that are out-of-sync are marked 'a'. - - -Version History ---------------- -1.0.0 Initial version. Support for RAID 4/5/6 -1.1.0 Added support for RAID 1 -1.2.0 Handle creation of arrays that contain failed devices. -1.3.0 Added support for RAID 10 -1.3.1 Allow device replacement/rebuild for RAID 10 diff --git a/trunk/Documentation/filesystems/nfs/nfsd-admin-interfaces.txt b/trunk/Documentation/filesystems/nfs/nfsd-admin-interfaces.txt deleted file mode 100644 index 56a96fb08a73..000000000000 --- a/trunk/Documentation/filesystems/nfs/nfsd-admin-interfaces.txt +++ /dev/null @@ -1,41 +0,0 @@ -Administrative interfaces for nfsd -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Note that normally these interfaces are used only by the utilities in -nfs-utils. - -nfsd is controlled mainly by pseudofiles under the "nfsd" filesystem, -which is normally mounted at /proc/fs/nfsd/. - -The server is always started by the first write of a nonzero value to -nfsd/threads. - -Before doing that, NFSD can be told which sockets to listen on by -writing to nfsd/portlist; that write may be: - - - an ascii-encoded file descriptor, which should refer to a - bound (and listening, for tcp) socket, or - - "transportname port", where transportname is currently either - "udp", "tcp", or "rdma". - -If nfsd is started without doing any of these, then it will create one -udp and one tcp listener at port 2049 (see nfsd_init_socks). - -On startup, nfsd and lockd grace periods start. - -nfsd is shut down by a write of 0 to nfsd/threads. All locks and state -are thrown away at that point. - -Between startup and shutdown, the number of threads may be adjusted up -or down by additional writes to nfsd/threads or by writes to -nfsd/pool_threads. - -For more detail about files under nfsd/ and what they control, see -fs/nfsd/nfsctl.c; most of them have detailed comments. - -Implementation notes -^^^^^^^^^^^^^^^^^^^^ - -Note that the rpc server requires the caller to serialize addition and -removal of listening sockets, and startup and shutdown of the server. -For nfsd this is done using nfsd_mutex. diff --git a/trunk/Documentation/thermal/exynos_thermal b/trunk/Documentation/hwmon/exynos4_tmu similarity index 71% rename from trunk/Documentation/thermal/exynos_thermal rename to trunk/Documentation/hwmon/exynos4_tmu index 2b46f67b1ccb..c3c6b41db607 100644 --- a/trunk/Documentation/thermal/exynos_thermal +++ b/trunk/Documentation/hwmon/exynos4_tmu @@ -46,7 +46,36 @@ The threshold levels are defined as follows: The threshold and each trigger_level are set through the corresponding registers. -When an interrupt occurs, this driver notify kernel thermal framework -with the function exynos4_report_trigger. +When an interrupt occurs, this driver notify user space of +one of four threshold levels for the interrupt +through kobject_uevent_env and sysfs_notify functions. Although an interrupt condition for level_0 can be set, -it can be used to synchronize the cooling action. +it is not notified to user space through sysfs_notify function. + +Sysfs Interface +--------------- +name name of the temperature sensor + RO + +temp1_input temperature + RO + +temp1_max temperature for level_1 interrupt + RO + +temp1_crit temperature for level_2 interrupt + RO + +temp1_emergency temperature for level_3 interrupt + RO + +temp1_max_alarm alarm for level_1 interrupt + RO + +temp1_crit_alarm + alarm for level_2 interrupt + RO + +temp1_emergency_alarm + alarm for level_3 interrupt + RO diff --git a/trunk/Documentation/scsi/ChangeLog.megaraid_sas b/trunk/Documentation/scsi/ChangeLog.megaraid_sas index da03146c182a..3a3079411a3d 100644 --- a/trunk/Documentation/scsi/ChangeLog.megaraid_sas +++ b/trunk/Documentation/scsi/ChangeLog.megaraid_sas @@ -1,16 +1,3 @@ -Release Date : Mon. Oct 1, 2012 17:00:00 PST 2012 - - (emaild-id:megaraidlinux@lsi.com) - Adam Radford -Current Version : 06.504.01.00-rc1 -Old Version : 00.00.06.18-rc1 - 1. Removed un-needed completion_lock spinlock calls. - 2. Add module param for configurable MSI-X vector count. - 3. Load io_request DataLength in bytes. - 4. Add array boundary check for SystemPD. - 5. Add SystemPD FastPath support. - 6. Remove duplicate code. - 7. Version, Changelog, Copyright update. -------------------------------------------------------------------------------- Release Date : Tue. Jun 17, 2012 17:00:00 PST 2012 - (emaild-id:megaraidlinux@lsi.com) Adam Radford/Kashyap Desai diff --git a/trunk/Documentation/thermal/cpu-cooling-api.txt b/trunk/Documentation/thermal/cpu-cooling-api.txt deleted file mode 100644 index fca24c931ec8..000000000000 --- a/trunk/Documentation/thermal/cpu-cooling-api.txt +++ /dev/null @@ -1,32 +0,0 @@ -CPU cooling APIs How To -=================================== - -Written by Amit Daniel Kachhap - -Updated: 12 May 2012 - -Copyright (c) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) - -0. Introduction - -The generic cpu cooling(freq clipping) provides registration/unregistration APIs -to the caller. The binding of the cooling devices to the trip point is left for -the user. The registration APIs returns the cooling device pointer. - -1. cpu cooling APIs - -1.1 cpufreq registration/unregistration APIs -1.1.1 struct thermal_cooling_device *cpufreq_cooling_register( - struct cpumask *clip_cpus) - - This interface function registers the cpufreq cooling device with the name - "thermal-cpufreq-%x". This api can support multiple instances of cpufreq - cooling devices. - - clip_cpus: cpumask of cpus where the frequency constraints will happen. - -1.1.2 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) - - This interface function unregisters the "thermal-cpufreq-%x" cooling device. - - cdev: Cooling device pointer which has to be unregistered. diff --git a/trunk/Documentation/thermal/sysfs-api.txt b/trunk/Documentation/thermal/sysfs-api.txt index ca1a1a34970e..c087dbcf3535 100644 --- a/trunk/Documentation/thermal/sysfs-api.txt +++ b/trunk/Documentation/thermal/sysfs-api.txt @@ -84,8 +84,7 @@ temperature) and throttle appropriate devices. 1.3 interface for binding a thermal zone device with a thermal cooling device 1.3.1 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, - int trip, struct thermal_cooling_device *cdev, - unsigned long upper, unsigned long lower); + int trip, struct thermal_cooling_device *cdev); This interface function bind a thermal cooling device to the certain trip point of a thermal zone device. @@ -94,12 +93,6 @@ temperature) and throttle appropriate devices. cdev: thermal cooling device trip: indicates which trip point the cooling devices is associated with in this thermal zone. - upper:the Maximum cooling state for this trip point. - THERMAL_NO_LIMIT means no upper limit, - and the cooling device can be in max_state. - lower:the Minimum cooling state can be used for this trip point. - THERMAL_NO_LIMIT means no lower limit, - and the cooling device can be in cooling state 0. 1.3.2 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, int trip, struct thermal_cooling_device *cdev); diff --git a/trunk/arch/Kconfig b/trunk/arch/Kconfig index a79a1ad8bb96..26a28419cafc 100644 --- a/trunk/arch/Kconfig +++ b/trunk/arch/Kconfig @@ -274,9 +274,6 @@ config ARCH_WANT_OLD_COMPAT_IPC config GENERIC_KERNEL_THREAD bool -config GENERIC_KERNEL_EXECVE - bool - config HAVE_ARCH_SECCOMP_FILTER bool help diff --git a/trunk/arch/alpha/Kconfig b/trunk/arch/alpha/Kconfig index 7a08cfb80ee8..7da91246e279 100644 --- a/trunk/arch/alpha/Kconfig +++ b/trunk/arch/alpha/Kconfig @@ -21,7 +21,6 @@ config ALPHA select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNLEN_USER select GENERIC_KERNEL_THREAD - select GENERIC_KERNEL_EXECVE help The Alpha is a 64-bit general-purpose processor designed and marketed by the Digital Equipment Corporation of blessed memory, diff --git a/trunk/arch/alpha/include/asm/unistd.h b/trunk/arch/alpha/include/asm/unistd.h index 7826e227e4d0..3cb6c1188984 100644 --- a/trunk/arch/alpha/include/asm/unistd.h +++ b/trunk/arch/alpha/include/asm/unistd.h @@ -482,6 +482,7 @@ #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_RT_SIGSUSPEND #define __ARCH_WANT_SYS_EXECVE +#define __ARCH_WANT_KERNEL_EXECVE /* "Conditional" syscalls. What we want is diff --git a/trunk/arch/alpha/kernel/entry.S b/trunk/arch/alpha/kernel/entry.S index a7607832dd4f..2a359c9ee3cd 100644 --- a/trunk/arch/alpha/kernel/entry.S +++ b/trunk/arch/alpha/kernel/entry.S @@ -311,7 +311,7 @@ entSys: .align 4 ret_from_sys_call: - cmovne $26, 0, $18 /* $18 = 0 => non-restartable */ + cmovne $26, 0, $19 /* $19 = 0 => non-restartable */ ldq $0, SP_OFF($sp) and $0, 8, $0 beq $0, ret_to_kernel @@ -320,8 +320,8 @@ ret_to_user: sampling and the rti. */ lda $16, 7 call_pal PAL_swpipl - ldl $17, TI_FLAGS($8) - and $17, _TIF_WORK_MASK, $2 + ldl $5, TI_FLAGS($8) + and $5, _TIF_WORK_MASK, $2 bne $2, work_pending restore_all: RESTORE_ALL @@ -341,10 +341,10 @@ $syscall_error: * frame to indicate that a negative return value wasn't an * error number.. */ - ldq $18, 0($sp) /* old syscall nr (zero if success) */ - beq $18, $ret_success + ldq $19, 0($sp) /* old syscall nr (zero if success) */ + beq $19, $ret_success - ldq $19, 72($sp) /* .. and this a3 */ + ldq $20, 72($sp) /* .. and this a3 */ subq $31, $0, $0 /* with error in v0 */ addq $31, 1, $1 /* set a3 for errno return */ stq $0, 0($sp) @@ -362,35 +362,51 @@ $ret_success: * Do all cleanup when returning from all interrupts and system calls. * * Arguments: + * $5: TI_FLAGS. * $8: current. - * $17: TI_FLAGS. - * $18: The old syscall number, or zero if this is not a return + * $19: The old syscall number, or zero if this is not a return * from a syscall that errored and is possibly restartable. - * $19: The old a3 value + * $20: The old a3 value */ .align 4 .ent work_pending work_pending: - and $17, _TIF_NOTIFY_RESUME | _TIF_SIGPENDING, $2 - bne $2, $work_notifysig + and $5, _TIF_NEED_RESCHED, $2 + beq $2, $work_notifysig $work_resched: - /* - * We can get here only if we returned from syscall without SIGPENDING - * or got through work_notifysig already. Either case means no syscall - * restarts for us, so let $18 and $19 burn. - */ + subq $sp, 16, $sp + stq $19, 0($sp) /* save syscall nr */ + stq $20, 8($sp) /* and error indication (a3) */ jsr $26, schedule - mov 0, $18 - br ret_to_user + ldq $19, 0($sp) + ldq $20, 8($sp) + addq $sp, 16, $sp + /* Make sure need_resched and sigpending don't change between + sampling and the rti. */ + lda $16, 7 + call_pal PAL_swpipl + ldl $5, TI_FLAGS($8) + and $5, _TIF_WORK_MASK, $2 + beq $2, restore_all + and $5, _TIF_NEED_RESCHED, $2 + bne $2, $work_resched $work_notifysig: mov $sp, $16 bsr $1, do_switch_stack - jsr $26, do_work_pending + mov $sp, $17 + mov $5, $18 + mov $19, $9 /* save old syscall number */ + mov $20, $10 /* save old a3 */ + and $5, _TIF_SIGPENDING, $2 + cmovne $2, 0, $9 /* we don't want double syscall restarts */ + jsr $26, do_notify_resume + mov $9, $19 + mov $10, $20 bsr $1, undo_switch_stack - br restore_all + br ret_to_user .end work_pending /* @@ -438,9 +454,9 @@ $strace_success: .align 3 $strace_error: - ldq $18, 0($sp) /* old syscall nr (zero if success) */ - beq $18, $strace_success - ldq $19, 72($sp) /* .. and this a3 */ + ldq $19, 0($sp) /* old syscall nr (zero if success) */ + beq $19, $strace_success + ldq $20, 72($sp) /* .. and this a3 */ subq $31, $0, $0 /* with error in v0 */ addq $31, 1, $1 /* set a3 for errno return */ @@ -448,11 +464,11 @@ $strace_error: stq $1, 72($sp) /* a3 for return */ bsr $1, do_switch_stack - mov $18, $9 /* save old syscall number */ - mov $19, $10 /* save old a3 */ + mov $19, $9 /* save old syscall number */ + mov $20, $10 /* save old a3 */ jsr $26, syscall_trace_leave - mov $9, $18 - mov $10, $19 + mov $9, $19 + mov $10, $20 bsr $1, undo_switch_stack mov $31, $26 /* tell "ret_from_sys_call" we can restart */ @@ -603,9 +619,24 @@ ret_from_kernel_thread: mov $9, $27 mov $10, $16 jsr $26, ($9) + ldgp $gp, 0($26) + mov $0, $16 + mov $31, $26 + jmp $31, sys_exit +.end ret_from_kernel_thread + + .globl ret_from_kernel_execve + .align 4 + .ent ret_from_kernel_execve +ret_from_kernel_execve: + mov $16, $sp + /* Avoid the HAE being gratuitously wrong, to avoid restoring it. */ + ldq $2, alpha_mv+HAE_CACHE + stq $2, 152($sp) /* HAE */ mov $31, $19 /* to disable syscall restarts */ br $31, ret_to_user -.end ret_from_kernel_thread + +.end ret_from_kernel_execve /* diff --git a/trunk/arch/alpha/kernel/osf_sys.c b/trunk/arch/alpha/kernel/osf_sys.c index 9eb090582cf1..63e77e3944ce 100644 --- a/trunk/arch/alpha/kernel/osf_sys.c +++ b/trunk/arch/alpha/kernel/osf_sys.c @@ -449,7 +449,7 @@ osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags) { int retval; struct cdfs_args tmp; - struct filename *devname; + char *devname; retval = -EFAULT; if (copy_from_user(&tmp, args, sizeof(tmp))) @@ -458,7 +458,7 @@ osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags) retval = PTR_ERR(devname); if (IS_ERR(devname)) goto out; - retval = do_mount(devname->name, dirname, "ext2", flags, NULL); + retval = do_mount(devname, dirname, "ext2", flags, NULL); putname(devname); out: return retval; @@ -469,7 +469,7 @@ osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags) { int retval; struct cdfs_args tmp; - struct filename *devname; + char *devname; retval = -EFAULT; if (copy_from_user(&tmp, args, sizeof(tmp))) @@ -478,7 +478,7 @@ osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags) retval = PTR_ERR(devname); if (IS_ERR(devname)) goto out; - retval = do_mount(devname->name, dirname, "iso9660", flags, NULL); + retval = do_mount(devname, dirname, "iso9660", flags, NULL); putname(devname); out: return retval; @@ -499,7 +499,7 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path, int, flag, void __user *, data) { int retval; - struct filename *name; + char *name; name = getname(path); retval = PTR_ERR(name); @@ -507,13 +507,13 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path, goto out; switch (typenr) { case 1: - retval = osf_ufs_mount(name->name, data, flag); + retval = osf_ufs_mount(name, data, flag); break; case 6: - retval = osf_cdfs_mount(name->name, data, flag); + retval = osf_cdfs_mount(name, data, flag); break; case 9: - retval = osf_procfs_mount(name->name, data, flag); + retval = osf_procfs_mount(name, data, flag); break; default: retval = -EINVAL; diff --git a/trunk/arch/alpha/kernel/signal.c b/trunk/arch/alpha/kernel/signal.c index 32575f85507d..a8c97d42ec8e 100644 --- a/trunk/arch/alpha/kernel/signal.c +++ b/trunk/arch/alpha/kernel/signal.c @@ -298,9 +298,8 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, - unsigned long mask, unsigned long sp) + struct switch_stack *sw, unsigned long mask, unsigned long sp) { - struct switch_stack *sw = (struct switch_stack *)regs - 1; long i, err = 0; err |= __put_user(on_sig_stack((unsigned long)sc), &sc->sc_onstack); @@ -355,7 +354,7 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, - struct pt_regs *regs) + struct pt_regs *regs, struct switch_stack * sw) { unsigned long oldsp, r26, err = 0; struct sigframe __user *frame; @@ -365,7 +364,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) return -EFAULT; - err |= setup_sigcontext(&frame->sc, regs, set->sig[0], oldsp); + err |= setup_sigcontext(&frame->sc, regs, sw, set->sig[0], oldsp); if (err) return -EFAULT; @@ -402,7 +401,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, - sigset_t *set, struct pt_regs *regs) + sigset_t *set, struct pt_regs *regs, struct switch_stack * sw) { unsigned long oldsp, r26, err = 0; struct rt_sigframe __user *frame; @@ -421,7 +420,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); err |= __put_user(sas_ss_flags(oldsp), &frame->uc.uc_stack.ss_flags); err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); - err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, + err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, sw, set->sig[0], oldsp); err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); if (err) @@ -465,15 +464,15 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, */ static inline void handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, - struct pt_regs * regs) + struct pt_regs * regs, struct switch_stack *sw) { sigset_t *oldset = sigmask_to_save(); int ret; if (ka->sa.sa_flags & SA_SIGINFO) - ret = setup_rt_frame(sig, ka, info, oldset, regs); + ret = setup_rt_frame(sig, ka, info, oldset, regs, sw); else - ret = setup_frame(sig, ka, oldset, regs); + ret = setup_frame(sig, ka, oldset, regs, sw); if (ret) { force_sigsegv(sig, current); @@ -520,7 +519,8 @@ syscall_restart(unsigned long r0, unsigned long r19, * all (if we get here from anything but a syscall return, it will be 0) */ static void -do_signal(struct pt_regs *regs, unsigned long r0, unsigned long r19) +do_signal(struct pt_regs * regs, struct switch_stack * sw, + unsigned long r0, unsigned long r19) { siginfo_t info; int signr; @@ -537,7 +537,7 @@ do_signal(struct pt_regs *regs, unsigned long r0, unsigned long r19) /* Whee! Actually deliver the signal. */ if (r0) syscall_restart(r0, r19, regs, &ka); - handle_signal(signr, &ka, &info, regs); + handle_signal(signr, &ka, &info, regs, sw); if (single_stepping) ptrace_set_bpt(current); /* re-set bpt */ return; @@ -568,23 +568,15 @@ do_signal(struct pt_regs *regs, unsigned long r0, unsigned long r19) } void -do_work_pending(struct pt_regs *regs, unsigned long thread_flags, +do_notify_resume(struct pt_regs *regs, struct switch_stack *sw, + unsigned long thread_info_flags, unsigned long r0, unsigned long r19) { - do { - if (thread_flags & _TIF_NEED_RESCHED) { - schedule(); - } else { - local_irq_enable(); - if (thread_flags & _TIF_SIGPENDING) { - do_signal(regs, r0, r19); - r0 = 0; - } else { - clear_thread_flag(TIF_NOTIFY_RESUME); - tracehook_notify_resume(regs); - } - } - local_irq_disable(); - thread_flags = current_thread_info()->flags; - } while (thread_flags & _TIF_WORK_MASK); + if (thread_info_flags & _TIF_SIGPENDING) + do_signal(regs, sw, r0, r19); + + if (thread_info_flags & _TIF_NOTIFY_RESUME) { + clear_thread_flag(TIF_NOTIFY_RESUME); + tracehook_notify_resume(regs); + } } diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index 431c3753145a..767aae8277fa 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -53,7 +53,6 @@ config ARM select GENERIC_STRNLEN_USER select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN select GENERIC_KERNEL_THREAD - select GENERIC_KERNEL_EXECVE help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and diff --git a/trunk/arch/arm/include/asm/unistd.h b/trunk/arch/arm/include/asm/unistd.h index 91819ad54424..f259921edfe9 100644 --- a/trunk/arch/arm/include/asm/unistd.h +++ b/trunk/arch/arm/include/asm/unistd.h @@ -479,6 +479,7 @@ #define __ARCH_WANT_SYS_SOCKETCALL #endif #define __ARCH_WANT_SYS_EXECVE +#define __ARCH_WANT_KERNEL_EXECVE /* * "Conditional" syscalls diff --git a/trunk/arch/arm/kernel/entry-common.S b/trunk/arch/arm/kernel/entry-common.S index 417bac1846bd..e340fa1db203 100644 --- a/trunk/arch/arm/kernel/entry-common.S +++ b/trunk/arch/arm/kernel/entry-common.S @@ -86,14 +86,35 @@ ENDPROC(ret_to_user) */ ENTRY(ret_from_fork) bl schedule_tail - cmp r5, #0 - movne r0, r4 - movne lr, pc - movne pc, r5 get_thread_info tsk + mov why, #1 b ret_slow_syscall ENDPROC(ret_from_fork) +ENTRY(ret_from_kernel_thread) + UNWIND(.fnstart) + UNWIND(.cantunwind) + bl schedule_tail + mov r0, r4 + adr lr, BSYM(1f) @ kernel threads should not exit + mov pc, r5 +1: bl do_exit + nop + UNWIND(.fnend) +ENDPROC(ret_from_kernel_thread) + +/* + * turn a kernel thread into userland process + * use: ret_from_kernel_execve(struct pt_regs *normal) + */ +ENTRY(ret_from_kernel_execve) + mov why, #0 @ not a syscall + str why, [r0, #S_R0] @ ... and we want 0 in ->ARM_r0 as well + get_thread_info tsk @ thread structure + mov sp, r0 @ stack pointer just under pt_regs + b ret_slow_syscall +ENDPROC(ret_from_kernel_execve) + .equ NR_syscalls,0 #define CALL(x) .equ NR_syscalls,NR_syscalls+1 #include "calls.S" diff --git a/trunk/arch/arm/kernel/process.c b/trunk/arch/arm/kernel/process.c index 90084a6de35a..f98c17ff1957 100644 --- a/trunk/arch/arm/kernel/process.c +++ b/trunk/arch/arm/kernel/process.c @@ -373,6 +373,7 @@ void release_thread(struct task_struct *dead_task) } asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); +asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread"); int copy_thread(unsigned long clone_flags, unsigned long stack_start, @@ -387,13 +388,13 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, *childregs = *regs; childregs->ARM_r0 = 0; childregs->ARM_sp = stack_start; + thread->cpu_context.pc = (unsigned long)ret_from_fork; } else { - memset(childregs, 0, sizeof(struct pt_regs)); thread->cpu_context.r4 = stk_sz; thread->cpu_context.r5 = stack_start; + thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread; childregs->ARM_cpsr = SVC_MODE; } - thread->cpu_context.pc = (unsigned long)ret_from_fork; thread->cpu_context.sp = (unsigned long)childregs; clear_ptrace_hw_breakpoint(p); diff --git a/trunk/arch/arm64/include/asm/Kbuild b/trunk/arch/arm64/include/asm/Kbuild index fe77e51a7847..35924a542d43 100644 --- a/trunk/arch/arm64/include/asm/Kbuild +++ b/trunk/arch/arm64/include/asm/Kbuild @@ -1,4 +1,6 @@ +include include/asm-generic/Kbuild.asm +header-y += hwcap.h generic-y += bug.h generic-y += bugs.h diff --git a/trunk/arch/arm64/include/uapi/asm/auxvec.h b/trunk/arch/arm64/include/asm/auxvec.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/auxvec.h rename to trunk/arch/arm64/include/asm/auxvec.h diff --git a/trunk/arch/arm64/include/uapi/asm/bitsperlong.h b/trunk/arch/arm64/include/asm/bitsperlong.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/bitsperlong.h rename to trunk/arch/arm64/include/asm/bitsperlong.h diff --git a/trunk/arch/arm64/include/uapi/asm/byteorder.h b/trunk/arch/arm64/include/asm/byteorder.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/byteorder.h rename to trunk/arch/arm64/include/asm/byteorder.h diff --git a/trunk/arch/arm64/include/uapi/asm/fcntl.h b/trunk/arch/arm64/include/asm/fcntl.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/fcntl.h rename to trunk/arch/arm64/include/asm/fcntl.h diff --git a/trunk/arch/arm64/include/asm/hwcap.h b/trunk/arch/arm64/include/asm/hwcap.h index 6d4482fa35bc..db05f9766112 100644 --- a/trunk/arch/arm64/include/asm/hwcap.h +++ b/trunk/arch/arm64/include/asm/hwcap.h @@ -16,7 +16,11 @@ #ifndef __ASM_HWCAP_H #define __ASM_HWCAP_H -#include +/* + * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP + */ +#define HWCAP_FP (1 << 0) +#define HWCAP_ASIMD (1 << 1) #define COMPAT_HWCAP_HALF (1 << 1) #define COMPAT_HWCAP_THUMB (1 << 2) @@ -31,6 +35,7 @@ #define COMPAT_HWCAP_IDIVT (1 << 18) #define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) +#ifdef __KERNEL__ #ifndef __ASSEMBLY__ /* * This yields a mask that user programs can use to figure out what @@ -46,3 +51,5 @@ extern unsigned int elf_hwcap; #endif #endif + +#endif diff --git a/trunk/arch/arm64/include/uapi/asm/param.h b/trunk/arch/arm64/include/asm/param.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/param.h rename to trunk/arch/arm64/include/asm/param.h diff --git a/trunk/arch/arm64/include/asm/ptrace.h b/trunk/arch/arm64/include/asm/ptrace.h index b04d3404f0d1..0fa5d6c9ef76 100644 --- a/trunk/arch/arm64/include/asm/ptrace.h +++ b/trunk/arch/arm64/include/asm/ptrace.h @@ -19,7 +19,9 @@ #ifndef __ASM_PTRACE_H #define __ASM_PTRACE_H -#include +#include + +#include /* AArch32-specific ptrace requests */ #define COMPAT_PTRACE_GETREGS 12 @@ -30,18 +32,80 @@ #define COMPAT_PTRACE_SETVFPREGS 28 #define COMPAT_PTRACE_GETHBPREGS 29 #define COMPAT_PTRACE_SETHBPREGS 30 + +/* + * PSR bits + */ +#define PSR_MODE_EL0t 0x00000000 +#define PSR_MODE_EL1t 0x00000004 +#define PSR_MODE_EL1h 0x00000005 +#define PSR_MODE_EL2t 0x00000008 +#define PSR_MODE_EL2h 0x00000009 +#define PSR_MODE_EL3t 0x0000000c +#define PSR_MODE_EL3h 0x0000000d +#define PSR_MODE_MASK 0x0000000f + +/* AArch32 CPSR bits */ +#define PSR_MODE32_BIT 0x00000010 #define COMPAT_PSR_MODE_USR 0x00000010 #define COMPAT_PSR_T_BIT 0x00000020 #define COMPAT_PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */ + +/* AArch64 SPSR bits */ +#define PSR_F_BIT 0x00000040 +#define PSR_I_BIT 0x00000080 +#define PSR_A_BIT 0x00000100 +#define PSR_D_BIT 0x00000200 +#define PSR_Q_BIT 0x08000000 +#define PSR_V_BIT 0x10000000 +#define PSR_C_BIT 0x20000000 +#define PSR_Z_BIT 0x40000000 +#define PSR_N_BIT 0x80000000 + +/* + * Groups of PSR bits + */ +#define PSR_f 0xff000000 /* Flags */ +#define PSR_s 0x00ff0000 /* Status */ +#define PSR_x 0x0000ff00 /* Extension */ +#define PSR_c 0x000000ff /* Control */ + /* * These are 'magic' values for PTRACE_PEEKUSR that return info about where a * process is located in memory. */ -#define COMPAT_PT_TEXT_ADDR 0x10000 -#define COMPAT_PT_DATA_ADDR 0x10004 -#define COMPAT_PT_TEXT_END_ADDR 0x10008 +#define PT_TEXT_ADDR 0x10000 +#define PT_DATA_ADDR 0x10004 +#define PT_TEXT_END_ADDR 0x10008 + #ifndef __ASSEMBLY__ +/* + * User structures for general purpose, floating point and debug registers. + */ +struct user_pt_regs { + __u64 regs[31]; + __u64 sp; + __u64 pc; + __u64 pstate; +}; + +struct user_fpsimd_state { + __uint128_t vregs[32]; + __u32 fpsr; + __u32 fpcr; +}; + +struct user_hwdebug_state { + __u32 dbg_info; + struct { + __u64 addr; + __u32 ctrl; + } dbg_regs[16]; +}; + +#ifdef __KERNEL__ + /* sizeof(struct user) for AArch32 */ #define COMPAT_USER_SZ 296 /* AArch32 uses x13 as the stack pointer... */ @@ -136,5 +200,8 @@ extern unsigned long profile_pc(struct pt_regs *regs); extern int aarch32_break_trap(struct pt_regs *regs); +#endif /* __KERNEL__ */ + #endif /* __ASSEMBLY__ */ + #endif diff --git a/trunk/arch/arm64/include/uapi/asm/setup.h b/trunk/arch/arm64/include/asm/setup.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/setup.h rename to trunk/arch/arm64/include/asm/setup.h diff --git a/trunk/arch/arm64/include/asm/sigcontext.h b/trunk/arch/arm64/include/asm/sigcontext.h index dca1094acc74..573cec778819 100644 --- a/trunk/arch/arm64/include/asm/sigcontext.h +++ b/trunk/arch/arm64/include/asm/sigcontext.h @@ -16,8 +16,44 @@ #ifndef __ASM_SIGCONTEXT_H #define __ASM_SIGCONTEXT_H -#include +#include +/* + * Signal context structure - contains all info to do with the state + * before the signal handler was invoked. + */ +struct sigcontext { + __u64 fault_address; + /* AArch64 registers */ + __u64 regs[31]; + __u64 sp; + __u64 pc; + __u64 pstate; + /* 4K reserved for FP/SIMD state and future expansion */ + __u8 __reserved[4096] __attribute__((__aligned__(16))); +}; + +/* + * Header to be used at the beginning of structures extending the user + * context. Such structures must be placed after the rt_sigframe on the stack + * and be 16-byte aligned. The last structure must be a dummy one with the + * magic and size set to 0. + */ +struct _aarch64_ctx { + __u32 magic; + __u32 size; +}; + +#define FPSIMD_MAGIC 0x46508001 + +struct fpsimd_context { + struct _aarch64_ctx head; + __u32 fpsr; + __u32 fpcr; + __uint128_t vregs[32]; +}; + +#ifdef __KERNEL__ /* * Auxiliary context saved in the sigcontext.__reserved array. Not exported to * user space as it will change with the addition of new context. User space @@ -29,3 +65,5 @@ struct aux_context { struct _aarch64_ctx end; }; #endif + +#endif diff --git a/trunk/arch/arm64/include/uapi/asm/siginfo.h b/trunk/arch/arm64/include/asm/siginfo.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/siginfo.h rename to trunk/arch/arm64/include/asm/siginfo.h diff --git a/trunk/arch/arm64/include/uapi/asm/signal.h b/trunk/arch/arm64/include/asm/signal.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/signal.h rename to trunk/arch/arm64/include/asm/signal.h diff --git a/trunk/arch/arm64/include/asm/stat.h b/trunk/arch/arm64/include/asm/stat.h index 15e35598ac40..a9f580c28f7b 100644 --- a/trunk/arch/arm64/include/asm/stat.h +++ b/trunk/arch/arm64/include/asm/stat.h @@ -16,8 +16,9 @@ #ifndef __ASM_STAT_H #define __ASM_STAT_H -#include +#include +#ifdef __KERNEL__ #ifdef CONFIG_COMPAT #include @@ -59,3 +60,5 @@ struct stat64 { #endif #endif + +#endif diff --git a/trunk/arch/arm64/include/uapi/asm/statfs.h b/trunk/arch/arm64/include/asm/statfs.h similarity index 100% rename from trunk/arch/arm64/include/uapi/asm/statfs.h rename to trunk/arch/arm64/include/asm/statfs.h diff --git a/trunk/arch/arm64/include/asm/unistd.h b/trunk/arch/arm64/include/asm/unistd.h index 63f853f8b718..8f03dee066ed 100644 --- a/trunk/arch/arm64/include/asm/unistd.h +++ b/trunk/arch/arm64/include/asm/unistd.h @@ -13,17 +13,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + +#ifndef __SYSCALL_COMPAT +#include +#endif + +#ifdef __KERNEL__ #ifdef CONFIG_COMPAT -#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION -#define __ARCH_WANT_COMPAT_STAT64 -#define __ARCH_WANT_SYS_GETHOSTNAME -#define __ARCH_WANT_SYS_PAUSE -#define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK -#define __ARCH_WANT_SYS_NICE -#define __ARCH_WANT_SYS_SIGPENDING -#define __ARCH_WANT_SYS_SIGPROCMASK -#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND -#define __ARCH_WANT_COMPAT_SYS_SENDFILE +#include +#endif #endif -#include diff --git a/trunk/arch/arm64/include/asm/unistd32.h b/trunk/arch/arm64/include/asm/unistd32.h index 6d909faebf28..ba42d41fc5c2 100644 --- a/trunk/arch/arm64/include/asm/unistd32.h +++ b/trunk/arch/arm64/include/asm/unistd32.h @@ -1,5 +1,5 @@ /* - * AArch32 (compat) system call definitions. + * Based on arch/arm/include/asm/unistd.h * * Copyright (C) 2001-2005 Russell King * Copyright (C) 2012 ARM Ltd. @@ -21,390 +21,715 @@ #define __SYSCALL(x, y) #endif -__SYSCALL(0, sys_restart_syscall) -__SYSCALL(1, sys_exit) -__SYSCALL(2, compat_sys_fork_wrapper) -__SYSCALL(3, sys_read) -__SYSCALL(4, sys_write) -__SYSCALL(5, compat_sys_open) -__SYSCALL(6, sys_close) -__SYSCALL(7, sys_ni_syscall) /* 7 was sys_waitpid */ -__SYSCALL(8, sys_creat) -__SYSCALL(9, sys_link) -__SYSCALL(10, sys_unlink) -__SYSCALL(11, compat_sys_execve_wrapper) -__SYSCALL(12, sys_chdir) -__SYSCALL(13, sys_ni_syscall) /* 13 was sys_time */ -__SYSCALL(14, sys_mknod) -__SYSCALL(15, sys_chmod) -__SYSCALL(16, sys_lchown16) -__SYSCALL(17, sys_ni_syscall) /* 17 was sys_break */ -__SYSCALL(18, sys_ni_syscall) /* 18 was sys_stat */ -__SYSCALL(19, compat_sys_lseek_wrapper) -__SYSCALL(20, sys_getpid) -__SYSCALL(21, compat_sys_mount) -__SYSCALL(22, sys_ni_syscall) /* 22 was sys_umount */ -__SYSCALL(23, sys_setuid16) -__SYSCALL(24, sys_getuid16) -__SYSCALL(25, sys_ni_syscall) /* 25 was sys_stime */ -__SYSCALL(26, compat_sys_ptrace) -__SYSCALL(27, sys_ni_syscall) /* 27 was sys_alarm */ -__SYSCALL(28, sys_ni_syscall) /* 28 was sys_fstat */ -__SYSCALL(29, sys_pause) -__SYSCALL(30, sys_ni_syscall) /* 30 was sys_utime */ -__SYSCALL(31, sys_ni_syscall) /* 31 was sys_stty */ -__SYSCALL(32, sys_ni_syscall) /* 32 was sys_gtty */ -__SYSCALL(33, sys_access) -__SYSCALL(34, sys_nice) -__SYSCALL(35, sys_ni_syscall) /* 35 was sys_ftime */ -__SYSCALL(36, sys_sync) -__SYSCALL(37, sys_kill) -__SYSCALL(38, sys_rename) -__SYSCALL(39, sys_mkdir) -__SYSCALL(40, sys_rmdir) -__SYSCALL(41, sys_dup) -__SYSCALL(42, sys_pipe) -__SYSCALL(43, compat_sys_times) -__SYSCALL(44, sys_ni_syscall) /* 44 was sys_prof */ -__SYSCALL(45, sys_brk) -__SYSCALL(46, sys_setgid16) -__SYSCALL(47, sys_getgid16) -__SYSCALL(48, sys_ni_syscall) /* 48 was sys_signal */ -__SYSCALL(49, sys_geteuid16) -__SYSCALL(50, sys_getegid16) -__SYSCALL(51, sys_acct) -__SYSCALL(52, sys_umount) -__SYSCALL(53, sys_ni_syscall) /* 53 was sys_lock */ -__SYSCALL(54, compat_sys_ioctl) -__SYSCALL(55, compat_sys_fcntl) -__SYSCALL(56, sys_ni_syscall) /* 56 was sys_mpx */ -__SYSCALL(57, sys_setpgid) -__SYSCALL(58, sys_ni_syscall) /* 58 was sys_ulimit */ -__SYSCALL(59, sys_ni_syscall) /* 59 was sys_olduname */ -__SYSCALL(60, sys_umask) -__SYSCALL(61, sys_chroot) -__SYSCALL(62, compat_sys_ustat) -__SYSCALL(63, sys_dup2) -__SYSCALL(64, sys_getppid) -__SYSCALL(65, sys_getpgrp) -__SYSCALL(66, sys_setsid) -__SYSCALL(67, compat_sys_sigaction) -__SYSCALL(68, sys_ni_syscall) /* 68 was sys_sgetmask */ -__SYSCALL(69, sys_ni_syscall) /* 69 was sys_ssetmask */ -__SYSCALL(70, sys_setreuid16) -__SYSCALL(71, sys_setregid16) -__SYSCALL(72, compat_sys_sigsuspend) -__SYSCALL(73, compat_sys_sigpending) -__SYSCALL(74, sys_sethostname) -__SYSCALL(75, compat_sys_setrlimit) -__SYSCALL(76, sys_ni_syscall) /* 76 was compat_sys_getrlimit */ -__SYSCALL(77, compat_sys_getrusage) -__SYSCALL(78, compat_sys_gettimeofday) -__SYSCALL(79, compat_sys_settimeofday) -__SYSCALL(80, sys_getgroups16) -__SYSCALL(81, sys_setgroups16) -__SYSCALL(82, sys_ni_syscall) /* 82 was compat_sys_select */ -__SYSCALL(83, sys_symlink) -__SYSCALL(84, sys_ni_syscall) /* 84 was sys_lstat */ -__SYSCALL(85, sys_readlink) -__SYSCALL(86, sys_uselib) -__SYSCALL(87, sys_swapon) -__SYSCALL(88, sys_reboot) -__SYSCALL(89, sys_ni_syscall) /* 89 was sys_readdir */ -__SYSCALL(90, sys_ni_syscall) /* 90 was sys_mmap */ -__SYSCALL(91, sys_munmap) -__SYSCALL(92, sys_truncate) -__SYSCALL(93, sys_ftruncate) -__SYSCALL(94, sys_fchmod) -__SYSCALL(95, sys_fchown16) -__SYSCALL(96, sys_getpriority) -__SYSCALL(97, sys_setpriority) -__SYSCALL(98, sys_ni_syscall) /* 98 was sys_profil */ -__SYSCALL(99, compat_sys_statfs) -__SYSCALL(100, compat_sys_fstatfs) -__SYSCALL(101, sys_ni_syscall) /* 101 was sys_ioperm */ -__SYSCALL(102, sys_ni_syscall) /* 102 was sys_socketcall */ -__SYSCALL(103, sys_syslog) -__SYSCALL(104, compat_sys_setitimer) -__SYSCALL(105, compat_sys_getitimer) -__SYSCALL(106, compat_sys_newstat) -__SYSCALL(107, compat_sys_newlstat) -__SYSCALL(108, compat_sys_newfstat) -__SYSCALL(109, sys_ni_syscall) /* 109 was sys_uname */ -__SYSCALL(110, sys_ni_syscall) /* 110 was sys_iopl */ -__SYSCALL(111, sys_vhangup) -__SYSCALL(112, sys_ni_syscall) /* 112 was sys_idle */ -__SYSCALL(113, sys_ni_syscall) /* 113 was sys_syscall */ -__SYSCALL(114, compat_sys_wait4) -__SYSCALL(115, sys_swapoff) -__SYSCALL(116, compat_sys_sysinfo) -__SYSCALL(117, sys_ni_syscall) /* 117 was sys_ipc */ -__SYSCALL(118, sys_fsync) -__SYSCALL(119, compat_sys_sigreturn_wrapper) -__SYSCALL(120, compat_sys_clone_wrapper) -__SYSCALL(121, sys_setdomainname) -__SYSCALL(122, sys_newuname) -__SYSCALL(123, sys_ni_syscall) /* 123 was sys_modify_ldt */ -__SYSCALL(124, compat_sys_adjtimex) -__SYSCALL(125, sys_mprotect) -__SYSCALL(126, compat_sys_sigprocmask) -__SYSCALL(127, sys_ni_syscall) /* 127 was sys_create_module */ -__SYSCALL(128, sys_init_module) -__SYSCALL(129, sys_delete_module) -__SYSCALL(130, sys_ni_syscall) /* 130 was sys_get_kernel_syms */ -__SYSCALL(131, sys_quotactl) -__SYSCALL(132, sys_getpgid) -__SYSCALL(133, sys_fchdir) -__SYSCALL(134, sys_bdflush) -__SYSCALL(135, sys_sysfs) -__SYSCALL(136, sys_personality) -__SYSCALL(137, sys_ni_syscall) /* 137 was sys_afs_syscall */ -__SYSCALL(138, sys_setfsuid16) -__SYSCALL(139, sys_setfsgid16) -__SYSCALL(140, sys_llseek) -__SYSCALL(141, compat_sys_getdents) -__SYSCALL(142, compat_sys_select) -__SYSCALL(143, sys_flock) -__SYSCALL(144, sys_msync) -__SYSCALL(145, compat_sys_readv) -__SYSCALL(146, compat_sys_writev) -__SYSCALL(147, sys_getsid) -__SYSCALL(148, sys_fdatasync) -__SYSCALL(149, compat_sys_sysctl) -__SYSCALL(150, sys_mlock) -__SYSCALL(151, sys_munlock) -__SYSCALL(152, sys_mlockall) -__SYSCALL(153, sys_munlockall) -__SYSCALL(154, sys_sched_setparam) -__SYSCALL(155, sys_sched_getparam) -__SYSCALL(156, sys_sched_setscheduler) -__SYSCALL(157, sys_sched_getscheduler) -__SYSCALL(158, sys_sched_yield) -__SYSCALL(159, sys_sched_get_priority_max) -__SYSCALL(160, sys_sched_get_priority_min) -__SYSCALL(161, compat_sys_sched_rr_get_interval) -__SYSCALL(162, compat_sys_nanosleep) -__SYSCALL(163, sys_mremap) -__SYSCALL(164, sys_setresuid16) -__SYSCALL(165, sys_getresuid16) -__SYSCALL(166, sys_ni_syscall) /* 166 was sys_vm86 */ -__SYSCALL(167, sys_ni_syscall) /* 167 was sys_query_module */ -__SYSCALL(168, sys_poll) -__SYSCALL(169, sys_ni_syscall) -__SYSCALL(170, sys_setresgid16) -__SYSCALL(171, sys_getresgid16) -__SYSCALL(172, sys_prctl) -__SYSCALL(173, compat_sys_rt_sigreturn_wrapper) -__SYSCALL(174, compat_sys_rt_sigaction) -__SYSCALL(175, compat_sys_rt_sigprocmask) -__SYSCALL(176, compat_sys_rt_sigpending) -__SYSCALL(177, compat_sys_rt_sigtimedwait) -__SYSCALL(178, compat_sys_rt_sigqueueinfo) -__SYSCALL(179, compat_sys_rt_sigsuspend) -__SYSCALL(180, compat_sys_pread64_wrapper) -__SYSCALL(181, compat_sys_pwrite64_wrapper) -__SYSCALL(182, sys_chown16) -__SYSCALL(183, sys_getcwd) -__SYSCALL(184, sys_capget) -__SYSCALL(185, sys_capset) -__SYSCALL(186, compat_sys_sigaltstack_wrapper) -__SYSCALL(187, compat_sys_sendfile) -__SYSCALL(188, sys_ni_syscall) /* 188 reserved */ -__SYSCALL(189, sys_ni_syscall) /* 189 reserved */ -__SYSCALL(190, compat_sys_vfork_wrapper) -__SYSCALL(191, compat_sys_getrlimit) /* SuS compliant getrlimit */ -__SYSCALL(192, sys_mmap_pgoff) -__SYSCALL(193, compat_sys_truncate64_wrapper) -__SYSCALL(194, compat_sys_ftruncate64_wrapper) -__SYSCALL(195, sys_stat64) -__SYSCALL(196, sys_lstat64) -__SYSCALL(197, sys_fstat64) -__SYSCALL(198, sys_lchown) -__SYSCALL(199, sys_getuid) -__SYSCALL(200, sys_getgid) -__SYSCALL(201, sys_geteuid) -__SYSCALL(202, sys_getegid) -__SYSCALL(203, sys_setreuid) -__SYSCALL(204, sys_setregid) -__SYSCALL(205, sys_getgroups) -__SYSCALL(206, sys_setgroups) -__SYSCALL(207, sys_fchown) -__SYSCALL(208, sys_setresuid) -__SYSCALL(209, sys_getresuid) -__SYSCALL(210, sys_setresgid) -__SYSCALL(211, sys_getresgid) -__SYSCALL(212, sys_chown) -__SYSCALL(213, sys_setuid) -__SYSCALL(214, sys_setgid) -__SYSCALL(215, sys_setfsuid) -__SYSCALL(216, sys_setfsgid) -__SYSCALL(217, compat_sys_getdents64) -__SYSCALL(218, sys_pivot_root) -__SYSCALL(219, sys_mincore) -__SYSCALL(220, sys_madvise) -__SYSCALL(221, compat_sys_fcntl64) -__SYSCALL(222, sys_ni_syscall) /* 222 for tux */ -__SYSCALL(223, sys_ni_syscall) /* 223 is unused */ -__SYSCALL(224, sys_gettid) -__SYSCALL(225, compat_sys_readahead_wrapper) -__SYSCALL(226, sys_setxattr) -__SYSCALL(227, sys_lsetxattr) -__SYSCALL(228, sys_fsetxattr) -__SYSCALL(229, sys_getxattr) -__SYSCALL(230, sys_lgetxattr) -__SYSCALL(231, sys_fgetxattr) -__SYSCALL(232, sys_listxattr) -__SYSCALL(233, sys_llistxattr) -__SYSCALL(234, sys_flistxattr) -__SYSCALL(235, sys_removexattr) -__SYSCALL(236, sys_lremovexattr) -__SYSCALL(237, sys_fremovexattr) -__SYSCALL(238, sys_tkill) -__SYSCALL(239, sys_sendfile64) -__SYSCALL(240, compat_sys_futex) -__SYSCALL(241, compat_sys_sched_setaffinity) -__SYSCALL(242, compat_sys_sched_getaffinity) -__SYSCALL(243, compat_sys_io_setup) -__SYSCALL(244, sys_io_destroy) -__SYSCALL(245, compat_sys_io_getevents) -__SYSCALL(246, compat_sys_io_submit) -__SYSCALL(247, sys_io_cancel) -__SYSCALL(248, sys_exit_group) -__SYSCALL(249, compat_sys_lookup_dcookie) -__SYSCALL(250, sys_epoll_create) -__SYSCALL(251, sys_epoll_ctl) -__SYSCALL(252, sys_epoll_wait) -__SYSCALL(253, sys_remap_file_pages) -__SYSCALL(254, sys_ni_syscall) /* 254 for set_thread_area */ -__SYSCALL(255, sys_ni_syscall) /* 255 for get_thread_area */ -__SYSCALL(256, sys_set_tid_address) -__SYSCALL(257, compat_sys_timer_create) -__SYSCALL(258, compat_sys_timer_settime) -__SYSCALL(259, compat_sys_timer_gettime) -__SYSCALL(260, sys_timer_getoverrun) -__SYSCALL(261, sys_timer_delete) -__SYSCALL(262, compat_sys_clock_settime) -__SYSCALL(263, compat_sys_clock_gettime) -__SYSCALL(264, compat_sys_clock_getres) -__SYSCALL(265, compat_sys_clock_nanosleep) -__SYSCALL(266, compat_sys_statfs64_wrapper) -__SYSCALL(267, compat_sys_fstatfs64_wrapper) -__SYSCALL(268, sys_tgkill) -__SYSCALL(269, compat_sys_utimes) -__SYSCALL(270, compat_sys_fadvise64_64_wrapper) -__SYSCALL(271, sys_pciconfig_iobase) -__SYSCALL(272, sys_pciconfig_read) -__SYSCALL(273, sys_pciconfig_write) -__SYSCALL(274, compat_sys_mq_open) -__SYSCALL(275, sys_mq_unlink) -__SYSCALL(276, compat_sys_mq_timedsend) -__SYSCALL(277, compat_sys_mq_timedreceive) -__SYSCALL(278, compat_sys_mq_notify) -__SYSCALL(279, compat_sys_mq_getsetattr) -__SYSCALL(280, compat_sys_waitid) -__SYSCALL(281, sys_socket) -__SYSCALL(282, sys_bind) -__SYSCALL(283, sys_connect) -__SYSCALL(284, sys_listen) -__SYSCALL(285, sys_accept) -__SYSCALL(286, sys_getsockname) -__SYSCALL(287, sys_getpeername) -__SYSCALL(288, sys_socketpair) -__SYSCALL(289, sys_send) -__SYSCALL(290, sys_sendto) -__SYSCALL(291, compat_sys_recv) -__SYSCALL(292, compat_sys_recvfrom) -__SYSCALL(293, sys_shutdown) -__SYSCALL(294, compat_sys_setsockopt) -__SYSCALL(295, compat_sys_getsockopt) -__SYSCALL(296, compat_sys_sendmsg) -__SYSCALL(297, compat_sys_recvmsg) -__SYSCALL(298, sys_semop) -__SYSCALL(299, sys_semget) -__SYSCALL(300, compat_sys_semctl) -__SYSCALL(301, compat_sys_msgsnd) -__SYSCALL(302, compat_sys_msgrcv) -__SYSCALL(303, sys_msgget) -__SYSCALL(304, compat_sys_msgctl) -__SYSCALL(305, compat_sys_shmat) -__SYSCALL(306, sys_shmdt) -__SYSCALL(307, sys_shmget) -__SYSCALL(308, compat_sys_shmctl) -__SYSCALL(309, sys_add_key) -__SYSCALL(310, sys_request_key) -__SYSCALL(311, compat_sys_keyctl) -__SYSCALL(312, compat_sys_semtimedop) -__SYSCALL(313, sys_ni_syscall) -__SYSCALL(314, sys_ioprio_set) -__SYSCALL(315, sys_ioprio_get) -__SYSCALL(316, sys_inotify_init) -__SYSCALL(317, sys_inotify_add_watch) -__SYSCALL(318, sys_inotify_rm_watch) -__SYSCALL(319, compat_sys_mbind) -__SYSCALL(320, compat_sys_get_mempolicy) -__SYSCALL(321, compat_sys_set_mempolicy) -__SYSCALL(322, compat_sys_openat) -__SYSCALL(323, sys_mkdirat) -__SYSCALL(324, sys_mknodat) -__SYSCALL(325, sys_fchownat) -__SYSCALL(326, compat_sys_futimesat) -__SYSCALL(327, sys_fstatat64) -__SYSCALL(328, sys_unlinkat) -__SYSCALL(329, sys_renameat) -__SYSCALL(330, sys_linkat) -__SYSCALL(331, sys_symlinkat) -__SYSCALL(332, sys_readlinkat) -__SYSCALL(333, sys_fchmodat) -__SYSCALL(334, sys_faccessat) -__SYSCALL(335, compat_sys_pselect6) -__SYSCALL(336, compat_sys_ppoll) -__SYSCALL(337, sys_unshare) -__SYSCALL(338, compat_sys_set_robust_list) -__SYSCALL(339, compat_sys_get_robust_list) -__SYSCALL(340, sys_splice) -__SYSCALL(341, compat_sys_sync_file_range2_wrapper) -__SYSCALL(342, sys_tee) -__SYSCALL(343, compat_sys_vmsplice) -__SYSCALL(344, compat_sys_move_pages) -__SYSCALL(345, sys_getcpu) -__SYSCALL(346, compat_sys_epoll_pwait) -__SYSCALL(347, compat_sys_kexec_load) -__SYSCALL(348, compat_sys_utimensat) -__SYSCALL(349, compat_sys_signalfd) -__SYSCALL(350, sys_timerfd_create) -__SYSCALL(351, sys_eventfd) -__SYSCALL(352, compat_sys_fallocate_wrapper) -__SYSCALL(353, compat_sys_timerfd_settime) -__SYSCALL(354, compat_sys_timerfd_gettime) -__SYSCALL(355, compat_sys_signalfd4) -__SYSCALL(356, sys_eventfd2) -__SYSCALL(357, sys_epoll_create1) -__SYSCALL(358, sys_dup3) -__SYSCALL(359, sys_pipe2) -__SYSCALL(360, sys_inotify_init1) -__SYSCALL(361, compat_sys_preadv) -__SYSCALL(362, compat_sys_pwritev) -__SYSCALL(363, compat_sys_rt_tgsigqueueinfo) -__SYSCALL(364, sys_perf_event_open) -__SYSCALL(365, compat_sys_recvmmsg) -__SYSCALL(366, sys_accept4) -__SYSCALL(367, sys_fanotify_init) -__SYSCALL(368, compat_sys_fanotify_mark_wrapper) -__SYSCALL(369, sys_prlimit64) -__SYSCALL(370, sys_name_to_handle_at) -__SYSCALL(371, sys_open_by_handle_at) -__SYSCALL(372, sys_clock_adjtime) -__SYSCALL(373, sys_syncfs) - -#define __NR_compat_syscalls 374 - /* - * Compat syscall numbers used by the AArch64 kernel. + * This file contains the system call numbers. */ -#define __NR_compat_restart_syscall 0 -#define __NR_compat_sigreturn 119 -#define __NR_compat_rt_sigreturn 173 +#ifdef __SYSCALL_COMPAT + +#define __NR_restart_syscall 0 +__SYSCALL(__NR_restart_syscall, sys_restart_syscall) +#define __NR_exit 1 +__SYSCALL(__NR_exit, sys_exit) +#define __NR_fork 2 +__SYSCALL(__NR_fork, sys_fork) +#define __NR_read 3 +__SYSCALL(__NR_read, sys_read) +#define __NR_write 4 +__SYSCALL(__NR_write, sys_write) +#define __NR_open 5 +__SYSCALL(__NR_open, sys_open) +#define __NR_close 6 +__SYSCALL(__NR_close, sys_close) +__SYSCALL(7, sys_ni_syscall) /* 7 was sys_waitpid */ +#define __NR_creat 8 +__SYSCALL(__NR_creat, sys_creat) +#define __NR_link 9 +__SYSCALL(__NR_link, sys_link) +#define __NR_unlink 10 +__SYSCALL(__NR_unlink, sys_unlink) +#define __NR_execve 11 +__SYSCALL(__NR_execve, sys_execve) +#define __NR_chdir 12 +__SYSCALL(__NR_chdir, sys_chdir) +__SYSCALL(13, sys_ni_syscall) /* 13 was sys_time */ +#define __NR_mknod 14 +__SYSCALL(__NR_mknod, sys_mknod) +#define __NR_chmod 15 +__SYSCALL(__NR_chmod, sys_chmod) +#define __NR_lchown 16 +__SYSCALL(__NR_lchown, sys_lchown16) +__SYSCALL(17, sys_ni_syscall) /* 17 was sys_break */ +__SYSCALL(18, sys_ni_syscall) /* 18 was sys_stat */ +#define __NR_lseek 19 +__SYSCALL(__NR_lseek, sys_lseek) +#define __NR_getpid 20 +__SYSCALL(__NR_getpid, sys_getpid) +#define __NR_mount 21 +__SYSCALL(__NR_mount, sys_mount) +__SYSCALL(22, sys_ni_syscall) /* 22 was sys_umount */ +#define __NR_setuid 23 +__SYSCALL(__NR_setuid, sys_setuid16) +#define __NR_getuid 24 +__SYSCALL(__NR_getuid, sys_getuid16) +__SYSCALL(25, sys_ni_syscall) /* 25 was sys_stime */ +#define __NR_ptrace 26 +__SYSCALL(__NR_ptrace, sys_ptrace) +__SYSCALL(27, sys_ni_syscall) /* 27 was sys_alarm */ +__SYSCALL(28, sys_ni_syscall) /* 28 was sys_fstat */ +#define __NR_pause 29 +__SYSCALL(__NR_pause, sys_pause) +__SYSCALL(30, sys_ni_syscall) /* 30 was sys_utime */ +__SYSCALL(31, sys_ni_syscall) /* 31 was sys_stty */ +__SYSCALL(32, sys_ni_syscall) /* 32 was sys_gtty */ +#define __NR_access 33 +__SYSCALL(__NR_access, sys_access) +#define __NR_nice 34 +__SYSCALL(__NR_nice, sys_nice) +__SYSCALL(35, sys_ni_syscall) /* 35 was sys_ftime */ +#define __NR_sync 36 +__SYSCALL(__NR_sync, sys_sync) +#define __NR_kill 37 +__SYSCALL(__NR_kill, sys_kill) +#define __NR_rename 38 +__SYSCALL(__NR_rename, sys_rename) +#define __NR_mkdir 39 +__SYSCALL(__NR_mkdir, sys_mkdir) +#define __NR_rmdir 40 +__SYSCALL(__NR_rmdir, sys_rmdir) +#define __NR_dup 41 +__SYSCALL(__NR_dup, sys_dup) +#define __NR_pipe 42 +__SYSCALL(__NR_pipe, sys_pipe) +#define __NR_times 43 +__SYSCALL(__NR_times, sys_times) +__SYSCALL(44, sys_ni_syscall) /* 44 was sys_prof */ +#define __NR_brk 45 +__SYSCALL(__NR_brk, sys_brk) +#define __NR_setgid 46 +__SYSCALL(__NR_setgid, sys_setgid16) +#define __NR_getgid 47 +__SYSCALL(__NR_getgid, sys_getgid16) +__SYSCALL(48, sys_ni_syscall) /* 48 was sys_signal */ +#define __NR_geteuid 49 +__SYSCALL(__NR_geteuid, sys_geteuid16) +#define __NR_getegid 50 +__SYSCALL(__NR_getegid, sys_getegid16) +#define __NR_acct 51 +__SYSCALL(__NR_acct, sys_acct) +#define __NR_umount2 52 +__SYSCALL(__NR_umount2, sys_umount) +__SYSCALL(53, sys_ni_syscall) /* 53 was sys_lock */ +#define __NR_ioctl 54 +__SYSCALL(__NR_ioctl, sys_ioctl) +#define __NR_fcntl 55 +__SYSCALL(__NR_fcntl, sys_fcntl) +__SYSCALL(56, sys_ni_syscall) /* 56 was sys_mpx */ +#define __NR_setpgid 57 +__SYSCALL(__NR_setpgid, sys_setpgid) +__SYSCALL(58, sys_ni_syscall) /* 58 was sys_ulimit */ +__SYSCALL(59, sys_ni_syscall) /* 59 was sys_olduname */ +#define __NR_umask 60 +__SYSCALL(__NR_umask, sys_umask) +#define __NR_chroot 61 +__SYSCALL(__NR_chroot, sys_chroot) +#define __NR_ustat 62 +__SYSCALL(__NR_ustat, sys_ustat) +#define __NR_dup2 63 +__SYSCALL(__NR_dup2, sys_dup2) +#define __NR_getppid 64 +__SYSCALL(__NR_getppid, sys_getppid) +#define __NR_getpgrp 65 +__SYSCALL(__NR_getpgrp, sys_getpgrp) +#define __NR_setsid 66 +__SYSCALL(__NR_setsid, sys_setsid) +#define __NR_sigaction 67 +__SYSCALL(__NR_sigaction, sys_sigaction) +__SYSCALL(68, sys_ni_syscall) /* 68 was sys_sgetmask */ +__SYSCALL(69, sys_ni_syscall) /* 69 was sys_ssetmask */ +#define __NR_setreuid 70 +__SYSCALL(__NR_setreuid, sys_setreuid16) +#define __NR_setregid 71 +__SYSCALL(__NR_setregid, sys_setregid16) +#define __NR_sigsuspend 72 +__SYSCALL(__NR_sigsuspend, sys_sigsuspend) +#define __NR_sigpending 73 +__SYSCALL(__NR_sigpending, sys_sigpending) +#define __NR_sethostname 74 +__SYSCALL(__NR_sethostname, sys_sethostname) +#define __NR_setrlimit 75 +__SYSCALL(__NR_setrlimit, sys_setrlimit) +__SYSCALL(76, sys_ni_syscall) /* 76 was sys_getrlimit */ +#define __NR_getrusage 77 +__SYSCALL(__NR_getrusage, sys_getrusage) +#define __NR_gettimeofday 78 +__SYSCALL(__NR_gettimeofday, sys_gettimeofday) +#define __NR_settimeofday 79 +__SYSCALL(__NR_settimeofday, sys_settimeofday) +#define __NR_getgroups 80 +__SYSCALL(__NR_getgroups, sys_getgroups16) +#define __NR_setgroups 81 +__SYSCALL(__NR_setgroups, sys_setgroups16) +__SYSCALL(82, sys_ni_syscall) /* 82 was sys_select */ +#define __NR_symlink 83 +__SYSCALL(__NR_symlink, sys_symlink) +__SYSCALL(84, sys_ni_syscall) /* 84 was sys_lstat */ +#define __NR_readlink 85 +__SYSCALL(__NR_readlink, sys_readlink) +#define __NR_uselib 86 +__SYSCALL(__NR_uselib, sys_uselib) +#define __NR_swapon 87 +__SYSCALL(__NR_swapon, sys_swapon) +#define __NR_reboot 88 +__SYSCALL(__NR_reboot, sys_reboot) +__SYSCALL(89, sys_ni_syscall) /* 89 was sys_readdir */ +__SYSCALL(90, sys_ni_syscall) /* 90 was sys_mmap */ +#define __NR_munmap 91 +__SYSCALL(__NR_munmap, sys_munmap) +#define __NR_truncate 92 +__SYSCALL(__NR_truncate, sys_truncate) +#define __NR_ftruncate 93 +__SYSCALL(__NR_ftruncate, sys_ftruncate) +#define __NR_fchmod 94 +__SYSCALL(__NR_fchmod, sys_fchmod) +#define __NR_fchown 95 +__SYSCALL(__NR_fchown, sys_fchown16) +#define __NR_getpriority 96 +__SYSCALL(__NR_getpriority, sys_getpriority) +#define __NR_setpriority 97 +__SYSCALL(__NR_setpriority, sys_setpriority) +__SYSCALL(98, sys_ni_syscall) /* 98 was sys_profil */ +#define __NR_statfs 99 +__SYSCALL(__NR_statfs, sys_statfs) +#define __NR_fstatfs 100 +__SYSCALL(__NR_fstatfs, sys_fstatfs) +__SYSCALL(101, sys_ni_syscall) /* 101 was sys_ioperm */ +__SYSCALL(102, sys_ni_syscall) /* 102 was sys_socketcall */ +#define __NR_syslog 103 +__SYSCALL(__NR_syslog, sys_syslog) +#define __NR_setitimer 104 +__SYSCALL(__NR_setitimer, sys_setitimer) +#define __NR_getitimer 105 +__SYSCALL(__NR_getitimer, sys_getitimer) +#define __NR_stat 106 +__SYSCALL(__NR_stat, sys_newstat) +#define __NR_lstat 107 +__SYSCALL(__NR_lstat, sys_newlstat) +#define __NR_fstat 108 +__SYSCALL(__NR_fstat, sys_newfstat) +__SYSCALL(109, sys_ni_syscall) /* 109 was sys_uname */ +__SYSCALL(110, sys_ni_syscall) /* 110 was sys_iopl */ +#define __NR_vhangup 111 +__SYSCALL(__NR_vhangup, sys_vhangup) +__SYSCALL(112, sys_ni_syscall) /* 112 was sys_idle */ +__SYSCALL(113, sys_ni_syscall) /* 113 was sys_syscall */ +#define __NR_wait4 114 +__SYSCALL(__NR_wait4, sys_wait4) +#define __NR_swapoff 115 +__SYSCALL(__NR_swapoff, sys_swapoff) +#define __NR_sysinfo 116 +__SYSCALL(__NR_sysinfo, sys_sysinfo) +__SYSCALL(117, sys_ni_syscall) /* 117 was sys_ipc */ +#define __NR_fsync 118 +__SYSCALL(__NR_fsync, sys_fsync) +#define __NR_sigreturn 119 +__SYSCALL(__NR_sigreturn, sys_sigreturn) +#define __NR_clone 120 +__SYSCALL(__NR_clone, sys_clone) +#define __NR_setdomainname 121 +__SYSCALL(__NR_setdomainname, sys_setdomainname) +#define __NR_uname 122 +__SYSCALL(__NR_uname, sys_newuname) +__SYSCALL(123, sys_ni_syscall) /* 123 was sys_modify_ldt */ +#define __NR_adjtimex 124 +__SYSCALL(__NR_adjtimex, sys_adjtimex) +#define __NR_mprotect 125 +__SYSCALL(__NR_mprotect, sys_mprotect) +#define __NR_sigprocmask 126 +__SYSCALL(__NR_sigprocmask, sys_sigprocmask) +__SYSCALL(127, sys_ni_syscall) /* 127 was sys_create_module */ +#define __NR_init_module 128 +__SYSCALL(__NR_init_module, sys_init_module) +#define __NR_delete_module 129 +__SYSCALL(__NR_delete_module, sys_delete_module) +__SYSCALL(130, sys_ni_syscall) /* 130 was sys_get_kernel_syms */ +#define __NR_quotactl 131 +__SYSCALL(__NR_quotactl, sys_quotactl) +#define __NR_getpgid 132 +__SYSCALL(__NR_getpgid, sys_getpgid) +#define __NR_fchdir 133 +__SYSCALL(__NR_fchdir, sys_fchdir) +#define __NR_bdflush 134 +__SYSCALL(__NR_bdflush, sys_bdflush) +#define __NR_sysfs 135 +__SYSCALL(__NR_sysfs, sys_sysfs) +#define __NR_personality 136 +__SYSCALL(__NR_personality, sys_personality) +__SYSCALL(137, sys_ni_syscall) /* 137 was sys_afs_syscall */ +#define __NR_setfsuid 138 +__SYSCALL(__NR_setfsuid, sys_setfsuid16) +#define __NR_setfsgid 139 +__SYSCALL(__NR_setfsgid, sys_setfsgid16) +#define __NR__llseek 140 +__SYSCALL(__NR__llseek, sys_llseek) +#define __NR_getdents 141 +__SYSCALL(__NR_getdents, sys_getdents) +#define __NR__newselect 142 +__SYSCALL(__NR__newselect, sys_select) +#define __NR_flock 143 +__SYSCALL(__NR_flock, sys_flock) +#define __NR_msync 144 +__SYSCALL(__NR_msync, sys_msync) +#define __NR_readv 145 +__SYSCALL(__NR_readv, sys_readv) +#define __NR_writev 146 +__SYSCALL(__NR_writev, sys_writev) +#define __NR_getsid 147 +__SYSCALL(__NR_getsid, sys_getsid) +#define __NR_fdatasync 148 +__SYSCALL(__NR_fdatasync, sys_fdatasync) +#define __NR__sysctl 149 +__SYSCALL(__NR__sysctl, sys_sysctl) +#define __NR_mlock 150 +__SYSCALL(__NR_mlock, sys_mlock) +#define __NR_munlock 151 +__SYSCALL(__NR_munlock, sys_munlock) +#define __NR_mlockall 152 +__SYSCALL(__NR_mlockall, sys_mlockall) +#define __NR_munlockall 153 +__SYSCALL(__NR_munlockall, sys_munlockall) +#define __NR_sched_setparam 154 +__SYSCALL(__NR_sched_setparam, sys_sched_setparam) +#define __NR_sched_getparam 155 +__SYSCALL(__NR_sched_getparam, sys_sched_getparam) +#define __NR_sched_setscheduler 156 +__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler) +#define __NR_sched_getscheduler 157 +__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) +#define __NR_sched_yield 158 +__SYSCALL(__NR_sched_yield, sys_sched_yield) +#define __NR_sched_get_priority_max 159 +__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) +#define __NR_sched_get_priority_min 160 +__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) +#define __NR_sched_rr_get_interval 161 +__SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval) +#define __NR_nanosleep 162 +__SYSCALL(__NR_nanosleep, sys_nanosleep) +#define __NR_mremap 163 +__SYSCALL(__NR_mremap, sys_mremap) +#define __NR_setresuid 164 +__SYSCALL(__NR_setresuid, sys_setresuid16) +#define __NR_getresuid 165 +__SYSCALL(__NR_getresuid, sys_getresuid16) +__SYSCALL(166, sys_ni_syscall) /* 166 was sys_vm86 */ +__SYSCALL(167, sys_ni_syscall) /* 167 was sys_query_module */ +#define __NR_poll 168 +__SYSCALL(__NR_poll, sys_poll) +#define __NR_nfsservctl 169 +__SYSCALL(__NR_nfsservctl, sys_ni_syscall) +#define __NR_setresgid 170 +__SYSCALL(__NR_setresgid, sys_setresgid16) +#define __NR_getresgid 171 +__SYSCALL(__NR_getresgid, sys_getresgid16) +#define __NR_prctl 172 +__SYSCALL(__NR_prctl, sys_prctl) +#define __NR_rt_sigreturn 173 +__SYSCALL(__NR_rt_sigreturn, sys_rt_sigreturn) +#define __NR_rt_sigaction 174 +__SYSCALL(__NR_rt_sigaction, sys_rt_sigaction) +#define __NR_rt_sigprocmask 175 +__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask) +#define __NR_rt_sigpending 176 +__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending) +#define __NR_rt_sigtimedwait 177 +__SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait) +#define __NR_rt_sigqueueinfo 178 +__SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo) +#define __NR_rt_sigsuspend 179 +__SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend) +#define __NR_pread64 180 +__SYSCALL(__NR_pread64, sys_pread64) +#define __NR_pwrite64 181 +__SYSCALL(__NR_pwrite64, sys_pwrite64) +#define __NR_chown 182 +__SYSCALL(__NR_chown, sys_chown16) +#define __NR_getcwd 183 +__SYSCALL(__NR_getcwd, sys_getcwd) +#define __NR_capget 184 +__SYSCALL(__NR_capget, sys_capget) +#define __NR_capset 185 +__SYSCALL(__NR_capset, sys_capset) +#define __NR_sigaltstack 186 +__SYSCALL(__NR_sigaltstack, sys_sigaltstack) +#define __NR_sendfile 187 +__SYSCALL(__NR_sendfile, sys_sendfile) +__SYSCALL(188, sys_ni_syscall) /* 188 reserved */ +__SYSCALL(189, sys_ni_syscall) /* 189 reserved */ +#define __NR_vfork 190 +__SYSCALL(__NR_vfork, sys_vfork) +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ +__SYSCALL(__NR_ugetrlimit, sys_getrlimit) +#define __NR_mmap2 192 +__SYSCALL(__NR_mmap2, sys_mmap2) +#define __NR_truncate64 193 +__SYSCALL(__NR_truncate64, sys_truncate64) +#define __NR_ftruncate64 194 +__SYSCALL(__NR_ftruncate64, sys_ftruncate64) +#define __NR_stat64 195 +__SYSCALL(__NR_stat64, sys_stat64) +#define __NR_lstat64 196 +__SYSCALL(__NR_lstat64, sys_lstat64) +#define __NR_fstat64 197 +__SYSCALL(__NR_fstat64, sys_fstat64) +#define __NR_lchown32 198 +__SYSCALL(__NR_lchown32, sys_lchown) +#define __NR_getuid32 199 +__SYSCALL(__NR_getuid32, sys_getuid) +#define __NR_getgid32 200 +__SYSCALL(__NR_getgid32, sys_getgid) +#define __NR_geteuid32 201 +__SYSCALL(__NR_geteuid32, sys_geteuid) +#define __NR_getegid32 202 +__SYSCALL(__NR_getegid32, sys_getegid) +#define __NR_setreuid32 203 +__SYSCALL(__NR_setreuid32, sys_setreuid) +#define __NR_setregid32 204 +__SYSCALL(__NR_setregid32, sys_setregid) +#define __NR_getgroups32 205 +__SYSCALL(__NR_getgroups32, sys_getgroups) +#define __NR_setgroups32 206 +__SYSCALL(__NR_setgroups32, sys_setgroups) +#define __NR_fchown32 207 +__SYSCALL(__NR_fchown32, sys_fchown) +#define __NR_setresuid32 208 +__SYSCALL(__NR_setresuid32, sys_setresuid) +#define __NR_getresuid32 209 +__SYSCALL(__NR_getresuid32, sys_getresuid) +#define __NR_setresgid32 210 +__SYSCALL(__NR_setresgid32, sys_setresgid) +#define __NR_getresgid32 211 +__SYSCALL(__NR_getresgid32, sys_getresgid) +#define __NR_chown32 212 +__SYSCALL(__NR_chown32, sys_chown) +#define __NR_setuid32 213 +__SYSCALL(__NR_setuid32, sys_setuid) +#define __NR_setgid32 214 +__SYSCALL(__NR_setgid32, sys_setgid) +#define __NR_setfsuid32 215 +__SYSCALL(__NR_setfsuid32, sys_setfsuid) +#define __NR_setfsgid32 216 +__SYSCALL(__NR_setfsgid32, sys_setfsgid) +#define __NR_getdents64 217 +__SYSCALL(__NR_getdents64, sys_getdents64) +#define __NR_pivot_root 218 +__SYSCALL(__NR_pivot_root, sys_pivot_root) +#define __NR_mincore 219 +__SYSCALL(__NR_mincore, sys_mincore) +#define __NR_madvise 220 +__SYSCALL(__NR_madvise, sys_madvise) +#define __NR_fcntl64 221 +__SYSCALL(__NR_fcntl64, sys_fcntl64) +__SYSCALL(222, sys_ni_syscall) /* 222 for tux */ +__SYSCALL(223, sys_ni_syscall) /* 223 is unused */ +#define __NR_gettid 224 +__SYSCALL(__NR_gettid, sys_gettid) +#define __NR_readahead 225 +__SYSCALL(__NR_readahead, sys_readahead) +#define __NR_setxattr 226 +__SYSCALL(__NR_setxattr, sys_setxattr) +#define __NR_lsetxattr 227 +__SYSCALL(__NR_lsetxattr, sys_lsetxattr) +#define __NR_fsetxattr 228 +__SYSCALL(__NR_fsetxattr, sys_fsetxattr) +#define __NR_getxattr 229 +__SYSCALL(__NR_getxattr, sys_getxattr) +#define __NR_lgetxattr 230 +__SYSCALL(__NR_lgetxattr, sys_lgetxattr) +#define __NR_fgetxattr 231 +__SYSCALL(__NR_fgetxattr, sys_fgetxattr) +#define __NR_listxattr 232 +__SYSCALL(__NR_listxattr, sys_listxattr) +#define __NR_llistxattr 233 +__SYSCALL(__NR_llistxattr, sys_llistxattr) +#define __NR_flistxattr 234 +__SYSCALL(__NR_flistxattr, sys_flistxattr) +#define __NR_removexattr 235 +__SYSCALL(__NR_removexattr, sys_removexattr) +#define __NR_lremovexattr 236 +__SYSCALL(__NR_lremovexattr, sys_lremovexattr) +#define __NR_fremovexattr 237 +__SYSCALL(__NR_fremovexattr, sys_fremovexattr) +#define __NR_tkill 238 +__SYSCALL(__NR_tkill, sys_tkill) +#define __NR_sendfile64 239 +__SYSCALL(__NR_sendfile64, sys_sendfile64) +#define __NR_futex 240 +__SYSCALL(__NR_futex, sys_futex) +#define __NR_sched_setaffinity 241 +__SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity) +#define __NR_sched_getaffinity 242 +__SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity) +#define __NR_io_setup 243 +__SYSCALL(__NR_io_setup, sys_io_setup) +#define __NR_io_destroy 244 +__SYSCALL(__NR_io_destroy, sys_io_destroy) +#define __NR_io_getevents 245 +__SYSCALL(__NR_io_getevents, sys_io_getevents) +#define __NR_io_submit 246 +__SYSCALL(__NR_io_submit, sys_io_submit) +#define __NR_io_cancel 247 +__SYSCALL(__NR_io_cancel, sys_io_cancel) +#define __NR_exit_group 248 +__SYSCALL(__NR_exit_group, sys_exit_group) +#define __NR_lookup_dcookie 249 +__SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie) +#define __NR_epoll_create 250 +__SYSCALL(__NR_epoll_create, sys_epoll_create) +#define __NR_epoll_ctl 251 +__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) +#define __NR_epoll_wait 252 +__SYSCALL(__NR_epoll_wait, sys_epoll_wait) +#define __NR_remap_file_pages 253 +__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) +__SYSCALL(254, sys_ni_syscall) /* 254 for set_thread_area */ +__SYSCALL(255, sys_ni_syscall) /* 255 for get_thread_area */ +#define __NR_set_tid_address 256 +__SYSCALL(__NR_set_tid_address, sys_set_tid_address) +#define __NR_timer_create 257 +__SYSCALL(__NR_timer_create, sys_timer_create) +#define __NR_timer_settime 258 +__SYSCALL(__NR_timer_settime, sys_timer_settime) +#define __NR_timer_gettime 259 +__SYSCALL(__NR_timer_gettime, sys_timer_gettime) +#define __NR_timer_getoverrun 260 +__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) +#define __NR_timer_delete 261 +__SYSCALL(__NR_timer_delete, sys_timer_delete) +#define __NR_clock_settime 262 +__SYSCALL(__NR_clock_settime, sys_clock_settime) +#define __NR_clock_gettime 263 +__SYSCALL(__NR_clock_gettime, sys_clock_gettime) +#define __NR_clock_getres 264 +__SYSCALL(__NR_clock_getres, sys_clock_getres) +#define __NR_clock_nanosleep 265 +__SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep) +#define __NR_statfs64 266 +__SYSCALL(__NR_statfs64, sys_statfs64) +#define __NR_fstatfs64 267 +__SYSCALL(__NR_fstatfs64, sys_fstatfs64) +#define __NR_tgkill 268 +__SYSCALL(__NR_tgkill, sys_tgkill) +#define __NR_utimes 269 +__SYSCALL(__NR_utimes, sys_utimes) +#define __NR_fadvise64 270 +__SYSCALL(__NR_fadvise64, sys_fadvise64_64) +#define __NR_pciconfig_iobase 271 +__SYSCALL(__NR_pciconfig_iobase, sys_pciconfig_iobase) +#define __NR_pciconfig_read 272 +__SYSCALL(__NR_pciconfig_read, sys_pciconfig_read) +#define __NR_pciconfig_write 273 +__SYSCALL(__NR_pciconfig_write, sys_pciconfig_write) +#define __NR_mq_open 274 +__SYSCALL(__NR_mq_open, sys_mq_open) +#define __NR_mq_unlink 275 +__SYSCALL(__NR_mq_unlink, sys_mq_unlink) +#define __NR_mq_timedsend 276 +__SYSCALL(__NR_mq_timedsend, sys_mq_timedsend) +#define __NR_mq_timedreceive 277 +__SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive) +#define __NR_mq_notify 278 +__SYSCALL(__NR_mq_notify, sys_mq_notify) +#define __NR_mq_getsetattr 279 +__SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr) +#define __NR_waitid 280 +__SYSCALL(__NR_waitid, sys_waitid) +#define __NR_socket 281 +__SYSCALL(__NR_socket, sys_socket) +#define __NR_bind 282 +__SYSCALL(__NR_bind, sys_bind) +#define __NR_connect 283 +__SYSCALL(__NR_connect, sys_connect) +#define __NR_listen 284 +__SYSCALL(__NR_listen, sys_listen) +#define __NR_accept 285 +__SYSCALL(__NR_accept, sys_accept) +#define __NR_getsockname 286 +__SYSCALL(__NR_getsockname, sys_getsockname) +#define __NR_getpeername 287 +__SYSCALL(__NR_getpeername, sys_getpeername) +#define __NR_socketpair 288 +__SYSCALL(__NR_socketpair, sys_socketpair) +#define __NR_send 289 +__SYSCALL(__NR_send, sys_send) +#define __NR_sendto 290 +__SYSCALL(__NR_sendto, sys_sendto) +#define __NR_recv 291 +__SYSCALL(__NR_recv, sys_recv) +#define __NR_recvfrom 292 +__SYSCALL(__NR_recvfrom, sys_recvfrom) +#define __NR_shutdown 293 +__SYSCALL(__NR_shutdown, sys_shutdown) +#define __NR_setsockopt 294 +__SYSCALL(__NR_setsockopt, sys_setsockopt) +#define __NR_getsockopt 295 +__SYSCALL(__NR_getsockopt, sys_getsockopt) +#define __NR_sendmsg 296 +__SYSCALL(__NR_sendmsg, sys_sendmsg) +#define __NR_recvmsg 297 +__SYSCALL(__NR_recvmsg, sys_recvmsg) +#define __NR_semop 298 +__SYSCALL(__NR_semop, sys_semop) +#define __NR_semget 299 +__SYSCALL(__NR_semget, sys_semget) +#define __NR_semctl 300 +__SYSCALL(__NR_semctl, sys_semctl) +#define __NR_msgsnd 301 +__SYSCALL(__NR_msgsnd, sys_msgsnd) +#define __NR_msgrcv 302 +__SYSCALL(__NR_msgrcv, sys_msgrcv) +#define __NR_msgget 303 +__SYSCALL(__NR_msgget, sys_msgget) +#define __NR_msgctl 304 +__SYSCALL(__NR_msgctl, sys_msgctl) +#define __NR_shmat 305 +__SYSCALL(__NR_shmat, sys_shmat) +#define __NR_shmdt 306 +__SYSCALL(__NR_shmdt, sys_shmdt) +#define __NR_shmget 307 +__SYSCALL(__NR_shmget, sys_shmget) +#define __NR_shmctl 308 +__SYSCALL(__NR_shmctl, sys_shmctl) +#define __NR_add_key 309 +__SYSCALL(__NR_add_key, sys_add_key) +#define __NR_request_key 310 +__SYSCALL(__NR_request_key, sys_request_key) +#define __NR_keyctl 311 +__SYSCALL(__NR_keyctl, sys_keyctl) +#define __NR_semtimedop 312 +__SYSCALL(__NR_semtimedop, sys_semtimedop) +#define __NR_vserver 313 +__SYSCALL(__NR_vserver, sys_ni_syscall) +#define __NR_ioprio_set 314 +__SYSCALL(__NR_ioprio_set, sys_ioprio_set) +#define __NR_ioprio_get 315 +__SYSCALL(__NR_ioprio_get, sys_ioprio_get) +#define __NR_inotify_init 316 +__SYSCALL(__NR_inotify_init, sys_inotify_init) +#define __NR_inotify_add_watch 317 +__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch) +#define __NR_inotify_rm_watch 318 +__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) +#define __NR_mbind 319 +__SYSCALL(__NR_mbind, sys_mbind) +#define __NR_get_mempolicy 320 +__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy) +#define __NR_set_mempolicy 321 +__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy) +#define __NR_openat 322 +__SYSCALL(__NR_openat, sys_openat) +#define __NR_mkdirat 323 +__SYSCALL(__NR_mkdirat, sys_mkdirat) +#define __NR_mknodat 324 +__SYSCALL(__NR_mknodat, sys_mknodat) +#define __NR_fchownat 325 +__SYSCALL(__NR_fchownat, sys_fchownat) +#define __NR_futimesat 326 +__SYSCALL(__NR_futimesat, sys_futimesat) +#define __NR_fstatat64 327 +__SYSCALL(__NR_fstatat64, sys_fstatat64) +#define __NR_unlinkat 328 +__SYSCALL(__NR_unlinkat, sys_unlinkat) +#define __NR_renameat 329 +__SYSCALL(__NR_renameat, sys_renameat) +#define __NR_linkat 330 +__SYSCALL(__NR_linkat, sys_linkat) +#define __NR_symlinkat 331 +__SYSCALL(__NR_symlinkat, sys_symlinkat) +#define __NR_readlinkat 332 +__SYSCALL(__NR_readlinkat, sys_readlinkat) +#define __NR_fchmodat 333 +__SYSCALL(__NR_fchmodat, sys_fchmodat) +#define __NR_faccessat 334 +__SYSCALL(__NR_faccessat, sys_faccessat) +#define __NR_pselect6 335 +__SYSCALL(__NR_pselect6, sys_pselect6) +#define __NR_ppoll 336 +__SYSCALL(__NR_ppoll, sys_ppoll) +#define __NR_unshare 337 +__SYSCALL(__NR_unshare, sys_unshare) +#define __NR_set_robust_list 338 +__SYSCALL(__NR_set_robust_list, sys_set_robust_list) +#define __NR_get_robust_list 339 +__SYSCALL(__NR_get_robust_list, sys_get_robust_list) +#define __NR_splice 340 +__SYSCALL(__NR_splice, sys_splice) +#define __NR_sync_file_range2 341 +__SYSCALL(__NR_sync_file_range2, sys_sync_file_range2) +#define __NR_tee 342 +__SYSCALL(__NR_tee, sys_tee) +#define __NR_vmsplice 343 +__SYSCALL(__NR_vmsplice, sys_vmsplice) +#define __NR_move_pages 344 +__SYSCALL(__NR_move_pages, sys_move_pages) +#define __NR_getcpu 345 +__SYSCALL(__NR_getcpu, sys_getcpu) +#define __NR_epoll_pwait 346 +__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait) +#define __NR_kexec_load 347 +__SYSCALL(__NR_kexec_load, sys_kexec_load) +#define __NR_utimensat 348 +__SYSCALL(__NR_utimensat, sys_utimensat) +#define __NR_signalfd 349 +__SYSCALL(__NR_signalfd, sys_signalfd) +#define __NR_timerfd_create 350 +__SYSCALL(__NR_timerfd_create, sys_timerfd_create) +#define __NR_eventfd 351 +__SYSCALL(__NR_eventfd, sys_eventfd) +#define __NR_fallocate 352 +__SYSCALL(__NR_fallocate, sys_fallocate) +#define __NR_timerfd_settime 353 +__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime) +#define __NR_timerfd_gettime 354 +__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime) +#define __NR_signalfd4 355 +__SYSCALL(__NR_signalfd4, sys_signalfd4) +#define __NR_eventfd2 356 +__SYSCALL(__NR_eventfd2, sys_eventfd2) +#define __NR_epoll_create1 357 +__SYSCALL(__NR_epoll_create1, sys_epoll_create1) +#define __NR_dup3 358 +__SYSCALL(__NR_dup3, sys_dup3) +#define __NR_pipe2 359 +__SYSCALL(__NR_pipe2, sys_pipe2) +#define __NR_inotify_init1 360 +__SYSCALL(__NR_inotify_init1, sys_inotify_init1) +#define __NR_preadv 361 +__SYSCALL(__NR_preadv, sys_preadv) +#define __NR_pwritev 362 +__SYSCALL(__NR_pwritev, sys_pwritev) +#define __NR_rt_tgsigqueueinfo 363 +__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) +#define __NR_perf_event_open 364 +__SYSCALL(__NR_perf_event_open, sys_perf_event_open) +#define __NR_recvmmsg 365 +__SYSCALL(__NR_recvmmsg, sys_recvmmsg) +#define __NR_accept4 366 +__SYSCALL(__NR_accept4, sys_accept4) +#define __NR_fanotify_init 367 +__SYSCALL(__NR_fanotify_init, sys_fanotify_init) +#define __NR_fanotify_mark 368 +__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) +#define __NR_prlimit64 369 +__SYSCALL(__NR_prlimit64, sys_prlimit64) +#define __NR_name_to_handle_at 370 +__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) +#define __NR_open_by_handle_at 371 +__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) +#define __NR_clock_adjtime 372 +__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) +#define __NR_syncfs 373 +__SYSCALL(__NR_syncfs, sys_syncfs) /* * The following SVCs are ARM private. @@ -412,3 +737,19 @@ __SYSCALL(373, sys_syncfs) #define __ARM_NR_COMPAT_BASE 0x0f0000 #define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) + +#endif /* __SYSCALL_COMPAT */ + +#define __NR_compat_syscalls 374 + +#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION +#define __ARCH_WANT_COMPAT_STAT64 +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND +#define __ARCH_WANT_COMPAT_SYS_SENDFILE diff --git a/trunk/arch/arm64/include/uapi/asm/Kbuild b/trunk/arch/arm64/include/uapi/asm/Kbuild index ca5b65f75c7b..baebb3da1d44 100644 --- a/trunk/arch/arm64/include/uapi/asm/Kbuild +++ b/trunk/arch/arm64/include/uapi/asm/Kbuild @@ -1,17 +1,3 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += auxvec.h -header-y += bitsperlong.h -header-y += byteorder.h -header-y += fcntl.h -header-y += hwcap.h -header-y += param.h -header-y += ptrace.h -header-y += setup.h -header-y += sigcontext.h -header-y += siginfo.h -header-y += signal.h -header-y += stat.h -header-y += statfs.h -header-y += unistd.h diff --git a/trunk/arch/arm64/include/uapi/asm/hwcap.h b/trunk/arch/arm64/include/uapi/asm/hwcap.h deleted file mode 100644 index eea497578b87..000000000000 --- a/trunk/arch/arm64/include/uapi/asm/hwcap.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2012 ARM Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef _UAPI__ASM_HWCAP_H -#define _UAPI__ASM_HWCAP_H - -/* - * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP - */ -#define HWCAP_FP (1 << 0) -#define HWCAP_ASIMD (1 << 1) - - -#endif /* _UAPI__ASM_HWCAP_H */ diff --git a/trunk/arch/arm64/include/uapi/asm/ptrace.h b/trunk/arch/arm64/include/uapi/asm/ptrace.h deleted file mode 100644 index 9b131b4efa0b..000000000000 --- a/trunk/arch/arm64/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Based on arch/arm/include/asm/ptrace.h - * - * Copyright (C) 1996-2003 Russell King - * Copyright (C) 2012 ARM Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef _UAPI__ASM_PTRACE_H -#define _UAPI__ASM_PTRACE_H - -#include - -#include - - -/* - * PSR bits - */ -#define PSR_MODE_EL0t 0x00000000 -#define PSR_MODE_EL1t 0x00000004 -#define PSR_MODE_EL1h 0x00000005 -#define PSR_MODE_EL2t 0x00000008 -#define PSR_MODE_EL2h 0x00000009 -#define PSR_MODE_EL3t 0x0000000c -#define PSR_MODE_EL3h 0x0000000d -#define PSR_MODE_MASK 0x0000000f - -/* AArch32 CPSR bits */ -#define PSR_MODE32_BIT 0x00000010 - -/* AArch64 SPSR bits */ -#define PSR_F_BIT 0x00000040 -#define PSR_I_BIT 0x00000080 -#define PSR_A_BIT 0x00000100 -#define PSR_D_BIT 0x00000200 -#define PSR_Q_BIT 0x08000000 -#define PSR_V_BIT 0x10000000 -#define PSR_C_BIT 0x20000000 -#define PSR_Z_BIT 0x40000000 -#define PSR_N_BIT 0x80000000 - -/* - * Groups of PSR bits - */ -#define PSR_f 0xff000000 /* Flags */ -#define PSR_s 0x00ff0000 /* Status */ -#define PSR_x 0x0000ff00 /* Extension */ -#define PSR_c 0x000000ff /* Control */ - - -#ifndef __ASSEMBLY__ - -/* - * User structures for general purpose, floating point and debug registers. - */ -struct user_pt_regs { - __u64 regs[31]; - __u64 sp; - __u64 pc; - __u64 pstate; -}; - -struct user_fpsimd_state { - __uint128_t vregs[32]; - __u32 fpsr; - __u32 fpcr; -}; - -struct user_hwdebug_state { - __u32 dbg_info; - struct { - __u64 addr; - __u32 ctrl; - } dbg_regs[16]; -}; - - -#endif /* __ASSEMBLY__ */ - -#endif /* _UAPI__ASM_PTRACE_H */ diff --git a/trunk/arch/arm64/include/uapi/asm/sigcontext.h b/trunk/arch/arm64/include/uapi/asm/sigcontext.h deleted file mode 100644 index 690ad51cc901..000000000000 --- a/trunk/arch/arm64/include/uapi/asm/sigcontext.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2012 ARM Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef _UAPI__ASM_SIGCONTEXT_H -#define _UAPI__ASM_SIGCONTEXT_H - -#include - -/* - * Signal context structure - contains all info to do with the state - * before the signal handler was invoked. - */ -struct sigcontext { - __u64 fault_address; - /* AArch64 registers */ - __u64 regs[31]; - __u64 sp; - __u64 pc; - __u64 pstate; - /* 4K reserved for FP/SIMD state and future expansion */ - __u8 __reserved[4096] __attribute__((__aligned__(16))); -}; - -/* - * Header to be used at the beginning of structures extending the user - * context. Such structures must be placed after the rt_sigframe on the stack - * and be 16-byte aligned. The last structure must be a dummy one with the - * magic and size set to 0. - */ -struct _aarch64_ctx { - __u32 magic; - __u32 size; -}; - -#define FPSIMD_MAGIC 0x46508001 - -struct fpsimd_context { - struct _aarch64_ctx head; - __u32 fpsr; - __u32 fpcr; - __uint128_t vregs[32]; -}; - - -#endif /* _UAPI__ASM_SIGCONTEXT_H */ diff --git a/trunk/arch/arm64/include/uapi/asm/stat.h b/trunk/arch/arm64/include/uapi/asm/stat.h deleted file mode 100644 index eeb702e5074a..000000000000 --- a/trunk/arch/arm64/include/uapi/asm/stat.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2012 ARM Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include diff --git a/trunk/arch/arm64/include/uapi/asm/unistd.h b/trunk/arch/arm64/include/uapi/asm/unistd.h deleted file mode 100644 index 1caadc24e3fe..000000000000 --- a/trunk/arch/arm64/include/uapi/asm/unistd.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2012 ARM Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include diff --git a/trunk/arch/arm64/kernel/entry.S b/trunk/arch/arm64/kernel/entry.S index a6f3f7da6880..6538928ff1ab 100644 --- a/trunk/arch/arm64/kernel/entry.S +++ b/trunk/arch/arm64/kernel/entry.S @@ -26,7 +26,6 @@ #include #include #include -#include /* * Bad Abort numbers diff --git a/trunk/arch/arm64/kernel/ptrace.c b/trunk/arch/arm64/kernel/ptrace.c index 2ea3968367c2..ac3550ecc7b5 100644 --- a/trunk/arch/arm64/kernel/ptrace.c +++ b/trunk/arch/arm64/kernel/ptrace.c @@ -823,11 +823,11 @@ static int compat_ptrace_read_user(struct task_struct *tsk, compat_ulong_t off, if (off & 3) return -EIO; - if (off == COMPAT_PT_TEXT_ADDR) + if (off == PT_TEXT_ADDR) tmp = tsk->mm->start_code; - else if (off == COMPAT_PT_DATA_ADDR) + else if (off == PT_DATA_ADDR) tmp = tsk->mm->start_data; - else if (off == COMPAT_PT_TEXT_END_ADDR) + else if (off == PT_TEXT_END_ADDR) tmp = tsk->mm->end_code; else if (off < sizeof(compat_elf_gregset_t)) return copy_regset_to_user(tsk, &user_aarch32_view, diff --git a/trunk/arch/arm64/kernel/signal32.c b/trunk/arch/arm64/kernel/signal32.c index 4654824747a4..0790a87a4346 100644 --- a/trunk/arch/arm64/kernel/signal32.c +++ b/trunk/arch/arm64/kernel/signal32.c @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#define __SYSCALL_COMPAT + #include #include #include @@ -26,7 +28,7 @@ #include #include #include -#include +#include struct compat_sigaction { compat_uptr_t sa_handler; @@ -124,19 +126,19 @@ struct compat_rt_sigframe { * For ARM syscalls, the syscall number has to be loaded into r7. * We do not support an OABI userspace. */ -#define MOV_R7_NR_SIGRETURN (0xe3a07000 | __NR_compat_sigreturn) -#define SVC_SYS_SIGRETURN (0xef000000 | __NR_compat_sigreturn) -#define MOV_R7_NR_RT_SIGRETURN (0xe3a07000 | __NR_compat_rt_sigreturn) -#define SVC_SYS_RT_SIGRETURN (0xef000000 | __NR_compat_rt_sigreturn) +#define MOV_R7_NR_SIGRETURN (0xe3a07000 | __NR_sigreturn) +#define SVC_SYS_SIGRETURN (0xef000000 | __NR_sigreturn) +#define MOV_R7_NR_RT_SIGRETURN (0xe3a07000 | __NR_rt_sigreturn) +#define SVC_SYS_RT_SIGRETURN (0xef000000 | __NR_rt_sigreturn) /* * For Thumb syscalls, we also pass the syscall number via r7. We therefore * need two 16-bit instructions. */ -#define SVC_THUMB_SIGRETURN (((0xdf00 | __NR_compat_sigreturn) << 16) | \ - 0x2700 | __NR_compat_sigreturn) -#define SVC_THUMB_RT_SIGRETURN (((0xdf00 | __NR_compat_rt_sigreturn) << 16) | \ - 0x2700 | __NR_compat_rt_sigreturn) +#define SVC_THUMB_SIGRETURN (((0xdf00 | __NR_sigreturn) << 16) | \ + 0x2700 | __NR_sigreturn) +#define SVC_THUMB_RT_SIGRETURN (((0xdf00 | __NR_rt_sigreturn) << 16) | \ + 0x2700 | __NR_rt_sigreturn) const compat_ulong_t aarch32_sigret_code[6] = { /* @@ -817,5 +819,5 @@ asmlinkage int compat_sys_rt_sigqueueinfo(int pid, int sig, void compat_setup_restart_syscall(struct pt_regs *regs) { - regs->regs[7] = __NR_compat_restart_syscall; + regs->regs[7] = __NR_restart_syscall; } diff --git a/trunk/arch/arm64/kernel/sys.c b/trunk/arch/arm64/kernel/sys.c index b120df37de35..905fcfb0ddd0 100644 --- a/trunk/arch/arm64/kernel/sys.c +++ b/trunk/arch/arm64/kernel/sys.c @@ -50,13 +50,13 @@ asmlinkage long sys_execve(const char __user *filenamei, struct pt_regs *regs) { long error; - struct filename *filename; + char * filename; filename = getname(filenamei); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); out: return error; diff --git a/trunk/arch/arm64/kernel/sys32.S b/trunk/arch/arm64/kernel/sys32.S index 54c4aec47a08..5e4dc93cc31f 100644 --- a/trunk/arch/arm64/kernel/sys32.S +++ b/trunk/arch/arm64/kernel/sys32.S @@ -147,12 +147,136 @@ compat_sys_fanotify_mark_wrapper: b sys_fanotify_mark ENDPROC(compat_sys_fanotify_mark_wrapper) +/* + * Use the compat system call wrappers. + */ +#define sys_fork compat_sys_fork_wrapper +#define sys_open compat_sys_open +#define sys_execve compat_sys_execve_wrapper +#define sys_lseek compat_sys_lseek_wrapper +#define sys_mount compat_sys_mount +#define sys_ptrace compat_sys_ptrace +#define sys_times compat_sys_times +#define sys_ioctl compat_sys_ioctl +#define sys_fcntl compat_sys_fcntl +#define sys_ustat compat_sys_ustat +#define sys_sigaction compat_sys_sigaction +#define sys_sigsuspend compat_sys_sigsuspend +#define sys_sigpending compat_sys_sigpending +#define sys_setrlimit compat_sys_setrlimit +#define sys_getrusage compat_sys_getrusage +#define sys_gettimeofday compat_sys_gettimeofday +#define sys_settimeofday compat_sys_settimeofday +#define sys_statfs compat_sys_statfs +#define sys_fstatfs compat_sys_fstatfs +#define sys_setitimer compat_sys_setitimer +#define sys_getitimer compat_sys_getitimer +#define sys_newstat compat_sys_newstat +#define sys_newlstat compat_sys_newlstat +#define sys_newfstat compat_sys_newfstat +#define sys_wait4 compat_sys_wait4 +#define sys_sysinfo compat_sys_sysinfo +#define sys_sigreturn compat_sys_sigreturn_wrapper +#define sys_clone compat_sys_clone_wrapper +#define sys_adjtimex compat_sys_adjtimex +#define sys_sigprocmask compat_sys_sigprocmask +#define sys_getdents compat_sys_getdents +#define sys_select compat_sys_select +#define sys_readv compat_sys_readv +#define sys_writev compat_sys_writev +#define sys_sysctl compat_sys_sysctl +#define sys_sched_rr_get_interval compat_sys_sched_rr_get_interval +#define sys_nanosleep compat_sys_nanosleep +#define sys_rt_sigreturn compat_sys_rt_sigreturn_wrapper +#define sys_rt_sigaction compat_sys_rt_sigaction +#define sys_rt_sigprocmask compat_sys_rt_sigprocmask +#define sys_rt_sigpending compat_sys_rt_sigpending +#define sys_rt_sigtimedwait compat_sys_rt_sigtimedwait +#define sys_rt_sigqueueinfo compat_sys_rt_sigqueueinfo +#define sys_rt_sigsuspend compat_sys_rt_sigsuspend +#define sys_pread64 compat_sys_pread64_wrapper +#define sys_pwrite64 compat_sys_pwrite64_wrapper +#define sys_sigaltstack compat_sys_sigaltstack_wrapper +#define sys_sendfile compat_sys_sendfile +#define sys_vfork compat_sys_vfork_wrapper +#define sys_getrlimit compat_sys_getrlimit +#define sys_mmap2 sys_mmap_pgoff +#define sys_truncate64 compat_sys_truncate64_wrapper +#define sys_ftruncate64 compat_sys_ftruncate64_wrapper +#define sys_getdents64 compat_sys_getdents64 +#define sys_fcntl64 compat_sys_fcntl64 +#define sys_readahead compat_sys_readahead_wrapper +#define sys_futex compat_sys_futex +#define sys_sched_setaffinity compat_sys_sched_setaffinity +#define sys_sched_getaffinity compat_sys_sched_getaffinity +#define sys_io_setup compat_sys_io_setup +#define sys_io_getevents compat_sys_io_getevents +#define sys_io_submit compat_sys_io_submit +#define sys_lookup_dcookie compat_sys_lookup_dcookie +#define sys_timer_create compat_sys_timer_create +#define sys_timer_settime compat_sys_timer_settime +#define sys_timer_gettime compat_sys_timer_gettime +#define sys_clock_settime compat_sys_clock_settime +#define sys_clock_gettime compat_sys_clock_gettime +#define sys_clock_getres compat_sys_clock_getres +#define sys_clock_nanosleep compat_sys_clock_nanosleep +#define sys_statfs64 compat_sys_statfs64_wrapper +#define sys_fstatfs64 compat_sys_fstatfs64_wrapper +#define sys_utimes compat_sys_utimes +#define sys_fadvise64_64 compat_sys_fadvise64_64_wrapper +#define sys_mq_open compat_sys_mq_open +#define sys_mq_timedsend compat_sys_mq_timedsend +#define sys_mq_timedreceive compat_sys_mq_timedreceive +#define sys_mq_notify compat_sys_mq_notify +#define sys_mq_getsetattr compat_sys_mq_getsetattr +#define sys_waitid compat_sys_waitid +#define sys_recv compat_sys_recv +#define sys_recvfrom compat_sys_recvfrom +#define sys_setsockopt compat_sys_setsockopt +#define sys_getsockopt compat_sys_getsockopt +#define sys_sendmsg compat_sys_sendmsg +#define sys_recvmsg compat_sys_recvmsg +#define sys_semctl compat_sys_semctl +#define sys_msgsnd compat_sys_msgsnd +#define sys_msgrcv compat_sys_msgrcv +#define sys_msgctl compat_sys_msgctl +#define sys_shmat compat_sys_shmat +#define sys_shmctl compat_sys_shmctl +#define sys_keyctl compat_sys_keyctl +#define sys_semtimedop compat_sys_semtimedop +#define sys_mbind compat_sys_mbind +#define sys_get_mempolicy compat_sys_get_mempolicy +#define sys_set_mempolicy compat_sys_set_mempolicy +#define sys_openat compat_sys_openat +#define sys_futimesat compat_sys_futimesat +#define sys_pselect6 compat_sys_pselect6 +#define sys_ppoll compat_sys_ppoll +#define sys_set_robust_list compat_sys_set_robust_list +#define sys_get_robust_list compat_sys_get_robust_list +#define sys_sync_file_range2 compat_sys_sync_file_range2_wrapper +#define sys_vmsplice compat_sys_vmsplice +#define sys_move_pages compat_sys_move_pages +#define sys_epoll_pwait compat_sys_epoll_pwait +#define sys_kexec_load compat_sys_kexec_load +#define sys_utimensat compat_sys_utimensat +#define sys_signalfd compat_sys_signalfd +#define sys_fallocate compat_sys_fallocate_wrapper +#define sys_timerfd_settime compat_sys_timerfd_settime +#define sys_timerfd_gettime compat_sys_timerfd_gettime +#define sys_signalfd4 compat_sys_signalfd4 +#define sys_preadv compat_sys_preadv +#define sys_pwritev compat_sys_pwritev +#define sys_rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo +#define sys_recvmmsg compat_sys_recvmmsg +#define sys_fanotify_mark compat_sys_fanotify_mark_wrapper + #undef __SYSCALL #define __SYSCALL(x, y) .quad y // x +#define __SYSCALL_COMPAT /* * The system calls table must be 4KB aligned. */ .align 12 ENTRY(compat_sys_call_table) -#include +#include diff --git a/trunk/arch/arm64/kernel/sys_compat.c b/trunk/arch/arm64/kernel/sys_compat.c index 906e3bd270b0..93f10e27dc79 100644 --- a/trunk/arch/arm64/kernel/sys_compat.c +++ b/trunk/arch/arm64/kernel/sys_compat.c @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#define __SYSCALL_COMPAT + #include #include #include @@ -26,7 +28,7 @@ #include #include -#include +#include asmlinkage int compat_sys_fork(struct pt_regs *regs) { @@ -54,14 +56,14 @@ asmlinkage int compat_sys_execve(const char __user *filenamei, struct pt_regs *regs) { int error; - struct filename *filename; + char * filename; filename = getname(filenamei); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = compat_do_execve(filename->name, compat_ptr(argv), - compat_ptr(envp), regs); + error = compat_do_execve(filename, compat_ptr(argv), compat_ptr(envp), + regs); putname(filename); out: return error; diff --git a/trunk/arch/avr32/include/asm/Kbuild b/trunk/arch/avr32/include/asm/Kbuild index 4807ded352c5..be0433ee5a8e 100644 --- a/trunk/arch/avr32/include/asm/Kbuild +++ b/trunk/arch/avr32/include/asm/Kbuild @@ -1,3 +1,6 @@ +include include/asm-generic/Kbuild.asm generic-y += clkdev.h generic-y += exec.h + +header-y += cachectl.h diff --git a/trunk/arch/avr32/include/uapi/asm/auxvec.h b/trunk/arch/avr32/include/asm/auxvec.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/auxvec.h rename to trunk/arch/avr32/include/asm/auxvec.h diff --git a/trunk/arch/avr32/include/uapi/asm/bitsperlong.h b/trunk/arch/avr32/include/asm/bitsperlong.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/bitsperlong.h rename to trunk/arch/avr32/include/asm/bitsperlong.h diff --git a/trunk/arch/avr32/include/uapi/asm/byteorder.h b/trunk/arch/avr32/include/asm/byteorder.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/byteorder.h rename to trunk/arch/avr32/include/asm/byteorder.h diff --git a/trunk/arch/avr32/include/uapi/asm/cachectl.h b/trunk/arch/avr32/include/asm/cachectl.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/cachectl.h rename to trunk/arch/avr32/include/asm/cachectl.h diff --git a/trunk/arch/avr32/include/uapi/asm/errno.h b/trunk/arch/avr32/include/asm/errno.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/errno.h rename to trunk/arch/avr32/include/asm/errno.h diff --git a/trunk/arch/avr32/include/uapi/asm/fcntl.h b/trunk/arch/avr32/include/asm/fcntl.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/fcntl.h rename to trunk/arch/avr32/include/asm/fcntl.h diff --git a/trunk/arch/avr32/include/uapi/asm/ioctl.h b/trunk/arch/avr32/include/asm/ioctl.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/ioctl.h rename to trunk/arch/avr32/include/asm/ioctl.h diff --git a/trunk/arch/avr32/include/uapi/asm/ioctls.h b/trunk/arch/avr32/include/asm/ioctls.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/ioctls.h rename to trunk/arch/avr32/include/asm/ioctls.h diff --git a/trunk/arch/avr32/include/uapi/asm/ipcbuf.h b/trunk/arch/avr32/include/asm/ipcbuf.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/ipcbuf.h rename to trunk/arch/avr32/include/asm/ipcbuf.h diff --git a/trunk/arch/avr32/include/uapi/asm/kvm_para.h b/trunk/arch/avr32/include/asm/kvm_para.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/kvm_para.h rename to trunk/arch/avr32/include/asm/kvm_para.h diff --git a/trunk/arch/avr32/include/uapi/asm/mman.h b/trunk/arch/avr32/include/asm/mman.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/mman.h rename to trunk/arch/avr32/include/asm/mman.h diff --git a/trunk/arch/avr32/include/uapi/asm/msgbuf.h b/trunk/arch/avr32/include/asm/msgbuf.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/msgbuf.h rename to trunk/arch/avr32/include/asm/msgbuf.h diff --git a/trunk/arch/avr32/include/asm/param.h b/trunk/arch/avr32/include/asm/param.h index 009a167aea1f..34bc8d4c3b29 100644 --- a/trunk/arch/avr32/include/asm/param.h +++ b/trunk/arch/avr32/include/asm/param.h @@ -1,9 +1,23 @@ #ifndef __ASM_AVR32_PARAM_H #define __ASM_AVR32_PARAM_H -#include - +#ifdef __KERNEL__ # define HZ CONFIG_HZ # define USER_HZ 100 /* User interfaces are in "ticks" */ # define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ +#endif + +#ifndef HZ +# define HZ 100 +#endif + +/* TODO: Should be configurable */ +#define EXEC_PAGESIZE 4096 + +#ifndef NOGROUP +# define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64 + #endif /* __ASM_AVR32_PARAM_H */ diff --git a/trunk/arch/avr32/include/uapi/asm/poll.h b/trunk/arch/avr32/include/asm/poll.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/poll.h rename to trunk/arch/avr32/include/asm/poll.h diff --git a/trunk/arch/avr32/include/uapi/asm/posix_types.h b/trunk/arch/avr32/include/asm/posix_types.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/posix_types.h rename to trunk/arch/avr32/include/asm/posix_types.h diff --git a/trunk/arch/avr32/include/asm/ptrace.h b/trunk/arch/avr32/include/asm/ptrace.h index 8d3c412fc65f..c67a007f672a 100644 --- a/trunk/arch/avr32/include/asm/ptrace.h +++ b/trunk/arch/avr32/include/asm/ptrace.h @@ -8,9 +8,119 @@ #ifndef __ASM_AVR32_PTRACE_H #define __ASM_AVR32_PTRACE_H -#include +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 + +/* + * Status Register bits + */ +#define SR_H 0x20000000 +#define SR_J 0x10000000 +#define SR_DM 0x08000000 +#define SR_D 0x04000000 +#define MODE_NMI 0x01c00000 +#define MODE_EXCEPTION 0x01800000 +#define MODE_INT3 0x01400000 +#define MODE_INT2 0x01000000 +#define MODE_INT1 0x00c00000 +#define MODE_INT0 0x00800000 +#define MODE_SUPERVISOR 0x00400000 +#define MODE_USER 0x00000000 +#define MODE_MASK 0x01c00000 +#define SR_EM 0x00200000 +#define SR_I3M 0x00100000 +#define SR_I2M 0x00080000 +#define SR_I1M 0x00040000 +#define SR_I0M 0x00020000 +#define SR_GM 0x00010000 + +#define SR_H_BIT 29 +#define SR_J_BIT 28 +#define SR_DM_BIT 27 +#define SR_D_BIT 26 +#define MODE_SHIFT 22 +#define SR_EM_BIT 21 +#define SR_I3M_BIT 20 +#define SR_I2M_BIT 19 +#define SR_I1M_BIT 18 +#define SR_I0M_BIT 17 +#define SR_GM_BIT 16 + +/* The user-visible part */ +#define SR_L 0x00000020 +#define SR_Q 0x00000010 +#define SR_V 0x00000008 +#define SR_N 0x00000004 +#define SR_Z 0x00000002 +#define SR_C 0x00000001 + +#define SR_L_BIT 5 +#define SR_Q_BIT 4 +#define SR_V_BIT 3 +#define SR_N_BIT 2 +#define SR_Z_BIT 1 +#define SR_C_BIT 0 + +/* + * The order is defined by the stmts instruction. r0 is stored first, + * so it gets the highest address. + * + * Registers 0-12 are general-purpose registers (r12 is normally used for + * the function return value). + * Register 13 is the stack pointer + * Register 14 is the link register + * Register 15 is the program counter (retrieved from the RAR sysreg) + */ +#define FRAME_SIZE_FULL 72 +#define REG_R12_ORIG 68 +#define REG_R0 64 +#define REG_R1 60 +#define REG_R2 56 +#define REG_R3 52 +#define REG_R4 48 +#define REG_R5 44 +#define REG_R6 40 +#define REG_R7 36 +#define REG_R8 32 +#define REG_R9 28 +#define REG_R10 24 +#define REG_R11 20 +#define REG_R12 16 +#define REG_SP 12 +#define REG_LR 8 + +#define FRAME_SIZE_MIN 8 +#define REG_PC 4 +#define REG_SR 0 #ifndef __ASSEMBLY__ +struct pt_regs { + /* These are always saved */ + unsigned long sr; + unsigned long pc; + + /* These are sometimes saved */ + unsigned long lr; + unsigned long sp; + unsigned long r12; + unsigned long r11; + unsigned long r10; + unsigned long r9; + unsigned long r8; + unsigned long r7; + unsigned long r6; + unsigned long r5; + unsigned long r4; + unsigned long r3; + unsigned long r2; + unsigned long r1; + unsigned long r0; + + /* Only saved on system call */ + unsigned long r12_orig; +}; + +#ifdef __KERNEL__ #include @@ -40,5 +150,8 @@ static __inline__ int valid_user_regs(struct pt_regs *regs) } +#endif /* __KERNEL__ */ + #endif /* ! __ASSEMBLY__ */ + #endif /* __ASM_AVR32_PTRACE_H */ diff --git a/trunk/arch/avr32/include/uapi/asm/resource.h b/trunk/arch/avr32/include/asm/resource.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/resource.h rename to trunk/arch/avr32/include/asm/resource.h diff --git a/trunk/arch/avr32/include/uapi/asm/sembuf.h b/trunk/arch/avr32/include/asm/sembuf.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/sembuf.h rename to trunk/arch/avr32/include/asm/sembuf.h diff --git a/trunk/arch/avr32/include/asm/setup.h b/trunk/arch/avr32/include/asm/setup.h index 73490ae0c476..160543dbec7e 100644 --- a/trunk/arch/avr32/include/asm/setup.h +++ b/trunk/arch/avr32/include/asm/setup.h @@ -11,8 +11,9 @@ #ifndef __ASM_AVR32_SETUP_H__ #define __ASM_AVR32_SETUP_H__ -#include +#define COMMAND_LINE_SIZE 256 +#ifdef __KERNEL__ /* Magic number indicating that a tag table is present */ #define ATAG_MAGIC 0xa2a25441 @@ -141,4 +142,6 @@ void setup_processor(void); #endif /* !__ASSEMBLY__ */ +#endif /* __KERNEL__ */ + #endif /* __ASM_AVR32_SETUP_H__ */ diff --git a/trunk/arch/avr32/include/uapi/asm/shmbuf.h b/trunk/arch/avr32/include/asm/shmbuf.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/shmbuf.h rename to trunk/arch/avr32/include/asm/shmbuf.h diff --git a/trunk/arch/avr32/include/uapi/asm/sigcontext.h b/trunk/arch/avr32/include/asm/sigcontext.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/sigcontext.h rename to trunk/arch/avr32/include/asm/sigcontext.h diff --git a/trunk/arch/avr32/include/uapi/asm/siginfo.h b/trunk/arch/avr32/include/asm/siginfo.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/siginfo.h rename to trunk/arch/avr32/include/asm/siginfo.h diff --git a/trunk/arch/avr32/include/asm/signal.h b/trunk/arch/avr32/include/asm/signal.h index 4d502fd6bad3..ae56849fdb2b 100644 --- a/trunk/arch/avr32/include/asm/signal.h +++ b/trunk/arch/avr32/include/asm/signal.h @@ -8,8 +8,12 @@ #ifndef __ASM_AVR32_SIGNAL_H #define __ASM_AVR32_SIGNAL_H -#include +#include +/* Avoid too many header ordering problems. */ +struct siginfo; + +#ifdef __KERNEL__ /* Most things should be clean enough to redefine this at will, if care is taken to make libc match. */ @@ -23,6 +27,94 @@ typedef struct { unsigned long sig[_NSIG_WORDS]; } sigset_t; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +#define NSIG 32 +typedef unsigned long sigset_t; + +#endif /* __KERNEL__ */ + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +/* +#define SIGLOST 29 +*/ +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED 31 + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX (_NSIG-1) + +/* + * SA_FLAGS values: + * + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_SIGINFO deliver the signal with SIGINFO structs + * SA_ONSTACK indicates that a registered stack_t will be used. + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_NODEFER prevents the current signal from being masked in the handler. + * SA_RESETHAND clears the handler when the signal is delivered. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. + */ +#define SA_NOCLDSTOP 0x00000001 +#define SA_NOCLDWAIT 0x00000002 +#define SA_SIGINFO 0x00000004 +#define SA_RESTORER 0x04000000 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND + +/* + * sigaltstack controls + */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#include + +#ifdef __KERNEL__ struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; @@ -33,10 +125,37 @@ struct sigaction { struct k_sigaction { struct sigaction sa; }; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +struct sigaction { + union { + __sighandler_t _sa_handler; + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +#endif /* __KERNEL__ */ + +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; + +#ifdef __KERNEL__ #include #undef __HAVE_ARCH_SIG_BITOPS #define ptrace_signal_deliver(regs, cookie) do { } while (0) +#endif /* __KERNEL__ */ + #endif diff --git a/trunk/arch/avr32/include/uapi/asm/socket.h b/trunk/arch/avr32/include/asm/socket.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/socket.h rename to trunk/arch/avr32/include/asm/socket.h diff --git a/trunk/arch/avr32/include/uapi/asm/sockios.h b/trunk/arch/avr32/include/asm/sockios.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/sockios.h rename to trunk/arch/avr32/include/asm/sockios.h diff --git a/trunk/arch/avr32/include/uapi/asm/stat.h b/trunk/arch/avr32/include/asm/stat.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/stat.h rename to trunk/arch/avr32/include/asm/stat.h diff --git a/trunk/arch/avr32/include/uapi/asm/statfs.h b/trunk/arch/avr32/include/asm/statfs.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/statfs.h rename to trunk/arch/avr32/include/asm/statfs.h diff --git a/trunk/arch/avr32/include/uapi/asm/swab.h b/trunk/arch/avr32/include/asm/swab.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/swab.h rename to trunk/arch/avr32/include/asm/swab.h diff --git a/trunk/arch/avr32/include/uapi/asm/termbits.h b/trunk/arch/avr32/include/asm/termbits.h similarity index 100% rename from trunk/arch/avr32/include/uapi/asm/termbits.h rename to trunk/arch/avr32/include/asm/termbits.h diff --git a/trunk/arch/avr32/include/asm/termios.h b/trunk/arch/avr32/include/asm/termios.h index 9d594376dbd6..dd7e9da25488 100644 --- a/trunk/arch/avr32/include/asm/termios.h +++ b/trunk/arch/avr32/include/asm/termios.h @@ -8,8 +8,45 @@ #ifndef __ASM_AVR32_TERMIOS_H #define __ASM_AVR32_TERMIOS_H -#include +#include +#include +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +#ifdef __KERNEL__ /* intr=^C quit=^\ erase=del kill=^U eof=^D vtime=\0 vmin=\1 sxtc=\0 start=^Q stop=^S susp=^Z eol=\0 @@ -20,4 +57,6 @@ #include +#endif /* __KERNEL__ */ + #endif /* __ASM_AVR32_TERMIOS_H */ diff --git a/trunk/arch/avr32/include/asm/types.h b/trunk/arch/avr32/include/asm/types.h index 59324058069c..9bb2d8b2e6ca 100644 --- a/trunk/arch/avr32/include/asm/types.h +++ b/trunk/arch/avr32/include/asm/types.h @@ -8,12 +8,16 @@ #ifndef __ASM_AVR32_TYPES_H #define __ASM_AVR32_TYPES_H -#include +#include /* * These aren't exported outside the kernel to avoid name space clashes */ +#ifdef __KERNEL__ #define BITS_PER_LONG 32 +#endif /* __KERNEL__ */ + + #endif /* __ASM_AVR32_TYPES_H */ diff --git a/trunk/arch/avr32/include/asm/unistd.h b/trunk/arch/avr32/include/asm/unistd.h index 157b4bd3d5e5..1358e366f4be 100644 --- a/trunk/arch/avr32/include/asm/unistd.h +++ b/trunk/arch/avr32/include/asm/unistd.h @@ -8,8 +8,300 @@ #ifndef __ASM_AVR32_UNISTD_H #define __ASM_AVR32_UNISTD_H -#include +/* + * This file contains the system call numbers. + */ + +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_umask 7 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_time 13 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_chown 16 +#define __NR_lchown 17 +#define __NR_lseek 18 +#define __NR__llseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_umount2 22 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_stime 25 +#define __NR_ptrace 26 +#define __NR_alarm 27 +#define __NR_pause 28 +#define __NR_utime 29 +#define __NR_stat 30 +#define __NR_fstat 31 +#define __NR_lstat 32 +#define __NR_access 33 +#define __NR_chroot 34 +#define __NR_sync 35 +#define __NR_fsync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_clone 44 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_getcwd 48 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_setfsuid 52 +#define __NR_setfsgid 53 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_setpgid 56 +#define __NR_mremap 57 +#define __NR_setresuid 58 +#define __NR_getresuid 59 +#define __NR_setreuid 60 +#define __NR_setregid 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_rt_sigaction 67 +#define __NR_rt_sigreturn 68 +#define __NR_rt_sigprocmask 69 +#define __NR_rt_sigpending 70 +#define __NR_rt_sigtimedwait 71 +#define __NR_rt_sigqueueinfo 72 +#define __NR_rt_sigsuspend 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrlimit 76 /* SuS compliant getrlimit */ +#define __NR_getrusage 77 +#define __NR_gettimeofday 78 +#define __NR_settimeofday 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_select 82 +#define __NR_symlink 83 +#define __NR_fchdir 84 +#define __NR_readlink 85 +#define __NR_pread 86 +#define __NR_pwrite 87 +#define __NR_swapon 88 +#define __NR_reboot 89 +#define __NR_mmap2 90 +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +#define __NR_wait4 98 +#define __NR_statfs 99 +#define __NR_fstatfs 100 +#define __NR_vhangup 101 +#define __NR_sigaltstack 102 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_swapoff 106 +#define __NR_sysinfo 107 +/* 108 was __NR_ipc for a little while */ +#define __NR_sendfile 109 +#define __NR_setdomainname 110 +#define __NR_uname 111 +#define __NR_adjtimex 112 +#define __NR_mprotect 113 +#define __NR_vfork 114 +#define __NR_init_module 115 +#define __NR_delete_module 116 +#define __NR_quotactl 117 +#define __NR_getpgid 118 +#define __NR_bdflush 119 +#define __NR_sysfs 120 +#define __NR_personality 121 +#define __NR_afs_syscall 122 /* Syscall for Andrew File System */ +#define __NR_getdents 123 +#define __NR_flock 124 +#define __NR_msync 125 +#define __NR_readv 126 +#define __NR_writev 127 +#define __NR_getsid 128 +#define __NR_fdatasync 129 +#define __NR__sysctl 130 +#define __NR_mlock 131 +#define __NR_munlock 132 +#define __NR_mlockall 133 +#define __NR_munlockall 134 +#define __NR_sched_setparam 135 +#define __NR_sched_getparam 136 +#define __NR_sched_setscheduler 137 +#define __NR_sched_getscheduler 138 +#define __NR_sched_yield 139 +#define __NR_sched_get_priority_max 140 +#define __NR_sched_get_priority_min 141 +#define __NR_sched_rr_get_interval 142 +#define __NR_nanosleep 143 +#define __NR_poll 144 +#define __NR_nfsservctl 145 +#define __NR_setresgid 146 +#define __NR_getresgid 147 +#define __NR_prctl 148 +#define __NR_socket 149 +#define __NR_bind 150 +#define __NR_connect 151 +#define __NR_listen 152 +#define __NR_accept 153 +#define __NR_getsockname 154 +#define __NR_getpeername 155 +#define __NR_socketpair 156 +#define __NR_send 157 +#define __NR_recv 158 +#define __NR_sendto 159 +#define __NR_recvfrom 160 +#define __NR_shutdown 161 +#define __NR_setsockopt 162 +#define __NR_getsockopt 163 +#define __NR_sendmsg 164 +#define __NR_recvmsg 165 +#define __NR_truncate64 166 +#define __NR_ftruncate64 167 +#define __NR_stat64 168 +#define __NR_lstat64 169 +#define __NR_fstat64 170 +#define __NR_pivot_root 171 +#define __NR_mincore 172 +#define __NR_madvise 173 +#define __NR_getdents64 174 +#define __NR_fcntl64 175 +#define __NR_gettid 176 +#define __NR_readahead 177 +#define __NR_setxattr 178 +#define __NR_lsetxattr 179 +#define __NR_fsetxattr 180 +#define __NR_getxattr 181 +#define __NR_lgetxattr 182 +#define __NR_fgetxattr 183 +#define __NR_listxattr 184 +#define __NR_llistxattr 185 +#define __NR_flistxattr 186 +#define __NR_removexattr 187 +#define __NR_lremovexattr 188 +#define __NR_fremovexattr 189 +#define __NR_tkill 190 +#define __NR_sendfile64 191 +#define __NR_futex 192 +#define __NR_sched_setaffinity 193 +#define __NR_sched_getaffinity 194 +#define __NR_capget 195 +#define __NR_capset 196 +#define __NR_io_setup 197 +#define __NR_io_destroy 198 +#define __NR_io_getevents 199 +#define __NR_io_submit 200 +#define __NR_io_cancel 201 +#define __NR_fadvise64 202 +#define __NR_exit_group 203 +#define __NR_lookup_dcookie 204 +#define __NR_epoll_create 205 +#define __NR_epoll_ctl 206 +#define __NR_epoll_wait 207 +#define __NR_remap_file_pages 208 +#define __NR_set_tid_address 209 + +#define __NR_timer_create 210 +#define __NR_timer_settime 211 +#define __NR_timer_gettime 212 +#define __NR_timer_getoverrun 213 +#define __NR_timer_delete 214 +#define __NR_clock_settime 215 +#define __NR_clock_gettime 216 +#define __NR_clock_getres 217 +#define __NR_clock_nanosleep 218 +#define __NR_statfs64 219 +#define __NR_fstatfs64 220 +#define __NR_tgkill 221 + /* 222 reserved for tux */ +#define __NR_utimes 223 +#define __NR_fadvise64_64 224 + +#define __NR_cacheflush 225 +#define __NR_vserver 226 +#define __NR_mq_open 227 +#define __NR_mq_unlink 228 +#define __NR_mq_timedsend 229 +#define __NR_mq_timedreceive 230 +#define __NR_mq_notify 231 +#define __NR_mq_getsetattr 232 +#define __NR_kexec_load 233 +#define __NR_waitid 234 +#define __NR_add_key 235 +#define __NR_request_key 236 +#define __NR_keyctl 237 +#define __NR_ioprio_set 238 +#define __NR_ioprio_get 239 +#define __NR_inotify_init 240 +#define __NR_inotify_add_watch 241 +#define __NR_inotify_rm_watch 242 +#define __NR_openat 243 +#define __NR_mkdirat 244 +#define __NR_mknodat 245 +#define __NR_fchownat 246 +#define __NR_futimesat 247 +#define __NR_fstatat64 248 +#define __NR_unlinkat 249 +#define __NR_renameat 250 +#define __NR_linkat 251 +#define __NR_symlinkat 252 +#define __NR_readlinkat 253 +#define __NR_fchmodat 254 +#define __NR_faccessat 255 +#define __NR_pselect6 256 +#define __NR_ppoll 257 +#define __NR_unshare 258 +#define __NR_set_robust_list 259 +#define __NR_get_robust_list 260 +#define __NR_splice 261 +#define __NR_sync_file_range 262 +#define __NR_tee 263 +#define __NR_vmsplice 264 +#define __NR_epoll_pwait 265 + +#define __NR_msgget 266 +#define __NR_msgsnd 267 +#define __NR_msgrcv 268 +#define __NR_msgctl 269 +#define __NR_semget 270 +#define __NR_semop 271 +#define __NR_semctl 272 +#define __NR_semtimedop 273 +#define __NR_shmat 274 +#define __NR_shmget 275 +#define __NR_shmdt 276 +#define __NR_shmctl 277 + +#define __NR_utimensat 278 +#define __NR_signalfd 279 +/* 280 was __NR_timerfd */ +#define __NR_eventfd 281 +#define __NR_setns 283 + +#ifdef __KERNEL__ #define NR_syscalls 284 /* Old stuff */ @@ -48,4 +340,6 @@ */ #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); +#endif /* __KERNEL__ */ + #endif /* __ASM_AVR32_UNISTD_H */ diff --git a/trunk/arch/avr32/include/uapi/asm/Kbuild b/trunk/arch/avr32/include/uapi/asm/Kbuild index df53e7a46774..baebb3da1d44 100644 --- a/trunk/arch/avr32/include/uapi/asm/Kbuild +++ b/trunk/arch/avr32/include/uapi/asm/Kbuild @@ -1,35 +1,3 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += auxvec.h -header-y += bitsperlong.h -header-y += byteorder.h -header-y += cachectl.h -header-y += errno.h -header-y += fcntl.h -header-y += ioctl.h -header-y += ioctls.h -header-y += ipcbuf.h -header-y += kvm_para.h -header-y += mman.h -header-y += msgbuf.h -header-y += param.h -header-y += poll.h -header-y += posix_types.h -header-y += ptrace.h -header-y += resource.h -header-y += sembuf.h -header-y += setup.h -header-y += shmbuf.h -header-y += sigcontext.h -header-y += siginfo.h -header-y += signal.h -header-y += socket.h -header-y += sockios.h -header-y += stat.h -header-y += statfs.h -header-y += swab.h -header-y += termbits.h -header-y += termios.h -header-y += types.h -header-y += unistd.h diff --git a/trunk/arch/avr32/include/uapi/asm/param.h b/trunk/arch/avr32/include/uapi/asm/param.h deleted file mode 100644 index d28aa5ee6d37..000000000000 --- a/trunk/arch/avr32/include/uapi/asm/param.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _UAPI__ASM_AVR32_PARAM_H -#define _UAPI__ASM_AVR32_PARAM_H - - -#ifndef HZ -# define HZ 100 -#endif - -/* TODO: Should be configurable */ -#define EXEC_PAGESIZE 4096 - -#ifndef NOGROUP -# define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 - -#endif /* _UAPI__ASM_AVR32_PARAM_H */ diff --git a/trunk/arch/avr32/include/uapi/asm/ptrace.h b/trunk/arch/avr32/include/uapi/asm/ptrace.h deleted file mode 100644 index fe8c16275bc0..000000000000 --- a/trunk/arch/avr32/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2004-2006 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef _UAPI__ASM_AVR32_PTRACE_H -#define _UAPI__ASM_AVR32_PTRACE_H - -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 - -/* - * Status Register bits - */ -#define SR_H 0x20000000 -#define SR_J 0x10000000 -#define SR_DM 0x08000000 -#define SR_D 0x04000000 -#define MODE_NMI 0x01c00000 -#define MODE_EXCEPTION 0x01800000 -#define MODE_INT3 0x01400000 -#define MODE_INT2 0x01000000 -#define MODE_INT1 0x00c00000 -#define MODE_INT0 0x00800000 -#define MODE_SUPERVISOR 0x00400000 -#define MODE_USER 0x00000000 -#define MODE_MASK 0x01c00000 -#define SR_EM 0x00200000 -#define SR_I3M 0x00100000 -#define SR_I2M 0x00080000 -#define SR_I1M 0x00040000 -#define SR_I0M 0x00020000 -#define SR_GM 0x00010000 - -#define SR_H_BIT 29 -#define SR_J_BIT 28 -#define SR_DM_BIT 27 -#define SR_D_BIT 26 -#define MODE_SHIFT 22 -#define SR_EM_BIT 21 -#define SR_I3M_BIT 20 -#define SR_I2M_BIT 19 -#define SR_I1M_BIT 18 -#define SR_I0M_BIT 17 -#define SR_GM_BIT 16 - -/* The user-visible part */ -#define SR_L 0x00000020 -#define SR_Q 0x00000010 -#define SR_V 0x00000008 -#define SR_N 0x00000004 -#define SR_Z 0x00000002 -#define SR_C 0x00000001 - -#define SR_L_BIT 5 -#define SR_Q_BIT 4 -#define SR_V_BIT 3 -#define SR_N_BIT 2 -#define SR_Z_BIT 1 -#define SR_C_BIT 0 - -/* - * The order is defined by the stmts instruction. r0 is stored first, - * so it gets the highest address. - * - * Registers 0-12 are general-purpose registers (r12 is normally used for - * the function return value). - * Register 13 is the stack pointer - * Register 14 is the link register - * Register 15 is the program counter (retrieved from the RAR sysreg) - */ -#define FRAME_SIZE_FULL 72 -#define REG_R12_ORIG 68 -#define REG_R0 64 -#define REG_R1 60 -#define REG_R2 56 -#define REG_R3 52 -#define REG_R4 48 -#define REG_R5 44 -#define REG_R6 40 -#define REG_R7 36 -#define REG_R8 32 -#define REG_R9 28 -#define REG_R10 24 -#define REG_R11 20 -#define REG_R12 16 -#define REG_SP 12 -#define REG_LR 8 - -#define FRAME_SIZE_MIN 8 -#define REG_PC 4 -#define REG_SR 0 - -#ifndef __ASSEMBLY__ -struct pt_regs { - /* These are always saved */ - unsigned long sr; - unsigned long pc; - - /* These are sometimes saved */ - unsigned long lr; - unsigned long sp; - unsigned long r12; - unsigned long r11; - unsigned long r10; - unsigned long r9; - unsigned long r8; - unsigned long r7; - unsigned long r6; - unsigned long r5; - unsigned long r4; - unsigned long r3; - unsigned long r2; - unsigned long r1; - unsigned long r0; - - /* Only saved on system call */ - unsigned long r12_orig; -}; - - -#endif /* ! __ASSEMBLY__ */ - -#endif /* _UAPI__ASM_AVR32_PTRACE_H */ diff --git a/trunk/arch/avr32/include/uapi/asm/setup.h b/trunk/arch/avr32/include/uapi/asm/setup.h deleted file mode 100644 index e58aa9356faf..000000000000 --- a/trunk/arch/avr32/include/uapi/asm/setup.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2004-2006 Atmel Corporation - * - * Based on linux/include/asm-arm/setup.h - * Copyright (C) 1997-1999 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef _UAPI__ASM_AVR32_SETUP_H__ -#define _UAPI__ASM_AVR32_SETUP_H__ - -#define COMMAND_LINE_SIZE 256 - - -#endif /* _UAPI__ASM_AVR32_SETUP_H__ */ diff --git a/trunk/arch/avr32/include/uapi/asm/signal.h b/trunk/arch/avr32/include/uapi/asm/signal.h deleted file mode 100644 index eb46f61adb7d..000000000000 --- a/trunk/arch/avr32/include/uapi/asm/signal.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2004-2006 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef _UAPI__ASM_AVR32_SIGNAL_H -#define _UAPI__ASM_AVR32_SIGNAL_H - -#include - -/* Avoid too many header ordering problems. */ -struct siginfo; - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -#define NSIG 32 -typedef unsigned long sigset_t; - -#endif /* __KERNEL__ */ - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT 6 -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -/* -#define SIGLOST 29 -*/ -#define SIGPWR 30 -#define SIGSYS 31 -#define SIGUNUSED 31 - -/* These should not be considered constants from userland. */ -#define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) - -/* - * SA_FLAGS values: - * - * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. - * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. - * SA_SIGINFO deliver the signal with SIGINFO structs - * SA_ONSTACK indicates that a registered stack_t will be used. - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_NODEFER prevents the current signal from being masked in the handler. - * SA_RESETHAND clears the handler when the signal is delivered. - * - * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single - * Unix names RESETHAND and NODEFER respectively. - */ -#define SA_NOCLDSTOP 0x00000001 -#define SA_NOCLDWAIT 0x00000002 -#define SA_SIGINFO 0x00000004 -#define SA_RESTORER 0x04000000 -#define SA_ONSTACK 0x08000000 -#define SA_RESTART 0x10000000 -#define SA_NODEFER 0x40000000 -#define SA_RESETHAND 0x80000000 - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND - -/* - * sigaltstack controls - */ -#define SS_ONSTACK 1 -#define SS_DISABLE 2 - -#define MINSIGSTKSZ 2048 -#define SIGSTKSZ 8192 - -#include - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -struct sigaction { - union { - __sighandler_t _sa_handler; - void (*_sa_sigaction)(int, struct siginfo *, void *); - } _u; - sigset_t sa_mask; - unsigned long sa_flags; - void (*sa_restorer)(void); -}; - -#define sa_handler _u._sa_handler -#define sa_sigaction _u._sa_sigaction - -#endif /* __KERNEL__ */ - -typedef struct sigaltstack { - void __user *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - - -#endif /* _UAPI__ASM_AVR32_SIGNAL_H */ diff --git a/trunk/arch/avr32/include/uapi/asm/termios.h b/trunk/arch/avr32/include/uapi/asm/termios.h deleted file mode 100644 index b8ef8ea63352..000000000000 --- a/trunk/arch/avr32/include/uapi/asm/termios.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2004-2006 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef _UAPI__ASM_AVR32_TERMIOS_H -#define _UAPI__ASM_AVR32_TERMIOS_H - -#include -#include - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - - -#endif /* _UAPI__ASM_AVR32_TERMIOS_H */ diff --git a/trunk/arch/avr32/include/uapi/asm/types.h b/trunk/arch/avr32/include/uapi/asm/types.h deleted file mode 100644 index bb34ad349dfc..000000000000 --- a/trunk/arch/avr32/include/uapi/asm/types.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (C) 2004-2006 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include diff --git a/trunk/arch/avr32/include/uapi/asm/unistd.h b/trunk/arch/avr32/include/uapi/asm/unistd.h deleted file mode 100644 index 3eaa68753adb..000000000000 --- a/trunk/arch/avr32/include/uapi/asm/unistd.h +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright (C) 2004-2006 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef _UAPI__ASM_AVR32_UNISTD_H -#define _UAPI__ASM_AVR32_UNISTD_H - -/* - * This file contains the system call numbers. - */ - -#define __NR_restart_syscall 0 -#define __NR_exit 1 -#define __NR_fork 2 -#define __NR_read 3 -#define __NR_write 4 -#define __NR_open 5 -#define __NR_close 6 -#define __NR_umask 7 -#define __NR_creat 8 -#define __NR_link 9 -#define __NR_unlink 10 -#define __NR_execve 11 -#define __NR_chdir 12 -#define __NR_time 13 -#define __NR_mknod 14 -#define __NR_chmod 15 -#define __NR_chown 16 -#define __NR_lchown 17 -#define __NR_lseek 18 -#define __NR__llseek 19 -#define __NR_getpid 20 -#define __NR_mount 21 -#define __NR_umount2 22 -#define __NR_setuid 23 -#define __NR_getuid 24 -#define __NR_stime 25 -#define __NR_ptrace 26 -#define __NR_alarm 27 -#define __NR_pause 28 -#define __NR_utime 29 -#define __NR_stat 30 -#define __NR_fstat 31 -#define __NR_lstat 32 -#define __NR_access 33 -#define __NR_chroot 34 -#define __NR_sync 35 -#define __NR_fsync 36 -#define __NR_kill 37 -#define __NR_rename 38 -#define __NR_mkdir 39 -#define __NR_rmdir 40 -#define __NR_dup 41 -#define __NR_pipe 42 -#define __NR_times 43 -#define __NR_clone 44 -#define __NR_brk 45 -#define __NR_setgid 46 -#define __NR_getgid 47 -#define __NR_getcwd 48 -#define __NR_geteuid 49 -#define __NR_getegid 50 -#define __NR_acct 51 -#define __NR_setfsuid 52 -#define __NR_setfsgid 53 -#define __NR_ioctl 54 -#define __NR_fcntl 55 -#define __NR_setpgid 56 -#define __NR_mremap 57 -#define __NR_setresuid 58 -#define __NR_getresuid 59 -#define __NR_setreuid 60 -#define __NR_setregid 61 -#define __NR_ustat 62 -#define __NR_dup2 63 -#define __NR_getppid 64 -#define __NR_getpgrp 65 -#define __NR_setsid 66 -#define __NR_rt_sigaction 67 -#define __NR_rt_sigreturn 68 -#define __NR_rt_sigprocmask 69 -#define __NR_rt_sigpending 70 -#define __NR_rt_sigtimedwait 71 -#define __NR_rt_sigqueueinfo 72 -#define __NR_rt_sigsuspend 73 -#define __NR_sethostname 74 -#define __NR_setrlimit 75 -#define __NR_getrlimit 76 /* SuS compliant getrlimit */ -#define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 -#define __NR_getgroups 80 -#define __NR_setgroups 81 -#define __NR_select 82 -#define __NR_symlink 83 -#define __NR_fchdir 84 -#define __NR_readlink 85 -#define __NR_pread 86 -#define __NR_pwrite 87 -#define __NR_swapon 88 -#define __NR_reboot 89 -#define __NR_mmap2 90 -#define __NR_munmap 91 -#define __NR_truncate 92 -#define __NR_ftruncate 93 -#define __NR_fchmod 94 -#define __NR_fchown 95 -#define __NR_getpriority 96 -#define __NR_setpriority 97 -#define __NR_wait4 98 -#define __NR_statfs 99 -#define __NR_fstatfs 100 -#define __NR_vhangup 101 -#define __NR_sigaltstack 102 -#define __NR_syslog 103 -#define __NR_setitimer 104 -#define __NR_getitimer 105 -#define __NR_swapoff 106 -#define __NR_sysinfo 107 -/* 108 was __NR_ipc for a little while */ -#define __NR_sendfile 109 -#define __NR_setdomainname 110 -#define __NR_uname 111 -#define __NR_adjtimex 112 -#define __NR_mprotect 113 -#define __NR_vfork 114 -#define __NR_init_module 115 -#define __NR_delete_module 116 -#define __NR_quotactl 117 -#define __NR_getpgid 118 -#define __NR_bdflush 119 -#define __NR_sysfs 120 -#define __NR_personality 121 -#define __NR_afs_syscall 122 /* Syscall for Andrew File System */ -#define __NR_getdents 123 -#define __NR_flock 124 -#define __NR_msync 125 -#define __NR_readv 126 -#define __NR_writev 127 -#define __NR_getsid 128 -#define __NR_fdatasync 129 -#define __NR__sysctl 130 -#define __NR_mlock 131 -#define __NR_munlock 132 -#define __NR_mlockall 133 -#define __NR_munlockall 134 -#define __NR_sched_setparam 135 -#define __NR_sched_getparam 136 -#define __NR_sched_setscheduler 137 -#define __NR_sched_getscheduler 138 -#define __NR_sched_yield 139 -#define __NR_sched_get_priority_max 140 -#define __NR_sched_get_priority_min 141 -#define __NR_sched_rr_get_interval 142 -#define __NR_nanosleep 143 -#define __NR_poll 144 -#define __NR_nfsservctl 145 -#define __NR_setresgid 146 -#define __NR_getresgid 147 -#define __NR_prctl 148 -#define __NR_socket 149 -#define __NR_bind 150 -#define __NR_connect 151 -#define __NR_listen 152 -#define __NR_accept 153 -#define __NR_getsockname 154 -#define __NR_getpeername 155 -#define __NR_socketpair 156 -#define __NR_send 157 -#define __NR_recv 158 -#define __NR_sendto 159 -#define __NR_recvfrom 160 -#define __NR_shutdown 161 -#define __NR_setsockopt 162 -#define __NR_getsockopt 163 -#define __NR_sendmsg 164 -#define __NR_recvmsg 165 -#define __NR_truncate64 166 -#define __NR_ftruncate64 167 -#define __NR_stat64 168 -#define __NR_lstat64 169 -#define __NR_fstat64 170 -#define __NR_pivot_root 171 -#define __NR_mincore 172 -#define __NR_madvise 173 -#define __NR_getdents64 174 -#define __NR_fcntl64 175 -#define __NR_gettid 176 -#define __NR_readahead 177 -#define __NR_setxattr 178 -#define __NR_lsetxattr 179 -#define __NR_fsetxattr 180 -#define __NR_getxattr 181 -#define __NR_lgetxattr 182 -#define __NR_fgetxattr 183 -#define __NR_listxattr 184 -#define __NR_llistxattr 185 -#define __NR_flistxattr 186 -#define __NR_removexattr 187 -#define __NR_lremovexattr 188 -#define __NR_fremovexattr 189 -#define __NR_tkill 190 -#define __NR_sendfile64 191 -#define __NR_futex 192 -#define __NR_sched_setaffinity 193 -#define __NR_sched_getaffinity 194 -#define __NR_capget 195 -#define __NR_capset 196 -#define __NR_io_setup 197 -#define __NR_io_destroy 198 -#define __NR_io_getevents 199 -#define __NR_io_submit 200 -#define __NR_io_cancel 201 -#define __NR_fadvise64 202 -#define __NR_exit_group 203 -#define __NR_lookup_dcookie 204 -#define __NR_epoll_create 205 -#define __NR_epoll_ctl 206 -#define __NR_epoll_wait 207 -#define __NR_remap_file_pages 208 -#define __NR_set_tid_address 209 - -#define __NR_timer_create 210 -#define __NR_timer_settime 211 -#define __NR_timer_gettime 212 -#define __NR_timer_getoverrun 213 -#define __NR_timer_delete 214 -#define __NR_clock_settime 215 -#define __NR_clock_gettime 216 -#define __NR_clock_getres 217 -#define __NR_clock_nanosleep 218 -#define __NR_statfs64 219 -#define __NR_fstatfs64 220 -#define __NR_tgkill 221 - /* 222 reserved for tux */ -#define __NR_utimes 223 -#define __NR_fadvise64_64 224 - -#define __NR_cacheflush 225 - -#define __NR_vserver 226 -#define __NR_mq_open 227 -#define __NR_mq_unlink 228 -#define __NR_mq_timedsend 229 -#define __NR_mq_timedreceive 230 -#define __NR_mq_notify 231 -#define __NR_mq_getsetattr 232 -#define __NR_kexec_load 233 -#define __NR_waitid 234 -#define __NR_add_key 235 -#define __NR_request_key 236 -#define __NR_keyctl 237 -#define __NR_ioprio_set 238 -#define __NR_ioprio_get 239 -#define __NR_inotify_init 240 -#define __NR_inotify_add_watch 241 -#define __NR_inotify_rm_watch 242 -#define __NR_openat 243 -#define __NR_mkdirat 244 -#define __NR_mknodat 245 -#define __NR_fchownat 246 -#define __NR_futimesat 247 -#define __NR_fstatat64 248 -#define __NR_unlinkat 249 -#define __NR_renameat 250 -#define __NR_linkat 251 -#define __NR_symlinkat 252 -#define __NR_readlinkat 253 -#define __NR_fchmodat 254 -#define __NR_faccessat 255 -#define __NR_pselect6 256 -#define __NR_ppoll 257 -#define __NR_unshare 258 -#define __NR_set_robust_list 259 -#define __NR_get_robust_list 260 -#define __NR_splice 261 -#define __NR_sync_file_range 262 -#define __NR_tee 263 -#define __NR_vmsplice 264 -#define __NR_epoll_pwait 265 - -#define __NR_msgget 266 -#define __NR_msgsnd 267 -#define __NR_msgrcv 268 -#define __NR_msgctl 269 -#define __NR_semget 270 -#define __NR_semop 271 -#define __NR_semctl 272 -#define __NR_semtimedop 273 -#define __NR_shmat 274 -#define __NR_shmget 275 -#define __NR_shmdt 276 -#define __NR_shmctl 277 - -#define __NR_utimensat 278 -#define __NR_signalfd 279 -/* 280 was __NR_timerfd */ -#define __NR_eventfd 281 -#define __NR_setns 283 - - -#endif /* _UAPI__ASM_AVR32_UNISTD_H */ diff --git a/trunk/arch/avr32/kernel/process.c b/trunk/arch/avr32/kernel/process.c index 1bb0a8abd79b..92c5af98a6f7 100644 --- a/trunk/arch/avr32/kernel/process.c +++ b/trunk/arch/avr32/kernel/process.c @@ -388,14 +388,14 @@ asmlinkage int sys_execve(const char __user *ufilename, struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; filename = getname(ufilename); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, uargv, uenvp, regs); + error = do_execve(filename, uargv, uenvp, regs); putname(filename); out: diff --git a/trunk/arch/blackfin/kernel/process.c b/trunk/arch/blackfin/kernel/process.c index bb1cc721fcf7..62bcea7dcc6d 100644 --- a/trunk/arch/blackfin/kernel/process.c +++ b/trunk/arch/blackfin/kernel/process.c @@ -213,14 +213,14 @@ asmlinkage int sys_execve(const char __user *name, const char __user *const __user *envp) { int error; - struct filename *filename; + char *filename; struct pt_regs *regs = (struct pt_regs *)((&name) + 6); filename = getname(name); error = PTR_ERR(filename); if (IS_ERR(filename)) return error; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); return error; } diff --git a/trunk/arch/c6x/include/asm/Kbuild b/trunk/arch/c6x/include/asm/Kbuild index 112a496d8355..4e4e98da8192 100644 --- a/trunk/arch/c6x/include/asm/Kbuild +++ b/trunk/arch/c6x/include/asm/Kbuild @@ -1,3 +1,4 @@ +include include/asm-generic/Kbuild.asm generic-y += atomic.h generic-y += auxvec.h diff --git a/trunk/arch/c6x/include/uapi/asm/byteorder.h b/trunk/arch/c6x/include/asm/byteorder.h similarity index 100% rename from trunk/arch/c6x/include/uapi/asm/byteorder.h rename to trunk/arch/c6x/include/asm/byteorder.h diff --git a/trunk/arch/c6x/include/uapi/asm/kvm_para.h b/trunk/arch/c6x/include/asm/kvm_para.h similarity index 100% rename from trunk/arch/c6x/include/uapi/asm/kvm_para.h rename to trunk/arch/c6x/include/asm/kvm_para.h diff --git a/trunk/arch/c6x/include/asm/ptrace.h b/trunk/arch/c6x/include/asm/ptrace.h index 76da6ad66108..b04ff5964258 100644 --- a/trunk/arch/c6x/include/asm/ptrace.h +++ b/trunk/arch/c6x/include/asm/ptrace.h @@ -11,13 +11,156 @@ #ifndef _ASM_C6X_PTRACE_H #define _ASM_C6X_PTRACE_H -#include +#define BKPT_OPCODE 0x56454314 /* illegal opcode */ + +#ifdef _BIG_ENDIAN +#define PT_LO(odd, even) odd +#define PT_HI(odd, even) even +#else +#define PT_LO(odd, even) even +#define PT_HI(odd, even) odd +#endif + +#define PT_A4_ORG PT_LO(1, 0) +#define PT_TSR PT_HI(1, 0) +#define PT_ILC PT_LO(3, 2) +#define PT_RILC PT_HI(3, 2) +#define PT_CSR PT_LO(5, 4) +#define PT_PC PT_HI(5, 4) +#define PT_B16 PT_LO(7, 6) +#define PT_B17 PT_HI(7, 6) +#define PT_B18 PT_LO(9, 8) +#define PT_B19 PT_HI(9, 8) +#define PT_B20 PT_LO(11, 10) +#define PT_B21 PT_HI(11, 10) +#define PT_B22 PT_LO(13, 12) +#define PT_B23 PT_HI(13, 12) +#define PT_B24 PT_LO(15, 14) +#define PT_B25 PT_HI(15, 14) +#define PT_B26 PT_LO(17, 16) +#define PT_B27 PT_HI(17, 16) +#define PT_B28 PT_LO(19, 18) +#define PT_B29 PT_HI(19, 18) +#define PT_B30 PT_LO(21, 20) +#define PT_B31 PT_HI(21, 20) +#define PT_B0 PT_LO(23, 22) +#define PT_B1 PT_HI(23, 22) +#define PT_B2 PT_LO(25, 24) +#define PT_B3 PT_HI(25, 24) +#define PT_B4 PT_LO(27, 26) +#define PT_B5 PT_HI(27, 26) +#define PT_B6 PT_LO(29, 28) +#define PT_B7 PT_HI(29, 28) +#define PT_B8 PT_LO(31, 30) +#define PT_B9 PT_HI(31, 30) +#define PT_B10 PT_LO(33, 32) +#define PT_B11 PT_HI(33, 32) +#define PT_B12 PT_LO(35, 34) +#define PT_B13 PT_HI(35, 34) +#define PT_A16 PT_LO(37, 36) +#define PT_A17 PT_HI(37, 36) +#define PT_A18 PT_LO(39, 38) +#define PT_A19 PT_HI(39, 38) +#define PT_A20 PT_LO(41, 40) +#define PT_A21 PT_HI(41, 40) +#define PT_A22 PT_LO(43, 42) +#define PT_A23 PT_HI(43, 42) +#define PT_A24 PT_LO(45, 44) +#define PT_A25 PT_HI(45, 44) +#define PT_A26 PT_LO(47, 46) +#define PT_A27 PT_HI(47, 46) +#define PT_A28 PT_LO(49, 48) +#define PT_A29 PT_HI(49, 48) +#define PT_A30 PT_LO(51, 50) +#define PT_A31 PT_HI(51, 50) +#define PT_A0 PT_LO(53, 52) +#define PT_A1 PT_HI(53, 52) +#define PT_A2 PT_LO(55, 54) +#define PT_A3 PT_HI(55, 54) +#define PT_A4 PT_LO(57, 56) +#define PT_A5 PT_HI(57, 56) +#define PT_A6 PT_LO(59, 58) +#define PT_A7 PT_HI(59, 58) +#define PT_A8 PT_LO(61, 60) +#define PT_A9 PT_HI(61, 60) +#define PT_A10 PT_LO(63, 62) +#define PT_A11 PT_HI(63, 62) +#define PT_A12 PT_LO(65, 64) +#define PT_A13 PT_HI(65, 64) +#define PT_A14 PT_LO(67, 66) +#define PT_A15 PT_HI(67, 66) +#define PT_B14 PT_LO(69, 68) +#define PT_B15 PT_HI(69, 68) + +#define NR_PTREGS 70 + +#define PT_DP PT_B14 /* Data Segment Pointer (B14) */ +#define PT_SP PT_B15 /* Stack Pointer (B15) */ + +#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */ + +#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ +#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ #ifndef __ASSEMBLY__ + #ifdef _BIG_ENDIAN +#define REG_PAIR(odd, even) unsigned long odd; unsigned long even #else +#define REG_PAIR(odd, even) unsigned long even; unsigned long odd #endif +/* + * this struct defines the way the registers are stored on the + * stack during a system call. fields defined with REG_PAIR + * are saved and restored using double-word memory operations + * which means the word ordering of the pair depends on endianess. + */ +struct pt_regs { + REG_PAIR(tsr, orig_a4); + REG_PAIR(rilc, ilc); + REG_PAIR(pc, csr); + + REG_PAIR(b17, b16); + REG_PAIR(b19, b18); + REG_PAIR(b21, b20); + REG_PAIR(b23, b22); + REG_PAIR(b25, b24); + REG_PAIR(b27, b26); + REG_PAIR(b29, b28); + REG_PAIR(b31, b30); + + REG_PAIR(b1, b0); + REG_PAIR(b3, b2); + REG_PAIR(b5, b4); + REG_PAIR(b7, b6); + REG_PAIR(b9, b8); + REG_PAIR(b11, b10); + REG_PAIR(b13, b12); + + REG_PAIR(a17, a16); + REG_PAIR(a19, a18); + REG_PAIR(a21, a20); + REG_PAIR(a23, a22); + REG_PAIR(a25, a24); + REG_PAIR(a27, a26); + REG_PAIR(a29, a28); + REG_PAIR(a31, a30); + + REG_PAIR(a1, a0); + REG_PAIR(a3, a2); + REG_PAIR(a5, a4); + REG_PAIR(a7, a6); + REG_PAIR(a9, a8); + REG_PAIR(a11, a10); + REG_PAIR(a13, a12); + + REG_PAIR(a15, a14); + REG_PAIR(sp, dp); +}; + +#ifdef __KERNEL__ + #include #define user_mode(regs) ((((regs)->tsr) & 0x40) != 0) @@ -31,5 +174,6 @@ extern void show_regs(struct pt_regs *); extern asmlinkage unsigned long syscall_trace_entry(struct pt_regs *regs); extern asmlinkage void syscall_trace_exit(struct pt_regs *regs); +#endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */ #endif /* _ASM_C6X_PTRACE_H */ diff --git a/trunk/arch/c6x/include/uapi/asm/setup.h b/trunk/arch/c6x/include/asm/setup.h similarity index 100% rename from trunk/arch/c6x/include/uapi/asm/setup.h rename to trunk/arch/c6x/include/asm/setup.h diff --git a/trunk/arch/c6x/include/uapi/asm/sigcontext.h b/trunk/arch/c6x/include/asm/sigcontext.h similarity index 100% rename from trunk/arch/c6x/include/uapi/asm/sigcontext.h rename to trunk/arch/c6x/include/asm/sigcontext.h diff --git a/trunk/arch/c6x/include/uapi/asm/swab.h b/trunk/arch/c6x/include/asm/swab.h similarity index 100% rename from trunk/arch/c6x/include/uapi/asm/swab.h rename to trunk/arch/c6x/include/asm/swab.h diff --git a/trunk/arch/c6x/include/uapi/asm/unistd.h b/trunk/arch/c6x/include/asm/unistd.h similarity index 100% rename from trunk/arch/c6x/include/uapi/asm/unistd.h rename to trunk/arch/c6x/include/asm/unistd.h diff --git a/trunk/arch/c6x/include/uapi/asm/Kbuild b/trunk/arch/c6x/include/uapi/asm/Kbuild index c312b424c433..baebb3da1d44 100644 --- a/trunk/arch/c6x/include/uapi/asm/Kbuild +++ b/trunk/arch/c6x/include/uapi/asm/Kbuild @@ -1,10 +1,3 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += byteorder.h -header-y += kvm_para.h -header-y += ptrace.h -header-y += setup.h -header-y += sigcontext.h -header-y += swab.h -header-y += unistd.h diff --git a/trunk/arch/c6x/include/uapi/asm/ptrace.h b/trunk/arch/c6x/include/uapi/asm/ptrace.h deleted file mode 100644 index cc0a4d99151e..000000000000 --- a/trunk/arch/c6x/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2004, 2006, 2009, 2010 Texas Instruments Incorporated - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) - * - * Updated for 2.6.34: Mark Salter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef _UAPI_ASM_C6X_PTRACE_H -#define _UAPI_ASM_C6X_PTRACE_H - -#define BKPT_OPCODE 0x56454314 /* illegal opcode */ - -#ifdef _BIG_ENDIAN -#define PT_LO(odd, even) odd -#define PT_HI(odd, even) even -#else -#define PT_LO(odd, even) even -#define PT_HI(odd, even) odd -#endif - -#define PT_A4_ORG PT_LO(1, 0) -#define PT_TSR PT_HI(1, 0) -#define PT_ILC PT_LO(3, 2) -#define PT_RILC PT_HI(3, 2) -#define PT_CSR PT_LO(5, 4) -#define PT_PC PT_HI(5, 4) -#define PT_B16 PT_LO(7, 6) -#define PT_B17 PT_HI(7, 6) -#define PT_B18 PT_LO(9, 8) -#define PT_B19 PT_HI(9, 8) -#define PT_B20 PT_LO(11, 10) -#define PT_B21 PT_HI(11, 10) -#define PT_B22 PT_LO(13, 12) -#define PT_B23 PT_HI(13, 12) -#define PT_B24 PT_LO(15, 14) -#define PT_B25 PT_HI(15, 14) -#define PT_B26 PT_LO(17, 16) -#define PT_B27 PT_HI(17, 16) -#define PT_B28 PT_LO(19, 18) -#define PT_B29 PT_HI(19, 18) -#define PT_B30 PT_LO(21, 20) -#define PT_B31 PT_HI(21, 20) -#define PT_B0 PT_LO(23, 22) -#define PT_B1 PT_HI(23, 22) -#define PT_B2 PT_LO(25, 24) -#define PT_B3 PT_HI(25, 24) -#define PT_B4 PT_LO(27, 26) -#define PT_B5 PT_HI(27, 26) -#define PT_B6 PT_LO(29, 28) -#define PT_B7 PT_HI(29, 28) -#define PT_B8 PT_LO(31, 30) -#define PT_B9 PT_HI(31, 30) -#define PT_B10 PT_LO(33, 32) -#define PT_B11 PT_HI(33, 32) -#define PT_B12 PT_LO(35, 34) -#define PT_B13 PT_HI(35, 34) -#define PT_A16 PT_LO(37, 36) -#define PT_A17 PT_HI(37, 36) -#define PT_A18 PT_LO(39, 38) -#define PT_A19 PT_HI(39, 38) -#define PT_A20 PT_LO(41, 40) -#define PT_A21 PT_HI(41, 40) -#define PT_A22 PT_LO(43, 42) -#define PT_A23 PT_HI(43, 42) -#define PT_A24 PT_LO(45, 44) -#define PT_A25 PT_HI(45, 44) -#define PT_A26 PT_LO(47, 46) -#define PT_A27 PT_HI(47, 46) -#define PT_A28 PT_LO(49, 48) -#define PT_A29 PT_HI(49, 48) -#define PT_A30 PT_LO(51, 50) -#define PT_A31 PT_HI(51, 50) -#define PT_A0 PT_LO(53, 52) -#define PT_A1 PT_HI(53, 52) -#define PT_A2 PT_LO(55, 54) -#define PT_A3 PT_HI(55, 54) -#define PT_A4 PT_LO(57, 56) -#define PT_A5 PT_HI(57, 56) -#define PT_A6 PT_LO(59, 58) -#define PT_A7 PT_HI(59, 58) -#define PT_A8 PT_LO(61, 60) -#define PT_A9 PT_HI(61, 60) -#define PT_A10 PT_LO(63, 62) -#define PT_A11 PT_HI(63, 62) -#define PT_A12 PT_LO(65, 64) -#define PT_A13 PT_HI(65, 64) -#define PT_A14 PT_LO(67, 66) -#define PT_A15 PT_HI(67, 66) -#define PT_B14 PT_LO(69, 68) -#define PT_B15 PT_HI(69, 68) - -#define NR_PTREGS 70 - -#define PT_DP PT_B14 /* Data Segment Pointer (B14) */ -#define PT_SP PT_B15 /* Stack Pointer (B15) */ - -#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */ - -#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ -#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ - -#ifndef __ASSEMBLY__ - -#ifdef _BIG_ENDIAN -#define REG_PAIR(odd, even) unsigned long odd; unsigned long even -#else -#define REG_PAIR(odd, even) unsigned long even; unsigned long odd -#endif - -/* - * this struct defines the way the registers are stored on the - * stack during a system call. fields defined with REG_PAIR - * are saved and restored using double-word memory operations - * which means the word ordering of the pair depends on endianess. - */ -struct pt_regs { - REG_PAIR(tsr, orig_a4); - REG_PAIR(rilc, ilc); - REG_PAIR(pc, csr); - - REG_PAIR(b17, b16); - REG_PAIR(b19, b18); - REG_PAIR(b21, b20); - REG_PAIR(b23, b22); - REG_PAIR(b25, b24); - REG_PAIR(b27, b26); - REG_PAIR(b29, b28); - REG_PAIR(b31, b30); - - REG_PAIR(b1, b0); - REG_PAIR(b3, b2); - REG_PAIR(b5, b4); - REG_PAIR(b7, b6); - REG_PAIR(b9, b8); - REG_PAIR(b11, b10); - REG_PAIR(b13, b12); - - REG_PAIR(a17, a16); - REG_PAIR(a19, a18); - REG_PAIR(a21, a20); - REG_PAIR(a23, a22); - REG_PAIR(a25, a24); - REG_PAIR(a27, a26); - REG_PAIR(a29, a28); - REG_PAIR(a31, a30); - - REG_PAIR(a1, a0); - REG_PAIR(a3, a2); - REG_PAIR(a5, a4); - REG_PAIR(a7, a6); - REG_PAIR(a9, a8); - REG_PAIR(a11, a10); - REG_PAIR(a13, a12); - - REG_PAIR(a15, a14); - REG_PAIR(sp, dp); -}; - -#endif /* __ASSEMBLY__ */ -#endif /* _UAPI_ASM_C6X_PTRACE_H */ diff --git a/trunk/arch/cris/arch-v10/kernel/process.c b/trunk/arch/cris/arch-v10/kernel/process.c index 15ac7150371f..bee8df43c201 100644 --- a/trunk/arch/cris/arch-v10/kernel/process.c +++ b/trunk/arch/cris/arch-v10/kernel/process.c @@ -212,14 +212,14 @@ asmlinkage int sys_execve(const char *fname, struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; filename = getname(fname); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); out: return error; diff --git a/trunk/arch/cris/arch-v32/kernel/process.c b/trunk/arch/cris/arch-v32/kernel/process.c index 4e9992246359..0570e8ce603d 100644 --- a/trunk/arch/cris/arch-v32/kernel/process.c +++ b/trunk/arch/cris/arch-v32/kernel/process.c @@ -224,7 +224,7 @@ sys_execve(const char *fname, struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; filename = getname(fname); error = PTR_ERR(filename); @@ -232,7 +232,7 @@ sys_execve(const char *fname, if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); out: return error; diff --git a/trunk/arch/frv/include/asm/Kbuild b/trunk/arch/frv/include/asm/Kbuild index 4a159da23633..251bd7125576 100644 --- a/trunk/arch/frv/include/asm/Kbuild +++ b/trunk/arch/frv/include/asm/Kbuild @@ -1,3 +1,6 @@ +include include/asm-generic/Kbuild.asm +header-y += registers.h +header-y += termios.h generic-y += clkdev.h generic-y += exec.h diff --git a/trunk/arch/frv/include/uapi/asm/auxvec.h b/trunk/arch/frv/include/asm/auxvec.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/auxvec.h rename to trunk/arch/frv/include/asm/auxvec.h diff --git a/trunk/arch/frv/include/uapi/asm/bitsperlong.h b/trunk/arch/frv/include/asm/bitsperlong.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/bitsperlong.h rename to trunk/arch/frv/include/asm/bitsperlong.h diff --git a/trunk/arch/frv/include/uapi/asm/byteorder.h b/trunk/arch/frv/include/asm/byteorder.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/byteorder.h rename to trunk/arch/frv/include/asm/byteorder.h diff --git a/trunk/arch/frv/include/uapi/asm/errno.h b/trunk/arch/frv/include/asm/errno.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/errno.h rename to trunk/arch/frv/include/asm/errno.h diff --git a/trunk/arch/frv/include/uapi/asm/fcntl.h b/trunk/arch/frv/include/asm/fcntl.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/fcntl.h rename to trunk/arch/frv/include/asm/fcntl.h diff --git a/trunk/arch/frv/include/uapi/asm/ioctl.h b/trunk/arch/frv/include/asm/ioctl.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/ioctl.h rename to trunk/arch/frv/include/asm/ioctl.h diff --git a/trunk/arch/frv/include/uapi/asm/ioctls.h b/trunk/arch/frv/include/asm/ioctls.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/ioctls.h rename to trunk/arch/frv/include/asm/ioctls.h diff --git a/trunk/arch/frv/include/uapi/asm/ipcbuf.h b/trunk/arch/frv/include/asm/ipcbuf.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/ipcbuf.h rename to trunk/arch/frv/include/asm/ipcbuf.h diff --git a/trunk/arch/frv/include/uapi/asm/kvm_para.h b/trunk/arch/frv/include/asm/kvm_para.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/kvm_para.h rename to trunk/arch/frv/include/asm/kvm_para.h diff --git a/trunk/arch/frv/include/uapi/asm/mman.h b/trunk/arch/frv/include/asm/mman.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/mman.h rename to trunk/arch/frv/include/asm/mman.h diff --git a/trunk/arch/frv/include/uapi/asm/msgbuf.h b/trunk/arch/frv/include/asm/msgbuf.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/msgbuf.h rename to trunk/arch/frv/include/asm/msgbuf.h diff --git a/trunk/arch/frv/include/uapi/asm/param.h b/trunk/arch/frv/include/asm/param.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/param.h rename to trunk/arch/frv/include/asm/param.h diff --git a/trunk/arch/frv/include/uapi/asm/poll.h b/trunk/arch/frv/include/asm/poll.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/poll.h rename to trunk/arch/frv/include/asm/poll.h diff --git a/trunk/arch/frv/include/uapi/asm/posix_types.h b/trunk/arch/frv/include/asm/posix_types.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/posix_types.h rename to trunk/arch/frv/include/asm/posix_types.h diff --git a/trunk/arch/frv/include/asm/ptrace.h b/trunk/arch/frv/include/asm/ptrace.h index 034f17934192..bd534b2d0258 100644 --- a/trunk/arch/frv/include/asm/ptrace.h +++ b/trunk/arch/frv/include/asm/ptrace.h @@ -11,10 +11,58 @@ #ifndef _ASM_PTRACE_H #define _ASM_PTRACE_H +#include +#ifdef __KERNEL__ #include -#include #define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0) +#endif + + +#define PT_PSR 0 +#define PT_ISR 1 +#define PT_CCR 2 +#define PT_CCCR 3 +#define PT_LR 4 +#define PT_LCR 5 +#define PT_PC 6 + +#define PT__STATUS 7 /* exception status */ +#define PT_SYSCALLNO 8 /* syscall number or -1 */ +#define PT_ORIG_GR8 9 /* saved GR8 for signal handling */ +#define PT_GNER0 10 +#define PT_GNER1 11 +#define PT_IACC0H 12 +#define PT_IACC0L 13 + +#define PT_GR(j) ( 14 + (j)) /* GRj for 0<=j<=63 */ +#define PT_FR(j) ( 78 + (j)) /* FRj for 0<=j<=63 */ +#define PT_FNER(j) (142 + (j)) /* FNERj for 0<=j<=1 */ +#define PT_MSR(j) (144 + (j)) /* MSRj for 0<=j<=2 */ +#define PT_ACC(j) (146 + (j)) /* ACCj for 0<=j<=7 */ +#define PT_ACCG(jklm) (154 + (jklm)) /* ACCGjklm for 0<=jklm<=1 (reads four regs per slot) */ +#define PT_FSR(j) (156 + (j)) /* FSRj for 0<=j<=0 */ +#define PT__GPEND 78 +#define PT__END 157 + +#define PT_TBR PT_GR(0) +#define PT_SP PT_GR(1) +#define PT_FP PT_GR(2) +#define PT_PREV_FRAME PT_GR(28) /* previous exception frame pointer (old gr28 value) */ +#define PT_CURR_TASK PT_GR(29) /* current task */ + + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */ + +#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ +#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ + +#ifdef __KERNEL__ #ifndef __ASSEMBLY__ struct task_struct; @@ -38,4 +86,5 @@ extern unsigned long user_stack(const struct pt_regs *); #define arch_has_single_step() (1) #endif /* !__ASSEMBLY__ */ +#endif /* __KERNEL__ */ #endif /* _ASM_PTRACE_H */ diff --git a/trunk/arch/frv/include/uapi/asm/registers.h b/trunk/arch/frv/include/asm/registers.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/registers.h rename to trunk/arch/frv/include/asm/registers.h diff --git a/trunk/arch/frv/include/uapi/asm/resource.h b/trunk/arch/frv/include/asm/resource.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/resource.h rename to trunk/arch/frv/include/asm/resource.h diff --git a/trunk/arch/frv/include/uapi/asm/sembuf.h b/trunk/arch/frv/include/asm/sembuf.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/sembuf.h rename to trunk/arch/frv/include/asm/sembuf.h diff --git a/trunk/arch/frv/include/asm/setup.h b/trunk/arch/frv/include/asm/setup.h index aa76f2eac09a..afd787ceede6 100644 --- a/trunk/arch/frv/include/asm/setup.h +++ b/trunk/arch/frv/include/asm/setup.h @@ -8,12 +8,15 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ + #ifndef _ASM_SETUP_H #define _ASM_SETUP_H +#define COMMAND_LINE_SIZE 512 + +#ifdef __KERNEL__ #include -#include #ifndef __ASSEMBLY__ @@ -23,4 +26,6 @@ extern unsigned long __initdata num_mappedpages; #endif /* !__ASSEMBLY__ */ +#endif /* __KERNEL__ */ + #endif /* _ASM_SETUP_H */ diff --git a/trunk/arch/frv/include/uapi/asm/shmbuf.h b/trunk/arch/frv/include/asm/shmbuf.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/shmbuf.h rename to trunk/arch/frv/include/asm/shmbuf.h diff --git a/trunk/arch/frv/include/uapi/asm/sigcontext.h b/trunk/arch/frv/include/asm/sigcontext.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/sigcontext.h rename to trunk/arch/frv/include/asm/sigcontext.h diff --git a/trunk/arch/frv/include/uapi/asm/siginfo.h b/trunk/arch/frv/include/asm/siginfo.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/siginfo.h rename to trunk/arch/frv/include/asm/siginfo.h diff --git a/trunk/arch/frv/include/asm/signal.h b/trunk/arch/frv/include/asm/signal.h index 599500a31025..f071e813dcb3 100644 --- a/trunk/arch/frv/include/asm/signal.h +++ b/trunk/arch/frv/include/asm/signal.h @@ -1,8 +1,21 @@ #ifndef _ASM_SIGNAL_H #define _ASM_SIGNAL_H -#include +#include +#ifndef __KERNEL__ +/* Here we must cater to libcs that poke about in kernel headers. */ + +#define NSIG 32 +typedef unsigned long sigset_t; + +#endif /* !__KERNEL__ */ + +#define SA_RESTORER 0x04000000 /* to get struct sigaction correct */ + +#include + +#ifdef __KERNEL__ struct old_sigaction { __sighandler_t sa_handler; old_sigset_t sa_mask; @@ -10,4 +23,22 @@ struct old_sigaction { __sigrestore_t sa_restorer; }; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +struct sigaction { + union { + __sighandler_t _sa_handler; + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +#endif /* __KERNEL__ */ + #endif /* _ASM_SIGNAL_H */ diff --git a/trunk/arch/frv/include/uapi/asm/socket.h b/trunk/arch/frv/include/asm/socket.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/socket.h rename to trunk/arch/frv/include/asm/socket.h diff --git a/trunk/arch/frv/include/uapi/asm/sockios.h b/trunk/arch/frv/include/asm/sockios.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/sockios.h rename to trunk/arch/frv/include/asm/sockios.h diff --git a/trunk/arch/frv/include/uapi/asm/stat.h b/trunk/arch/frv/include/asm/stat.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/stat.h rename to trunk/arch/frv/include/asm/stat.h diff --git a/trunk/arch/frv/include/uapi/asm/statfs.h b/trunk/arch/frv/include/asm/statfs.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/statfs.h rename to trunk/arch/frv/include/asm/statfs.h diff --git a/trunk/arch/frv/include/uapi/asm/swab.h b/trunk/arch/frv/include/asm/swab.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/swab.h rename to trunk/arch/frv/include/asm/swab.h diff --git a/trunk/arch/frv/include/uapi/asm/termbits.h b/trunk/arch/frv/include/asm/termbits.h similarity index 100% rename from trunk/arch/frv/include/uapi/asm/termbits.h rename to trunk/arch/frv/include/asm/termbits.h diff --git a/trunk/arch/frv/include/asm/termios.h b/trunk/arch/frv/include/asm/termios.h index 9f753fc09532..b4868aafe79c 100644 --- a/trunk/arch/frv/include/asm/termios.h +++ b/trunk/arch/frv/include/asm/termios.h @@ -1,8 +1,27 @@ #ifndef _ASM_TERMIOS_H #define _ASM_TERMIOS_H -#include +#include +#include +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +#ifdef __KERNEL__ /* intr=^C quit=^| erase=del kill=^U eof=^D vtime=\0 vmin=\1 sxtc=\0 start=^Q stop=^S susp=^Z eol=\0 @@ -10,5 +29,30 @@ eol2=\0 */ #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" +#endif + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */ + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +#ifdef __KERNEL__ #include +#endif + #endif /* _ASM_TERMIOS_H */ diff --git a/trunk/arch/frv/include/asm/types.h b/trunk/arch/frv/include/asm/types.h index 6bc63650d832..390a612f3a58 100644 --- a/trunk/arch/frv/include/asm/types.h +++ b/trunk/arch/frv/include/asm/types.h @@ -8,15 +8,19 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ + #ifndef _ASM_TYPES_H #define _ASM_TYPES_H -#include +#include /* * These aren't exported outside the kernel to avoid name space clashes */ +#ifdef __KERNEL__ #define BITS_PER_LONG 32 +#endif /* __KERNEL__ */ + #endif /* _ASM_TYPES_H */ diff --git a/trunk/arch/frv/include/asm/unistd.h b/trunk/arch/frv/include/asm/unistd.h index 266a5b25a0c1..b6b07e55e473 100644 --- a/trunk/arch/frv/include/asm/unistd.h +++ b/trunk/arch/frv/include/asm/unistd.h @@ -1,8 +1,351 @@ #ifndef _ASM_UNISTD_H_ #define _ASM_UNISTD_H_ -#include +/* + * This file contains the system call numbers. + */ + +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_waitpid 7 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_time 13 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_lchown 16 +#define __NR_break 17 +#define __NR_oldstat 18 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_umount 22 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_stime 25 +#define __NR_ptrace 26 +#define __NR_alarm 27 +#define __NR_oldfstat 28 +#define __NR_pause 29 +#define __NR_utime 30 +#define __NR_stty 31 +#define __NR_gtty 32 +#define __NR_access 33 +#define __NR_nice 34 +#define __NR_ftime 35 +#define __NR_sync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_prof 44 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_signal 48 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_umount2 52 +#define __NR_lock 53 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_mpx 56 +#define __NR_setpgid 57 +#define __NR_ulimit 58 +// #define __NR_oldolduname /* 59 */ obsolete +#define __NR_umask 60 +#define __NR_chroot 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_sigaction 67 +#define __NR_sgetmask 68 +#define __NR_ssetmask 69 +#define __NR_setreuid 70 +#define __NR_setregid 71 +#define __NR_sigsuspend 72 +#define __NR_sigpending 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ +#define __NR_getrusage 77 +#define __NR_gettimeofday 78 +#define __NR_settimeofday 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_select 82 +#define __NR_symlink 83 +#define __NR_oldlstat 84 +#define __NR_readlink 85 +#define __NR_uselib 86 +#define __NR_swapon 87 +#define __NR_reboot 88 +#define __NR_readdir 89 +// #define __NR_mmap 90 /* obsolete - not implemented */ +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +// #define __NR_profil /* 98 */ obsolete +#define __NR_statfs 99 +#define __NR_fstatfs 100 +// #define __NR_ioperm /* 101 */ not supported +#define __NR_socketcall 102 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_stat 106 +#define __NR_lstat 107 +#define __NR_fstat 108 +// #define __NR_olduname /* 109 */ obsolete +// #define __NR_iopl /* 110 */ not supported +#define __NR_vhangup 111 +// #define __NR_idle /* 112 */ Obsolete +// #define __NR_vm86old /* 113 */ not supported +#define __NR_wait4 114 +#define __NR_swapoff 115 +#define __NR_sysinfo 116 +#define __NR_ipc 117 +#define __NR_fsync 118 +#define __NR_sigreturn 119 +#define __NR_clone 120 +#define __NR_setdomainname 121 +#define __NR_uname 122 +// #define __NR_modify_ldt /* 123 */ not supported +#define __NR_cacheflush 123 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_sigprocmask 126 +#define __NR_create_module 127 +#define __NR_init_module 128 +#define __NR_delete_module 129 +#define __NR_get_kernel_syms 130 +#define __NR_quotactl 131 +#define __NR_getpgid 132 +#define __NR_fchdir 133 +#define __NR_bdflush 134 +#define __NR_sysfs 135 +#define __NR_personality 136 +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ +#define __NR_setfsuid 138 +#define __NR_setfsgid 139 +#define __NR__llseek 140 +#define __NR_getdents 141 +#define __NR__newselect 142 +#define __NR_flock 143 +#define __NR_msync 144 +#define __NR_readv 145 +#define __NR_writev 146 +#define __NR_getsid 147 +#define __NR_fdatasync 148 +#define __NR__sysctl 149 +#define __NR_mlock 150 +#define __NR_munlock 151 +#define __NR_mlockall 152 +#define __NR_munlockall 153 +#define __NR_sched_setparam 154 +#define __NR_sched_getparam 155 +#define __NR_sched_setscheduler 156 +#define __NR_sched_getscheduler 157 +#define __NR_sched_yield 158 +#define __NR_sched_get_priority_max 159 +#define __NR_sched_get_priority_min 160 +#define __NR_sched_rr_get_interval 161 +#define __NR_nanosleep 162 +#define __NR_mremap 163 +#define __NR_setresuid 164 +#define __NR_getresuid 165 +// #define __NR_vm86 /* 166 */ not supported +#define __NR_query_module 167 +#define __NR_poll 168 +#define __NR_nfsservctl 169 +#define __NR_setresgid 170 +#define __NR_getresgid 171 +#define __NR_prctl 172 +#define __NR_rt_sigreturn 173 +#define __NR_rt_sigaction 174 +#define __NR_rt_sigprocmask 175 +#define __NR_rt_sigpending 176 +#define __NR_rt_sigtimedwait 177 +#define __NR_rt_sigqueueinfo 178 +#define __NR_rt_sigsuspend 179 +#define __NR_pread64 180 +#define __NR_pwrite64 181 +#define __NR_chown 182 +#define __NR_getcwd 183 +#define __NR_capget 184 +#define __NR_capset 185 +#define __NR_sigaltstack 186 +#define __NR_sendfile 187 +#define __NR_getpmsg 188 /* some people actually want streams */ +#define __NR_putpmsg 189 /* some people actually want streams */ +#define __NR_vfork 190 +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#define __NR_lchown32 198 +#define __NR_getuid32 199 +#define __NR_getgid32 200 +#define __NR_geteuid32 201 +#define __NR_getegid32 202 +#define __NR_setreuid32 203 +#define __NR_setregid32 204 +#define __NR_getgroups32 205 +#define __NR_setgroups32 206 +#define __NR_fchown32 207 +#define __NR_setresuid32 208 +#define __NR_getresuid32 209 +#define __NR_setresgid32 210 +#define __NR_getresgid32 211 +#define __NR_chown32 212 +#define __NR_setuid32 213 +#define __NR_setgid32 214 +#define __NR_setfsuid32 215 +#define __NR_setfsgid32 216 +#define __NR_pivot_root 217 +#define __NR_mincore 218 +#define __NR_madvise 219 + +#define __NR_getdents64 220 +#define __NR_fcntl64 221 +#define __NR_security 223 /* syscall for security modules */ +#define __NR_gettid 224 +#define __NR_readahead 225 +#define __NR_setxattr 226 +#define __NR_lsetxattr 227 +#define __NR_fsetxattr 228 +#define __NR_getxattr 229 +#define __NR_lgetxattr 230 +#define __NR_fgetxattr 231 +#define __NR_listxattr 232 +#define __NR_llistxattr 233 +#define __NR_flistxattr 234 +#define __NR_removexattr 235 +#define __NR_lremovexattr 236 +#define __NR_fremovexattr 237 +#define __NR_tkill 238 +#define __NR_sendfile64 239 +#define __NR_futex 240 +#define __NR_sched_setaffinity 241 +#define __NR_sched_getaffinity 242 +#define __NR_set_thread_area 243 +#define __NR_get_thread_area 244 +#define __NR_io_setup 245 +#define __NR_io_destroy 246 +#define __NR_io_getevents 247 +#define __NR_io_submit 248 +#define __NR_io_cancel 249 +#define __NR_fadvise64 250 + +#define __NR_exit_group 252 +#define __NR_lookup_dcookie 253 +#define __NR_epoll_create 254 +#define __NR_epoll_ctl 255 +#define __NR_epoll_wait 256 +#define __NR_remap_file_pages 257 +#define __NR_set_tid_address 258 +#define __NR_timer_create 259 +#define __NR_timer_settime (__NR_timer_create+1) +#define __NR_timer_gettime (__NR_timer_create+2) +#define __NR_timer_getoverrun (__NR_timer_create+3) +#define __NR_timer_delete (__NR_timer_create+4) +#define __NR_clock_settime (__NR_timer_create+5) +#define __NR_clock_gettime (__NR_timer_create+6) +#define __NR_clock_getres (__NR_timer_create+7) +#define __NR_clock_nanosleep (__NR_timer_create+8) +#define __NR_statfs64 268 +#define __NR_fstatfs64 269 +#define __NR_tgkill 270 +#define __NR_utimes 271 +#define __NR_fadvise64_64 272 +#define __NR_vserver 273 +#define __NR_mbind 274 +#define __NR_get_mempolicy 275 +#define __NR_set_mempolicy 276 +#define __NR_mq_open 277 +#define __NR_mq_unlink (__NR_mq_open+1) +#define __NR_mq_timedsend (__NR_mq_open+2) +#define __NR_mq_timedreceive (__NR_mq_open+3) +#define __NR_mq_notify (__NR_mq_open+4) +#define __NR_mq_getsetattr (__NR_mq_open+5) +#define __NR_kexec_load 283 +#define __NR_waitid 284 +/* #define __NR_sys_setaltroot 285 */ +#define __NR_add_key 286 +#define __NR_request_key 287 +#define __NR_keyctl 288 +#define __NR_ioprio_set 289 +#define __NR_ioprio_get 290 +#define __NR_inotify_init 291 +#define __NR_inotify_add_watch 292 +#define __NR_inotify_rm_watch 293 +#define __NR_migrate_pages 294 +#define __NR_openat 295 +#define __NR_mkdirat 296 +#define __NR_mknodat 297 +#define __NR_fchownat 298 +#define __NR_futimesat 299 +#define __NR_fstatat64 300 +#define __NR_unlinkat 301 +#define __NR_renameat 302 +#define __NR_linkat 303 +#define __NR_symlinkat 304 +#define __NR_readlinkat 305 +#define __NR_fchmodat 306 +#define __NR_faccessat 307 +#define __NR_pselect6 308 +#define __NR_ppoll 309 +#define __NR_unshare 310 +#define __NR_set_robust_list 311 +#define __NR_get_robust_list 312 +#define __NR_splice 313 +#define __NR_sync_file_range 314 +#define __NR_tee 315 +#define __NR_vmsplice 316 +#define __NR_move_pages 317 +#define __NR_getcpu 318 +#define __NR_epoll_pwait 319 +#define __NR_utimensat 320 +#define __NR_signalfd 321 +#define __NR_timerfd_create 322 +#define __NR_eventfd 323 +#define __NR_fallocate 324 +#define __NR_timerfd_settime 325 +#define __NR_timerfd_gettime 326 +#define __NR_signalfd4 327 +#define __NR_eventfd2 328 +#define __NR_epoll_create1 329 +#define __NR_dup3 330 +#define __NR_pipe2 331 +#define __NR_inotify_init1 332 +#define __NR_preadv 333 +#define __NR_pwritev 334 +#define __NR_rt_tgsigqueueinfo 335 +#define __NR_perf_event_open 336 +#define __NR_setns 337 +#ifdef __KERNEL__ #define NR_syscalls 338 @@ -42,4 +385,5 @@ #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") #endif +#endif /* __KERNEL__ */ #endif /* _ASM_UNISTD_H_ */ diff --git a/trunk/arch/frv/include/uapi/asm/Kbuild b/trunk/arch/frv/include/uapi/asm/Kbuild index 42a2b33461c0..baebb3da1d44 100644 --- a/trunk/arch/frv/include/uapi/asm/Kbuild +++ b/trunk/arch/frv/include/uapi/asm/Kbuild @@ -1,35 +1,3 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += auxvec.h -header-y += bitsperlong.h -header-y += byteorder.h -header-y += errno.h -header-y += fcntl.h -header-y += ioctl.h -header-y += ioctls.h -header-y += ipcbuf.h -header-y += kvm_para.h -header-y += mman.h -header-y += msgbuf.h -header-y += param.h -header-y += poll.h -header-y += posix_types.h -header-y += ptrace.h -header-y += registers.h -header-y += resource.h -header-y += sembuf.h -header-y += setup.h -header-y += shmbuf.h -header-y += sigcontext.h -header-y += siginfo.h -header-y += signal.h -header-y += socket.h -header-y += sockios.h -header-y += stat.h -header-y += statfs.h -header-y += swab.h -header-y += termbits.h -header-y += termios.h -header-y += types.h -header-y += unistd.h diff --git a/trunk/arch/frv/include/uapi/asm/ptrace.h b/trunk/arch/frv/include/uapi/asm/ptrace.h deleted file mode 100644 index 3887e4934683..000000000000 --- a/trunk/arch/frv/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ptrace.h: ptrace() relevant definitions - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * 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. - */ -#ifndef _UAPI_ASM_PTRACE_H -#define _UAPI_ASM_PTRACE_H - -#include - - -#define PT_PSR 0 -#define PT_ISR 1 -#define PT_CCR 2 -#define PT_CCCR 3 -#define PT_LR 4 -#define PT_LCR 5 -#define PT_PC 6 - -#define PT__STATUS 7 /* exception status */ -#define PT_SYSCALLNO 8 /* syscall number or -1 */ -#define PT_ORIG_GR8 9 /* saved GR8 for signal handling */ -#define PT_GNER0 10 -#define PT_GNER1 11 -#define PT_IACC0H 12 -#define PT_IACC0L 13 - -#define PT_GR(j) ( 14 + (j)) /* GRj for 0<=j<=63 */ -#define PT_FR(j) ( 78 + (j)) /* FRj for 0<=j<=63 */ -#define PT_FNER(j) (142 + (j)) /* FNERj for 0<=j<=1 */ -#define PT_MSR(j) (144 + (j)) /* MSRj for 0<=j<=2 */ -#define PT_ACC(j) (146 + (j)) /* ACCj for 0<=j<=7 */ -#define PT_ACCG(jklm) (154 + (jklm)) /* ACCGjklm for 0<=jklm<=1 (reads four regs per slot) */ -#define PT_FSR(j) (156 + (j)) /* FSRj for 0<=j<=0 */ -#define PT__GPEND 78 -#define PT__END 157 - -#define PT_TBR PT_GR(0) -#define PT_SP PT_GR(1) -#define PT_FP PT_GR(2) -#define PT_PREV_FRAME PT_GR(28) /* previous exception frame pointer (old gr28 value) */ -#define PT_CURR_TASK PT_GR(29) /* current task */ - - -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 -#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */ - -#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ -#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ - -#endif /* _UAPI_ASM_PTRACE_H */ diff --git a/trunk/arch/frv/include/uapi/asm/setup.h b/trunk/arch/frv/include/uapi/asm/setup.h deleted file mode 100644 index fbf3fc96aae9..000000000000 --- a/trunk/arch/frv/include/uapi/asm/setup.h +++ /dev/null @@ -1,18 +0,0 @@ -/* setup.h: setup stuff - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * 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. - */ - -#ifndef _UAPI_ASM_SETUP_H -#define _UAPI_ASM_SETUP_H - -#define COMMAND_LINE_SIZE 512 - - -#endif /* _UAPI_ASM_SETUP_H */ diff --git a/trunk/arch/frv/include/uapi/asm/signal.h b/trunk/arch/frv/include/uapi/asm/signal.h deleted file mode 100644 index bf3b162f9bea..000000000000 --- a/trunk/arch/frv/include/uapi/asm/signal.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _UAPI_ASM_SIGNAL_H -#define _UAPI_ASM_SIGNAL_H - -#include - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -#define NSIG 32 -typedef unsigned long sigset_t; - -#endif /* !__KERNEL__ */ - -#define SA_RESTORER 0x04000000 /* to get struct sigaction correct */ - -#include - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -struct sigaction { - union { - __sighandler_t _sa_handler; - void (*_sa_sigaction)(int, struct siginfo *, void *); - } _u; - sigset_t sa_mask; - unsigned long sa_flags; - void (*sa_restorer)(void); -}; - -#define sa_handler _u._sa_handler -#define sa_sigaction _u._sa_sigaction - -#endif /* __KERNEL__ */ - -#endif /* _UAPI_ASM_SIGNAL_H */ diff --git a/trunk/arch/frv/include/uapi/asm/termios.h b/trunk/arch/frv/include/uapi/asm/termios.h deleted file mode 100644 index edcc08a22382..000000000000 --- a/trunk/arch/frv/include/uapi/asm/termios.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _UAPI_ASM_TERMIOS_H -#define _UAPI_ASM_TERMIOS_H - -#include -#include - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */ - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - - -#endif /* _UAPI_ASM_TERMIOS_H */ diff --git a/trunk/arch/frv/include/uapi/asm/types.h b/trunk/arch/frv/include/uapi/asm/types.h deleted file mode 100644 index cf23149943f9..000000000000 --- a/trunk/arch/frv/include/uapi/asm/types.h +++ /dev/null @@ -1,11 +0,0 @@ -/* types.h: FRV types - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * 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. - */ -#include diff --git a/trunk/arch/frv/include/uapi/asm/unistd.h b/trunk/arch/frv/include/uapi/asm/unistd.h deleted file mode 100644 index 9e2612ff1c9d..000000000000 --- a/trunk/arch/frv/include/uapi/asm/unistd.h +++ /dev/null @@ -1,348 +0,0 @@ -#ifndef _UAPI_ASM_UNISTD_H_ -#define _UAPI_ASM_UNISTD_H_ - -/* - * This file contains the system call numbers. - */ - -#define __NR_restart_syscall 0 -#define __NR_exit 1 -#define __NR_fork 2 -#define __NR_read 3 -#define __NR_write 4 -#define __NR_open 5 -#define __NR_close 6 -#define __NR_waitpid 7 -#define __NR_creat 8 -#define __NR_link 9 -#define __NR_unlink 10 -#define __NR_execve 11 -#define __NR_chdir 12 -#define __NR_time 13 -#define __NR_mknod 14 -#define __NR_chmod 15 -#define __NR_lchown 16 -#define __NR_break 17 -#define __NR_oldstat 18 -#define __NR_lseek 19 -#define __NR_getpid 20 -#define __NR_mount 21 -#define __NR_umount 22 -#define __NR_setuid 23 -#define __NR_getuid 24 -#define __NR_stime 25 -#define __NR_ptrace 26 -#define __NR_alarm 27 -#define __NR_oldfstat 28 -#define __NR_pause 29 -#define __NR_utime 30 -#define __NR_stty 31 -#define __NR_gtty 32 -#define __NR_access 33 -#define __NR_nice 34 -#define __NR_ftime 35 -#define __NR_sync 36 -#define __NR_kill 37 -#define __NR_rename 38 -#define __NR_mkdir 39 -#define __NR_rmdir 40 -#define __NR_dup 41 -#define __NR_pipe 42 -#define __NR_times 43 -#define __NR_prof 44 -#define __NR_brk 45 -#define __NR_setgid 46 -#define __NR_getgid 47 -#define __NR_signal 48 -#define __NR_geteuid 49 -#define __NR_getegid 50 -#define __NR_acct 51 -#define __NR_umount2 52 -#define __NR_lock 53 -#define __NR_ioctl 54 -#define __NR_fcntl 55 -#define __NR_mpx 56 -#define __NR_setpgid 57 -#define __NR_ulimit 58 -// #define __NR_oldolduname /* 59 */ obsolete -#define __NR_umask 60 -#define __NR_chroot 61 -#define __NR_ustat 62 -#define __NR_dup2 63 -#define __NR_getppid 64 -#define __NR_getpgrp 65 -#define __NR_setsid 66 -#define __NR_sigaction 67 -#define __NR_sgetmask 68 -#define __NR_ssetmask 69 -#define __NR_setreuid 70 -#define __NR_setregid 71 -#define __NR_sigsuspend 72 -#define __NR_sigpending 73 -#define __NR_sethostname 74 -#define __NR_setrlimit 75 -#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ -#define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 -#define __NR_getgroups 80 -#define __NR_setgroups 81 -#define __NR_select 82 -#define __NR_symlink 83 -#define __NR_oldlstat 84 -#define __NR_readlink 85 -#define __NR_uselib 86 -#define __NR_swapon 87 -#define __NR_reboot 88 -#define __NR_readdir 89 -// #define __NR_mmap 90 /* obsolete - not implemented */ -#define __NR_munmap 91 -#define __NR_truncate 92 -#define __NR_ftruncate 93 -#define __NR_fchmod 94 -#define __NR_fchown 95 -#define __NR_getpriority 96 -#define __NR_setpriority 97 -// #define __NR_profil /* 98 */ obsolete -#define __NR_statfs 99 -#define __NR_fstatfs 100 -// #define __NR_ioperm /* 101 */ not supported -#define __NR_socketcall 102 -#define __NR_syslog 103 -#define __NR_setitimer 104 -#define __NR_getitimer 105 -#define __NR_stat 106 -#define __NR_lstat 107 -#define __NR_fstat 108 -// #define __NR_olduname /* 109 */ obsolete -// #define __NR_iopl /* 110 */ not supported -#define __NR_vhangup 111 -// #define __NR_idle /* 112 */ Obsolete -// #define __NR_vm86old /* 113 */ not supported -#define __NR_wait4 114 -#define __NR_swapoff 115 -#define __NR_sysinfo 116 -#define __NR_ipc 117 -#define __NR_fsync 118 -#define __NR_sigreturn 119 -#define __NR_clone 120 -#define __NR_setdomainname 121 -#define __NR_uname 122 -// #define __NR_modify_ldt /* 123 */ not supported -#define __NR_cacheflush 123 -#define __NR_adjtimex 124 -#define __NR_mprotect 125 -#define __NR_sigprocmask 126 -#define __NR_create_module 127 -#define __NR_init_module 128 -#define __NR_delete_module 129 -#define __NR_get_kernel_syms 130 -#define __NR_quotactl 131 -#define __NR_getpgid 132 -#define __NR_fchdir 133 -#define __NR_bdflush 134 -#define __NR_sysfs 135 -#define __NR_personality 136 -#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ -#define __NR_setfsuid 138 -#define __NR_setfsgid 139 -#define __NR__llseek 140 -#define __NR_getdents 141 -#define __NR__newselect 142 -#define __NR_flock 143 -#define __NR_msync 144 -#define __NR_readv 145 -#define __NR_writev 146 -#define __NR_getsid 147 -#define __NR_fdatasync 148 -#define __NR__sysctl 149 -#define __NR_mlock 150 -#define __NR_munlock 151 -#define __NR_mlockall 152 -#define __NR_munlockall 153 -#define __NR_sched_setparam 154 -#define __NR_sched_getparam 155 -#define __NR_sched_setscheduler 156 -#define __NR_sched_getscheduler 157 -#define __NR_sched_yield 158 -#define __NR_sched_get_priority_max 159 -#define __NR_sched_get_priority_min 160 -#define __NR_sched_rr_get_interval 161 -#define __NR_nanosleep 162 -#define __NR_mremap 163 -#define __NR_setresuid 164 -#define __NR_getresuid 165 -// #define __NR_vm86 /* 166 */ not supported -#define __NR_query_module 167 -#define __NR_poll 168 -#define __NR_nfsservctl 169 -#define __NR_setresgid 170 -#define __NR_getresgid 171 -#define __NR_prctl 172 -#define __NR_rt_sigreturn 173 -#define __NR_rt_sigaction 174 -#define __NR_rt_sigprocmask 175 -#define __NR_rt_sigpending 176 -#define __NR_rt_sigtimedwait 177 -#define __NR_rt_sigqueueinfo 178 -#define __NR_rt_sigsuspend 179 -#define __NR_pread64 180 -#define __NR_pwrite64 181 -#define __NR_chown 182 -#define __NR_getcwd 183 -#define __NR_capget 184 -#define __NR_capset 185 -#define __NR_sigaltstack 186 -#define __NR_sendfile 187 -#define __NR_getpmsg 188 /* some people actually want streams */ -#define __NR_putpmsg 189 /* some people actually want streams */ -#define __NR_vfork 190 -#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ -#define __NR_mmap2 192 -#define __NR_truncate64 193 -#define __NR_ftruncate64 194 -#define __NR_stat64 195 -#define __NR_lstat64 196 -#define __NR_fstat64 197 -#define __NR_lchown32 198 -#define __NR_getuid32 199 -#define __NR_getgid32 200 -#define __NR_geteuid32 201 -#define __NR_getegid32 202 -#define __NR_setreuid32 203 -#define __NR_setregid32 204 -#define __NR_getgroups32 205 -#define __NR_setgroups32 206 -#define __NR_fchown32 207 -#define __NR_setresuid32 208 -#define __NR_getresuid32 209 -#define __NR_setresgid32 210 -#define __NR_getresgid32 211 -#define __NR_chown32 212 -#define __NR_setuid32 213 -#define __NR_setgid32 214 -#define __NR_setfsuid32 215 -#define __NR_setfsgid32 216 -#define __NR_pivot_root 217 -#define __NR_mincore 218 -#define __NR_madvise 219 - -#define __NR_getdents64 220 -#define __NR_fcntl64 221 -#define __NR_security 223 /* syscall for security modules */ -#define __NR_gettid 224 -#define __NR_readahead 225 -#define __NR_setxattr 226 -#define __NR_lsetxattr 227 -#define __NR_fsetxattr 228 -#define __NR_getxattr 229 -#define __NR_lgetxattr 230 -#define __NR_fgetxattr 231 -#define __NR_listxattr 232 -#define __NR_llistxattr 233 -#define __NR_flistxattr 234 -#define __NR_removexattr 235 -#define __NR_lremovexattr 236 -#define __NR_fremovexattr 237 -#define __NR_tkill 238 -#define __NR_sendfile64 239 -#define __NR_futex 240 -#define __NR_sched_setaffinity 241 -#define __NR_sched_getaffinity 242 -#define __NR_set_thread_area 243 -#define __NR_get_thread_area 244 -#define __NR_io_setup 245 -#define __NR_io_destroy 246 -#define __NR_io_getevents 247 -#define __NR_io_submit 248 -#define __NR_io_cancel 249 -#define __NR_fadvise64 250 - -#define __NR_exit_group 252 -#define __NR_lookup_dcookie 253 -#define __NR_epoll_create 254 -#define __NR_epoll_ctl 255 -#define __NR_epoll_wait 256 -#define __NR_remap_file_pages 257 -#define __NR_set_tid_address 258 -#define __NR_timer_create 259 -#define __NR_timer_settime (__NR_timer_create+1) -#define __NR_timer_gettime (__NR_timer_create+2) -#define __NR_timer_getoverrun (__NR_timer_create+3) -#define __NR_timer_delete (__NR_timer_create+4) -#define __NR_clock_settime (__NR_timer_create+5) -#define __NR_clock_gettime (__NR_timer_create+6) -#define __NR_clock_getres (__NR_timer_create+7) -#define __NR_clock_nanosleep (__NR_timer_create+8) -#define __NR_statfs64 268 -#define __NR_fstatfs64 269 -#define __NR_tgkill 270 -#define __NR_utimes 271 -#define __NR_fadvise64_64 272 -#define __NR_vserver 273 -#define __NR_mbind 274 -#define __NR_get_mempolicy 275 -#define __NR_set_mempolicy 276 -#define __NR_mq_open 277 -#define __NR_mq_unlink (__NR_mq_open+1) -#define __NR_mq_timedsend (__NR_mq_open+2) -#define __NR_mq_timedreceive (__NR_mq_open+3) -#define __NR_mq_notify (__NR_mq_open+4) -#define __NR_mq_getsetattr (__NR_mq_open+5) -#define __NR_kexec_load 283 -#define __NR_waitid 284 -/* #define __NR_sys_setaltroot 285 */ -#define __NR_add_key 286 -#define __NR_request_key 287 -#define __NR_keyctl 288 -#define __NR_ioprio_set 289 -#define __NR_ioprio_get 290 -#define __NR_inotify_init 291 -#define __NR_inotify_add_watch 292 -#define __NR_inotify_rm_watch 293 -#define __NR_migrate_pages 294 -#define __NR_openat 295 -#define __NR_mkdirat 296 -#define __NR_mknodat 297 -#define __NR_fchownat 298 -#define __NR_futimesat 299 -#define __NR_fstatat64 300 -#define __NR_unlinkat 301 -#define __NR_renameat 302 -#define __NR_linkat 303 -#define __NR_symlinkat 304 -#define __NR_readlinkat 305 -#define __NR_fchmodat 306 -#define __NR_faccessat 307 -#define __NR_pselect6 308 -#define __NR_ppoll 309 -#define __NR_unshare 310 -#define __NR_set_robust_list 311 -#define __NR_get_robust_list 312 -#define __NR_splice 313 -#define __NR_sync_file_range 314 -#define __NR_tee 315 -#define __NR_vmsplice 316 -#define __NR_move_pages 317 -#define __NR_getcpu 318 -#define __NR_epoll_pwait 319 -#define __NR_utimensat 320 -#define __NR_signalfd 321 -#define __NR_timerfd_create 322 -#define __NR_eventfd 323 -#define __NR_fallocate 324 -#define __NR_timerfd_settime 325 -#define __NR_timerfd_gettime 326 -#define __NR_signalfd4 327 -#define __NR_eventfd2 328 -#define __NR_epoll_create1 329 -#define __NR_dup3 330 -#define __NR_pipe2 331 -#define __NR_inotify_init1 332 -#define __NR_preadv 333 -#define __NR_pwritev 334 -#define __NR_rt_tgsigqueueinfo 335 -#define __NR_perf_event_open 336 -#define __NR_setns 337 - -#endif /* _UAPI_ASM_UNISTD_H_ */ diff --git a/trunk/arch/h8300/kernel/process.c b/trunk/arch/h8300/kernel/process.c index e8dc1393a13a..f153ed1a4c08 100644 --- a/trunk/arch/h8300/kernel/process.c +++ b/trunk/arch/h8300/kernel/process.c @@ -217,14 +217,14 @@ asmlinkage int sys_execve(const char *name, int dummy, ...) { int error; - struct filename *filename; + char * filename; struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy-4); filename = getname(name); error = PTR_ERR(filename); if (IS_ERR(filename)) return error; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); return error; } diff --git a/trunk/arch/hexagon/kernel/syscall.c b/trunk/arch/hexagon/kernel/syscall.c index 25a9bfe3445d..553cd60ee659 100644 --- a/trunk/arch/hexagon/kernel/syscall.c +++ b/trunk/arch/hexagon/kernel/syscall.c @@ -40,7 +40,7 @@ asmlinkage int sys_execve(char __user *ufilename, const char __user *const __user *envp) { struct pt_regs *pregs = current_thread_info()->regs; - struct filename *filename; + char *filename; int retval; filename = getname(ufilename); @@ -48,7 +48,7 @@ asmlinkage int sys_execve(char __user *ufilename, if (IS_ERR(filename)) return retval; - retval = do_execve(filename->name, argv, envp, pregs); + retval = do_execve(filename, argv, envp, pregs); putname(filename); return retval; diff --git a/trunk/arch/ia64/include/asm/Kbuild b/trunk/arch/ia64/include/asm/Kbuild index 4a159da23633..562f59315847 100644 --- a/trunk/arch/ia64/include/asm/Kbuild +++ b/trunk/arch/ia64/include/asm/Kbuild @@ -1,3 +1,17 @@ +include include/asm-generic/Kbuild.asm +header-y += break.h +header-y += cmpxchg.h +header-y += fpu.h +header-y += gcc_intrin.h +header-y += ia64regs.h +header-y += intel_intrin.h +header-y += intrinsics.h +header-y += perfmon.h +header-y += perfmon_default_smpl.h +header-y += ptrace_offsets.h +header-y += rse.h +header-y += ucontext.h +header-y += ustack.h generic-y += clkdev.h generic-y += exec.h diff --git a/trunk/arch/ia64/include/uapi/asm/auxvec.h b/trunk/arch/ia64/include/asm/auxvec.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/auxvec.h rename to trunk/arch/ia64/include/asm/auxvec.h diff --git a/trunk/arch/ia64/include/uapi/asm/bitsperlong.h b/trunk/arch/ia64/include/asm/bitsperlong.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/bitsperlong.h rename to trunk/arch/ia64/include/asm/bitsperlong.h diff --git a/trunk/arch/ia64/include/uapi/asm/break.h b/trunk/arch/ia64/include/asm/break.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/break.h rename to trunk/arch/ia64/include/asm/break.h diff --git a/trunk/arch/ia64/include/uapi/asm/byteorder.h b/trunk/arch/ia64/include/asm/byteorder.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/byteorder.h rename to trunk/arch/ia64/include/asm/byteorder.h diff --git a/trunk/arch/ia64/include/uapi/asm/cmpxchg.h b/trunk/arch/ia64/include/asm/cmpxchg.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/cmpxchg.h rename to trunk/arch/ia64/include/asm/cmpxchg.h diff --git a/trunk/arch/ia64/include/uapi/asm/errno.h b/trunk/arch/ia64/include/asm/errno.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/errno.h rename to trunk/arch/ia64/include/asm/errno.h diff --git a/trunk/arch/ia64/include/uapi/asm/fcntl.h b/trunk/arch/ia64/include/asm/fcntl.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/fcntl.h rename to trunk/arch/ia64/include/asm/fcntl.h diff --git a/trunk/arch/ia64/include/uapi/asm/fpu.h b/trunk/arch/ia64/include/asm/fpu.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/fpu.h rename to trunk/arch/ia64/include/asm/fpu.h diff --git a/trunk/arch/ia64/include/asm/gcc_intrin.h b/trunk/arch/ia64/include/asm/gcc_intrin.h index f9495b1757a8..21ddee54adae 100644 --- a/trunk/arch/ia64/include/asm/gcc_intrin.h +++ b/trunk/arch/ia64/include/asm/gcc_intrin.h @@ -1,12 +1,621 @@ +#ifndef _ASM_IA64_GCC_INTRIN_H +#define _ASM_IA64_GCC_INTRIN_H /* * * Copyright (C) 2002,2003 Jun Nakajima * Copyright (C) 2002,2003 Suresh Siddha */ -#ifndef _ASM_IA64_GCC_INTRIN_H -#define _ASM_IA64_GCC_INTRIN_H -#include +#include +#include + +/* define this macro to get some asm stmts included in 'c' files */ +#define ASM_SUPPORTED + +/* Optimization barrier */ +/* The "volatile" is due to gcc bugs */ +#define ia64_barrier() asm volatile ("":::"memory") + +#define ia64_stop() asm volatile (";;"::) + +#define ia64_invala_gr(regnum) asm volatile ("invala.e r%0" :: "i"(regnum)) + +#define ia64_invala_fr(regnum) asm volatile ("invala.e f%0" :: "i"(regnum)) + +#define ia64_flushrs() asm volatile ("flushrs;;":::"memory") + +#define ia64_loadrs() asm volatile ("loadrs;;":::"memory") + +extern void ia64_bad_param_for_setreg (void); +extern void ia64_bad_param_for_getreg (void); +#ifdef __KERNEL__ register unsigned long ia64_r13 asm ("r13") __used; +#endif + +#define ia64_native_setreg(regnum, val) \ +({ \ + switch (regnum) { \ + case _IA64_REG_PSR_L: \ + asm volatile ("mov psr.l=%0" :: "r"(val) : "memory"); \ + break; \ + case _IA64_REG_AR_KR0 ... _IA64_REG_AR_EC: \ + asm volatile ("mov ar%0=%1" :: \ + "i" (regnum - _IA64_REG_AR_KR0), \ + "r"(val): "memory"); \ + break; \ + case _IA64_REG_CR_DCR ... _IA64_REG_CR_LRR1: \ + asm volatile ("mov cr%0=%1" :: \ + "i" (regnum - _IA64_REG_CR_DCR), \ + "r"(val): "memory" ); \ + break; \ + case _IA64_REG_SP: \ + asm volatile ("mov r12=%0" :: \ + "r"(val): "memory"); \ + break; \ + case _IA64_REG_GP: \ + asm volatile ("mov gp=%0" :: "r"(val) : "memory"); \ + break; \ + default: \ + ia64_bad_param_for_setreg(); \ + break; \ + } \ +}) + +#define ia64_native_getreg(regnum) \ +({ \ + __u64 ia64_intri_res; \ + \ + switch (regnum) { \ + case _IA64_REG_GP: \ + asm volatile ("mov %0=gp" : "=r"(ia64_intri_res)); \ + break; \ + case _IA64_REG_IP: \ + asm volatile ("mov %0=ip" : "=r"(ia64_intri_res)); \ + break; \ + case _IA64_REG_PSR: \ + asm volatile ("mov %0=psr" : "=r"(ia64_intri_res)); \ + break; \ + case _IA64_REG_TP: /* for current() */ \ + ia64_intri_res = ia64_r13; \ + break; \ + case _IA64_REG_AR_KR0 ... _IA64_REG_AR_EC: \ + asm volatile ("mov %0=ar%1" : "=r" (ia64_intri_res) \ + : "i"(regnum - _IA64_REG_AR_KR0)); \ + break; \ + case _IA64_REG_CR_DCR ... _IA64_REG_CR_LRR1: \ + asm volatile ("mov %0=cr%1" : "=r" (ia64_intri_res) \ + : "i" (regnum - _IA64_REG_CR_DCR)); \ + break; \ + case _IA64_REG_SP: \ + asm volatile ("mov %0=sp" : "=r" (ia64_intri_res)); \ + break; \ + default: \ + ia64_bad_param_for_getreg(); \ + break; \ + } \ + ia64_intri_res; \ +}) + +#define ia64_hint_pause 0 + +#define ia64_hint(mode) \ +({ \ + switch (mode) { \ + case ia64_hint_pause: \ + asm volatile ("hint @pause" ::: "memory"); \ + break; \ + } \ +}) + + +/* Integer values for mux1 instruction */ +#define ia64_mux1_brcst 0 +#define ia64_mux1_mix 8 +#define ia64_mux1_shuf 9 +#define ia64_mux1_alt 10 +#define ia64_mux1_rev 11 + +#define ia64_mux1(x, mode) \ +({ \ + __u64 ia64_intri_res; \ + \ + switch (mode) { \ + case ia64_mux1_brcst: \ + asm ("mux1 %0=%1,@brcst" : "=r" (ia64_intri_res) : "r" (x)); \ + break; \ + case ia64_mux1_mix: \ + asm ("mux1 %0=%1,@mix" : "=r" (ia64_intri_res) : "r" (x)); \ + break; \ + case ia64_mux1_shuf: \ + asm ("mux1 %0=%1,@shuf" : "=r" (ia64_intri_res) : "r" (x)); \ + break; \ + case ia64_mux1_alt: \ + asm ("mux1 %0=%1,@alt" : "=r" (ia64_intri_res) : "r" (x)); \ + break; \ + case ia64_mux1_rev: \ + asm ("mux1 %0=%1,@rev" : "=r" (ia64_intri_res) : "r" (x)); \ + break; \ + } \ + ia64_intri_res; \ +}) + +#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# define ia64_popcnt(x) __builtin_popcountl(x) +#else +# define ia64_popcnt(x) \ + ({ \ + __u64 ia64_intri_res; \ + asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \ + \ + ia64_intri_res; \ + }) +#endif + +#define ia64_getf_exp(x) \ +({ \ + long ia64_intri_res; \ + \ + asm ("getf.exp %0=%1" : "=r"(ia64_intri_res) : "f"(x)); \ + \ + ia64_intri_res; \ +}) + +#define ia64_shrp(a, b, count) \ +({ \ + __u64 ia64_intri_res; \ + asm ("shrp %0=%1,%2,%3" : "=r"(ia64_intri_res) : "r"(a), "r"(b), "i"(count)); \ + ia64_intri_res; \ +}) + +#define ia64_ldfs(regnum, x) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("ldfs %0=[%1]" :"=f"(__f__): "r"(x)); \ +}) + +#define ia64_ldfd(regnum, x) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("ldfd %0=[%1]" :"=f"(__f__): "r"(x)); \ +}) + +#define ia64_ldfe(regnum, x) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("ldfe %0=[%1]" :"=f"(__f__): "r"(x)); \ +}) + +#define ia64_ldf8(regnum, x) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("ldf8 %0=[%1]" :"=f"(__f__): "r"(x)); \ +}) + +#define ia64_ldf_fill(regnum, x) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("ldf.fill %0=[%1]" :"=f"(__f__): "r"(x)); \ +}) + +#define ia64_st4_rel_nta(m, val) \ +({ \ + asm volatile ("st4.rel.nta [%0] = %1\n\t" :: "r"(m), "r"(val)); \ +}) + +#define ia64_stfs(x, regnum) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("stfs [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ +}) + +#define ia64_stfd(x, regnum) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("stfd [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ +}) + +#define ia64_stfe(x, regnum) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("stfe [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ +}) + +#define ia64_stf8(x, regnum) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("stf8 [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ +}) + +#define ia64_stf_spill(x, regnum) \ +({ \ + register double __f__ asm ("f"#regnum); \ + asm volatile ("stf.spill [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ +}) + +#define ia64_fetchadd4_acq(p, inc) \ +({ \ + \ + __u64 ia64_intri_res; \ + asm volatile ("fetchadd4.acq %0=[%1],%2" \ + : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \ + : "memory"); \ + \ + ia64_intri_res; \ +}) + +#define ia64_fetchadd4_rel(p, inc) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("fetchadd4.rel %0=[%1],%2" \ + : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \ + : "memory"); \ + \ + ia64_intri_res; \ +}) + +#define ia64_fetchadd8_acq(p, inc) \ +({ \ + \ + __u64 ia64_intri_res; \ + asm volatile ("fetchadd8.acq %0=[%1],%2" \ + : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \ + : "memory"); \ + \ + ia64_intri_res; \ +}) + +#define ia64_fetchadd8_rel(p, inc) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("fetchadd8.rel %0=[%1],%2" \ + : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \ + : "memory"); \ + \ + ia64_intri_res; \ +}) + +#define ia64_xchg1(ptr,x) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("xchg1 %0=[%1],%2" \ + : "=r" (ia64_intri_res) : "r" (ptr), "r" (x) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_xchg2(ptr,x) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("xchg2 %0=[%1],%2" : "=r" (ia64_intri_res) \ + : "r" (ptr), "r" (x) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_xchg4(ptr,x) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("xchg4 %0=[%1],%2" : "=r" (ia64_intri_res) \ + : "r" (ptr), "r" (x) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_xchg8(ptr,x) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("xchg8 %0=[%1],%2" : "=r" (ia64_intri_res) \ + : "r" (ptr), "r" (x) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_cmpxchg1_acq(ptr, new, old) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ + asm volatile ("cmpxchg1.acq %0=[%1],%2,ar.ccv": \ + "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_cmpxchg1_rel(ptr, new, old) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ + asm volatile ("cmpxchg1.rel %0=[%1],%2,ar.ccv": \ + "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_cmpxchg2_acq(ptr, new, old) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ + asm volatile ("cmpxchg2.acq %0=[%1],%2,ar.ccv": \ + "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_cmpxchg2_rel(ptr, new, old) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ + \ + asm volatile ("cmpxchg2.rel %0=[%1],%2,ar.ccv": \ + "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_cmpxchg4_acq(ptr, new, old) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ + asm volatile ("cmpxchg4.acq %0=[%1],%2,ar.ccv": \ + "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_cmpxchg4_rel(ptr, new, old) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ + asm volatile ("cmpxchg4.rel %0=[%1],%2,ar.ccv": \ + "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_cmpxchg8_acq(ptr, new, old) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ + asm volatile ("cmpxchg8.acq %0=[%1],%2,ar.ccv": \ + "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_cmpxchg8_rel(ptr, new, old) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ + \ + asm volatile ("cmpxchg8.rel %0=[%1],%2,ar.ccv": \ + "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ + ia64_intri_res; \ +}) + +#define ia64_mf() asm volatile ("mf" ::: "memory") +#define ia64_mfa() asm volatile ("mf.a" ::: "memory") + +#define ia64_invala() asm volatile ("invala" ::: "memory") + +#define ia64_native_thash(addr) \ +({ \ + unsigned long ia64_intri_res; \ + asm volatile ("thash %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \ + ia64_intri_res; \ +}) + +#define ia64_srlz_i() asm volatile (";; srlz.i ;;" ::: "memory") +#define ia64_srlz_d() asm volatile (";; srlz.d" ::: "memory"); + +#ifdef HAVE_SERIALIZE_DIRECTIVE +# define ia64_dv_serialize_data() asm volatile (".serialize.data"); +# define ia64_dv_serialize_instruction() asm volatile (".serialize.instruction"); +#else +# define ia64_dv_serialize_data() +# define ia64_dv_serialize_instruction() +#endif + +#define ia64_nop(x) asm volatile ("nop %0"::"i"(x)); + +#define ia64_itci(addr) asm volatile ("itc.i %0;;" :: "r"(addr) : "memory") + +#define ia64_itcd(addr) asm volatile ("itc.d %0;;" :: "r"(addr) : "memory") + + +#define ia64_itri(trnum, addr) asm volatile ("itr.i itr[%0]=%1" \ + :: "r"(trnum), "r"(addr) : "memory") + +#define ia64_itrd(trnum, addr) asm volatile ("itr.d dtr[%0]=%1" \ + :: "r"(trnum), "r"(addr) : "memory") + +#define ia64_tpa(addr) \ +({ \ + unsigned long ia64_pa; \ + asm volatile ("tpa %0 = %1" : "=r"(ia64_pa) : "r"(addr) : "memory"); \ + ia64_pa; \ +}) + +#define __ia64_set_dbr(index, val) \ + asm volatile ("mov dbr[%0]=%1" :: "r"(index), "r"(val) : "memory") + +#define ia64_set_ibr(index, val) \ + asm volatile ("mov ibr[%0]=%1" :: "r"(index), "r"(val) : "memory") + +#define ia64_set_pkr(index, val) \ + asm volatile ("mov pkr[%0]=%1" :: "r"(index), "r"(val) : "memory") + +#define ia64_set_pmc(index, val) \ + asm volatile ("mov pmc[%0]=%1" :: "r"(index), "r"(val) : "memory") + +#define ia64_set_pmd(index, val) \ + asm volatile ("mov pmd[%0]=%1" :: "r"(index), "r"(val) : "memory") + +#define ia64_native_set_rr(index, val) \ + asm volatile ("mov rr[%0]=%1" :: "r"(index), "r"(val) : "memory"); + +#define ia64_native_get_cpuid(index) \ +({ \ + unsigned long ia64_intri_res; \ + asm volatile ("mov %0=cpuid[%r1]" : "=r"(ia64_intri_res) : "rO"(index)); \ + ia64_intri_res; \ +}) + +#define __ia64_get_dbr(index) \ +({ \ + unsigned long ia64_intri_res; \ + asm volatile ("mov %0=dbr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ + ia64_intri_res; \ +}) + +#define ia64_get_ibr(index) \ +({ \ + unsigned long ia64_intri_res; \ + asm volatile ("mov %0=ibr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ + ia64_intri_res; \ +}) + +#define ia64_get_pkr(index) \ +({ \ + unsigned long ia64_intri_res; \ + asm volatile ("mov %0=pkr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ + ia64_intri_res; \ +}) + +#define ia64_get_pmc(index) \ +({ \ + unsigned long ia64_intri_res; \ + asm volatile ("mov %0=pmc[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ + ia64_intri_res; \ +}) + + +#define ia64_native_get_pmd(index) \ +({ \ + unsigned long ia64_intri_res; \ + asm volatile ("mov %0=pmd[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ + ia64_intri_res; \ +}) + +#define ia64_native_get_rr(index) \ +({ \ + unsigned long ia64_intri_res; \ + asm volatile ("mov %0=rr[%1]" : "=r"(ia64_intri_res) : "r" (index)); \ + ia64_intri_res; \ +}) + +#define ia64_native_fc(addr) asm volatile ("fc %0" :: "r"(addr) : "memory") + + +#define ia64_sync_i() asm volatile (";; sync.i" ::: "memory") + +#define ia64_native_ssm(mask) asm volatile ("ssm %0":: "i"((mask)) : "memory") +#define ia64_native_rsm(mask) asm volatile ("rsm %0":: "i"((mask)) : "memory") +#define ia64_sum(mask) asm volatile ("sum %0":: "i"((mask)) : "memory") +#define ia64_rum(mask) asm volatile ("rum %0":: "i"((mask)) : "memory") + +#define ia64_ptce(addr) asm volatile ("ptc.e %0" :: "r"(addr)) + +#define ia64_native_ptcga(addr, size) \ +do { \ + asm volatile ("ptc.ga %0,%1" :: "r"(addr), "r"(size) : "memory"); \ + ia64_dv_serialize_data(); \ +} while (0) + +#define ia64_ptcl(addr, size) \ +do { \ + asm volatile ("ptc.l %0,%1" :: "r"(addr), "r"(size) : "memory"); \ + ia64_dv_serialize_data(); \ +} while (0) + +#define ia64_ptri(addr, size) \ + asm volatile ("ptr.i %0,%1" :: "r"(addr), "r"(size) : "memory") + +#define ia64_ptrd(addr, size) \ + asm volatile ("ptr.d %0,%1" :: "r"(addr), "r"(size) : "memory") + +#define ia64_ttag(addr) \ +({ \ + __u64 ia64_intri_res; \ + asm volatile ("ttag %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \ + ia64_intri_res; \ +}) + + +/* Values for lfhint in ia64_lfetch and ia64_lfetch_fault */ + +#define ia64_lfhint_none 0 +#define ia64_lfhint_nt1 1 +#define ia64_lfhint_nt2 2 +#define ia64_lfhint_nta 3 + +#define ia64_lfetch(lfhint, y) \ +({ \ + switch (lfhint) { \ + case ia64_lfhint_none: \ + asm volatile ("lfetch [%0]" : : "r"(y)); \ + break; \ + case ia64_lfhint_nt1: \ + asm volatile ("lfetch.nt1 [%0]" : : "r"(y)); \ + break; \ + case ia64_lfhint_nt2: \ + asm volatile ("lfetch.nt2 [%0]" : : "r"(y)); \ + break; \ + case ia64_lfhint_nta: \ + asm volatile ("lfetch.nta [%0]" : : "r"(y)); \ + break; \ + } \ +}) + +#define ia64_lfetch_excl(lfhint, y) \ +({ \ + switch (lfhint) { \ + case ia64_lfhint_none: \ + asm volatile ("lfetch.excl [%0]" :: "r"(y)); \ + break; \ + case ia64_lfhint_nt1: \ + asm volatile ("lfetch.excl.nt1 [%0]" :: "r"(y)); \ + break; \ + case ia64_lfhint_nt2: \ + asm volatile ("lfetch.excl.nt2 [%0]" :: "r"(y)); \ + break; \ + case ia64_lfhint_nta: \ + asm volatile ("lfetch.excl.nta [%0]" :: "r"(y)); \ + break; \ + } \ +}) + +#define ia64_lfetch_fault(lfhint, y) \ +({ \ + switch (lfhint) { \ + case ia64_lfhint_none: \ + asm volatile ("lfetch.fault [%0]" : : "r"(y)); \ + break; \ + case ia64_lfhint_nt1: \ + asm volatile ("lfetch.fault.nt1 [%0]" : : "r"(y)); \ + break; \ + case ia64_lfhint_nt2: \ + asm volatile ("lfetch.fault.nt2 [%0]" : : "r"(y)); \ + break; \ + case ia64_lfhint_nta: \ + asm volatile ("lfetch.fault.nta [%0]" : : "r"(y)); \ + break; \ + } \ +}) + +#define ia64_lfetch_fault_excl(lfhint, y) \ +({ \ + switch (lfhint) { \ + case ia64_lfhint_none: \ + asm volatile ("lfetch.fault.excl [%0]" :: "r"(y)); \ + break; \ + case ia64_lfhint_nt1: \ + asm volatile ("lfetch.fault.excl.nt1 [%0]" :: "r"(y)); \ + break; \ + case ia64_lfhint_nt2: \ + asm volatile ("lfetch.fault.excl.nt2 [%0]" :: "r"(y)); \ + break; \ + case ia64_lfhint_nta: \ + asm volatile ("lfetch.fault.excl.nta [%0]" :: "r"(y)); \ + break; \ + } \ +}) + +#define ia64_native_intrin_local_irq_restore(x) \ +do { \ + asm volatile (";; cmp.ne p6,p7=%0,r0;;" \ + "(p6) ssm psr.i;" \ + "(p7) rsm psr.i;;" \ + "(p6) srlz.d" \ + :: "r"((x)) : "p6", "p7", "memory"); \ +} while (0) + #endif /* _ASM_IA64_GCC_INTRIN_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/ia64regs.h b/trunk/arch/ia64/include/asm/ia64regs.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/ia64regs.h rename to trunk/arch/ia64/include/asm/ia64regs.h diff --git a/trunk/arch/ia64/include/uapi/asm/intel_intrin.h b/trunk/arch/ia64/include/asm/intel_intrin.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/intel_intrin.h rename to trunk/arch/ia64/include/asm/intel_intrin.h diff --git a/trunk/arch/ia64/include/asm/intrinsics.h b/trunk/arch/ia64/include/asm/intrinsics.h index 20477ea111ba..d129e367e764 100644 --- a/trunk/arch/ia64/include/asm/intrinsics.h +++ b/trunk/arch/ia64/include/asm/intrinsics.h @@ -1,16 +1,99 @@ +#ifndef _ASM_IA64_INTRINSICS_H +#define _ASM_IA64_INTRINSICS_H + /* * Compiler-dependent intrinsics. * * Copyright (C) 2002-2003 Hewlett-Packard Co * David Mosberger-Tang */ -#ifndef _ASM_IA64_INTRINSICS_H -#define _ASM_IA64_INTRINSICS_H +#ifndef __ASSEMBLY__ + +#include +/* include compiler specific intrinsics */ +#include +#ifdef __INTEL_COMPILER +# include +#else +# include +#endif +#include + +#define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I) + +#define ia64_native_set_rr0_to_rr4(val0, val1, val2, val3, val4) \ +do { \ + ia64_native_set_rr(0x0000000000000000UL, (val0)); \ + ia64_native_set_rr(0x2000000000000000UL, (val1)); \ + ia64_native_set_rr(0x4000000000000000UL, (val2)); \ + ia64_native_set_rr(0x6000000000000000UL, (val3)); \ + ia64_native_set_rr(0x8000000000000000UL, (val4)); \ +} while (0) + +/* + * Force an unresolved reference if someone tries to use + * ia64_fetch_and_add() with a bad value. + */ +extern unsigned long __bad_size_for_ia64_fetch_and_add (void); +extern unsigned long __bad_increment_for_ia64_fetch_and_add (void); + +#define IA64_FETCHADD(tmp,v,n,sz,sem) \ +({ \ + switch (sz) { \ + case 4: \ + tmp = ia64_fetchadd4_##sem((unsigned int *) v, n); \ + break; \ + \ + case 8: \ + tmp = ia64_fetchadd8_##sem((unsigned long *) v, n); \ + break; \ + \ + default: \ + __bad_size_for_ia64_fetch_and_add(); \ + } \ +}) + +#define ia64_fetchadd(i,v,sem) \ +({ \ + __u64 _tmp; \ + volatile __typeof__(*(v)) *_v = (v); \ + /* Can't use a switch () here: gcc isn't always smart enough for that... */ \ + if ((i) == -16) \ + IA64_FETCHADD(_tmp, _v, -16, sizeof(*(v)), sem); \ + else if ((i) == -8) \ + IA64_FETCHADD(_tmp, _v, -8, sizeof(*(v)), sem); \ + else if ((i) == -4) \ + IA64_FETCHADD(_tmp, _v, -4, sizeof(*(v)), sem); \ + else if ((i) == -1) \ + IA64_FETCHADD(_tmp, _v, -1, sizeof(*(v)), sem); \ + else if ((i) == 1) \ + IA64_FETCHADD(_tmp, _v, 1, sizeof(*(v)), sem); \ + else if ((i) == 4) \ + IA64_FETCHADD(_tmp, _v, 4, sizeof(*(v)), sem); \ + else if ((i) == 8) \ + IA64_FETCHADD(_tmp, _v, 8, sizeof(*(v)), sem); \ + else if ((i) == 16) \ + IA64_FETCHADD(_tmp, _v, 16, sizeof(*(v)), sem); \ + else \ + _tmp = __bad_increment_for_ia64_fetch_and_add(); \ + (__typeof__(*(v))) (_tmp); /* return old value */ \ +}) + +#define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */ + +#endif + +#ifdef __KERNEL__ #include -#include +#endif #ifndef __ASSEMBLY__ + +#define IA64_INTRINSIC_API(name) ia64_native_ ## name +#define IA64_INTRINSIC_MACRO(name) ia64_native_ ## name + +#if defined(__KERNEL__) #if defined(CONFIG_PARAVIRT) # undef IA64_INTRINSIC_API # undef IA64_INTRINSIC_MACRO @@ -21,5 +104,36 @@ # endif #define IA64_INTRINSIC_MACRO(name) paravirt_ ## name #endif +#endif + +/************************************************/ +/* Instructions paravirtualized for correctness */ +/************************************************/ +/* fc, thash, get_cpuid, get_pmd, get_eflags, set_eflags */ +/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag" + * is not currently used (though it may be in a long-format VHPT system!) + */ +#define ia64_fc IA64_INTRINSIC_API(fc) +#define ia64_thash IA64_INTRINSIC_API(thash) +#define ia64_get_cpuid IA64_INTRINSIC_API(get_cpuid) +#define ia64_get_pmd IA64_INTRINSIC_API(get_pmd) + + +/************************************************/ +/* Instructions paravirtualized for performance */ +/************************************************/ +#define ia64_ssm IA64_INTRINSIC_MACRO(ssm) +#define ia64_rsm IA64_INTRINSIC_MACRO(rsm) +#define ia64_getreg IA64_INTRINSIC_MACRO(getreg) +#define ia64_setreg IA64_INTRINSIC_API(setreg) +#define ia64_set_rr IA64_INTRINSIC_API(set_rr) +#define ia64_get_rr IA64_INTRINSIC_API(get_rr) +#define ia64_ptcga IA64_INTRINSIC_API(ptcga) +#define ia64_get_psr_i IA64_INTRINSIC_API(get_psr_i) +#define ia64_intrin_local_irq_restore \ + IA64_INTRINSIC_API(intrin_local_irq_restore) +#define ia64_set_rr0_to_rr4 IA64_INTRINSIC_API(set_rr0_to_rr4) + #endif /* !__ASSEMBLY__ */ + #endif /* _ASM_IA64_INTRINSICS_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/ioctl.h b/trunk/arch/ia64/include/asm/ioctl.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/ioctl.h rename to trunk/arch/ia64/include/asm/ioctl.h diff --git a/trunk/arch/ia64/include/uapi/asm/ioctls.h b/trunk/arch/ia64/include/asm/ioctls.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/ioctls.h rename to trunk/arch/ia64/include/asm/ioctls.h diff --git a/trunk/arch/ia64/include/uapi/asm/ipcbuf.h b/trunk/arch/ia64/include/asm/ipcbuf.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/ipcbuf.h rename to trunk/arch/ia64/include/asm/ipcbuf.h diff --git a/trunk/arch/ia64/include/uapi/asm/kvm.h b/trunk/arch/ia64/include/asm/kvm.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/kvm.h rename to trunk/arch/ia64/include/asm/kvm.h diff --git a/trunk/arch/ia64/include/asm/kvm_para.h b/trunk/arch/ia64/include/asm/kvm_para.h index 47c00f910434..2019cb99335e 100644 --- a/trunk/arch/ia64/include/asm/kvm_para.h +++ b/trunk/arch/ia64/include/asm/kvm_para.h @@ -1,3 +1,6 @@ +#ifndef __IA64_KVM_PARA_H +#define __IA64_KVM_PARA_H + /* * Copyright (C) 2007 Xiantao Zhang * @@ -15,11 +18,8 @@ * Place - Suite 330, Boston, MA 02111-1307 USA. * */ -#ifndef __IA64_KVM_PARA_H -#define __IA64_KVM_PARA_H - -#include +#ifdef __KERNEL__ static inline unsigned int kvm_arch_para_features(void) { @@ -32,3 +32,5 @@ static inline bool kvm_check_and_clear_guest_paused(void) } #endif + +#endif diff --git a/trunk/arch/ia64/include/asm/mman.h b/trunk/arch/ia64/include/asm/mman.h index fdd5f5229f78..4459028e5aa8 100644 --- a/trunk/arch/ia64/include/asm/mman.h +++ b/trunk/arch/ia64/include/asm/mman.h @@ -1,17 +1,23 @@ +#ifndef _ASM_IA64_MMAN_H +#define _ASM_IA64_MMAN_H + /* * Based on . * * Modified 1998-2000, 2002 * David Mosberger-Tang , Hewlett-Packard Co */ -#ifndef _ASM_IA64_MMAN_H -#define _ASM_IA64_MMAN_H -#include +#include + +#define MAP_GROWSUP 0x0200 /* register stack-like segment */ +#ifdef __KERNEL__ #ifndef __ASSEMBLY__ #define arch_mmap_check ia64_mmap_check int ia64_mmap_check(unsigned long addr, unsigned long len, unsigned long flags); #endif +#endif + #endif /* _ASM_IA64_MMAN_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/msgbuf.h b/trunk/arch/ia64/include/asm/msgbuf.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/msgbuf.h rename to trunk/arch/ia64/include/asm/msgbuf.h diff --git a/trunk/arch/ia64/include/asm/param.h b/trunk/arch/ia64/include/asm/param.h index 1295913d6a82..0964c32c1358 100644 --- a/trunk/arch/ia64/include/asm/param.h +++ b/trunk/arch/ia64/include/asm/param.h @@ -1,3 +1,6 @@ +#ifndef _ASM_IA64_PARAM_H +#define _ASM_IA64_PARAM_H + /* * Fundamental kernel parameters. * @@ -6,12 +9,25 @@ * Modified 1998, 1999, 2002-2003 * David Mosberger-Tang , Hewlett-Packard Co */ -#ifndef _ASM_IA64_PARAM_H -#define _ASM_IA64_PARAM_H -#include +#define EXEC_PAGESIZE 65536 + +#ifndef NOGROUP +# define NOGROUP (-1) +#endif +#define MAXHOSTNAMELEN 64 /* max length of hostname */ + +#ifdef __KERNEL__ # define HZ CONFIG_HZ # define USER_HZ HZ # define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ +#else + /* + * Technically, this is wrong, but some old apps still refer to it. The proper way to + * get the HZ value is via sysconf(_SC_CLK_TCK). + */ +# define HZ 1024 +#endif + #endif /* _ASM_IA64_PARAM_H */ diff --git a/trunk/arch/ia64/include/asm/perfmon.h b/trunk/arch/ia64/include/asm/perfmon.h index 15476dd3a8b0..d551183fee90 100644 --- a/trunk/arch/ia64/include/asm/perfmon.h +++ b/trunk/arch/ia64/include/asm/perfmon.h @@ -2,12 +2,179 @@ * Copyright (C) 2001-2003 Hewlett-Packard Co * Stephane Eranian */ + #ifndef _ASM_IA64_PERFMON_H #define _ASM_IA64_PERFMON_H -#include +/* + * perfmon commands supported on all CPU models + */ +#define PFM_WRITE_PMCS 0x01 +#define PFM_WRITE_PMDS 0x02 +#define PFM_READ_PMDS 0x03 +#define PFM_STOP 0x04 +#define PFM_START 0x05 +#define PFM_ENABLE 0x06 /* obsolete */ +#define PFM_DISABLE 0x07 /* obsolete */ +#define PFM_CREATE_CONTEXT 0x08 +#define PFM_DESTROY_CONTEXT 0x09 /* obsolete use close() */ +#define PFM_RESTART 0x0a +#define PFM_PROTECT_CONTEXT 0x0b /* obsolete */ +#define PFM_GET_FEATURES 0x0c +#define PFM_DEBUG 0x0d +#define PFM_UNPROTECT_CONTEXT 0x0e /* obsolete */ +#define PFM_GET_PMC_RESET_VAL 0x0f +#define PFM_LOAD_CONTEXT 0x10 +#define PFM_UNLOAD_CONTEXT 0x11 + +/* + * PMU model specific commands (may not be supported on all PMU models) + */ +#define PFM_WRITE_IBRS 0x20 +#define PFM_WRITE_DBRS 0x21 + +/* + * context flags + */ +#define PFM_FL_NOTIFY_BLOCK 0x01 /* block task on user level notifications */ +#define PFM_FL_SYSTEM_WIDE 0x02 /* create a system wide context */ +#define PFM_FL_OVFL_NO_MSG 0x80 /* do not post overflow/end messages for notification */ + +/* + * event set flags + */ +#define PFM_SETFL_EXCL_IDLE 0x01 /* exclude idle task (syswide only) XXX: DO NOT USE YET */ + +/* + * PMC flags + */ +#define PFM_REGFL_OVFL_NOTIFY 0x1 /* send notification on overflow */ +#define PFM_REGFL_RANDOM 0x2 /* randomize sampling interval */ + +/* + * PMD/PMC/IBR/DBR return flags (ignored on input) + * + * Those flags are used on output and must be checked in case EAGAIN is returned + * by any of the calls using a pfarg_reg_t or pfarg_dbreg_t structure. + */ +#define PFM_REG_RETFL_NOTAVAIL (1UL<<31) /* set if register is implemented but not available */ +#define PFM_REG_RETFL_EINVAL (1UL<<30) /* set if register entry is invalid */ +#define PFM_REG_RETFL_MASK (PFM_REG_RETFL_NOTAVAIL|PFM_REG_RETFL_EINVAL) + +#define PFM_REG_HAS_ERROR(flag) (((flag) & PFM_REG_RETFL_MASK) != 0) + +typedef unsigned char pfm_uuid_t[16]; /* custom sampling buffer identifier type */ + +/* + * Request structure used to define a context + */ +typedef struct { + pfm_uuid_t ctx_smpl_buf_id; /* which buffer format to use (if needed) */ + unsigned long ctx_flags; /* noblock/block */ + unsigned short ctx_nextra_sets; /* number of extra event sets (you always get 1) */ + unsigned short ctx_reserved1; /* for future use */ + int ctx_fd; /* return arg: unique identification for context */ + void *ctx_smpl_vaddr; /* return arg: virtual address of sampling buffer, is used */ + unsigned long ctx_reserved2[11];/* for future use */ +} pfarg_context_t; + +/* + * Request structure used to write/read a PMC or PMD + */ +typedef struct { + unsigned int reg_num; /* which register */ + unsigned short reg_set; /* event set for this register */ + unsigned short reg_reserved1; /* for future use */ + + unsigned long reg_value; /* initial pmc/pmd value */ + unsigned long reg_flags; /* input: pmc/pmd flags, return: reg error */ + + unsigned long reg_long_reset; /* reset after buffer overflow notification */ + unsigned long reg_short_reset; /* reset after counter overflow */ + + unsigned long reg_reset_pmds[4]; /* which other counters to reset on overflow */ + unsigned long reg_random_seed; /* seed value when randomization is used */ + unsigned long reg_random_mask; /* bitmask used to limit random value */ + unsigned long reg_last_reset_val;/* return: PMD last reset value */ + + unsigned long reg_smpl_pmds[4]; /* which pmds are accessed when PMC overflows */ + unsigned long reg_smpl_eventid; /* opaque sampling event identifier */ + + unsigned long reg_reserved2[3]; /* for future use */ +} pfarg_reg_t; + +typedef struct { + unsigned int dbreg_num; /* which debug register */ + unsigned short dbreg_set; /* event set for this register */ + unsigned short dbreg_reserved1; /* for future use */ + unsigned long dbreg_value; /* value for debug register */ + unsigned long dbreg_flags; /* return: dbreg error */ + unsigned long dbreg_reserved2[1]; /* for future use */ +} pfarg_dbreg_t; + +typedef struct { + unsigned int ft_version; /* perfmon: major [16-31], minor [0-15] */ + unsigned int ft_reserved; /* reserved for future use */ + unsigned long reserved[4]; /* for future use */ +} pfarg_features_t; + +typedef struct { + pid_t load_pid; /* process to load the context into */ + unsigned short load_set; /* first event set to load */ + unsigned short load_reserved1; /* for future use */ + unsigned long load_reserved2[3]; /* for future use */ +} pfarg_load_t; + +typedef struct { + int msg_type; /* generic message header */ + int msg_ctx_fd; /* generic message header */ + unsigned long msg_ovfl_pmds[4]; /* which PMDs overflowed */ + unsigned short msg_active_set; /* active set at the time of overflow */ + unsigned short msg_reserved1; /* for future use */ + unsigned int msg_reserved2; /* for future use */ + unsigned long msg_tstamp; /* for perf tuning/debug */ +} pfm_ovfl_msg_t; + +typedef struct { + int msg_type; /* generic message header */ + int msg_ctx_fd; /* generic message header */ + unsigned long msg_tstamp; /* for perf tuning */ +} pfm_end_msg_t; + +typedef struct { + int msg_type; /* type of the message */ + int msg_ctx_fd; /* unique identifier for the context */ + unsigned long msg_tstamp; /* for perf tuning */ +} pfm_gen_msg_t; + +#define PFM_MSG_OVFL 1 /* an overflow happened */ +#define PFM_MSG_END 2 /* task to which context was attached ended */ + +typedef union { + pfm_ovfl_msg_t pfm_ovfl_msg; + pfm_end_msg_t pfm_end_msg; + pfm_gen_msg_t pfm_gen_msg; +} pfm_msg_t; + +/* + * Define the version numbers for both perfmon as a whole and the sampling buffer format. + */ +#define PFM_VERSION_MAJ 2U +#define PFM_VERSION_MIN 0U +#define PFM_VERSION (((PFM_VERSION_MAJ&0xffff)<<16)|(PFM_VERSION_MIN & 0xffff)) +#define PFM_VERSION_MAJOR(x) (((x)>>16) & 0xffff) +#define PFM_VERSION_MINOR(x) ((x) & 0xffff) +/* + * miscellaneous architected definitions + */ +#define PMU_FIRST_COUNTER 4 /* first counting monitor (PMC/PMD) */ +#define PMU_MAX_PMCS 256 /* maximum architected number of PMC registers */ +#define PMU_MAX_PMDS 256 /* maximum architected number of PMD registers */ + +#ifdef __KERNEL__ + extern long perfmonctl(int fd, int cmd, void *arg, int narg); typedef struct { @@ -107,4 +274,6 @@ typedef struct { extern pfm_sysctl_t pfm_sysctl; +#endif /* __KERNEL__ */ + #endif /* _ASM_IA64_PERFMON_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/perfmon_default_smpl.h b/trunk/arch/ia64/include/asm/perfmon_default_smpl.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/perfmon_default_smpl.h rename to trunk/arch/ia64/include/asm/perfmon_default_smpl.h diff --git a/trunk/arch/ia64/include/uapi/asm/poll.h b/trunk/arch/ia64/include/asm/poll.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/poll.h rename to trunk/arch/ia64/include/asm/poll.h diff --git a/trunk/arch/ia64/include/uapi/asm/posix_types.h b/trunk/arch/ia64/include/asm/posix_types.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/posix_types.h rename to trunk/arch/ia64/include/asm/posix_types.h diff --git a/trunk/arch/ia64/include/asm/ptrace.h b/trunk/arch/ia64/include/asm/ptrace.h index b0e973649cb9..68c98f5b3ca6 100644 --- a/trunk/arch/ia64/include/asm/ptrace.h +++ b/trunk/arch/ia64/include/asm/ptrace.h @@ -1,3 +1,6 @@ +#ifndef _ASM_IA64_PTRACE_H +#define _ASM_IA64_PTRACE_H + /* * Copyright (C) 1998-2004 Hewlett-Packard Co * David Mosberger-Tang @@ -12,13 +15,52 @@ * 6/17/99 D. Mosberger added second unat member to "struct switch_stack" * */ -#ifndef _ASM_IA64_PTRACE_H -#define _ASM_IA64_PTRACE_H +/* + * When a user process is blocked, its state looks as follows: + * + * +----------------------+ ------- IA64_STK_OFFSET + * | | ^ + * | struct pt_regs | | + * | | | + * +----------------------+ | + * | | | + * | memory stack | | + * | (growing downwards) | | + * //.....................// | + * | + * //.....................// | + * | | | + * +----------------------+ | + * | struct switch_stack | | + * | | | + * +----------------------+ | + * | | | + * //.....................// | + * | + * //.....................// | + * | | | + * | register stack | | + * | (growing upwards) | | + * | | | + * +----------------------+ | --- IA64_RBS_OFFSET + * | struct thread_info | | ^ + * +----------------------+ | | + * | | | | + * | struct task_struct | | | + * current -> | | | | + * +----------------------+ ------- + * + * Note that ar.ec is not saved explicitly in pt_reg or switch_stack. + * This is because ar.ec is saved as part of ar.pfs. + */ + +#include + +#ifdef __KERNEL__ #ifndef ASM_OFFSETS_C #include #endif -#include /* * Base-2 logarithm of number of pages to allocate per task structure @@ -39,8 +81,155 @@ #define KERNEL_STACK_SIZE IA64_STK_OFFSET +#endif /* __KERNEL__ */ + #ifndef __ASSEMBLY__ +/* + * This struct defines the way the registers are saved on system + * calls. + * + * We don't save all floating point register because the kernel + * is compiled to use only a very small subset, so the other are + * untouched. + * + * THIS STRUCTURE MUST BE A MULTIPLE 16-BYTE IN SIZE + * (because the memory stack pointer MUST ALWAYS be aligned this way) + * + */ +struct pt_regs { + /* The following registers are saved by SAVE_MIN: */ + unsigned long b6; /* scratch */ + unsigned long b7; /* scratch */ + + unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */ + unsigned long ar_ssd; /* reserved for future use (scratch) */ + + unsigned long r8; /* scratch (return value register 0) */ + unsigned long r9; /* scratch (return value register 1) */ + unsigned long r10; /* scratch (return value register 2) */ + unsigned long r11; /* scratch (return value register 3) */ + + unsigned long cr_ipsr; /* interrupted task's psr */ + unsigned long cr_iip; /* interrupted task's instruction pointer */ + /* + * interrupted task's function state; if bit 63 is cleared, it + * contains syscall's ar.pfs.pfm: + */ + unsigned long cr_ifs; + + unsigned long ar_unat; /* interrupted task's NaT register (preserved) */ + unsigned long ar_pfs; /* prev function state */ + unsigned long ar_rsc; /* RSE configuration */ + /* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */ + unsigned long ar_rnat; /* RSE NaT */ + unsigned long ar_bspstore; /* RSE bspstore */ + + unsigned long pr; /* 64 predicate registers (1 bit each) */ + unsigned long b0; /* return pointer (bp) */ + unsigned long loadrs; /* size of dirty partition << 16 */ + + unsigned long r1; /* the gp pointer */ + unsigned long r12; /* interrupted task's memory stack pointer */ + unsigned long r13; /* thread pointer */ + + unsigned long ar_fpsr; /* floating point status (preserved) */ + unsigned long r15; /* scratch */ + + /* The remaining registers are NOT saved for system calls. */ + + unsigned long r14; /* scratch */ + unsigned long r2; /* scratch */ + unsigned long r3; /* scratch */ + + /* The following registers are saved by SAVE_REST: */ + unsigned long r16; /* scratch */ + unsigned long r17; /* scratch */ + unsigned long r18; /* scratch */ + unsigned long r19; /* scratch */ + unsigned long r20; /* scratch */ + unsigned long r21; /* scratch */ + unsigned long r22; /* scratch */ + unsigned long r23; /* scratch */ + unsigned long r24; /* scratch */ + unsigned long r25; /* scratch */ + unsigned long r26; /* scratch */ + unsigned long r27; /* scratch */ + unsigned long r28; /* scratch */ + unsigned long r29; /* scratch */ + unsigned long r30; /* scratch */ + unsigned long r31; /* scratch */ + + unsigned long ar_ccv; /* compare/exchange value (scratch) */ + + /* + * Floating point registers that the kernel considers scratch: + */ + struct ia64_fpreg f6; /* scratch */ + struct ia64_fpreg f7; /* scratch */ + struct ia64_fpreg f8; /* scratch */ + struct ia64_fpreg f9; /* scratch */ + struct ia64_fpreg f10; /* scratch */ + struct ia64_fpreg f11; /* scratch */ +}; + +/* + * This structure contains the addition registers that need to + * preserved across a context switch. This generally consists of + * "preserved" registers. + */ +struct switch_stack { + unsigned long caller_unat; /* user NaT collection register (preserved) */ + unsigned long ar_fpsr; /* floating-point status register */ + + struct ia64_fpreg f2; /* preserved */ + struct ia64_fpreg f3; /* preserved */ + struct ia64_fpreg f4; /* preserved */ + struct ia64_fpreg f5; /* preserved */ + + struct ia64_fpreg f12; /* scratch, but untouched by kernel */ + struct ia64_fpreg f13; /* scratch, but untouched by kernel */ + struct ia64_fpreg f14; /* scratch, but untouched by kernel */ + struct ia64_fpreg f15; /* scratch, but untouched by kernel */ + struct ia64_fpreg f16; /* preserved */ + struct ia64_fpreg f17; /* preserved */ + struct ia64_fpreg f18; /* preserved */ + struct ia64_fpreg f19; /* preserved */ + struct ia64_fpreg f20; /* preserved */ + struct ia64_fpreg f21; /* preserved */ + struct ia64_fpreg f22; /* preserved */ + struct ia64_fpreg f23; /* preserved */ + struct ia64_fpreg f24; /* preserved */ + struct ia64_fpreg f25; /* preserved */ + struct ia64_fpreg f26; /* preserved */ + struct ia64_fpreg f27; /* preserved */ + struct ia64_fpreg f28; /* preserved */ + struct ia64_fpreg f29; /* preserved */ + struct ia64_fpreg f30; /* preserved */ + struct ia64_fpreg f31; /* preserved */ + + unsigned long r4; /* preserved */ + unsigned long r5; /* preserved */ + unsigned long r6; /* preserved */ + unsigned long r7; /* preserved */ + + unsigned long b0; /* so we can force a direct return in copy_thread */ + unsigned long b1; + unsigned long b2; + unsigned long b3; + unsigned long b4; + unsigned long b5; + + unsigned long ar_pfs; /* previous function state */ + unsigned long ar_lc; /* loop counter (preserved) */ + unsigned long ar_unat; /* NaT bits for r4-r7 */ + unsigned long ar_rnat; /* RSE NaT collection register */ + unsigned long ar_bspstore; /* RSE dirty base (preserved) */ + unsigned long pr; /* 64 predicate registers (1 bit each) */ +}; + +#ifdef __KERNEL__ + #include #include @@ -142,5 +331,46 @@ static inline long regs_return_value(struct pt_regs *regs) #define arch_has_single_step() (1) #define arch_has_block_step() (1) +#endif /* !__KERNEL__ */ + +/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ +struct pt_all_user_regs { + unsigned long nat; + unsigned long cr_iip; + unsigned long cfm; + unsigned long cr_ipsr; + unsigned long pr; + + unsigned long gr[32]; + unsigned long br[8]; + unsigned long ar[128]; + struct ia64_fpreg fr[128]; +}; + #endif /* !__ASSEMBLY__ */ + +/* indices to application-registers array in pt_all_user_regs */ +#define PT_AUR_RSC 16 +#define PT_AUR_BSP 17 +#define PT_AUR_BSPSTORE 18 +#define PT_AUR_RNAT 19 +#define PT_AUR_CCV 32 +#define PT_AUR_UNAT 36 +#define PT_AUR_FPSR 40 +#define PT_AUR_PFS 64 +#define PT_AUR_LC 65 +#define PT_AUR_EC 66 + +/* + * The numbers chosen here are somewhat arbitrary but absolutely MUST + * not overlap with any of the number assigned in . + */ +#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */ +#define PTRACE_OLD_GETSIGINFO 13 /* (replaced by PTRACE_GETSIGINFO in ) */ +#define PTRACE_OLD_SETSIGINFO 14 /* (replaced by PTRACE_SETSIGINFO in ) */ +#define PTRACE_GETREGS 18 /* get all registers (pt_all_user_regs) in one shot */ +#define PTRACE_SETREGS 19 /* set all registers (pt_all_user_regs) in one shot */ + +#define PTRACE_OLDSETOPTIONS 21 + #endif /* _ASM_IA64_PTRACE_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/ptrace_offsets.h b/trunk/arch/ia64/include/asm/ptrace_offsets.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/ptrace_offsets.h rename to trunk/arch/ia64/include/asm/ptrace_offsets.h diff --git a/trunk/arch/ia64/include/uapi/asm/resource.h b/trunk/arch/ia64/include/asm/resource.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/resource.h rename to trunk/arch/ia64/include/asm/resource.h diff --git a/trunk/arch/ia64/include/uapi/asm/rse.h b/trunk/arch/ia64/include/asm/rse.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/rse.h rename to trunk/arch/ia64/include/asm/rse.h diff --git a/trunk/arch/ia64/include/uapi/asm/sembuf.h b/trunk/arch/ia64/include/asm/sembuf.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/sembuf.h rename to trunk/arch/ia64/include/asm/sembuf.h diff --git a/trunk/arch/ia64/include/uapi/asm/setup.h b/trunk/arch/ia64/include/asm/setup.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/setup.h rename to trunk/arch/ia64/include/asm/setup.h diff --git a/trunk/arch/ia64/include/uapi/asm/shmbuf.h b/trunk/arch/ia64/include/asm/shmbuf.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/shmbuf.h rename to trunk/arch/ia64/include/asm/shmbuf.h diff --git a/trunk/arch/ia64/include/uapi/asm/sigcontext.h b/trunk/arch/ia64/include/asm/sigcontext.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/sigcontext.h rename to trunk/arch/ia64/include/asm/sigcontext.h diff --git a/trunk/arch/ia64/include/asm/siginfo.h b/trunk/arch/ia64/include/asm/siginfo.h index 6f2e2dd0f28f..c8fcaa2ac48f 100644 --- a/trunk/arch/ia64/include/asm/siginfo.h +++ b/trunk/arch/ia64/include/asm/siginfo.h @@ -1,14 +1,124 @@ +#ifndef _ASM_IA64_SIGINFO_H +#define _ASM_IA64_SIGINFO_H + /* * Based on . * * Modified 1998-2002 * David Mosberger-Tang , Hewlett-Packard Co */ -#ifndef _ASM_IA64_SIGINFO_H -#define _ASM_IA64_SIGINFO_H +#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) + +#define HAVE_ARCH_SIGINFO_T +#define HAVE_ARCH_COPY_SIGINFO +#define HAVE_ARCH_COPY_SIGINFO_TO_USER + +#include + +typedef struct siginfo { + int si_signo; + int si_errno; + int si_code; + int __pad0; + + union { + int _pad[SI_PAD_SIZE]; + + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + char _pad[sizeof(__ARCH_SI_UID_T) - sizeof(int)]; + sigval_t _sigval; /* must overlay ._rt._sigval! */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + uid_t _uid; /* sender's uid */ + int _status; /* exit code */ + clock_t _utime; + clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + void __user *_addr; /* faulting insn/memory ref. */ + int _imm; /* immediate value for "break" */ + unsigned int _flags; /* see below */ + unsigned long _isr; /* isr */ + short _addr_lsb; /* lsb of faulting address */ + } _sigfault; + + /* SIGPOLL */ + struct { + long _band; /* POLL_IN, POLL_OUT, POLL_MSG (XPG requires a "long") */ + int _fd; + } _sigpoll; + } _sifields; +} siginfo_t; + +#define si_imm _sifields._sigfault._imm /* as per UNIX SysV ABI spec */ +#define si_flags _sifields._sigfault._flags +/* + * si_isr is valid for SIGILL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP provided that + * si_code is non-zero and __ISR_VALID is set in si_flags. + */ +#define si_isr _sifields._sigfault._isr + +/* + * Flag values for si_flags: + */ +#define __ISR_VALID_BIT 0 +#define __ISR_VALID (1 << __ISR_VALID_BIT) + +/* + * SIGILL si_codes + */ +#define ILL_BADIADDR (__SI_FAULT|9) /* unimplemented instruction address */ +#define __ILL_BREAK (__SI_FAULT|10) /* illegal break */ +#define __ILL_BNDMOD (__SI_FAULT|11) /* bundle-update (modification) in progress */ +#undef NSIGILL +#define NSIGILL 11 + +/* + * SIGFPE si_codes + */ +#define __FPE_DECOVF (__SI_FAULT|9) /* decimal overflow */ +#define __FPE_DECDIV (__SI_FAULT|10) /* decimal division by zero */ +#define __FPE_DECERR (__SI_FAULT|11) /* packed decimal error */ +#define __FPE_INVASC (__SI_FAULT|12) /* invalid ASCII digit */ +#define __FPE_INVDEC (__SI_FAULT|13) /* invalid decimal digit */ +#undef NSIGFPE +#define NSIGFPE 13 + +/* + * SIGSEGV si_codes + */ +#define __SEGV_PSTKOVF (__SI_FAULT|3) /* paragraph stack overflow */ +#undef NSIGSEGV +#define NSIGSEGV 3 + +#undef NSIGTRAP +#define NSIGTRAP 4 + +#ifdef __KERNEL__ #include -#include static inline void copy_siginfo (siginfo_t *to, siginfo_t *from) @@ -20,4 +130,6 @@ copy_siginfo (siginfo_t *to, siginfo_t *from) memcpy(to, from, 4*sizeof(int) + sizeof(from->_sifields._sigchld)); } +#endif /* __KERNEL__ */ + #endif /* _ASM_IA64_SIGINFO_H */ diff --git a/trunk/arch/ia64/include/asm/signal.h b/trunk/arch/ia64/include/asm/signal.h index aecda5b9eb4e..b166248d49a4 100644 --- a/trunk/arch/ia64/include/asm/signal.h +++ b/trunk/arch/ia64/include/asm/signal.h @@ -1,3 +1,6 @@ +#ifndef _ASM_IA64_SIGNAL_H +#define _ASM_IA64_SIGNAL_H + /* * Modified 1998-2001, 2003 * David Mosberger-Tang , Hewlett-Packard Co @@ -5,18 +8,129 @@ * Unfortunately, this file is being included by bits/signal.h in * glibc-2.x. Hence the #ifdef __KERNEL__ ugliness. */ -#ifndef _ASM_IA64_SIGNAL_H -#define _ASM_IA64_SIGNAL_H -#include +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +/* +#define SIGLOST 29 +*/ +#define SIGPWR 30 +#define SIGSYS 31 +/* signal 31 is no longer "unused", but the SIGUNUSED macro remains for backwards compatibility */ +#define SIGUNUSED 31 + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX _NSIG +/* + * SA_FLAGS values: + * + * SA_ONSTACK indicates that a registered stack_t will be used. + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. + */ +#define SA_NOCLDSTOP 0x00000001 +#define SA_NOCLDWAIT 0x00000002 +#define SA_SIGINFO 0x00000004 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND + +#define SA_RESTORER 0x04000000 + +/* + * sigaltstack controls + */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +/* + * The minimum stack size needs to be fairly large because we want to + * be sure that an app compiled for today's CPUs will continue to run + * on all future CPU models. The CPU model matters because the signal + * frame needs to have space for the complete machine state, including + * all physical stacked registers. The number of physical stacked + * registers is CPU model dependent, but given that the width of + * ar.rsc.loadrs is 14 bits, we can assume that they'll never take up + * more than 16KB of space. + */ +#if 1 + /* + * This is a stupid typo: the value was _meant_ to be 131072 (0x20000), but I typed it + * in wrong. ;-( To preserve backwards compatibility, we leave the kernel at the + * incorrect value and fix libc only. + */ +# define MINSIGSTKSZ 131027 /* min. stack size for sigaltstack() */ +#else +# define MINSIGSTKSZ 131072 /* min. stack size for sigaltstack() */ +#endif +#define SIGSTKSZ 262144 /* default stack size for sigaltstack() */ + +#ifdef __KERNEL__ #define _NSIG 64 #define _NSIG_BPW 64 #define _NSIG_WORDS (_NSIG / _NSIG_BPW) +#endif /* __KERNEL__ */ + +#include + # ifndef __ASSEMBLY__ +# include + +/* Avoid too many header ordering problems. */ +struct siginfo; + +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; + +#ifdef __KERNEL__ + /* Most things should be clean enough to redefine this at will, if care is taken to make libc match. */ @@ -40,5 +154,7 @@ struct k_sigaction { #define ptrace_signal_deliver(regs, cookie) do { } while (0) +#endif /* __KERNEL__ */ + # endif /* !__ASSEMBLY__ */ #endif /* _ASM_IA64_SIGNAL_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/socket.h b/trunk/arch/ia64/include/asm/socket.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/socket.h rename to trunk/arch/ia64/include/asm/socket.h diff --git a/trunk/arch/ia64/include/uapi/asm/sockios.h b/trunk/arch/ia64/include/asm/sockios.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/sockios.h rename to trunk/arch/ia64/include/asm/sockios.h diff --git a/trunk/arch/ia64/include/uapi/asm/stat.h b/trunk/arch/ia64/include/asm/stat.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/stat.h rename to trunk/arch/ia64/include/asm/stat.h diff --git a/trunk/arch/ia64/include/uapi/asm/statfs.h b/trunk/arch/ia64/include/asm/statfs.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/statfs.h rename to trunk/arch/ia64/include/asm/statfs.h diff --git a/trunk/arch/ia64/include/uapi/asm/swab.h b/trunk/arch/ia64/include/asm/swab.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/swab.h rename to trunk/arch/ia64/include/asm/swab.h diff --git a/trunk/arch/ia64/include/uapi/asm/termbits.h b/trunk/arch/ia64/include/asm/termbits.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/termbits.h rename to trunk/arch/ia64/include/asm/termbits.h diff --git a/trunk/arch/ia64/include/asm/termios.h b/trunk/arch/ia64/include/asm/termios.h index a42f870ca4f6..689d218c0c28 100644 --- a/trunk/arch/ia64/include/asm/termios.h +++ b/trunk/arch/ia64/include/asm/termios.h @@ -1,14 +1,52 @@ +#ifndef _ASM_IA64_TERMIOS_H +#define _ASM_IA64_TERMIOS_H + /* * Modified 1999 * David Mosberger-Tang , Hewlett-Packard Co * * 99/01/28 Added N_IRDA and N_SMSBLOCK */ -#ifndef _ASM_IA64_TERMIOS_H -#define _ASM_IA64_TERMIOS_H -#include +#include +#include +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +# ifdef __KERNEL__ /* intr=^C quit=^\ erase=del kill=^U eof=^D vtime=\0 vmin=\1 sxtc=\0 @@ -54,4 +92,6 @@ #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) +# endif /* __KERNEL__ */ + #endif /* _ASM_IA64_TERMIOS_H */ diff --git a/trunk/arch/ia64/include/asm/types.h b/trunk/arch/ia64/include/asm/types.h index 4c351b169da2..3f5b122d9975 100644 --- a/trunk/arch/ia64/include/asm/types.h +++ b/trunk/arch/ia64/include/asm/types.h @@ -1,3 +1,6 @@ +#ifndef _ASM_IA64_TYPES_H +#define _ASM_IA64_TYPES_H + /* * This file is never included by application software unless explicitly * requested (e.g., via linux/types.h) in which case the application is @@ -10,22 +13,32 @@ * Modified 1998-2000, 2002 * David Mosberger-Tang , Hewlett-Packard Co */ -#ifndef _ASM_IA64_TYPES_H -#define _ASM_IA64_TYPES_H +#ifdef __KERNEL__ #include -#include +#else +#include +#endif #ifdef __ASSEMBLY__ +# define __IA64_UL(x) (x) +# define __IA64_UL_CONST(x) x + #else +# define __IA64_UL(x) ((unsigned long)(x)) +# define __IA64_UL_CONST(x) x##UL + /* * These aren't exported outside the kernel to avoid name space clashes */ +# ifdef __KERNEL__ struct fnptr { unsigned long ip; unsigned long gp; }; +# endif /* __KERNEL__ */ #endif /* !__ASSEMBLY__ */ + #endif /* _ASM_IA64_TYPES_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/ucontext.h b/trunk/arch/ia64/include/asm/ucontext.h similarity index 100% rename from trunk/arch/ia64/include/uapi/asm/ucontext.h rename to trunk/arch/ia64/include/asm/ucontext.h diff --git a/trunk/arch/ia64/include/asm/unistd.h b/trunk/arch/ia64/include/asm/unistd.h index 8b3ff2f5b861..7a3bd2524944 100644 --- a/trunk/arch/ia64/include/asm/unistd.h +++ b/trunk/arch/ia64/include/asm/unistd.h @@ -1,14 +1,331 @@ +#ifndef _ASM_IA64_UNISTD_H +#define _ASM_IA64_UNISTD_H + /* * IA-64 Linux syscall numbers and inline-functions. * * Copyright (C) 1998-2005 Hewlett-Packard Co * David Mosberger-Tang */ -#ifndef _ASM_IA64_UNISTD_H -#define _ASM_IA64_UNISTD_H -#include +#include + +#define __BREAK_SYSCALL __IA64_BREAK_SYSCALL + +#define __NR_ni_syscall 1024 +#define __NR_exit 1025 +#define __NR_read 1026 +#define __NR_write 1027 +#define __NR_open 1028 +#define __NR_close 1029 +#define __NR_creat 1030 +#define __NR_link 1031 +#define __NR_unlink 1032 +#define __NR_execve 1033 +#define __NR_chdir 1034 +#define __NR_fchdir 1035 +#define __NR_utimes 1036 +#define __NR_mknod 1037 +#define __NR_chmod 1038 +#define __NR_chown 1039 +#define __NR_lseek 1040 +#define __NR_getpid 1041 +#define __NR_getppid 1042 +#define __NR_mount 1043 +#define __NR_umount 1044 +#define __NR_setuid 1045 +#define __NR_getuid 1046 +#define __NR_geteuid 1047 +#define __NR_ptrace 1048 +#define __NR_access 1049 +#define __NR_sync 1050 +#define __NR_fsync 1051 +#define __NR_fdatasync 1052 +#define __NR_kill 1053 +#define __NR_rename 1054 +#define __NR_mkdir 1055 +#define __NR_rmdir 1056 +#define __NR_dup 1057 +#define __NR_pipe 1058 +#define __NR_times 1059 +#define __NR_brk 1060 +#define __NR_setgid 1061 +#define __NR_getgid 1062 +#define __NR_getegid 1063 +#define __NR_acct 1064 +#define __NR_ioctl 1065 +#define __NR_fcntl 1066 +#define __NR_umask 1067 +#define __NR_chroot 1068 +#define __NR_ustat 1069 +#define __NR_dup2 1070 +#define __NR_setreuid 1071 +#define __NR_setregid 1072 +#define __NR_getresuid 1073 +#define __NR_setresuid 1074 +#define __NR_getresgid 1075 +#define __NR_setresgid 1076 +#define __NR_getgroups 1077 +#define __NR_setgroups 1078 +#define __NR_getpgid 1079 +#define __NR_setpgid 1080 +#define __NR_setsid 1081 +#define __NR_getsid 1082 +#define __NR_sethostname 1083 +#define __NR_setrlimit 1084 +#define __NR_getrlimit 1085 +#define __NR_getrusage 1086 +#define __NR_gettimeofday 1087 +#define __NR_settimeofday 1088 +#define __NR_select 1089 +#define __NR_poll 1090 +#define __NR_symlink 1091 +#define __NR_readlink 1092 +#define __NR_uselib 1093 +#define __NR_swapon 1094 +#define __NR_swapoff 1095 +#define __NR_reboot 1096 +#define __NR_truncate 1097 +#define __NR_ftruncate 1098 +#define __NR_fchmod 1099 +#define __NR_fchown 1100 +#define __NR_getpriority 1101 +#define __NR_setpriority 1102 +#define __NR_statfs 1103 +#define __NR_fstatfs 1104 +#define __NR_gettid 1105 +#define __NR_semget 1106 +#define __NR_semop 1107 +#define __NR_semctl 1108 +#define __NR_msgget 1109 +#define __NR_msgsnd 1110 +#define __NR_msgrcv 1111 +#define __NR_msgctl 1112 +#define __NR_shmget 1113 +#define __NR_shmat 1114 +#define __NR_shmdt 1115 +#define __NR_shmctl 1116 +/* also known as klogctl() in GNU libc: */ +#define __NR_syslog 1117 +#define __NR_setitimer 1118 +#define __NR_getitimer 1119 +/* 1120 was __NR_old_stat */ +/* 1121 was __NR_old_lstat */ +/* 1122 was __NR_old_fstat */ +#define __NR_vhangup 1123 +#define __NR_lchown 1124 +#define __NR_remap_file_pages 1125 +#define __NR_wait4 1126 +#define __NR_sysinfo 1127 +#define __NR_clone 1128 +#define __NR_setdomainname 1129 +#define __NR_uname 1130 +#define __NR_adjtimex 1131 +/* 1132 was __NR_create_module */ +#define __NR_init_module 1133 +#define __NR_delete_module 1134 +/* 1135 was __NR_get_kernel_syms */ +/* 1136 was __NR_query_module */ +#define __NR_quotactl 1137 +#define __NR_bdflush 1138 +#define __NR_sysfs 1139 +#define __NR_personality 1140 +#define __NR_afs_syscall 1141 +#define __NR_setfsuid 1142 +#define __NR_setfsgid 1143 +#define __NR_getdents 1144 +#define __NR_flock 1145 +#define __NR_readv 1146 +#define __NR_writev 1147 +#define __NR_pread64 1148 +#define __NR_pwrite64 1149 +#define __NR__sysctl 1150 +#define __NR_mmap 1151 +#define __NR_munmap 1152 +#define __NR_mlock 1153 +#define __NR_mlockall 1154 +#define __NR_mprotect 1155 +#define __NR_mremap 1156 +#define __NR_msync 1157 +#define __NR_munlock 1158 +#define __NR_munlockall 1159 +#define __NR_sched_getparam 1160 +#define __NR_sched_setparam 1161 +#define __NR_sched_getscheduler 1162 +#define __NR_sched_setscheduler 1163 +#define __NR_sched_yield 1164 +#define __NR_sched_get_priority_max 1165 +#define __NR_sched_get_priority_min 1166 +#define __NR_sched_rr_get_interval 1167 +#define __NR_nanosleep 1168 +#define __NR_nfsservctl 1169 +#define __NR_prctl 1170 +/* 1171 is reserved for backwards compatibility with old __NR_getpagesize */ +#define __NR_mmap2 1172 +#define __NR_pciconfig_read 1173 +#define __NR_pciconfig_write 1174 +#define __NR_perfmonctl 1175 +#define __NR_sigaltstack 1176 +#define __NR_rt_sigaction 1177 +#define __NR_rt_sigpending 1178 +#define __NR_rt_sigprocmask 1179 +#define __NR_rt_sigqueueinfo 1180 +#define __NR_rt_sigreturn 1181 +#define __NR_rt_sigsuspend 1182 +#define __NR_rt_sigtimedwait 1183 +#define __NR_getcwd 1184 +#define __NR_capget 1185 +#define __NR_capset 1186 +#define __NR_sendfile 1187 +#define __NR_getpmsg 1188 +#define __NR_putpmsg 1189 +#define __NR_socket 1190 +#define __NR_bind 1191 +#define __NR_connect 1192 +#define __NR_listen 1193 +#define __NR_accept 1194 +#define __NR_getsockname 1195 +#define __NR_getpeername 1196 +#define __NR_socketpair 1197 +#define __NR_send 1198 +#define __NR_sendto 1199 +#define __NR_recv 1200 +#define __NR_recvfrom 1201 +#define __NR_shutdown 1202 +#define __NR_setsockopt 1203 +#define __NR_getsockopt 1204 +#define __NR_sendmsg 1205 +#define __NR_recvmsg 1206 +#define __NR_pivot_root 1207 +#define __NR_mincore 1208 +#define __NR_madvise 1209 +#define __NR_stat 1210 +#define __NR_lstat 1211 +#define __NR_fstat 1212 +#define __NR_clone2 1213 +#define __NR_getdents64 1214 +#define __NR_getunwind 1215 +#define __NR_readahead 1216 +#define __NR_setxattr 1217 +#define __NR_lsetxattr 1218 +#define __NR_fsetxattr 1219 +#define __NR_getxattr 1220 +#define __NR_lgetxattr 1221 +#define __NR_fgetxattr 1222 +#define __NR_listxattr 1223 +#define __NR_llistxattr 1224 +#define __NR_flistxattr 1225 +#define __NR_removexattr 1226 +#define __NR_lremovexattr 1227 +#define __NR_fremovexattr 1228 +#define __NR_tkill 1229 +#define __NR_futex 1230 +#define __NR_sched_setaffinity 1231 +#define __NR_sched_getaffinity 1232 +#define __NR_set_tid_address 1233 +#define __NR_fadvise64 1234 +#define __NR_tgkill 1235 +#define __NR_exit_group 1236 +#define __NR_lookup_dcookie 1237 +#define __NR_io_setup 1238 +#define __NR_io_destroy 1239 +#define __NR_io_getevents 1240 +#define __NR_io_submit 1241 +#define __NR_io_cancel 1242 +#define __NR_epoll_create 1243 +#define __NR_epoll_ctl 1244 +#define __NR_epoll_wait 1245 +#define __NR_restart_syscall 1246 +#define __NR_semtimedop 1247 +#define __NR_timer_create 1248 +#define __NR_timer_settime 1249 +#define __NR_timer_gettime 1250 +#define __NR_timer_getoverrun 1251 +#define __NR_timer_delete 1252 +#define __NR_clock_settime 1253 +#define __NR_clock_gettime 1254 +#define __NR_clock_getres 1255 +#define __NR_clock_nanosleep 1256 +#define __NR_fstatfs64 1257 +#define __NR_statfs64 1258 +#define __NR_mbind 1259 +#define __NR_get_mempolicy 1260 +#define __NR_set_mempolicy 1261 +#define __NR_mq_open 1262 +#define __NR_mq_unlink 1263 +#define __NR_mq_timedsend 1264 +#define __NR_mq_timedreceive 1265 +#define __NR_mq_notify 1266 +#define __NR_mq_getsetattr 1267 +#define __NR_kexec_load 1268 +#define __NR_vserver 1269 +#define __NR_waitid 1270 +#define __NR_add_key 1271 +#define __NR_request_key 1272 +#define __NR_keyctl 1273 +#define __NR_ioprio_set 1274 +#define __NR_ioprio_get 1275 +#define __NR_move_pages 1276 +#define __NR_inotify_init 1277 +#define __NR_inotify_add_watch 1278 +#define __NR_inotify_rm_watch 1279 +#define __NR_migrate_pages 1280 +#define __NR_openat 1281 +#define __NR_mkdirat 1282 +#define __NR_mknodat 1283 +#define __NR_fchownat 1284 +#define __NR_futimesat 1285 +#define __NR_newfstatat 1286 +#define __NR_unlinkat 1287 +#define __NR_renameat 1288 +#define __NR_linkat 1289 +#define __NR_symlinkat 1290 +#define __NR_readlinkat 1291 +#define __NR_fchmodat 1292 +#define __NR_faccessat 1293 +#define __NR_pselect6 1294 +#define __NR_ppoll 1295 +#define __NR_unshare 1296 +#define __NR_splice 1297 +#define __NR_set_robust_list 1298 +#define __NR_get_robust_list 1299 +#define __NR_sync_file_range 1300 +#define __NR_tee 1301 +#define __NR_vmsplice 1302 +#define __NR_fallocate 1303 +#define __NR_getcpu 1304 +#define __NR_epoll_pwait 1305 +#define __NR_utimensat 1306 +#define __NR_signalfd 1307 +#define __NR_timerfd 1308 +#define __NR_eventfd 1309 +#define __NR_timerfd_create 1310 +#define __NR_timerfd_settime 1311 +#define __NR_timerfd_gettime 1312 +#define __NR_signalfd4 1313 +#define __NR_eventfd2 1314 +#define __NR_epoll_create1 1315 +#define __NR_dup3 1316 +#define __NR_pipe2 1317 +#define __NR_inotify_init1 1318 +#define __NR_preadv 1319 +#define __NR_pwritev 1320 +#define __NR_rt_tgsigqueueinfo 1321 +#define __NR_recvmmsg 1322 +#define __NR_fanotify_init 1323 +#define __NR_fanotify_mark 1324 +#define __NR_prlimit64 1325 +#define __NR_name_to_handle_at 1326 +#define __NR_open_by_handle_at 1327 +#define __NR_clock_adjtime 1328 +#define __NR_syncfs 1329 +#define __NR_setns 1330 +#define __NR_sendmmsg 1331 +#define __NR_process_vm_readv 1332 +#define __NR_process_vm_writev 1333 +#define __NR_accept4 1334 +#ifdef __KERNEL__ #define NR_syscalls 311 /* length of syscall table */ @@ -65,4 +382,5 @@ asmlinkage long sys_rt_sigaction(int sig, #define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall"))) #endif /* !__ASSEMBLY__ */ +#endif /* __KERNEL__ */ #endif /* _ASM_IA64_UNISTD_H */ diff --git a/trunk/arch/ia64/include/asm/ustack.h b/trunk/arch/ia64/include/asm/ustack.h index b275401b96d3..504167c35b8b 100644 --- a/trunk/arch/ia64/include/asm/ustack.h +++ b/trunk/arch/ia64/include/asm/ustack.h @@ -1,11 +1,20 @@ #ifndef _ASM_IA64_USTACK_H #define _ASM_IA64_USTACK_H +/* + * Constants for the user stack size + */ + +#ifdef __KERNEL__ #include -#include /* The absolute hard limit for stack size is 1/2 of the mappable space in the region */ #define MAX_USER_STACK_SIZE (RGN_MAP_LIMIT/2) #define STACK_TOP (0x6000000000000000UL + RGN_MAP_LIMIT) #define STACK_TOP_MAX STACK_TOP +#endif + +/* Make a default stack size of 2GiB */ +#define DEFAULT_USER_STACK_SIZE (1UL << 31) + #endif /* _ASM_IA64_USTACK_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/Kbuild b/trunk/arch/ia64/include/uapi/asm/Kbuild index 30cafac93703..baebb3da1d44 100644 --- a/trunk/arch/ia64/include/uapi/asm/Kbuild +++ b/trunk/arch/ia64/include/uapi/asm/Kbuild @@ -1,48 +1,3 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += auxvec.h -header-y += bitsperlong.h -header-y += break.h -header-y += byteorder.h -header-y += cmpxchg.h -header-y += errno.h -header-y += fcntl.h -header-y += fpu.h -header-y += gcc_intrin.h -header-y += ia64regs.h -header-y += intel_intrin.h -header-y += intrinsics.h -header-y += ioctl.h -header-y += ioctls.h -header-y += ipcbuf.h -header-y += kvm.h -header-y += kvm_para.h -header-y += mman.h -header-y += msgbuf.h -header-y += param.h -header-y += perfmon.h -header-y += perfmon_default_smpl.h -header-y += poll.h -header-y += posix_types.h -header-y += ptrace.h -header-y += ptrace_offsets.h -header-y += resource.h -header-y += rse.h -header-y += sembuf.h -header-y += setup.h -header-y += shmbuf.h -header-y += sigcontext.h -header-y += siginfo.h -header-y += signal.h -header-y += socket.h -header-y += sockios.h -header-y += stat.h -header-y += statfs.h -header-y += swab.h -header-y += termbits.h -header-y += termios.h -header-y += types.h -header-y += ucontext.h -header-y += unistd.h -header-y += ustack.h diff --git a/trunk/arch/ia64/include/uapi/asm/gcc_intrin.h b/trunk/arch/ia64/include/uapi/asm/gcc_intrin.h deleted file mode 100644 index 61d0d0111978..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/gcc_intrin.h +++ /dev/null @@ -1,618 +0,0 @@ -/* - * - * Copyright (C) 2002,2003 Jun Nakajima - * Copyright (C) 2002,2003 Suresh Siddha - */ -#ifndef _UAPI_ASM_IA64_GCC_INTRIN_H -#define _UAPI_ASM_IA64_GCC_INTRIN_H - -#include -#include - -/* define this macro to get some asm stmts included in 'c' files */ -#define ASM_SUPPORTED - -/* Optimization barrier */ -/* The "volatile" is due to gcc bugs */ -#define ia64_barrier() asm volatile ("":::"memory") - -#define ia64_stop() asm volatile (";;"::) - -#define ia64_invala_gr(regnum) asm volatile ("invala.e r%0" :: "i"(regnum)) - -#define ia64_invala_fr(regnum) asm volatile ("invala.e f%0" :: "i"(regnum)) - -#define ia64_flushrs() asm volatile ("flushrs;;":::"memory") - -#define ia64_loadrs() asm volatile ("loadrs;;":::"memory") - -extern void ia64_bad_param_for_setreg (void); -extern void ia64_bad_param_for_getreg (void); - - -#define ia64_native_setreg(regnum, val) \ -({ \ - switch (regnum) { \ - case _IA64_REG_PSR_L: \ - asm volatile ("mov psr.l=%0" :: "r"(val) : "memory"); \ - break; \ - case _IA64_REG_AR_KR0 ... _IA64_REG_AR_EC: \ - asm volatile ("mov ar%0=%1" :: \ - "i" (regnum - _IA64_REG_AR_KR0), \ - "r"(val): "memory"); \ - break; \ - case _IA64_REG_CR_DCR ... _IA64_REG_CR_LRR1: \ - asm volatile ("mov cr%0=%1" :: \ - "i" (regnum - _IA64_REG_CR_DCR), \ - "r"(val): "memory" ); \ - break; \ - case _IA64_REG_SP: \ - asm volatile ("mov r12=%0" :: \ - "r"(val): "memory"); \ - break; \ - case _IA64_REG_GP: \ - asm volatile ("mov gp=%0" :: "r"(val) : "memory"); \ - break; \ - default: \ - ia64_bad_param_for_setreg(); \ - break; \ - } \ -}) - -#define ia64_native_getreg(regnum) \ -({ \ - __u64 ia64_intri_res; \ - \ - switch (regnum) { \ - case _IA64_REG_GP: \ - asm volatile ("mov %0=gp" : "=r"(ia64_intri_res)); \ - break; \ - case _IA64_REG_IP: \ - asm volatile ("mov %0=ip" : "=r"(ia64_intri_res)); \ - break; \ - case _IA64_REG_PSR: \ - asm volatile ("mov %0=psr" : "=r"(ia64_intri_res)); \ - break; \ - case _IA64_REG_TP: /* for current() */ \ - ia64_intri_res = ia64_r13; \ - break; \ - case _IA64_REG_AR_KR0 ... _IA64_REG_AR_EC: \ - asm volatile ("mov %0=ar%1" : "=r" (ia64_intri_res) \ - : "i"(regnum - _IA64_REG_AR_KR0)); \ - break; \ - case _IA64_REG_CR_DCR ... _IA64_REG_CR_LRR1: \ - asm volatile ("mov %0=cr%1" : "=r" (ia64_intri_res) \ - : "i" (regnum - _IA64_REG_CR_DCR)); \ - break; \ - case _IA64_REG_SP: \ - asm volatile ("mov %0=sp" : "=r" (ia64_intri_res)); \ - break; \ - default: \ - ia64_bad_param_for_getreg(); \ - break; \ - } \ - ia64_intri_res; \ -}) - -#define ia64_hint_pause 0 - -#define ia64_hint(mode) \ -({ \ - switch (mode) { \ - case ia64_hint_pause: \ - asm volatile ("hint @pause" ::: "memory"); \ - break; \ - } \ -}) - - -/* Integer values for mux1 instruction */ -#define ia64_mux1_brcst 0 -#define ia64_mux1_mix 8 -#define ia64_mux1_shuf 9 -#define ia64_mux1_alt 10 -#define ia64_mux1_rev 11 - -#define ia64_mux1(x, mode) \ -({ \ - __u64 ia64_intri_res; \ - \ - switch (mode) { \ - case ia64_mux1_brcst: \ - asm ("mux1 %0=%1,@brcst" : "=r" (ia64_intri_res) : "r" (x)); \ - break; \ - case ia64_mux1_mix: \ - asm ("mux1 %0=%1,@mix" : "=r" (ia64_intri_res) : "r" (x)); \ - break; \ - case ia64_mux1_shuf: \ - asm ("mux1 %0=%1,@shuf" : "=r" (ia64_intri_res) : "r" (x)); \ - break; \ - case ia64_mux1_alt: \ - asm ("mux1 %0=%1,@alt" : "=r" (ia64_intri_res) : "r" (x)); \ - break; \ - case ia64_mux1_rev: \ - asm ("mux1 %0=%1,@rev" : "=r" (ia64_intri_res) : "r" (x)); \ - break; \ - } \ - ia64_intri_res; \ -}) - -#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# define ia64_popcnt(x) __builtin_popcountl(x) -#else -# define ia64_popcnt(x) \ - ({ \ - __u64 ia64_intri_res; \ - asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \ - \ - ia64_intri_res; \ - }) -#endif - -#define ia64_getf_exp(x) \ -({ \ - long ia64_intri_res; \ - \ - asm ("getf.exp %0=%1" : "=r"(ia64_intri_res) : "f"(x)); \ - \ - ia64_intri_res; \ -}) - -#define ia64_shrp(a, b, count) \ -({ \ - __u64 ia64_intri_res; \ - asm ("shrp %0=%1,%2,%3" : "=r"(ia64_intri_res) : "r"(a), "r"(b), "i"(count)); \ - ia64_intri_res; \ -}) - -#define ia64_ldfs(regnum, x) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("ldfs %0=[%1]" :"=f"(__f__): "r"(x)); \ -}) - -#define ia64_ldfd(regnum, x) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("ldfd %0=[%1]" :"=f"(__f__): "r"(x)); \ -}) - -#define ia64_ldfe(regnum, x) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("ldfe %0=[%1]" :"=f"(__f__): "r"(x)); \ -}) - -#define ia64_ldf8(regnum, x) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("ldf8 %0=[%1]" :"=f"(__f__): "r"(x)); \ -}) - -#define ia64_ldf_fill(regnum, x) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("ldf.fill %0=[%1]" :"=f"(__f__): "r"(x)); \ -}) - -#define ia64_st4_rel_nta(m, val) \ -({ \ - asm volatile ("st4.rel.nta [%0] = %1\n\t" :: "r"(m), "r"(val)); \ -}) - -#define ia64_stfs(x, regnum) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("stfs [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ -}) - -#define ia64_stfd(x, regnum) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("stfd [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ -}) - -#define ia64_stfe(x, regnum) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("stfe [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ -}) - -#define ia64_stf8(x, regnum) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("stf8 [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ -}) - -#define ia64_stf_spill(x, regnum) \ -({ \ - register double __f__ asm ("f"#regnum); \ - asm volatile ("stf.spill [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \ -}) - -#define ia64_fetchadd4_acq(p, inc) \ -({ \ - \ - __u64 ia64_intri_res; \ - asm volatile ("fetchadd4.acq %0=[%1],%2" \ - : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \ - : "memory"); \ - \ - ia64_intri_res; \ -}) - -#define ia64_fetchadd4_rel(p, inc) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("fetchadd4.rel %0=[%1],%2" \ - : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \ - : "memory"); \ - \ - ia64_intri_res; \ -}) - -#define ia64_fetchadd8_acq(p, inc) \ -({ \ - \ - __u64 ia64_intri_res; \ - asm volatile ("fetchadd8.acq %0=[%1],%2" \ - : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \ - : "memory"); \ - \ - ia64_intri_res; \ -}) - -#define ia64_fetchadd8_rel(p, inc) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("fetchadd8.rel %0=[%1],%2" \ - : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \ - : "memory"); \ - \ - ia64_intri_res; \ -}) - -#define ia64_xchg1(ptr,x) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("xchg1 %0=[%1],%2" \ - : "=r" (ia64_intri_res) : "r" (ptr), "r" (x) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_xchg2(ptr,x) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("xchg2 %0=[%1],%2" : "=r" (ia64_intri_res) \ - : "r" (ptr), "r" (x) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_xchg4(ptr,x) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("xchg4 %0=[%1],%2" : "=r" (ia64_intri_res) \ - : "r" (ptr), "r" (x) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_xchg8(ptr,x) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("xchg8 %0=[%1],%2" : "=r" (ia64_intri_res) \ - : "r" (ptr), "r" (x) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg1_acq(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg1.acq %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg1_rel(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg1.rel %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg2_acq(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg2.acq %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg2_rel(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - \ - asm volatile ("cmpxchg2.rel %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg4_acq(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg4.acq %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg4_rel(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg4.rel %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg8_acq(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - asm volatile ("cmpxchg8.acq %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_cmpxchg8_rel(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \ - \ - asm volatile ("cmpxchg8.rel %0=[%1],%2,ar.ccv": \ - "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \ - ia64_intri_res; \ -}) - -#define ia64_mf() asm volatile ("mf" ::: "memory") -#define ia64_mfa() asm volatile ("mf.a" ::: "memory") - -#define ia64_invala() asm volatile ("invala" ::: "memory") - -#define ia64_native_thash(addr) \ -({ \ - unsigned long ia64_intri_res; \ - asm volatile ("thash %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \ - ia64_intri_res; \ -}) - -#define ia64_srlz_i() asm volatile (";; srlz.i ;;" ::: "memory") -#define ia64_srlz_d() asm volatile (";; srlz.d" ::: "memory"); - -#ifdef HAVE_SERIALIZE_DIRECTIVE -# define ia64_dv_serialize_data() asm volatile (".serialize.data"); -# define ia64_dv_serialize_instruction() asm volatile (".serialize.instruction"); -#else -# define ia64_dv_serialize_data() -# define ia64_dv_serialize_instruction() -#endif - -#define ia64_nop(x) asm volatile ("nop %0"::"i"(x)); - -#define ia64_itci(addr) asm volatile ("itc.i %0;;" :: "r"(addr) : "memory") - -#define ia64_itcd(addr) asm volatile ("itc.d %0;;" :: "r"(addr) : "memory") - - -#define ia64_itri(trnum, addr) asm volatile ("itr.i itr[%0]=%1" \ - :: "r"(trnum), "r"(addr) : "memory") - -#define ia64_itrd(trnum, addr) asm volatile ("itr.d dtr[%0]=%1" \ - :: "r"(trnum), "r"(addr) : "memory") - -#define ia64_tpa(addr) \ -({ \ - unsigned long ia64_pa; \ - asm volatile ("tpa %0 = %1" : "=r"(ia64_pa) : "r"(addr) : "memory"); \ - ia64_pa; \ -}) - -#define __ia64_set_dbr(index, val) \ - asm volatile ("mov dbr[%0]=%1" :: "r"(index), "r"(val) : "memory") - -#define ia64_set_ibr(index, val) \ - asm volatile ("mov ibr[%0]=%1" :: "r"(index), "r"(val) : "memory") - -#define ia64_set_pkr(index, val) \ - asm volatile ("mov pkr[%0]=%1" :: "r"(index), "r"(val) : "memory") - -#define ia64_set_pmc(index, val) \ - asm volatile ("mov pmc[%0]=%1" :: "r"(index), "r"(val) : "memory") - -#define ia64_set_pmd(index, val) \ - asm volatile ("mov pmd[%0]=%1" :: "r"(index), "r"(val) : "memory") - -#define ia64_native_set_rr(index, val) \ - asm volatile ("mov rr[%0]=%1" :: "r"(index), "r"(val) : "memory"); - -#define ia64_native_get_cpuid(index) \ -({ \ - unsigned long ia64_intri_res; \ - asm volatile ("mov %0=cpuid[%r1]" : "=r"(ia64_intri_res) : "rO"(index)); \ - ia64_intri_res; \ -}) - -#define __ia64_get_dbr(index) \ -({ \ - unsigned long ia64_intri_res; \ - asm volatile ("mov %0=dbr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ - ia64_intri_res; \ -}) - -#define ia64_get_ibr(index) \ -({ \ - unsigned long ia64_intri_res; \ - asm volatile ("mov %0=ibr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ - ia64_intri_res; \ -}) - -#define ia64_get_pkr(index) \ -({ \ - unsigned long ia64_intri_res; \ - asm volatile ("mov %0=pkr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ - ia64_intri_res; \ -}) - -#define ia64_get_pmc(index) \ -({ \ - unsigned long ia64_intri_res; \ - asm volatile ("mov %0=pmc[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ - ia64_intri_res; \ -}) - - -#define ia64_native_get_pmd(index) \ -({ \ - unsigned long ia64_intri_res; \ - asm volatile ("mov %0=pmd[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ - ia64_intri_res; \ -}) - -#define ia64_native_get_rr(index) \ -({ \ - unsigned long ia64_intri_res; \ - asm volatile ("mov %0=rr[%1]" : "=r"(ia64_intri_res) : "r" (index)); \ - ia64_intri_res; \ -}) - -#define ia64_native_fc(addr) asm volatile ("fc %0" :: "r"(addr) : "memory") - - -#define ia64_sync_i() asm volatile (";; sync.i" ::: "memory") - -#define ia64_native_ssm(mask) asm volatile ("ssm %0":: "i"((mask)) : "memory") -#define ia64_native_rsm(mask) asm volatile ("rsm %0":: "i"((mask)) : "memory") -#define ia64_sum(mask) asm volatile ("sum %0":: "i"((mask)) : "memory") -#define ia64_rum(mask) asm volatile ("rum %0":: "i"((mask)) : "memory") - -#define ia64_ptce(addr) asm volatile ("ptc.e %0" :: "r"(addr)) - -#define ia64_native_ptcga(addr, size) \ -do { \ - asm volatile ("ptc.ga %0,%1" :: "r"(addr), "r"(size) : "memory"); \ - ia64_dv_serialize_data(); \ -} while (0) - -#define ia64_ptcl(addr, size) \ -do { \ - asm volatile ("ptc.l %0,%1" :: "r"(addr), "r"(size) : "memory"); \ - ia64_dv_serialize_data(); \ -} while (0) - -#define ia64_ptri(addr, size) \ - asm volatile ("ptr.i %0,%1" :: "r"(addr), "r"(size) : "memory") - -#define ia64_ptrd(addr, size) \ - asm volatile ("ptr.d %0,%1" :: "r"(addr), "r"(size) : "memory") - -#define ia64_ttag(addr) \ -({ \ - __u64 ia64_intri_res; \ - asm volatile ("ttag %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \ - ia64_intri_res; \ -}) - - -/* Values for lfhint in ia64_lfetch and ia64_lfetch_fault */ - -#define ia64_lfhint_none 0 -#define ia64_lfhint_nt1 1 -#define ia64_lfhint_nt2 2 -#define ia64_lfhint_nta 3 - -#define ia64_lfetch(lfhint, y) \ -({ \ - switch (lfhint) { \ - case ia64_lfhint_none: \ - asm volatile ("lfetch [%0]" : : "r"(y)); \ - break; \ - case ia64_lfhint_nt1: \ - asm volatile ("lfetch.nt1 [%0]" : : "r"(y)); \ - break; \ - case ia64_lfhint_nt2: \ - asm volatile ("lfetch.nt2 [%0]" : : "r"(y)); \ - break; \ - case ia64_lfhint_nta: \ - asm volatile ("lfetch.nta [%0]" : : "r"(y)); \ - break; \ - } \ -}) - -#define ia64_lfetch_excl(lfhint, y) \ -({ \ - switch (lfhint) { \ - case ia64_lfhint_none: \ - asm volatile ("lfetch.excl [%0]" :: "r"(y)); \ - break; \ - case ia64_lfhint_nt1: \ - asm volatile ("lfetch.excl.nt1 [%0]" :: "r"(y)); \ - break; \ - case ia64_lfhint_nt2: \ - asm volatile ("lfetch.excl.nt2 [%0]" :: "r"(y)); \ - break; \ - case ia64_lfhint_nta: \ - asm volatile ("lfetch.excl.nta [%0]" :: "r"(y)); \ - break; \ - } \ -}) - -#define ia64_lfetch_fault(lfhint, y) \ -({ \ - switch (lfhint) { \ - case ia64_lfhint_none: \ - asm volatile ("lfetch.fault [%0]" : : "r"(y)); \ - break; \ - case ia64_lfhint_nt1: \ - asm volatile ("lfetch.fault.nt1 [%0]" : : "r"(y)); \ - break; \ - case ia64_lfhint_nt2: \ - asm volatile ("lfetch.fault.nt2 [%0]" : : "r"(y)); \ - break; \ - case ia64_lfhint_nta: \ - asm volatile ("lfetch.fault.nta [%0]" : : "r"(y)); \ - break; \ - } \ -}) - -#define ia64_lfetch_fault_excl(lfhint, y) \ -({ \ - switch (lfhint) { \ - case ia64_lfhint_none: \ - asm volatile ("lfetch.fault.excl [%0]" :: "r"(y)); \ - break; \ - case ia64_lfhint_nt1: \ - asm volatile ("lfetch.fault.excl.nt1 [%0]" :: "r"(y)); \ - break; \ - case ia64_lfhint_nt2: \ - asm volatile ("lfetch.fault.excl.nt2 [%0]" :: "r"(y)); \ - break; \ - case ia64_lfhint_nta: \ - asm volatile ("lfetch.fault.excl.nta [%0]" :: "r"(y)); \ - break; \ - } \ -}) - -#define ia64_native_intrin_local_irq_restore(x) \ -do { \ - asm volatile (";; cmp.ne p6,p7=%0,r0;;" \ - "(p6) ssm psr.i;" \ - "(p7) rsm psr.i;;" \ - "(p6) srlz.d" \ - :: "r"((x)) : "p6", "p7", "memory"); \ -} while (0) - -#endif /* _UAPI_ASM_IA64_GCC_INTRIN_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/intrinsics.h b/trunk/arch/ia64/include/uapi/asm/intrinsics.h deleted file mode 100644 index 5829978ff466..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/intrinsics.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Compiler-dependent intrinsics. - * - * Copyright (C) 2002-2003 Hewlett-Packard Co - * David Mosberger-Tang - */ -#ifndef _UAPI_ASM_IA64_INTRINSICS_H -#define _UAPI_ASM_IA64_INTRINSICS_H - - -#ifndef __ASSEMBLY__ - -#include -/* include compiler specific intrinsics */ -#include -#ifdef __INTEL_COMPILER -# include -#else -# include -#endif -#include - -#define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I) - -#define ia64_native_set_rr0_to_rr4(val0, val1, val2, val3, val4) \ -do { \ - ia64_native_set_rr(0x0000000000000000UL, (val0)); \ - ia64_native_set_rr(0x2000000000000000UL, (val1)); \ - ia64_native_set_rr(0x4000000000000000UL, (val2)); \ - ia64_native_set_rr(0x6000000000000000UL, (val3)); \ - ia64_native_set_rr(0x8000000000000000UL, (val4)); \ -} while (0) - -/* - * Force an unresolved reference if someone tries to use - * ia64_fetch_and_add() with a bad value. - */ -extern unsigned long __bad_size_for_ia64_fetch_and_add (void); -extern unsigned long __bad_increment_for_ia64_fetch_and_add (void); - -#define IA64_FETCHADD(tmp,v,n,sz,sem) \ -({ \ - switch (sz) { \ - case 4: \ - tmp = ia64_fetchadd4_##sem((unsigned int *) v, n); \ - break; \ - \ - case 8: \ - tmp = ia64_fetchadd8_##sem((unsigned long *) v, n); \ - break; \ - \ - default: \ - __bad_size_for_ia64_fetch_and_add(); \ - } \ -}) - -#define ia64_fetchadd(i,v,sem) \ -({ \ - __u64 _tmp; \ - volatile __typeof__(*(v)) *_v = (v); \ - /* Can't use a switch () here: gcc isn't always smart enough for that... */ \ - if ((i) == -16) \ - IA64_FETCHADD(_tmp, _v, -16, sizeof(*(v)), sem); \ - else if ((i) == -8) \ - IA64_FETCHADD(_tmp, _v, -8, sizeof(*(v)), sem); \ - else if ((i) == -4) \ - IA64_FETCHADD(_tmp, _v, -4, sizeof(*(v)), sem); \ - else if ((i) == -1) \ - IA64_FETCHADD(_tmp, _v, -1, sizeof(*(v)), sem); \ - else if ((i) == 1) \ - IA64_FETCHADD(_tmp, _v, 1, sizeof(*(v)), sem); \ - else if ((i) == 4) \ - IA64_FETCHADD(_tmp, _v, 4, sizeof(*(v)), sem); \ - else if ((i) == 8) \ - IA64_FETCHADD(_tmp, _v, 8, sizeof(*(v)), sem); \ - else if ((i) == 16) \ - IA64_FETCHADD(_tmp, _v, 16, sizeof(*(v)), sem); \ - else \ - _tmp = __bad_increment_for_ia64_fetch_and_add(); \ - (__typeof__(*(v))) (_tmp); /* return old value */ \ -}) - -#define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */ - -#endif - - -#ifndef __ASSEMBLY__ - -#define IA64_INTRINSIC_API(name) ia64_native_ ## name -#define IA64_INTRINSIC_MACRO(name) ia64_native_ ## name - - -/************************************************/ -/* Instructions paravirtualized for correctness */ -/************************************************/ -/* fc, thash, get_cpuid, get_pmd, get_eflags, set_eflags */ -/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag" - * is not currently used (though it may be in a long-format VHPT system!) - */ -#define ia64_fc IA64_INTRINSIC_API(fc) -#define ia64_thash IA64_INTRINSIC_API(thash) -#define ia64_get_cpuid IA64_INTRINSIC_API(get_cpuid) -#define ia64_get_pmd IA64_INTRINSIC_API(get_pmd) - - -/************************************************/ -/* Instructions paravirtualized for performance */ -/************************************************/ -#define ia64_ssm IA64_INTRINSIC_MACRO(ssm) -#define ia64_rsm IA64_INTRINSIC_MACRO(rsm) -#define ia64_getreg IA64_INTRINSIC_MACRO(getreg) -#define ia64_setreg IA64_INTRINSIC_API(setreg) -#define ia64_set_rr IA64_INTRINSIC_API(set_rr) -#define ia64_get_rr IA64_INTRINSIC_API(get_rr) -#define ia64_ptcga IA64_INTRINSIC_API(ptcga) -#define ia64_get_psr_i IA64_INTRINSIC_API(get_psr_i) -#define ia64_intrin_local_irq_restore \ - IA64_INTRINSIC_API(intrin_local_irq_restore) -#define ia64_set_rr0_to_rr4 IA64_INTRINSIC_API(set_rr0_to_rr4) - -#endif /* !__ASSEMBLY__ */ - -#endif /* _UAPI_ASM_IA64_INTRINSICS_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/kvm_para.h b/trunk/arch/ia64/include/uapi/asm/kvm_para.h deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/trunk/arch/ia64/include/uapi/asm/mman.h b/trunk/arch/ia64/include/uapi/asm/mman.h deleted file mode 100644 index 8740819adc54..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/mman.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Based on . - * - * Modified 1998-2000, 2002 - * David Mosberger-Tang , Hewlett-Packard Co - */ -#ifndef _UAPI_ASM_IA64_MMAN_H -#define _UAPI_ASM_IA64_MMAN_H - - -#include - -#define MAP_GROWSUP 0x0200 /* register stack-like segment */ - - -#endif /* _UAPI_ASM_IA64_MMAN_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/param.h b/trunk/arch/ia64/include/uapi/asm/param.h deleted file mode 100644 index d7da41d9497d..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/param.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Fundamental kernel parameters. - * - * Based on . - * - * Modified 1998, 1999, 2002-2003 - * David Mosberger-Tang , Hewlett-Packard Co - */ -#ifndef _UAPI_ASM_IA64_PARAM_H -#define _UAPI_ASM_IA64_PARAM_H - - -#define EXEC_PAGESIZE 65536 - -#ifndef NOGROUP -# define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 /* max length of hostname */ - -#ifndef __KERNEL__ - /* - * Technically, this is wrong, but some old apps still refer to it. The proper way to - * get the HZ value is via sysconf(_SC_CLK_TCK). - */ -# define HZ 1024 -#endif - -#endif /* _UAPI_ASM_IA64_PARAM_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/perfmon.h b/trunk/arch/ia64/include/uapi/asm/perfmon.h deleted file mode 100644 index 1a10a2dd58a1..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/perfmon.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2001-2003 Hewlett-Packard Co - * Stephane Eranian - */ - -#ifndef _UAPI_ASM_IA64_PERFMON_H -#define _UAPI_ASM_IA64_PERFMON_H - -/* - * perfmon commands supported on all CPU models - */ -#define PFM_WRITE_PMCS 0x01 -#define PFM_WRITE_PMDS 0x02 -#define PFM_READ_PMDS 0x03 -#define PFM_STOP 0x04 -#define PFM_START 0x05 -#define PFM_ENABLE 0x06 /* obsolete */ -#define PFM_DISABLE 0x07 /* obsolete */ -#define PFM_CREATE_CONTEXT 0x08 -#define PFM_DESTROY_CONTEXT 0x09 /* obsolete use close() */ -#define PFM_RESTART 0x0a -#define PFM_PROTECT_CONTEXT 0x0b /* obsolete */ -#define PFM_GET_FEATURES 0x0c -#define PFM_DEBUG 0x0d -#define PFM_UNPROTECT_CONTEXT 0x0e /* obsolete */ -#define PFM_GET_PMC_RESET_VAL 0x0f -#define PFM_LOAD_CONTEXT 0x10 -#define PFM_UNLOAD_CONTEXT 0x11 - -/* - * PMU model specific commands (may not be supported on all PMU models) - */ -#define PFM_WRITE_IBRS 0x20 -#define PFM_WRITE_DBRS 0x21 - -/* - * context flags - */ -#define PFM_FL_NOTIFY_BLOCK 0x01 /* block task on user level notifications */ -#define PFM_FL_SYSTEM_WIDE 0x02 /* create a system wide context */ -#define PFM_FL_OVFL_NO_MSG 0x80 /* do not post overflow/end messages for notification */ - -/* - * event set flags - */ -#define PFM_SETFL_EXCL_IDLE 0x01 /* exclude idle task (syswide only) XXX: DO NOT USE YET */ - -/* - * PMC flags - */ -#define PFM_REGFL_OVFL_NOTIFY 0x1 /* send notification on overflow */ -#define PFM_REGFL_RANDOM 0x2 /* randomize sampling interval */ - -/* - * PMD/PMC/IBR/DBR return flags (ignored on input) - * - * Those flags are used on output and must be checked in case EAGAIN is returned - * by any of the calls using a pfarg_reg_t or pfarg_dbreg_t structure. - */ -#define PFM_REG_RETFL_NOTAVAIL (1UL<<31) /* set if register is implemented but not available */ -#define PFM_REG_RETFL_EINVAL (1UL<<30) /* set if register entry is invalid */ -#define PFM_REG_RETFL_MASK (PFM_REG_RETFL_NOTAVAIL|PFM_REG_RETFL_EINVAL) - -#define PFM_REG_HAS_ERROR(flag) (((flag) & PFM_REG_RETFL_MASK) != 0) - -typedef unsigned char pfm_uuid_t[16]; /* custom sampling buffer identifier type */ - -/* - * Request structure used to define a context - */ -typedef struct { - pfm_uuid_t ctx_smpl_buf_id; /* which buffer format to use (if needed) */ - unsigned long ctx_flags; /* noblock/block */ - unsigned short ctx_nextra_sets; /* number of extra event sets (you always get 1) */ - unsigned short ctx_reserved1; /* for future use */ - int ctx_fd; /* return arg: unique identification for context */ - void *ctx_smpl_vaddr; /* return arg: virtual address of sampling buffer, is used */ - unsigned long ctx_reserved2[11];/* for future use */ -} pfarg_context_t; - -/* - * Request structure used to write/read a PMC or PMD - */ -typedef struct { - unsigned int reg_num; /* which register */ - unsigned short reg_set; /* event set for this register */ - unsigned short reg_reserved1; /* for future use */ - - unsigned long reg_value; /* initial pmc/pmd value */ - unsigned long reg_flags; /* input: pmc/pmd flags, return: reg error */ - - unsigned long reg_long_reset; /* reset after buffer overflow notification */ - unsigned long reg_short_reset; /* reset after counter overflow */ - - unsigned long reg_reset_pmds[4]; /* which other counters to reset on overflow */ - unsigned long reg_random_seed; /* seed value when randomization is used */ - unsigned long reg_random_mask; /* bitmask used to limit random value */ - unsigned long reg_last_reset_val;/* return: PMD last reset value */ - - unsigned long reg_smpl_pmds[4]; /* which pmds are accessed when PMC overflows */ - unsigned long reg_smpl_eventid; /* opaque sampling event identifier */ - - unsigned long reg_reserved2[3]; /* for future use */ -} pfarg_reg_t; - -typedef struct { - unsigned int dbreg_num; /* which debug register */ - unsigned short dbreg_set; /* event set for this register */ - unsigned short dbreg_reserved1; /* for future use */ - unsigned long dbreg_value; /* value for debug register */ - unsigned long dbreg_flags; /* return: dbreg error */ - unsigned long dbreg_reserved2[1]; /* for future use */ -} pfarg_dbreg_t; - -typedef struct { - unsigned int ft_version; /* perfmon: major [16-31], minor [0-15] */ - unsigned int ft_reserved; /* reserved for future use */ - unsigned long reserved[4]; /* for future use */ -} pfarg_features_t; - -typedef struct { - pid_t load_pid; /* process to load the context into */ - unsigned short load_set; /* first event set to load */ - unsigned short load_reserved1; /* for future use */ - unsigned long load_reserved2[3]; /* for future use */ -} pfarg_load_t; - -typedef struct { - int msg_type; /* generic message header */ - int msg_ctx_fd; /* generic message header */ - unsigned long msg_ovfl_pmds[4]; /* which PMDs overflowed */ - unsigned short msg_active_set; /* active set at the time of overflow */ - unsigned short msg_reserved1; /* for future use */ - unsigned int msg_reserved2; /* for future use */ - unsigned long msg_tstamp; /* for perf tuning/debug */ -} pfm_ovfl_msg_t; - -typedef struct { - int msg_type; /* generic message header */ - int msg_ctx_fd; /* generic message header */ - unsigned long msg_tstamp; /* for perf tuning */ -} pfm_end_msg_t; - -typedef struct { - int msg_type; /* type of the message */ - int msg_ctx_fd; /* unique identifier for the context */ - unsigned long msg_tstamp; /* for perf tuning */ -} pfm_gen_msg_t; - -#define PFM_MSG_OVFL 1 /* an overflow happened */ -#define PFM_MSG_END 2 /* task to which context was attached ended */ - -typedef union { - pfm_ovfl_msg_t pfm_ovfl_msg; - pfm_end_msg_t pfm_end_msg; - pfm_gen_msg_t pfm_gen_msg; -} pfm_msg_t; - -/* - * Define the version numbers for both perfmon as a whole and the sampling buffer format. - */ -#define PFM_VERSION_MAJ 2U -#define PFM_VERSION_MIN 0U -#define PFM_VERSION (((PFM_VERSION_MAJ&0xffff)<<16)|(PFM_VERSION_MIN & 0xffff)) -#define PFM_VERSION_MAJOR(x) (((x)>>16) & 0xffff) -#define PFM_VERSION_MINOR(x) ((x) & 0xffff) - - -/* - * miscellaneous architected definitions - */ -#define PMU_FIRST_COUNTER 4 /* first counting monitor (PMC/PMD) */ -#define PMU_MAX_PMCS 256 /* maximum architected number of PMC registers */ -#define PMU_MAX_PMDS 256 /* maximum architected number of PMD registers */ - - -#endif /* _UAPI_ASM_IA64_PERFMON_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/ptrace.h b/trunk/arch/ia64/include/uapi/asm/ptrace.h deleted file mode 100644 index 0a02f634e12b..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 1998-2004 Hewlett-Packard Co - * David Mosberger-Tang - * Stephane Eranian - * Copyright (C) 2003 Intel Co - * Suresh Siddha - * Fenghua Yu - * Arun Sharma - * - * 12/07/98 S. Eranian added pt_regs & switch_stack - * 12/21/98 D. Mosberger updated to match latest code - * 6/17/99 D. Mosberger added second unat member to "struct switch_stack" - * - */ -#ifndef _UAPI_ASM_IA64_PTRACE_H -#define _UAPI_ASM_IA64_PTRACE_H - -/* - * When a user process is blocked, its state looks as follows: - * - * +----------------------+ ------- IA64_STK_OFFSET - * | | ^ - * | struct pt_regs | | - * | | | - * +----------------------+ | - * | | | - * | memory stack | | - * | (growing downwards) | | - * //.....................// | - * | - * //.....................// | - * | | | - * +----------------------+ | - * | struct switch_stack | | - * | | | - * +----------------------+ | - * | | | - * //.....................// | - * | - * //.....................// | - * | | | - * | register stack | | - * | (growing upwards) | | - * | | | - * +----------------------+ | --- IA64_RBS_OFFSET - * | struct thread_info | | ^ - * +----------------------+ | | - * | | | | - * | struct task_struct | | | - * current -> | | | | - * +----------------------+ ------- - * - * Note that ar.ec is not saved explicitly in pt_reg or switch_stack. - * This is because ar.ec is saved as part of ar.pfs. - */ - - -#include - - -#ifndef __ASSEMBLY__ - -/* - * This struct defines the way the registers are saved on system - * calls. - * - * We don't save all floating point register because the kernel - * is compiled to use only a very small subset, so the other are - * untouched. - * - * THIS STRUCTURE MUST BE A MULTIPLE 16-BYTE IN SIZE - * (because the memory stack pointer MUST ALWAYS be aligned this way) - * - */ -struct pt_regs { - /* The following registers are saved by SAVE_MIN: */ - unsigned long b6; /* scratch */ - unsigned long b7; /* scratch */ - - unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */ - unsigned long ar_ssd; /* reserved for future use (scratch) */ - - unsigned long r8; /* scratch (return value register 0) */ - unsigned long r9; /* scratch (return value register 1) */ - unsigned long r10; /* scratch (return value register 2) */ - unsigned long r11; /* scratch (return value register 3) */ - - unsigned long cr_ipsr; /* interrupted task's psr */ - unsigned long cr_iip; /* interrupted task's instruction pointer */ - /* - * interrupted task's function state; if bit 63 is cleared, it - * contains syscall's ar.pfs.pfm: - */ - unsigned long cr_ifs; - - unsigned long ar_unat; /* interrupted task's NaT register (preserved) */ - unsigned long ar_pfs; /* prev function state */ - unsigned long ar_rsc; /* RSE configuration */ - /* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */ - unsigned long ar_rnat; /* RSE NaT */ - unsigned long ar_bspstore; /* RSE bspstore */ - - unsigned long pr; /* 64 predicate registers (1 bit each) */ - unsigned long b0; /* return pointer (bp) */ - unsigned long loadrs; /* size of dirty partition << 16 */ - - unsigned long r1; /* the gp pointer */ - unsigned long r12; /* interrupted task's memory stack pointer */ - unsigned long r13; /* thread pointer */ - - unsigned long ar_fpsr; /* floating point status (preserved) */ - unsigned long r15; /* scratch */ - - /* The remaining registers are NOT saved for system calls. */ - - unsigned long r14; /* scratch */ - unsigned long r2; /* scratch */ - unsigned long r3; /* scratch */ - - /* The following registers are saved by SAVE_REST: */ - unsigned long r16; /* scratch */ - unsigned long r17; /* scratch */ - unsigned long r18; /* scratch */ - unsigned long r19; /* scratch */ - unsigned long r20; /* scratch */ - unsigned long r21; /* scratch */ - unsigned long r22; /* scratch */ - unsigned long r23; /* scratch */ - unsigned long r24; /* scratch */ - unsigned long r25; /* scratch */ - unsigned long r26; /* scratch */ - unsigned long r27; /* scratch */ - unsigned long r28; /* scratch */ - unsigned long r29; /* scratch */ - unsigned long r30; /* scratch */ - unsigned long r31; /* scratch */ - - unsigned long ar_ccv; /* compare/exchange value (scratch) */ - - /* - * Floating point registers that the kernel considers scratch: - */ - struct ia64_fpreg f6; /* scratch */ - struct ia64_fpreg f7; /* scratch */ - struct ia64_fpreg f8; /* scratch */ - struct ia64_fpreg f9; /* scratch */ - struct ia64_fpreg f10; /* scratch */ - struct ia64_fpreg f11; /* scratch */ -}; - -/* - * This structure contains the addition registers that need to - * preserved across a context switch. This generally consists of - * "preserved" registers. - */ -struct switch_stack { - unsigned long caller_unat; /* user NaT collection register (preserved) */ - unsigned long ar_fpsr; /* floating-point status register */ - - struct ia64_fpreg f2; /* preserved */ - struct ia64_fpreg f3; /* preserved */ - struct ia64_fpreg f4; /* preserved */ - struct ia64_fpreg f5; /* preserved */ - - struct ia64_fpreg f12; /* scratch, but untouched by kernel */ - struct ia64_fpreg f13; /* scratch, but untouched by kernel */ - struct ia64_fpreg f14; /* scratch, but untouched by kernel */ - struct ia64_fpreg f15; /* scratch, but untouched by kernel */ - struct ia64_fpreg f16; /* preserved */ - struct ia64_fpreg f17; /* preserved */ - struct ia64_fpreg f18; /* preserved */ - struct ia64_fpreg f19; /* preserved */ - struct ia64_fpreg f20; /* preserved */ - struct ia64_fpreg f21; /* preserved */ - struct ia64_fpreg f22; /* preserved */ - struct ia64_fpreg f23; /* preserved */ - struct ia64_fpreg f24; /* preserved */ - struct ia64_fpreg f25; /* preserved */ - struct ia64_fpreg f26; /* preserved */ - struct ia64_fpreg f27; /* preserved */ - struct ia64_fpreg f28; /* preserved */ - struct ia64_fpreg f29; /* preserved */ - struct ia64_fpreg f30; /* preserved */ - struct ia64_fpreg f31; /* preserved */ - - unsigned long r4; /* preserved */ - unsigned long r5; /* preserved */ - unsigned long r6; /* preserved */ - unsigned long r7; /* preserved */ - - unsigned long b0; /* so we can force a direct return in copy_thread */ - unsigned long b1; - unsigned long b2; - unsigned long b3; - unsigned long b4; - unsigned long b5; - - unsigned long ar_pfs; /* previous function state */ - unsigned long ar_lc; /* loop counter (preserved) */ - unsigned long ar_unat; /* NaT bits for r4-r7 */ - unsigned long ar_rnat; /* RSE NaT collection register */ - unsigned long ar_bspstore; /* RSE dirty base (preserved) */ - unsigned long pr; /* 64 predicate registers (1 bit each) */ -}; - - -/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ -struct pt_all_user_regs { - unsigned long nat; - unsigned long cr_iip; - unsigned long cfm; - unsigned long cr_ipsr; - unsigned long pr; - - unsigned long gr[32]; - unsigned long br[8]; - unsigned long ar[128]; - struct ia64_fpreg fr[128]; -}; - -#endif /* !__ASSEMBLY__ */ - -/* indices to application-registers array in pt_all_user_regs */ -#define PT_AUR_RSC 16 -#define PT_AUR_BSP 17 -#define PT_AUR_BSPSTORE 18 -#define PT_AUR_RNAT 19 -#define PT_AUR_CCV 32 -#define PT_AUR_UNAT 36 -#define PT_AUR_FPSR 40 -#define PT_AUR_PFS 64 -#define PT_AUR_LC 65 -#define PT_AUR_EC 66 - -/* - * The numbers chosen here are somewhat arbitrary but absolutely MUST - * not overlap with any of the number assigned in . - */ -#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */ -#define PTRACE_OLD_GETSIGINFO 13 /* (replaced by PTRACE_GETSIGINFO in ) */ -#define PTRACE_OLD_SETSIGINFO 14 /* (replaced by PTRACE_SETSIGINFO in ) */ -#define PTRACE_GETREGS 18 /* get all registers (pt_all_user_regs) in one shot */ -#define PTRACE_SETREGS 19 /* set all registers (pt_all_user_regs) in one shot */ - -#define PTRACE_OLDSETOPTIONS 21 - -#endif /* _UAPI_ASM_IA64_PTRACE_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/siginfo.h b/trunk/arch/ia64/include/uapi/asm/siginfo.h deleted file mode 100644 index 4ea6225196bb..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/siginfo.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Based on . - * - * Modified 1998-2002 - * David Mosberger-Tang , Hewlett-Packard Co - */ -#ifndef _UAPI_ASM_IA64_SIGINFO_H -#define _UAPI_ASM_IA64_SIGINFO_H - - -#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) - -#define HAVE_ARCH_SIGINFO_T -#define HAVE_ARCH_COPY_SIGINFO -#define HAVE_ARCH_COPY_SIGINFO_TO_USER - -#include - -typedef struct siginfo { - int si_signo; - int si_errno; - int si_code; - int __pad0; - - union { - int _pad[SI_PAD_SIZE]; - - /* kill() */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - char _pad[sizeof(__ARCH_SI_UID_T) - sizeof(int)]; - sigval_t _sigval; /* must overlay ._rt._sigval! */ - int _sys_private; /* not to be passed to user */ - } _timer; - - /* POSIX.1b signals */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - pid_t _pid; /* which child */ - uid_t _uid; /* sender's uid */ - int _status; /* exit code */ - clock_t _utime; - clock_t _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - void __user *_addr; /* faulting insn/memory ref. */ - int _imm; /* immediate value for "break" */ - unsigned int _flags; /* see below */ - unsigned long _isr; /* isr */ - short _addr_lsb; /* lsb of faulting address */ - } _sigfault; - - /* SIGPOLL */ - struct { - long _band; /* POLL_IN, POLL_OUT, POLL_MSG (XPG requires a "long") */ - int _fd; - } _sigpoll; - } _sifields; -} siginfo_t; - -#define si_imm _sifields._sigfault._imm /* as per UNIX SysV ABI spec */ -#define si_flags _sifields._sigfault._flags -/* - * si_isr is valid for SIGILL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP provided that - * si_code is non-zero and __ISR_VALID is set in si_flags. - */ -#define si_isr _sifields._sigfault._isr - -/* - * Flag values for si_flags: - */ -#define __ISR_VALID_BIT 0 -#define __ISR_VALID (1 << __ISR_VALID_BIT) - -/* - * SIGILL si_codes - */ -#define ILL_BADIADDR (__SI_FAULT|9) /* unimplemented instruction address */ -#define __ILL_BREAK (__SI_FAULT|10) /* illegal break */ -#define __ILL_BNDMOD (__SI_FAULT|11) /* bundle-update (modification) in progress */ -#undef NSIGILL -#define NSIGILL 11 - -/* - * SIGFPE si_codes - */ -#define __FPE_DECOVF (__SI_FAULT|9) /* decimal overflow */ -#define __FPE_DECDIV (__SI_FAULT|10) /* decimal division by zero */ -#define __FPE_DECERR (__SI_FAULT|11) /* packed decimal error */ -#define __FPE_INVASC (__SI_FAULT|12) /* invalid ASCII digit */ -#define __FPE_INVDEC (__SI_FAULT|13) /* invalid decimal digit */ -#undef NSIGFPE -#define NSIGFPE 13 - -/* - * SIGSEGV si_codes - */ -#define __SEGV_PSTKOVF (__SI_FAULT|3) /* paragraph stack overflow */ -#undef NSIGSEGV -#define NSIGSEGV 3 - -#undef NSIGTRAP -#define NSIGTRAP 4 - - -#endif /* _UAPI_ASM_IA64_SIGINFO_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/signal.h b/trunk/arch/ia64/include/uapi/asm/signal.h deleted file mode 100644 index e531c424434c..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/signal.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Modified 1998-2001, 2003 - * David Mosberger-Tang , Hewlett-Packard Co - * - * Unfortunately, this file is being included by bits/signal.h in - * glibc-2.x. Hence the #ifdef __KERNEL__ ugliness. - */ -#ifndef _UAPI_ASM_IA64_SIGNAL_H -#define _UAPI_ASM_IA64_SIGNAL_H - - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT 6 -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -/* -#define SIGLOST 29 -*/ -#define SIGPWR 30 -#define SIGSYS 31 -/* signal 31 is no longer "unused", but the SIGUNUSED macro remains for backwards compatibility */ -#define SIGUNUSED 31 - -/* These should not be considered constants from userland. */ -#define SIGRTMIN 32 -#define SIGRTMAX _NSIG - -/* - * SA_FLAGS values: - * - * SA_ONSTACK indicates that a registered stack_t will be used. - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. - * SA_RESETHAND clears the handler when the signal is delivered. - * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. - * SA_NODEFER prevents the current signal from being masked in the handler. - * - * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single - * Unix names RESETHAND and NODEFER respectively. - */ -#define SA_NOCLDSTOP 0x00000001 -#define SA_NOCLDWAIT 0x00000002 -#define SA_SIGINFO 0x00000004 -#define SA_ONSTACK 0x08000000 -#define SA_RESTART 0x10000000 -#define SA_NODEFER 0x40000000 -#define SA_RESETHAND 0x80000000 - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND - -#define SA_RESTORER 0x04000000 - -/* - * sigaltstack controls - */ -#define SS_ONSTACK 1 -#define SS_DISABLE 2 - -/* - * The minimum stack size needs to be fairly large because we want to - * be sure that an app compiled for today's CPUs will continue to run - * on all future CPU models. The CPU model matters because the signal - * frame needs to have space for the complete machine state, including - * all physical stacked registers. The number of physical stacked - * registers is CPU model dependent, but given that the width of - * ar.rsc.loadrs is 14 bits, we can assume that they'll never take up - * more than 16KB of space. - */ -#if 1 - /* - * This is a stupid typo: the value was _meant_ to be 131072 (0x20000), but I typed it - * in wrong. ;-( To preserve backwards compatibility, we leave the kernel at the - * incorrect value and fix libc only. - */ -# define MINSIGSTKSZ 131027 /* min. stack size for sigaltstack() */ -#else -# define MINSIGSTKSZ 131072 /* min. stack size for sigaltstack() */ -#endif -#define SIGSTKSZ 262144 /* default stack size for sigaltstack() */ - - -#include - -# ifndef __ASSEMBLY__ - -# include - -/* Avoid too many header ordering problems. */ -struct siginfo; - -typedef struct sigaltstack { - void __user *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - - -# endif /* !__ASSEMBLY__ */ -#endif /* _UAPI_ASM_IA64_SIGNAL_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/termios.h b/trunk/arch/ia64/include/uapi/asm/termios.h deleted file mode 100644 index d59b48c307f8..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/termios.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Modified 1999 - * David Mosberger-Tang , Hewlett-Packard Co - * - * 99/01/28 Added N_IRDA and N_SMSBLOCK - */ -#ifndef _UAPI_ASM_IA64_TERMIOS_H -#define _UAPI_ASM_IA64_TERMIOS_H - - -#include -#include - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - - -#endif /* _UAPI_ASM_IA64_TERMIOS_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/types.h b/trunk/arch/ia64/include/uapi/asm/types.h deleted file mode 100644 index 321193b05eed..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/types.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is never included by application software unless explicitly - * requested (e.g., via linux/types.h) in which case the application is - * Linux specific so (user-) name space pollution is not a major issue. - * However, for interoperability, libraries still need to be careful to - * avoid naming clashes. - * - * Based on . - * - * Modified 1998-2000, 2002 - * David Mosberger-Tang , Hewlett-Packard Co - */ -#ifndef _UAPI_ASM_IA64_TYPES_H -#define _UAPI_ASM_IA64_TYPES_H - - -#ifndef __KERNEL__ -#include -#endif - -#ifdef __ASSEMBLY__ -# define __IA64_UL(x) (x) -# define __IA64_UL_CONST(x) x - -#else -# define __IA64_UL(x) ((unsigned long)(x)) -# define __IA64_UL_CONST(x) x##UL - -#endif /* !__ASSEMBLY__ */ - -#endif /* _UAPI_ASM_IA64_TYPES_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/unistd.h b/trunk/arch/ia64/include/uapi/asm/unistd.h deleted file mode 100644 index b706aa54df20..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/unistd.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - * IA-64 Linux syscall numbers and inline-functions. - * - * Copyright (C) 1998-2005 Hewlett-Packard Co - * David Mosberger-Tang - */ -#ifndef _UAPI_ASM_IA64_UNISTD_H -#define _UAPI_ASM_IA64_UNISTD_H - - -#include - -#define __BREAK_SYSCALL __IA64_BREAK_SYSCALL - -#define __NR_ni_syscall 1024 -#define __NR_exit 1025 -#define __NR_read 1026 -#define __NR_write 1027 -#define __NR_open 1028 -#define __NR_close 1029 -#define __NR_creat 1030 -#define __NR_link 1031 -#define __NR_unlink 1032 -#define __NR_execve 1033 -#define __NR_chdir 1034 -#define __NR_fchdir 1035 -#define __NR_utimes 1036 -#define __NR_mknod 1037 -#define __NR_chmod 1038 -#define __NR_chown 1039 -#define __NR_lseek 1040 -#define __NR_getpid 1041 -#define __NR_getppid 1042 -#define __NR_mount 1043 -#define __NR_umount 1044 -#define __NR_setuid 1045 -#define __NR_getuid 1046 -#define __NR_geteuid 1047 -#define __NR_ptrace 1048 -#define __NR_access 1049 -#define __NR_sync 1050 -#define __NR_fsync 1051 -#define __NR_fdatasync 1052 -#define __NR_kill 1053 -#define __NR_rename 1054 -#define __NR_mkdir 1055 -#define __NR_rmdir 1056 -#define __NR_dup 1057 -#define __NR_pipe 1058 -#define __NR_times 1059 -#define __NR_brk 1060 -#define __NR_setgid 1061 -#define __NR_getgid 1062 -#define __NR_getegid 1063 -#define __NR_acct 1064 -#define __NR_ioctl 1065 -#define __NR_fcntl 1066 -#define __NR_umask 1067 -#define __NR_chroot 1068 -#define __NR_ustat 1069 -#define __NR_dup2 1070 -#define __NR_setreuid 1071 -#define __NR_setregid 1072 -#define __NR_getresuid 1073 -#define __NR_setresuid 1074 -#define __NR_getresgid 1075 -#define __NR_setresgid 1076 -#define __NR_getgroups 1077 -#define __NR_setgroups 1078 -#define __NR_getpgid 1079 -#define __NR_setpgid 1080 -#define __NR_setsid 1081 -#define __NR_getsid 1082 -#define __NR_sethostname 1083 -#define __NR_setrlimit 1084 -#define __NR_getrlimit 1085 -#define __NR_getrusage 1086 -#define __NR_gettimeofday 1087 -#define __NR_settimeofday 1088 -#define __NR_select 1089 -#define __NR_poll 1090 -#define __NR_symlink 1091 -#define __NR_readlink 1092 -#define __NR_uselib 1093 -#define __NR_swapon 1094 -#define __NR_swapoff 1095 -#define __NR_reboot 1096 -#define __NR_truncate 1097 -#define __NR_ftruncate 1098 -#define __NR_fchmod 1099 -#define __NR_fchown 1100 -#define __NR_getpriority 1101 -#define __NR_setpriority 1102 -#define __NR_statfs 1103 -#define __NR_fstatfs 1104 -#define __NR_gettid 1105 -#define __NR_semget 1106 -#define __NR_semop 1107 -#define __NR_semctl 1108 -#define __NR_msgget 1109 -#define __NR_msgsnd 1110 -#define __NR_msgrcv 1111 -#define __NR_msgctl 1112 -#define __NR_shmget 1113 -#define __NR_shmat 1114 -#define __NR_shmdt 1115 -#define __NR_shmctl 1116 -/* also known as klogctl() in GNU libc: */ -#define __NR_syslog 1117 -#define __NR_setitimer 1118 -#define __NR_getitimer 1119 -/* 1120 was __NR_old_stat */ -/* 1121 was __NR_old_lstat */ -/* 1122 was __NR_old_fstat */ -#define __NR_vhangup 1123 -#define __NR_lchown 1124 -#define __NR_remap_file_pages 1125 -#define __NR_wait4 1126 -#define __NR_sysinfo 1127 -#define __NR_clone 1128 -#define __NR_setdomainname 1129 -#define __NR_uname 1130 -#define __NR_adjtimex 1131 -/* 1132 was __NR_create_module */ -#define __NR_init_module 1133 -#define __NR_delete_module 1134 -/* 1135 was __NR_get_kernel_syms */ -/* 1136 was __NR_query_module */ -#define __NR_quotactl 1137 -#define __NR_bdflush 1138 -#define __NR_sysfs 1139 -#define __NR_personality 1140 -#define __NR_afs_syscall 1141 -#define __NR_setfsuid 1142 -#define __NR_setfsgid 1143 -#define __NR_getdents 1144 -#define __NR_flock 1145 -#define __NR_readv 1146 -#define __NR_writev 1147 -#define __NR_pread64 1148 -#define __NR_pwrite64 1149 -#define __NR__sysctl 1150 -#define __NR_mmap 1151 -#define __NR_munmap 1152 -#define __NR_mlock 1153 -#define __NR_mlockall 1154 -#define __NR_mprotect 1155 -#define __NR_mremap 1156 -#define __NR_msync 1157 -#define __NR_munlock 1158 -#define __NR_munlockall 1159 -#define __NR_sched_getparam 1160 -#define __NR_sched_setparam 1161 -#define __NR_sched_getscheduler 1162 -#define __NR_sched_setscheduler 1163 -#define __NR_sched_yield 1164 -#define __NR_sched_get_priority_max 1165 -#define __NR_sched_get_priority_min 1166 -#define __NR_sched_rr_get_interval 1167 -#define __NR_nanosleep 1168 -#define __NR_nfsservctl 1169 -#define __NR_prctl 1170 -/* 1171 is reserved for backwards compatibility with old __NR_getpagesize */ -#define __NR_mmap2 1172 -#define __NR_pciconfig_read 1173 -#define __NR_pciconfig_write 1174 -#define __NR_perfmonctl 1175 -#define __NR_sigaltstack 1176 -#define __NR_rt_sigaction 1177 -#define __NR_rt_sigpending 1178 -#define __NR_rt_sigprocmask 1179 -#define __NR_rt_sigqueueinfo 1180 -#define __NR_rt_sigreturn 1181 -#define __NR_rt_sigsuspend 1182 -#define __NR_rt_sigtimedwait 1183 -#define __NR_getcwd 1184 -#define __NR_capget 1185 -#define __NR_capset 1186 -#define __NR_sendfile 1187 -#define __NR_getpmsg 1188 -#define __NR_putpmsg 1189 -#define __NR_socket 1190 -#define __NR_bind 1191 -#define __NR_connect 1192 -#define __NR_listen 1193 -#define __NR_accept 1194 -#define __NR_getsockname 1195 -#define __NR_getpeername 1196 -#define __NR_socketpair 1197 -#define __NR_send 1198 -#define __NR_sendto 1199 -#define __NR_recv 1200 -#define __NR_recvfrom 1201 -#define __NR_shutdown 1202 -#define __NR_setsockopt 1203 -#define __NR_getsockopt 1204 -#define __NR_sendmsg 1205 -#define __NR_recvmsg 1206 -#define __NR_pivot_root 1207 -#define __NR_mincore 1208 -#define __NR_madvise 1209 -#define __NR_stat 1210 -#define __NR_lstat 1211 -#define __NR_fstat 1212 -#define __NR_clone2 1213 -#define __NR_getdents64 1214 -#define __NR_getunwind 1215 -#define __NR_readahead 1216 -#define __NR_setxattr 1217 -#define __NR_lsetxattr 1218 -#define __NR_fsetxattr 1219 -#define __NR_getxattr 1220 -#define __NR_lgetxattr 1221 -#define __NR_fgetxattr 1222 -#define __NR_listxattr 1223 -#define __NR_llistxattr 1224 -#define __NR_flistxattr 1225 -#define __NR_removexattr 1226 -#define __NR_lremovexattr 1227 -#define __NR_fremovexattr 1228 -#define __NR_tkill 1229 -#define __NR_futex 1230 -#define __NR_sched_setaffinity 1231 -#define __NR_sched_getaffinity 1232 -#define __NR_set_tid_address 1233 -#define __NR_fadvise64 1234 -#define __NR_tgkill 1235 -#define __NR_exit_group 1236 -#define __NR_lookup_dcookie 1237 -#define __NR_io_setup 1238 -#define __NR_io_destroy 1239 -#define __NR_io_getevents 1240 -#define __NR_io_submit 1241 -#define __NR_io_cancel 1242 -#define __NR_epoll_create 1243 -#define __NR_epoll_ctl 1244 -#define __NR_epoll_wait 1245 -#define __NR_restart_syscall 1246 -#define __NR_semtimedop 1247 -#define __NR_timer_create 1248 -#define __NR_timer_settime 1249 -#define __NR_timer_gettime 1250 -#define __NR_timer_getoverrun 1251 -#define __NR_timer_delete 1252 -#define __NR_clock_settime 1253 -#define __NR_clock_gettime 1254 -#define __NR_clock_getres 1255 -#define __NR_clock_nanosleep 1256 -#define __NR_fstatfs64 1257 -#define __NR_statfs64 1258 -#define __NR_mbind 1259 -#define __NR_get_mempolicy 1260 -#define __NR_set_mempolicy 1261 -#define __NR_mq_open 1262 -#define __NR_mq_unlink 1263 -#define __NR_mq_timedsend 1264 -#define __NR_mq_timedreceive 1265 -#define __NR_mq_notify 1266 -#define __NR_mq_getsetattr 1267 -#define __NR_kexec_load 1268 -#define __NR_vserver 1269 -#define __NR_waitid 1270 -#define __NR_add_key 1271 -#define __NR_request_key 1272 -#define __NR_keyctl 1273 -#define __NR_ioprio_set 1274 -#define __NR_ioprio_get 1275 -#define __NR_move_pages 1276 -#define __NR_inotify_init 1277 -#define __NR_inotify_add_watch 1278 -#define __NR_inotify_rm_watch 1279 -#define __NR_migrate_pages 1280 -#define __NR_openat 1281 -#define __NR_mkdirat 1282 -#define __NR_mknodat 1283 -#define __NR_fchownat 1284 -#define __NR_futimesat 1285 -#define __NR_newfstatat 1286 -#define __NR_unlinkat 1287 -#define __NR_renameat 1288 -#define __NR_linkat 1289 -#define __NR_symlinkat 1290 -#define __NR_readlinkat 1291 -#define __NR_fchmodat 1292 -#define __NR_faccessat 1293 -#define __NR_pselect6 1294 -#define __NR_ppoll 1295 -#define __NR_unshare 1296 -#define __NR_splice 1297 -#define __NR_set_robust_list 1298 -#define __NR_get_robust_list 1299 -#define __NR_sync_file_range 1300 -#define __NR_tee 1301 -#define __NR_vmsplice 1302 -#define __NR_fallocate 1303 -#define __NR_getcpu 1304 -#define __NR_epoll_pwait 1305 -#define __NR_utimensat 1306 -#define __NR_signalfd 1307 -#define __NR_timerfd 1308 -#define __NR_eventfd 1309 -#define __NR_timerfd_create 1310 -#define __NR_timerfd_settime 1311 -#define __NR_timerfd_gettime 1312 -#define __NR_signalfd4 1313 -#define __NR_eventfd2 1314 -#define __NR_epoll_create1 1315 -#define __NR_dup3 1316 -#define __NR_pipe2 1317 -#define __NR_inotify_init1 1318 -#define __NR_preadv 1319 -#define __NR_pwritev 1320 -#define __NR_rt_tgsigqueueinfo 1321 -#define __NR_recvmmsg 1322 -#define __NR_fanotify_init 1323 -#define __NR_fanotify_mark 1324 -#define __NR_prlimit64 1325 -#define __NR_name_to_handle_at 1326 -#define __NR_open_by_handle_at 1327 -#define __NR_clock_adjtime 1328 -#define __NR_syncfs 1329 -#define __NR_setns 1330 -#define __NR_sendmmsg 1331 -#define __NR_process_vm_readv 1332 -#define __NR_process_vm_writev 1333 -#define __NR_accept4 1334 - -#endif /* _UAPI_ASM_IA64_UNISTD_H */ diff --git a/trunk/arch/ia64/include/uapi/asm/ustack.h b/trunk/arch/ia64/include/uapi/asm/ustack.h deleted file mode 100644 index 1dfebc622692..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/ustack.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _UAPI_ASM_IA64_USTACK_H -#define _UAPI_ASM_IA64_USTACK_H - -/* - * Constants for the user stack size - */ - - -/* Make a default stack size of 2GiB */ -#define DEFAULT_USER_STACK_SIZE (1UL << 31) - -#endif /* _UAPI_ASM_IA64_USTACK_H */ diff --git a/trunk/arch/ia64/kernel/process.c b/trunk/arch/ia64/kernel/process.c index 35e106f2ed13..ee31fe9b310e 100644 --- a/trunk/arch/ia64/kernel/process.c +++ b/trunk/arch/ia64/kernel/process.c @@ -614,14 +614,14 @@ sys_execve (const char __user *filename, const char __user *const __user *envp, struct pt_regs *regs) { - struct filename *fname; + char *fname; int error; fname = getname(filename); error = PTR_ERR(fname); if (IS_ERR(fname)) goto out; - error = do_execve(fname->name, argv, envp, regs); + error = do_execve(fname, argv, envp, regs); putname(fname); out: return error; diff --git a/trunk/arch/m32r/kernel/process.c b/trunk/arch/m32r/kernel/process.c index e7366276ef30..384e63f3a4c4 100644 --- a/trunk/arch/m32r/kernel/process.c +++ b/trunk/arch/m32r/kernel/process.c @@ -296,14 +296,14 @@ asmlinkage int sys_execve(const char __user *ufilename, unsigned long r6, struct pt_regs regs) { int error; - struct filename *filename; + char *filename; filename = getname(ufilename); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, uargv, uenvp, ®s); + error = do_execve(filename, uargv, uenvp, ®s); putname(filename); out: return error; diff --git a/trunk/arch/microblaze/kernel/sys_microblaze.c b/trunk/arch/microblaze/kernel/sys_microblaze.c index 404c0f24bd41..e5b154f24f85 100644 --- a/trunk/arch/microblaze/kernel/sys_microblaze.c +++ b/trunk/arch/microblaze/kernel/sys_microblaze.c @@ -54,13 +54,13 @@ asmlinkage long microblaze_execve(const char __user *filenamei, struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; filename = getname(filenamei); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); out: return error; diff --git a/trunk/arch/mips/kernel/kgdb.c b/trunk/arch/mips/kernel/kgdb.c index 23817a6e32b6..f4546e97c60d 100644 --- a/trunk/arch/mips/kernel/kgdb.c +++ b/trunk/arch/mips/kernel/kgdb.c @@ -283,15 +283,6 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd, struct pt_regs *regs = args->regs; int trap = (regs->cp0_cause & 0x7c) >> 2; -#ifdef CONFIG_KPROBES - /* - * Return immediately if the kprobes fault notifier has set - * DIE_PAGE_FAULT. - */ - if (cmd == DIE_PAGE_FAULT) - return NOTIFY_DONE; -#endif /* CONFIG_KPROBES */ - /* Userspace events, ignore. */ if (user_mode(regs)) return NOTIFY_DONE; diff --git a/trunk/arch/mips/kernel/linux32.c b/trunk/arch/mips/kernel/linux32.c index 3a21acedf882..922a554cd108 100644 --- a/trunk/arch/mips/kernel/linux32.c +++ b/trunk/arch/mips/kernel/linux32.c @@ -83,13 +83,13 @@ SYSCALL_DEFINE6(32_mmap2, unsigned long, addr, unsigned long, len, asmlinkage int sys32_execve(nabi_no_regargs struct pt_regs regs) { int error; - struct filename *filename; + char * filename; filename = getname(compat_ptr(regs.regs[4])); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = compat_do_execve(filename->name, compat_ptr(regs.regs[5]), + error = compat_do_execve(filename, compat_ptr(regs.regs[5]), compat_ptr(regs.regs[6]), ®s); putname(filename); diff --git a/trunk/arch/mips/kernel/syscall.c b/trunk/arch/mips/kernel/syscall.c index 2bd561bc05ae..b08220c82113 100644 --- a/trunk/arch/mips/kernel/syscall.c +++ b/trunk/arch/mips/kernel/syscall.c @@ -133,13 +133,13 @@ _sys_clone(nabi_no_regargs struct pt_regs regs) asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs) { int error; - struct filename *filename; + char * filename; filename = getname((const char __user *) (long)regs.regs[4]); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, + error = do_execve(filename, (const char __user *const __user *) (long)regs.regs[5], (const char __user *const __user *) (long)regs.regs[6], ®s); diff --git a/trunk/arch/mn10300/include/asm/Kbuild b/trunk/arch/mn10300/include/asm/Kbuild index 4a159da23633..fccd81eddff1 100644 --- a/trunk/arch/mn10300/include/asm/Kbuild +++ b/trunk/arch/mn10300/include/asm/Kbuild @@ -1,3 +1,4 @@ +include include/asm-generic/Kbuild.asm generic-y += clkdev.h generic-y += exec.h diff --git a/trunk/arch/mn10300/include/uapi/asm/auxvec.h b/trunk/arch/mn10300/include/asm/auxvec.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/auxvec.h rename to trunk/arch/mn10300/include/asm/auxvec.h diff --git a/trunk/arch/mn10300/include/uapi/asm/bitsperlong.h b/trunk/arch/mn10300/include/asm/bitsperlong.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/bitsperlong.h rename to trunk/arch/mn10300/include/asm/bitsperlong.h diff --git a/trunk/arch/mn10300/include/uapi/asm/byteorder.h b/trunk/arch/mn10300/include/asm/byteorder.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/byteorder.h rename to trunk/arch/mn10300/include/asm/byteorder.h diff --git a/trunk/arch/mn10300/include/uapi/asm/errno.h b/trunk/arch/mn10300/include/asm/errno.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/errno.h rename to trunk/arch/mn10300/include/asm/errno.h diff --git a/trunk/arch/mn10300/include/uapi/asm/fcntl.h b/trunk/arch/mn10300/include/asm/fcntl.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/fcntl.h rename to trunk/arch/mn10300/include/asm/fcntl.h diff --git a/trunk/arch/mn10300/include/uapi/asm/ioctl.h b/trunk/arch/mn10300/include/asm/ioctl.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/ioctl.h rename to trunk/arch/mn10300/include/asm/ioctl.h diff --git a/trunk/arch/mn10300/include/uapi/asm/ioctls.h b/trunk/arch/mn10300/include/asm/ioctls.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/ioctls.h rename to trunk/arch/mn10300/include/asm/ioctls.h diff --git a/trunk/arch/mn10300/include/uapi/asm/ipcbuf.h b/trunk/arch/mn10300/include/asm/ipcbuf.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/ipcbuf.h rename to trunk/arch/mn10300/include/asm/ipcbuf.h diff --git a/trunk/arch/mn10300/include/uapi/asm/kvm_para.h b/trunk/arch/mn10300/include/asm/kvm_para.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/kvm_para.h rename to trunk/arch/mn10300/include/asm/kvm_para.h diff --git a/trunk/arch/mn10300/include/uapi/asm/mman.h b/trunk/arch/mn10300/include/asm/mman.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/mman.h rename to trunk/arch/mn10300/include/asm/mman.h diff --git a/trunk/arch/mn10300/include/uapi/asm/msgbuf.h b/trunk/arch/mn10300/include/asm/msgbuf.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/msgbuf.h rename to trunk/arch/mn10300/include/asm/msgbuf.h diff --git a/trunk/arch/mn10300/include/uapi/asm/param.h b/trunk/arch/mn10300/include/asm/param.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/param.h rename to trunk/arch/mn10300/include/asm/param.h diff --git a/trunk/arch/mn10300/include/uapi/asm/poll.h b/trunk/arch/mn10300/include/asm/poll.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/poll.h rename to trunk/arch/mn10300/include/asm/poll.h diff --git a/trunk/arch/mn10300/include/uapi/asm/posix_types.h b/trunk/arch/mn10300/include/asm/posix_types.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/posix_types.h rename to trunk/arch/mn10300/include/asm/posix_types.h diff --git a/trunk/arch/mn10300/include/asm/ptrace.h b/trunk/arch/mn10300/include/asm/ptrace.h index 838a3830010e..08ac856c053e 100644 --- a/trunk/arch/mn10300/include/asm/ptrace.h +++ b/trunk/arch/mn10300/include/asm/ptrace.h @@ -11,8 +11,77 @@ #ifndef _ASM_PTRACE_H #define _ASM_PTRACE_H -#include +#define PT_A3 0 +#define PT_A2 1 +#define PT_D3 2 +#define PT_D2 3 +#define PT_MCVF 4 +#define PT_MCRL 5 +#define PT_MCRH 6 +#define PT_MDRQ 7 +#define PT_E1 8 +#define PT_E0 9 +#define PT_E7 10 +#define PT_E6 11 +#define PT_E5 12 +#define PT_E4 13 +#define PT_E3 14 +#define PT_E2 15 +#define PT_SP 16 +#define PT_LAR 17 +#define PT_LIR 18 +#define PT_MDR 19 +#define PT_A1 20 +#define PT_A0 21 +#define PT_D1 22 +#define PT_D0 23 +#define PT_ORIG_D0 24 +#define PT_EPSW 25 +#define PT_PC 26 +#define NR_PTREGS 27 +/* + * This defines the way registers are stored in the event of an exception + * - the strange order is due to the MOVM instruction + */ +struct pt_regs { + unsigned long a3; /* syscall arg 3 */ + unsigned long a2; /* syscall arg 4 */ + unsigned long d3; /* syscall arg 5 */ + unsigned long d2; /* syscall arg 6 */ + unsigned long mcvf; + unsigned long mcrl; + unsigned long mcrh; + unsigned long mdrq; + unsigned long e1; + unsigned long e0; + unsigned long e7; + unsigned long e6; + unsigned long e5; + unsigned long e4; + unsigned long e3; + unsigned long e2; + unsigned long sp; + unsigned long lar; + unsigned long lir; + unsigned long mdr; + unsigned long a1; + unsigned long a0; /* syscall arg 1 */ + unsigned long d1; /* syscall arg 2 */ + unsigned long d0; /* syscall ret */ + struct pt_regs *next; /* next frame pointer */ + unsigned long orig_d0; /* syscall number */ + unsigned long epsw; + unsigned long pc; +}; + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 + +#ifdef __KERNEL__ #define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) #define instruction_pointer(regs) ((regs)->pc) @@ -23,4 +92,5 @@ #define profile_pc(regs) ((regs)->pc) +#endif /* __KERNEL__ */ #endif /* _ASM_PTRACE_H */ diff --git a/trunk/arch/mn10300/include/uapi/asm/resource.h b/trunk/arch/mn10300/include/asm/resource.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/resource.h rename to trunk/arch/mn10300/include/asm/resource.h diff --git a/trunk/arch/mn10300/include/uapi/asm/sembuf.h b/trunk/arch/mn10300/include/asm/sembuf.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/sembuf.h rename to trunk/arch/mn10300/include/asm/sembuf.h diff --git a/trunk/arch/mn10300/include/asm/setup.h b/trunk/arch/mn10300/include/asm/setup.h index fb024555d2a9..c229d1e3f999 100644 --- a/trunk/arch/mn10300/include/asm/setup.h +++ b/trunk/arch/mn10300/include/asm/setup.h @@ -11,8 +11,8 @@ #ifndef _ASM_SETUP_H #define _ASM_SETUP_H -#include - +#ifdef __KERNEL__ extern void __init unit_setup(void); extern void __init unit_init_IRQ(void); +#endif #endif /* _ASM_SETUP_H */ diff --git a/trunk/arch/mn10300/include/uapi/asm/shmbuf.h b/trunk/arch/mn10300/include/asm/shmbuf.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/shmbuf.h rename to trunk/arch/mn10300/include/asm/shmbuf.h diff --git a/trunk/arch/mn10300/include/uapi/asm/sigcontext.h b/trunk/arch/mn10300/include/asm/sigcontext.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/sigcontext.h rename to trunk/arch/mn10300/include/asm/sigcontext.h diff --git a/trunk/arch/mn10300/include/uapi/asm/siginfo.h b/trunk/arch/mn10300/include/asm/siginfo.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/siginfo.h rename to trunk/arch/mn10300/include/asm/siginfo.h diff --git a/trunk/arch/mn10300/include/asm/signal.h b/trunk/arch/mn10300/include/asm/signal.h index f9668ec3040c..1865d72a86ff 100644 --- a/trunk/arch/mn10300/include/asm/signal.h +++ b/trunk/arch/mn10300/include/asm/signal.h @@ -11,8 +11,12 @@ #ifndef _ASM_SIGNAL_H #define _ASM_SIGNAL_H -#include +#include +/* Avoid too many header ordering problems. */ +struct siginfo; + +#ifdef __KERNEL__ /* Most things should be clean enough to redefine this at will, if care is taken to make libc match. */ @@ -26,6 +30,94 @@ typedef struct { unsigned long sig[_NSIG_WORDS]; } sigset_t; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +#define NSIG 32 +typedef unsigned long sigset_t; + +#endif /* __KERNEL__ */ + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +/* +#define SIGLOST 29 +*/ +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED 31 + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX _NSIG + +/* + * SA_FLAGS values: + * + * SA_ONSTACK indicates that a registered stack_t will be used. + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. + */ +#define SA_NOCLDSTOP 0x00000001U +#define SA_NOCLDWAIT 0x00000002U +#define SA_SIGINFO 0x00000004U +#define SA_ONSTACK 0x08000000U +#define SA_RESTART 0x10000000U +#define SA_NODEFER 0x40000000U +#define SA_RESETHAND 0x80000000U + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND + +#define SA_RESTORER 0x04000000 + +/* + * sigaltstack controls + */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#include + +#ifdef __KERNEL__ struct old_sigaction { __sighandler_t sa_handler; old_sigset_t sa_mask; @@ -43,10 +135,37 @@ struct sigaction { struct k_sigaction { struct sigaction sa; }; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +struct sigaction { + union { + __sighandler_t _sa_handler; + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +#endif /* __KERNEL__ */ + +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; + +#ifdef __KERNEL__ #include struct pt_regs; #define ptrace_signal_deliver(regs, cookie) do { } while (0) +#endif /* __KERNEL__ */ + #endif /* _ASM_SIGNAL_H */ diff --git a/trunk/arch/mn10300/include/uapi/asm/socket.h b/trunk/arch/mn10300/include/asm/socket.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/socket.h rename to trunk/arch/mn10300/include/asm/socket.h diff --git a/trunk/arch/mn10300/include/uapi/asm/sockios.h b/trunk/arch/mn10300/include/asm/sockios.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/sockios.h rename to trunk/arch/mn10300/include/asm/sockios.h diff --git a/trunk/arch/mn10300/include/uapi/asm/stat.h b/trunk/arch/mn10300/include/asm/stat.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/stat.h rename to trunk/arch/mn10300/include/asm/stat.h diff --git a/trunk/arch/mn10300/include/uapi/asm/statfs.h b/trunk/arch/mn10300/include/asm/statfs.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/statfs.h rename to trunk/arch/mn10300/include/asm/statfs.h diff --git a/trunk/arch/mn10300/include/uapi/asm/swab.h b/trunk/arch/mn10300/include/asm/swab.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/swab.h rename to trunk/arch/mn10300/include/asm/swab.h diff --git a/trunk/arch/mn10300/include/uapi/asm/termbits.h b/trunk/arch/mn10300/include/asm/termbits.h similarity index 100% rename from trunk/arch/mn10300/include/uapi/asm/termbits.h rename to trunk/arch/mn10300/include/asm/termbits.h diff --git a/trunk/arch/mn10300/include/asm/termios.h b/trunk/arch/mn10300/include/asm/termios.h index c2e29c75dfac..dd7cf617e118 100644 --- a/trunk/arch/mn10300/include/asm/termios.h +++ b/trunk/arch/mn10300/include/asm/termios.h @@ -1,8 +1,27 @@ #ifndef _ASM_TERMIOS_H #define _ASM_TERMIOS_H -#include +#include +#include +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +#ifdef __KERNEL__ /* intr=^C quit=^| erase=del kill=^U eof=^D vtime=\0 vmin=\1 sxtc=\0 start=^Q stop=^S susp=^Z eol=\0 @@ -10,4 +29,64 @@ eol2=\0 */ #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" +#endif + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */ + +/* + * Translate a "termio" structure into a "termios". Ugh. + */ +#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ + unsigned short __tmp; \ + get_user(__tmp, &(termio)->x); \ + *(unsigned short *) &(termios)->x = __tmp; \ +} + +#define user_termio_to_kernel_termios(termios, termio) \ +({ \ + SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ +}) + +/* + * Translate a "termios" structure into a "termio". Ugh. + */ +#define kernel_termios_to_user_termio(termio, termios) \ +({ \ + put_user((termios)->c_iflag, &(termio)->c_iflag); \ + put_user((termios)->c_oflag, &(termio)->c_oflag); \ + put_user((termios)->c_cflag, &(termio)->c_cflag); \ + put_user((termios)->c_lflag, &(termio)->c_lflag); \ + put_user((termios)->c_line, &(termio)->c_line); \ + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ +}) + +#define user_termios_to_kernel_termios(k, u) \ + copy_from_user(k, u, sizeof(struct termios2)) +#define kernel_termios_to_user_termios(u, k) \ + copy_to_user(u, k, sizeof(struct termios2)) +#define user_termios_to_kernel_termios_1(k, u) \ + copy_from_user(k, u, sizeof(struct termios)) +#define kernel_termios_to_user_termios_1(u, k) \ + copy_to_user(u, k, sizeof(struct termios)) + #endif /* _ASM_TERMIOS_H */ diff --git a/trunk/arch/mn10300/include/asm/types.h b/trunk/arch/mn10300/include/asm/types.h index 3d6e48311bef..713d4ba108a5 100644 --- a/trunk/arch/mn10300/include/asm/types.h +++ b/trunk/arch/mn10300/include/asm/types.h @@ -11,12 +11,15 @@ #ifndef _ASM_TYPES_H #define _ASM_TYPES_H -#include +#include /* * These aren't exported outside the kernel to avoid name space clashes */ +#ifdef __KERNEL__ #define BITS_PER_LONG 32 +#endif /* __KERNEL__ */ + #endif /* _ASM_TYPES_H */ diff --git a/trunk/arch/mn10300/include/asm/unistd.h b/trunk/arch/mn10300/include/asm/unistd.h index 55bbec1887e9..044c770adbb6 100644 --- a/trunk/arch/mn10300/include/asm/unistd.h +++ b/trunk/arch/mn10300/include/asm/unistd.h @@ -11,8 +11,347 @@ #ifndef _ASM_UNISTD_H #define _ASM_UNISTD_H -#include +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_waitpid 7 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_time 13 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_lchown 16 +#define __NR_break 17 +#define __NR_oldstat 18 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_umount 22 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_stime 25 +#define __NR_ptrace 26 +#define __NR_alarm 27 +#define __NR_oldfstat 28 +#define __NR_pause 29 +#define __NR_utime 30 +#define __NR_stty 31 +#define __NR_gtty 32 +#define __NR_access 33 +#define __NR_nice 34 +#define __NR_ftime 35 +#define __NR_sync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_prof 44 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_signal 48 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_umount2 52 +#define __NR_lock 53 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_mpx 56 +#define __NR_setpgid 57 +#define __NR_ulimit 58 +#define __NR_oldolduname 59 +#define __NR_umask 60 +#define __NR_chroot 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_sigaction 67 +#define __NR_sgetmask 68 +#define __NR_ssetmask 69 +#define __NR_setreuid 70 +#define __NR_setregid 71 +#define __NR_sigsuspend 72 +#define __NR_sigpending 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ +#define __NR_getrusage 77 +#define __NR_gettimeofday 78 +#define __NR_settimeofday 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_select 82 +#define __NR_symlink 83 +#define __NR_oldlstat 84 +#define __NR_readlink 85 +#define __NR_uselib 86 +#define __NR_swapon 87 +#define __NR_reboot 88 +#define __NR_readdir 89 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +#define __NR_profil 98 +#define __NR_statfs 99 +#define __NR_fstatfs 100 +#define __NR_ioperm 101 +#define __NR_socketcall 102 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_stat 106 +#define __NR_lstat 107 +#define __NR_fstat 108 +#define __NR_olduname 109 +#define __NR_iopl 110 +#define __NR_vhangup 111 +#define __NR_idle 112 +#define __NR_vm86old 113 +#define __NR_wait4 114 +#define __NR_swapoff 115 +#define __NR_sysinfo 116 +#define __NR_ipc 117 +#define __NR_fsync 118 +#define __NR_sigreturn 119 +#define __NR_clone 120 +#define __NR_setdomainname 121 +#define __NR_uname 122 +#define __NR_modify_ldt 123 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_sigprocmask 126 +#define __NR_create_module 127 +#define __NR_init_module 128 +#define __NR_delete_module 129 +#define __NR_get_kernel_syms 130 +#define __NR_quotactl 131 +#define __NR_getpgid 132 +#define __NR_fchdir 133 +#define __NR_bdflush 134 +#define __NR_sysfs 135 +#define __NR_personality 136 +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ +#define __NR_setfsuid 138 +#define __NR_setfsgid 139 +#define __NR__llseek 140 +#define __NR_getdents 141 +#define __NR__newselect 142 +#define __NR_flock 143 +#define __NR_msync 144 +#define __NR_readv 145 +#define __NR_writev 146 +#define __NR_getsid 147 +#define __NR_fdatasync 148 +#define __NR__sysctl 149 +#define __NR_mlock 150 +#define __NR_munlock 151 +#define __NR_mlockall 152 +#define __NR_munlockall 153 +#define __NR_sched_setparam 154 +#define __NR_sched_getparam 155 +#define __NR_sched_setscheduler 156 +#define __NR_sched_getscheduler 157 +#define __NR_sched_yield 158 +#define __NR_sched_get_priority_max 159 +#define __NR_sched_get_priority_min 160 +#define __NR_sched_rr_get_interval 161 +#define __NR_nanosleep 162 +#define __NR_mremap 163 +#define __NR_setresuid 164 +#define __NR_getresuid 165 +#define __NR_vm86 166 +#define __NR_query_module 167 +#define __NR_poll 168 +#define __NR_nfsservctl 169 +#define __NR_setresgid 170 +#define __NR_getresgid 171 +#define __NR_prctl 172 +#define __NR_rt_sigreturn 173 +#define __NR_rt_sigaction 174 +#define __NR_rt_sigprocmask 175 +#define __NR_rt_sigpending 176 +#define __NR_rt_sigtimedwait 177 +#define __NR_rt_sigqueueinfo 178 +#define __NR_rt_sigsuspend 179 +#define __NR_pread64 180 +#define __NR_pwrite64 181 +#define __NR_chown 182 +#define __NR_getcwd 183 +#define __NR_capget 184 +#define __NR_capset 185 +#define __NR_sigaltstack 186 +#define __NR_sendfile 187 +#define __NR_getpmsg 188 /* some people actually want streams */ +#define __NR_putpmsg 189 /* some people actually want streams */ +#define __NR_vfork 190 +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#define __NR_lchown32 198 +#define __NR_getuid32 199 +#define __NR_getgid32 200 +#define __NR_geteuid32 201 +#define __NR_getegid32 202 +#define __NR_setreuid32 203 +#define __NR_setregid32 204 +#define __NR_getgroups32 205 +#define __NR_setgroups32 206 +#define __NR_fchown32 207 +#define __NR_setresuid32 208 +#define __NR_getresuid32 209 +#define __NR_setresgid32 210 +#define __NR_getresgid32 211 +#define __NR_chown32 212 +#define __NR_setuid32 213 +#define __NR_setgid32 214 +#define __NR_setfsuid32 215 +#define __NR_setfsgid32 216 +#define __NR_pivot_root 217 +#define __NR_mincore 218 +#define __NR_madvise 219 +#define __NR_madvise1 219 /* delete when C lib stub is removed */ +#define __NR_getdents64 220 +#define __NR_fcntl64 221 +/* 223 is unused */ +#define __NR_gettid 224 +#define __NR_readahead 225 +#define __NR_setxattr 226 +#define __NR_lsetxattr 227 +#define __NR_fsetxattr 228 +#define __NR_getxattr 229 +#define __NR_lgetxattr 230 +#define __NR_fgetxattr 231 +#define __NR_listxattr 232 +#define __NR_llistxattr 233 +#define __NR_flistxattr 234 +#define __NR_removexattr 235 +#define __NR_lremovexattr 236 +#define __NR_fremovexattr 237 +#define __NR_tkill 238 +#define __NR_sendfile64 239 +#define __NR_futex 240 +#define __NR_sched_setaffinity 241 +#define __NR_sched_getaffinity 242 +#define __NR_set_thread_area 243 +#define __NR_get_thread_area 244 +#define __NR_io_setup 245 +#define __NR_io_destroy 246 +#define __NR_io_getevents 247 +#define __NR_io_submit 248 +#define __NR_io_cancel 249 +#define __NR_fadvise64 250 +#define __NR_exit_group 252 +#define __NR_lookup_dcookie 253 +#define __NR_epoll_create 254 +#define __NR_epoll_ctl 255 +#define __NR_epoll_wait 256 +#define __NR_remap_file_pages 257 +#define __NR_set_tid_address 258 +#define __NR_timer_create 259 +#define __NR_timer_settime (__NR_timer_create+1) +#define __NR_timer_gettime (__NR_timer_create+2) +#define __NR_timer_getoverrun (__NR_timer_create+3) +#define __NR_timer_delete (__NR_timer_create+4) +#define __NR_clock_settime (__NR_timer_create+5) +#define __NR_clock_gettime (__NR_timer_create+6) +#define __NR_clock_getres (__NR_timer_create+7) +#define __NR_clock_nanosleep (__NR_timer_create+8) +#define __NR_statfs64 268 +#define __NR_fstatfs64 269 +#define __NR_tgkill 270 +#define __NR_utimes 271 +#define __NR_fadvise64_64 272 +#define __NR_vserver 273 +#define __NR_mbind 274 +#define __NR_get_mempolicy 275 +#define __NR_set_mempolicy 276 +#define __NR_mq_open 277 +#define __NR_mq_unlink (__NR_mq_open+1) +#define __NR_mq_timedsend (__NR_mq_open+2) +#define __NR_mq_timedreceive (__NR_mq_open+3) +#define __NR_mq_notify (__NR_mq_open+4) +#define __NR_mq_getsetattr (__NR_mq_open+5) +#define __NR_kexec_load 283 +#define __NR_waitid 284 +#define __NR_add_key 286 +#define __NR_request_key 287 +#define __NR_keyctl 288 +#define __NR_cacheflush 289 +#define __NR_ioprio_set 290 +#define __NR_ioprio_get 291 +#define __NR_inotify_init 292 +#define __NR_inotify_add_watch 293 +#define __NR_inotify_rm_watch 294 +#define __NR_migrate_pages 295 +#define __NR_openat 296 +#define __NR_mkdirat 297 +#define __NR_mknodat 298 +#define __NR_fchownat 299 +#define __NR_futimesat 300 +#define __NR_fstatat64 301 +#define __NR_unlinkat 302 +#define __NR_renameat 303 +#define __NR_linkat 304 +#define __NR_symlinkat 305 +#define __NR_readlinkat 306 +#define __NR_fchmodat 307 +#define __NR_faccessat 308 +#define __NR_pselect6 309 +#define __NR_ppoll 310 +#define __NR_unshare 311 +#define __NR_set_robust_list 312 +#define __NR_get_robust_list 313 +#define __NR_splice 314 +#define __NR_sync_file_range 315 +#define __NR_tee 316 +#define __NR_vmsplice 317 +#define __NR_move_pages 318 +#define __NR_getcpu 319 +#define __NR_epoll_pwait 320 +#define __NR_utimensat 321 +#define __NR_signalfd 322 +#define __NR_timerfd_create 323 +#define __NR_eventfd 324 +#define __NR_fallocate 325 +#define __NR_timerfd_settime 326 +#define __NR_timerfd_gettime 327 +#define __NR_signalfd4 328 +#define __NR_eventfd2 329 +#define __NR_epoll_create1 330 +#define __NR_dup3 331 +#define __NR_pipe2 332 +#define __NR_inotify_init1 333 +#define __NR_preadv 334 +#define __NR_pwritev 335 +#define __NR_rt_tgsigqueueinfo 336 +#define __NR_perf_event_open 337 +#define __NR_recvmmsg 338 +#define __NR_setns 339 + +#ifdef __KERNEL__ #define NR_syscalls 340 @@ -56,4 +395,5 @@ #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); #endif +#endif /* __KERNEL__ */ #endif /* _ASM_UNISTD_H */ diff --git a/trunk/arch/mn10300/include/uapi/asm/Kbuild b/trunk/arch/mn10300/include/uapi/asm/Kbuild index 040178cdb3eb..baebb3da1d44 100644 --- a/trunk/arch/mn10300/include/uapi/asm/Kbuild +++ b/trunk/arch/mn10300/include/uapi/asm/Kbuild @@ -1,34 +1,3 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += auxvec.h -header-y += bitsperlong.h -header-y += byteorder.h -header-y += errno.h -header-y += fcntl.h -header-y += ioctl.h -header-y += ioctls.h -header-y += ipcbuf.h -header-y += kvm_para.h -header-y += mman.h -header-y += msgbuf.h -header-y += param.h -header-y += poll.h -header-y += posix_types.h -header-y += ptrace.h -header-y += resource.h -header-y += sembuf.h -header-y += setup.h -header-y += shmbuf.h -header-y += sigcontext.h -header-y += siginfo.h -header-y += signal.h -header-y += socket.h -header-y += sockios.h -header-y += stat.h -header-y += statfs.h -header-y += swab.h -header-y += termbits.h -header-y += termios.h -header-y += types.h -header-y += unistd.h diff --git a/trunk/arch/mn10300/include/uapi/asm/ptrace.h b/trunk/arch/mn10300/include/uapi/asm/ptrace.h deleted file mode 100644 index 71b2251b7bff..000000000000 --- a/trunk/arch/mn10300/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,84 +0,0 @@ -/* MN10300 Exception frame layout and ptrace constants - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _UAPI_ASM_PTRACE_H -#define _UAPI_ASM_PTRACE_H - -#define PT_A3 0 -#define PT_A2 1 -#define PT_D3 2 -#define PT_D2 3 -#define PT_MCVF 4 -#define PT_MCRL 5 -#define PT_MCRH 6 -#define PT_MDRQ 7 -#define PT_E1 8 -#define PT_E0 9 -#define PT_E7 10 -#define PT_E6 11 -#define PT_E5 12 -#define PT_E4 13 -#define PT_E3 14 -#define PT_E2 15 -#define PT_SP 16 -#define PT_LAR 17 -#define PT_LIR 18 -#define PT_MDR 19 -#define PT_A1 20 -#define PT_A0 21 -#define PT_D1 22 -#define PT_D0 23 -#define PT_ORIG_D0 24 -#define PT_EPSW 25 -#define PT_PC 26 -#define NR_PTREGS 27 - -/* - * This defines the way registers are stored in the event of an exception - * - the strange order is due to the MOVM instruction - */ -struct pt_regs { - unsigned long a3; /* syscall arg 3 */ - unsigned long a2; /* syscall arg 4 */ - unsigned long d3; /* syscall arg 5 */ - unsigned long d2; /* syscall arg 6 */ - unsigned long mcvf; - unsigned long mcrl; - unsigned long mcrh; - unsigned long mdrq; - unsigned long e1; - unsigned long e0; - unsigned long e7; - unsigned long e6; - unsigned long e5; - unsigned long e4; - unsigned long e3; - unsigned long e2; - unsigned long sp; - unsigned long lar; - unsigned long lir; - unsigned long mdr; - unsigned long a1; - unsigned long a0; /* syscall arg 1 */ - unsigned long d1; /* syscall arg 2 */ - unsigned long d0; /* syscall ret */ - struct pt_regs *next; /* next frame pointer */ - unsigned long orig_d0; /* syscall number */ - unsigned long epsw; - unsigned long pc; -}; - -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 - -#endif /* _UAPI_ASM_PTRACE_H */ diff --git a/trunk/arch/mn10300/include/uapi/asm/setup.h b/trunk/arch/mn10300/include/uapi/asm/setup.h deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/trunk/arch/mn10300/include/uapi/asm/signal.h b/trunk/arch/mn10300/include/uapi/asm/signal.h deleted file mode 100644 index 08dcd6a85618..000000000000 --- a/trunk/arch/mn10300/include/uapi/asm/signal.h +++ /dev/null @@ -1,131 +0,0 @@ -/* MN10300 Signal definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _UAPI_ASM_SIGNAL_H -#define _UAPI_ASM_SIGNAL_H - -#include - -/* Avoid too many header ordering problems. */ -struct siginfo; - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -#define NSIG 32 -typedef unsigned long sigset_t; - -#endif /* __KERNEL__ */ - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT 6 -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -/* -#define SIGLOST 29 -*/ -#define SIGPWR 30 -#define SIGSYS 31 -#define SIGUNUSED 31 - -/* These should not be considered constants from userland. */ -#define SIGRTMIN 32 -#define SIGRTMAX _NSIG - -/* - * SA_FLAGS values: - * - * SA_ONSTACK indicates that a registered stack_t will be used. - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. - * SA_RESETHAND clears the handler when the signal is delivered. - * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. - * SA_NODEFER prevents the current signal from being masked in the handler. - * - * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single - * Unix names RESETHAND and NODEFER respectively. - */ -#define SA_NOCLDSTOP 0x00000001U -#define SA_NOCLDWAIT 0x00000002U -#define SA_SIGINFO 0x00000004U -#define SA_ONSTACK 0x08000000U -#define SA_RESTART 0x10000000U -#define SA_NODEFER 0x40000000U -#define SA_RESETHAND 0x80000000U - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND - -#define SA_RESTORER 0x04000000 - -/* - * sigaltstack controls - */ -#define SS_ONSTACK 1 -#define SS_DISABLE 2 - -#define MINSIGSTKSZ 2048 -#define SIGSTKSZ 8192 - -#include - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -struct sigaction { - union { - __sighandler_t _sa_handler; - void (*_sa_sigaction)(int, struct siginfo *, void *); - } _u; - sigset_t sa_mask; - unsigned long sa_flags; - void (*sa_restorer)(void); -}; - -#define sa_handler _u._sa_handler -#define sa_sigaction _u._sa_sigaction - -#endif /* __KERNEL__ */ - -typedef struct sigaltstack { - void __user *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - - -#endif /* _UAPI_ASM_SIGNAL_H */ diff --git a/trunk/arch/mn10300/include/uapi/asm/termios.h b/trunk/arch/mn10300/include/uapi/asm/termios.h deleted file mode 100644 index 11d3cc9d3162..000000000000 --- a/trunk/arch/mn10300/include/uapi/asm/termios.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _UAPI_ASM_TERMIOS_H -#define _UAPI_ASM_TERMIOS_H - -#include -#include - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */ - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ -#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ - unsigned short __tmp; \ - get_user(__tmp, &(termio)->x); \ - *(unsigned short *) &(termios)->x = __tmp; \ -} - -#define user_termio_to_kernel_termios(termios, termio) \ -({ \ - SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ - copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -}) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -({ \ - put_user((termios)->c_iflag, &(termio)->c_iflag); \ - put_user((termios)->c_oflag, &(termio)->c_oflag); \ - put_user((termios)->c_cflag, &(termio)->c_cflag); \ - put_user((termios)->c_lflag, &(termio)->c_lflag); \ - put_user((termios)->c_line, &(termio)->c_line); \ - copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -}) - -#define user_termios_to_kernel_termios(k, u) \ - copy_from_user(k, u, sizeof(struct termios2)) -#define kernel_termios_to_user_termios(u, k) \ - copy_to_user(u, k, sizeof(struct termios2)) -#define user_termios_to_kernel_termios_1(k, u) \ - copy_from_user(k, u, sizeof(struct termios)) -#define kernel_termios_to_user_termios_1(u, k) \ - copy_to_user(u, k, sizeof(struct termios)) - -#endif /* _UAPI_ASM_TERMIOS_H */ diff --git a/trunk/arch/mn10300/include/uapi/asm/types.h b/trunk/arch/mn10300/include/uapi/asm/types.h deleted file mode 100644 index 8b3f0501b9bc..000000000000 --- a/trunk/arch/mn10300/include/uapi/asm/types.h +++ /dev/null @@ -1,11 +0,0 @@ -/* MN10300 Basic type definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include diff --git a/trunk/arch/mn10300/include/uapi/asm/unistd.h b/trunk/arch/mn10300/include/uapi/asm/unistd.h deleted file mode 100644 index e28ac3f42479..000000000000 --- a/trunk/arch/mn10300/include/uapi/asm/unistd.h +++ /dev/null @@ -1,354 +0,0 @@ -/* MN10300 System call number list - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _UAPI_ASM_UNISTD_H -#define _UAPI_ASM_UNISTD_H - -#define __NR_restart_syscall 0 -#define __NR_exit 1 -#define __NR_fork 2 -#define __NR_read 3 -#define __NR_write 4 -#define __NR_open 5 -#define __NR_close 6 -#define __NR_waitpid 7 -#define __NR_creat 8 -#define __NR_link 9 -#define __NR_unlink 10 -#define __NR_execve 11 -#define __NR_chdir 12 -#define __NR_time 13 -#define __NR_mknod 14 -#define __NR_chmod 15 -#define __NR_lchown 16 -#define __NR_break 17 -#define __NR_oldstat 18 -#define __NR_lseek 19 -#define __NR_getpid 20 -#define __NR_mount 21 -#define __NR_umount 22 -#define __NR_setuid 23 -#define __NR_getuid 24 -#define __NR_stime 25 -#define __NR_ptrace 26 -#define __NR_alarm 27 -#define __NR_oldfstat 28 -#define __NR_pause 29 -#define __NR_utime 30 -#define __NR_stty 31 -#define __NR_gtty 32 -#define __NR_access 33 -#define __NR_nice 34 -#define __NR_ftime 35 -#define __NR_sync 36 -#define __NR_kill 37 -#define __NR_rename 38 -#define __NR_mkdir 39 -#define __NR_rmdir 40 -#define __NR_dup 41 -#define __NR_pipe 42 -#define __NR_times 43 -#define __NR_prof 44 -#define __NR_brk 45 -#define __NR_setgid 46 -#define __NR_getgid 47 -#define __NR_signal 48 -#define __NR_geteuid 49 -#define __NR_getegid 50 -#define __NR_acct 51 -#define __NR_umount2 52 -#define __NR_lock 53 -#define __NR_ioctl 54 -#define __NR_fcntl 55 -#define __NR_mpx 56 -#define __NR_setpgid 57 -#define __NR_ulimit 58 -#define __NR_oldolduname 59 -#define __NR_umask 60 -#define __NR_chroot 61 -#define __NR_ustat 62 -#define __NR_dup2 63 -#define __NR_getppid 64 -#define __NR_getpgrp 65 -#define __NR_setsid 66 -#define __NR_sigaction 67 -#define __NR_sgetmask 68 -#define __NR_ssetmask 69 -#define __NR_setreuid 70 -#define __NR_setregid 71 -#define __NR_sigsuspend 72 -#define __NR_sigpending 73 -#define __NR_sethostname 74 -#define __NR_setrlimit 75 -#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ -#define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 -#define __NR_getgroups 80 -#define __NR_setgroups 81 -#define __NR_select 82 -#define __NR_symlink 83 -#define __NR_oldlstat 84 -#define __NR_readlink 85 -#define __NR_uselib 86 -#define __NR_swapon 87 -#define __NR_reboot 88 -#define __NR_readdir 89 -#define __NR_mmap 90 -#define __NR_munmap 91 -#define __NR_truncate 92 -#define __NR_ftruncate 93 -#define __NR_fchmod 94 -#define __NR_fchown 95 -#define __NR_getpriority 96 -#define __NR_setpriority 97 -#define __NR_profil 98 -#define __NR_statfs 99 -#define __NR_fstatfs 100 -#define __NR_ioperm 101 -#define __NR_socketcall 102 -#define __NR_syslog 103 -#define __NR_setitimer 104 -#define __NR_getitimer 105 -#define __NR_stat 106 -#define __NR_lstat 107 -#define __NR_fstat 108 -#define __NR_olduname 109 -#define __NR_iopl 110 -#define __NR_vhangup 111 -#define __NR_idle 112 -#define __NR_vm86old 113 -#define __NR_wait4 114 -#define __NR_swapoff 115 -#define __NR_sysinfo 116 -#define __NR_ipc 117 -#define __NR_fsync 118 -#define __NR_sigreturn 119 -#define __NR_clone 120 -#define __NR_setdomainname 121 -#define __NR_uname 122 -#define __NR_modify_ldt 123 -#define __NR_adjtimex 124 -#define __NR_mprotect 125 -#define __NR_sigprocmask 126 -#define __NR_create_module 127 -#define __NR_init_module 128 -#define __NR_delete_module 129 -#define __NR_get_kernel_syms 130 -#define __NR_quotactl 131 -#define __NR_getpgid 132 -#define __NR_fchdir 133 -#define __NR_bdflush 134 -#define __NR_sysfs 135 -#define __NR_personality 136 -#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ -#define __NR_setfsuid 138 -#define __NR_setfsgid 139 -#define __NR__llseek 140 -#define __NR_getdents 141 -#define __NR__newselect 142 -#define __NR_flock 143 -#define __NR_msync 144 -#define __NR_readv 145 -#define __NR_writev 146 -#define __NR_getsid 147 -#define __NR_fdatasync 148 -#define __NR__sysctl 149 -#define __NR_mlock 150 -#define __NR_munlock 151 -#define __NR_mlockall 152 -#define __NR_munlockall 153 -#define __NR_sched_setparam 154 -#define __NR_sched_getparam 155 -#define __NR_sched_setscheduler 156 -#define __NR_sched_getscheduler 157 -#define __NR_sched_yield 158 -#define __NR_sched_get_priority_max 159 -#define __NR_sched_get_priority_min 160 -#define __NR_sched_rr_get_interval 161 -#define __NR_nanosleep 162 -#define __NR_mremap 163 -#define __NR_setresuid 164 -#define __NR_getresuid 165 -#define __NR_vm86 166 -#define __NR_query_module 167 -#define __NR_poll 168 -#define __NR_nfsservctl 169 -#define __NR_setresgid 170 -#define __NR_getresgid 171 -#define __NR_prctl 172 -#define __NR_rt_sigreturn 173 -#define __NR_rt_sigaction 174 -#define __NR_rt_sigprocmask 175 -#define __NR_rt_sigpending 176 -#define __NR_rt_sigtimedwait 177 -#define __NR_rt_sigqueueinfo 178 -#define __NR_rt_sigsuspend 179 -#define __NR_pread64 180 -#define __NR_pwrite64 181 -#define __NR_chown 182 -#define __NR_getcwd 183 -#define __NR_capget 184 -#define __NR_capset 185 -#define __NR_sigaltstack 186 -#define __NR_sendfile 187 -#define __NR_getpmsg 188 /* some people actually want streams */ -#define __NR_putpmsg 189 /* some people actually want streams */ -#define __NR_vfork 190 -#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ -#define __NR_mmap2 192 -#define __NR_truncate64 193 -#define __NR_ftruncate64 194 -#define __NR_stat64 195 -#define __NR_lstat64 196 -#define __NR_fstat64 197 -#define __NR_lchown32 198 -#define __NR_getuid32 199 -#define __NR_getgid32 200 -#define __NR_geteuid32 201 -#define __NR_getegid32 202 -#define __NR_setreuid32 203 -#define __NR_setregid32 204 -#define __NR_getgroups32 205 -#define __NR_setgroups32 206 -#define __NR_fchown32 207 -#define __NR_setresuid32 208 -#define __NR_getresuid32 209 -#define __NR_setresgid32 210 -#define __NR_getresgid32 211 -#define __NR_chown32 212 -#define __NR_setuid32 213 -#define __NR_setgid32 214 -#define __NR_setfsuid32 215 -#define __NR_setfsgid32 216 -#define __NR_pivot_root 217 -#define __NR_mincore 218 -#define __NR_madvise 219 -#define __NR_madvise1 219 /* delete when C lib stub is removed */ -#define __NR_getdents64 220 -#define __NR_fcntl64 221 -/* 223 is unused */ -#define __NR_gettid 224 -#define __NR_readahead 225 -#define __NR_setxattr 226 -#define __NR_lsetxattr 227 -#define __NR_fsetxattr 228 -#define __NR_getxattr 229 -#define __NR_lgetxattr 230 -#define __NR_fgetxattr 231 -#define __NR_listxattr 232 -#define __NR_llistxattr 233 -#define __NR_flistxattr 234 -#define __NR_removexattr 235 -#define __NR_lremovexattr 236 -#define __NR_fremovexattr 237 -#define __NR_tkill 238 -#define __NR_sendfile64 239 -#define __NR_futex 240 -#define __NR_sched_setaffinity 241 -#define __NR_sched_getaffinity 242 -#define __NR_set_thread_area 243 -#define __NR_get_thread_area 244 -#define __NR_io_setup 245 -#define __NR_io_destroy 246 -#define __NR_io_getevents 247 -#define __NR_io_submit 248 -#define __NR_io_cancel 249 -#define __NR_fadvise64 250 - -#define __NR_exit_group 252 -#define __NR_lookup_dcookie 253 -#define __NR_epoll_create 254 -#define __NR_epoll_ctl 255 -#define __NR_epoll_wait 256 -#define __NR_remap_file_pages 257 -#define __NR_set_tid_address 258 -#define __NR_timer_create 259 -#define __NR_timer_settime (__NR_timer_create+1) -#define __NR_timer_gettime (__NR_timer_create+2) -#define __NR_timer_getoverrun (__NR_timer_create+3) -#define __NR_timer_delete (__NR_timer_create+4) -#define __NR_clock_settime (__NR_timer_create+5) -#define __NR_clock_gettime (__NR_timer_create+6) -#define __NR_clock_getres (__NR_timer_create+7) -#define __NR_clock_nanosleep (__NR_timer_create+8) -#define __NR_statfs64 268 -#define __NR_fstatfs64 269 -#define __NR_tgkill 270 -#define __NR_utimes 271 -#define __NR_fadvise64_64 272 -#define __NR_vserver 273 -#define __NR_mbind 274 -#define __NR_get_mempolicy 275 -#define __NR_set_mempolicy 276 -#define __NR_mq_open 277 -#define __NR_mq_unlink (__NR_mq_open+1) -#define __NR_mq_timedsend (__NR_mq_open+2) -#define __NR_mq_timedreceive (__NR_mq_open+3) -#define __NR_mq_notify (__NR_mq_open+4) -#define __NR_mq_getsetattr (__NR_mq_open+5) -#define __NR_kexec_load 283 -#define __NR_waitid 284 -#define __NR_add_key 286 -#define __NR_request_key 287 -#define __NR_keyctl 288 -#define __NR_cacheflush 289 -#define __NR_ioprio_set 290 -#define __NR_ioprio_get 291 -#define __NR_inotify_init 292 -#define __NR_inotify_add_watch 293 -#define __NR_inotify_rm_watch 294 -#define __NR_migrate_pages 295 -#define __NR_openat 296 -#define __NR_mkdirat 297 -#define __NR_mknodat 298 -#define __NR_fchownat 299 -#define __NR_futimesat 300 -#define __NR_fstatat64 301 -#define __NR_unlinkat 302 -#define __NR_renameat 303 -#define __NR_linkat 304 -#define __NR_symlinkat 305 -#define __NR_readlinkat 306 -#define __NR_fchmodat 307 -#define __NR_faccessat 308 -#define __NR_pselect6 309 -#define __NR_ppoll 310 -#define __NR_unshare 311 -#define __NR_set_robust_list 312 -#define __NR_get_robust_list 313 -#define __NR_splice 314 -#define __NR_sync_file_range 315 -#define __NR_tee 316 -#define __NR_vmsplice 317 -#define __NR_move_pages 318 -#define __NR_getcpu 319 -#define __NR_epoll_pwait 320 -#define __NR_utimensat 321 -#define __NR_signalfd 322 -#define __NR_timerfd_create 323 -#define __NR_eventfd 324 -#define __NR_fallocate 325 -#define __NR_timerfd_settime 326 -#define __NR_timerfd_gettime 327 -#define __NR_signalfd4 328 -#define __NR_eventfd2 329 -#define __NR_epoll_create1 330 -#define __NR_dup3 331 -#define __NR_pipe2 332 -#define __NR_inotify_init1 333 -#define __NR_preadv 334 -#define __NR_pwritev 335 -#define __NR_rt_tgsigqueueinfo 336 -#define __NR_perf_event_open 337 -#define __NR_recvmmsg 338 -#define __NR_setns 339 - -#endif /* _UAPI_ASM_UNISTD_H */ diff --git a/trunk/arch/openrisc/include/asm/processor.h b/trunk/arch/openrisc/include/asm/processor.h index 43decdbdb2ed..30462f1fe959 100644 --- a/trunk/arch/openrisc/include/asm/processor.h +++ b/trunk/arch/openrisc/include/asm/processor.h @@ -103,7 +103,7 @@ extern unsigned long thread_saved_pc(struct task_struct *t); #define init_stack (init_thread_union.stack) -#define cpu_relax() barrier() +#define cpu_relax() do { } while (0) #endif /* __ASSEMBLY__ */ #endif /* __ASM_OPENRISC_PROCESSOR_H */ diff --git a/trunk/arch/openrisc/kernel/irq.c b/trunk/arch/openrisc/kernel/irq.c index 8ec77bc9f1e7..e935b9d8eee1 100644 --- a/trunk/arch/openrisc/kernel/irq.c +++ b/trunk/arch/openrisc/kernel/irq.c @@ -46,19 +46,19 @@ EXPORT_SYMBOL(arch_local_irq_restore); static void or1k_pic_mask(struct irq_data *data) { - mtspr(SPR_PICMR, mfspr(SPR_PICMR) & ~(1UL << data->hwirq)); + mtspr(SPR_PICMR, mfspr(SPR_PICMR) & ~(1UL << data->irq)); } static void or1k_pic_unmask(struct irq_data *data) { - mtspr(SPR_PICMR, mfspr(SPR_PICMR) | (1UL << data->hwirq)); + mtspr(SPR_PICMR, mfspr(SPR_PICMR) | (1UL << data->irq)); } static void or1k_pic_ack(struct irq_data *data) { /* EDGE-triggered interrupts need to be ack'ed in order to clear * the latch. - * LEVEL-triggered interrupts do not need to be ack'ed; however, + * LEVER-triggered interrupts do not need to be ack'ed; however, * ack'ing the interrupt has no ill-effect and is quicker than * trying to figure out what type it is... */ @@ -75,10 +75,10 @@ static void or1k_pic_ack(struct irq_data *data) * as opposed to a 1 as mandated by the spec */ - mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(1UL << data->hwirq)); + mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(1UL << data->irq)); #else - WARN(1, "Interrupt handling possibly broken\n"); - mtspr(SPR_PICSR, (1UL << data->hwirq)); + WARN(1, "Interrupt handling possibily broken\n"); + mtspr(SPR_PICSR, (1UL << irq)); #endif } @@ -87,12 +87,10 @@ static void or1k_pic_mask_ack(struct irq_data *data) /* Comments for pic_ack apply here, too */ #ifdef CONFIG_OR1K_1200 - mtspr(SPR_PICMR, mfspr(SPR_PICMR) & ~(1UL << data->hwirq)); - mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(1UL << data->hwirq)); + mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(1UL << data->irq)); #else - WARN(1, "Interrupt handling possibly broken\n"); - mtspr(SPR_PICMR, (1UL << data->hwirq)); - mtspr(SPR_PICSR, (1UL << data->hwirq)); + WARN(1, "Interrupt handling possibily broken\n"); + mtspr(SPR_PICSR, (1UL << irq)); #endif } diff --git a/trunk/arch/openrisc/kernel/process.c b/trunk/arch/openrisc/kernel/process.c index c35f3ab1a8d3..55210f37d1a3 100644 --- a/trunk/arch/openrisc/kernel/process.c +++ b/trunk/arch/openrisc/kernel/process.c @@ -271,7 +271,7 @@ asmlinkage long _sys_execve(const char __user *name, struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; filename = getname(name); error = PTR_ERR(filename); @@ -279,7 +279,7 @@ asmlinkage long _sys_execve(const char __user *name, if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); out: diff --git a/trunk/arch/openrisc/kernel/ptrace.c b/trunk/arch/openrisc/kernel/ptrace.c index 71a2a0c34c65..e71781d24b0e 100644 --- a/trunk/arch/openrisc/kernel/ptrace.c +++ b/trunk/arch/openrisc/kernel/ptrace.c @@ -187,7 +187,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) */ ret = -1L; - audit_syscall_entry(AUDIT_ARCH_OPENRISC, regs->gpr[11], + audit_syscall_entry(audit_arch(), regs->gpr[11], regs->gpr[3], regs->gpr[4], regs->gpr[5], regs->gpr[6]); diff --git a/trunk/arch/openrisc/lib/delay.c b/trunk/arch/openrisc/lib/delay.c index c330767c9217..01d9740ae6f3 100644 --- a/trunk/arch/openrisc/lib/delay.c +++ b/trunk/arch/openrisc/lib/delay.c @@ -30,9 +30,9 @@ int __devinit read_current_timer(unsigned long *timer_value) void __delay(unsigned long cycles) { - cycles_t start = get_cycles(); + cycles_t target = get_cycles() + cycles; - while ((get_cycles() - start) < cycles) + while (get_cycles() < target) cpu_relax(); } EXPORT_SYMBOL(__delay); @@ -41,7 +41,7 @@ inline void __const_udelay(unsigned long xloops) { unsigned long long loops; - loops = (unsigned long long)xloops * loops_per_jiffy * HZ; + loops = xloops * loops_per_jiffy * HZ; __delay(loops >> 32); } diff --git a/trunk/arch/parisc/hpux/fs.c b/trunk/arch/parisc/hpux/fs.c index a0760b87fd4e..6785de7bd2a0 100644 --- a/trunk/arch/parisc/hpux/fs.c +++ b/trunk/arch/parisc/hpux/fs.c @@ -34,14 +34,14 @@ int hpux_execve(struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; filename = getname((const char __user *) regs->gr[26]); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, + error = do_execve(filename, (const char __user *const __user *) regs->gr[25], (const char __user *const __user *) regs->gr[24], regs); diff --git a/trunk/arch/parisc/kernel/process.c b/trunk/arch/parisc/kernel/process.c index cbc37216bf90..8c6b6b6561f0 100644 --- a/trunk/arch/parisc/kernel/process.c +++ b/trunk/arch/parisc/kernel/process.c @@ -342,13 +342,13 @@ unsigned long thread_saved_pc(struct task_struct *t) asmlinkage int sys_execve(struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; filename = getname((const char __user *) regs->gr[26]); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, + error = do_execve(filename, (const char __user *const __user *) regs->gr[25], (const char __user *const __user *) regs->gr[24], regs); diff --git a/trunk/arch/parisc/kernel/sys_parisc32.c b/trunk/arch/parisc/kernel/sys_parisc32.c index bf5b93a885d3..dc9a62462323 100644 --- a/trunk/arch/parisc/kernel/sys_parisc32.c +++ b/trunk/arch/parisc/kernel/sys_parisc32.c @@ -60,14 +60,14 @@ asmlinkage int sys32_execve(struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; DBG(("sys32_execve(%p) r26 = 0x%lx\n", regs, regs->gr[26])); filename = getname((const char __user *) regs->gr[26]); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = compat_do_execve(filename->name, compat_ptr(regs->gr[25]), + error = compat_do_execve(filename, compat_ptr(regs->gr[25]), compat_ptr(regs->gr[24]), regs); putname(filename); out: diff --git a/trunk/arch/powerpc/include/asm/Kbuild b/trunk/arch/powerpc/include/asm/Kbuild index a4fe15e33c6f..ace53dbde2cd 100644 --- a/trunk/arch/powerpc/include/asm/Kbuild +++ b/trunk/arch/powerpc/include/asm/Kbuild @@ -1,4 +1,39 @@ +include include/asm-generic/Kbuild.asm +header-y += auxvec.h +header-y += bootx.h +header-y += byteorder.h +header-y += cputable.h +header-y += elf.h +header-y += errno.h +header-y += fcntl.h +header-y += ioctl.h +header-y += ioctls.h +header-y += ipcbuf.h +header-y += linkage.h +header-y += msgbuf.h +header-y += nvram.h +header-y += param.h +header-y += poll.h +header-y += posix_types.h +header-y += ps3fb.h +header-y += resource.h +header-y += seccomp.h +header-y += sembuf.h +header-y += shmbuf.h +header-y += sigcontext.h +header-y += siginfo.h +header-y += signal.h +header-y += socket.h +header-y += sockios.h +header-y += spu_info.h +header-y += stat.h +header-y += statfs.h +header-y += termbits.h +header-y += termios.h +header-y += types.h +header-y += ucontext.h +header-y += unistd.h generic-y += clkdev.h generic-y += rwsem.h diff --git a/trunk/arch/powerpc/include/uapi/asm/auxvec.h b/trunk/arch/powerpc/include/asm/auxvec.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/auxvec.h rename to trunk/arch/powerpc/include/asm/auxvec.h diff --git a/trunk/arch/powerpc/include/uapi/asm/bitsperlong.h b/trunk/arch/powerpc/include/asm/bitsperlong.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/bitsperlong.h rename to trunk/arch/powerpc/include/asm/bitsperlong.h diff --git a/trunk/arch/powerpc/include/asm/bootx.h b/trunk/arch/powerpc/include/asm/bootx.h index dd9461003dfa..60a3c9ef3017 100644 --- a/trunk/arch/powerpc/include/asm/bootx.h +++ b/trunk/arch/powerpc/include/asm/bootx.h @@ -5,11 +5,126 @@ * Written by Benjamin Herrenschmidt. */ + #ifndef __ASM_BOOTX_H__ #define __ASM_BOOTX_H__ -#include +#include + +#ifdef macintosh +#include +#include "linux_type_defs.h" +#endif + +#ifdef macintosh +/* All this requires PowerPC alignment */ +#pragma options align=power +#endif + +/* On kernel entry: + * + * r3 = 0x426f6f58 ('BooX') + * r4 = pointer to boot_infos + * r5 = NULL + * + * Data and instruction translation disabled, interrupts + * disabled, kernel loaded at physical 0x00000000 on PCI + * machines (will be different on NuBus). + */ + +#define BOOT_INFO_VERSION 5 +#define BOOT_INFO_COMPATIBLE_VERSION 1 + +/* Bit in the architecture flag mask. More to be defined in + future versions. Note that either BOOT_ARCH_PCI or + BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are + set additionally when BOOT_ARCH_NUBUS is set. + */ +#define BOOT_ARCH_PCI 0x00000001UL +#define BOOT_ARCH_NUBUS 0x00000002UL +#define BOOT_ARCH_NUBUS_PDM 0x00000010UL +#define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL +#define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL + +/* Maximum number of ranges in phys memory map */ +#define MAX_MEM_MAP_SIZE 26 + +/* This is the format of an element in the physical memory map. Note that + the map is optional and current BootX will only build it for pre-PCI + machines */ +typedef struct boot_info_map_entry +{ + __u32 physAddr; /* Physical starting address */ + __u32 size; /* Size in bytes */ +} boot_info_map_entry_t; + + +/* Here are the boot informations that are passed to the bootstrap + * Note that the kernel arguments and the device tree are appended + * at the end of this structure. */ +typedef struct boot_infos +{ + /* Version of this structure */ + __u32 version; + /* backward compatible down to version: */ + __u32 compatible_version; + + /* NEW (vers. 2) this holds the current _logical_ base addr of + the frame buffer (for use by early boot message) */ + __u8* logicalDisplayBase; + /* NEW (vers. 4) Apple's machine identification */ + __u32 machineID; + + /* NEW (vers. 4) Detected hw architecture */ + __u32 architecture; + + /* The device tree (internal addresses relative to the beginning of the tree, + * device tree offset relative to the beginning of this structure). + * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this + * field is 0. + */ + __u32 deviceTreeOffset; /* Device tree offset */ + __u32 deviceTreeSize; /* Size of the device tree */ + + /* Some infos about the current MacOS display */ + __u32 dispDeviceRect[4]; /* left,top,right,bottom */ + __u32 dispDeviceDepth; /* (8, 16 or 32) */ + __u8* dispDeviceBase; /* base address (physical) */ + __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */ + __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */ + /* Optional offset in the registry to the current + * MacOS display. (Can be 0 when not detected) */ + __u32 dispDeviceRegEntryOffset; + + /* Optional pointer to boot ramdisk (offset from this structure) */ + __u32 ramDisk; + __u32 ramDiskSize; /* size of ramdisk image */ + + /* Kernel command line arguments (offset from this structure) */ + __u32 kernelParamsOffset; + + /* ALL BELOW NEW (vers. 4) */ + + /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag + (non-PCI) only. On PCI, memory is contiguous and it's size is in the + device-tree. */ + boot_info_map_entry_t + physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */ + __u32 physMemoryMapSize; /* How many entries in map */ + + + /* The framebuffer size (optional, currently 0) */ + __u32 frameBufferSize; /* Represents a max size, can be 0. */ + + /* NEW (vers. 5) */ + + /* Total params size (args + colormap + device tree + ramdisk) */ + __u32 totalParamsSize; + +} boot_infos_t; + +#ifdef __KERNEL__ /* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index * is represented by 3 short words containing a 16 bits (unsigned) color * component. Later versions may contain the gamma table for direct-color @@ -47,4 +162,10 @@ struct bootx_dt_node { extern void bootx_init(unsigned long r4, unsigned long phys); +#endif /* __KERNEL__ */ + +#ifdef macintosh +#pragma options align=reset +#endif + #endif diff --git a/trunk/arch/powerpc/include/uapi/asm/byteorder.h b/trunk/arch/powerpc/include/asm/byteorder.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/byteorder.h rename to trunk/arch/powerpc/include/asm/byteorder.h diff --git a/trunk/arch/powerpc/include/asm/cputable.h b/trunk/arch/powerpc/include/asm/cputable.h index 21a0687b8c4d..b3c083de17ad 100644 --- a/trunk/arch/powerpc/include/asm/cputable.h +++ b/trunk/arch/powerpc/include/asm/cputable.h @@ -1,10 +1,42 @@ #ifndef __ASM_POWERPC_CPUTABLE_H #define __ASM_POWERPC_CPUTABLE_H +#define PPC_FEATURE_32 0x80000000 +#define PPC_FEATURE_64 0x40000000 +#define PPC_FEATURE_601_INSTR 0x20000000 +#define PPC_FEATURE_HAS_ALTIVEC 0x10000000 +#define PPC_FEATURE_HAS_FPU 0x08000000 +#define PPC_FEATURE_HAS_MMU 0x04000000 +#define PPC_FEATURE_HAS_4xxMAC 0x02000000 +#define PPC_FEATURE_UNIFIED_CACHE 0x01000000 +#define PPC_FEATURE_HAS_SPE 0x00800000 +#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 +#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 +#define PPC_FEATURE_NO_TB 0x00100000 +#define PPC_FEATURE_POWER4 0x00080000 +#define PPC_FEATURE_POWER5 0x00040000 +#define PPC_FEATURE_POWER5_PLUS 0x00020000 +#define PPC_FEATURE_CELL 0x00010000 +#define PPC_FEATURE_BOOKE 0x00008000 +#define PPC_FEATURE_SMT 0x00004000 +#define PPC_FEATURE_ICACHE_SNOOP 0x00002000 +#define PPC_FEATURE_ARCH_2_05 0x00001000 +#define PPC_FEATURE_PA6T 0x00000800 +#define PPC_FEATURE_HAS_DFP 0x00000400 +#define PPC_FEATURE_POWER6_EXT 0x00000200 +#define PPC_FEATURE_ARCH_2_06 0x00000100 +#define PPC_FEATURE_HAS_VSX 0x00000080 + +#define PPC_FEATURE_PSERIES_PERFMON_COMPAT \ + 0x00000040 + +#define PPC_FEATURE_TRUE_LE 0x00000002 +#define PPC_FEATURE_PPC_LE 0x00000001 + +#ifdef __KERNEL__ #include #include -#include #ifndef __ASSEMBLY__ @@ -525,4 +557,5 @@ static inline int cpu_has_feature(unsigned long feature) #endif /* !__ASSEMBLY__ */ +#endif /* __KERNEL__ */ #endif /* __ASM_POWERPC_CPUTABLE_H */ diff --git a/trunk/arch/powerpc/include/asm/elf.h b/trunk/arch/powerpc/include/asm/elf.h index 6abf0a163233..3bf9cca35147 100644 --- a/trunk/arch/powerpc/include/asm/elf.h +++ b/trunk/arch/powerpc/include/asm/elf.h @@ -1,3 +1,90 @@ +#ifndef _ASM_POWERPC_ELF_H +#define _ASM_POWERPC_ELF_H + +#ifdef __KERNEL__ +#include /* for task_struct */ +#include +#include +#endif + +#include + +#include +#include +#include + +/* PowerPC relocations defined by the ABIs */ +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 /* 32bit absolute address */ +#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ +#define R_PPC_ADDR16 3 /* 16bit absolute address */ +#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ +#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ +#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ +#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 /* PC relative 26 bit */ +#define R_PPC_REL14 11 /* PC relative 16 bit */ +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + +/* PowerPC relocations defined for the TLS access ABI. */ +#define R_PPC_TLS 67 /* none (sym+add)@tls */ +#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ +#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ +#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ +#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ +#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ +#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ +#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ +#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ +#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ +#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ +#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ +#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ +#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ +#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ +#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ +#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ +#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ +#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ +#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ +#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ +#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ +#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ +#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ +#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ +#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ +#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ +#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ + +/* keep this the last entry. */ +#define R_PPC_NUM 95 + /* * ELF register definitions.. * @@ -6,14 +93,77 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#ifndef _ASM_POWERPC_ELF_H -#define _ASM_POWERPC_ELF_H -#include /* for task_struct */ -#include -#include -#include +#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ +#define ELF_NFPREG 33 /* includes fpscr */ + +typedef unsigned long elf_greg_t64; +typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG]; + +typedef unsigned int elf_greg_t32; +typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG]; +typedef elf_gregset_t32 compat_elf_gregset_t; + +/* + * ELF_ARCH, CLASS, and DATA are used to set parameters in the core dumps. + */ +#ifdef __powerpc64__ +# define ELF_NVRREG32 33 /* includes vscr & vrsave stuffed together */ +# define ELF_NVRREG 34 /* includes vscr & vrsave in split vectors */ +# define ELF_NVSRHALFREG 32 /* Half the vsx registers */ +# define ELF_GREG_TYPE elf_greg_t64 +#else +# define ELF_NEVRREG 34 /* includes acc (as 2) */ +# define ELF_NVRREG 33 /* includes vscr */ +# define ELF_GREG_TYPE elf_greg_t32 +# define ELF_ARCH EM_PPC +# define ELF_CLASS ELFCLASS32 +# define ELF_DATA ELFDATA2MSB +#endif /* __powerpc64__ */ +#ifndef ELF_ARCH +# define ELF_ARCH EM_PPC64 +# define ELF_CLASS ELFCLASS64 +# define ELF_DATA ELFDATA2MSB + typedef elf_greg_t64 elf_greg_t; + typedef elf_gregset_t64 elf_gregset_t; +#else + /* Assumption: ELF_ARCH == EM_PPC and ELF_CLASS == ELFCLASS32 */ + typedef elf_greg_t32 elf_greg_t; + typedef elf_gregset_t32 elf_gregset_t; +#endif /* ELF_ARCH */ + +/* Floating point registers */ +typedef double elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +/* Altivec registers */ +/* + * The entries with indexes 0-31 contain the corresponding vector registers. + * The entry with index 32 contains the vscr as the last word (offset 12) + * within the quadword. This allows the vscr to be stored as either a + * quadword (since it must be copied via a vector register to/from storage) + * or as a word. + * + * 64-bit kernel notes: The entry at index 33 contains the vrsave as the first + * word (offset 0) within the quadword. + * + * This definition of the VMX state is compatible with the current PPC32 + * ptrace interface. This allows signal handling and ptrace to use the same + * structures. This also simplifies the implementation of a bi-arch + * (combined (32- and 64-bit) gdb. + * + * Note that it's _not_ compatible with 32 bits ucontext which stuffs the + * vrsave along with vscr and so only uses 33 vectors for the register set + */ +typedef __vector128 elf_vrreg_t; +typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; +#ifdef __powerpc64__ +typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32]; +typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG]; +#endif + +#ifdef __KERNEL__ /* * This is used to ensure we don't load something for the wrong architecture. */ @@ -127,6 +277,153 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, extern unsigned long arch_randomize_brk(struct mm_struct *mm); #define arch_randomize_brk arch_randomize_brk +#endif /* __KERNEL__ */ + +/* + * The requirements here are: + * - keep the final alignment of sp (sp & 0xf) + * - make sure the 32-bit value at the first 16 byte aligned position of + * AUXV is greater than 16 for glibc compatibility. + * AT_IGNOREPPC is used for that. + * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC, + * even if DLINFO_ARCH_ITEMS goes to zero or is undefined. + * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes + */ +#define ARCH_DLINFO \ +do { \ + /* Handle glibc compatibility. */ \ + NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ + NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ + /* Cache size items */ \ + NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \ + NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \ + NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \ + VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->mm->context.vdso_base); \ +} while (0) + +/* PowerPC64 relocations defined by the ABIs */ +#define R_PPC64_NONE R_PPC_NONE +#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */ +#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */ +#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */ +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */ +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */ +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ +#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */ +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN +#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */ +#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */ +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN +#define R_PPC64_GOT16 R_PPC_GOT16 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA + +#define R_PPC64_COPY R_PPC_COPY +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT +#define R_PPC64_RELATIVE R_PPC_RELATIVE + +#define R_PPC64_UADDR32 R_PPC_UADDR32 +#define R_PPC64_UADDR16 R_PPC_UADDR16 +#define R_PPC64_REL32 R_PPC_REL32 +#define R_PPC64_PLT32 R_PPC_PLT32 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA + +#define R_PPC64_SECTOFF R_PPC_SECTOFF +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA +#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */ +#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */ +#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */ +#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */ +#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */ +#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */ +#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */ +#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */ +#define R_PPC64_PLT64 45 /* doubleword64 L + A. */ +#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */ +#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */ +#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */ +#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */ +#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */ +#define R_PPC64_TOC 51 /* doubleword64 .TOC. */ +#define R_PPC64_PLTGOT16 52 /* half16* M + A. */ +#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */ +#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */ +#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */ + +#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */ +#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */ +#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */ +#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */ +#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */ +#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */ +#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */ +#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */ +#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */ +#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */ +#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */ + +/* PowerPC64 relocations defined for the TLS access ABI. */ +#define R_PPC64_TLS 67 /* none (sym+add)@tls */ +#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ +#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ +#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ +#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ +#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ +#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ +#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ +#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ +#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ +#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ +#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ +#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ +#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ +#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ +#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ +#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ +#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ +#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ +#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ +#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ +#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ +#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ +#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ +#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ +#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ +#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ +#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ +#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ +#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ +#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ +#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ +#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ +#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ +#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ +#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ +#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ +#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ +#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ +#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ + +/* Keep this the last entry. */ +#define R_PPC64_NUM 107 + +/* There's actually a third entry here, but it's unused */ +struct ppc64_opd_entry +{ + unsigned long funcaddr; + unsigned long r2; +}; + +#ifdef __KERNEL__ #ifdef CONFIG_SPU_BASE /* Notes used in ET_CORE. Note name is "SPU//". */ @@ -136,4 +433,6 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm); #endif /* CONFIG_SPU_BASE */ +#endif /* __KERNEL */ + #endif /* _ASM_POWERPC_ELF_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/errno.h b/trunk/arch/powerpc/include/asm/errno.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/errno.h rename to trunk/arch/powerpc/include/asm/errno.h diff --git a/trunk/arch/powerpc/include/uapi/asm/fcntl.h b/trunk/arch/powerpc/include/asm/fcntl.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/fcntl.h rename to trunk/arch/powerpc/include/asm/fcntl.h diff --git a/trunk/arch/powerpc/include/uapi/asm/ioctl.h b/trunk/arch/powerpc/include/asm/ioctl.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/ioctl.h rename to trunk/arch/powerpc/include/asm/ioctl.h diff --git a/trunk/arch/powerpc/include/uapi/asm/ioctls.h b/trunk/arch/powerpc/include/asm/ioctls.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/ioctls.h rename to trunk/arch/powerpc/include/asm/ioctls.h diff --git a/trunk/arch/powerpc/include/uapi/asm/ipcbuf.h b/trunk/arch/powerpc/include/asm/ipcbuf.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/ipcbuf.h rename to trunk/arch/powerpc/include/asm/ipcbuf.h diff --git a/trunk/arch/powerpc/include/uapi/asm/kvm.h b/trunk/arch/powerpc/include/asm/kvm.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/kvm.h rename to trunk/arch/powerpc/include/asm/kvm.h diff --git a/trunk/arch/powerpc/include/asm/kvm_para.h b/trunk/arch/powerpc/include/asm/kvm_para.h index 9365860fb7f6..c18916bff689 100644 --- a/trunk/arch/powerpc/include/asm/kvm_para.h +++ b/trunk/arch/powerpc/include/asm/kvm_para.h @@ -16,11 +16,77 @@ * * Authors: Hollis Blanchard */ + #ifndef __POWERPC_KVM_PARA_H__ #define __POWERPC_KVM_PARA_H__ -#include +#include +/* + * Additions to this struct must only occur at the end, and should be + * accompanied by a KVM_MAGIC_FEAT flag to advertise that they are present + * (albeit not necessarily relevant to the current target hardware platform). + * + * Struct fields are always 32 or 64 bit aligned, depending on them being 32 + * or 64 bit wide respectively. + * + * See Documentation/virtual/kvm/ppc-pv.txt + */ +struct kvm_vcpu_arch_shared { + __u64 scratch1; + __u64 scratch2; + __u64 scratch3; + __u64 critical; /* Guest may not get interrupts if == r1 */ + __u64 sprg0; + __u64 sprg1; + __u64 sprg2; + __u64 sprg3; + __u64 srr0; + __u64 srr1; + __u64 dar; /* dear on BookE */ + __u64 msr; + __u32 dsisr; + __u32 int_pending; /* Tells the guest if we have an interrupt */ + __u32 sr[16]; + __u32 mas0; + __u32 mas1; + __u64 mas7_3; + __u64 mas2; + __u32 mas4; + __u32 mas6; + __u32 esr; + __u32 pir; + + /* + * SPRG4-7 are user-readable, so we can only keep these consistent + * between the shared area and the real registers when there's an + * intervening exit to KVM. This also applies to SPRG3 on some + * chips. + * + * This suffices for access by guest userspace, since in PR-mode + * KVM, an exit must occur when changing the guest's MSR[PR]. + * If the guest kernel writes to SPRG3-7 via the shared area, it + * must also use the shared area for reading while in kernel space. + */ + __u64 sprg4; + __u64 sprg5; + __u64 sprg6; + __u64 sprg7; +}; + +#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */ +#define HC_VENDOR_KVM (42 << 16) +#define HC_EV_SUCCESS 0 +#define HC_EV_UNIMPLEMENTED 12 + +#define KVM_FEATURE_MAGIC_PAGE 1 + +#define KVM_MAGIC_FEAT_SR (1 << 0) + +/* MASn, ESR, PIR, and high SPRGs */ +#define KVM_MAGIC_FEAT_MAS0_TO_SPRG7 (1 << 1) + +#ifdef __KERNEL__ #ifdef CONFIG_KVM_GUEST @@ -145,4 +211,6 @@ static inline bool kvm_check_and_clear_guest_paused(void) return false; } +#endif /* __KERNEL__ */ + #endif /* __POWERPC_KVM_PARA_H__ */ diff --git a/trunk/arch/powerpc/include/uapi/asm/linkage.h b/trunk/arch/powerpc/include/asm/linkage.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/linkage.h rename to trunk/arch/powerpc/include/asm/linkage.h diff --git a/trunk/arch/powerpc/include/asm/mman.h b/trunk/arch/powerpc/include/asm/mman.h index 8565c254151a..d4a7f645c5db 100644 --- a/trunk/arch/powerpc/include/asm/mman.h +++ b/trunk/arch/powerpc/include/asm/mman.h @@ -1,14 +1,34 @@ +#ifndef _ASM_POWERPC_MMAN_H +#define _ASM_POWERPC_MMAN_H + +#include + /* * 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. */ -#ifndef _ASM_POWERPC_MMAN_H -#define _ASM_POWERPC_MMAN_H -#include +#define PROT_SAO 0x10 /* Strong Access Ordering */ + +#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ +#define MAP_NORESERVE 0x40 /* don't reserve swap pages */ +#define MAP_LOCKED 0x80 + +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ + +#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ +#define MCL_FUTURE 0x4000 /* lock all additions to address space */ + +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000 /* do not block on IO */ +#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ +#define MAP_HUGETLB 0x40000 /* create a huge page mapping */ +#ifdef __KERNEL__ #ifdef CONFIG_PPC64 #include @@ -41,4 +61,5 @@ static inline int arch_validate_prot(unsigned long prot) #define arch_validate_prot(prot) arch_validate_prot(prot) #endif /* CONFIG_PPC64 */ +#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MMAN_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/msgbuf.h b/trunk/arch/powerpc/include/asm/msgbuf.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/msgbuf.h rename to trunk/arch/powerpc/include/asm/msgbuf.h diff --git a/trunk/arch/powerpc/include/asm/nvram.h b/trunk/arch/powerpc/include/asm/nvram.h index b0fe0fe4e626..9d1aafe607c7 100644 --- a/trunk/arch/powerpc/include/asm/nvram.h +++ b/trunk/arch/powerpc/include/asm/nvram.h @@ -6,13 +6,29 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ + #ifndef _ASM_POWERPC_NVRAM_H #define _ASM_POWERPC_NVRAM_H +/* Signatures for nvram partitions */ +#define NVRAM_SIG_SP 0x02 /* support processor */ +#define NVRAM_SIG_OF 0x50 /* open firmware config */ +#define NVRAM_SIG_FW 0x51 /* general firmware */ +#define NVRAM_SIG_HW 0x52 /* hardware (VPD) */ +#define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */ +#define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */ +#define NVRAM_SIG_SYS 0x70 /* system env vars */ +#define NVRAM_SIG_CFG 0x71 /* config data */ +#define NVRAM_SIG_ELOG 0x72 /* error log */ +#define NVRAM_SIG_VEND 0x7e /* vendor defined */ +#define NVRAM_SIG_FREE 0x7f /* Free space */ +#define NVRAM_SIG_OS 0xa0 /* OS defined */ +#define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */ + +#ifdef __KERNEL__ #include #include -#include #ifdef CONFIG_PPC_PSERIES extern int nvram_write_error_log(char * buff, int length, @@ -40,6 +56,17 @@ extern int nvram_remove_partition(const char *name, int sig, extern int nvram_get_partition_size(loff_t data_index); extern loff_t nvram_find_partition(const char *name, int sig, int *out_size); +#endif /* __KERNEL__ */ + +/* PowerMac specific nvram stuffs */ + +enum { + pmac_nvram_OF, /* Open Firmware partition */ + pmac_nvram_XPRAM, /* MacOS XPRAM partition */ + pmac_nvram_NR /* MacOS Name Registry partition */ +}; + +#ifdef __KERNEL__ /* Return partition offset in nvram */ extern int pmac_get_partition(int partition); @@ -56,4 +83,30 @@ extern ssize_t nvram_get_size(void); /* Normal access to NVRAM */ extern unsigned char nvram_read_byte(int i); extern void nvram_write_byte(unsigned char c, int i); +#endif + +/* Some offsets in XPRAM */ +#define PMAC_XPRAM_MACHINE_LOC 0xe4 +#define PMAC_XPRAM_SOUND_VOLUME 0x08 + +/* Machine location structure in PowerMac XPRAM */ +struct pmac_machine_location { + unsigned int latitude; /* 2+30 bit Fractional number */ + unsigned int longitude; /* 2+30 bit Fractional number */ + unsigned int delta; /* mix of GMT delta and DLS */ +}; + +/* + * /dev/nvram ioctls + * + * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is + * definitely obsolete. Do not use it if you can avoid it + */ + +#define OBSOLETE_PMAC_NVRAM_GET_OFFSET \ + _IOWR('p', 0x40, int) + +#define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */ +#define IOC_NVRAM_SYNC _IO('p', 0x43) /* Sync NVRAM image */ + #endif /* _ASM_POWERPC_NVRAM_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/param.h b/trunk/arch/powerpc/include/asm/param.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/param.h rename to trunk/arch/powerpc/include/asm/param.h diff --git a/trunk/arch/powerpc/include/uapi/asm/poll.h b/trunk/arch/powerpc/include/asm/poll.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/poll.h rename to trunk/arch/powerpc/include/asm/poll.h diff --git a/trunk/arch/powerpc/include/uapi/asm/posix_types.h b/trunk/arch/powerpc/include/asm/posix_types.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/posix_types.h rename to trunk/arch/powerpc/include/asm/posix_types.h diff --git a/trunk/arch/powerpc/include/uapi/asm/ps3fb.h b/trunk/arch/powerpc/include/asm/ps3fb.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/ps3fb.h rename to trunk/arch/powerpc/include/asm/ps3fb.h diff --git a/trunk/arch/powerpc/include/asm/ptrace.h b/trunk/arch/powerpc/include/asm/ptrace.h index 5f995681bc1d..f76b88c367d1 100644 --- a/trunk/arch/powerpc/include/asm/ptrace.h +++ b/trunk/arch/powerpc/include/asm/ptrace.h @@ -1,3 +1,6 @@ +#ifndef _ASM_POWERPC_PTRACE_H +#define _ASM_POWERPC_PTRACE_H + /* * Copyright (C) 2001 PPC64 Team, IBM Corp * @@ -20,11 +23,37 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#ifndef _ASM_POWERPC_PTRACE_H -#define _ASM_POWERPC_PTRACE_H -#include +#include + +#ifndef __ASSEMBLY__ + +struct pt_regs { + unsigned long gpr[32]; + unsigned long nip; + unsigned long msr; + unsigned long orig_gpr3; /* Used for restarting system calls */ + unsigned long ctr; + unsigned long link; + unsigned long xer; + unsigned long ccr; +#ifdef __powerpc64__ + unsigned long softe; /* Soft enabled/disabled */ +#else + unsigned long mq; /* 601 only (not used at present) */ + /* Used on APUS to hold IPL value. */ +#endif + unsigned long trap; /* Reason for being here */ + /* N.B. for critical exceptions on 4xx, the dar and dsisr + fields are overloaded to hold srr0 and srr1. */ + unsigned long dar; /* Fault registers */ + unsigned long dsisr; /* on 4xx/Book-E used for ESR */ + unsigned long result; /* Result of a system call */ +}; + +#endif /* __ASSEMBLY__ */ +#ifdef __KERNEL__ #ifdef __powerpc64__ @@ -193,12 +222,219 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, #endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ + +/* + * Offsets used by 'ptrace' system call interface. + * These can't be changed without breaking binary compatibility + * with MkLinux, etc. + */ +#define PT_R0 0 +#define PT_R1 1 +#define PT_R2 2 +#define PT_R3 3 +#define PT_R4 4 +#define PT_R5 5 +#define PT_R6 6 +#define PT_R7 7 +#define PT_R8 8 +#define PT_R9 9 +#define PT_R10 10 +#define PT_R11 11 +#define PT_R12 12 +#define PT_R13 13 +#define PT_R14 14 +#define PT_R15 15 +#define PT_R16 16 +#define PT_R17 17 +#define PT_R18 18 +#define PT_R19 19 +#define PT_R20 20 +#define PT_R21 21 +#define PT_R22 22 +#define PT_R23 23 +#define PT_R24 24 +#define PT_R25 25 +#define PT_R26 26 +#define PT_R27 27 +#define PT_R28 28 +#define PT_R29 29 +#define PT_R30 30 +#define PT_R31 31 + +#define PT_NIP 32 +#define PT_MSR 33 +#define PT_ORIG_R3 34 +#define PT_CTR 35 +#define PT_LNK 36 +#define PT_XER 37 +#define PT_CCR 38 +#ifndef __powerpc64__ +#define PT_MQ 39 +#else +#define PT_SOFTE 39 +#endif +#define PT_TRAP 40 +#define PT_DAR 41 +#define PT_DSISR 42 +#define PT_RESULT 43 +#define PT_REGS_COUNT 44 + +#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */ + #ifndef __powerpc64__ + +#define PT_FPR31 (PT_FPR0 + 2*31) +#define PT_FPSCR (PT_FPR0 + 2*32 + 1) + #else /* __powerpc64__ */ + +#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ + +#ifdef __KERNEL__ #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ +#endif + +#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ +#define PT_VSCR (PT_VR0 + 32*2 + 1) +#define PT_VRSAVE (PT_VR0 + 33*2) + +#ifdef __KERNEL__ #define PT_VR0_32 164 /* each Vector reg occupies 4 slots in 32-bit */ #define PT_VSCR_32 (PT_VR0 + 32*4 + 3) #define PT_VRSAVE_32 (PT_VR0 + 33*4) +#endif + +/* + * Only store first 32 VSRs here. The second 32 VSRs in VR0-31 + */ +#define PT_VSR0 150 /* each VSR reg occupies 2 slots in 64-bit */ +#define PT_VSR31 (PT_VSR0 + 2*31) +#ifdef __KERNEL__ #define PT_VSR0_32 300 /* each VSR reg occupies 4 slots in 32-bit */ +#endif #endif /* __powerpc64__ */ + +/* + * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go. + * The transfer totals 34 quadword. Quadwords 0-31 contain the + * corresponding vector registers. Quadword 32 contains the vscr as the + * last word (offset 12) within that quadword. Quadword 33 contains the + * vrsave as the first word (offset 0) within the quadword. + * + * This definition of the VMX state is compatible with the current PPC32 + * ptrace interface. This allows signal handling and ptrace to use the same + * structures. This also simplifies the implementation of a bi-arch + * (combined (32- and 64-bit) gdb. + */ +#define PTRACE_GETVRREGS 18 +#define PTRACE_SETVRREGS 19 + +/* Get/set all the upper 32-bits of the SPE registers, accumulator, and + * spefscr, in one go */ +#define PTRACE_GETEVRREGS 20 +#define PTRACE_SETEVRREGS 21 + +/* Get the first 32 128bit VSX registers */ +#define PTRACE_GETVSRREGS 27 +#define PTRACE_SETVSRREGS 28 + +/* + * Get or set a debug register. The first 16 are DABR registers and the + * second 16 are IABR registers. + */ +#define PTRACE_GET_DEBUGREG 25 +#define PTRACE_SET_DEBUGREG 26 + +/* (new) PTRACE requests using the same numbers as x86 and the same + * argument ordering. Additionally, they support more registers too + */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +#define PTRACE_GETREGS64 22 +#define PTRACE_SETREGS64 23 + +/* Calls to trace a 64bit program from a 32bit program */ +#define PPC_PTRACE_PEEKTEXT_3264 0x95 +#define PPC_PTRACE_PEEKDATA_3264 0x94 +#define PPC_PTRACE_POKETEXT_3264 0x93 +#define PPC_PTRACE_POKEDATA_3264 0x92 +#define PPC_PTRACE_PEEKUSR_3264 0x91 +#define PPC_PTRACE_POKEUSR_3264 0x90 + +#define PTRACE_SINGLEBLOCK 0x100 /* resume execution until next branch */ + +#define PPC_PTRACE_GETHWDBGINFO 0x89 +#define PPC_PTRACE_SETHWDEBUG 0x88 +#define PPC_PTRACE_DELHWDEBUG 0x87 + +#ifndef __ASSEMBLY__ + +struct ppc_debug_info { + __u32 version; /* Only version 1 exists to date */ + __u32 num_instruction_bps; + __u32 num_data_bps; + __u32 num_condition_regs; + __u32 data_bp_alignment; + __u32 sizeof_condition; /* size of the DVC register */ + __u64 features; +}; + +#endif /* __ASSEMBLY__ */ + +/* + * features will have bits indication whether there is support for: + */ +#define PPC_DEBUG_FEATURE_INSN_BP_RANGE 0x0000000000000001 +#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x0000000000000002 +#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x0000000000000004 +#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x0000000000000008 + +#ifndef __ASSEMBLY__ + +struct ppc_hw_breakpoint { + __u32 version; /* currently, version must be 1 */ + __u32 trigger_type; /* only some combinations allowed */ + __u32 addr_mode; /* address match mode */ + __u32 condition_mode; /* break/watchpoint condition flags */ + __u64 addr; /* break/watchpoint address */ + __u64 addr2; /* range end or mask */ + __u64 condition_value; /* contents of the DVC register */ +}; + +#endif /* __ASSEMBLY__ */ + +/* + * Trigger Type + */ +#define PPC_BREAKPOINT_TRIGGER_EXECUTE 0x00000001 +#define PPC_BREAKPOINT_TRIGGER_READ 0x00000002 +#define PPC_BREAKPOINT_TRIGGER_WRITE 0x00000004 +#define PPC_BREAKPOINT_TRIGGER_RW \ + (PPC_BREAKPOINT_TRIGGER_READ | PPC_BREAKPOINT_TRIGGER_WRITE) + +/* + * Address Mode + */ +#define PPC_BREAKPOINT_MODE_EXACT 0x00000000 +#define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE 0x00000001 +#define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE 0x00000002 +#define PPC_BREAKPOINT_MODE_MASK 0x00000003 + +/* + * Condition Mode + */ +#define PPC_BREAKPOINT_CONDITION_MODE 0x00000003 +#define PPC_BREAKPOINT_CONDITION_NONE 0x00000000 +#define PPC_BREAKPOINT_CONDITION_AND 0x00000001 +#define PPC_BREAKPOINT_CONDITION_EXACT PPC_BREAKPOINT_CONDITION_AND +#define PPC_BREAKPOINT_CONDITION_OR 0x00000002 +#define PPC_BREAKPOINT_CONDITION_AND_OR 0x00000003 +#define PPC_BREAKPOINT_CONDITION_BE_ALL 0x00ff0000 +#define PPC_BREAKPOINT_CONDITION_BE_SHIFT 16 +#define PPC_BREAKPOINT_CONDITION_BE(n) \ + (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT)) + #endif /* _ASM_POWERPC_PTRACE_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/resource.h b/trunk/arch/powerpc/include/asm/resource.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/resource.h rename to trunk/arch/powerpc/include/asm/resource.h diff --git a/trunk/arch/powerpc/include/uapi/asm/seccomp.h b/trunk/arch/powerpc/include/asm/seccomp.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/seccomp.h rename to trunk/arch/powerpc/include/asm/seccomp.h diff --git a/trunk/arch/powerpc/include/uapi/asm/sembuf.h b/trunk/arch/powerpc/include/asm/sembuf.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/sembuf.h rename to trunk/arch/powerpc/include/asm/sembuf.h diff --git a/trunk/arch/powerpc/include/uapi/asm/setup.h b/trunk/arch/powerpc/include/asm/setup.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/setup.h rename to trunk/arch/powerpc/include/asm/setup.h diff --git a/trunk/arch/powerpc/include/uapi/asm/shmbuf.h b/trunk/arch/powerpc/include/asm/shmbuf.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/shmbuf.h rename to trunk/arch/powerpc/include/asm/shmbuf.h diff --git a/trunk/arch/powerpc/include/uapi/asm/sigcontext.h b/trunk/arch/powerpc/include/asm/sigcontext.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/sigcontext.h rename to trunk/arch/powerpc/include/asm/sigcontext.h diff --git a/trunk/arch/powerpc/include/uapi/asm/siginfo.h b/trunk/arch/powerpc/include/asm/siginfo.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/siginfo.h rename to trunk/arch/powerpc/include/asm/siginfo.h diff --git a/trunk/arch/powerpc/include/asm/signal.h b/trunk/arch/powerpc/include/asm/signal.h index 189998bb61c4..3eb13be11d8f 100644 --- a/trunk/arch/powerpc/include/asm/signal.h +++ b/trunk/arch/powerpc/include/asm/signal.h @@ -1,8 +1,149 @@ #ifndef _ASM_POWERPC_SIGNAL_H #define _ASM_POWERPC_SIGNAL_H -#include +#include +#define _NSIG 64 +#ifdef __powerpc64__ +#define _NSIG_BPW 64 +#else +#define _NSIG_BPW 32 +#endif +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef unsigned long old_sigset_t; /* at least 32 bits */ + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +/* +#define SIGLOST 29 +*/ +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED 31 + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX _NSIG + +/* + * SA_FLAGS values: + * + * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. + */ +#define SA_NOCLDSTOP 0x00000001U +#define SA_NOCLDWAIT 0x00000002U +#define SA_SIGINFO 0x00000004U +#define SA_ONSTACK 0x08000000U +#define SA_RESTART 0x10000000U +#define SA_NODEFER 0x40000000U +#define SA_RESETHAND 0x80000000U + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND + +#define SA_RESTORER 0x04000000U + +/* + * sigaltstack controls + */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#include + +struct old_sigaction { + __sighandler_t sa_handler; + old_sigset_t sa_mask; + unsigned long sa_flags; + __sigrestore_t sa_restorer; +}; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + __sigrestore_t sa_restorer; + sigset_t sa_mask; /* mask last for extensibility */ +}; + +struct k_sigaction { + struct sigaction sa; +}; + +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; + +#ifdef __KERNEL__ struct pt_regs; #define ptrace_signal_deliver(regs, cookie) do { } while (0) +#endif /* __KERNEL__ */ + +#ifndef __powerpc64__ +/* + * These are parameters to dbg_sigreturn syscall. They enable or + * disable certain debugging things that can be done from signal + * handlers. The dbg_sigreturn syscall *must* be called from a + * SA_SIGINFO signal so the ucontext can be passed to it. It takes an + * array of struct sig_dbg_op, which has the debug operations to + * perform before returning from the signal. + */ +struct sig_dbg_op { + int dbg_type; + unsigned long dbg_value; +}; + +/* Enable or disable single-stepping. The value sets the state. */ +#define SIG_DBG_SINGLE_STEPPING 1 + +/* Enable or disable branch tracing. The value sets the state. */ +#define SIG_DBG_BRANCH_TRACING 2 +#endif /* ! __powerpc64__ */ + #endif /* _ASM_POWERPC_SIGNAL_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/socket.h b/trunk/arch/powerpc/include/asm/socket.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/socket.h rename to trunk/arch/powerpc/include/asm/socket.h diff --git a/trunk/arch/powerpc/include/uapi/asm/sockios.h b/trunk/arch/powerpc/include/asm/sockios.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/sockios.h rename to trunk/arch/powerpc/include/asm/sockios.h diff --git a/trunk/arch/powerpc/include/asm/spu_info.h b/trunk/arch/powerpc/include/asm/spu_info.h index 7146b78e40f1..1286c823f0d8 100644 --- a/trunk/arch/powerpc/include/asm/spu_info.h +++ b/trunk/arch/powerpc/include/asm/spu_info.h @@ -19,10 +19,37 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + #ifndef _SPU_INFO_H #define _SPU_INFO_H +#include + +#ifdef __KERNEL__ #include -#include +#else +struct mfc_cq_sr { + __u64 mfc_cq_data0_RW; + __u64 mfc_cq_data1_RW; + __u64 mfc_cq_data2_RW; + __u64 mfc_cq_data3_RW; +}; +#endif /* __KERNEL__ */ + +struct spu_dma_info { + __u64 dma_info_type; + __u64 dma_info_mask; + __u64 dma_info_status; + __u64 dma_info_stall_and_notify; + __u64 dma_info_atomic_command_status; + struct mfc_cq_sr dma_info_command_data[16]; +}; + +struct spu_proxydma_info { + __u64 proxydma_info_type; + __u64 proxydma_info_mask; + __u64 proxydma_info_status; + struct mfc_cq_sr proxydma_info_command_data[8]; +}; #endif diff --git a/trunk/arch/powerpc/include/uapi/asm/stat.h b/trunk/arch/powerpc/include/asm/stat.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/stat.h rename to trunk/arch/powerpc/include/asm/stat.h diff --git a/trunk/arch/powerpc/include/uapi/asm/statfs.h b/trunk/arch/powerpc/include/asm/statfs.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/statfs.h rename to trunk/arch/powerpc/include/asm/statfs.h diff --git a/trunk/arch/powerpc/include/asm/swab.h b/trunk/arch/powerpc/include/asm/swab.h index b9bd1ca944d0..c581e3ef73ed 100644 --- a/trunk/arch/powerpc/include/asm/swab.h +++ b/trunk/arch/powerpc/include/asm/swab.h @@ -1,18 +1,24 @@ +#ifndef _ASM_POWERPC_SWAB_H +#define _ASM_POWERPC_SWAB_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 * 2 of the License, or (at your option) any later version. */ -#ifndef _ASM_POWERPC_SWAB_H -#define _ASM_POWERPC_SWAB_H -#include +#include +#include #ifdef __GNUC__ + #ifndef __powerpc64__ +#define __SWAB_64_THRU_32__ #endif /* __powerpc64__ */ +#ifdef __KERNEL__ + static __inline__ __u16 ld_le16(const volatile __u16 *addr) { __u16 val; @@ -77,5 +83,8 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 value) } #define __arch_swab32 __arch_swab32 +#endif /* __KERNEL__ */ + #endif /* __GNUC__ */ + #endif /* _ASM_POWERPC_SWAB_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/termbits.h b/trunk/arch/powerpc/include/asm/termbits.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/termbits.h rename to trunk/arch/powerpc/include/asm/termbits.h diff --git a/trunk/arch/powerpc/include/asm/termios.h b/trunk/arch/powerpc/include/asm/termios.h index b8353e2032d0..a24f48704a34 100644 --- a/trunk/arch/powerpc/include/asm/termios.h +++ b/trunk/arch/powerpc/include/asm/termios.h @@ -1,3 +1,6 @@ +#ifndef _ASM_POWERPC_TERMIOS_H +#define _ASM_POWERPC_TERMIOS_H + /* * Liberally adapted from alpha/termios.h. In particular, the c_cc[] * fields have been reordered so that termio & termios share the @@ -9,14 +12,74 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#ifndef _ASM_POWERPC_TERMIOS_H -#define _ASM_POWERPC_TERMIOS_H -#include +#include +#include + +struct sgttyb { + char sg_ispeed; + char sg_ospeed; + char sg_erase; + char sg_kill; + short sg_flags; +}; + +struct tchars { + char t_intrc; + char t_quitc; + char t_startc; + char t_stopc; + char t_eofc; + char t_brkc; +}; +struct ltchars { + char t_suspc; + char t_dsuspc; + char t_rprntc; + char t_flushc; + char t_werasc; + char t_lnextc; +}; + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 10 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* c_cc characters */ +#define _VINTR 0 +#define _VQUIT 1 +#define _VERASE 2 +#define _VKILL 3 +#define _VEOF 4 +#define _VMIN 5 +#define _VEOL 6 +#define _VTIME 7 +#define _VEOL2 8 +#define _VSWTC 9 + +#ifdef __KERNEL__ /* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */ #define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" +#endif + +#ifdef __KERNEL__ #include +#endif /* __KERNEL__ */ + #endif /* _ASM_POWERPC_TERMIOS_H */ diff --git a/trunk/arch/powerpc/include/asm/types.h b/trunk/arch/powerpc/include/asm/types.h index bfb6ded38ffa..0abf7f2c6df9 100644 --- a/trunk/arch/powerpc/include/asm/types.h +++ b/trunk/arch/powerpc/include/asm/types.h @@ -1,3 +1,22 @@ +#ifndef _ASM_POWERPC_TYPES_H +#define _ASM_POWERPC_TYPES_H + +/* + * This is here because we used to use l64 for 64bit powerpc + * and we don't want to impact user mode with our change to ll64 + * in the kernel. + * + * However, some user programs are fine with this. They can + * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here. + */ +#if !defined(__SANE_USERSPACE_TYPES__) && defined(__powerpc64__) && !defined(__KERNEL__) +# include +#else +# include +#endif + +#ifndef __ASSEMBLY__ + /* * This file is never included by application software unless * explicitly requested (e.g., via linux/types.h) in which case the @@ -10,11 +29,14 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#ifndef _ASM_POWERPC_TYPES_H -#define _ASM_POWERPC_TYPES_H -#include +typedef struct { + __u32 u[4]; +} __attribute__((aligned(16))) __vector128; +#endif /* __ASSEMBLY__ */ + +#ifdef __KERNEL__ #ifndef __ASSEMBLY__ typedef __vector128 vector128; @@ -27,4 +49,6 @@ typedef struct { #endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ + #endif /* _ASM_POWERPC_TYPES_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/ucontext.h b/trunk/arch/powerpc/include/asm/ucontext.h similarity index 100% rename from trunk/arch/powerpc/include/uapi/asm/ucontext.h rename to trunk/arch/powerpc/include/asm/ucontext.h diff --git a/trunk/arch/powerpc/include/asm/unistd.h b/trunk/arch/powerpc/include/asm/unistd.h index 921dce6d8445..2533752af30f 100644 --- a/trunk/arch/powerpc/include/asm/unistd.h +++ b/trunk/arch/powerpc/include/asm/unistd.h @@ -1,3 +1,6 @@ +#ifndef _ASM_POWERPC_UNISTD_H_ +#define _ASM_POWERPC_UNISTD_H_ + /* * This file contains the system call numbers. * @@ -6,11 +9,374 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#ifndef _ASM_POWERPC_UNISTD_H_ -#define _ASM_POWERPC_UNISTD_H_ -#include +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_waitpid 7 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_time 13 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_lchown 16 +#define __NR_break 17 +#define __NR_oldstat 18 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_umount 22 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_stime 25 +#define __NR_ptrace 26 +#define __NR_alarm 27 +#define __NR_oldfstat 28 +#define __NR_pause 29 +#define __NR_utime 30 +#define __NR_stty 31 +#define __NR_gtty 32 +#define __NR_access 33 +#define __NR_nice 34 +#define __NR_ftime 35 +#define __NR_sync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_prof 44 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_signal 48 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_umount2 52 +#define __NR_lock 53 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_mpx 56 +#define __NR_setpgid 57 +#define __NR_ulimit 58 +#define __NR_oldolduname 59 +#define __NR_umask 60 +#define __NR_chroot 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_sigaction 67 +#define __NR_sgetmask 68 +#define __NR_ssetmask 69 +#define __NR_setreuid 70 +#define __NR_setregid 71 +#define __NR_sigsuspend 72 +#define __NR_sigpending 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrlimit 76 +#define __NR_getrusage 77 +#define __NR_gettimeofday 78 +#define __NR_settimeofday 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_select 82 +#define __NR_symlink 83 +#define __NR_oldlstat 84 +#define __NR_readlink 85 +#define __NR_uselib 86 +#define __NR_swapon 87 +#define __NR_reboot 88 +#define __NR_readdir 89 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +#define __NR_profil 98 +#define __NR_statfs 99 +#define __NR_fstatfs 100 +#define __NR_ioperm 101 +#define __NR_socketcall 102 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_stat 106 +#define __NR_lstat 107 +#define __NR_fstat 108 +#define __NR_olduname 109 +#define __NR_iopl 110 +#define __NR_vhangup 111 +#define __NR_idle 112 +#define __NR_vm86 113 +#define __NR_wait4 114 +#define __NR_swapoff 115 +#define __NR_sysinfo 116 +#define __NR_ipc 117 +#define __NR_fsync 118 +#define __NR_sigreturn 119 +#define __NR_clone 120 +#define __NR_setdomainname 121 +#define __NR_uname 122 +#define __NR_modify_ldt 123 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_sigprocmask 126 +#define __NR_create_module 127 +#define __NR_init_module 128 +#define __NR_delete_module 129 +#define __NR_get_kernel_syms 130 +#define __NR_quotactl 131 +#define __NR_getpgid 132 +#define __NR_fchdir 133 +#define __NR_bdflush 134 +#define __NR_sysfs 135 +#define __NR_personality 136 +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ +#define __NR_setfsuid 138 +#define __NR_setfsgid 139 +#define __NR__llseek 140 +#define __NR_getdents 141 +#define __NR__newselect 142 +#define __NR_flock 143 +#define __NR_msync 144 +#define __NR_readv 145 +#define __NR_writev 146 +#define __NR_getsid 147 +#define __NR_fdatasync 148 +#define __NR__sysctl 149 +#define __NR_mlock 150 +#define __NR_munlock 151 +#define __NR_mlockall 152 +#define __NR_munlockall 153 +#define __NR_sched_setparam 154 +#define __NR_sched_getparam 155 +#define __NR_sched_setscheduler 156 +#define __NR_sched_getscheduler 157 +#define __NR_sched_yield 158 +#define __NR_sched_get_priority_max 159 +#define __NR_sched_get_priority_min 160 +#define __NR_sched_rr_get_interval 161 +#define __NR_nanosleep 162 +#define __NR_mremap 163 +#define __NR_setresuid 164 +#define __NR_getresuid 165 +#define __NR_query_module 166 +#define __NR_poll 167 +#define __NR_nfsservctl 168 +#define __NR_setresgid 169 +#define __NR_getresgid 170 +#define __NR_prctl 171 +#define __NR_rt_sigreturn 172 +#define __NR_rt_sigaction 173 +#define __NR_rt_sigprocmask 174 +#define __NR_rt_sigpending 175 +#define __NR_rt_sigtimedwait 176 +#define __NR_rt_sigqueueinfo 177 +#define __NR_rt_sigsuspend 178 +#define __NR_pread64 179 +#define __NR_pwrite64 180 +#define __NR_chown 181 +#define __NR_getcwd 182 +#define __NR_capget 183 +#define __NR_capset 184 +#define __NR_sigaltstack 185 +#define __NR_sendfile 186 +#define __NR_getpmsg 187 /* some people actually want streams */ +#define __NR_putpmsg 188 /* some people actually want streams */ +#define __NR_vfork 189 +#define __NR_ugetrlimit 190 /* SuS compliant getrlimit */ +#define __NR_readahead 191 +#ifndef __powerpc64__ /* these are 32-bit only */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#endif +#define __NR_pciconfig_read 198 +#define __NR_pciconfig_write 199 +#define __NR_pciconfig_iobase 200 +#define __NR_multiplexer 201 +#define __NR_getdents64 202 +#define __NR_pivot_root 203 +#ifndef __powerpc64__ +#define __NR_fcntl64 204 +#endif +#define __NR_madvise 205 +#define __NR_mincore 206 +#define __NR_gettid 207 +#define __NR_tkill 208 +#define __NR_setxattr 209 +#define __NR_lsetxattr 210 +#define __NR_fsetxattr 211 +#define __NR_getxattr 212 +#define __NR_lgetxattr 213 +#define __NR_fgetxattr 214 +#define __NR_listxattr 215 +#define __NR_llistxattr 216 +#define __NR_flistxattr 217 +#define __NR_removexattr 218 +#define __NR_lremovexattr 219 +#define __NR_fremovexattr 220 +#define __NR_futex 221 +#define __NR_sched_setaffinity 222 +#define __NR_sched_getaffinity 223 +/* 224 currently unused */ +#define __NR_tuxcall 225 +#ifndef __powerpc64__ +#define __NR_sendfile64 226 +#endif +#define __NR_io_setup 227 +#define __NR_io_destroy 228 +#define __NR_io_getevents 229 +#define __NR_io_submit 230 +#define __NR_io_cancel 231 +#define __NR_set_tid_address 232 +#define __NR_fadvise64 233 +#define __NR_exit_group 234 +#define __NR_lookup_dcookie 235 +#define __NR_epoll_create 236 +#define __NR_epoll_ctl 237 +#define __NR_epoll_wait 238 +#define __NR_remap_file_pages 239 +#define __NR_timer_create 240 +#define __NR_timer_settime 241 +#define __NR_timer_gettime 242 +#define __NR_timer_getoverrun 243 +#define __NR_timer_delete 244 +#define __NR_clock_settime 245 +#define __NR_clock_gettime 246 +#define __NR_clock_getres 247 +#define __NR_clock_nanosleep 248 +#define __NR_swapcontext 249 +#define __NR_tgkill 250 +#define __NR_utimes 251 +#define __NR_statfs64 252 +#define __NR_fstatfs64 253 +#ifndef __powerpc64__ +#define __NR_fadvise64_64 254 +#endif +#define __NR_rtas 255 +#define __NR_sys_debug_setcontext 256 +/* Number 257 is reserved for vserver */ +#define __NR_migrate_pages 258 +#define __NR_mbind 259 +#define __NR_get_mempolicy 260 +#define __NR_set_mempolicy 261 +#define __NR_mq_open 262 +#define __NR_mq_unlink 263 +#define __NR_mq_timedsend 264 +#define __NR_mq_timedreceive 265 +#define __NR_mq_notify 266 +#define __NR_mq_getsetattr 267 +#define __NR_kexec_load 268 +#define __NR_add_key 269 +#define __NR_request_key 270 +#define __NR_keyctl 271 +#define __NR_waitid 272 +#define __NR_ioprio_set 273 +#define __NR_ioprio_get 274 +#define __NR_inotify_init 275 +#define __NR_inotify_add_watch 276 +#define __NR_inotify_rm_watch 277 +#define __NR_spu_run 278 +#define __NR_spu_create 279 +#define __NR_pselect6 280 +#define __NR_ppoll 281 +#define __NR_unshare 282 +#define __NR_splice 283 +#define __NR_tee 284 +#define __NR_vmsplice 285 +#define __NR_openat 286 +#define __NR_mkdirat 287 +#define __NR_mknodat 288 +#define __NR_fchownat 289 +#define __NR_futimesat 290 +#ifdef __powerpc64__ +#define __NR_newfstatat 291 +#else +#define __NR_fstatat64 291 +#endif +#define __NR_unlinkat 292 +#define __NR_renameat 293 +#define __NR_linkat 294 +#define __NR_symlinkat 295 +#define __NR_readlinkat 296 +#define __NR_fchmodat 297 +#define __NR_faccessat 298 +#define __NR_get_robust_list 299 +#define __NR_set_robust_list 300 +#define __NR_move_pages 301 +#define __NR_getcpu 302 +#define __NR_epoll_pwait 303 +#define __NR_utimensat 304 +#define __NR_signalfd 305 +#define __NR_timerfd_create 306 +#define __NR_eventfd 307 +#define __NR_sync_file_range2 308 +#define __NR_fallocate 309 +#define __NR_subpage_prot 310 +#define __NR_timerfd_settime 311 +#define __NR_timerfd_gettime 312 +#define __NR_signalfd4 313 +#define __NR_eventfd2 314 +#define __NR_epoll_create1 315 +#define __NR_dup3 316 +#define __NR_pipe2 317 +#define __NR_inotify_init1 318 +#define __NR_perf_event_open 319 +#define __NR_preadv 320 +#define __NR_pwritev 321 +#define __NR_rt_tgsigqueueinfo 322 +#define __NR_fanotify_init 323 +#define __NR_fanotify_mark 324 +#define __NR_prlimit64 325 +#define __NR_socket 326 +#define __NR_bind 327 +#define __NR_connect 328 +#define __NR_listen 329 +#define __NR_accept 330 +#define __NR_getsockname 331 +#define __NR_getpeername 332 +#define __NR_socketpair 333 +#define __NR_send 334 +#define __NR_sendto 335 +#define __NR_recv 336 +#define __NR_recvfrom 337 +#define __NR_shutdown 338 +#define __NR_setsockopt 339 +#define __NR_getsockopt 340 +#define __NR_sendmsg 341 +#define __NR_recvmsg 342 +#define __NR_recvmmsg 343 +#define __NR_accept4 344 +#define __NR_name_to_handle_at 345 +#define __NR_open_by_handle_at 346 +#define __NR_clock_adjtime 347 +#define __NR_syncfs 348 +#define __NR_sendmmsg 349 +#define __NR_setns 350 +#define __NR_process_vm_readv 351 +#define __NR_process_vm_writev 352 +#ifdef __KERNEL__ #define __NR_syscalls 353 @@ -65,4 +431,6 @@ asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall"))) #endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ + #endif /* _ASM_POWERPC_UNISTD_H_ */ diff --git a/trunk/arch/powerpc/include/uapi/asm/Kbuild b/trunk/arch/powerpc/include/uapi/asm/Kbuild index a33c3c03bb2e..baebb3da1d44 100644 --- a/trunk/arch/powerpc/include/uapi/asm/Kbuild +++ b/trunk/arch/powerpc/include/uapi/asm/Kbuild @@ -1,44 +1,3 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += auxvec.h -header-y += bitsperlong.h -header-y += bootx.h -header-y += byteorder.h -header-y += cputable.h -header-y += elf.h -header-y += errno.h -header-y += fcntl.h -header-y += ioctl.h -header-y += ioctls.h -header-y += ipcbuf.h -header-y += kvm.h -header-y += kvm_para.h -header-y += linkage.h -header-y += mman.h -header-y += msgbuf.h -header-y += nvram.h -header-y += param.h -header-y += poll.h -header-y += posix_types.h -header-y += ps3fb.h -header-y += ptrace.h -header-y += resource.h -header-y += seccomp.h -header-y += sembuf.h -header-y += setup.h -header-y += shmbuf.h -header-y += sigcontext.h -header-y += siginfo.h -header-y += signal.h -header-y += socket.h -header-y += sockios.h -header-y += spu_info.h -header-y += stat.h -header-y += statfs.h -header-y += swab.h -header-y += termbits.h -header-y += termios.h -header-y += types.h -header-y += ucontext.h -header-y += unistd.h diff --git a/trunk/arch/powerpc/include/uapi/asm/bootx.h b/trunk/arch/powerpc/include/uapi/asm/bootx.h deleted file mode 100644 index 6e51cf0708a1..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/bootx.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * This file describes the structure passed from the BootX application - * (for MacOS) when it is used to boot Linux. - * - * Written by Benjamin Herrenschmidt. - */ - - -#ifndef _UAPI__ASM_BOOTX_H__ -#define _UAPI__ASM_BOOTX_H__ - -#include - -#ifdef macintosh -#include -#include "linux_type_defs.h" -#endif - -#ifdef macintosh -/* All this requires PowerPC alignment */ -#pragma options align=power -#endif - -/* On kernel entry: - * - * r3 = 0x426f6f58 ('BooX') - * r4 = pointer to boot_infos - * r5 = NULL - * - * Data and instruction translation disabled, interrupts - * disabled, kernel loaded at physical 0x00000000 on PCI - * machines (will be different on NuBus). - */ - -#define BOOT_INFO_VERSION 5 -#define BOOT_INFO_COMPATIBLE_VERSION 1 - -/* Bit in the architecture flag mask. More to be defined in - future versions. Note that either BOOT_ARCH_PCI or - BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are - set additionally when BOOT_ARCH_NUBUS is set. - */ -#define BOOT_ARCH_PCI 0x00000001UL -#define BOOT_ARCH_NUBUS 0x00000002UL -#define BOOT_ARCH_NUBUS_PDM 0x00000010UL -#define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL -#define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL - -/* Maximum number of ranges in phys memory map */ -#define MAX_MEM_MAP_SIZE 26 - -/* This is the format of an element in the physical memory map. Note that - the map is optional and current BootX will only build it for pre-PCI - machines */ -typedef struct boot_info_map_entry -{ - __u32 physAddr; /* Physical starting address */ - __u32 size; /* Size in bytes */ -} boot_info_map_entry_t; - - -/* Here are the boot informations that are passed to the bootstrap - * Note that the kernel arguments and the device tree are appended - * at the end of this structure. */ -typedef struct boot_infos -{ - /* Version of this structure */ - __u32 version; - /* backward compatible down to version: */ - __u32 compatible_version; - - /* NEW (vers. 2) this holds the current _logical_ base addr of - the frame buffer (for use by early boot message) */ - __u8* logicalDisplayBase; - - /* NEW (vers. 4) Apple's machine identification */ - __u32 machineID; - - /* NEW (vers. 4) Detected hw architecture */ - __u32 architecture; - - /* The device tree (internal addresses relative to the beginning of the tree, - * device tree offset relative to the beginning of this structure). - * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this - * field is 0. - */ - __u32 deviceTreeOffset; /* Device tree offset */ - __u32 deviceTreeSize; /* Size of the device tree */ - - /* Some infos about the current MacOS display */ - __u32 dispDeviceRect[4]; /* left,top,right,bottom */ - __u32 dispDeviceDepth; /* (8, 16 or 32) */ - __u8* dispDeviceBase; /* base address (physical) */ - __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */ - __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */ - /* Optional offset in the registry to the current - * MacOS display. (Can be 0 when not detected) */ - __u32 dispDeviceRegEntryOffset; - - /* Optional pointer to boot ramdisk (offset from this structure) */ - __u32 ramDisk; - __u32 ramDiskSize; /* size of ramdisk image */ - - /* Kernel command line arguments (offset from this structure) */ - __u32 kernelParamsOffset; - - /* ALL BELOW NEW (vers. 4) */ - - /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag - (non-PCI) only. On PCI, memory is contiguous and it's size is in the - device-tree. */ - boot_info_map_entry_t - physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */ - __u32 physMemoryMapSize; /* How many entries in map */ - - - /* The framebuffer size (optional, currently 0) */ - __u32 frameBufferSize; /* Represents a max size, can be 0. */ - - /* NEW (vers. 5) */ - - /* Total params size (args + colormap + device tree + ramdisk) */ - __u32 totalParamsSize; - -} boot_infos_t; - - -#ifdef macintosh -#pragma options align=reset -#endif - -#endif /* _UAPI__ASM_BOOTX_H__ */ diff --git a/trunk/arch/powerpc/include/uapi/asm/cputable.h b/trunk/arch/powerpc/include/uapi/asm/cputable.h deleted file mode 100644 index ed9dd8156962..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/cputable.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _UAPI__ASM_POWERPC_CPUTABLE_H -#define _UAPI__ASM_POWERPC_CPUTABLE_H - -#define PPC_FEATURE_32 0x80000000 -#define PPC_FEATURE_64 0x40000000 -#define PPC_FEATURE_601_INSTR 0x20000000 -#define PPC_FEATURE_HAS_ALTIVEC 0x10000000 -#define PPC_FEATURE_HAS_FPU 0x08000000 -#define PPC_FEATURE_HAS_MMU 0x04000000 -#define PPC_FEATURE_HAS_4xxMAC 0x02000000 -#define PPC_FEATURE_UNIFIED_CACHE 0x01000000 -#define PPC_FEATURE_HAS_SPE 0x00800000 -#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 -#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 -#define PPC_FEATURE_NO_TB 0x00100000 -#define PPC_FEATURE_POWER4 0x00080000 -#define PPC_FEATURE_POWER5 0x00040000 -#define PPC_FEATURE_POWER5_PLUS 0x00020000 -#define PPC_FEATURE_CELL 0x00010000 -#define PPC_FEATURE_BOOKE 0x00008000 -#define PPC_FEATURE_SMT 0x00004000 -#define PPC_FEATURE_ICACHE_SNOOP 0x00002000 -#define PPC_FEATURE_ARCH_2_05 0x00001000 -#define PPC_FEATURE_PA6T 0x00000800 -#define PPC_FEATURE_HAS_DFP 0x00000400 -#define PPC_FEATURE_POWER6_EXT 0x00000200 -#define PPC_FEATURE_ARCH_2_06 0x00000100 -#define PPC_FEATURE_HAS_VSX 0x00000080 - -#define PPC_FEATURE_PSERIES_PERFMON_COMPAT \ - 0x00000040 - -#define PPC_FEATURE_TRUE_LE 0x00000002 -#define PPC_FEATURE_PPC_LE 0x00000001 - -#endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/elf.h b/trunk/arch/powerpc/include/uapi/asm/elf.h deleted file mode 100644 index 05b8d560cfba..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/elf.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * ELF register definitions.. - * - * 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. - */ -#ifndef _UAPI_ASM_POWERPC_ELF_H -#define _UAPI_ASM_POWERPC_ELF_H - - -#include - -#include -#include -#include - -/* PowerPC relocations defined by the ABIs */ -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 /* 32bit absolute address */ -#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -#define R_PPC_ADDR16 3 /* 16bit absolute address */ -#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 /* PC relative 26 bit */ -#define R_PPC_REL14 11 /* PC relative 16 bit */ -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 - -/* PowerPC relocations defined for the TLS access ABI. */ -#define R_PPC_TLS 67 /* none (sym+add)@tls */ -#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ -#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ -#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ -#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ -#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ -#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ -#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ -#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ -#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ -#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ -#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ - -/* keep this the last entry. */ -#define R_PPC_NUM 95 - - -#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ -#define ELF_NFPREG 33 /* includes fpscr */ - -typedef unsigned long elf_greg_t64; -typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG]; - -typedef unsigned int elf_greg_t32; -typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG]; -typedef elf_gregset_t32 compat_elf_gregset_t; - -/* - * ELF_ARCH, CLASS, and DATA are used to set parameters in the core dumps. - */ -#ifdef __powerpc64__ -# define ELF_NVRREG32 33 /* includes vscr & vrsave stuffed together */ -# define ELF_NVRREG 34 /* includes vscr & vrsave in split vectors */ -# define ELF_NVSRHALFREG 32 /* Half the vsx registers */ -# define ELF_GREG_TYPE elf_greg_t64 -#else -# define ELF_NEVRREG 34 /* includes acc (as 2) */ -# define ELF_NVRREG 33 /* includes vscr */ -# define ELF_GREG_TYPE elf_greg_t32 -# define ELF_ARCH EM_PPC -# define ELF_CLASS ELFCLASS32 -# define ELF_DATA ELFDATA2MSB -#endif /* __powerpc64__ */ - -#ifndef ELF_ARCH -# define ELF_ARCH EM_PPC64 -# define ELF_CLASS ELFCLASS64 -# define ELF_DATA ELFDATA2MSB - typedef elf_greg_t64 elf_greg_t; - typedef elf_gregset_t64 elf_gregset_t; -#else - /* Assumption: ELF_ARCH == EM_PPC and ELF_CLASS == ELFCLASS32 */ - typedef elf_greg_t32 elf_greg_t; - typedef elf_gregset_t32 elf_gregset_t; -#endif /* ELF_ARCH */ - -/* Floating point registers */ -typedef double elf_fpreg_t; -typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; - -/* Altivec registers */ -/* - * The entries with indexes 0-31 contain the corresponding vector registers. - * The entry with index 32 contains the vscr as the last word (offset 12) - * within the quadword. This allows the vscr to be stored as either a - * quadword (since it must be copied via a vector register to/from storage) - * or as a word. - * - * 64-bit kernel notes: The entry at index 33 contains the vrsave as the first - * word (offset 0) within the quadword. - * - * This definition of the VMX state is compatible with the current PPC32 - * ptrace interface. This allows signal handling and ptrace to use the same - * structures. This also simplifies the implementation of a bi-arch - * (combined (32- and 64-bit) gdb. - * - * Note that it's _not_ compatible with 32 bits ucontext which stuffs the - * vrsave along with vscr and so only uses 33 vectors for the register set - */ -typedef __vector128 elf_vrreg_t; -typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; -#ifdef __powerpc64__ -typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32]; -typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG]; -#endif - - -/* - * The requirements here are: - * - keep the final alignment of sp (sp & 0xf) - * - make sure the 32-bit value at the first 16 byte aligned position of - * AUXV is greater than 16 for glibc compatibility. - * AT_IGNOREPPC is used for that. - * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC, - * even if DLINFO_ARCH_ITEMS goes to zero or is undefined. - * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes - */ -#define ARCH_DLINFO \ -do { \ - /* Handle glibc compatibility. */ \ - NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ - NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ - /* Cache size items */ \ - NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \ - NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \ - NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \ - VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->mm->context.vdso_base); \ -} while (0) - -/* PowerPC64 relocations defined by the ABIs */ -#define R_PPC64_NONE R_PPC_NONE -#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */ -#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */ -#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */ -#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */ -#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */ -#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ -#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */ -#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN -#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN -#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */ -#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */ -#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN -#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN -#define R_PPC64_GOT16 R_PPC_GOT16 -#define R_PPC64_GOT16_LO R_PPC_GOT16_LO -#define R_PPC64_GOT16_HI R_PPC_GOT16_HI -#define R_PPC64_GOT16_HA R_PPC_GOT16_HA - -#define R_PPC64_COPY R_PPC_COPY -#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT -#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT -#define R_PPC64_RELATIVE R_PPC_RELATIVE - -#define R_PPC64_UADDR32 R_PPC_UADDR32 -#define R_PPC64_UADDR16 R_PPC_UADDR16 -#define R_PPC64_REL32 R_PPC_REL32 -#define R_PPC64_PLT32 R_PPC_PLT32 -#define R_PPC64_PLTREL32 R_PPC_PLTREL32 -#define R_PPC64_PLT16_LO R_PPC_PLT16_LO -#define R_PPC64_PLT16_HI R_PPC_PLT16_HI -#define R_PPC64_PLT16_HA R_PPC_PLT16_HA - -#define R_PPC64_SECTOFF R_PPC_SECTOFF -#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO -#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI -#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA -#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */ -#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */ -#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */ -#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */ -#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */ -#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */ -#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */ -#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */ -#define R_PPC64_PLT64 45 /* doubleword64 L + A. */ -#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */ -#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */ -#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */ -#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */ -#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */ -#define R_PPC64_TOC 51 /* doubleword64 .TOC. */ -#define R_PPC64_PLTGOT16 52 /* half16* M + A. */ -#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */ -#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */ -#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */ - -#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */ -#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */ -#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */ -#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */ -#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */ -#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */ -#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */ -#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */ -#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */ -#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */ -#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */ - -/* PowerPC64 relocations defined for the TLS access ABI. */ -#define R_PPC64_TLS 67 /* none (sym+add)@tls */ -#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ -#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ -#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ -#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ -#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ -#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ -#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ -#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ -#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ -#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ -#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ -#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ -#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ -#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ -#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ -#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ -#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ -#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ -#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ -#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ -#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ -#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ -#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ - -/* Keep this the last entry. */ -#define R_PPC64_NUM 107 - -/* There's actually a third entry here, but it's unused */ -struct ppc64_opd_entry -{ - unsigned long funcaddr; - unsigned long r2; -}; - - -#endif /* _UAPI_ASM_POWERPC_ELF_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/kvm_para.h b/trunk/arch/powerpc/include/uapi/asm/kvm_para.h deleted file mode 100644 index 5e04383a1db5..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/kvm_para.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2008 - * - * Authors: Hollis Blanchard - */ - -#ifndef _UAPI__POWERPC_KVM_PARA_H__ -#define _UAPI__POWERPC_KVM_PARA_H__ - -#include - -/* - * Additions to this struct must only occur at the end, and should be - * accompanied by a KVM_MAGIC_FEAT flag to advertise that they are present - * (albeit not necessarily relevant to the current target hardware platform). - * - * Struct fields are always 32 or 64 bit aligned, depending on them being 32 - * or 64 bit wide respectively. - * - * See Documentation/virtual/kvm/ppc-pv.txt - */ -struct kvm_vcpu_arch_shared { - __u64 scratch1; - __u64 scratch2; - __u64 scratch3; - __u64 critical; /* Guest may not get interrupts if == r1 */ - __u64 sprg0; - __u64 sprg1; - __u64 sprg2; - __u64 sprg3; - __u64 srr0; - __u64 srr1; - __u64 dar; /* dear on BookE */ - __u64 msr; - __u32 dsisr; - __u32 int_pending; /* Tells the guest if we have an interrupt */ - __u32 sr[16]; - __u32 mas0; - __u32 mas1; - __u64 mas7_3; - __u64 mas2; - __u32 mas4; - __u32 mas6; - __u32 esr; - __u32 pir; - - /* - * SPRG4-7 are user-readable, so we can only keep these consistent - * between the shared area and the real registers when there's an - * intervening exit to KVM. This also applies to SPRG3 on some - * chips. - * - * This suffices for access by guest userspace, since in PR-mode - * KVM, an exit must occur when changing the guest's MSR[PR]. - * If the guest kernel writes to SPRG3-7 via the shared area, it - * must also use the shared area for reading while in kernel space. - */ - __u64 sprg4; - __u64 sprg5; - __u64 sprg6; - __u64 sprg7; -}; - -#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */ -#define HC_VENDOR_KVM (42 << 16) -#define HC_EV_SUCCESS 0 -#define HC_EV_UNIMPLEMENTED 12 - -#define KVM_FEATURE_MAGIC_PAGE 1 - -#define KVM_MAGIC_FEAT_SR (1 << 0) - -/* MASn, ESR, PIR, and high SPRGs */ -#define KVM_MAGIC_FEAT_MAS0_TO_SPRG7 (1 << 1) - - -#endif /* _UAPI__POWERPC_KVM_PARA_H__ */ diff --git a/trunk/arch/powerpc/include/uapi/asm/mman.h b/trunk/arch/powerpc/include/uapi/asm/mman.h deleted file mode 100644 index 6ea26df0a73c..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/mman.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ -#ifndef _UAPI_ASM_POWERPC_MMAN_H -#define _UAPI_ASM_POWERPC_MMAN_H - -#include - - -#define PROT_SAO 0x10 /* Strong Access Ordering */ - -#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ -#define MAP_NORESERVE 0x40 /* don't reserve swap pages */ -#define MAP_LOCKED 0x80 - -#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ - -#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ -#define MCL_FUTURE 0x4000 /* lock all additions to address space */ - -#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000 /* do not block on IO */ -#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ -#define MAP_HUGETLB 0x40000 /* create a huge page mapping */ - -#endif /* _UAPI_ASM_POWERPC_MMAN_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/nvram.h b/trunk/arch/powerpc/include/uapi/asm/nvram.h deleted file mode 100644 index 608bdc8aedd1..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/nvram.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * NVRAM definitions and access functions. - * - * 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. - */ - -#ifndef _UAPI_ASM_POWERPC_NVRAM_H -#define _UAPI_ASM_POWERPC_NVRAM_H - -/* Signatures for nvram partitions */ -#define NVRAM_SIG_SP 0x02 /* support processor */ -#define NVRAM_SIG_OF 0x50 /* open firmware config */ -#define NVRAM_SIG_FW 0x51 /* general firmware */ -#define NVRAM_SIG_HW 0x52 /* hardware (VPD) */ -#define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */ -#define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */ -#define NVRAM_SIG_SYS 0x70 /* system env vars */ -#define NVRAM_SIG_CFG 0x71 /* config data */ -#define NVRAM_SIG_ELOG 0x72 /* error log */ -#define NVRAM_SIG_VEND 0x7e /* vendor defined */ -#define NVRAM_SIG_FREE 0x7f /* Free space */ -#define NVRAM_SIG_OS 0xa0 /* OS defined */ -#define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */ - - -/* PowerMac specific nvram stuffs */ - -enum { - pmac_nvram_OF, /* Open Firmware partition */ - pmac_nvram_XPRAM, /* MacOS XPRAM partition */ - pmac_nvram_NR /* MacOS Name Registry partition */ -}; - - -/* Some offsets in XPRAM */ -#define PMAC_XPRAM_MACHINE_LOC 0xe4 -#define PMAC_XPRAM_SOUND_VOLUME 0x08 - -/* Machine location structure in PowerMac XPRAM */ -struct pmac_machine_location { - unsigned int latitude; /* 2+30 bit Fractional number */ - unsigned int longitude; /* 2+30 bit Fractional number */ - unsigned int delta; /* mix of GMT delta and DLS */ -}; - -/* - * /dev/nvram ioctls - * - * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is - * definitely obsolete. Do not use it if you can avoid it - */ - -#define OBSOLETE_PMAC_NVRAM_GET_OFFSET \ - _IOWR('p', 0x40, int) - -#define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */ -#define IOC_NVRAM_SYNC _IO('p', 0x43) /* Sync NVRAM image */ - -#endif /* _UAPI_ASM_POWERPC_NVRAM_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/ptrace.h b/trunk/arch/powerpc/include/uapi/asm/ptrace.h deleted file mode 100644 index ee67a2bc91bb..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2001 PPC64 Team, IBM Corp - * - * This struct defines the way the registers are stored on the - * kernel stack during a system call or other kernel entry. - * - * this should only contain volatile regs - * since we can keep non-volatile in the thread_struct - * should set this up when only volatiles are saved - * by intr code. - * - * Since this is going on the stack, *CARE MUST BE TAKEN* to insure - * that the overall structure is a multiple of 16 bytes in length. - * - * Note that the offsets of the fields in this struct correspond with - * the PT_* values below. This simplifies arch/powerpc/kernel/ptrace.c. - * - * 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. - */ -#ifndef _UAPI_ASM_POWERPC_PTRACE_H -#define _UAPI_ASM_POWERPC_PTRACE_H - - -#include - -#ifndef __ASSEMBLY__ - -struct pt_regs { - unsigned long gpr[32]; - unsigned long nip; - unsigned long msr; - unsigned long orig_gpr3; /* Used for restarting system calls */ - unsigned long ctr; - unsigned long link; - unsigned long xer; - unsigned long ccr; -#ifdef __powerpc64__ - unsigned long softe; /* Soft enabled/disabled */ -#else - unsigned long mq; /* 601 only (not used at present) */ - /* Used on APUS to hold IPL value. */ -#endif - unsigned long trap; /* Reason for being here */ - /* N.B. for critical exceptions on 4xx, the dar and dsisr - fields are overloaded to hold srr0 and srr1. */ - unsigned long dar; /* Fault registers */ - unsigned long dsisr; /* on 4xx/Book-E used for ESR */ - unsigned long result; /* Result of a system call */ -}; - -#endif /* __ASSEMBLY__ */ - - -/* - * Offsets used by 'ptrace' system call interface. - * These can't be changed without breaking binary compatibility - * with MkLinux, etc. - */ -#define PT_R0 0 -#define PT_R1 1 -#define PT_R2 2 -#define PT_R3 3 -#define PT_R4 4 -#define PT_R5 5 -#define PT_R6 6 -#define PT_R7 7 -#define PT_R8 8 -#define PT_R9 9 -#define PT_R10 10 -#define PT_R11 11 -#define PT_R12 12 -#define PT_R13 13 -#define PT_R14 14 -#define PT_R15 15 -#define PT_R16 16 -#define PT_R17 17 -#define PT_R18 18 -#define PT_R19 19 -#define PT_R20 20 -#define PT_R21 21 -#define PT_R22 22 -#define PT_R23 23 -#define PT_R24 24 -#define PT_R25 25 -#define PT_R26 26 -#define PT_R27 27 -#define PT_R28 28 -#define PT_R29 29 -#define PT_R30 30 -#define PT_R31 31 - -#define PT_NIP 32 -#define PT_MSR 33 -#define PT_ORIG_R3 34 -#define PT_CTR 35 -#define PT_LNK 36 -#define PT_XER 37 -#define PT_CCR 38 -#ifndef __powerpc64__ -#define PT_MQ 39 -#else -#define PT_SOFTE 39 -#endif -#define PT_TRAP 40 -#define PT_DAR 41 -#define PT_DSISR 42 -#define PT_RESULT 43 -#define PT_REGS_COUNT 44 - -#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */ - -#ifndef __powerpc64__ - -#define PT_FPR31 (PT_FPR0 + 2*31) -#define PT_FPSCR (PT_FPR0 + 2*32 + 1) - -#else /* __powerpc64__ */ - -#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ - - -#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ -#define PT_VSCR (PT_VR0 + 32*2 + 1) -#define PT_VRSAVE (PT_VR0 + 33*2) - - -/* - * Only store first 32 VSRs here. The second 32 VSRs in VR0-31 - */ -#define PT_VSR0 150 /* each VSR reg occupies 2 slots in 64-bit */ -#define PT_VSR31 (PT_VSR0 + 2*31) -#endif /* __powerpc64__ */ - -/* - * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go. - * The transfer totals 34 quadword. Quadwords 0-31 contain the - * corresponding vector registers. Quadword 32 contains the vscr as the - * last word (offset 12) within that quadword. Quadword 33 contains the - * vrsave as the first word (offset 0) within the quadword. - * - * This definition of the VMX state is compatible with the current PPC32 - * ptrace interface. This allows signal handling and ptrace to use the same - * structures. This also simplifies the implementation of a bi-arch - * (combined (32- and 64-bit) gdb. - */ -#define PTRACE_GETVRREGS 18 -#define PTRACE_SETVRREGS 19 - -/* Get/set all the upper 32-bits of the SPE registers, accumulator, and - * spefscr, in one go */ -#define PTRACE_GETEVRREGS 20 -#define PTRACE_SETEVRREGS 21 - -/* Get the first 32 128bit VSX registers */ -#define PTRACE_GETVSRREGS 27 -#define PTRACE_SETVSRREGS 28 - -/* - * Get or set a debug register. The first 16 are DABR registers and the - * second 16 are IABR registers. - */ -#define PTRACE_GET_DEBUGREG 25 -#define PTRACE_SET_DEBUGREG 26 - -/* (new) PTRACE requests using the same numbers as x86 and the same - * argument ordering. Additionally, they support more registers too - */ -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 -#define PTRACE_GETREGS64 22 -#define PTRACE_SETREGS64 23 - -/* Calls to trace a 64bit program from a 32bit program */ -#define PPC_PTRACE_PEEKTEXT_3264 0x95 -#define PPC_PTRACE_PEEKDATA_3264 0x94 -#define PPC_PTRACE_POKETEXT_3264 0x93 -#define PPC_PTRACE_POKEDATA_3264 0x92 -#define PPC_PTRACE_PEEKUSR_3264 0x91 -#define PPC_PTRACE_POKEUSR_3264 0x90 - -#define PTRACE_SINGLEBLOCK 0x100 /* resume execution until next branch */ - -#define PPC_PTRACE_GETHWDBGINFO 0x89 -#define PPC_PTRACE_SETHWDEBUG 0x88 -#define PPC_PTRACE_DELHWDEBUG 0x87 - -#ifndef __ASSEMBLY__ - -struct ppc_debug_info { - __u32 version; /* Only version 1 exists to date */ - __u32 num_instruction_bps; - __u32 num_data_bps; - __u32 num_condition_regs; - __u32 data_bp_alignment; - __u32 sizeof_condition; /* size of the DVC register */ - __u64 features; -}; - -#endif /* __ASSEMBLY__ */ - -/* - * features will have bits indication whether there is support for: - */ -#define PPC_DEBUG_FEATURE_INSN_BP_RANGE 0x0000000000000001 -#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x0000000000000002 -#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x0000000000000004 -#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x0000000000000008 - -#ifndef __ASSEMBLY__ - -struct ppc_hw_breakpoint { - __u32 version; /* currently, version must be 1 */ - __u32 trigger_type; /* only some combinations allowed */ - __u32 addr_mode; /* address match mode */ - __u32 condition_mode; /* break/watchpoint condition flags */ - __u64 addr; /* break/watchpoint address */ - __u64 addr2; /* range end or mask */ - __u64 condition_value; /* contents of the DVC register */ -}; - -#endif /* __ASSEMBLY__ */ - -/* - * Trigger Type - */ -#define PPC_BREAKPOINT_TRIGGER_EXECUTE 0x00000001 -#define PPC_BREAKPOINT_TRIGGER_READ 0x00000002 -#define PPC_BREAKPOINT_TRIGGER_WRITE 0x00000004 -#define PPC_BREAKPOINT_TRIGGER_RW \ - (PPC_BREAKPOINT_TRIGGER_READ | PPC_BREAKPOINT_TRIGGER_WRITE) - -/* - * Address Mode - */ -#define PPC_BREAKPOINT_MODE_EXACT 0x00000000 -#define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE 0x00000001 -#define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE 0x00000002 -#define PPC_BREAKPOINT_MODE_MASK 0x00000003 - -/* - * Condition Mode - */ -#define PPC_BREAKPOINT_CONDITION_MODE 0x00000003 -#define PPC_BREAKPOINT_CONDITION_NONE 0x00000000 -#define PPC_BREAKPOINT_CONDITION_AND 0x00000001 -#define PPC_BREAKPOINT_CONDITION_EXACT PPC_BREAKPOINT_CONDITION_AND -#define PPC_BREAKPOINT_CONDITION_OR 0x00000002 -#define PPC_BREAKPOINT_CONDITION_AND_OR 0x00000003 -#define PPC_BREAKPOINT_CONDITION_BE_ALL 0x00ff0000 -#define PPC_BREAKPOINT_CONDITION_BE_SHIFT 16 -#define PPC_BREAKPOINT_CONDITION_BE(n) \ - (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT)) - -#endif /* _UAPI_ASM_POWERPC_PTRACE_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/signal.h b/trunk/arch/powerpc/include/uapi/asm/signal.h deleted file mode 100644 index 48fa8d3f2f9a..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/signal.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef _UAPI_ASM_POWERPC_SIGNAL_H -#define _UAPI_ASM_POWERPC_SIGNAL_H - -#include - -#define _NSIG 64 -#ifdef __powerpc64__ -#define _NSIG_BPW 64 -#else -#define _NSIG_BPW 32 -#endif -#define _NSIG_WORDS (_NSIG / _NSIG_BPW) - -typedef unsigned long old_sigset_t; /* at least 32 bits */ - -typedef struct { - unsigned long sig[_NSIG_WORDS]; -} sigset_t; - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT 6 -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -/* -#define SIGLOST 29 -*/ -#define SIGPWR 30 -#define SIGSYS 31 -#define SIGUNUSED 31 - -/* These should not be considered constants from userland. */ -#define SIGRTMIN 32 -#define SIGRTMAX _NSIG - -/* - * SA_FLAGS values: - * - * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. - * SA_RESETHAND clears the handler when the signal is delivered. - * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. - * SA_NODEFER prevents the current signal from being masked in the handler. - * - * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single - * Unix names RESETHAND and NODEFER respectively. - */ -#define SA_NOCLDSTOP 0x00000001U -#define SA_NOCLDWAIT 0x00000002U -#define SA_SIGINFO 0x00000004U -#define SA_ONSTACK 0x08000000U -#define SA_RESTART 0x10000000U -#define SA_NODEFER 0x40000000U -#define SA_RESETHAND 0x80000000U - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND - -#define SA_RESTORER 0x04000000U - -/* - * sigaltstack controls - */ -#define SS_ONSTACK 1 -#define SS_DISABLE 2 - -#define MINSIGSTKSZ 2048 -#define SIGSTKSZ 8192 - -#include - -struct old_sigaction { - __sighandler_t sa_handler; - old_sigset_t sa_mask; - unsigned long sa_flags; - __sigrestore_t sa_restorer; -}; - -struct sigaction { - __sighandler_t sa_handler; - unsigned long sa_flags; - __sigrestore_t sa_restorer; - sigset_t sa_mask; /* mask last for extensibility */ -}; - -struct k_sigaction { - struct sigaction sa; -}; - -typedef struct sigaltstack { - void __user *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - - -#ifndef __powerpc64__ -/* - * These are parameters to dbg_sigreturn syscall. They enable or - * disable certain debugging things that can be done from signal - * handlers. The dbg_sigreturn syscall *must* be called from a - * SA_SIGINFO signal so the ucontext can be passed to it. It takes an - * array of struct sig_dbg_op, which has the debug operations to - * perform before returning from the signal. - */ -struct sig_dbg_op { - int dbg_type; - unsigned long dbg_value; -}; - -/* Enable or disable single-stepping. The value sets the state. */ -#define SIG_DBG_SINGLE_STEPPING 1 - -/* Enable or disable branch tracing. The value sets the state. */ -#define SIG_DBG_BRANCH_TRACING 2 -#endif /* ! __powerpc64__ */ - -#endif /* _UAPI_ASM_POWERPC_SIGNAL_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/spu_info.h b/trunk/arch/powerpc/include/uapi/asm/spu_info.h deleted file mode 100644 index ed071bf97707..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/spu_info.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SPU info structures - * - * (C) Copyright 2006 IBM Corp. - * - * Author: Dwayne Grant McConnell - * - * 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, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef _UAPI_SPU_INFO_H -#define _UAPI_SPU_INFO_H - -#include - -#ifndef __KERNEL__ -struct mfc_cq_sr { - __u64 mfc_cq_data0_RW; - __u64 mfc_cq_data1_RW; - __u64 mfc_cq_data2_RW; - __u64 mfc_cq_data3_RW; -}; -#endif /* __KERNEL__ */ - -struct spu_dma_info { - __u64 dma_info_type; - __u64 dma_info_mask; - __u64 dma_info_status; - __u64 dma_info_stall_and_notify; - __u64 dma_info_atomic_command_status; - struct mfc_cq_sr dma_info_command_data[16]; -}; - -struct spu_proxydma_info { - __u64 proxydma_info_type; - __u64 proxydma_info_mask; - __u64 proxydma_info_status; - struct mfc_cq_sr proxydma_info_command_data[8]; -}; - -#endif /* _UAPI_SPU_INFO_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/swab.h b/trunk/arch/powerpc/include/uapi/asm/swab.h deleted file mode 100644 index b6c368aa5c05..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/swab.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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. - */ -#ifndef _UAPI_ASM_POWERPC_SWAB_H -#define _UAPI_ASM_POWERPC_SWAB_H - - -#include -#include - -#ifdef __GNUC__ - -#ifndef __powerpc64__ -#define __SWAB_64_THRU_32__ -#endif /* __powerpc64__ */ - - -#endif /* __GNUC__ */ - -#endif /* _UAPI_ASM_POWERPC_SWAB_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/termios.h b/trunk/arch/powerpc/include/uapi/asm/termios.h deleted file mode 100644 index 6cca5cdfec04..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/termios.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Liberally adapted from alpha/termios.h. In particular, the c_cc[] - * fields have been reordered so that termio & termios share the - * common subset in the same order (for brain dead programs that don't - * know or care about the differences). - * - * 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. - */ -#ifndef _UAPI_ASM_POWERPC_TERMIOS_H -#define _UAPI_ASM_POWERPC_TERMIOS_H - - -#include -#include - -struct sgttyb { - char sg_ispeed; - char sg_ospeed; - char sg_erase; - char sg_kill; - short sg_flags; -}; - -struct tchars { - char t_intrc; - char t_quitc; - char t_startc; - char t_stopc; - char t_eofc; - char t_brkc; -}; - -struct ltchars { - char t_suspc; - char t_dsuspc; - char t_rprntc; - char t_flushc; - char t_werasc; - char t_lnextc; -}; - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 10 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* c_cc characters */ -#define _VINTR 0 -#define _VQUIT 1 -#define _VERASE 2 -#define _VKILL 3 -#define _VEOF 4 -#define _VMIN 5 -#define _VEOL 6 -#define _VTIME 7 -#define _VEOL2 8 -#define _VSWTC 9 - - - -#endif /* _UAPI_ASM_POWERPC_TERMIOS_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/types.h b/trunk/arch/powerpc/include/uapi/asm/types.h deleted file mode 100644 index 4b8ab990a3c1..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/types.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is never included by application software unless - * explicitly requested (e.g., via linux/types.h) in which case the - * application is Linux specific so (user-) name space pollution is - * not a major issue. However, for interoperability, libraries still - * need to be careful to avoid a name clashes. - * - * 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. - */ -#ifndef _UAPI_ASM_POWERPC_TYPES_H -#define _UAPI_ASM_POWERPC_TYPES_H - -/* - * This is here because we used to use l64 for 64bit powerpc - * and we don't want to impact user mode with our change to ll64 - * in the kernel. - * - * However, some user programs are fine with this. They can - * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here. - */ -#if !defined(__SANE_USERSPACE_TYPES__) && defined(__powerpc64__) && !defined(__KERNEL__) -# include -#else -# include -#endif - -#ifndef __ASSEMBLY__ - - -typedef struct { - __u32 u[4]; -} __attribute__((aligned(16))) __vector128; - -#endif /* __ASSEMBLY__ */ - - -#endif /* _UAPI_ASM_POWERPC_TYPES_H */ diff --git a/trunk/arch/powerpc/include/uapi/asm/unistd.h b/trunk/arch/powerpc/include/uapi/asm/unistd.h deleted file mode 100644 index 380b5d37a904..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/unistd.h +++ /dev/null @@ -1,380 +0,0 @@ -/* - * This file contains the system call numbers. - * - * 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. - */ -#ifndef _UAPI_ASM_POWERPC_UNISTD_H_ -#define _UAPI_ASM_POWERPC_UNISTD_H_ - - -#define __NR_restart_syscall 0 -#define __NR_exit 1 -#define __NR_fork 2 -#define __NR_read 3 -#define __NR_write 4 -#define __NR_open 5 -#define __NR_close 6 -#define __NR_waitpid 7 -#define __NR_creat 8 -#define __NR_link 9 -#define __NR_unlink 10 -#define __NR_execve 11 -#define __NR_chdir 12 -#define __NR_time 13 -#define __NR_mknod 14 -#define __NR_chmod 15 -#define __NR_lchown 16 -#define __NR_break 17 -#define __NR_oldstat 18 -#define __NR_lseek 19 -#define __NR_getpid 20 -#define __NR_mount 21 -#define __NR_umount 22 -#define __NR_setuid 23 -#define __NR_getuid 24 -#define __NR_stime 25 -#define __NR_ptrace 26 -#define __NR_alarm 27 -#define __NR_oldfstat 28 -#define __NR_pause 29 -#define __NR_utime 30 -#define __NR_stty 31 -#define __NR_gtty 32 -#define __NR_access 33 -#define __NR_nice 34 -#define __NR_ftime 35 -#define __NR_sync 36 -#define __NR_kill 37 -#define __NR_rename 38 -#define __NR_mkdir 39 -#define __NR_rmdir 40 -#define __NR_dup 41 -#define __NR_pipe 42 -#define __NR_times 43 -#define __NR_prof 44 -#define __NR_brk 45 -#define __NR_setgid 46 -#define __NR_getgid 47 -#define __NR_signal 48 -#define __NR_geteuid 49 -#define __NR_getegid 50 -#define __NR_acct 51 -#define __NR_umount2 52 -#define __NR_lock 53 -#define __NR_ioctl 54 -#define __NR_fcntl 55 -#define __NR_mpx 56 -#define __NR_setpgid 57 -#define __NR_ulimit 58 -#define __NR_oldolduname 59 -#define __NR_umask 60 -#define __NR_chroot 61 -#define __NR_ustat 62 -#define __NR_dup2 63 -#define __NR_getppid 64 -#define __NR_getpgrp 65 -#define __NR_setsid 66 -#define __NR_sigaction 67 -#define __NR_sgetmask 68 -#define __NR_ssetmask 69 -#define __NR_setreuid 70 -#define __NR_setregid 71 -#define __NR_sigsuspend 72 -#define __NR_sigpending 73 -#define __NR_sethostname 74 -#define __NR_setrlimit 75 -#define __NR_getrlimit 76 -#define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 -#define __NR_getgroups 80 -#define __NR_setgroups 81 -#define __NR_select 82 -#define __NR_symlink 83 -#define __NR_oldlstat 84 -#define __NR_readlink 85 -#define __NR_uselib 86 -#define __NR_swapon 87 -#define __NR_reboot 88 -#define __NR_readdir 89 -#define __NR_mmap 90 -#define __NR_munmap 91 -#define __NR_truncate 92 -#define __NR_ftruncate 93 -#define __NR_fchmod 94 -#define __NR_fchown 95 -#define __NR_getpriority 96 -#define __NR_setpriority 97 -#define __NR_profil 98 -#define __NR_statfs 99 -#define __NR_fstatfs 100 -#define __NR_ioperm 101 -#define __NR_socketcall 102 -#define __NR_syslog 103 -#define __NR_setitimer 104 -#define __NR_getitimer 105 -#define __NR_stat 106 -#define __NR_lstat 107 -#define __NR_fstat 108 -#define __NR_olduname 109 -#define __NR_iopl 110 -#define __NR_vhangup 111 -#define __NR_idle 112 -#define __NR_vm86 113 -#define __NR_wait4 114 -#define __NR_swapoff 115 -#define __NR_sysinfo 116 -#define __NR_ipc 117 -#define __NR_fsync 118 -#define __NR_sigreturn 119 -#define __NR_clone 120 -#define __NR_setdomainname 121 -#define __NR_uname 122 -#define __NR_modify_ldt 123 -#define __NR_adjtimex 124 -#define __NR_mprotect 125 -#define __NR_sigprocmask 126 -#define __NR_create_module 127 -#define __NR_init_module 128 -#define __NR_delete_module 129 -#define __NR_get_kernel_syms 130 -#define __NR_quotactl 131 -#define __NR_getpgid 132 -#define __NR_fchdir 133 -#define __NR_bdflush 134 -#define __NR_sysfs 135 -#define __NR_personality 136 -#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ -#define __NR_setfsuid 138 -#define __NR_setfsgid 139 -#define __NR__llseek 140 -#define __NR_getdents 141 -#define __NR__newselect 142 -#define __NR_flock 143 -#define __NR_msync 144 -#define __NR_readv 145 -#define __NR_writev 146 -#define __NR_getsid 147 -#define __NR_fdatasync 148 -#define __NR__sysctl 149 -#define __NR_mlock 150 -#define __NR_munlock 151 -#define __NR_mlockall 152 -#define __NR_munlockall 153 -#define __NR_sched_setparam 154 -#define __NR_sched_getparam 155 -#define __NR_sched_setscheduler 156 -#define __NR_sched_getscheduler 157 -#define __NR_sched_yield 158 -#define __NR_sched_get_priority_max 159 -#define __NR_sched_get_priority_min 160 -#define __NR_sched_rr_get_interval 161 -#define __NR_nanosleep 162 -#define __NR_mremap 163 -#define __NR_setresuid 164 -#define __NR_getresuid 165 -#define __NR_query_module 166 -#define __NR_poll 167 -#define __NR_nfsservctl 168 -#define __NR_setresgid 169 -#define __NR_getresgid 170 -#define __NR_prctl 171 -#define __NR_rt_sigreturn 172 -#define __NR_rt_sigaction 173 -#define __NR_rt_sigprocmask 174 -#define __NR_rt_sigpending 175 -#define __NR_rt_sigtimedwait 176 -#define __NR_rt_sigqueueinfo 177 -#define __NR_rt_sigsuspend 178 -#define __NR_pread64 179 -#define __NR_pwrite64 180 -#define __NR_chown 181 -#define __NR_getcwd 182 -#define __NR_capget 183 -#define __NR_capset 184 -#define __NR_sigaltstack 185 -#define __NR_sendfile 186 -#define __NR_getpmsg 187 /* some people actually want streams */ -#define __NR_putpmsg 188 /* some people actually want streams */ -#define __NR_vfork 189 -#define __NR_ugetrlimit 190 /* SuS compliant getrlimit */ -#define __NR_readahead 191 -#ifndef __powerpc64__ /* these are 32-bit only */ -#define __NR_mmap2 192 -#define __NR_truncate64 193 -#define __NR_ftruncate64 194 -#define __NR_stat64 195 -#define __NR_lstat64 196 -#define __NR_fstat64 197 -#endif -#define __NR_pciconfig_read 198 -#define __NR_pciconfig_write 199 -#define __NR_pciconfig_iobase 200 -#define __NR_multiplexer 201 -#define __NR_getdents64 202 -#define __NR_pivot_root 203 -#ifndef __powerpc64__ -#define __NR_fcntl64 204 -#endif -#define __NR_madvise 205 -#define __NR_mincore 206 -#define __NR_gettid 207 -#define __NR_tkill 208 -#define __NR_setxattr 209 -#define __NR_lsetxattr 210 -#define __NR_fsetxattr 211 -#define __NR_getxattr 212 -#define __NR_lgetxattr 213 -#define __NR_fgetxattr 214 -#define __NR_listxattr 215 -#define __NR_llistxattr 216 -#define __NR_flistxattr 217 -#define __NR_removexattr 218 -#define __NR_lremovexattr 219 -#define __NR_fremovexattr 220 -#define __NR_futex 221 -#define __NR_sched_setaffinity 222 -#define __NR_sched_getaffinity 223 -/* 224 currently unused */ -#define __NR_tuxcall 225 -#ifndef __powerpc64__ -#define __NR_sendfile64 226 -#endif -#define __NR_io_setup 227 -#define __NR_io_destroy 228 -#define __NR_io_getevents 229 -#define __NR_io_submit 230 -#define __NR_io_cancel 231 -#define __NR_set_tid_address 232 -#define __NR_fadvise64 233 -#define __NR_exit_group 234 -#define __NR_lookup_dcookie 235 -#define __NR_epoll_create 236 -#define __NR_epoll_ctl 237 -#define __NR_epoll_wait 238 -#define __NR_remap_file_pages 239 -#define __NR_timer_create 240 -#define __NR_timer_settime 241 -#define __NR_timer_gettime 242 -#define __NR_timer_getoverrun 243 -#define __NR_timer_delete 244 -#define __NR_clock_settime 245 -#define __NR_clock_gettime 246 -#define __NR_clock_getres 247 -#define __NR_clock_nanosleep 248 -#define __NR_swapcontext 249 -#define __NR_tgkill 250 -#define __NR_utimes 251 -#define __NR_statfs64 252 -#define __NR_fstatfs64 253 -#ifndef __powerpc64__ -#define __NR_fadvise64_64 254 -#endif -#define __NR_rtas 255 -#define __NR_sys_debug_setcontext 256 -/* Number 257 is reserved for vserver */ -#define __NR_migrate_pages 258 -#define __NR_mbind 259 -#define __NR_get_mempolicy 260 -#define __NR_set_mempolicy 261 -#define __NR_mq_open 262 -#define __NR_mq_unlink 263 -#define __NR_mq_timedsend 264 -#define __NR_mq_timedreceive 265 -#define __NR_mq_notify 266 -#define __NR_mq_getsetattr 267 -#define __NR_kexec_load 268 -#define __NR_add_key 269 -#define __NR_request_key 270 -#define __NR_keyctl 271 -#define __NR_waitid 272 -#define __NR_ioprio_set 273 -#define __NR_ioprio_get 274 -#define __NR_inotify_init 275 -#define __NR_inotify_add_watch 276 -#define __NR_inotify_rm_watch 277 -#define __NR_spu_run 278 -#define __NR_spu_create 279 -#define __NR_pselect6 280 -#define __NR_ppoll 281 -#define __NR_unshare 282 -#define __NR_splice 283 -#define __NR_tee 284 -#define __NR_vmsplice 285 -#define __NR_openat 286 -#define __NR_mkdirat 287 -#define __NR_mknodat 288 -#define __NR_fchownat 289 -#define __NR_futimesat 290 -#ifdef __powerpc64__ -#define __NR_newfstatat 291 -#else -#define __NR_fstatat64 291 -#endif -#define __NR_unlinkat 292 -#define __NR_renameat 293 -#define __NR_linkat 294 -#define __NR_symlinkat 295 -#define __NR_readlinkat 296 -#define __NR_fchmodat 297 -#define __NR_faccessat 298 -#define __NR_get_robust_list 299 -#define __NR_set_robust_list 300 -#define __NR_move_pages 301 -#define __NR_getcpu 302 -#define __NR_epoll_pwait 303 -#define __NR_utimensat 304 -#define __NR_signalfd 305 -#define __NR_timerfd_create 306 -#define __NR_eventfd 307 -#define __NR_sync_file_range2 308 -#define __NR_fallocate 309 -#define __NR_subpage_prot 310 -#define __NR_timerfd_settime 311 -#define __NR_timerfd_gettime 312 -#define __NR_signalfd4 313 -#define __NR_eventfd2 314 -#define __NR_epoll_create1 315 -#define __NR_dup3 316 -#define __NR_pipe2 317 -#define __NR_inotify_init1 318 -#define __NR_perf_event_open 319 -#define __NR_preadv 320 -#define __NR_pwritev 321 -#define __NR_rt_tgsigqueueinfo 322 -#define __NR_fanotify_init 323 -#define __NR_fanotify_mark 324 -#define __NR_prlimit64 325 -#define __NR_socket 326 -#define __NR_bind 327 -#define __NR_connect 328 -#define __NR_listen 329 -#define __NR_accept 330 -#define __NR_getsockname 331 -#define __NR_getpeername 332 -#define __NR_socketpair 333 -#define __NR_send 334 -#define __NR_sendto 335 -#define __NR_recv 336 -#define __NR_recvfrom 337 -#define __NR_shutdown 338 -#define __NR_setsockopt 339 -#define __NR_getsockopt 340 -#define __NR_sendmsg 341 -#define __NR_recvmsg 342 -#define __NR_recvmmsg 343 -#define __NR_accept4 344 -#define __NR_name_to_handle_at 345 -#define __NR_open_by_handle_at 346 -#define __NR_clock_adjtime 347 -#define __NR_syncfs 348 -#define __NR_sendmmsg 349 -#define __NR_setns 350 -#define __NR_process_vm_readv 351 -#define __NR_process_vm_writev 352 - - -#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ diff --git a/trunk/arch/powerpc/platforms/pseries/eeh_event.c b/trunk/arch/powerpc/platforms/pseries/eeh_event.c index 185bedd926df..51faaac8abe6 100644 --- a/trunk/arch/powerpc/platforms/pseries/eeh_event.c +++ b/trunk/arch/powerpc/platforms/pseries/eeh_event.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -60,6 +59,8 @@ static int eeh_event_handler(void * dummy) struct eeh_event *event; struct eeh_pe *pe; + set_task_comm(current, "eehd"); + spin_lock_irqsave(&eeh_eventlist_lock, flags); event = NULL; @@ -107,7 +108,7 @@ static int eeh_event_handler(void * dummy) */ static void eeh_thread_launcher(struct work_struct *dummy) { - if (IS_ERR(kthread_run(eeh_event_handler, NULL, "eehd"))) + if (kernel_thread(eeh_event_handler, NULL, CLONE_KERNEL) < 0) printk(KERN_ERR "Failed to start EEH daemon\n"); } diff --git a/trunk/arch/score/kernel/sys_score.c b/trunk/arch/score/kernel/sys_score.c index d45cf00a3351..21e867974066 100644 --- a/trunk/arch/score/kernel/sys_score.c +++ b/trunk/arch/score/kernel/sys_score.c @@ -92,14 +92,14 @@ asmlinkage long score_execve(struct pt_regs *regs) { int error; - struct filename *filename; + char *filename; filename = getname((char __user*)regs->regs[4]); error = PTR_ERR(filename); if (IS_ERR(filename)) return error; - error = do_execve(filename->name, + error = do_execve(filename, (const char __user *const __user *)regs->regs[5], (const char __user *const __user *)regs->regs[6], regs); diff --git a/trunk/arch/sh/kernel/process_32.c b/trunk/arch/sh/kernel/process_32.c index ba7345f37bc9..59521e8a164d 100644 --- a/trunk/arch/sh/kernel/process_32.c +++ b/trunk/arch/sh/kernel/process_32.c @@ -298,14 +298,14 @@ asmlinkage int sys_execve(const char __user *ufilename, { struct pt_regs *regs = RELOC_HIDE(&__regs, 0); int error; - struct filename *filename; + char *filename; filename = getname(ufilename); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, uargv, uenvp, regs); + error = do_execve(filename, uargv, uenvp, regs); putname(filename); out: return error; diff --git a/trunk/arch/sh/kernel/process_64.c b/trunk/arch/sh/kernel/process_64.c index 98a709f0c3c4..602545b12a86 100644 --- a/trunk/arch/sh/kernel/process_64.c +++ b/trunk/arch/sh/kernel/process_64.c @@ -491,14 +491,14 @@ asmlinkage int sys_execve(const char *ufilename, char **uargv, struct pt_regs *pregs) { int error; - struct filename *filename; + char *filename; filename = getname((char __user *)ufilename); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, + error = do_execve(filename, (const char __user *const __user *)uargv, (const char __user *const __user *)uenvp, pregs); diff --git a/trunk/arch/sparc/include/asm/uaccess_64.h b/trunk/arch/sparc/include/asm/uaccess_64.h index 73083e1d38d9..7c831d848b4e 100644 --- a/trunk/arch/sparc/include/asm/uaccess_64.h +++ b/trunk/arch/sparc/include/asm/uaccess_64.h @@ -265,11 +265,6 @@ extern __must_check long strnlen_user(const char __user *str, long n); #define __copy_to_user_inatomic ___copy_to_user #define __copy_from_user_inatomic ___copy_from_user -struct pt_regs; -extern unsigned long compute_effective_address(struct pt_regs *, - unsigned int insn, - unsigned int rd); - #endif /* __ASSEMBLY__ */ #endif /* _ASM_UACCESS_H */ diff --git a/trunk/arch/sparc/kernel/process_32.c b/trunk/arch/sparc/kernel/process_32.c index 487bffb36f5e..14006d8aca28 100644 --- a/trunk/arch/sparc/kernel/process_32.c +++ b/trunk/arch/sparc/kernel/process_32.c @@ -482,7 +482,7 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs) asmlinkage int sparc_execve(struct pt_regs *regs) { int error, base = 0; - struct filename *filename; + char *filename; /* Check for indirect call. */ if(regs->u_regs[UREG_G1] == 0) @@ -492,7 +492,7 @@ asmlinkage int sparc_execve(struct pt_regs *regs) error = PTR_ERR(filename); if(IS_ERR(filename)) goto out; - error = do_execve(filename->name, + error = do_execve(filename, (const char __user *const __user *) regs->u_regs[base + UREG_I1], (const char __user *const __user *) diff --git a/trunk/arch/sparc/kernel/process_64.c b/trunk/arch/sparc/kernel/process_64.c index fcaa59421126..aff0c72fac09 100644 --- a/trunk/arch/sparc/kernel/process_64.c +++ b/trunk/arch/sparc/kernel/process_64.c @@ -722,7 +722,7 @@ EXPORT_SYMBOL(dump_fpu); asmlinkage int sparc_execve(struct pt_regs *regs) { int error, base = 0; - struct filename *filename; + char *filename; /* User register window flush is done by entry.S */ @@ -734,7 +734,7 @@ asmlinkage int sparc_execve(struct pt_regs *regs) error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, + error = do_execve(filename, (const char __user *const __user *) regs->u_regs[base + UREG_I1], (const char __user *const __user *) diff --git a/trunk/arch/sparc/kernel/sys_sparc32.c b/trunk/arch/sparc/kernel/sys_sparc32.c index c3239811a1b5..d862499eb01c 100644 --- a/trunk/arch/sparc/kernel/sys_sparc32.c +++ b/trunk/arch/sparc/kernel/sys_sparc32.c @@ -403,7 +403,7 @@ asmlinkage long compat_sys_rt_sigaction(int sig, asmlinkage long sparc32_execve(struct pt_regs *regs) { int error, base = 0; - struct filename *filename; + char *filename; /* User register window flush is done by entry.S */ @@ -416,7 +416,7 @@ asmlinkage long sparc32_execve(struct pt_regs *regs) if (IS_ERR(filename)) goto out; - error = compat_do_execve(filename->name, + error = compat_do_execve(filename, compat_ptr(regs->u_regs[base + UREG_I1]), compat_ptr(regs->u_regs[base + UREG_I2]), regs); diff --git a/trunk/arch/sparc/kernel/syscalls.S b/trunk/arch/sparc/kernel/syscalls.S index 7f5f65d0b3fd..1d7e274f3f2b 100644 --- a/trunk/arch/sparc/kernel/syscalls.S +++ b/trunk/arch/sparc/kernel/syscalls.S @@ -212,20 +212,24 @@ linux_sparc_syscall: 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] ret_sys_call: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 + ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc sra %o0, 0, %o0 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 sllx %g2, 32, %g2 + /* Check if force_successful_syscall_return() + * was invoked. + */ + ldub [%g6 + TI_SYS_NOERROR], %l2 + brnz,a,pn %l2, 80f + stb %g0, [%g6 + TI_SYS_NOERROR] + cmp %o0, -ERESTART_RESTARTBLOCK bgeu,pn %xcc, 1f - andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 - ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc - -2: - stb %g0, [%g6 + TI_SYS_NOERROR] + andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6 +80: /* System call success, clear Carry condition code. */ andn %g3, %g2, %g3 -3: stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] bne,pn %icc, linux_syscall_trace2 add %l1, 0x4, %l2 ! npc = npc+4 @@ -234,20 +238,20 @@ ret_sys_call: stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] 1: - /* Check if force_successful_syscall_return() - * was invoked. - */ - ldub [%g6 + TI_SYS_NOERROR], %l2 - brnz,pn %l2, 2b - ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc /* System call failure, set Carry condition code. * Also, get abs(errno) to return to the process. */ + andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6 sub %g0, %o0, %o0 + or %g3, %g2, %g3 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] - ba,pt %xcc, 3b - or %g3, %g2, %g3 + stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] + bne,pn %icc, linux_syscall_trace2 + add %l1, 0x4, %l2 ! npc = npc+4 + stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC] + b,pt %xcc, rtrap + stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] linux_syscall_trace2: call syscall_trace_leave add %sp, PTREGS_OFF, %o0 diff --git a/trunk/arch/sparc/kernel/traps_64.c b/trunk/arch/sparc/kernel/traps_64.c index b66a77968f35..fa1f1d375ffc 100644 --- a/trunk/arch/sparc/kernel/traps_64.c +++ b/trunk/arch/sparc/kernel/traps_64.c @@ -1,6 +1,6 @@ /* arch/sparc64/kernel/traps.c * - * Copyright (C) 1995,1997,2008,2009,2012 David S. Miller (davem@davemloft.net) + * Copyright (C) 1995,1997,2008,2009 David S. Miller (davem@davemloft.net) * Copyright (C) 1997,1999,2000 Jakub Jelinek (jakub@redhat.com) */ @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -1761,223 +1760,85 @@ void cheetah_plus_parity_error(int type, struct pt_regs *regs) } struct sun4v_error_entry { - /* Unique error handle */ -/*0x00*/u64 err_handle; + u64 err_handle; + u64 err_stick; - /* %stick value at the time of the error */ -/*0x08*/u64 err_stick; - -/*0x10*/u8 reserved_1[3]; - - /* Error type */ -/*0x13*/u8 err_type; + u32 err_type; #define SUN4V_ERR_TYPE_UNDEFINED 0 #define SUN4V_ERR_TYPE_UNCORRECTED_RES 1 #define SUN4V_ERR_TYPE_PRECISE_NONRES 2 #define SUN4V_ERR_TYPE_DEFERRED_NONRES 3 -#define SUN4V_ERR_TYPE_SHUTDOWN_RQST 4 -#define SUN4V_ERR_TYPE_DUMP_CORE 5 -#define SUN4V_ERR_TYPE_SP_STATE_CHANGE 6 -#define SUN4V_ERR_TYPE_NUM 7 +#define SUN4V_ERR_TYPE_WARNING_RES 4 - /* Error attributes */ -/*0x14*/u32 err_attrs; + u32 err_attrs; #define SUN4V_ERR_ATTRS_PROCESSOR 0x00000001 #define SUN4V_ERR_ATTRS_MEMORY 0x00000002 #define SUN4V_ERR_ATTRS_PIO 0x00000004 #define SUN4V_ERR_ATTRS_INT_REGISTERS 0x00000008 #define SUN4V_ERR_ATTRS_FPU_REGISTERS 0x00000010 -#define SUN4V_ERR_ATTRS_SHUTDOWN_RQST 0x00000020 -#define SUN4V_ERR_ATTRS_ASR 0x00000040 -#define SUN4V_ERR_ATTRS_ASI 0x00000080 -#define SUN4V_ERR_ATTRS_PRIV_REG 0x00000100 -#define SUN4V_ERR_ATTRS_SPSTATE_MSK 0x00000600 -#define SUN4V_ERR_ATTRS_SPSTATE_SHFT 9 -#define SUN4V_ERR_ATTRS_MODE_MSK 0x03000000 -#define SUN4V_ERR_ATTRS_MODE_SHFT 24 +#define SUN4V_ERR_ATTRS_USER_MODE 0x01000000 +#define SUN4V_ERR_ATTRS_PRIV_MODE 0x02000000 #define SUN4V_ERR_ATTRS_RES_QUEUE_FULL 0x80000000 -#define SUN4V_ERR_SPSTATE_FAULTED 0 -#define SUN4V_ERR_SPSTATE_AVAILABLE 1 -#define SUN4V_ERR_SPSTATE_NOT_PRESENT 2 - -#define SUN4V_ERR_MODE_USER 1 -#define SUN4V_ERR_MODE_PRIV 2 - - /* Real address of the memory region or PIO transaction */ -/*0x18*/u64 err_raddr; - - /* Size of the operation triggering the error, in bytes */ -/*0x20*/u32 err_size; - - /* ID of the CPU */ -/*0x24*/u16 err_cpu; - - /* Grace periof for shutdown, in seconds */ -/*0x26*/u16 err_secs; - - /* Value of the %asi register */ -/*0x28*/u8 err_asi; - -/*0x29*/u8 reserved_2; - - /* Value of the ASR register number */ -/*0x2a*/u16 err_asr; -#define SUN4V_ERR_ASR_VALID 0x8000 - -/*0x2c*/u32 reserved_3; -/*0x30*/u64 reserved_4; -/*0x38*/u64 reserved_5; + u64 err_raddr; + u32 err_size; + u16 err_cpu; + u16 err_pad; }; static atomic_t sun4v_resum_oflow_cnt = ATOMIC_INIT(0); static atomic_t sun4v_nonresum_oflow_cnt = ATOMIC_INIT(0); -static const char *sun4v_err_type_to_str(u8 type) -{ - static const char *types[SUN4V_ERR_TYPE_NUM] = { - "undefined", - "uncorrected resumable", - "precise nonresumable", - "deferred nonresumable", - "shutdown request", - "dump core", - "SP state change", - }; - - if (type < SUN4V_ERR_TYPE_NUM) - return types[type]; - - return "unknown"; -} - -static void sun4v_emit_err_attr_strings(u32 attrs) -{ - static const char *attr_names[] = { - "processor", - "memory", - "PIO", - "int-registers", - "fpu-registers", - "shutdown-request", - "ASR", - "ASI", - "priv-reg", - }; - static const char *sp_states[] = { - "sp-faulted", - "sp-available", - "sp-not-present", - "sp-state-reserved", - }; - static const char *modes[] = { - "mode-reserved0", - "user", - "priv", - "mode-reserved1", - }; - u32 sp_state, mode; - int i; - - for (i = 0; i < ARRAY_SIZE(attr_names); i++) { - if (attrs & (1U << i)) { - const char *s = attr_names[i]; - - pr_cont("%s ", s); - } +static const char *sun4v_err_type_to_str(u32 type) +{ + switch (type) { + case SUN4V_ERR_TYPE_UNDEFINED: + return "undefined"; + case SUN4V_ERR_TYPE_UNCORRECTED_RES: + return "uncorrected resumable"; + case SUN4V_ERR_TYPE_PRECISE_NONRES: + return "precise nonresumable"; + case SUN4V_ERR_TYPE_DEFERRED_NONRES: + return "deferred nonresumable"; + case SUN4V_ERR_TYPE_WARNING_RES: + return "warning resumable"; + default: + return "unknown"; } - - sp_state = ((attrs & SUN4V_ERR_ATTRS_SPSTATE_MSK) >> - SUN4V_ERR_ATTRS_SPSTATE_SHFT); - pr_cont("%s ", sp_states[sp_state]); - - mode = ((attrs & SUN4V_ERR_ATTRS_MODE_MSK) >> - SUN4V_ERR_ATTRS_MODE_SHFT); - pr_cont("%s ", modes[mode]); - - if (attrs & SUN4V_ERR_ATTRS_RES_QUEUE_FULL) - pr_cont("res-queue-full "); } -/* When the report contains a real-address of "-1" it means that the - * hardware did not provide the address. So we compute the effective - * address of the load or store instruction at regs->tpc and report - * that. Usually when this happens it's a PIO and in such a case we - * are using physical addresses with bypass ASIs anyways, so what we - * report here is exactly what we want. - */ -static void sun4v_report_real_raddr(const char *pfx, struct pt_regs *regs) +static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt) { - unsigned int insn; - u64 addr; - - if (!(regs->tstate & TSTATE_PRIV)) - return; - - insn = *(unsigned int *) regs->tpc; - - addr = compute_effective_address(regs, insn, 0); - - printk("%s: insn effective address [0x%016llx]\n", - pfx, addr); -} - -static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, - int cpu, const char *pfx, atomic_t *ocnt) -{ - u64 *raw_ptr = (u64 *) ent; - u32 attrs; int cnt; printk("%s: Reporting on cpu %d\n", pfx, cpu); - printk("%s: TPC [0x%016lx] <%pS>\n", - pfx, regs->tpc, (void *) regs->tpc); - - printk("%s: RAW [%016llx:%016llx:%016llx:%016llx\n", - pfx, raw_ptr[0], raw_ptr[1], raw_ptr[2], raw_ptr[3]); - printk("%s: %016llx:%016llx:%016llx:%016llx]\n", - pfx, raw_ptr[4], raw_ptr[5], raw_ptr[6], raw_ptr[7]); - - printk("%s: handle [0x%016llx] stick [0x%016llx]\n", - pfx, ent->err_handle, ent->err_stick); - - printk("%s: type [%s]\n", pfx, sun4v_err_type_to_str(ent->err_type)); - - attrs = ent->err_attrs; - printk("%s: attrs [0x%08x] < ", pfx, attrs); - sun4v_emit_err_attr_strings(attrs); - pr_cont(">\n"); - - /* Various fields in the error report are only valid if - * certain attribute bits are set. - */ - if (attrs & (SUN4V_ERR_ATTRS_MEMORY | - SUN4V_ERR_ATTRS_PIO | - SUN4V_ERR_ATTRS_ASI)) { - printk("%s: raddr [0x%016llx]\n", pfx, ent->err_raddr); - - if (ent->err_raddr == ~(u64)0) - sun4v_report_real_raddr(pfx, regs); - } - - if (attrs & (SUN4V_ERR_ATTRS_MEMORY | SUN4V_ERR_ATTRS_ASI)) - printk("%s: size [0x%x]\n", pfx, ent->err_size); - - if (attrs & (SUN4V_ERR_ATTRS_PROCESSOR | - SUN4V_ERR_ATTRS_INT_REGISTERS | - SUN4V_ERR_ATTRS_FPU_REGISTERS | - SUN4V_ERR_ATTRS_PRIV_REG)) - printk("%s: cpu[%u]\n", pfx, ent->err_cpu); - - if (attrs & SUN4V_ERR_ATTRS_ASI) - printk("%s: asi [0x%02x]\n", pfx, ent->err_asi); - - if ((attrs & (SUN4V_ERR_ATTRS_INT_REGISTERS | - SUN4V_ERR_ATTRS_FPU_REGISTERS | - SUN4V_ERR_ATTRS_PRIV_REG)) && - (ent->err_asr & SUN4V_ERR_ASR_VALID) != 0) - printk("%s: reg [0x%04x]\n", - pfx, ent->err_asr & ~SUN4V_ERR_ASR_VALID); + printk("%s: err_handle[%llx] err_stick[%llx] err_type[%08x:%s]\n", + pfx, + ent->err_handle, ent->err_stick, + ent->err_type, + sun4v_err_type_to_str(ent->err_type)); + printk("%s: err_attrs[%08x:%s %s %s %s %s %s %s %s]\n", + pfx, + ent->err_attrs, + ((ent->err_attrs & SUN4V_ERR_ATTRS_PROCESSOR) ? + "processor" : ""), + ((ent->err_attrs & SUN4V_ERR_ATTRS_MEMORY) ? + "memory" : ""), + ((ent->err_attrs & SUN4V_ERR_ATTRS_PIO) ? + "pio" : ""), + ((ent->err_attrs & SUN4V_ERR_ATTRS_INT_REGISTERS) ? + "integer-regs" : ""), + ((ent->err_attrs & SUN4V_ERR_ATTRS_FPU_REGISTERS) ? + "fpu-regs" : ""), + ((ent->err_attrs & SUN4V_ERR_ATTRS_USER_MODE) ? + "user" : ""), + ((ent->err_attrs & SUN4V_ERR_ATTRS_PRIV_MODE) ? + "privileged" : ""), + ((ent->err_attrs & SUN4V_ERR_ATTRS_RES_QUEUE_FULL) ? + "queue-full" : "")); + printk("%s: err_raddr[%016llx] err_size[%u] err_cpu[%u]\n", + pfx, + ent->err_raddr, ent->err_size, ent->err_cpu); show_regs(regs); @@ -2013,15 +1874,13 @@ void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) put_cpu(); - if (local_copy.err_type == SUN4V_ERR_TYPE_SHUTDOWN_RQST) { - /* We should really take the seconds field of - * the error report and use it for the shutdown - * invocation, but for now do the same thing we - * do for a DS shutdown request. + if (ent->err_type == SUN4V_ERR_TYPE_WARNING_RES) { + /* If err_type is 0x4, it's a powerdown request. Do + * not do the usual resumable error log because that + * makes it look like some abnormal error. */ - pr_info("Shutdown request, %u seconds...\n", - local_copy.err_secs); - orderly_poweroff(true); + printk(KERN_INFO "Power down request...\n"); + kill_cad_pid(SIGINT, 1); return; } diff --git a/trunk/arch/sparc/mm/fault_64.c b/trunk/arch/sparc/mm/fault_64.c index 097aee763af3..2976dba1ebaf 100644 --- a/trunk/arch/sparc/mm/fault_64.c +++ b/trunk/arch/sparc/mm/fault_64.c @@ -151,6 +151,8 @@ show_signal_msg(struct pt_regs *regs, int sig, int code, printk(KERN_CONT "\n"); } +extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int); + static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, unsigned int insn, int fault_code) { diff --git a/trunk/arch/tile/include/arch/Kbuild b/trunk/arch/tile/include/arch/Kbuild index e69de29bb2d1..9c0ea24cc948 100644 --- a/trunk/arch/tile/include/arch/Kbuild +++ b/trunk/arch/tile/include/arch/Kbuild @@ -0,0 +1,17 @@ +header-y += abi.h +header-y += chip.h +header-y += chip_tile64.h +header-y += chip_tilegx.h +header-y += chip_tilepro.h +header-y += icache.h +header-y += interrupts.h +header-y += interrupts_32.h +header-y += interrupts_64.h +header-y += opcode.h +header-y += opcode_tilegx.h +header-y += opcode_tilepro.h +header-y += sim.h +header-y += sim_def.h +header-y += spr_def.h +header-y += spr_def_32.h +header-y += spr_def_64.h diff --git a/trunk/arch/tile/include/uapi/arch/abi.h b/trunk/arch/tile/include/arch/abi.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/abi.h rename to trunk/arch/tile/include/arch/abi.h diff --git a/trunk/arch/tile/include/uapi/arch/chip.h b/trunk/arch/tile/include/arch/chip.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/chip.h rename to trunk/arch/tile/include/arch/chip.h diff --git a/trunk/arch/tile/include/uapi/arch/chip_tile64.h b/trunk/arch/tile/include/arch/chip_tile64.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/chip_tile64.h rename to trunk/arch/tile/include/arch/chip_tile64.h diff --git a/trunk/arch/tile/include/uapi/arch/chip_tilegx.h b/trunk/arch/tile/include/arch/chip_tilegx.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/chip_tilegx.h rename to trunk/arch/tile/include/arch/chip_tilegx.h diff --git a/trunk/arch/tile/include/uapi/arch/chip_tilepro.h b/trunk/arch/tile/include/arch/chip_tilepro.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/chip_tilepro.h rename to trunk/arch/tile/include/arch/chip_tilepro.h diff --git a/trunk/arch/tile/include/uapi/arch/icache.h b/trunk/arch/tile/include/arch/icache.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/icache.h rename to trunk/arch/tile/include/arch/icache.h diff --git a/trunk/arch/tile/include/uapi/arch/interrupts.h b/trunk/arch/tile/include/arch/interrupts.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/interrupts.h rename to trunk/arch/tile/include/arch/interrupts.h diff --git a/trunk/arch/tile/include/uapi/arch/interrupts_32.h b/trunk/arch/tile/include/arch/interrupts_32.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/interrupts_32.h rename to trunk/arch/tile/include/arch/interrupts_32.h diff --git a/trunk/arch/tile/include/uapi/arch/interrupts_64.h b/trunk/arch/tile/include/arch/interrupts_64.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/interrupts_64.h rename to trunk/arch/tile/include/arch/interrupts_64.h diff --git a/trunk/arch/tile/include/uapi/arch/opcode.h b/trunk/arch/tile/include/arch/opcode.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/opcode.h rename to trunk/arch/tile/include/arch/opcode.h diff --git a/trunk/arch/tile/include/uapi/arch/opcode_tilegx.h b/trunk/arch/tile/include/arch/opcode_tilegx.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/opcode_tilegx.h rename to trunk/arch/tile/include/arch/opcode_tilegx.h diff --git a/trunk/arch/tile/include/uapi/arch/opcode_tilepro.h b/trunk/arch/tile/include/arch/opcode_tilepro.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/opcode_tilepro.h rename to trunk/arch/tile/include/arch/opcode_tilepro.h diff --git a/trunk/arch/tile/include/uapi/arch/sim.h b/trunk/arch/tile/include/arch/sim.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/sim.h rename to trunk/arch/tile/include/arch/sim.h diff --git a/trunk/arch/tile/include/uapi/arch/sim_def.h b/trunk/arch/tile/include/arch/sim_def.h similarity index 100% rename from trunk/arch/tile/include/uapi/arch/sim_def.h rename to trunk/arch/tile/include/arch/sim_def.h diff --git a/trunk/arch/tile/include/arch/spr_def.h b/trunk/arch/tile/include/arch/spr_def.h index 2de83e7aff3e..d6ba449b5363 100644 --- a/trunk/arch/tile/include/arch/spr_def.h +++ b/trunk/arch/tile/include/arch/spr_def.h @@ -11,11 +11,15 @@ * NON INFRINGEMENT. See the GNU General Public License for * more details. */ -#ifndef __ARCH_SPR_DEF_H__ -#define __ARCH_SPR_DEF_H__ -#include +/* Include the proper base SPR definition file. */ +#ifdef __tilegx__ +#include +#else +#include +#endif +#ifdef __KERNEL__ /* * In addition to including the proper base SPR definition file, depending @@ -106,4 +110,4 @@ #define INT_INTCTRL_K \ _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,) -#endif /* __ARCH_SPR_DEF_H__ */ +#endif /* __KERNEL__ */ diff --git a/trunk/arch/tile/include/uapi/arch/spr_def_32.h b/trunk/arch/tile/include/arch/spr_def_32.h similarity index 98% rename from trunk/arch/tile/include/uapi/arch/spr_def_32.h rename to trunk/arch/tile/include/arch/spr_def_32.h index c689446e6284..78bbce2fb19a 100644 --- a/trunk/arch/tile/include/uapi/arch/spr_def_32.h +++ b/trunk/arch/tile/include/arch/spr_def_32.h @@ -14,8 +14,8 @@ #ifndef __DOXYGEN__ -#ifndef __ARCH_SPR_DEF_32_H__ -#define __ARCH_SPR_DEF_32_H__ +#ifndef __ARCH_SPR_DEF_H__ +#define __ARCH_SPR_DEF_H__ #define SPR_AUX_PERF_COUNT_0 0x6005 #define SPR_AUX_PERF_COUNT_1 0x6006 @@ -252,6 +252,6 @@ #define SPR_WATCH_MASK 0x420a #define SPR_WATCH_VAL 0x420b -#endif /* !defined(__ARCH_SPR_DEF_32_H__) */ +#endif /* !defined(__ARCH_SPR_DEF_H__) */ #endif /* !defined(__DOXYGEN__) */ diff --git a/trunk/arch/tile/include/uapi/arch/spr_def_64.h b/trunk/arch/tile/include/arch/spr_def_64.h similarity index 98% rename from trunk/arch/tile/include/uapi/arch/spr_def_64.h rename to trunk/arch/tile/include/arch/spr_def_64.h index 67a6c1751e3b..0da86faa3370 100644 --- a/trunk/arch/tile/include/uapi/arch/spr_def_64.h +++ b/trunk/arch/tile/include/arch/spr_def_64.h @@ -14,8 +14,8 @@ #ifndef __DOXYGEN__ -#ifndef __ARCH_SPR_DEF_64_H__ -#define __ARCH_SPR_DEF_64_H__ +#ifndef __ARCH_SPR_DEF_H__ +#define __ARCH_SPR_DEF_H__ #define SPR_AUX_PERF_COUNT_0 0x2105 #define SPR_AUX_PERF_COUNT_1 0x2106 @@ -211,6 +211,6 @@ #define SPR_WATCH_MASK 0x200a #define SPR_WATCH_VAL 0x200b -#endif /* !defined(__ARCH_SPR_DEF_64_H__) */ +#endif /* !defined(__ARCH_SPR_DEF_H__) */ #endif /* !defined(__DOXYGEN__) */ diff --git a/trunk/arch/tile/include/asm/Kbuild b/trunk/arch/tile/include/asm/Kbuild index c68808a09da7..5cd98fac9899 100644 --- a/trunk/arch/tile/include/asm/Kbuild +++ b/trunk/arch/tile/include/asm/Kbuild @@ -1,7 +1,10 @@ +include include/asm-generic/Kbuild.asm header-y += ../arch/ +header-y += cachectl.h header-y += ucontext.h +header-y += hardwall.h generic-y += bug.h generic-y += bugs.h diff --git a/trunk/arch/tile/include/uapi/asm/auxvec.h b/trunk/arch/tile/include/asm/auxvec.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/auxvec.h rename to trunk/arch/tile/include/asm/auxvec.h diff --git a/trunk/arch/tile/include/uapi/asm/bitsperlong.h b/trunk/arch/tile/include/asm/bitsperlong.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/bitsperlong.h rename to trunk/arch/tile/include/asm/bitsperlong.h diff --git a/trunk/arch/tile/include/uapi/asm/byteorder.h b/trunk/arch/tile/include/asm/byteorder.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/byteorder.h rename to trunk/arch/tile/include/asm/byteorder.h diff --git a/trunk/arch/tile/include/uapi/asm/cachectl.h b/trunk/arch/tile/include/asm/cachectl.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/cachectl.h rename to trunk/arch/tile/include/asm/cachectl.h diff --git a/trunk/arch/tile/include/asm/hardwall.h b/trunk/arch/tile/include/asm/hardwall.h index 2f572b6b7bc2..47514a58d685 100644 --- a/trunk/arch/tile/include/asm/hardwall.h +++ b/trunk/arch/tile/include/asm/hardwall.h @@ -14,11 +14,40 @@ * Provide methods for access control of per-cpu resources like * UDN, IDN, or IPI. */ + #ifndef _ASM_TILE_HARDWALL_H #define _ASM_TILE_HARDWALL_H -#include +#include +#include + +#define HARDWALL_IOCTL_BASE 0xa2 + +/* + * The HARDWALL_CREATE() ioctl is a macro with a "size" argument. + * The resulting ioctl value is passed to the kernel in conjunction + * with a pointer to a standard kernel bitmask of cpus. + * For network resources (UDN or IDN) the bitmask must physically + * represent a rectangular configuration on the chip. + * The "size" is the number of bytes of cpu mask data. + */ +#define _HARDWALL_CREATE 1 +#define HARDWALL_CREATE(size) \ + _IOC(_IOC_READ, HARDWALL_IOCTL_BASE, _HARDWALL_CREATE, (size)) + +#define _HARDWALL_ACTIVATE 2 +#define HARDWALL_ACTIVATE \ + _IO(HARDWALL_IOCTL_BASE, _HARDWALL_ACTIVATE) + +#define _HARDWALL_DEACTIVATE 3 +#define HARDWALL_DEACTIVATE \ + _IO(HARDWALL_IOCTL_BASE, _HARDWALL_DEACTIVATE) + +#define _HARDWALL_GET_ID 4 +#define HARDWALL_GET_ID \ + _IO(HARDWALL_IOCTL_BASE, _HARDWALL_GET_ID) +#ifdef __KERNEL__ /* /proc hooks for hardwall. */ struct proc_dir_entry; #ifdef CONFIG_HARDWALL @@ -27,4 +56,6 @@ int proc_pid_hardwall(struct task_struct *task, char *buffer); #else static inline void proc_tile_hardwall_init(struct proc_dir_entry *root) {} #endif +#endif + #endif /* _ASM_TILE_HARDWALL_H */ diff --git a/trunk/arch/tile/include/uapi/asm/kvm_para.h b/trunk/arch/tile/include/asm/kvm_para.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/kvm_para.h rename to trunk/arch/tile/include/asm/kvm_para.h diff --git a/trunk/arch/tile/include/uapi/asm/mman.h b/trunk/arch/tile/include/asm/mman.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/mman.h rename to trunk/arch/tile/include/asm/mman.h diff --git a/trunk/arch/tile/include/asm/ptrace.h b/trunk/arch/tile/include/asm/ptrace.h index 1a4fd9ab0ee1..c6cddd7e8d51 100644 --- a/trunk/arch/tile/include/asm/ptrace.h +++ b/trunk/arch/tile/include/asm/ptrace.h @@ -11,21 +11,87 @@ * NON INFRINGEMENT. See the GNU General Public License for * more details. */ + #ifndef _ASM_TILE_PTRACE_H #define _ASM_TILE_PTRACE_H -#include +#include +#include + +/* These must match struct pt_regs, below. */ +#if CHIP_WORD_SIZE() == 32 +#define PTREGS_OFFSET_REG(n) ((n)*4) +#else +#define PTREGS_OFFSET_REG(n) ((n)*8) +#endif +#define PTREGS_OFFSET_BASE 0 +#define PTREGS_OFFSET_TP PTREGS_OFFSET_REG(53) +#define PTREGS_OFFSET_SP PTREGS_OFFSET_REG(54) +#define PTREGS_OFFSET_LR PTREGS_OFFSET_REG(55) +#define PTREGS_NR_GPRS 56 +#define PTREGS_OFFSET_PC PTREGS_OFFSET_REG(56) +#define PTREGS_OFFSET_EX1 PTREGS_OFFSET_REG(57) +#define PTREGS_OFFSET_FAULTNUM PTREGS_OFFSET_REG(58) +#define PTREGS_OFFSET_ORIG_R0 PTREGS_OFFSET_REG(59) +#define PTREGS_OFFSET_FLAGS PTREGS_OFFSET_REG(60) +#if CHIP_HAS_CMPEXCH() +#define PTREGS_OFFSET_CMPEXCH PTREGS_OFFSET_REG(61) +#endif +#define PTREGS_SIZE PTREGS_OFFSET_REG(64) #ifndef __ASSEMBLY__ + +#ifdef __KERNEL__ /* Benefit from consistent use of "long" on all chips. */ typedef unsigned long pt_reg_t; +#else +/* Provide appropriate length type to userspace regardless of -m32/-m64. */ +typedef uint_reg_t pt_reg_t; +#endif + +/* + * This struct defines the way the registers are stored on the stack during a + * system call or exception. "struct sigcontext" has the same shape. + */ +struct pt_regs { + /* Saved main processor registers; 56..63 are special. */ + /* tp, sp, and lr must immediately follow regs[] for aliasing. */ + pt_reg_t regs[53]; + pt_reg_t tp; /* aliases regs[TREG_TP] */ + pt_reg_t sp; /* aliases regs[TREG_SP] */ + pt_reg_t lr; /* aliases regs[TREG_LR] */ + + /* Saved special registers. */ + pt_reg_t pc; /* stored in EX_CONTEXT_K_0 */ + pt_reg_t ex1; /* stored in EX_CONTEXT_K_1 (PL and ICS bit) */ + pt_reg_t faultnum; /* fault number (INT_SWINT_1 for syscall) */ + pt_reg_t orig_r0; /* r0 at syscall entry, else zero */ + pt_reg_t flags; /* flags (see below) */ +#if !CHIP_HAS_CMPEXCH() + pt_reg_t pad[3]; +#else + pt_reg_t cmpexch; /* value of CMPEXCH_VALUE SPR at interrupt */ + pt_reg_t pad[2]; #endif +}; + +#endif /* __ASSEMBLY__ */ -#include +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +/* Support TILE-specific ptrace options, with events starting at 16. */ +#define PTRACE_O_TRACEMIGRATE 0x00010000 +#define PTRACE_EVENT_MIGRATE 16 +#ifdef __KERNEL__ #define PTRACE_O_MASK_TILE (PTRACE_O_TRACEMIGRATE) #define PT_TRACE_MIGRATE 0x00080000 #define PT_TRACE_MASK_TILE (PT_TRACE_MIGRATE) +#endif + +#ifdef __KERNEL__ /* Flag bits in pt_regs.flags */ #define PT_FLAGS_DISABLE_IRQ 1 /* on return to kernel, disable irqs */ @@ -93,4 +159,6 @@ extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, #define SINGLESTEP_STATE_TARGET_LB 2 #define SINGLESTEP_STATE_TARGET_UB 7 +#endif /* !__KERNEL__ */ + #endif /* _ASM_TILE_PTRACE_H */ diff --git a/trunk/arch/tile/include/asm/setup.h b/trunk/arch/tile/include/asm/setup.h index d048888c5d9a..c67eb70ea78e 100644 --- a/trunk/arch/tile/include/asm/setup.h +++ b/trunk/arch/tile/include/asm/setup.h @@ -11,13 +11,16 @@ * NON INFRINGEMENT. See the GNU General Public License for * more details. */ + #ifndef _ASM_TILE_SETUP_H #define _ASM_TILE_SETUP_H +#define COMMAND_LINE_SIZE 2048 + +#ifdef __KERNEL__ #include #include -#include /* * Reserved space for vmalloc and iomap - defined in asm/page.h @@ -50,4 +53,6 @@ int hardwall_ipi_valid(int cpu); } while (0) #endif +#endif /* __KERNEL__ */ + #endif /* _ASM_TILE_SETUP_H */ diff --git a/trunk/arch/tile/include/uapi/asm/sigcontext.h b/trunk/arch/tile/include/asm/sigcontext.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/sigcontext.h rename to trunk/arch/tile/include/asm/sigcontext.h diff --git a/trunk/arch/tile/include/uapi/asm/siginfo.h b/trunk/arch/tile/include/asm/siginfo.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/siginfo.h rename to trunk/arch/tile/include/asm/siginfo.h diff --git a/trunk/arch/tile/include/asm/signal.h b/trunk/arch/tile/include/asm/signal.h index 10e183de96d3..1e5e49aad548 100644 --- a/trunk/arch/tile/include/asm/signal.h +++ b/trunk/arch/tile/include/asm/signal.h @@ -11,11 +11,19 @@ * NON INFRINGEMENT. See the GNU General Public License for * more details. */ + #ifndef _ASM_TILE_SIGNAL_H #define _ASM_TILE_SIGNAL_H -#include +/* Do not notify a ptracer when this signal is handled. */ +#define SA_NOPTRACE 0x02000000u + +/* Used in earlier Tilera releases, so keeping for binary compatibility. */ +#define SA_RESTORER 0x04000000u + +#include +#if defined(__KERNEL__) #if !defined(__ASSEMBLY__) struct pt_regs; int restore_sigcontext(struct pt_regs *, struct sigcontext __user *); @@ -26,4 +34,6 @@ void signal_fault(const char *type, struct pt_regs *, void trace_unhandled_signal(const char *type, struct pt_regs *regs, unsigned long address, int signo); #endif +#endif + #endif /* _ASM_TILE_SIGNAL_H */ diff --git a/trunk/arch/tile/include/uapi/asm/stat.h b/trunk/arch/tile/include/asm/stat.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/stat.h rename to trunk/arch/tile/include/asm/stat.h diff --git a/trunk/arch/tile/include/uapi/asm/swab.h b/trunk/arch/tile/include/asm/swab.h similarity index 100% rename from trunk/arch/tile/include/uapi/asm/swab.h rename to trunk/arch/tile/include/asm/swab.h diff --git a/trunk/arch/tile/include/asm/unistd.h b/trunk/arch/tile/include/asm/unistd.h index 6e032a0a268e..0e1f3e66e492 100644 --- a/trunk/arch/tile/include/asm/unistd.h +++ b/trunk/arch/tile/include/asm/unistd.h @@ -11,9 +11,32 @@ * NON INFRINGEMENT. See the GNU General Public License for * more details. */ + +#if !defined(__LP64__) || defined(__SYSCALL_COMPAT) +/* Use the flavor of this syscall that matches the 32-bit API better. */ +#define __ARCH_WANT_SYNC_FILE_RANGE2 +#endif + +/* Use the standard ABI for syscalls. */ +#include + +/* Additional Tilera-specific syscalls. */ +#define __NR_cacheflush (__NR_arch_specific_syscall + 1) +__SYSCALL(__NR_cacheflush, sys_cacheflush) + +#ifndef __tilegx__ +/* "Fast" syscalls provide atomic support for 32-bit chips. */ +#define __NR_FAST_cmpxchg -1 +#define __NR_FAST_atomic_update -2 +#define __NR_FAST_cmpxchg64 -3 +#define __NR_cmpxchg_badaddr (__NR_arch_specific_syscall + 0) +__SYSCALL(__NR_cmpxchg_badaddr, sys_cmpxchg_badaddr) +#endif + +#ifdef __KERNEL__ /* In compat mode, we use sys_llseek() for compat_sys_llseek(). */ #ifdef CONFIG_COMPAT #define __ARCH_WANT_SYS_LLSEEK #endif #define __ARCH_WANT_SYS_NEWFSTATAT -#include +#endif diff --git a/trunk/arch/tile/include/uapi/arch/Kbuild b/trunk/arch/tile/include/uapi/arch/Kbuild index 4ebc34f4768d..aafaa5aa54d4 100644 --- a/trunk/arch/tile/include/uapi/arch/Kbuild +++ b/trunk/arch/tile/include/uapi/arch/Kbuild @@ -1,18 +1 @@ # UAPI Header export list -header-y += abi.h -header-y += chip.h -header-y += chip_tile64.h -header-y += chip_tilegx.h -header-y += chip_tilepro.h -header-y += icache.h -header-y += interrupts.h -header-y += interrupts_32.h -header-y += interrupts_64.h -header-y += opcode.h -header-y += opcode_tilegx.h -header-y += opcode_tilepro.h -header-y += sim.h -header-y += sim_def.h -header-y += spr_def.h -header-y += spr_def_32.h -header-y += spr_def_64.h diff --git a/trunk/arch/tile/include/uapi/arch/spr_def.h b/trunk/arch/tile/include/uapi/arch/spr_def.h deleted file mode 100644 index c250c5adb1a6..000000000000 --- a/trunk/arch/tile/include/uapi/arch/spr_def.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010 Tilera Corporation. All Rights Reserved. - * - * 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, version 2. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for - * more details. - */ - -#ifndef _UAPI__ARCH_SPR_DEF_H__ -#define _UAPI__ARCH_SPR_DEF_H__ - -/* Include the proper base SPR definition file. */ -#ifdef __tilegx__ -#include -#else -#include -#endif - - -#endif /* _UAPI__ARCH_SPR_DEF_H__ */ diff --git a/trunk/arch/tile/include/uapi/asm/Kbuild b/trunk/arch/tile/include/uapi/asm/Kbuild index 5c6915fd30b5..baebb3da1d44 100644 --- a/trunk/arch/tile/include/uapi/asm/Kbuild +++ b/trunk/arch/tile/include/uapi/asm/Kbuild @@ -1,18 +1,3 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += auxvec.h -header-y += bitsperlong.h -header-y += byteorder.h -header-y += cachectl.h -header-y += hardwall.h -header-y += kvm_para.h -header-y += mman.h -header-y += ptrace.h -header-y += setup.h -header-y += sigcontext.h -header-y += siginfo.h -header-y += signal.h -header-y += stat.h -header-y += swab.h -header-y += unistd.h diff --git a/trunk/arch/tile/include/uapi/asm/hardwall.h b/trunk/arch/tile/include/uapi/asm/hardwall.h deleted file mode 100644 index c2169d4f4010..000000000000 --- a/trunk/arch/tile/include/uapi/asm/hardwall.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2010 Tilera Corporation. All Rights Reserved. - * - * 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, version 2. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for - * more details. - * - * Provide methods for access control of per-cpu resources like - * UDN, IDN, or IPI. - */ - -#ifndef _UAPI_ASM_TILE_HARDWALL_H -#define _UAPI_ASM_TILE_HARDWALL_H - -#include -#include - -#define HARDWALL_IOCTL_BASE 0xa2 - -/* - * The HARDWALL_CREATE() ioctl is a macro with a "size" argument. - * The resulting ioctl value is passed to the kernel in conjunction - * with a pointer to a standard kernel bitmask of cpus. - * For network resources (UDN or IDN) the bitmask must physically - * represent a rectangular configuration on the chip. - * The "size" is the number of bytes of cpu mask data. - */ -#define _HARDWALL_CREATE 1 -#define HARDWALL_CREATE(size) \ - _IOC(_IOC_READ, HARDWALL_IOCTL_BASE, _HARDWALL_CREATE, (size)) - -#define _HARDWALL_ACTIVATE 2 -#define HARDWALL_ACTIVATE \ - _IO(HARDWALL_IOCTL_BASE, _HARDWALL_ACTIVATE) - -#define _HARDWALL_DEACTIVATE 3 -#define HARDWALL_DEACTIVATE \ - _IO(HARDWALL_IOCTL_BASE, _HARDWALL_DEACTIVATE) - -#define _HARDWALL_GET_ID 4 -#define HARDWALL_GET_ID \ - _IO(HARDWALL_IOCTL_BASE, _HARDWALL_GET_ID) - - -#endif /* _UAPI_ASM_TILE_HARDWALL_H */ diff --git a/trunk/arch/tile/include/uapi/asm/ptrace.h b/trunk/arch/tile/include/uapi/asm/ptrace.h deleted file mode 100644 index c717d0fec72e..000000000000 --- a/trunk/arch/tile/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2010 Tilera Corporation. All Rights Reserved. - * - * 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, version 2. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for - * more details. - */ - -#ifndef _UAPI_ASM_TILE_PTRACE_H -#define _UAPI_ASM_TILE_PTRACE_H - -#include -#include - -/* These must match struct pt_regs, below. */ -#if CHIP_WORD_SIZE() == 32 -#define PTREGS_OFFSET_REG(n) ((n)*4) -#else -#define PTREGS_OFFSET_REG(n) ((n)*8) -#endif -#define PTREGS_OFFSET_BASE 0 -#define PTREGS_OFFSET_TP PTREGS_OFFSET_REG(53) -#define PTREGS_OFFSET_SP PTREGS_OFFSET_REG(54) -#define PTREGS_OFFSET_LR PTREGS_OFFSET_REG(55) -#define PTREGS_NR_GPRS 56 -#define PTREGS_OFFSET_PC PTREGS_OFFSET_REG(56) -#define PTREGS_OFFSET_EX1 PTREGS_OFFSET_REG(57) -#define PTREGS_OFFSET_FAULTNUM PTREGS_OFFSET_REG(58) -#define PTREGS_OFFSET_ORIG_R0 PTREGS_OFFSET_REG(59) -#define PTREGS_OFFSET_FLAGS PTREGS_OFFSET_REG(60) -#if CHIP_HAS_CMPEXCH() -#define PTREGS_OFFSET_CMPEXCH PTREGS_OFFSET_REG(61) -#endif -#define PTREGS_SIZE PTREGS_OFFSET_REG(64) - - -#ifndef __ASSEMBLY__ - -#ifndef __KERNEL__ -/* Provide appropriate length type to userspace regardless of -m32/-m64. */ -typedef uint_reg_t pt_reg_t; -#endif - -/* - * This struct defines the way the registers are stored on the stack during a - * system call or exception. "struct sigcontext" has the same shape. - */ -struct pt_regs { - /* Saved main processor registers; 56..63 are special. */ - /* tp, sp, and lr must immediately follow regs[] for aliasing. */ - pt_reg_t regs[53]; - pt_reg_t tp; /* aliases regs[TREG_TP] */ - pt_reg_t sp; /* aliases regs[TREG_SP] */ - pt_reg_t lr; /* aliases regs[TREG_LR] */ - - /* Saved special registers. */ - pt_reg_t pc; /* stored in EX_CONTEXT_K_0 */ - pt_reg_t ex1; /* stored in EX_CONTEXT_K_1 (PL and ICS bit) */ - pt_reg_t faultnum; /* fault number (INT_SWINT_1 for syscall) */ - pt_reg_t orig_r0; /* r0 at syscall entry, else zero */ - pt_reg_t flags; /* flags (see below) */ -#if !CHIP_HAS_CMPEXCH() - pt_reg_t pad[3]; -#else - pt_reg_t cmpexch; /* value of CMPEXCH_VALUE SPR at interrupt */ - pt_reg_t pad[2]; -#endif -}; - -#endif /* __ASSEMBLY__ */ - -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 - -/* Support TILE-specific ptrace options, with events starting at 16. */ -#define PTRACE_O_TRACEMIGRATE 0x00010000 -#define PTRACE_EVENT_MIGRATE 16 - - -#endif /* _UAPI_ASM_TILE_PTRACE_H */ diff --git a/trunk/arch/tile/include/uapi/asm/setup.h b/trunk/arch/tile/include/uapi/asm/setup.h deleted file mode 100644 index e6f7da265ac3..000000000000 --- a/trunk/arch/tile/include/uapi/asm/setup.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2010 Tilera Corporation. All Rights Reserved. - * - * 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, version 2. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for - * more details. - */ - -#ifndef _UAPI_ASM_TILE_SETUP_H -#define _UAPI_ASM_TILE_SETUP_H - -#define COMMAND_LINE_SIZE 2048 - - -#endif /* _UAPI_ASM_TILE_SETUP_H */ diff --git a/trunk/arch/tile/include/uapi/asm/signal.h b/trunk/arch/tile/include/uapi/asm/signal.h deleted file mode 100644 index ef0d32d84a4c..000000000000 --- a/trunk/arch/tile/include/uapi/asm/signal.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2010 Tilera Corporation. All Rights Reserved. - * - * 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, version 2. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for - * more details. - */ - -#ifndef _UAPI_ASM_TILE_SIGNAL_H -#define _UAPI_ASM_TILE_SIGNAL_H - -/* Do not notify a ptracer when this signal is handled. */ -#define SA_NOPTRACE 0x02000000u - -/* Used in earlier Tilera releases, so keeping for binary compatibility. */ -#define SA_RESTORER 0x04000000u - -#include - - -#endif /* _UAPI_ASM_TILE_SIGNAL_H */ diff --git a/trunk/arch/tile/include/uapi/asm/unistd.h b/trunk/arch/tile/include/uapi/asm/unistd.h deleted file mode 100644 index cd7b6dd9d471..000000000000 --- a/trunk/arch/tile/include/uapi/asm/unistd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010 Tilera Corporation. All Rights Reserved. - * - * 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, version 2. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for - * more details. - */ - -#if !defined(__LP64__) || defined(__SYSCALL_COMPAT) -/* Use the flavor of this syscall that matches the 32-bit API better. */ -#define __ARCH_WANT_SYNC_FILE_RANGE2 -#endif - -/* Use the standard ABI for syscalls. */ -#include - -/* Additional Tilera-specific syscalls. */ -#define __NR_cacheflush (__NR_arch_specific_syscall + 1) -__SYSCALL(__NR_cacheflush, sys_cacheflush) - -#ifndef __tilegx__ -/* "Fast" syscalls provide atomic support for 32-bit chips. */ -#define __NR_FAST_cmpxchg -1 -#define __NR_FAST_atomic_update -2 -#define __NR_FAST_cmpxchg64 -3 -#define __NR_cmpxchg_badaddr (__NR_arch_specific_syscall + 0) -__SYSCALL(__NR_cmpxchg_badaddr, sys_cmpxchg_badaddr) -#endif diff --git a/trunk/arch/tile/kernel/process.c b/trunk/arch/tile/kernel/process.c index 307d010696c9..6be799150501 100644 --- a/trunk/arch/tile/kernel/process.c +++ b/trunk/arch/tile/kernel/process.c @@ -548,9 +548,6 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags) if (!user_mode(regs)) return 0; - /* Enable interrupts; they are disabled again on return to caller. */ - local_irq_enable(); - if (thread_info_flags & _TIF_NEED_RESCHED) { schedule(); return 1; @@ -597,13 +594,13 @@ SYSCALL_DEFINE4(execve, const char __user *, path, struct pt_regs *, regs) { long error; - struct filename *filename; + char *filename; filename = getname(path); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); if (error == 0) single_step_execve(); @@ -618,13 +615,13 @@ long compat_sys_execve(const char __user *path, struct pt_regs *regs) { long error; - struct filename *filename; + char *filename; filename = getname(path); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = compat_do_execve(filename->name, argv, envp, regs); + error = compat_do_execve(filename, argv, envp, regs); putname(filename); if (error == 0) single_step_execve(); diff --git a/trunk/arch/um/include/asm/processor-generic.h b/trunk/arch/um/include/asm/processor-generic.h index c03cd5a02364..1e82e954e978 100644 --- a/trunk/arch/um/include/asm/processor-generic.h +++ b/trunk/arch/um/include/asm/processor-generic.h @@ -26,6 +26,7 @@ struct thread_struct { jmp_buf *fault_catcher; struct task_struct *prev_sched; unsigned long temp_stack; + jmp_buf *exec_buf; struct arch_thread arch; jmp_buf switch_buf; int mm_count; @@ -53,6 +54,7 @@ struct thread_struct { .fault_addr = NULL, \ .prev_sched = NULL, \ .temp_stack = 0, \ + .exec_buf = NULL, \ .arch = INIT_ARCH_THREAD, \ .request = { 0 } \ } diff --git a/trunk/arch/um/include/shared/os.h b/trunk/arch/um/include/shared/os.h index 95feaa47a2fb..44883049c11d 100644 --- a/trunk/arch/um/include/shared/os.h +++ b/trunk/arch/um/include/shared/os.h @@ -191,6 +191,7 @@ extern int os_getpid(void); extern int os_getpgrp(void); extern void init_new_thread_signals(void); +extern int run_kernel_thread(int (*fn)(void *), void *arg, jmp_buf **jmp_ptr); extern int os_map_memory(void *virt, int fd, unsigned long long off, unsigned long len, int r, int w, int x); diff --git a/trunk/arch/um/kernel/exec.c b/trunk/arch/um/kernel/exec.c index 3a8ece7d09ca..ab019c7f0b57 100644 --- a/trunk/arch/um/kernel/exec.c +++ b/trunk/arch/um/kernel/exec.c @@ -47,3 +47,8 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) #endif } EXPORT_SYMBOL(start_thread); + +void __noreturn ret_from_kernel_execve(struct pt_regs *unused) +{ + UML_LONGJMP(current->thread.exec_buf, 1); +} diff --git a/trunk/arch/um/kernel/process.c b/trunk/arch/um/kernel/process.c index b6d699cdd557..30629783b3e0 100644 --- a/trunk/arch/um/kernel/process.c +++ b/trunk/arch/um/kernel/process.c @@ -135,10 +135,14 @@ void new_thread_handler(void) arg = current->thread.request.u.thread.arg; /* - * callback returns only if the kernel thread execs a process + * The return value is 1 if the kernel thread execs a process, + * 0 if it just exits */ - n = fn(arg); - userspace(¤t->thread.regs.regs); + n = run_kernel_thread(fn, arg, ¤t->thread.exec_buf); + if (n == 1) + userspace(¤t->thread.regs.regs); + else + do_exit(0); } /* Called magically, see new_thread_handler above */ diff --git a/trunk/arch/um/os-Linux/process.c b/trunk/arch/um/os-Linux/process.c index b8f34c9e53ae..162bea3d91b2 100644 --- a/trunk/arch/um/os-Linux/process.c +++ b/trunk/arch/um/os-Linux/process.c @@ -244,3 +244,16 @@ void init_new_thread_signals(void) signal(SIGWINCH, SIG_IGN); signal(SIGTERM, SIG_DFL); } + +int run_kernel_thread(int (*fn)(void *), void *arg, jmp_buf **jmp_ptr) +{ + jmp_buf buf; + int n; + + *jmp_ptr = &buf; + n = UML_SETJMP(&buf); + if (n != 0) + return n; + (*fn)(arg); + return 0; +} diff --git a/trunk/arch/unicore32/kernel/sys.c b/trunk/arch/unicore32/kernel/sys.c index fabdee96110b..5fd9af773e15 100644 --- a/trunk/arch/unicore32/kernel/sys.c +++ b/trunk/arch/unicore32/kernel/sys.c @@ -51,13 +51,13 @@ asmlinkage long __sys_execve(const char __user *filename, struct pt_regs *regs) { int error; - struct filename *fn; + char *fn; fn = getname(filename); error = PTR_ERR(fn); if (IS_ERR(fn)) goto out; - error = do_execve(fn->name, argv, envp, regs); + error = do_execve(fn, argv, envp, regs); putname(fn); out: return error; diff --git a/trunk/arch/x86/Kconfig b/trunk/arch/x86/Kconfig index 70071b19eb98..42d2c35a5bbd 100644 --- a/trunk/arch/x86/Kconfig +++ b/trunk/arch/x86/Kconfig @@ -109,7 +109,6 @@ config X86 select HAVE_RCU_USER_QS if X86_64 select HAVE_IRQ_TIME_ACCOUNTING select GENERIC_KERNEL_THREAD - select GENERIC_KERNEL_EXECVE config INSTRUCTION_DECODER def_bool y diff --git a/trunk/arch/x86/include/asm/msr-index.h b/trunk/arch/x86/include/asm/msr-index.h index 7f0edceb7563..fbee9714d9ab 100644 --- a/trunk/arch/x86/include/asm/msr-index.h +++ b/trunk/arch/x86/include/asm/msr-index.h @@ -121,11 +121,6 @@ #define MSR_P6_EVNTSEL0 0x00000186 #define MSR_P6_EVNTSEL1 0x00000187 -#define MSR_KNC_PERFCTR0 0x00000020 -#define MSR_KNC_PERFCTR1 0x00000021 -#define MSR_KNC_EVNTSEL0 0x00000028 -#define MSR_KNC_EVNTSEL1 0x00000029 - /* AMD64 MSRs. Not complete. See the architecture manual for a more complete list. */ diff --git a/trunk/arch/x86/include/asm/unistd.h b/trunk/arch/x86/include/asm/unistd.h index 16f3fc6ebf2e..55d155560fdf 100644 --- a/trunk/arch/x86/include/asm/unistd.h +++ b/trunk/arch/x86/include/asm/unistd.h @@ -51,6 +51,7 @@ # define __ARCH_WANT_SYS_UTIME # define __ARCH_WANT_SYS_WAITPID # define __ARCH_WANT_SYS_EXECVE +# define __ARCH_WANT_KERNEL_EXECVE /* * "Conditional" syscalls diff --git a/trunk/arch/x86/kernel/cpu/Makefile b/trunk/arch/x86/kernel/cpu/Makefile index a0e067d3d96c..d30a6a9a0121 100644 --- a/trunk/arch/x86/kernel/cpu/Makefile +++ b/trunk/arch/x86/kernel/cpu/Makefile @@ -32,7 +32,7 @@ obj-$(CONFIG_PERF_EVENTS) += perf_event.o ifdef CONFIG_PERF_EVENTS obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o -obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o +obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_p4.o obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o endif diff --git a/trunk/arch/x86/kernel/cpu/perf_event.h b/trunk/arch/x86/kernel/cpu/perf_event.h index 271d25700297..8b6defe7eefc 100644 --- a/trunk/arch/x86/kernel/cpu/perf_event.h +++ b/trunk/arch/x86/kernel/cpu/perf_event.h @@ -626,8 +626,6 @@ int p4_pmu_init(void); int p6_pmu_init(void); -int knc_pmu_init(void); - #else /* CONFIG_CPU_SUP_INTEL */ static inline void reserve_ds_buffers(void) diff --git a/trunk/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/trunk/arch/x86/kernel/cpu/perf_event_amd_ibs.c index 6336bcbd0618..eebd5ffe1bba 100644 --- a/trunk/arch/x86/kernel/cpu/perf_event_amd_ibs.c +++ b/trunk/arch/x86/kernel/cpu/perf_event_amd_ibs.c @@ -41,22 +41,17 @@ struct cpu_perf_ibs { }; struct perf_ibs { - struct pmu pmu; - unsigned int msr; - u64 config_mask; - u64 cnt_mask; - u64 enable_mask; - u64 valid_mask; - u64 max_period; - unsigned long offset_mask[1]; - int offset_max; - struct cpu_perf_ibs __percpu *pcpu; - - struct attribute **format_attrs; - struct attribute_group format_group; - const struct attribute_group *attr_groups[2]; - - u64 (*get_count)(u64 config); + struct pmu pmu; + unsigned int msr; + u64 config_mask; + u64 cnt_mask; + u64 enable_mask; + u64 valid_mask; + u64 max_period; + unsigned long offset_mask[1]; + int offset_max; + struct cpu_perf_ibs __percpu *pcpu; + u64 (*get_count)(u64 config); }; struct perf_ibs_data { @@ -451,19 +446,6 @@ static void perf_ibs_del(struct perf_event *event, int flags) static void perf_ibs_read(struct perf_event *event) { } -PMU_FORMAT_ATTR(rand_en, "config:57"); -PMU_FORMAT_ATTR(cnt_ctl, "config:19"); - -static struct attribute *ibs_fetch_format_attrs[] = { - &format_attr_rand_en.attr, - NULL, -}; - -static struct attribute *ibs_op_format_attrs[] = { - NULL, /* &format_attr_cnt_ctl.attr if IBS_CAPS_OPCNT */ - NULL, -}; - static struct perf_ibs perf_ibs_fetch = { .pmu = { .task_ctx_nr = perf_invalid_context, @@ -483,7 +465,6 @@ static struct perf_ibs perf_ibs_fetch = { .max_period = IBS_FETCH_MAX_CNT << 4, .offset_mask = { MSR_AMD64_IBSFETCH_REG_MASK }, .offset_max = MSR_AMD64_IBSFETCH_REG_COUNT, - .format_attrs = ibs_fetch_format_attrs, .get_count = get_ibs_fetch_count, }; @@ -507,7 +488,6 @@ static struct perf_ibs perf_ibs_op = { .max_period = IBS_OP_MAX_CNT << 4, .offset_mask = { MSR_AMD64_IBSOP_REG_MASK }, .offset_max = MSR_AMD64_IBSOP_REG_COUNT, - .format_attrs = ibs_op_format_attrs, .get_count = get_ibs_op_count, }; @@ -617,17 +597,6 @@ static __init int perf_ibs_pmu_init(struct perf_ibs *perf_ibs, char *name) perf_ibs->pcpu = pcpu; - /* register attributes */ - if (perf_ibs->format_attrs[0]) { - memset(&perf_ibs->format_group, 0, sizeof(perf_ibs->format_group)); - perf_ibs->format_group.name = "format"; - perf_ibs->format_group.attrs = perf_ibs->format_attrs; - - memset(&perf_ibs->attr_groups, 0, sizeof(perf_ibs->attr_groups)); - perf_ibs->attr_groups[0] = &perf_ibs->format_group; - perf_ibs->pmu.attr_groups = perf_ibs->attr_groups; - } - ret = perf_pmu_register(&perf_ibs->pmu, name, -1); if (ret) { perf_ibs->pcpu = NULL; @@ -639,19 +608,13 @@ static __init int perf_ibs_pmu_init(struct perf_ibs *perf_ibs, char *name) static __init int perf_event_ibs_init(void) { - struct attribute **attr = ibs_op_format_attrs; - if (!ibs_caps) return -ENODEV; /* ibs not supported by the cpu */ perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch"); - - if (ibs_caps & IBS_CAPS_OPCNT) { + if (ibs_caps & IBS_CAPS_OPCNT) perf_ibs_op.config_mask |= IBS_OP_CNT_CTL; - *attr++ = &format_attr_cnt_ctl.attr; - } perf_ibs_pmu_init(&perf_ibs_op, "ibs_op"); - register_nmi_handler(NMI_LOCAL, perf_ibs_nmi_handler, 0, "perf_ibs"); printk(KERN_INFO "perf: AMD IBS detected (0x%08x)\n", ibs_caps); diff --git a/trunk/arch/x86/kernel/cpu/perf_event_intel.c b/trunk/arch/x86/kernel/cpu/perf_event_intel.c index 324bb523d9d9..6bca492b8547 100644 --- a/trunk/arch/x86/kernel/cpu/perf_event_intel.c +++ b/trunk/arch/x86/kernel/cpu/perf_event_intel.c @@ -1906,8 +1906,6 @@ __init int intel_pmu_init(void) switch (boot_cpu_data.x86) { case 0x6: return p6_pmu_init(); - case 0xb: - return knc_pmu_init(); case 0xf: return p4_pmu_init(); } diff --git a/trunk/arch/x86/kernel/cpu/perf_event_knc.c b/trunk/arch/x86/kernel/cpu/perf_event_knc.c deleted file mode 100644 index 7c46bfdbc373..000000000000 --- a/trunk/arch/x86/kernel/cpu/perf_event_knc.c +++ /dev/null @@ -1,248 +0,0 @@ -/* Driver for Intel Xeon Phi "Knights Corner" PMU */ - -#include -#include - -#include "perf_event.h" - -static const u64 knc_perfmon_event_map[] = -{ - [PERF_COUNT_HW_CPU_CYCLES] = 0x002a, - [PERF_COUNT_HW_INSTRUCTIONS] = 0x0016, - [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0028, - [PERF_COUNT_HW_CACHE_MISSES] = 0x0029, - [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x0012, - [PERF_COUNT_HW_BRANCH_MISSES] = 0x002b, -}; - -static __initconst u64 knc_hw_cache_event_ids - [PERF_COUNT_HW_CACHE_MAX] - [PERF_COUNT_HW_CACHE_OP_MAX] - [PERF_COUNT_HW_CACHE_RESULT_MAX] = -{ - [ C(L1D) ] = { - [ C(OP_READ) ] = { - /* On Xeon Phi event "0" is a valid DATA_READ */ - /* (L1 Data Cache Reads) Instruction. */ - /* We code this as ARCH_PERFMON_EVENTSEL_INT as this */ - /* bit will always be set in x86_pmu_hw_config(). */ - [ C(RESULT_ACCESS) ] = ARCH_PERFMON_EVENTSEL_INT, - /* DATA_READ */ - [ C(RESULT_MISS) ] = 0x0003, /* DATA_READ_MISS */ - }, - [ C(OP_WRITE) ] = { - [ C(RESULT_ACCESS) ] = 0x0001, /* DATA_WRITE */ - [ C(RESULT_MISS) ] = 0x0004, /* DATA_WRITE_MISS */ - }, - [ C(OP_PREFETCH) ] = { - [ C(RESULT_ACCESS) ] = 0x0011, /* L1_DATA_PF1 */ - [ C(RESULT_MISS) ] = 0x001c, /* L1_DATA_PF1_MISS */ - }, - }, - [ C(L1I ) ] = { - [ C(OP_READ) ] = { - [ C(RESULT_ACCESS) ] = 0x000c, /* CODE_READ */ - [ C(RESULT_MISS) ] = 0x000e, /* CODE_CACHE_MISS */ - }, - [ C(OP_WRITE) ] = { - [ C(RESULT_ACCESS) ] = -1, - [ C(RESULT_MISS) ] = -1, - }, - [ C(OP_PREFETCH) ] = { - [ C(RESULT_ACCESS) ] = 0x0, - [ C(RESULT_MISS) ] = 0x0, - }, - }, - [ C(LL ) ] = { - [ C(OP_READ) ] = { - [ C(RESULT_ACCESS) ] = 0, - [ C(RESULT_MISS) ] = 0x10cb, /* L2_READ_MISS */ - }, - [ C(OP_WRITE) ] = { - [ C(RESULT_ACCESS) ] = 0x10cc, /* L2_WRITE_HIT */ - [ C(RESULT_MISS) ] = 0, - }, - [ C(OP_PREFETCH) ] = { - [ C(RESULT_ACCESS) ] = 0x10fc, /* L2_DATA_PF2 */ - [ C(RESULT_MISS) ] = 0x10fe, /* L2_DATA_PF2_MISS */ - }, - }, - [ C(DTLB) ] = { - [ C(OP_READ) ] = { - [ C(RESULT_ACCESS) ] = ARCH_PERFMON_EVENTSEL_INT, - /* DATA_READ */ - /* see note on L1 OP_READ */ - [ C(RESULT_MISS) ] = 0x0002, /* DATA_PAGE_WALK */ - }, - [ C(OP_WRITE) ] = { - [ C(RESULT_ACCESS) ] = 0x0001, /* DATA_WRITE */ - [ C(RESULT_MISS) ] = 0x0002, /* DATA_PAGE_WALK */ - }, - [ C(OP_PREFETCH) ] = { - [ C(RESULT_ACCESS) ] = 0x0, - [ C(RESULT_MISS) ] = 0x0, - }, - }, - [ C(ITLB) ] = { - [ C(OP_READ) ] = { - [ C(RESULT_ACCESS) ] = 0x000c, /* CODE_READ */ - [ C(RESULT_MISS) ] = 0x000d, /* CODE_PAGE_WALK */ - }, - [ C(OP_WRITE) ] = { - [ C(RESULT_ACCESS) ] = -1, - [ C(RESULT_MISS) ] = -1, - }, - [ C(OP_PREFETCH) ] = { - [ C(RESULT_ACCESS) ] = -1, - [ C(RESULT_MISS) ] = -1, - }, - }, - [ C(BPU ) ] = { - [ C(OP_READ) ] = { - [ C(RESULT_ACCESS) ] = 0x0012, /* BRANCHES */ - [ C(RESULT_MISS) ] = 0x002b, /* BRANCHES_MISPREDICTED */ - }, - [ C(OP_WRITE) ] = { - [ C(RESULT_ACCESS) ] = -1, - [ C(RESULT_MISS) ] = -1, - }, - [ C(OP_PREFETCH) ] = { - [ C(RESULT_ACCESS) ] = -1, - [ C(RESULT_MISS) ] = -1, - }, - }, -}; - - -static u64 knc_pmu_event_map(int hw_event) -{ - return knc_perfmon_event_map[hw_event]; -} - -static struct event_constraint knc_event_constraints[] = -{ - INTEL_EVENT_CONSTRAINT(0xc3, 0x1), /* HWP_L2HIT */ - INTEL_EVENT_CONSTRAINT(0xc4, 0x1), /* HWP_L2MISS */ - INTEL_EVENT_CONSTRAINT(0xc8, 0x1), /* L2_READ_HIT_E */ - INTEL_EVENT_CONSTRAINT(0xc9, 0x1), /* L2_READ_HIT_M */ - INTEL_EVENT_CONSTRAINT(0xca, 0x1), /* L2_READ_HIT_S */ - INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* L2_READ_MISS */ - INTEL_EVENT_CONSTRAINT(0xcc, 0x1), /* L2_WRITE_HIT */ - INTEL_EVENT_CONSTRAINT(0xce, 0x1), /* L2_STRONGLY_ORDERED_STREAMING_VSTORES_MISS */ - INTEL_EVENT_CONSTRAINT(0xcf, 0x1), /* L2_WEAKLY_ORDERED_STREAMING_VSTORE_MISS */ - INTEL_EVENT_CONSTRAINT(0xd7, 0x1), /* L2_VICTIM_REQ_WITH_DATA */ - INTEL_EVENT_CONSTRAINT(0xe3, 0x1), /* SNP_HITM_BUNIT */ - INTEL_EVENT_CONSTRAINT(0xe6, 0x1), /* SNP_HIT_L2 */ - INTEL_EVENT_CONSTRAINT(0xe7, 0x1), /* SNP_HITM_L2 */ - INTEL_EVENT_CONSTRAINT(0xf1, 0x1), /* L2_DATA_READ_MISS_CACHE_FILL */ - INTEL_EVENT_CONSTRAINT(0xf2, 0x1), /* L2_DATA_WRITE_MISS_CACHE_FILL */ - INTEL_EVENT_CONSTRAINT(0xf6, 0x1), /* L2_DATA_READ_MISS_MEM_FILL */ - INTEL_EVENT_CONSTRAINT(0xf7, 0x1), /* L2_DATA_WRITE_MISS_MEM_FILL */ - INTEL_EVENT_CONSTRAINT(0xfc, 0x1), /* L2_DATA_PF2 */ - INTEL_EVENT_CONSTRAINT(0xfd, 0x1), /* L2_DATA_PF2_DROP */ - INTEL_EVENT_CONSTRAINT(0xfe, 0x1), /* L2_DATA_PF2_MISS */ - INTEL_EVENT_CONSTRAINT(0xff, 0x1), /* L2_DATA_HIT_INFLIGHT_PF2 */ - EVENT_CONSTRAINT_END -}; - -#define MSR_KNC_IA32_PERF_GLOBAL_STATUS 0x0000002d -#define MSR_KNC_IA32_PERF_GLOBAL_OVF_CONTROL 0x0000002e -#define MSR_KNC_IA32_PERF_GLOBAL_CTRL 0x0000002f - -#define KNC_ENABLE_COUNTER0 0x00000001 -#define KNC_ENABLE_COUNTER1 0x00000002 - -static void knc_pmu_disable_all(void) -{ - u64 val; - - rdmsrl(MSR_KNC_IA32_PERF_GLOBAL_CTRL, val); - val &= ~(KNC_ENABLE_COUNTER0|KNC_ENABLE_COUNTER1); - wrmsrl(MSR_KNC_IA32_PERF_GLOBAL_CTRL, val); -} - -static void knc_pmu_enable_all(int added) -{ - u64 val; - - rdmsrl(MSR_KNC_IA32_PERF_GLOBAL_CTRL, val); - val |= (KNC_ENABLE_COUNTER0|KNC_ENABLE_COUNTER1); - wrmsrl(MSR_KNC_IA32_PERF_GLOBAL_CTRL, val); -} - -static inline void -knc_pmu_disable_event(struct perf_event *event) -{ - struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); - struct hw_perf_event *hwc = &event->hw; - u64 val; - - val = hwc->config; - if (cpuc->enabled) - val &= ~ARCH_PERFMON_EVENTSEL_ENABLE; - - (void)wrmsrl_safe(hwc->config_base + hwc->idx, val); -} - -static void knc_pmu_enable_event(struct perf_event *event) -{ - struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); - struct hw_perf_event *hwc = &event->hw; - u64 val; - - val = hwc->config; - if (cpuc->enabled) - val |= ARCH_PERFMON_EVENTSEL_ENABLE; - - (void)wrmsrl_safe(hwc->config_base + hwc->idx, val); -} - -PMU_FORMAT_ATTR(event, "config:0-7" ); -PMU_FORMAT_ATTR(umask, "config:8-15" ); -PMU_FORMAT_ATTR(edge, "config:18" ); -PMU_FORMAT_ATTR(inv, "config:23" ); -PMU_FORMAT_ATTR(cmask, "config:24-31" ); - -static struct attribute *intel_knc_formats_attr[] = { - &format_attr_event.attr, - &format_attr_umask.attr, - &format_attr_edge.attr, - &format_attr_inv.attr, - &format_attr_cmask.attr, - NULL, -}; - -static __initconst struct x86_pmu knc_pmu = { - .name = "knc", - .handle_irq = x86_pmu_handle_irq, - .disable_all = knc_pmu_disable_all, - .enable_all = knc_pmu_enable_all, - .enable = knc_pmu_enable_event, - .disable = knc_pmu_disable_event, - .hw_config = x86_pmu_hw_config, - .schedule_events = x86_schedule_events, - .eventsel = MSR_KNC_EVNTSEL0, - .perfctr = MSR_KNC_PERFCTR0, - .event_map = knc_pmu_event_map, - .max_events = ARRAY_SIZE(knc_perfmon_event_map), - .apic = 1, - .max_period = (1ULL << 31) - 1, - .version = 0, - .num_counters = 2, - /* in theory 40 bits, early silicon is buggy though */ - .cntval_bits = 32, - .cntval_mask = (1ULL << 32) - 1, - .get_event_constraints = x86_get_event_constraints, - .event_constraints = knc_event_constraints, - .format_attrs = intel_knc_formats_attr, -}; - -__init int knc_pmu_init(void) -{ - x86_pmu = knc_pmu; - - memcpy(hw_cache_event_ids, knc_hw_cache_event_ids, - sizeof(hw_cache_event_ids)); - - return 0; -} diff --git a/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c b/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c index 2e8caf03f593..966512b2cacf 100644 --- a/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c @@ -56,8 +56,6 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr) switch (boot_cpu_data.x86) { case 6: return msr - MSR_P6_PERFCTR0; - case 11: - return msr - MSR_KNC_PERFCTR0; case 15: return msr - MSR_P4_BPU_PERFCTR0; } @@ -84,8 +82,6 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr) switch (boot_cpu_data.x86) { case 6: return msr - MSR_P6_EVNTSEL0; - case 11: - return msr - MSR_KNC_EVNTSEL0; case 15: return msr - MSR_P4_BSU_ESCR0; } diff --git a/trunk/arch/x86/kernel/entry_32.S b/trunk/arch/x86/kernel/entry_32.S index a1193aef6d7d..2c6340796fe9 100644 --- a/trunk/arch/x86/kernel/entry_32.S +++ b/trunk/arch/x86/kernel/entry_32.S @@ -299,20 +299,12 @@ ENTRY(ret_from_fork) CFI_ENDPROC END(ret_from_fork) -ENTRY(ret_from_kernel_thread) - CFI_STARTPROC - pushl_cfi %eax - call schedule_tail - GET_THREAD_INFO(%ebp) - popl_cfi %eax - pushl_cfi $0x0202 # Reset kernel eflags - popfl_cfi - movl PT_EBP(%esp),%eax - call *PT_EBX(%esp) +ENTRY(ret_from_kernel_execve) + movl %eax, %esp movl $0,PT_EAX(%esp) + GET_THREAD_INFO(%ebp) jmp syscall_exit - CFI_ENDPROC -ENDPROC(ret_from_kernel_thread) +END(ret_from_kernel_execve) /* * Interrupt exit functions should be protected against kprobes @@ -1023,6 +1015,21 @@ END(spurious_interrupt_bug) */ .popsection +ENTRY(ret_from_kernel_thread) + CFI_STARTPROC + pushl_cfi %eax + call schedule_tail + GET_THREAD_INFO(%ebp) + popl_cfi %eax + pushl_cfi $0x0202 # Reset kernel eflags + popfl_cfi + movl PT_EBP(%esp),%eax + call *PT_EBX(%esp) + call do_exit + ud2 # padding for call trace + CFI_ENDPROC +ENDPROC(ret_from_kernel_thread) + #ifdef CONFIG_XEN /* Xen doesn't set %esp to be precisely what the normal sysenter entrypoint expects, so fix it up before using the normal path. */ diff --git a/trunk/arch/x86/kernel/entry_64.S b/trunk/arch/x86/kernel/entry_64.S index 0c58952d64e8..cdc790c78f32 100644 --- a/trunk/arch/x86/kernel/entry_64.S +++ b/trunk/arch/x86/kernel/entry_64.S @@ -563,13 +563,15 @@ ENTRY(ret_from_fork) jmp ret_from_sys_call # go to the SYSRET fastpath 1: - subq $REST_SKIP, %rsp # leave space for volatiles + subq $REST_SKIP, %rsp # move the stack pointer back CFI_ADJUST_CFA_OFFSET REST_SKIP movq %rbp, %rdi call *%rbx - movl $0, RAX(%rsp) - RESTORE_REST - jmp int_ret_from_sys_call + # exit + mov %eax, %edi + call do_exit + ud2 # padding for call trace + CFI_ENDPROC END(ret_from_fork) @@ -1324,6 +1326,20 @@ bad_gs: jmp 2b .previous +ENTRY(ret_from_kernel_execve) + movq %rdi, %rsp + movl $0, RAX(%rsp) + // RESTORE_REST + movq 0*8(%rsp), %r15 + movq 1*8(%rsp), %r14 + movq 2*8(%rsp), %r13 + movq 3*8(%rsp), %r12 + movq 4*8(%rsp), %rbp + movq 5*8(%rsp), %rbx + addq $(6*8), %rsp + jmp int_ret_from_sys_call +END(ret_from_kernel_execve) + /* Call softirq on interrupt stack. Interrupts are off. */ ENTRY(call_softirq) CFI_STARTPROC diff --git a/trunk/arch/x86/kernel/kgdb.c b/trunk/arch/x86/kernel/kgdb.c index 836f8322960e..3f61904365cf 100644 --- a/trunk/arch/x86/kernel/kgdb.c +++ b/trunk/arch/x86/kernel/kgdb.c @@ -746,9 +746,7 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip) int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) { int err; -#ifdef CONFIG_DEBUG_RODATA char opc[BREAK_INSTR_SIZE]; -#endif /* CONFIG_DEBUG_RODATA */ bpt->type = BP_BREAKPOINT; err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr, diff --git a/trunk/arch/x86/um/Kconfig b/trunk/arch/x86/um/Kconfig index 9fa950df80e5..30c4eec033af 100644 --- a/trunk/arch/x86/um/Kconfig +++ b/trunk/arch/x86/um/Kconfig @@ -14,7 +14,6 @@ config UML_X86 def_bool y select GENERIC_FIND_FIRST_BIT select GENERIC_KERNEL_THREAD - select GENERIC_KERNEL_EXECVE config 64BIT bool "64-bit kernel" if SUBARCH = "x86" diff --git a/trunk/arch/xtensa/kernel/process.c b/trunk/arch/xtensa/kernel/process.c index bc020825cce5..bc44311aa18c 100644 --- a/trunk/arch/xtensa/kernel/process.c +++ b/trunk/arch/xtensa/kernel/process.c @@ -328,13 +328,13 @@ long xtensa_execve(const char __user *name, struct pt_regs *regs) { long error; - struct filename *filename; + char * filename; filename = getname(name); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename->name, argv, envp, regs); + error = do_execve(filename, argv, envp, regs); putname(filename); out: return error; diff --git a/trunk/crypto/xor.c b/trunk/crypto/xor.c index 35d6b3adf230..65c7b416b4a3 100644 --- a/trunk/crypto/xor.c +++ b/trunk/crypto/xor.c @@ -56,11 +56,11 @@ xor_blocks(unsigned int src_count, unsigned int bytes, void *dest, void **srcs) EXPORT_SYMBOL(xor_blocks); /* Set of all registered templates. */ -static struct xor_block_template *__initdata template_list; +static struct xor_block_template *template_list; #define BENCH_SIZE (PAGE_SIZE) -static void __init +static void do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2) { int speed; diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index a51df9681319..7edaccce6640 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -71,6 +71,9 @@ enum ec_command { #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ +#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts + per one transaction */ + enum { EC_FLAGS_QUERY_PENDING, /* Query is pending */ EC_FLAGS_GPE_STORM, /* GPE storm detected */ @@ -84,15 +87,6 @@ static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; module_param(ec_delay, uint, 0644); MODULE_PARM_DESC(ec_delay, "Timeout(ms) waited until an EC command completes"); -/* - * If the number of false interrupts per one transaction exceeds - * this threshold, will think there is a GPE storm happened and - * will disable the GPE for normal transaction. - */ -static unsigned int ec_storm_threshold __read_mostly = 8; -module_param(ec_storm_threshold, uint, 0644); -MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm"); - /* If we find an EC via the ECDT, we need to keep a ptr to its context */ /* External interfaces use first EC only, so remember */ typedef int (*acpi_ec_query_func) (void *data); @@ -325,7 +319,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) msleep(1); /* It is safe to enable the GPE outside of the transaction. */ acpi_enable_gpe(NULL, ec->gpe); - } else if (t->irq_count > ec_storm_threshold) { + } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { pr_info(PREFIX "GPE storm detected, " "transactions will use polling mode\n"); set_bit(EC_FLAGS_GPE_STORM, &ec->flags); @@ -930,17 +924,6 @@ static int ec_flag_msi(const struct dmi_system_id *id) return 0; } -/* - * Clevo M720 notebook actually works ok with IRQ mode, if we lifted - * the GPE storm threshold back to 20 - */ -static int ec_enlarge_storm_threshold(const struct dmi_system_id *id) -{ - pr_debug("Setting the EC GPE storm threshold to 20\n"); - ec_storm_threshold = 20; - return 0; -} - static struct dmi_system_id __initdata ec_dmi_table[] = { { ec_skip_dsdt_scan, "Compal JFL92", { @@ -972,13 +955,10 @@ static struct dmi_system_id __initdata ec_dmi_table[] = { { ec_validate_ecdt, "ASUS hardware", { DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL}, - { - ec_enlarge_storm_threshold, "CLEVO hardware", { - DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."), - DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL}, {}, }; + int __init acpi_ec_ecdt_probe(void) { acpi_status status; diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index e8086c725305..3655ab923812 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -1132,7 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) int acpi_processor_hotplug(struct acpi_processor *pr) { int ret = 0; - struct cpuidle_device *dev; + struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); if (disabled_by_idle_boot_param()) return 0; @@ -1147,7 +1147,6 @@ int acpi_processor_hotplug(struct acpi_processor *pr) if (!pr->flags.power_setup_done) return -ENODEV; - dev = per_cpu(acpi_cpuidle_device, pr->id); cpuidle_pause_and_lock(); cpuidle_disable_device(dev); acpi_processor_get_power_info(pr); diff --git a/trunk/drivers/acpi/thermal.c b/trunk/drivers/acpi/thermal.c index 804204d41999..edda74a43406 100644 --- a/trunk/drivers/acpi/thermal.c +++ b/trunk/drivers/acpi/thermal.c @@ -708,40 +708,6 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal, return -EINVAL; } -static int thermal_get_trend(struct thermal_zone_device *thermal, - int trip, enum thermal_trend *trend) -{ - struct acpi_thermal *tz = thermal->devdata; - enum thermal_trip_type type; - int i; - - if (thermal_get_trip_type(thermal, trip, &type)) - return -EINVAL; - - if (type == THERMAL_TRIP_ACTIVE) { - /* aggressive active cooling */ - *trend = THERMAL_TREND_RAISING; - return 0; - } - - /* - * tz->temperature has already been updated by generic thermal layer, - * before this callback being invoked - */ - i = (tz->trips.passive.tc1 * (tz->temperature - tz->last_temperature)) - + (tz->trips.passive.tc2 - * (tz->temperature - tz->trips.passive.temperature)); - - if (i > 0) - *trend = THERMAL_TREND_RAISING; - else if (i < 0) - *trend = THERMAL_TREND_DROPPING; - else - *trend = THERMAL_TREND_STABLE; - return 0; -} - - static int thermal_notify(struct thermal_zone_device *thermal, int trip, enum thermal_trip_type trip_type) { @@ -765,9 +731,11 @@ static int thermal_notify(struct thermal_zone_device *thermal, int trip, return 0; } +typedef int (*cb)(struct thermal_zone_device *, int, + struct thermal_cooling_device *); static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev, - bool bind) + cb action) { struct acpi_device *device = cdev->devdata; struct acpi_thermal *tz = thermal->devdata; @@ -791,19 +759,11 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, i++) { handle = tz->trips.passive.devices.handles[i]; status = acpi_bus_get_device(handle, &dev); - if (ACPI_FAILURE(status) || dev != device) - continue; - if (bind) - result = - thermal_zone_bind_cooling_device - (thermal, trip, cdev, - THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); - else - result = - thermal_zone_unbind_cooling_device - (thermal, trip, cdev); - if (result) - goto failed; + if (ACPI_SUCCESS(status) && (dev == device)) { + result = action(thermal, trip, cdev); + if (result) + goto failed; + } } } @@ -816,17 +776,11 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, j++) { handle = tz->trips.active[i].devices.handles[j]; status = acpi_bus_get_device(handle, &dev); - if (ACPI_FAILURE(status) || dev != device) - continue; - if (bind) - result = thermal_zone_bind_cooling_device - (thermal, trip, cdev, - THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); - else - result = thermal_zone_unbind_cooling_device - (thermal, trip, cdev); - if (result) - goto failed; + if (ACPI_SUCCESS(status) && (dev == device)) { + result = action(thermal, trip, cdev); + if (result) + goto failed; + } } } @@ -834,14 +788,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, handle = tz->devices.handles[i]; status = acpi_bus_get_device(handle, &dev); if (ACPI_SUCCESS(status) && (dev == device)) { - if (bind) - result = thermal_zone_bind_cooling_device - (thermal, -1, cdev, - THERMAL_NO_LIMIT, - THERMAL_NO_LIMIT); - else - result = thermal_zone_unbind_cooling_device - (thermal, -1, cdev); + result = action(thermal, -1, cdev); if (result) goto failed; } @@ -855,14 +802,16 @@ static int acpi_thermal_bind_cooling_device(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev) { - return acpi_thermal_cooling_device_cb(thermal, cdev, true); + return acpi_thermal_cooling_device_cb(thermal, cdev, + thermal_zone_bind_cooling_device); } static int acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev) { - return acpi_thermal_cooling_device_cb(thermal, cdev, false); + return acpi_thermal_cooling_device_cb(thermal, cdev, + thermal_zone_unbind_cooling_device); } static const struct thermal_zone_device_ops acpi_thermal_zone_ops = { @@ -874,7 +823,6 @@ static const struct thermal_zone_device_ops acpi_thermal_zone_ops = { .get_trip_type = thermal_get_trip_type, .get_trip_temp = thermal_get_trip_temp, .get_crit_temp = thermal_get_crit_temp, - .get_trend = thermal_get_trend, .notify = thermal_notify, }; @@ -901,12 +849,15 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) tz->thermal_zone = thermal_zone_device_register("acpitz", trips, 0, tz, &acpi_thermal_zone_ops, + tz->trips.passive.tc1, + tz->trips.passive.tc2, tz->trips.passive.tsp*100, tz->polling_frequency*100); else tz->thermal_zone = thermal_zone_device_register("acpitz", trips, 0, tz, - &acpi_thermal_zone_ops, 0, + &acpi_thermal_zone_ops, + 0, 0, 0, tz->polling_frequency*100); if (IS_ERR(tz->thermal_zone)) return -ENODEV; diff --git a/trunk/drivers/char/tpm/tpm.c b/trunk/drivers/char/tpm/tpm.c index 93211df52aab..f26afdb1a702 100644 --- a/trunk/drivers/char/tpm/tpm.c +++ b/trunk/drivers/char/tpm/tpm.c @@ -1182,21 +1182,18 @@ ssize_t tpm_write(struct file *file, const char __user *buf, size_t size, loff_t *off) { struct tpm_chip *chip = file->private_data; - size_t in_size = size; - ssize_t out_size; + size_t in_size = size, out_size; /* cannot perform a write until the read has cleared - either via tpm_read or a user_read_timer timeout. - This also prevents splitted buffered writes from blocking here. - */ - if (atomic_read(&chip->data_pending) != 0) - return -EBUSY; - - if (in_size > TPM_BUFSIZE) - return -E2BIG; + either via tpm_read or a user_read_timer timeout */ + while (atomic_read(&chip->data_pending) != 0) + msleep(TPM_TIMEOUT); mutex_lock(&chip->buffer_mutex); + if (in_size > TPM_BUFSIZE) + in_size = TPM_BUFSIZE; + if (copy_from_user (chip->data_buffer, (void __user *) buf, in_size)) { mutex_unlock(&chip->buffer_mutex); @@ -1205,10 +1202,6 @@ ssize_t tpm_write(struct file *file, const char __user *buf, /* atomic tpm command send and result receive */ out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE); - if (out_size < 0) { - mutex_unlock(&chip->buffer_mutex); - return out_size; - } atomic_set(&chip->data_pending, out_size); mutex_unlock(&chip->buffer_mutex); @@ -1266,7 +1259,6 @@ void tpm_remove_hardware(struct device *dev) misc_deregister(&chip->vendor.miscdev); sysfs_remove_group(&dev->kobj, chip->vendor.attr_group); - tpm_remove_ppi(&dev->kobj); tpm_bios_log_teardown(chip->bios_dir); /* write it this way to be explicit (chip->dev == dev) */ @@ -1484,7 +1476,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, goto put_device; } - if (tpm_add_ppi(&dev->kobj)) { + if (sys_add_ppi(&dev->kobj)) { misc_deregister(&chip->vendor.miscdev); goto put_device; } diff --git a/trunk/drivers/char/tpm/tpm.h b/trunk/drivers/char/tpm/tpm.h index 8ef7649a50aa..02c266aa2bf7 100644 --- a/trunk/drivers/char/tpm/tpm.h +++ b/trunk/drivers/char/tpm/tpm.h @@ -329,15 +329,10 @@ extern int wait_for_tpm_stat(struct tpm_chip *, u8, unsigned long, wait_queue_head_t *); #ifdef CONFIG_ACPI -extern int tpm_add_ppi(struct kobject *); -extern void tpm_remove_ppi(struct kobject *); +extern ssize_t sys_add_ppi(struct kobject *parent); #else -static inline int tpm_add_ppi(struct kobject *parent) +static inline ssize_t sys_add_ppi(struct kobject *parent) { return 0; } - -static inline void tpm_remove_ppi(struct kobject *parent) -{ -} #endif diff --git a/trunk/drivers/char/tpm/tpm_ppi.c b/trunk/drivers/char/tpm/tpm_ppi.c index 720ebcf29fdf..f27b58cfae98 100644 --- a/trunk/drivers/char/tpm/tpm_ppi.c +++ b/trunk/drivers/char/tpm/tpm_ppi.c @@ -444,20 +444,18 @@ static struct attribute *ppi_attrs[] = { &dev_attr_vs_operations.attr, NULL, }; static struct attribute_group ppi_attr_grp = { - .name = "ppi", .attrs = ppi_attrs }; -int tpm_add_ppi(struct kobject *parent) +ssize_t sys_add_ppi(struct kobject *parent) { - return sysfs_create_group(parent, &ppi_attr_grp); -} -EXPORT_SYMBOL_GPL(tpm_add_ppi); - -void tpm_remove_ppi(struct kobject *parent) -{ - sysfs_remove_group(parent, &ppi_attr_grp); + struct kobject *ppi; + ppi = kobject_create_and_add("ppi", parent); + if (sysfs_create_group(ppi, &ppi_attr_grp)) + return -EFAULT; + else + return 0; } -EXPORT_SYMBOL_GPL(tpm_remove_ppi); +EXPORT_SYMBOL_GPL(sys_add_ppi); MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/cpuidle/cpuidle.c b/trunk/drivers/cpuidle/cpuidle.c index 7f15b8514a18..e28f6ea46f1a 100644 --- a/trunk/drivers/cpuidle/cpuidle.c +++ b/trunk/drivers/cpuidle/cpuidle.c @@ -368,7 +368,7 @@ EXPORT_SYMBOL_GPL(cpuidle_enable_device); */ void cpuidle_disable_device(struct cpuidle_device *dev) { - if (!dev || !dev->enabled) + if (!dev->enabled) return; if (!cpuidle_get_driver() || !cpuidle_curr_governor) return; diff --git a/trunk/drivers/hwmon/Kconfig b/trunk/drivers/hwmon/Kconfig index c4633de64465..c74e73b2069a 100644 --- a/trunk/drivers/hwmon/Kconfig +++ b/trunk/drivers/hwmon/Kconfig @@ -334,6 +334,16 @@ config SENSORS_DA9052_ADC This driver can also be built as module. If so, the module will be called da9052-hwmon. +config SENSORS_EXYNOS4_TMU + tristate "Temperature sensor on Samsung EXYNOS4" + depends on ARCH_EXYNOS4 + help + If you say yes here you get support for TMU (Thermal Management + Unit) on SAMSUNG EXYNOS4 series of SoC. + + This driver can also be built as a module. If so, the module + will be called exynos4-tmu. + config SENSORS_I5K_AMB tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets" depends on PCI diff --git a/trunk/drivers/hwmon/Makefile b/trunk/drivers/hwmon/Makefile index 8d5fcb5e8e9f..a62ce17ddbfc 100644 --- a/trunk/drivers/hwmon/Makefile +++ b/trunk/drivers/hwmon/Makefile @@ -50,6 +50,7 @@ obj-$(CONFIG_SENSORS_DS1621) += ds1621.o obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o +obj-$(CONFIG_SENSORS_EXYNOS4_TMU) += exynos4_tmu.o obj-$(CONFIG_SENSORS_F71805F) += f71805f.o obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o obj-$(CONFIG_SENSORS_F75375S) += f75375s.o diff --git a/trunk/drivers/hwmon/exynos4_tmu.c b/trunk/drivers/hwmon/exynos4_tmu.c new file mode 100644 index 000000000000..e912059140cd --- /dev/null +++ b/trunk/drivers/hwmon/exynos4_tmu.c @@ -0,0 +1,518 @@ +/* + * exynos4_tmu.c - Samsung EXYNOS4 TMU (Thermal Management Unit) + * + * Copyright (C) 2011 Samsung Electronics + * Donggeun Kim + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define EXYNOS4_TMU_REG_TRIMINFO 0x0 +#define EXYNOS4_TMU_REG_CONTROL 0x20 +#define EXYNOS4_TMU_REG_STATUS 0x28 +#define EXYNOS4_TMU_REG_CURRENT_TEMP 0x40 +#define EXYNOS4_TMU_REG_THRESHOLD_TEMP 0x44 +#define EXYNOS4_TMU_REG_TRIG_LEVEL0 0x50 +#define EXYNOS4_TMU_REG_TRIG_LEVEL1 0x54 +#define EXYNOS4_TMU_REG_TRIG_LEVEL2 0x58 +#define EXYNOS4_TMU_REG_TRIG_LEVEL3 0x5C +#define EXYNOS4_TMU_REG_PAST_TEMP0 0x60 +#define EXYNOS4_TMU_REG_PAST_TEMP1 0x64 +#define EXYNOS4_TMU_REG_PAST_TEMP2 0x68 +#define EXYNOS4_TMU_REG_PAST_TEMP3 0x6C +#define EXYNOS4_TMU_REG_INTEN 0x70 +#define EXYNOS4_TMU_REG_INTSTAT 0x74 +#define EXYNOS4_TMU_REG_INTCLEAR 0x78 + +#define EXYNOS4_TMU_GAIN_SHIFT 8 +#define EXYNOS4_TMU_REF_VOLTAGE_SHIFT 24 + +#define EXYNOS4_TMU_TRIM_TEMP_MASK 0xff +#define EXYNOS4_TMU_CORE_ON 3 +#define EXYNOS4_TMU_CORE_OFF 2 +#define EXYNOS4_TMU_DEF_CODE_TO_TEMP_OFFSET 50 +#define EXYNOS4_TMU_TRIG_LEVEL0_MASK 0x1 +#define EXYNOS4_TMU_TRIG_LEVEL1_MASK 0x10 +#define EXYNOS4_TMU_TRIG_LEVEL2_MASK 0x100 +#define EXYNOS4_TMU_TRIG_LEVEL3_MASK 0x1000 +#define EXYNOS4_TMU_INTCLEAR_VAL 0x1111 + +struct exynos4_tmu_data { + struct exynos4_tmu_platform_data *pdata; + struct device *hwmon_dev; + struct resource *mem; + void __iomem *base; + int irq; + struct work_struct irq_work; + struct mutex lock; + struct clk *clk; + u8 temp_error1, temp_error2; +}; + +/* + * TMU treats temperature as a mapped temperature code. + * The temperature is converted differently depending on the calibration type. + */ +static int temp_to_code(struct exynos4_tmu_data *data, u8 temp) +{ + struct exynos4_tmu_platform_data *pdata = data->pdata; + int temp_code; + + /* temp should range between 25 and 125 */ + if (temp < 25 || temp > 125) { + temp_code = -EINVAL; + goto out; + } + + switch (pdata->cal_type) { + case TYPE_TWO_POINT_TRIMMING: + temp_code = (temp - 25) * + (data->temp_error2 - data->temp_error1) / + (85 - 25) + data->temp_error1; + break; + case TYPE_ONE_POINT_TRIMMING: + temp_code = temp + data->temp_error1 - 25; + break; + default: + temp_code = temp + EXYNOS4_TMU_DEF_CODE_TO_TEMP_OFFSET; + break; + } +out: + return temp_code; +} + +/* + * Calculate a temperature value from a temperature code. + * The unit of the temperature is degree Celsius. + */ +static int code_to_temp(struct exynos4_tmu_data *data, u8 temp_code) +{ + struct exynos4_tmu_platform_data *pdata = data->pdata; + int temp; + + /* temp_code should range between 75 and 175 */ + if (temp_code < 75 || temp_code > 175) { + temp = -ENODATA; + goto out; + } + + switch (pdata->cal_type) { + case TYPE_TWO_POINT_TRIMMING: + temp = (temp_code - data->temp_error1) * (85 - 25) / + (data->temp_error2 - data->temp_error1) + 25; + break; + case TYPE_ONE_POINT_TRIMMING: + temp = temp_code - data->temp_error1 + 25; + break; + default: + temp = temp_code - EXYNOS4_TMU_DEF_CODE_TO_TEMP_OFFSET; + break; + } +out: + return temp; +} + +static int exynos4_tmu_initialize(struct platform_device *pdev) +{ + struct exynos4_tmu_data *data = platform_get_drvdata(pdev); + struct exynos4_tmu_platform_data *pdata = data->pdata; + unsigned int status, trim_info; + int ret = 0, threshold_code; + + mutex_lock(&data->lock); + clk_enable(data->clk); + + status = readb(data->base + EXYNOS4_TMU_REG_STATUS); + if (!status) { + ret = -EBUSY; + goto out; + } + + /* Save trimming info in order to perform calibration */ + trim_info = readl(data->base + EXYNOS4_TMU_REG_TRIMINFO); + data->temp_error1 = trim_info & EXYNOS4_TMU_TRIM_TEMP_MASK; + data->temp_error2 = ((trim_info >> 8) & EXYNOS4_TMU_TRIM_TEMP_MASK); + + /* Write temperature code for threshold */ + threshold_code = temp_to_code(data, pdata->threshold); + if (threshold_code < 0) { + ret = threshold_code; + goto out; + } + writeb(threshold_code, + data->base + EXYNOS4_TMU_REG_THRESHOLD_TEMP); + + writeb(pdata->trigger_levels[0], + data->base + EXYNOS4_TMU_REG_TRIG_LEVEL0); + writeb(pdata->trigger_levels[1], + data->base + EXYNOS4_TMU_REG_TRIG_LEVEL1); + writeb(pdata->trigger_levels[2], + data->base + EXYNOS4_TMU_REG_TRIG_LEVEL2); + writeb(pdata->trigger_levels[3], + data->base + EXYNOS4_TMU_REG_TRIG_LEVEL3); + + writel(EXYNOS4_TMU_INTCLEAR_VAL, + data->base + EXYNOS4_TMU_REG_INTCLEAR); +out: + clk_disable(data->clk); + mutex_unlock(&data->lock); + + return ret; +} + +static void exynos4_tmu_control(struct platform_device *pdev, bool on) +{ + struct exynos4_tmu_data *data = platform_get_drvdata(pdev); + struct exynos4_tmu_platform_data *pdata = data->pdata; + unsigned int con, interrupt_en; + + mutex_lock(&data->lock); + clk_enable(data->clk); + + con = pdata->reference_voltage << EXYNOS4_TMU_REF_VOLTAGE_SHIFT | + pdata->gain << EXYNOS4_TMU_GAIN_SHIFT; + if (on) { + con |= EXYNOS4_TMU_CORE_ON; + interrupt_en = pdata->trigger_level3_en << 12 | + pdata->trigger_level2_en << 8 | + pdata->trigger_level1_en << 4 | + pdata->trigger_level0_en; + } else { + con |= EXYNOS4_TMU_CORE_OFF; + interrupt_en = 0; /* Disable all interrupts */ + } + writel(interrupt_en, data->base + EXYNOS4_TMU_REG_INTEN); + writel(con, data->base + EXYNOS4_TMU_REG_CONTROL); + + clk_disable(data->clk); + mutex_unlock(&data->lock); +} + +static int exynos4_tmu_read(struct exynos4_tmu_data *data) +{ + u8 temp_code; + int temp; + + mutex_lock(&data->lock); + clk_enable(data->clk); + + temp_code = readb(data->base + EXYNOS4_TMU_REG_CURRENT_TEMP); + temp = code_to_temp(data, temp_code); + + clk_disable(data->clk); + mutex_unlock(&data->lock); + + return temp; +} + +static void exynos4_tmu_work(struct work_struct *work) +{ + struct exynos4_tmu_data *data = container_of(work, + struct exynos4_tmu_data, irq_work); + + mutex_lock(&data->lock); + clk_enable(data->clk); + + writel(EXYNOS4_TMU_INTCLEAR_VAL, data->base + EXYNOS4_TMU_REG_INTCLEAR); + + kobject_uevent(&data->hwmon_dev->kobj, KOBJ_CHANGE); + + enable_irq(data->irq); + + clk_disable(data->clk); + mutex_unlock(&data->lock); +} + +static irqreturn_t exynos4_tmu_irq(int irq, void *id) +{ + struct exynos4_tmu_data *data = id; + + disable_irq_nosync(irq); + schedule_work(&data->irq_work); + + return IRQ_HANDLED; +} + +static ssize_t exynos4_tmu_show_name(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "exynos4-tmu\n"); +} + +static ssize_t exynos4_tmu_show_temp(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct exynos4_tmu_data *data = dev_get_drvdata(dev); + int ret; + + ret = exynos4_tmu_read(data); + if (ret < 0) + return ret; + + /* convert from degree Celsius to millidegree Celsius */ + return sprintf(buf, "%d\n", ret * 1000); +} + +static ssize_t exynos4_tmu_show_alarm(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct exynos4_tmu_data *data = dev_get_drvdata(dev); + struct exynos4_tmu_platform_data *pdata = data->pdata; + int temp; + unsigned int trigger_level; + + temp = exynos4_tmu_read(data); + if (temp < 0) + return temp; + + trigger_level = pdata->threshold + pdata->trigger_levels[attr->index]; + + return sprintf(buf, "%d\n", !!(temp > trigger_level)); +} + +static ssize_t exynos4_tmu_show_level(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct exynos4_tmu_data *data = dev_get_drvdata(dev); + struct exynos4_tmu_platform_data *pdata = data->pdata; + unsigned int temp = pdata->threshold + + pdata->trigger_levels[attr->index]; + + return sprintf(buf, "%u\n", temp * 1000); +} + +static DEVICE_ATTR(name, S_IRUGO, exynos4_tmu_show_name, NULL); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, exynos4_tmu_show_temp, NULL, 0); + +static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, + exynos4_tmu_show_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, + exynos4_tmu_show_alarm, NULL, 2); +static SENSOR_DEVICE_ATTR(temp1_emergency_alarm, S_IRUGO, + exynos4_tmu_show_alarm, NULL, 3); + +static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, exynos4_tmu_show_level, NULL, 1); +static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, exynos4_tmu_show_level, NULL, 2); +static SENSOR_DEVICE_ATTR(temp1_emergency, S_IRUGO, + exynos4_tmu_show_level, NULL, 3); + +static struct attribute *exynos4_tmu_attributes[] = { + &dev_attr_name.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_emergency_alarm.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_crit.dev_attr.attr, + &sensor_dev_attr_temp1_emergency.dev_attr.attr, + NULL, +}; + +static const struct attribute_group exynos4_tmu_attr_group = { + .attrs = exynos4_tmu_attributes, +}; + +static int __devinit exynos4_tmu_probe(struct platform_device *pdev) +{ + struct exynos4_tmu_data *data; + struct exynos4_tmu_platform_data *pdata = pdev->dev.platform_data; + int ret; + + if (!pdata) { + dev_err(&pdev->dev, "No platform init data supplied.\n"); + return -ENODEV; + } + + data = kzalloc(sizeof(struct exynos4_tmu_data), GFP_KERNEL); + if (!data) { + dev_err(&pdev->dev, "Failed to allocate driver structure\n"); + return -ENOMEM; + } + + data->irq = platform_get_irq(pdev, 0); + if (data->irq < 0) { + ret = data->irq; + dev_err(&pdev->dev, "Failed to get platform irq\n"); + goto err_free; + } + + INIT_WORK(&data->irq_work, exynos4_tmu_work); + + data->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!data->mem) { + ret = -ENOENT; + dev_err(&pdev->dev, "Failed to get platform resource\n"); + goto err_free; + } + + data->mem = request_mem_region(data->mem->start, + resource_size(data->mem), pdev->name); + if (!data->mem) { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to request memory region\n"); + goto err_free; + } + + data->base = ioremap(data->mem->start, resource_size(data->mem)); + if (!data->base) { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to ioremap memory\n"); + goto err_mem_region; + } + + ret = request_irq(data->irq, exynos4_tmu_irq, + IRQF_TRIGGER_RISING, + "exynos4-tmu", data); + if (ret) { + dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); + goto err_io_remap; + } + + data->clk = clk_get(NULL, "tmu_apbif"); + if (IS_ERR(data->clk)) { + ret = PTR_ERR(data->clk); + dev_err(&pdev->dev, "Failed to get clock\n"); + goto err_irq; + } + + data->pdata = pdata; + platform_set_drvdata(pdev, data); + mutex_init(&data->lock); + + ret = exynos4_tmu_initialize(pdev); + if (ret) { + dev_err(&pdev->dev, "Failed to initialize TMU\n"); + goto err_clk; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &exynos4_tmu_attr_group); + if (ret) { + dev_err(&pdev->dev, "Failed to create sysfs group\n"); + goto err_clk; + } + + data->hwmon_dev = hwmon_device_register(&pdev->dev); + if (IS_ERR(data->hwmon_dev)) { + ret = PTR_ERR(data->hwmon_dev); + dev_err(&pdev->dev, "Failed to register hwmon device\n"); + goto err_create_group; + } + + exynos4_tmu_control(pdev, true); + + return 0; + +err_create_group: + sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group); +err_clk: + platform_set_drvdata(pdev, NULL); + clk_put(data->clk); +err_irq: + free_irq(data->irq, data); +err_io_remap: + iounmap(data->base); +err_mem_region: + release_mem_region(data->mem->start, resource_size(data->mem)); +err_free: + kfree(data); + + return ret; +} + +static int __devexit exynos4_tmu_remove(struct platform_device *pdev) +{ + struct exynos4_tmu_data *data = platform_get_drvdata(pdev); + + exynos4_tmu_control(pdev, false); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group); + + clk_put(data->clk); + + free_irq(data->irq, data); + + iounmap(data->base); + release_mem_region(data->mem->start, resource_size(data->mem)); + + platform_set_drvdata(pdev, NULL); + + kfree(data); + + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int exynos4_tmu_suspend(struct device *dev) +{ + exynos4_tmu_control(to_platform_device(dev), false); + + return 0; +} + +static int exynos4_tmu_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + + exynos4_tmu_initialize(pdev); + exynos4_tmu_control(pdev, true); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm, + exynos4_tmu_suspend, exynos4_tmu_resume); +#define EXYNOS4_TMU_PM &exynos4_tmu_pm +#else +#define EXYNOS4_TMU_PM NULL +#endif + +static struct platform_driver exynos4_tmu_driver = { + .driver = { + .name = "exynos4-tmu", + .owner = THIS_MODULE, + .pm = EXYNOS4_TMU_PM, + }, + .probe = exynos4_tmu_probe, + .remove = __devexit_p(exynos4_tmu_remove), +}; + +module_platform_driver(exynos4_tmu_driver); + +MODULE_DESCRIPTION("EXYNOS4 TMU Driver"); +MODULE_AUTHOR("Donggeun Kim "); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:exynos4-tmu"); diff --git a/trunk/drivers/input/evdev.c b/trunk/drivers/input/evdev.c index 6ae2ac47c9c8..118d0300f1fb 100644 --- a/trunk/drivers/input/evdev.c +++ b/trunk/drivers/input/evdev.c @@ -23,11 +23,11 @@ #include #include #include -#include #include "input-compat.h" struct evdev { int open; + int minor; struct input_handle handle; wait_queue_head_t wait; struct evdev_client __rcu *grab; @@ -35,7 +35,6 @@ struct evdev { spinlock_t client_lock; /* protects client_list */ struct mutex mutex; struct device dev; - struct cdev cdev; bool exist; }; @@ -52,6 +51,9 @@ struct evdev_client { struct input_event buffer[]; }; +static struct evdev *evdev_table[EVDEV_MINORS]; +static DEFINE_MUTEX(evdev_table_mutex); + static void __pass_event(struct evdev_client *client, const struct input_event *event) { @@ -308,16 +310,35 @@ static unsigned int evdev_compute_buffer_size(struct input_dev *dev) static int evdev_open(struct inode *inode, struct file *file) { - struct evdev *evdev = container_of(inode->i_cdev, struct evdev, cdev); - unsigned int bufsize = evdev_compute_buffer_size(evdev->handle.dev); + struct evdev *evdev; struct evdev_client *client; + int i = iminor(inode) - EVDEV_MINOR_BASE; + unsigned int bufsize; int error; + if (i >= EVDEV_MINORS) + return -ENODEV; + + error = mutex_lock_interruptible(&evdev_table_mutex); + if (error) + return error; + evdev = evdev_table[i]; + if (evdev) + get_device(&evdev->dev); + mutex_unlock(&evdev_table_mutex); + + if (!evdev) + return -ENODEV; + + bufsize = evdev_compute_buffer_size(evdev->handle.dev); + client = kzalloc(sizeof(struct evdev_client) + bufsize * sizeof(struct input_event), GFP_KERNEL); - if (!client) - return -ENOMEM; + if (!client) { + error = -ENOMEM; + goto err_put_evdev; + } client->bufsize = bufsize; spin_lock_init(&client->buffer_lock); @@ -331,12 +352,13 @@ static int evdev_open(struct inode *inode, struct file *file) file->private_data = client; nonseekable_open(inode, file); - get_device(&evdev->dev); return 0; err_free_client: evdev_detach_client(evdev, client); kfree(client); + err_put_evdev: + put_device(&evdev->dev); return error; } @@ -920,6 +942,26 @@ static const struct file_operations evdev_fops = { .llseek = no_llseek, }; +static int evdev_install_chrdev(struct evdev *evdev) +{ + /* + * No need to do any locking here as calls to connect and + * disconnect are serialized by the input core + */ + evdev_table[evdev->minor] = evdev; + return 0; +} + +static void evdev_remove_chrdev(struct evdev *evdev) +{ + /* + * Lock evdev table to prevent race with evdev_open() + */ + mutex_lock(&evdev_table_mutex); + evdev_table[evdev->minor] = NULL; + mutex_unlock(&evdev_table_mutex); +} + /* * Mark device non-existent. This disables writes, ioctls and * prevents new users from opening the device. Already posted @@ -938,8 +980,7 @@ static void evdev_cleanup(struct evdev *evdev) evdev_mark_dead(evdev); evdev_hangup(evdev); - - cdev_del(&evdev->cdev); + evdev_remove_chrdev(evdev); /* evdev is marked dead so no one else accesses evdev->open */ if (evdev->open) { @@ -950,47 +991,43 @@ static void evdev_cleanup(struct evdev *evdev) /* * Create new evdev device. Note that input core serializes calls - * to connect and disconnect. + * to connect and disconnect so we don't need to lock evdev_table here. */ static int evdev_connect(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id) { struct evdev *evdev; int minor; - int dev_no; int error; - minor = input_get_new_minor(EVDEV_MINOR_BASE, EVDEV_MINORS, true); - if (minor < 0) { - error = minor; - pr_err("failed to reserve new minor: %d\n", error); - return error; + for (minor = 0; minor < EVDEV_MINORS; minor++) + if (!evdev_table[minor]) + break; + + if (minor == EVDEV_MINORS) { + pr_err("no more free evdev devices\n"); + return -ENFILE; } evdev = kzalloc(sizeof(struct evdev), GFP_KERNEL); - if (!evdev) { - error = -ENOMEM; - goto err_free_minor; - } + if (!evdev) + return -ENOMEM; INIT_LIST_HEAD(&evdev->client_list); spin_lock_init(&evdev->client_lock); mutex_init(&evdev->mutex); init_waitqueue_head(&evdev->wait); - evdev->exist = true; - dev_no = minor; - /* Normalize device number if it falls into legacy range */ - if (dev_no < EVDEV_MINOR_BASE + EVDEV_MINORS) - dev_no -= EVDEV_MINOR_BASE; - dev_set_name(&evdev->dev, "event%d", dev_no); + dev_set_name(&evdev->dev, "event%d", minor); + evdev->exist = true; + evdev->minor = minor; evdev->handle.dev = input_get_device(dev); evdev->handle.name = dev_name(&evdev->dev); evdev->handle.handler = handler; evdev->handle.private = evdev; - evdev->dev.devt = MKDEV(INPUT_MAJOR, minor); + evdev->dev.devt = MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor); evdev->dev.class = &input_class; evdev->dev.parent = &dev->dev; evdev->dev.release = evdev_free; @@ -1000,8 +1037,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev, if (error) goto err_free_evdev; - cdev_init(&evdev->cdev, &evdev_fops); - error = cdev_add(&evdev->cdev, evdev->dev.devt, 1); + error = evdev_install_chrdev(evdev); if (error) goto err_unregister_handle; @@ -1017,8 +1053,6 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev, input_unregister_handle(&evdev->handle); err_free_evdev: put_device(&evdev->dev); - err_free_minor: - input_free_minor(minor); return error; } @@ -1028,7 +1062,6 @@ static void evdev_disconnect(struct input_handle *handle) device_del(&evdev->dev); evdev_cleanup(evdev); - input_free_minor(MINOR(evdev->dev.devt)); input_unregister_handle(handle); put_device(&evdev->dev); } @@ -1045,7 +1078,7 @@ static struct input_handler evdev_handler = { .events = evdev_events, .connect = evdev_connect, .disconnect = evdev_disconnect, - .legacy_minors = true, + .fops = &evdev_fops, .minor = EVDEV_MINOR_BASE, .name = "evdev", .id_table = evdev_ids, diff --git a/trunk/drivers/input/input.c b/trunk/drivers/input/input.c index 53a0ddee7872..ace3f7c4226d 100644 --- a/trunk/drivers/input/input.c +++ b/trunk/drivers/input/input.c @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -33,9 +32,7 @@ MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Input core"); MODULE_LICENSE("GPL"); -#define INPUT_MAX_CHAR_DEVICES 1024 -#define INPUT_FIRST_DYNAMIC_DEV 256 -static DEFINE_IDA(input_ida); +#define INPUT_DEVICES 256 static LIST_HEAD(input_dev_list); static LIST_HEAD(input_handler_list); @@ -48,6 +45,8 @@ static LIST_HEAD(input_handler_list); */ static DEFINE_MUTEX(input_mutex); +static struct input_handler *input_table[8]; + static const struct input_value input_value_sync = { EV_SYN, SYN_REPORT, 1 }; static inline int is_event_supported(unsigned int code, @@ -1219,7 +1218,7 @@ static int input_handlers_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "N: Number=%u Name=%s", state->pos, handler->name); if (handler->filter) seq_puts(seq, " (filter)"); - if (handler->legacy_minors) + if (handler->fops) seq_printf(seq, " Minor=%d", handler->minor); seq_putc(seq, '\n'); @@ -2017,14 +2016,22 @@ EXPORT_SYMBOL(input_unregister_device); int input_register_handler(struct input_handler *handler) { struct input_dev *dev; - int error; + int retval; - error = mutex_lock_interruptible(&input_mutex); - if (error) - return error; + retval = mutex_lock_interruptible(&input_mutex); + if (retval) + return retval; INIT_LIST_HEAD(&handler->h_list); + if (handler->fops != NULL) { + if (input_table[handler->minor >> 5]) { + retval = -EBUSY; + goto out; + } + input_table[handler->minor >> 5] = handler; + } + list_add_tail(&handler->node, &input_handler_list); list_for_each_entry(dev, &input_dev_list, node) @@ -2032,8 +2039,9 @@ int input_register_handler(struct input_handler *handler) input_wakeup_procfs_readers(); + out: mutex_unlock(&input_mutex); - return 0; + return retval; } EXPORT_SYMBOL(input_register_handler); @@ -2056,6 +2064,9 @@ void input_unregister_handler(struct input_handler *handler) list_del_init(&handler->node); + if (handler->fops != NULL) + input_table[handler->minor >> 5] = NULL; + input_wakeup_procfs_readers(); mutex_unlock(&input_mutex); @@ -2172,52 +2183,51 @@ void input_unregister_handle(struct input_handle *handle) } EXPORT_SYMBOL(input_unregister_handle); -/** - * input_get_new_minor - allocates a new input minor number - * @legacy_base: beginning or the legacy range to be searched - * @legacy_num: size of legacy range - * @allow_dynamic: whether we can also take ID from the dynamic range - * - * This function allocates a new device minor for from input major namespace. - * Caller can request legacy minor by specifying @legacy_base and @legacy_num - * parameters and whether ID can be allocated from dynamic range if there are - * no free IDs in legacy range. - */ -int input_get_new_minor(int legacy_base, unsigned int legacy_num, - bool allow_dynamic) +static int input_open_file(struct inode *inode, struct file *file) { + struct input_handler *handler; + const struct file_operations *old_fops, *new_fops = NULL; + int err; + + err = mutex_lock_interruptible(&input_mutex); + if (err) + return err; + + /* No load-on-demand here? */ + handler = input_table[iminor(inode) >> 5]; + if (handler) + new_fops = fops_get(handler->fops); + + mutex_unlock(&input_mutex); + /* - * This function should be called from input handler's ->connect() - * methods, which are serialized with input_mutex, so no additional - * locking is needed here. + * That's _really_ odd. Usually NULL ->open means "nothing special", + * not "no device". Oh, well... */ - if (legacy_base >= 0) { - int minor = ida_simple_get(&input_ida, - legacy_base, - legacy_base + legacy_num, - GFP_KERNEL); - if (minor >= 0 || !allow_dynamic) - return minor; + if (!new_fops || !new_fops->open) { + fops_put(new_fops); + err = -ENODEV; + goto out; } - return ida_simple_get(&input_ida, - INPUT_FIRST_DYNAMIC_DEV, INPUT_MAX_CHAR_DEVICES, - GFP_KERNEL); -} -EXPORT_SYMBOL(input_get_new_minor); + old_fops = file->f_op; + file->f_op = new_fops; -/** - * input_free_minor - release previously allocated minor - * @minor: minor to be released - * - * This function releases previously allocated input minor so that it can be - * reused later. - */ -void input_free_minor(unsigned int minor) -{ - ida_simple_remove(&input_ida, minor); + err = new_fops->open(inode, file); + if (err) { + fops_put(file->f_op); + file->f_op = fops_get(old_fops); + } + fops_put(old_fops); +out: + return err; } -EXPORT_SYMBOL(input_free_minor); + +static const struct file_operations input_fops = { + .owner = THIS_MODULE, + .open = input_open_file, + .llseek = noop_llseek, +}; static int __init input_init(void) { @@ -2233,8 +2243,7 @@ static int __init input_init(void) if (err) goto fail1; - err = register_chrdev_region(MKDEV(INPUT_MAJOR, 0), - INPUT_MAX_CHAR_DEVICES, "input"); + err = register_chrdev(INPUT_MAJOR, "input", &input_fops); if (err) { pr_err("unable to register char major %d", INPUT_MAJOR); goto fail2; @@ -2250,8 +2259,7 @@ static int __init input_init(void) static void __exit input_exit(void) { input_proc_exit(); - unregister_chrdev_region(MKDEV(INPUT_MAJOR, 0), - INPUT_MAX_CHAR_DEVICES); + unregister_chrdev(INPUT_MAJOR, "input"); class_unregister(&input_class); } diff --git a/trunk/drivers/input/joydev.c b/trunk/drivers/input/joydev.c index b62b5891f399..78f323ea1e4b 100644 --- a/trunk/drivers/input/joydev.c +++ b/trunk/drivers/input/joydev.c @@ -27,7 +27,6 @@ #include #include #include -#include MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Joystick device interfaces"); @@ -40,13 +39,13 @@ MODULE_LICENSE("GPL"); struct joydev { int open; + int minor; struct input_handle handle; wait_queue_head_t wait; struct list_head client_list; spinlock_t client_lock; /* protects client_list */ struct mutex mutex; struct device dev; - struct cdev cdev; bool exist; struct js_corr corr[ABS_CNT]; @@ -71,6 +70,9 @@ struct joydev_client { struct list_head node; }; +static struct joydev *joydev_table[JOYDEV_MINORS]; +static DEFINE_MUTEX(joydev_table_mutex); + static int joydev_correct(int value, struct js_corr *corr) { switch (corr->type) { @@ -250,14 +252,30 @@ static int joydev_release(struct inode *inode, struct file *file) static int joydev_open(struct inode *inode, struct file *file) { - struct joydev *joydev = - container_of(inode->i_cdev, struct joydev, cdev); struct joydev_client *client; + struct joydev *joydev; + int i = iminor(inode) - JOYDEV_MINOR_BASE; int error; + if (i >= JOYDEV_MINORS) + return -ENODEV; + + error = mutex_lock_interruptible(&joydev_table_mutex); + if (error) + return error; + joydev = joydev_table[i]; + if (joydev) + get_device(&joydev->dev); + mutex_unlock(&joydev_table_mutex); + + if (!joydev) + return -ENODEV; + client = kzalloc(sizeof(struct joydev_client), GFP_KERNEL); - if (!client) - return -ENOMEM; + if (!client) { + error = -ENOMEM; + goto err_put_joydev; + } spin_lock_init(&client->buffer_lock); client->joydev = joydev; @@ -270,12 +288,13 @@ static int joydev_open(struct inode *inode, struct file *file) file->private_data = client; nonseekable_open(inode, file); - get_device(&joydev->dev); return 0; err_free_client: joydev_detach_client(joydev, client); kfree(client); + err_put_joydev: + put_device(&joydev->dev); return error; } @@ -723,6 +742,19 @@ static const struct file_operations joydev_fops = { .llseek = no_llseek, }; +static int joydev_install_chrdev(struct joydev *joydev) +{ + joydev_table[joydev->minor] = joydev; + return 0; +} + +static void joydev_remove_chrdev(struct joydev *joydev) +{ + mutex_lock(&joydev_table_mutex); + joydev_table[joydev->minor] = NULL; + mutex_unlock(&joydev_table_mutex); +} + /* * Mark device non-existent. This disables writes, ioctls and * prevents new users from opening the device. Already posted @@ -741,8 +773,7 @@ static void joydev_cleanup(struct joydev *joydev) joydev_mark_dead(joydev); joydev_hangup(joydev); - - cdev_del(&joydev->cdev); + joydev_remove_chrdev(joydev); /* joydev is marked dead so no one else accesses joydev->open */ if (joydev->open) @@ -767,33 +798,30 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id) { struct joydev *joydev; - int i, j, t, minor, dev_no; + int i, j, t, minor; int error; - minor = input_get_new_minor(JOYDEV_MINOR_BASE, JOYDEV_MINORS, true); - if (minor < 0) { - error = minor; - pr_err("failed to reserve new minor: %d\n", error); - return error; + for (minor = 0; minor < JOYDEV_MINORS; minor++) + if (!joydev_table[minor]) + break; + + if (minor == JOYDEV_MINORS) { + pr_err("no more free joydev devices\n"); + return -ENFILE; } joydev = kzalloc(sizeof(struct joydev), GFP_KERNEL); - if (!joydev) { - error = -ENOMEM; - goto err_free_minor; - } + if (!joydev) + return -ENOMEM; INIT_LIST_HEAD(&joydev->client_list); spin_lock_init(&joydev->client_lock); mutex_init(&joydev->mutex); init_waitqueue_head(&joydev->wait); - joydev->exist = true; - dev_no = minor; - /* Normalize device number if it falls into legacy range */ - if (dev_no < JOYDEV_MINOR_BASE + JOYDEV_MINORS) - dev_no -= JOYDEV_MINOR_BASE; - dev_set_name(&joydev->dev, "js%d", dev_no); + dev_set_name(&joydev->dev, "js%d", minor); + joydev->exist = true; + joydev->minor = minor; joydev->handle.dev = input_get_device(dev); joydev->handle.name = dev_name(&joydev->dev); @@ -847,7 +875,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, } } - joydev->dev.devt = MKDEV(INPUT_MAJOR, minor); + joydev->dev.devt = MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor); joydev->dev.class = &input_class; joydev->dev.parent = &dev->dev; joydev->dev.release = joydev_free; @@ -857,8 +885,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, if (error) goto err_free_joydev; - cdev_init(&joydev->cdev, &joydev_fops); - error = cdev_add(&joydev->cdev, joydev->dev.devt, 1); + error = joydev_install_chrdev(joydev); if (error) goto err_unregister_handle; @@ -874,8 +901,6 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, input_unregister_handle(&joydev->handle); err_free_joydev: put_device(&joydev->dev); - err_free_minor: - input_free_minor(minor); return error; } @@ -885,7 +910,6 @@ static void joydev_disconnect(struct input_handle *handle) device_del(&joydev->dev); joydev_cleanup(joydev); - input_free_minor(MINOR(joydev->dev.devt)); input_unregister_handle(handle); put_device(&joydev->dev); } @@ -937,7 +961,7 @@ static struct input_handler joydev_handler = { .match = joydev_match, .connect = joydev_connect, .disconnect = joydev_disconnect, - .legacy_minors = true, + .fops = &joydev_fops, .minor = JOYDEV_MINOR_BASE, .name = "joydev", .id_table = joydev_ids, diff --git a/trunk/drivers/input/keyboard/samsung-keypad.c b/trunk/drivers/input/keyboard/samsung-keypad.c index 9d7a111486f7..277e26dc910e 100644 --- a/trunk/drivers/input/keyboard/samsung-keypad.c +++ b/trunk/drivers/input/keyboard/samsung-keypad.c @@ -431,12 +431,6 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) goto err_unmap_base; } - error = clk_prepare(keypad->clk); - if (error) { - dev_err(&pdev->dev, "keypad clock prepare failed\n"); - goto err_put_clk; - } - keypad->input_dev = input_dev; keypad->pdev = pdev; keypad->row_shift = row_shift; @@ -467,7 +461,7 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) keypad->keycodes, input_dev); if (error) { dev_err(&pdev->dev, "failed to build keymap\n"); - goto err_unprepare_clk; + goto err_put_clk; } input_set_capability(input_dev, EV_MSC, MSC_SCAN); @@ -509,8 +503,6 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); device_init_wakeup(&pdev->dev, 0); platform_set_drvdata(pdev, NULL); -err_unprepare_clk: - clk_unprepare(keypad->clk); err_put_clk: clk_put(keypad->clk); samsung_keypad_dt_gpio_free(keypad); @@ -539,7 +531,6 @@ static int __devexit samsung_keypad_remove(struct platform_device *pdev) */ free_irq(keypad->irq, keypad); - clk_unprepare(keypad->clk); clk_put(keypad->clk); samsung_keypad_dt_gpio_free(keypad); diff --git a/trunk/drivers/input/mousedev.c b/trunk/drivers/input/mousedev.c index a1b4c37956b2..964e43d81e29 100644 --- a/trunk/drivers/input/mousedev.c +++ b/trunk/drivers/input/mousedev.c @@ -24,8 +24,10 @@ #include #include #include -#include #include +#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX +#include +#endif MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces"); @@ -59,18 +61,17 @@ struct mousedev_hw_data { struct mousedev { int open; + int minor; struct input_handle handle; wait_queue_head_t wait; struct list_head client_list; spinlock_t client_lock; /* protects client_list */ struct mutex mutex; struct device dev; - struct cdev cdev; bool exist; - bool is_mixdev; struct list_head mixdev_node; - bool opened_by_mixdev; + int mixdev_open; struct mousedev_hw_data packet; unsigned int pkt_count; @@ -113,6 +114,10 @@ struct mousedev_client { static unsigned char mousedev_imps_seq[] = { 0xf3, 200, 0xf3, 100, 0xf3, 80 }; static unsigned char mousedev_imex_seq[] = { 0xf3, 200, 0xf3, 200, 0xf3, 80 }; +static struct input_handler mousedev_handler; + +static struct mousedev *mousedev_table[MOUSEDEV_MINORS]; +static DEFINE_MUTEX(mousedev_table_mutex); static struct mousedev *mousedev_mix; static LIST_HEAD(mousedev_mix_list); @@ -428,7 +433,7 @@ static int mousedev_open_device(struct mousedev *mousedev) if (retval) return retval; - if (mousedev->is_mixdev) + if (mousedev->minor == MOUSEDEV_MIX) mixdev_open_devices(); else if (!mousedev->exist) retval = -ENODEV; @@ -446,7 +451,7 @@ static void mousedev_close_device(struct mousedev *mousedev) { mutex_lock(&mousedev->mutex); - if (mousedev->is_mixdev) + if (mousedev->minor == MOUSEDEV_MIX) mixdev_close_devices(); else if (mousedev->exist && !--mousedev->open) input_close_device(&mousedev->handle); @@ -467,11 +472,11 @@ static void mixdev_open_devices(void) return; list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) { - if (!mousedev->opened_by_mixdev) { + if (!mousedev->mixdev_open) { if (mousedev_open_device(mousedev)) continue; - mousedev->opened_by_mixdev = true; + mousedev->mixdev_open = 1; } } } @@ -489,8 +494,8 @@ static void mixdev_close_devices(void) return; list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) { - if (mousedev->opened_by_mixdev) { - mousedev->opened_by_mixdev = false; + if (mousedev->mixdev_open) { + mousedev->mixdev_open = 0; mousedev_close_device(mousedev); } } @@ -533,17 +538,35 @@ static int mousedev_open(struct inode *inode, struct file *file) struct mousedev_client *client; struct mousedev *mousedev; int error; + int i; #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX if (imajor(inode) == MISC_MAJOR) - mousedev = mousedev_mix; + i = MOUSEDEV_MIX; else #endif - mousedev = container_of(inode->i_cdev, struct mousedev, cdev); + i = iminor(inode) - MOUSEDEV_MINOR_BASE; + + if (i >= MOUSEDEV_MINORS) + return -ENODEV; + + error = mutex_lock_interruptible(&mousedev_table_mutex); + if (error) + return error; + + mousedev = mousedev_table[i]; + if (mousedev) + get_device(&mousedev->dev); + mutex_unlock(&mousedev_table_mutex); + + if (!mousedev) + return -ENODEV; client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL); - if (!client) - return -ENOMEM; + if (!client) { + error = -ENOMEM; + goto err_put_mousedev; + } spin_lock_init(&client->packet_lock); client->pos_x = xres / 2; @@ -556,14 +579,13 @@ static int mousedev_open(struct inode *inode, struct file *file) goto err_free_client; file->private_data = client; - nonseekable_open(inode, file); - - get_device(&mousedev->dev); return 0; err_free_client: mousedev_detach_client(mousedev, client); kfree(client); + err_put_mousedev: + put_device(&mousedev->dev); return error; } @@ -763,16 +785,29 @@ static unsigned int mousedev_poll(struct file *file, poll_table *wait) } static const struct file_operations mousedev_fops = { - .owner = THIS_MODULE, - .read = mousedev_read, - .write = mousedev_write, - .poll = mousedev_poll, - .open = mousedev_open, - .release = mousedev_release, - .fasync = mousedev_fasync, - .llseek = noop_llseek, + .owner = THIS_MODULE, + .read = mousedev_read, + .write = mousedev_write, + .poll = mousedev_poll, + .open = mousedev_open, + .release = mousedev_release, + .fasync = mousedev_fasync, + .llseek = noop_llseek, }; +static int mousedev_install_chrdev(struct mousedev *mousedev) +{ + mousedev_table[mousedev->minor] = mousedev; + return 0; +} + +static void mousedev_remove_chrdev(struct mousedev *mousedev) +{ + mutex_lock(&mousedev_table_mutex); + mousedev_table[mousedev->minor] = NULL; + mutex_unlock(&mousedev_table_mutex); +} + /* * Mark device non-existent. This disables writes, ioctls and * prevents new users from opening the device. Already posted @@ -807,50 +842,24 @@ static void mousedev_cleanup(struct mousedev *mousedev) mousedev_mark_dead(mousedev); mousedev_hangup(mousedev); - - cdev_del(&mousedev->cdev); + mousedev_remove_chrdev(mousedev); /* mousedev is marked dead so no one else accesses mousedev->open */ if (mousedev->open) input_close_device(handle); } -static int mousedev_reserve_minor(bool mixdev) -{ - int minor; - - if (mixdev) { - minor = input_get_new_minor(MOUSEDEV_MIX, 1, false); - if (minor < 0) - pr_err("failed to reserve mixdev minor: %d\n", minor); - } else { - minor = input_get_new_minor(MOUSEDEV_MINOR_BASE, - MOUSEDEV_MINORS, true); - if (minor < 0) - pr_err("failed to reserve new minor: %d\n", minor); - } - - return minor; -} - static struct mousedev *mousedev_create(struct input_dev *dev, struct input_handler *handler, - bool mixdev) + int minor) { struct mousedev *mousedev; - int minor; int error; - minor = mousedev_reserve_minor(mixdev); - if (minor < 0) { - error = minor; - goto err_out; - } - mousedev = kzalloc(sizeof(struct mousedev), GFP_KERNEL); if (!mousedev) { error = -ENOMEM; - goto err_free_minor; + goto err_out; } INIT_LIST_HEAD(&mousedev->client_list); @@ -858,21 +867,16 @@ static struct mousedev *mousedev_create(struct input_dev *dev, spin_lock_init(&mousedev->client_lock); mutex_init(&mousedev->mutex); lockdep_set_subclass(&mousedev->mutex, - mixdev ? SINGLE_DEPTH_NESTING : 0); + minor == MOUSEDEV_MIX ? SINGLE_DEPTH_NESTING : 0); init_waitqueue_head(&mousedev->wait); - if (mixdev) { + if (minor == MOUSEDEV_MIX) dev_set_name(&mousedev->dev, "mice"); - } else { - int dev_no = minor; - /* Normalize device number if it falls into legacy range */ - if (dev_no < MOUSEDEV_MINOR_BASE + MOUSEDEV_MINORS) - dev_no -= MOUSEDEV_MINOR_BASE; - dev_set_name(&mousedev->dev, "mouse%d", dev_no); - } + else + dev_set_name(&mousedev->dev, "mouse%d", minor); + mousedev->minor = minor; mousedev->exist = true; - mousedev->is_mixdev = mixdev; mousedev->handle.dev = input_get_device(dev); mousedev->handle.name = dev_name(&mousedev->dev); mousedev->handle.handler = handler; @@ -881,18 +885,17 @@ static struct mousedev *mousedev_create(struct input_dev *dev, mousedev->dev.class = &input_class; if (dev) mousedev->dev.parent = &dev->dev; - mousedev->dev.devt = MKDEV(INPUT_MAJOR, minor); + mousedev->dev.devt = MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor); mousedev->dev.release = mousedev_free; device_initialize(&mousedev->dev); - if (!mixdev) { + if (minor != MOUSEDEV_MIX) { error = input_register_handle(&mousedev->handle); if (error) goto err_free_mousedev; } - cdev_init(&mousedev->cdev, &mousedev_fops); - error = cdev_add(&mousedev->cdev, mousedev->dev.devt, 1); + error = mousedev_install_chrdev(mousedev); if (error) goto err_unregister_handle; @@ -905,12 +908,10 @@ static struct mousedev *mousedev_create(struct input_dev *dev, err_cleanup_mousedev: mousedev_cleanup(mousedev); err_unregister_handle: - if (!mixdev) + if (minor != MOUSEDEV_MIX) input_unregister_handle(&mousedev->handle); err_free_mousedev: put_device(&mousedev->dev); - err_free_minor: - input_free_minor(minor); err_out: return ERR_PTR(error); } @@ -919,8 +920,7 @@ static void mousedev_destroy(struct mousedev *mousedev) { device_del(&mousedev->dev); mousedev_cleanup(mousedev); - input_free_minor(MINOR(mousedev->dev.devt)); - if (!mousedev->is_mixdev) + if (mousedev->minor != MOUSEDEV_MIX) input_unregister_handle(&mousedev->handle); put_device(&mousedev->dev); } @@ -938,7 +938,7 @@ static int mixdev_add_device(struct mousedev *mousedev) if (retval) goto out; - mousedev->opened_by_mixdev = true; + mousedev->mixdev_open = 1; } get_device(&mousedev->dev); @@ -953,8 +953,8 @@ static void mixdev_remove_device(struct mousedev *mousedev) { mutex_lock(&mousedev_mix->mutex); - if (mousedev->opened_by_mixdev) { - mousedev->opened_by_mixdev = false; + if (mousedev->mixdev_open) { + mousedev->mixdev_open = 0; mousedev_close_device(mousedev); } @@ -969,9 +969,19 @@ static int mousedev_connect(struct input_handler *handler, const struct input_device_id *id) { struct mousedev *mousedev; + int minor; int error; - mousedev = mousedev_create(dev, handler, false); + for (minor = 0; minor < MOUSEDEV_MINORS; minor++) + if (!mousedev_table[minor]) + break; + + if (minor == MOUSEDEV_MINORS) { + pr_err("no more free mousedev devices\n"); + return -ENFILE; + } + + mousedev = mousedev_create(dev, handler, minor); if (IS_ERR(mousedev)) return PTR_ERR(mousedev); @@ -1044,53 +1054,27 @@ static const struct input_device_id mousedev_ids[] = { MODULE_DEVICE_TABLE(input, mousedev_ids); static struct input_handler mousedev_handler = { - .event = mousedev_event, - .connect = mousedev_connect, - .disconnect = mousedev_disconnect, - .legacy_minors = true, - .minor = MOUSEDEV_MINOR_BASE, - .name = "mousedev", - .id_table = mousedev_ids, + .event = mousedev_event, + .connect = mousedev_connect, + .disconnect = mousedev_disconnect, + .fops = &mousedev_fops, + .minor = MOUSEDEV_MINOR_BASE, + .name = "mousedev", + .id_table = mousedev_ids, }; #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX -#include - static struct miscdevice psaux_mouse = { - .minor = PSMOUSE_MINOR, - .name = "psaux", - .fops = &mousedev_fops, + PSMOUSE_MINOR, "psaux", &mousedev_fops }; - -static bool psaux_registered; - -static void __init mousedev_psaux_register(void) -{ - int error; - - error = misc_register(&psaux_mouse); - if (error) - pr_warn("could not register psaux device, error: %d\n", - error); - else - psaux_registered = true; -} - -static void __exit mousedev_psaux_unregister(void) -{ - if (psaux_registered) - misc_deregister(&psaux_mouse); -} -#else -static inline void mousedev_psaux_register(void) { } -static inline void mousedev_psaux_unregister(void) { } +static int psaux_registered; #endif static int __init mousedev_init(void) { int error; - mousedev_mix = mousedev_create(NULL, &mousedev_handler, true); + mousedev_mix = mousedev_create(NULL, &mousedev_handler, MOUSEDEV_MIX); if (IS_ERR(mousedev_mix)) return PTR_ERR(mousedev_mix); @@ -1100,7 +1084,14 @@ static int __init mousedev_init(void) return error; } - mousedev_psaux_register(); +#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX + error = misc_register(&psaux_mouse); + if (error) + pr_warn("could not register psaux device, error: %d\n", + error); + else + psaux_registered = 1; +#endif pr_info("PS/2 mouse device common for all mice\n"); @@ -1109,7 +1100,10 @@ static int __init mousedev_init(void) static void __exit mousedev_exit(void) { - mousedev_psaux_unregister(); +#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX + if (psaux_registered) + misc_deregister(&psaux_mouse); +#endif input_unregister_handler(&mousedev_handler); mousedev_destroy(mousedev_mix); } diff --git a/trunk/drivers/input/tablet/wacom_sys.c b/trunk/drivers/input/tablet/wacom_sys.c index 9edf9806cff9..0d3219f29744 100644 --- a/trunk/drivers/input/tablet/wacom_sys.c +++ b/trunk/drivers/input/tablet/wacom_sys.c @@ -171,76 +171,6 @@ static void wacom_close(struct input_dev *dev) usb_autopm_put_interface(wacom->intf); } -/* - * Calculate the resolution of the X or Y axis, given appropriate HID data. - * This function is little more than hidinput_calc_abs_res stripped down. - */ -static int wacom_calc_hid_res(int logical_extents, int physical_extents, - unsigned char unit, unsigned char exponent) -{ - int prev, unit_exponent; - - /* Check if the extents are sane */ - if (logical_extents <= 0 || physical_extents <= 0) - return 0; - - /* Get signed value of nybble-sized twos-compliment exponent */ - unit_exponent = exponent; - if (unit_exponent > 7) - unit_exponent -= 16; - - /* Convert physical_extents to millimeters */ - if (unit == 0x11) { /* If centimeters */ - unit_exponent += 1; - } else if (unit == 0x13) { /* If inches */ - prev = physical_extents; - physical_extents *= 254; - if (physical_extents < prev) - return 0; - unit_exponent -= 1; - } else { - return 0; - } - - /* Apply negative unit exponent */ - for (; unit_exponent < 0; unit_exponent++) { - prev = logical_extents; - logical_extents *= 10; - if (logical_extents < prev) - return 0; - } - /* Apply positive unit exponent */ - for (; unit_exponent > 0; unit_exponent--) { - prev = physical_extents; - physical_extents *= 10; - if (physical_extents < prev) - return 0; - } - - /* Calculate resolution */ - return logical_extents / physical_extents; -} - -/* - * The physical dimension specified by the HID descriptor is likely not in - * the "100th of a mm" units expected by wacom_calculate_touch_res. This - * function adjusts the value of [xy]_phy based on the unit and exponent - * provided by the HID descriptor. If an error occurs durring conversion - * (e.g. from the unit being left unspecified) [xy]_phy is not modified. - */ -static void wacom_fix_phy_from_hid(struct wacom_features *features) -{ - int xres = wacom_calc_hid_res(features->x_max, features->x_phy, - features->unit, features->unitExpo); - int yres = wacom_calc_hid_res(features->y_max, features->y_phy, - features->unit, features->unitExpo); - - if (xres > 0 && yres > 0) { - features->x_phy = (100 * features->x_max) / xres; - features->y_phy = (100 * features->y_max) / yres; - } -} - /* * Static values for max X/Y and resolution of Pen interface is stored in * features. This mean physical size of active area can be computed. @@ -502,52 +432,56 @@ static int wacom_parse_hid(struct usb_interface *intf, return result; } -static int wacom_set_device_mode(struct usb_interface *intf, int report_id, int length, int mode) +static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_features *features) { unsigned char *rep_data; - int error = -ENOMEM, limit = 0; + int limit = 0, report_id = 2; + int error = -ENOMEM; - rep_data = kzalloc(length, GFP_KERNEL); + rep_data = kmalloc(4, GFP_KERNEL); if (!rep_data) return error; - rep_data[0] = report_id; - rep_data[1] = mode; - - do { - error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT, - report_id, rep_data, length, 1); - if (error >= 0) - error = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, - report_id, rep_data, length, 1); - } while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES); - - kfree(rep_data); - - return error < 0 ? error : 0; -} - -/* - * Switch the tablet into its most-capable mode. Wacom tablets are - * typically configured to power-up in a mode which sends mouse-like - * reports to the OS. To get absolute position, pressure data, etc. - * from the tablet, it is necessary to switch the tablet out of this - * mode and into one which sends the full range of tablet data. - */ -static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_features *features) -{ + /* ask to report Wacom data */ if (features->device_type == BTN_TOOL_FINGER) { + /* if it is an MT Tablet PC touch */ if (features->type > TABLETPC) { - /* MT Tablet PC touch */ - return wacom_set_device_mode(intf, 3, 4, 4); - } - } else if (features->device_type == BTN_TOOL_PEN) { - if (features->type <= BAMBOO_PT && features->type != WIRELESS) { - return wacom_set_device_mode(intf, 2, 2, 2); + do { + rep_data[0] = 3; + rep_data[1] = 4; + rep_data[2] = 0; + rep_data[3] = 0; + report_id = 3; + error = wacom_set_report(intf, + WAC_HID_FEATURE_REPORT, + report_id, + rep_data, 4, 1); + if (error >= 0) + error = wacom_get_report(intf, + WAC_HID_FEATURE_REPORT, + report_id, + rep_data, 4, 1); + } while ((error < 0 || rep_data[1] != 4) && + limit++ < WAC_MSG_RETRIES); } + } else if (features->type <= BAMBOO_PT && + features->type != WIRELESS && + features->device_type == BTN_TOOL_PEN) { + do { + rep_data[0] = 2; + rep_data[1] = 2; + error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT, + report_id, rep_data, 2, 1); + if (error >= 0) + error = wacom_get_report(intf, + WAC_HID_FEATURE_REPORT, + report_id, rep_data, 2, 1); + } while ((error < 0 || rep_data[1] != 2) && limit++ < WAC_MSG_RETRIES); } - return 0; + kfree(rep_data); + + return error < 0 ? error : 0; } static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, @@ -597,7 +531,6 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, error = wacom_parse_hid(intf, hid_desc, features); if (error) goto out; - wacom_fix_phy_from_hid(features); out: return error; diff --git a/trunk/drivers/input/tablet/wacom_wac.c b/trunk/drivers/input/tablet/wacom_wac.c index c3468c8dbd89..08b462b6c0d8 100644 --- a/trunk/drivers/input/tablet/wacom_wac.c +++ b/trunk/drivers/input/tablet/wacom_wac.c @@ -25,11 +25,6 @@ #define WACOM_INTUOS_RES 100 #define WACOM_INTUOS3_RES 200 -/* Scale factor relating reported contact size to logical contact area. - * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo - */ -#define WACOM_CONTACT_AREA_SCALE 2607 - static int wacom_penpartner_irq(struct wacom_wac *wacom) { unsigned char *data = wacom->data; @@ -331,7 +326,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) /* Enter report */ if ((data[1] & 0xfc) == 0xc0) { - if (features->quirks == WACOM_QUIRK_MULTI_INPUT) + if (features->type >= INTUOS5S && features->type <= INTUOS5L) wacom->shared->stylus_in_proximity = true; /* serial number of the tool */ @@ -419,7 +414,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) /* Exit report */ if ((data[1] & 0xfe) == 0x80) { - if (features->quirks == WACOM_QUIRK_MULTI_INPUT) + if (features->type >= INTUOS5S && features->type <= INTUOS5L) wacom->shared->stylus_in_proximity = false; /* @@ -1048,19 +1043,11 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) if (touch) { int x = (data[2] << 4) | (data[4] >> 4); int y = (data[3] << 4) | (data[4] & 0x0f); - int a = data[5]; - - // "a" is a scaled-down area which we assume is roughly - // circular and which can be described as: a=(pi*r^2)/C. - int x_res = input_abs_get_res(input, ABS_X); - int y_res = input_abs_get_res(input, ABS_Y); - int width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); - int height = width * y_res / x_res; + int w = data[6]; input_report_abs(input, ABS_MT_POSITION_X, x); input_report_abs(input, ABS_MT_POSITION_Y, y); - input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); - input_report_abs(input, ABS_MT_TOUCH_MINOR, height); + input_report_abs(input, ABS_MT_TOUCH_MAJOR, w); } } @@ -1546,9 +1533,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, input_mt_init_slots(input_dev, features->touch_max, 0); input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, - 0, features->x_max, 0, 0); - input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, - 0, features->y_max, 0, 0); + 0, 255, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, features->x_max, @@ -1656,10 +1641,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, - 0, features->x_max, 0, 0); - input_set_abs_params(input_dev, - ABS_MT_TOUCH_MINOR, - 0, features->y_max, 0, 0); + 0, 255, 0, 0); } input_set_abs_params(input_dev, ABS_MT_POSITION_X, diff --git a/trunk/drivers/input/touchscreen/atmel_mxt_ts.c b/trunk/drivers/input/touchscreen/atmel_mxt_ts.c index 1df2396af008..e92615d0b1b0 100644 --- a/trunk/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/trunk/drivers/input/touchscreen/atmel_mxt_ts.c @@ -320,8 +320,10 @@ static bool mxt_object_writable(unsigned int type) static void mxt_dump_message(struct device *dev, struct mxt_message *message) { - dev_dbg(dev, "reportid: %u\tmessage: %*ph\n", - message->reportid, 7, message->message); + dev_dbg(dev, "reportid: %u\tmessage: %02x %02x %02x %02x %02x %02x %02x\n", + message->reportid, message->message[0], message->message[1], + message->message[2], message->message[3], message->message[4], + message->message[5], message->message[6]); } static int mxt_check_bootloader(struct i2c_client *client, diff --git a/trunk/drivers/isdn/i4l/isdn_ppp.c b/trunk/drivers/isdn/i4l/isdn_ppp.c index 61d78fa03b1a..a1e760150821 100644 --- a/trunk/drivers/isdn/i4l/isdn_ppp.c +++ b/trunk/drivers/isdn/i4l/isdn_ppp.c @@ -595,7 +595,7 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg) j = ipc->num / (sizeof(long) * 8); i = ipc->num % (sizeof(long) * 8); if (j < 8) - protos[j] |= (1UL << i); + protos[j] |= (0x1 << i); ipc = ipc->next; } if ((r = set_arg(argp, protos, 8 * sizeof(long)))) diff --git a/trunk/drivers/md/Kconfig b/trunk/drivers/md/Kconfig index 91a02eeeb319..d949b781f6f8 100644 --- a/trunk/drivers/md/Kconfig +++ b/trunk/drivers/md/Kconfig @@ -216,13 +216,6 @@ config DM_BUFIO as a cache, holding recently-read blocks in memory and performing delayed writes. -config DM_BIO_PRISON - tristate - depends on BLK_DEV_DM && EXPERIMENTAL - ---help--- - Some bio locking schemes used by other device-mapper targets - including thin provisioning. - source "drivers/md/persistent-data/Kconfig" config DM_CRYPT @@ -254,7 +247,6 @@ config DM_THIN_PROVISIONING tristate "Thin provisioning target (EXPERIMENTAL)" depends on BLK_DEV_DM && EXPERIMENTAL select DM_PERSISTENT_DATA - select DM_BIO_PRISON ---help--- Provides thin provisioning and snapshots that share a data store. diff --git a/trunk/drivers/md/Makefile b/trunk/drivers/md/Makefile index 94dce8b49324..8b2e0dffe82e 100644 --- a/trunk/drivers/md/Makefile +++ b/trunk/drivers/md/Makefile @@ -29,7 +29,6 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o obj-$(CONFIG_BLK_DEV_MD) += md-mod.o obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o obj-$(CONFIG_DM_BUFIO) += dm-bufio.o -obj-$(CONFIG_DM_BIO_PRISON) += dm-bio-prison.o obj-$(CONFIG_DM_CRYPT) += dm-crypt.o obj-$(CONFIG_DM_DELAY) += dm-delay.o obj-$(CONFIG_DM_FLAKEY) += dm-flakey.o diff --git a/trunk/drivers/md/bitmap.c b/trunk/drivers/md/bitmap.c index 7155945f8eb8..94e7f6ba2e11 100644 --- a/trunk/drivers/md/bitmap.c +++ b/trunk/drivers/md/bitmap.c @@ -163,17 +163,20 @@ static struct md_rdev *next_active_rdev(struct md_rdev *rdev, struct mddev *mdde * As devices are only added or removed when raid_disk is < 0 and * nr_pending is 0 and In_sync is clear, the entries we return will * still be in the same position on the list when we re-enter - * list_for_each_entry_continue_rcu. + * list_for_each_continue_rcu. */ + struct list_head *pos; rcu_read_lock(); if (rdev == NULL) /* start at the beginning */ - rdev = list_entry_rcu(&mddev->disks, struct md_rdev, same_set); + pos = &mddev->disks; else { /* release the previous rdev and start from there. */ rdev_dec_pending(rdev, mddev); + pos = &rdev->same_set; } - list_for_each_entry_continue_rcu(rdev, &mddev->disks, same_set) { + list_for_each_continue_rcu(pos, &mddev->disks) { + rdev = list_entry(pos, struct md_rdev, same_set); if (rdev->raid_disk >= 0 && !test_bit(Faulty, &rdev->flags)) { /* this is a usable devices */ @@ -470,10 +473,14 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) { bitmap_super_t *sb; unsigned long chunksize, daemon_sleep, write_behind; + int err = -EINVAL; bitmap->storage.sb_page = alloc_page(GFP_KERNEL); - if (bitmap->storage.sb_page == NULL) - return -ENOMEM; + if (IS_ERR(bitmap->storage.sb_page)) { + err = PTR_ERR(bitmap->storage.sb_page); + bitmap->storage.sb_page = NULL; + return err; + } bitmap->storage.sb_page->index = 0; sb = kmap_atomic(bitmap->storage.sb_page); diff --git a/trunk/drivers/md/dm-bio-prison.c b/trunk/drivers/md/dm-bio-prison.c deleted file mode 100644 index e4e841567459..000000000000 --- a/trunk/drivers/md/dm-bio-prison.c +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (C) 2012 Red Hat, Inc. - * - * This file is released under the GPL. - */ - -#include "dm.h" -#include "dm-bio-prison.h" - -#include -#include -#include -#include - -/*----------------------------------------------------------------*/ - -struct dm_bio_prison_cell { - struct hlist_node list; - struct dm_bio_prison *prison; - struct dm_cell_key key; - struct bio *holder; - struct bio_list bios; -}; - -struct dm_bio_prison { - spinlock_t lock; - mempool_t *cell_pool; - - unsigned nr_buckets; - unsigned hash_mask; - struct hlist_head *cells; -}; - -/*----------------------------------------------------------------*/ - -static uint32_t calc_nr_buckets(unsigned nr_cells) -{ - uint32_t n = 128; - - nr_cells /= 4; - nr_cells = min(nr_cells, 8192u); - - while (n < nr_cells) - n <<= 1; - - return n; -} - -static struct kmem_cache *_cell_cache; - -/* - * @nr_cells should be the number of cells you want in use _concurrently_. - * Don't confuse it with the number of distinct keys. - */ -struct dm_bio_prison *dm_bio_prison_create(unsigned nr_cells) -{ - unsigned i; - uint32_t nr_buckets = calc_nr_buckets(nr_cells); - size_t len = sizeof(struct dm_bio_prison) + - (sizeof(struct hlist_head) * nr_buckets); - struct dm_bio_prison *prison = kmalloc(len, GFP_KERNEL); - - if (!prison) - return NULL; - - spin_lock_init(&prison->lock); - prison->cell_pool = mempool_create_slab_pool(nr_cells, _cell_cache); - if (!prison->cell_pool) { - kfree(prison); - return NULL; - } - - prison->nr_buckets = nr_buckets; - prison->hash_mask = nr_buckets - 1; - prison->cells = (struct hlist_head *) (prison + 1); - for (i = 0; i < nr_buckets; i++) - INIT_HLIST_HEAD(prison->cells + i); - - return prison; -} -EXPORT_SYMBOL_GPL(dm_bio_prison_create); - -void dm_bio_prison_destroy(struct dm_bio_prison *prison) -{ - mempool_destroy(prison->cell_pool); - kfree(prison); -} -EXPORT_SYMBOL_GPL(dm_bio_prison_destroy); - -static uint32_t hash_key(struct dm_bio_prison *prison, struct dm_cell_key *key) -{ - const unsigned long BIG_PRIME = 4294967291UL; - uint64_t hash = key->block * BIG_PRIME; - - return (uint32_t) (hash & prison->hash_mask); -} - -static int keys_equal(struct dm_cell_key *lhs, struct dm_cell_key *rhs) -{ - return (lhs->virtual == rhs->virtual) && - (lhs->dev == rhs->dev) && - (lhs->block == rhs->block); -} - -static struct dm_bio_prison_cell *__search_bucket(struct hlist_head *bucket, - struct dm_cell_key *key) -{ - struct dm_bio_prison_cell *cell; - struct hlist_node *tmp; - - hlist_for_each_entry(cell, tmp, bucket, list) - if (keys_equal(&cell->key, key)) - return cell; - - return NULL; -} - -/* - * This may block if a new cell needs allocating. You must ensure that - * cells will be unlocked even if the calling thread is blocked. - * - * Returns 1 if the cell was already held, 0 if @inmate is the new holder. - */ -int dm_bio_detain(struct dm_bio_prison *prison, struct dm_cell_key *key, - struct bio *inmate, struct dm_bio_prison_cell **ref) -{ - int r = 1; - unsigned long flags; - uint32_t hash = hash_key(prison, key); - struct dm_bio_prison_cell *cell, *cell2; - - BUG_ON(hash > prison->nr_buckets); - - spin_lock_irqsave(&prison->lock, flags); - - cell = __search_bucket(prison->cells + hash, key); - if (cell) { - bio_list_add(&cell->bios, inmate); - goto out; - } - - /* - * Allocate a new cell - */ - spin_unlock_irqrestore(&prison->lock, flags); - cell2 = mempool_alloc(prison->cell_pool, GFP_NOIO); - spin_lock_irqsave(&prison->lock, flags); - - /* - * We've been unlocked, so we have to double check that - * nobody else has inserted this cell in the meantime. - */ - cell = __search_bucket(prison->cells + hash, key); - if (cell) { - mempool_free(cell2, prison->cell_pool); - bio_list_add(&cell->bios, inmate); - goto out; - } - - /* - * Use new cell. - */ - cell = cell2; - - cell->prison = prison; - memcpy(&cell->key, key, sizeof(cell->key)); - cell->holder = inmate; - bio_list_init(&cell->bios); - hlist_add_head(&cell->list, prison->cells + hash); - - r = 0; - -out: - spin_unlock_irqrestore(&prison->lock, flags); - - *ref = cell; - - return r; -} -EXPORT_SYMBOL_GPL(dm_bio_detain); - -/* - * @inmates must have been initialised prior to this call - */ -static void __cell_release(struct dm_bio_prison_cell *cell, struct bio_list *inmates) -{ - struct dm_bio_prison *prison = cell->prison; - - hlist_del(&cell->list); - - if (inmates) { - bio_list_add(inmates, cell->holder); - bio_list_merge(inmates, &cell->bios); - } - - mempool_free(cell, prison->cell_pool); -} - -void dm_cell_release(struct dm_bio_prison_cell *cell, struct bio_list *bios) -{ - unsigned long flags; - struct dm_bio_prison *prison = cell->prison; - - spin_lock_irqsave(&prison->lock, flags); - __cell_release(cell, bios); - spin_unlock_irqrestore(&prison->lock, flags); -} -EXPORT_SYMBOL_GPL(dm_cell_release); - -/* - * There are a couple of places where we put a bio into a cell briefly - * before taking it out again. In these situations we know that no other - * bio may be in the cell. This function releases the cell, and also does - * a sanity check. - */ -static void __cell_release_singleton(struct dm_bio_prison_cell *cell, struct bio *bio) -{ - BUG_ON(cell->holder != bio); - BUG_ON(!bio_list_empty(&cell->bios)); - - __cell_release(cell, NULL); -} - -void dm_cell_release_singleton(struct dm_bio_prison_cell *cell, struct bio *bio) -{ - unsigned long flags; - struct dm_bio_prison *prison = cell->prison; - - spin_lock_irqsave(&prison->lock, flags); - __cell_release_singleton(cell, bio); - spin_unlock_irqrestore(&prison->lock, flags); -} -EXPORT_SYMBOL_GPL(dm_cell_release_singleton); - -/* - * Sometimes we don't want the holder, just the additional bios. - */ -static void __cell_release_no_holder(struct dm_bio_prison_cell *cell, struct bio_list *inmates) -{ - struct dm_bio_prison *prison = cell->prison; - - hlist_del(&cell->list); - bio_list_merge(inmates, &cell->bios); - - mempool_free(cell, prison->cell_pool); -} - -void dm_cell_release_no_holder(struct dm_bio_prison_cell *cell, struct bio_list *inmates) -{ - unsigned long flags; - struct dm_bio_prison *prison = cell->prison; - - spin_lock_irqsave(&prison->lock, flags); - __cell_release_no_holder(cell, inmates); - spin_unlock_irqrestore(&prison->lock, flags); -} -EXPORT_SYMBOL_GPL(dm_cell_release_no_holder); - -void dm_cell_error(struct dm_bio_prison_cell *cell) -{ - struct dm_bio_prison *prison = cell->prison; - struct bio_list bios; - struct bio *bio; - unsigned long flags; - - bio_list_init(&bios); - - spin_lock_irqsave(&prison->lock, flags); - __cell_release(cell, &bios); - spin_unlock_irqrestore(&prison->lock, flags); - - while ((bio = bio_list_pop(&bios))) - bio_io_error(bio); -} -EXPORT_SYMBOL_GPL(dm_cell_error); - -/*----------------------------------------------------------------*/ - -#define DEFERRED_SET_SIZE 64 - -struct dm_deferred_entry { - struct dm_deferred_set *ds; - unsigned count; - struct list_head work_items; -}; - -struct dm_deferred_set { - spinlock_t lock; - unsigned current_entry; - unsigned sweeper; - struct dm_deferred_entry entries[DEFERRED_SET_SIZE]; -}; - -struct dm_deferred_set *dm_deferred_set_create(void) -{ - int i; - struct dm_deferred_set *ds; - - ds = kmalloc(sizeof(*ds), GFP_KERNEL); - if (!ds) - return NULL; - - spin_lock_init(&ds->lock); - ds->current_entry = 0; - ds->sweeper = 0; - for (i = 0; i < DEFERRED_SET_SIZE; i++) { - ds->entries[i].ds = ds; - ds->entries[i].count = 0; - INIT_LIST_HEAD(&ds->entries[i].work_items); - } - - return ds; -} -EXPORT_SYMBOL_GPL(dm_deferred_set_create); - -void dm_deferred_set_destroy(struct dm_deferred_set *ds) -{ - kfree(ds); -} -EXPORT_SYMBOL_GPL(dm_deferred_set_destroy); - -struct dm_deferred_entry *dm_deferred_entry_inc(struct dm_deferred_set *ds) -{ - unsigned long flags; - struct dm_deferred_entry *entry; - - spin_lock_irqsave(&ds->lock, flags); - entry = ds->entries + ds->current_entry; - entry->count++; - spin_unlock_irqrestore(&ds->lock, flags); - - return entry; -} -EXPORT_SYMBOL_GPL(dm_deferred_entry_inc); - -static unsigned ds_next(unsigned index) -{ - return (index + 1) % DEFERRED_SET_SIZE; -} - -static void __sweep(struct dm_deferred_set *ds, struct list_head *head) -{ - while ((ds->sweeper != ds->current_entry) && - !ds->entries[ds->sweeper].count) { - list_splice_init(&ds->entries[ds->sweeper].work_items, head); - ds->sweeper = ds_next(ds->sweeper); - } - - if ((ds->sweeper == ds->current_entry) && !ds->entries[ds->sweeper].count) - list_splice_init(&ds->entries[ds->sweeper].work_items, head); -} - -void dm_deferred_entry_dec(struct dm_deferred_entry *entry, struct list_head *head) -{ - unsigned long flags; - - spin_lock_irqsave(&entry->ds->lock, flags); - BUG_ON(!entry->count); - --entry->count; - __sweep(entry->ds, head); - spin_unlock_irqrestore(&entry->ds->lock, flags); -} -EXPORT_SYMBOL_GPL(dm_deferred_entry_dec); - -/* - * Returns 1 if deferred or 0 if no pending items to delay job. - */ -int dm_deferred_set_add_work(struct dm_deferred_set *ds, struct list_head *work) -{ - int r = 1; - unsigned long flags; - unsigned next_entry; - - spin_lock_irqsave(&ds->lock, flags); - if ((ds->sweeper == ds->current_entry) && - !ds->entries[ds->current_entry].count) - r = 0; - else { - list_add(work, &ds->entries[ds->current_entry].work_items); - next_entry = ds_next(ds->current_entry); - if (!ds->entries[next_entry].count) - ds->current_entry = next_entry; - } - spin_unlock_irqrestore(&ds->lock, flags); - - return r; -} -EXPORT_SYMBOL_GPL(dm_deferred_set_add_work); - -/*----------------------------------------------------------------*/ - -static int __init dm_bio_prison_init(void) -{ - _cell_cache = KMEM_CACHE(dm_bio_prison_cell, 0); - if (!_cell_cache) - return -ENOMEM; - - return 0; -} - -static void __exit dm_bio_prison_exit(void) -{ - kmem_cache_destroy(_cell_cache); - _cell_cache = NULL; -} - -/* - * module hooks - */ -module_init(dm_bio_prison_init); -module_exit(dm_bio_prison_exit); - -MODULE_DESCRIPTION(DM_NAME " bio prison"); -MODULE_AUTHOR("Joe Thornber "); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/md/dm-bio-prison.h b/trunk/drivers/md/dm-bio-prison.h deleted file mode 100644 index 4e0ac376700a..000000000000 --- a/trunk/drivers/md/dm-bio-prison.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2011-2012 Red Hat, Inc. - * - * This file is released under the GPL. - */ - -#ifndef DM_BIO_PRISON_H -#define DM_BIO_PRISON_H - -#include "persistent-data/dm-block-manager.h" /* FIXME: for dm_block_t */ -#include "dm-thin-metadata.h" /* FIXME: for dm_thin_id */ - -#include -#include - -/*----------------------------------------------------------------*/ - -/* - * Sometimes we can't deal with a bio straight away. We put them in prison - * where they can't cause any mischief. Bios are put in a cell identified - * by a key, multiple bios can be in the same cell. When the cell is - * subsequently unlocked the bios become available. - */ -struct dm_bio_prison; -struct dm_bio_prison_cell; - -/* FIXME: this needs to be more abstract */ -struct dm_cell_key { - int virtual; - dm_thin_id dev; - dm_block_t block; -}; - -struct dm_bio_prison *dm_bio_prison_create(unsigned nr_cells); -void dm_bio_prison_destroy(struct dm_bio_prison *prison); - -/* - * This may block if a new cell needs allocating. You must ensure that - * cells will be unlocked even if the calling thread is blocked. - * - * Returns 1 if the cell was already held, 0 if @inmate is the new holder. - */ -int dm_bio_detain(struct dm_bio_prison *prison, struct dm_cell_key *key, - struct bio *inmate, struct dm_bio_prison_cell **ref); - -void dm_cell_release(struct dm_bio_prison_cell *cell, struct bio_list *bios); -void dm_cell_release_singleton(struct dm_bio_prison_cell *cell, struct bio *bio); // FIXME: bio arg not needed -void dm_cell_release_no_holder(struct dm_bio_prison_cell *cell, struct bio_list *inmates); -void dm_cell_error(struct dm_bio_prison_cell *cell); - -/*----------------------------------------------------------------*/ - -/* - * We use the deferred set to keep track of pending reads to shared blocks. - * We do this to ensure the new mapping caused by a write isn't performed - * until these prior reads have completed. Otherwise the insertion of the - * new mapping could free the old block that the read bios are mapped to. - */ - -struct dm_deferred_set; -struct dm_deferred_entry; - -struct dm_deferred_set *dm_deferred_set_create(void); -void dm_deferred_set_destroy(struct dm_deferred_set *ds); - -struct dm_deferred_entry *dm_deferred_entry_inc(struct dm_deferred_set *ds); -void dm_deferred_entry_dec(struct dm_deferred_entry *entry, struct list_head *head); -int dm_deferred_set_add_work(struct dm_deferred_set *ds, struct list_head *work); - -/*----------------------------------------------------------------*/ - -#endif diff --git a/trunk/drivers/md/dm-bufio.c b/trunk/drivers/md/dm-bufio.c index 651ca79881dd..cc06a1e52423 100644 --- a/trunk/drivers/md/dm-bufio.c +++ b/trunk/drivers/md/dm-bufio.c @@ -280,7 +280,9 @@ static void __cache_size_refresh(void) BUG_ON(!mutex_is_locked(&dm_bufio_clients_lock)); BUG_ON(dm_bufio_client_count < 0); - dm_bufio_cache_size_latch = ACCESS_ONCE(dm_bufio_cache_size); + dm_bufio_cache_size_latch = dm_bufio_cache_size; + + barrier(); /* * Use default if set to 0 and report the actual cache size used. @@ -439,7 +441,8 @@ static void __relink_lru(struct dm_buffer *b, int dirty) c->n_buffers[b->list_mode]--; c->n_buffers[dirty]++; b->list_mode = dirty; - list_move(&b->lru_list, &c->lru[dirty]); + list_del(&b->lru_list); + list_add(&b->lru_list, &c->lru[dirty]); } /*---------------------------------------------------------------- @@ -810,7 +813,7 @@ static void __get_memory_limit(struct dm_bufio_client *c, { unsigned long buffers; - if (ACCESS_ONCE(dm_bufio_cache_size) != dm_bufio_cache_size_latch) { + if (dm_bufio_cache_size != dm_bufio_cache_size_latch) { mutex_lock(&dm_bufio_clients_lock); __cache_size_refresh(); mutex_unlock(&dm_bufio_clients_lock); @@ -1588,9 +1591,11 @@ EXPORT_SYMBOL_GPL(dm_bufio_client_destroy); static void cleanup_old_buffers(void) { - unsigned long max_age = ACCESS_ONCE(dm_bufio_max_age); + unsigned long max_age = dm_bufio_max_age; struct dm_bufio_client *c; + barrier(); + if (max_age > ULONG_MAX / HZ) max_age = ULONG_MAX / HZ; diff --git a/trunk/drivers/md/dm-mpath.c b/trunk/drivers/md/dm-mpath.c index 573bd04591bf..d778563a4ffd 100644 --- a/trunk/drivers/md/dm-mpath.c +++ b/trunk/drivers/md/dm-mpath.c @@ -1309,14 +1309,13 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone, { struct multipath *m = ti->private; struct dm_mpath_io *mpio = map_context->ptr; - struct pgpath *pgpath; + struct pgpath *pgpath = mpio->pgpath; struct path_selector *ps; int r; BUG_ON(!mpio); r = do_end_io(m, clone, error, mpio); - pgpath = mpio->pgpath; if (pgpath) { ps = &pgpath->pg->ps; if (ps->type->end_io) diff --git a/trunk/drivers/md/dm-raid.c b/trunk/drivers/md/dm-raid.c index 45d94a7e7f6d..982e3e390c45 100644 --- a/trunk/drivers/md/dm-raid.c +++ b/trunk/drivers/md/dm-raid.c @@ -337,84 +337,6 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size) return 0; } -/* - * validate_rebuild_devices - * @rs - * - * Determine if the devices specified for rebuild can result in a valid - * usable array that is capable of rebuilding the given devices. - * - * Returns: 0 on success, -EINVAL on failure. - */ -static int validate_rebuild_devices(struct raid_set *rs) -{ - unsigned i, rebuild_cnt = 0; - unsigned rebuilds_per_group, copies, d; - - if (!(rs->print_flags & DMPF_REBUILD)) - return 0; - - for (i = 0; i < rs->md.raid_disks; i++) - if (!test_bit(In_sync, &rs->dev[i].rdev.flags)) - rebuild_cnt++; - - switch (rs->raid_type->level) { - case 1: - if (rebuild_cnt >= rs->md.raid_disks) - goto too_many; - break; - case 4: - case 5: - case 6: - if (rebuild_cnt > rs->raid_type->parity_devs) - goto too_many; - break; - case 10: - copies = raid10_md_layout_to_copies(rs->md.layout); - if (rebuild_cnt < copies) - break; - - /* - * It is possible to have a higher rebuild count for RAID10, - * as long as the failed devices occur in different mirror - * groups (i.e. different stripes). - * - * Right now, we only allow for "near" copies. When other - * formats are added, we will have to check those too. - * - * When checking "near" format, make sure no adjacent devices - * have failed beyond what can be handled. In addition to the - * simple case where the number of devices is a multiple of the - * number of copies, we must also handle cases where the number - * of devices is not a multiple of the number of copies. - * E.g. dev1 dev2 dev3 dev4 dev5 - * A A B B C - * C D D E E - */ - rebuilds_per_group = 0; - for (i = 0; i < rs->md.raid_disks * copies; i++) { - d = i % rs->md.raid_disks; - if (!test_bit(In_sync, &rs->dev[d].rdev.flags) && - (++rebuilds_per_group >= copies)) - goto too_many; - if (!((i + 1) % copies)) - rebuilds_per_group = 0; - } - break; - default: - DMERR("The rebuild parameter is not supported for %s", - rs->raid_type->name); - rs->ti->error = "Rebuild not supported for this RAID type"; - return -EINVAL; - } - - return 0; - -too_many: - rs->ti->error = "Too many rebuild devices specified"; - return -EINVAL; -} - /* * Possible arguments are... * [optional_args] @@ -443,7 +365,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv, { char *raid10_format = "near"; unsigned raid10_copies = 2; - unsigned i; + unsigned i, rebuild_cnt = 0; unsigned long value, region_size = 0; sector_t sectors_per_dev = rs->ti->len; sector_t max_io_len; @@ -539,7 +461,31 @@ static int parse_raid_params(struct raid_set *rs, char **argv, /* Parameters that take a numeric value are checked here */ if (!strcasecmp(key, "rebuild")) { - if (value >= rs->md.raid_disks) { + rebuild_cnt++; + + switch (rs->raid_type->level) { + case 1: + if (rebuild_cnt >= rs->md.raid_disks) { + rs->ti->error = "Too many rebuild devices specified"; + return -EINVAL; + } + break; + case 4: + case 5: + case 6: + if (rebuild_cnt > rs->raid_type->parity_devs) { + rs->ti->error = "Too many rebuild devices specified for given RAID type"; + return -EINVAL; + } + break; + case 10: + default: + DMERR("The rebuild parameter is not supported for %s", rs->raid_type->name); + rs->ti->error = "Rebuild not supported for this RAID type"; + return -EINVAL; + } + + if (value > rs->md.raid_disks) { rs->ti->error = "Invalid rebuild index given"; return -EINVAL; } @@ -662,9 +608,6 @@ static int parse_raid_params(struct raid_set *rs, char **argv, } rs->md.dev_sectors = sectors_per_dev; - if (validate_rebuild_devices(rs)) - return -EINVAL; - /* Assume there are no metadata devices until the drives are parsed */ rs->md.persistent = 0; rs->md.external = 1; @@ -1017,19 +960,6 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) freshest = NULL; rdev_for_each_safe(rdev, tmp, mddev) { - /* - * Skipping super_load due to DMPF_SYNC will cause - * the array to undergo initialization again as - * though it were new. This is the intended effect - * of the "sync" directive. - * - * When reshaping capability is added, we must ensure - * that the "sync" directive is disallowed during the - * reshape. - */ - if (rs->print_flags & DMPF_SYNC) - continue; - if (!rdev->meta_bdev) continue; @@ -1430,7 +1360,7 @@ static void raid_resume(struct dm_target *ti) static struct target_type raid_target = { .name = "raid", - .version = {1, 3, 1}, + .version = {1, 3, 0}, .module = THIS_MODULE, .ctr = raid_ctr, .dtr = raid_dtr, diff --git a/trunk/drivers/md/dm-thin.c b/trunk/drivers/md/dm-thin.c index 058acf3a5ba7..c29410af1e22 100644 --- a/trunk/drivers/md/dm-thin.c +++ b/trunk/drivers/md/dm-thin.c @@ -5,7 +5,6 @@ */ #include "dm-thin-metadata.h" -#include "dm-bio-prison.h" #include "dm.h" #include @@ -22,6 +21,7 @@ * Tunable constants */ #define ENDIO_HOOK_POOL_SIZE 1024 +#define DEFERRED_SET_SIZE 64 #define MAPPING_POOL_SIZE 1024 #define PRISON_CELLS 1024 #define COMMIT_PERIOD HZ @@ -58,7 +58,7 @@ * i) plug io further to this physical block. (see bio_prison code). * * ii) quiesce any read io to that shared data block. Obviously - * including all devices that share this block. (see dm_deferred_set code) + * including all devices that share this block. (see deferred_set code) * * iii) copy the data block to a newly allocate block. This step can be * missed out if the io covers the block. (schedule_copy). @@ -98,11 +98,382 @@ /*----------------------------------------------------------------*/ +/* + * Sometimes we can't deal with a bio straight away. We put them in prison + * where they can't cause any mischief. Bios are put in a cell identified + * by a key, multiple bios can be in the same cell. When the cell is + * subsequently unlocked the bios become available. + */ +struct bio_prison; + +struct cell_key { + int virtual; + dm_thin_id dev; + dm_block_t block; +}; + +struct dm_bio_prison_cell { + struct hlist_node list; + struct bio_prison *prison; + struct cell_key key; + struct bio *holder; + struct bio_list bios; +}; + +struct bio_prison { + spinlock_t lock; + mempool_t *cell_pool; + + unsigned nr_buckets; + unsigned hash_mask; + struct hlist_head *cells; +}; + +static uint32_t calc_nr_buckets(unsigned nr_cells) +{ + uint32_t n = 128; + + nr_cells /= 4; + nr_cells = min(nr_cells, 8192u); + + while (n < nr_cells) + n <<= 1; + + return n; +} + +static struct kmem_cache *_cell_cache; + +/* + * @nr_cells should be the number of cells you want in use _concurrently_. + * Don't confuse it with the number of distinct keys. + */ +static struct bio_prison *prison_create(unsigned nr_cells) +{ + unsigned i; + uint32_t nr_buckets = calc_nr_buckets(nr_cells); + size_t len = sizeof(struct bio_prison) + + (sizeof(struct hlist_head) * nr_buckets); + struct bio_prison *prison = kmalloc(len, GFP_KERNEL); + + if (!prison) + return NULL; + + spin_lock_init(&prison->lock); + prison->cell_pool = mempool_create_slab_pool(nr_cells, _cell_cache); + if (!prison->cell_pool) { + kfree(prison); + return NULL; + } + + prison->nr_buckets = nr_buckets; + prison->hash_mask = nr_buckets - 1; + prison->cells = (struct hlist_head *) (prison + 1); + for (i = 0; i < nr_buckets; i++) + INIT_HLIST_HEAD(prison->cells + i); + + return prison; +} + +static void prison_destroy(struct bio_prison *prison) +{ + mempool_destroy(prison->cell_pool); + kfree(prison); +} + +static uint32_t hash_key(struct bio_prison *prison, struct cell_key *key) +{ + const unsigned long BIG_PRIME = 4294967291UL; + uint64_t hash = key->block * BIG_PRIME; + + return (uint32_t) (hash & prison->hash_mask); +} + +static int keys_equal(struct cell_key *lhs, struct cell_key *rhs) +{ + return (lhs->virtual == rhs->virtual) && + (lhs->dev == rhs->dev) && + (lhs->block == rhs->block); +} + +static struct dm_bio_prison_cell *__search_bucket(struct hlist_head *bucket, + struct cell_key *key) +{ + struct dm_bio_prison_cell *cell; + struct hlist_node *tmp; + + hlist_for_each_entry(cell, tmp, bucket, list) + if (keys_equal(&cell->key, key)) + return cell; + + return NULL; +} + +/* + * This may block if a new cell needs allocating. You must ensure that + * cells will be unlocked even if the calling thread is blocked. + * + * Returns 1 if the cell was already held, 0 if @inmate is the new holder. + */ +static int bio_detain(struct bio_prison *prison, struct cell_key *key, + struct bio *inmate, struct dm_bio_prison_cell **ref) +{ + int r = 1; + unsigned long flags; + uint32_t hash = hash_key(prison, key); + struct dm_bio_prison_cell *cell, *cell2; + + BUG_ON(hash > prison->nr_buckets); + + spin_lock_irqsave(&prison->lock, flags); + + cell = __search_bucket(prison->cells + hash, key); + if (cell) { + bio_list_add(&cell->bios, inmate); + goto out; + } + + /* + * Allocate a new cell + */ + spin_unlock_irqrestore(&prison->lock, flags); + cell2 = mempool_alloc(prison->cell_pool, GFP_NOIO); + spin_lock_irqsave(&prison->lock, flags); + + /* + * We've been unlocked, so we have to double check that + * nobody else has inserted this cell in the meantime. + */ + cell = __search_bucket(prison->cells + hash, key); + if (cell) { + mempool_free(cell2, prison->cell_pool); + bio_list_add(&cell->bios, inmate); + goto out; + } + + /* + * Use new cell. + */ + cell = cell2; + + cell->prison = prison; + memcpy(&cell->key, key, sizeof(cell->key)); + cell->holder = inmate; + bio_list_init(&cell->bios); + hlist_add_head(&cell->list, prison->cells + hash); + + r = 0; + +out: + spin_unlock_irqrestore(&prison->lock, flags); + + *ref = cell; + + return r; +} + +/* + * @inmates must have been initialised prior to this call + */ +static void __cell_release(struct dm_bio_prison_cell *cell, struct bio_list *inmates) +{ + struct bio_prison *prison = cell->prison; + + hlist_del(&cell->list); + + if (inmates) { + bio_list_add(inmates, cell->holder); + bio_list_merge(inmates, &cell->bios); + } + + mempool_free(cell, prison->cell_pool); +} + +static void cell_release(struct dm_bio_prison_cell *cell, struct bio_list *bios) +{ + unsigned long flags; + struct bio_prison *prison = cell->prison; + + spin_lock_irqsave(&prison->lock, flags); + __cell_release(cell, bios); + spin_unlock_irqrestore(&prison->lock, flags); +} + +/* + * There are a couple of places where we put a bio into a cell briefly + * before taking it out again. In these situations we know that no other + * bio may be in the cell. This function releases the cell, and also does + * a sanity check. + */ +static void __cell_release_singleton(struct dm_bio_prison_cell *cell, struct bio *bio) +{ + BUG_ON(cell->holder != bio); + BUG_ON(!bio_list_empty(&cell->bios)); + + __cell_release(cell, NULL); +} + +static void cell_release_singleton(struct dm_bio_prison_cell *cell, struct bio *bio) +{ + unsigned long flags; + struct bio_prison *prison = cell->prison; + + spin_lock_irqsave(&prison->lock, flags); + __cell_release_singleton(cell, bio); + spin_unlock_irqrestore(&prison->lock, flags); +} + +/* + * Sometimes we don't want the holder, just the additional bios. + */ +static void __cell_release_no_holder(struct dm_bio_prison_cell *cell, + struct bio_list *inmates) +{ + struct bio_prison *prison = cell->prison; + + hlist_del(&cell->list); + bio_list_merge(inmates, &cell->bios); + + mempool_free(cell, prison->cell_pool); +} + +static void cell_release_no_holder(struct dm_bio_prison_cell *cell, + struct bio_list *inmates) +{ + unsigned long flags; + struct bio_prison *prison = cell->prison; + + spin_lock_irqsave(&prison->lock, flags); + __cell_release_no_holder(cell, inmates); + spin_unlock_irqrestore(&prison->lock, flags); +} + +static void cell_error(struct dm_bio_prison_cell *cell) +{ + struct bio_prison *prison = cell->prison; + struct bio_list bios; + struct bio *bio; + unsigned long flags; + + bio_list_init(&bios); + + spin_lock_irqsave(&prison->lock, flags); + __cell_release(cell, &bios); + spin_unlock_irqrestore(&prison->lock, flags); + + while ((bio = bio_list_pop(&bios))) + bio_io_error(bio); +} + +/*----------------------------------------------------------------*/ + +/* + * We use the deferred set to keep track of pending reads to shared blocks. + * We do this to ensure the new mapping caused by a write isn't performed + * until these prior reads have completed. Otherwise the insertion of the + * new mapping could free the old block that the read bios are mapped to. + */ + +struct deferred_set; +struct deferred_entry { + struct deferred_set *ds; + unsigned count; + struct list_head work_items; +}; + +struct deferred_set { + spinlock_t lock; + unsigned current_entry; + unsigned sweeper; + struct deferred_entry entries[DEFERRED_SET_SIZE]; +}; + +static void ds_init(struct deferred_set *ds) +{ + int i; + + spin_lock_init(&ds->lock); + ds->current_entry = 0; + ds->sweeper = 0; + for (i = 0; i < DEFERRED_SET_SIZE; i++) { + ds->entries[i].ds = ds; + ds->entries[i].count = 0; + INIT_LIST_HEAD(&ds->entries[i].work_items); + } +} + +static struct deferred_entry *ds_inc(struct deferred_set *ds) +{ + unsigned long flags; + struct deferred_entry *entry; + + spin_lock_irqsave(&ds->lock, flags); + entry = ds->entries + ds->current_entry; + entry->count++; + spin_unlock_irqrestore(&ds->lock, flags); + + return entry; +} + +static unsigned ds_next(unsigned index) +{ + return (index + 1) % DEFERRED_SET_SIZE; +} + +static void __sweep(struct deferred_set *ds, struct list_head *head) +{ + while ((ds->sweeper != ds->current_entry) && + !ds->entries[ds->sweeper].count) { + list_splice_init(&ds->entries[ds->sweeper].work_items, head); + ds->sweeper = ds_next(ds->sweeper); + } + + if ((ds->sweeper == ds->current_entry) && !ds->entries[ds->sweeper].count) + list_splice_init(&ds->entries[ds->sweeper].work_items, head); +} + +static void ds_dec(struct deferred_entry *entry, struct list_head *head) +{ + unsigned long flags; + + spin_lock_irqsave(&entry->ds->lock, flags); + BUG_ON(!entry->count); + --entry->count; + __sweep(entry->ds, head); + spin_unlock_irqrestore(&entry->ds->lock, flags); +} + +/* + * Returns 1 if deferred or 0 if no pending items to delay job. + */ +static int ds_add_work(struct deferred_set *ds, struct list_head *work) +{ + int r = 1; + unsigned long flags; + unsigned next_entry; + + spin_lock_irqsave(&ds->lock, flags); + if ((ds->sweeper == ds->current_entry) && + !ds->entries[ds->current_entry].count) + r = 0; + else { + list_add(work, &ds->entries[ds->current_entry].work_items); + next_entry = ds_next(ds->current_entry); + if (!ds->entries[next_entry].count) + ds->current_entry = next_entry; + } + spin_unlock_irqrestore(&ds->lock, flags); + + return r; +} + +/*----------------------------------------------------------------*/ + /* * Key building. */ static void build_data_key(struct dm_thin_device *td, - dm_block_t b, struct dm_cell_key *key) + dm_block_t b, struct cell_key *key) { key->virtual = 0; key->dev = dm_thin_dev_id(td); @@ -110,7 +481,7 @@ static void build_data_key(struct dm_thin_device *td, } static void build_virtual_key(struct dm_thin_device *td, dm_block_t b, - struct dm_cell_key *key) + struct cell_key *key) { key->virtual = 1; key->dev = dm_thin_dev_id(td); @@ -163,7 +534,7 @@ struct pool { unsigned low_water_triggered:1; /* A dm event has been sent */ unsigned no_free_space:1; /* A -ENOSPC warning has been issued */ - struct dm_bio_prison *prison; + struct bio_prison *prison; struct dm_kcopyd_client *copier; struct workqueue_struct *wq; @@ -181,8 +552,8 @@ struct pool { struct bio_list retry_on_resume_list; - struct dm_deferred_set *shared_read_ds; - struct dm_deferred_set *all_io_ds; + struct deferred_set shared_read_ds; + struct deferred_set all_io_ds; struct dm_thin_new_mapping *next_mapping; mempool_t *mapping_pool; @@ -289,8 +660,8 @@ static struct pool *__pool_table_lookup_metadata_dev(struct block_device *md_dev struct dm_thin_endio_hook { struct thin_c *tc; - struct dm_deferred_entry *shared_read_entry; - struct dm_deferred_entry *all_io_entry; + struct deferred_entry *shared_read_entry; + struct deferred_entry *all_io_entry; struct dm_thin_new_mapping *overwrite_mapping; }; @@ -506,7 +877,7 @@ static void cell_defer(struct thin_c *tc, struct dm_bio_prison_cell *cell, unsigned long flags; spin_lock_irqsave(&pool->lock, flags); - dm_cell_release(cell, &pool->deferred_bios); + cell_release(cell, &pool->deferred_bios); spin_unlock_irqrestore(&tc->pool->lock, flags); wake_worker(pool); @@ -525,7 +896,7 @@ static void cell_defer_except(struct thin_c *tc, struct dm_bio_prison_cell *cell bio_list_init(&bios); spin_lock_irqsave(&pool->lock, flags); - dm_cell_release_no_holder(cell, &pool->deferred_bios); + cell_release_no_holder(cell, &pool->deferred_bios); spin_unlock_irqrestore(&pool->lock, flags); wake_worker(pool); @@ -535,7 +906,7 @@ static void process_prepared_mapping_fail(struct dm_thin_new_mapping *m) { if (m->bio) m->bio->bi_end_io = m->saved_bi_end_io; - dm_cell_error(m->cell); + cell_error(m->cell); list_del(&m->list); mempool_free(m, m->tc->pool->mapping_pool); } @@ -550,7 +921,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m) bio->bi_end_io = m->saved_bi_end_io; if (m->err) { - dm_cell_error(m->cell); + cell_error(m->cell); goto out; } @@ -562,7 +933,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m) r = dm_thin_insert_block(tc->td, m->virt_block, m->data_block); if (r) { DMERR("dm_thin_insert_block() failed"); - dm_cell_error(m->cell); + cell_error(m->cell); goto out; } @@ -696,7 +1067,7 @@ static void schedule_copy(struct thin_c *tc, dm_block_t virt_block, m->err = 0; m->bio = NULL; - if (!dm_deferred_set_add_work(pool->shared_read_ds, &m->list)) + if (!ds_add_work(&pool->shared_read_ds, &m->list)) m->quiesced = 1; /* @@ -728,7 +1099,7 @@ static void schedule_copy(struct thin_c *tc, dm_block_t virt_block, if (r < 0) { mempool_free(m, pool->mapping_pool); DMERR("dm_kcopyd_copy() failed"); - dm_cell_error(cell); + cell_error(cell); } } } @@ -793,7 +1164,7 @@ static void schedule_zero(struct thin_c *tc, dm_block_t virt_block, if (r < 0) { mempool_free(m, pool->mapping_pool); DMERR("dm_kcopyd_zero() failed"); - dm_cell_error(cell); + cell_error(cell); } } } @@ -905,7 +1276,7 @@ static void no_space(struct dm_bio_prison_cell *cell) struct bio_list bios; bio_list_init(&bios); - dm_cell_release(cell, &bios); + cell_release(cell, &bios); while ((bio = bio_list_pop(&bios))) retry_on_resume(bio); @@ -917,13 +1288,13 @@ static void process_discard(struct thin_c *tc, struct bio *bio) unsigned long flags; struct pool *pool = tc->pool; struct dm_bio_prison_cell *cell, *cell2; - struct dm_cell_key key, key2; + struct cell_key key, key2; dm_block_t block = get_bio_block(tc, bio); struct dm_thin_lookup_result lookup_result; struct dm_thin_new_mapping *m; build_virtual_key(tc->td, block, &key); - if (dm_bio_detain(tc->pool->prison, &key, bio, &cell)) + if (bio_detain(tc->pool->prison, &key, bio, &cell)) return; r = dm_thin_find_block(tc->td, block, 1, &lookup_result); @@ -935,8 +1306,8 @@ static void process_discard(struct thin_c *tc, struct bio *bio) * on this block. */ build_data_key(tc->td, lookup_result.block, &key2); - if (dm_bio_detain(tc->pool->prison, &key2, bio, &cell2)) { - dm_cell_release_singleton(cell, bio); + if (bio_detain(tc->pool->prison, &key2, bio, &cell2)) { + cell_release_singleton(cell, bio); break; } @@ -955,7 +1326,7 @@ static void process_discard(struct thin_c *tc, struct bio *bio) m->err = 0; m->bio = bio; - if (!dm_deferred_set_add_work(pool->all_io_ds, &m->list)) { + if (!ds_add_work(&pool->all_io_ds, &m->list)) { spin_lock_irqsave(&pool->lock, flags); list_add(&m->list, &pool->prepared_discards); spin_unlock_irqrestore(&pool->lock, flags); @@ -967,8 +1338,8 @@ static void process_discard(struct thin_c *tc, struct bio *bio) * a block boundary. So we submit the discard of a * partial block appropriately. */ - dm_cell_release_singleton(cell, bio); - dm_cell_release_singleton(cell2, bio); + cell_release_singleton(cell, bio); + cell_release_singleton(cell2, bio); if ((!lookup_result.shared) && pool->pf.discard_passdown) remap_and_issue(tc, bio, lookup_result.block); else @@ -980,20 +1351,20 @@ static void process_discard(struct thin_c *tc, struct bio *bio) /* * It isn't provisioned, just forget it. */ - dm_cell_release_singleton(cell, bio); + cell_release_singleton(cell, bio); bio_endio(bio, 0); break; default: DMERR("discard: find block unexpectedly returned %d", r); - dm_cell_release_singleton(cell, bio); + cell_release_singleton(cell, bio); bio_io_error(bio); break; } } static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block, - struct dm_cell_key *key, + struct cell_key *key, struct dm_thin_lookup_result *lookup_result, struct dm_bio_prison_cell *cell) { @@ -1013,7 +1384,7 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block, default: DMERR("%s: alloc_data_block() failed, error = %d", __func__, r); - dm_cell_error(cell); + cell_error(cell); break; } } @@ -1024,14 +1395,14 @@ static void process_shared_bio(struct thin_c *tc, struct bio *bio, { struct dm_bio_prison_cell *cell; struct pool *pool = tc->pool; - struct dm_cell_key key; + struct cell_key key; /* * If cell is already occupied, then sharing is already in the process * of being broken so we have nothing further to do here. */ build_data_key(tc->td, lookup_result->block, &key); - if (dm_bio_detain(pool->prison, &key, bio, &cell)) + if (bio_detain(pool->prison, &key, bio, &cell)) return; if (bio_data_dir(bio) == WRITE && bio->bi_size) @@ -1039,9 +1410,9 @@ static void process_shared_bio(struct thin_c *tc, struct bio *bio, else { struct dm_thin_endio_hook *h = dm_get_mapinfo(bio)->ptr; - h->shared_read_entry = dm_deferred_entry_inc(pool->shared_read_ds); + h->shared_read_entry = ds_inc(&pool->shared_read_ds); - dm_cell_release_singleton(cell, bio); + cell_release_singleton(cell, bio); remap_and_issue(tc, bio, lookup_result->block); } } @@ -1056,7 +1427,7 @@ static void provision_block(struct thin_c *tc, struct bio *bio, dm_block_t block * Remap empty bios (flushes) immediately, without provisioning. */ if (!bio->bi_size) { - dm_cell_release_singleton(cell, bio); + cell_release_singleton(cell, bio); remap_and_issue(tc, bio, 0); return; } @@ -1066,7 +1437,7 @@ static void provision_block(struct thin_c *tc, struct bio *bio, dm_block_t block */ if (bio_data_dir(bio) == READ) { zero_fill_bio(bio); - dm_cell_release_singleton(cell, bio); + cell_release_singleton(cell, bio); bio_endio(bio, 0); return; } @@ -1087,7 +1458,7 @@ static void provision_block(struct thin_c *tc, struct bio *bio, dm_block_t block default: DMERR("%s: alloc_data_block() failed, error = %d", __func__, r); set_pool_mode(tc->pool, PM_READ_ONLY); - dm_cell_error(cell); + cell_error(cell); break; } } @@ -1097,7 +1468,7 @@ static void process_bio(struct thin_c *tc, struct bio *bio) int r; dm_block_t block = get_bio_block(tc, bio); struct dm_bio_prison_cell *cell; - struct dm_cell_key key; + struct cell_key key; struct dm_thin_lookup_result lookup_result; /* @@ -1105,7 +1476,7 @@ static void process_bio(struct thin_c *tc, struct bio *bio) * being provisioned so we have nothing further to do here. */ build_virtual_key(tc->td, block, &key); - if (dm_bio_detain(tc->pool->prison, &key, bio, &cell)) + if (bio_detain(tc->pool->prison, &key, bio, &cell)) return; r = dm_thin_find_block(tc->td, block, 1, &lookup_result); @@ -1120,7 +1491,7 @@ static void process_bio(struct thin_c *tc, struct bio *bio) * TODO: this will probably have to change when discard goes * back in. */ - dm_cell_release_singleton(cell, bio); + cell_release_singleton(cell, bio); if (lookup_result.shared) process_shared_bio(tc, bio, block, &lookup_result); @@ -1130,7 +1501,7 @@ static void process_bio(struct thin_c *tc, struct bio *bio) case -ENODATA: if (bio_data_dir(bio) == READ && tc->origin_dev) { - dm_cell_release_singleton(cell, bio); + cell_release_singleton(cell, bio); remap_to_origin_and_issue(tc, bio); } else provision_block(tc, bio, block, cell); @@ -1138,7 +1509,7 @@ static void process_bio(struct thin_c *tc, struct bio *bio) default: DMERR("dm_thin_find_block() failed, error = %d", r); - dm_cell_release_singleton(cell, bio); + cell_release_singleton(cell, bio); bio_io_error(bio); break; } @@ -1347,7 +1718,7 @@ static struct dm_thin_endio_hook *thin_hook_bio(struct thin_c *tc, struct bio *b h->tc = tc; h->shared_read_entry = NULL; - h->all_io_entry = bio->bi_rw & REQ_DISCARD ? NULL : dm_deferred_entry_inc(pool->all_io_ds); + h->all_io_entry = bio->bi_rw & REQ_DISCARD ? NULL : ds_inc(&pool->all_io_ds); h->overwrite_mapping = NULL; return h; @@ -1557,7 +1928,7 @@ static void __pool_destroy(struct pool *pool) if (dm_pool_metadata_close(pool->pmd) < 0) DMWARN("%s: dm_pool_metadata_close() failed.", __func__); - dm_bio_prison_destroy(pool->prison); + prison_destroy(pool->prison); dm_kcopyd_client_destroy(pool->copier); if (pool->wq) @@ -1567,8 +1938,6 @@ static void __pool_destroy(struct pool *pool) mempool_free(pool->next_mapping, pool->mapping_pool); mempool_destroy(pool->mapping_pool); mempool_destroy(pool->endio_hook_pool); - dm_deferred_set_destroy(pool->shared_read_ds); - dm_deferred_set_destroy(pool->all_io_ds); kfree(pool); } @@ -1607,7 +1976,7 @@ static struct pool *pool_create(struct mapped_device *pool_md, pool->sectors_per_block_shift = __ffs(block_size); pool->low_water_blocks = 0; pool_features_init(&pool->pf); - pool->prison = dm_bio_prison_create(PRISON_CELLS); + pool->prison = prison_create(PRISON_CELLS); if (!pool->prison) { *error = "Error creating pool's bio prison"; err_p = ERR_PTR(-ENOMEM); @@ -1643,20 +2012,8 @@ static struct pool *pool_create(struct mapped_device *pool_md, pool->low_water_triggered = 0; pool->no_free_space = 0; bio_list_init(&pool->retry_on_resume_list); - - pool->shared_read_ds = dm_deferred_set_create(); - if (!pool->shared_read_ds) { - *error = "Error creating pool's shared read deferred set"; - err_p = ERR_PTR(-ENOMEM); - goto bad_shared_read_ds; - } - - pool->all_io_ds = dm_deferred_set_create(); - if (!pool->all_io_ds) { - *error = "Error creating pool's all io deferred set"; - err_p = ERR_PTR(-ENOMEM); - goto bad_all_io_ds; - } + ds_init(&pool->shared_read_ds); + ds_init(&pool->all_io_ds); pool->next_mapping = NULL; pool->mapping_pool = mempool_create_slab_pool(MAPPING_POOL_SIZE, @@ -1685,15 +2042,11 @@ static struct pool *pool_create(struct mapped_device *pool_md, bad_endio_hook_pool: mempool_destroy(pool->mapping_pool); bad_mapping_pool: - dm_deferred_set_destroy(pool->all_io_ds); -bad_all_io_ds: - dm_deferred_set_destroy(pool->shared_read_ds); -bad_shared_read_ds: destroy_workqueue(pool->wq); bad_wq: dm_kcopyd_client_destroy(pool->copier); bad_kcopyd_client: - dm_bio_prison_destroy(pool->prison); + prison_destroy(pool->prison); bad_prison: kfree(pool); bad_pool: @@ -1919,6 +2272,15 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) goto out_flags_changed; } + /* + * The block layer requires discard_granularity to be a power of 2. + */ + if (pf.discard_enabled && !is_power_of_2(block_size)) { + ti->error = "Discard support must be disabled when the block size is not a power of 2"; + r = -EINVAL; + goto out_flags_changed; + } + pt->pool = pool; pt->ti = ti; pt->metadata_dev = metadata_dev; @@ -2400,11 +2762,6 @@ static int pool_merge(struct dm_target *ti, struct bvec_merge_data *bvm, return min(max_size, q->merge_bvec_fn(q, bvm, biovec)); } -static bool block_size_is_power_of_two(struct pool *pool) -{ - return pool->sectors_per_block_shift >= 0; -} - static void set_discard_limits(struct pool_c *pt, struct queue_limits *limits) { struct pool *pool = pt->pool; @@ -2418,15 +2775,8 @@ static void set_discard_limits(struct pool_c *pt, struct queue_limits *limits) if (pt->adjusted_pf.discard_passdown) { data_limits = &bdev_get_queue(pt->data_dev->bdev)->limits; limits->discard_granularity = data_limits->discard_granularity; - } else if (block_size_is_power_of_two(pool)) + } else limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; - else - /* - * Use largest power of 2 that is a factor of sectors_per_block - * but at least DATA_DEV_BLOCK_SIZE_MIN_SECTORS. - */ - limits->discard_granularity = max(1 << (ffs(pool->sectors_per_block) - 1), - DATA_DEV_BLOCK_SIZE_MIN_SECTORS) << SECTOR_SHIFT; } static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) @@ -2454,7 +2804,7 @@ static struct target_type pool_target = { .name = "thin-pool", .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | DM_TARGET_IMMUTABLE, - .version = {1, 5, 0}, + .version = {1, 4, 0}, .module = THIS_MODULE, .ctr = pool_ctr, .dtr = pool_dtr, @@ -2629,7 +2979,7 @@ static int thin_endio(struct dm_target *ti, if (h->shared_read_entry) { INIT_LIST_HEAD(&work); - dm_deferred_entry_dec(h->shared_read_entry, &work); + ds_dec(h->shared_read_entry, &work); spin_lock_irqsave(&pool->lock, flags); list_for_each_entry_safe(m, tmp, &work, list) { @@ -2642,7 +2992,7 @@ static int thin_endio(struct dm_target *ti, if (h->all_io_entry) { INIT_LIST_HEAD(&work); - dm_deferred_entry_dec(h->all_io_entry, &work); + ds_dec(h->all_io_entry, &work); spin_lock_irqsave(&pool->lock, flags); list_for_each_entry_safe(m, tmp, &work, list) list_add(&m->list, &pool->prepared_discards); @@ -2745,7 +3095,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) static struct target_type thin_target = { .name = "thin", - .version = {1, 5, 0}, + .version = {1, 4, 0}, .module = THIS_MODULE, .ctr = thin_ctr, .dtr = thin_dtr, @@ -2775,6 +3125,10 @@ static int __init dm_thin_init(void) r = -ENOMEM; + _cell_cache = KMEM_CACHE(dm_bio_prison_cell, 0); + if (!_cell_cache) + goto bad_cell_cache; + _new_mapping_cache = KMEM_CACHE(dm_thin_new_mapping, 0); if (!_new_mapping_cache) goto bad_new_mapping_cache; @@ -2788,6 +3142,8 @@ static int __init dm_thin_init(void) bad_endio_hook_cache: kmem_cache_destroy(_new_mapping_cache); bad_new_mapping_cache: + kmem_cache_destroy(_cell_cache); +bad_cell_cache: dm_unregister_target(&pool_target); bad_pool_target: dm_unregister_target(&thin_target); @@ -2800,6 +3156,7 @@ static void dm_thin_exit(void) dm_unregister_target(&thin_target); dm_unregister_target(&pool_target); + kmem_cache_destroy(_cell_cache); kmem_cache_destroy(_new_mapping_cache); kmem_cache_destroy(_endio_hook_cache); } diff --git a/trunk/drivers/md/dm-verity.c b/trunk/drivers/md/dm-verity.c index 9e7328bb4030..892ae2766aa6 100644 --- a/trunk/drivers/md/dm-verity.c +++ b/trunk/drivers/md/dm-verity.c @@ -438,7 +438,7 @@ static void verity_prefetch_io(struct dm_verity *v, struct dm_verity_io *io) verity_hash_at_level(v, io->block, i, &hash_block_start, NULL); verity_hash_at_level(v, io->block + io->n_blocks - 1, i, &hash_block_end, NULL); if (!i) { - unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster); + unsigned cluster = *(volatile unsigned *)&dm_verity_prefetch_cluster; cluster >>= v->data_dev_block_bits; if (unlikely(!cluster)) diff --git a/trunk/drivers/md/dm.c b/trunk/drivers/md/dm.c index 02db9183ca01..66ceaff6455c 100644 --- a/trunk/drivers/md/dm.c +++ b/trunk/drivers/md/dm.c @@ -71,7 +71,6 @@ struct dm_target_io { struct dm_io *io; struct dm_target *ti; union map_info info; - struct bio clone; }; /* @@ -215,6 +214,7 @@ struct dm_md_mempools { #define MIN_IOS 256 static struct kmem_cache *_io_cache; +static struct kmem_cache *_tio_cache; static struct kmem_cache *_rq_tio_cache; /* @@ -232,9 +232,14 @@ static int __init local_init(void) if (!_io_cache) return r; + /* allocate a slab for the target ios */ + _tio_cache = KMEM_CACHE(dm_target_io, 0); + if (!_tio_cache) + goto out_free_io_cache; + _rq_tio_cache = KMEM_CACHE(dm_rq_target_io, 0); if (!_rq_tio_cache) - goto out_free_io_cache; + goto out_free_tio_cache; _rq_bio_info_cache = KMEM_CACHE(dm_rq_clone_bio_info, 0); if (!_rq_bio_info_cache) @@ -260,6 +265,8 @@ static int __init local_init(void) kmem_cache_destroy(_rq_bio_info_cache); out_free_rq_tio_cache: kmem_cache_destroy(_rq_tio_cache); +out_free_tio_cache: + kmem_cache_destroy(_tio_cache); out_free_io_cache: kmem_cache_destroy(_io_cache); @@ -270,6 +277,7 @@ static void local_exit(void) { kmem_cache_destroy(_rq_bio_info_cache); kmem_cache_destroy(_rq_tio_cache); + kmem_cache_destroy(_tio_cache); kmem_cache_destroy(_io_cache); unregister_blkdev(_major, _name); dm_uevent_exit(); @@ -455,7 +463,7 @@ static void free_io(struct mapped_device *md, struct dm_io *io) static void free_tio(struct mapped_device *md, struct dm_target_io *tio) { - bio_put(&tio->clone); + mempool_free(tio, md->tio_pool); } static struct dm_rq_target_io *alloc_rq_tio(struct mapped_device *md, @@ -674,6 +682,7 @@ static void clone_endio(struct bio *bio, int error) } free_tio(md, tio); + bio_put(bio); dec_pending(io, error); } @@ -993,12 +1002,12 @@ int dm_set_target_max_io_len(struct dm_target *ti, sector_t len) } EXPORT_SYMBOL_GPL(dm_set_target_max_io_len); -static void __map_bio(struct dm_target *ti, struct dm_target_io *tio) +static void __map_bio(struct dm_target *ti, struct bio *clone, + struct dm_target_io *tio) { int r; sector_t sector; struct mapped_device *md; - struct bio *clone = &tio->clone; clone->bi_end_io = clone_endio; clone->bi_private = tio; @@ -1022,6 +1031,7 @@ static void __map_bio(struct dm_target *ti, struct dm_target_io *tio) /* error the io and bail out, or requeue it if needed */ md = tio->io->md; dec_pending(tio->io, r); + bio_put(clone); free_tio(md, tio); } else if (r) { DMWARN("unimplemented target map return value: %d", r); @@ -1042,13 +1052,14 @@ struct clone_info { /* * Creates a little bio that just does part of a bvec. */ -static void split_bvec(struct dm_target_io *tio, struct bio *bio, - sector_t sector, unsigned short idx, unsigned int offset, - unsigned int len, struct bio_set *bs) +static struct bio *split_bvec(struct bio *bio, sector_t sector, + unsigned short idx, unsigned int offset, + unsigned int len, struct bio_set *bs) { - struct bio *clone = &tio->clone; + struct bio *clone; struct bio_vec *bv = bio->bi_io_vec + idx; + clone = bio_alloc_bioset(GFP_NOIO, 1, bs); *clone->bi_io_vec = *bv; clone->bi_sector = sector; @@ -1065,18 +1076,20 @@ static void split_bvec(struct dm_target_io *tio, struct bio *bio, bio_integrity_trim(clone, bio_sector_offset(bio, idx, offset), len); } + + return clone; } /* * Creates a bio that consists of range of complete bvecs. */ -static void clone_bio(struct dm_target_io *tio, struct bio *bio, - sector_t sector, unsigned short idx, - unsigned short bv_count, unsigned int len, - struct bio_set *bs) +static struct bio *clone_bio(struct bio *bio, sector_t sector, + unsigned short idx, unsigned short bv_count, + unsigned int len, struct bio_set *bs) { - struct bio *clone = &tio->clone; + struct bio *clone; + clone = bio_alloc_bioset(GFP_NOIO, bio->bi_max_vecs, bs); __bio_clone(clone, bio); clone->bi_sector = sector; clone->bi_idx = idx; @@ -1091,16 +1104,14 @@ static void clone_bio(struct dm_target_io *tio, struct bio *bio, bio_integrity_trim(clone, bio_sector_offset(bio, idx, 0), len); } + + return clone; } static struct dm_target_io *alloc_tio(struct clone_info *ci, - struct dm_target *ti, int nr_iovecs) + struct dm_target *ti) { - struct dm_target_io *tio; - struct bio *clone; - - clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, ci->md->bs); - tio = container_of(clone, struct dm_target_io, clone); + struct dm_target_io *tio = mempool_alloc(ci->md->tio_pool, GFP_NOIO); tio->io = ci->io; tio->ti = ti; @@ -1112,8 +1123,8 @@ static struct dm_target_io *alloc_tio(struct clone_info *ci, static void __issue_target_request(struct clone_info *ci, struct dm_target *ti, unsigned request_nr, sector_t len) { - struct dm_target_io *tio = alloc_tio(ci, ti, ci->bio->bi_max_vecs); - struct bio *clone = &tio->clone; + struct dm_target_io *tio = alloc_tio(ci, ti); + struct bio *clone; tio->info.target_request_nr = request_nr; @@ -1122,14 +1133,14 @@ static void __issue_target_request(struct clone_info *ci, struct dm_target *ti, * ci->bio->bi_max_vecs is BIO_INLINE_VECS anyway, for both flush * and discard, so no need for concern about wasted bvec allocations. */ + clone = bio_clone_bioset(ci->bio, GFP_NOIO, ci->md->bs); - __bio_clone(clone, ci->bio); if (len) { clone->bi_sector = ci->sector; clone->bi_size = to_bytes(len); } - __map_bio(ti, tio); + __map_bio(ti, clone, tio); } static void __issue_target_requests(struct clone_info *ci, struct dm_target *ti, @@ -1158,13 +1169,14 @@ static int __clone_and_map_empty_flush(struct clone_info *ci) */ static void __clone_and_map_simple(struct clone_info *ci, struct dm_target *ti) { - struct bio *bio = ci->bio; + struct bio *clone, *bio = ci->bio; struct dm_target_io *tio; - tio = alloc_tio(ci, ti, bio->bi_max_vecs); - clone_bio(tio, bio, ci->sector, ci->idx, bio->bi_vcnt - ci->idx, - ci->sector_count, ci->md->bs); - __map_bio(ti, tio); + tio = alloc_tio(ci, ti); + clone = clone_bio(bio, ci->sector, ci->idx, + bio->bi_vcnt - ci->idx, ci->sector_count, + ci->md->bs); + __map_bio(ti, clone, tio); ci->sector_count = 0; } @@ -1202,7 +1214,7 @@ static int __clone_and_map_discard(struct clone_info *ci) static int __clone_and_map(struct clone_info *ci) { - struct bio *bio = ci->bio; + struct bio *clone, *bio = ci->bio; struct dm_target *ti; sector_t len = 0, max; struct dm_target_io *tio; @@ -1242,10 +1254,10 @@ static int __clone_and_map(struct clone_info *ci) len += bv_len; } - tio = alloc_tio(ci, ti, bio->bi_max_vecs); - clone_bio(tio, bio, ci->sector, ci->idx, i - ci->idx, len, - ci->md->bs); - __map_bio(ti, tio); + tio = alloc_tio(ci, ti); + clone = clone_bio(bio, ci->sector, ci->idx, i - ci->idx, len, + ci->md->bs); + __map_bio(ti, clone, tio); ci->sector += len; ci->sector_count -= len; @@ -1270,11 +1282,12 @@ static int __clone_and_map(struct clone_info *ci) len = min(remaining, max); - tio = alloc_tio(ci, ti, 1); - split_bvec(tio, bio, ci->sector, ci->idx, - bv->bv_offset + offset, len, ci->md->bs); + tio = alloc_tio(ci, ti); + clone = split_bvec(bio, ci->sector, ci->idx, + bv->bv_offset + offset, len, + ci->md->bs); - __map_bio(ti, tio); + __map_bio(ti, clone, tio); ci->sector += len; ci->sector_count -= len; @@ -1942,7 +1955,7 @@ static void __bind_mempools(struct mapped_device *md, struct dm_table *t) { struct dm_md_mempools *p; - if (md->io_pool && (md->tio_pool || dm_table_get_type(t) == DM_TYPE_BIO_BASED) && md->bs) + if (md->io_pool && md->tio_pool && md->bs) /* the md already has necessary mempools */ goto out; @@ -2719,16 +2732,14 @@ struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity) if (!pools->io_pool) goto free_pools_and_out; - pools->tio_pool = NULL; - if (type == DM_TYPE_REQUEST_BASED) { - pools->tio_pool = mempool_create_slab_pool(MIN_IOS, _rq_tio_cache); - if (!pools->tio_pool) - goto free_io_pool_and_out; - } + pools->tio_pool = (type == DM_TYPE_BIO_BASED) ? + mempool_create_slab_pool(MIN_IOS, _tio_cache) : + mempool_create_slab_pool(MIN_IOS, _rq_tio_cache); + if (!pools->tio_pool) + goto free_io_pool_and_out; pools->bs = (type == DM_TYPE_BIO_BASED) ? - bioset_create(pool_size, - offsetof(struct dm_target_io, clone)) : + bioset_create(pool_size, 0) : bioset_create(pool_size, offsetof(struct dm_rq_clone_bio_info, clone)); if (!pools->bs) @@ -2743,8 +2754,7 @@ struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity) bioset_free(pools->bs); free_tio_pool_and_out: - if (pools->tio_pool) - mempool_destroy(pools->tio_pool); + mempool_destroy(pools->tio_pool); free_io_pool_and_out: mempool_destroy(pools->io_pool); diff --git a/trunk/drivers/md/linear.c b/trunk/drivers/md/linear.c index 21014836bdbf..fa211d80fc0a 100644 --- a/trunk/drivers/md/linear.c +++ b/trunk/drivers/md/linear.c @@ -138,7 +138,6 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks) struct linear_conf *conf; struct md_rdev *rdev; int i, cnt; - bool discard_supported = false; conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(struct dev_info), GFP_KERNEL); @@ -172,8 +171,6 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks) conf->array_sectors += rdev->sectors; cnt++; - if (blk_queue_discard(bdev_get_queue(rdev->bdev))) - discard_supported = true; } if (cnt != raid_disks) { printk(KERN_ERR "md/linear:%s: not enough drives present. Aborting!\n", @@ -181,11 +178,6 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks) goto out; } - if (!discard_supported) - queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); - else - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); - /* * Here we calculate the device offsets. */ @@ -252,9 +244,7 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev) if (!newconf) return -ENOMEM; - oldconf = rcu_dereference_protected(mddev->private, - lockdep_is_held( - &mddev->reconfig_mutex)); + oldconf = rcu_dereference(mddev->private); mddev->raid_disks++; rcu_assign_pointer(mddev->private, newconf); md_set_array_sectors(mddev, linear_size(mddev, 0, 0)); @@ -266,10 +256,7 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev) static int linear_stop (struct mddev *mddev) { - struct linear_conf *conf = - rcu_dereference_protected(mddev->private, - lockdep_is_held( - &mddev->reconfig_mutex)); + struct linear_conf *conf = mddev->private; /* * We do not require rcu protection here since @@ -339,14 +326,6 @@ static void linear_make_request(struct mddev *mddev, struct bio *bio) bio->bi_sector = bio->bi_sector - start_sector + tmp_dev->rdev->data_offset; rcu_read_unlock(); - - if (unlikely((bio->bi_rw & REQ_DISCARD) && - !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) { - /* Just ignore it */ - bio_endio(bio, 0); - return; - } - generic_make_request(bio); } diff --git a/trunk/drivers/md/md.c b/trunk/drivers/md/md.c index 9ab768acfb62..95c88012a3b9 100644 --- a/trunk/drivers/md/md.c +++ b/trunk/drivers/md/md.c @@ -674,18 +674,7 @@ static struct md_rdev * find_rdev_nr(struct mddev *mddev, int nr) return NULL; } -static struct md_rdev *find_rdev_nr_rcu(struct mddev *mddev, int nr) -{ - struct md_rdev *rdev; - - rdev_for_each_rcu(rdev, mddev) - if (rdev->desc_nr == nr) - return rdev; - - return NULL; -} - -static struct md_rdev *find_rdev(struct mddev *mddev, dev_t dev) +static struct md_rdev * find_rdev(struct mddev * mddev, dev_t dev) { struct md_rdev *rdev; @@ -696,17 +685,6 @@ static struct md_rdev *find_rdev(struct mddev *mddev, dev_t dev) return NULL; } -static struct md_rdev *find_rdev_rcu(struct mddev *mddev, dev_t dev) -{ - struct md_rdev *rdev; - - rdev_for_each_rcu(rdev, mddev) - if (rdev->bdev->bd_dev == dev) - return rdev; - - return NULL; -} - static struct md_personality *find_pers(int level, char *clevel) { struct md_personality *pers; @@ -2044,14 +2022,8 @@ EXPORT_SYMBOL(md_integrity_register); /* Disable data integrity if non-capable/non-matching disk is being added */ void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev) { - struct blk_integrity *bi_rdev; - struct blk_integrity *bi_mddev; - - if (!mddev->gendisk) - return; - - bi_rdev = bdev_get_integrity(rdev->bdev); - bi_mddev = blk_get_integrity(mddev->gendisk); + struct blk_integrity *bi_rdev = bdev_get_integrity(rdev->bdev); + struct blk_integrity *bi_mddev = blk_get_integrity(mddev->gendisk); if (!bi_mddev) /* nothing to do */ return; @@ -3782,8 +3754,6 @@ resync_start_store(struct mddev *mddev, const char *buf, size_t len) return -EINVAL; mddev->recovery_cp = n; - if (mddev->pers) - set_bit(MD_CHANGE_CLEAN, &mddev->flags); return len; } static struct md_sysfs_entry md_resync_start = @@ -4261,13 +4231,6 @@ action_store(struct mddev *mddev, const char *page, size_t len) set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); set_bit(MD_RECOVERY_SYNC, &mddev->recovery); } - if (mddev->ro == 2) { - /* A write to sync_action is enough to justify - * canceling read-auto mode - */ - mddev->ro = 0; - md_wakeup_thread(mddev->sync_thread); - } set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); sysfs_notify_dirent_safe(mddev->sysfs_action); @@ -4278,8 +4241,7 @@ static ssize_t mismatch_cnt_show(struct mddev *mddev, char *page) { return sprintf(page, "%llu\n", - (unsigned long long) - atomic64_read(&mddev->resync_mismatches)); + (unsigned long long) mddev->resync_mismatches); } static struct md_sysfs_entry md_scan_mode = @@ -4400,10 +4362,6 @@ sync_completed_show(struct mddev *mddev, char *page) if (!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) return sprintf(page, "none\n"); - if (mddev->curr_resync == 1 || - mddev->curr_resync == 2) - return sprintf(page, "delayed\n"); - if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) || test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) max_sectors = mddev->resync_max_sectors; @@ -5249,7 +5207,7 @@ static void md_clean(struct mddev *mddev) mddev->new_layout = 0; mddev->new_chunk_sectors = 0; mddev->curr_resync = 0; - atomic64_set(&mddev->resync_mismatches, 0); + mddev->resync_mismatches = 0; mddev->suspend_lo = mddev->suspend_hi = 0; mddev->sync_speed_min = mddev->sync_speed_max = 0; mddev->recovery = 0; @@ -5551,9 +5509,8 @@ static int get_array_info(struct mddev * mddev, void __user * arg) int nr,working,insync,failed,spare; struct md_rdev *rdev; - nr = working = insync = failed = spare = 0; - rcu_read_lock(); - rdev_for_each_rcu(rdev, mddev) { + nr=working=insync=failed=spare=0; + rdev_for_each(rdev, mddev) { nr++; if (test_bit(Faulty, &rdev->flags)) failed++; @@ -5565,7 +5522,6 @@ static int get_array_info(struct mddev * mddev, void __user * arg) spare++; } } - rcu_read_unlock(); info.major_version = mddev->major_version; info.minor_version = mddev->minor_version; @@ -5649,8 +5605,7 @@ static int get_disk_info(struct mddev * mddev, void __user * arg) if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; - rcu_read_lock(); - rdev = find_rdev_nr_rcu(mddev, info.number); + rdev = find_rdev_nr(mddev, info.number); if (rdev) { info.major = MAJOR(rdev->bdev->bd_dev); info.minor = MINOR(rdev->bdev->bd_dev); @@ -5669,7 +5624,6 @@ static int get_disk_info(struct mddev * mddev, void __user * arg) info.raid_disk = -1; info.state = (1<pers == NULL) return -ENODEV; - rcu_read_lock(); - rdev = find_rdev_rcu(mddev, dev); + rdev = find_rdev(mddev, dev); if (!rdev) - err = -ENODEV; - else { - md_error(mddev, rdev); - if (!test_bit(Faulty, &rdev->flags)) - err = -EBUSY; - } - rcu_read_unlock(); - return err; + return -ENODEV; + + md_error(mddev, rdev); + if (!test_bit(Faulty, &rdev->flags)) + return -EBUSY; + return 0; } /* @@ -6365,27 +6315,6 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, goto abort; } - /* Some actions do not requires the mutex */ - switch (cmd) { - case GET_ARRAY_INFO: - if (!mddev->raid_disks && !mddev->external) - err = -ENODEV; - else - err = get_array_info(mddev, argp); - goto abort; - - case GET_DISK_INFO: - if (!mddev->raid_disks && !mddev->external) - err = -ENODEV; - else - err = get_disk_info(mddev, argp); - goto abort; - - case SET_DISK_FAULTY: - err = set_disk_faulty(mddev, new_decode_dev(arg)); - goto abort; - } - err = mddev_lock(mddev); if (err) { printk(KERN_INFO @@ -6458,10 +6387,18 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, */ switch (cmd) { + case GET_ARRAY_INFO: + err = get_array_info(mddev, argp); + goto done_unlock; + case GET_BITMAP_FILE: err = get_bitmap_file(mddev, argp); goto done_unlock; + case GET_DISK_INFO: + err = get_disk_info(mddev, argp); + goto done_unlock; + case RESTART_ARRAY_RW: err = restart_array(mddev); goto done_unlock; @@ -6543,6 +6480,10 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, err = hot_add_disk(mddev, new_decode_dev(arg)); goto done_unlock; + case SET_DISK_FAULTY: + err = set_disk_faulty(mddev, new_decode_dev(arg)); + goto done_unlock; + case RUN_ARRAY: err = do_md_run(mddev); goto done_unlock; @@ -6700,7 +6641,7 @@ static int md_thread(void * arg) clear_bit(THREAD_WAKEUP, &thread->flags); if (!kthread_should_stop()) - thread->run(thread); + thread->run(thread->mddev); } return 0; @@ -6715,8 +6656,8 @@ void md_wakeup_thread(struct md_thread *thread) } } -struct md_thread *md_register_thread(void (*run) (struct md_thread *), - struct mddev *mddev, const char *name) +struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev *mddev, + const char *name) { struct md_thread *thread; @@ -6811,11 +6752,7 @@ static void status_resync(struct seq_file *seq, struct mddev * mddev) int scale; unsigned int per_milli; - if (mddev->curr_resync <= 3) - resync = 0; - else - resync = mddev->curr_resync - - atomic_read(&mddev->recovery_active); + resync = mddev->curr_resync - atomic_read(&mddev->recovery_active); if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) || test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) @@ -7041,7 +6978,7 @@ static int md_seq_show(struct seq_file *seq, void *v) if (mddev->curr_resync > 2) { status_resync(seq, mddev); seq_printf(seq, "\n "); - } else if (mddev->curr_resync >= 1) + } else if (mddev->curr_resync == 1 || mddev->curr_resync == 2) seq_printf(seq, "\tresync=DELAYED\n "); else if (mddev->recovery_cp < MaxSector) seq_printf(seq, "\tresync=PENDING\n "); @@ -7269,9 +7206,8 @@ EXPORT_SYMBOL_GPL(md_allow_write); #define SYNC_MARKS 10 #define SYNC_MARK_STEP (3*HZ) -void md_do_sync(struct md_thread *thread) +void md_do_sync(struct mddev *mddev) { - struct mddev *mddev = thread->mddev; struct mddev *mddev2; unsigned int currspeed = 0, window; @@ -7375,7 +7311,7 @@ void md_do_sync(struct md_thread *thread) * which defaults to physical size, but can be virtual size */ max_sectors = mddev->resync_max_sectors; - atomic64_set(&mddev->resync_mismatches, 0); + mddev->resync_mismatches = 0; /* we don't use the checkpoint if there's a bitmap */ if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) j = mddev->resync_min; @@ -7431,11 +7367,8 @@ void md_do_sync(struct md_thread *thread) "md: resuming %s of %s from checkpoint.\n", desc, mdname(mddev)); mddev->curr_resync = j; - } else - mddev->curr_resync = 3; /* no longer delayed */ + } mddev->curr_resync_completed = j; - sysfs_notify(&mddev->kobj, NULL, "sync_completed"); - md_new_event(mddev); blk_start_plug(&plug); while (j < max_sectors) { @@ -7488,8 +7421,7 @@ void md_do_sync(struct md_thread *thread) break; j += sectors; - if (j > 2) - mddev->curr_resync = j; + if (j>1) mddev->curr_resync = j; mddev->curr_mark_cnt = io_sectors; if (last_check == 0) /* this is the earliest that rebuild will be @@ -7611,6 +7543,8 @@ static int remove_and_add_spares(struct mddev *mddev) int spares = 0; int removed = 0; + mddev->curr_resync_completed = 0; + rdev_for_each(rdev, mddev) if (rdev->raid_disk >= 0 && !test_bit(Blocked, &rdev->flags) && @@ -7805,7 +7739,6 @@ void md_check_recovery(struct mddev *mddev) /* Set RUNNING before clearing NEEDED to avoid * any transients in the value of "sync_action". */ - mddev->curr_resync_completed = 0; set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); /* Clear some bits that don't mean anything, but * might be left set @@ -7819,7 +7752,7 @@ void md_check_recovery(struct mddev *mddev) /* no recovery is running. * remove any failed drives, then * add spares if possible. - * Spares are also removed and re-added, to allow + * Spare are also removed and re-added, to allow * the personality to fail the re-add. */ diff --git a/trunk/drivers/md/md.h b/trunk/drivers/md/md.h index af443ab868db..f385b038589d 100644 --- a/trunk/drivers/md/md.h +++ b/trunk/drivers/md/md.h @@ -282,7 +282,7 @@ struct mddev { sector_t resync_max_sectors; /* may be set by personality */ - atomic64_t resync_mismatches; /* count of sectors where + sector_t resync_mismatches; /* count of sectors where * parity/replica mismatch found */ @@ -540,13 +540,12 @@ static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) struct md_thread { - void (*run) (struct md_thread *thread); + void (*run) (struct mddev *mddev); struct mddev *mddev; wait_queue_head_t wqueue; unsigned long flags; struct task_struct *tsk; unsigned long timeout; - void *private; }; #define THREAD_WAKEUP 0 @@ -585,7 +584,7 @@ static inline void safe_put_page(struct page *p) extern int register_md_personality(struct md_personality *p); extern int unregister_md_personality(struct md_personality *p); extern struct md_thread *md_register_thread( - void (*run)(struct md_thread *thread), + void (*run)(struct mddev *mddev), struct mddev *mddev, const char *name); extern void md_unregister_thread(struct md_thread **threadp); @@ -604,7 +603,7 @@ extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev, extern void md_super_wait(struct mddev *mddev); extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, struct page *page, int rw, bool metadata_op); -extern void md_do_sync(struct md_thread *thread); +extern void md_do_sync(struct mddev *mddev); extern void md_new_event(struct mddev *mddev); extern int md_allow_write(struct mddev *mddev); extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev); diff --git a/trunk/drivers/md/multipath.c b/trunk/drivers/md/multipath.c index 1642eae75a33..61a1833ebaf3 100644 --- a/trunk/drivers/md/multipath.c +++ b/trunk/drivers/md/multipath.c @@ -335,9 +335,8 @@ static int multipath_remove_disk(struct mddev *mddev, struct md_rdev *rdev) * 3. Performs writes following reads for array syncronising. */ -static void multipathd(struct md_thread *thread) +static void multipathd (struct mddev *mddev) { - struct mddev *mddev = thread->mddev; struct multipath_bh *mp_bh; struct bio *bio; unsigned long flags; diff --git a/trunk/drivers/md/persistent-data/dm-space-map-common.c b/trunk/drivers/md/persistent-data/dm-space-map-common.c index f3a9af8cdec3..d77602d63c83 100644 --- a/trunk/drivers/md/persistent-data/dm-space-map-common.c +++ b/trunk/drivers/md/persistent-data/dm-space-map-common.c @@ -434,14 +434,14 @@ int sm_ll_insert(struct ll_disk *ll, dm_block_t b, if (ref_count && !old) { *ev = SM_ALLOC; ll->nr_allocated++; - le32_add_cpu(&ie_disk.nr_free, -1); + ie_disk.nr_free = cpu_to_le32(le32_to_cpu(ie_disk.nr_free) - 1); if (le32_to_cpu(ie_disk.none_free_before) == bit) ie_disk.none_free_before = cpu_to_le32(bit + 1); } else if (old && !ref_count) { *ev = SM_FREE; ll->nr_allocated--; - le32_add_cpu(&ie_disk.nr_free, 1); + ie_disk.nr_free = cpu_to_le32(le32_to_cpu(ie_disk.nr_free) + 1); ie_disk.none_free_before = cpu_to_le32(min(le32_to_cpu(ie_disk.none_free_before), bit)); } diff --git a/trunk/drivers/md/raid0.c b/trunk/drivers/md/raid0.c index 24b359717a7e..a9e4fa95dfaa 100644 --- a/trunk/drivers/md/raid0.c +++ b/trunk/drivers/md/raid0.c @@ -88,7 +88,6 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) char b[BDEVNAME_SIZE]; char b2[BDEVNAME_SIZE]; struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); - bool discard_supported = false; if (!conf) return -ENOMEM; @@ -196,9 +195,6 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) if (!smallest || (rdev1->sectors < smallest->sectors)) smallest = rdev1; cnt++; - - if (blk_queue_discard(bdev_get_queue(rdev1->bdev))) - discard_supported = true; } if (cnt != mddev->raid_disks) { printk(KERN_ERR "md/raid0:%s: too few disks (%d of %d) - " @@ -276,11 +272,6 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) blk_queue_io_opt(mddev->queue, (mddev->chunk_sectors << 9) * mddev->raid_disks); - if (!discard_supported) - queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); - else - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); - pr_debug("md/raid0:%s: done.\n", mdname(mddev)); *private_conf = conf; @@ -432,7 +423,6 @@ static int raid0_run(struct mddev *mddev) return -EINVAL; blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors); - blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors); /* if private is not null, we are here after takeover */ if (mddev->private == NULL) { @@ -520,7 +510,7 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) sector_t sector = bio->bi_sector; struct bio_pair *bp; /* Sanity check -- queue functions should prevent this happening */ - if ((bio->bi_vcnt != 1 && bio->bi_vcnt != 0) || + if (bio->bi_vcnt != 1 || bio->bi_idx != 0) goto bad_map; /* This is a one page bio that upper layers @@ -546,13 +536,6 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) bio->bi_sector = sector_offset + zone->dev_start + tmp_dev->data_offset; - if (unlikely((bio->bi_rw & REQ_DISCARD) && - !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) { - /* Just ignore it */ - bio_endio(bio, 0); - return; - } - generic_make_request(bio); return; diff --git a/trunk/drivers/md/raid1.c b/trunk/drivers/md/raid1.c index 8034fbd6190c..611b5f797618 100644 --- a/trunk/drivers/md/raid1.c +++ b/trunk/drivers/md/raid1.c @@ -333,10 +333,9 @@ static void raid1_end_read_request(struct bio *bio, int error) spin_unlock_irqrestore(&conf->device_lock, flags); } - if (uptodate) { + if (uptodate) raid_end_bio_io(r1_bio); - rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); - } else { + else { /* * oops, read error: */ @@ -350,8 +349,9 @@ static void raid1_end_read_request(struct bio *bio, int error) (unsigned long long)r1_bio->sector); set_bit(R1BIO_ReadError, &r1_bio->state); reschedule_retry(r1_bio); - /* don't drop the reference on read_disk yet */ } + + rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); } static void close_write(struct r1bio *r1_bio) @@ -781,12 +781,7 @@ static void flush_pending_writes(struct r1conf *conf) while (bio) { /* submit pending writes */ struct bio *next = bio->bi_next; bio->bi_next = NULL; - if (unlikely((bio->bi_rw & REQ_DISCARD) && - !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) - /* Just ignore it */ - bio_endio(bio, 0); - else - generic_make_request(bio); + generic_make_request(bio); bio = next; } } else @@ -999,8 +994,6 @@ static void make_request(struct mddev *mddev, struct bio * bio) const int rw = bio_data_dir(bio); const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); - const unsigned long do_discard = (bio->bi_rw - & (REQ_DISCARD | REQ_SECURE)); struct md_rdev *blocked_rdev; struct blk_plug_cb *cb; struct raid1_plug_cb *plug = NULL; @@ -1302,7 +1295,7 @@ static void make_request(struct mddev *mddev, struct bio * bio) conf->mirrors[i].rdev->data_offset); mbio->bi_bdev = conf->mirrors[i].rdev->bdev; mbio->bi_end_io = raid1_end_write_request; - mbio->bi_rw = WRITE | do_flush_fua | do_sync | do_discard; + mbio->bi_rw = WRITE | do_flush_fua | do_sync; mbio->bi_private = r1_bio; atomic_inc(&r1_bio->remaining); @@ -1556,8 +1549,6 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev) clear_bit(Unmerged, &rdev->flags); } md_integrity_add_rdev(rdev, mddev); - if (blk_queue_discard(bdev_get_queue(rdev->bdev))) - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); print_conf(conf); return err; } @@ -1876,7 +1867,7 @@ static int process_checks(struct r1bio *r1_bio) } else j = 0; if (j >= 0) - atomic64_add(r1_bio->sectors, &mddev->resync_mismatches); + mddev->resync_mismatches += r1_bio->sectors; if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && test_bit(BIO_UPTODATE, &sbio->bi_flags))) { /* No need to write to this device. */ @@ -2229,7 +2220,6 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio) unfreeze_array(conf); } else md_error(mddev, conf->mirrors[r1_bio->read_disk].rdev); - rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev); bio = r1_bio->bios[r1_bio->read_disk]; bdevname(bio->bi_bdev, b); @@ -2295,9 +2285,8 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio) } } -static void raid1d(struct md_thread *thread) +static void raid1d(struct mddev *mddev) { - struct mddev *mddev = thread->mddev; struct r1bio *r1_bio; unsigned long flags; struct r1conf *conf = mddev->private; @@ -2794,7 +2783,6 @@ static int run(struct mddev *mddev) int i; struct md_rdev *rdev; int ret; - bool discard_supported = false; if (mddev->level != 1) { printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", @@ -2824,8 +2812,6 @@ static int run(struct mddev *mddev) continue; disk_stack_limits(mddev->gendisk, rdev->bdev, rdev->data_offset << 9); - if (blk_queue_discard(bdev_get_queue(rdev->bdev))) - discard_supported = true; } mddev->degraded = 0; @@ -2860,13 +2846,6 @@ static int run(struct mddev *mddev) mddev->queue->backing_dev_info.congested_fn = raid1_congested; mddev->queue->backing_dev_info.congested_data = mddev; blk_queue_merge_bvec(mddev->queue, raid1_mergeable_bvec); - - if (discard_supported) - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, - mddev->queue); - else - queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, - mddev->queue); } ret = md_integrity_register(mddev); diff --git a/trunk/drivers/md/raid10.c b/trunk/drivers/md/raid10.c index 906ccbd0f7dc..0138a727c1f3 100644 --- a/trunk/drivers/md/raid10.c +++ b/trunk/drivers/md/raid10.c @@ -911,12 +911,7 @@ static void flush_pending_writes(struct r10conf *conf) while (bio) { /* submit pending writes */ struct bio *next = bio->bi_next; bio->bi_next = NULL; - if (unlikely((bio->bi_rw & REQ_DISCARD) && - !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) - /* Just ignore it */ - bio_endio(bio, 0); - else - generic_make_request(bio); + generic_make_request(bio); bio = next; } } else @@ -1055,44 +1050,6 @@ static sector_t choose_data_offset(struct r10bio *r10_bio, return rdev->new_data_offset; } -struct raid10_plug_cb { - struct blk_plug_cb cb; - struct bio_list pending; - int pending_cnt; -}; - -static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule) -{ - struct raid10_plug_cb *plug = container_of(cb, struct raid10_plug_cb, - cb); - struct mddev *mddev = plug->cb.data; - struct r10conf *conf = mddev->private; - struct bio *bio; - - if (from_schedule) { - spin_lock_irq(&conf->device_lock); - bio_list_merge(&conf->pending_bio_list, &plug->pending); - conf->pending_count += plug->pending_cnt; - spin_unlock_irq(&conf->device_lock); - md_wakeup_thread(mddev->thread); - kfree(plug); - return; - } - - /* we aren't scheduling, so we can do the write-out directly. */ - bio = bio_list_get(&plug->pending); - bitmap_unplug(mddev->bitmap); - wake_up(&conf->wait_barrier); - - while (bio) { /* submit pending writes */ - struct bio *next = bio->bi_next; - bio->bi_next = NULL; - generic_make_request(bio); - bio = next; - } - kfree(plug); -} - static void make_request(struct mddev *mddev, struct bio * bio) { struct r10conf *conf = mddev->private; @@ -1104,12 +1061,8 @@ static void make_request(struct mddev *mddev, struct bio * bio) const int rw = bio_data_dir(bio); const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); const unsigned long do_fua = (bio->bi_rw & REQ_FUA); - const unsigned long do_discard = (bio->bi_rw - & (REQ_DISCARD | REQ_SECURE)); unsigned long flags; struct md_rdev *blocked_rdev; - struct blk_plug_cb *cb; - struct raid10_plug_cb *plug = NULL; int sectors_handled; int max_sectors; int sectors; @@ -1128,7 +1081,7 @@ static void make_request(struct mddev *mddev, struct bio * bio) || conf->prev.near_copies < conf->prev.raid_disks))) { struct bio_pair *bp; /* Sanity check -- queue functions should prevent this happening */ - if ((bio->bi_vcnt != 1 && bio->bi_vcnt != 0) || + if (bio->bi_vcnt != 1 || bio->bi_idx != 0) goto bad_map; /* This is a one page bio that upper layers @@ -1457,26 +1410,15 @@ static void make_request(struct mddev *mddev, struct bio * bio) conf->mirrors[d].rdev)); mbio->bi_bdev = conf->mirrors[d].rdev->bdev; mbio->bi_end_io = raid10_end_write_request; - mbio->bi_rw = WRITE | do_sync | do_fua | do_discard; + mbio->bi_rw = WRITE | do_sync | do_fua; mbio->bi_private = r10_bio; atomic_inc(&r10_bio->remaining); - - cb = blk_check_plugged(raid10_unplug, mddev, sizeof(*plug)); - if (cb) - plug = container_of(cb, struct raid10_plug_cb, cb); - else - plug = NULL; spin_lock_irqsave(&conf->device_lock, flags); - if (plug) { - bio_list_add(&plug->pending, mbio); - plug->pending_cnt++; - } else { - bio_list_add(&conf->pending_bio_list, mbio); - conf->pending_count++; - } + bio_list_add(&conf->pending_bio_list, mbio); + conf->pending_count++; spin_unlock_irqrestore(&conf->device_lock, flags); - if (!plug) + if (!mddev_check_plugged(mddev)) md_wakeup_thread(mddev->thread); if (!r10_bio->devs[i].repl_bio) @@ -1497,7 +1439,7 @@ static void make_request(struct mddev *mddev, struct bio * bio) conf->mirrors[d].replacement)); mbio->bi_bdev = conf->mirrors[d].replacement->bdev; mbio->bi_end_io = raid10_end_write_request; - mbio->bi_rw = WRITE | do_sync | do_fua | do_discard; + mbio->bi_rw = WRITE | do_sync | do_fua; mbio->bi_private = r10_bio; atomic_inc(&r10_bio->remaining); @@ -1696,7 +1638,7 @@ static int raid10_spare_active(struct mddev *mddev) && !test_bit(Faulty, &tmp->rdev->flags) && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { count++; - sysfs_notify_dirent_safe(tmp->rdev->sysfs_state); + sysfs_notify_dirent(tmp->rdev->sysfs_state); } } spin_lock_irqsave(&conf->device_lock, flags); @@ -1783,9 +1725,6 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) clear_bit(Unmerged, &rdev->flags); } md_integrity_add_rdev(rdev, mddev); - if (blk_queue_discard(bdev_get_queue(rdev->bdev))) - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); - print_conf(conf); return err; } @@ -2013,7 +1952,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) break; if (j == vcnt) continue; - atomic64_add(r10_bio->sectors, &mddev->resync_mismatches); + mddev->resync_mismatches += r10_bio->sectors; if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) /* Don't fix anything. */ continue; @@ -2734,9 +2673,8 @@ static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio) } } -static void raid10d(struct md_thread *thread) +static void raid10d(struct mddev *mddev) { - struct mddev *mddev = thread->mddev; struct r10bio *r10_bio; unsigned long flags; struct r10conf *conf = mddev->private; @@ -3220,7 +3158,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, else { bad_sectors -= (sector - first_bad); if (max_sync > bad_sectors) - max_sync = bad_sectors; + max_sync = max_sync; continue; } } @@ -3544,7 +3482,6 @@ static int run(struct mddev *mddev) sector_t size; sector_t min_offset_diff = 0; int first = 1; - bool discard_supported = false; if (mddev->private == NULL) { conf = setup_conf(mddev); @@ -3561,8 +3498,6 @@ static int run(struct mddev *mddev) chunk_size = mddev->chunk_sectors << 9; if (mddev->queue) { - blk_queue_max_discard_sectors(mddev->queue, - mddev->chunk_sectors); blk_queue_io_min(mddev->queue, chunk_size); if (conf->geo.raid_disks % conf->geo.near_copies) blk_queue_io_opt(mddev->queue, chunk_size * conf->geo.raid_disks); @@ -3608,16 +3543,8 @@ static int run(struct mddev *mddev) rdev->data_offset << 9); disk->head_position = 0; - - if (blk_queue_discard(bdev_get_queue(rdev->bdev))) - discard_supported = true; } - if (discard_supported) - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); - else - queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); - /* need to check that every block has at least one working mirror */ if (!enough(conf, -1)) { printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n", diff --git a/trunk/drivers/md/raid5.c b/trunk/drivers/md/raid5.c index c5439dce0295..0689173fd9f5 100644 --- a/trunk/drivers/md/raid5.c +++ b/trunk/drivers/md/raid5.c @@ -551,8 +551,6 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) rw = WRITE_FUA; else rw = WRITE; - if (test_bit(R5_Discard, &sh->dev[i].flags)) - rw |= REQ_DISCARD; } else if (test_and_clear_bit(R5_Wantread, &sh->dev[i].flags)) rw = READ; else if (test_and_clear_bit(R5_WantReplace, @@ -1176,11 +1174,8 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) set_bit(R5_WantFUA, &dev->flags); if (wbi->bi_rw & REQ_SYNC) set_bit(R5_SyncIO, &dev->flags); - if (wbi->bi_rw & REQ_DISCARD) - set_bit(R5_Discard, &dev->flags); - else - tx = async_copy_data(1, wbi, dev->page, - dev->sector, tx); + tx = async_copy_data(1, wbi, dev->page, + dev->sector, tx); wbi = r5_next_bio(wbi, dev->sector); } } @@ -1196,7 +1191,7 @@ static void ops_complete_reconstruct(void *stripe_head_ref) int pd_idx = sh->pd_idx; int qd_idx = sh->qd_idx; int i; - bool fua = false, sync = false, discard = false; + bool fua = false, sync = false; pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector); @@ -1204,15 +1199,13 @@ static void ops_complete_reconstruct(void *stripe_head_ref) for (i = disks; i--; ) { fua |= test_bit(R5_WantFUA, &sh->dev[i].flags); sync |= test_bit(R5_SyncIO, &sh->dev[i].flags); - discard |= test_bit(R5_Discard, &sh->dev[i].flags); } for (i = disks; i--; ) { struct r5dev *dev = &sh->dev[i]; if (dev->written || i == pd_idx || i == qd_idx) { - if (!discard) - set_bit(R5_UPTODATE, &dev->flags); + set_bit(R5_UPTODATE, &dev->flags); if (fua) set_bit(R5_WantFUA, &dev->flags); if (sync) @@ -1248,18 +1241,6 @@ ops_run_reconstruct5(struct stripe_head *sh, struct raid5_percpu *percpu, pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector); - for (i = 0; i < sh->disks; i++) { - if (pd_idx == i) - continue; - if (!test_bit(R5_Discard, &sh->dev[i].flags)) - break; - } - if (i >= sh->disks) { - atomic_inc(&sh->count); - set_bit(R5_Discard, &sh->dev[pd_idx].flags); - ops_complete_reconstruct(sh); - return; - } /* check if prexor is active which means only process blocks * that are part of a read-modify-write (written) */ @@ -1304,24 +1285,10 @@ ops_run_reconstruct6(struct stripe_head *sh, struct raid5_percpu *percpu, { struct async_submit_ctl submit; struct page **blocks = percpu->scribble; - int count, i; + int count; pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector); - for (i = 0; i < sh->disks; i++) { - if (sh->pd_idx == i || sh->qd_idx == i) - continue; - if (!test_bit(R5_Discard, &sh->dev[i].flags)) - break; - } - if (i >= sh->disks) { - atomic_inc(&sh->count); - set_bit(R5_Discard, &sh->dev[sh->pd_idx].flags); - set_bit(R5_Discard, &sh->dev[sh->qd_idx].flags); - ops_complete_reconstruct(sh); - return; - } - count = set_syndrome_sources(blocks, sh); atomic_inc(&sh->count); @@ -2441,11 +2408,11 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in if (sector >= sh->dev[dd_idx].sector + STRIPE_SECTORS) set_bit(R5_OVERWRITE, &sh->dev[dd_idx].flags); } + spin_unlock_irq(&sh->stripe_lock); pr_debug("added bi b#%llu to stripe s#%llu, disk %d.\n", (unsigned long long)(*bip)->bi_sector, (unsigned long long)sh->sector, dd_idx); - spin_unlock_irq(&sh->stripe_lock); if (conf->mddev->bitmap && firstwrite) { bitmap_startwrite(conf->mddev->bitmap, sh->sector, @@ -2512,8 +2479,10 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, bi = sh->dev[i].towrite; sh->dev[i].towrite = NULL; spin_unlock_irq(&sh->stripe_lock); - if (bi) + if (bi) { + s->to_write--; bitmap_end = 1; + } if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) wake_up(&conf->wait_for_overlap); @@ -2555,12 +2524,11 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, if (!test_bit(R5_Wantfill, &sh->dev[i].flags) && (!test_bit(R5_Insync, &sh->dev[i].flags) || test_bit(R5_ReadError, &sh->dev[i].flags))) { - spin_lock_irq(&sh->stripe_lock); bi = sh->dev[i].toread; sh->dev[i].toread = NULL; - spin_unlock_irq(&sh->stripe_lock); if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) wake_up(&conf->wait_for_overlap); + if (bi) s->to_read--; while (bi && bi->bi_sector < sh->dev[i].sector + STRIPE_SECTORS) { struct bio *nextbi = @@ -2773,8 +2741,7 @@ static void handle_stripe_clean_event(struct r5conf *conf, if (sh->dev[i].written) { dev = &sh->dev[i]; if (!test_bit(R5_LOCKED, &dev->flags) && - (test_bit(R5_UPTODATE, &dev->flags) || - test_and_clear_bit(R5_Discard, &dev->flags))) { + test_bit(R5_UPTODATE, &dev->flags)) { /* We can return any write requests */ struct bio *wbi, *wbi2; pr_debug("Return write for disc %d\n", i); @@ -2808,25 +2775,12 @@ static void handle_stripe_dirtying(struct r5conf *conf, int disks) { int rmw = 0, rcw = 0, i; - sector_t recovery_cp = conf->mddev->recovery_cp; - - /* RAID6 requires 'rcw' in current implementation. - * Otherwise, check whether resync is now happening or should start. - * If yes, then the array is dirty (after unclean shutdown or - * initial creation), so parity in some stripes might be inconsistent. - * In this case, we need to always do reconstruct-write, to ensure - * that in case of drive failure or read-error correction, we - * generate correct data from the parity. - */ - if (conf->max_degraded == 2 || - (recovery_cp < MaxSector && sh->sector >= recovery_cp)) { - /* Calculate the real rcw later - for now make it + if (conf->max_degraded == 2) { + /* RAID6 requires 'rcw' in current implementation + * Calculate the real rcw later - for now fake it * look like rcw is cheaper */ rcw = 1; rmw = 2; - pr_debug("force RCW max_degraded=%u, recovery_cp=%llu sh->sector=%llu\n", - conf->max_degraded, (unsigned long long)recovery_cp, - (unsigned long long)sh->sector); } else for (i = disks; i--; ) { /* would I have to read this buffer for read_modify_write */ struct r5dev *dev = &sh->dev[i]; @@ -2978,7 +2932,7 @@ static void handle_parity_checks5(struct r5conf *conf, struct stripe_head *sh, */ set_bit(STRIPE_INSYNC, &sh->state); else { - atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches); + conf->mddev->resync_mismatches += STRIPE_SECTORS; if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) /* don't try to repair!! */ set_bit(STRIPE_INSYNC, &sh->state); @@ -3130,7 +3084,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh, */ } } else { - atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches); + conf->mddev->resync_mismatches += STRIPE_SECTORS; if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) /* don't try to repair!! */ set_bit(STRIPE_INSYNC, &sh->state); @@ -3505,12 +3459,10 @@ static void handle_stripe(struct stripe_head *sh) if (s.written && (s.p_failed || ((test_bit(R5_Insync, &pdev->flags) && !test_bit(R5_LOCKED, &pdev->flags) - && (test_bit(R5_UPTODATE, &pdev->flags) || - test_bit(R5_Discard, &pdev->flags))))) && + && test_bit(R5_UPTODATE, &pdev->flags)))) && (s.q_failed || ((test_bit(R5_Insync, &qdev->flags) && !test_bit(R5_LOCKED, &qdev->flags) - && (test_bit(R5_UPTODATE, &qdev->flags) || - test_bit(R5_Discard, &qdev->flags)))))) + && test_bit(R5_UPTODATE, &qdev->flags))))) handle_stripe_clean_event(conf, sh, disks, &s.return_bi); /* Now we might consider reading some blocks, either to check/generate @@ -3537,11 +3489,9 @@ static void handle_stripe(struct stripe_head *sh) /* All the 'written' buffers and the parity block are ready to * be written back to disk */ - BUG_ON(!test_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags) && - !test_bit(R5_Discard, &sh->dev[sh->pd_idx].flags)); + BUG_ON(!test_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags)); BUG_ON(sh->qd_idx >= 0 && - !test_bit(R5_UPTODATE, &sh->dev[sh->qd_idx].flags) && - !test_bit(R5_Discard, &sh->dev[sh->qd_idx].flags)); + !test_bit(R5_UPTODATE, &sh->dev[sh->qd_idx].flags)); for (i = disks; i--; ) { struct r5dev *dev = &sh->dev[i]; if (test_bit(R5_LOCKED, &dev->flags) && @@ -4122,88 +4072,6 @@ static void release_stripe_plug(struct mddev *mddev, release_stripe(sh); } -static void make_discard_request(struct mddev *mddev, struct bio *bi) -{ - struct r5conf *conf = mddev->private; - sector_t logical_sector, last_sector; - struct stripe_head *sh; - int remaining; - int stripe_sectors; - - if (mddev->reshape_position != MaxSector) - /* Skip discard while reshape is happening */ - return; - - logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); - last_sector = bi->bi_sector + (bi->bi_size>>9); - - bi->bi_next = NULL; - bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ - - stripe_sectors = conf->chunk_sectors * - (conf->raid_disks - conf->max_degraded); - logical_sector = DIV_ROUND_UP_SECTOR_T(logical_sector, - stripe_sectors); - sector_div(last_sector, stripe_sectors); - - logical_sector *= conf->chunk_sectors; - last_sector *= conf->chunk_sectors; - - for (; logical_sector < last_sector; - logical_sector += STRIPE_SECTORS) { - DEFINE_WAIT(w); - int d; - again: - sh = get_active_stripe(conf, logical_sector, 0, 0, 0); - prepare_to_wait(&conf->wait_for_overlap, &w, - TASK_UNINTERRUPTIBLE); - spin_lock_irq(&sh->stripe_lock); - for (d = 0; d < conf->raid_disks; d++) { - if (d == sh->pd_idx || d == sh->qd_idx) - continue; - if (sh->dev[d].towrite || sh->dev[d].toread) { - set_bit(R5_Overlap, &sh->dev[d].flags); - spin_unlock_irq(&sh->stripe_lock); - release_stripe(sh); - schedule(); - goto again; - } - } - finish_wait(&conf->wait_for_overlap, &w); - for (d = 0; d < conf->raid_disks; d++) { - if (d == sh->pd_idx || d == sh->qd_idx) - continue; - sh->dev[d].towrite = bi; - set_bit(R5_OVERWRITE, &sh->dev[d].flags); - raid5_inc_bi_active_stripes(bi); - } - spin_unlock_irq(&sh->stripe_lock); - if (conf->mddev->bitmap) { - for (d = 0; - d < conf->raid_disks - conf->max_degraded; - d++) - bitmap_startwrite(mddev->bitmap, - sh->sector, - STRIPE_SECTORS, - 0); - sh->bm_seq = conf->seq_flush + 1; - set_bit(STRIPE_BIT_DELAY, &sh->state); - } - - set_bit(STRIPE_HANDLE, &sh->state); - clear_bit(STRIPE_DELAYED, &sh->state); - if (!test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) - atomic_inc(&conf->preread_active_stripes); - release_stripe_plug(mddev, sh); - } - - remaining = raid5_dec_bi_active_stripes(bi); - if (remaining == 0) { - md_write_end(mddev); - bio_endio(bi, 0); - } -} - static void make_request(struct mddev *mddev, struct bio * bi) { struct r5conf *conf = mddev->private; @@ -4226,11 +4094,6 @@ static void make_request(struct mddev *mddev, struct bio * bi) chunk_aligned_read(mddev,bi)) return; - if (unlikely(bi->bi_rw & REQ_DISCARD)) { - make_discard_request(mddev, bi); - return; - } - logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); last_sector = bi->bi_sector + (bi->bi_size>>9); bi->bi_next = NULL; @@ -4767,9 +4630,8 @@ static int handle_active_stripes(struct r5conf *conf) * During the scan, completed stripes are saved for us by the interrupt * handler, so that they will not have to wait for our next wakeup. */ -static void raid5d(struct md_thread *thread) +static void raid5d(struct mddev *mddev) { - struct mddev *mddev = thread->mddev; struct r5conf *conf = mddev->private; int handled; struct blk_plug plug; @@ -5504,7 +5366,6 @@ static int run(struct mddev *mddev) if (mddev->queue) { int chunk_size; - bool discard_supported = true; /* read-ahead size must cover two whole stripes, which * is 2 * (datadisks) * chunksize where 'n' is the * number of raid devices @@ -5524,48 +5385,13 @@ static int run(struct mddev *mddev) blk_queue_io_min(mddev->queue, chunk_size); blk_queue_io_opt(mddev->queue, chunk_size * (conf->raid_disks - conf->max_degraded)); - /* - * We can only discard a whole stripe. It doesn't make sense to - * discard data disk but write parity disk - */ - stripe = stripe * PAGE_SIZE; - mddev->queue->limits.discard_alignment = stripe; - mddev->queue->limits.discard_granularity = stripe; - /* - * unaligned part of discard request will be ignored, so can't - * guarantee discard_zerors_data - */ - mddev->queue->limits.discard_zeroes_data = 0; rdev_for_each(rdev, mddev) { disk_stack_limits(mddev->gendisk, rdev->bdev, rdev->data_offset << 9); disk_stack_limits(mddev->gendisk, rdev->bdev, rdev->new_data_offset << 9); - /* - * discard_zeroes_data is required, otherwise data - * could be lost. Consider a scenario: discard a stripe - * (the stripe could be inconsistent if - * discard_zeroes_data is 0); write one disk of the - * stripe (the stripe could be inconsistent again - * depending on which disks are used to calculate - * parity); the disk is broken; The stripe data of this - * disk is lost. - */ - if (!blk_queue_discard(bdev_get_queue(rdev->bdev)) || - !bdev_get_queue(rdev->bdev)-> - limits.discard_zeroes_data) - discard_supported = false; } - - if (discard_supported && - mddev->queue->limits.max_discard_sectors >= stripe && - mddev->queue->limits.discard_granularity >= stripe) - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, - mddev->queue); - else - queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, - mddev->queue); } return 0; @@ -5876,8 +5702,7 @@ static int check_reshape(struct mddev *mddev) if (!check_stripe_cache(mddev)) return -ENOSPC; - return resize_stripes(conf, (conf->previous_raid_disks - + mddev->delta_disks)); + return resize_stripes(conf, conf->raid_disks + mddev->delta_disks); } static int raid5_start_reshape(struct mddev *mddev) diff --git a/trunk/drivers/md/raid5.h b/trunk/drivers/md/raid5.h index 18b2c4a8a1fd..a9fc24901eda 100644 --- a/trunk/drivers/md/raid5.h +++ b/trunk/drivers/md/raid5.h @@ -298,7 +298,6 @@ enum r5dev_flags { R5_WantReplace, /* We need to update the replacement, we have read * data in, and now is a good time to write it out. */ - R5_Discard, /* Discard the stripe */ }; /* diff --git a/trunk/drivers/mmc/host/mxs-mmc.c b/trunk/drivers/mmc/host/mxs-mmc.c index 80d1e6d4b0ae..bb4c2bf04d09 100644 --- a/trunk/drivers/mmc/host/mxs-mmc.c +++ b/trunk/drivers/mmc/host/mxs-mmc.c @@ -525,7 +525,7 @@ static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK, ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); writel(BM_SSP_CTRL1_SDIO_IRQ_EN, - ssp->base + HW_SSP_CTRL1(ssp) + STMP_OFFSET_REG_SET); + host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_SET); } else { writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK, ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); diff --git a/trunk/drivers/net/ethernet/intel/e1000e/e1000.h b/trunk/drivers/net/ethernet/intel/e1000e/e1000.h index 04668b47a1df..cb3356c9af80 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/trunk/drivers/net/ethernet/intel/e1000e/e1000.h @@ -175,13 +175,13 @@ struct e1000_info; /* * in the case of WTHRESH, it appears at least the 82571/2 hardware * writes back 4 descriptors when WTHRESH=5, and 3 descriptors when - * WTHRESH=4, so a setting of 5 gives the most efficient bus - * utilization but to avoid possible Tx stalls, set it to 1 + * WTHRESH=4, and since we want 64 bytes at a time written back, set + * it to 5 */ #define E1000_TXDCTL_DMA_BURST_ENABLE \ (E1000_TXDCTL_GRAN | /* set descriptor granularity */ \ E1000_TXDCTL_COUNT_DESC | \ - (1 << 16) | /* wthresh must be +1 more than desired */\ + (5 << 16) | /* wthresh must be +1 more than desired */\ (1 << 8) | /* hthresh */ \ 0x1f) /* pthresh */ diff --git a/trunk/drivers/net/ethernet/intel/e1000e/netdev.c b/trunk/drivers/net/ethernet/intel/e1000e/netdev.c index f444eb0b76d8..de57a2ba6bde 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/trunk/drivers/net/ethernet/intel/e1000e/netdev.c @@ -2831,7 +2831,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) * set up some performance related parameters to encourage the * hardware to use the bus more efficiently in bursts, depends * on the tx_int_delay to be enabled, - * wthresh = 1 ==> burst write is disabled to avoid Tx stalls + * wthresh = 5 ==> burst write a cacheline (64 bytes) at a time * hthresh = 1 ==> prefetch when one or more available * pthresh = 0x1f ==> prefetch if internal cache 31 or less * BEWARE: this seems to work but should be considered first if diff --git a/trunk/drivers/net/ethernet/jme.c b/trunk/drivers/net/ethernet/jme.c index f8064df10cc4..c911d883c27e 100644 --- a/trunk/drivers/net/ethernet/jme.c +++ b/trunk/drivers/net/ethernet/jme.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -2974,9 +2973,6 @@ jme_init_one(struct pci_dev *pdev, /* * set up PCI device basics */ - pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | - PCIE_LINK_STATE_CLKPM); - rc = pci_enable_device(pdev); if (rc) { pr_err("Cannot enable PCI device\n"); diff --git a/trunk/drivers/net/usb/cdc_eem.c b/trunk/drivers/net/usb/cdc_eem.c index c81e278629ff..434d5af8e6fb 100644 --- a/trunk/drivers/net/usb/cdc_eem.c +++ b/trunk/drivers/net/usb/cdc_eem.c @@ -244,12 +244,8 @@ static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb) * - suspend: peripheral ready to suspend * - response: suggest N millisec polling * - response complete: suggest N sec polling - * - * Suspend is reported and maybe heeded. */ case 2: /* Suspend hint */ - usbnet_device_suggests_idle(dev); - continue; case 3: /* Response hint */ case 4: /* Response complete hint */ continue; diff --git a/trunk/drivers/net/usb/kaweth.c b/trunk/drivers/net/usb/kaweth.c index afb117c16d2d..c75e11e1b385 100644 --- a/trunk/drivers/net/usb/kaweth.c +++ b/trunk/drivers/net/usb/kaweth.c @@ -424,7 +424,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth, netdev_dbg(kaweth->net, "Downloading firmware at %p to kaweth device at %p\n", - kaweth->firmware_buf, kaweth); + fw->data, kaweth); netdev_dbg(kaweth->net, "Firmware length: %d\n", data_len); return kaweth_control(kaweth, diff --git a/trunk/drivers/net/usb/mcs7830.c b/trunk/drivers/net/usb/mcs7830.c index cc7e72010ac3..03c2d8d653df 100644 --- a/trunk/drivers/net/usb/mcs7830.c +++ b/trunk/drivers/net/usb/mcs7830.c @@ -117,7 +117,6 @@ enum { struct mcs7830_data { u8 multi_filter[8]; u8 config; - u8 link_counter; }; static const char driver_name[] = "MOSCHIP usb-ethernet driver"; @@ -633,31 +632,20 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb) static void mcs7830_status(struct usbnet *dev, struct urb *urb) { u8 *buf = urb->transfer_buffer; - bool link, link_changed; - struct mcs7830_data *data = mcs7830_get_data(dev); + bool link; if (urb->actual_length < 16) return; link = !(buf[1] & 0x20); - link_changed = netif_carrier_ok(dev->net) != link; - if (link_changed) { - data->link_counter++; - /* - track link state 20 times to guard against erroneous - link state changes reported sometimes by the chip - */ - if (data->link_counter > 20) { - data->link_counter = 0; - if (link) { - netif_carrier_on(dev->net); - usbnet_defer_kevent(dev, EVENT_LINK_RESET); - } else - netif_carrier_off(dev->net); - netdev_dbg(dev->net, "Link Status is: %d\n", link); - } - } else - data->link_counter = 0; + if (netif_carrier_ok(dev->net) != link) { + if (link) { + netif_carrier_on(dev->net); + usbnet_defer_kevent(dev, EVENT_LINK_RESET); + } else + netif_carrier_off(dev->net); + netdev_dbg(dev->net, "Link Status is: %d\n", link); + } } static const struct driver_info moschip_info = { diff --git a/trunk/drivers/net/usb/usbnet.c b/trunk/drivers/net/usb/usbnet.c index f9819d10b1f9..fc9f578a1e25 100644 --- a/trunk/drivers/net/usb/usbnet.c +++ b/trunk/drivers/net/usb/usbnet.c @@ -1588,27 +1588,10 @@ int usbnet_resume (struct usb_interface *intf) tasklet_schedule (&dev->bh); } } - - if (test_and_clear_bit(EVENT_DEVICE_REPORT_IDLE, &dev->flags)) - usb_autopm_get_interface_no_resume(intf); - return 0; } EXPORT_SYMBOL_GPL(usbnet_resume); -/* - * Either a subdriver implements manage_power, then it is assumed to always - * be ready to be suspended or it reports the readiness to be suspended - * explicitly - */ -void usbnet_device_suggests_idle(struct usbnet *dev) -{ - if (!test_and_set_bit(EVENT_DEVICE_REPORT_IDLE, &dev->flags)) { - dev->intf->needs_remote_wakeup = 1; - usb_autopm_put_interface_async(dev->intf); - } -} -EXPORT_SYMBOL(usbnet_device_suggests_idle); /*-------------------------------------------------------------------------*/ diff --git a/trunk/drivers/net/vxlan.c b/trunk/drivers/net/vxlan.c index 607976c00162..8be9bf07bd39 100644 --- a/trunk/drivers/net/vxlan.c +++ b/trunk/drivers/net/vxlan.c @@ -106,8 +106,6 @@ struct vxlan_dev { __be32 gaddr; /* multicast group */ __be32 saddr; /* source address */ unsigned int link; /* link to multicast over */ - __u16 port_min; /* source port range */ - __u16 port_max; __u8 tos; /* TOS override */ __u8 ttl; bool learn; @@ -230,9 +228,9 @@ static u32 eth_hash(const unsigned char *addr) /* only want 6 bytes */ #ifdef __BIG_ENDIAN - value >>= 16; -#else value <<= 16; +#else + value >>= 16; #endif return hash_64(value, FDB_HASH_BITS); } @@ -537,6 +535,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) } __skb_pull(skb, sizeof(struct vxlanhdr)); + skb_postpull_rcsum(skb, eth_hdr(skb), sizeof(struct vxlanhdr)); /* Is this VNI defined? */ vni = ntohl(vxh->vx_vni) >> 8; @@ -555,6 +554,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) /* Re-examine inner Ethernet packet */ oip = ip_hdr(skb); skb->protocol = eth_type_trans(skb, vxlan->dev); + skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN); /* Ignore packet loops (and multicast echo) */ if (compare_ether_addr(eth_hdr(skb)->h_source, @@ -566,7 +566,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) __skb_tunnel_rx(skb, vxlan->dev); skb_reset_network_header(skb); - skb->ip_summed = CHECKSUM_NONE; err = IP_ECN_decapsulate(oip, skb); if (unlikely(err)) { @@ -622,89 +621,46 @@ static inline u8 vxlan_ecn_encap(u8 tos, return INET_ECN_encapsulate(tos, inner); } -static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb) -{ - const struct ethhdr *eth = (struct ethhdr *) skb->data; - const struct vxlan_fdb *f; - - if (is_multicast_ether_addr(eth->h_dest)) - return vxlan->gaddr; - - f = vxlan_find_mac(vxlan, eth->h_dest); - if (f) - return f->remote_ip; - else - return vxlan->gaddr; - -} - -static void vxlan_sock_free(struct sk_buff *skb) -{ - sock_put(skb->sk); -} - -/* On transmit, associate with the tunnel socket */ -static void vxlan_set_owner(struct net_device *dev, struct sk_buff *skb) -{ - struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); - struct sock *sk = vn->sock->sk; - - skb_orphan(skb); - sock_hold(sk); - skb->sk = sk; - skb->destructor = vxlan_sock_free; -} - -/* Compute source port for outgoing packet - * first choice to use L4 flow hash since it will spread - * better and maybe available from hardware - * secondary choice is to use jhash on the Ethernet header - */ -static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb) -{ - unsigned int range = (vxlan->port_max - vxlan->port_min) + 1; - u32 hash; - - hash = skb_get_rxhash(skb); - if (!hash) - hash = jhash(skb->data, 2 * ETH_ALEN, - (__force u32) skb->protocol); - - return (((u64) hash * range) >> 32) + vxlan->port_min; -} - /* Transmit local packets over Vxlan * * Outer IP header inherits ECN and DF from inner header. * Outer UDP destination is the VXLAN assigned port. - * source port is based on hash of flow + * source port is based on hash of flow if available + * otherwise use a random value */ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) { struct vxlan_dev *vxlan = netdev_priv(dev); struct rtable *rt; + const struct ethhdr *eth; const struct iphdr *old_iph; struct iphdr *iph; struct vxlanhdr *vxh; struct udphdr *uh; struct flowi4 fl4; + struct vxlan_fdb *f; unsigned int pkt_len = skb->len; + u32 hash; __be32 dst; - __u16 src_port; __be16 df = 0; __u8 tos, ttl; int err; - dst = vxlan_find_dst(vxlan, skb); - if (!dst) - goto drop; - /* Need space for new headers (invalidates iph ptr) */ if (skb_cow_head(skb, VXLAN_HEADROOM)) goto drop; + eth = (void *)skb->data; old_iph = ip_hdr(skb); + if (!is_multicast_ether_addr(eth->h_dest) && + (f = vxlan_find_mac(vxlan, eth->h_dest))) + dst = f->remote_ip; + else if (vxlan->gaddr) { + dst = vxlan->gaddr; + } else + goto drop; + ttl = vxlan->ttl; if (!ttl && IN_MULTICAST(ntohl(dst))) ttl = 1; @@ -713,15 +669,11 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) if (tos == 1) tos = vxlan_get_dsfield(old_iph, skb); - src_port = vxlan_src_port(vxlan, skb); - - memset(&fl4, 0, sizeof(fl4)); - fl4.flowi4_oif = vxlan->link; - fl4.flowi4_tos = RT_TOS(tos); - fl4.daddr = dst; - fl4.saddr = vxlan->saddr; + hash = skb_get_rxhash(skb); - rt = ip_route_output_key(dev_net(dev), &fl4); + rt = ip_route_output_gre(dev_net(dev), &fl4, dst, + vxlan->saddr, vxlan->vni, + RT_TOS(tos), vxlan->link); if (IS_ERR(rt)) { netdev_dbg(dev, "no route to %pI4\n", &dst); dev->stats.tx_carrier_errors++; @@ -750,7 +702,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) uh = udp_hdr(skb); uh->dest = htons(vxlan_port); - uh->source = htons(src_port); + uh->source = hash ? :random32(); uh->len = htons(skb->len); uh->check = 0; @@ -763,12 +715,10 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) iph->frag_off = df; iph->protocol = IPPROTO_UDP; iph->tos = vxlan_ecn_encap(tos, old_iph, skb); - iph->daddr = dst; + iph->daddr = fl4.daddr; iph->saddr = fl4.saddr; iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); - vxlan_set_owner(dev, skb); - /* See __IPTUNNEL_XMIT */ skb->ip_summed = CHECKSUM_NONE; ip_select_ident(iph, &rt->dst, NULL); @@ -978,11 +928,9 @@ static void vxlan_setup(struct net_device *dev) { struct vxlan_dev *vxlan = netdev_priv(dev); unsigned h; - int low, high; eth_hw_addr_random(dev); ether_setup(dev); - dev->hard_header_len = ETH_HLEN + VXLAN_HEADROOM; dev->netdev_ops = &vxlan_netdev_ops; dev->destructor = vxlan_free; @@ -999,10 +947,6 @@ static void vxlan_setup(struct net_device *dev) vxlan->age_timer.function = vxlan_cleanup; vxlan->age_timer.data = (unsigned long) vxlan; - inet_get_local_port_range(&low, &high); - vxlan->port_min = low; - vxlan->port_max = high; - vxlan->dev = dev; for (h = 0; h < FDB_HASH_SIZE; ++h) @@ -1019,7 +963,6 @@ static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = { [IFLA_VXLAN_LEARNING] = { .type = NLA_U8 }, [IFLA_VXLAN_AGEING] = { .type = NLA_U32 }, [IFLA_VXLAN_LIMIT] = { .type = NLA_U32 }, - [IFLA_VXLAN_PORT_RANGE] = { .len = sizeof(struct ifla_vxlan_port_range) }, }; static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[]) @@ -1052,18 +995,6 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[]) return -EADDRNOTAVAIL; } } - - if (data[IFLA_VXLAN_PORT_RANGE]) { - const struct ifla_vxlan_port_range *p - = nla_data(data[IFLA_VXLAN_PORT_RANGE]); - - if (ntohs(p->high) < ntohs(p->low)) { - pr_debug("port range %u .. %u not valid\n", - ntohs(p->low), ntohs(p->high)); - return -EINVAL; - } - } - return 0; } @@ -1090,18 +1021,14 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, if (data[IFLA_VXLAN_LOCAL]) vxlan->saddr = nla_get_be32(data[IFLA_VXLAN_LOCAL]); - if (data[IFLA_VXLAN_LINK] && - (vxlan->link = nla_get_u32(data[IFLA_VXLAN_LINK]))) { - struct net_device *lowerdev - = __dev_get_by_index(net, vxlan->link); - - if (!lowerdev) { - pr_info("ifindex %d does not exist\n", vxlan->link); - return -ENODEV; - } + if (data[IFLA_VXLAN_LINK]) { + vxlan->link = nla_get_u32(data[IFLA_VXLAN_LINK]); - if (!tb[IFLA_MTU]) + if (!tb[IFLA_MTU]) { + struct net_device *lowerdev; + lowerdev = __dev_get_by_index(net, vxlan->link); dev->mtu = lowerdev->mtu - VXLAN_HEADROOM; + } } if (data[IFLA_VXLAN_TOS]) @@ -1118,13 +1045,6 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, if (data[IFLA_VXLAN_LIMIT]) vxlan->addrmax = nla_get_u32(data[IFLA_VXLAN_LIMIT]); - if (data[IFLA_VXLAN_PORT_RANGE]) { - const struct ifla_vxlan_port_range *p - = nla_data(data[IFLA_VXLAN_PORT_RANGE]); - vxlan->port_min = ntohs(p->low); - vxlan->port_max = ntohs(p->high); - } - err = register_netdevice(dev); if (!err) hlist_add_head_rcu(&vxlan->hlist, vni_head(net, vxlan->vni)); @@ -1153,17 +1073,12 @@ static size_t vxlan_get_size(const struct net_device *dev) nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LEARNING */ nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_AGEING */ nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LIMIT */ - nla_total_size(sizeof(struct ifla_vxlan_port_range)) + 0; } static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev) { const struct vxlan_dev *vxlan = netdev_priv(dev); - struct ifla_vxlan_port_range ports = { - .low = htons(vxlan->port_min), - .high = htons(vxlan->port_max), - }; if (nla_put_u32(skb, IFLA_VXLAN_ID, vxlan->vni)) goto nla_put_failure; @@ -1184,9 +1099,6 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev) nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan->addrmax)) goto nla_put_failure; - if (nla_put(skb, IFLA_VXLAN_PORT_RANGE, sizeof(ports), &ports)) - goto nla_put_failure; - return 0; nla_put_failure: diff --git a/trunk/drivers/net/wireless/ath/ath5k/base.c b/trunk/drivers/net/wireless/ath/ath5k/base.c index 9f31cfa56cc0..9fd6d9a9942e 100644 --- a/trunk/drivers/net/wireless/ath/ath5k/base.c +++ b/trunk/drivers/net/wireless/ath/ath5k/base.c @@ -1804,7 +1804,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { int ret; struct ath5k_hw *ah = hw->priv; - struct ath5k_vif *avf; + struct ath5k_vif *avf = (void *)vif->drv_priv; struct sk_buff *skb; if (WARN_ON(!vif)) { @@ -1819,7 +1819,6 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif) goto out; } - avf = (void *)vif->drv_priv; ath5k_txbuf_free_skb(ah, avf->bbuf); avf->bbuf->skb = skb; ret = ath5k_beacon_setup(ah, avf->bbuf); diff --git a/trunk/drivers/net/wireless/ath/ath9k/beacon.c b/trunk/drivers/net/wireless/ath/ath9k/beacon.c index 1b48414dca95..76f07d8c272d 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/beacon.c +++ b/trunk/drivers/net/wireless/ath/ath9k/beacon.c @@ -120,7 +120,7 @@ static void ath9k_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) if (ath_tx_start(hw, skb, &txctl) != 0) { ath_dbg(common, XMIT, "CABQ TX failed\n"); - ieee80211_free_txskb(hw, skb); + dev_kfree_skb_any(skb); } } diff --git a/trunk/drivers/net/wireless/ath/ath9k/hw.c b/trunk/drivers/net/wireless/ath/ath9k/hw.c index 8e1559aba495..f9a6ec5cf470 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/hw.c +++ b/trunk/drivers/net/wireless/ath/ath9k/hw.c @@ -1450,14 +1450,9 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type) REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT); - if (!ah->reset_power_on) - type = ATH9K_RESET_POWER_ON; - switch (type) { case ATH9K_RESET_POWER_ON: ret = ath9k_hw_set_reset_power_on(ah); - if (!ret) - ah->reset_power_on = true; break; case ATH9K_RESET_WARM: case ATH9K_RESET_COLD: diff --git a/trunk/drivers/net/wireless/ath/ath9k/hw.h b/trunk/drivers/net/wireless/ath/ath9k/hw.h index dbc1b7a4cbfd..566a4ce4f156 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/hw.h +++ b/trunk/drivers/net/wireless/ath/ath9k/hw.h @@ -741,7 +741,6 @@ struct ath_hw { u32 rfkill_polarity; u32 ah_flags; - bool reset_power_on; bool htc_reset_init; enum nl80211_iftype opmode; diff --git a/trunk/drivers/net/wireless/ath/ath9k/main.c b/trunk/drivers/net/wireless/ath/ath9k/main.c index dd45edfa6bae..31ab82e3ba85 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/main.c +++ b/trunk/drivers/net/wireless/ath/ath9k/main.c @@ -639,7 +639,8 @@ static int ath9k_start(struct ieee80211_hw *hw) ath_err(common, "Unable to reset hardware; reset status %d (freq %u MHz)\n", r, curchan->center_freq); - ah->reset_power_on = false; + spin_unlock_bh(&sc->sc_pcu_lock); + goto mutex_unlock; } /* Setup our intr mask. */ @@ -664,8 +665,11 @@ static int ath9k_start(struct ieee80211_hw *hw) clear_bit(SC_OP_INVALID, &sc->sc_flags); sc->sc_ah->is_monitoring = false; - if (!ath_complete_reset(sc, false)) - ah->reset_power_on = false; + if (!ath_complete_reset(sc, false)) { + r = -EIO; + spin_unlock_bh(&sc->sc_pcu_lock); + goto mutex_unlock; + } if (ah->led_pin >= 0) { ath9k_hw_cfg_output(ah, ah->led_pin, @@ -684,11 +688,12 @@ static int ath9k_start(struct ieee80211_hw *hw) if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) common->bus_ops->extn_synch_en(common); +mutex_unlock: mutex_unlock(&sc->mutex); ath9k_ps_restore(sc); - return 0; + return r; } static void ath9k_tx(struct ieee80211_hw *hw, @@ -765,7 +770,7 @@ static void ath9k_tx(struct ieee80211_hw *hw, return; exit: - ieee80211_free_txskb(hw, skb); + dev_kfree_skb_any(skb); } static void ath9k_stop(struct ieee80211_hw *hw) diff --git a/trunk/drivers/net/wireless/ath/ath9k/pci.c b/trunk/drivers/net/wireless/ath/ath9k/pci.c index f088f4bf9a26..0e630a99b68b 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/pci.c +++ b/trunk/drivers/net/wireless/ath/ath9k/pci.c @@ -324,10 +324,6 @@ static int ath_pci_suspend(struct device *device) static int ath_pci_resume(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); u32 val; /* @@ -339,9 +335,6 @@ static int ath_pci_resume(struct device *device) if ((val & 0x0000ff00) != 0) pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); - ath_pci_aspm_init(common); - ah->reset_power_on = false; - return 0; } diff --git a/trunk/drivers/net/wireless/ath/ath9k/xmit.c b/trunk/drivers/net/wireless/ath/ath9k/xmit.c index 378bd70256b2..36618e3a5e60 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/xmit.c +++ b/trunk/drivers/net/wireless/ath/ath9k/xmit.c @@ -66,7 +66,8 @@ static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, struct ath_txq *txq, struct ath_atx_tid *tid, - struct sk_buff *skb); + struct sk_buff *skb, + bool dequeue); enum { MCS_HT20, @@ -175,15 +176,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) fi = get_frame_info(skb); bf = fi->bf; - if (!bf) { - bf = ath_tx_setup_buffer(sc, txq, tid, skb); - if (!bf) { - ieee80211_free_txskb(sc->hw, skb); - continue; - } - } - - if (fi->retries) { + if (bf && fi->retries) { list_add_tail(&bf->list, &bf_head); ath_tx_update_baw(sc, tid, bf->bf_state.seqno); ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); @@ -792,13 +785,10 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, fi = get_frame_info(skb); bf = fi->bf; if (!fi->bf) - bf = ath_tx_setup_buffer(sc, txq, tid, skb); + bf = ath_tx_setup_buffer(sc, txq, tid, skb, true); - if (!bf) { - __skb_unlink(skb, &tid->buf_q); - ieee80211_free_txskb(sc->hw, skb); + if (!bf) continue; - } bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR; seqno = bf->bf_state.seqno; @@ -1741,11 +1731,9 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, return; } - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); - if (!bf) { - ieee80211_free_txskb(sc->hw, skb); + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); + if (!bf) return; - } bf->bf_state.bf_type = BUF_AMPDU; INIT_LIST_HEAD(&bf_head); @@ -1769,6 +1757,11 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf; bf = fi->bf; + if (!bf) + bf = ath_tx_setup_buffer(sc, txq, tid, skb, false); + + if (!bf) + return; INIT_LIST_HEAD(&bf_head); list_add_tail(&bf->list, &bf_head); @@ -1846,7 +1839,8 @@ u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, struct ath_txq *txq, struct ath_atx_tid *tid, - struct sk_buff *skb) + struct sk_buff *skb, + bool dequeue) { struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_frame_info *fi = get_frame_info(skb); @@ -1858,7 +1852,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, bf = ath_tx_get_buffer(sc); if (!bf) { ath_dbg(common, XMIT, "TX buffers are full\n"); - return NULL; + goto error; } ATH_TXBUF_RESET(bf); @@ -1887,12 +1881,18 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, ath_err(ath9k_hw_common(sc->sc_ah), "dma_mapping_error() on TX\n"); ath_tx_return_buffer(sc, bf); - return NULL; + goto error; } fi->bf = bf; return bf; + +error: + if (dequeue) + __skb_unlink(skb, &tid->buf_q); + dev_kfree_skb_any(skb); + return NULL; } /* FIXME: tx power */ @@ -1921,14 +1921,9 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb, */ ath_tx_send_ampdu(sc, tid, skb, txctl); } else { - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); - if (!bf) { - if (txctl->paprd) - dev_kfree_skb_any(skb); - else - ieee80211_free_txskb(sc->hw, skb); + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); + if (!bf) return; - } bf->bf_state.bfs_paprd = txctl->paprd; diff --git a/trunk/drivers/net/wireless/ath/carl9170/carl9170.h b/trunk/drivers/net/wireless/ath/carl9170/carl9170.h index 2df17f1e49ef..2aa4a59c72c8 100644 --- a/trunk/drivers/net/wireless/ath/carl9170/carl9170.h +++ b/trunk/drivers/net/wireless/ath/carl9170/carl9170.h @@ -303,7 +303,6 @@ struct ar9170 { unsigned long queue_stop_timeout[__AR9170_NUM_TXQ]; unsigned long max_queue_stop_timeout[__AR9170_NUM_TXQ]; bool needs_full_reset; - bool force_usb_reset; atomic_t pending_restarts; /* interface mode settings */ diff --git a/trunk/drivers/net/wireless/ath/carl9170/main.c b/trunk/drivers/net/wireless/ath/carl9170/main.c index 25a1e2f4f738..67997b39aba7 100644 --- a/trunk/drivers/net/wireless/ath/carl9170/main.c +++ b/trunk/drivers/net/wireless/ath/carl9170/main.c @@ -465,26 +465,27 @@ static void carl9170_restart_work(struct work_struct *work) { struct ar9170 *ar = container_of(work, struct ar9170, restart_work); - int err = -EIO; + int err; ar->usedkeys = 0; ar->filter_state = 0; carl9170_cancel_worker(ar); mutex_lock(&ar->mutex); - if (!ar->force_usb_reset) { - err = carl9170_usb_restart(ar); - if (net_ratelimit()) { - if (err) - dev_err(&ar->udev->dev, "Failed to restart device (%d).\n", err); - else - dev_info(&ar->udev->dev, "device restarted successfully.\n"); + err = carl9170_usb_restart(ar); + if (net_ratelimit()) { + if (err) { + dev_err(&ar->udev->dev, "Failed to restart device " + " (%d).\n", err); + } else { + dev_info(&ar->udev->dev, "device restarted " + "successfully.\n"); } } + carl9170_zap_queues(ar); mutex_unlock(&ar->mutex); - - if (!err && !ar->force_usb_reset) { + if (!err) { ar->restart_counter++; atomic_set(&ar->pending_restarts, 0); @@ -525,10 +526,10 @@ void carl9170_restart(struct ar9170 *ar, const enum carl9170_restart_reasons r) if (!ar->registered) return; - if (!IS_ACCEPTING_CMD(ar) || ar->needs_full_reset) - ar->force_usb_reset = true; - - ieee80211_queue_work(ar->hw, &ar->restart_work); + if (IS_ACCEPTING_CMD(ar) && !ar->needs_full_reset) + ieee80211_queue_work(ar->hw, &ar->restart_work); + else + carl9170_usb_reset(ar); /* * At this point, the device instance might have vanished/disabled. diff --git a/trunk/drivers/net/wireless/mwifiex/cfg80211.c b/trunk/drivers/net/wireless/mwifiex/cfg80211.c index 0679458a1bac..2691620393ea 100644 --- a/trunk/drivers/net/wireless/mwifiex/cfg80211.c +++ b/trunk/drivers/net/wireless/mwifiex/cfg80211.c @@ -1596,9 +1596,8 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, } } - ret = mwifiex_bss_start(priv, bss, &req_ssid); - if (ret) - return ret; + if (mwifiex_bss_start(priv, bss, &req_ssid)) + return -EFAULT; if (mode == NL80211_IFTYPE_ADHOC) { /* Inform the BSS information to kernel, otherwise @@ -1653,19 +1652,9 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, "info: association to bssid %pM failed\n", priv->cfg_bssid); memset(priv->cfg_bssid, 0, ETH_ALEN); - - if (ret > 0) - cfg80211_connect_result(priv->netdev, priv->cfg_bssid, - NULL, 0, NULL, 0, ret, - GFP_KERNEL); - else - cfg80211_connect_result(priv->netdev, priv->cfg_bssid, - NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_KERNEL); } - return 0; + return ret; } /* @@ -1813,7 +1802,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, { struct net_device *dev = request->wdev->netdev; struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - int i, offset, ret; + int i, offset; struct ieee80211_channel *chan; struct ieee_types_header *ie; @@ -1866,12 +1855,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, priv->user_scan_cfg->chan_list[i].scan_time = 0; } - - ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); - if (ret) { - dev_err(priv->adapter->dev, "scan failed: %d\n", ret); - return ret; - } + if (mwifiex_scan_networks(priv, priv->user_scan_cfg)) + return -EFAULT; if (request->ie && request->ie_len) { for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) { diff --git a/trunk/drivers/net/wireless/mwifiex/join.c b/trunk/drivers/net/wireless/mwifiex/join.c index 7b0858af8f5d..82e63cee1e97 100644 --- a/trunk/drivers/net/wireless/mwifiex/join.c +++ b/trunk/drivers/net/wireless/mwifiex/join.c @@ -1180,18 +1180,16 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, struct mwifiex_adapter *adapter = priv->adapter; struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; struct mwifiex_bssdescriptor *bss_desc; - u16 reason_code; adhoc_result = &resp->params.adhoc_result; bss_desc = priv->attempted_bss_desc; /* Join result code 0 --> SUCCESS */ - reason_code = le16_to_cpu(resp->result); - if (reason_code) { + if (le16_to_cpu(resp->result)) { dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); if (priv->media_connected) - mwifiex_reset_connect_state(priv, reason_code); + mwifiex_reset_connect_state(priv); memset(&priv->curr_bss_params.bss_descriptor, 0x00, sizeof(struct mwifiex_bssdescriptor)); diff --git a/trunk/drivers/net/wireless/mwifiex/main.h b/trunk/drivers/net/wireless/mwifiex/main.h index c2d0ab146af5..bfb3fa69805c 100644 --- a/trunk/drivers/net/wireless/mwifiex/main.h +++ b/trunk/drivers/net/wireless/mwifiex/main.h @@ -847,7 +847,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, struct mwifiex_bssdescriptor *bss_desc); int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, struct host_cmd_ds_command *resp); -void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason); +void mwifiex_reset_connect_state(struct mwifiex_private *priv); u8 mwifiex_band_to_radio_type(u8 band); int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac); int mwifiex_adhoc_start(struct mwifiex_private *priv, diff --git a/trunk/drivers/net/wireless/mwifiex/scan.c b/trunk/drivers/net/wireless/mwifiex/scan.c index 00b658d3b6ec..e36a75988f87 100644 --- a/trunk/drivers/net/wireless/mwifiex/scan.c +++ b/trunk/drivers/net/wireless/mwifiex/scan.c @@ -1296,7 +1296,7 @@ mwifiex_radio_type_to_band(u8 radio_type) int mwifiex_scan_networks(struct mwifiex_private *priv, const struct mwifiex_user_scan_cfg *user_scan_in) { - int ret; + int ret = 0; struct mwifiex_adapter *adapter = priv->adapter; struct cmd_ctrl_node *cmd_node; union mwifiex_scan_cmd_config_tlv *scan_cfg_out; @@ -1309,26 +1309,25 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, unsigned long flags; if (adapter->scan_processing) { - dev_err(adapter->dev, "cmd: Scan already in process...\n"); - return -EBUSY; - } - - if (priv->scan_block) { - dev_err(adapter->dev, - "cmd: Scan is blocked during association...\n"); - return -EBUSY; + dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); + return ret; } spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); adapter->scan_processing = true; spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); + if (priv->scan_block) { + dev_dbg(adapter->dev, + "cmd: Scan is blocked during association...\n"); + return ret; + } + scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), GFP_KERNEL); if (!scan_cfg_out) { dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); - ret = -ENOMEM; - goto done; + return -ENOMEM; } buf_size = sizeof(struct mwifiex_chan_scan_param_set) * @@ -1337,8 +1336,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, if (!scan_chan_list) { dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); kfree(scan_cfg_out); - ret = -ENOMEM; - goto done; + return -ENOMEM; } mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config, @@ -1366,16 +1364,14 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); } + } else { + spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); + adapter->scan_processing = true; + spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); } kfree(scan_cfg_out); kfree(scan_chan_list); -done: - if (ret) { - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->scan_processing = false; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - } return ret; } @@ -1434,8 +1430,8 @@ int mwifiex_check_network_compatibility(struct mwifiex_private *priv, ret = mwifiex_is_network_compatible(priv, bss_desc, priv->bss_mode); if (ret) - dev_err(priv->adapter->dev, - "Incompatible network settings\n"); + dev_err(priv->adapter->dev, "cannot find ssid " + "%s\n", bss_desc->ssid.ssid); break; default: ret = 0; diff --git a/trunk/drivers/net/wireless/mwifiex/sta_cmdresp.c b/trunk/drivers/net/wireless/mwifiex/sta_cmdresp.c index 09e6a267f566..e380171c4c5d 100644 --- a/trunk/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/trunk/drivers/net/wireless/mwifiex/sta_cmdresp.c @@ -545,7 +545,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, if (!memcmp(resp->params.deauth.mac_addr, &priv->curr_bss_params.bss_descriptor.mac_address, sizeof(resp->params.deauth.mac_addr))) - mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); + mwifiex_reset_connect_state(priv); return 0; } @@ -558,7 +558,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, struct host_cmd_ds_command *resp) { - mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); + mwifiex_reset_connect_state(priv); return 0; } diff --git a/trunk/drivers/net/wireless/mwifiex/sta_event.c b/trunk/drivers/net/wireless/mwifiex/sta_event.c index 8132119e1a21..aafde30e714a 100644 --- a/trunk/drivers/net/wireless/mwifiex/sta_event.c +++ b/trunk/drivers/net/wireless/mwifiex/sta_event.c @@ -41,7 +41,7 @@ * - Sends a disconnect event to upper layers/applications. */ void -mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) +mwifiex_reset_connect_state(struct mwifiex_private *priv) { struct mwifiex_adapter *adapter = priv->adapter; @@ -117,10 +117,10 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) priv->media_connected = false; dev_dbg(adapter->dev, "info: successfully disconnected from %pM: reason code %d\n", - priv->cfg_bssid, reason_code); + priv->cfg_bssid, WLAN_REASON_DEAUTH_LEAVING); if (priv->bss_mode == NL80211_IFTYPE_STATION) { - cfg80211_disconnected(priv->netdev, reason_code, NULL, 0, - GFP_KERNEL); + cfg80211_disconnected(priv->netdev, WLAN_REASON_DEAUTH_LEAVING, + NULL, 0, GFP_KERNEL); } memset(priv->cfg_bssid, 0, ETH_ALEN); @@ -186,7 +186,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) struct mwifiex_adapter *adapter = priv->adapter; int ret = 0; u32 eventcause = adapter->event_cause; - u16 ctrl, reason_code; + u16 ctrl; switch (eventcause) { case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: @@ -204,31 +204,22 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) case EVENT_DEAUTHENTICATED: dev_dbg(adapter->dev, "event: Deauthenticated\n"); adapter->dbg.num_event_deauth++; - if (priv->media_connected) { - reason_code = - le16_to_cpu(*(__le16 *)adapter->event_body); - mwifiex_reset_connect_state(priv, reason_code); - } + if (priv->media_connected) + mwifiex_reset_connect_state(priv); break; case EVENT_DISASSOCIATED: dev_dbg(adapter->dev, "event: Disassociated\n"); adapter->dbg.num_event_disassoc++; - if (priv->media_connected) { - reason_code = - le16_to_cpu(*(__le16 *)adapter->event_body); - mwifiex_reset_connect_state(priv, reason_code); - } + if (priv->media_connected) + mwifiex_reset_connect_state(priv); break; case EVENT_LINK_LOST: dev_dbg(adapter->dev, "event: Link lost\n"); adapter->dbg.num_event_link_lost++; - if (priv->media_connected) { - reason_code = - le16_to_cpu(*(__le16 *)adapter->event_body); - mwifiex_reset_connect_state(priv, reason_code); - } + if (priv->media_connected) + mwifiex_reset_connect_state(priv); break; case EVENT_PS_SLEEP: diff --git a/trunk/drivers/net/wireless/rt2x00/rt2800lib.c b/trunk/drivers/net/wireless/rt2x00/rt2800lib.c index 01dc8891070c..540c94f8505a 100644 --- a/trunk/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/trunk/drivers/net/wireless/rt2x00/rt2800lib.c @@ -2252,9 +2252,9 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, */ if (rt2x00_rt(rt2x00dev, RT3352)) { rt2800_bbp_write(rt2x00dev, 27, 0x0); - rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 62, 0x26 + rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 27, 0x20); - rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 62, 0x26 + rt2x00dev->lna_gain); } else { rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); diff --git a/trunk/drivers/net/xen-netback/netback.c b/trunk/drivers/net/xen-netback/netback.c index f2d6b78d901d..4ebfcf3d8a3b 100644 --- a/trunk/drivers/net/xen-netback/netback.c +++ b/trunk/drivers/net/xen-netback/netback.c @@ -335,35 +335,21 @@ unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb) for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]); - unsigned long offset = skb_shinfo(skb)->frags[i].page_offset; unsigned long bytes; - - offset &= ~PAGE_MASK; - while (size > 0) { - BUG_ON(offset >= PAGE_SIZE); BUG_ON(copy_off > MAX_BUFFER_OFFSET); - bytes = PAGE_SIZE - offset; - - if (bytes > size) - bytes = size; - - if (start_new_rx_buffer(copy_off, bytes, 0)) { + if (start_new_rx_buffer(copy_off, size, 0)) { count++; copy_off = 0; } + bytes = size; if (copy_off + bytes > MAX_BUFFER_OFFSET) bytes = MAX_BUFFER_OFFSET - copy_off; copy_off += bytes; - - offset += bytes; size -= bytes; - - if (offset == PAGE_SIZE) - offset = 0; } } return count; @@ -417,24 +403,14 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, unsigned long bytes; /* Data must not cross a page boundary. */ - BUG_ON(size + offset > PAGE_SIZE< PAGE_SIZE); meta = npo->meta + npo->meta_prod - 1; - /* Skip unused frames from start of page */ - page += offset >> PAGE_SHIFT; - offset &= ~PAGE_MASK; - while (size > 0) { - BUG_ON(offset >= PAGE_SIZE); BUG_ON(npo->copy_off > MAX_BUFFER_OFFSET); - bytes = PAGE_SIZE - offset; - - if (bytes > size) - bytes = size; - - if (start_new_rx_buffer(npo->copy_off, bytes, *head)) { + if (start_new_rx_buffer(npo->copy_off, size, *head)) { /* * Netfront requires there to be some data in the head * buffer. @@ -444,6 +420,7 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, meta = get_next_rx_buffer(vif, npo); } + bytes = size; if (npo->copy_off + bytes > MAX_BUFFER_OFFSET) bytes = MAX_BUFFER_OFFSET - npo->copy_off; @@ -476,13 +453,6 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, offset += bytes; size -= bytes; - /* Next frame */ - if (offset == PAGE_SIZE && size) { - BUG_ON(!PageCompound(page)); - page++; - offset = 0; - } - /* Leave a gap for the GSO descriptor. */ if (*head && skb_shinfo(skb)->gso_size && !vif->gso_prefix) vif->rx.req_cons++; diff --git a/trunk/drivers/platform/x86/acerhdf.c b/trunk/drivers/platform/x86/acerhdf.c index 84c56881ba80..39abb150bdd4 100644 --- a/trunk/drivers/platform/x86/acerhdf.c +++ b/trunk/drivers/platform/x86/acerhdf.c @@ -329,8 +329,7 @@ static int acerhdf_bind(struct thermal_zone_device *thermal, if (cdev != cl_dev) return 0; - if (thermal_zone_bind_cooling_device(thermal, 0, cdev, - THERMAL_NO_LIMIT, THERMAL_NO_LIMIT)) { + if (thermal_zone_bind_cooling_device(thermal, 0, cdev)) { pr_err("error binding cooling dev\n"); return -EINVAL; } @@ -662,7 +661,7 @@ static int acerhdf_register_thermal(void) return -EINVAL; thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL, - &acerhdf_dev_ops, 0, + &acerhdf_dev_ops, 0, 0, 0, (kernelmode) ? interval*1000 : 0); if (IS_ERR(thz_dev)) return -EINVAL; diff --git a/trunk/drivers/platform/x86/intel_mid_thermal.c b/trunk/drivers/platform/x86/intel_mid_thermal.c index c8097616dd62..3a27113deda9 100644 --- a/trunk/drivers/platform/x86/intel_mid_thermal.c +++ b/trunk/drivers/platform/x86/intel_mid_thermal.c @@ -502,7 +502,7 @@ static int mid_thermal_probe(struct platform_device *pdev) goto err; } pinfo->tzd[i] = thermal_zone_device_register(name[i], - 0, 0, td_info, &tzd_ops, 0, 0); + 0, 0, td_info, &tzd_ops, 0, 0, 0, 0); if (IS_ERR(pinfo->tzd[i])) { kfree(td_info); ret = PTR_ERR(pinfo->tzd[i]); diff --git a/trunk/drivers/power/power_supply_core.c b/trunk/drivers/power/power_supply_core.c index 2436f1350013..08cc8a3c15af 100644 --- a/trunk/drivers/power/power_supply_core.c +++ b/trunk/drivers/power/power_supply_core.c @@ -201,7 +201,7 @@ static int psy_register_thermal(struct power_supply *psy) for (i = 0; i < psy->num_properties; i++) { if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { psy->tzd = thermal_zone_device_register(psy->name, 0, 0, - psy, &psy_tzd_ops, 0, 0); + psy, &psy_tzd_ops, 0, 0, 0, 0); if (IS_ERR(psy->tzd)) return PTR_ERR(psy->tzd); break; diff --git a/trunk/drivers/scsi/bfa/bfa_core.c b/trunk/drivers/scsi/bfa/bfa_core.c index 342d7d9c0997..b7c326f7a6d0 100644 --- a/trunk/drivers/scsi/bfa/bfa_core.c +++ b/trunk/drivers/scsi/bfa/bfa_core.c @@ -165,16 +165,6 @@ bfa_com_phy_attach(struct bfa_s *bfa, bfa_boolean_t mincfg) bfa_phy_memclaim(phy, phy_dma->kva_curp, phy_dma->dma_curp, mincfg); } -static void -bfa_com_fru_attach(struct bfa_s *bfa, bfa_boolean_t mincfg) -{ - struct bfa_fru_s *fru = BFA_FRU(bfa); - struct bfa_mem_dma_s *fru_dma = BFA_MEM_FRU_DMA(bfa); - - bfa_fru_attach(fru, &bfa->ioc, bfa, bfa->trcmod, mincfg); - bfa_fru_memclaim(fru, fru_dma->kva_curp, fru_dma->dma_curp, mincfg); -} - /* * BFA IOC FC related definitions */ @@ -284,15 +274,6 @@ bfa_iocfc_sm_initing(struct bfa_iocfc_s *iocfc, enum iocfc_event event) case IOCFC_E_IOC_ENABLED: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_dconf_read); break; - - case IOCFC_E_DISABLE: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling); - break; - - case IOCFC_E_STOP: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_stopping); - break; - case IOCFC_E_IOC_FAILED: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_failed); break; @@ -317,15 +298,6 @@ bfa_iocfc_sm_dconf_read(struct bfa_iocfc_s *iocfc, enum iocfc_event event) case IOCFC_E_DCONF_DONE: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_cfg_wait); break; - - case IOCFC_E_DISABLE: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling); - break; - - case IOCFC_E_STOP: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_stopping); - break; - case IOCFC_E_IOC_FAILED: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_failed); break; @@ -350,15 +322,6 @@ bfa_iocfc_sm_init_cfg_wait(struct bfa_iocfc_s *iocfc, enum iocfc_event event) case IOCFC_E_CFG_DONE: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_cfg_done); break; - - case IOCFC_E_DISABLE: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling); - break; - - case IOCFC_E_STOP: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_stopping); - break; - case IOCFC_E_IOC_FAILED: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_failed); break; @@ -470,12 +433,6 @@ bfa_iocfc_sm_stopping(struct bfa_iocfc_s *iocfc, enum iocfc_event event) bfa_cb_queue(iocfc->bfa, &iocfc->bfa->iocfc.stop_hcb_qe, bfa_iocfc_stop_cb, iocfc->bfa); break; - - case IOCFC_E_IOC_ENABLED: - case IOCFC_E_DCONF_DONE: - case IOCFC_E_CFG_DONE: - break; - default: bfa_sm_fault(iocfc->bfa, event); break; @@ -497,15 +454,6 @@ bfa_iocfc_sm_enabling(struct bfa_iocfc_s *iocfc, enum iocfc_event event) case IOCFC_E_IOC_ENABLED: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_cfg_wait); break; - - case IOCFC_E_DISABLE: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling); - break; - - case IOCFC_E_STOP: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_dconf_write); - break; - case IOCFC_E_IOC_FAILED: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_failed); @@ -545,13 +493,6 @@ bfa_iocfc_sm_cfg_wait(struct bfa_iocfc_s *iocfc, enum iocfc_event event) bfa_iocfc_enable_cb, iocfc->bfa); iocfc->bfa->iocfc.cb_reqd = BFA_FALSE; break; - case IOCFC_E_DISABLE: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling); - break; - - case IOCFC_E_STOP: - bfa_fsm_set_state(iocfc, bfa_iocfc_sm_dconf_write); - break; case IOCFC_E_IOC_FAILED: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_failed); if (iocfc->bfa->iocfc.cb_reqd == BFA_FALSE) @@ -583,10 +524,6 @@ bfa_iocfc_sm_disabling(struct bfa_iocfc_s *iocfc, enum iocfc_event event) case IOCFC_E_IOC_DISABLED: bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabled); break; - case IOCFC_E_IOC_ENABLED: - case IOCFC_E_DCONF_DONE: - case IOCFC_E_CFG_DONE: - break; default: bfa_sm_fault(iocfc->bfa, event); break; @@ -848,20 +785,19 @@ void bfa_isr_enable(struct bfa_s *bfa) { u32 umsk; - int port_id = bfa_ioc_portid(&bfa->ioc); + int pci_func = bfa_ioc_pcifn(&bfa->ioc); - bfa_trc(bfa, bfa_ioc_pcifn(&bfa->ioc)); - bfa_trc(bfa, port_id); + bfa_trc(bfa, pci_func); bfa_msix_ctrl_install(bfa); if (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id)) { umsk = __HFN_INT_ERR_MASK_CT2; - umsk |= port_id == 0 ? + umsk |= pci_func == 0 ? __HFN_INT_FN0_MASK_CT2 : __HFN_INT_FN1_MASK_CT2; } else { umsk = __HFN_INT_ERR_MASK; - umsk |= port_id == 0 ? __HFN_INT_FN0_MASK : __HFN_INT_FN1_MASK; + umsk |= pci_func == 0 ? __HFN_INT_FN0_MASK : __HFN_INT_FN1_MASK; } writel(umsk, bfa->iocfc.bfa_regs.intr_status); @@ -994,8 +930,7 @@ bfa_iocfc_send_cfg(void *bfa_arg) cfg_info->single_msix_vec = 1; cfg_info->endian_sig = BFI_IOC_ENDIAN_SIG; cfg_info->num_cqs = cfg->fwcfg.num_cqs; - cfg_info->num_ioim_reqs = cpu_to_be16(bfa_fcpim_get_throttle_cfg(bfa, - cfg->fwcfg.num_ioim_reqs)); + cfg_info->num_ioim_reqs = cpu_to_be16(cfg->fwcfg.num_ioim_reqs); cfg_info->num_fwtio_reqs = cpu_to_be16(cfg->fwcfg.num_fwtio_reqs); bfa_dma_be_addr_set(cfg_info->cfgrsp_addr, iocfc->cfgrsp_dma.pa); @@ -1257,14 +1192,10 @@ bfa_iocfc_qreg(struct bfa_s *bfa, struct bfi_iocfc_qreg_s *qreg) static void bfa_iocfc_res_recfg(struct bfa_s *bfa, struct bfa_iocfc_fwcfg_s *fwcfg) { - struct bfa_iocfc_s *iocfc = &bfa->iocfc; - struct bfi_iocfc_cfg_s *cfg_info = iocfc->cfginfo; - bfa_fcxp_res_recfg(bfa, fwcfg->num_fcxp_reqs); bfa_uf_res_recfg(bfa, fwcfg->num_uf_bufs); bfa_rport_res_recfg(bfa, fwcfg->num_rports); - bfa_fcp_res_recfg(bfa, cpu_to_be16(cfg_info->num_ioim_reqs), - fwcfg->num_ioim_reqs); + bfa_fcp_res_recfg(bfa, fwcfg->num_ioim_reqs); bfa_tskim_res_recfg(bfa, fwcfg->num_tskim_reqs); } @@ -1762,7 +1693,6 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo, struct bfa_mem_dma_s *flash_dma = BFA_MEM_FLASH_DMA(bfa); struct bfa_mem_dma_s *diag_dma = BFA_MEM_DIAG_DMA(bfa); struct bfa_mem_dma_s *phy_dma = BFA_MEM_PHY_DMA(bfa); - struct bfa_mem_dma_s *fru_dma = BFA_MEM_FRU_DMA(bfa); WARN_ON((cfg == NULL) || (meminfo == NULL)); @@ -1787,8 +1717,6 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo, bfa_mem_dma_setup(meminfo, diag_dma, bfa_diag_meminfo()); bfa_mem_dma_setup(meminfo, phy_dma, bfa_phy_meminfo(cfg->drvcfg.min_cfg)); - bfa_mem_dma_setup(meminfo, fru_dma, - bfa_fru_meminfo(cfg->drvcfg.min_cfg)); } /* @@ -1861,7 +1789,6 @@ bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, bfa_com_flash_attach(bfa, cfg->drvcfg.min_cfg); bfa_com_diag_attach(bfa); bfa_com_phy_attach(bfa, cfg->drvcfg.min_cfg); - bfa_com_fru_attach(bfa, cfg->drvcfg.min_cfg); } /* diff --git a/trunk/drivers/scsi/bfa/bfa_defs.h b/trunk/drivers/scsi/bfa/bfa_defs.h index 0efdf312b42c..b5a1595cc0a5 100644 --- a/trunk/drivers/scsi/bfa/bfa_defs.h +++ b/trunk/drivers/scsi/bfa/bfa_defs.h @@ -159,13 +159,10 @@ enum bfa_status { BFA_STATUS_BEACON_ON = 72, /* Port Beacon already on */ BFA_STATUS_ENOFSAVE = 78, /* No saved firmware trace */ BFA_STATUS_IOC_DISABLED = 82, /* IOC is already disabled */ - BFA_STATUS_ERROR_TRL_ENABLED = 87, /* TRL is enabled */ - BFA_STATUS_ERROR_QOS_ENABLED = 88, /* QoS is enabled */ BFA_STATUS_NO_SFP_DEV = 89, /* No SFP device check or replace SFP */ BFA_STATUS_MEMTEST_FAILED = 90, /* Memory test failed contact support */ BFA_STATUS_LEDTEST_OP = 109, /* LED test is operating */ BFA_STATUS_INVALID_MAC = 134, /* Invalid MAC address */ - BFA_STATUS_CMD_NOTSUPP_CNA = 146, /* Command not supported for CNA */ BFA_STATUS_PBC = 154, /* Operation not allowed for pre-boot * configuration */ BFA_STATUS_BAD_FWCFG = 156, /* Bad firmware configuration */ @@ -187,17 +184,6 @@ enum bfa_status { BFA_STATUS_FAA_ACQ_ADDR = 200, /* Acquiring addr */ BFA_STATUS_ERROR_TRUNK_ENABLED = 203, /* Trunk enabled on adapter */ BFA_STATUS_MAX_ENTRY_REACHED = 212, /* MAX entry reached */ - BFA_STATUS_TOPOLOGY_LOOP = 230, /* Topology is set to Loop */ - BFA_STATUS_LOOP_UNSUPP_MEZZ = 231, /* Loop topology is not supported - * on mezz cards */ - BFA_STATUS_INVALID_BW = 233, /* Invalid bandwidth value */ - BFA_STATUS_QOS_BW_INVALID = 234, /* Invalid QOS bandwidth - * configuration */ - BFA_STATUS_DPORT_ENABLED = 235, /* D-port mode is already enabled */ - BFA_STATUS_DPORT_DISABLED = 236, /* D-port mode is already disabled */ - BFA_STATUS_CMD_NOTSUPP_MEZZ = 239, /* Cmd not supported for MEZZ card */ - BFA_STATUS_FRU_NOT_PRESENT = 240, /* fru module not present */ - BFA_STATUS_DPORT_ERR = 245, /* D-port mode is enabled */ BFA_STATUS_MAX_VAL /* Unknown error code */ }; #define bfa_status_t enum bfa_status @@ -263,10 +249,6 @@ struct bfa_adapter_attr_s { u8 is_mezz; u8 trunk_capable; - u8 mfg_day; /* manufacturing day */ - u8 mfg_month; /* manufacturing month */ - u16 mfg_year; /* manufacturing year */ - u16 rsvd; }; /* @@ -516,17 +498,6 @@ struct bfa_ioc_aen_data_s { mac_t mac; }; -/* - * D-port states - * -*/ -enum bfa_dport_state { - BFA_DPORT_ST_DISABLED = 0, /* D-port is Disabled */ - BFA_DPORT_ST_DISABLING = 1, /* D-port is Disabling */ - BFA_DPORT_ST_ENABLING = 2, /* D-port is Enabling */ - BFA_DPORT_ST_ENABLED = 3, /* D-port is Enabled */ -}; - /* * ---------------------- mfg definitions ------------ */ @@ -751,8 +722,7 @@ struct bfa_ablk_cfg_pf_s { u8 rsvd[1]; u16 num_qpairs; u16 num_vectors; - u16 bw_min; - u16 bw_max; + u32 bw; }; struct bfa_ablk_cfg_port_s { @@ -919,40 +889,11 @@ struct sfp_diag_ext_s { u8 ext_status_ctl[2]; }; -/* - * Diagnostic: Data Fields -- Address A2h - * General Use Fields: User Writable Table - Features's Control Registers - * Total 32 bytes - */ -struct sfp_usr_eeprom_s { - u8 rsvd1[2]; /* 128-129 */ - u8 ewrap; /* 130 */ - u8 rsvd2[2]; /* */ - u8 owrap; /* 133 */ - u8 rsvd3[2]; /* */ - u8 prbs; /* 136: PRBS 7 generator */ - u8 rsvd4[2]; /* */ - u8 tx_eqz_16; /* 139: TX Equalizer (16xFC) */ - u8 tx_eqz_8; /* 140: TX Equalizer (8xFC) */ - u8 rsvd5[2]; /* */ - u8 rx_emp_16; /* 143: RX Emphasis (16xFC) */ - u8 rx_emp_8; /* 144: RX Emphasis (8xFC) */ - u8 rsvd6[2]; /* */ - u8 tx_eye_adj; /* 147: TX eye Threshold Adjust */ - u8 rsvd7[3]; /* */ - u8 tx_eye_qctl; /* 151: TX eye Quality Control */ - u8 tx_eye_qres; /* 152: TX eye Quality Result */ - u8 rsvd8[2]; /* */ - u8 poh[3]; /* 155-157: Power On Hours */ - u8 rsvd9[2]; /* */ -}; - struct sfp_mem_s { struct sfp_srlid_base_s srlid_base; struct sfp_srlid_ext_s srlid_ext; struct sfp_diag_base_s diag_base; struct sfp_diag_ext_s diag_ext; - struct sfp_usr_eeprom_s usr_eeprom; }; /* diff --git a/trunk/drivers/scsi/bfa/bfa_defs_svc.h b/trunk/drivers/scsi/bfa/bfa_defs_svc.h index ec03c8cd8dac..36756ce0e58f 100644 --- a/trunk/drivers/scsi/bfa/bfa_defs_svc.h +++ b/trunk/drivers/scsi/bfa/bfa_defs_svc.h @@ -258,7 +258,6 @@ struct bfa_fw_port_lksm_stats_s { u32 hwsm_lrr_rx; /* No. of times LRR rx-ed by HWSM */ u32 hwsm_lr_rx; /* No. of times LR rx-ed by HWSM */ u32 bbsc_lr; /* LKSM LR tx for credit recovery */ - u32 rsvd; }; struct bfa_fw_port_snsm_stats_s { @@ -271,9 +270,6 @@ struct bfa_fw_port_snsm_stats_s { u32 sync_lost; /* Sync loss count */ u32 sig_lost; /* Signal loss count */ u32 asn8g_attempts; /* SNSM HWSM at 8Gbps attempts */ - u32 adapt_success; /* SNSM adaptation success */ - u32 adapt_fails; /* SNSM adaptation failures */ - u32 adapt_ign_fails; /* SNSM adaptation failures ignored */ }; struct bfa_fw_port_physm_stats_s { @@ -328,46 +324,12 @@ struct bfa_fw_fcoe_port_stats_s { struct bfa_fw_fip_stats_s fip_stats; }; -/** - * @brief LPSM statistics - */ -struct bfa_fw_lpsm_stats_s { - u32 cls_rx; /* LPSM cls_rx */ - u32 cls_tx; /* LPSM cls_tx */ - u32 arbf0_rx; /* LPSM abrf0 rcvd */ - u32 arbf0_tx; /* LPSM abrf0 xmit */ - u32 init_rx; /* LPSM loop init start */ - u32 unexp_hwst; /* LPSM unknown hw state */ - u32 unexp_frame; /* LPSM unknown_frame */ - u32 unexp_prim; /* LPSM unexpected primitive */ - u32 prev_alpa_unavail; /* LPSM prev alpa unavailable */ - u32 alpa_unavail; /* LPSM alpa not available */ - u32 lip_rx; /* LPSM lip rcvd */ - u32 lip_f7f7_rx; /* LPSM lip f7f7 rcvd */ - u32 lip_f8_rx; /* LPSM lip f8 rcvd */ - u32 lip_f8f7_rx; /* LPSM lip f8f7 rcvd */ - u32 lip_other_rx; /* LPSM lip other rcvd */ - u32 lip_tx; /* LPSM lip xmit */ - u32 retry_tov; /* LPSM retry TOV */ - u32 lip_tov; /* LPSM LIP wait TOV */ - u32 idle_tov; /* LPSM idle wait TOV */ - u32 arbf0_tov; /* LPSM arbfo wait TOV */ - u32 stop_loop_tov; /* LPSM stop loop wait TOV */ - u32 lixa_tov; /* LPSM lisa wait TOV */ - u32 lixx_tov; /* LPSM lilp/lirp wait TOV */ - u32 cls_tov; /* LPSM cls wait TOV */ - u32 sler; /* LPSM SLER recvd */ - u32 failed; /* LPSM failed */ - u32 success; /* LPSM online */ -}; - /* * IOC firmware FC uport stats */ struct bfa_fw_fc_uport_stats_s { struct bfa_fw_port_snsm_stats_s snsm_stats; struct bfa_fw_port_lksm_stats_s lksm_stats; - struct bfa_fw_lpsm_stats_s lpsm_stats; }; /* @@ -395,6 +357,11 @@ struct bfa_fw_fcxchg_stats_s { u32 ua_state_inv; }; +struct bfa_fw_lpsm_stats_s { + u32 cls_rx; + u32 cls_tx; +}; + /* * Trunk statistics */ @@ -487,6 +454,7 @@ struct bfa_fw_stats_s { struct bfa_fw_io_stats_s io_stats; struct bfa_fw_port_stats_s port_stats; struct bfa_fw_fcxchg_stats_s fcxchg_stats; + struct bfa_fw_lpsm_stats_s lpsm_stats; struct bfa_fw_lps_stats_s lps_stats; struct bfa_fw_trunk_stats_s trunk_stats; struct bfa_fw_advsm_stats_s advsm_stats; @@ -526,23 +494,13 @@ enum bfa_qos_bw_alloc { BFA_QOS_BW_LOW = 10, /* bandwidth allocation for Low */ }; #pragma pack(1) - -struct bfa_qos_bw_s { - u8 qos_bw_set; - u8 high; - u8 med; - u8 low; -}; - /* * QoS attribute returned in QoS Query */ struct bfa_qos_attr_s { - u8 state; /* QoS current state */ - u8 rsvd1[3]; - u32 total_bb_cr; /* Total BB Credits */ - struct bfa_qos_bw_s qos_bw; /* QOS bw cfg */ - struct bfa_qos_bw_s qos_bw_op; /* QOS bw operational */ + u8 state; /* QoS current state */ + u8 rsvd[3]; + u32 total_bb_cr; /* Total BB Credits */ }; /* @@ -734,8 +692,7 @@ enum bfa_port_states { BFA_PORT_ST_FWMISMATCH = 12, BFA_PORT_ST_PREBOOT_DISABLED = 13, BFA_PORT_ST_TOGGLING_QWAIT = 14, - BFA_PORT_ST_FAA_MISCONFIG = 15, - BFA_PORT_ST_DPORT = 16, + BFA_PORT_ST_ACQ_ADDR = 15, BFA_PORT_ST_MAX_STATE, }; @@ -757,11 +714,9 @@ enum bfa_port_type { */ enum bfa_port_topology { BFA_PORT_TOPOLOGY_NONE = 0, /* No valid topology */ - BFA_PORT_TOPOLOGY_P2P_OLD_VER = 1, /* P2P def for older ver */ - BFA_PORT_TOPOLOGY_LOOP = 2, /* LOOP topology */ - BFA_PORT_TOPOLOGY_AUTO_OLD_VER = 3, /* auto def for older ver */ - BFA_PORT_TOPOLOGY_AUTO = 4, /* auto topology selection */ - BFA_PORT_TOPOLOGY_P2P = 5, /* P2P only */ + BFA_PORT_TOPOLOGY_P2P = 1, /* P2P only */ + BFA_PORT_TOPOLOGY_LOOP = 2, /* LOOP topology */ + BFA_PORT_TOPOLOGY_AUTO = 3, /* auto topology selection */ }; /* @@ -805,7 +760,6 @@ enum bfa_port_linkstate_rsn { BFA_PORT_LINKSTATE_RSN_LOCAL_FAULT = 9, BFA_PORT_LINKSTATE_RSN_REMOTE_FAULT = 10, BFA_PORT_LINKSTATE_RSN_TIMEOUT = 11, - BFA_PORT_LINKSTATE_RSN_FAA_MISCONFIG = 12, @@ -879,19 +833,6 @@ struct bfa_lunmask_cfg_s { struct bfa_lun_mask_s lun_list[MAX_LUN_MASK_CFG]; }; -struct bfa_throttle_cfg_s { - u16 is_valid; - u16 value; - u32 rsvd; -}; - -struct bfa_defs_fcpim_throttle_s { - u16 max_value; - u16 cur_value; - u16 cfg_value; - u16 rsvd; -}; - /* * Physical port configuration */ @@ -910,10 +851,9 @@ struct bfa_port_cfg_s { u8 bb_scn; /* BB_SCN value from FLOGI Exchg */ u8 bb_scn_state; /* Config state of BB_SCN */ u8 faa_state; /* FAA enabled/disabled */ - u8 rsvd1; + u8 rsvd[1]; u16 path_tov; /* device path timeout */ u16 q_depth; /* SCSI Queue depth */ - struct bfa_qos_bw_s qos_bw; /* QOS bandwidth */ }; #pragma pack() @@ -961,7 +901,7 @@ struct bfa_port_attr_s { /* FCoE specific */ u16 fcoe_vlan; - u8 rsvd1[6]; + u8 rsvd1[2]; }; /* @@ -1031,13 +971,6 @@ struct bfa_trunk_vc_attr_s { u16 vc_credits[8]; }; -struct bfa_fcport_loop_info_s { - u8 myalpa; /* alpa claimed */ - u8 alpabm_val; /* alpa bitmap valid or not (1 or 0) */ - u8 resvd[6]; - struct fc_alpabm_s alpabm; /* alpa bitmap */ -}; - /* * Link state information */ @@ -1048,18 +981,13 @@ struct bfa_port_link_s { u8 speed; /* Link speed (1/2/4/8 G) */ u32 linkstate_opt; /* Linkstate optional data (debug) */ u8 trunked; /* Trunked or not (1 or 0) */ - u8 resvd[7]; + u8 resvd[3]; struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ union { - struct bfa_fcport_loop_info_s loop_info; - union { - struct bfa_qos_vc_attr_s qos_vc_attr; - /* VC info from ELP */ - struct bfa_trunk_vc_attr_s trunk_vc_attr; - struct bfa_fcport_fcf_s fcf; - /* FCF information (for FCoE) */ - } vc_fcf; - } attr; + struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */ + struct bfa_trunk_vc_attr_s trunk_vc_attr; + struct bfa_fcport_fcf_s fcf; /* FCF information (for FCoE) */ + } vc_fcf; }; #pragma pack() @@ -1184,9 +1112,6 @@ struct bfa_port_fc_stats_s { u64 tx_frames; /* Tx frames */ u64 tx_words; /* Tx words */ u64 tx_lip; /* Tx LIP */ - u64 tx_lip_f7f7; /* Tx LIP_F7F7 */ - u64 tx_lip_f8f7; /* Tx LIP_F8F7 */ - u64 tx_arbf0; /* Tx ARB F0 */ u64 tx_nos; /* Tx NOS */ u64 tx_ols; /* Tx OLS */ u64 tx_lr; /* Tx LR */ @@ -1194,9 +1119,6 @@ struct bfa_port_fc_stats_s { u64 rx_frames; /* Rx frames */ u64 rx_words; /* Rx words */ u64 lip_count; /* Rx LIP */ - u64 rx_lip_f7f7; /* Rx LIP_F7F7 */ - u64 rx_lip_f8f7; /* Rx LIP_F8F7 */ - u64 rx_arbf0; /* Rx ARB F0 */ u64 nos_count; /* Rx NOS */ u64 ols_count; /* Rx OLS */ u64 lr_count; /* Rx LR */ @@ -1218,7 +1140,6 @@ struct bfa_port_fc_stats_s { u64 bbsc_frames_lost; /* Credit Recovery-Frames Lost */ u64 bbsc_credits_lost; /* Credit Recovery-Credits Lost */ u64 bbsc_link_resets; /* Credit Recovery-Link Resets */ - u64 loop_timeouts; /* Loop timeouts */ }; /* diff --git a/trunk/drivers/scsi/bfa/bfa_fc.h b/trunk/drivers/scsi/bfa/bfa_fc.h index bea821b98030..e0beb4d7e264 100644 --- a/trunk/drivers/scsi/bfa/bfa_fc.h +++ b/trunk/drivers/scsi/bfa/bfa_fc.h @@ -24,7 +24,6 @@ typedef u64 wwn_t; #define WWN_NULL (0) #define FC_SYMNAME_MAX 256 /* max name server symbolic name size */ -#define FC_ALPA_MAX 128 #pragma pack(1) @@ -1016,10 +1015,6 @@ struct fc_symname_s { u8 symname[FC_SYMNAME_MAX]; }; -struct fc_alpabm_s { - u8 alpa_bm[FC_ALPA_MAX / 8]; -}; - /* * protocol default timeout values */ diff --git a/trunk/drivers/scsi/bfa/bfa_fcbuild.c b/trunk/drivers/scsi/bfa/bfa_fcbuild.c index dce787f6cca2..273cee90b3b4 100644 --- a/trunk/drivers/scsi/bfa/bfa_fcbuild.c +++ b/trunk/drivers/scsi/bfa/bfa_fcbuild.c @@ -228,10 +228,6 @@ fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, memcpy(plogi, &plogi_tmpl, sizeof(struct fc_logi_s)); - /* For FC AL bb_cr is 0 and altbbcred is 1 */ - if (!bb_cr) - plogi->csp.altbbcred = 1; - plogi->els_cmd.els_code = els_code; if (els_code == FC_ELS_PLOGI) fc_els_req_build(fchs, d_id, s_id, ox_id); diff --git a/trunk/drivers/scsi/bfa/bfa_fcpim.c b/trunk/drivers/scsi/bfa/bfa_fcpim.c index 27b560962357..1633963c66ca 100644 --- a/trunk/drivers/scsi/bfa/bfa_fcpim.c +++ b/trunk/drivers/scsi/bfa/bfa_fcpim.c @@ -158,7 +158,6 @@ enum bfa_tskim_event { BFA_TSKIM_SM_IOS_DONE = 7, /* IO and sub TM completions */ BFA_TSKIM_SM_CLEANUP = 8, /* TM cleanup on ITN offline */ BFA_TSKIM_SM_CLEANUP_DONE = 9, /* TM abort completion */ - BFA_TSKIM_SM_UTAG = 10, /* TM completion unknown tag */ }; /* @@ -3037,7 +3036,7 @@ bfa_ioim_abort(struct bfa_ioim_s *ioim) static void bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) { - bfa_trc(tskim->bfa, tskim->tsk_tag << 16 | event); + bfa_trc(tskim->bfa, event); switch (event) { case BFA_TSKIM_SM_START: @@ -3075,7 +3074,7 @@ bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) static void bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) { - bfa_trc(tskim->bfa, tskim->tsk_tag << 16 | event); + bfa_trc(tskim->bfa, event); switch (event) { case BFA_TSKIM_SM_DONE: @@ -3111,7 +3110,7 @@ bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) static void bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) { - bfa_trc(tskim->bfa, tskim->tsk_tag << 16 | event); + bfa_trc(tskim->bfa, event); switch (event) { case BFA_TSKIM_SM_DONE: @@ -3120,7 +3119,6 @@ bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) */ break; - case BFA_TSKIM_SM_UTAG: case BFA_TSKIM_SM_CLEANUP_DONE: bfa_sm_set_state(tskim, bfa_tskim_sm_iocleanup); bfa_tskim_cleanup_ios(tskim); @@ -3140,7 +3138,7 @@ bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) static void bfa_tskim_sm_iocleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) { - bfa_trc(tskim->bfa, tskim->tsk_tag << 16 | event); + bfa_trc(tskim->bfa, event); switch (event) { case BFA_TSKIM_SM_IOS_DONE: @@ -3172,7 +3170,7 @@ bfa_tskim_sm_iocleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) static void bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) { - bfa_trc(tskim->bfa, tskim->tsk_tag << 16 | event); + bfa_trc(tskim->bfa, event); switch (event) { case BFA_TSKIM_SM_QRESUME: @@ -3209,7 +3207,7 @@ static void bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) { - bfa_trc(tskim->bfa, tskim->tsk_tag << 16 | event); + bfa_trc(tskim->bfa, event); switch (event) { case BFA_TSKIM_SM_DONE: @@ -3240,7 +3238,7 @@ bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, static void bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) { - bfa_trc(tskim->bfa, tskim->tsk_tag << 16 | event); + bfa_trc(tskim->bfa, event); switch (event) { case BFA_TSKIM_SM_HCB: @@ -3562,8 +3560,6 @@ bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) if (rsp->tsk_status == BFI_TSKIM_STS_ABORTED) { bfa_stats(tskim->itnim, tm_cleanup_comps); bfa_sm_send_event(tskim, BFA_TSKIM_SM_CLEANUP_DONE); - } else if (rsp->tsk_status == BFI_TSKIM_STS_UTAG) { - bfa_sm_send_event(tskim, BFA_TSKIM_SM_UTAG); } else { bfa_stats(tskim->itnim, tm_fw_rsps); bfa_sm_send_event(tskim, BFA_TSKIM_SM_DONE); @@ -3703,7 +3699,6 @@ bfa_fcp_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, struct bfa_mem_dma_s *seg_ptr; u16 idx, nsegs, num_io_req; - fcp->max_ioim_reqs = cfg->fwcfg.num_ioim_reqs; fcp->num_ioim_reqs = cfg->fwcfg.num_ioim_reqs; fcp->num_fwtio_reqs = cfg->fwcfg.num_fwtio_reqs; fcp->num_itns = cfg->fwcfg.num_rports; @@ -3726,7 +3721,6 @@ bfa_fcp_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, bfa_iocfc_set_snsbase(bfa, idx, fcp->snsbase[idx].pa); } - fcp->throttle_update_required = 1; bfa_fcpim_attach(fcp, bfad, cfg, pcidev); bfa_iotag_attach(fcp); @@ -3765,33 +3759,23 @@ bfa_fcp_iocdisable(struct bfa_s *bfa) { struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa); + /* Enqueue unused ioim resources to free_q */ + list_splice_tail_init(&fcp->iotag_unused_q, &fcp->iotag_ioim_free_q); + bfa_fcpim_iocdisable(fcp); } void -bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw, u16 max_ioim_fw) +bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw) { struct bfa_fcp_mod_s *mod = BFA_FCP_MOD(bfa); struct list_head *qe; int i; - /* Update io throttle value only once during driver load time */ - if (!mod->throttle_update_required) - return; - for (i = 0; i < (mod->num_ioim_reqs - num_ioim_fw); i++) { bfa_q_deq_tail(&mod->iotag_ioim_free_q, &qe); list_add_tail(qe, &mod->iotag_unused_q); } - - if (mod->num_ioim_reqs != num_ioim_fw) { - bfa_trc(bfa, mod->num_ioim_reqs); - bfa_trc(bfa, num_ioim_fw); - } - - mod->max_ioim_reqs = max_ioim_fw; - mod->num_ioim_reqs = num_ioim_fw; - mod->throttle_update_required = 0; } void @@ -3849,88 +3833,3 @@ bfa_iotag_attach(struct bfa_fcp_mod_s *fcp) bfa_mem_kva_curp(fcp) = (u8 *) iotag; } - - -/** - * To send config req, first try to use throttle value from flash - * If 0, then use driver parameter - * We need to use min(flash_val, drv_val) because - * memory allocation was done based on this cfg'd value - */ -u16 -bfa_fcpim_get_throttle_cfg(struct bfa_s *bfa, u16 drv_cfg_param) -{ - u16 tmp; - struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa); - - /* - * If throttle value from flash is already in effect after driver is - * loaded then until next load, always return current value instead - * of actual flash value - */ - if (!fcp->throttle_update_required) - return (u16)fcp->num_ioim_reqs; - - tmp = bfa_dconf_read_data_valid(bfa) ? bfa_fcpim_read_throttle(bfa) : 0; - if (!tmp || (tmp > drv_cfg_param)) - tmp = drv_cfg_param; - - return tmp; -} - -bfa_status_t -bfa_fcpim_write_throttle(struct bfa_s *bfa, u16 value) -{ - if (!bfa_dconf_get_min_cfg(bfa)) { - BFA_DCONF_MOD(bfa)->dconf->throttle_cfg.value = value; - BFA_DCONF_MOD(bfa)->dconf->throttle_cfg.is_valid = 1; - return BFA_STATUS_OK; - } - - return BFA_STATUS_FAILED; -} - -u16 -bfa_fcpim_read_throttle(struct bfa_s *bfa) -{ - struct bfa_throttle_cfg_s *throttle_cfg = - &(BFA_DCONF_MOD(bfa)->dconf->throttle_cfg); - - return ((!bfa_dconf_get_min_cfg(bfa)) ? - ((throttle_cfg->is_valid == 1) ? (throttle_cfg->value) : 0) : 0); -} - -bfa_status_t -bfa_fcpim_throttle_set(struct bfa_s *bfa, u16 value) -{ - /* in min cfg no commands should run. */ - if ((bfa_dconf_get_min_cfg(bfa) == BFA_TRUE) || - (!bfa_dconf_read_data_valid(bfa))) - return BFA_STATUS_FAILED; - - bfa_fcpim_write_throttle(bfa, value); - - return bfa_dconf_update(bfa); -} - -bfa_status_t -bfa_fcpim_throttle_get(struct bfa_s *bfa, void *buf) -{ - struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa); - struct bfa_defs_fcpim_throttle_s throttle; - - if ((bfa_dconf_get_min_cfg(bfa) == BFA_TRUE) || - (!bfa_dconf_read_data_valid(bfa))) - return BFA_STATUS_FAILED; - - memset(&throttle, 0, sizeof(struct bfa_defs_fcpim_throttle_s)); - - throttle.cur_value = (u16)(fcpim->fcp->num_ioim_reqs); - throttle.cfg_value = bfa_fcpim_read_throttle(bfa); - if (!throttle.cfg_value) - throttle.cfg_value = throttle.cur_value; - throttle.max_value = (u16)(fcpim->fcp->max_ioim_reqs); - memcpy(buf, &throttle, sizeof(struct bfa_defs_fcpim_throttle_s)); - - return BFA_STATUS_OK; -} diff --git a/trunk/drivers/scsi/bfa/bfa_fcpim.h b/trunk/drivers/scsi/bfa/bfa_fcpim.h index e693af6e5930..36f26da80f76 100644 --- a/trunk/drivers/scsi/bfa/bfa_fcpim.h +++ b/trunk/drivers/scsi/bfa/bfa_fcpim.h @@ -42,7 +42,7 @@ void bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport, void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m)); void bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m); void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp); -void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw, u16 max_ioim_fw); +void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw); #define BFA_FCP_MOD(_hal) (&(_hal)->modules.fcp_mod) #define BFA_MEM_FCP_KVA(__bfa) (&(BFA_FCP_MOD(__bfa)->kva_seg)) @@ -51,9 +51,7 @@ void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw, u16 max_ioim_fw); #define BFA_ITN_FROM_TAG(_fcp, _tag) \ ((_fcp)->itn_arr + ((_tag) & ((_fcp)->num_itns - 1))) #define BFA_SNSINFO_FROM_TAG(_fcp, _tag) \ - bfa_mem_get_dmabuf_kva(_fcp, (_tag & BFA_IOIM_IOTAG_MASK), \ - BFI_IOIM_SNSLEN) - + bfa_mem_get_dmabuf_kva(_fcp, _tag, BFI_IOIM_SNSLEN) #define BFA_ITNIM_MIN 32 #define BFA_ITNIM_MAX 1024 @@ -150,7 +148,6 @@ struct bfa_fcp_mod_s { struct list_head iotag_unused_q; /* unused IO resources*/ struct bfa_iotag_s *iotag_arr; struct bfa_itn_s *itn_arr; - int max_ioim_reqs; int num_ioim_reqs; int num_fwtio_reqs; int num_itns; @@ -158,7 +155,6 @@ struct bfa_fcp_mod_s { struct bfa_fcpim_s fcpim; struct bfa_mem_dma_s dma_seg[BFA_FCP_DMA_SEGS]; struct bfa_mem_kva_s kva_seg; - int throttle_update_required; }; /* @@ -420,10 +416,5 @@ bfa_status_t bfa_fcpim_lunmask_delete(struct bfa_s *bfa, u16 vf_id, bfa_status_t bfa_fcpim_lunmask_add(struct bfa_s *bfa, u16 vf_id, wwn_t *pwwn, wwn_t rpwwn, struct scsi_lun lun); bfa_status_t bfa_fcpim_lunmask_clear(struct bfa_s *bfa); -u16 bfa_fcpim_read_throttle(struct bfa_s *bfa); -bfa_status_t bfa_fcpim_write_throttle(struct bfa_s *bfa, u16 value); -bfa_status_t bfa_fcpim_throttle_set(struct bfa_s *bfa, u16 value); -bfa_status_t bfa_fcpim_throttle_get(struct bfa_s *bfa, void *buf); -u16 bfa_fcpim_get_throttle_cfg(struct bfa_s *bfa, u16 drv_cfg_param); #endif /* __BFA_FCPIM_H__ */ diff --git a/trunk/drivers/scsi/bfa/bfa_fcs.c b/trunk/drivers/scsi/bfa/bfa_fcs.c index d428808fb37e..fd3e84d32bd2 100644 --- a/trunk/drivers/scsi/bfa/bfa_fcs.c +++ b/trunk/drivers/scsi/bfa/bfa_fcs.c @@ -303,30 +303,16 @@ static void bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event) { - struct bfa_s *bfa = fabric->fcs->bfa; - bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); bfa_trc(fabric->fcs, event); switch (event) { case BFA_FCS_FABRIC_SM_START: - if (!bfa_fcport_is_linkup(fabric->fcs->bfa)) { - bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); - break; - } - if (bfa_fcport_get_topology(bfa) == - BFA_PORT_TOPOLOGY_LOOP) { - fabric->fab_type = BFA_FCS_FABRIC_LOOP; - fabric->bport.pid = bfa_fcport_get_myalpa(bfa); - fabric->bport.pid = bfa_hton3b(fabric->bport.pid); - bfa_sm_set_state(fabric, - bfa_fcs_fabric_sm_online); - bfa_fcs_fabric_set_opertype(fabric); - bfa_fcs_lport_online(&fabric->bport); - } else { + if (bfa_fcport_is_linkup(fabric->fcs->bfa)) { bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); bfa_fcs_fabric_login(fabric); - } + } else + bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); break; case BFA_FCS_FABRIC_SM_LINK_UP: @@ -351,28 +337,16 @@ static void bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event) { - struct bfa_s *bfa = fabric->fcs->bfa; - bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); bfa_trc(fabric->fcs, event); switch (event) { case BFA_FCS_FABRIC_SM_LINK_UP: - if (bfa_fcport_get_topology(bfa) != BFA_PORT_TOPOLOGY_LOOP) { - bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); - bfa_fcs_fabric_login(fabric); - break; - } - fabric->fab_type = BFA_FCS_FABRIC_LOOP; - fabric->bport.pid = bfa_fcport_get_myalpa(bfa); - fabric->bport.pid = bfa_hton3b(fabric->bport.pid); - bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_online); - bfa_fcs_fabric_set_opertype(fabric); - bfa_fcs_lport_online(&fabric->bport); + bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); + bfa_fcs_fabric_login(fabric); break; case BFA_FCS_FABRIC_SM_RETRY_OP: - case BFA_FCS_FABRIC_SM_LOOPBACK: break; case BFA_FCS_FABRIC_SM_DELETE: @@ -621,20 +595,14 @@ void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event) { - struct bfa_s *bfa = fabric->fcs->bfa; - bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); bfa_trc(fabric->fcs, event); switch (event) { case BFA_FCS_FABRIC_SM_LINK_DOWN: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); - if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP) { - bfa_fcs_lport_offline(&fabric->bport); - } else { - bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); - bfa_fcs_fabric_notify_offline(fabric); - } + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); + bfa_fcs_fabric_notify_offline(fabric); break; case BFA_FCS_FABRIC_SM_DELETE: @@ -751,29 +719,20 @@ static void bfa_fcs_fabric_sm_stopping(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event) { - struct bfa_s *bfa = fabric->fcs->bfa; - bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); bfa_trc(fabric->fcs, event); switch (event) { case BFA_FCS_FABRIC_SM_STOPCOMP: - if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP) { - bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created); - } else { - bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); - bfa_sm_send_event(fabric->lps, BFA_LPS_SM_LOGOUT); - } + bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); + bfa_sm_send_event(fabric->lps, BFA_LPS_SM_LOGOUT); break; case BFA_FCS_FABRIC_SM_LINK_UP: break; case BFA_FCS_FABRIC_SM_LINK_DOWN: - if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP) - bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created); - else - bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); + bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); break; default: @@ -1016,6 +975,9 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric) struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg; u8 alpa = 0, bb_scn = 0; + if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP) + alpa = bfa_fcport_get_myalpa(bfa); + if (bfa_fcs_fabric_is_bbscn_enabled(fabric) && (!fabric->fcs->bbscn_flogi_rjt)) bb_scn = BFA_FCS_PORT_DEF_BB_SCN; diff --git a/trunk/drivers/scsi/bfa/bfa_fcs.h b/trunk/drivers/scsi/bfa/bfa_fcs.h index a449706c6bc0..6c4377cb287f 100644 --- a/trunk/drivers/scsi/bfa/bfa_fcs.h +++ b/trunk/drivers/scsi/bfa/bfa_fcs.h @@ -118,9 +118,9 @@ struct bfa_fcs_lport_fab_s { #define MAX_ALPA_COUNT 127 struct bfa_fcs_lport_loop_s { - u8 num_alpa; /* Num of ALPA entries in the map */ - u8 alpabm_valid; /* alpa bitmap valid or not (1 or 0) */ - u8 alpa_pos_map[MAX_ALPA_COUNT]; /* ALPA Positional Map */ + u8 num_alpa; /* Num of ALPA entries in the map */ + u8 alpa_pos_map[MAX_ALPA_COUNT]; /* ALPA Positional + *Map */ struct bfa_fcs_lport_s *port; /* parent port */ }; @@ -175,7 +175,6 @@ enum bfa_fcs_fabric_type { BFA_FCS_FABRIC_UNKNOWN = 0, BFA_FCS_FABRIC_SWITCHED = 1, BFA_FCS_FABRIC_N2N = 2, - BFA_FCS_FABRIC_LOOP = 3, }; @@ -351,10 +350,9 @@ void bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced); void bfa_fcs_lport_scn_init(struct bfa_fcs_lport_s *vport); void bfa_fcs_lport_scn_offline(struct bfa_fcs_lport_s *vport); -void bfa_fcs_lport_fab_scn_online(struct bfa_fcs_lport_s *vport); +void bfa_fcs_lport_scn_online(struct bfa_fcs_lport_s *vport); void bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port, struct fchs_s *rx_frame, u32 len); -void bfa_fcs_lport_lip_scn_online(bfa_fcs_lport_t *port); struct bfa_fcs_vport_s { struct list_head qe; /* queue elem */ @@ -455,7 +453,6 @@ struct bfa_fcs_rport_s { struct bfa_rport_stats_s stats; /* rport stats */ enum bfa_rport_function scsi_function; /* Initiator/Target */ struct bfa_fcs_rpf_s rpf; /* Rport features module */ - bfa_boolean_t scn_online; /* SCN online flag */ }; static inline struct bfa_rport_s * @@ -642,9 +639,9 @@ struct bfa_fcs_fdmi_hba_attr_s { u8 model[16]; u8 model_desc[256]; u8 hw_version[8]; - u8 driver_version[BFA_VERSION_LEN]; + u8 driver_version[8]; u8 option_rom_ver[BFA_VERSION_LEN]; - u8 fw_version[BFA_VERSION_LEN]; + u8 fw_version[8]; u8 os_name[256]; __be32 max_ct_pyld; }; @@ -736,7 +733,7 @@ enum rport_event { RPSM_EVENT_LOGO_IMP = 5, /* implicit logo for SLER */ RPSM_EVENT_FCXP_SENT = 6, /* Frame from has been sent */ RPSM_EVENT_DELETE = 7, /* RPORT delete request */ - RPSM_EVENT_FAB_SCN = 8, /* state change notification */ + RPSM_EVENT_SCN = 8, /* state change notification */ RPSM_EVENT_ACCEPTED = 9, /* Good response from remote device */ RPSM_EVENT_FAILED = 10, /* Request to rport failed. */ RPSM_EVENT_TIMEOUT = 11, /* Rport SM timeout event */ @@ -747,9 +744,7 @@ enum rport_event { RPSM_EVENT_ADDRESS_DISC = 16, /* Need to Discover rport's PID */ RPSM_EVENT_PRLO_RCVD = 17, /* PRLO from remote device */ RPSM_EVENT_PLOGI_RETRY = 18, /* Retry PLOGI continuously */ - RPSM_EVENT_SCN_OFFLINE = 19, /* loop scn offline */ - RPSM_EVENT_SCN_ONLINE = 20, /* loop scn online */ - RPSM_EVENT_FC4_FCS_ONLINE = 21, /* FC-4 FCS online complete */ + RPSM_EVENT_FC4_FCS_ONLINE = 19, /*!< FC-4 FCS online complete */ }; /* @@ -768,7 +763,7 @@ enum bfa_fcs_itnim_event { BFA_FCS_ITNIM_SM_DELETE = 10, /* delete event from rport */ BFA_FCS_ITNIM_SM_PRLO = 11, /* delete event from rport */ BFA_FCS_ITNIM_SM_RSP_NOT_SUPP = 12, /* cmd not supported rsp */ - BFA_FCS_ITNIM_SM_HAL_ONLINE = 13, /* bfa rport online event */ + BFA_FCS_ITNIM_SM_HAL_ONLINE = 13, /*!< bfa rport online event */ }; /* diff --git a/trunk/drivers/scsi/bfa/bfa_fcs_lport.c b/trunk/drivers/scsi/bfa/bfa_fcs_lport.c index 1224d0462a49..3b75f6fb2de1 100644 --- a/trunk/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/trunk/drivers/scsi/bfa/bfa_fcs_lport.c @@ -23,34 +23,6 @@ BFA_TRC_FILE(FCS, PORT); -/* - * ALPA to LIXA bitmap mapping - * - * ALPA 0x00 (Word 0, Bit 30) is invalid for N_Ports. Also Word 0 Bit 31 - * is for L_bit (login required) and is filled as ALPA 0x00 here. - */ -static const u8 loop_alpa_map[] = { - 0x00, 0x00, 0x01, 0x02, 0x04, 0x08, 0x0F, 0x10, /* Word 0 Bits 31..24 */ - 0x17, 0x18, 0x1B, 0x1D, 0x1E, 0x1F, 0x23, 0x25, /* Word 0 Bits 23..16 */ - 0x26, 0x27, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, /* Word 0 Bits 15..08 */ - 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x39, 0x3A, /* Word 0 Bits 07..00 */ - - 0x3C, 0x43, 0x45, 0x46, 0x47, 0x49, 0x4A, 0x4B, /* Word 1 Bits 31..24 */ - 0x4C, 0x4D, 0x4E, 0x51, 0x52, 0x53, 0x54, 0x55, /* Word 1 Bits 23..16 */ - 0x56, 0x59, 0x5A, 0x5C, 0x63, 0x65, 0x66, 0x67, /* Word 1 Bits 15..08 */ - 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x71, 0x72, /* Word 1 Bits 07..00 */ - - 0x73, 0x74, 0x75, 0x76, 0x79, 0x7A, 0x7C, 0x80, /* Word 2 Bits 31..24 */ - 0x81, 0x82, 0x84, 0x88, 0x8F, 0x90, 0x97, 0x98, /* Word 2 Bits 23..16 */ - 0x9B, 0x9D, 0x9E, 0x9F, 0xA3, 0xA5, 0xA6, 0xA7, /* Word 2 Bits 15..08 */ - 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xB1, 0xB2, /* Word 2 Bits 07..00 */ - - 0xB3, 0xB4, 0xB5, 0xB6, 0xB9, 0xBA, 0xBC, 0xC3, /* Word 3 Bits 31..24 */ - 0xC5, 0xC6, 0xC7, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, /* Word 3 Bits 23..16 */ - 0xCE, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD9, /* Word 3 Bits 15..08 */ - 0xDA, 0xDC, 0xE0, 0xE1, 0xE2, 0xE4, 0xE8, 0xEF, /* Word 3 Bits 07..00 */ -}; - static void bfa_fcs_lport_send_ls_rjt(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs, u8 reason_code, u8 reason_code_expl); @@ -79,10 +51,6 @@ static void bfa_fcs_lport_n2n_init(struct bfa_fcs_lport_s *port); static void bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port); static void bfa_fcs_lport_n2n_offline(struct bfa_fcs_lport_s *port); -static void bfa_fcs_lport_loop_init(struct bfa_fcs_lport_s *port); -static void bfa_fcs_lport_loop_online(struct bfa_fcs_lport_s *port); -static void bfa_fcs_lport_loop_offline(struct bfa_fcs_lport_s *port); - static struct { void (*init) (struct bfa_fcs_lport_s *port); void (*online) (struct bfa_fcs_lport_s *port); @@ -94,9 +62,7 @@ static struct { bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, bfa_fcs_lport_fab_offline}, { bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, + bfa_fcs_lport_n2n_offline}, }; /* @@ -1161,7 +1127,7 @@ static void bfa_fcs_lport_fab_online(struct bfa_fcs_lport_s *port) { bfa_fcs_lport_ns_online(port); - bfa_fcs_lport_fab_scn_online(port); + bfa_fcs_lport_scn_online(port); } /* @@ -1255,98 +1221,6 @@ bfa_fcs_lport_n2n_offline(struct bfa_fcs_lport_s *port) n2n_port->reply_oxid = 0; } -void -bfa_fcport_get_loop_attr(struct bfa_fcs_lport_s *port) -{ - int i = 0, j = 0, bit = 0, alpa_bit = 0; - u8 k = 0; - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(port->fcs->bfa); - - port->port_topo.ploop.alpabm_valid = fcport->alpabm_valid; - port->pid = fcport->myalpa; - port->pid = bfa_hton3b(port->pid); - - for (i = 0; i < (FC_ALPA_MAX / 8); i++) { - for (j = 0, alpa_bit = 0; j < 8; j++, alpa_bit++) { - bfa_trc(port->fcs->bfa, fcport->alpabm.alpa_bm[i]); - bit = (fcport->alpabm.alpa_bm[i] & (1 << (7 - j))); - if (bit) { - port->port_topo.ploop.alpa_pos_map[k] = - loop_alpa_map[(i * 8) + alpa_bit]; - k++; - bfa_trc(port->fcs->bfa, k); - bfa_trc(port->fcs->bfa, - port->port_topo.ploop.alpa_pos_map[k]); - } - } - } - port->port_topo.ploop.num_alpa = k; -} - -/* - * Called by fcs/port to initialize Loop topology. - */ -static void -bfa_fcs_lport_loop_init(struct bfa_fcs_lport_s *port) -{ -} - -/* - * Called by fcs/port to notify transition to online state. - */ -static void -bfa_fcs_lport_loop_online(struct bfa_fcs_lport_s *port) -{ - u8 num_alpa = 0, alpabm_valid = 0; - struct bfa_fcs_rport_s *rport; - u8 *alpa_map = NULL; - int i = 0; - u32 pid; - - bfa_fcport_get_loop_attr(port); - - num_alpa = port->port_topo.ploop.num_alpa; - alpabm_valid = port->port_topo.ploop.alpabm_valid; - alpa_map = port->port_topo.ploop.alpa_pos_map; - - bfa_trc(port->fcs->bfa, port->pid); - bfa_trc(port->fcs->bfa, num_alpa); - if (alpabm_valid == 1) { - for (i = 0; i < num_alpa; i++) { - bfa_trc(port->fcs->bfa, alpa_map[i]); - if (alpa_map[i] != bfa_hton3b(port->pid)) { - pid = alpa_map[i]; - bfa_trc(port->fcs->bfa, pid); - rport = bfa_fcs_lport_get_rport_by_pid(port, - bfa_hton3b(pid)); - if (!rport) - rport = bfa_fcs_rport_create(port, - bfa_hton3b(pid)); - } - } - } else { - for (i = 0; i < MAX_ALPA_COUNT; i++) { - if (alpa_map[i] != port->pid) { - pid = loop_alpa_map[i]; - bfa_trc(port->fcs->bfa, pid); - rport = bfa_fcs_lport_get_rport_by_pid(port, - bfa_hton3b(pid)); - if (!rport) - rport = bfa_fcs_rport_create(port, - bfa_hton3b(pid)); - } - } - } -} - -/* - * Called by fcs/port to notify transition to offline state. - */ -static void -bfa_fcs_lport_loop_offline(struct bfa_fcs_lport_s *port) -{ -} - #define BFA_FCS_FDMI_CMD_MAX_RETRIES 2 /* @@ -2014,10 +1888,13 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) sizeof(templen)); } + /* + * f/w Version = driver version + */ attr = (struct fdmi_attr_s *) curr_ptr; attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FW_VERSION); - templen = (u16) strlen(fcs_hba_attr->fw_version); - memcpy(attr->value, fcs_hba_attr->fw_version, templen); + templen = (u16) strlen(fcs_hba_attr->driver_version); + memcpy(attr->value, fcs_hba_attr->driver_version, templen); templen = fc_roundup(templen, sizeof(u32)); curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; len += templen; @@ -2419,7 +2296,6 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, { struct bfa_fcs_lport_s *port = fdmi->ms->port; struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; - struct bfa_fcs_fdmi_port_attr_s fcs_port_attr; memset(hba_attr, 0, sizeof(struct bfa_fcs_fdmi_hba_attr_s)); @@ -2455,9 +2331,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, sizeof(driver_info->host_os_patch)); } - /* Retrieve the max frame size from the port attr */ - bfa_fcs_fdmi_get_portattr(fdmi, &fcs_port_attr); - hba_attr->max_ct_pyld = fcs_port_attr.max_frm_size; + hba_attr->max_ct_pyld = cpu_to_be32(FC_MAX_PDUSZ); } static void @@ -2517,7 +2391,7 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, /* * Max PDU Size. */ - port_attr->max_frm_size = cpu_to_be32(pport_attr.pport_cfg.maxfrsize); + port_attr->max_frm_size = cpu_to_be32(FC_MAX_PDUSZ); /* * OS device Name @@ -5325,7 +5199,7 @@ bfa_fcs_lport_scn_offline(struct bfa_fcs_lport_s *port) } void -bfa_fcs_lport_fab_scn_online(struct bfa_fcs_lport_s *port) +bfa_fcs_lport_scn_online(struct bfa_fcs_lport_s *port) { struct bfa_fcs_lport_scn_s *scn = BFA_FCS_GET_SCN_FROM_PORT(port); @@ -5746,15 +5620,6 @@ bfa_fcs_lport_clear_stats(struct bfa_fcs_lport_s *fcs_port) memset(&fcs_port->stats, 0, sizeof(struct bfa_lport_stats_s)); } -/* - * Let new loop map create missing rports - */ -void -bfa_fcs_lport_lip_scn_online(struct bfa_fcs_lport_s *port) -{ - bfa_fcs_lport_loop_online(port); -} - /* * FCS virtual port state machine */ diff --git a/trunk/drivers/scsi/bfa/bfa_fcs_rport.c b/trunk/drivers/scsi/bfa/bfa_fcs_rport.c index 58ac643ba9f3..cc43b2a58ce3 100644 --- a/trunk/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/trunk/drivers/scsi/bfa/bfa_fcs_rport.c @@ -106,13 +106,9 @@ static void bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport, enum rport_event event); static void bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event); -static void bfa_fcs_rport_sm_adisc_online_sending( - struct bfa_fcs_rport_s *rport, enum rport_event event); -static void bfa_fcs_rport_sm_adisc_online(struct bfa_fcs_rport_s *rport, - enum rport_event event); -static void bfa_fcs_rport_sm_adisc_offline_sending(struct bfa_fcs_rport_s - *rport, enum rport_event event); -static void bfa_fcs_rport_sm_adisc_offline(struct bfa_fcs_rport_s *rport, +static void bfa_fcs_rport_sm_adisc_sending(struct bfa_fcs_rport_s *rport, + enum rport_event event); +static void bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event); static void bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport, enum rport_event event); @@ -154,10 +150,8 @@ static struct bfa_sm_table_s rport_sm_table[] = { {BFA_SM(bfa_fcs_rport_sm_online), BFA_RPORT_ONLINE}, {BFA_SM(bfa_fcs_rport_sm_nsquery_sending), BFA_RPORT_NSQUERY}, {BFA_SM(bfa_fcs_rport_sm_nsquery), BFA_RPORT_NSQUERY}, - {BFA_SM(bfa_fcs_rport_sm_adisc_online_sending), BFA_RPORT_ADISC}, - {BFA_SM(bfa_fcs_rport_sm_adisc_online), BFA_RPORT_ADISC}, - {BFA_SM(bfa_fcs_rport_sm_adisc_offline_sending), BFA_RPORT_ADISC}, - {BFA_SM(bfa_fcs_rport_sm_adisc_offline), BFA_RPORT_ADISC}, + {BFA_SM(bfa_fcs_rport_sm_adisc_sending), BFA_RPORT_ADISC}, + {BFA_SM(bfa_fcs_rport_sm_adisc), BFA_RPORT_ADISC}, {BFA_SM(bfa_fcs_rport_sm_fc4_logorcv), BFA_RPORT_LOGORCV}, {BFA_SM(bfa_fcs_rport_sm_fc4_logosend), BFA_RPORT_LOGO}, {BFA_SM(bfa_fcs_rport_sm_fc4_offline), BFA_RPORT_OFFLINE}, @@ -237,19 +231,10 @@ bfa_fcs_rport_sm_plogi_sending(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_send_plogiacc(rport, NULL); break; - case RPSM_EVENT_SCN_OFFLINE: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); - bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); - bfa_timer_start(rport->fcs->bfa, &rport->timer, - bfa_fcs_rport_timeout, rport, - bfa_fcs_rport_del_timeout); - break; case RPSM_EVENT_ADDRESS_CHANGE: - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: /* query the NS */ bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); - WARN_ON(!(bfa_fcport_get_topology(rport->port->fcs->bfa) != - BFA_PORT_TOPOLOGY_LOOP)); bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending); rport->ns_retries = 0; bfa_fcs_rport_send_nsdisc(rport, NULL); @@ -295,20 +280,12 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport, case RPSM_EVENT_PLOGI_RCVD: case RPSM_EVENT_PLOGI_COMP: - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: /* * Ignore, SCN is possibly online notification. */ break; - case RPSM_EVENT_SCN_OFFLINE: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); - bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); - bfa_timer_start(rport->fcs->bfa, &rport->timer, - bfa_fcs_rport_timeout, rport, - bfa_fcs_rport_del_timeout); - break; - case RPSM_EVENT_ADDRESS_CHANGE: bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending); @@ -369,19 +346,9 @@ bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_send_plogiacc(rport, NULL); break; - case RPSM_EVENT_SCN_OFFLINE: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); - bfa_timer_stop(&rport->timer); - bfa_timer_start(rport->fcs->bfa, &rport->timer, - bfa_fcs_rport_timeout, rport, - bfa_fcs_rport_del_timeout); - break; - case RPSM_EVENT_ADDRESS_CHANGE: - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: bfa_timer_stop(&rport->timer); - WARN_ON(!(bfa_fcport_get_topology(rport->port->fcs->bfa) != - BFA_PORT_TOPOLOGY_LOOP)); bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending); rport->ns_retries = 0; bfa_fcs_rport_send_nsdisc(rport, NULL); @@ -455,18 +422,7 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event) } break; - case RPSM_EVENT_SCN_ONLINE: - break; - - case RPSM_EVENT_SCN_OFFLINE: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); - bfa_fcxp_discard(rport->fcxp); - bfa_timer_start(rport->fcs->bfa, &rport->timer, - bfa_fcs_rport_timeout, rport, - bfa_fcs_rport_del_timeout); - break; - - case RPSM_EVENT_PLOGI_RETRY: + case RPSM_EVENT_PLOGI_RETRY: rport->plogi_retries = 0; bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_retry); bfa_timer_start(rport->fcs->bfa, &rport->timer, @@ -484,10 +440,8 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event) break; case RPSM_EVENT_ADDRESS_CHANGE: - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: bfa_fcxp_discard(rport->fcxp); - WARN_ON(!(bfa_fcport_get_topology(rport->port->fcs->bfa) != - BFA_PORT_TOPOLOGY_LOOP)); bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending); rport->ns_retries = 0; bfa_fcs_rport_send_nsdisc(rport, NULL); @@ -558,8 +512,7 @@ bfa_fcs_rport_sm_fc4_fcs_online(struct bfa_fcs_rport_s *rport, case RPSM_EVENT_PLOGI_COMP: case RPSM_EVENT_LOGO_IMP: case RPSM_EVENT_ADDRESS_CHANGE: - case RPSM_EVENT_FAB_SCN: - case RPSM_EVENT_SCN_OFFLINE: + case RPSM_EVENT_SCN: bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); bfa_fcs_rport_fcs_offline_action(rport); break; @@ -608,10 +561,9 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_fcs_offline_action(rport); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: case RPSM_EVENT_LOGO_IMP: case RPSM_EVENT_ADDRESS_CHANGE: - case RPSM_EVENT_SCN_OFFLINE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); bfa_fcs_rport_fcs_offline_action(rport); break; @@ -643,15 +595,14 @@ bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, enum rport_event event) bfa_trc(rport->fcs, event); switch (event) { - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: if (bfa_fcs_fabric_is_switched(rport->port->fabric)) { bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsquery_sending); rport->ns_retries = 0; bfa_fcs_rport_send_nsdisc(rport, NULL); } else { - bfa_sm_set_state(rport, - bfa_fcs_rport_sm_adisc_online_sending); + bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc_sending); bfa_fcs_rport_send_adisc(rport, NULL); } break; @@ -659,7 +610,6 @@ bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, enum rport_event event) case RPSM_EVENT_PLOGI_RCVD: case RPSM_EVENT_LOGO_IMP: case RPSM_EVENT_ADDRESS_CHANGE: - case RPSM_EVENT_SCN_OFFLINE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); bfa_fcs_rport_hal_offline_action(rport); break; @@ -675,7 +625,6 @@ bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, enum rport_event event) bfa_fcs_rport_hal_offline_action(rport); break; - case RPSM_EVENT_SCN_ONLINE: case RPSM_EVENT_PLOGI_COMP: break; @@ -707,7 +656,7 @@ bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_hal_offline_action(rport); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: /* * ignore SCN, wait for response to query itself */ @@ -747,7 +696,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event) switch (event) { case RPSM_EVENT_ACCEPTED: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc_online_sending); + bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc_sending); bfa_fcs_rport_send_adisc(rport, NULL); break; @@ -769,7 +718,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event) bfa_fcs_rport_hal_offline_action(rport); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: break; case RPSM_EVENT_LOGO_RCVD: @@ -798,7 +747,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event) * authenticating with rport. FC-4s are paused. */ static void -bfa_fcs_rport_sm_adisc_online_sending(struct bfa_fcs_rport_s *rport, +bfa_fcs_rport_sm_adisc_sending(struct bfa_fcs_rport_s *rport, enum rport_event event) { bfa_trc(rport->fcs, rport->pwwn); @@ -807,7 +756,7 @@ bfa_fcs_rport_sm_adisc_online_sending(struct bfa_fcs_rport_s *rport, switch (event) { case RPSM_EVENT_FCXP_SENT: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc_online); + bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc); break; case RPSM_EVENT_DELETE: @@ -830,7 +779,7 @@ bfa_fcs_rport_sm_adisc_online_sending(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_hal_offline_action(rport); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: break; case RPSM_EVENT_PLOGI_RCVD: @@ -849,8 +798,7 @@ bfa_fcs_rport_sm_adisc_online_sending(struct bfa_fcs_rport_s *rport, * FC-4s are paused. */ static void -bfa_fcs_rport_sm_adisc_online(struct bfa_fcs_rport_s *rport, - enum rport_event event) +bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event) { bfa_trc(rport->fcs, rport->pwwn); bfa_trc(rport->fcs, rport->pid); @@ -883,7 +831,7 @@ bfa_fcs_rport_sm_adisc_online(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_hal_offline_action(rport); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: /* * already processing RSCN */ @@ -908,96 +856,7 @@ bfa_fcs_rport_sm_adisc_online(struct bfa_fcs_rport_s *rport, } /* - * ADISC is being sent for authenticating with rport - * Already did offline actions. - */ -static void -bfa_fcs_rport_sm_adisc_offline_sending(struct bfa_fcs_rport_s *rport, - enum rport_event event) -{ - bfa_trc(rport->fcs, rport->pwwn); - bfa_trc(rport->fcs, rport->pid); - bfa_trc(rport->fcs, event); - - switch (event) { - case RPSM_EVENT_FCXP_SENT: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc_offline); - break; - - case RPSM_EVENT_DELETE: - case RPSM_EVENT_SCN_OFFLINE: - case RPSM_EVENT_LOGO_IMP: - case RPSM_EVENT_LOGO_RCVD: - case RPSM_EVENT_PRLO_RCVD: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); - bfa_fcxp_walloc_cancel(rport->fcs->bfa, - &rport->fcxp_wqe); - bfa_timer_start(rport->fcs->bfa, &rport->timer, - bfa_fcs_rport_timeout, rport, - bfa_fcs_rport_del_timeout); - break; - - case RPSM_EVENT_PLOGI_RCVD: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending); - bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); - bfa_fcs_rport_send_plogiacc(rport, NULL); - break; - - default: - bfa_sm_fault(rport->fcs, event); - } -} - -/* - * ADISC to rport - * Already did offline actions - */ -static void -bfa_fcs_rport_sm_adisc_offline(struct bfa_fcs_rport_s *rport, - enum rport_event event) -{ - bfa_trc(rport->fcs, rport->pwwn); - bfa_trc(rport->fcs, rport->pid); - bfa_trc(rport->fcs, event); - - switch (event) { - case RPSM_EVENT_ACCEPTED: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); - bfa_fcs_rport_hal_online(rport); - break; - - case RPSM_EVENT_PLOGI_RCVD: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending); - bfa_fcxp_discard(rport->fcxp); - bfa_fcs_rport_send_plogiacc(rport, NULL); - break; - - case RPSM_EVENT_FAILED: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); - bfa_timer_start(rport->fcs->bfa, &rport->timer, - bfa_fcs_rport_timeout, rport, - bfa_fcs_rport_del_timeout); - break; - - case RPSM_EVENT_DELETE: - case RPSM_EVENT_SCN_OFFLINE: - case RPSM_EVENT_LOGO_IMP: - case RPSM_EVENT_LOGO_RCVD: - case RPSM_EVENT_PRLO_RCVD: - bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); - bfa_fcxp_discard(rport->fcxp); - bfa_timer_start(rport->fcs->bfa, &rport->timer, - bfa_fcs_rport_timeout, rport, - bfa_fcs_rport_del_timeout); - break; - - default: - bfa_sm_fault(rport->fcs, event); - } -} - -/* - * Rport has sent LOGO. Awaiting FC-4 offline completion callback. + * Rport has sent LOGO. Awaiting FC-4 offline completion callback. */ static void bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport, @@ -1022,8 +881,6 @@ bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport, bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_off_delete); break; - case RPSM_EVENT_SCN_ONLINE: - case RPSM_EVENT_SCN_OFFLINE: case RPSM_EVENT_HCB_ONLINE: case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_PRLO_RCVD: @@ -1088,8 +945,6 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_hal_offline(rport); break; - case RPSM_EVENT_SCN_ONLINE: - break; case RPSM_EVENT_LOGO_RCVD: /* * Rport is going offline. Just ack the logo @@ -1101,9 +956,8 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_send_prlo_acc(rport); break; - case RPSM_EVENT_SCN_OFFLINE: case RPSM_EVENT_HCB_ONLINE: - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: case RPSM_EVENT_LOGO_IMP: case RPSM_EVENT_ADDRESS_CHANGE: /* @@ -1161,19 +1015,6 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_sm_nsdisc_sending); rport->ns_retries = 0; bfa_fcs_rport_send_nsdisc(rport, NULL); - } else if (bfa_fcport_get_topology(rport->port->fcs->bfa) == - BFA_PORT_TOPOLOGY_LOOP) { - if (rport->scn_online) { - bfa_sm_set_state(rport, - bfa_fcs_rport_sm_adisc_offline_sending); - bfa_fcs_rport_send_adisc(rport, NULL); - } else { - bfa_sm_set_state(rport, - bfa_fcs_rport_sm_offline); - bfa_timer_start(rport->fcs->bfa, &rport->timer, - bfa_fcs_rport_timeout, rport, - bfa_fcs_rport_del_timeout); - } } else { bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending); rport->plogi_retries = 0; @@ -1186,9 +1027,7 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_free(rport); break; - case RPSM_EVENT_SCN_ONLINE: - case RPSM_EVENT_SCN_OFFLINE: - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_PRLO_RCVD: case RPSM_EVENT_PLOGI_RCVD: @@ -1267,8 +1106,6 @@ bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport, bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); break; - case RPSM_EVENT_SCN_ONLINE: - case RPSM_EVENT_SCN_OFFLINE: case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_PRLO_RCVD: /* @@ -1309,8 +1146,6 @@ bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport, bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending); break; - case RPSM_EVENT_SCN_ONLINE: - case RPSM_EVENT_SCN_OFFLINE: case RPSM_EVENT_ADDRESS_CHANGE: break; @@ -1337,9 +1172,7 @@ bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_free(rport); break; - case RPSM_EVENT_SCN_ONLINE: - case RPSM_EVENT_SCN_OFFLINE: - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: case RPSM_EVENT_ADDRESS_CHANGE: break; @@ -1376,12 +1209,10 @@ bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport, enum rport_event event) bfa_fcs_rport_free(rport); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: case RPSM_EVENT_ADDRESS_CHANGE: - bfa_timer_stop(&rport->timer); - WARN_ON(!(bfa_fcport_get_topology(rport->port->fcs->bfa) != - BFA_PORT_TOPOLOGY_LOOP)); bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending); + bfa_timer_stop(&rport->timer); rport->ns_retries = 0; bfa_fcs_rport_send_nsdisc(rport, NULL); break; @@ -1401,7 +1232,6 @@ bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport, enum rport_event event) case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_PRLO_RCVD: case RPSM_EVENT_LOGO_IMP: - case RPSM_EVENT_SCN_OFFLINE: break; case RPSM_EVENT_PLOGI_COMP: @@ -1410,12 +1240,6 @@ bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport, enum rport_event event) bfa_fcs_rport_fcs_online_action(rport); break; - case RPSM_EVENT_SCN_ONLINE: - bfa_timer_stop(&rport->timer); - bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending); - bfa_fcs_rport_send_plogi(rport, NULL); - break; - case RPSM_EVENT_PLOGI_SEND: bfa_timer_stop(&rport->timer); bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending); @@ -1456,7 +1280,7 @@ bfa_fcs_rport_sm_nsdisc_sending(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_send_plogiacc(rport, NULL); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_PRLO_RCVD: case RPSM_EVENT_PLOGI_SEND: @@ -1502,7 +1326,7 @@ bfa_fcs_rport_sm_nsdisc_retry(struct bfa_fcs_rport_s *rport, bfa_fcs_rport_send_nsdisc(rport, NULL); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: case RPSM_EVENT_ADDRESS_CHANGE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending); bfa_timer_stop(&rport->timer); @@ -1615,7 +1439,7 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport, case RPSM_EVENT_PRLO_RCVD: bfa_fcs_rport_send_prlo_acc(rport); break; - case RPSM_EVENT_FAB_SCN: + case RPSM_EVENT_SCN: /* * ignore, wait for NS query response */ @@ -2722,7 +2546,7 @@ void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport) { rport->stats.rscns++; - bfa_sm_send_event(rport, RPSM_EVENT_FAB_SCN); + bfa_sm_send_event(rport, RPSM_EVENT_SCN); } /* @@ -2797,48 +2621,6 @@ bfa_cb_rport_qos_scn_flowid(void *cbarg, bfa_fcs_rport_aen_post(rport, BFA_RPORT_AEN_QOS_FLOWID, &aen_data); } -void -bfa_cb_rport_scn_online(struct bfa_s *bfa) -{ - struct bfa_fcs_s *fcs = &((struct bfad_s *)bfa->bfad)->bfa_fcs; - struct bfa_fcs_lport_s *port = bfa_fcs_get_base_port(fcs); - struct bfa_fcs_rport_s *rp; - struct list_head *qe; - - list_for_each(qe, &port->rport_q) { - rp = (struct bfa_fcs_rport_s *) qe; - bfa_sm_send_event(rp, RPSM_EVENT_SCN_ONLINE); - rp->scn_online = BFA_TRUE; - } - - if (bfa_fcs_lport_is_online(port)) - bfa_fcs_lport_lip_scn_online(port); -} - -void -bfa_cb_rport_scn_no_dev(void *rport) -{ - struct bfa_fcs_rport_s *rp = rport; - - bfa_sm_send_event(rp, RPSM_EVENT_SCN_OFFLINE); - rp->scn_online = BFA_FALSE; -} - -void -bfa_cb_rport_scn_offline(struct bfa_s *bfa) -{ - struct bfa_fcs_s *fcs = &((struct bfad_s *)bfa->bfad)->bfa_fcs; - struct bfa_fcs_lport_s *port = bfa_fcs_get_base_port(fcs); - struct bfa_fcs_rport_s *rp; - struct list_head *qe; - - list_for_each(qe, &port->rport_q) { - rp = (struct bfa_fcs_rport_s *) qe; - bfa_sm_send_event(rp, RPSM_EVENT_SCN_OFFLINE); - rp->scn_online = BFA_FALSE; - } -} - /* * brief * This routine is a static BFA callback when there is a QoS priority @@ -3026,9 +2808,6 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, struct bfa_rport_qos_attr_s qos_attr; struct bfa_fcs_lport_s *port = rport->port; bfa_port_speed_t rport_speed = rport->rpf.rpsc_speed; - struct bfa_port_attr_s port_attr; - - bfa_fcport_get_attr(rport->fcs->bfa, &port_attr); memset(rport_attr, 0, sizeof(struct bfa_rport_attr_s)); memset(&qos_attr, 0, sizeof(struct bfa_rport_qos_attr_s)); @@ -3059,8 +2838,7 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, rport_speed = bfa_fcport_get_ratelim_speed(rport->fcs->bfa); - if ((bfa_fcs_lport_get_rport_max_speed(port) != - BFA_PORT_SPEED_UNKNOWN) && (rport_speed < port_attr.speed)) + if (rport_speed < bfa_fcs_lport_get_rport_max_speed(port)) rport_attr->trl_enforced = BFA_TRUE; } } diff --git a/trunk/drivers/scsi/bfa/bfa_ioc.c b/trunk/drivers/scsi/bfa/bfa_ioc.c index 0116c1032e25..75ca8752b9f4 100644 --- a/trunk/drivers/scsi/bfa/bfa_ioc.c +++ b/trunk/drivers/scsi/bfa/bfa_ioc.c @@ -731,7 +731,8 @@ bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf_s *iocpf) /* * Unlock the hw semaphore. Should be here only once per boot. */ - bfa_ioc_ownership_reset(iocpf->ioc); + readl(iocpf->ioc->ioc_regs.ioc_sem_reg); + writel(1, iocpf->ioc->ioc_regs.ioc_sem_reg); /* * unlock init semaphore. @@ -1750,7 +1751,6 @@ bfa_ioc_getattr_reply(struct bfa_ioc_s *ioc) attr->card_type = be32_to_cpu(attr->card_type); attr->maxfrsize = be16_to_cpu(attr->maxfrsize); ioc->fcmode = (attr->port_mode == BFI_PORT_MODE_FC); - attr->mfg_year = be16_to_cpu(attr->mfg_year); bfa_fsm_send_event(ioc, IOC_E_FWRSP_GETATTR); } @@ -2497,9 +2497,6 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, ad_attr->cna_capable = bfa_ioc_is_cna(ioc); ad_attr->trunk_capable = (ad_attr->nports > 1) && !bfa_ioc_is_cna(ioc) && !ad_attr->is_mezz; - ad_attr->mfg_day = ioc_attr->mfg_day; - ad_attr->mfg_month = ioc_attr->mfg_month; - ad_attr->mfg_year = ioc_attr->mfg_year; } enum bfa_ioc_type_e @@ -2926,7 +2923,7 @@ bfa_ioc_poll_fwinit(struct bfa_ioc_s *ioc) return; } - if (ioc->iocpf.poll_time >= (3 * BFA_IOC_TOV)) + if (ioc->iocpf.poll_time >= BFA_IOC_TOV) bfa_iocpf_timeout(ioc); else { ioc->iocpf.poll_time += BFA_IOC_POLL_TOV; @@ -3019,6 +3016,7 @@ bfa_ablk_config_swap(struct bfa_ablk_cfg_s *cfg) struct bfa_ablk_cfg_inst_s *cfg_inst; int i, j; u16 be16; + u32 be32; for (i = 0; i < BFA_ABLK_MAX; i++) { cfg_inst = &cfg->inst[i]; @@ -3029,10 +3027,8 @@ bfa_ablk_config_swap(struct bfa_ablk_cfg_s *cfg) cfg_inst->pf_cfg[j].num_qpairs = be16_to_cpu(be16); be16 = cfg_inst->pf_cfg[j].num_vectors; cfg_inst->pf_cfg[j].num_vectors = be16_to_cpu(be16); - be16 = cfg_inst->pf_cfg[j].bw_min; - cfg_inst->pf_cfg[j].bw_min = be16_to_cpu(be16); - be16 = cfg_inst->pf_cfg[j].bw_max; - cfg_inst->pf_cfg[j].bw_max = be16_to_cpu(be16); + be32 = cfg_inst->pf_cfg[j].bw; + cfg_inst->pf_cfg[j].bw = be16_to_cpu(be32); } } } @@ -3174,8 +3170,7 @@ bfa_ablk_query(struct bfa_ablk_s *ablk, struct bfa_ablk_cfg_s *ablk_cfg, bfa_status_t bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, - u8 port, enum bfi_pcifn_class personality, - u16 bw_min, u16 bw_max, + u8 port, enum bfi_pcifn_class personality, int bw, bfa_ablk_cbfn_t cbfn, void *cbarg) { struct bfi_ablk_h2i_pf_req_s *m; @@ -3199,8 +3194,7 @@ bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_CREATE, bfa_ioc_portid(ablk->ioc)); m->pers = cpu_to_be16((u16)personality); - m->bw_min = cpu_to_be16(bw_min); - m->bw_max = cpu_to_be16(bw_max); + m->bw = cpu_to_be32(bw); m->port = port; bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); @@ -3300,8 +3294,8 @@ bfa_ablk_port_config(struct bfa_ablk_s *ablk, int port, enum bfa_mode_s mode, } bfa_status_t -bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, u16 bw_min, - u16 bw_max, bfa_ablk_cbfn_t cbfn, void *cbarg) +bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, int bw, + bfa_ablk_cbfn_t cbfn, void *cbarg) { struct bfi_ablk_h2i_pf_req_s *m; @@ -3323,8 +3317,7 @@ bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, u16 bw_min, bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_UPDATE, bfa_ioc_portid(ablk->ioc)); m->pcifn = (u8)pcifn; - m->bw_min = cpu_to_be16(bw_min); - m->bw_max = cpu_to_be16(bw_max); + m->bw = cpu_to_be32(bw); bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); return BFA_STATUS_OK; @@ -4687,25 +4680,22 @@ diag_tempsensor_comp(struct bfa_diag_s *diag, bfi_diag_ts_rsp_t *rsp) diag->tsensor.temp->temp = be16_to_cpu(rsp->temp); diag->tsensor.temp->ts_junc = rsp->ts_junc; diag->tsensor.temp->ts_brd = rsp->ts_brd; + diag->tsensor.temp->status = BFA_STATUS_OK; if (rsp->ts_brd) { - /* tsensor.temp->status is brd_temp status */ - diag->tsensor.temp->status = rsp->status; if (rsp->status == BFA_STATUS_OK) { diag->tsensor.temp->brd_temp = be16_to_cpu(rsp->brd_temp); - } else + } else { + bfa_trc(diag, rsp->status); diag->tsensor.temp->brd_temp = 0; + diag->tsensor.temp->status = BFA_STATUS_DEVBUSY; + } } - - bfa_trc(diag, rsp->status); bfa_trc(diag, rsp->ts_junc); bfa_trc(diag, rsp->temp); bfa_trc(diag, rsp->ts_brd); bfa_trc(diag, rsp->brd_temp); - - /* tsensor status is always good bcos we always have junction temp */ - diag->tsensor.status = BFA_STATUS_OK; diag->tsensor.cbfn(diag->tsensor.cbarg, diag->tsensor.status); diag->tsensor.lock = 0; } @@ -4934,7 +4924,6 @@ bfa_diag_tsensor_query(struct bfa_diag_s *diag, diag->tsensor.temp = result; diag->tsensor.cbfn = cbfn; diag->tsensor.cbarg = cbarg; - diag->tsensor.status = BFA_STATUS_OK; /* Send msg to fw */ diag_tempsensor_send(diag); @@ -5626,7 +5615,7 @@ bfa_dconf_sm_uninit(struct bfa_dconf_mod_s *dconf, enum bfa_dconf_event event) } bfa_sm_set_state(dconf, bfa_dconf_sm_flash_read); bfa_timer_start(dconf->bfa, &dconf->timer, - bfa_dconf_timer, dconf, 2 * BFA_DCONF_UPDATE_TOV); + bfa_dconf_timer, dconf, BFA_DCONF_UPDATE_TOV); bfa_status = bfa_flash_read_part(BFA_FLASH(dconf->bfa), BFA_FLASH_PART_DRV, dconf->instance, dconf->dconf, @@ -5666,7 +5655,7 @@ bfa_dconf_sm_flash_read(struct bfa_dconf_mod_s *dconf, break; case BFA_DCONF_SM_TIMEOUT: bfa_sm_set_state(dconf, bfa_dconf_sm_ready); - bfa_ioc_suspend(&dconf->bfa->ioc); + bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_IOC_FAILED); break; case BFA_DCONF_SM_EXIT: bfa_timer_stop(&dconf->timer); @@ -5864,6 +5853,7 @@ bfa_dconf_init_cb(void *arg, bfa_status_t status) struct bfa_s *bfa = arg; struct bfa_dconf_mod_s *dconf = BFA_DCONF_MOD(bfa); + bfa_sm_send_event(dconf, BFA_DCONF_SM_FLASH_COMP); if (status == BFA_STATUS_OK) { bfa_dconf_read_data_valid(bfa) = BFA_TRUE; if (dconf->dconf->hdr.signature != BFI_DCONF_SIGNATURE) @@ -5871,7 +5861,6 @@ bfa_dconf_init_cb(void *arg, bfa_status_t status) if (dconf->dconf->hdr.version != BFI_DCONF_VERSION) dconf->dconf->hdr.version = BFI_DCONF_VERSION; } - bfa_sm_send_event(dconf, BFA_DCONF_SM_FLASH_COMP); bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_DCONF_DONE); } @@ -5956,448 +5945,3 @@ bfa_dconf_modexit(struct bfa_s *bfa) struct bfa_dconf_mod_s *dconf = BFA_DCONF_MOD(bfa); bfa_sm_send_event(dconf, BFA_DCONF_SM_EXIT); } - -/* - * FRU specific functions - */ - -#define BFA_FRU_DMA_BUF_SZ 0x02000 /* 8k dma buffer */ -#define BFA_FRU_CHINOOK_MAX_SIZE 0x10000 -#define BFA_FRU_LIGHTNING_MAX_SIZE 0x200 - -static void -bfa_fru_notify(void *cbarg, enum bfa_ioc_event_e event) -{ - struct bfa_fru_s *fru = cbarg; - - bfa_trc(fru, event); - - switch (event) { - case BFA_IOC_E_DISABLED: - case BFA_IOC_E_FAILED: - if (fru->op_busy) { - fru->status = BFA_STATUS_IOC_FAILURE; - fru->cbfn(fru->cbarg, fru->status); - fru->op_busy = 0; - } - break; - - default: - break; - } -} - -/* - * Send fru write request. - * - * @param[in] cbarg - callback argument - */ -static void -bfa_fru_write_send(void *cbarg, enum bfi_fru_h2i_msgs msg_type) -{ - struct bfa_fru_s *fru = cbarg; - struct bfi_fru_write_req_s *msg = - (struct bfi_fru_write_req_s *) fru->mb.msg; - u32 len; - - msg->offset = cpu_to_be32(fru->addr_off + fru->offset); - len = (fru->residue < BFA_FRU_DMA_BUF_SZ) ? - fru->residue : BFA_FRU_DMA_BUF_SZ; - msg->length = cpu_to_be32(len); - - /* - * indicate if it's the last msg of the whole write operation - */ - msg->last = (len == fru->residue) ? 1 : 0; - - bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc)); - bfa_alen_set(&msg->alen, len, fru->dbuf_pa); - - memcpy(fru->dbuf_kva, fru->ubuf + fru->offset, len); - bfa_ioc_mbox_queue(fru->ioc, &fru->mb); - - fru->residue -= len; - fru->offset += len; -} - -/* - * Send fru read request. - * - * @param[in] cbarg - callback argument - */ -static void -bfa_fru_read_send(void *cbarg, enum bfi_fru_h2i_msgs msg_type) -{ - struct bfa_fru_s *fru = cbarg; - struct bfi_fru_read_req_s *msg = - (struct bfi_fru_read_req_s *) fru->mb.msg; - u32 len; - - msg->offset = cpu_to_be32(fru->addr_off + fru->offset); - len = (fru->residue < BFA_FRU_DMA_BUF_SZ) ? - fru->residue : BFA_FRU_DMA_BUF_SZ; - msg->length = cpu_to_be32(len); - bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc)); - bfa_alen_set(&msg->alen, len, fru->dbuf_pa); - bfa_ioc_mbox_queue(fru->ioc, &fru->mb); -} - -/* - * Flash memory info API. - * - * @param[in] mincfg - minimal cfg variable - */ -u32 -bfa_fru_meminfo(bfa_boolean_t mincfg) -{ - /* min driver doesn't need fru */ - if (mincfg) - return 0; - - return BFA_ROUNDUP(BFA_FRU_DMA_BUF_SZ, BFA_DMA_ALIGN_SZ); -} - -/* - * Flash attach API. - * - * @param[in] fru - fru structure - * @param[in] ioc - ioc structure - * @param[in] dev - device structure - * @param[in] trcmod - trace module - * @param[in] logmod - log module - */ -void -bfa_fru_attach(struct bfa_fru_s *fru, struct bfa_ioc_s *ioc, void *dev, - struct bfa_trc_mod_s *trcmod, bfa_boolean_t mincfg) -{ - fru->ioc = ioc; - fru->trcmod = trcmod; - fru->cbfn = NULL; - fru->cbarg = NULL; - fru->op_busy = 0; - - bfa_ioc_mbox_regisr(fru->ioc, BFI_MC_FRU, bfa_fru_intr, fru); - bfa_q_qe_init(&fru->ioc_notify); - bfa_ioc_notify_init(&fru->ioc_notify, bfa_fru_notify, fru); - list_add_tail(&fru->ioc_notify.qe, &fru->ioc->notify_q); - - /* min driver doesn't need fru */ - if (mincfg) { - fru->dbuf_kva = NULL; - fru->dbuf_pa = 0; - } -} - -/* - * Claim memory for fru - * - * @param[in] fru - fru structure - * @param[in] dm_kva - pointer to virtual memory address - * @param[in] dm_pa - frusical memory address - * @param[in] mincfg - minimal cfg variable - */ -void -bfa_fru_memclaim(struct bfa_fru_s *fru, u8 *dm_kva, u64 dm_pa, - bfa_boolean_t mincfg) -{ - if (mincfg) - return; - - fru->dbuf_kva = dm_kva; - fru->dbuf_pa = dm_pa; - memset(fru->dbuf_kva, 0, BFA_FRU_DMA_BUF_SZ); - dm_kva += BFA_ROUNDUP(BFA_FRU_DMA_BUF_SZ, BFA_DMA_ALIGN_SZ); - dm_pa += BFA_ROUNDUP(BFA_FRU_DMA_BUF_SZ, BFA_DMA_ALIGN_SZ); -} - -/* - * Update fru vpd image. - * - * @param[in] fru - fru structure - * @param[in] buf - update data buffer - * @param[in] len - data buffer length - * @param[in] offset - offset relative to starting address - * @param[in] cbfn - callback function - * @param[in] cbarg - callback argument - * - * Return status. - */ -bfa_status_t -bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, - bfa_cb_fru_t cbfn, void *cbarg) -{ - bfa_trc(fru, BFI_FRUVPD_H2I_WRITE_REQ); - bfa_trc(fru, len); - bfa_trc(fru, offset); - - if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) - return BFA_STATUS_FRU_NOT_PRESENT; - - if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) - return BFA_STATUS_CMD_NOTSUPP; - - if (!bfa_ioc_is_operational(fru->ioc)) - return BFA_STATUS_IOC_NON_OP; - - if (fru->op_busy) { - bfa_trc(fru, fru->op_busy); - return BFA_STATUS_DEVBUSY; - } - - fru->op_busy = 1; - - fru->cbfn = cbfn; - fru->cbarg = cbarg; - fru->residue = len; - fru->offset = 0; - fru->addr_off = offset; - fru->ubuf = buf; - - bfa_fru_write_send(fru, BFI_FRUVPD_H2I_WRITE_REQ); - - return BFA_STATUS_OK; -} - -/* - * Read fru vpd image. - * - * @param[in] fru - fru structure - * @param[in] buf - read data buffer - * @param[in] len - data buffer length - * @param[in] offset - offset relative to starting address - * @param[in] cbfn - callback function - * @param[in] cbarg - callback argument - * - * Return status. - */ -bfa_status_t -bfa_fruvpd_read(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, - bfa_cb_fru_t cbfn, void *cbarg) -{ - bfa_trc(fru, BFI_FRUVPD_H2I_READ_REQ); - bfa_trc(fru, len); - bfa_trc(fru, offset); - - if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) - return BFA_STATUS_FRU_NOT_PRESENT; - - if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) - return BFA_STATUS_CMD_NOTSUPP; - - if (!bfa_ioc_is_operational(fru->ioc)) - return BFA_STATUS_IOC_NON_OP; - - if (fru->op_busy) { - bfa_trc(fru, fru->op_busy); - return BFA_STATUS_DEVBUSY; - } - - fru->op_busy = 1; - - fru->cbfn = cbfn; - fru->cbarg = cbarg; - fru->residue = len; - fru->offset = 0; - fru->addr_off = offset; - fru->ubuf = buf; - bfa_fru_read_send(fru, BFI_FRUVPD_H2I_READ_REQ); - - return BFA_STATUS_OK; -} - -/* - * Get maximum size fru vpd image. - * - * @param[in] fru - fru structure - * @param[out] size - maximum size of fru vpd data - * - * Return status. - */ -bfa_status_t -bfa_fruvpd_get_max_size(struct bfa_fru_s *fru, u32 *max_size) -{ - if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) - return BFA_STATUS_FRU_NOT_PRESENT; - - if (!bfa_ioc_is_operational(fru->ioc)) - return BFA_STATUS_IOC_NON_OP; - - if (fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK) - *max_size = BFA_FRU_CHINOOK_MAX_SIZE; - else - return BFA_STATUS_CMD_NOTSUPP; - return BFA_STATUS_OK; -} -/* - * tfru write. - * - * @param[in] fru - fru structure - * @param[in] buf - update data buffer - * @param[in] len - data buffer length - * @param[in] offset - offset relative to starting address - * @param[in] cbfn - callback function - * @param[in] cbarg - callback argument - * - * Return status. - */ -bfa_status_t -bfa_tfru_write(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, - bfa_cb_fru_t cbfn, void *cbarg) -{ - bfa_trc(fru, BFI_TFRU_H2I_WRITE_REQ); - bfa_trc(fru, len); - bfa_trc(fru, offset); - bfa_trc(fru, *((u8 *) buf)); - - if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) - return BFA_STATUS_FRU_NOT_PRESENT; - - if (!bfa_ioc_is_operational(fru->ioc)) - return BFA_STATUS_IOC_NON_OP; - - if (fru->op_busy) { - bfa_trc(fru, fru->op_busy); - return BFA_STATUS_DEVBUSY; - } - - fru->op_busy = 1; - - fru->cbfn = cbfn; - fru->cbarg = cbarg; - fru->residue = len; - fru->offset = 0; - fru->addr_off = offset; - fru->ubuf = buf; - - bfa_fru_write_send(fru, BFI_TFRU_H2I_WRITE_REQ); - - return BFA_STATUS_OK; -} - -/* - * tfru read. - * - * @param[in] fru - fru structure - * @param[in] buf - read data buffer - * @param[in] len - data buffer length - * @param[in] offset - offset relative to starting address - * @param[in] cbfn - callback function - * @param[in] cbarg - callback argument - * - * Return status. - */ -bfa_status_t -bfa_tfru_read(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, - bfa_cb_fru_t cbfn, void *cbarg) -{ - bfa_trc(fru, BFI_TFRU_H2I_READ_REQ); - bfa_trc(fru, len); - bfa_trc(fru, offset); - - if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) - return BFA_STATUS_FRU_NOT_PRESENT; - - if (!bfa_ioc_is_operational(fru->ioc)) - return BFA_STATUS_IOC_NON_OP; - - if (fru->op_busy) { - bfa_trc(fru, fru->op_busy); - return BFA_STATUS_DEVBUSY; - } - - fru->op_busy = 1; - - fru->cbfn = cbfn; - fru->cbarg = cbarg; - fru->residue = len; - fru->offset = 0; - fru->addr_off = offset; - fru->ubuf = buf; - bfa_fru_read_send(fru, BFI_TFRU_H2I_READ_REQ); - - return BFA_STATUS_OK; -} - -/* - * Process fru response messages upon receiving interrupts. - * - * @param[in] fruarg - fru structure - * @param[in] msg - message structure - */ -void -bfa_fru_intr(void *fruarg, struct bfi_mbmsg_s *msg) -{ - struct bfa_fru_s *fru = fruarg; - struct bfi_fru_rsp_s *rsp = (struct bfi_fru_rsp_s *)msg; - u32 status; - - bfa_trc(fru, msg->mh.msg_id); - - if (!fru->op_busy) { - /* - * receiving response after ioc failure - */ - bfa_trc(fru, 0x9999); - return; - } - - switch (msg->mh.msg_id) { - case BFI_FRUVPD_I2H_WRITE_RSP: - case BFI_TFRU_I2H_WRITE_RSP: - status = be32_to_cpu(rsp->status); - bfa_trc(fru, status); - - if (status != BFA_STATUS_OK || fru->residue == 0) { - fru->status = status; - fru->op_busy = 0; - if (fru->cbfn) - fru->cbfn(fru->cbarg, fru->status); - } else { - bfa_trc(fru, fru->offset); - if (msg->mh.msg_id == BFI_FRUVPD_I2H_WRITE_RSP) - bfa_fru_write_send(fru, - BFI_FRUVPD_H2I_WRITE_REQ); - else - bfa_fru_write_send(fru, - BFI_TFRU_H2I_WRITE_REQ); - } - break; - case BFI_FRUVPD_I2H_READ_RSP: - case BFI_TFRU_I2H_READ_RSP: - status = be32_to_cpu(rsp->status); - bfa_trc(fru, status); - - if (status != BFA_STATUS_OK) { - fru->status = status; - fru->op_busy = 0; - if (fru->cbfn) - fru->cbfn(fru->cbarg, fru->status); - } else { - u32 len = be32_to_cpu(rsp->length); - - bfa_trc(fru, fru->offset); - bfa_trc(fru, len); - - memcpy(fru->ubuf + fru->offset, fru->dbuf_kva, len); - fru->residue -= len; - fru->offset += len; - - if (fru->residue == 0) { - fru->status = status; - fru->op_busy = 0; - if (fru->cbfn) - fru->cbfn(fru->cbarg, fru->status); - } else { - if (msg->mh.msg_id == BFI_FRUVPD_I2H_READ_RSP) - bfa_fru_read_send(fru, - BFI_FRUVPD_H2I_READ_REQ); - else - bfa_fru_read_send(fru, - BFI_TFRU_H2I_READ_REQ); - } - } - break; - default: - WARN_ON(1); - } -} diff --git a/trunk/drivers/scsi/bfa/bfa_ioc.h b/trunk/drivers/scsi/bfa/bfa_ioc.h index 23a90e7b7107..b2856f96567c 100644 --- a/trunk/drivers/scsi/bfa/bfa_ioc.h +++ b/trunk/drivers/scsi/bfa/bfa_ioc.h @@ -701,55 +701,6 @@ void bfa_phy_memclaim(struct bfa_phy_s *phy, u8 *dm_kva, u64 dm_pa, bfa_boolean_t mincfg); void bfa_phy_intr(void *phyarg, struct bfi_mbmsg_s *msg); -/* - * FRU module specific - */ -typedef void (*bfa_cb_fru_t) (void *cbarg, bfa_status_t status); - -struct bfa_fru_s { - struct bfa_ioc_s *ioc; /* back pointer to ioc */ - struct bfa_trc_mod_s *trcmod; /* trace module */ - u8 op_busy; /* operation busy flag */ - u8 rsv[3]; - u32 residue; /* residual length */ - u32 offset; /* offset */ - bfa_status_t status; /* status */ - u8 *dbuf_kva; /* dma buf virtual address */ - u64 dbuf_pa; /* dma buf physical address */ - struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ - bfa_cb_fru_t cbfn; /* user callback function */ - void *cbarg; /* user callback arg */ - u8 *ubuf; /* user supplied buffer */ - struct bfa_cb_qe_s hcb_qe; /* comp: BFA callback qelem */ - u32 addr_off; /* fru address offset */ - struct bfa_mbox_cmd_s mb; /* mailbox */ - struct bfa_ioc_notify_s ioc_notify; /* ioc event notify */ - struct bfa_mem_dma_s fru_dma; -}; - -#define BFA_FRU(__bfa) (&(__bfa)->modules.fru) -#define BFA_MEM_FRU_DMA(__bfa) (&(BFA_FRU(__bfa)->fru_dma)) - -bfa_status_t bfa_fruvpd_update(struct bfa_fru_s *fru, - void *buf, u32 len, u32 offset, - bfa_cb_fru_t cbfn, void *cbarg); -bfa_status_t bfa_fruvpd_read(struct bfa_fru_s *fru, - void *buf, u32 len, u32 offset, - bfa_cb_fru_t cbfn, void *cbarg); -bfa_status_t bfa_fruvpd_get_max_size(struct bfa_fru_s *fru, u32 *max_size); -bfa_status_t bfa_tfru_write(struct bfa_fru_s *fru, - void *buf, u32 len, u32 offset, - bfa_cb_fru_t cbfn, void *cbarg); -bfa_status_t bfa_tfru_read(struct bfa_fru_s *fru, - void *buf, u32 len, u32 offset, - bfa_cb_fru_t cbfn, void *cbarg); -u32 bfa_fru_meminfo(bfa_boolean_t mincfg); -void bfa_fru_attach(struct bfa_fru_s *fru, struct bfa_ioc_s *ioc, - void *dev, struct bfa_trc_mod_s *trcmod, bfa_boolean_t mincfg); -void bfa_fru_memclaim(struct bfa_fru_s *fru, - u8 *dm_kva, u64 dm_pa, bfa_boolean_t mincfg); -void bfa_fru_intr(void *fruarg, struct bfi_mbmsg_s *msg); - /* * Driver Config( dconf) specific */ @@ -765,7 +716,6 @@ struct bfa_dconf_hdr_s { struct bfa_dconf_s { struct bfa_dconf_hdr_s hdr; struct bfa_lunmask_cfg_s lun_mask; - struct bfa_throttle_cfg_s throttle_cfg; }; #pragma pack() @@ -788,8 +738,6 @@ struct bfa_dconf_mod_s { #define bfa_dconf_read_data_valid(__bfa) \ (BFA_DCONF_MOD(__bfa)->read_data_valid) #define BFA_DCONF_UPDATE_TOV 5000 /* memtest timeout in msec */ -#define bfa_dconf_get_min_cfg(__bfa) \ - (BFA_DCONF_MOD(__bfa)->min_cfg) void bfa_dconf_modinit(struct bfa_s *bfa); void bfa_dconf_modexit(struct bfa_s *bfa); @@ -813,8 +761,7 @@ bfa_status_t bfa_dconf_update(struct bfa_s *bfa); #define bfa_ioc_maxfrsize(__ioc) ((__ioc)->attr->maxfrsize) #define bfa_ioc_rx_bbcredit(__ioc) ((__ioc)->attr->rx_bbcredit) #define bfa_ioc_speed_sup(__ioc) \ - ((bfa_ioc_is_cna(__ioc)) ? BFA_PORT_SPEED_10GBPS : \ - BFI_ADAPTER_GETP(SPEED, (__ioc)->attr->adapter_prop)) + BFI_ADAPTER_GETP(SPEED, (__ioc)->attr->adapter_prop) #define bfa_ioc_get_nports(__ioc) \ BFI_ADAPTER_GETP(NPORTS, (__ioc)->attr->adapter_prop) @@ -938,12 +885,12 @@ bfa_status_t bfa_ablk_port_config(struct bfa_ablk_s *ablk, int port, enum bfa_mode_s mode, int max_pf, int max_vf, bfa_ablk_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, - u8 port, enum bfi_pcifn_class personality, - u16 bw_min, u16 bw_max, bfa_ablk_cbfn_t cbfn, void *cbarg); + u8 port, enum bfi_pcifn_class personality, int bw, + bfa_ablk_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_ablk_pf_delete(struct bfa_ablk_s *ablk, int pcifn, bfa_ablk_cbfn_t cbfn, void *cbarg); -bfa_status_t bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, - u16 bw_min, u16 bw_max, bfa_ablk_cbfn_t cbfn, void *cbarg); +bfa_status_t bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, int bw, + bfa_ablk_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_ablk_optrom_en(struct bfa_ablk_s *ablk, bfa_ablk_cbfn_t cbfn, void *cbarg); bfa_status_t bfa_ablk_optrom_dis(struct bfa_ablk_s *ablk, diff --git a/trunk/drivers/scsi/bfa/bfa_ioc_ct.c b/trunk/drivers/scsi/bfa/bfa_ioc_ct.c index de4e726a1263..2eb0c6a2938d 100644 --- a/trunk/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/trunk/drivers/scsi/bfa/bfa_ioc_ct.c @@ -57,6 +57,13 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) u32 usecnt; struct bfi_ioc_image_hdr_s fwhdr; + /* + * If bios boot (flash based) -- do not increment usage count + */ + if (bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)) < + BFA_IOC_FWIMG_MINSZ) + return BFA_TRUE; + bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); usecnt = readl(ioc->ioc_regs.ioc_usage_reg); @@ -107,6 +114,13 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc) { u32 usecnt; + /* + * If bios boot (flash based) -- do not decrement usage count + */ + if (bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)) < + BFA_IOC_FWIMG_MINSZ) + return; + /* * decrement usage count */ @@ -386,12 +400,13 @@ static void bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc) { - bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); - writel(0, ioc->ioc_regs.ioc_usage_reg); - readl(ioc->ioc_regs.ioc_usage_sem_reg); - writel(1, ioc->ioc_regs.ioc_usage_sem_reg); + if (bfa_ioc_is_cna(ioc)) { + bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); + writel(0, ioc->ioc_regs.ioc_usage_reg); + readl(ioc->ioc_regs.ioc_usage_sem_reg); + writel(1, ioc->ioc_regs.ioc_usage_sem_reg); + } - writel(0, ioc->ioc_regs.ioc_fail_sync); /* * Read the hw sem reg to make sure that it is locked * before we clear it. If it is not locked, writing 1 @@ -744,6 +759,25 @@ bfa_ioc_ct2_mem_init(void __iomem *rb) void bfa_ioc_ct2_mac_reset(void __iomem *rb) { + u32 r32; + + bfa_ioc_ct2_sclk_init(rb); + bfa_ioc_ct2_lclk_init(rb); + + /* + * release soft reset on s_clk & l_clk + */ + r32 = readl((rb + CT2_APP_PLL_SCLK_CTL_REG)); + writel(r32 & ~__APP_PLL_SCLK_LOGIC_SOFT_RESET, + (rb + CT2_APP_PLL_SCLK_CTL_REG)); + + /* + * release soft reset on s_clk & l_clk + */ + r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); + writel(r32 & ~__APP_PLL_LCLK_LOGIC_SOFT_RESET, + (rb + CT2_APP_PLL_LCLK_CTL_REG)); + /* put port0, port1 MAC & AHB in reset */ writel((__CSI_MAC_RESET | __CSI_MAC_AHB_RESET), rb + CT2_CSI_MAC_CONTROL_REG(0)); @@ -751,21 +785,8 @@ bfa_ioc_ct2_mac_reset(void __iomem *rb) rb + CT2_CSI_MAC_CONTROL_REG(1)); } -static void -bfa_ioc_ct2_enable_flash(void __iomem *rb) -{ - u32 r32; - - r32 = readl((rb + PSS_GPIO_OUT_REG)); - writel(r32 & ~1, (rb + PSS_GPIO_OUT_REG)); - r32 = readl((rb + PSS_GPIO_OE_REG)); - writel(r32 | 1, (rb + PSS_GPIO_OE_REG)); -} - #define CT2_NFC_MAX_DELAY 1000 -#define CT2_NFC_PAUSE_MAX_DELAY 4000 -#define CT2_NFC_VER_VALID 0x147 -#define CT2_NFC_STATE_RUNNING 0x20000001 +#define CT2_NFC_VER_VALID 0x143 #define BFA_IOC_PLL_POLL 1000000 static bfa_boolean_t @@ -780,20 +801,6 @@ bfa_ioc_ct2_nfc_halted(void __iomem *rb) return BFA_FALSE; } -static void -bfa_ioc_ct2_nfc_halt(void __iomem *rb) -{ - int i; - - writel(__HALT_NFC_CONTROLLER, rb + CT2_NFC_CSR_SET_REG); - for (i = 0; i < CT2_NFC_MAX_DELAY; i++) { - if (bfa_ioc_ct2_nfc_halted(rb)) - break; - udelay(1000); - } - WARN_ON(!bfa_ioc_ct2_nfc_halted(rb)); -} - static void bfa_ioc_ct2_nfc_resume(void __iomem *rb) { @@ -810,142 +817,105 @@ bfa_ioc_ct2_nfc_resume(void __iomem *rb) WARN_ON(1); } -static void -bfa_ioc_ct2_clk_reset(void __iomem *rb) -{ - u32 r32; - - bfa_ioc_ct2_sclk_init(rb); - bfa_ioc_ct2_lclk_init(rb); - - /* - * release soft reset on s_clk & l_clk - */ - r32 = readl((rb + CT2_APP_PLL_SCLK_CTL_REG)); - writel(r32 & ~__APP_PLL_SCLK_LOGIC_SOFT_RESET, - (rb + CT2_APP_PLL_SCLK_CTL_REG)); - - r32 = readl((rb + CT2_APP_PLL_LCLK_CTL_REG)); - writel(r32 & ~__APP_PLL_LCLK_LOGIC_SOFT_RESET, - (rb + CT2_APP_PLL_LCLK_CTL_REG)); - -} - -static void -bfa_ioc_ct2_nfc_clk_reset(void __iomem *rb) +bfa_status_t +bfa_ioc_ct2_pll_init(void __iomem *rb, enum bfi_asic_mode mode) { - u32 r32, i; - - r32 = readl((rb + PSS_CTL_REG)); - r32 |= (__PSS_LPU0_RESET | __PSS_LPU1_RESET); - writel(r32, (rb + PSS_CTL_REG)); - - writel(__RESET_AND_START_SCLK_LCLK_PLLS, rb + CT2_CSI_FW_CTL_SET_REG); + u32 wgn, r32, nfc_ver, i; - for (i = 0; i < BFA_IOC_PLL_POLL; i++) { - r32 = readl(rb + CT2_NFC_FLASH_STS_REG); + wgn = readl(rb + CT2_WGN_STATUS); + nfc_ver = readl(rb + CT2_RSC_GPR15_REG); - if ((r32 & __FLASH_PLL_INIT_AND_RESET_IN_PROGRESS)) - break; - } - WARN_ON(!(r32 & __FLASH_PLL_INIT_AND_RESET_IN_PROGRESS)); + if ((wgn == (__A2T_AHB_LOAD | __WGN_READY)) && + (nfc_ver >= CT2_NFC_VER_VALID)) { + if (bfa_ioc_ct2_nfc_halted(rb)) + bfa_ioc_ct2_nfc_resume(rb); - for (i = 0; i < BFA_IOC_PLL_POLL; i++) { - r32 = readl(rb + CT2_NFC_FLASH_STS_REG); + writel(__RESET_AND_START_SCLK_LCLK_PLLS, + rb + CT2_CSI_FW_CTL_SET_REG); - if (!(r32 & __FLASH_PLL_INIT_AND_RESET_IN_PROGRESS)) - break; - } - WARN_ON((r32 & __FLASH_PLL_INIT_AND_RESET_IN_PROGRESS)); + for (i = 0; i < BFA_IOC_PLL_POLL; i++) { + r32 = readl(rb + CT2_APP_PLL_LCLK_CTL_REG); + if (r32 & __RESET_AND_START_SCLK_LCLK_PLLS) + break; + } - r32 = readl(rb + CT2_CSI_FW_CTL_REG); - WARN_ON((r32 & __RESET_AND_START_SCLK_LCLK_PLLS)); -} + WARN_ON(!(r32 & __RESET_AND_START_SCLK_LCLK_PLLS)); -static void -bfa_ioc_ct2_wait_till_nfc_running(void __iomem *rb) -{ - u32 r32; - int i; + for (i = 0; i < BFA_IOC_PLL_POLL; i++) { + r32 = readl(rb + CT2_APP_PLL_LCLK_CTL_REG); + if (!(r32 & __RESET_AND_START_SCLK_LCLK_PLLS)) + break; + } - if (bfa_ioc_ct2_nfc_halted(rb)) - bfa_ioc_ct2_nfc_resume(rb); - for (i = 0; i < CT2_NFC_PAUSE_MAX_DELAY; i++) { - r32 = readl(rb + CT2_NFC_STS_REG); - if (r32 == CT2_NFC_STATE_RUNNING) - return; + WARN_ON(r32 & __RESET_AND_START_SCLK_LCLK_PLLS); udelay(1000); - } - - r32 = readl(rb + CT2_NFC_STS_REG); - WARN_ON(!(r32 == CT2_NFC_STATE_RUNNING)); -} -bfa_status_t -bfa_ioc_ct2_pll_init(void __iomem *rb, enum bfi_asic_mode mode) -{ - u32 wgn, r32, nfc_ver; + r32 = readl(rb + CT2_CSI_FW_CTL_REG); + WARN_ON(r32 & __RESET_AND_START_SCLK_LCLK_PLLS); + } else { + writel(__HALT_NFC_CONTROLLER, rb + CT2_NFC_CSR_SET_REG); + for (i = 0; i < CT2_NFC_MAX_DELAY; i++) { + r32 = readl(rb + CT2_NFC_CSR_SET_REG); + if (r32 & __NFC_CONTROLLER_HALTED) + break; + udelay(1000); + } - wgn = readl(rb + CT2_WGN_STATUS); + bfa_ioc_ct2_mac_reset(rb); + bfa_ioc_ct2_sclk_init(rb); + bfa_ioc_ct2_lclk_init(rb); - if (wgn == (__WGN_READY | __GLBL_PF_VF_CFG_RDY)) { /* - * If flash is corrupted, enable flash explicitly + * release soft reset on s_clk & l_clk */ - bfa_ioc_ct2_clk_reset(rb); - bfa_ioc_ct2_enable_flash(rb); - - bfa_ioc_ct2_mac_reset(rb); - - bfa_ioc_ct2_clk_reset(rb); - bfa_ioc_ct2_enable_flash(rb); + r32 = readl(rb + CT2_APP_PLL_SCLK_CTL_REG); + writel(r32 & ~__APP_PLL_SCLK_LOGIC_SOFT_RESET, + (rb + CT2_APP_PLL_SCLK_CTL_REG)); - } else { - nfc_ver = readl(rb + CT2_RSC_GPR15_REG); - - if ((nfc_ver >= CT2_NFC_VER_VALID) && - (wgn == (__A2T_AHB_LOAD | __WGN_READY))) { - - bfa_ioc_ct2_wait_till_nfc_running(rb); - - bfa_ioc_ct2_nfc_clk_reset(rb); - } else { - bfa_ioc_ct2_nfc_halt(rb); - - bfa_ioc_ct2_clk_reset(rb); - bfa_ioc_ct2_mac_reset(rb); - bfa_ioc_ct2_clk_reset(rb); + /* + * release soft reset on s_clk & l_clk + */ + r32 = readl(rb + CT2_APP_PLL_LCLK_CTL_REG); + writel(r32 & ~__APP_PLL_LCLK_LOGIC_SOFT_RESET, + (rb + CT2_APP_PLL_LCLK_CTL_REG)); + } - } + /* + * Announce flash device presence, if flash was corrupted. + */ + if (wgn == (__WGN_READY | __GLBL_PF_VF_CFG_RDY)) { + r32 = readl(rb + PSS_GPIO_OUT_REG); + writel(r32 & ~1, (rb + PSS_GPIO_OUT_REG)); + r32 = readl(rb + PSS_GPIO_OE_REG); + writel(r32 | 1, (rb + PSS_GPIO_OE_REG)); } /* * Mask the interrupts and clear any - * pending interrupts left by BIOS/EFI + * pending interrupts. */ - writel(1, (rb + CT2_LPU0_HOSTFN_MBOX0_MSK)); writel(1, (rb + CT2_LPU1_HOSTFN_MBOX0_MSK)); /* For first time initialization, no need to clear interrupts */ r32 = readl(rb + HOST_SEM5_REG); if (r32 & 0x1) { - r32 = readl((rb + CT2_LPU0_HOSTFN_CMD_STAT)); + r32 = readl(rb + CT2_LPU0_HOSTFN_CMD_STAT); if (r32 == 1) { - writel(1, (rb + CT2_LPU0_HOSTFN_CMD_STAT)); + writel(1, rb + CT2_LPU0_HOSTFN_CMD_STAT); readl((rb + CT2_LPU0_HOSTFN_CMD_STAT)); } - r32 = readl((rb + CT2_LPU1_HOSTFN_CMD_STAT)); + r32 = readl(rb + CT2_LPU1_HOSTFN_CMD_STAT); if (r32 == 1) { - writel(1, (rb + CT2_LPU1_HOSTFN_CMD_STAT)); - readl((rb + CT2_LPU1_HOSTFN_CMD_STAT)); + writel(1, rb + CT2_LPU1_HOSTFN_CMD_STAT); + readl(rb + CT2_LPU1_HOSTFN_CMD_STAT); } } bfa_ioc_ct2_mem_init(rb); - writel(BFI_IOC_UNINIT, (rb + CT2_BFA_IOC0_STATE_REG)); - writel(BFI_IOC_UNINIT, (rb + CT2_BFA_IOC1_STATE_REG)); + writel(BFI_IOC_UNINIT, rb + CT2_BFA_IOC0_STATE_REG); + writel(BFI_IOC_UNINIT, rb + CT2_BFA_IOC1_STATE_REG); return BFA_STATUS_OK; } diff --git a/trunk/drivers/scsi/bfa/bfa_modules.h b/trunk/drivers/scsi/bfa/bfa_modules.h index a14c784ff3fc..189fff71e3c2 100644 --- a/trunk/drivers/scsi/bfa/bfa_modules.h +++ b/trunk/drivers/scsi/bfa/bfa_modules.h @@ -45,7 +45,6 @@ struct bfa_modules_s { struct bfa_diag_s diag_mod; /* diagnostics module */ struct bfa_phy_s phy; /* phy module */ struct bfa_dconf_mod_s dconf_mod; /* DCONF common module */ - struct bfa_fru_s fru; /* fru module */ }; /* diff --git a/trunk/drivers/scsi/bfa/bfa_port.c b/trunk/drivers/scsi/bfa/bfa_port.c index 8ea7697deb9b..95e4ad8759ac 100644 --- a/trunk/drivers/scsi/bfa/bfa_port.c +++ b/trunk/drivers/scsi/bfa/bfa_port.c @@ -250,12 +250,6 @@ bfa_port_enable(struct bfa_port_s *port, bfa_port_endis_cbfn_t cbfn, return BFA_STATUS_IOC_FAILURE; } - /* if port is d-port enabled, return error */ - if (port->dport_enabled) { - bfa_trc(port, BFA_STATUS_DPORT_ERR); - return BFA_STATUS_DPORT_ERR; - } - if (port->endis_pending) { bfa_trc(port, BFA_STATUS_DEVBUSY); return BFA_STATUS_DEVBUSY; @@ -306,12 +300,6 @@ bfa_port_disable(struct bfa_port_s *port, bfa_port_endis_cbfn_t cbfn, return BFA_STATUS_IOC_FAILURE; } - /* if port is d-port enabled, return error */ - if (port->dport_enabled) { - bfa_trc(port, BFA_STATUS_DPORT_ERR); - return BFA_STATUS_DPORT_ERR; - } - if (port->endis_pending) { bfa_trc(port, BFA_STATUS_DEVBUSY); return BFA_STATUS_DEVBUSY; @@ -443,10 +431,6 @@ bfa_port_notify(void *arg, enum bfa_ioc_event_e event) port->endis_cbfn = NULL; port->endis_pending = BFA_FALSE; } - - /* clear D-port mode */ - if (port->dport_enabled) - bfa_port_set_dportenabled(port, BFA_FALSE); break; default: break; @@ -483,7 +467,6 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, port->stats_cbfn = NULL; port->endis_cbfn = NULL; port->pbc_disabled = BFA_FALSE; - port->dport_enabled = BFA_FALSE; bfa_ioc_mbox_regisr(port->ioc, BFI_MC_PORT, bfa_port_isr, port); bfa_q_qe_init(&port->ioc_notify); @@ -499,21 +482,6 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, bfa_trc(port, 0); } -/* - * bfa_port_set_dportenabled(); - * - * Port module- set pbc disabled flag - * - * @param[in] port - Pointer to the Port module data structure - * - * @return void - */ -void -bfa_port_set_dportenabled(struct bfa_port_s *port, bfa_boolean_t enabled) -{ - port->dport_enabled = enabled; -} - /* * CEE module specific definitions */ diff --git a/trunk/drivers/scsi/bfa/bfa_port.h b/trunk/drivers/scsi/bfa/bfa_port.h index 2fcab6bc6280..947f897328d6 100644 --- a/trunk/drivers/scsi/bfa/bfa_port.h +++ b/trunk/drivers/scsi/bfa/bfa_port.h @@ -45,7 +45,6 @@ struct bfa_port_s { bfa_status_t endis_status; struct bfa_ioc_notify_s ioc_notify; bfa_boolean_t pbc_disabled; - bfa_boolean_t dport_enabled; struct bfa_mem_dma_s port_dma; }; @@ -67,8 +66,6 @@ bfa_status_t bfa_port_disable(struct bfa_port_s *port, u32 bfa_port_meminfo(void); void bfa_port_mem_claim(struct bfa_port_s *port, u8 *dma_kva, u64 dma_pa); -void bfa_port_set_dportenabled(struct bfa_port_s *port, - bfa_boolean_t enabled); /* * CEE declaration diff --git a/trunk/drivers/scsi/bfa/bfa_svc.c b/trunk/drivers/scsi/bfa/bfa_svc.c index 299c1c889b33..b2538d60db34 100644 --- a/trunk/drivers/scsi/bfa/bfa_svc.c +++ b/trunk/drivers/scsi/bfa/bfa_svc.c @@ -67,9 +67,6 @@ enum bfa_fcport_sm_event { BFA_FCPORT_SM_LINKDOWN = 7, /* firmware linkup down */ BFA_FCPORT_SM_QRESUME = 8, /* CQ space available */ BFA_FCPORT_SM_HWFAIL = 9, /* IOC h/w failure */ - BFA_FCPORT_SM_DPORTENABLE = 10, /* enable dport */ - BFA_FCPORT_SM_DPORTDISABLE = 11,/* disable dport */ - BFA_FCPORT_SM_FAA_MISCONFIG = 12, /* FAA misconfiguratin */ }; /* @@ -200,10 +197,6 @@ static void bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport, enum bfa_fcport_sm_event event); static void bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport, enum bfa_fcport_sm_event event); -static void bfa_fcport_sm_dport(struct bfa_fcport_s *fcport, - enum bfa_fcport_sm_event event); -static void bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport, - enum bfa_fcport_sm_event event); static void bfa_fcport_ln_sm_dn(struct bfa_fcport_ln_s *ln, enum bfa_fcport_ln_sm_event event); @@ -233,8 +226,6 @@ static struct bfa_sm_table_s hal_port_sm_table[] = { {BFA_SM(bfa_fcport_sm_stopped), BFA_PORT_ST_STOPPED}, {BFA_SM(bfa_fcport_sm_iocdown), BFA_PORT_ST_IOCDOWN}, {BFA_SM(bfa_fcport_sm_iocfail), BFA_PORT_ST_IOCDOWN}, - {BFA_SM(bfa_fcport_sm_dport), BFA_PORT_ST_DPORT}, - {BFA_SM(bfa_fcport_sm_faa_misconfig), BFA_PORT_ST_FAA_MISCONFIG}, }; @@ -1253,12 +1244,6 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) * Just ignore */ break; - case BFA_LPS_SM_SET_N2N_PID: - /* - * When topology is set to loop, bfa_lps_set_n2n_pid() sends - * this event. Ignore this event. - */ - break; default: bfa_sm_fault(lps->bfa, event); @@ -1276,7 +1261,6 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) switch (event) { case BFA_LPS_SM_FWRSP: - case BFA_LPS_SM_OFFLINE: if (lps->status == BFA_STATUS_OK) { bfa_sm_set_state(lps, bfa_lps_sm_online); if (lps->fdisc) @@ -1305,6 +1289,7 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) bfa_lps_login_comp(lps); break; + case BFA_LPS_SM_OFFLINE: case BFA_LPS_SM_DELETE: bfa_sm_set_state(lps, bfa_lps_sm_init); break; @@ -2184,12 +2169,6 @@ bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport, bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); break; - case BFA_FCPORT_SM_FAA_MISCONFIG: - bfa_fcport_reset_linkinfo(fcport); - bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); - bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig); - break; - default: bfa_sm_fault(fcport->bfa, event); } @@ -2246,12 +2225,6 @@ bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport, bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); break; - case BFA_FCPORT_SM_FAA_MISCONFIG: - bfa_fcport_reset_linkinfo(fcport); - bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); - bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig); - break; - default: bfa_sm_fault(fcport->bfa, event); } @@ -2277,11 +2250,11 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { bfa_trc(fcport->bfa, - pevent->link_state.attr.vc_fcf.fcf.fipenabled); + pevent->link_state.vc_fcf.fcf.fipenabled); bfa_trc(fcport->bfa, - pevent->link_state.attr.vc_fcf.fcf.fipfailed); + pevent->link_state.vc_fcf.fcf.fipfailed); - if (pevent->link_state.attr.vc_fcf.fcf.fipfailed) + if (pevent->link_state.vc_fcf.fcf.fipfailed) bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, BFA_PL_EID_FIP_FCF_DISC, 0, "FIP FCF Discovery Failed"); @@ -2338,12 +2311,6 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); break; - case BFA_FCPORT_SM_FAA_MISCONFIG: - bfa_fcport_reset_linkinfo(fcport); - bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); - bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig); - break; - default: bfa_sm_fault(fcport->bfa, event); } @@ -2437,12 +2404,6 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, } break; - case BFA_FCPORT_SM_FAA_MISCONFIG: - bfa_fcport_reset_linkinfo(fcport); - bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); - bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig); - break; - default: bfa_sm_fault(fcport->bfa, event); } @@ -2488,12 +2449,6 @@ bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport, bfa_reqq_wcancel(&fcport->reqq_wait); break; - case BFA_FCPORT_SM_FAA_MISCONFIG: - bfa_fcport_reset_linkinfo(fcport); - bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); - bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig); - break; - default: bfa_sm_fault(fcport->bfa, event); } @@ -2645,10 +2600,6 @@ bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport, bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail); break; - case BFA_FCPORT_SM_DPORTENABLE: - bfa_sm_set_state(fcport, bfa_fcport_sm_dport); - break; - default: bfa_sm_fault(fcport->bfa, event); } @@ -2729,81 +2680,6 @@ bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport, } } -static void -bfa_fcport_sm_dport(struct bfa_fcport_s *fcport, enum bfa_fcport_sm_event event) -{ - bfa_trc(fcport->bfa, event); - - switch (event) { - case BFA_FCPORT_SM_DPORTENABLE: - case BFA_FCPORT_SM_DISABLE: - case BFA_FCPORT_SM_ENABLE: - case BFA_FCPORT_SM_START: - /* - * Ignore event for a port that is dport - */ - break; - - case BFA_FCPORT_SM_STOP: - bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); - break; - - case BFA_FCPORT_SM_HWFAIL: - bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail); - break; - - case BFA_FCPORT_SM_DPORTDISABLE: - bfa_sm_set_state(fcport, bfa_fcport_sm_disabled); - break; - - default: - bfa_sm_fault(fcport->bfa, event); - } -} - -static void -bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport, - enum bfa_fcport_sm_event event) -{ - bfa_trc(fcport->bfa, event); - - switch (event) { - case BFA_FCPORT_SM_DPORTENABLE: - case BFA_FCPORT_SM_ENABLE: - case BFA_FCPORT_SM_START: - /* - * Ignore event for a port as there is FAA misconfig - */ - break; - - case BFA_FCPORT_SM_DISABLE: - if (bfa_fcport_send_disable(fcport)) - bfa_sm_set_state(fcport, bfa_fcport_sm_disabling); - else - bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait); - - bfa_fcport_reset_linkinfo(fcport); - bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE); - bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, - BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); - bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); - break; - - case BFA_FCPORT_SM_STOP: - bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); - break; - - case BFA_FCPORT_SM_HWFAIL: - bfa_fcport_reset_linkinfo(fcport); - bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE); - bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); - break; - - default: - bfa_sm_fault(fcport->bfa, event); - } -} - /* * Link state is down */ @@ -3067,7 +2943,6 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, */ do_gettimeofday(&tv); fcport->stats_reset_time = tv.tv_sec; - fcport->stats_dma_ready = BFA_FALSE; /* * initialize and set default configuration @@ -3078,9 +2953,6 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, port_cfg->maxfrsize = 0; port_cfg->trl_def_speed = BFA_PORT_SPEED_1GBPS; - port_cfg->qos_bw.high = BFA_QOS_BW_HIGH; - port_cfg->qos_bw.med = BFA_QOS_BW_MED; - port_cfg->qos_bw.low = BFA_QOS_BW_LOW; INIT_LIST_HEAD(&fcport->stats_pending_q); INIT_LIST_HEAD(&fcport->statsclr_pending_q); @@ -3124,21 +2996,6 @@ bfa_fcport_iocdisable(struct bfa_s *bfa) bfa_trunk_iocdisable(bfa); } -/* - * Update loop info in fcport for SCN online - */ -static void -bfa_fcport_update_loop_info(struct bfa_fcport_s *fcport, - struct bfa_fcport_loop_info_s *loop_info) -{ - fcport->myalpa = loop_info->myalpa; - fcport->alpabm_valid = - loop_info->alpabm_val; - memcpy(fcport->alpabm.alpa_bm, - loop_info->alpabm.alpa_bm, - sizeof(struct fc_alpabm_s)); -} - static void bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport) { @@ -3148,15 +3005,12 @@ bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport) fcport->speed = pevent->link_state.speed; fcport->topology = pevent->link_state.topology; - if (fcport->topology == BFA_PORT_TOPOLOGY_LOOP) { - bfa_fcport_update_loop_info(fcport, - &pevent->link_state.attr.loop_info); - return; - } + if (fcport->topology == BFA_PORT_TOPOLOGY_LOOP) + fcport->myalpa = 0; /* QoS Details */ fcport->qos_attr = pevent->link_state.qos_attr; - fcport->qos_vc_attr = pevent->link_state.attr.vc_fcf.qos_vc_attr; + fcport->qos_vc_attr = pevent->link_state.vc_fcf.qos_vc_attr; /* * update trunk state if applicable @@ -3165,8 +3019,7 @@ bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport) trunk->attr.state = BFA_TRUNK_DISABLED; /* update FCoE specific */ - fcport->fcoe_vlan = - be16_to_cpu(pevent->link_state.attr.vc_fcf.fcf.vlan); + fcport->fcoe_vlan = be16_to_cpu(pevent->link_state.vc_fcf.fcf.vlan); bfa_trc(fcport->bfa, fcport->speed); bfa_trc(fcport->bfa, fcport->topology); @@ -3600,7 +3453,6 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) case BFI_FCPORT_I2H_ENABLE_RSP: if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) { - fcport->stats_dma_ready = BFA_TRUE; if (fcport->use_flash_cfg) { fcport->cfg = i2hmsg.penable_rsp->port_cfg; fcport->cfg.maxfrsize = @@ -3616,8 +3468,6 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) else fcport->trunk.attr.state = BFA_TRUNK_DISABLED; - fcport->qos_attr.qos_bw = - i2hmsg.penable_rsp->port_cfg.qos_bw; fcport->use_flash_cfg = BFA_FALSE; } @@ -3626,9 +3476,6 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) else fcport->qos_attr.state = BFA_QOS_DISABLED; - fcport->qos_attr.qos_bw_op = - i2hmsg.penable_rsp->port_cfg.qos_bw; - bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); } break; @@ -3641,17 +3488,8 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) case BFI_FCPORT_I2H_EVENT: if (i2hmsg.event->link_state.linkstate == BFA_PORT_LINKUP) bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP); - else { - if (i2hmsg.event->link_state.linkstate_rsn == - BFA_PORT_LINKSTATE_RSN_FAA_MISCONFIG) - bfa_sm_send_event(fcport, - BFA_FCPORT_SM_FAA_MISCONFIG); - else - bfa_sm_send_event(fcport, - BFA_FCPORT_SM_LINKDOWN); - } - fcport->qos_attr.qos_bw_op = - i2hmsg.event->link_state.qos_attr.qos_bw_op; + else + bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKDOWN); break; case BFI_FCPORT_I2H_TRUNK_SCN: @@ -3771,9 +3609,6 @@ bfa_fcport_cfg_speed(struct bfa_s *bfa, enum bfa_port_speed speed) if (fcport->cfg.trunked == BFA_TRUE) return BFA_STATUS_TRUNK_ENABLED; - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) && - (speed == BFA_PORT_SPEED_16GBPS)) - return BFA_STATUS_UNSUPP_SPEED; if ((speed != BFA_PORT_SPEED_AUTO) && (speed > fcport->speed_sup)) { bfa_trc(bfa, fcport->speed_sup); return BFA_STATUS_UNSUPP_SPEED; @@ -3828,26 +3663,7 @@ bfa_fcport_cfg_topology(struct bfa_s *bfa, enum bfa_port_topology topology) switch (topology) { case BFA_PORT_TOPOLOGY_P2P: - break; - case BFA_PORT_TOPOLOGY_LOOP: - if ((bfa_fcport_is_qos_enabled(bfa) != BFA_FALSE) || - (fcport->qos_attr.state != BFA_QOS_DISABLED)) - return BFA_STATUS_ERROR_QOS_ENABLED; - if (fcport->cfg.ratelimit != BFA_FALSE) - return BFA_STATUS_ERROR_TRL_ENABLED; - if ((bfa_fcport_is_trunk_enabled(bfa) != BFA_FALSE) || - (fcport->trunk.attr.state != BFA_TRUNK_DISABLED)) - return BFA_STATUS_ERROR_TRUNK_ENABLED; - if ((bfa_fcport_get_speed(bfa) == BFA_PORT_SPEED_16GBPS) || - (fcport->cfg.speed == BFA_PORT_SPEED_16GBPS)) - return BFA_STATUS_UNSUPP_SPEED; - if (bfa_mfg_is_mezz(bfa->ioc.attr->card_type)) - return BFA_STATUS_LOOP_UNSUPP_MEZZ; - if (bfa_fcport_is_dport(bfa) != BFA_FALSE) - return BFA_STATUS_DPORT_ERR; - break; - case BFA_PORT_TOPOLOGY_AUTO: break; @@ -3870,17 +3686,6 @@ bfa_fcport_get_topology(struct bfa_s *bfa) return fcport->topology; } -/** - * Get config topology. - */ -enum bfa_port_topology -bfa_fcport_get_cfg_topology(struct bfa_s *bfa) -{ - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); - - return fcport->cfg.topology; -} - bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa) { @@ -3956,11 +3761,9 @@ bfa_fcport_get_maxfrsize(struct bfa_s *bfa) u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa) { - if (bfa_fcport_get_topology(bfa) != BFA_PORT_TOPOLOGY_LOOP) - return (BFA_FCPORT_MOD(bfa))->cfg.rx_bbcredit; + struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); - else - return 0; + return fcport->cfg.rx_bbcredit; } void @@ -4047,9 +3850,8 @@ bfa_fcport_get_stats(struct bfa_s *bfa, struct bfa_cb_pending_q_s *cb) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); - if (!bfa_iocfc_is_operational(bfa) || - !fcport->stats_dma_ready) - return BFA_STATUS_IOC_NON_OP; + if (bfa_ioc_is_disabled(&bfa->ioc)) + return BFA_STATUS_IOC_DISABLED; if (!list_empty(&fcport->statsclr_pending_q)) return BFA_STATUS_DEVBUSY; @@ -4074,10 +3876,6 @@ bfa_fcport_clear_stats(struct bfa_s *bfa, struct bfa_cb_pending_q_s *cb) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); - if (!bfa_iocfc_is_operational(bfa) || - !fcport->stats_dma_ready) - return BFA_STATUS_IOC_NON_OP; - if (!list_empty(&fcport->stats_pending_q)) return BFA_STATUS_DEVBUSY; @@ -4106,40 +3904,6 @@ bfa_fcport_is_disabled(struct bfa_s *bfa) } -bfa_boolean_t -bfa_fcport_is_dport(struct bfa_s *bfa) -{ - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); - - return (bfa_sm_to_state(hal_port_sm_table, fcport->sm) == - BFA_PORT_ST_DPORT); -} - -bfa_status_t -bfa_fcport_set_qos_bw(struct bfa_s *bfa, struct bfa_qos_bw_s *qos_bw) -{ - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); - enum bfa_ioc_type_e ioc_type = bfa_get_type(bfa); - - bfa_trc(bfa, ioc_type); - - if ((qos_bw->high == 0) || (qos_bw->med == 0) || (qos_bw->low == 0)) - return BFA_STATUS_QOS_BW_INVALID; - - if ((qos_bw->high + qos_bw->med + qos_bw->low) != 100) - return BFA_STATUS_QOS_BW_INVALID; - - if ((qos_bw->med > qos_bw->high) || (qos_bw->low > qos_bw->med) || - (qos_bw->low > qos_bw->high)) - return BFA_STATUS_QOS_BW_INVALID; - - if ((ioc_type == BFA_IOC_TYPE_FC) && - (fcport->cfg.topology != BFA_PORT_TOPOLOGY_LOOP)) - fcport->cfg.qos_bw = *qos_bw; - - return BFA_STATUS_OK; -} - bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa) { @@ -4217,26 +3981,6 @@ bfa_fcport_is_trunk_enabled(struct bfa_s *bfa) return fcport->cfg.trunked; } -void -bfa_fcport_dportenable(struct bfa_s *bfa) -{ - /* - * Assume caller check for port is in disable state - */ - bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DPORTENABLE); - bfa_port_set_dportenabled(&bfa->modules.port, BFA_TRUE); -} - -void -bfa_fcport_dportdisable(struct bfa_s *bfa) -{ - /* - * Assume caller check for port is in disable state - */ - bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DPORTDISABLE); - bfa_port_set_dportenabled(&bfa->modules.port, BFA_FALSE); -} - /* * Rport State machine functions */ @@ -4963,21 +4707,6 @@ bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *m) bfa_sm_send_event(rp, BFA_RPORT_SM_QOS_SCN); break; - case BFI_RPORT_I2H_LIP_SCN_ONLINE: - bfa_fcport_update_loop_info(BFA_FCPORT_MOD(bfa), - &msg.lip_scn->loop_info); - bfa_cb_rport_scn_online(bfa); - break; - - case BFI_RPORT_I2H_LIP_SCN_OFFLINE: - bfa_cb_rport_scn_offline(bfa); - break; - - case BFI_RPORT_I2H_NO_DEV: - rp = BFA_RPORT_FROM_TAG(bfa, msg.lip_scn->bfa_handle); - bfa_cb_rport_scn_no_dev(rp->rport_drv); - break; - default: bfa_trc(bfa, m->mhdr.msg_id); WARN_ON(1); @@ -5618,37 +5347,6 @@ bfa_uf_res_recfg(struct bfa_s *bfa, u16 num_uf_fw) } } -/* - * Dport forward declaration - */ - -/* - * BFA DPORT state machine events - */ -enum bfa_dport_sm_event { - BFA_DPORT_SM_ENABLE = 1, /* dport enable event */ - BFA_DPORT_SM_DISABLE = 2, /* dport disable event */ - BFA_DPORT_SM_FWRSP = 3, /* fw enable/disable rsp */ - BFA_DPORT_SM_QRESUME = 4, /* CQ space available */ - BFA_DPORT_SM_HWFAIL = 5, /* IOC h/w failure */ -}; - -static void bfa_dport_sm_disabled(struct bfa_dport_s *dport, - enum bfa_dport_sm_event event); -static void bfa_dport_sm_enabling_qwait(struct bfa_dport_s *dport, - enum bfa_dport_sm_event event); -static void bfa_dport_sm_enabling(struct bfa_dport_s *dport, - enum bfa_dport_sm_event event); -static void bfa_dport_sm_enabled(struct bfa_dport_s *dport, - enum bfa_dport_sm_event event); -static void bfa_dport_sm_disabling_qwait(struct bfa_dport_s *dport, - enum bfa_dport_sm_event event); -static void bfa_dport_sm_disabling(struct bfa_dport_s *dport, - enum bfa_dport_sm_event event); -static void bfa_dport_qresume(void *cbarg); -static void bfa_dport_req_comp(struct bfa_dport_s *dport, - bfi_diag_dport_rsp_t *msg); - /* * BFA fcdiag module */ @@ -5679,24 +5377,15 @@ bfa_fcdiag_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, struct bfa_pcidev_s *pcidev) { struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); - struct bfa_dport_s *dport = &fcdiag->dport; - fcdiag->bfa = bfa; fcdiag->trcmod = bfa->trcmod; /* The common DIAG attach bfa_diag_attach() will do all memory claim */ - dport->bfa = bfa; - bfa_sm_set_state(dport, bfa_dport_sm_disabled); - bfa_reqq_winit(&dport->reqq_wait, bfa_dport_qresume, dport); - dport->cbfn = NULL; - dport->cbarg = NULL; } static void bfa_fcdiag_iocdisable(struct bfa_s *bfa) { struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); - struct bfa_dport_s *dport = &fcdiag->dport; - bfa_trc(fcdiag, fcdiag->lb.lock); if (fcdiag->lb.lock) { fcdiag->lb.status = BFA_STATUS_IOC_FAILURE; @@ -5704,8 +5393,6 @@ bfa_fcdiag_iocdisable(struct bfa_s *bfa) fcdiag->lb.lock = 0; bfa_fcdiag_set_busy_status(fcdiag); } - - bfa_sm_send_event(dport, BFA_DPORT_SM_HWFAIL); } static void @@ -5890,9 +5577,6 @@ bfa_fcdiag_intr(struct bfa_s *bfa, struct bfi_msg_s *msg) case BFI_DIAG_I2H_QTEST: bfa_fcdiag_queuetest_comp(fcdiag, (bfi_diag_qtest_rsp_t *)msg); break; - case BFI_DIAG_I2H_DPORT: - bfa_dport_req_comp(&fcdiag->dport, (bfi_diag_dport_rsp_t *)msg); - break; default: bfa_trc(fcdiag, msg->mhdr.msg_id); WARN_ON(1); @@ -5962,18 +5646,12 @@ bfa_fcdiag_loopback(struct bfa_s *bfa, enum bfa_port_opmode opmode, } } - /* - * For CT2, 1G is not supported - */ - if ((speed == BFA_PORT_SPEED_1GBPS) && - (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id))) { - bfa_trc(fcdiag, speed); - return BFA_STATUS_UNSUPP_SPEED; - } - /* For Mezz card, port speed entered needs to be checked */ if (bfa_mfg_is_mezz(bfa->ioc.attr->card_type)) { if (bfa_ioc_get_type(&bfa->ioc) == BFA_IOC_TYPE_FC) { + if ((speed == BFA_PORT_SPEED_1GBPS) && + (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id))) + return BFA_STATUS_UNSUPP_SPEED; if (!(speed == BFA_PORT_SPEED_1GBPS || speed == BFA_PORT_SPEED_2GBPS || speed == BFA_PORT_SPEED_4GBPS || @@ -6086,379 +5764,3 @@ bfa_fcdiag_lb_is_running(struct bfa_s *bfa) struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); return fcdiag->lb.lock ? BFA_STATUS_DIAG_BUSY : BFA_STATUS_OK; } - -/* - * D-port - */ -static bfa_boolean_t bfa_dport_send_req(struct bfa_dport_s *dport, - enum bfi_dport_req req); -static void -bfa_cb_fcdiag_dport(struct bfa_dport_s *dport, bfa_status_t bfa_status) -{ - if (dport->cbfn != NULL) { - dport->cbfn(dport->cbarg, bfa_status); - dport->cbfn = NULL; - dport->cbarg = NULL; - } -} - -static void -bfa_dport_sm_disabled(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) -{ - bfa_trc(dport->bfa, event); - - switch (event) { - case BFA_DPORT_SM_ENABLE: - bfa_fcport_dportenable(dport->bfa); - if (bfa_dport_send_req(dport, BFI_DPORT_ENABLE)) - bfa_sm_set_state(dport, bfa_dport_sm_enabling); - else - bfa_sm_set_state(dport, bfa_dport_sm_enabling_qwait); - break; - - case BFA_DPORT_SM_DISABLE: - /* Already disabled */ - break; - - case BFA_DPORT_SM_HWFAIL: - /* ignore */ - break; - - default: - bfa_sm_fault(dport->bfa, event); - } -} - -static void -bfa_dport_sm_enabling_qwait(struct bfa_dport_s *dport, - enum bfa_dport_sm_event event) -{ - bfa_trc(dport->bfa, event); - - switch (event) { - case BFA_DPORT_SM_QRESUME: - bfa_sm_set_state(dport, bfa_dport_sm_enabling); - bfa_dport_send_req(dport, BFI_DPORT_ENABLE); - break; - - case BFA_DPORT_SM_HWFAIL: - bfa_reqq_wcancel(&dport->reqq_wait); - bfa_sm_set_state(dport, bfa_dport_sm_disabled); - bfa_cb_fcdiag_dport(dport, BFA_STATUS_FAILED); - break; - - default: - bfa_sm_fault(dport->bfa, event); - } -} - -static void -bfa_dport_sm_enabling(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) -{ - bfa_trc(dport->bfa, event); - - switch (event) { - case BFA_DPORT_SM_FWRSP: - bfa_sm_set_state(dport, bfa_dport_sm_enabled); - break; - - case BFA_DPORT_SM_HWFAIL: - bfa_sm_set_state(dport, bfa_dport_sm_disabled); - bfa_cb_fcdiag_dport(dport, BFA_STATUS_FAILED); - break; - - default: - bfa_sm_fault(dport->bfa, event); - } -} - -static void -bfa_dport_sm_enabled(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) -{ - bfa_trc(dport->bfa, event); - - switch (event) { - case BFA_DPORT_SM_ENABLE: - /* Already enabled */ - break; - - case BFA_DPORT_SM_DISABLE: - bfa_fcport_dportdisable(dport->bfa); - if (bfa_dport_send_req(dport, BFI_DPORT_DISABLE)) - bfa_sm_set_state(dport, bfa_dport_sm_disabling); - else - bfa_sm_set_state(dport, bfa_dport_sm_disabling_qwait); - break; - - case BFA_DPORT_SM_HWFAIL: - bfa_sm_set_state(dport, bfa_dport_sm_disabled); - break; - - default: - bfa_sm_fault(dport->bfa, event); - } -} - -static void -bfa_dport_sm_disabling_qwait(struct bfa_dport_s *dport, - enum bfa_dport_sm_event event) -{ - bfa_trc(dport->bfa, event); - - switch (event) { - case BFA_DPORT_SM_QRESUME: - bfa_sm_set_state(dport, bfa_dport_sm_disabling); - bfa_dport_send_req(dport, BFI_DPORT_DISABLE); - break; - - case BFA_DPORT_SM_HWFAIL: - bfa_sm_set_state(dport, bfa_dport_sm_disabled); - bfa_reqq_wcancel(&dport->reqq_wait); - bfa_cb_fcdiag_dport(dport, BFA_STATUS_OK); - break; - - default: - bfa_sm_fault(dport->bfa, event); - } -} - -static void -bfa_dport_sm_disabling(struct bfa_dport_s *dport, enum bfa_dport_sm_event event) -{ - bfa_trc(dport->bfa, event); - - switch (event) { - case BFA_DPORT_SM_FWRSP: - bfa_sm_set_state(dport, bfa_dport_sm_disabled); - break; - - case BFA_DPORT_SM_HWFAIL: - bfa_sm_set_state(dport, bfa_dport_sm_disabled); - bfa_cb_fcdiag_dport(dport, BFA_STATUS_OK); - break; - - default: - bfa_sm_fault(dport->bfa, event); - } -} - - -static bfa_boolean_t -bfa_dport_send_req(struct bfa_dport_s *dport, enum bfi_dport_req req) -{ - struct bfi_diag_dport_req_s *m; - - /* - * Increment message tag before queue check, so that responses to old - * requests are discarded. - */ - dport->msgtag++; - - /* - * check for room in queue to send request now - */ - m = bfa_reqq_next(dport->bfa, BFA_REQQ_DIAG); - if (!m) { - bfa_reqq_wait(dport->bfa, BFA_REQQ_PORT, &dport->reqq_wait); - return BFA_FALSE; - } - - bfi_h2i_set(m->mh, BFI_MC_DIAG, BFI_DIAG_H2I_DPORT, - bfa_fn_lpu(dport->bfa)); - m->req = req; - m->msgtag = dport->msgtag; - - /* - * queue I/O message to firmware - */ - bfa_reqq_produce(dport->bfa, BFA_REQQ_DIAG, m->mh); - - return BFA_TRUE; -} - -static void -bfa_dport_qresume(void *cbarg) -{ - struct bfa_dport_s *dport = cbarg; - - bfa_sm_send_event(dport, BFA_DPORT_SM_QRESUME); -} - -static void -bfa_dport_req_comp(struct bfa_dport_s *dport, bfi_diag_dport_rsp_t *msg) -{ - bfa_sm_send_event(dport, BFA_DPORT_SM_FWRSP); - bfa_cb_fcdiag_dport(dport, msg->status); -} - -/* - * Dport enable - * - * @param[in] *bfa - bfa data struct - */ -bfa_status_t -bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) -{ - struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); - struct bfa_dport_s *dport = &fcdiag->dport; - - /* - * Dport is not support in MEZZ card - */ - if (bfa_mfg_is_mezz(dport->bfa->ioc.attr->card_type)) { - bfa_trc(dport->bfa, BFA_STATUS_PBC); - return BFA_STATUS_CMD_NOTSUPP_MEZZ; - } - - /* - * Check to see if IOC is down - */ - if (!bfa_iocfc_is_operational(bfa)) - return BFA_STATUS_IOC_NON_OP; - - /* if port is PBC disabled, return error */ - if (bfa_fcport_is_pbcdisabled(bfa)) { - bfa_trc(dport->bfa, BFA_STATUS_PBC); - return BFA_STATUS_PBC; - } - - /* - * Check if port mode is FC port - */ - if (bfa_ioc_get_type(&bfa->ioc) != BFA_IOC_TYPE_FC) { - bfa_trc(dport->bfa, bfa_ioc_get_type(&bfa->ioc)); - return BFA_STATUS_CMD_NOTSUPP_CNA; - } - - /* - * Check if port is in LOOP mode - */ - if ((bfa_fcport_get_cfg_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP) || - (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP)) { - bfa_trc(dport->bfa, 0); - return BFA_STATUS_TOPOLOGY_LOOP; - } - - /* - * Check if port is TRUNK mode - */ - if (bfa_fcport_is_trunk_enabled(bfa)) { - bfa_trc(dport->bfa, 0); - return BFA_STATUS_ERROR_TRUNK_ENABLED; - } - - /* - * Check to see if port is disable or in dport state - */ - if ((bfa_fcport_is_disabled(bfa) == BFA_FALSE) && - (bfa_fcport_is_dport(bfa) == BFA_FALSE)) { - bfa_trc(dport->bfa, 0); - return BFA_STATUS_PORT_NOT_DISABLED; - } - - /* - * Check if dport is busy - */ - if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabling) || - bfa_sm_cmp_state(dport, bfa_dport_sm_enabling_qwait) || - bfa_sm_cmp_state(dport, bfa_dport_sm_disabling) || - bfa_sm_cmp_state(dport, bfa_dport_sm_disabling_qwait)) { - return BFA_STATUS_DEVBUSY; - } - - /* - * Check if dport is already enabled - */ - if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabled)) { - bfa_trc(dport->bfa, 0); - return BFA_STATUS_DPORT_ENABLED; - } - - dport->cbfn = cbfn; - dport->cbarg = cbarg; - - bfa_sm_send_event(dport, BFA_DPORT_SM_ENABLE); - return BFA_STATUS_OK; -} - -/* - * Dport disable - * - * @param[in] *bfa - bfa data struct - */ -bfa_status_t -bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, void *cbarg) -{ - struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); - struct bfa_dport_s *dport = &fcdiag->dport; - - if (bfa_ioc_is_disabled(&bfa->ioc)) - return BFA_STATUS_IOC_DISABLED; - - /* if port is PBC disabled, return error */ - if (bfa_fcport_is_pbcdisabled(bfa)) { - bfa_trc(dport->bfa, BFA_STATUS_PBC); - return BFA_STATUS_PBC; - } - - /* - * Check to see if port is disable or in dport state - */ - if ((bfa_fcport_is_disabled(bfa) == BFA_FALSE) && - (bfa_fcport_is_dport(bfa) == BFA_FALSE)) { - bfa_trc(dport->bfa, 0); - return BFA_STATUS_PORT_NOT_DISABLED; - } - - /* - * Check if dport is busy - */ - if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabling) || - bfa_sm_cmp_state(dport, bfa_dport_sm_enabling_qwait) || - bfa_sm_cmp_state(dport, bfa_dport_sm_disabling) || - bfa_sm_cmp_state(dport, bfa_dport_sm_disabling_qwait)) - return BFA_STATUS_DEVBUSY; - - /* - * Check if dport is already disabled - */ - if (bfa_sm_cmp_state(dport, bfa_dport_sm_disabled)) { - bfa_trc(dport->bfa, 0); - return BFA_STATUS_DPORT_DISABLED; - } - - dport->cbfn = cbfn; - dport->cbarg = cbarg; - - bfa_sm_send_event(dport, BFA_DPORT_SM_DISABLE); - return BFA_STATUS_OK; -} - -/* - * Get D-port state - * - * @param[in] *bfa - bfa data struct - */ - -bfa_status_t -bfa_dport_get_state(struct bfa_s *bfa, enum bfa_dport_state *state) -{ - struct bfa_fcdiag_s *fcdiag = BFA_FCDIAG_MOD(bfa); - struct bfa_dport_s *dport = &fcdiag->dport; - - if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabled)) - *state = BFA_DPORT_ST_ENABLED; - else if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabling) || - bfa_sm_cmp_state(dport, bfa_dport_sm_enabling_qwait)) - *state = BFA_DPORT_ST_ENABLING; - else if (bfa_sm_cmp_state(dport, bfa_dport_sm_disabled)) - *state = BFA_DPORT_ST_DISABLED; - else if (bfa_sm_cmp_state(dport, bfa_dport_sm_disabling) || - bfa_sm_cmp_state(dport, bfa_dport_sm_disabling_qwait)) - *state = BFA_DPORT_ST_DISABLING; - else { - bfa_trc(dport->bfa, BFA_STATUS_EINVAL); - return BFA_STATUS_EINVAL; - } - return BFA_STATUS_OK; -} diff --git a/trunk/drivers/scsi/bfa/bfa_svc.h b/trunk/drivers/scsi/bfa/bfa_svc.h index 8d7fbecfcb22..1abcf7c51661 100644 --- a/trunk/drivers/scsi/bfa/bfa_svc.h +++ b/trunk/drivers/scsi/bfa/bfa_svc.h @@ -474,10 +474,8 @@ struct bfa_fcport_s { /* supported speeds */ enum bfa_port_speed speed; /* current speed */ enum bfa_port_topology topology; /* current topology */ - u8 rsvd[3]; u8 myalpa; /* my ALPA in LOOP topology */ - u8 alpabm_valid; /* alpa bitmap valid or not */ - struct fc_alpabm_s alpabm; /* alpa bitmap */ + u8 rsvd[3]; struct bfa_port_cfg_s cfg; /* current port configuration */ bfa_boolean_t use_flash_cfg; /* get port cfg from flash */ struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ @@ -514,7 +512,6 @@ struct bfa_fcport_s { struct bfa_fcport_trunk_s trunk; u16 fcoe_vlan; struct bfa_mem_dma_s fcport_dma; - bfa_boolean_t stats_dma_ready; }; #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) @@ -537,7 +534,6 @@ enum bfa_port_speed bfa_fcport_get_speed(struct bfa_s *bfa); bfa_status_t bfa_fcport_cfg_topology(struct bfa_s *bfa, enum bfa_port_topology topo); enum bfa_port_topology bfa_fcport_get_topology(struct bfa_s *bfa); -enum bfa_port_topology bfa_fcport_get_cfg_topology(struct bfa_s *bfa); bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa); bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa); u8 bfa_fcport_get_myalpa(struct bfa_s *bfa); @@ -551,9 +547,6 @@ void bfa_fcport_event_register(struct bfa_s *bfa, void (*event_cbfn) (void *cbarg, enum bfa_port_linkstate event), void *event_cbarg); bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa); -bfa_boolean_t bfa_fcport_is_dport(struct bfa_s *bfa); -bfa_status_t bfa_fcport_set_qos_bw(struct bfa_s *bfa, - struct bfa_qos_bw_s *qos_bw); enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit, u8 bb_scn); @@ -567,8 +560,6 @@ bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa, struct bfa_cb_pending_q_s *cb); bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa); bfa_boolean_t bfa_fcport_is_trunk_enabled(struct bfa_s *bfa); -void bfa_fcport_dportenable(struct bfa_s *bfa); -void bfa_fcport_dportdisable(struct bfa_s *bfa); bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa); void bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state); @@ -584,9 +575,6 @@ void bfa_cb_rport_offline(void *rport); void bfa_cb_rport_qos_scn_flowid(void *rport, struct bfa_rport_qos_attr_s old_qos_attr, struct bfa_rport_qos_attr_s new_qos_attr); -void bfa_cb_rport_scn_online(struct bfa_s *bfa); -void bfa_cb_rport_scn_offline(struct bfa_s *bfa); -void bfa_cb_rport_scn_no_dev(void *rp); void bfa_cb_rport_qos_scn_prio(void *rport, struct bfa_rport_qos_attr_s old_qos_attr, struct bfa_rport_qos_attr_s new_qos_attr); @@ -709,21 +697,11 @@ struct bfa_fcdiag_lb_s { u32 status; }; -struct bfa_dport_s { - struct bfa_s *bfa; /* Back pointer to BFA */ - bfa_sm_t sm; /* finite state machine */ - u32 msgtag; /* firmware msg tag for reply */ - struct bfa_reqq_wait_s reqq_wait; - bfa_cb_diag_t cbfn; - void *cbarg; -}; - struct bfa_fcdiag_s { struct bfa_s *bfa; /* Back pointer to BFA */ struct bfa_trc_mod_s *trcmod; struct bfa_fcdiag_lb_s lb; struct bfa_fcdiag_qtest_s qtest; - struct bfa_dport_s dport; }; #define BFA_FCDIAG_MOD(__bfa) (&(__bfa)->modules.fcdiag) @@ -739,11 +717,5 @@ bfa_status_t bfa_fcdiag_queuetest(struct bfa_s *bfa, u32 ignore, u32 queue, struct bfa_diag_qtest_result_s *result, bfa_cb_diag_t cbfn, void *cbarg); bfa_status_t bfa_fcdiag_lb_is_running(struct bfa_s *bfa); -bfa_status_t bfa_dport_enable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, - void *cbarg); -bfa_status_t bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn, - void *cbarg); -bfa_status_t bfa_dport_get_state(struct bfa_s *bfa, - enum bfa_dport_state *state); #endif /* __BFA_SVC_H__ */ diff --git a/trunk/drivers/scsi/bfa/bfad.c b/trunk/drivers/scsi/bfa/bfad.c index 895b0e516e07..c37494916a1a 100644 --- a/trunk/drivers/scsi/bfa/bfad.c +++ b/trunk/drivers/scsi/bfa/bfad.c @@ -63,9 +63,9 @@ int max_rport_logins = BFA_FCS_MAX_RPORT_LOGINS; u32 bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size; u32 *bfi_image_cb, *bfi_image_ct, *bfi_image_ct2; -#define BFAD_FW_FILE_CB "cbfw-3.1.0.0.bin" -#define BFAD_FW_FILE_CT "ctfw-3.1.0.0.bin" -#define BFAD_FW_FILE_CT2 "ct2fw-3.1.0.0.bin" +#define BFAD_FW_FILE_CB "cbfw.bin" +#define BFAD_FW_FILE_CT "ctfw.bin" +#define BFAD_FW_FILE_CT2 "ct2fw.bin" static u32 *bfad_load_fwimg(struct pci_dev *pdev); static void bfad_free_fwimg(void); diff --git a/trunk/drivers/scsi/bfa/bfad_bsg.c b/trunk/drivers/scsi/bfa/bfad_bsg.c index 555e7db94a1c..0afa39076cef 100644 --- a/trunk/drivers/scsi/bfa/bfad_bsg.c +++ b/trunk/drivers/scsi/bfa/bfad_bsg.c @@ -33,7 +33,7 @@ bfad_iocmd_ioc_enable(struct bfad_s *bfad, void *cmd) /* If IOC is not in disabled state - return */ if (!bfa_ioc_is_disabled(&bfad->bfa.ioc)) { spin_unlock_irqrestore(&bfad->bfad_lock, flags); - iocmd->status = BFA_STATUS_OK; + iocmd->status = BFA_STATUS_IOC_FAILURE; return rc; } @@ -54,12 +54,6 @@ bfad_iocmd_ioc_disable(struct bfad_s *bfad, void *cmd) unsigned long flags; spin_lock_irqsave(&bfad->bfad_lock, flags); - if (bfa_ioc_is_disabled(&bfad->bfa.ioc)) { - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - iocmd->status = BFA_STATUS_OK; - return rc; - } - if (bfad->disable_active) { spin_unlock_irqrestore(&bfad->bfad_lock, flags); return -EBUSY; @@ -107,10 +101,9 @@ bfad_iocmd_ioc_get_info(struct bfad_s *bfad, void *cmd) /* set adapter hw path */ strcpy(iocmd->adapter_hwpath, bfad->pci_name); - for (i = 0; iocmd->adapter_hwpath[i] != ':' && i < BFA_STRING_32; i++) - ; - for (; iocmd->adapter_hwpath[++i] != ':' && i < BFA_STRING_32; ) - ; + i = strlen(iocmd->adapter_hwpath) - 1; + while (iocmd->adapter_hwpath[i] != '.') + i--; iocmd->adapter_hwpath[i] = '\0'; iocmd->status = BFA_STATUS_OK; return 0; @@ -886,19 +879,6 @@ bfad_iocmd_fabric_get_lports(struct bfad_s *bfad, void *cmd, return 0; } -int -bfad_iocmd_qos_set_bw(struct bfad_s *bfad, void *pcmd) -{ - struct bfa_bsg_qos_bw_s *iocmd = (struct bfa_bsg_qos_bw_s *)pcmd; - unsigned long flags; - - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_fcport_set_qos_bw(&bfad->bfa, &iocmd->qos_bw); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - - return 0; -} - int bfad_iocmd_ratelim(struct bfad_s *bfad, unsigned int cmd, void *pcmd) { @@ -908,22 +888,16 @@ bfad_iocmd_ratelim(struct bfad_s *bfad, unsigned int cmd, void *pcmd) spin_lock_irqsave(&bfad->bfad_lock, flags); - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) && - (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) - iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; - else { - if (cmd == IOCMD_RATELIM_ENABLE) - fcport->cfg.ratelimit = BFA_TRUE; - else if (cmd == IOCMD_RATELIM_DISABLE) - fcport->cfg.ratelimit = BFA_FALSE; + if (cmd == IOCMD_RATELIM_ENABLE) + fcport->cfg.ratelimit = BFA_TRUE; + else if (cmd == IOCMD_RATELIM_DISABLE) + fcport->cfg.ratelimit = BFA_FALSE; - if (fcport->cfg.trl_def_speed == BFA_PORT_SPEED_UNKNOWN) - fcport->cfg.trl_def_speed = BFA_PORT_SPEED_1GBPS; - - iocmd->status = BFA_STATUS_OK; - } + if (fcport->cfg.trl_def_speed == BFA_PORT_SPEED_UNKNOWN) + fcport->cfg.trl_def_speed = BFA_PORT_SPEED_1GBPS; spin_unlock_irqrestore(&bfad->bfad_lock, flags); + iocmd->status = BFA_STATUS_OK; return 0; } @@ -945,13 +919,8 @@ bfad_iocmd_ratelim_speed(struct bfad_s *bfad, unsigned int cmd, void *pcmd) return 0; } - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) && - (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) - iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; - else { - fcport->cfg.trl_def_speed = iocmd->speed; - iocmd->status = BFA_STATUS_OK; - } + fcport->cfg.trl_def_speed = iocmd->speed; + iocmd->status = BFA_STATUS_OK; spin_unlock_irqrestore(&bfad->bfad_lock, flags); return 0; @@ -1198,8 +1167,8 @@ bfad_iocmd_pcifn_create(struct bfad_s *bfad, void *cmd) spin_lock_irqsave(&bfad->bfad_lock, flags); iocmd->status = bfa_ablk_pf_create(&bfad->bfa.modules.ablk, &iocmd->pcifn_id, iocmd->port, - iocmd->pcifn_class, iocmd->bw_min, - iocmd->bw_max, bfad_hcb_comp, &fcomp); + iocmd->pcifn_class, iocmd->bandwidth, + bfad_hcb_comp, &fcomp); spin_unlock_irqrestore(&bfad->bfad_lock, flags); if (iocmd->status != BFA_STATUS_OK) goto out; @@ -1242,8 +1211,8 @@ bfad_iocmd_pcifn_bw(struct bfad_s *bfad, void *cmd) init_completion(&fcomp.comp); spin_lock_irqsave(&bfad->bfad_lock, flags); iocmd->status = bfa_ablk_pf_update(&bfad->bfa.modules.ablk, - iocmd->pcifn_id, iocmd->bw_min, - iocmd->bw_max, bfad_hcb_comp, &fcomp); + iocmd->pcifn_id, iocmd->bandwidth, + bfad_hcb_comp, &fcomp); spin_unlock_irqrestore(&bfad->bfad_lock, flags); bfa_trc(bfad, iocmd->status); if (iocmd->status != BFA_STATUS_OK) @@ -1766,52 +1735,6 @@ bfad_iocmd_diag_lb_stat(struct bfad_s *bfad, void *cmd) return 0; } -int -bfad_iocmd_diag_cfg_dport(struct bfad_s *bfad, unsigned int cmd, void *pcmd) -{ - struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)pcmd; - unsigned long flags; - struct bfad_hal_comp fcomp; - - init_completion(&fcomp.comp); - spin_lock_irqsave(&bfad->bfad_lock, flags); - if (cmd == IOCMD_DIAG_DPORT_ENABLE) - iocmd->status = bfa_dport_enable(&bfad->bfa, - bfad_hcb_comp, &fcomp); - else if (cmd == IOCMD_DIAG_DPORT_DISABLE) - iocmd->status = bfa_dport_disable(&bfad->bfa, - bfad_hcb_comp, &fcomp); - else { - bfa_trc(bfad, 0); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - return -EINVAL; - } - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - - if (iocmd->status != BFA_STATUS_OK) - bfa_trc(bfad, iocmd->status); - else { - wait_for_completion(&fcomp.comp); - iocmd->status = fcomp.status; - } - - return 0; -} - -int -bfad_iocmd_diag_dport_get_state(struct bfad_s *bfad, void *pcmd) -{ - struct bfa_bsg_diag_dport_get_state_s *iocmd = - (struct bfa_bsg_diag_dport_get_state_s *)pcmd; - unsigned long flags; - - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_dport_get_state(&bfad->bfa, &iocmd->state); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - - return 0; -} - int bfad_iocmd_phy_get_attr(struct bfad_s *bfad, void *cmd) { @@ -2129,7 +2052,7 @@ bfad_iocmd_boot_cfg(struct bfad_s *bfad, void *cmd) init_completion(&fcomp.comp); spin_lock_irqsave(&bfad->bfad_lock, flags); iocmd->status = bfa_flash_update_part(BFA_FLASH(&bfad->bfa), - BFA_FLASH_PART_BOOT, bfad->bfa.ioc.port_id, + BFA_FLASH_PART_BOOT, PCI_FUNC(bfad->pcidev->devfn), &iocmd->cfg, sizeof(struct bfa_boot_cfg_s), 0, bfad_hcb_comp, &fcomp); spin_unlock_irqrestore(&bfad->bfad_lock, flags); @@ -2151,7 +2074,7 @@ bfad_iocmd_boot_query(struct bfad_s *bfad, void *cmd) init_completion(&fcomp.comp); spin_lock_irqsave(&bfad->bfad_lock, flags); iocmd->status = bfa_flash_read_part(BFA_FLASH(&bfad->bfa), - BFA_FLASH_PART_BOOT, bfad->bfa.ioc.port_id, + BFA_FLASH_PART_BOOT, PCI_FUNC(bfad->pcidev->devfn), &iocmd->cfg, sizeof(struct bfa_boot_cfg_s), 0, bfad_hcb_comp, &fcomp); spin_unlock_irqrestore(&bfad->bfad_lock, flags); @@ -2238,31 +2161,22 @@ bfad_iocmd_cfg_trunk(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) spin_lock_irqsave(&bfad->bfad_lock, flags); - if (bfa_fcport_is_dport(&bfad->bfa)) - return BFA_STATUS_DPORT_ERR; - - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) || - (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) - iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; - else { - if (v_cmd == IOCMD_TRUNK_ENABLE) { - trunk->attr.state = BFA_TRUNK_OFFLINE; - bfa_fcport_disable(&bfad->bfa); - fcport->cfg.trunked = BFA_TRUE; - } else if (v_cmd == IOCMD_TRUNK_DISABLE) { - trunk->attr.state = BFA_TRUNK_DISABLED; - bfa_fcport_disable(&bfad->bfa); - fcport->cfg.trunked = BFA_FALSE; - } - - if (!bfa_fcport_is_disabled(&bfad->bfa)) - bfa_fcport_enable(&bfad->bfa); - - iocmd->status = BFA_STATUS_OK; + if (v_cmd == IOCMD_TRUNK_ENABLE) { + trunk->attr.state = BFA_TRUNK_OFFLINE; + bfa_fcport_disable(&bfad->bfa); + fcport->cfg.trunked = BFA_TRUE; + } else if (v_cmd == IOCMD_TRUNK_DISABLE) { + trunk->attr.state = BFA_TRUNK_DISABLED; + bfa_fcport_disable(&bfad->bfa); + fcport->cfg.trunked = BFA_FALSE; } + if (!bfa_fcport_is_disabled(&bfad->bfa)) + bfa_fcport_enable(&bfad->bfa); + spin_unlock_irqrestore(&bfad->bfad_lock, flags); + iocmd->status = BFA_STATUS_OK; return 0; } @@ -2275,17 +2189,12 @@ bfad_iocmd_trunk_get_attr(struct bfad_s *bfad, void *cmd) unsigned long flags; spin_lock_irqsave(&bfad->bfad_lock, flags); - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) || - (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) - iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; - else { - memcpy((void *)&iocmd->attr, (void *)&trunk->attr, - sizeof(struct bfa_trunk_attr_s)); - iocmd->attr.port_id = bfa_lps_get_base_pid(&bfad->bfa); - iocmd->status = BFA_STATUS_OK; - } + memcpy((void *)&iocmd->attr, (void *)&trunk->attr, + sizeof(struct bfa_trunk_attr_s)); + iocmd->attr.port_id = bfa_lps_get_base_pid(&bfad->bfa); spin_unlock_irqrestore(&bfad->bfad_lock, flags); + iocmd->status = BFA_STATUS_OK; return 0; } @@ -2298,22 +2207,14 @@ bfad_iocmd_qos(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) spin_lock_irqsave(&bfad->bfad_lock, flags); if (bfa_ioc_get_type(&bfad->bfa.ioc) == BFA_IOC_TYPE_FC) { - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) && - (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) - iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; - else { - if (v_cmd == IOCMD_QOS_ENABLE) - fcport->cfg.qos_enabled = BFA_TRUE; - else if (v_cmd == IOCMD_QOS_DISABLE) { - fcport->cfg.qos_enabled = BFA_FALSE; - fcport->cfg.qos_bw.high = BFA_QOS_BW_HIGH; - fcport->cfg.qos_bw.med = BFA_QOS_BW_MED; - fcport->cfg.qos_bw.low = BFA_QOS_BW_LOW; - } - } + if (v_cmd == IOCMD_QOS_ENABLE) + fcport->cfg.qos_enabled = BFA_TRUE; + else if (v_cmd == IOCMD_QOS_DISABLE) + fcport->cfg.qos_enabled = BFA_FALSE; } spin_unlock_irqrestore(&bfad->bfad_lock, flags); + iocmd->status = BFA_STATUS_OK; return 0; } @@ -2325,21 +2226,11 @@ bfad_iocmd_qos_get_attr(struct bfad_s *bfad, void *cmd) unsigned long flags; spin_lock_irqsave(&bfad->bfad_lock, flags); - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) && - (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) - iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; - else { - iocmd->attr.state = fcport->qos_attr.state; - iocmd->attr.total_bb_cr = - be32_to_cpu(fcport->qos_attr.total_bb_cr); - iocmd->attr.qos_bw.high = fcport->cfg.qos_bw.high; - iocmd->attr.qos_bw.med = fcport->cfg.qos_bw.med; - iocmd->attr.qos_bw.low = fcport->cfg.qos_bw.low; - iocmd->attr.qos_bw_op = fcport->qos_attr.qos_bw_op; - iocmd->status = BFA_STATUS_OK; - } + iocmd->attr.state = fcport->qos_attr.state; + iocmd->attr.total_bb_cr = be32_to_cpu(fcport->qos_attr.total_bb_cr); spin_unlock_irqrestore(&bfad->bfad_lock, flags); + iocmd->status = BFA_STATUS_OK; return 0; } @@ -2383,7 +2274,6 @@ bfad_iocmd_qos_get_stats(struct bfad_s *bfad, void *cmd) struct bfad_hal_comp fcomp; unsigned long flags; struct bfa_cb_pending_q_s cb_qe; - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa); init_completion(&fcomp.comp); bfa_pending_q_init(&cb_qe, (bfa_cb_cbfn_t)bfad_hcb_comp, @@ -2391,11 +2281,7 @@ bfad_iocmd_qos_get_stats(struct bfad_s *bfad, void *cmd) spin_lock_irqsave(&bfad->bfad_lock, flags); WARN_ON(!bfa_ioc_get_fcmode(&bfad->bfa.ioc)); - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) && - (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) - iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; - else - iocmd->status = bfa_fcport_get_stats(&bfad->bfa, &cb_qe); + iocmd->status = bfa_fcport_get_stats(&bfad->bfa, &cb_qe); spin_unlock_irqrestore(&bfad->bfad_lock, flags); if (iocmd->status != BFA_STATUS_OK) { bfa_trc(bfad, iocmd->status); @@ -2414,7 +2300,6 @@ bfad_iocmd_qos_reset_stats(struct bfad_s *bfad, void *cmd) struct bfad_hal_comp fcomp; unsigned long flags; struct bfa_cb_pending_q_s cb_qe; - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa); init_completion(&fcomp.comp); bfa_pending_q_init(&cb_qe, (bfa_cb_cbfn_t)bfad_hcb_comp, @@ -2422,11 +2307,7 @@ bfad_iocmd_qos_reset_stats(struct bfad_s *bfad, void *cmd) spin_lock_irqsave(&bfad->bfad_lock, flags); WARN_ON(!bfa_ioc_get_fcmode(&bfad->bfa.ioc)); - if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) && - (fcport->topology == BFA_PORT_TOPOLOGY_LOOP)) - iocmd->status = BFA_STATUS_TOPOLOGY_LOOP; - else - iocmd->status = bfa_fcport_clear_stats(&bfad->bfa, &cb_qe); + iocmd->status = bfa_fcport_clear_stats(&bfad->bfa, &cb_qe); spin_unlock_irqrestore(&bfad->bfad_lock, flags); if (iocmd->status != BFA_STATUS_OK) { bfa_trc(bfad, iocmd->status); @@ -2554,139 +2435,6 @@ bfad_iocmd_fcpim_cfg_lunmask(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) return 0; } -int -bfad_iocmd_fcpim_throttle_query(struct bfad_s *bfad, void *cmd) -{ - struct bfa_bsg_fcpim_throttle_s *iocmd = - (struct bfa_bsg_fcpim_throttle_s *)cmd; - unsigned long flags; - - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_fcpim_throttle_get(&bfad->bfa, - (void *)&iocmd->throttle); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - - return 0; -} - -int -bfad_iocmd_fcpim_throttle_set(struct bfad_s *bfad, void *cmd) -{ - struct bfa_bsg_fcpim_throttle_s *iocmd = - (struct bfa_bsg_fcpim_throttle_s *)cmd; - unsigned long flags; - - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_fcpim_throttle_set(&bfad->bfa, - iocmd->throttle.cfg_value); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - - return 0; -} - -int -bfad_iocmd_tfru_read(struct bfad_s *bfad, void *cmd) -{ - struct bfa_bsg_tfru_s *iocmd = - (struct bfa_bsg_tfru_s *)cmd; - struct bfad_hal_comp fcomp; - unsigned long flags = 0; - - init_completion(&fcomp.comp); - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_tfru_read(BFA_FRU(&bfad->bfa), - &iocmd->data, iocmd->len, iocmd->offset, - bfad_hcb_comp, &fcomp); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - if (iocmd->status == BFA_STATUS_OK) { - wait_for_completion(&fcomp.comp); - iocmd->status = fcomp.status; - } - - return 0; -} - -int -bfad_iocmd_tfru_write(struct bfad_s *bfad, void *cmd) -{ - struct bfa_bsg_tfru_s *iocmd = - (struct bfa_bsg_tfru_s *)cmd; - struct bfad_hal_comp fcomp; - unsigned long flags = 0; - - init_completion(&fcomp.comp); - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_tfru_write(BFA_FRU(&bfad->bfa), - &iocmd->data, iocmd->len, iocmd->offset, - bfad_hcb_comp, &fcomp); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - if (iocmd->status == BFA_STATUS_OK) { - wait_for_completion(&fcomp.comp); - iocmd->status = fcomp.status; - } - - return 0; -} - -int -bfad_iocmd_fruvpd_read(struct bfad_s *bfad, void *cmd) -{ - struct bfa_bsg_fruvpd_s *iocmd = - (struct bfa_bsg_fruvpd_s *)cmd; - struct bfad_hal_comp fcomp; - unsigned long flags = 0; - - init_completion(&fcomp.comp); - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_fruvpd_read(BFA_FRU(&bfad->bfa), - &iocmd->data, iocmd->len, iocmd->offset, - bfad_hcb_comp, &fcomp); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - if (iocmd->status == BFA_STATUS_OK) { - wait_for_completion(&fcomp.comp); - iocmd->status = fcomp.status; - } - - return 0; -} - -int -bfad_iocmd_fruvpd_update(struct bfad_s *bfad, void *cmd) -{ - struct bfa_bsg_fruvpd_s *iocmd = - (struct bfa_bsg_fruvpd_s *)cmd; - struct bfad_hal_comp fcomp; - unsigned long flags = 0; - - init_completion(&fcomp.comp); - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_fruvpd_update(BFA_FRU(&bfad->bfa), - &iocmd->data, iocmd->len, iocmd->offset, - bfad_hcb_comp, &fcomp); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - if (iocmd->status == BFA_STATUS_OK) { - wait_for_completion(&fcomp.comp); - iocmd->status = fcomp.status; - } - - return 0; -} - -int -bfad_iocmd_fruvpd_get_max_size(struct bfad_s *bfad, void *cmd) -{ - struct bfa_bsg_fruvpd_max_size_s *iocmd = - (struct bfa_bsg_fruvpd_max_size_s *)cmd; - unsigned long flags = 0; - - spin_lock_irqsave(&bfad->bfad_lock, flags); - iocmd->status = bfa_fruvpd_get_max_size(BFA_FRU(&bfad->bfa), - &iocmd->max_size); - spin_unlock_irqrestore(&bfad->bfad_lock, flags); - - return 0; -} - static int bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, unsigned int payload_len) @@ -2912,13 +2660,6 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, case IOCMD_DIAG_LB_STAT: rc = bfad_iocmd_diag_lb_stat(bfad, iocmd); break; - case IOCMD_DIAG_DPORT_ENABLE: - case IOCMD_DIAG_DPORT_DISABLE: - rc = bfad_iocmd_diag_cfg_dport(bfad, cmd, iocmd); - break; - case IOCMD_DIAG_DPORT_GET_STATE: - rc = bfad_iocmd_diag_dport_get_state(bfad, iocmd); - break; case IOCMD_PHY_GET_ATTR: rc = bfad_iocmd_phy_get_attr(bfad, iocmd); break; @@ -3000,9 +2741,6 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, case IOCMD_QOS_RESET_STATS: rc = bfad_iocmd_qos_reset_stats(bfad, iocmd); break; - case IOCMD_QOS_SET_BW: - rc = bfad_iocmd_qos_set_bw(bfad, iocmd); - break; case IOCMD_VF_GET_STATS: rc = bfad_iocmd_vf_get_stats(bfad, iocmd); break; @@ -3021,29 +2759,6 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, case IOCMD_FCPIM_LUNMASK_DELETE: rc = bfad_iocmd_fcpim_cfg_lunmask(bfad, iocmd, cmd); break; - case IOCMD_FCPIM_THROTTLE_QUERY: - rc = bfad_iocmd_fcpim_throttle_query(bfad, iocmd); - break; - case IOCMD_FCPIM_THROTTLE_SET: - rc = bfad_iocmd_fcpim_throttle_set(bfad, iocmd); - break; - /* TFRU */ - case IOCMD_TFRU_READ: - rc = bfad_iocmd_tfru_read(bfad, iocmd); - break; - case IOCMD_TFRU_WRITE: - rc = bfad_iocmd_tfru_write(bfad, iocmd); - break; - /* FRU */ - case IOCMD_FRUVPD_READ: - rc = bfad_iocmd_fruvpd_read(bfad, iocmd); - break; - case IOCMD_FRUVPD_UPDATE: - rc = bfad_iocmd_fruvpd_update(bfad, iocmd); - break; - case IOCMD_FRUVPD_GET_MAX_SIZE: - rc = bfad_iocmd_fruvpd_get_max_size(bfad, iocmd); - break; default: rc = -EINVAL; break; diff --git a/trunk/drivers/scsi/bfa/bfad_bsg.h b/trunk/drivers/scsi/bfa/bfad_bsg.h index 15e1fc8e796b..8c569ddb750d 100644 --- a/trunk/drivers/scsi/bfa/bfad_bsg.h +++ b/trunk/drivers/scsi/bfa/bfad_bsg.h @@ -141,17 +141,6 @@ enum { IOCMD_FCPIM_LUNMASK_QUERY, IOCMD_FCPIM_LUNMASK_ADD, IOCMD_FCPIM_LUNMASK_DELETE, - IOCMD_DIAG_DPORT_ENABLE, - IOCMD_DIAG_DPORT_DISABLE, - IOCMD_DIAG_DPORT_GET_STATE, - IOCMD_QOS_SET_BW, - IOCMD_FCPIM_THROTTLE_QUERY, - IOCMD_FCPIM_THROTTLE_SET, - IOCMD_TFRU_READ, - IOCMD_TFRU_WRITE, - IOCMD_FRUVPD_READ, - IOCMD_FRUVPD_UPDATE, - IOCMD_FRUVPD_GET_MAX_SIZE, }; struct bfa_bsg_gen_s { @@ -474,8 +463,7 @@ struct bfa_bsg_pcifn_s { bfa_status_t status; u16 bfad_num; u16 pcifn_id; - u16 bw_min; - u16 bw_max; + u32 bandwidth; u8 port; enum bfi_pcifn_class pcifn_class; u8 rsvd[1]; @@ -625,13 +613,6 @@ struct bfa_bsg_diag_lb_stat_s { u16 rsvd; }; -struct bfa_bsg_diag_dport_get_state_s { - bfa_status_t status; - u16 bfad_num; - u16 rsvd; - enum bfa_dport_state state; -}; - struct bfa_bsg_phy_attr_s { bfa_status_t status; u16 bfad_num; @@ -713,13 +694,6 @@ struct bfa_bsg_qos_vc_attr_s { struct bfa_qos_vc_attr_s attr; }; -struct bfa_bsg_qos_bw_s { - bfa_status_t status; - u16 bfad_num; - u16 rsvd; - struct bfa_qos_bw_s qos_bw; -}; - struct bfa_bsg_vf_stats_s { bfa_status_t status; u16 bfad_num; @@ -748,41 +722,6 @@ struct bfa_bsg_fcpim_lunmask_s { struct scsi_lun lun; }; -struct bfa_bsg_fcpim_throttle_s { - bfa_status_t status; - u16 bfad_num; - u16 vf_id; - struct bfa_defs_fcpim_throttle_s throttle; -}; - -#define BFA_TFRU_DATA_SIZE 64 -#define BFA_MAX_FRUVPD_TRANSFER_SIZE 0x1000 - -struct bfa_bsg_tfru_s { - bfa_status_t status; - u16 bfad_num; - u16 rsvd; - u32 offset; - u32 len; - u8 data[BFA_TFRU_DATA_SIZE]; -}; - -struct bfa_bsg_fruvpd_s { - bfa_status_t status; - u16 bfad_num; - u16 rsvd; - u32 offset; - u32 len; - u8 data[BFA_MAX_FRUVPD_TRANSFER_SIZE]; -}; - -struct bfa_bsg_fruvpd_max_size_s { - bfa_status_t status; - u16 bfad_num; - u16 rsvd; - u32 max_size; -}; - struct bfa_bsg_fcpt_s { bfa_status_t status; u16 vf_id; diff --git a/trunk/drivers/scsi/bfa/bfad_drv.h b/trunk/drivers/scsi/bfa/bfad_drv.h index 0c64a04f01fa..1840651ce1d4 100644 --- a/trunk/drivers/scsi/bfa/bfad_drv.h +++ b/trunk/drivers/scsi/bfa/bfad_drv.h @@ -57,7 +57,7 @@ #ifdef BFA_DRIVER_VERSION #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION #else -#define BFAD_DRIVER_VERSION "3.1.2.1" +#define BFAD_DRIVER_VERSION "3.1.2.0" #endif #define BFAD_PROTO_NAME FCPI_NAME diff --git a/trunk/drivers/scsi/bfa/bfi.h b/trunk/drivers/scsi/bfa/bfi.h index 57b146bca18c..b2ba0b2e91b2 100644 --- a/trunk/drivers/scsi/bfa/bfi.h +++ b/trunk/drivers/scsi/bfa/bfi.h @@ -210,8 +210,7 @@ enum bfi_mclass { BFI_MC_PORT = 21, /* Physical port */ BFI_MC_SFP = 22, /* SFP module */ BFI_MC_PHY = 25, /* External PHY message class */ - BFI_MC_FRU = 34, - BFI_MC_MAX = 35 + BFI_MC_MAX = 32 }; #define BFI_IOC_MAX_CQS 4 @@ -289,9 +288,6 @@ struct bfi_ioc_attr_s { char optrom_version[BFA_VERSION_LEN]; struct bfa_mfg_vpd_s vpd; u32 card_type; /* card type */ - u8 mfg_day; /* manufacturing day */ - u8 mfg_month; /* manufacturing month */ - u16 mfg_year; /* manufacturing year */ }; /* @@ -691,8 +687,7 @@ struct bfi_ablk_h2i_pf_req_s { u8 pcifn; u8 port; u16 pers; - u16 bw_min; /* percent BW @ max speed */ - u16 bw_max; /* percent BW @ max speed */ + u32 bw; }; /* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */ @@ -962,7 +957,6 @@ enum bfi_diag_h2i { BFI_DIAG_H2I_TEMPSENSOR = 4, BFI_DIAG_H2I_LEDTEST = 5, BFI_DIAG_H2I_QTEST = 6, - BFI_DIAG_H2I_DPORT = 7, }; enum bfi_diag_i2h { @@ -972,7 +966,6 @@ enum bfi_diag_i2h { BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR), BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST), BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST), - BFI_DIAG_I2H_DPORT = BFA_I2HM(BFI_DIAG_H2I_DPORT), }; #define BFI_DIAG_MAX_SGES 2 @@ -1058,23 +1051,6 @@ struct bfi_diag_qtest_req_s { }; #define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s -/* - * D-port test - */ -enum bfi_dport_req { - BFI_DPORT_DISABLE = 0, /* disable dport request */ - BFI_DPORT_ENABLE = 1, /* enable dport request */ -}; - -struct bfi_diag_dport_req_s { - struct bfi_mhdr_s mh; /* 4 bytes */ - u8 req; /* request 1: enable 0: disable */ - u8 status; /* reply status */ - u8 rsvd[2]; - u32 msgtag; /* msgtag for reply */ -}; -#define bfi_diag_dport_rsp_t struct bfi_diag_dport_req_s - /* * PHY module specific */ @@ -1171,50 +1147,6 @@ struct bfi_phy_write_rsp_s { u32 length; }; -enum bfi_fru_h2i_msgs { - BFI_FRUVPD_H2I_WRITE_REQ = 1, - BFI_FRUVPD_H2I_READ_REQ = 2, - BFI_TFRU_H2I_WRITE_REQ = 3, - BFI_TFRU_H2I_READ_REQ = 4, -}; - -enum bfi_fru_i2h_msgs { - BFI_FRUVPD_I2H_WRITE_RSP = BFA_I2HM(1), - BFI_FRUVPD_I2H_READ_RSP = BFA_I2HM(2), - BFI_TFRU_I2H_WRITE_RSP = BFA_I2HM(3), - BFI_TFRU_I2H_READ_RSP = BFA_I2HM(4), -}; - -/* - * FRU write request - */ -struct bfi_fru_write_req_s { - struct bfi_mhdr_s mh; /* Common msg header */ - u8 last; - u8 rsv[3]; - u32 offset; - u32 length; - struct bfi_alen_s alen; -}; - -/* - * FRU read request - */ -struct bfi_fru_read_req_s { - struct bfi_mhdr_s mh; /* Common msg header */ - u32 offset; - u32 length; - struct bfi_alen_s alen; -}; - -/* - * FRU response - */ -struct bfi_fru_rsp_s { - struct bfi_mhdr_s mh; /* Common msg header */ - u32 status; - u32 length; -}; #pragma pack() #endif /* __BFI_H__ */ diff --git a/trunk/drivers/scsi/bfa/bfi_ms.h b/trunk/drivers/scsi/bfa/bfi_ms.h index 5ae2c167b2c8..d4220e13cafa 100644 --- a/trunk/drivers/scsi/bfa/bfi_ms.h +++ b/trunk/drivers/scsi/bfa/bfi_ms.h @@ -426,7 +426,6 @@ struct bfi_lps_login_req_s { u8 auth_en; u8 lps_role; u8 bb_scn; - u32 vvl_flag; }; struct bfi_lps_login_rsp_s { @@ -500,9 +499,6 @@ enum bfi_rport_i2h_msgs { BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1), BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2), BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3), - BFI_RPORT_I2H_LIP_SCN_ONLINE = BFA_I2HM(4), - BFI_RPORT_I2H_LIP_SCN_OFFLINE = BFA_I2HM(5), - BFI_RPORT_I2H_NO_DEV = BFA_I2HM(6), }; struct bfi_rport_create_req_s { @@ -555,14 +551,6 @@ struct bfi_rport_qos_scn_s { struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */ }; -struct bfi_rport_lip_scn_s { - struct bfi_mhdr_s mh; /*!< common msg header */ - u16 bfa_handle; /*!< host rport handle */ - u8 status; /*!< scn online status */ - u8 rsvd; - struct bfa_fcport_loop_info_s loop_info; -}; - union bfi_rport_h2i_msg_u { struct bfi_msg_s *msg; struct bfi_rport_create_req_s *create_req; @@ -575,7 +563,6 @@ union bfi_rport_i2h_msg_u { struct bfi_rport_create_rsp_s *create_rsp; struct bfi_rport_delete_rsp_s *delete_rsp; struct bfi_rport_qos_scn_s *qos_scn_evt; - struct bfi_rport_lip_scn_s *lip_scn; }; /* @@ -841,7 +828,6 @@ enum bfi_tskim_status { */ BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */ BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */ - BFI_TSKIM_STS_UTAG = 12, /* unknown tag for request */ }; struct bfi_tskim_rsp_s { diff --git a/trunk/drivers/scsi/bfa/bfi_reg.h b/trunk/drivers/scsi/bfa/bfi_reg.h index 99133bcf53f9..ed5f159e1867 100644 --- a/trunk/drivers/scsi/bfa/bfi_reg.h +++ b/trunk/drivers/scsi/bfa/bfi_reg.h @@ -338,7 +338,6 @@ enum { #define __A2T_AHB_LOAD 0x00000800 #define __WGN_READY 0x00000400 #define __GLBL_PF_VF_CFG_RDY 0x00000200 -#define CT2_NFC_STS_REG 0x00027410 #define CT2_NFC_CSR_CLR_REG 0x00027420 #define CT2_NFC_CSR_SET_REG 0x00027424 #define __HALT_NFC_CONTROLLER 0x00000002 @@ -356,8 +355,6 @@ enum { (CT2_CSI_MAC0_CONTROL_REG + \ (__n) * (CT2_CSI_MAC1_CONTROL_REG - CT2_CSI_MAC0_CONTROL_REG)) -#define CT2_NFC_FLASH_STS_REG 0x00014834 -#define __FLASH_PLL_INIT_AND_RESET_IN_PROGRESS 0x00000020 /* * Name semaphore registers based on usage */ diff --git a/trunk/drivers/scsi/fcoe/fcoe.c b/trunk/drivers/scsi/fcoe/fcoe.c index 666b7ac4475f..078d262ac7cc 100644 --- a/trunk/drivers/scsi/fcoe/fcoe.c +++ b/trunk/drivers/scsi/fcoe/fcoe.c @@ -1643,7 +1643,7 @@ static int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp) skb_reset_network_header(skb); skb->mac_len = elen; skb->protocol = htons(ETH_P_FCOE); - skb->priority = fcoe->priority; + skb->priority = port->priority; if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN && fcoe->realdev->features & NETIF_F_HW_VLAN_TX) { @@ -1917,6 +1917,7 @@ static int fcoe_dcb_app_notification(struct notifier_block *notifier, struct fcoe_ctlr *ctlr; struct fcoe_interface *fcoe; struct net_device *netdev; + struct fcoe_port *port; int prio; if (entry->app.selector != DCB_APP_IDTYPE_ETHTYPE) @@ -1945,8 +1946,10 @@ static int fcoe_dcb_app_notification(struct notifier_block *notifier, entry->app.protocol == ETH_P_FCOE) ctlr->priority = prio; - if (entry->app.protocol == ETH_P_FCOE) - fcoe->priority = prio; + if (entry->app.protocol == ETH_P_FCOE) { + port = lport_priv(ctlr->lp); + port->priority = prio; + } return NOTIFY_OK; } @@ -2177,6 +2180,7 @@ static void fcoe_dcb_create(struct fcoe_interface *fcoe) u8 fup, up; struct net_device *netdev = fcoe->realdev; struct fcoe_ctlr *ctlr = fcoe_to_ctlr(fcoe); + struct fcoe_port *port = lport_priv(ctlr->lp); struct dcb_app app = { .priority = 0, .protocol = ETH_P_FCOE @@ -2198,8 +2202,8 @@ static void fcoe_dcb_create(struct fcoe_interface *fcoe) fup = dcb_getapp(netdev, &app); } - fcoe->priority = ffs(up) ? ffs(up) - 1 : 0; - ctlr->priority = ffs(fup) ? ffs(fup) - 1 : fcoe->priority; + port->priority = ffs(up) ? ffs(up) - 1 : 0; + ctlr->priority = ffs(fup) ? ffs(fup) - 1 : port->priority; } #endif } diff --git a/trunk/drivers/scsi/fcoe/fcoe.h b/trunk/drivers/scsi/fcoe/fcoe.h index b42dc32cb5eb..a624add4f8ec 100644 --- a/trunk/drivers/scsi/fcoe/fcoe.h +++ b/trunk/drivers/scsi/fcoe/fcoe.h @@ -71,7 +71,6 @@ do { \ * @oem: The offload exchange manager for all local port * instances associated with this port * @removed: Indicates fcoe interface removed from net device - * @priority: Priority for the FCoE packet (DCB) * This structure is 1:1 with a net device. */ struct fcoe_interface { @@ -82,7 +81,6 @@ struct fcoe_interface { struct packet_type fip_packet_type; struct fc_exch_mgr *oem; u8 removed; - u8 priority; }; #define fcoe_to_ctlr(x) \ diff --git a/trunk/drivers/scsi/libfc/fc_fcp.c b/trunk/drivers/scsi/libfc/fc_fcp.c index fcb9d0b20ee4..14243fa5f8e8 100644 --- a/trunk/drivers/scsi/libfc/fc_fcp.c +++ b/trunk/drivers/scsi/libfc/fc_fcp.c @@ -851,8 +851,7 @@ static void fc_fcp_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp) fc_rp_info = (struct fcp_resp_rsp_info *)(rp_ex + 1); if (flags & FCP_RSP_LEN_VAL) { respl = ntohl(rp_ex->fr_rsp_len); - if ((respl != FCP_RESP_RSP_INFO_LEN4) && - (respl != FCP_RESP_RSP_INFO_LEN8)) + if (respl != sizeof(*fc_rp_info)) goto len_err; if (fsp->wait_for_comp) { /* Abuse cdb_status for rsp code */ diff --git a/trunk/drivers/scsi/lpfc/lpfc.h b/trunk/drivers/scsi/lpfc/lpfc.h index 69b59935b53f..a184c2443a64 100644 --- a/trunk/drivers/scsi/lpfc/lpfc.h +++ b/trunk/drivers/scsi/lpfc/lpfc.h @@ -27,8 +27,6 @@ struct lpfc_sli2_slim; -#define ELX_MODEL_NAME_SIZE 80 - #define LPFC_PCI_DEV_LP 0x1 #define LPFC_PCI_DEV_OC 0x2 diff --git a/trunk/drivers/scsi/lpfc/lpfc_attr.c b/trunk/drivers/scsi/lpfc/lpfc_attr.c index ad16e54ac383..b032562aa0d9 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_attr.c +++ b/trunk/drivers/scsi/lpfc/lpfc_attr.c @@ -3935,12 +3935,6 @@ MODULE_PARM_DESC(lpfc_fcp_look_ahead, "Look ahead for completions"); # - Only meaningful if BG is turned on (lpfc_enable_bg=1). # - Allows you to ultimately specify which profiles to use # - Default will result in registering capabilities for all profiles. -# - SHOST_DIF_TYPE1_PROTECTION 1 -# HBA supports T10 DIF Type 1: HBA to Target Type 1 Protection -# - SHOST_DIX_TYPE0_PROTECTION 8 -# HBA supports DIX Type 0: Host to HBA protection only -# - SHOST_DIX_TYPE1_PROTECTION 16 -# HBA supports DIX Type 1: Host to HBA Type 1 protection # */ unsigned int lpfc_prot_mask = SHOST_DIF_TYPE1_PROTECTION | @@ -3953,7 +3947,7 @@ MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask"); /* # lpfc_prot_guard: i # - Bit mask of protection guard types to register with the SCSI mid-layer -# - Guard types are currently either 1) T10-DIF CRC 2) IP checksum +# - Guard types are currently either 1) IP checksum 2) T10-DIF CRC # - Allows you to ultimately specify which profiles to use # - Default will result in registering capabilities for all guard types # diff --git a/trunk/drivers/scsi/lpfc/lpfc_crtn.h b/trunk/drivers/scsi/lpfc/lpfc_crtn.h index 4380a44000bc..e470c489de07 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_crtn.h +++ b/trunk/drivers/scsi/lpfc/lpfc_crtn.h @@ -467,4 +467,3 @@ int lpfc_sli4_read_config(struct lpfc_hba *); void lpfc_sli4_node_prep(struct lpfc_hba *); int lpfc_sli4_xri_sgl_update(struct lpfc_hba *); void lpfc_free_sgl_list(struct lpfc_hba *, struct list_head *); -uint32_t lpfc_sli_port_speed_get(struct lpfc_hba *); diff --git a/trunk/drivers/scsi/lpfc/lpfc_els.c b/trunk/drivers/scsi/lpfc/lpfc_els.c index f19e9b6f9f13..cfe533bc9790 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_els.c +++ b/trunk/drivers/scsi/lpfc/lpfc_els.c @@ -809,8 +809,6 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, phba->fc_ratov = FF_DEF_RATOV; rc = memcmp(&vport->fc_portname, &sp->portName, sizeof(vport->fc_portname)); - memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm)); - if (rc >= 0) { /* This side will initiate the PLOGI */ spin_lock_irq(shost->host_lock); @@ -3162,8 +3160,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, retry = 1; break; } - if ((cmd == ELS_CMD_PLOGI) || - (cmd == ELS_CMD_PRLI)) { + if (cmd == ELS_CMD_PLOGI) { delay = 1000; maxretry = lpfc_max_els_tries + 1; retry = 1; @@ -3308,7 +3305,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ndlp->nlp_prev_state = ndlp->nlp_state; if (cmd == ELS_CMD_PRLI) lpfc_nlp_set_state(vport, ndlp, - NLP_STE_PRLI_ISSUE); + NLP_STE_REG_LOGIN_ISSUE); else lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); diff --git a/trunk/drivers/scsi/lpfc/lpfc_hbadisc.c b/trunk/drivers/scsi/lpfc/lpfc_hbadisc.c index d7096ad94d3f..e9845d2ecf10 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/trunk/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -1506,10 +1506,9 @@ lpfc_match_fcf_conn_list(struct lpfc_hba *phba, } } - /* FCF not valid/available or solicitation in progress */ + /* If FCF not available return 0 */ if (!bf_get(lpfc_fcf_record_fcf_avail, new_fcf_record) || - !bf_get(lpfc_fcf_record_fcf_valid, new_fcf_record) || - bf_get(lpfc_fcf_record_fcf_sol, new_fcf_record)) + !bf_get(lpfc_fcf_record_fcf_valid, new_fcf_record)) return 0; if (!(phba->hba_flag & HBA_FIP_SUPPORT)) { @@ -1843,7 +1842,6 @@ lpfc_sli4_log_fcf_record_info(struct lpfc_hba *phba, "\tFCF_Index : x%x\n" "\tFCF_Avail : x%x\n" "\tFCF_Valid : x%x\n" - "\tFCF_SOL : x%x\n" "\tFIP_Priority : x%x\n" "\tMAC_Provider : x%x\n" "\tLowest VLANID : x%x\n" @@ -1854,7 +1852,6 @@ lpfc_sli4_log_fcf_record_info(struct lpfc_hba *phba, bf_get(lpfc_fcf_record_fcf_index, fcf_record), bf_get(lpfc_fcf_record_fcf_avail, fcf_record), bf_get(lpfc_fcf_record_fcf_valid, fcf_record), - bf_get(lpfc_fcf_record_fcf_sol, fcf_record), fcf_record->fip_priority, bf_get(lpfc_fcf_record_mac_addr_prov, fcf_record), vlan_id, @@ -2188,14 +2185,12 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) new_fcf_record)); lpfc_printf_log(phba, KERN_WARNING, LOG_FIP, "2781 FCF (x%x) failed connection " - "list check: (x%x/x%x/%x)\n", + "list check: (x%x/x%x)\n", bf_get(lpfc_fcf_record_fcf_index, new_fcf_record), bf_get(lpfc_fcf_record_fcf_avail, new_fcf_record), bf_get(lpfc_fcf_record_fcf_valid, - new_fcf_record), - bf_get(lpfc_fcf_record_fcf_sol, new_fcf_record)); if ((phba->fcf.fcf_flag & FCF_IN_USE) && lpfc_sli4_fcf_record_match(phba, &phba->fcf.current_rec, diff --git a/trunk/drivers/scsi/lpfc/lpfc_hw4.h b/trunk/drivers/scsi/lpfc/lpfc_hw4.h index 2cdeb5434fb7..834b699cac76 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_hw4.h +++ b/trunk/drivers/scsi/lpfc/lpfc_hw4.h @@ -1305,11 +1305,6 @@ struct lpfc_mbx_mq_create_ext { #define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK #define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001 #define lpfc_mbx_mq_create_ext_async_evt_link_WORD async_evt_bmap -#define LPFC_EVT_CODE_LINK_NO_LINK 0x0 -#define LPFC_EVT_CODE_LINK_10_MBIT 0x1 -#define LPFC_EVT_CODE_LINK_100_MBIT 0x2 -#define LPFC_EVT_CODE_LINK_1_GBIT 0x3 -#define LPFC_EVT_CODE_LINK_10_GBIT 0x4 #define lpfc_mbx_mq_create_ext_async_evt_fip_SHIFT LPFC_TRAILER_CODE_FCOE #define lpfc_mbx_mq_create_ext_async_evt_fip_MASK 0x00000001 #define lpfc_mbx_mq_create_ext_async_evt_fip_WORD async_evt_bmap @@ -1319,13 +1314,6 @@ struct lpfc_mbx_mq_create_ext { #define lpfc_mbx_mq_create_ext_async_evt_fc_SHIFT LPFC_TRAILER_CODE_FC #define lpfc_mbx_mq_create_ext_async_evt_fc_MASK 0x00000001 #define lpfc_mbx_mq_create_ext_async_evt_fc_WORD async_evt_bmap -#define LPFC_EVT_CODE_FC_NO_LINK 0x0 -#define LPFC_EVT_CODE_FC_1_GBAUD 0x1 -#define LPFC_EVT_CODE_FC_2_GBAUD 0x2 -#define LPFC_EVT_CODE_FC_4_GBAUD 0x4 -#define LPFC_EVT_CODE_FC_8_GBAUD 0x8 -#define LPFC_EVT_CODE_FC_10_GBAUD 0xA -#define LPFC_EVT_CODE_FC_16_GBAUD 0x10 #define lpfc_mbx_mq_create_ext_async_evt_sli_SHIFT LPFC_TRAILER_CODE_SLI #define lpfc_mbx_mq_create_ext_async_evt_sli_MASK 0x00000001 #define lpfc_mbx_mq_create_ext_async_evt_sli_WORD async_evt_bmap @@ -1707,14 +1695,8 @@ struct fcf_record { #define lpfc_fcf_record_fc_map_2_MASK 0x000000FF #define lpfc_fcf_record_fc_map_2_WORD word7 #define lpfc_fcf_record_fcf_valid_SHIFT 24 -#define lpfc_fcf_record_fcf_valid_MASK 0x00000001 +#define lpfc_fcf_record_fcf_valid_MASK 0x000000FF #define lpfc_fcf_record_fcf_valid_WORD word7 -#define lpfc_fcf_record_fcf_fc_SHIFT 25 -#define lpfc_fcf_record_fcf_fc_MASK 0x00000001 -#define lpfc_fcf_record_fcf_fc_WORD word7 -#define lpfc_fcf_record_fcf_sol_SHIFT 31 -#define lpfc_fcf_record_fcf_sol_MASK 0x00000001 -#define lpfc_fcf_record_fcf_sol_WORD word7 uint32_t word8; #define lpfc_fcf_record_fcf_index_SHIFT 0 #define lpfc_fcf_record_fcf_index_MASK 0x0000FFFF diff --git a/trunk/drivers/scsi/lpfc/lpfc_init.c b/trunk/drivers/scsi/lpfc/lpfc_init.c index 7dc4218d9c4c..8a55a586dd65 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_init.c +++ b/trunk/drivers/scsi/lpfc/lpfc_init.c @@ -1892,10 +1892,8 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) max_speed = 4; else if (phba->lmt & LMT_2Gb) max_speed = 2; - else if (phba->lmt & LMT_1Gb) - max_speed = 1; else - max_speed = 0; + max_speed = 1; vp = &phba->vpd; @@ -2080,13 +2078,9 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) if (descp && descp[0] == '\0') { if (oneConnect) snprintf(descp, 255, - "Emulex OneConnect %s, %s Initiator %s", + "Emulex OneConnect %s, %s Initiator, Port %s", m.name, m.function, phba->Port); - else if (max_speed == 0) - snprintf(descp, 255, - "Emulex %s %s %s ", - m.name, m.bus, m.function); else snprintf(descp, 255, "Emulex %s %d%s %s %s", @@ -3507,119 +3501,6 @@ lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba, return link_speed; } -/** - * lpfc_sli_port_speed_get - Get sli3 link speed code to link speed - * @phba: pointer to lpfc hba data structure. - * - * This routine is to get an SLI3 FC port's link speed in Mbps. - * - * Return: link speed in terms of Mbps. - **/ -uint32_t -lpfc_sli_port_speed_get(struct lpfc_hba *phba) -{ - uint32_t link_speed; - - if (!lpfc_is_link_up(phba)) - return 0; - - switch (phba->fc_linkspeed) { - case LPFC_LINK_SPEED_1GHZ: - link_speed = 1000; - break; - case LPFC_LINK_SPEED_2GHZ: - link_speed = 2000; - break; - case LPFC_LINK_SPEED_4GHZ: - link_speed = 4000; - break; - case LPFC_LINK_SPEED_8GHZ: - link_speed = 8000; - break; - case LPFC_LINK_SPEED_10GHZ: - link_speed = 10000; - break; - case LPFC_LINK_SPEED_16GHZ: - link_speed = 16000; - break; - default: - link_speed = 0; - } - return link_speed; -} - -/** - * lpfc_sli4_port_speed_parse - Parse async evt link speed code to link speed - * @phba: pointer to lpfc hba data structure. - * @evt_code: asynchronous event code. - * @speed_code: asynchronous event link speed code. - * - * This routine is to parse the giving SLI4 async event link speed code into - * value of Mbps for the link speed. - * - * Return: link speed in terms of Mbps. - **/ -static uint32_t -lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, - uint8_t speed_code) -{ - uint32_t port_speed; - - switch (evt_code) { - case LPFC_TRAILER_CODE_LINK: - switch (speed_code) { - case LPFC_EVT_CODE_LINK_NO_LINK: - port_speed = 0; - break; - case LPFC_EVT_CODE_LINK_10_MBIT: - port_speed = 10; - break; - case LPFC_EVT_CODE_LINK_100_MBIT: - port_speed = 100; - break; - case LPFC_EVT_CODE_LINK_1_GBIT: - port_speed = 1000; - break; - case LPFC_EVT_CODE_LINK_10_GBIT: - port_speed = 10000; - break; - default: - port_speed = 0; - } - break; - case LPFC_TRAILER_CODE_FC: - switch (speed_code) { - case LPFC_EVT_CODE_FC_NO_LINK: - port_speed = 0; - break; - case LPFC_EVT_CODE_FC_1_GBAUD: - port_speed = 1000; - break; - case LPFC_EVT_CODE_FC_2_GBAUD: - port_speed = 2000; - break; - case LPFC_EVT_CODE_FC_4_GBAUD: - port_speed = 4000; - break; - case LPFC_EVT_CODE_FC_8_GBAUD: - port_speed = 8000; - break; - case LPFC_EVT_CODE_FC_10_GBAUD: - port_speed = 10000; - break; - case LPFC_EVT_CODE_FC_16_GBAUD: - port_speed = 16000; - break; - default: - port_speed = 0; - } - break; - default: - port_speed = 0; - } - return port_speed; -} - /** * lpfc_sli4_async_link_evt - Process the asynchronous FCoE link event * @phba: pointer to lpfc hba data structure. @@ -3677,8 +3558,7 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, /* Keep the link status for extra SLI4 state machine reference */ phba->sli4_hba.link_state.speed = - lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, - bf_get(lpfc_acqe_link_speed, acqe_link)); + bf_get(lpfc_acqe_link_speed, acqe_link); phba->sli4_hba.link_state.duplex = bf_get(lpfc_acqe_link_duplex, acqe_link); phba->sli4_hba.link_state.status = @@ -3690,8 +3570,7 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, phba->sli4_hba.link_state.fault = bf_get(lpfc_acqe_link_fault, acqe_link); phba->sli4_hba.link_state.logical_speed = - bf_get(lpfc_acqe_logical_link_speed, acqe_link) * 10; - + bf_get(lpfc_acqe_logical_link_speed, acqe_link); lpfc_printf_log(phba, KERN_INFO, LOG_SLI, "2900 Async FC/FCoE Link event - Speed:%dGBit " "duplex:x%x LA Type:x%x Port Type:%d Port Number:%d " @@ -3701,7 +3580,7 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, phba->sli4_hba.link_state.status, phba->sli4_hba.link_state.type, phba->sli4_hba.link_state.number, - phba->sli4_hba.link_state.logical_speed, + phba->sli4_hba.link_state.logical_speed * 10, phba->sli4_hba.link_state.fault); /* * For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch @@ -3773,8 +3652,7 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) } /* Keep the link status for extra SLI4 state machine reference */ phba->sli4_hba.link_state.speed = - lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, - bf_get(lpfc_acqe_fc_la_speed, acqe_fc)); + bf_get(lpfc_acqe_fc_la_speed, acqe_fc); phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; phba->sli4_hba.link_state.topology = bf_get(lpfc_acqe_fc_la_topology, acqe_fc); @@ -3787,7 +3665,7 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) phba->sli4_hba.link_state.fault = bf_get(lpfc_acqe_link_fault, acqe_fc); phba->sli4_hba.link_state.logical_speed = - bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc) * 10; + bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc); lpfc_printf_log(phba, KERN_INFO, LOG_SLI, "2896 Async FC event - Speed:%dGBaud Topology:x%x " "LA Type:x%x Port Type:%d Port Number:%d Logical speed:" @@ -3797,7 +3675,7 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) phba->sli4_hba.link_state.status, phba->sli4_hba.link_state.type, phba->sli4_hba.link_state.number, - phba->sli4_hba.link_state.logical_speed, + phba->sli4_hba.link_state.logical_speed * 10, phba->sli4_hba.link_state.fault); pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); if (!pmb) { @@ -3905,18 +3783,14 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) case LPFC_SLI_EVENT_STATUS_VALID: return; /* no message if the sfp is okay */ case LPFC_SLI_EVENT_STATUS_NOT_PRESENT: - sprintf(message, "Optics faulted/incorrectly installed/not " \ - "installed - Reseat optics, if issue not " - "resolved, replace."); + sprintf(message, "Not installed"); break; case LPFC_SLI_EVENT_STATUS_WRONG_TYPE: sprintf(message, - "Optics of two types installed - Remove one optic or " \ - "install matching pair of optics."); + "Optics of two types installed"); break; case LPFC_SLI_EVENT_STATUS_UNSUPPORTED: - sprintf(message, "Incompatible optics - Replace with " \ - "compatible optics for card to function."); + sprintf(message, "Incompatible optics"); break; default: /* firmware is reporting a status we don't know about */ @@ -4287,11 +4161,11 @@ lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, phba->fcoe_eventtag = acqe_grp5->event_tag; prev_ll_spd = phba->sli4_hba.link_state.logical_speed; phba->sli4_hba.link_state.logical_speed = - (bf_get(lpfc_acqe_grp5_llink_spd, acqe_grp5)) * 10; + (bf_get(lpfc_acqe_grp5_llink_spd, acqe_grp5)); lpfc_printf_log(phba, KERN_INFO, LOG_SLI, "2789 GRP5 Async Event: Updating logical link speed " - "from %dMbps to %dMbps\n", prev_ll_spd, - phba->sli4_hba.link_state.logical_speed); + "from %dMbps to %dMbps\n", (prev_ll_spd * 10), + (phba->sli4_hba.link_state.logical_speed*10)); } /** @@ -5073,7 +4947,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) } phba->sli4_hba.msix_entries = kzalloc((sizeof(struct msix_entry) * - phba->cfg_fcp_io_channel), GFP_KERNEL); + phba->sli4_hba.cfg_eqn), GFP_KERNEL); if (!phba->sli4_hba.msix_entries) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "2573 Failed allocate memory for msi-x " @@ -6685,8 +6559,7 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) i++; } if (i < cfg_fcp_io_channel) { - lpfc_printf_log(phba, - KERN_ERR, LOG_INIT, + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, "3188 Reducing IO channels to match number of " "CPUs: from %d to %d\n", cfg_fcp_io_channel, i); cfg_fcp_io_channel = i; @@ -6694,8 +6567,8 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) if (cfg_fcp_io_channel > phba->sli4_hba.max_cfg_param.max_eq) { - if (phba->sli4_hba.max_cfg_param.max_eq < - LPFC_FCP_IO_CHAN_MIN) { + cfg_fcp_io_channel = phba->sli4_hba.max_cfg_param.max_eq; + if (cfg_fcp_io_channel < LPFC_FCP_IO_CHAN_MIN) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "2574 Not enough EQs (%d) from the " "pci function for supporting FCP " @@ -6704,12 +6577,13 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) phba->cfg_fcp_io_channel); goto out_error; } - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "2575 Reducing IO channels to match number of " - "available EQs: from %d to %d\n", - cfg_fcp_io_channel, - phba->sli4_hba.max_cfg_param.max_eq); - cfg_fcp_io_channel = phba->sli4_hba.max_cfg_param.max_eq; + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, + "2575 Not enough EQs (%d) from the pci " + "function for supporting the requested " + "FCP EQs (%d), the actual FCP EQs can " + "be supported: %d\n", + phba->sli4_hba.max_cfg_param.max_eq, + phba->cfg_fcp_io_channel, cfg_fcp_io_channel); } /* Eventually cfg_fcp_eq_count / cfg_fcp_wq_count will be depricated */ @@ -6718,6 +6592,7 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) phba->cfg_fcp_eq_count = cfg_fcp_io_channel; phba->cfg_fcp_wq_count = cfg_fcp_io_channel; phba->cfg_fcp_io_channel = cfg_fcp_io_channel; + phba->sli4_hba.cfg_eqn = cfg_fcp_io_channel; /* Get EQ depth from module parameter, fake the default for now */ phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; @@ -8220,11 +8095,11 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) int vectors, rc, index; /* Set up MSI-X multi-message vectors */ - for (index = 0; index < phba->cfg_fcp_io_channel; index++) + for (index = 0; index < phba->sli4_hba.cfg_eqn; index++) phba->sli4_hba.msix_entries[index].entry = index; /* Configure MSI-X capability structure */ - vectors = phba->cfg_fcp_io_channel; + vectors = phba->sli4_hba.cfg_eqn; enable_msix_vectors: rc = pci_enable_msix(phba->pcidev, phba->sli4_hba.msix_entries, vectors); @@ -8267,14 +8142,8 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) goto cfg_fail_out; } } + phba->sli4_hba.msix_vec_nr = vectors; - if (vectors != phba->cfg_fcp_io_channel) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "3238 Reducing IO channels to match number of " - "MSI-X vectors, requested %d got %d\n", - phba->cfg_fcp_io_channel, vectors); - phba->cfg_fcp_io_channel = vectors; - } return rc; cfg_fail_out: @@ -8302,7 +8171,7 @@ lpfc_sli4_disable_msix(struct lpfc_hba *phba) int index; /* Free up MSI-X multi-message vectors */ - for (index = 0; index < phba->cfg_fcp_io_channel; index++) + for (index = 0; index < phba->sli4_hba.msix_vec_nr; index++) free_irq(phba->sli4_hba.msix_entries[index].vector, &phba->sli4_hba.fcp_eq_hdl[index]); @@ -9435,28 +9304,23 @@ lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) /** * lpfc_write_firmware - attempt to write a firmware image to the port - * @fw: pointer to firmware image returned from request_firmware. * @phba: pointer to lpfc hba data structure. + * @fw: pointer to firmware image returned from request_firmware. * + * returns the number of bytes written if write is successful. + * returns a negative error value if there were errors. + * returns 0 if firmware matches currently active firmware on port. **/ -static void -lpfc_write_firmware(const struct firmware *fw, void *context) +int +lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw) { - struct lpfc_hba *phba = (struct lpfc_hba *)context; char fwrev[FW_REV_STR_SIZE]; - struct lpfc_grp_hdr *image; + struct lpfc_grp_hdr *image = (struct lpfc_grp_hdr *)fw->data; struct list_head dma_buffer_list; int i, rc = 0; struct lpfc_dmabuf *dmabuf, *next; uint32_t offset = 0, temp_offset = 0; - /* It can be null, sanity check */ - if (!fw) { - rc = -ENXIO; - goto out; - } - image = (struct lpfc_grp_hdr *)fw->data; - INIT_LIST_HEAD(&dma_buffer_list); if ((be32_to_cpu(image->magic_number) != LPFC_GROUP_OJECT_MAGIC_NUM) || (bf_get_be32(lpfc_grp_hdr_file_type, image) != @@ -9469,13 +9333,12 @@ lpfc_write_firmware(const struct firmware *fw, void *context) be32_to_cpu(image->magic_number), bf_get_be32(lpfc_grp_hdr_file_type, image), bf_get_be32(lpfc_grp_hdr_id, image)); - rc = -EINVAL; - goto release_out; + return -EINVAL; } lpfc_decode_firmware_rev(phba, fwrev, 1); if (strncmp(fwrev, image->revision, strnlen(image->revision, 16))) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "3023 Updating Firmware, Current Version:%s " + "3023 Updating Firmware. Current Version:%s " "New Version:%s\n", fwrev, image->revision); for (i = 0; i < LPFC_MBX_WR_CONFIG_MAX_BDE; i++) { @@ -9483,7 +9346,7 @@ lpfc_write_firmware(const struct firmware *fw, void *context) GFP_KERNEL); if (!dmabuf) { rc = -ENOMEM; - goto release_out; + goto out; } dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, @@ -9492,7 +9355,7 @@ lpfc_write_firmware(const struct firmware *fw, void *context) if (!dmabuf->virt) { kfree(dmabuf); rc = -ENOMEM; - goto release_out; + goto out; } list_add_tail(&dmabuf->list, &dma_buffer_list); } @@ -9512,24 +9375,23 @@ lpfc_write_firmware(const struct firmware *fw, void *context) } rc = lpfc_wr_object(phba, &dma_buffer_list, (fw->size - offset), &offset); - if (rc) - goto release_out; + if (rc) { + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "3024 Firmware update failed. " + "%d\n", rc); + goto out; + } } rc = offset; } - -release_out: +out: list_for_each_entry_safe(dmabuf, next, &dma_buffer_list, list) { list_del(&dmabuf->list); dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, dmabuf->virt, dmabuf->phys); kfree(dmabuf); } - release_firmware(fw); -out: - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "3024 Firmware update done: %d.", rc); - return; + return rc; } /** @@ -9556,11 +9418,12 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) struct lpfc_hba *phba; struct lpfc_vport *vport = NULL; struct Scsi_Host *shost = NULL; - int error, ret; + int error; uint32_t cfg_mode, intr_mode; int mcnt; int adjusted_fcp_io_channel; - uint8_t file_name[ELX_MODEL_NAME_SIZE]; + const struct firmware *fw; + uint8_t file_name[16]; /* Allocate memory for HBA structure */ phba = lpfc_hba_alloc(pdev); @@ -9662,6 +9525,9 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) /* Default to single EQ for non-MSI-X */ if (phba->intr_type != MSIX) adjusted_fcp_io_channel = 1; + else if (phba->sli4_hba.msix_vec_nr < + phba->cfg_fcp_io_channel) + adjusted_fcp_io_channel = phba->sli4_hba.msix_vec_nr; else adjusted_fcp_io_channel = phba->cfg_fcp_io_channel; phba->cfg_fcp_io_channel = adjusted_fcp_io_channel; @@ -9706,12 +9572,12 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) /* check for firmware upgrade or downgrade (if_type 2 only) */ if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == LPFC_SLI_INTF_IF_TYPE_2) { - snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", - phba->ModelName); - ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG, - file_name, &phba->pcidev->dev, - GFP_KERNEL, (void *)phba, - lpfc_write_firmware); + snprintf(file_name, 16, "%s.grp", phba->ModelName); + error = request_firmware(&fw, file_name, &phba->pcidev->dev); + if (!error) { + lpfc_write_firmware(phba, fw); + release_firmware(fw); + } } /* Check if there are static vports to be created. */ diff --git a/trunk/drivers/scsi/lpfc/lpfc_scsi.c b/trunk/drivers/scsi/lpfc/lpfc_scsi.c index 7f45ac9964a9..64013f3097ad 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_scsi.c +++ b/trunk/drivers/scsi/lpfc/lpfc_scsi.c @@ -3829,9 +3829,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, cmd->scsi_done(cmd); if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { - spin_lock_irqsave(&phba->hbalock, flags); + spin_lock_irq(&phba->hbalock); lpfc_cmd->pCmd = NULL; - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock_irq(&phba->hbalock); /* * If there is a thread waiting for command completion @@ -3871,9 +3871,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, } } - spin_lock_irqsave(&phba->hbalock, flags); + spin_lock_irq(&phba->hbalock); lpfc_cmd->pCmd = NULL; - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock_irq(&phba->hbalock); /* * If there is a thread waiting for command completion @@ -4163,7 +4163,7 @@ lpfc_info(struct Scsi_Host *host) { struct lpfc_vport *vport = (struct lpfc_vport *) host->hostdata; struct lpfc_hba *phba = vport->phba; - int len, link_speed = 0; + int len; static char lpfcinfobuf[384]; memset(lpfcinfobuf,0,384); @@ -4184,18 +4184,12 @@ lpfc_info(struct Scsi_Host *host) phba->Port); } len = strlen(lpfcinfobuf); - if (phba->sli_rev <= LPFC_SLI_REV3) { - link_speed = lpfc_sli_port_speed_get(phba); - } else { - if (phba->sli4_hba.link_state.logical_speed) - link_speed = - phba->sli4_hba.link_state.logical_speed; - else - link_speed = phba->sli4_hba.link_state.speed; + if (phba->sli4_hba.link_state.logical_speed) { + snprintf(lpfcinfobuf + len, + 384-len, + " Logical Link Speed: %d Mbps", + phba->sli4_hba.link_state.logical_speed * 10); } - if (link_speed != 0) - snprintf(lpfcinfobuf + len, 384-len, - " Logical Link Speed: %d Mbps", link_speed); } return lpfcinfobuf; } @@ -4404,17 +4398,16 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) struct lpfc_scsi_buf *lpfc_cmd; IOCB_t *cmd, *icmd; int ret = SUCCESS, status = 0; - unsigned long flags; DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); status = fc_block_scsi_eh(cmnd); if (status != 0 && status != SUCCESS) return status; - spin_lock_irqsave(&phba->hbalock, flags); + spin_lock_irq(&phba->hbalock); /* driver queued commands are in process of being flushed */ if (phba->hba_flag & HBA_FCP_IOQ_FLUSH) { - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock_irq(&phba->hbalock); lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "3168 SCSI Layer abort requested I/O has been " "flushed by LLD.\n"); @@ -4423,7 +4416,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble; if (!lpfc_cmd || !lpfc_cmd->pCmd) { - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock_irq(&phba->hbalock); lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "2873 SCSI Layer I/O Abort Request IO CMPL Status " "x%x ID %d LUN %d\n", @@ -4434,7 +4427,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) iocb = &lpfc_cmd->cur_iocbq; /* the command is in process of being cancelled */ if (!(iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ)) { - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock_irq(&phba->hbalock); lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "3169 SCSI Layer abort requested I/O has been " "cancelled by LLD.\n"); @@ -4491,7 +4484,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) abtsiocb->iocb_cmpl = lpfc_sli_abort_fcp_cmpl; abtsiocb->vport = vport; /* no longer need the lock after this point */ - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock_irq(&phba->hbalock); if (lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, abtsiocb, 0) == IOCB_ERROR) { @@ -4523,7 +4516,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) goto out; out_unlock: - spin_unlock_irqrestore(&phba->hbalock, flags); + spin_unlock_irq(&phba->hbalock); out: lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "0749 SCSI Layer I/O Abort Request Status x%x ID %d " diff --git a/trunk/drivers/scsi/lpfc/lpfc_sli.c b/trunk/drivers/scsi/lpfc/lpfc_sli.c index d7f3313ef886..219bf534ef99 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_sli.c +++ b/trunk/drivers/scsi/lpfc/lpfc_sli.c @@ -3964,9 +3964,9 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba) pci_write_config_word(phba->pcidev, PCI_COMMAND, (cfg_value & ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR))); - /* Perform FCoE PCI function reset before freeing queue memory */ - rc = lpfc_pci_function_reset(phba); + /* Perform FCoE PCI function reset */ lpfc_sli4_queue_destroy(phba); + rc = lpfc_pci_function_reset(phba); /* Restore PCI cmd register */ pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value); @@ -7071,40 +7071,6 @@ lpfc_sli4_async_mbox_unblock(struct lpfc_hba *phba) lpfc_worker_wake_up(phba); } -/** - * lpfc_sli4_wait_bmbx_ready - Wait for bootstrap mailbox register ready - * @phba: Pointer to HBA context object. - * @mboxq: Pointer to mailbox object. - * - * The function waits for the bootstrap mailbox register ready bit from - * port for twice the regular mailbox command timeout value. - * - * 0 - no timeout on waiting for bootstrap mailbox register ready. - * MBXERR_ERROR - wait for bootstrap mailbox register timed out. - **/ -static int -lpfc_sli4_wait_bmbx_ready(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) -{ - uint32_t db_ready; - unsigned long timeout; - struct lpfc_register bmbx_reg; - - timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) - * 1000) + jiffies; - - do { - bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); - db_ready = bf_get(lpfc_bmbx_rdy, &bmbx_reg); - if (!db_ready) - msleep(2); - - if (time_after(jiffies, timeout)) - return MBXERR_ERROR; - } while (!db_ready); - - return 0; -} - /** * lpfc_sli4_post_sync_mbox - Post an SLI4 mailbox to the bootstrap mailbox * @phba: Pointer to HBA context object. @@ -7126,12 +7092,15 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) { int rc = MBX_SUCCESS; unsigned long iflag; + uint32_t db_ready; uint32_t mcqe_status; uint32_t mbx_cmnd; + unsigned long timeout; struct lpfc_sli *psli = &phba->sli; struct lpfc_mqe *mb = &mboxq->u.mqe; struct lpfc_bmbx_create *mbox_rgn; struct dma_address *dma_address; + struct lpfc_register bmbx_reg; /* * Only one mailbox can be active to the bootstrap mailbox region @@ -7155,11 +7124,6 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) phba->sli.mbox_active = mboxq; spin_unlock_irqrestore(&phba->hbalock, iflag); - /* wait for bootstrap mbox register for readyness */ - rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); - if (rc) - goto exit; - /* * Initialize the bootstrap memory region to avoid stale data areas * in the mailbox post. Then copy the caller's mailbox contents to @@ -7174,18 +7138,35 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) dma_address = &phba->sli4_hba.bmbx.dma_address; writel(dma_address->addr_hi, phba->sli4_hba.BMBXregaddr); - /* wait for bootstrap mbox register for hi-address write done */ - rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); - if (rc) - goto exit; + timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) + * 1000) + jiffies; + do { + bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); + db_ready = bf_get(lpfc_bmbx_rdy, &bmbx_reg); + if (!db_ready) + msleep(2); + + if (time_after(jiffies, timeout)) { + rc = MBXERR_ERROR; + goto exit; + } + } while (!db_ready); /* Post the low mailbox dma address to the port. */ writel(dma_address->addr_lo, phba->sli4_hba.BMBXregaddr); + timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) + * 1000) + jiffies; + do { + bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); + db_ready = bf_get(lpfc_bmbx_rdy, &bmbx_reg); + if (!db_ready) + msleep(2); - /* wait for bootstrap mbox register for low address write done */ - rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); - if (rc) - goto exit; + if (time_after(jiffies, timeout)) { + rc = MBXERR_ERROR; + goto exit; + } + } while (!db_ready); /* * Read the CQ to ensure the mailbox has completed. @@ -8109,8 +8090,6 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, bf_set(wqe_lenloc, &wqe->fcp_icmd.wqe_com, LPFC_WQE_LENLOC_NONE); bf_set(wqe_ebde_cnt, &wqe->fcp_icmd.wqe_com, 0); - bf_set(wqe_erp, &wqe->fcp_icmd.wqe_com, - iocbq->iocb.ulpFCP2Rcvy); break; case CMD_GEN_REQUEST64_CR: /* For this command calculate the xmit length of the @@ -12120,7 +12099,6 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba *phba, uint16_t startq) struct lpfc_queue *eq; int cnt, rc, length, status = 0; uint32_t shdr_status, shdr_add_status; - uint32_t result; int fcp_eqidx; union lpfc_sli4_cfg_shdr *shdr; uint16_t dmult; @@ -12139,11 +12117,8 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba *phba, uint16_t startq) eq_delay = &mbox->u.mqe.un.eq_delay; /* Calculate delay multiper from maximum interrupt per second */ - result = phba->cfg_fcp_imax / phba->cfg_fcp_io_channel; - if (result > LPFC_DMULT_CONST) - dmult = 0; - else - dmult = LPFC_DMULT_CONST/result - 1; + dmult = phba->cfg_fcp_imax / phba->cfg_fcp_io_channel; + dmult = LPFC_DMULT_CONST/dmult - 1; cnt = 0; for (fcp_eqidx = startq; fcp_eqidx < phba->cfg_fcp_io_channel; @@ -12199,7 +12174,7 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba *phba, uint16_t startq) * fails this function will return -ENXIO. **/ uint32_t -lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax) +lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint16_t imax) { struct lpfc_mbx_eq_create *eq_create; LPFC_MBOXQ_t *mbox; @@ -12231,10 +12206,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax) LPFC_EQE_SIZE); bf_set(lpfc_eq_context_valid, &eq_create->u.request.context, 1); /* Calculate delay multiper from maximum interrupt per second */ - if (imax > LPFC_DMULT_CONST) - dmult = 0; - else - dmult = LPFC_DMULT_CONST/imax - 1; + dmult = LPFC_DMULT_CONST/imax - 1; bf_set(lpfc_eq_context_delay_multi, &eq_create->u.request.context, dmult); switch (eq->entry_count) { diff --git a/trunk/drivers/scsi/lpfc/lpfc_sli4.h b/trunk/drivers/scsi/lpfc/lpfc_sli4.h index f44a06a4c6e7..bd4bc4342ae2 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_sli4.h +++ b/trunk/drivers/scsi/lpfc/lpfc_sli4.h @@ -37,7 +37,7 @@ /* Multi-queue arrangement for FCP EQ/CQ/WQ tuples */ #define LPFC_FCP_IO_CHAN_DEF 4 #define LPFC_FCP_IO_CHAN_MIN 1 -#define LPFC_FCP_IO_CHAN_MAX 16 +#define LPFC_FCP_IO_CHAN_MAX 8 /* * Provide the default FCF Record attributes used by the driver @@ -168,7 +168,7 @@ struct lpfc_queue { }; struct lpfc_sli4_link { - uint16_t speed; + uint8_t speed; uint8_t duplex; uint8_t status; uint8_t type; @@ -490,6 +490,8 @@ struct lpfc_sli4_hba { struct lpfc_pc_sli4_params pc_sli4_params; struct msix_entry *msix_entries; uint8_t handler_name[LPFC_FCP_IO_CHAN_MAX][LPFC_SLI4_HANDLER_NAME_SZ]; + uint32_t cfg_eqn; + uint32_t msix_vec_nr; struct lpfc_fcp_eq_hdl *fcp_eq_hdl; /* FCP per-WQ handle */ /* Pointers to the constructed SLI4 queues */ @@ -624,7 +626,7 @@ void lpfc_sli4_hba_reset(struct lpfc_hba *); struct lpfc_queue *lpfc_sli4_queue_alloc(struct lpfc_hba *, uint32_t, uint32_t); void lpfc_sli4_queue_free(struct lpfc_queue *); -uint32_t lpfc_eq_create(struct lpfc_hba *, struct lpfc_queue *, uint32_t); +uint32_t lpfc_eq_create(struct lpfc_hba *, struct lpfc_queue *, uint16_t); uint32_t lpfc_modify_fcp_eq_delay(struct lpfc_hba *, uint16_t); uint32_t lpfc_cq_create(struct lpfc_hba *, struct lpfc_queue *, struct lpfc_queue *, uint32_t, uint32_t); diff --git a/trunk/drivers/scsi/lpfc/lpfc_version.h b/trunk/drivers/scsi/lpfc/lpfc_version.h index 0c2149189dda..04265a1c4e52 100644 --- a/trunk/drivers/scsi/lpfc/lpfc_version.h +++ b/trunk/drivers/scsi/lpfc/lpfc_version.h @@ -18,7 +18,7 @@ * included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "8.3.35" +#define LPFC_DRIVER_VERSION "8.3.34" #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */ diff --git a/trunk/drivers/scsi/megaraid/megaraid_sas.h b/trunk/drivers/scsi/megaraid/megaraid_sas.h index 16b7a72a70c4..fcb005fa4bd1 100644 --- a/trunk/drivers/scsi/megaraid/megaraid_sas.h +++ b/trunk/drivers/scsi/megaraid/megaraid_sas.h @@ -1,7 +1,7 @@ /* * Linux MegaRAID driver for SAS based RAID controllers * - * Copyright (c) 2003-2012 LSI Corporation. + * Copyright (c) 2009-2011 LSI Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,9 +33,9 @@ /* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION "06.504.01.00-rc1" -#define MEGASAS_RELDATE "Oct. 1, 2012" -#define MEGASAS_EXT_VERSION "Mon. Oct. 1 17:00:00 PDT 2012" +#define MEGASAS_VERSION "00.00.06.18-rc1" +#define MEGASAS_RELDATE "Jun. 17, 2012" +#define MEGASAS_EXT_VERSION "Tue. Jun. 17 17:00:00 PDT 2012" /* * Device IDs diff --git a/trunk/drivers/scsi/megaraid/megaraid_sas_base.c b/trunk/drivers/scsi/megaraid/megaraid_sas_base.c index d2c5366aff7f..0393ec478cdf 100644 --- a/trunk/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/trunk/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1,7 +1,7 @@ /* * Linux MegaRAID driver for SAS based RAID controllers * - * Copyright (c) 2003-2012 LSI Corporation. + * Copyright (c) 2009-2011 LSI Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * FILE: megaraid_sas_base.c - * Version : v06.504.01.00-rc1 + * Version : v00.00.06.18-rc1 * * Authors: LSI Corporation * Sreenivas Bagalkote @@ -71,10 +71,6 @@ static int msix_disable; module_param(msix_disable, int, S_IRUGO); MODULE_PARM_DESC(msix_disable, "Disable MSI-X interrupt handling. Default: 0"); -static unsigned int msix_vectors; -module_param(msix_vectors, int, S_IRUGO); -MODULE_PARM_DESC(msix_vectors, "MSI-X max vector count. Default: Set by FW"); - static int throttlequeuedepth = MEGASAS_THROTTLE_QUEUE_DEPTH; module_param(throttlequeuedepth, int, S_IRUGO); MODULE_PARM_DESC(throttlequeuedepth, @@ -3524,10 +3520,6 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->msix_vectors = (readl(&instance->reg_set-> outbound_scratch_pad_2 ) & 0x1F) + 1; - if (msix_vectors) - instance->msix_vectors = - min(msix_vectors, - instance->msix_vectors); } else instance->msix_vectors = 1; /* Don't bother allocating more MSI-X vectors than cpus */ @@ -5241,6 +5233,7 @@ megasas_aen_polling(struct work_struct *work) case MR_EVT_PD_REMOVED: if (megasas_get_pd_list(instance) == 0) { + megasas_get_pd_list(instance); for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) { for (j = 0; j < MEGASAS_MAX_DEV_PER_CHANNEL; diff --git a/trunk/drivers/scsi/megaraid/megaraid_sas_fp.c b/trunk/drivers/scsi/megaraid/megaraid_sas_fp.c index a11df82474ef..e3d251a2e26a 100644 --- a/trunk/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/trunk/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -1,7 +1,7 @@ /* * Linux MegaRAID driver for SAS based RAID controllers * - * Copyright (c) 2009-2012 LSI Corporation. + * Copyright (c) 2009-2011 LSI Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/trunk/drivers/scsi/megaraid/megaraid_sas_fusion.c b/trunk/drivers/scsi/megaraid/megaraid_sas_fusion.c index 74030aff69ad..ddf094e7d0ac 100644 --- a/trunk/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/trunk/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1,7 +1,7 @@ /* * Linux MegaRAID driver for SAS based RAID controllers * - * Copyright (c) 2009-2012 LSI Corporation. + * Copyright (c) 2009-2011 LSI Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -1184,6 +1184,8 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, io_request->CDB.EEDP32.PrimaryReferenceTag = cpu_to_be32(ref_tag); io_request->CDB.EEDP32.PrimaryApplicationTagMask = 0xffff; + + io_request->DataLength = num_blocks * 512; io_request->IoFlags = 32; /* Specify 32-byte cdb */ /* Transfer length */ @@ -1327,7 +1329,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, struct megasas_cmd_fusion *cmd) { u8 fp_possible; - u32 start_lba_lo, start_lba_hi, device_id, datalength = 0; + u32 start_lba_lo, start_lba_hi, device_id; struct MPI2_RAID_SCSI_IO_REQUEST *io_request; union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; struct IO_REQUEST_INFO io_info; @@ -1353,7 +1355,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, * 6-byte READ(0x08) or WRITE(0x0A) cdb */ if (scp->cmd_len == 6) { - datalength = (u32) scp->cmnd[4]; + io_request->DataLength = (u32) scp->cmnd[4]; start_lba_lo = ((u32) scp->cmnd[1] << 16) | ((u32) scp->cmnd[2] << 8) | (u32) scp->cmnd[3]; @@ -1364,7 +1366,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, * 10-byte READ(0x28) or WRITE(0x2A) cdb */ else if (scp->cmd_len == 10) { - datalength = (u32) scp->cmnd[8] | + io_request->DataLength = (u32) scp->cmnd[8] | ((u32) scp->cmnd[7] << 8); start_lba_lo = ((u32) scp->cmnd[2] << 24) | ((u32) scp->cmnd[3] << 16) | @@ -1375,7 +1377,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, * 12-byte READ(0xA8) or WRITE(0xAA) cdb */ else if (scp->cmd_len == 12) { - datalength = ((u32) scp->cmnd[6] << 24) | + io_request->DataLength = ((u32) scp->cmnd[6] << 24) | ((u32) scp->cmnd[7] << 16) | ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9]; start_lba_lo = ((u32) scp->cmnd[2] << 24) | @@ -1387,7 +1389,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, * 16-byte READ(0x88) or WRITE(0x8A) cdb */ else if (scp->cmd_len == 16) { - datalength = ((u32) scp->cmnd[10] << 24) | + io_request->DataLength = ((u32) scp->cmnd[10] << 24) | ((u32) scp->cmnd[11] << 16) | ((u32) scp->cmnd[12] << 8) | (u32) scp->cmnd[13]; start_lba_lo = ((u32) scp->cmnd[6] << 24) | @@ -1401,9 +1403,8 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, memset(&io_info, 0, sizeof(struct IO_REQUEST_INFO)); io_info.ldStartBlock = ((u64)start_lba_hi << 32) | start_lba_lo; - io_info.numBlocks = datalength; + io_info.numBlocks = io_request->DataLength; io_info.ldTgtId = device_id; - io_request->DataLength = scsi_bufflen(scp); if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) io_info.isRead = 1; @@ -1430,6 +1431,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, if (fp_possible) { megasas_set_pd_lba(io_request, scp->cmd_len, &io_info, scp, local_map_ptr, start_lba_lo); + io_request->DataLength = scsi_bufflen(scp); io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST; cmd->request_desc->SCSIIO.RequestFlags = (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY @@ -1508,8 +1510,7 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance, local_map_ptr = fusion->ld_map[(instance->map_id & 1)]; /* Check if this is a system PD I/O */ - if (scmd->device->channel < MEGASAS_MAX_PD_CHANNELS && - instance->pd_list[pd_index].driveState == MR_PD_STATE_SYSTEM) { + if (instance->pd_list[pd_index].driveState == MR_PD_STATE_SYSTEM) { io_request->Function = 0; io_request->DevHandle = local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; @@ -1524,8 +1525,6 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance, cmd->request_desc->SCSIIO.RequestFlags = (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY << MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); - cmd->request_desc->SCSIIO.DevHandle = - local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; } else { io_request->Function = MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST; io_request->DevHandle = device_id; @@ -1733,6 +1732,8 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) if (reply_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) return IRQ_NONE; + d_val.word = desc->Words; + num_completed = 0; while ((d_val.u.low != UINT_MAX) && (d_val.u.high != UINT_MAX)) { @@ -1854,8 +1855,10 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr) } spin_unlock_irqrestore(&instance->hba_lock, flags); + spin_lock_irqsave(&instance->completion_lock, flags); for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) complete_cmd_fusion(instance, MSIxIndex); + spin_unlock_irqrestore(&instance->completion_lock, flags); } /** diff --git a/trunk/drivers/scsi/megaraid/megaraid_sas_fusion.h b/trunk/drivers/scsi/megaraid/megaraid_sas_fusion.h index a7c64f051996..088c9f91da95 100644 --- a/trunk/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/trunk/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -1,7 +1,7 @@ /* * Linux MegaRAID driver for SAS based RAID controllers * - * Copyright (c) 2009-2012 LSI Corporation. + * Copyright (c) 2009-2011 LSI Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/trunk/drivers/scsi/mvumi.c b/trunk/drivers/scsi/mvumi.c index c585a925b3cd..783edc7c6b98 100644 --- a/trunk/drivers/scsi/mvumi.c +++ b/trunk/drivers/scsi/mvumi.c @@ -35,12 +35,10 @@ #include #include #include -#include #include #include #include #include -#include #include "mvumi.h" @@ -50,7 +48,6 @@ MODULE_DESCRIPTION("Marvell UMI Driver"); static DEFINE_PCI_DEVICE_TABLE(mvumi_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_2, PCI_DEVICE_ID_MARVELL_MV9143) }, - { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_2, PCI_DEVICE_ID_MARVELL_MV9580) }, { 0 } }; @@ -121,7 +118,7 @@ static int mvumi_map_pci_addr(struct pci_dev *dev, void **addr_array) static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba, enum resource_type type, unsigned int size) { - struct mvumi_res *res = kzalloc(sizeof(*res), GFP_ATOMIC); + struct mvumi_res *res = kzalloc(sizeof(*res), GFP_KERNEL); if (!res) { dev_err(&mhba->pdev->dev, @@ -131,7 +128,7 @@ static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba, switch (type) { case RESOURCE_CACHED_MEMORY: - res->virt_addr = kzalloc(size, GFP_ATOMIC); + res->virt_addr = kzalloc(size, GFP_KERNEL); if (!res->virt_addr) { dev_err(&mhba->pdev->dev, "unable to allocate memory,size = %d.\n", size); @@ -225,11 +222,11 @@ static int mvumi_make_sgl(struct mvumi_hba *mhba, struct scsi_cmnd *scmd, m_sg->baseaddr_l = cpu_to_le32(lower_32_bits(busaddr)); m_sg->baseaddr_h = cpu_to_le32(upper_32_bits(busaddr)); m_sg->flags = 0; - sgd_setsz(mhba, m_sg, cpu_to_le32(sg_dma_len(&sg[i]))); + m_sg->size = cpu_to_le32(sg_dma_len(&sg[i])); if ((i + 1) == *sg_count) - m_sg->flags |= 1U << mhba->eot_flag; + m_sg->flags |= SGD_EOT; - sgd_inc(mhba, m_sg); + m_sg++; } } else { scmd->SCp.dma_handle = scsi_bufflen(scmd) ? @@ -240,8 +237,8 @@ static int mvumi_make_sgl(struct mvumi_hba *mhba, struct scsi_cmnd *scmd, busaddr = scmd->SCp.dma_handle; m_sg->baseaddr_l = cpu_to_le32(lower_32_bits(busaddr)); m_sg->baseaddr_h = cpu_to_le32(upper_32_bits(busaddr)); - m_sg->flags = 1U << mhba->eot_flag; - sgd_setsz(mhba, m_sg, cpu_to_le32(scsi_bufflen(scmd))); + m_sg->flags = SGD_EOT; + m_sg->size = cpu_to_le32(scsi_bufflen(scmd)); *sg_count = 1; } @@ -270,8 +267,8 @@ static int mvumi_internal_cmd_sgl(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, m_sg->baseaddr_l = cpu_to_le32(lower_32_bits(phy_addr)); m_sg->baseaddr_h = cpu_to_le32(upper_32_bits(phy_addr)); - m_sg->flags = 1U << mhba->eot_flag; - sgd_setsz(mhba, m_sg, cpu_to_le32(size)); + m_sg->flags = SGD_EOT; + m_sg->size = cpu_to_le32(size); return 0; } @@ -288,8 +285,7 @@ static struct mvumi_cmd *mvumi_create_internal_cmd(struct mvumi_hba *mhba, } INIT_LIST_HEAD(&cmd->queue_pointer); - cmd->frame = pci_alloc_consistent(mhba->pdev, - mhba->ib_max_size, &cmd->frame_phys); + cmd->frame = kzalloc(mhba->ib_max_size, GFP_KERNEL); if (!cmd->frame) { dev_err(&mhba->pdev->dev, "failed to allocate memory for FW" " frame,size = %d.\n", mhba->ib_max_size); @@ -301,8 +297,7 @@ static struct mvumi_cmd *mvumi_create_internal_cmd(struct mvumi_hba *mhba, if (mvumi_internal_cmd_sgl(mhba, cmd, buf_size)) { dev_err(&mhba->pdev->dev, "failed to allocate memory" " for internal frame\n"); - pci_free_consistent(mhba->pdev, mhba->ib_max_size, - cmd->frame, cmd->frame_phys); + kfree(cmd->frame); kfree(cmd); return NULL; } @@ -322,7 +317,7 @@ static void mvumi_delete_internal_cmd(struct mvumi_hba *mhba, if (cmd && cmd->frame) { if (cmd->frame->sg_counts) { m_sg = (struct mvumi_sgl *) &cmd->frame->payload[0]; - sgd_getsz(mhba, m_sg, size); + size = m_sg->size; phy_addr = (dma_addr_t) m_sg->baseaddr_l | (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16); @@ -330,8 +325,7 @@ static void mvumi_delete_internal_cmd(struct mvumi_hba *mhba, pci_free_consistent(mhba->pdev, size, cmd->data_buf, phy_addr); } - pci_free_consistent(mhba->pdev, mhba->ib_max_size, - cmd->frame, cmd->frame_phys); + kfree(cmd->frame); kfree(cmd); } } @@ -380,8 +374,7 @@ static void mvumi_free_cmds(struct mvumi_hba *mhba) cmd = list_first_entry(&mhba->cmd_pool, struct mvumi_cmd, queue_pointer); list_del(&cmd->queue_pointer); - if (!(mhba->hba_capability & HS_CAPABILITY_SUPPORT_DYN_SRC)) - kfree(cmd->frame); + kfree(cmd->frame); kfree(cmd); } } @@ -403,12 +396,7 @@ static int mvumi_alloc_cmds(struct mvumi_hba *mhba) INIT_LIST_HEAD(&cmd->queue_pointer); list_add_tail(&cmd->queue_pointer, &mhba->cmd_pool); - if (mhba->hba_capability & HS_CAPABILITY_SUPPORT_DYN_SRC) { - cmd->frame = mhba->ib_frame + i * mhba->ib_max_size; - cmd->frame_phys = mhba->ib_frame_phys - + i * mhba->ib_max_size; - } else - cmd->frame = kzalloc(mhba->ib_max_size, GFP_KERNEL); + cmd->frame = kzalloc(mhba->ib_max_size, GFP_KERNEL); if (!cmd->frame) goto err_exit; } @@ -421,71 +409,48 @@ static int mvumi_alloc_cmds(struct mvumi_hba *mhba) cmd = list_first_entry(&mhba->cmd_pool, struct mvumi_cmd, queue_pointer); list_del(&cmd->queue_pointer); - if (!(mhba->hba_capability & HS_CAPABILITY_SUPPORT_DYN_SRC)) - kfree(cmd->frame); + kfree(cmd->frame); kfree(cmd); } return -ENOMEM; } -static unsigned int mvumi_check_ib_list_9143(struct mvumi_hba *mhba) +static int mvumi_get_ib_list_entry(struct mvumi_hba *mhba, void **ib_entry) { - unsigned int ib_rp_reg; - struct mvumi_hw_regs *regs = mhba->regs; - - ib_rp_reg = ioread32(mhba->regs->inb_read_pointer); + unsigned int ib_rp_reg, cur_ib_entry; - if (unlikely(((ib_rp_reg & regs->cl_slot_num_mask) == - (mhba->ib_cur_slot & regs->cl_slot_num_mask)) && - ((ib_rp_reg & regs->cl_pointer_toggle) - != (mhba->ib_cur_slot & regs->cl_pointer_toggle)))) { - dev_warn(&mhba->pdev->dev, "no free slot to use.\n"); - return 0; - } if (atomic_read(&mhba->fw_outstanding) >= mhba->max_io) { dev_warn(&mhba->pdev->dev, "firmware io overflow.\n"); - return 0; - } else { - return mhba->max_io - atomic_read(&mhba->fw_outstanding); + return -1; } -} + ib_rp_reg = ioread32(mhba->mmio + CLA_INB_READ_POINTER); -static unsigned int mvumi_check_ib_list_9580(struct mvumi_hba *mhba) -{ - unsigned int count; - if (atomic_read(&mhba->fw_outstanding) >= (mhba->max_io - 1)) - return 0; - count = ioread32(mhba->ib_shadow); - if (count == 0xffff) - return 0; - return count; -} - -static void mvumi_get_ib_list_entry(struct mvumi_hba *mhba, void **ib_entry) -{ - unsigned int cur_ib_entry; + if (unlikely(((ib_rp_reg & CL_SLOT_NUM_MASK) == + (mhba->ib_cur_slot & CL_SLOT_NUM_MASK)) && + ((ib_rp_reg & CL_POINTER_TOGGLE) != + (mhba->ib_cur_slot & CL_POINTER_TOGGLE)))) { + dev_warn(&mhba->pdev->dev, "no free slot to use.\n"); + return -1; + } - cur_ib_entry = mhba->ib_cur_slot & mhba->regs->cl_slot_num_mask; + cur_ib_entry = mhba->ib_cur_slot & CL_SLOT_NUM_MASK; cur_ib_entry++; if (cur_ib_entry >= mhba->list_num_io) { cur_ib_entry -= mhba->list_num_io; - mhba->ib_cur_slot ^= mhba->regs->cl_pointer_toggle; - } - mhba->ib_cur_slot &= ~mhba->regs->cl_slot_num_mask; - mhba->ib_cur_slot |= (cur_ib_entry & mhba->regs->cl_slot_num_mask); - if (mhba->hba_capability & HS_CAPABILITY_SUPPORT_DYN_SRC) { - *ib_entry = mhba->ib_list + cur_ib_entry * - sizeof(struct mvumi_dyn_list_entry); - } else { - *ib_entry = mhba->ib_list + cur_ib_entry * mhba->ib_max_size; + mhba->ib_cur_slot ^= CL_POINTER_TOGGLE; } + mhba->ib_cur_slot &= ~CL_SLOT_NUM_MASK; + mhba->ib_cur_slot |= (cur_ib_entry & CL_SLOT_NUM_MASK); + *ib_entry = mhba->ib_list + cur_ib_entry * mhba->ib_max_size; atomic_inc(&mhba->fw_outstanding); + + return 0; } static void mvumi_send_ib_list_entry(struct mvumi_hba *mhba) { - iowrite32(0xffff, mhba->ib_shadow); - iowrite32(mhba->ib_cur_slot, mhba->regs->inb_write_pointer); + iowrite32(0xfff, mhba->ib_shadow); + iowrite32(mhba->ib_cur_slot, mhba->mmio + CLA_INB_WRITE_POINTER); } static char mvumi_check_ob_frame(struct mvumi_hba *mhba, @@ -515,59 +480,31 @@ static char mvumi_check_ob_frame(struct mvumi_hba *mhba, return 0; } -static int mvumi_check_ob_list_9143(struct mvumi_hba *mhba, - unsigned int *cur_obf, unsigned int *assign_obf_end) -{ - unsigned int ob_write, ob_write_shadow; - struct mvumi_hw_regs *regs = mhba->regs; - - do { - ob_write = ioread32(regs->outb_copy_pointer); - ob_write_shadow = ioread32(mhba->ob_shadow); - } while ((ob_write & regs->cl_slot_num_mask) != ob_write_shadow); - - *cur_obf = mhba->ob_cur_slot & mhba->regs->cl_slot_num_mask; - *assign_obf_end = ob_write & mhba->regs->cl_slot_num_mask; - - if ((ob_write & regs->cl_pointer_toggle) != - (mhba->ob_cur_slot & regs->cl_pointer_toggle)) { - *assign_obf_end += mhba->list_num_io; - } - return 0; -} - -static int mvumi_check_ob_list_9580(struct mvumi_hba *mhba, - unsigned int *cur_obf, unsigned int *assign_obf_end) -{ - unsigned int ob_write; - struct mvumi_hw_regs *regs = mhba->regs; - - ob_write = ioread32(regs->outb_read_pointer); - ob_write = ioread32(regs->outb_copy_pointer); - *cur_obf = mhba->ob_cur_slot & mhba->regs->cl_slot_num_mask; - *assign_obf_end = ob_write & mhba->regs->cl_slot_num_mask; - if (*assign_obf_end < *cur_obf) - *assign_obf_end += mhba->list_num_io; - else if (*assign_obf_end == *cur_obf) - return -1; - return 0; -} - static void mvumi_receive_ob_list_entry(struct mvumi_hba *mhba) { + unsigned int ob_write_reg, ob_write_shadow_reg; unsigned int cur_obf, assign_obf_end, i; struct mvumi_ob_data *ob_data; struct mvumi_rsp_frame *p_outb_frame; - struct mvumi_hw_regs *regs = mhba->regs; - if (mhba->instancet->check_ob_list(mhba, &cur_obf, &assign_obf_end)) - return; + do { + ob_write_reg = ioread32(mhba->mmio + CLA_OUTB_COPY_POINTER); + ob_write_shadow_reg = ioread32(mhba->ob_shadow); + } while ((ob_write_reg & CL_SLOT_NUM_MASK) != ob_write_shadow_reg); + + cur_obf = mhba->ob_cur_slot & CL_SLOT_NUM_MASK; + assign_obf_end = ob_write_reg & CL_SLOT_NUM_MASK; + + if ((ob_write_reg & CL_POINTER_TOGGLE) != + (mhba->ob_cur_slot & CL_POINTER_TOGGLE)) { + assign_obf_end += mhba->list_num_io; + } for (i = (assign_obf_end - cur_obf); i != 0; i--) { cur_obf++; if (cur_obf >= mhba->list_num_io) { cur_obf -= mhba->list_num_io; - mhba->ob_cur_slot ^= regs->cl_pointer_toggle; + mhba->ob_cur_slot ^= CL_POINTER_TOGGLE; } p_outb_frame = mhba->ob_list + cur_obf * mhba->ob_max_size; @@ -591,7 +528,7 @@ static void mvumi_receive_ob_list_entry(struct mvumi_hba *mhba) ob_data = NULL; if (cur_obf == 0) { cur_obf = mhba->list_num_io - 1; - mhba->ob_cur_slot ^= regs->cl_pointer_toggle; + mhba->ob_cur_slot ^= CL_POINTER_TOGGLE; } else cur_obf -= 1; break; @@ -602,20 +539,18 @@ static void mvumi_receive_ob_list_entry(struct mvumi_hba *mhba) list_add_tail(&ob_data->list, &mhba->free_ob_list); } - mhba->ob_cur_slot &= ~regs->cl_slot_num_mask; - mhba->ob_cur_slot |= (cur_obf & regs->cl_slot_num_mask); - iowrite32(mhba->ob_cur_slot, regs->outb_read_pointer); + mhba->ob_cur_slot &= ~CL_SLOT_NUM_MASK; + mhba->ob_cur_slot |= (cur_obf & CL_SLOT_NUM_MASK); + iowrite32(mhba->ob_cur_slot, mhba->mmio + CLA_OUTB_READ_POINTER); } -static void mvumi_reset(struct mvumi_hba *mhba) +static void mvumi_reset(void *regs) { - struct mvumi_hw_regs *regs = mhba->regs; - - iowrite32(0, regs->enpointa_mask_reg); - if (ioread32(regs->arm_to_pciea_msg1) != HANDSHAKE_DONESTATE) + iowrite32(0, regs + CPU_ENPOINTA_MASK_REG); + if (ioread32(regs + CPU_ARM_TO_PCIEA_MSG1) != HANDSHAKE_DONESTATE) return; - iowrite32(DRBL_SOFT_RESET, regs->pciea_to_arm_drbl_reg); + iowrite32(DRBL_SOFT_RESET, regs + CPU_PCIEA_TO_ARM_DRBL_REG); } static unsigned char mvumi_start(struct mvumi_hba *mhba); @@ -623,7 +558,7 @@ static unsigned char mvumi_start(struct mvumi_hba *mhba); static int mvumi_wait_for_outstanding(struct mvumi_hba *mhba) { mhba->fw_state = FW_STATE_ABORT; - mvumi_reset(mhba); + mvumi_reset(mhba->mmio); if (mvumi_start(mhba)) return FAILED; @@ -631,98 +566,6 @@ static int mvumi_wait_for_outstanding(struct mvumi_hba *mhba) return SUCCESS; } -static int mvumi_wait_for_fw(struct mvumi_hba *mhba) -{ - struct mvumi_hw_regs *regs = mhba->regs; - u32 tmp; - unsigned long before; - before = jiffies; - - iowrite32(0, regs->enpointa_mask_reg); - tmp = ioread32(regs->arm_to_pciea_msg1); - while (tmp != HANDSHAKE_READYSTATE) { - iowrite32(DRBL_MU_RESET, regs->pciea_to_arm_drbl_reg); - if (time_after(jiffies, before + FW_MAX_DELAY * HZ)) { - dev_err(&mhba->pdev->dev, - "FW reset failed [0x%x].\n", tmp); - return FAILED; - } - - msleep(500); - rmb(); - tmp = ioread32(regs->arm_to_pciea_msg1); - } - - return SUCCESS; -} - -static void mvumi_backup_bar_addr(struct mvumi_hba *mhba) -{ - unsigned char i; - - for (i = 0; i < MAX_BASE_ADDRESS; i++) { - pci_read_config_dword(mhba->pdev, 0x10 + i * 4, - &mhba->pci_base[i]); - } -} - -static void mvumi_restore_bar_addr(struct mvumi_hba *mhba) -{ - unsigned char i; - - for (i = 0; i < MAX_BASE_ADDRESS; i++) { - if (mhba->pci_base[i]) - pci_write_config_dword(mhba->pdev, 0x10 + i * 4, - mhba->pci_base[i]); - } -} - -static unsigned int mvumi_pci_set_master(struct pci_dev *pdev) -{ - unsigned int ret = 0; - pci_set_master(pdev); - - if (IS_DMA64) { - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - } else - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - - return ret; -} - -static int mvumi_reset_host_9580(struct mvumi_hba *mhba) -{ - mhba->fw_state = FW_STATE_ABORT; - - iowrite32(0, mhba->regs->reset_enable); - iowrite32(0xf, mhba->regs->reset_request); - - iowrite32(0x10, mhba->regs->reset_enable); - iowrite32(0x10, mhba->regs->reset_request); - msleep(100); - pci_disable_device(mhba->pdev); - - if (pci_enable_device(mhba->pdev)) { - dev_err(&mhba->pdev->dev, "enable device failed\n"); - return FAILED; - } - if (mvumi_pci_set_master(mhba->pdev)) { - dev_err(&mhba->pdev->dev, "set master failed\n"); - return FAILED; - } - mvumi_restore_bar_addr(mhba); - if (mvumi_wait_for_fw(mhba) == FAILED) - return FAILED; - - return mvumi_wait_for_outstanding(mhba); -} - -static int mvumi_reset_host_9143(struct mvumi_hba *mhba) -{ - return mvumi_wait_for_outstanding(mhba); -} - static int mvumi_host_reset(struct scsi_cmnd *scmd) { struct mvumi_hba *mhba; @@ -732,7 +575,7 @@ static int mvumi_host_reset(struct scsi_cmnd *scmd) scmd_printk(KERN_NOTICE, scmd, "RESET -%ld cmd=%x retries=%x\n", scmd->serial_number, scmd->cmnd[0], scmd->retries); - return mhba->instancet->reset_host(mhba); + return mvumi_wait_for_outstanding(mhba); } static int mvumi_issue_blocked_cmd(struct mvumi_hba *mhba, @@ -785,9 +628,7 @@ static void mvumi_release_fw(struct mvumi_hba *mhba) mvumi_free_cmds(mhba); mvumi_release_mem_resource(mhba); mvumi_unmap_pci_addr(mhba->pdev, mhba->base_addr); - pci_free_consistent(mhba->pdev, HSP_MAX_SIZE, - mhba->handshake_page, mhba->handshake_page_phys); - kfree(mhba->regs); + kfree(mhba->handshake_page); pci_release_regions(mhba->pdev); } @@ -824,7 +665,6 @@ get_cmd: cmd = mvumi_create_internal_cmd(mhba, 0); frame->cdb_length = MAX_COMMAND_SIZE; memset(frame->cdb, 0, MAX_COMMAND_SIZE); frame->cdb[0] = SCSI_CMD_MARVELL_SPECIFIC; - frame->cdb[1] = CDB_CORE_MODULE; frame->cdb[2] = CDB_CORE_SHUTDOWN; mvumi_issue_blocked_cmd(mhba, cmd); @@ -855,7 +695,7 @@ mvumi_calculate_checksum(struct mvumi_hs_header *p_header, return ret; } -static void mvumi_hs_build_page(struct mvumi_hba *mhba, +void mvumi_hs_build_page(struct mvumi_hba *mhba, struct mvumi_hs_header *hs_header) { struct mvumi_hs_page2 *hs_page2; @@ -870,8 +710,6 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba, hs_header->frame_length = sizeof(*hs_page2) - 4; memset(hs_header->frame_content, 0, hs_header->frame_length); hs_page2->host_type = 3; /* 3 mean linux*/ - if (mhba->hba_capability & HS_CAPABILITY_SUPPORT_DYN_SRC) - hs_page2->host_cap = 0x08;/* host dynamic source mode */ hs_page2->host_ver.ver_major = VER_MAJOR; hs_page2->host_ver.ver_minor = VER_MINOR; hs_page2->host_ver.ver_oem = VER_OEM; @@ -907,18 +745,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba, hs_page4->ob_baseaddr_h = upper_32_bits(mhba->ob_list_phys); hs_page4->ib_entry_size = mhba->ib_max_size_setting; hs_page4->ob_entry_size = mhba->ob_max_size_setting; - if (mhba->hba_capability - & HS_CAPABILITY_NEW_PAGE_IO_DEPTH_DEF) { - hs_page4->ob_depth = find_first_bit((unsigned long *) - &mhba->list_num_io, - BITS_PER_LONG); - hs_page4->ib_depth = find_first_bit((unsigned long *) - &mhba->list_num_io, - BITS_PER_LONG); - } else { - hs_page4->ob_depth = (u8) mhba->list_num_io; - hs_page4->ib_depth = (u8) mhba->list_num_io; - } + hs_page4->ob_depth = mhba->list_num_io; + hs_page4->ib_depth = mhba->list_num_io; hs_header->checksum = mvumi_calculate_checksum(hs_header, hs_header->frame_length); break; @@ -946,11 +774,8 @@ static int mvumi_init_data(struct mvumi_hba *mhba) return 0; tmp_size = mhba->ib_max_size * mhba->max_io; - if (mhba->hba_capability & HS_CAPABILITY_SUPPORT_DYN_SRC) - tmp_size += sizeof(struct mvumi_dyn_list_entry) * mhba->max_io; - tmp_size += 128 + mhba->ob_max_size * mhba->max_io; - tmp_size += 8 + sizeof(u32)*2 + 16; + tmp_size += 8 + sizeof(u32) + 16; res_mgnt = mvumi_alloc_mem_resource(mhba, RESOURCE_UNCACHED_MEMORY, tmp_size); @@ -968,41 +793,24 @@ static int mvumi_init_data(struct mvumi_hba *mhba) v += offset; mhba->ib_list = v; mhba->ib_list_phys = p; - if (mhba->hba_capability & HS_CAPABILITY_SUPPORT_DYN_SRC) { - v += sizeof(struct mvumi_dyn_list_entry) * mhba->max_io; - p += sizeof(struct mvumi_dyn_list_entry) * mhba->max_io; - mhba->ib_frame = v; - mhba->ib_frame_phys = p; - } v += mhba->ib_max_size * mhba->max_io; p += mhba->ib_max_size * mhba->max_io; - /* ib shadow */ offset = round_up(p, 8) - p; p += offset; v += offset; mhba->ib_shadow = v; mhba->ib_shadow_phys = p; - p += sizeof(u32)*2; - v += sizeof(u32)*2; + p += sizeof(u32); + v += sizeof(u32); /* ob shadow */ - if (mhba->pdev->device == PCI_DEVICE_ID_MARVELL_MV9580) { - offset = round_up(p, 8) - p; - p += offset; - v += offset; - mhba->ob_shadow = v; - mhba->ob_shadow_phys = p; - p += 8; - v += 8; - } else { - offset = round_up(p, 4) - p; - p += offset; - v += offset; - mhba->ob_shadow = v; - mhba->ob_shadow_phys = p; - p += 4; - v += 4; - } + offset = round_up(p, 8) - p; + p += offset; + v += offset; + mhba->ob_shadow = v; + mhba->ob_shadow_phys = p; + p += 8; + v += 8; /* ob list */ offset = round_up(p, 128) - p; @@ -1094,12 +902,6 @@ static int mvumi_hs_process_page(struct mvumi_hba *mhba, dev_dbg(&mhba->pdev->dev, "FW version:%d\n", hs_page1->fw_ver.ver_build); - if (mhba->hba_capability & HS_CAPABILITY_SUPPORT_COMPACT_SG) - mhba->eot_flag = 22; - else - mhba->eot_flag = 27; - if (mhba->hba_capability & HS_CAPABILITY_NEW_PAGE_IO_DEPTH_DEF) - mhba->list_num_io = 1 << hs_page1->cl_inout_list_depth; break; default: dev_err(&mhba->pdev->dev, "handshake: page code error\n"); @@ -1121,12 +923,12 @@ static int mvumi_handshake(struct mvumi_hba *mhba) { unsigned int hs_state, tmp, hs_fun; struct mvumi_hs_header *hs_header; - struct mvumi_hw_regs *regs = mhba->regs; + void *regs = mhba->mmio; if (mhba->fw_state == FW_STATE_STARTING) hs_state = HS_S_START; else { - tmp = ioread32(regs->arm_to_pciea_msg0); + tmp = ioread32(regs + CPU_ARM_TO_PCIEA_MSG0); hs_state = HS_GET_STATE(tmp); dev_dbg(&mhba->pdev->dev, "handshake state[0x%x].\n", hs_state); if (HS_GET_STATUS(tmp) != HS_STATUS_OK) { @@ -1141,20 +943,21 @@ static int mvumi_handshake(struct mvumi_hba *mhba) mhba->fw_state = FW_STATE_HANDSHAKING; HS_SET_STATUS(hs_fun, HS_STATUS_OK); HS_SET_STATE(hs_fun, HS_S_RESET); - iowrite32(HANDSHAKE_SIGNATURE, regs->pciea_to_arm_msg1); - iowrite32(hs_fun, regs->pciea_to_arm_msg0); - iowrite32(DRBL_HANDSHAKE, regs->pciea_to_arm_drbl_reg); + iowrite32(HANDSHAKE_SIGNATURE, regs + CPU_PCIEA_TO_ARM_MSG1); + iowrite32(hs_fun, regs + CPU_PCIEA_TO_ARM_MSG0); + iowrite32(DRBL_HANDSHAKE, regs + CPU_PCIEA_TO_ARM_DRBL_REG); break; case HS_S_RESET: iowrite32(lower_32_bits(mhba->handshake_page_phys), - regs->pciea_to_arm_msg1); + regs + CPU_PCIEA_TO_ARM_MSG1); iowrite32(upper_32_bits(mhba->handshake_page_phys), - regs->arm_to_pciea_msg1); + regs + CPU_ARM_TO_PCIEA_MSG1); HS_SET_STATUS(hs_fun, HS_STATUS_OK); HS_SET_STATE(hs_fun, HS_S_PAGE_ADDR); - iowrite32(hs_fun, regs->pciea_to_arm_msg0); - iowrite32(DRBL_HANDSHAKE, regs->pciea_to_arm_drbl_reg); + iowrite32(hs_fun, regs + CPU_PCIEA_TO_ARM_MSG0); + iowrite32(DRBL_HANDSHAKE, regs + CPU_PCIEA_TO_ARM_DRBL_REG); + break; case HS_S_PAGE_ADDR: @@ -1194,37 +997,30 @@ static int mvumi_handshake(struct mvumi_hba *mhba) HS_SET_STATE(hs_fun, HS_S_END); HS_SET_STATUS(hs_fun, HS_STATUS_OK); - iowrite32(hs_fun, regs->pciea_to_arm_msg0); - iowrite32(DRBL_HANDSHAKE, regs->pciea_to_arm_drbl_reg); + iowrite32(hs_fun, regs + CPU_PCIEA_TO_ARM_MSG0); + iowrite32(DRBL_HANDSHAKE, regs + CPU_PCIEA_TO_ARM_DRBL_REG); break; case HS_S_END: /* Set communication list ISR */ - tmp = ioread32(regs->enpointa_mask_reg); - tmp |= regs->int_comaout | regs->int_comaerr; - iowrite32(tmp, regs->enpointa_mask_reg); + tmp = ioread32(regs + CPU_ENPOINTA_MASK_REG); + tmp |= INT_MAP_COMAOUT | INT_MAP_COMAERR; + iowrite32(tmp, regs + CPU_ENPOINTA_MASK_REG); iowrite32(mhba->list_num_io, mhba->ib_shadow); /* Set InBound List Available count shadow */ iowrite32(lower_32_bits(mhba->ib_shadow_phys), - regs->inb_aval_count_basel); + regs + CLA_INB_AVAL_COUNT_BASEL); iowrite32(upper_32_bits(mhba->ib_shadow_phys), - regs->inb_aval_count_baseh); - - if (mhba->pdev->device == PCI_DEVICE_ID_MARVELL_MV9143) { - /* Set OutBound List Available count shadow */ - iowrite32((mhba->list_num_io-1) | - regs->cl_pointer_toggle, - mhba->ob_shadow); - iowrite32(lower_32_bits(mhba->ob_shadow_phys), - regs->outb_copy_basel); - iowrite32(upper_32_bits(mhba->ob_shadow_phys), - regs->outb_copy_baseh); - } + regs + CLA_INB_AVAL_COUNT_BASEH); + + /* Set OutBound List Available count shadow */ + iowrite32((mhba->list_num_io-1) | CL_POINTER_TOGGLE, + mhba->ob_shadow); + iowrite32(lower_32_bits(mhba->ob_shadow_phys), regs + 0x5B0); + iowrite32(upper_32_bits(mhba->ob_shadow_phys), regs + 0x5B4); - mhba->ib_cur_slot = (mhba->list_num_io - 1) | - regs->cl_pointer_toggle; - mhba->ob_cur_slot = (mhba->list_num_io - 1) | - regs->cl_pointer_toggle; + mhba->ib_cur_slot = (mhba->list_num_io - 1) | CL_POINTER_TOGGLE; + mhba->ob_cur_slot = (mhba->list_num_io - 1) | CL_POINTER_TOGGLE; mhba->fw_state = FW_STATE_STARTED; break; @@ -1244,7 +1040,7 @@ static unsigned char mvumi_handshake_event(struct mvumi_hba *mhba) before = jiffies; mvumi_handshake(mhba); do { - isr_status = mhba->instancet->read_fw_status_reg(mhba); + isr_status = mhba->instancet->read_fw_status_reg(mhba->mmio); if (mhba->fw_state == FW_STATE_STARTED) return 0; @@ -1266,15 +1062,16 @@ static unsigned char mvumi_handshake_event(struct mvumi_hba *mhba) static unsigned char mvumi_check_handshake(struct mvumi_hba *mhba) { + void *regs = mhba->mmio; unsigned int tmp; unsigned long before; before = jiffies; - tmp = ioread32(mhba->regs->arm_to_pciea_msg1); + tmp = ioread32(regs + CPU_ARM_TO_PCIEA_MSG1); while ((tmp != HANDSHAKE_READYSTATE) && (tmp != HANDSHAKE_DONESTATE)) { if (tmp != HANDSHAKE_READYSTATE) iowrite32(DRBL_MU_RESET, - mhba->regs->pciea_to_arm_drbl_reg); + regs + CPU_PCIEA_TO_ARM_DRBL_REG); if (time_after(jiffies, before + FW_MAX_DELAY * HZ)) { dev_err(&mhba->pdev->dev, "invalid signature [0x%x].\n", tmp); @@ -1282,7 +1079,7 @@ static unsigned char mvumi_check_handshake(struct mvumi_hba *mhba) } usleep_range(1000, 2000); rmb(); - tmp = ioread32(mhba->regs->arm_to_pciea_msg1); + tmp = ioread32(regs + CPU_ARM_TO_PCIEA_MSG1); } mhba->fw_state = FW_STATE_STARTING; @@ -1303,17 +1100,15 @@ static unsigned char mvumi_check_handshake(struct mvumi_hba *mhba) static unsigned char mvumi_start(struct mvumi_hba *mhba) { + void *regs = mhba->mmio; unsigned int tmp; - struct mvumi_hw_regs *regs = mhba->regs; - /* clear Door bell */ - tmp = ioread32(regs->arm_to_pciea_drbl_reg); - iowrite32(tmp, regs->arm_to_pciea_drbl_reg); + tmp = ioread32(regs + CPU_ARM_TO_PCIEA_DRBL_REG); + iowrite32(tmp, regs + CPU_ARM_TO_PCIEA_DRBL_REG); - iowrite32(regs->int_drbl_int_mask, regs->arm_to_pciea_mask_reg); - tmp = ioread32(regs->enpointa_mask_reg) | regs->int_dl_cpu2pciea; - iowrite32(tmp, regs->enpointa_mask_reg); - msleep(100); + iowrite32(0x3FFFFFFF, regs + CPU_ARM_TO_PCIEA_MASK_REG); + tmp = ioread32(regs + CPU_ENPOINTA_MASK_REG) | INT_MAP_DL_CPU2PCIEA; + iowrite32(tmp, regs + CPU_ENPOINTA_MASK_REG); if (mvumi_check_handshake(mhba)) return -1; @@ -1371,7 +1166,6 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, cmd->scmd->scsi_done(scmd); mvumi_return_cmd(mhba, cmd); } - static void mvumi_complete_internal_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, struct mvumi_rsp_frame *ob_frame) @@ -1416,304 +1210,6 @@ static void mvumi_show_event(struct mvumi_hba *mhba, } } -static int mvumi_handle_hotplug(struct mvumi_hba *mhba, u16 devid, int status) -{ - struct scsi_device *sdev; - int ret = -1; - - if (status == DEVICE_OFFLINE) { - sdev = scsi_device_lookup(mhba->shost, 0, devid, 0); - if (sdev) { - dev_dbg(&mhba->pdev->dev, "remove disk %d-%d-%d.\n", 0, - sdev->id, 0); - scsi_remove_device(sdev); - scsi_device_put(sdev); - ret = 0; - } else - dev_err(&mhba->pdev->dev, " no disk[%d] to remove\n", - devid); - } else if (status == DEVICE_ONLINE) { - sdev = scsi_device_lookup(mhba->shost, 0, devid, 0); - if (!sdev) { - scsi_add_device(mhba->shost, 0, devid, 0); - dev_dbg(&mhba->pdev->dev, " add disk %d-%d-%d.\n", 0, - devid, 0); - ret = 0; - } else { - dev_err(&mhba->pdev->dev, " don't add disk %d-%d-%d.\n", - 0, devid, 0); - scsi_device_put(sdev); - } - } - return ret; -} - -static u64 mvumi_inquiry(struct mvumi_hba *mhba, - unsigned int id, struct mvumi_cmd *cmd) -{ - struct mvumi_msg_frame *frame; - u64 wwid = 0; - int cmd_alloc = 0; - int data_buf_len = 64; - - if (!cmd) { - cmd = mvumi_create_internal_cmd(mhba, data_buf_len); - if (cmd) - cmd_alloc = 1; - else - return 0; - } else { - memset(cmd->data_buf, 0, data_buf_len); - } - cmd->scmd = NULL; - cmd->cmd_status = REQ_STATUS_PENDING; - atomic_set(&cmd->sync_cmd, 0); - frame = cmd->frame; - frame->device_id = (u16) id; - frame->cmd_flag = CMD_FLAG_DATA_IN; - frame->req_function = CL_FUN_SCSI_CMD; - frame->cdb_length = 6; - frame->data_transfer_length = MVUMI_INQUIRY_LENGTH; - memset(frame->cdb, 0, frame->cdb_length); - frame->cdb[0] = INQUIRY; - frame->cdb[4] = frame->data_transfer_length; - - mvumi_issue_blocked_cmd(mhba, cmd); - - if (cmd->cmd_status == SAM_STAT_GOOD) { - if (mhba->pdev->device == PCI_DEVICE_ID_MARVELL_MV9143) - wwid = id + 1; - else - memcpy((void *)&wwid, - (cmd->data_buf + MVUMI_INQUIRY_UUID_OFF), - MVUMI_INQUIRY_UUID_LEN); - dev_dbg(&mhba->pdev->dev, - "inquiry device(0:%d:0) wwid(%llx)\n", id, wwid); - } else { - wwid = 0; - } - if (cmd_alloc) - mvumi_delete_internal_cmd(mhba, cmd); - - return wwid; -} - -static void mvumi_detach_devices(struct mvumi_hba *mhba) -{ - struct mvumi_device *mv_dev = NULL , *dev_next; - struct scsi_device *sdev = NULL; - - mutex_lock(&mhba->device_lock); - - /* detach Hard Disk */ - list_for_each_entry_safe(mv_dev, dev_next, - &mhba->shost_dev_list, list) { - mvumi_handle_hotplug(mhba, mv_dev->id, DEVICE_OFFLINE); - list_del_init(&mv_dev->list); - dev_dbg(&mhba->pdev->dev, "release device(0:%d:0) wwid(%llx)\n", - mv_dev->id, mv_dev->wwid); - kfree(mv_dev); - } - list_for_each_entry_safe(mv_dev, dev_next, &mhba->mhba_dev_list, list) { - list_del_init(&mv_dev->list); - dev_dbg(&mhba->pdev->dev, "release device(0:%d:0) wwid(%llx)\n", - mv_dev->id, mv_dev->wwid); - kfree(mv_dev); - } - - /* detach virtual device */ - if (mhba->pdev->device == PCI_DEVICE_ID_MARVELL_MV9580) - sdev = scsi_device_lookup(mhba->shost, 0, - mhba->max_target_id - 1, 0); - - if (sdev) { - scsi_remove_device(sdev); - scsi_device_put(sdev); - } - - mutex_unlock(&mhba->device_lock); -} - -static void mvumi_rescan_devices(struct mvumi_hba *mhba, int id) -{ - struct scsi_device *sdev; - - sdev = scsi_device_lookup(mhba->shost, 0, id, 0); - if (sdev) { - scsi_rescan_device(&sdev->sdev_gendev); - scsi_device_put(sdev); - } -} - -static int mvumi_match_devices(struct mvumi_hba *mhba, int id, u64 wwid) -{ - struct mvumi_device *mv_dev = NULL; - - list_for_each_entry(mv_dev, &mhba->shost_dev_list, list) { - if (mv_dev->wwid == wwid) { - if (mv_dev->id != id) { - dev_err(&mhba->pdev->dev, - "%s has same wwid[%llx] ," - " but different id[%d %d]\n", - __func__, mv_dev->wwid, mv_dev->id, id); - return -1; - } else { - if (mhba->pdev->device == - PCI_DEVICE_ID_MARVELL_MV9143) - mvumi_rescan_devices(mhba, id); - return 1; - } - } - } - return 0; -} - -static void mvumi_remove_devices(struct mvumi_hba *mhba, int id) -{ - struct mvumi_device *mv_dev = NULL, *dev_next; - - list_for_each_entry_safe(mv_dev, dev_next, - &mhba->shost_dev_list, list) { - if (mv_dev->id == id) { - dev_dbg(&mhba->pdev->dev, - "detach device(0:%d:0) wwid(%llx) from HOST\n", - mv_dev->id, mv_dev->wwid); - mvumi_handle_hotplug(mhba, mv_dev->id, DEVICE_OFFLINE); - list_del_init(&mv_dev->list); - kfree(mv_dev); - } - } -} - -static int mvumi_probe_devices(struct mvumi_hba *mhba) -{ - int id, maxid; - u64 wwid = 0; - struct mvumi_device *mv_dev = NULL; - struct mvumi_cmd *cmd = NULL; - int found = 0; - - cmd = mvumi_create_internal_cmd(mhba, 64); - if (!cmd) - return -1; - - if (mhba->pdev->device == PCI_DEVICE_ID_MARVELL_MV9143) - maxid = mhba->max_target_id; - else - maxid = mhba->max_target_id - 1; - - for (id = 0; id < maxid; id++) { - wwid = mvumi_inquiry(mhba, id, cmd); - if (!wwid) { - /* device no response, remove it */ - mvumi_remove_devices(mhba, id); - } else { - /* device response, add it */ - found = mvumi_match_devices(mhba, id, wwid); - if (!found) { - mvumi_remove_devices(mhba, id); - mv_dev = kzalloc(sizeof(struct mvumi_device), - GFP_KERNEL); - if (!mv_dev) { - dev_err(&mhba->pdev->dev, - "%s alloc mv_dev failed\n", - __func__); - continue; - } - mv_dev->id = id; - mv_dev->wwid = wwid; - mv_dev->sdev = NULL; - INIT_LIST_HEAD(&mv_dev->list); - list_add_tail(&mv_dev->list, - &mhba->mhba_dev_list); - dev_dbg(&mhba->pdev->dev, - "probe a new device(0:%d:0)" - " wwid(%llx)\n", id, mv_dev->wwid); - } else if (found == -1) - return -1; - else - continue; - } - } - - if (cmd) - mvumi_delete_internal_cmd(mhba, cmd); - - return 0; -} - -static int mvumi_rescan_bus(void *data) -{ - int ret = 0; - struct mvumi_hba *mhba = (struct mvumi_hba *) data; - struct mvumi_device *mv_dev = NULL , *dev_next; - - while (!kthread_should_stop()) { - - set_current_state(TASK_INTERRUPTIBLE); - if (!atomic_read(&mhba->pnp_count)) - schedule(); - msleep(1000); - atomic_set(&mhba->pnp_count, 0); - __set_current_state(TASK_RUNNING); - - mutex_lock(&mhba->device_lock); - ret = mvumi_probe_devices(mhba); - if (!ret) { - list_for_each_entry_safe(mv_dev, dev_next, - &mhba->mhba_dev_list, list) { - if (mvumi_handle_hotplug(mhba, mv_dev->id, - DEVICE_ONLINE)) { - dev_err(&mhba->pdev->dev, - "%s add device(0:%d:0) failed" - "wwid(%llx) has exist\n", - __func__, - mv_dev->id, mv_dev->wwid); - list_del_init(&mv_dev->list); - kfree(mv_dev); - } else { - list_move_tail(&mv_dev->list, - &mhba->shost_dev_list); - } - } - } - mutex_unlock(&mhba->device_lock); - } - return 0; -} - -static void mvumi_proc_msg(struct mvumi_hba *mhba, - struct mvumi_hotplug_event *param) -{ - u16 size = param->size; - const unsigned long *ar_bitmap; - const unsigned long *re_bitmap; - int index; - - if (mhba->fw_flag & MVUMI_FW_ATTACH) { - index = -1; - ar_bitmap = (const unsigned long *) param->bitmap; - re_bitmap = (const unsigned long *) ¶m->bitmap[size >> 3]; - - mutex_lock(&mhba->sas_discovery_mutex); - do { - index = find_next_zero_bit(ar_bitmap, size, index + 1); - if (index >= size) - break; - mvumi_handle_hotplug(mhba, index, DEVICE_ONLINE); - } while (1); - - index = -1; - do { - index = find_next_zero_bit(re_bitmap, size, index + 1); - if (index >= size) - break; - mvumi_handle_hotplug(mhba, index, DEVICE_OFFLINE); - } while (1); - mutex_unlock(&mhba->sas_discovery_mutex); - } -} - static void mvumi_notification(struct mvumi_hba *mhba, u8 msg, void *buffer) { if (msg == APICDB1_EVENT_GETEVENT) { @@ -1731,8 +1227,6 @@ static void mvumi_notification(struct mvumi_hba *mhba, u8 msg, void *buffer) param = &er->events[i]; mvumi_show_event(mhba, param); } - } else if (msg == APICDB1_HOST_GETEVENT) { - mvumi_proc_msg(mhba, buffer); } } @@ -1777,27 +1271,17 @@ static void mvumi_scan_events(struct work_struct *work) kfree(mu_ev); } -static void mvumi_launch_events(struct mvumi_hba *mhba, u32 isr_status) +static void mvumi_launch_events(struct mvumi_hba *mhba, u8 msg) { struct mvumi_events_wq *mu_ev; - while (isr_status & (DRBL_BUS_CHANGE | DRBL_EVENT_NOTIFY)) { - if (isr_status & DRBL_BUS_CHANGE) { - atomic_inc(&mhba->pnp_count); - wake_up_process(mhba->dm_thread); - isr_status &= ~(DRBL_BUS_CHANGE); - continue; - } - - mu_ev = kzalloc(sizeof(*mu_ev), GFP_ATOMIC); - if (mu_ev) { - INIT_WORK(&mu_ev->work_q, mvumi_scan_events); - mu_ev->mhba = mhba; - mu_ev->event = APICDB1_EVENT_GETEVENT; - isr_status &= ~(DRBL_EVENT_NOTIFY); - mu_ev->param = NULL; - schedule_work(&mu_ev->work_q); - } + mu_ev = kzalloc(sizeof(*mu_ev), GFP_ATOMIC); + if (mu_ev) { + INIT_WORK(&mu_ev->work_q, mvumi_scan_events); + mu_ev->mhba = mhba; + mu_ev->event = msg; + mu_ev->param = NULL; + schedule_work(&mu_ev->work_q); } } @@ -1838,17 +1322,16 @@ static irqreturn_t mvumi_isr_handler(int irq, void *devp) return IRQ_NONE; } - if (mhba->global_isr & mhba->regs->int_dl_cpu2pciea) { - if (mhba->isr_status & (DRBL_BUS_CHANGE | DRBL_EVENT_NOTIFY)) - mvumi_launch_events(mhba, mhba->isr_status); + if (mhba->global_isr & INT_MAP_DL_CPU2PCIEA) { if (mhba->isr_status & DRBL_HANDSHAKE_ISR) { dev_warn(&mhba->pdev->dev, "enter handshake again!\n"); mvumi_handshake(mhba); } - + if (mhba->isr_status & DRBL_EVENT_NOTIFY) + mvumi_launch_events(mhba, APICDB1_EVENT_GETEVENT); } - if (mhba->global_isr & mhba->regs->int_comaout) + if (mhba->global_isr & INT_MAP_COMAOUT) mvumi_receive_ob_list_entry(mhba); mhba->global_isr = 0; @@ -1875,7 +1358,8 @@ static enum mvumi_qc_result mvumi_send_command(struct mvumi_hba *mhba, dev_dbg(&mhba->pdev->dev, "no free tag.\n"); return MV_QUEUE_COMMAND_RESULT_NO_RESOURCE; } - mvumi_get_ib_list_entry(mhba, &ib_entry); + if (mvumi_get_ib_list_entry(mhba, &ib_entry)) + return MV_QUEUE_COMMAND_RESULT_NO_RESOURCE; cmd->frame->tag = tag_get_one(mhba, &mhba->tag_pool); cmd->frame->request_id = mhba->io_seq++; @@ -1883,35 +1367,21 @@ static enum mvumi_qc_result mvumi_send_command(struct mvumi_hba *mhba, mhba->tag_cmd[cmd->frame->tag] = cmd; frame_len = sizeof(*ib_frame) - 4 + ib_frame->sg_counts * sizeof(struct mvumi_sgl); - if (mhba->hba_capability & HS_CAPABILITY_SUPPORT_DYN_SRC) { - struct mvumi_dyn_list_entry *dle; - dle = ib_entry; - dle->src_low_addr = - cpu_to_le32(lower_32_bits(cmd->frame_phys)); - dle->src_high_addr = - cpu_to_le32(upper_32_bits(cmd->frame_phys)); - dle->if_length = (frame_len >> 2) & 0xFFF; - } else { - memcpy(ib_entry, ib_frame, frame_len); - } + memcpy(ib_entry, ib_frame, frame_len); return MV_QUEUE_COMMAND_RESULT_SENT; } static void mvumi_fire_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd) { unsigned short num_of_cl_sent = 0; - unsigned int count; enum mvumi_qc_result result; if (cmd) list_add_tail(&cmd->queue_pointer, &mhba->waiting_req_list); - count = mhba->instancet->check_ib_list(mhba); - if (list_empty(&mhba->waiting_req_list) || !count) - return; - do { + while (!list_empty(&mhba->waiting_req_list)) { cmd = list_first_entry(&mhba->waiting_req_list, - struct mvumi_cmd, queue_pointer); + struct mvumi_cmd, queue_pointer); list_del_init(&cmd->queue_pointer); result = mvumi_send_command(mhba, cmd); switch (result) { @@ -1925,77 +1395,65 @@ static void mvumi_fire_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd) return; } - } while (!list_empty(&mhba->waiting_req_list) && count--); - + } if (num_of_cl_sent > 0) mvumi_send_ib_list_entry(mhba); } /** * mvumi_enable_intr - Enables interrupts - * @mhba: Adapter soft state + * @regs: FW register set */ -static void mvumi_enable_intr(struct mvumi_hba *mhba) +static void mvumi_enable_intr(void *regs) { unsigned int mask; - struct mvumi_hw_regs *regs = mhba->regs; - iowrite32(regs->int_drbl_int_mask, regs->arm_to_pciea_mask_reg); - mask = ioread32(regs->enpointa_mask_reg); - mask |= regs->int_dl_cpu2pciea | regs->int_comaout | regs->int_comaerr; - iowrite32(mask, regs->enpointa_mask_reg); + iowrite32(0x3FFFFFFF, regs + CPU_ARM_TO_PCIEA_MASK_REG); + mask = ioread32(regs + CPU_ENPOINTA_MASK_REG); + mask |= INT_MAP_DL_CPU2PCIEA | INT_MAP_COMAOUT | INT_MAP_COMAERR; + iowrite32(mask, regs + CPU_ENPOINTA_MASK_REG); } /** * mvumi_disable_intr -Disables interrupt - * @mhba: Adapter soft state + * @regs: FW register set */ -static void mvumi_disable_intr(struct mvumi_hba *mhba) +static void mvumi_disable_intr(void *regs) { unsigned int mask; - struct mvumi_hw_regs *regs = mhba->regs; - iowrite32(0, regs->arm_to_pciea_mask_reg); - mask = ioread32(regs->enpointa_mask_reg); - mask &= ~(regs->int_dl_cpu2pciea | regs->int_comaout | - regs->int_comaerr); - iowrite32(mask, regs->enpointa_mask_reg); + iowrite32(0, regs + CPU_ARM_TO_PCIEA_MASK_REG); + mask = ioread32(regs + CPU_ENPOINTA_MASK_REG); + mask &= ~(INT_MAP_DL_CPU2PCIEA | INT_MAP_COMAOUT | INT_MAP_COMAERR); + iowrite32(mask, regs + CPU_ENPOINTA_MASK_REG); } static int mvumi_clear_intr(void *extend) { struct mvumi_hba *mhba = (struct mvumi_hba *) extend; unsigned int status, isr_status = 0, tmp = 0; - struct mvumi_hw_regs *regs = mhba->regs; + void *regs = mhba->mmio; - status = ioread32(regs->main_int_cause_reg); - if (!(status & regs->int_mu) || status == 0xFFFFFFFF) + status = ioread32(regs + CPU_MAIN_INT_CAUSE_REG); + if (!(status & INT_MAP_MU) || status == 0xFFFFFFFF) return 1; - if (unlikely(status & regs->int_comaerr)) { - tmp = ioread32(regs->outb_isr_cause); - if (mhba->pdev->device == PCI_DEVICE_ID_MARVELL_MV9580) { - if (tmp & regs->clic_out_err) { - iowrite32(tmp & regs->clic_out_err, - regs->outb_isr_cause); - } - } else { - if (tmp & (regs->clic_in_err | regs->clic_out_err)) - iowrite32(tmp & (regs->clic_in_err | - regs->clic_out_err), - regs->outb_isr_cause); - } - status ^= mhba->regs->int_comaerr; + if (unlikely(status & INT_MAP_COMAERR)) { + tmp = ioread32(regs + CLA_ISR_CAUSE); + if (tmp & (CLIC_IN_ERR_IRQ | CLIC_OUT_ERR_IRQ)) + iowrite32(tmp & (CLIC_IN_ERR_IRQ | CLIC_OUT_ERR_IRQ), + regs + CLA_ISR_CAUSE); + status ^= INT_MAP_COMAERR; /* inbound or outbound parity error, command will timeout */ } - if (status & regs->int_comaout) { - tmp = ioread32(regs->outb_isr_cause); - if (tmp & regs->clic_irq) - iowrite32(tmp & regs->clic_irq, regs->outb_isr_cause); + if (status & INT_MAP_COMAOUT) { + tmp = ioread32(regs + CLA_ISR_CAUSE); + if (tmp & CLIC_OUT_IRQ) + iowrite32(tmp & CLIC_OUT_IRQ, regs + CLA_ISR_CAUSE); } - if (status & regs->int_dl_cpu2pciea) { - isr_status = ioread32(regs->arm_to_pciea_drbl_reg); + if (status & INT_MAP_DL_CPU2PCIEA) { + isr_status = ioread32(regs + CPU_ARM_TO_PCIEA_DRBL_REG); if (isr_status) - iowrite32(isr_status, regs->arm_to_pciea_drbl_reg); + iowrite32(isr_status, regs + CPU_ARM_TO_PCIEA_DRBL_REG); } mhba->global_isr = status; @@ -2006,38 +1464,24 @@ static int mvumi_clear_intr(void *extend) /** * mvumi_read_fw_status_reg - returns the current FW status value - * @mhba: Adapter soft state + * @regs: FW register set */ -static unsigned int mvumi_read_fw_status_reg(struct mvumi_hba *mhba) +static unsigned int mvumi_read_fw_status_reg(void *regs) { unsigned int status; - status = ioread32(mhba->regs->arm_to_pciea_drbl_reg); + status = ioread32(regs + CPU_ARM_TO_PCIEA_DRBL_REG); if (status) - iowrite32(status, mhba->regs->arm_to_pciea_drbl_reg); + iowrite32(status, regs + CPU_ARM_TO_PCIEA_DRBL_REG); return status; } -static struct mvumi_instance_template mvumi_instance_9143 = { +static struct mvumi_instance_template mvumi_instance_template = { .fire_cmd = mvumi_fire_cmd, .enable_intr = mvumi_enable_intr, .disable_intr = mvumi_disable_intr, .clear_intr = mvumi_clear_intr, .read_fw_status_reg = mvumi_read_fw_status_reg, - .check_ib_list = mvumi_check_ib_list_9143, - .check_ob_list = mvumi_check_ob_list_9143, - .reset_host = mvumi_reset_host_9143, -}; - -static struct mvumi_instance_template mvumi_instance_9580 = { - .fire_cmd = mvumi_fire_cmd, - .enable_intr = mvumi_enable_intr, - .disable_intr = mvumi_disable_intr, - .clear_intr = mvumi_clear_intr, - .read_fw_status_reg = mvumi_read_fw_status_reg, - .check_ib_list = mvumi_check_ib_list_9580, - .check_ob_list = mvumi_check_ob_list_9580, - .reset_host = mvumi_reset_host_9580, }; static int mvumi_slave_configure(struct scsi_device *sdev) @@ -2237,124 +1681,6 @@ static struct scsi_transport_template mvumi_transport_template = { .eh_timed_out = mvumi_timed_out, }; -static int mvumi_cfg_hw_reg(struct mvumi_hba *mhba) -{ - void *base = NULL; - struct mvumi_hw_regs *regs; - - switch (mhba->pdev->device) { - case PCI_DEVICE_ID_MARVELL_MV9143: - mhba->mmio = mhba->base_addr[0]; - base = mhba->mmio; - if (!mhba->regs) { - mhba->regs = kzalloc(sizeof(*regs), GFP_KERNEL); - if (mhba->regs == NULL) - return -ENOMEM; - } - regs = mhba->regs; - - /* For Arm */ - regs->ctrl_sts_reg = base + 0x20104; - regs->rstoutn_mask_reg = base + 0x20108; - regs->sys_soft_rst_reg = base + 0x2010C; - regs->main_int_cause_reg = base + 0x20200; - regs->enpointa_mask_reg = base + 0x2020C; - regs->rstoutn_en_reg = base + 0xF1400; - /* For Doorbell */ - regs->pciea_to_arm_drbl_reg = base + 0x20400; - regs->arm_to_pciea_drbl_reg = base + 0x20408; - regs->arm_to_pciea_mask_reg = base + 0x2040C; - regs->pciea_to_arm_msg0 = base + 0x20430; - regs->pciea_to_arm_msg1 = base + 0x20434; - regs->arm_to_pciea_msg0 = base + 0x20438; - regs->arm_to_pciea_msg1 = base + 0x2043C; - - /* For Message Unit */ - - regs->inb_aval_count_basel = base + 0x508; - regs->inb_aval_count_baseh = base + 0x50C; - regs->inb_write_pointer = base + 0x518; - regs->inb_read_pointer = base + 0x51C; - regs->outb_coal_cfg = base + 0x568; - regs->outb_copy_basel = base + 0x5B0; - regs->outb_copy_baseh = base + 0x5B4; - regs->outb_copy_pointer = base + 0x544; - regs->outb_read_pointer = base + 0x548; - regs->outb_isr_cause = base + 0x560; - regs->outb_coal_cfg = base + 0x568; - /* Bit setting for HW */ - regs->int_comaout = 1 << 8; - regs->int_comaerr = 1 << 6; - regs->int_dl_cpu2pciea = 1 << 1; - regs->cl_pointer_toggle = 1 << 12; - regs->clic_irq = 1 << 1; - regs->clic_in_err = 1 << 8; - regs->clic_out_err = 1 << 12; - regs->cl_slot_num_mask = 0xFFF; - regs->int_drbl_int_mask = 0x3FFFFFFF; - regs->int_mu = regs->int_dl_cpu2pciea | regs->int_comaout | - regs->int_comaerr; - break; - case PCI_DEVICE_ID_MARVELL_MV9580: - mhba->mmio = mhba->base_addr[2]; - base = mhba->mmio; - if (!mhba->regs) { - mhba->regs = kzalloc(sizeof(*regs), GFP_KERNEL); - if (mhba->regs == NULL) - return -ENOMEM; - } - regs = mhba->regs; - /* For Arm */ - regs->ctrl_sts_reg = base + 0x20104; - regs->rstoutn_mask_reg = base + 0x1010C; - regs->sys_soft_rst_reg = base + 0x10108; - regs->main_int_cause_reg = base + 0x10200; - regs->enpointa_mask_reg = base + 0x1020C; - regs->rstoutn_en_reg = base + 0xF1400; - - /* For Doorbell */ - regs->pciea_to_arm_drbl_reg = base + 0x10460; - regs->arm_to_pciea_drbl_reg = base + 0x10480; - regs->arm_to_pciea_mask_reg = base + 0x10484; - regs->pciea_to_arm_msg0 = base + 0x10400; - regs->pciea_to_arm_msg1 = base + 0x10404; - regs->arm_to_pciea_msg0 = base + 0x10420; - regs->arm_to_pciea_msg1 = base + 0x10424; - - /* For reset*/ - regs->reset_request = base + 0x10108; - regs->reset_enable = base + 0x1010c; - - /* For Message Unit */ - regs->inb_aval_count_basel = base + 0x4008; - regs->inb_aval_count_baseh = base + 0x400C; - regs->inb_write_pointer = base + 0x4018; - regs->inb_read_pointer = base + 0x401C; - regs->outb_copy_basel = base + 0x4058; - regs->outb_copy_baseh = base + 0x405C; - regs->outb_copy_pointer = base + 0x406C; - regs->outb_read_pointer = base + 0x4070; - regs->outb_coal_cfg = base + 0x4080; - regs->outb_isr_cause = base + 0x4088; - /* Bit setting for HW */ - regs->int_comaout = 1 << 4; - regs->int_dl_cpu2pciea = 1 << 12; - regs->int_comaerr = 1 << 29; - regs->cl_pointer_toggle = 1 << 14; - regs->cl_slot_num_mask = 0x3FFF; - regs->clic_irq = 1 << 0; - regs->clic_out_err = 1 << 1; - regs->int_drbl_int_mask = 0x3FFFFFFF; - regs->int_mu = regs->int_dl_cpu2pciea | regs->int_comaout; - break; - default: - return -1; - break; - } - - return 0; -} - /** * mvumi_init_fw - Initializes the FW * @mhba: Adapter soft state @@ -2373,18 +1699,15 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) if (ret) goto fail_ioremap; + mhba->mmio = mhba->base_addr[0]; + switch (mhba->pdev->device) { case PCI_DEVICE_ID_MARVELL_MV9143: - mhba->instancet = &mvumi_instance_9143; + mhba->instancet = &mvumi_instance_template; mhba->io_seq = 0; mhba->max_sge = MVUMI_MAX_SG_ENTRY; mhba->request_id_enabled = 1; break; - case PCI_DEVICE_ID_MARVELL_MV9580: - mhba->instancet = &mvumi_instance_9580; - mhba->io_seq = 0; - mhba->max_sge = MVUMI_MAX_SG_ENTRY; - break; default: dev_err(&mhba->pdev->dev, "device 0x%x not supported!\n", mhba->pdev->device); @@ -2394,21 +1717,15 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) } dev_dbg(&mhba->pdev->dev, "device id : %04X is found.\n", mhba->pdev->device); - ret = mvumi_cfg_hw_reg(mhba); - if (ret) { - dev_err(&mhba->pdev->dev, - "failed to allocate memory for reg\n"); - ret = -ENOMEM; - goto fail_alloc_mem; - } - mhba->handshake_page = pci_alloc_consistent(mhba->pdev, HSP_MAX_SIZE, - &mhba->handshake_page_phys); + + mhba->handshake_page = kzalloc(HSP_MAX_SIZE, GFP_KERNEL); if (!mhba->handshake_page) { dev_err(&mhba->pdev->dev, "failed to allocate memory for handshake\n"); ret = -ENOMEM; - goto fail_alloc_page; + goto fail_alloc_mem; } + mhba->handshake_page_phys = virt_to_phys(mhba->handshake_page); if (mvumi_start(mhba)) { ret = -EINVAL; @@ -2422,10 +1739,7 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) fail_ready_state: mvumi_release_mem_resource(mhba); - pci_free_consistent(mhba->pdev, HSP_MAX_SIZE, - mhba->handshake_page, mhba->handshake_page_phys); -fail_alloc_page: - kfree(mhba->regs); + kfree(mhba->handshake_page); fail_alloc_mem: mvumi_unmap_pci_addr(mhba->pdev, mhba->base_addr); fail_ioremap: @@ -2441,7 +1755,6 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) static int mvumi_io_attach(struct mvumi_hba *mhba) { struct Scsi_Host *host = mhba->shost; - struct scsi_device *sdev = NULL; int ret; unsigned int max_sg = (mhba->ib_max_size + 4 - sizeof(struct mvumi_msg_frame)) / sizeof(struct mvumi_sgl); @@ -2451,7 +1764,7 @@ static int mvumi_io_attach(struct mvumi_hba *mhba) host->can_queue = (mhba->max_io - 1) ? (mhba->max_io - 1) : 1; host->sg_tablesize = mhba->max_sge > max_sg ? max_sg : mhba->max_sge; host->max_sectors = mhba->max_transfer_size / 512; - host->cmd_per_lun = (mhba->max_io - 1) ? (mhba->max_io - 1) : 1; + host->cmd_per_lun = (mhba->max_io - 1) ? (mhba->max_io - 1) : 1; host->max_id = mhba->max_target_id; host->max_cmd_len = MAX_COMMAND_SIZE; host->transportt = &mvumi_transport_template; @@ -2462,43 +1775,9 @@ static int mvumi_io_attach(struct mvumi_hba *mhba) return ret; } mhba->fw_flag |= MVUMI_FW_ATTACH; + scsi_scan_host(host); - mutex_lock(&mhba->sas_discovery_mutex); - if (mhba->pdev->device == PCI_DEVICE_ID_MARVELL_MV9580) - ret = scsi_add_device(host, 0, mhba->max_target_id - 1, 0); - else - ret = 0; - if (ret) { - dev_err(&mhba->pdev->dev, "add virtual device failed\n"); - mutex_unlock(&mhba->sas_discovery_mutex); - goto fail_add_device; - } - - mhba->dm_thread = kthread_create(mvumi_rescan_bus, - mhba, "mvumi_scanthread"); - if (IS_ERR(mhba->dm_thread)) { - dev_err(&mhba->pdev->dev, - "failed to create device scan thread\n"); - mutex_unlock(&mhba->sas_discovery_mutex); - goto fail_create_thread; - } - atomic_set(&mhba->pnp_count, 1); - wake_up_process(mhba->dm_thread); - - mutex_unlock(&mhba->sas_discovery_mutex); return 0; - -fail_create_thread: - if (mhba->pdev->device == PCI_DEVICE_ID_MARVELL_MV9580) - sdev = scsi_device_lookup(mhba->shost, 0, - mhba->max_target_id - 1, 0); - if (sdev) { - scsi_remove_device(sdev); - scsi_device_put(sdev); - } -fail_add_device: - scsi_remove_host(mhba->shost); - return ret; } /** @@ -2549,12 +1828,8 @@ static int __devinit mvumi_probe_one(struct pci_dev *pdev, INIT_LIST_HEAD(&mhba->free_ob_list); INIT_LIST_HEAD(&mhba->res_list); INIT_LIST_HEAD(&mhba->waiting_req_list); - mutex_init(&mhba->device_lock); - INIT_LIST_HEAD(&mhba->mhba_dev_list); - INIT_LIST_HEAD(&mhba->shost_dev_list); atomic_set(&mhba->fw_outstanding, 0); init_waitqueue_head(&mhba->int_cmd_wait_q); - mutex_init(&mhba->sas_discovery_mutex); mhba->pdev = pdev; mhba->shost = host; @@ -2570,22 +1845,19 @@ static int __devinit mvumi_probe_one(struct pci_dev *pdev, dev_err(&pdev->dev, "failed to register IRQ\n"); goto fail_init_irq; } - - mhba->instancet->enable_intr(mhba); + mhba->instancet->enable_intr(mhba->mmio); pci_set_drvdata(pdev, mhba); ret = mvumi_io_attach(mhba); if (ret) goto fail_io_attach; - - mvumi_backup_bar_addr(mhba); dev_dbg(&pdev->dev, "probe mvumi driver successfully.\n"); return 0; fail_io_attach: pci_set_drvdata(pdev, NULL); - mhba->instancet->disable_intr(mhba); + mhba->instancet->disable_intr(mhba->mmio); free_irq(mhba->pdev->irq, mhba); fail_init_irq: mvumi_release_fw(mhba); @@ -2605,17 +1877,11 @@ static void mvumi_detach_one(struct pci_dev *pdev) struct mvumi_hba *mhba; mhba = pci_get_drvdata(pdev); - if (mhba->dm_thread) { - kthread_stop(mhba->dm_thread); - mhba->dm_thread = NULL; - } - - mvumi_detach_devices(mhba); host = mhba->shost; scsi_remove_host(mhba->shost); mvumi_flush_cache(mhba); - mhba->instancet->disable_intr(mhba); + mhba->instancet->disable_intr(mhba->mmio); free_irq(mhba->pdev->irq, mhba); mvumi_release_fw(mhba); scsi_host_put(host); @@ -2643,7 +1909,7 @@ static int mvumi_suspend(struct pci_dev *pdev, pm_message_t state) mvumi_flush_cache(mhba); pci_set_drvdata(pdev, mhba); - mhba->instancet->disable_intr(mhba); + mhba->instancet->disable_intr(mhba->mmio); free_irq(mhba->pdev->irq, mhba); mvumi_unmap_pci_addr(pdev, mhba->base_addr); pci_release_regions(pdev); @@ -2690,13 +1956,8 @@ static int mvumi_resume(struct pci_dev *pdev) if (ret) goto release_regions; - if (mvumi_cfg_hw_reg(mhba)) { - ret = -EINVAL; - goto unmap_pci_addr; - } - mhba->mmio = mhba->base_addr[0]; - mvumi_reset(mhba); + mvumi_reset(mhba->mmio); if (mvumi_start(mhba)) { ret = -EINVAL; @@ -2709,7 +1970,7 @@ static int mvumi_resume(struct pci_dev *pdev) dev_err(&pdev->dev, "failed to register IRQ\n"); goto unmap_pci_addr; } - mhba->instancet->enable_intr(mhba); + mhba->instancet->enable_intr(mhba->mmio); return 0; diff --git a/trunk/drivers/scsi/mvumi.h b/trunk/drivers/scsi/mvumi.h index e360135fd1bd..10b9237566f0 100644 --- a/trunk/drivers/scsi/mvumi.h +++ b/trunk/drivers/scsi/mvumi.h @@ -34,87 +34,51 @@ #define MV_DRIVER_NAME "mvumi" #define PCI_VENDOR_ID_MARVELL_2 0x1b4b #define PCI_DEVICE_ID_MARVELL_MV9143 0x9143 -#define PCI_DEVICE_ID_MARVELL_MV9580 0x9580 #define MVUMI_INTERNAL_CMD_WAIT_TIME 45 -#define MVUMI_INQUIRY_LENGTH 44 -#define MVUMI_INQUIRY_UUID_OFF 36 -#define MVUMI_INQUIRY_UUID_LEN 8 #define IS_DMA64 (sizeof(dma_addr_t) == 8) enum mvumi_qc_result { - MV_QUEUE_COMMAND_RESULT_SENT = 0, + MV_QUEUE_COMMAND_RESULT_SENT = 0, MV_QUEUE_COMMAND_RESULT_NO_RESOURCE, }; -struct mvumi_hw_regs { - /* For CPU */ - void *main_int_cause_reg; - void *enpointa_mask_reg; - void *enpointb_mask_reg; - void *rstoutn_en_reg; - void *ctrl_sts_reg; - void *rstoutn_mask_reg; - void *sys_soft_rst_reg; - - /* For Doorbell */ - void *pciea_to_arm_drbl_reg; - void *arm_to_pciea_drbl_reg; - void *arm_to_pciea_mask_reg; - void *pciea_to_arm_msg0; - void *pciea_to_arm_msg1; - void *arm_to_pciea_msg0; - void *arm_to_pciea_msg1; - - /* reset register */ - void *reset_request; - void *reset_enable; - - /* For Message Unit */ - void *inb_list_basel; - void *inb_list_baseh; - void *inb_aval_count_basel; - void *inb_aval_count_baseh; - void *inb_write_pointer; - void *inb_read_pointer; - void *outb_list_basel; - void *outb_list_baseh; - void *outb_copy_basel; - void *outb_copy_baseh; - void *outb_copy_pointer; - void *outb_read_pointer; - void *inb_isr_cause; - void *outb_isr_cause; - void *outb_coal_cfg; - void *outb_coal_timeout; - - /* Bit setting for HW */ - u32 int_comaout; - u32 int_comaerr; - u32 int_dl_cpu2pciea; - u32 int_mu; - u32 int_drbl_int_mask; - u32 int_main_int_mask; - u32 cl_pointer_toggle; - u32 cl_slot_num_mask; - u32 clic_irq; - u32 clic_in_err; - u32 clic_out_err; -}; +enum { + /*******************************************/ -struct mvumi_dyn_list_entry { - u32 src_low_addr; - u32 src_high_addr; - u32 if_length; - u32 reserve; -}; + /* ARM Mbus Registers Map */ -#define SCSI_CMD_MARVELL_SPECIFIC 0xE1 -#define CDB_CORE_MODULE 0x1 -#define CDB_CORE_SHUTDOWN 0xB + /*******************************************/ + CPU_MAIN_INT_CAUSE_REG = 0x20200, + CPU_MAIN_IRQ_MASK_REG = 0x20204, + CPU_MAIN_FIQ_MASK_REG = 0x20208, + CPU_ENPOINTA_MASK_REG = 0x2020C, + CPU_ENPOINTB_MASK_REG = 0x20210, + + INT_MAP_COMAERR = 1 << 6, + INT_MAP_COMAIN = 1 << 7, + INT_MAP_COMAOUT = 1 << 8, + INT_MAP_COMBERR = 1 << 9, + INT_MAP_COMBIN = 1 << 10, + INT_MAP_COMBOUT = 1 << 11, + + INT_MAP_COMAINT = (INT_MAP_COMAOUT | INT_MAP_COMAERR), + INT_MAP_COMBINT = (INT_MAP_COMBOUT | INT_MAP_COMBIN | INT_MAP_COMBERR), + + INT_MAP_DL_PCIEA2CPU = 1 << 0, + INT_MAP_DL_CPU2PCIEA = 1 << 1, + + /***************************************/ + + /* ARM Doorbell Registers Map */ + + /***************************************/ + CPU_PCIEA_TO_ARM_DRBL_REG = 0x20400, + CPU_PCIEA_TO_ARM_MASK_REG = 0x20404, + CPU_ARM_TO_PCIEA_DRBL_REG = 0x20408, + CPU_ARM_TO_PCIEA_MASK_REG = 0x2040C, -enum { DRBL_HANDSHAKE = 1 << 0, DRBL_SOFT_RESET = 1 << 1, DRBL_BUS_CHANGE = 1 << 2, @@ -122,6 +86,46 @@ enum { DRBL_MU_RESET = 1 << 4, DRBL_HANDSHAKE_ISR = DRBL_HANDSHAKE, + CPU_PCIEA_TO_ARM_MSG0 = 0x20430, + CPU_PCIEA_TO_ARM_MSG1 = 0x20434, + CPU_ARM_TO_PCIEA_MSG0 = 0x20438, + CPU_ARM_TO_PCIEA_MSG1 = 0x2043C, + + /*******************************************/ + + /* ARM Communication List Registers Map */ + + /*******************************************/ + CLA_INB_LIST_BASEL = 0x500, + CLA_INB_LIST_BASEH = 0x504, + CLA_INB_AVAL_COUNT_BASEL = 0x508, + CLA_INB_AVAL_COUNT_BASEH = 0x50C, + CLA_INB_DESTI_LIST_BASEL = 0x510, + CLA_INB_DESTI_LIST_BASEH = 0x514, + CLA_INB_WRITE_POINTER = 0x518, + CLA_INB_READ_POINTER = 0x51C, + + CLA_OUTB_LIST_BASEL = 0x530, + CLA_OUTB_LIST_BASEH = 0x534, + CLA_OUTB_SOURCE_LIST_BASEL = 0x538, + CLA_OUTB_SOURCE_LIST_BASEH = 0x53C, + CLA_OUTB_COPY_POINTER = 0x544, + CLA_OUTB_READ_POINTER = 0x548, + + CLA_ISR_CAUSE = 0x560, + CLA_ISR_MASK = 0x564, + + INT_MAP_MU = (INT_MAP_DL_CPU2PCIEA | INT_MAP_COMAINT), + + CL_POINTER_TOGGLE = 1 << 12, + + CLIC_IN_IRQ = 1 << 0, + CLIC_OUT_IRQ = 1 << 1, + CLIC_IN_ERR_IRQ = 1 << 8, + CLIC_OUT_ERR_IRQ = 1 << 12, + + CL_SLOT_NUM_MASK = 0xFFF, + /* * Command flag is the flag for the CDB command itself */ @@ -133,23 +137,15 @@ enum { CMD_FLAG_DATA_IN = 1 << 3, /* 1-host write data */ CMD_FLAG_DATA_OUT = 1 << 4, - CMD_FLAG_PRDT_IN_HOST = 1 << 5, + + SCSI_CMD_MARVELL_SPECIFIC = 0xE1, + CDB_CORE_SHUTDOWN = 0xB, }; #define APICDB0_EVENT 0xF4 #define APICDB1_EVENT_GETEVENT 0 -#define APICDB1_HOST_GETEVENT 1 #define MAX_EVENTS_RETURNED 6 -#define DEVICE_OFFLINE 0 -#define DEVICE_ONLINE 1 - -struct mvumi_hotplug_event { - u16 size; - u8 dummy[2]; - u8 bitmap[0]; -}; - struct mvumi_driver_event { u32 time_stamp; u32 sequence_no; @@ -176,14 +172,8 @@ struct mvumi_events_wq { void *param; }; -#define HS_CAPABILITY_SUPPORT_COMPACT_SG (1U << 4) -#define HS_CAPABILITY_SUPPORT_PRD_HOST (1U << 5) -#define HS_CAPABILITY_SUPPORT_DYN_SRC (1U << 6) -#define HS_CAPABILITY_NEW_PAGE_IO_DEPTH_DEF (1U << 14) - #define MVUMI_MAX_SG_ENTRY 32 #define SGD_EOT (1L << 27) -#define SGD_EOT_CP (1L << 22) struct mvumi_sgl { u32 baseaddr_l; @@ -191,39 +181,6 @@ struct mvumi_sgl { u32 flags; u32 size; }; -struct mvumi_compact_sgl { - u32 baseaddr_l; - u32 baseaddr_h; - u32 flags; -}; - -#define GET_COMPACT_SGD_SIZE(sgd) \ - ((((struct mvumi_compact_sgl *)(sgd))->flags) & 0x3FFFFFL) - -#define SET_COMPACT_SGD_SIZE(sgd, sz) do { \ - (((struct mvumi_compact_sgl *)(sgd))->flags) &= ~0x3FFFFFL; \ - (((struct mvumi_compact_sgl *)(sgd))->flags) |= (sz); \ -} while (0) -#define sgd_getsz(_mhba, sgd, sz) do { \ - if (_mhba->hba_capability & HS_CAPABILITY_SUPPORT_COMPACT_SG) \ - (sz) = GET_COMPACT_SGD_SIZE(sgd); \ - else \ - (sz) = (sgd)->size; \ -} while (0) - -#define sgd_setsz(_mhba, sgd, sz) do { \ - if (_mhba->hba_capability & HS_CAPABILITY_SUPPORT_COMPACT_SG) \ - SET_COMPACT_SGD_SIZE(sgd, sz); \ - else \ - (sgd)->size = (sz); \ -} while (0) - -#define sgd_inc(_mhba, sgd) do { \ - if (_mhba->hba_capability & HS_CAPABILITY_SUPPORT_COMPACT_SG) \ - sgd = (struct mvumi_sgl *)(((unsigned char *) (sgd)) + 12); \ - else \ - sgd = (struct mvumi_sgl *)(((unsigned char *) (sgd)) + 16); \ -} while (0) struct mvumi_res { struct list_head entry; @@ -240,7 +197,7 @@ enum resource_type { }; struct mvumi_sense_data { - u8 error_code:7; + u8 error_eode:7; u8 valid:1; u8 segment_number; u8 sense_key:4; @@ -263,7 +220,6 @@ struct mvumi_sense_data { struct mvumi_cmd { struct list_head queue_pointer; struct mvumi_msg_frame *frame; - dma_addr_t frame_phys; struct scsi_cmnd *scmd; atomic_t sync_cmd; void *data_buf; @@ -437,8 +393,7 @@ struct mvumi_hs_page2 { u16 frame_length; u8 host_type; - u8 host_cap; - u8 reserved[2]; + u8 reserved[3]; struct version_info host_ver; u32 system_io_bus; u32 slot_number; @@ -480,17 +435,8 @@ struct mvumi_tag { unsigned short size; }; -struct mvumi_device { - struct list_head list; - struct scsi_device *sdev; - u64 wwid; - u8 dev_type; - int id; -}; - struct mvumi_hba { void *base_addr[MAX_BASE_ADDRESS]; - u32 pci_base[MAX_BASE_ADDRESS]; void *mmio; struct list_head cmd_pool; struct Scsi_Host *shost; @@ -503,9 +449,6 @@ struct mvumi_hba { void *ib_list; dma_addr_t ib_list_phys; - void *ib_frame; - dma_addr_t ib_frame_phys; - void *ob_list; dma_addr_t ob_list_phys; @@ -534,14 +477,12 @@ struct mvumi_hba { unsigned char hba_total_pages; unsigned char fw_flag; unsigned char request_id_enabled; - unsigned char eot_flag; unsigned short hba_capability; unsigned short io_seq; unsigned int ib_cur_slot; unsigned int ob_cur_slot; unsigned int fw_state; - struct mutex sas_discovery_mutex; struct list_head ob_data_list; struct list_head free_ob_list; @@ -550,24 +491,14 @@ struct mvumi_hba { struct mvumi_tag tag_pool; struct mvumi_cmd **tag_cmd; - struct mvumi_hw_regs *regs; - struct mutex device_lock; - struct list_head mhba_dev_list; - struct list_head shost_dev_list; - struct task_struct *dm_thread; - atomic_t pnp_count; }; struct mvumi_instance_template { - void (*fire_cmd) (struct mvumi_hba *, struct mvumi_cmd *); - void (*enable_intr) (struct mvumi_hba *); - void (*disable_intr) (struct mvumi_hba *); - int (*clear_intr) (void *); - unsigned int (*read_fw_status_reg) (struct mvumi_hba *); - unsigned int (*check_ib_list) (struct mvumi_hba *); - int (*check_ob_list) (struct mvumi_hba *, unsigned int *, - unsigned int *); - int (*reset_host) (struct mvumi_hba *); + void (*fire_cmd)(struct mvumi_hba *, struct mvumi_cmd *); + void (*enable_intr)(void *) ; + void (*disable_intr)(void *); + int (*clear_intr)(void *); + unsigned int (*read_fw_status_reg)(void *); }; extern struct timezone sys_tz; diff --git a/trunk/drivers/scsi/qla2xxx/qla_init.c b/trunk/drivers/scsi/qla2xxx/qla_init.c index 48fca47384b7..799a58bb9859 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_init.c +++ b/trunk/drivers/scsi/qla2xxx/qla_init.c @@ -2080,7 +2080,6 @@ qla2x00_configure_hba(scsi_qla_host_t *vha) uint8_t domain; char connect_type[22]; struct qla_hw_data *ha = vha->hw; - unsigned long flags; /* Get host addresses. */ rval = qla2x00_get_adapter_id(vha, @@ -2155,9 +2154,9 @@ qla2x00_configure_hba(scsi_qla_host_t *vha) vha->d_id.b.area = area; vha->d_id.b.al_pa = al_pa; - spin_lock_irqsave(&ha->vport_slock, flags); + spin_lock(&ha->vport_slock); qlt_update_vp_map(vha, SET_AL_PA); - spin_unlock_irqrestore(&ha->vport_slock, flags); + spin_unlock(&ha->vport_slock); if (!vha->flags.init_done) ql_log(ql_log_info, vha, 0x2010, diff --git a/trunk/drivers/scsi/scsi_debug.c b/trunk/drivers/scsi/scsi_debug.c index 5cda11c07c68..57fbd5a3d4e2 100644 --- a/trunk/drivers/scsi/scsi_debug.c +++ b/trunk/drivers/scsi/scsi_debug.c @@ -2055,7 +2055,7 @@ static void unmap_region(sector_t lba, unsigned int len) block = lba + alignment; rem = do_div(block, granularity); - if (rem == 0 && lba + granularity < end && block < map_size) { + if (rem == 0 && lba + granularity <= end && block < map_size) { clear_bit(block, map_storep); if (scsi_debug_lbprz) memset(fake_storep + diff --git a/trunk/drivers/scsi/scsi_error.c b/trunk/drivers/scsi/scsi_error.c index c1b05a83d403..de2337f255a7 100644 --- a/trunk/drivers/scsi/scsi_error.c +++ b/trunk/drivers/scsi/scsi_error.c @@ -789,6 +789,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, int cmnd_size, int timeout, unsigned sense_bytes) { struct scsi_device *sdev = scmd->device; + struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); struct Scsi_Host *shost = sdev->host; DECLARE_COMPLETION_ONSTACK(done); unsigned long timeleft; @@ -844,11 +845,8 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, scsi_eh_restore_cmnd(scmd, &ses); - if (scmd->request->cmd_type != REQ_TYPE_BLOCK_PC) { - struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); - if (sdrv->eh_action) - rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); - } + if (sdrv && sdrv->eh_action) + rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); return rtn; } diff --git a/trunk/drivers/scsi/storvsc_drv.c b/trunk/drivers/scsi/storvsc_drv.c index 01440782feb2..528d52beaa1c 100644 --- a/trunk/drivers/scsi/storvsc_drv.c +++ b/trunk/drivers/scsi/storvsc_drv.c @@ -1221,12 +1221,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) /* * At this point, all outstanding requests in the adapter * should have been flushed out and return to us - * There is a potential race here where the host may be in - * the process of responding when we return from here. - * Just wait for all in-transit packets to be accounted for - * before we return from here. */ - storvsc_wait_to_drain(stor_device); return SUCCESS; } diff --git a/trunk/drivers/scsi/virtio_scsi.c b/trunk/drivers/scsi/virtio_scsi.c index 595af1ae4421..3e79a2f00042 100644 --- a/trunk/drivers/scsi/virtio_scsi.c +++ b/trunk/drivers/scsi/virtio_scsi.c @@ -219,7 +219,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi, struct scatterlist sg; unsigned long flags; - sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); + sg_set_buf(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); @@ -279,31 +279,6 @@ static void virtscsi_handle_transport_reset(struct virtio_scsi *vscsi, } } -static void virtscsi_handle_param_change(struct virtio_scsi *vscsi, - struct virtio_scsi_event *event) -{ - struct scsi_device *sdev; - struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev); - unsigned int target = event->lun[1]; - unsigned int lun = (event->lun[2] << 8) | event->lun[3]; - u8 asc = event->reason & 255; - u8 ascq = event->reason >> 8; - - sdev = scsi_device_lookup(shost, 0, target, lun); - if (!sdev) { - pr_err("SCSI device %d 0 %d %d not found\n", - shost->host_no, target, lun); - return; - } - - /* Handle "Parameters changed", "Mode parameters changed", and - "Capacity data has changed". */ - if (asc == 0x2a && (ascq == 0x00 || ascq == 0x01 || ascq == 0x09)) - scsi_rescan_device(&sdev->sdev_gendev); - - scsi_device_put(sdev); -} - static void virtscsi_handle_event(struct work_struct *work) { struct virtio_scsi_event_node *event_node = @@ -322,9 +297,6 @@ static void virtscsi_handle_event(struct work_struct *work) case VIRTIO_SCSI_T_TRANSPORT_RESET: virtscsi_handle_transport_reset(vscsi, event); break; - case VIRTIO_SCSI_T_PARAM_CHANGE: - virtscsi_handle_param_change(vscsi, event); - break; default: pr_err("Unsupport virtio scsi event %x\n", event->event); } @@ -705,11 +677,7 @@ static int __devinit virtscsi_probe(struct virtio_device *vdev) cmd_per_lun = virtscsi_config_get(vdev, cmd_per_lun) ?: 1; shost->cmd_per_lun = min_t(u32, cmd_per_lun, shost->can_queue); shost->max_sectors = virtscsi_config_get(vdev, max_sectors) ?: 0xFFFF; - - /* LUNs > 256 are reported with format 1, so they go in the range - * 16640-32767. - */ - shost->max_lun = virtscsi_config_get(vdev, max_lun) + 1 + 0x4000; + shost->max_lun = virtscsi_config_get(vdev, max_lun) + 1; shost->max_id = num_targets; shost->max_channel = 0; shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE; @@ -765,8 +733,7 @@ static struct virtio_device_id id_table[] = { }; static unsigned int features[] = { - VIRTIO_SCSI_F_HOTPLUG, - VIRTIO_SCSI_F_CHANGE, + VIRTIO_SCSI_F_HOTPLUG }; static struct virtio_driver virtio_scsi_driver = { diff --git a/trunk/drivers/staging/omap-thermal/omap-thermal-common.c b/trunk/drivers/staging/omap-thermal/omap-thermal-common.c index 5c0c203b887f..46ee0a9f49d9 100644 --- a/trunk/drivers/staging/omap-thermal/omap-thermal-common.c +++ b/trunk/drivers/staging/omap-thermal/omap-thermal-common.c @@ -126,9 +126,7 @@ static int omap_thermal_bind(struct thermal_zone_device *thermal, /* TODO: bind with min and max states */ /* Simple thing, two trips, one passive another critical */ - return thermal_zone_bind_cooling_device(thermal, 0, cdev, - THERMAL_NO_LIMIT, - THERMAL_NO_LIMIT); + return thermal_zone_bind_cooling_device(thermal, 0, cdev); } /* Unbind callback functions for thermal zone */ @@ -270,6 +268,7 @@ int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id, /* Create thermal zone */ data->omap_thermal = thermal_zone_device_register(domain, OMAP_TRIP_NUMBER, 0, data, &omap_thermal_ops, + 1, 2, /*TODO: remove this when FW allows */ FAST_TEMP_MONITORING_RATE, FAST_TEMP_MONITORING_RATE); if (IS_ERR_OR_NULL(data->omap_thermal)) { diff --git a/trunk/drivers/thermal/Kconfig b/trunk/drivers/thermal/Kconfig index edfd67d25013..3ab2bd540b54 100644 --- a/trunk/drivers/thermal/Kconfig +++ b/trunk/drivers/thermal/Kconfig @@ -19,17 +19,6 @@ config THERMAL_HWMON depends on HWMON=y || HWMON=THERMAL default y -config CPU_THERMAL - bool "generic cpu cooling support" - depends on THERMAL && CPU_FREQ - help - This implements the generic cpu cooling mechanism through frequency - reduction, cpu hotplug and any other ways of reducing temperature. An - ACPI version of this already exists(drivers/acpi/processor_thermal.c). - This will be useful for platforms using the generic thermal interface - and not the ACPI interface. - If you want this support, you should say Y here. - config SPEAR_THERMAL bool "SPEAr thermal sensor driver" depends on THERMAL @@ -38,18 +27,3 @@ config SPEAR_THERMAL help Enable this to plug the SPEAr thermal sensor driver into the Linux thermal framework - -config RCAR_THERMAL - tristate "Renesas R-Car thermal driver" - depends on THERMAL - depends on ARCH_SHMOBILE - help - Enable this to plug the R-Car thermal sensor driver into the Linux - thermal framework - -config EXYNOS_THERMAL - tristate "Temperature sensor on Samsung EXYNOS" - depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5) && THERMAL - help - If you say yes here you get support for TMU (Thermal Managment - Unit) on SAMSUNG EXYNOS series of SoC. diff --git a/trunk/drivers/thermal/Makefile b/trunk/drivers/thermal/Makefile index 885550dc64b7..a9fff0bf4b14 100644 --- a/trunk/drivers/thermal/Makefile +++ b/trunk/drivers/thermal/Makefile @@ -3,7 +3,4 @@ # obj-$(CONFIG_THERMAL) += thermal_sys.o -obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o -obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o -obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o +obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o \ No newline at end of file diff --git a/trunk/drivers/thermal/cpu_cooling.c b/trunk/drivers/thermal/cpu_cooling.c deleted file mode 100644 index cc1c930a90e4..000000000000 --- a/trunk/drivers/thermal/cpu_cooling.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * linux/drivers/thermal/cpu_cooling.c - * - * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) - * Copyright (C) 2012 Amit Daniel - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * 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; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - * struct cpufreq_cooling_device - * @id: unique integer value corresponding to each cpufreq_cooling_device - * registered. - * @cool_dev: thermal_cooling_device pointer to keep track of the the - * egistered cooling device. - * @cpufreq_state: integer value representing the current state of cpufreq - * cooling devices. - * @cpufreq_val: integer value representing the absolute value of the clipped - * frequency. - * @allowed_cpus: all the cpus involved for this cpufreq_cooling_device. - * @node: list_head to link all cpufreq_cooling_device together. - * - * This structure is required for keeping information of each - * cpufreq_cooling_device registered as a list whose head is represented by - * cooling_cpufreq_list. In order to prevent corruption of this list a - * mutex lock cooling_cpufreq_lock is used. - */ -struct cpufreq_cooling_device { - int id; - struct thermal_cooling_device *cool_dev; - unsigned int cpufreq_state; - unsigned int cpufreq_val; - struct cpumask allowed_cpus; - struct list_head node; -}; -static LIST_HEAD(cooling_cpufreq_list); -static DEFINE_IDR(cpufreq_idr); - -static struct mutex cooling_cpufreq_lock; - -/* notify_table passes value to the CPUFREQ_ADJUST callback function. */ -#define NOTIFY_INVALID NULL -struct cpufreq_cooling_device *notify_device; - -/** - * get_idr - function to get a unique id. - * @idr: struct idr * handle used to create a id. - * @id: int * value generated by this function. - */ -static int get_idr(struct idr *idr, int *id) -{ - int err; -again: - if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0)) - return -ENOMEM; - - mutex_lock(&cooling_cpufreq_lock); - err = idr_get_new(idr, NULL, id); - mutex_unlock(&cooling_cpufreq_lock); - - if (unlikely(err == -EAGAIN)) - goto again; - else if (unlikely(err)) - return err; - - *id = *id & MAX_IDR_MASK; - return 0; -} - -/** - * release_idr - function to free the unique id. - * @idr: struct idr * handle used for creating the id. - * @id: int value representing the unique id. - */ -static void release_idr(struct idr *idr, int id) -{ - mutex_lock(&cooling_cpufreq_lock); - idr_remove(idr, id); - mutex_unlock(&cooling_cpufreq_lock); -} - -/* Below code defines functions to be used for cpufreq as cooling device */ - -/** - * is_cpufreq_valid - function to check if a cpu has frequency transition policy. - * @cpu: cpu for which check is needed. - */ -static int is_cpufreq_valid(int cpu) -{ - struct cpufreq_policy policy; - return !cpufreq_get_policy(&policy, cpu); -} - -/** - * get_cpu_frequency - get the absolute value of frequency from level. - * @cpu: cpu for which frequency is fetched. - * @level: level of frequency of the CPU - * e.g level=1 --> 1st MAX FREQ, LEVEL=2 ---> 2nd MAX FREQ, .... etc - */ -static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level) -{ - int ret = 0, i = 0; - unsigned long level_index; - bool descend = false; - struct cpufreq_frequency_table *table = - cpufreq_frequency_get_table(cpu); - if (!table) - return ret; - - while (table[i].frequency != CPUFREQ_TABLE_END) { - if (table[i].frequency == CPUFREQ_ENTRY_INVALID) - continue; - - /*check if table in ascending or descending order*/ - if ((table[i + 1].frequency != CPUFREQ_TABLE_END) && - (table[i + 1].frequency < table[i].frequency) - && !descend) { - descend = true; - } - - /*return if level matched and table in descending order*/ - if (descend && i == level) - return table[i].frequency; - i++; - } - i--; - - if (level > i || descend) - return ret; - level_index = i - level; - - /*Scan the table in reverse order and match the level*/ - while (i >= 0) { - if (table[i].frequency == CPUFREQ_ENTRY_INVALID) - continue; - /*return if level matched*/ - if (i == level_index) - return table[i].frequency; - i--; - } - return ret; -} - -/** - * cpufreq_apply_cooling - function to apply frequency clipping. - * @cpufreq_device: cpufreq_cooling_device pointer containing frequency - * clipping data. - * @cooling_state: value of the cooling state. - */ -static int cpufreq_apply_cooling(struct cpufreq_cooling_device *cpufreq_device, - unsigned long cooling_state) -{ - unsigned int cpuid, clip_freq; - struct cpumask *maskPtr = &cpufreq_device->allowed_cpus; - unsigned int cpu = cpumask_any(maskPtr); - - - /* Check if the old cooling action is same as new cooling action */ - if (cpufreq_device->cpufreq_state == cooling_state) - return 0; - - clip_freq = get_cpu_frequency(cpu, cooling_state); - if (!clip_freq) - return -EINVAL; - - cpufreq_device->cpufreq_state = cooling_state; - cpufreq_device->cpufreq_val = clip_freq; - notify_device = cpufreq_device; - - for_each_cpu(cpuid, maskPtr) { - if (is_cpufreq_valid(cpuid)) - cpufreq_update_policy(cpuid); - } - - notify_device = NOTIFY_INVALID; - - return 0; -} - -/** - * cpufreq_thermal_notifier - notifier callback for cpufreq policy change. - * @nb: struct notifier_block * with callback info. - * @event: value showing cpufreq event for which this function invoked. - * @data: callback-specific data - */ -static int cpufreq_thermal_notifier(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct cpufreq_policy *policy = data; - unsigned long max_freq = 0; - - if (event != CPUFREQ_ADJUST || notify_device == NOTIFY_INVALID) - return 0; - - if (cpumask_test_cpu(policy->cpu, ¬ify_device->allowed_cpus)) - max_freq = notify_device->cpufreq_val; - - /* Never exceed user_policy.max*/ - if (max_freq > policy->user_policy.max) - max_freq = policy->user_policy.max; - - if (policy->max != max_freq) - cpufreq_verify_within_limits(policy, 0, max_freq); - - return 0; -} - -/* - * cpufreq cooling device callback functions are defined below - */ - -/** - * cpufreq_get_max_state - callback function to get the max cooling state. - * @cdev: thermal cooling device pointer. - * @state: fill this variable with the max cooling state. - */ -static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, - unsigned long *state) -{ - int ret = -EINVAL, i = 0; - struct cpufreq_cooling_device *cpufreq_device; - struct cpumask *maskPtr; - unsigned int cpu; - struct cpufreq_frequency_table *table; - - mutex_lock(&cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, &cooling_cpufreq_list, node) { - if (cpufreq_device && cpufreq_device->cool_dev == cdev) - break; - } - if (cpufreq_device == NULL) - goto return_get_max_state; - - maskPtr = &cpufreq_device->allowed_cpus; - cpu = cpumask_any(maskPtr); - table = cpufreq_frequency_get_table(cpu); - if (!table) { - *state = 0; - ret = 0; - goto return_get_max_state; - } - - while (table[i].frequency != CPUFREQ_TABLE_END) { - if (table[i].frequency == CPUFREQ_ENTRY_INVALID) - continue; - i++; - } - if (i > 0) { - *state = --i; - ret = 0; - } - -return_get_max_state: - mutex_unlock(&cooling_cpufreq_lock); - return ret; -} - -/** - * cpufreq_get_cur_state - callback function to get the current cooling state. - * @cdev: thermal cooling device pointer. - * @state: fill this variable with the current cooling state. - */ -static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, - unsigned long *state) -{ - int ret = -EINVAL; - struct cpufreq_cooling_device *cpufreq_device; - - mutex_lock(&cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, &cooling_cpufreq_list, node) { - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { - *state = cpufreq_device->cpufreq_state; - ret = 0; - break; - } - } - mutex_unlock(&cooling_cpufreq_lock); - - return ret; -} - -/** - * cpufreq_set_cur_state - callback function to set the current cooling state. - * @cdev: thermal cooling device pointer. - * @state: set this variable to the current cooling state. - */ -static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, - unsigned long state) -{ - int ret = -EINVAL; - struct cpufreq_cooling_device *cpufreq_device; - - mutex_lock(&cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, &cooling_cpufreq_list, node) { - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { - ret = 0; - break; - } - } - if (!ret) - ret = cpufreq_apply_cooling(cpufreq_device, state); - - mutex_unlock(&cooling_cpufreq_lock); - - return ret; -} - -/* Bind cpufreq callbacks to thermal cooling device ops */ -static struct thermal_cooling_device_ops const cpufreq_cooling_ops = { - .get_max_state = cpufreq_get_max_state, - .get_cur_state = cpufreq_get_cur_state, - .set_cur_state = cpufreq_set_cur_state, -}; - -/* Notifier for cpufreq policy change */ -static struct notifier_block thermal_cpufreq_notifier_block = { - .notifier_call = cpufreq_thermal_notifier, -}; - -/** - * cpufreq_cooling_register - function to create cpufreq cooling device. - * @clip_cpus: cpumask of cpus where the frequency constraints will happen. - */ -struct thermal_cooling_device *cpufreq_cooling_register( - struct cpumask *clip_cpus) -{ - struct thermal_cooling_device *cool_dev; - struct cpufreq_cooling_device *cpufreq_dev = NULL; - unsigned int cpufreq_dev_count = 0, min = 0, max = 0; - char dev_name[THERMAL_NAME_LENGTH]; - int ret = 0, i; - struct cpufreq_policy policy; - - list_for_each_entry(cpufreq_dev, &cooling_cpufreq_list, node) - cpufreq_dev_count++; - - /*Verify that all the clip cpus have same freq_min, freq_max limit*/ - for_each_cpu(i, clip_cpus) { - /*continue if cpufreq policy not found and not return error*/ - if (!cpufreq_get_policy(&policy, i)) - continue; - if (min == 0 && max == 0) { - min = policy.cpuinfo.min_freq; - max = policy.cpuinfo.max_freq; - } else { - if (min != policy.cpuinfo.min_freq || - max != policy.cpuinfo.max_freq) - return ERR_PTR(-EINVAL); -} - } - cpufreq_dev = kzalloc(sizeof(struct cpufreq_cooling_device), - GFP_KERNEL); - if (!cpufreq_dev) - return ERR_PTR(-ENOMEM); - - cpumask_copy(&cpufreq_dev->allowed_cpus, clip_cpus); - - if (cpufreq_dev_count == 0) - mutex_init(&cooling_cpufreq_lock); - - ret = get_idr(&cpufreq_idr, &cpufreq_dev->id); - if (ret) { - kfree(cpufreq_dev); - return ERR_PTR(-EINVAL); - } - - sprintf(dev_name, "thermal-cpufreq-%d", cpufreq_dev->id); - - cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev, - &cpufreq_cooling_ops); - if (!cool_dev) { - release_idr(&cpufreq_idr, cpufreq_dev->id); - kfree(cpufreq_dev); - return ERR_PTR(-EINVAL); - } - cpufreq_dev->cool_dev = cool_dev; - cpufreq_dev->cpufreq_state = 0; - mutex_lock(&cooling_cpufreq_lock); - list_add_tail(&cpufreq_dev->node, &cooling_cpufreq_list); - - /* Register the notifier for first cpufreq cooling device */ - if (cpufreq_dev_count == 0) - cpufreq_register_notifier(&thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); - - mutex_unlock(&cooling_cpufreq_lock); - return cool_dev; -} -EXPORT_SYMBOL(cpufreq_cooling_register); - -/** - * cpufreq_cooling_unregister - function to remove cpufreq cooling device. - * @cdev: thermal cooling device pointer. - */ -void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) -{ - struct cpufreq_cooling_device *cpufreq_dev = NULL; - unsigned int cpufreq_dev_count = 0; - - mutex_lock(&cooling_cpufreq_lock); - list_for_each_entry(cpufreq_dev, &cooling_cpufreq_list, node) { - if (cpufreq_dev && cpufreq_dev->cool_dev == cdev) - break; - cpufreq_dev_count++; - } - - if (!cpufreq_dev || cpufreq_dev->cool_dev != cdev) { - mutex_unlock(&cooling_cpufreq_lock); - return; - } - - list_del(&cpufreq_dev->node); - - /* Unregister the notifier for the last cpufreq cooling device */ - if (cpufreq_dev_count == 1) { - cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); - } - mutex_unlock(&cooling_cpufreq_lock); - thermal_cooling_device_unregister(cpufreq_dev->cool_dev); - release_idr(&cpufreq_idr, cpufreq_dev->id); - if (cpufreq_dev_count == 1) - mutex_destroy(&cooling_cpufreq_lock); - kfree(cpufreq_dev); -} -EXPORT_SYMBOL(cpufreq_cooling_unregister); diff --git a/trunk/drivers/thermal/exynos_thermal.c b/trunk/drivers/thermal/exynos_thermal.c deleted file mode 100644 index fd03e8581afc..000000000000 --- a/trunk/drivers/thermal/exynos_thermal.c +++ /dev/null @@ -1,997 +0,0 @@ -/* - * exynos_thermal.c - Samsung EXYNOS TMU (Thermal Management Unit) - * - * Copyright (C) 2011 Samsung Electronics - * Donggeun Kim - * Amit Daniel Kachhap - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* Exynos generic registers */ -#define EXYNOS_TMU_REG_TRIMINFO 0x0 -#define EXYNOS_TMU_REG_CONTROL 0x20 -#define EXYNOS_TMU_REG_STATUS 0x28 -#define EXYNOS_TMU_REG_CURRENT_TEMP 0x40 -#define EXYNOS_TMU_REG_INTEN 0x70 -#define EXYNOS_TMU_REG_INTSTAT 0x74 -#define EXYNOS_TMU_REG_INTCLEAR 0x78 - -#define EXYNOS_TMU_TRIM_TEMP_MASK 0xff -#define EXYNOS_TMU_GAIN_SHIFT 8 -#define EXYNOS_TMU_REF_VOLTAGE_SHIFT 24 -#define EXYNOS_TMU_CORE_ON 3 -#define EXYNOS_TMU_CORE_OFF 2 -#define EXYNOS_TMU_DEF_CODE_TO_TEMP_OFFSET 50 - -/* Exynos4210 specific registers */ -#define EXYNOS4210_TMU_REG_THRESHOLD_TEMP 0x44 -#define EXYNOS4210_TMU_REG_TRIG_LEVEL0 0x50 -#define EXYNOS4210_TMU_REG_TRIG_LEVEL1 0x54 -#define EXYNOS4210_TMU_REG_TRIG_LEVEL2 0x58 -#define EXYNOS4210_TMU_REG_TRIG_LEVEL3 0x5C -#define EXYNOS4210_TMU_REG_PAST_TEMP0 0x60 -#define EXYNOS4210_TMU_REG_PAST_TEMP1 0x64 -#define EXYNOS4210_TMU_REG_PAST_TEMP2 0x68 -#define EXYNOS4210_TMU_REG_PAST_TEMP3 0x6C - -#define EXYNOS4210_TMU_TRIG_LEVEL0_MASK 0x1 -#define EXYNOS4210_TMU_TRIG_LEVEL1_MASK 0x10 -#define EXYNOS4210_TMU_TRIG_LEVEL2_MASK 0x100 -#define EXYNOS4210_TMU_TRIG_LEVEL3_MASK 0x1000 -#define EXYNOS4210_TMU_INTCLEAR_VAL 0x1111 - -/* Exynos5250 and Exynos4412 specific registers */ -#define EXYNOS_TMU_TRIMINFO_CON 0x14 -#define EXYNOS_THD_TEMP_RISE 0x50 -#define EXYNOS_THD_TEMP_FALL 0x54 -#define EXYNOS_EMUL_CON 0x80 - -#define EXYNOS_TRIMINFO_RELOAD 0x1 -#define EXYNOS_TMU_CLEAR_RISE_INT 0x111 -#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 16) -#define EXYNOS_MUX_ADDR_VALUE 6 -#define EXYNOS_MUX_ADDR_SHIFT 20 -#define EXYNOS_TMU_TRIP_MODE_SHIFT 13 - -#define EFUSE_MIN_VALUE 40 -#define EFUSE_MAX_VALUE 100 - -/* In-kernel thermal framework related macros & definations */ -#define SENSOR_NAME_LEN 16 -#define MAX_TRIP_COUNT 8 -#define MAX_COOLING_DEVICE 4 - -#define ACTIVE_INTERVAL 500 -#define IDLE_INTERVAL 10000 -#define MCELSIUS 1000 - -/* CPU Zone information */ -#define PANIC_ZONE 4 -#define WARN_ZONE 3 -#define MONITOR_ZONE 2 -#define SAFE_ZONE 1 - -#define GET_ZONE(trip) (trip + 2) -#define GET_TRIP(zone) (zone - 2) - -#define EXYNOS_ZONE_COUNT 3 - -struct exynos_tmu_data { - struct exynos_tmu_platform_data *pdata; - struct resource *mem; - void __iomem *base; - int irq; - enum soc_type soc; - struct work_struct irq_work; - struct mutex lock; - struct clk *clk; - u8 temp_error1, temp_error2; -}; - -struct thermal_trip_point_conf { - int trip_val[MAX_TRIP_COUNT]; - int trip_count; -}; - -struct thermal_cooling_conf { - struct freq_clip_table freq_data[MAX_TRIP_COUNT]; - int freq_clip_count; -}; - -struct thermal_sensor_conf { - char name[SENSOR_NAME_LEN]; - int (*read_temperature)(void *data); - struct thermal_trip_point_conf trip_data; - struct thermal_cooling_conf cooling_data; - void *private_data; -}; - -struct exynos_thermal_zone { - enum thermal_device_mode mode; - struct thermal_zone_device *therm_dev; - struct thermal_cooling_device *cool_dev[MAX_COOLING_DEVICE]; - unsigned int cool_dev_size; - struct platform_device *exynos4_dev; - struct thermal_sensor_conf *sensor_conf; - bool bind; -}; - -static struct exynos_thermal_zone *th_zone; -static void exynos_unregister_thermal(void); -static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf); - -/* Get mode callback functions for thermal zone */ -static int exynos_get_mode(struct thermal_zone_device *thermal, - enum thermal_device_mode *mode) -{ - if (th_zone) - *mode = th_zone->mode; - return 0; -} - -/* Set mode callback functions for thermal zone */ -static int exynos_set_mode(struct thermal_zone_device *thermal, - enum thermal_device_mode mode) -{ - if (!th_zone->therm_dev) { - pr_notice("thermal zone not registered\n"); - return 0; - } - - mutex_lock(&th_zone->therm_dev->lock); - - if (mode == THERMAL_DEVICE_ENABLED) - th_zone->therm_dev->polling_delay = IDLE_INTERVAL; - else - th_zone->therm_dev->polling_delay = 0; - - mutex_unlock(&th_zone->therm_dev->lock); - - th_zone->mode = mode; - thermal_zone_device_update(th_zone->therm_dev); - pr_info("thermal polling set for duration=%d msec\n", - th_zone->therm_dev->polling_delay); - return 0; -} - - -/* Get trip type callback functions for thermal zone */ -static int exynos_get_trip_type(struct thermal_zone_device *thermal, int trip, - enum thermal_trip_type *type) -{ - switch (GET_ZONE(trip)) { - case MONITOR_ZONE: - case WARN_ZONE: - *type = THERMAL_TRIP_ACTIVE; - break; - case PANIC_ZONE: - *type = THERMAL_TRIP_CRITICAL; - break; - default: - return -EINVAL; - } - return 0; -} - -/* Get trip temperature callback functions for thermal zone */ -static int exynos_get_trip_temp(struct thermal_zone_device *thermal, int trip, - unsigned long *temp) -{ - if (trip < GET_TRIP(MONITOR_ZONE) || trip > GET_TRIP(PANIC_ZONE)) - return -EINVAL; - - *temp = th_zone->sensor_conf->trip_data.trip_val[trip]; - /* convert the temperature into millicelsius */ - *temp = *temp * MCELSIUS; - - return 0; -} - -/* Get critical temperature callback functions for thermal zone */ -static int exynos_get_crit_temp(struct thermal_zone_device *thermal, - unsigned long *temp) -{ - int ret; - /* Panic zone */ - ret = exynos_get_trip_temp(thermal, GET_TRIP(PANIC_ZONE), temp); - return ret; -} - -static int exynos_get_frequency_level(unsigned int cpu, unsigned int freq) -{ - int i = 0, ret = -EINVAL; - struct cpufreq_frequency_table *table = NULL; -#ifdef CONFIG_CPU_FREQ - table = cpufreq_frequency_get_table(cpu); -#endif - if (!table) - return ret; - - while (table[i].frequency != CPUFREQ_TABLE_END) { - if (table[i].frequency == CPUFREQ_ENTRY_INVALID) - continue; - if (table[i].frequency == freq) - return i; - i++; - } - return ret; -} - -/* Bind callback functions for thermal zone */ -static int exynos_bind(struct thermal_zone_device *thermal, - struct thermal_cooling_device *cdev) -{ - int ret = 0, i, tab_size, level; - struct freq_clip_table *tab_ptr, *clip_data; - struct thermal_sensor_conf *data = th_zone->sensor_conf; - - tab_ptr = (struct freq_clip_table *)data->cooling_data.freq_data; - tab_size = data->cooling_data.freq_clip_count; - - if (tab_ptr == NULL || tab_size == 0) - return -EINVAL; - - /* find the cooling device registered*/ - for (i = 0; i < th_zone->cool_dev_size; i++) - if (cdev == th_zone->cool_dev[i]) - break; - - /* No matching cooling device */ - if (i == th_zone->cool_dev_size) - return 0; - - /* Bind the thermal zone to the cpufreq cooling device */ - for (i = 0; i < tab_size; i++) { - clip_data = (struct freq_clip_table *)&(tab_ptr[i]); - level = exynos_get_frequency_level(0, clip_data->freq_clip_max); - if (level < 0) - return 0; - switch (GET_ZONE(i)) { - case MONITOR_ZONE: - case WARN_ZONE: - if (thermal_zone_bind_cooling_device(thermal, i, cdev, - level, level)) { - pr_err("error binding cdev inst %d\n", i); - ret = -EINVAL; - } - th_zone->bind = true; - break; - default: - ret = -EINVAL; - } - } - - return ret; -} - -/* Unbind callback functions for thermal zone */ -static int exynos_unbind(struct thermal_zone_device *thermal, - struct thermal_cooling_device *cdev) -{ - int ret = 0, i, tab_size; - struct thermal_sensor_conf *data = th_zone->sensor_conf; - - if (th_zone->bind == false) - return 0; - - tab_size = data->cooling_data.freq_clip_count; - - if (tab_size == 0) - return -EINVAL; - - /* find the cooling device registered*/ - for (i = 0; i < th_zone->cool_dev_size; i++) - if (cdev == th_zone->cool_dev[i]) - break; - - /* No matching cooling device */ - if (i == th_zone->cool_dev_size) - return 0; - - /* Bind the thermal zone to the cpufreq cooling device */ - for (i = 0; i < tab_size; i++) { - switch (GET_ZONE(i)) { - case MONITOR_ZONE: - case WARN_ZONE: - if (thermal_zone_unbind_cooling_device(thermal, i, - cdev)) { - pr_err("error unbinding cdev inst=%d\n", i); - ret = -EINVAL; - } - th_zone->bind = false; - break; - default: - ret = -EINVAL; - } - } - return ret; -} - -/* Get temperature callback functions for thermal zone */ -static int exynos_get_temp(struct thermal_zone_device *thermal, - unsigned long *temp) -{ - void *data; - - if (!th_zone->sensor_conf) { - pr_info("Temperature sensor not initialised\n"); - return -EINVAL; - } - data = th_zone->sensor_conf->private_data; - *temp = th_zone->sensor_conf->read_temperature(data); - /* convert the temperature into millicelsius */ - *temp = *temp * MCELSIUS; - return 0; -} - -/* Get the temperature trend */ -static int exynos_get_trend(struct thermal_zone_device *thermal, - int trip, enum thermal_trend *trend) -{ - if (thermal->temperature >= trip) - *trend = THERMAL_TREND_RAISING; - else - *trend = THERMAL_TREND_DROPPING; - - return 0; -} -/* Operation callback functions for thermal zone */ -static struct thermal_zone_device_ops const exynos_dev_ops = { - .bind = exynos_bind, - .unbind = exynos_unbind, - .get_temp = exynos_get_temp, - .get_trend = exynos_get_trend, - .get_mode = exynos_get_mode, - .set_mode = exynos_set_mode, - .get_trip_type = exynos_get_trip_type, - .get_trip_temp = exynos_get_trip_temp, - .get_crit_temp = exynos_get_crit_temp, -}; - -/* - * This function may be called from interrupt based temperature sensor - * when threshold is changed. - */ -static void exynos_report_trigger(void) -{ - unsigned int i; - char data[10]; - char *envp[] = { data, NULL }; - - if (!th_zone || !th_zone->therm_dev) - return; - if (th_zone->bind == false) { - for (i = 0; i < th_zone->cool_dev_size; i++) { - if (!th_zone->cool_dev[i]) - continue; - exynos_bind(th_zone->therm_dev, - th_zone->cool_dev[i]); - } - } - - thermal_zone_device_update(th_zone->therm_dev); - - mutex_lock(&th_zone->therm_dev->lock); - /* Find the level for which trip happened */ - for (i = 0; i < th_zone->sensor_conf->trip_data.trip_count; i++) { - if (th_zone->therm_dev->last_temperature < - th_zone->sensor_conf->trip_data.trip_val[i] * MCELSIUS) - break; - } - - if (th_zone->mode == THERMAL_DEVICE_ENABLED) { - if (i > 0) - th_zone->therm_dev->polling_delay = ACTIVE_INTERVAL; - else - th_zone->therm_dev->polling_delay = IDLE_INTERVAL; - } - - snprintf(data, sizeof(data), "%u", i); - kobject_uevent_env(&th_zone->therm_dev->device.kobj, KOBJ_CHANGE, envp); - mutex_unlock(&th_zone->therm_dev->lock); -} - -/* Register with the in-kernel thermal management */ -static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) -{ - int ret; - struct cpumask mask_val; - - if (!sensor_conf || !sensor_conf->read_temperature) { - pr_err("Temperature sensor not initialised\n"); - return -EINVAL; - } - - th_zone = kzalloc(sizeof(struct exynos_thermal_zone), GFP_KERNEL); - if (!th_zone) - return -ENOMEM; - - th_zone->sensor_conf = sensor_conf; - cpumask_set_cpu(0, &mask_val); - th_zone->cool_dev[0] = cpufreq_cooling_register(&mask_val); - if (IS_ERR(th_zone->cool_dev[0])) { - pr_err("Failed to register cpufreq cooling device\n"); - ret = -EINVAL; - goto err_unregister; - } - th_zone->cool_dev_size++; - - th_zone->therm_dev = thermal_zone_device_register(sensor_conf->name, - EXYNOS_ZONE_COUNT, 0, NULL, &exynos_dev_ops, 0, - IDLE_INTERVAL); - - if (IS_ERR(th_zone->therm_dev)) { - pr_err("Failed to register thermal zone device\n"); - ret = -EINVAL; - goto err_unregister; - } - th_zone->mode = THERMAL_DEVICE_ENABLED; - - pr_info("Exynos: Kernel Thermal management registered\n"); - - return 0; - -err_unregister: - exynos_unregister_thermal(); - return ret; -} - -/* Un-Register with the in-kernel thermal management */ -static void exynos_unregister_thermal(void) -{ - int i; - - if (!th_zone) - return; - - if (th_zone->therm_dev) - thermal_zone_device_unregister(th_zone->therm_dev); - - for (i = 0; i < th_zone->cool_dev_size; i++) { - if (th_zone->cool_dev[i]) - cpufreq_cooling_unregister(th_zone->cool_dev[i]); - } - - kfree(th_zone); - pr_info("Exynos: Kernel Thermal management unregistered\n"); -} - -/* - * TMU treats temperature as a mapped temperature code. - * The temperature is converted differently depending on the calibration type. - */ -static int temp_to_code(struct exynos_tmu_data *data, u8 temp) -{ - struct exynos_tmu_platform_data *pdata = data->pdata; - int temp_code; - - if (data->soc == SOC_ARCH_EXYNOS4210) - /* temp should range between 25 and 125 */ - if (temp < 25 || temp > 125) { - temp_code = -EINVAL; - goto out; - } - - switch (pdata->cal_type) { - case TYPE_TWO_POINT_TRIMMING: - temp_code = (temp - 25) * - (data->temp_error2 - data->temp_error1) / - (85 - 25) + data->temp_error1; - break; - case TYPE_ONE_POINT_TRIMMING: - temp_code = temp + data->temp_error1 - 25; - break; - default: - temp_code = temp + EXYNOS_TMU_DEF_CODE_TO_TEMP_OFFSET; - break; - } -out: - return temp_code; -} - -/* - * Calculate a temperature value from a temperature code. - * The unit of the temperature is degree Celsius. - */ -static int code_to_temp(struct exynos_tmu_data *data, u8 temp_code) -{ - struct exynos_tmu_platform_data *pdata = data->pdata; - int temp; - - if (data->soc == SOC_ARCH_EXYNOS4210) - /* temp_code should range between 75 and 175 */ - if (temp_code < 75 || temp_code > 175) { - temp = -ENODATA; - goto out; - } - - switch (pdata->cal_type) { - case TYPE_TWO_POINT_TRIMMING: - temp = (temp_code - data->temp_error1) * (85 - 25) / - (data->temp_error2 - data->temp_error1) + 25; - break; - case TYPE_ONE_POINT_TRIMMING: - temp = temp_code - data->temp_error1 + 25; - break; - default: - temp = temp_code - EXYNOS_TMU_DEF_CODE_TO_TEMP_OFFSET; - break; - } -out: - return temp; -} - -static int exynos_tmu_initialize(struct platform_device *pdev) -{ - struct exynos_tmu_data *data = platform_get_drvdata(pdev); - struct exynos_tmu_platform_data *pdata = data->pdata; - unsigned int status, trim_info, rising_threshold; - int ret = 0, threshold_code; - - mutex_lock(&data->lock); - clk_enable(data->clk); - - status = readb(data->base + EXYNOS_TMU_REG_STATUS); - if (!status) { - ret = -EBUSY; - goto out; - } - - if (data->soc == SOC_ARCH_EXYNOS) { - __raw_writel(EXYNOS_TRIMINFO_RELOAD, - data->base + EXYNOS_TMU_TRIMINFO_CON); - } - /* Save trimming info in order to perform calibration */ - trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO); - data->temp_error1 = trim_info & EXYNOS_TMU_TRIM_TEMP_MASK; - data->temp_error2 = ((trim_info >> 8) & EXYNOS_TMU_TRIM_TEMP_MASK); - - if ((EFUSE_MIN_VALUE > data->temp_error1) || - (data->temp_error1 > EFUSE_MAX_VALUE) || - (data->temp_error2 != 0)) - data->temp_error1 = pdata->efuse_value; - - if (data->soc == SOC_ARCH_EXYNOS4210) { - /* Write temperature code for threshold */ - threshold_code = temp_to_code(data, pdata->threshold); - if (threshold_code < 0) { - ret = threshold_code; - goto out; - } - writeb(threshold_code, - data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); - - writeb(pdata->trigger_levels[0], - data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0); - writeb(pdata->trigger_levels[1], - data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL1); - writeb(pdata->trigger_levels[2], - data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL2); - writeb(pdata->trigger_levels[3], - data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL3); - - writel(EXYNOS4210_TMU_INTCLEAR_VAL, - data->base + EXYNOS_TMU_REG_INTCLEAR); - } else if (data->soc == SOC_ARCH_EXYNOS) { - /* Write temperature code for threshold */ - threshold_code = temp_to_code(data, pdata->trigger_levels[0]); - if (threshold_code < 0) { - ret = threshold_code; - goto out; - } - rising_threshold = threshold_code; - threshold_code = temp_to_code(data, pdata->trigger_levels[1]); - if (threshold_code < 0) { - ret = threshold_code; - goto out; - } - rising_threshold |= (threshold_code << 8); - threshold_code = temp_to_code(data, pdata->trigger_levels[2]); - if (threshold_code < 0) { - ret = threshold_code; - goto out; - } - rising_threshold |= (threshold_code << 16); - - writel(rising_threshold, - data->base + EXYNOS_THD_TEMP_RISE); - writel(0, data->base + EXYNOS_THD_TEMP_FALL); - - writel(EXYNOS_TMU_CLEAR_RISE_INT|EXYNOS_TMU_CLEAR_FALL_INT, - data->base + EXYNOS_TMU_REG_INTCLEAR); - } -out: - clk_disable(data->clk); - mutex_unlock(&data->lock); - - return ret; -} - -static void exynos_tmu_control(struct platform_device *pdev, bool on) -{ - struct exynos_tmu_data *data = platform_get_drvdata(pdev); - struct exynos_tmu_platform_data *pdata = data->pdata; - unsigned int con, interrupt_en; - - mutex_lock(&data->lock); - clk_enable(data->clk); - - con = pdata->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT | - pdata->gain << EXYNOS_TMU_GAIN_SHIFT; - - if (data->soc == SOC_ARCH_EXYNOS) { - con |= pdata->noise_cancel_mode << EXYNOS_TMU_TRIP_MODE_SHIFT; - con |= (EXYNOS_MUX_ADDR_VALUE << EXYNOS_MUX_ADDR_SHIFT); - } - - if (on) { - con |= EXYNOS_TMU_CORE_ON; - interrupt_en = pdata->trigger_level3_en << 12 | - pdata->trigger_level2_en << 8 | - pdata->trigger_level1_en << 4 | - pdata->trigger_level0_en; - } else { - con |= EXYNOS_TMU_CORE_OFF; - interrupt_en = 0; /* Disable all interrupts */ - } - writel(interrupt_en, data->base + EXYNOS_TMU_REG_INTEN); - writel(con, data->base + EXYNOS_TMU_REG_CONTROL); - - clk_disable(data->clk); - mutex_unlock(&data->lock); -} - -static int exynos_tmu_read(struct exynos_tmu_data *data) -{ - u8 temp_code; - int temp; - - mutex_lock(&data->lock); - clk_enable(data->clk); - - temp_code = readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP); - temp = code_to_temp(data, temp_code); - - clk_disable(data->clk); - mutex_unlock(&data->lock); - - return temp; -} - -static void exynos_tmu_work(struct work_struct *work) -{ - struct exynos_tmu_data *data = container_of(work, - struct exynos_tmu_data, irq_work); - - mutex_lock(&data->lock); - clk_enable(data->clk); - - - if (data->soc == SOC_ARCH_EXYNOS) - writel(EXYNOS_TMU_CLEAR_RISE_INT, - data->base + EXYNOS_TMU_REG_INTCLEAR); - else - writel(EXYNOS4210_TMU_INTCLEAR_VAL, - data->base + EXYNOS_TMU_REG_INTCLEAR); - - clk_disable(data->clk); - mutex_unlock(&data->lock); - exynos_report_trigger(); - enable_irq(data->irq); -} - -static irqreturn_t exynos_tmu_irq(int irq, void *id) -{ - struct exynos_tmu_data *data = id; - - disable_irq_nosync(irq); - schedule_work(&data->irq_work); - - return IRQ_HANDLED; -} -static struct thermal_sensor_conf exynos_sensor_conf = { - .name = "exynos-therm", - .read_temperature = (int (*)(void *))exynos_tmu_read, -}; - -#if defined(CONFIG_CPU_EXYNOS4210) -static struct exynos_tmu_platform_data const exynos4210_default_tmu_data = { - .threshold = 80, - .trigger_levels[0] = 5, - .trigger_levels[1] = 20, - .trigger_levels[2] = 30, - .trigger_level0_en = 1, - .trigger_level1_en = 1, - .trigger_level2_en = 1, - .trigger_level3_en = 0, - .gain = 15, - .reference_voltage = 7, - .cal_type = TYPE_ONE_POINT_TRIMMING, - .freq_tab[0] = { - .freq_clip_max = 800 * 1000, - .temp_level = 85, - }, - .freq_tab[1] = { - .freq_clip_max = 200 * 1000, - .temp_level = 100, - }, - .freq_tab_count = 2, - .type = SOC_ARCH_EXYNOS4210, -}; -#define EXYNOS4210_TMU_DRV_DATA (&exynos4210_default_tmu_data) -#else -#define EXYNOS4210_TMU_DRV_DATA (NULL) -#endif - -#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412) -static struct exynos_tmu_platform_data const exynos_default_tmu_data = { - .trigger_levels[0] = 85, - .trigger_levels[1] = 103, - .trigger_levels[2] = 110, - .trigger_level0_en = 1, - .trigger_level1_en = 1, - .trigger_level2_en = 1, - .trigger_level3_en = 0, - .gain = 8, - .reference_voltage = 16, - .noise_cancel_mode = 4, - .cal_type = TYPE_ONE_POINT_TRIMMING, - .efuse_value = 55, - .freq_tab[0] = { - .freq_clip_max = 800 * 1000, - .temp_level = 85, - }, - .freq_tab[1] = { - .freq_clip_max = 200 * 1000, - .temp_level = 103, - }, - .freq_tab_count = 2, - .type = SOC_ARCH_EXYNOS, -}; -#define EXYNOS_TMU_DRV_DATA (&exynos_default_tmu_data) -#else -#define EXYNOS_TMU_DRV_DATA (NULL) -#endif - -#ifdef CONFIG_OF -static const struct of_device_id exynos_tmu_match[] = { - { - .compatible = "samsung,exynos4210-tmu", - .data = (void *)EXYNOS4210_TMU_DRV_DATA, - }, - { - .compatible = "samsung,exynos5250-tmu", - .data = (void *)EXYNOS_TMU_DRV_DATA, - }, - {}, -}; -MODULE_DEVICE_TABLE(of, exynos_tmu_match); -#else -#define exynos_tmu_match NULL -#endif - -static struct platform_device_id exynos_tmu_driver_ids[] = { - { - .name = "exynos4210-tmu", - .driver_data = (kernel_ulong_t)EXYNOS4210_TMU_DRV_DATA, - }, - { - .name = "exynos5250-tmu", - .driver_data = (kernel_ulong_t)EXYNOS_TMU_DRV_DATA, - }, - { }, -}; -MODULE_DEVICE_TABLE(platform, exynos4_tmu_driver_ids); - -static inline struct exynos_tmu_platform_data *exynos_get_driver_data( - struct platform_device *pdev) -{ -#ifdef CONFIG_OF - if (pdev->dev.of_node) { - const struct of_device_id *match; - match = of_match_node(exynos_tmu_match, pdev->dev.of_node); - if (!match) - return NULL; - return (struct exynos_tmu_platform_data *) match->data; - } -#endif - return (struct exynos_tmu_platform_data *) - platform_get_device_id(pdev)->driver_data; -} -static int __devinit exynos_tmu_probe(struct platform_device *pdev) -{ - struct exynos_tmu_data *data; - struct exynos_tmu_platform_data *pdata = pdev->dev.platform_data; - int ret, i; - - if (!pdata) - pdata = exynos_get_driver_data(pdev); - - if (!pdata) { - dev_err(&pdev->dev, "No platform init data supplied.\n"); - return -ENODEV; - } - data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data), - GFP_KERNEL); - if (!data) { - dev_err(&pdev->dev, "Failed to allocate driver structure\n"); - return -ENOMEM; - } - - data->irq = platform_get_irq(pdev, 0); - if (data->irq < 0) { - dev_err(&pdev->dev, "Failed to get platform irq\n"); - return data->irq; - } - - INIT_WORK(&data->irq_work, exynos_tmu_work); - - data->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!data->mem) { - dev_err(&pdev->dev, "Failed to get platform resource\n"); - return -ENOENT; - } - - data->base = devm_request_and_ioremap(&pdev->dev, data->mem); - if (!data->base) { - dev_err(&pdev->dev, "Failed to ioremap memory\n"); - return -ENODEV; - } - - ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, - IRQF_TRIGGER_RISING, "exynos-tmu", data); - if (ret) { - dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); - return ret; - } - - data->clk = clk_get(NULL, "tmu_apbif"); - if (IS_ERR(data->clk)) { - dev_err(&pdev->dev, "Failed to get clock\n"); - return PTR_ERR(data->clk); - } - - if (pdata->type == SOC_ARCH_EXYNOS || - pdata->type == SOC_ARCH_EXYNOS4210) - data->soc = pdata->type; - else { - ret = -EINVAL; - dev_err(&pdev->dev, "Platform not supported\n"); - goto err_clk; - } - - data->pdata = pdata; - platform_set_drvdata(pdev, data); - mutex_init(&data->lock); - - ret = exynos_tmu_initialize(pdev); - if (ret) { - dev_err(&pdev->dev, "Failed to initialize TMU\n"); - goto err_clk; - } - - exynos_tmu_control(pdev, true); - - /* Register the sensor with thermal management interface */ - (&exynos_sensor_conf)->private_data = data; - exynos_sensor_conf.trip_data.trip_count = pdata->trigger_level0_en + - pdata->trigger_level1_en + pdata->trigger_level2_en + - pdata->trigger_level3_en; - - for (i = 0; i < exynos_sensor_conf.trip_data.trip_count; i++) - exynos_sensor_conf.trip_data.trip_val[i] = - pdata->threshold + pdata->trigger_levels[i]; - - exynos_sensor_conf.cooling_data.freq_clip_count = - pdata->freq_tab_count; - for (i = 0; i < pdata->freq_tab_count; i++) { - exynos_sensor_conf.cooling_data.freq_data[i].freq_clip_max = - pdata->freq_tab[i].freq_clip_max; - exynos_sensor_conf.cooling_data.freq_data[i].temp_level = - pdata->freq_tab[i].temp_level; - } - - ret = exynos_register_thermal(&exynos_sensor_conf); - if (ret) { - dev_err(&pdev->dev, "Failed to register thermal interface\n"); - goto err_clk; - } - return 0; -err_clk: - platform_set_drvdata(pdev, NULL); - clk_put(data->clk); - return ret; -} - -static int __devexit exynos_tmu_remove(struct platform_device *pdev) -{ - struct exynos_tmu_data *data = platform_get_drvdata(pdev); - - exynos_tmu_control(pdev, false); - - exynos_unregister_thermal(); - - clk_put(data->clk); - - platform_set_drvdata(pdev, NULL); - - return 0; -} - -#ifdef CONFIG_PM_SLEEP -static int exynos_tmu_suspend(struct device *dev) -{ - exynos_tmu_control(to_platform_device(dev), false); - - return 0; -} - -static int exynos_tmu_resume(struct device *dev) -{ - struct platform_device *pdev = to_platform_device(dev); - - exynos_tmu_initialize(pdev); - exynos_tmu_control(pdev, true); - - return 0; -} - -static SIMPLE_DEV_PM_OPS(exynos_tmu_pm, - exynos_tmu_suspend, exynos_tmu_resume); -#define EXYNOS_TMU_PM (&exynos_tmu_pm) -#else -#define EXYNOS_TMU_PM NULL -#endif - -static struct platform_driver exynos_tmu_driver = { - .driver = { - .name = "exynos-tmu", - .owner = THIS_MODULE, - .pm = EXYNOS_TMU_PM, - .of_match_table = exynos_tmu_match, - }, - .probe = exynos_tmu_probe, - .remove = __devexit_p(exynos_tmu_remove), - .id_table = exynos_tmu_driver_ids, -}; - -module_platform_driver(exynos_tmu_driver); - -MODULE_DESCRIPTION("EXYNOS TMU Driver"); -MODULE_AUTHOR("Donggeun Kim "); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:exynos-tmu"); diff --git a/trunk/drivers/thermal/rcar_thermal.c b/trunk/drivers/thermal/rcar_thermal.c deleted file mode 100644 index d4452716aaab..000000000000 --- a/trunk/drivers/thermal/rcar_thermal.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * R-Car THS/TSC thermal sensor driver - * - * Copyright (C) 2012 Renesas Solutions Corp. - * Kuninori Morimoto - * - * 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; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#define THSCR 0x2c -#define THSSR 0x30 - -/* THSCR */ -#define CPTAP 0xf - -/* THSSR */ -#define CTEMP 0x3f - - -struct rcar_thermal_priv { - void __iomem *base; - struct device *dev; - spinlock_t lock; - u32 comp; -}; - -/* - * basic functions - */ -static u32 rcar_thermal_read(struct rcar_thermal_priv *priv, u32 reg) -{ - unsigned long flags; - u32 ret; - - spin_lock_irqsave(&priv->lock, flags); - - ret = ioread32(priv->base + reg); - - spin_unlock_irqrestore(&priv->lock, flags); - - return ret; -} - -#if 0 /* no user at this point */ -static void rcar_thermal_write(struct rcar_thermal_priv *priv, - u32 reg, u32 data) -{ - unsigned long flags; - - spin_lock_irqsave(&priv->lock, flags); - - iowrite32(data, priv->base + reg); - - spin_unlock_irqrestore(&priv->lock, flags); -} -#endif - -static void rcar_thermal_bset(struct rcar_thermal_priv *priv, u32 reg, - u32 mask, u32 data) -{ - unsigned long flags; - u32 val; - - spin_lock_irqsave(&priv->lock, flags); - - val = ioread32(priv->base + reg); - val &= ~mask; - val |= (data & mask); - iowrite32(val, priv->base + reg); - - spin_unlock_irqrestore(&priv->lock, flags); -} - -/* - * zone device functions - */ -static int rcar_thermal_get_temp(struct thermal_zone_device *zone, - unsigned long *temp) -{ - struct rcar_thermal_priv *priv = zone->devdata; - int val, min, max, tmp; - - tmp = -200; /* default */ - while (1) { - if (priv->comp < 1 || priv->comp > 12) { - dev_err(priv->dev, - "THSSR invalid data (%d)\n", priv->comp); - priv->comp = 4; /* for next thermal */ - return -EINVAL; - } - - /* - * THS comparator offset and the reference temperature - * - * Comparator | reference | Temperature field - * offset | temperature | measurement - * | (degrees C) | (degrees C) - * -------------+---------------+------------------- - * 1 | -45 | -45 to -30 - * 2 | -30 | -30 to -15 - * 3 | -15 | -15 to 0 - * 4 | 0 | 0 to +15 - * 5 | +15 | +15 to +30 - * 6 | +30 | +30 to +45 - * 7 | +45 | +45 to +60 - * 8 | +60 | +60 to +75 - * 9 | +75 | +75 to +90 - * 10 | +90 | +90 to +105 - * 11 | +105 | +105 to +120 - * 12 | +120 | +120 to +135 - */ - - /* calculate thermal limitation */ - min = (priv->comp * 15) - 60; - max = min + 15; - - /* - * we need to wait 300us after changing comparator offset - * to get stable temperature. - * see "Usage Notes" on datasheet - */ - rcar_thermal_bset(priv, THSCR, CPTAP, priv->comp); - udelay(300); - - /* calculate current temperature */ - val = rcar_thermal_read(priv, THSSR) & CTEMP; - val = (val * 5) - 65; - - dev_dbg(priv->dev, "comp/min/max/val = %d/%d/%d/%d\n", - priv->comp, min, max, val); - - /* - * If val is same as min/max, then, - * it should try again on next comparator. - * But the val might be correct temperature. - * Keep it on "tmp" and compare with next val. - */ - if (tmp == val) - break; - - if (val <= min) { - tmp = min; - priv->comp--; /* try again */ - } else if (val >= max) { - tmp = max; - priv->comp++; /* try again */ - } else { - tmp = val; - break; - } - } - - *temp = tmp; - return 0; -} - -static struct thermal_zone_device_ops rcar_thermal_zone_ops = { - .get_temp = rcar_thermal_get_temp, -}; - -/* - * platform functions - */ -static int rcar_thermal_probe(struct platform_device *pdev) -{ - struct thermal_zone_device *zone; - struct rcar_thermal_priv *priv; - struct resource *res; - int ret; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "Could not get platform resource\n"); - return -ENODEV; - } - - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); - if (!priv) { - dev_err(&pdev->dev, "Could not allocate priv\n"); - return -ENOMEM; - } - - priv->comp = 4; /* basic setup */ - priv->dev = &pdev->dev; - spin_lock_init(&priv->lock); - priv->base = devm_ioremap_nocache(&pdev->dev, - res->start, resource_size(res)); - if (!priv->base) { - dev_err(&pdev->dev, "Unable to ioremap thermal register\n"); - ret = -ENOMEM; - goto error_free_priv; - } - - zone = thermal_zone_device_register("rcar_thermal", 0, priv, - &rcar_thermal_zone_ops, 0, 0); - if (IS_ERR(zone)) { - dev_err(&pdev->dev, "thermal zone device is NULL\n"); - ret = PTR_ERR(zone); - goto error_iounmap; - } - - platform_set_drvdata(pdev, zone); - - dev_info(&pdev->dev, "proved\n"); - - return 0; - -error_iounmap: - devm_iounmap(&pdev->dev, priv->base); -error_free_priv: - devm_kfree(&pdev->dev, priv); - - return ret; -} - -static int rcar_thermal_remove(struct platform_device *pdev) -{ - struct thermal_zone_device *zone = platform_get_drvdata(pdev); - struct rcar_thermal_priv *priv = zone->devdata; - - thermal_zone_device_unregister(zone); - platform_set_drvdata(pdev, NULL); - - devm_iounmap(&pdev->dev, priv->base); - devm_kfree(&pdev->dev, priv); - - return 0; -} - -static struct platform_driver rcar_thermal_driver = { - .driver = { - .name = "rcar_thermal", - }, - .probe = rcar_thermal_probe, - .remove = rcar_thermal_remove, -}; -module_platform_driver(rcar_thermal_driver); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("R-Car THS/TSC thermal sensor driver"); -MODULE_AUTHOR("Kuninori Morimoto "); diff --git a/trunk/drivers/thermal/spear_thermal.c b/trunk/drivers/thermal/spear_thermal.c index 9bc969261d01..5f8ee39f2000 100644 --- a/trunk/drivers/thermal/spear_thermal.c +++ b/trunk/drivers/thermal/spear_thermal.c @@ -147,7 +147,7 @@ static int spear_thermal_probe(struct platform_device *pdev) writel_relaxed(stdev->flags, stdev->thermal_base); spear_thermal = thermal_zone_device_register("spear_thermal", 0, 0, - stdev, &ops, 0, 0); + stdev, &ops, 0, 0, 0, 0); if (IS_ERR(spear_thermal)) { dev_err(&pdev->dev, "thermal zone device is NULL\n"); ret = PTR_ERR(spear_thermal); diff --git a/trunk/drivers/thermal/thermal_sys.c b/trunk/drivers/thermal/thermal_sys.c index 9ee42ca4d289..efd81bb25e01 100644 --- a/trunk/drivers/thermal/thermal_sys.c +++ b/trunk/drivers/thermal/thermal_sys.c @@ -41,25 +41,15 @@ MODULE_AUTHOR("Zhang Rui"); MODULE_DESCRIPTION("Generic thermal management sysfs support"); MODULE_LICENSE("GPL"); -#define THERMAL_NO_TARGET -1UL -/* - * This structure is used to describe the behavior of - * a certain cooling device on a certain trip point - * in a certain thermal zone - */ -struct thermal_instance { +struct thermal_cooling_device_instance { int id; char name[THERMAL_NAME_LENGTH]; struct thermal_zone_device *tz; struct thermal_cooling_device *cdev; int trip; - unsigned long upper; /* Highest cooling state for this trip point */ - unsigned long lower; /* Lowest cooling state for this trip point */ - unsigned long target; /* expected cooling state */ char attr_name[THERMAL_NAME_LENGTH]; struct device_attribute attr; - struct list_head tz_node; /* node in tz->thermal_instances */ - struct list_head cdev_node; /* node in cdev->thermal_instances */ + struct list_head node; }; static DEFINE_IDR(thermal_tz_idr); @@ -318,9 +308,8 @@ passive_store(struct device *dev, struct device_attribute *attr, if (!strncmp("Processor", cdev->type, sizeof("Processor"))) thermal_zone_bind_cooling_device(tz, - THERMAL_TRIPS_NONE, cdev, - THERMAL_NO_LIMIT, - THERMAL_NO_LIMIT); + THERMAL_TRIPS_NONE, + cdev); } mutex_unlock(&thermal_list_lock); if (!tz->passive_delay) @@ -338,6 +327,9 @@ passive_store(struct device *dev, struct device_attribute *attr, tz->passive_delay = 0; } + tz->tc1 = 1; + tz->tc2 = 1; + tz->forced_passive = state; thermal_zone_device_update(tz); @@ -433,10 +425,10 @@ static ssize_t thermal_cooling_device_trip_point_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct thermal_instance *instance; + struct thermal_cooling_device_instance *instance; instance = - container_of(attr, struct thermal_instance, attr); + container_of(attr, struct thermal_cooling_device_instance, attr); if (instance->trip == THERMAL_TRIPS_NONE) return sprintf(buf, "-1\n"); @@ -598,7 +590,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) temp->tz = tz; hwmon->count++; - snprintf(temp->temp_input.name, sizeof(temp->temp_input.name), + snprintf(temp->temp_input.name, THERMAL_NAME_LENGTH, "temp%d_input", hwmon->count); temp->temp_input.attr.attr.name = temp->temp_input.name; temp->temp_input.attr.attr.mode = 0444; @@ -611,8 +603,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) if (tz->ops->get_crit_temp) { unsigned long temperature; if (!tz->ops->get_crit_temp(tz, &temperature)) { - snprintf(temp->temp_crit.name, - sizeof(temp->temp_crit.name), + snprintf(temp->temp_crit.name, THERMAL_NAME_LENGTH, "temp%d_crit", hwmon->count); temp->temp_crit.attr.attr.name = temp->temp_crit.name; temp->temp_crit.attr.attr.mode = 0444; @@ -713,6 +704,74 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, cancel_delayed_work(&tz->poll_queue); } +static void thermal_zone_device_passive(struct thermal_zone_device *tz, + int temp, int trip_temp, int trip) +{ + int trend = 0; + struct thermal_cooling_device_instance *instance; + struct thermal_cooling_device *cdev; + long state, max_state; + + /* + * Above Trip? + * ----------- + * Calculate the thermal trend (using the passive cooling equation) + * and modify the performance limit for all passive cooling devices + * accordingly. Note that we assume symmetry. + */ + if (temp >= trip_temp) { + tz->passive = true; + + trend = (tz->tc1 * (temp - tz->last_temperature)) + + (tz->tc2 * (temp - trip_temp)); + + /* Heating up? */ + if (trend > 0) { + list_for_each_entry(instance, &tz->cooling_devices, + node) { + if (instance->trip != trip) + continue; + cdev = instance->cdev; + cdev->ops->get_cur_state(cdev, &state); + cdev->ops->get_max_state(cdev, &max_state); + if (state++ < max_state) + cdev->ops->set_cur_state(cdev, state); + } + } else if (trend < 0) { /* Cooling off? */ + list_for_each_entry(instance, &tz->cooling_devices, + node) { + if (instance->trip != trip) + continue; + cdev = instance->cdev; + cdev->ops->get_cur_state(cdev, &state); + cdev->ops->get_max_state(cdev, &max_state); + if (state > 0) + cdev->ops->set_cur_state(cdev, --state); + } + } + return; + } + + /* + * Below Trip? + * ----------- + * Implement passive cooling hysteresis to slowly increase performance + * and avoid thrashing around the passive trip point. Note that we + * assume symmetry. + */ + list_for_each_entry(instance, &tz->cooling_devices, node) { + if (instance->trip != trip) + continue; + cdev = instance->cdev; + cdev->ops->get_cur_state(cdev, &state); + cdev->ops->get_max_state(cdev, &max_state); + if (state > 0) + cdev->ops->set_cur_state(cdev, --state); + if (state == 0) + tz->passive = false; + } +} + static void thermal_zone_device_check(struct work_struct *work) { struct thermal_zone_device *tz = container_of(work, struct @@ -732,14 +791,12 @@ static void thermal_zone_device_check(struct work_struct *work) */ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, int trip, - struct thermal_cooling_device *cdev, - unsigned long upper, unsigned long lower) + struct thermal_cooling_device *cdev) { - struct thermal_instance *dev; - struct thermal_instance *pos; + struct thermal_cooling_device_instance *dev; + struct thermal_cooling_device_instance *pos; struct thermal_zone_device *pos1; struct thermal_cooling_device *pos2; - unsigned long max_state; int result; if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) @@ -757,26 +814,13 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, if (tz != pos1 || cdev != pos2) return -EINVAL; - cdev->ops->get_max_state(cdev, &max_state); - - /* lower default 0, upper default max_state */ - lower = lower == THERMAL_NO_LIMIT ? 0 : lower; - upper = upper == THERMAL_NO_LIMIT ? max_state : upper; - - if (lower > upper || upper > max_state) - return -EINVAL; - dev = - kzalloc(sizeof(struct thermal_instance), GFP_KERNEL); + kzalloc(sizeof(struct thermal_cooling_device_instance), GFP_KERNEL); if (!dev) return -ENOMEM; dev->tz = tz; dev->cdev = cdev; dev->trip = trip; - dev->upper = upper; - dev->lower = lower; - dev->target = THERMAL_NO_TARGET; - result = get_idr(&tz->idr, &tz->lock, &dev->id); if (result) goto free_mem; @@ -797,17 +841,13 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, goto remove_symbol_link; mutex_lock(&tz->lock); - mutex_lock(&cdev->lock); - list_for_each_entry(pos, &tz->thermal_instances, tz_node) + list_for_each_entry(pos, &tz->cooling_devices, node) if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { result = -EEXIST; break; } - if (!result) { - list_add_tail(&dev->tz_node, &tz->thermal_instances); - list_add_tail(&dev->cdev_node, &cdev->thermal_instances); - } - mutex_unlock(&cdev->lock); + if (!result) + list_add_tail(&dev->node, &tz->cooling_devices); mutex_unlock(&tz->lock); if (!result) @@ -837,20 +877,16 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, int trip, struct thermal_cooling_device *cdev) { - struct thermal_instance *pos, *next; + struct thermal_cooling_device_instance *pos, *next; mutex_lock(&tz->lock); - mutex_lock(&cdev->lock); - list_for_each_entry_safe(pos, next, &tz->thermal_instances, tz_node) { + list_for_each_entry_safe(pos, next, &tz->cooling_devices, node) { if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { - list_del(&pos->tz_node); - list_del(&pos->cdev_node); - mutex_unlock(&cdev->lock); + list_del(&pos->node); mutex_unlock(&tz->lock); goto unbind; } } - mutex_unlock(&cdev->lock); mutex_unlock(&tz->lock); return -ENODEV; @@ -898,7 +934,7 @@ thermal_cooling_device_register(char *type, void *devdata, struct thermal_zone_device *pos; int result; - if (type && strlen(type) >= THERMAL_NAME_LENGTH) + if (strlen(type) >= THERMAL_NAME_LENGTH) return ERR_PTR(-EINVAL); if (!ops || !ops->get_max_state || !ops->get_cur_state || @@ -915,11 +951,8 @@ thermal_cooling_device_register(char *type, void *devdata, return ERR_PTR(result); } - strcpy(cdev->type, type ? : ""); - mutex_init(&cdev->lock); - INIT_LIST_HEAD(&cdev->thermal_instances); + strcpy(cdev->type, type); cdev->ops = ops; - cdev->updated = true; cdev->device.class = &thermal_class; cdev->devdata = devdata; dev_set_name(&cdev->device, "cooling_device%d", cdev->id); @@ -1011,136 +1044,6 @@ void thermal_cooling_device_unregister(struct } EXPORT_SYMBOL(thermal_cooling_device_unregister); -static void thermal_cdev_do_update(struct thermal_cooling_device *cdev) -{ - struct thermal_instance *instance; - unsigned long target = 0; - - /* cooling device is updated*/ - if (cdev->updated) - return; - - mutex_lock(&cdev->lock); - /* Make sure cdev enters the deepest cooling state */ - list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { - if (instance->target == THERMAL_NO_TARGET) - continue; - if (instance->target > target) - target = instance->target; - } - mutex_unlock(&cdev->lock); - cdev->ops->set_cur_state(cdev, target); - cdev->updated = true; -} - -static void thermal_zone_do_update(struct thermal_zone_device *tz) -{ - struct thermal_instance *instance; - - list_for_each_entry(instance, &tz->thermal_instances, tz_node) - thermal_cdev_do_update(instance->cdev); -} - -/* - * Cooling algorithm for both active and passive cooling - * - * 1. if the temperature is higher than a trip point, - * a. if the trend is THERMAL_TREND_RAISING, use higher cooling - * state for this trip point - * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling - * state for this trip point - * - * 2. if the temperature is lower than a trip point, use lower - * cooling state for this trip point - * - * Note that this behaves the same as the previous passive cooling - * algorithm. - */ - -static void thermal_zone_trip_update(struct thermal_zone_device *tz, - int trip, long temp) -{ - struct thermal_instance *instance; - struct thermal_cooling_device *cdev = NULL; - unsigned long cur_state, max_state; - long trip_temp; - enum thermal_trip_type trip_type; - enum thermal_trend trend; - - if (trip == THERMAL_TRIPS_NONE) { - trip_temp = tz->forced_passive; - trip_type = THERMAL_TRIPS_NONE; - } else { - tz->ops->get_trip_temp(tz, trip, &trip_temp); - tz->ops->get_trip_type(tz, trip, &trip_type); - } - - if (!tz->ops->get_trend || tz->ops->get_trend(tz, trip, &trend)) { - /* - * compare the current temperature and previous temperature - * to get the thermal trend, if no special requirement - */ - if (tz->temperature > tz->last_temperature) - trend = THERMAL_TREND_RAISING; - else if (tz->temperature < tz->last_temperature) - trend = THERMAL_TREND_DROPPING; - else - trend = THERMAL_TREND_STABLE; - } - - if (temp >= trip_temp) { - list_for_each_entry(instance, &tz->thermal_instances, tz_node) { - if (instance->trip != trip) - continue; - - cdev = instance->cdev; - - cdev->ops->get_cur_state(cdev, &cur_state); - cdev->ops->get_max_state(cdev, &max_state); - - if (trend == THERMAL_TREND_RAISING) { - cur_state = cur_state < instance->upper ? - (cur_state + 1) : instance->upper; - } else if (trend == THERMAL_TREND_DROPPING) { - cur_state = cur_state > instance->lower ? - (cur_state - 1) : instance->lower; - } - - /* activate a passive thermal instance */ - if ((trip_type == THERMAL_TRIP_PASSIVE || - trip_type == THERMAL_TRIPS_NONE) && - instance->target == THERMAL_NO_TARGET) - tz->passive++; - - instance->target = cur_state; - cdev->updated = false; /* cooling device needs update */ - } - } else { /* below trip */ - list_for_each_entry(instance, &tz->thermal_instances, tz_node) { - if (instance->trip != trip) - continue; - - /* Do not use the inactive thermal instance */ - if (instance->target == THERMAL_NO_TARGET) - continue; - cdev = instance->cdev; - cdev->ops->get_cur_state(cdev, &cur_state); - - cur_state = cur_state > instance->lower ? - (cur_state - 1) : THERMAL_NO_TARGET; - - /* deactivate a passive thermal instance */ - if ((trip_type == THERMAL_TRIP_PASSIVE || - trip_type == THERMAL_TRIPS_NONE) && - cur_state == THERMAL_NO_TARGET) - tz->passive--; - instance->target = cur_state; - cdev->updated = false; /* cooling device needs update */ - } - } - - return; -} /** * thermal_zone_device_update - force an update of a thermal zone's state * @ttz: the thermal zone to update @@ -1151,6 +1054,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) int count, ret = 0; long temp, trip_temp; enum thermal_trip_type trip_type; + struct thermal_cooling_device_instance *instance; + struct thermal_cooling_device *cdev; mutex_lock(&tz->lock); @@ -1160,9 +1065,6 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) goto leave; } - tz->last_temperature = tz->temperature; - tz->temperature = temp; - for (count = 0; count < tz->trips; count++) { tz->ops->get_trip_type(tz, count, &trip_type); tz->ops->get_trip_temp(tz, count, &trip_temp); @@ -1186,18 +1088,32 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) tz->ops->notify(tz, count, trip_type); break; case THERMAL_TRIP_ACTIVE: - thermal_zone_trip_update(tz, count, temp); + list_for_each_entry(instance, &tz->cooling_devices, + node) { + if (instance->trip != count) + continue; + + cdev = instance->cdev; + + if (temp >= trip_temp) + cdev->ops->set_cur_state(cdev, 1); + else + cdev->ops->set_cur_state(cdev, 0); + } break; case THERMAL_TRIP_PASSIVE: if (temp >= trip_temp || tz->passive) - thermal_zone_trip_update(tz, count, temp); + thermal_zone_device_passive(tz, temp, + trip_temp, count); break; } } if (tz->forced_passive) - thermal_zone_trip_update(tz, THERMAL_TRIPS_NONE, temp); - thermal_zone_do_update(tz); + thermal_zone_device_passive(tz, temp, tz->forced_passive, + THERMAL_TRIPS_NONE); + + tz->last_temperature = temp; leave: if (tz->passive) @@ -1320,6 +1236,8 @@ static void remove_trip_attrs(struct thermal_zone_device *tz) * @mask: a bit string indicating the writeablility of trip points * @devdata: private device data * @ops: standard thermal zone device callbacks + * @tc1: thermal coefficient 1 for passive calculations + * @tc2: thermal coefficient 2 for passive calculations * @passive_delay: number of milliseconds to wait between polls when * performing passive cooling * @polling_delay: number of milliseconds to wait between polls when checking @@ -1327,12 +1245,13 @@ static void remove_trip_attrs(struct thermal_zone_device *tz) * driven systems) * * thermal_zone_device_unregister() must be called when the device is no - * longer needed. The passive cooling depends on the .get_trend() return value. + * longer needed. The passive cooling formula uses tc1 and tc2 as described in + * section 11.1.5.1 of the ACPI specification 3.0. */ struct thermal_zone_device *thermal_zone_device_register(const char *type, int trips, int mask, void *devdata, const struct thermal_zone_device_ops *ops, - int passive_delay, int polling_delay) + int tc1, int tc2, int passive_delay, int polling_delay) { struct thermal_zone_device *tz; struct thermal_cooling_device *pos; @@ -1341,7 +1260,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, int count; int passive = 0; - if (type && strlen(type) >= THERMAL_NAME_LENGTH) + if (strlen(type) >= THERMAL_NAME_LENGTH) return ERR_PTR(-EINVAL); if (trips > THERMAL_MAX_TRIPS || trips < 0 || mask >> trips) @@ -1354,7 +1273,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, if (!tz) return ERR_PTR(-ENOMEM); - INIT_LIST_HEAD(&tz->thermal_instances); + INIT_LIST_HEAD(&tz->cooling_devices); idr_init(&tz->idr); mutex_init(&tz->lock); result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id); @@ -1363,11 +1282,13 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, return ERR_PTR(result); } - strcpy(tz->type, type ? : ""); + strcpy(tz->type, type); tz->ops = ops; tz->device.class = &thermal_class; tz->devdata = devdata; tz->trips = trips; + tz->tc1 = tc1; + tz->tc2 = tc2; tz->passive_delay = passive_delay; tz->polling_delay = polling_delay; diff --git a/trunk/drivers/tty/serial/kgdboc.c b/trunk/drivers/tty/serial/kgdboc.c index 10020547c60b..c0b334327d93 100644 --- a/trunk/drivers/tty/serial/kgdboc.c +++ b/trunk/drivers/tty/serial/kgdboc.c @@ -97,8 +97,7 @@ static void kgdboc_restore_input(void) static int kgdboc_register_kbd(char **cptr) { - if (strncmp(*cptr, "kbd", 3) == 0 || - strncmp(*cptr, "kdb", 3) == 0) { + if (strncmp(*cptr, "kbd", 3) == 0) { if (kdb_poll_idx < KDB_POLL_FUNC_MAX) { kdb_poll_funcs[kdb_poll_idx] = kdb_get_kbd_char; kdb_poll_idx++; diff --git a/trunk/drivers/tty/vt/vt.c b/trunk/drivers/tty/vt/vt.c index f87d7e8964bf..999ca63afdef 100644 --- a/trunk/drivers/tty/vt/vt.c +++ b/trunk/drivers/tty/vt/vt.c @@ -3442,19 +3442,6 @@ int con_debug_enter(struct vc_data *vc) kdb_set(2, setargs); } } - if (vc->vc_cols < 999) { - int colcount; - char cols[4]; - const char *setargs[3] = { - "set", - "COLUMNS", - cols, - }; - if (kdbgetintenv(setargs[0], &colcount)) { - snprintf(cols, 4, "%i", vc->vc_cols); - kdb_set(2, setargs); - } - } #endif /* CONFIG_KGDB_KDB */ return ret; } diff --git a/trunk/drivers/usb/class/cdc-acm.c b/trunk/drivers/usb/class/cdc-acm.c index 981f2132d128..36f2be4def2f 100644 --- a/trunk/drivers/usb/class/cdc-acm.c +++ b/trunk/drivers/usb/class/cdc-acm.c @@ -1551,9 +1551,6 @@ static const struct usb_device_id acm_ids[] = { Maybe we should define a new quirk for this. */ }, - { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */ - .driver_info = NO_UNION_NORMAL, - }, { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ }, diff --git a/trunk/fs/btrfs/ioctl.c b/trunk/fs/btrfs/ioctl.c index 61168805f175..e568c472f807 100644 --- a/trunk/fs/btrfs/ioctl.c +++ b/trunk/fs/btrfs/ioctl.c @@ -638,7 +638,7 @@ static int btrfs_may_delete(struct inode *dir,struct dentry *victim,int isdir) return -ENOENT; BUG_ON(victim->d_parent->d_inode != dir); - audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); + audit_inode_child(victim, dir); error = inode_permission(dir, MAY_WRITE | MAY_EXEC); if (error) diff --git a/trunk/fs/compat.c b/trunk/fs/compat.c index 015e1e1f87c6..b7a24d0ca30d 100644 --- a/trunk/fs/compat.c +++ b/trunk/fs/compat.c @@ -776,16 +776,16 @@ asmlinkage long compat_sys_mount(const char __user * dev_name, char *kernel_type; unsigned long data_page; char *kernel_dev; - struct filename *dir; + char *dir_page; int retval; retval = copy_mount_string(type, &kernel_type); if (retval < 0) goto out; - dir = getname(dir_name); - retval = PTR_ERR(dir); - if (IS_ERR(dir)) + dir_page = getname(dir_name); + retval = PTR_ERR(dir_page); + if (IS_ERR(dir_page)) goto out1; retval = copy_mount_string(dev_name, &kernel_dev); @@ -807,7 +807,7 @@ asmlinkage long compat_sys_mount(const char __user * dev_name, } } - retval = do_mount(kernel_dev, dir->name, kernel_type, + retval = do_mount(kernel_dev, dir_page, kernel_type, flags, (void*)data_page); out4: @@ -815,7 +815,7 @@ asmlinkage long compat_sys_mount(const char __user * dev_name, out3: kfree(kernel_dev); out2: - putname(dir); + putname(dir_page); out1: kfree(kernel_type); out: diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index 8b9011b67041..ca434534ae9a 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -105,7 +105,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt) SYSCALL_DEFINE1(uselib, const char __user *, library) { struct file *file; - struct filename *tmp = getname(library); + char *tmp = getname(library); int error = PTR_ERR(tmp); static const struct open_flags uselib_flags = { .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, @@ -751,14 +751,13 @@ struct file *open_exec(const char *name) { struct file *file; int err; - struct filename tmp = { .name = name }; static const struct open_flags open_exec_flags = { .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, .acc_mode = MAY_EXEC | MAY_OPEN, .intent = LOOKUP_OPEN }; - file = do_filp_open(AT_FDCWD, &tmp, &open_exec_flags, LOOKUP_FOLLOW); + file = do_filp_open(AT_FDCWD, name, &open_exec_flags, LOOKUP_FOLLOW); if (IS_ERR(file)) goto out; @@ -1665,10 +1664,10 @@ SYSCALL_DEFINE3(execve, const char __user *const __user *, argv, const char __user *const __user *, envp) { - struct filename *path = getname(filename); + const char *path = getname(filename); int error = PTR_ERR(path); if (!IS_ERR(path)) { - error = do_execve(path->name, argv, envp, current_pt_regs()); + error = do_execve(path, argv, envp, current_pt_regs()); putname(path); } return error; @@ -1678,11 +1677,10 @@ asmlinkage long compat_sys_execve(const char __user * filename, const compat_uptr_t __user * argv, const compat_uptr_t __user * envp) { - struct filename *path = getname(filename); + const char *path = getname(filename); int error = PTR_ERR(path); if (!IS_ERR(path)) { - error = compat_do_execve(path->name, argv, envp, - current_pt_regs()); + error = compat_do_execve(path, argv, envp, current_pt_regs()); putname(path); } return error; diff --git a/trunk/fs/filesystems.c b/trunk/fs/filesystems.c index da165f6adcbf..96f24286667a 100644 --- a/trunk/fs/filesystems.c +++ b/trunk/fs/filesystems.c @@ -124,7 +124,7 @@ EXPORT_SYMBOL(unregister_filesystem); static int fs_index(const char __user * __name) { struct file_system_type * tmp; - struct filename *name; + char * name; int err, index; name = getname(__name); @@ -135,7 +135,7 @@ static int fs_index(const char __user * __name) err = -EINVAL; read_lock(&file_systems_lock); for (tmp=file_systems, index=0 ; tmp ; tmp=tmp->next, index++) { - if (strcmp(tmp->name, name->name) == 0) { + if (strcmp(tmp->name,name) == 0) { err = index; break; } diff --git a/trunk/fs/internal.h b/trunk/fs/internal.h index 916b7cbf3e3e..371bcc4b1697 100644 --- a/trunk/fs/internal.h +++ b/trunk/fs/internal.h @@ -97,8 +97,8 @@ struct open_flags { int acc_mode; int intent; }; -extern struct file *do_filp_open(int dfd, struct filename *pathname, - const struct open_flags *op, int flags); +extern struct file *do_filp_open(int dfd, const char *pathname, + const struct open_flags *op, int lookup_flags); extern struct file *do_file_open_root(struct dentry *, struct vfsmount *, const char *, const struct open_flags *, int lookup_flags); diff --git a/trunk/fs/lockd/svc.c b/trunk/fs/lockd/svc.c index a2aa97d45670..7e355870d519 100644 --- a/trunk/fs/lockd/svc.c +++ b/trunk/fs/lockd/svc.c @@ -126,7 +126,7 @@ static void restart_grace(void) static int lockd(void *vrqstp) { - int err = 0; + int err = 0, preverr = 0; struct svc_rqst *rqstp = vrqstp; /* try_to_freeze() is called from svc_recv() */ @@ -165,8 +165,21 @@ lockd(void *vrqstp) * recvfrom routine. */ err = svc_recv(rqstp, timeout); - if (err == -EAGAIN || err == -EINTR) + if (err == -EAGAIN || err == -EINTR) { + preverr = err; continue; + } + if (err < 0) { + if (err != preverr) { + printk(KERN_WARNING "%s: unexpected error " + "from svc_recv (%d)\n", __func__, err); + preverr = err; + } + schedule_timeout_interruptible(HZ); + continue; + } + preverr = err; + dprintk("lockd: request from %s\n", svc_print_addr(rqstp, buf, sizeof(buf))); diff --git a/trunk/fs/locks.c b/trunk/fs/locks.c index a94e331a52a2..abc7dc6c490b 100644 --- a/trunk/fs/locks.c +++ b/trunk/fs/locks.c @@ -1289,7 +1289,7 @@ EXPORT_SYMBOL(__break_lease); void lease_get_mtime(struct inode *inode, struct timespec *time) { struct file_lock *flock = inode->i_flock; - if (flock && IS_LEASE(flock) && (flock->fl_type == F_WRLCK)) + if (flock && IS_LEASE(flock) && (flock->fl_type & F_WRLCK)) *time = current_fs_time(inode->i_sb); else *time = inode->i_mtime; @@ -2185,8 +2185,8 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, } else { seq_printf(f, "%s ", (lease_breaking(fl)) - ? (fl->fl_type == F_UNLCK) ? "UNLCK" : "READ " - : (fl->fl_type == F_WRLCK) ? "WRITE" : "READ "); + ? (fl->fl_type & F_UNLCK) ? "UNLCK" : "READ " + : (fl->fl_type & F_WRLCK) ? "WRITE" : "READ "); } if (inode) { #ifdef WE_CAN_BREAK_LSLK_NOW diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index d1895f308156..c1f18e4f034c 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -117,70 +117,18 @@ * POSIX.1 2.4: an empty pathname is invalid (ENOENT). * PATH_MAX includes the nul terminator --RR. */ -void final_putname(struct filename *name) +static char *getname_flags(const char __user *filename, int flags, int *empty) { - if (name->separate) { - __putname(name->name); - kfree(name); - } else { - __putname(name); - } -} - -#define EMBEDDED_NAME_MAX (PATH_MAX - sizeof(struct filename)) - -static struct filename * -getname_flags(const char __user *filename, int flags, int *empty) -{ - struct filename *result, *err; + char *result = __getname(), *err; int len; - long max; - char *kname; - result = audit_reusename(filename); - if (result) - return result; - - result = __getname(); if (unlikely(!result)) return ERR_PTR(-ENOMEM); - /* - * First, try to embed the struct filename inside the names_cache - * allocation - */ - kname = (char *)result + sizeof(*result); - result->name = kname; - result->separate = false; - max = EMBEDDED_NAME_MAX; - -recopy: - len = strncpy_from_user(kname, filename, max); - if (unlikely(len < 0)) { - err = ERR_PTR(len); + len = strncpy_from_user(result, filename, PATH_MAX); + err = ERR_PTR(len); + if (unlikely(len < 0)) goto error; - } - - /* - * Uh-oh. We have a name that's approaching PATH_MAX. Allocate a - * separate struct filename so we can dedicate the entire - * names_cache allocation for the pathname, and re-do the copy from - * userland. - */ - if (len == EMBEDDED_NAME_MAX && max == EMBEDDED_NAME_MAX) { - kname = (char *)result; - - result = kzalloc(sizeof(*result), GFP_KERNEL); - if (!result) { - err = ERR_PTR(-ENOMEM); - result = (struct filename *)kname; - goto error; - } - result->name = kname; - result->separate = true; - max = PATH_MAX; - goto recopy; - } /* The empty path is special. */ if (unlikely(!len)) { @@ -192,32 +140,30 @@ getname_flags(const char __user *filename, int flags, int *empty) } err = ERR_PTR(-ENAMETOOLONG); - if (unlikely(len >= PATH_MAX)) - goto error; - - result->uptr = filename; - audit_getname(result); - return result; + if (likely(len < PATH_MAX)) { + audit_getname(result); + return result; + } error: - final_putname(result); + __putname(result); return err; } -struct filename * -getname(const char __user * filename) +char *getname(const char __user * filename) { return getname_flags(filename, 0, NULL); } -EXPORT_SYMBOL(getname); #ifdef CONFIG_AUDITSYSCALL -void putname(struct filename *name) +void putname(const char *name) { if (unlikely(!audit_dummy_context())) - return audit_putname(name); - final_putname(name); + audit_putname(name); + else + __putname(name); } +EXPORT_SYMBOL(putname); #endif static int check_acl(struct inode *inode, int mask) @@ -2017,29 +1963,24 @@ static int path_lookupat(int dfd, const char *name, return err; } -static int filename_lookup(int dfd, struct filename *name, +static int do_path_lookup(int dfd, const char *name, unsigned int flags, struct nameidata *nd) { - int retval = path_lookupat(dfd, name->name, flags | LOOKUP_RCU, nd); + int retval = path_lookupat(dfd, name, flags | LOOKUP_RCU, nd); if (unlikely(retval == -ECHILD)) - retval = path_lookupat(dfd, name->name, flags, nd); + retval = path_lookupat(dfd, name, flags, nd); if (unlikely(retval == -ESTALE)) - retval = path_lookupat(dfd, name->name, - flags | LOOKUP_REVAL, nd); + retval = path_lookupat(dfd, name, flags | LOOKUP_REVAL, nd); - if (likely(!retval)) - audit_inode(name, nd->path.dentry, flags & LOOKUP_PARENT); + if (likely(!retval)) { + if (unlikely(!audit_dummy_context())) { + if (nd->path.dentry && nd->inode) + audit_inode(name, nd->path.dentry); + } + } return retval; } -static int do_path_lookup(int dfd, const char *name, - unsigned int flags, struct nameidata *nd) -{ - struct filename filename = { .name = name }; - - return filename_lookup(dfd, &filename, flags, nd); -} - /* does lookup, returns the object with parent locked */ struct dentry *kern_path_locked(const char *name, struct path *path) { @@ -2157,13 +2098,13 @@ int user_path_at_empty(int dfd, const char __user *name, unsigned flags, struct path *path, int *empty) { struct nameidata nd; - struct filename *tmp = getname_flags(name, flags, empty); + char *tmp = getname_flags(name, flags, empty); int err = PTR_ERR(tmp); if (!IS_ERR(tmp)) { BUG_ON(flags & LOOKUP_PARENT); - err = filename_lookup(dfd, tmp, flags, &nd); + err = do_path_lookup(dfd, tmp, flags, &nd); putname(tmp); if (!err) *path = nd.path; @@ -2177,28 +2118,22 @@ int user_path_at(int dfd, const char __user *name, unsigned flags, return user_path_at_empty(dfd, name, flags, path, NULL); } -/* - * NB: most callers don't do anything directly with the reference to the - * to struct filename, but the nd->last pointer points into the name string - * allocated by getname. So we must hold the reference to it until all - * path-walking is complete. - */ -static struct filename * -user_path_parent(int dfd, const char __user *path, struct nameidata *nd) +static int user_path_parent(int dfd, const char __user *path, + struct nameidata *nd, char **name) { - struct filename *s = getname(path); + char *s = getname(path); int error; if (IS_ERR(s)) - return s; + return PTR_ERR(s); - error = filename_lookup(dfd, s, LOOKUP_PARENT, nd); - if (error) { + error = do_path_lookup(dfd, s, LOOKUP_PARENT, nd); + if (error) putname(s); - return ERR_PTR(error); - } + else + *name = s; - return s; + return error; } /* @@ -2245,7 +2180,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir) return -ENOENT; BUG_ON(victim->d_parent->d_inode != dir); - audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); + audit_inode_child(victim, dir); error = inode_permission(dir, MAY_WRITE | MAY_EXEC); if (error) @@ -2690,7 +2625,7 @@ static int lookup_open(struct nameidata *nd, struct path *path, */ static int do_last(struct nameidata *nd, struct path *path, struct file *file, const struct open_flags *op, - int *opened, struct filename *name) + int *opened, const char *pathname) { struct dentry *dir = nd->path.dentry; int open_flag = op->open_flag; @@ -2717,7 +2652,7 @@ static int do_last(struct nameidata *nd, struct path *path, error = complete_walk(nd); if (error) return error; - audit_inode(name, nd->path.dentry, 0); + audit_inode(pathname, nd->path.dentry); if (open_flag & O_CREAT) { error = -EISDIR; goto out; @@ -2727,7 +2662,7 @@ static int do_last(struct nameidata *nd, struct path *path, error = complete_walk(nd); if (error) return error; - audit_inode(name, dir, 0); + audit_inode(pathname, dir); goto finish_open; } @@ -2756,7 +2691,7 @@ static int do_last(struct nameidata *nd, struct path *path, if (error) return error; - audit_inode(name, dir, 0); + audit_inode(pathname, dir); error = -EISDIR; /* trailing slashes? */ if (nd->last.name[nd->last.len]) @@ -2786,7 +2721,7 @@ static int do_last(struct nameidata *nd, struct path *path, !S_ISREG(file->f_path.dentry->d_inode->i_mode)) will_truncate = false; - audit_inode(name, file->f_path.dentry, 0); + audit_inode(pathname, file->f_path.dentry); goto opened; } @@ -2803,7 +2738,7 @@ static int do_last(struct nameidata *nd, struct path *path, * create/update audit record if it already exists. */ if (path->dentry->d_inode) - audit_inode(name, path->dentry, 0); + audit_inode(pathname, path->dentry); /* * If atomic_open() acquired write access it is dropped now due to @@ -2868,7 +2803,7 @@ static int do_last(struct nameidata *nd, struct path *path, error = -ENOTDIR; if ((nd->flags & LOOKUP_DIRECTORY) && !nd->inode->i_op->lookup) goto out; - audit_inode(name, nd->path.dentry, 0); + audit_inode(pathname, nd->path.dentry); finish_open: if (!S_ISREG(nd->inode->i_mode)) will_truncate = false; @@ -2936,7 +2871,7 @@ static int do_last(struct nameidata *nd, struct path *path, goto retry_lookup; } -static struct file *path_openat(int dfd, struct filename *pathname, +static struct file *path_openat(int dfd, const char *pathname, struct nameidata *nd, const struct open_flags *op, int flags) { struct file *base = NULL; @@ -2951,12 +2886,12 @@ static struct file *path_openat(int dfd, struct filename *pathname, file->f_flags = op->open_flag; - error = path_init(dfd, pathname->name, flags | LOOKUP_PARENT, nd, &base); + error = path_init(dfd, pathname, flags | LOOKUP_PARENT, nd, &base); if (unlikely(error)) goto out; current->total_link_count = 0; - error = link_path_walk(pathname->name, nd); + error = link_path_walk(pathname, nd); if (unlikely(error)) goto out; @@ -3002,7 +2937,7 @@ static struct file *path_openat(int dfd, struct filename *pathname, return file; } -struct file *do_filp_open(int dfd, struct filename *pathname, +struct file *do_filp_open(int dfd, const char *pathname, const struct open_flags *op, int flags) { struct nameidata nd; @@ -3021,7 +2956,6 @@ struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, { struct nameidata nd; struct file *file; - struct filename filename = { .name = name }; nd.root.mnt = mnt; nd.root.dentry = dentry; @@ -3031,11 +2965,11 @@ struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, if (dentry->d_inode->i_op->follow_link && op->intent & LOOKUP_OPEN) return ERR_PTR(-ELOOP); - file = path_openat(-1, &filename, &nd, op, flags | LOOKUP_RCU); + file = path_openat(-1, name, &nd, op, flags | LOOKUP_RCU); if (unlikely(file == ERR_PTR(-ECHILD))) - file = path_openat(-1, &filename, &nd, op, flags); + file = path_openat(-1, name, &nd, op, flags); if (unlikely(file == ERR_PTR(-ESTALE))) - file = path_openat(-1, &filename, &nd, op, flags | LOOKUP_REVAL); + file = path_openat(-1, name, &nd, op, flags | LOOKUP_REVAL); return file; } @@ -3110,11 +3044,11 @@ EXPORT_SYMBOL(done_path_create); struct dentry *user_path_create(int dfd, const char __user *pathname, struct path *path, int is_dir) { - struct filename *tmp = getname(pathname); + char *tmp = getname(pathname); struct dentry *res; if (IS_ERR(tmp)) return ERR_CAST(tmp); - res = kern_path_create(dfd, tmp->name, path, is_dir); + res = kern_path_create(dfd, tmp, path, is_dir); putname(tmp); return res; } @@ -3319,13 +3253,13 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) static long do_rmdir(int dfd, const char __user *pathname) { int error = 0; - struct filename *name; + char * name; struct dentry *dentry; struct nameidata nd; - name = user_path_parent(dfd, pathname, &nd); - if (IS_ERR(name)) - return PTR_ERR(name); + error = user_path_parent(dfd, pathname, &nd, &name); + if (error) + return error; switch(nd.last_type) { case LAST_DOTDOT: @@ -3414,14 +3348,14 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) static long do_unlinkat(int dfd, const char __user *pathname) { int error; - struct filename *name; + char *name; struct dentry *dentry; struct nameidata nd; struct inode *inode = NULL; - name = user_path_parent(dfd, pathname, &nd); - if (IS_ERR(name)) - return PTR_ERR(name); + error = user_path_parent(dfd, pathname, &nd, &name); + if (error) + return error; error = -EISDIR; if (nd.last_type != LAST_NORM) @@ -3505,7 +3439,7 @@ SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, int, newdfd, const char __user *, newname) { int error; - struct filename *from; + char *from; struct dentry *dentry; struct path path; @@ -3518,9 +3452,9 @@ SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, if (IS_ERR(dentry)) goto out_putname; - error = security_path_symlink(&path, dentry, from->name); + error = security_path_symlink(&path, dentry, from); if (!error) - error = vfs_symlink(path.dentry->d_inode, dentry, from->name); + error = vfs_symlink(path.dentry->d_inode, dentry, from); done_path_create(&path, dentry); out_putname: putname(from); @@ -3800,21 +3734,17 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, struct dentry *old_dentry, *new_dentry; struct dentry *trap; struct nameidata oldnd, newnd; - struct filename *from; - struct filename *to; + char *from; + char *to; int error; - from = user_path_parent(olddfd, oldname, &oldnd); - if (IS_ERR(from)) { - error = PTR_ERR(from); + error = user_path_parent(olddfd, oldname, &oldnd, &from); + if (error) goto exit; - } - to = user_path_parent(newdfd, newname, &newnd); - if (IS_ERR(to)) { - error = PTR_ERR(to); + error = user_path_parent(newdfd, newname, &newnd, &to); + if (error) goto exit1; - } error = -EXDEV; if (oldnd.path.mnt != newnd.path.mnt) @@ -4038,6 +3968,7 @@ EXPORT_SYMBOL(follow_down_one); EXPORT_SYMBOL(follow_down); EXPORT_SYMBOL(follow_up); EXPORT_SYMBOL(get_write_access); /* nfsd */ +EXPORT_SYMBOL(getname); EXPORT_SYMBOL(lock_rename); EXPORT_SYMBOL(lookup_one_len); EXPORT_SYMBOL(page_follow_link_light); diff --git a/trunk/fs/namespace.c b/trunk/fs/namespace.c index 24960626bb6b..fc33207e28ad 100644 --- a/trunk/fs/namespace.c +++ b/trunk/fs/namespace.c @@ -2408,7 +2408,7 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, { int ret; char *kernel_type; - struct filename *kernel_dir; + char *kernel_dir; char *kernel_dev; unsigned long data_page; @@ -2430,7 +2430,7 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, if (ret < 0) goto out_data; - ret = do_mount(kernel_dev, kernel_dir->name, kernel_type, flags, + ret = do_mount(kernel_dev, kernel_dir, kernel_type, flags, (void *) data_page); free_page(data_page); diff --git a/trunk/fs/nfs/callback.c b/trunk/fs/nfs/callback.c index 9a521fb39869..2245bef50f37 100644 --- a/trunk/fs/nfs/callback.c +++ b/trunk/fs/nfs/callback.c @@ -72,7 +72,7 @@ static int nfs4_callback_up_net(struct svc_serv *serv, struct net *net) static int nfs4_callback_svc(void *vrqstp) { - int err; + int err, preverr = 0; struct svc_rqst *rqstp = vrqstp; set_freezable(); @@ -82,8 +82,20 @@ nfs4_callback_svc(void *vrqstp) * Listen for a request on the socket */ err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT); - if (err == -EAGAIN || err == -EINTR) + if (err == -EAGAIN || err == -EINTR) { + preverr = err; continue; + } + if (err < 0) { + if (err != preverr) { + printk(KERN_WARNING "NFS: %s: unexpected error " + "from svc_recv (%d)\n", __func__, err); + preverr = err; + } + schedule_timeout_uninterruptible(HZ); + continue; + } + preverr = err; svc_process(rqstp); } return 0; diff --git a/trunk/fs/nfsd/nfs2acl.c b/trunk/fs/nfsd/nfs2acl.c index b314888825d5..6aa5590c3679 100644 --- a/trunk/fs/nfsd/nfs2acl.c +++ b/trunk/fs/nfsd/nfs2acl.c @@ -218,7 +218,8 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, * There must be an encoding function for void results so svc_process * will work properly. */ -static int nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) +int +nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) { return xdr_ressize_check(rqstp, p); } diff --git a/trunk/fs/nfsd/nfs3proc.c b/trunk/fs/nfsd/nfs3proc.c index 97d90d1c8608..9095f3c21df9 100644 --- a/trunk/fs/nfsd/nfs3proc.c +++ b/trunk/fs/nfsd/nfs3proc.c @@ -247,7 +247,7 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, /* Now create the file and set attributes */ nfserr = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len, attr, newfhp, - argp->createmode, (u32 *)argp->verf, NULL, NULL); + argp->createmode, argp->verf, NULL, NULL); RETURN_STATUS(nfserr); } diff --git a/trunk/fs/nfsd/nfs4callback.c b/trunk/fs/nfsd/nfs4callback.c index bdf29c96e4cd..4c7bd35b1876 100644 --- a/trunk/fs/nfsd/nfs4callback.c +++ b/trunk/fs/nfsd/nfs4callback.c @@ -1028,6 +1028,7 @@ void nfsd4_cb_recall(struct nfs4_delegation *dp) cb->cb_msg.rpc_cred = callback_cred; cb->cb_ops = &nfsd4_cb_recall_ops; + dp->dl_retries = 1; INIT_LIST_HEAD(&cb->cb_per_client); cb->cb_done = true; diff --git a/trunk/fs/nfsd/nfs4idmap.c b/trunk/fs/nfsd/nfs4idmap.c index a1f10c0a6255..fdc91a6fc9c4 100644 --- a/trunk/fs/nfsd/nfs4idmap.c +++ b/trunk/fs/nfsd/nfs4idmap.c @@ -478,7 +478,7 @@ nfsd_idmap_init(struct net *net) goto destroy_idtoname_cache; nn->nametoid_cache = cache_create_net(&nametoid_cache_template, net); if (IS_ERR(nn->nametoid_cache)) { - rv = PTR_ERR(nn->nametoid_cache); + rv = PTR_ERR(nn->idtoname_cache); goto unregister_idtoname_cache; } rv = cache_register_net(nn->nametoid_cache, net); @@ -598,7 +598,7 @@ numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namel /* Just to make sure it's null-terminated: */ memcpy(buf, name, namelen); buf[namelen] = '\0'; - ret = kstrtouint(buf, 10, id); + ret = kstrtouint(name, 10, id); return ret == 0; } diff --git a/trunk/fs/nfsd/nfs4proc.c b/trunk/fs/nfsd/nfs4proc.c index 6c9a4b291dba..c9c1c0a25417 100644 --- a/trunk/fs/nfsd/nfs4proc.c +++ b/trunk/fs/nfsd/nfs4proc.c @@ -370,7 +370,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, break; case NFS4_OPEN_CLAIM_PREVIOUS: open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; - status = nfs4_check_open_reclaim(&open->op_clientid, cstate->minorversion); + status = nfs4_check_open_reclaim(&open->op_clientid); if (status) goto out; case NFS4_OPEN_CLAIM_FH: @@ -1054,8 +1054,8 @@ struct nfsd4_operation { char *op_name; /* Try to get response size before operation */ nfsd4op_rsize op_rsize_bop; - stateid_getter op_get_currentstateid; - stateid_setter op_set_currentstateid; + stateid_setter op_get_currentstateid; + stateid_getter op_set_currentstateid; }; static struct nfsd4_operation nfsd4_ops[]; diff --git a/trunk/fs/nfsd/nfs4state.c b/trunk/fs/nfsd/nfs4state.c index d0237f872cc4..48a1bad37334 100644 --- a/trunk/fs/nfsd/nfs4state.c +++ b/trunk/fs/nfsd/nfs4state.c @@ -758,7 +758,7 @@ static void nfsd4_put_drc_mem(int slotsize, int num) spin_unlock(&nfsd_drc_lock); } -static struct nfsd4_session *__alloc_session(int slotsize, int numslots) +static struct nfsd4_session *alloc_session(int slotsize, int numslots) { struct nfsd4_session *new; int mem, i; @@ -852,28 +852,35 @@ static int nfsd4_register_conn(struct nfsd4_conn *conn) return register_xpt_user(conn->cn_xprt, &conn->cn_xpt_user); } -static void nfsd4_init_conn(struct svc_rqst *rqstp, struct nfsd4_conn *conn, struct nfsd4_session *ses) +static __be32 nfsd4_new_conn(struct svc_rqst *rqstp, struct nfsd4_session *ses, u32 dir) { + struct nfsd4_conn *conn; int ret; + conn = alloc_conn(rqstp, dir); + if (!conn) + return nfserr_jukebox; nfsd4_hash_conn(conn, ses); ret = nfsd4_register_conn(conn); if (ret) /* oops; xprt is already down: */ nfsd4_conn_lost(&conn->cn_xpt_user); - if (conn->cn_flags & NFS4_CDFC4_BACK) { + if (ses->se_client->cl_cb_state == NFSD4_CB_DOWN && + dir & NFS4_CDFC4_BACK) { /* callback channel may be back up */ nfsd4_probe_callback(ses->se_client); } + return nfs_ok; } -static struct nfsd4_conn *alloc_conn_from_crses(struct svc_rqst *rqstp, struct nfsd4_create_session *cses) +static __be32 nfsd4_new_conn_from_crses(struct svc_rqst *rqstp, struct nfsd4_session *ses) { u32 dir = NFS4_CDFC4_FORE; - if (cses->flags & SESSION4_BACK_CHAN) + if (ses->se_flags & SESSION4_BACK_CHAN) dir |= NFS4_CDFC4_BACK; - return alloc_conn(rqstp, dir); + + return nfsd4_new_conn(rqstp, ses, dir); } /* must be called under client_lock */ @@ -896,21 +903,20 @@ static void nfsd4_del_conns(struct nfsd4_session *s) spin_unlock(&clp->cl_lock); } -static void __free_session(struct nfsd4_session *ses) -{ - nfsd4_put_drc_mem(slot_bytes(&ses->se_fchannel), ses->se_fchannel.maxreqs); - free_session_slots(ses); - kfree(ses); -} - static void free_session(struct kref *kref) { struct nfsd4_session *ses; + int mem; lockdep_assert_held(&client_lock); ses = container_of(kref, struct nfsd4_session, se_ref); nfsd4_del_conns(ses); - __free_session(ses); + spin_lock(&nfsd_drc_lock); + mem = ses->se_fchannel.maxreqs * slot_bytes(&ses->se_fchannel); + nfsd_drc_mem_used -= mem; + spin_unlock(&nfsd_drc_lock); + free_session_slots(ses); + kfree(ses); } void nfsd4_put_session(struct nfsd4_session *ses) @@ -920,10 +926,14 @@ void nfsd4_put_session(struct nfsd4_session *ses) spin_unlock(&client_lock); } -static struct nfsd4_session *alloc_session(struct nfsd4_channel_attrs *fchan) +static struct nfsd4_session *alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp, struct nfsd4_create_session *cses) { struct nfsd4_session *new; + struct nfsd4_channel_attrs *fchan = &cses->fore_channel; int numslots, slotsize; + __be32 status; + int idx; + /* * Note decreasing slot size below client's request may * make it difficult for client to function correctly, whereas @@ -936,18 +946,12 @@ static struct nfsd4_session *alloc_session(struct nfsd4_channel_attrs *fchan) if (numslots < 1) return NULL; - new = __alloc_session(slotsize, numslots); + new = alloc_session(slotsize, numslots); if (!new) { nfsd4_put_drc_mem(slotsize, fchan->maxreqs); return NULL; } init_forechannel_attrs(&new->se_fchannel, fchan, numslots, slotsize); - return new; -} - -static struct nfsd4_session *init_session(struct svc_rqst *rqstp, struct nfsd4_session *new, struct nfs4_client *clp, struct nfsd4_create_session *cses) -{ - int idx; new->se_client = clp; gen_sessionid(new); @@ -966,6 +970,14 @@ static struct nfsd4_session *init_session(struct svc_rqst *rqstp, struct nfsd4_s spin_unlock(&clp->cl_lock); spin_unlock(&client_lock); + status = nfsd4_new_conn_from_crses(rqstp, new); + /* whoops: benny points out, status is ignored! (err, or bogus) */ + if (status) { + spin_lock(&client_lock); + free_session(&new->se_ref); + spin_unlock(&client_lock); + return NULL; + } if (cses->flags & SESSION4_BACK_CHAN) { struct sockaddr *sa = svc_addr(rqstp); /* @@ -978,6 +990,7 @@ static struct nfsd4_session *init_session(struct svc_rqst *rqstp, struct nfsd4_s rpc_copy_addr((struct sockaddr *)&clp->cl_cb_conn.cb_addr, sa); clp->cl_cb_conn.cb_addrlen = svc_addr_len(sa); } + nfsd4_probe_callback(clp); return new; } @@ -1118,7 +1131,7 @@ unhash_client_locked(struct nfs4_client *clp) } static void -destroy_client(struct nfs4_client *clp) +expire_client(struct nfs4_client *clp) { struct nfs4_openowner *oo; struct nfs4_delegation *dp; @@ -1152,12 +1165,6 @@ destroy_client(struct nfs4_client *clp) spin_unlock(&client_lock); } -static void expire_client(struct nfs4_client *clp) -{ - nfsd4_client_record_remove(clp); - destroy_client(clp); -} - static void copy_verf(struct nfs4_client *target, nfs4_verifier *source) { memcpy(target->cl_verifier.data, source->data, @@ -1216,26 +1223,10 @@ static bool groups_equal(struct group_info *g1, struct group_info *g2) return true; } -/* - * RFC 3530 language requires clid_inuse be returned when the - * "principal" associated with a requests differs from that previously - * used. We use uid, gid's, and gss principal string as our best - * approximation. We also don't want to allow non-gss use of a client - * established using gss: in theory cr_principal should catch that - * change, but in practice cr_principal can be null even in the gss case - * since gssd doesn't always pass down a principal string. - */ -static bool is_gss_cred(struct svc_cred *cr) -{ - /* Is cr_flavor one of the gss "pseudoflavors"?: */ - return (cr->cr_flavor > RPC_AUTH_MAXFLAVOR); -} - - static bool same_creds(struct svc_cred *cr1, struct svc_cred *cr2) { - if ((is_gss_cred(cr1) != is_gss_cred(cr2)) + if ((cr1->cr_flavor != cr2->cr_flavor) || (cr1->cr_uid != cr2->cr_uid) || (cr1->cr_gid != cr2->cr_gid) || !groups_equal(cr1->cr_group_info, cr2->cr_group_info)) @@ -1349,15 +1340,13 @@ move_to_confirmed(struct nfs4_client *clp) } static struct nfs4_client * -find_confirmed_client(clientid_t *clid, bool sessions) +find_confirmed_client(clientid_t *clid) { struct nfs4_client *clp; unsigned int idhashval = clientid_hashval(clid->cl_id); list_for_each_entry(clp, &conf_id_hashtbl[idhashval], cl_idhash) { if (same_clid(&clp->cl_clientid, clid)) { - if ((bool)clp->cl_minorversion != sessions) - return NULL; renew_client(clp); return clp; } @@ -1366,17 +1355,14 @@ find_confirmed_client(clientid_t *clid, bool sessions) } static struct nfs4_client * -find_unconfirmed_client(clientid_t *clid, bool sessions) +find_unconfirmed_client(clientid_t *clid) { struct nfs4_client *clp; unsigned int idhashval = clientid_hashval(clid->cl_id); list_for_each_entry(clp, &unconf_id_hashtbl[idhashval], cl_idhash) { - if (same_clid(&clp->cl_clientid, clid)) { - if ((bool)clp->cl_minorversion != sessions) - return NULL; + if (same_clid(&clp->cl_clientid, clid)) return clp; - } } return NULL; } @@ -1665,7 +1651,6 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, status = nfserr_jukebox; goto out; } - new->cl_minorversion = 1; gen_clid(new); add_to_unconfirmed(new, strhashval); @@ -1758,71 +1743,67 @@ nfsd4_create_session(struct svc_rqst *rqstp, struct sockaddr *sa = svc_addr(rqstp); struct nfs4_client *conf, *unconf; struct nfsd4_session *new; - struct nfsd4_conn *conn; struct nfsd4_clid_slot *cs_slot = NULL; + bool confirm_me = false; __be32 status = 0; if (cr_ses->flags & ~SESSION4_FLAG_MASK_A) return nfserr_inval; - if (check_forechannel_attrs(cr_ses->fore_channel)) - return nfserr_toosmall; - new = alloc_session(&cr_ses->fore_channel); - if (!new) - return nfserr_jukebox; - status = nfserr_jukebox; - conn = alloc_conn_from_crses(rqstp, cr_ses); - if (!conn) - goto out_free_session; nfs4_lock_state(); - unconf = find_unconfirmed_client(&cr_ses->clientid, true); - conf = find_confirmed_client(&cr_ses->clientid, true); + unconf = find_unconfirmed_client(&cr_ses->clientid); + conf = find_confirmed_client(&cr_ses->clientid); if (conf) { cs_slot = &conf->cl_cs_slot; status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0); if (status == nfserr_replay_cache) { status = nfsd4_replay_create_session(cr_ses, cs_slot); - goto out_free_conn; + goto out; } else if (cr_ses->seqid != cs_slot->sl_seqid + 1) { status = nfserr_seq_misordered; - goto out_free_conn; + goto out; } } else if (unconf) { - unsigned int hash; - struct nfs4_client *old; if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) || !rpc_cmp_addr(sa, (struct sockaddr *) &unconf->cl_addr)) { status = nfserr_clid_inuse; - goto out_free_conn; + goto out; } cs_slot = &unconf->cl_cs_slot; status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0); if (status) { /* an unconfirmed replay returns misordered */ status = nfserr_seq_misordered; - goto out_free_conn; + goto out; } - hash = clientstr_hashval(unconf->cl_recdir); - old = find_confirmed_client_by_str(unconf->cl_recdir, hash); - if (old) - expire_client(old); - move_to_confirmed(unconf); + confirm_me = true; conf = unconf; } else { status = nfserr_stale_clientid; - goto out_free_conn; + goto out; } - status = nfs_ok; + + /* + * XXX: we should probably set this at creation time, and check + * for consistent minorversion use throughout: + */ + conf->cl_minorversion = 1; /* * We do not support RDMA or persistent sessions */ cr_ses->flags &= ~SESSION4_PERSIST; cr_ses->flags &= ~SESSION4_RDMA; - init_session(rqstp, new, conf, cr_ses); - nfsd4_init_conn(rqstp, conn, new); + status = nfserr_toosmall; + if (check_forechannel_attrs(cr_ses->fore_channel)) + goto out; + status = nfserr_jukebox; + new = alloc_init_session(rqstp, conf, cr_ses); + if (!new) + goto out; + status = nfs_ok; memcpy(cr_ses->sessionid.data, new->se_sessionid.data, NFS4_MAX_SESSIONID_LEN); memcpy(&cr_ses->fore_channel, &new->se_fchannel, @@ -1832,15 +1813,18 @@ nfsd4_create_session(struct svc_rqst *rqstp, /* cache solo and embedded create sessions under the state lock */ nfsd4_cache_create_session(cr_ses, cs_slot, status); + if (confirm_me) { + unsigned int hash = clientstr_hashval(unconf->cl_recdir); + struct nfs4_client *old = + find_confirmed_client_by_str(conf->cl_recdir, hash); + if (old) + expire_client(old); + move_to_confirmed(conf); + } out: nfs4_unlock_state(); dprintk("%s returns %d\n", __func__, ntohl(status)); return status; -out_free_conn: - free_conn(conn); -out_free_session: - __free_session(new); - goto out; } static bool nfsd4_last_compound_op(struct svc_rqst *rqstp) @@ -1870,7 +1854,6 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp, struct nfsd4_bind_conn_to_session *bcts) { __be32 status; - struct nfsd4_conn *conn; if (!nfsd4_last_compound_op(rqstp)) return nfserr_not_only_op; @@ -1887,13 +1870,9 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp, return nfserr_badsession; status = nfsd4_map_bcts_dir(&bcts->dir); - if (status) - return status; - conn = alloc_conn(rqstp, bcts->dir); - if (!conn) - return nfserr_jukebox; - nfsd4_init_conn(rqstp, conn, cstate->session); - return nfs_ok; + if (!status) + nfsd4_new_conn(rqstp, cstate->session, bcts->dir); + return status; } static bool nfsd4_compound_in_session(struct nfsd4_session *session, struct nfs4_sessionid *sid) @@ -2106,8 +2085,8 @@ nfsd4_destroy_clientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *csta __be32 status = 0; nfs4_lock_state(); - unconf = find_unconfirmed_client(&dc->clientid, true); - conf = find_confirmed_client(&dc->clientid, true); + unconf = find_unconfirmed_client(&dc->clientid); + conf = find_confirmed_client(&dc->clientid); if (conf) { clp = conf; @@ -2221,6 +2200,10 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, copy_clid(new, conf); else /* case 4 (new client) or cases 2, 3 (client reboot): */ gen_clid(new); + /* + * XXX: we should probably set this at creation time, and check + * for consistent minorversion use throughout: + */ new->cl_minorversion = 0; gen_callback(new, setclid, rqstp); add_to_unconfirmed(new, strhashval); @@ -2249,8 +2232,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, return nfserr_stale_clientid; nfs4_lock_state(); - conf = find_confirmed_client(clid, false); - unconf = find_unconfirmed_client(clid, false); + conf = find_confirmed_client(clid); + unconf = find_unconfirmed_client(clid); /* * We try hard to give out unique clientid's, so if we get an * attempt to confirm the same clientid with a different cred, @@ -2279,8 +2262,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, unsigned int hash = clientstr_hashval(unconf->cl_recdir); conf = find_confirmed_client_by_str(unconf->cl_recdir, hash); - if (conf) + if (conf) { + nfsd4_client_record_remove(conf); expire_client(conf); + } move_to_confirmed(unconf); nfsd4_probe_callback(unconf); } @@ -2462,20 +2447,16 @@ same_owner_str(struct nfs4_stateowner *sop, struct xdr_netobj *owner, } static struct nfs4_openowner * -find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open, bool sessions) +find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open) { struct nfs4_stateowner *so; struct nfs4_openowner *oo; - struct nfs4_client *clp; list_for_each_entry(so, &ownerstr_hashtbl[hashval], so_strhash) { if (!so->so_is_open_owner) continue; if (same_owner_str(so, &open->op_owner, &open->op_clientid)) { oo = openowner(so); - clp = oo->oo_owner.so_client; - if ((bool)clp->cl_minorversion != sessions) - return NULL; renew_client(oo->oo_owner.so_client); return oo; } @@ -2619,10 +2600,10 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate, return nfserr_jukebox; strhashval = ownerstr_hashval(clientid->cl_id, &open->op_owner); - oo = find_openstateowner_str(strhashval, open, cstate->minorversion); + oo = find_openstateowner_str(strhashval, open); open->op_openowner = oo; if (!oo) { - clp = find_confirmed_client(clientid, cstate->minorversion); + clp = find_confirmed_client(clientid); if (clp == NULL) return nfserr_expired; goto new_owner; @@ -2724,6 +2705,11 @@ nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_ol_st return nfs_ok; } +static void nfs4_free_stateid(struct nfs4_ol_stateid *s) +{ + kmem_cache_free(stateid_slab, s); +} + static inline int nfs4_access_to_access(u32 nfs4_access) { int flags = 0; @@ -3101,7 +3087,7 @@ void nfsd4_cleanup_open_state(struct nfsd4_open *open, __be32 status) if (open->op_file) nfsd4_free_file(open->op_file); if (open->op_stp) - free_generic_stateid(open->op_stp); + nfs4_free_stateid(open->op_stp); } __be32 @@ -3118,7 +3104,7 @@ nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, status = nfserr_stale_clientid; if (STALE_CLIENTID(clid, nn)) goto out; - clp = find_confirmed_client(clid, cstate->minorversion); + clp = find_confirmed_client(clid); status = nfserr_expired; if (clp == NULL) { /* We assume the client took too long to RENEW. */ @@ -3194,6 +3180,7 @@ nfs4_laundromat(void) clp = list_entry(pos, struct nfs4_client, cl_lru); dprintk("NFSD: purging unused client (clientid %08x)\n", clp->cl_clientid.cl_id); + nfsd4_client_record_remove(clp); expire_client(clp); } spin_lock(&recall_lock); @@ -3385,7 +3372,7 @@ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid) return nfs_ok; } -static __be32 nfsd4_lookup_stateid(stateid_t *stateid, unsigned char typemask, struct nfs4_stid **s, bool sessions) +static __be32 nfsd4_lookup_stateid(stateid_t *stateid, unsigned char typemask, struct nfs4_stid **s) { struct nfs4_client *cl; struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); @@ -3394,7 +3381,7 @@ static __be32 nfsd4_lookup_stateid(stateid_t *stateid, unsigned char typemask, s return nfserr_bad_stateid; if (STALE_STATEID(stateid, nn)) return nfserr_stale_stateid; - cl = find_confirmed_client(&stateid->si_opaque.so_clid, sessions); + cl = find_confirmed_client(&stateid->si_opaque.so_clid); if (!cl) return nfserr_expired; *s = find_stateid_by_type(cl, stateid, typemask); @@ -3427,7 +3414,7 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) return check_special_stateids(net, current_fh, stateid, flags); - status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, &s, cstate->minorversion); + status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, &s); if (status) return status; status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate)); @@ -3577,7 +3564,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, seqid, STATEID_VAL(stateid)); *stpp = NULL; - status = nfsd4_lookup_stateid(stateid, typemask, &s, cstate->minorversion); + status = nfsd4_lookup_stateid(stateid, typemask, &s); if (status) return status; *stpp = openlockstateid(s); @@ -3778,7 +3765,6 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); nfsd4_close_open_stateid(stp); - release_last_closed_stateid(oo); oo->oo_last_closed_stid = stp; if (list_empty(&oo->oo_owner.so_stateids)) { @@ -3815,7 +3801,7 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, inode = cstate->current_fh.fh_dentry->d_inode; nfs4_lock_state(); - status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID, &s, cstate->minorversion); + status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID, &s); if (status) goto out; dp = delegstateid(s); @@ -4059,8 +4045,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfs4_lockowner *lock_sop = NULL; struct nfs4_ol_stateid *lock_stp; struct file *filp = NULL; - struct file_lock *file_lock = NULL; - struct file_lock *conflock = NULL; + struct file_lock file_lock; + struct file_lock conflock; __be32 status = 0; bool new_state = false; int lkflg; @@ -4130,28 +4116,21 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if (!locks_in_grace(SVC_NET(rqstp)) && lock->lk_reclaim) goto out; - file_lock = locks_alloc_lock(); - if (!file_lock) { - dprintk("NFSD: %s: unable to allocate lock!\n", __func__); - status = nfserr_jukebox; - goto out; - } - - locks_init_lock(file_lock); + locks_init_lock(&file_lock); switch (lock->lk_type) { case NFS4_READ_LT: case NFS4_READW_LT: filp = find_readable_file(lock_stp->st_file); if (filp) get_lock_access(lock_stp, NFS4_SHARE_ACCESS_READ); - file_lock->fl_type = F_RDLCK; + file_lock.fl_type = F_RDLCK; break; case NFS4_WRITE_LT: case NFS4_WRITEW_LT: filp = find_writeable_file(lock_stp->st_file); if (filp) get_lock_access(lock_stp, NFS4_SHARE_ACCESS_WRITE); - file_lock->fl_type = F_WRLCK; + file_lock.fl_type = F_WRLCK; break; default: status = nfserr_inval; @@ -4161,23 +4140,22 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, status = nfserr_openmode; goto out; } - file_lock->fl_owner = (fl_owner_t)lock_sop; - file_lock->fl_pid = current->tgid; - file_lock->fl_file = filp; - file_lock->fl_flags = FL_POSIX; - file_lock->fl_lmops = &nfsd_posix_mng_ops; - file_lock->fl_start = lock->lk_offset; - file_lock->fl_end = last_byte_offset(lock->lk_offset, lock->lk_length); - nfs4_transform_lock_offset(file_lock); - - conflock = locks_alloc_lock(); - if (!conflock) { - dprintk("NFSD: %s: unable to allocate lock!\n", __func__); - status = nfserr_jukebox; - goto out; - } + file_lock.fl_owner = (fl_owner_t)lock_sop; + file_lock.fl_pid = current->tgid; + file_lock.fl_file = filp; + file_lock.fl_flags = FL_POSIX; + file_lock.fl_lmops = &nfsd_posix_mng_ops; + + file_lock.fl_start = lock->lk_offset; + file_lock.fl_end = last_byte_offset(lock->lk_offset, lock->lk_length); + nfs4_transform_lock_offset(&file_lock); + + /* + * Try to lock the file in the VFS. + * Note: locks.c uses the BKL to protect the inode's lock list. + */ - err = vfs_lock_file(filp, F_SETLK, file_lock, conflock); + err = vfs_lock_file(filp, F_SETLK, &file_lock, &conflock); switch (-err) { case 0: /* success! */ update_stateid(&lock_stp->st_stid.sc_stateid); @@ -4188,7 +4166,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, case (EAGAIN): /* conflock holds conflicting lock */ status = nfserr_denied; dprintk("NFSD: nfsd4_lock: conflicting lock found!\n"); - nfs4_set_lock_denied(conflock, &lock->lk_denied); + nfs4_set_lock_denied(&conflock, &lock->lk_denied); break; case (EDEADLK): status = nfserr_deadlock; @@ -4203,10 +4181,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, release_lockowner(lock_sop); if (!cstate->replay_owner) nfs4_unlock_state(); - if (file_lock) - locks_free_lock(file_lock); - if (conflock) - locks_free_lock(conflock); return status; } @@ -4235,7 +4209,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_lockt *lockt) { struct inode *inode; - struct file_lock *file_lock = NULL; + struct file_lock file_lock; struct nfs4_lockowner *lo; __be32 status; struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); @@ -4256,21 +4230,15 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, goto out; inode = cstate->current_fh.fh_dentry->d_inode; - file_lock = locks_alloc_lock(); - if (!file_lock) { - dprintk("NFSD: %s: unable to allocate lock!\n", __func__); - status = nfserr_jukebox; - goto out; - } - locks_init_lock(file_lock); + locks_init_lock(&file_lock); switch (lockt->lt_type) { case NFS4_READ_LT: case NFS4_READW_LT: - file_lock->fl_type = F_RDLCK; + file_lock.fl_type = F_RDLCK; break; case NFS4_WRITE_LT: case NFS4_WRITEW_LT: - file_lock->fl_type = F_WRLCK; + file_lock.fl_type = F_WRLCK; break; default: dprintk("NFSD: nfs4_lockt: bad lock type!\n"); @@ -4280,27 +4248,25 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, lo = find_lockowner_str(inode, &lockt->lt_clientid, &lockt->lt_owner); if (lo) - file_lock->fl_owner = (fl_owner_t)lo; - file_lock->fl_pid = current->tgid; - file_lock->fl_flags = FL_POSIX; + file_lock.fl_owner = (fl_owner_t)lo; + file_lock.fl_pid = current->tgid; + file_lock.fl_flags = FL_POSIX; - file_lock->fl_start = lockt->lt_offset; - file_lock->fl_end = last_byte_offset(lockt->lt_offset, lockt->lt_length); + file_lock.fl_start = lockt->lt_offset; + file_lock.fl_end = last_byte_offset(lockt->lt_offset, lockt->lt_length); - nfs4_transform_lock_offset(file_lock); + nfs4_transform_lock_offset(&file_lock); - status = nfsd_test_lock(rqstp, &cstate->current_fh, file_lock); + status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); if (status) goto out; - if (file_lock->fl_type != F_UNLCK) { + if (file_lock.fl_type != F_UNLCK) { status = nfserr_denied; - nfs4_set_lock_denied(file_lock, &lockt->lt_denied); + nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); } out: nfs4_unlock_state(); - if (file_lock) - locks_free_lock(file_lock); return status; } @@ -4310,7 +4276,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, { struct nfs4_ol_stateid *stp; struct file *filp = NULL; - struct file_lock *file_lock = NULL; + struct file_lock file_lock; __be32 status; int err; @@ -4332,29 +4298,23 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, status = nfserr_lock_range; goto out; } - file_lock = locks_alloc_lock(); - if (!file_lock) { - dprintk("NFSD: %s: unable to allocate lock!\n", __func__); - status = nfserr_jukebox; - goto out; - } - locks_init_lock(file_lock); - file_lock->fl_type = F_UNLCK; - file_lock->fl_owner = (fl_owner_t)lockowner(stp->st_stateowner); - file_lock->fl_pid = current->tgid; - file_lock->fl_file = filp; - file_lock->fl_flags = FL_POSIX; - file_lock->fl_lmops = &nfsd_posix_mng_ops; - file_lock->fl_start = locku->lu_offset; - - file_lock->fl_end = last_byte_offset(locku->lu_offset, - locku->lu_length); - nfs4_transform_lock_offset(file_lock); + BUG_ON(!filp); + locks_init_lock(&file_lock); + file_lock.fl_type = F_UNLCK; + file_lock.fl_owner = (fl_owner_t)lockowner(stp->st_stateowner); + file_lock.fl_pid = current->tgid; + file_lock.fl_file = filp; + file_lock.fl_flags = FL_POSIX; + file_lock.fl_lmops = &nfsd_posix_mng_ops; + file_lock.fl_start = locku->lu_offset; + + file_lock.fl_end = last_byte_offset(locku->lu_offset, locku->lu_length); + nfs4_transform_lock_offset(&file_lock); /* * Try to unlock the file in the VFS. */ - err = vfs_lock_file(filp, F_SETLK, file_lock, NULL); + err = vfs_lock_file(filp, F_SETLK, &file_lock, NULL); if (err) { dprintk("NFSD: nfs4_locku: vfs_lock_file failed!\n"); goto out_nfserr; @@ -4368,8 +4328,6 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, out: if (!cstate->replay_owner) nfs4_unlock_state(); - if (file_lock) - locks_free_lock(file_lock); return status; out_nfserr: @@ -4543,12 +4501,12 @@ nfsd4_find_reclaim_client(struct nfs4_client *clp) * Called from OPEN. Look for clientid in reclaim list. */ __be32 -nfs4_check_open_reclaim(clientid_t *clid, bool sessions) +nfs4_check_open_reclaim(clientid_t *clid) { struct nfs4_client *clp; /* find clientid in conf_id_hashtbl */ - clp = find_confirmed_client(clid, sessions); + clp = find_confirmed_client(clid); if (clp == NULL) return nfserr_reclaim_bad; @@ -4564,6 +4522,7 @@ void nfsd_forget_clients(u64 num) nfs4_lock_state(); list_for_each_entry_safe(clp, next, &client_lru, cl_lru) { + nfsd4_client_record_remove(clp); expire_client(clp); if (++count == num) break; @@ -4623,7 +4582,7 @@ void nfsd_forget_openowners(u64 num) printk(KERN_INFO "NFSD: Forgot %d open owners", count); } -static int nfsd_process_n_delegations(u64 num, struct list_head *list) +int nfsd_process_n_delegations(u64 num, struct list_head *list) { int i, count = 0; struct nfs4_file *fp, *fnext; @@ -4788,11 +4747,11 @@ __nfs4_state_shutdown(void) for (i = 0; i < CLIENT_HASH_SIZE; i++) { while (!list_empty(&conf_id_hashtbl[i])) { clp = list_entry(conf_id_hashtbl[i].next, struct nfs4_client, cl_idhash); - destroy_client(clp); + expire_client(clp); } while (!list_empty(&unconf_str_hashtbl[i])) { clp = list_entry(unconf_str_hashtbl[i].next, struct nfs4_client, cl_strhash); - destroy_client(clp); + expire_client(clp); } } INIT_LIST_HEAD(&reaplist); diff --git a/trunk/fs/nfsd/nfs4xdr.c b/trunk/fs/nfsd/nfs4xdr.c index fd548d155088..6322df36031f 100644 --- a/trunk/fs/nfsd/nfs4xdr.c +++ b/trunk/fs/nfsd/nfs4xdr.c @@ -2659,7 +2659,7 @@ static __be32 nfsd4_encode_bind_conn_to_session(struct nfsd4_compoundres *resp, RESERVE_SPACE(NFS4_MAX_SESSIONID_LEN + 8); WRITEMEM(bcts->sessionid.data, NFS4_MAX_SESSIONID_LEN); WRITE32(bcts->dir); - /* Sorry, we do not yet support RDMA over 4.1: */ + /* XXX: ? */ WRITE32(0); ADJUST_ARGS(); } diff --git a/trunk/fs/nfsd/nfsctl.c b/trunk/fs/nfsd/nfsctl.c index dab350dfc376..fa49cff5ee65 100644 --- a/trunk/fs/nfsd/nfsctl.c +++ b/trunk/fs/nfsd/nfsctl.c @@ -406,7 +406,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size) return rv; if (newthreads < 0) return -EINVAL; - rv = nfsd_svc(newthreads); + rv = nfsd_svc(NFS_PORT, newthreads); if (rv < 0) return rv; } else @@ -682,6 +682,25 @@ static ssize_t __write_ports_addfd(char *buf) return err; } +/* + * A '-' followed by the 'name' of a socket means we close the socket. + */ +static ssize_t __write_ports_delfd(char *buf) +{ + char *toclose; + int len = 0; + + toclose = kstrdup(buf + 1, GFP_KERNEL); + if (toclose == NULL) + return -ENOMEM; + + if (nfsd_serv != NULL) + len = svc_sock_names(nfsd_serv, buf, + SIMPLE_TRANSACTION_LIMIT, toclose); + kfree(toclose); + return len; +} + /* * A transport listener is added by writing it's transport name and * a port number. @@ -693,7 +712,7 @@ static ssize_t __write_ports_addxprt(char *buf) int port, err; struct net *net = &init_net; - if (sscanf(buf, "%15s %5u", transport, &port) != 2) + if (sscanf(buf, "%15s %4u", transport, &port) != 2) return -EINVAL; if (port < 1 || port > USHRT_MAX) @@ -727,6 +746,31 @@ static ssize_t __write_ports_addxprt(char *buf) return err; } +/* + * A transport listener is removed by writing a "-", it's transport + * name, and it's port number. + */ +static ssize_t __write_ports_delxprt(char *buf) +{ + struct svc_xprt *xprt; + char transport[16]; + int port; + + if (sscanf(&buf[1], "%15s %4u", transport, &port) != 2) + return -EINVAL; + + if (port < 1 || port > USHRT_MAX || nfsd_serv == NULL) + return -EINVAL; + + xprt = svc_find_xprt(nfsd_serv, transport, &init_net, AF_UNSPEC, port); + if (xprt == NULL) + return -ENOTCONN; + + svc_close_xprt(xprt); + svc_xprt_put(xprt); + return 0; +} + static ssize_t __write_ports(struct file *file, char *buf, size_t size) { if (size == 0) @@ -735,9 +779,15 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) if (isdigit(buf[0])) return __write_ports_addfd(buf); + if (buf[0] == '-' && isdigit(buf[1])) + return __write_ports_delfd(buf); + if (isalpha(buf[0])) return __write_ports_addxprt(buf); + if (buf[0] == '-' && isalpha(buf[1])) + return __write_ports_delxprt(buf); + return -EINVAL; } @@ -775,6 +825,21 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) * OR * * Input: + * buf: C string containing a "-" followed + * by an integer value representing a + * previously passed in socket file + * descriptor + * size: non-zero length of C string in @buf + * Output: + * On success: NFS service no longer listens on that socket; + * passed-in buffer filled with a '\n'-terminated C + * string containing a unique name of the listener; + * return code is the size in bytes of the string + * On error: return code is a negative errno value + * + * OR + * + * Input: * buf: C string containing a transport * name and an unsigned integer value * representing the port to listen on, @@ -783,6 +848,19 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) * Output: * On success: returns zero; NFS service is started * On error: return code is a negative errno value + * + * OR + * + * Input: + * buf: C string containing a "-" followed + * by a transport name and an unsigned + * integer value representing the port + * to listen on, separated by whitespace + * size: non-zero length of C string in @buf + * Output: + * On success: returns zero; NFS service no longer listens + * on that transport + * On error: return code is a negative errno value */ static ssize_t write_ports(struct file *file, char *buf, size_t size) { @@ -930,6 +1008,8 @@ static ssize_t write_gracetime(struct file *file, char *buf, size_t size) return nfsd4_write_time(file, buf, size, &nfsd4_grace); } +extern char *nfs4_recoverydir(void); + static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size) { char *mesg = buf; diff --git a/trunk/fs/nfsd/nfsd.h b/trunk/fs/nfsd/nfsd.h index 80d5ce40aadb..2244222368ab 100644 --- a/trunk/fs/nfsd/nfsd.h +++ b/trunk/fs/nfsd/nfsd.h @@ -65,7 +65,7 @@ extern const struct seq_operations nfs_exports_op; /* * Function prototypes. */ -int nfsd_svc(int nrservs); +int nfsd_svc(unsigned short port, int nrservs); int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp); int nfsd_nrthreads(void); @@ -124,7 +124,6 @@ int nfs4_state_start(void); void nfs4_state_shutdown(void); void nfs4_reset_lease(time_t leasetime); int nfs4_reset_recoverydir(char *recdir); -char * nfs4_recoverydir(void); #else static inline void nfs4_state_init(void) { } static inline int nfsd4_init_slabs(void) { return 0; } @@ -133,7 +132,6 @@ static inline int nfs4_state_start(void) { return 0; } static inline void nfs4_state_shutdown(void) { } static inline void nfs4_reset_lease(time_t leasetime) { } static inline int nfs4_reset_recoverydir(char *recdir) { return 0; } -static inline char * nfs4_recoverydir(void) {return NULL; } #endif /* diff --git a/trunk/fs/nfsd/nfssvc.c b/trunk/fs/nfsd/nfssvc.c index 2013aa001dab..240473cb708f 100644 --- a/trunk/fs/nfsd/nfssvc.c +++ b/trunk/fs/nfsd/nfssvc.c @@ -183,18 +183,18 @@ int nfsd_nrthreads(void) return rv; } -static int nfsd_init_socks(void) +static int nfsd_init_socks(int port) { int error; if (!list_empty(&nfsd_serv->sv_permsocks)) return 0; - error = svc_create_xprt(nfsd_serv, "udp", &init_net, PF_INET, NFS_PORT, + error = svc_create_xprt(nfsd_serv, "udp", &init_net, PF_INET, port, SVC_SOCK_DEFAULTS); if (error < 0) return error; - error = svc_create_xprt(nfsd_serv, "tcp", &init_net, PF_INET, NFS_PORT, + error = svc_create_xprt(nfsd_serv, "tcp", &init_net, PF_INET, port, SVC_SOCK_DEFAULTS); if (error < 0) return error; @@ -204,7 +204,7 @@ static int nfsd_init_socks(void) static bool nfsd_up = false; -static int nfsd_startup(int nrservs) +static int nfsd_startup(unsigned short port, int nrservs) { int ret; @@ -218,7 +218,7 @@ static int nfsd_startup(int nrservs) ret = nfsd_racache_init(2*nrservs); if (ret) return ret; - ret = nfsd_init_socks(); + ret = nfsd_init_socks(port); if (ret) goto out_racache; ret = lockd_up(&init_net); @@ -436,7 +436,7 @@ int nfsd_set_nrthreads(int n, int *nthreads) * this is the first time nrservs is nonzero. */ int -nfsd_svc(int nrservs) +nfsd_svc(unsigned short port, int nrservs) { int error; bool nfsd_up_before; @@ -458,7 +458,7 @@ nfsd_svc(int nrservs) nfsd_up_before = nfsd_up; - error = nfsd_startup(nrservs); + error = nfsd_startup(port, nrservs); if (error) goto out_destroy; error = svc_set_num_threads(nfsd_serv, NULL, nrservs); @@ -487,7 +487,7 @@ static int nfsd(void *vrqstp) { struct svc_rqst *rqstp = (struct svc_rqst *) vrqstp; - int err; + int err, preverr = 0; /* Lock module and set up kernel thread */ mutex_lock(&nfsd_mutex); @@ -534,6 +534,16 @@ nfsd(void *vrqstp) ; if (err == -EINTR) break; + else if (err < 0) { + if (err != preverr) { + printk(KERN_WARNING "%s: unexpected error " + "from svc_recv (%d)\n", __func__, -err); + preverr = err; + } + schedule_timeout_uninterruptible(HZ); + continue; + } + validate_process_creds(); svc_process(rqstp); validate_process_creds(); diff --git a/trunk/fs/nfsd/state.h b/trunk/fs/nfsd/state.h index e036894bce57..22bd0a66c356 100644 --- a/trunk/fs/nfsd/state.h +++ b/trunk/fs/nfsd/state.h @@ -373,7 +373,11 @@ static inline struct nfs4_lockowner * lockowner(struct nfs4_stateowner *so) return container_of(so, struct nfs4_lockowner, lo_owner); } -/* nfs4_file: a file opened by some number of (open) nfs4_stateowners. */ +/* +* nfs4_file: a file opened by some number of (open) nfs4_stateowners. +* o fi_perfile list is used to search for conflicting +* share_acces, share_deny on the file. +*/ struct nfs4_file { atomic_t fi_ref; struct list_head fi_hash; /* hash by "struct inode *" */ @@ -455,7 +459,7 @@ extern void nfs4_unlock_state(void); extern int nfs4_in_grace(void); extern void nfs4_release_reclaim(void); extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(struct nfs4_client *crp); -extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions); +extern __be32 nfs4_check_open_reclaim(clientid_t *clid); extern void nfs4_free_openowner(struct nfs4_openowner *); extern void nfs4_free_lockowner(struct nfs4_lockowner *); extern int set_callback_cred(void); diff --git a/trunk/fs/nfsd/vfs.c b/trunk/fs/nfsd/vfs.c index c120b48ec305..3f67b8e12251 100644 --- a/trunk/fs/nfsd/vfs.c +++ b/trunk/fs/nfsd/vfs.c @@ -1581,7 +1581,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) */ oldfs = get_fs(); set_fs(KERNEL_DS); - host_err = inode->i_op->readlink(path.dentry, (char __user *)buf, *lenp); + host_err = inode->i_op->readlink(path.dentry, buf, *lenp); set_fs(oldfs); if (host_err < 0) diff --git a/trunk/fs/open.c b/trunk/fs/open.c index 59071f55bf7f..44da0feeca2c 100644 --- a/trunk/fs/open.c +++ b/trunk/fs/open.c @@ -478,7 +478,7 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode) file = fget(fd); if (file) { - audit_inode(NULL, file->f_path.dentry, 0); + audit_inode(NULL, file->f_path.dentry); err = chmod_common(&file->f_path, mode); fput(file); } @@ -588,7 +588,7 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group) error = mnt_want_write_file(f.file); if (error) goto out_fput; - audit_inode(NULL, f.file->f_path.dentry, 0); + audit_inode(NULL, f.file->f_path.dentry); error = chown_common(&f.file->f_path, user, group); mnt_drop_write_file(f.file); out_fput: @@ -858,24 +858,6 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o return lookup_flags; } -/** - * file_open_name - open file and return file pointer - * - * @name: struct filename containing path to open - * @flags: open flags as per the open(2) second argument - * @mode: mode for the new file if O_CREAT is set, else ignored - * - * This is the helper to open a file from kernelspace if you really - * have to. But in generally you should not do this, so please move - * along, nothing to see here.. - */ -struct file *file_open_name(struct filename *name, int flags, umode_t mode) -{ - struct open_flags op; - int lookup = build_open_flags(flags, mode, &op); - return do_filp_open(AT_FDCWD, name, &op, lookup); -} - /** * filp_open - open file and return file pointer * @@ -889,8 +871,9 @@ struct file *file_open_name(struct filename *name, int flags, umode_t mode) */ struct file *filp_open(const char *filename, int flags, umode_t mode) { - struct filename name = {.name = filename}; - return file_open_name(&name, flags, mode); + struct open_flags op; + int lookup = build_open_flags(flags, mode, &op); + return do_filp_open(AT_FDCWD, filename, &op, lookup); } EXPORT_SYMBOL(filp_open); @@ -912,7 +895,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode) { struct open_flags op; int lookup = build_open_flags(flags, mode, &op); - struct filename *tmp = getname(filename); + char *tmp = getname(filename); int fd = PTR_ERR(tmp); if (!IS_ERR(tmp)) { diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index 144a96732dd7..ef5c84be66f9 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -2258,8 +2258,7 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) pid_t tgid = task_tgid_nr_ns(current, ns); char *name = ERR_PTR(-ENOENT); if (tgid) { - /* 11 for max length of signed int in decimal + NULL term */ - name = kmalloc(12, GFP_KERNEL); + name = __getname(); if (!name) name = ERR_PTR(-ENOMEM); else @@ -2274,7 +2273,7 @@ static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd, { char *s = nd_get_link(nd); if (!IS_ERR(s)) - kfree(s); + __putname(s); } static const struct inode_operations proc_self_inode_operations = { diff --git a/trunk/fs/quota/quota.c b/trunk/fs/quota/quota.c index af1661f7a54f..ff0135d6bc51 100644 --- a/trunk/fs/quota/quota.c +++ b/trunk/fs/quota/quota.c @@ -331,11 +331,11 @@ static struct super_block *quotactl_block(const char __user *special, int cmd) #ifdef CONFIG_BLOCK struct block_device *bdev; struct super_block *sb; - struct filename *tmp = getname(special); + char *tmp = getname(special); if (IS_ERR(tmp)) return ERR_CAST(tmp); - bdev = lookup_bdev(tmp->name); + bdev = lookup_bdev(tmp); putname(tmp); if (IS_ERR(bdev)) return ERR_CAST(bdev); diff --git a/trunk/fs/xattr.c b/trunk/fs/xattr.c index e164dddb8e96..1780f062dbaf 100644 --- a/trunk/fs/xattr.c +++ b/trunk/fs/xattr.c @@ -412,7 +412,7 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, if (!f.file) return error; dentry = f.file->f_path.dentry; - audit_inode(NULL, dentry, 0); + audit_inode(NULL, dentry); error = mnt_want_write_file(f.file); if (!error) { error = setxattr(dentry, name, value, size, flags); @@ -507,7 +507,7 @@ SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name, if (!f.file) return error; - audit_inode(NULL, f.file->f_path.dentry, 0); + audit_inode(NULL, f.file->f_path.dentry); error = getxattr(f.file->f_path.dentry, name, value, size); fdput(f); return error; @@ -586,7 +586,7 @@ SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size) if (!f.file) return error; - audit_inode(NULL, f.file->f_path.dentry, 0); + audit_inode(NULL, f.file->f_path.dentry); error = listxattr(f.file->f_path.dentry, list, size); fdput(f); return error; @@ -655,7 +655,7 @@ SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) if (!f.file) return error; dentry = f.file->f_path.dentry; - audit_inode(NULL, dentry, 0); + audit_inode(NULL, dentry); error = mnt_want_write_file(f.file); if (!error) { error = removexattr(dentry, name); diff --git a/trunk/include/linux/audit.h b/trunk/include/linux/audit.h index b889fa64b0e0..2c83e5f7edb1 100644 --- a/trunk/include/linux/audit.h +++ b/trunk/include/linux/audit.h @@ -337,7 +337,6 @@ enum { #define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE) #define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) -#define AUDIT_ARCH_OPENRISC (EM_OPENRISC) #define AUDIT_ARCH_PARISC (EM_PARISC) #define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_PPC (EM_PPC) @@ -453,16 +452,6 @@ struct audit_field { extern int __init audit_register_class(int class, unsigned *list); extern int audit_classify_syscall(int abi, unsigned syscall); extern int audit_classify_arch(int arch); - -/* audit_names->type values */ -#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ -#define AUDIT_TYPE_NORMAL 1 /* a "normal" audit record */ -#define AUDIT_TYPE_PARENT 2 /* a parent audit record */ -#define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ -#define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ - -struct filename; - #ifdef CONFIG_AUDITSYSCALL /* These are defined in auditsc.c */ /* Public API */ @@ -472,14 +461,11 @@ extern void __audit_syscall_entry(int arch, int major, unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3); extern void __audit_syscall_exit(int ret_success, long ret_value); -extern struct filename *__audit_reusename(const __user char *uptr); -extern void __audit_getname(struct filename *name); -extern void audit_putname(struct filename *name); -extern void __audit_inode(struct filename *name, const struct dentry *dentry, - unsigned int parent); -extern void __audit_inode_child(const struct inode *parent, - const struct dentry *dentry, - const unsigned char type); +extern void __audit_getname(const char *name); +extern void audit_putname(const char *name); +extern void __audit_inode(const char *name, const struct dentry *dentry); +extern void __audit_inode_child(const struct dentry *dentry, + const struct inode *parent); extern void __audit_seccomp(unsigned long syscall, long signr, int code); extern void __audit_ptrace(struct task_struct *t); @@ -509,27 +495,19 @@ static inline void audit_syscall_exit(void *pt_regs) __audit_syscall_exit(success, return_code); } } -static inline struct filename *audit_reusename(const __user char *name) -{ - if (unlikely(!audit_dummy_context())) - return __audit_reusename(name); - return NULL; -} -static inline void audit_getname(struct filename *name) +static inline void audit_getname(const char *name) { if (unlikely(!audit_dummy_context())) __audit_getname(name); } -static inline void audit_inode(struct filename *name, const struct dentry *dentry, - unsigned int parent) { +static inline void audit_inode(const char *name, const struct dentry *dentry) { if (unlikely(!audit_dummy_context())) - __audit_inode(name, dentry, parent); + __audit_inode(name, dentry); } -static inline void audit_inode_child(const struct inode *parent, - const struct dentry *dentry, - const unsigned char type) { +static inline void audit_inode_child(const struct dentry *dentry, + const struct inode *parent) { if (unlikely(!audit_dummy_context())) - __audit_inode_child(parent, dentry, type); + __audit_inode_child(dentry, parent); } void audit_core_dumps(long signr); @@ -673,29 +651,19 @@ static inline int audit_dummy_context(void) { return 1; } -static inline struct filename *audit_reusename(const __user char *name) -{ - return NULL; -} -static inline void audit_getname(struct filename *name) +static inline void audit_getname(const char *name) { } -static inline void audit_putname(struct filename *name) +static inline void audit_putname(const char *name) { } -static inline void __audit_inode(struct filename *name, - const struct dentry *dentry, - unsigned int parent) +static inline void __audit_inode(const char *name, const struct dentry *dentry) { } -static inline void __audit_inode_child(const struct inode *parent, - const struct dentry *dentry, - const unsigned char type) +static inline void __audit_inode_child(const struct dentry *dentry, + const struct inode *parent) { } -static inline void audit_inode(struct filename *name, - const struct dentry *dentry, - unsigned int parent) +static inline void audit_inode(const char *name, const struct dentry *dentry) { } -static inline void audit_inode_child(const struct inode *parent, - const struct dentry *dentry, - const unsigned char type) +static inline void audit_inode_child(const struct dentry *dentry, + const struct inode *parent) { } static inline void audit_core_dumps(long signr) { } diff --git a/trunk/include/linux/can/Kbuild b/trunk/include/linux/can/Kbuild index e69de29bb2d1..c62b7f1728f9 100644 --- a/trunk/include/linux/can/Kbuild +++ b/trunk/include/linux/can/Kbuild @@ -0,0 +1,5 @@ +header-y += raw.h +header-y += bcm.h +header-y += gw.h +header-y += error.h +header-y += netlink.h diff --git a/trunk/include/uapi/linux/can/bcm.h b/trunk/include/linux/can/bcm.h similarity index 100% rename from trunk/include/uapi/linux/can/bcm.h rename to trunk/include/linux/can/bcm.h diff --git a/trunk/include/uapi/linux/can/error.h b/trunk/include/linux/can/error.h similarity index 100% rename from trunk/include/uapi/linux/can/error.h rename to trunk/include/linux/can/error.h diff --git a/trunk/include/uapi/linux/can/gw.h b/trunk/include/linux/can/gw.h similarity index 100% rename from trunk/include/uapi/linux/can/gw.h rename to trunk/include/linux/can/gw.h diff --git a/trunk/include/uapi/linux/can/netlink.h b/trunk/include/linux/can/netlink.h similarity index 100% rename from trunk/include/uapi/linux/can/netlink.h rename to trunk/include/linux/can/netlink.h diff --git a/trunk/include/uapi/linux/can/raw.h b/trunk/include/linux/can/raw.h similarity index 100% rename from trunk/include/uapi/linux/can/raw.h rename to trunk/include/linux/can/raw.h diff --git a/trunk/include/linux/console.h b/trunk/include/linux/console.h index dedb082fe50f..7201ce4280ca 100644 --- a/trunk/include/linux/console.h +++ b/trunk/include/linux/console.h @@ -83,14 +83,8 @@ void give_up_console(const struct consw *sw); int con_debug_enter(struct vc_data *vc); int con_debug_leave(void); #else -static inline int con_debug_enter(struct vc_data *vc) -{ - return 0; -} -static inline int con_debug_leave(void) -{ - return 0; -} +#define con_debug_enter(vc) (0) +#define con_debug_leave() (0) #endif /* scroll */ diff --git a/trunk/include/linux/cpu_cooling.h b/trunk/include/linux/cpu_cooling.h deleted file mode 100644 index 851530128e65..000000000000 --- a/trunk/include/linux/cpu_cooling.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * linux/include/linux/cpu_cooling.h - * - * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) - * Copyright (C) 2012 Amit Daniel - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * 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; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -#ifndef __CPU_COOLING_H__ -#define __CPU_COOLING_H__ - -#include - -#define CPUFREQ_COOLING_START 0 -#define CPUFREQ_COOLING_STOP 1 - -#ifdef CONFIG_CPU_THERMAL -/** - * cpufreq_cooling_register - function to create cpufreq cooling device. - * @clip_cpus: cpumask of cpus where the frequency constraints will happen - */ -struct thermal_cooling_device *cpufreq_cooling_register( - struct cpumask *clip_cpus); - -/** - * cpufreq_cooling_unregister - function to remove cpufreq cooling device. - * @cdev: thermal cooling device pointer. - */ -void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); -#else /* !CONFIG_CPU_THERMAL */ -static inline struct thermal_cooling_device *cpufreq_cooling_register( - struct cpumask *clip_cpus) -{ - return NULL; -} -static inline void cpufreq_cooling_unregister( - struct thermal_cooling_device *cdev) -{ - return; -} -#endif /* CONFIG_CPU_THERMAL */ - -#endif /* __CPU_COOLING_H__ */ diff --git a/trunk/include/linux/fs.h b/trunk/include/linux/fs.h index 65fbf571023f..8ef2fc9f1f08 100644 --- a/trunk/include/linux/fs.h +++ b/trunk/include/linux/fs.h @@ -2196,13 +2196,6 @@ static inline int break_lease(struct inode *inode, unsigned int mode) #endif /* CONFIG_FILE_LOCKING */ /* fs/open.c */ -struct audit_names; -struct filename { - const char *name; /* pointer to actual string */ - const __user char *uptr; /* original userland pointer */ - struct audit_names *aname; - bool separate; /* should "name" be freed? */ -}; extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, struct file *filp); @@ -2210,15 +2203,12 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len); extern long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode); -extern struct file *file_open_name(struct filename *, int, umode_t); extern struct file *filp_open(const char *, int, umode_t); extern struct file *file_open_root(struct dentry *, struct vfsmount *, const char *, int); extern struct file * dentry_open(const struct path *, int, const struct cred *); extern int filp_close(struct file *, fl_owner_t id); - -extern struct filename *getname(const char __user *); - +extern char * getname(const char __user *); enum { FILE_CREATED = 1, FILE_OPENED = 2 @@ -2238,14 +2228,13 @@ extern void __init vfs_caches_init(unsigned long); extern struct kmem_cache *names_cachep; -extern void final_putname(struct filename *name); - -#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) +#define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp)) +#define __getname() __getname_gfp(GFP_KERNEL) #define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) #ifndef CONFIG_AUDITSYSCALL -#define putname(name) final_putname(name) +#define putname(name) __putname(name) #else -extern void putname(struct filename *name); +extern void putname(const char *name); #endif #ifdef CONFIG_BLOCK diff --git a/trunk/include/linux/fsnotify.h b/trunk/include/linux/fsnotify.h index 0fbfb4646d1b..a6dfe6944564 100644 --- a/trunk/include/linux/fsnotify.h +++ b/trunk/include/linux/fsnotify.h @@ -109,7 +109,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, if (source) fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); - audit_inode_child(new_dir, moved, AUDIT_TYPE_CHILD_CREATE); + audit_inode_child(moved, new_dir); } /* @@ -155,7 +155,7 @@ static inline void fsnotify_inoderemove(struct inode *inode) */ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) { - audit_inode_child(inode, dentry, AUDIT_TYPE_CHILD_CREATE); + audit_inode_child(dentry, inode); fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); } @@ -168,7 +168,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) { fsnotify_link_count(inode); - audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE); + audit_inode_child(new_dentry, dir); fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); } @@ -181,7 +181,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) __u32 mask = (FS_CREATE | FS_ISDIR); struct inode *d_inode = dentry->d_inode; - audit_inode_child(inode, dentry, AUDIT_TYPE_CHILD_CREATE); + audit_inode_child(dentry, inode); fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); } diff --git a/trunk/include/linux/if_link.h b/trunk/include/linux/if_link.h index 3265f332998a..e4dad4ddf085 100644 --- a/trunk/include/linux/if_link.h +++ b/trunk/include/linux/if_link.h @@ -284,16 +284,10 @@ enum { IFLA_VXLAN_LEARNING, IFLA_VXLAN_AGEING, IFLA_VXLAN_LIMIT, - IFLA_VXLAN_PORT_RANGE, __IFLA_VXLAN_MAX }; #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) -struct ifla_vxlan_port_range { - __be16 low; - __be16 high; -}; - /* SR-IOV virtual function management section */ enum { diff --git a/trunk/include/linux/input.h b/trunk/include/linux/input.h index 15464ba6bf53..ba4874302939 100644 --- a/trunk/include/linux/input.h +++ b/trunk/include/linux/input.h @@ -1396,8 +1396,8 @@ struct input_handle; * @start: starts handler for given handle. This function is called by * input core right after connect() method and also when a process * that "grabbed" a device releases it - * @legacy_minors: set to %true by drivers using legacy minor ranges - * @minor: beginning of range of 32 legacy minors for devices this driver + * @fops: file operations this driver implements + * @minor: beginning of range of 32 minors for devices this driver * can provide * @name: name of the handler, to be shown in /proc/bus/input/handlers * @id_table: pointer to a table of input_device_ids this driver can @@ -1431,7 +1431,7 @@ struct input_handler { void (*disconnect)(struct input_handle *handle); void (*start)(struct input_handle *handle); - bool legacy_minors; + const struct file_operations *fops; int minor; const char *name; @@ -1499,10 +1499,6 @@ void input_reset_device(struct input_dev *); int __must_check input_register_handler(struct input_handler *); void input_unregister_handler(struct input_handler *); -int __must_check input_get_new_minor(int legacy_base, unsigned int legacy_num, - bool allow_dynamic); -void input_free_minor(unsigned int minor); - int input_handler_for_each_handle(struct input_handler *, void *data, int (*fn)(struct input_handle *, void *)); diff --git a/trunk/include/linux/mmc/Kbuild b/trunk/include/linux/mmc/Kbuild index e69de29bb2d1..1fb26448faa9 100644 --- a/trunk/include/linux/mmc/Kbuild +++ b/trunk/include/linux/mmc/Kbuild @@ -0,0 +1 @@ +header-y += ioctl.h diff --git a/trunk/include/uapi/linux/mmc/ioctl.h b/trunk/include/linux/mmc/ioctl.h similarity index 100% rename from trunk/include/uapi/linux/mmc/ioctl.h rename to trunk/include/linux/mmc/ioctl.h diff --git a/trunk/include/linux/nfsd/Kbuild b/trunk/include/linux/nfsd/Kbuild index e69de29bb2d1..5b7d84ac954a 100644 --- a/trunk/include/linux/nfsd/Kbuild +++ b/trunk/include/linux/nfsd/Kbuild @@ -0,0 +1,5 @@ +header-y += cld.h +header-y += debug.h +header-y += export.h +header-y += nfsfh.h +header-y += stats.h diff --git a/trunk/include/uapi/linux/nfsd/cld.h b/trunk/include/linux/nfsd/cld.h similarity index 100% rename from trunk/include/uapi/linux/nfsd/cld.h rename to trunk/include/linux/nfsd/cld.h diff --git a/trunk/include/linux/nfsd/debug.h b/trunk/include/linux/nfsd/debug.h index 19ef8375b577..ee4aa91788e7 100644 --- a/trunk/include/linux/nfsd/debug.h +++ b/trunk/include/linux/nfsd/debug.h @@ -5,15 +5,44 @@ * * Copyright (C) 1995 Olaf Kirch */ + #ifndef LINUX_NFSD_DEBUG_H #define LINUX_NFSD_DEBUG_H -#include +#include +/* + * Enable debugging for nfsd. + * Requires RPC_DEBUG. + */ +#ifdef RPC_DEBUG +# define NFSD_DEBUG 1 +#endif + +/* + * knfsd debug flags + */ +#define NFSDDBG_SOCK 0x0001 +#define NFSDDBG_FH 0x0002 +#define NFSDDBG_EXPORT 0x0004 +#define NFSDDBG_SVC 0x0008 +#define NFSDDBG_PROC 0x0010 +#define NFSDDBG_FILEOP 0x0020 +#define NFSDDBG_AUTH 0x0040 +#define NFSDDBG_REPCACHE 0x0080 +#define NFSDDBG_XDR 0x0100 +#define NFSDDBG_LOCKD 0x0200 +#define NFSDDBG_ALL 0x7FFF +#define NFSDDBG_NOCHANGE 0xFFFF + + +#ifdef __KERNEL__ # undef ifdebug # ifdef NFSD_DEBUG # define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag) # else # define ifdebug(flag) if (0) # endif +#endif /* __KERNEL__ */ + #endif /* LINUX_NFSD_DEBUG_H */ diff --git a/trunk/include/linux/nfsd/export.h b/trunk/include/linux/nfsd/export.h index 24c139288db4..e33f747b173c 100644 --- a/trunk/include/linux/nfsd/export.h +++ b/trunk/include/linux/nfsd/export.h @@ -6,11 +6,58 @@ * * Copyright (C) 1995-1997 Olaf Kirch */ + #ifndef NFSD_EXPORT_H #define NFSD_EXPORT_H +# include +#ifdef __KERNEL__ # include -#include +#endif + +/* + * Important limits for the exports stuff. + */ +#define NFSCLNT_IDMAX 1024 +#define NFSCLNT_ADDRMAX 16 +#define NFSCLNT_KEYMAX 32 + +/* + * Export flags. + */ +#define NFSEXP_READONLY 0x0001 +#define NFSEXP_INSECURE_PORT 0x0002 +#define NFSEXP_ROOTSQUASH 0x0004 +#define NFSEXP_ALLSQUASH 0x0008 +#define NFSEXP_ASYNC 0x0010 +#define NFSEXP_GATHERED_WRITES 0x0020 +/* 40 80 100 currently unused */ +#define NFSEXP_NOHIDE 0x0200 +#define NFSEXP_NOSUBTREECHECK 0x0400 +#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ +#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */ +#define NFSEXP_FSID 0x2000 +#define NFSEXP_CROSSMOUNT 0x4000 +#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ +/* + * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4 + * clients, and only to the single directory that is the root of the + * export; further lookup and readdir operations are treated as if every + * subdirectory was a mountpoint, and ignored if they are not themselves + * exported. This is used by nfsd and mountd to construct the NFSv4 + * pseudofilesystem, which provides access only to paths leading to each + * exported filesystem. + */ +#define NFSEXP_V4ROOT 0x10000 +/* All flags that we claim to support. (Note we don't support NOACL.) */ +#define NFSEXP_ALLFLAGS 0x17E3F + +/* The flags that may vary depending on security flavor: */ +#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ + | NFSEXP_ALLSQUASH \ + | NFSEXP_INSECURE_PORT) + +#ifdef __KERNEL__ /* * FS Locations @@ -107,4 +154,7 @@ static inline void exp_get(struct svc_export *exp) } struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *); +#endif /* __KERNEL__ */ + #endif /* NFSD_EXPORT_H */ + diff --git a/trunk/include/linux/nfsd/nfsfh.h b/trunk/include/linux/nfsd/nfsfh.h index a93593f1fa4e..fa63048fecff 100644 --- a/trunk/include/linux/nfsd/nfsfh.h +++ b/trunk/include/linux/nfsd/nfsfh.h @@ -10,11 +10,117 @@ * * Copyright (C) 1995, 1996, 1997 Olaf Kirch */ + #ifndef _LINUX_NFSD_FH_H #define _LINUX_NFSD_FH_H +#include +#include +#include +#include +#include +#ifdef __KERNEL__ # include -#include +#endif + +/* + * This is the old "dentry style" Linux NFSv2 file handle. + * + * The xino and xdev fields are currently used to transport the + * ino/dev of the exported inode. + */ +struct nfs_fhbase_old { + __u32 fb_dcookie; /* dentry cookie - always 0xfeebbaca */ + __u32 fb_ino; /* our inode number */ + __u32 fb_dirino; /* dir inode number, 0 for directories */ + __u32 fb_dev; /* our device */ + __u32 fb_xdev; + __u32 fb_xino; + __u32 fb_generation; +}; + +/* + * This is the new flexible, extensible style NFSv2/v3 file handle. + * by Neil Brown - March 2000 + * + * The file handle starts with a sequence of four-byte words. + * The first word contains a version number (1) and three descriptor bytes + * that tell how the remaining 3 variable length fields should be handled. + * These three bytes are auth_type, fsid_type and fileid_type. + * + * All four-byte values are in host-byte-order. + * + * The auth_type field specifies how the filehandle can be authenticated + * This might allow a file to be confirmed to be in a writable part of a + * filetree without checking the path from it up to the root. + * Current values: + * 0 - No authentication. fb_auth is 0 bytes long + * Possible future values: + * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle + * prefixed by a secret and with the important export flags. + * + * The fsid_type identifies how the filesystem (or export point) is + * encoded. + * Current values: + * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number + * NOTE: we cannot use the kdev_t device id value, because kdev_t.h + * says we mustn't. We must break it up and reassemble. + * 1 - 4 byte user specified identifier + * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED + * 3 - 4 byte device id, encoded for user-space, 4 byte inode number + * 4 - 4 byte inode number and 4 byte uuid + * 5 - 8 byte uuid + * 6 - 16 byte uuid + * 7 - 8 byte inode number and 16 byte uuid + * + * The fileid_type identified how the file within the filesystem is encoded. + * This is (will be) passed to, and set by, the underlying filesystem if it supports + * filehandle operations. The filesystem must not use the value '0' or '0xff' and may + * only use the values 1 and 2 as defined below: + * Current values: + * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes. + * 1 - 32bit inode number, 32 bit generation number. + * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number. + * + */ +struct nfs_fhbase_new { + __u8 fb_version; /* == 1, even => nfs_fhbase_old */ + __u8 fb_auth_type; + __u8 fb_fsid_type; + __u8 fb_fileid_type; + __u32 fb_auth[1]; +/* __u32 fb_fsid[0]; floating */ +/* __u32 fb_fileid[0]; floating */ +}; + +struct knfsd_fh { + unsigned int fh_size; /* significant for NFSv3. + * Points to the current size while building + * a new file handle + */ + union { + struct nfs_fhbase_old fh_old; + __u32 fh_pad[NFS4_FHSIZE/4]; + struct nfs_fhbase_new fh_new; + } fh_base; +}; + +#define ofh_dcookie fh_base.fh_old.fb_dcookie +#define ofh_ino fh_base.fh_old.fb_ino +#define ofh_dirino fh_base.fh_old.fb_dirino +#define ofh_dev fh_base.fh_old.fb_dev +#define ofh_xdev fh_base.fh_old.fb_xdev +#define ofh_xino fh_base.fh_old.fb_xino +#define ofh_generation fh_base.fh_old.fb_generation + +#define fh_version fh_base.fh_new.fb_version +#define fh_fsid_type fh_base.fh_new.fb_fsid_type +#define fh_auth_type fh_base.fh_new.fb_auth_type +#define fh_fileid_type fh_base.fh_new.fb_fileid_type +#define fh_auth fh_base.fh_new.fb_auth +#define fh_fsid fh_base.fh_new.fb_auth + +#ifdef __KERNEL__ static inline __u32 ino_t_to_u32(ino_t ino) { @@ -60,4 +166,7 @@ typedef struct svc_fh { } svc_fh; +#endif /* __KERNEL__ */ + + #endif /* _LINUX_NFSD_FH_H */ diff --git a/trunk/include/linux/nfsd/stats.h b/trunk/include/linux/nfsd/stats.h index e75b2544ff12..2693ef647df6 100644 --- a/trunk/include/linux/nfsd/stats.h +++ b/trunk/include/linux/nfsd/stats.h @@ -5,11 +5,16 @@ * * Copyright (C) 1995, 1996 Olaf Kirch */ + #ifndef LINUX_NFSD_STATS_H #define LINUX_NFSD_STATS_H -#include +#include + +/* thread usage wraps very million seconds (approx one fortnight) */ +#define NFSD_USAGE_WRAP (HZ*1000000) +#ifdef __KERNEL__ struct nfsd_stats { unsigned int rchits; /* repcache hits */ @@ -42,4 +47,5 @@ extern struct svc_stat nfsd_svcstats; void nfsd_stat_init(void); void nfsd_stat_shutdown(void); +#endif /* __KERNEL__ */ #endif /* LINUX_NFSD_STATS_H */ diff --git a/trunk/include/linux/of_mdio.h b/trunk/include/linux/of_mdio.h index 8163107b94b4..6ef49b803efb 100644 --- a/trunk/include/linux/of_mdio.h +++ b/trunk/include/linux/of_mdio.h @@ -26,32 +26,32 @@ extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); #else /* CONFIG_OF */ -static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) +int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) { return -ENOSYS; } -static inline struct phy_device *of_phy_find_device(struct device_node *phy_np) +struct phy_device *of_phy_find_device(struct device_node *phy_np) { return NULL; } -static inline struct phy_device *of_phy_connect(struct net_device *dev, - struct device_node *phy_np, - void (*hndlr)(struct net_device *), - u32 flags, phy_interface_t iface) +struct phy_device *of_phy_connect(struct net_device *dev, + struct device_node *phy_np, + void (*hndlr)(struct net_device *), + u32 flags, phy_interface_t iface) { return NULL; } -static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, - void (*hndlr)(struct net_device *), - phy_interface_t iface) +struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, + void (*hndlr)(struct net_device *), + phy_interface_t iface) { return NULL; } -static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np) +struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np) { return NULL; } diff --git a/trunk/include/linux/perf_event.h b/trunk/include/linux/perf_event.h index b4166cdfa7a2..599afc4bb67e 100644 --- a/trunk/include/linux/perf_event.h +++ b/trunk/include/linux/perf_event.h @@ -1110,7 +1110,7 @@ struct perf_cpu_context { int exclusive; struct list_head rotation_list; int jiffies_interval; - struct pmu *unique_pmu; + struct pmu *active_pmu; struct perf_cgroup *cgrp; }; diff --git a/trunk/include/linux/platform_data/exynos_thermal.h b/trunk/include/linux/platform_data/exynos4_tmu.h similarity index 64% rename from trunk/include/linux/platform_data/exynos_thermal.h rename to trunk/include/linux/platform_data/exynos4_tmu.h index a7bdb2f63b73..39e038cca590 100644 --- a/trunk/include/linux/platform_data/exynos_thermal.h +++ b/trunk/include/linux/platform_data/exynos4_tmu.h @@ -1,5 +1,5 @@ /* - * exynos_thermal.h - Samsung EXYNOS TMU (Thermal Management Unit) + * exynos4_tmu.h - Samsung EXYNOS4 TMU (Thermal Management Unit) * * Copyright (C) 2011 Samsung Electronics * Donggeun Kim @@ -19,9 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _LINUX_EXYNOS_THERMAL_H -#define _LINUX_EXYNOS_THERMAL_H -#include +#ifndef _LINUX_EXYNOS4_TMU_H +#define _LINUX_EXYNOS4_TMU_H enum calibration_type { TYPE_ONE_POINT_TRIMMING, @@ -29,28 +28,8 @@ enum calibration_type { TYPE_NONE, }; -enum soc_type { - SOC_ARCH_EXYNOS4210 = 1, - SOC_ARCH_EXYNOS, -}; -/** - * struct freq_clip_table - * @freq_clip_max: maximum frequency allowed for this cooling state. - * @temp_level: Temperature level at which the temperature clipping will - * happen. - * @mask_val: cpumask of the allowed cpu's where the clipping will take place. - * - * This structure is required to be filled and passed to the - * cpufreq_cooling_unregister function. - */ -struct freq_clip_table { - unsigned int freq_clip_max; - unsigned int temp_level; - const struct cpumask *mask_val; -}; - /** - * struct exynos_tmu_platform_data + * struct exynos4_tmu_platform_data * @threshold: basic temperature for generating interrupt * 25 <= threshold <= 125 [unit: degree Celsius] * @trigger_levels: array for each interrupt levels @@ -84,18 +63,11 @@ struct freq_clip_table { * @reference_voltage: reference voltage of amplifier * in the positive-TC generator block * 0 <= reference_voltage <= 31 - * @noise_cancel_mode: noise cancellation mode - * 000, 100, 101, 110 and 111 can be different modes - * @type: determines the type of SOC - * @efuse_value: platform defined fuse value * @cal_type: calibration type for temperature - * @freq_clip_table: Table representing frequency reduction percentage. - * @freq_tab_count: Count of the above table as frequency reduction may - * applicable to only some of the trigger levels. * - * This structure is required for configuration of exynos_tmu driver. + * This structure is required for configuration of exynos4_tmu driver. */ -struct exynos_tmu_platform_data { +struct exynos4_tmu_platform_data { u8 threshold; u8 trigger_levels[4]; bool trigger_level0_en; @@ -105,12 +77,7 @@ struct exynos_tmu_platform_data { u8 gain; u8 reference_voltage; - u8 noise_cancel_mode; - u32 efuse_value; enum calibration_type cal_type; - enum soc_type type; - struct freq_clip_table freq_tab[4]; - unsigned int freq_tab_count; }; -#endif /* _LINUX_EXYNOS_THERMAL_H */ +#endif /* _LINUX_EXYNOS4_TMU_H */ diff --git a/trunk/include/linux/sunrpc/Kbuild b/trunk/include/linux/sunrpc/Kbuild index e69de29bb2d1..98df21164a86 100644 --- a/trunk/include/linux/sunrpc/Kbuild +++ b/trunk/include/linux/sunrpc/Kbuild @@ -0,0 +1 @@ +header-y += debug.h diff --git a/trunk/include/linux/sunrpc/debug.h b/trunk/include/linux/sunrpc/debug.h index 9385bd74c860..a76cc20d98ce 100644 --- a/trunk/include/linux/sunrpc/debug.h +++ b/trunk/include/linux/sunrpc/debug.h @@ -5,11 +5,28 @@ * * Copyright (C) 1996, Olaf Kirch */ + #ifndef _LINUX_SUNRPC_DEBUG_H_ #define _LINUX_SUNRPC_DEBUG_H_ -#include +/* + * RPC debug facilities + */ +#define RPCDBG_XPRT 0x0001 +#define RPCDBG_CALL 0x0002 +#define RPCDBG_DEBUG 0x0004 +#define RPCDBG_NFS 0x0008 +#define RPCDBG_AUTH 0x0010 +#define RPCDBG_BIND 0x0020 +#define RPCDBG_SCHED 0x0040 +#define RPCDBG_TRANS 0x0080 +#define RPCDBG_SVCXPRT 0x0100 +#define RPCDBG_SVCDSP 0x0200 +#define RPCDBG_MISC 0x0400 +#define RPCDBG_CACHE 0x0800 +#define RPCDBG_ALL 0x7fff +#ifdef __KERNEL__ /* * Enable RPC debugging/profiling. @@ -70,4 +87,24 @@ void rpc_register_sysctl(void); void rpc_unregister_sysctl(void); #endif +#endif /* __KERNEL__ */ + +/* + * Declarations for the sysctl debug interface, which allows to read or + * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc + * module currently registers its sysctl table dynamically, the sysctl path + * for module FOO is . + */ + +enum { + CTL_RPCDEBUG = 1, + CTL_NFSDEBUG, + CTL_NFSDDEBUG, + CTL_NLMDEBUG, + CTL_SLOTTABLE_UDP, + CTL_SLOTTABLE_TCP, + CTL_MIN_RESVPORT, + CTL_MAX_RESVPORT, +}; + #endif /* _LINUX_SUNRPC_DEBUG_H_ */ diff --git a/trunk/include/linux/sunrpc/svc_xprt.h b/trunk/include/linux/sunrpc/svc_xprt.h index b05963f09ebf..b3f64b12f141 100644 --- a/trunk/include/linux/sunrpc/svc_xprt.h +++ b/trunk/include/linux/sunrpc/svc_xprt.h @@ -114,6 +114,7 @@ void svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *, int svc_create_xprt(struct svc_serv *, const char *, struct net *, const int, const unsigned short, int); void svc_xprt_enqueue(struct svc_xprt *xprt); +void svc_xprt_received(struct svc_xprt *); void svc_xprt_put(struct svc_xprt *xprt); void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt); void svc_close_xprt(struct svc_xprt *xprt); @@ -123,7 +124,6 @@ struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, struct net *net, const sa_family_t af, const unsigned short port); int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); -void svc_add_new_perm_xprt(struct svc_serv *serv, struct svc_xprt *xprt); static inline void svc_xprt_get(struct svc_xprt *xprt) { @@ -166,7 +166,8 @@ static inline size_t svc_addr_len(const struct sockaddr *sa) case AF_INET6: return sizeof(struct sockaddr_in6); } - BUG(); + + return 0; } static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt) diff --git a/trunk/include/linux/sunrpc/svcsock.h b/trunk/include/linux/sunrpc/svcsock.h index 92ad02f0dcc0..cb4ac69e1f33 100644 --- a/trunk/include/linux/sunrpc/svcsock.h +++ b/trunk/include/linux/sunrpc/svcsock.h @@ -39,6 +39,9 @@ int svc_recv(struct svc_rqst *, long); int svc_send(struct svc_rqst *); void svc_drop(struct svc_rqst *); void svc_sock_update_bufs(struct svc_serv *serv); +int svc_sock_names(struct svc_serv *serv, char *buf, + const size_t buflen, + const char *toclose); int svc_addsock(struct svc_serv *serv, const int fd, char *name_return, const size_t len); void svc_init_xprt_sock(void); diff --git a/trunk/include/linux/syscalls.h b/trunk/include/linux/syscalls.h index 727f0cd73921..19439c75c5b2 100644 --- a/trunk/include/linux/syscalls.h +++ b/trunk/include/linux/syscalls.h @@ -827,15 +827,7 @@ asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, const char __user *pathname); asmlinkage long sys_syncfs(int fd); -#ifndef CONFIG_GENERIC_KERNEL_EXECVE int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); -#else -#define kernel_execve(filename, argv, envp) \ - do_execve(filename, \ - (const char __user *const __user *)argv, \ - (const char __user *const __user *)envp, \ - current_pt_regs()) -#endif asmlinkage long sys_perf_event_open( diff --git a/trunk/include/linux/thermal.h b/trunk/include/linux/thermal.h index 91b34812cd84..4b94a61955df 100644 --- a/trunk/include/linux/thermal.h +++ b/trunk/include/linux/thermal.h @@ -44,12 +44,6 @@ enum thermal_trip_type { THERMAL_TRIP_CRITICAL, }; -enum thermal_trend { - THERMAL_TREND_STABLE, /* temperature is stable */ - THERMAL_TREND_RAISING, /* temperature is raising */ - THERMAL_TREND_DROPPING, /* temperature is dropping */ -}; - struct thermal_zone_device_ops { int (*bind) (struct thermal_zone_device *, struct thermal_cooling_device *); @@ -71,8 +65,6 @@ struct thermal_zone_device_ops { int (*set_trip_hyst) (struct thermal_zone_device *, int, unsigned long); int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); - int (*get_trend) (struct thermal_zone_device *, int, - enum thermal_trend *); int (*notify) (struct thermal_zone_device *, int, enum thermal_trip_type); }; @@ -83,8 +75,6 @@ struct thermal_cooling_device_ops { int (*set_cur_state) (struct thermal_cooling_device *, unsigned long); }; -#define THERMAL_NO_LIMIT -1UL /* no upper/lower limit requirement */ - #define THERMAL_TRIPS_NONE -1 #define THERMAL_MAX_TRIPS 12 #define THERMAL_NAME_LENGTH 20 @@ -94,9 +84,6 @@ struct thermal_cooling_device { struct device device; void *devdata; const struct thermal_cooling_device_ops *ops; - bool updated; /* true if the cooling device does not need update */ - struct mutex lock; /* protect thermal_instances list */ - struct list_head thermal_instances; struct list_head node; }; @@ -118,16 +105,17 @@ struct thermal_zone_device { struct thermal_attr *trip_hyst_attrs; void *devdata; int trips; + int tc1; + int tc2; int passive_delay; int polling_delay; - int temperature; int last_temperature; - int passive; + bool passive; unsigned int forced_passive; const struct thermal_zone_device_ops *ops; - struct list_head thermal_instances; + struct list_head cooling_devices; struct idr idr; - struct mutex lock; /* protect thermal_instances list */ + struct mutex lock; /* protect cooling devices list */ struct list_head node; struct delayed_work poll_queue; }; @@ -164,12 +152,12 @@ enum { #define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, - void *, const struct thermal_zone_device_ops *, int, int); + void *, const struct thermal_zone_device_ops *, int tc1, + int tc2, int passive_freq, int polling_freq); void thermal_zone_device_unregister(struct thermal_zone_device *); int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, - struct thermal_cooling_device *, - unsigned long, unsigned long); + struct thermal_cooling_device *); int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *); void thermal_zone_device_update(struct thermal_zone_device *); diff --git a/trunk/include/linux/usb/usbnet.h b/trunk/include/linux/usb/usbnet.h index ddbbb7de894b..f87cf622317f 100644 --- a/trunk/include/linux/usb/usbnet.h +++ b/trunk/include/linux/usb/usbnet.h @@ -68,7 +68,6 @@ struct usbnet { # define EVENT_RX_PAUSED 5 # define EVENT_DEV_ASLEEP 6 # define EVENT_DEV_OPEN 7 -# define EVENT_DEVICE_REPORT_IDLE 8 }; static inline struct usb_driver *driver_of(struct usb_interface *intf) @@ -161,7 +160,6 @@ extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); extern int usbnet_suspend(struct usb_interface *, pm_message_t); extern int usbnet_resume(struct usb_interface *); extern void usbnet_disconnect(struct usb_interface *); -extern void usbnet_device_suggests_idle(struct usbnet *dev); /* Drivers that reuse some of the standard USB CDC infrastructure diff --git a/trunk/include/linux/virtio_scsi.h b/trunk/include/linux/virtio_scsi.h index d6b4440387b7..dc8d305b0e05 100644 --- a/trunk/include/linux/virtio_scsi.h +++ b/trunk/include/linux/virtio_scsi.h @@ -72,7 +72,6 @@ struct virtio_scsi_config { /* Feature Bits */ #define VIRTIO_SCSI_F_INOUT 0 #define VIRTIO_SCSI_F_HOTPLUG 1 -#define VIRTIO_SCSI_F_CHANGE 2 /* Response codes */ #define VIRTIO_SCSI_S_OK 0 @@ -109,7 +108,6 @@ struct virtio_scsi_config { #define VIRTIO_SCSI_T_NO_EVENT 0 #define VIRTIO_SCSI_T_TRANSPORT_RESET 1 #define VIRTIO_SCSI_T_ASYNC_NOTIFY 2 -#define VIRTIO_SCSI_T_PARAM_CHANGE 3 /* Reasons of transport reset event */ #define VIRTIO_SCSI_EVT_RESET_HARD 0 diff --git a/trunk/include/linux/wimax/Kbuild b/trunk/include/linux/wimax/Kbuild index e69de29bb2d1..3cb4f269bb09 100644 --- a/trunk/include/linux/wimax/Kbuild +++ b/trunk/include/linux/wimax/Kbuild @@ -0,0 +1 @@ +header-y += i2400m.h diff --git a/trunk/include/uapi/linux/wimax/i2400m.h b/trunk/include/linux/wimax/i2400m.h similarity index 100% rename from trunk/include/uapi/linux/wimax/i2400m.h rename to trunk/include/linux/wimax/i2400m.h diff --git a/trunk/include/scsi/fc/fc_fcp.h b/trunk/include/scsi/fc/fc_fcp.h index 9c8702942b61..0d7d67e96d43 100644 --- a/trunk/include/scsi/fc/fc_fcp.h +++ b/trunk/include/scsi/fc/fc_fcp.h @@ -127,9 +127,6 @@ struct fcp_txrdy { * * All response frames will always contain the fcp_resp template. Some * will also include the fcp_resp_len template. - * - * From Table 23, the FCP_RSP_INFO can either be 4 bytes or 8 bytes, both - * are valid length. */ struct fcp_resp { __u8 _fr_resvd[8]; /* reserved */ @@ -159,9 +156,6 @@ struct fcp_resp_rsp_info { __u8 _fr_resvd2[4]; /* reserved */ }; -#define FCP_RESP_RSP_INFO_LEN4 4 /* without reserved field */ -#define FCP_RESP_RSP_INFO_LEN8 8 /* with reserved field */ - struct fcp_resp_with_ext { struct fcp_resp resp; struct fcp_resp_ext ext; diff --git a/trunk/include/scsi/libfcoe.h b/trunk/include/scsi/libfcoe.h index 8742d853a3b8..22b07cc99808 100644 --- a/trunk/include/scsi/libfcoe.h +++ b/trunk/include/scsi/libfcoe.h @@ -327,6 +327,7 @@ struct fcoe_percpu_s { * @lport: The associated local port * @fcoe_pending_queue: The pending Rx queue of skbs * @fcoe_pending_queue_active: Indicates if the pending queue is active + * @priority: Packet priority (DCB) * @max_queue_depth: Max queue depth of pending queue * @min_queue_depth: Min queue depth of pending queue * @timer: The queue timer @@ -342,6 +343,7 @@ struct fcoe_port { struct fc_lport *lport; struct sk_buff_head fcoe_pending_queue; u8 fcoe_pending_queue_active; + u8 priority; u32 max_queue_depth; u32 min_queue_depth; struct timer_list timer; diff --git a/trunk/include/scsi/scsi_cmnd.h b/trunk/include/scsi/scsi_cmnd.h index de5f5d8f1f8a..ac06cc595890 100644 --- a/trunk/include/scsi/scsi_cmnd.h +++ b/trunk/include/scsi/scsi_cmnd.h @@ -132,10 +132,18 @@ struct scsi_cmnd { unsigned char tag; /* SCSI-II queued command tag */ }; -/* make sure not to use it with REQ_TYPE_BLOCK_PC commands */ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) { - return *(struct scsi_driver **)cmd->request->rq_disk->private_data; + struct scsi_driver **sdp; + + if (!cmd->request->rq_disk) + return NULL; + + sdp = (struct scsi_driver **)cmd->request->rq_disk->private_data; + if (!sdp) + return NULL; + + return *sdp; } extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); diff --git a/trunk/include/uapi/linux/can/Kbuild b/trunk/include/uapi/linux/can/Kbuild index 21c91bf25a29..aafaa5aa54d4 100644 --- a/trunk/include/uapi/linux/can/Kbuild +++ b/trunk/include/uapi/linux/can/Kbuild @@ -1,6 +1 @@ # UAPI Header export list -header-y += bcm.h -header-y += error.h -header-y += gw.h -header-y += netlink.h -header-y += raw.h diff --git a/trunk/include/uapi/linux/mmc/Kbuild b/trunk/include/uapi/linux/mmc/Kbuild index 8c1d2cb75e33..aafaa5aa54d4 100644 --- a/trunk/include/uapi/linux/mmc/Kbuild +++ b/trunk/include/uapi/linux/mmc/Kbuild @@ -1,2 +1 @@ # UAPI Header export list -header-y += ioctl.h diff --git a/trunk/include/uapi/linux/nfsd/Kbuild b/trunk/include/uapi/linux/nfsd/Kbuild index c11bc404053c..aafaa5aa54d4 100644 --- a/trunk/include/uapi/linux/nfsd/Kbuild +++ b/trunk/include/uapi/linux/nfsd/Kbuild @@ -1,6 +1 @@ # UAPI Header export list -header-y += cld.h -header-y += debug.h -header-y += export.h -header-y += nfsfh.h -header-y += stats.h diff --git a/trunk/include/uapi/linux/nfsd/debug.h b/trunk/include/uapi/linux/nfsd/debug.h deleted file mode 100644 index a6f453c740b8..000000000000 --- a/trunk/include/uapi/linux/nfsd/debug.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * linux/include/linux/nfsd/debug.h - * - * Debugging-related stuff for nfsd - * - * Copyright (C) 1995 Olaf Kirch - */ - -#ifndef _UAPILINUX_NFSD_DEBUG_H -#define _UAPILINUX_NFSD_DEBUG_H - -#include - -/* - * Enable debugging for nfsd. - * Requires RPC_DEBUG. - */ -#ifdef RPC_DEBUG -# define NFSD_DEBUG 1 -#endif - -/* - * knfsd debug flags - */ -#define NFSDDBG_SOCK 0x0001 -#define NFSDDBG_FH 0x0002 -#define NFSDDBG_EXPORT 0x0004 -#define NFSDDBG_SVC 0x0008 -#define NFSDDBG_PROC 0x0010 -#define NFSDDBG_FILEOP 0x0020 -#define NFSDDBG_AUTH 0x0040 -#define NFSDDBG_REPCACHE 0x0080 -#define NFSDDBG_XDR 0x0100 -#define NFSDDBG_LOCKD 0x0200 -#define NFSDDBG_ALL 0x7FFF -#define NFSDDBG_NOCHANGE 0xFFFF - - - -#endif /* _UAPILINUX_NFSD_DEBUG_H */ diff --git a/trunk/include/uapi/linux/nfsd/export.h b/trunk/include/uapi/linux/nfsd/export.h deleted file mode 100644 index cf47c313794e..000000000000 --- a/trunk/include/uapi/linux/nfsd/export.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * include/linux/nfsd/export.h - * - * Public declarations for NFS exports. The definitions for the - * syscall interface are in nfsctl.h - * - * Copyright (C) 1995-1997 Olaf Kirch - */ - -#ifndef _UAPINFSD_EXPORT_H -#define _UAPINFSD_EXPORT_H - -# include - -/* - * Important limits for the exports stuff. - */ -#define NFSCLNT_IDMAX 1024 -#define NFSCLNT_ADDRMAX 16 -#define NFSCLNT_KEYMAX 32 - -/* - * Export flags. - */ -#define NFSEXP_READONLY 0x0001 -#define NFSEXP_INSECURE_PORT 0x0002 -#define NFSEXP_ROOTSQUASH 0x0004 -#define NFSEXP_ALLSQUASH 0x0008 -#define NFSEXP_ASYNC 0x0010 -#define NFSEXP_GATHERED_WRITES 0x0020 -/* 40 80 100 currently unused */ -#define NFSEXP_NOHIDE 0x0200 -#define NFSEXP_NOSUBTREECHECK 0x0400 -#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ -#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */ -#define NFSEXP_FSID 0x2000 -#define NFSEXP_CROSSMOUNT 0x4000 -#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ -/* - * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4 - * clients, and only to the single directory that is the root of the - * export; further lookup and readdir operations are treated as if every - * subdirectory was a mountpoint, and ignored if they are not themselves - * exported. This is used by nfsd and mountd to construct the NFSv4 - * pseudofilesystem, which provides access only to paths leading to each - * exported filesystem. - */ -#define NFSEXP_V4ROOT 0x10000 -/* All flags that we claim to support. (Note we don't support NOACL.) */ -#define NFSEXP_ALLFLAGS 0x17E3F - -/* The flags that may vary depending on security flavor: */ -#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ - | NFSEXP_ALLSQUASH \ - | NFSEXP_INSECURE_PORT) - - -#endif /* _UAPINFSD_EXPORT_H */ diff --git a/trunk/include/uapi/linux/nfsd/nfsfh.h b/trunk/include/uapi/linux/nfsd/nfsfh.h deleted file mode 100644 index 616e3b396476..000000000000 --- a/trunk/include/uapi/linux/nfsd/nfsfh.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * include/linux/nfsd/nfsfh.h - * - * This file describes the layout of the file handles as passed - * over the wire. - * - * Earlier versions of knfsd used to sign file handles using keyed MD5 - * or SHA. I've removed this code, because it doesn't give you more - * security than blocking external access to port 2049 on your firewall. - * - * Copyright (C) 1995, 1996, 1997 Olaf Kirch - */ - -#ifndef _UAPI_LINUX_NFSD_FH_H -#define _UAPI_LINUX_NFSD_FH_H - -#include -#include -#include -#include -#include - -/* - * This is the old "dentry style" Linux NFSv2 file handle. - * - * The xino and xdev fields are currently used to transport the - * ino/dev of the exported inode. - */ -struct nfs_fhbase_old { - __u32 fb_dcookie; /* dentry cookie - always 0xfeebbaca */ - __u32 fb_ino; /* our inode number */ - __u32 fb_dirino; /* dir inode number, 0 for directories */ - __u32 fb_dev; /* our device */ - __u32 fb_xdev; - __u32 fb_xino; - __u32 fb_generation; -}; - -/* - * This is the new flexible, extensible style NFSv2/v3 file handle. - * by Neil Brown - March 2000 - * - * The file handle starts with a sequence of four-byte words. - * The first word contains a version number (1) and three descriptor bytes - * that tell how the remaining 3 variable length fields should be handled. - * These three bytes are auth_type, fsid_type and fileid_type. - * - * All four-byte values are in host-byte-order. - * - * The auth_type field specifies how the filehandle can be authenticated - * This might allow a file to be confirmed to be in a writable part of a - * filetree without checking the path from it up to the root. - * Current values: - * 0 - No authentication. fb_auth is 0 bytes long - * Possible future values: - * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle - * prefixed by a secret and with the important export flags. - * - * The fsid_type identifies how the filesystem (or export point) is - * encoded. - * Current values: - * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number - * NOTE: we cannot use the kdev_t device id value, because kdev_t.h - * says we mustn't. We must break it up and reassemble. - * 1 - 4 byte user specified identifier - * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED - * 3 - 4 byte device id, encoded for user-space, 4 byte inode number - * 4 - 4 byte inode number and 4 byte uuid - * 5 - 8 byte uuid - * 6 - 16 byte uuid - * 7 - 8 byte inode number and 16 byte uuid - * - * The fileid_type identified how the file within the filesystem is encoded. - * This is (will be) passed to, and set by, the underlying filesystem if it supports - * filehandle operations. The filesystem must not use the value '0' or '0xff' and may - * only use the values 1 and 2 as defined below: - * Current values: - * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes. - * 1 - 32bit inode number, 32 bit generation number. - * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number. - * - */ -struct nfs_fhbase_new { - __u8 fb_version; /* == 1, even => nfs_fhbase_old */ - __u8 fb_auth_type; - __u8 fb_fsid_type; - __u8 fb_fileid_type; - __u32 fb_auth[1]; -/* __u32 fb_fsid[0]; floating */ -/* __u32 fb_fileid[0]; floating */ -}; - -struct knfsd_fh { - unsigned int fh_size; /* significant for NFSv3. - * Points to the current size while building - * a new file handle - */ - union { - struct nfs_fhbase_old fh_old; - __u32 fh_pad[NFS4_FHSIZE/4]; - struct nfs_fhbase_new fh_new; - } fh_base; -}; - -#define ofh_dcookie fh_base.fh_old.fb_dcookie -#define ofh_ino fh_base.fh_old.fb_ino -#define ofh_dirino fh_base.fh_old.fb_dirino -#define ofh_dev fh_base.fh_old.fb_dev -#define ofh_xdev fh_base.fh_old.fb_xdev -#define ofh_xino fh_base.fh_old.fb_xino -#define ofh_generation fh_base.fh_old.fb_generation - -#define fh_version fh_base.fh_new.fb_version -#define fh_fsid_type fh_base.fh_new.fb_fsid_type -#define fh_auth_type fh_base.fh_new.fb_auth_type -#define fh_fileid_type fh_base.fh_new.fb_fileid_type -#define fh_auth fh_base.fh_new.fb_auth -#define fh_fsid fh_base.fh_new.fb_auth - - - -#endif /* _UAPI_LINUX_NFSD_FH_H */ diff --git a/trunk/include/uapi/linux/nfsd/stats.h b/trunk/include/uapi/linux/nfsd/stats.h deleted file mode 100644 index 9fb7a0644263..000000000000 --- a/trunk/include/uapi/linux/nfsd/stats.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * linux/include/linux/nfsd/stats.h - * - * Statistics for NFS server. - * - * Copyright (C) 1995, 1996 Olaf Kirch - */ - -#ifndef _UAPILINUX_NFSD_STATS_H -#define _UAPILINUX_NFSD_STATS_H - -#include - -/* thread usage wraps very million seconds (approx one fortnight) */ -#define NFSD_USAGE_WRAP (HZ*1000000) - -#endif /* _UAPILINUX_NFSD_STATS_H */ diff --git a/trunk/include/uapi/linux/sunrpc/Kbuild b/trunk/include/uapi/linux/sunrpc/Kbuild index 8e02e47c20fb..aafaa5aa54d4 100644 --- a/trunk/include/uapi/linux/sunrpc/Kbuild +++ b/trunk/include/uapi/linux/sunrpc/Kbuild @@ -1,2 +1 @@ # UAPI Header export list -header-y += debug.h diff --git a/trunk/include/uapi/linux/sunrpc/debug.h b/trunk/include/uapi/linux/sunrpc/debug.h deleted file mode 100644 index 830e34493a8c..000000000000 --- a/trunk/include/uapi/linux/sunrpc/debug.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * linux/include/linux/sunrpc/debug.h - * - * Debugging support for sunrpc module - * - * Copyright (C) 1996, Olaf Kirch - */ - -#ifndef _UAPI_LINUX_SUNRPC_DEBUG_H_ -#define _UAPI_LINUX_SUNRPC_DEBUG_H_ - -/* - * RPC debug facilities - */ -#define RPCDBG_XPRT 0x0001 -#define RPCDBG_CALL 0x0002 -#define RPCDBG_DEBUG 0x0004 -#define RPCDBG_NFS 0x0008 -#define RPCDBG_AUTH 0x0010 -#define RPCDBG_BIND 0x0020 -#define RPCDBG_SCHED 0x0040 -#define RPCDBG_TRANS 0x0080 -#define RPCDBG_SVCXPRT 0x0100 -#define RPCDBG_SVCDSP 0x0200 -#define RPCDBG_MISC 0x0400 -#define RPCDBG_CACHE 0x0800 -#define RPCDBG_ALL 0x7fff - - -/* - * Declarations for the sysctl debug interface, which allows to read or - * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc - * module currently registers its sysctl table dynamically, the sysctl path - * for module FOO is . - */ - -enum { - CTL_RPCDEBUG = 1, - CTL_NFSDEBUG, - CTL_NFSDDEBUG, - CTL_NLMDEBUG, - CTL_SLOTTABLE_UDP, - CTL_SLOTTABLE_TCP, - CTL_MIN_RESVPORT, - CTL_MAX_RESVPORT, -}; - -#endif /* _UAPI_LINUX_SUNRPC_DEBUG_H_ */ diff --git a/trunk/include/uapi/linux/wimax/Kbuild b/trunk/include/uapi/linux/wimax/Kbuild index 1c97be49971f..aafaa5aa54d4 100644 --- a/trunk/include/uapi/linux/wimax/Kbuild +++ b/trunk/include/uapi/linux/wimax/Kbuild @@ -1,2 +1 @@ # UAPI Header export list -header-y += i2400m.h diff --git a/trunk/include/uapi/xen/Kbuild b/trunk/include/uapi/xen/Kbuild index 61257cb14653..aafaa5aa54d4 100644 --- a/trunk/include/uapi/xen/Kbuild +++ b/trunk/include/uapi/xen/Kbuild @@ -1,3 +1 @@ # UAPI Header export list -header-y += evtchn.h -header-y += privcmd.h diff --git a/trunk/include/xen/Kbuild b/trunk/include/xen/Kbuild index e69de29bb2d1..84ad8f02fee5 100644 --- a/trunk/include/xen/Kbuild +++ b/trunk/include/xen/Kbuild @@ -0,0 +1,2 @@ +header-y += evtchn.h +header-y += privcmd.h diff --git a/trunk/include/uapi/xen/evtchn.h b/trunk/include/xen/evtchn.h similarity index 100% rename from trunk/include/uapi/xen/evtchn.h rename to trunk/include/xen/evtchn.h diff --git a/trunk/include/uapi/xen/privcmd.h b/trunk/include/xen/privcmd.h similarity index 100% rename from trunk/include/uapi/xen/privcmd.h rename to trunk/include/xen/privcmd.h diff --git a/trunk/init/do_mounts.c b/trunk/init/do_mounts.c index f8a66424360d..d3f0aeed2d39 100644 --- a/trunk/init/do_mounts.c +++ b/trunk/init/do_mounts.c @@ -353,9 +353,8 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data) void __init mount_block_root(char *name, int flags) { - struct page *page = alloc_page(GFP_KERNEL | - __GFP_NOTRACK_FALSE_POSITIVE); - char *fs_names = page_address(page); + char *fs_names = __getname_gfp(GFP_KERNEL + | __GFP_NOTRACK_FALSE_POSITIVE); char *p; #ifdef CONFIG_BLOCK char b[BDEVNAME_SIZE]; @@ -407,7 +406,7 @@ void __init mount_block_root(char *name, int flags) #endif panic("VFS: Unable to mount root fs on %s", b); out: - put_page(page); + putname(fs_names); } #ifdef CONFIG_ROOT_NFS diff --git a/trunk/init/do_mounts_initrd.c b/trunk/init/do_mounts_initrd.c index 5e4ded51788e..135959a276be 100644 --- a/trunk/init/do_mounts_initrd.c +++ b/trunk/init/do_mounts_initrd.c @@ -16,13 +16,13 @@ #include #include #include -#include #include "do_mounts.h" unsigned long initrd_start, initrd_end; int initrd_below_start_ok; unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */ +static int __initdata old_fd, root_fd; static int __initdata mount_initrd = 1; static int __init no_initrd(char *str) @@ -33,29 +33,33 @@ static int __init no_initrd(char *str) __setup("noinitrd", no_initrd); -static int init_linuxrc(struct subprocess_info *info, struct cred *new) +static int __init do_linuxrc(void *_shell) { - sys_unshare(CLONE_FS | CLONE_FILES); - /* move initrd over / and chdir/chroot in initrd root */ - sys_chdir("/root"); - sys_mount(".", "/", NULL, MS_MOVE, NULL); - sys_chroot("."); + static const char *argv[] = { "linuxrc", NULL, }; + extern const char *envp_init[]; + const char *shell = _shell; + + sys_close(old_fd);sys_close(root_fd); sys_setsid(); - return 0; + return kernel_execve(shell, argv, envp_init); } static void __init handle_initrd(void) { - static char *argv[] = { "linuxrc", NULL, }; - extern char *envp_init[]; int error; + int pid; real_root_dev = new_encode_dev(ROOT_DEV); create_dev("/dev/root.old", Root_RAM0); /* mount initrd on rootfs' /root */ mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY); sys_mkdir("/old", 0700); - sys_chdir("/old"); + root_fd = sys_open("/", 0, 0); + old_fd = sys_open("/old", 0, 0); + /* move initrd over / and chdir/chroot in initrd root */ + sys_chdir("/root"); + sys_mount(".", "/", NULL, MS_MOVE, NULL); + sys_chroot("."); /* * In case that a resume from disk is carried out by linuxrc or one of @@ -63,22 +67,27 @@ static void __init handle_initrd(void) */ current->flags |= PF_FREEZER_SKIP; - call_usermodehelper_fns("/linuxrc", argv, envp_init, UMH_WAIT_PROC, - init_linuxrc, NULL, NULL); + pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD); + if (pid > 0) + while (pid != sys_wait4(-1, NULL, 0, NULL)) + yield(); current->flags &= ~PF_FREEZER_SKIP; /* move initrd to rootfs' /old */ - sys_mount("..", ".", NULL, MS_MOVE, NULL); + sys_fchdir(old_fd); + sys_mount("/", ".", NULL, MS_MOVE, NULL); /* switch root and cwd back to / of rootfs */ - sys_chroot(".."); + sys_fchdir(root_fd); + sys_chroot("."); + sys_close(old_fd); + sys_close(root_fd); if (new_decode_dev(real_root_dev) == Root_RAM0) { sys_chdir("/old"); return; } - sys_chdir("/"); ROOT_DEV = new_decode_dev(real_root_dev); mount_root(); diff --git a/trunk/init/main.c b/trunk/init/main.c index 9cf77ab138a6..313360fe1118 100644 --- a/trunk/init/main.c +++ b/trunk/init/main.c @@ -69,7 +69,6 @@ #include #include #include -#include #include #include @@ -792,17 +791,17 @@ static void __init do_pre_smp_initcalls(void) do_one_initcall(*fn); } -static int run_init_process(const char *init_filename) +static void run_init_process(const char *init_filename) { argv_init[0] = init_filename; - return kernel_execve(init_filename, argv_init, envp_init); + kernel_execve(init_filename, argv_init, envp_init); } -static void __init kernel_init_freeable(void); - -static int __ref kernel_init(void *unused) +/* This is a non __init function. Force it to be noinline otherwise gcc + * makes it inline to init() and it becomes part of init.text section + */ +static noinline int init_post(void) { - kernel_init_freeable(); /* need to finish all async __init code before freeing the memory */ async_synchronize_full(); free_initmem(); @@ -814,8 +813,7 @@ static int __ref kernel_init(void *unused) flush_delayed_fput(); if (ramdisk_execute_command) { - if (!run_init_process(ramdisk_execute_command)) - return 0; + run_init_process(ramdisk_execute_command); printk(KERN_WARNING "Failed to execute %s\n", ramdisk_execute_command); } @@ -827,22 +825,20 @@ static int __ref kernel_init(void *unused) * trying to recover a really broken machine. */ if (execute_command) { - if (!run_init_process(execute_command)) - return 0; + run_init_process(execute_command); printk(KERN_WARNING "Failed to execute %s. Attempting " "defaults...\n", execute_command); } - if (!run_init_process("/sbin/init") || - !run_init_process("/etc/init") || - !run_init_process("/bin/init") || - !run_init_process("/bin/sh")) - return 0; + run_init_process("/sbin/init"); + run_init_process("/etc/init"); + run_init_process("/bin/init"); + run_init_process("/bin/sh"); panic("No init found. Try passing init= option to kernel. " "See Linux Documentation/init.txt for guidance."); } -static void __init kernel_init_freeable(void) +static int __init kernel_init(void * unused) { /* * Wait until kthreadd is all set-up. @@ -897,4 +893,7 @@ static void __init kernel_init_freeable(void) * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ + + init_post(); + return 0; } diff --git a/trunk/ipc/mqueue.c b/trunk/ipc/mqueue.c index 71a3ca18c873..6b97e2466fad 100644 --- a/trunk/ipc/mqueue.c +++ b/trunk/ipc/mqueue.c @@ -772,7 +772,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, { struct path path; struct file *filp; - struct filename *name; + char *name; struct mq_attr attr; int fd, error; struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; @@ -795,7 +795,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, ro = mnt_want_write(mnt); /* we'll drop it in any case */ error = 0; mutex_lock(&root->d_inode->i_mutex); - path.dentry = lookup_one_len(name->name, root, strlen(name->name)); + path.dentry = lookup_one_len(name, root, strlen(name)); if (IS_ERR(path.dentry)) { error = PTR_ERR(path.dentry); goto out_putfd; @@ -804,7 +804,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, if (oflag & O_CREAT) { if (path.dentry->d_inode) { /* entry already exists */ - audit_inode(name, path.dentry, 0); + audit_inode(name, path.dentry); if (oflag & O_EXCL) { error = -EEXIST; goto out; @@ -824,7 +824,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, error = -ENOENT; goto out; } - audit_inode(name, path.dentry, 0); + audit_inode(name, path.dentry); filp = do_open(&path, oflag); } @@ -849,7 +849,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) { int err; - struct filename *name; + char *name; struct dentry *dentry; struct inode *inode = NULL; struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; @@ -863,8 +863,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) if (err) goto out_name; mutex_lock_nested(&mnt->mnt_root->d_inode->i_mutex, I_MUTEX_PARENT); - dentry = lookup_one_len(name->name, mnt->mnt_root, - strlen(name->name)); + dentry = lookup_one_len(name, mnt->mnt_root, strlen(name)); if (IS_ERR(dentry)) { err = PTR_ERR(dentry); goto out_unlock; @@ -979,7 +978,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, goto out_fput; } info = MQUEUE_I(inode); - audit_inode(NULL, f.file->f_path.dentry, 0); + audit_inode(NULL, f.file->f_path.dentry); if (unlikely(!(f.file->f_mode & FMODE_WRITE))) { ret = -EBADF; @@ -1095,7 +1094,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, goto out_fput; } info = MQUEUE_I(inode); - audit_inode(NULL, f.file->f_path.dentry, 0); + audit_inode(NULL, f.file->f_path.dentry); if (unlikely(!(f.file->f_mode & FMODE_READ))) { ret = -EBADF; diff --git a/trunk/kernel/acct.c b/trunk/kernel/acct.c index 051e071a06e7..6cd7529c9e6a 100644 --- a/trunk/kernel/acct.c +++ b/trunk/kernel/acct.c @@ -193,7 +193,7 @@ static void acct_file_reopen(struct bsd_acct_struct *acct, struct file *file, } } -static int acct_on(struct filename *pathname) +static int acct_on(char *name) { struct file *file; struct vfsmount *mnt; @@ -201,7 +201,7 @@ static int acct_on(struct filename *pathname) struct bsd_acct_struct *acct = NULL; /* Difference from BSD - they don't do O_APPEND */ - file = file_open_name(pathname, O_WRONLY|O_APPEND|O_LARGEFILE, 0); + file = filp_open(name, O_WRONLY|O_APPEND|O_LARGEFILE, 0); if (IS_ERR(file)) return PTR_ERR(file); @@ -260,7 +260,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name) return -EPERM; if (name) { - struct filename *tmp = getname(name); + char *tmp = getname(name); if (IS_ERR(tmp)) return (PTR_ERR(tmp)); error = acct_on(tmp); diff --git a/trunk/kernel/audit.h b/trunk/kernel/audit.h index d51cba868e1b..9eb3d79482b6 100644 --- a/trunk/kernel/audit.h +++ b/trunk/kernel/audit.h @@ -74,15 +74,12 @@ static inline int audit_hash_ino(u32 ino) return (ino & (AUDIT_INODE_BUCKETS-1)); } -/* Indicates that audit should log the full pathname. */ -#define AUDIT_NAME_FULL -1 - extern int audit_match_class(int class, unsigned syscall); extern int audit_comparator(const u32 left, const u32 op, const u32 right); extern int audit_uid_comparator(kuid_t left, u32 op, kuid_t right); extern int audit_gid_comparator(kgid_t left, u32 op, kgid_t right); -extern int parent_len(const char *path); -extern int audit_compare_dname_path(const char *dname, const char *path, int plen); +extern int audit_compare_dname_path(const char *dname, const char *path, + int *dirlen); extern struct sk_buff * audit_make_reply(int pid, int seq, int type, int done, int multi, const void *payload, int size); diff --git a/trunk/kernel/audit_watch.c b/trunk/kernel/audit_watch.c index 9a9ae6e3d290..1c22ec3d87bc 100644 --- a/trunk/kernel/audit_watch.c +++ b/trunk/kernel/audit_watch.c @@ -265,8 +265,7 @@ static void audit_update_watch(struct audit_parent *parent, /* Run all of the watches on this parent looking for the one that * matches the given dname */ list_for_each_entry_safe(owatch, nextw, &parent->watches, wlist) { - if (audit_compare_dname_path(dname, owatch->path, - AUDIT_NAME_FULL)) + if (audit_compare_dname_path(dname, owatch->path, NULL)) continue; /* If the update involves invalidating rules, do the inode-based diff --git a/trunk/kernel/auditfilter.c b/trunk/kernel/auditfilter.c index 7f19f23d38a3..c4bcdbaf4d4d 100644 --- a/trunk/kernel/auditfilter.c +++ b/trunk/kernel/auditfilter.c @@ -1298,60 +1298,41 @@ int audit_gid_comparator(kgid_t left, u32 op, kgid_t right) } } -/** - * parent_len - find the length of the parent portion of a pathname - * @path: pathname of which to determine length - */ -int parent_len(const char *path) +/* Compare given dentry name with last component in given path, + * return of 0 indicates a match. */ +int audit_compare_dname_path(const char *dname, const char *path, + int *dirlen) { - int plen; + int dlen, plen; const char *p; - plen = strlen(path); + if (!dname || !path) + return 1; - if (plen == 0) - return plen; + dlen = strlen(dname); + plen = strlen(path); + if (plen < dlen) + return 1; /* disregard trailing slashes */ p = path + plen - 1; while ((*p == '/') && (p > path)) p--; - /* walk backward until we find the next slash or hit beginning */ - while ((*p != '/') && (p > path)) - p--; - - /* did we find a slash? Then increment to include it in path */ - if (*p == '/') - p++; - - return p - path; -} - -/** - * audit_compare_dname_path - compare given dentry name with last component in - * given path. Return of 0 indicates a match. - * @dname: dentry name that we're comparing - * @path: full pathname that we're comparing - * @parentlen: length of the parent if known. Passing in AUDIT_NAME_FULL - * here indicates that we must compute this value. - */ -int audit_compare_dname_path(const char *dname, const char *path, int parentlen) -{ - int dlen, pathlen; - const char *p; - - dlen = strlen(dname); - pathlen = strlen(path); - if (pathlen < dlen) + /* find last path component */ + p = p - dlen + 1; + if (p < path) return 1; + else if (p > path) { + if (*--p != '/') + return 1; + else + p++; + } - parentlen = parentlen == AUDIT_NAME_FULL ? parent_len(path) : parentlen; - if (pathlen - parentlen != dlen) - return 1; - - p = path + parentlen; - + /* return length of path's directory component */ + if (dirlen) + *dirlen = p - path; return strncmp(p, dname, dlen); } diff --git a/trunk/kernel/auditsc.c b/trunk/kernel/auditsc.c index 2f186ed80c40..f4a7756f999c 100644 --- a/trunk/kernel/auditsc.c +++ b/trunk/kernel/auditsc.c @@ -81,6 +81,9 @@ * a name dynamically and also add those to the list anchored by names_list. */ #define AUDIT_NAMES 5 +/* Indicates that audit should log the full pathname. */ +#define AUDIT_NAME_FULL -1 + /* no execve audit message should be longer than this (userspace limits) */ #define MAX_EXECVE_AUDIT_LEN 7500 @@ -103,29 +106,27 @@ struct audit_cap_data { * we don't let putname() free it (instead we free all of the saved * pointers at syscall exit time). * - * Further, in fs/namei.c:path_lookup() we store the inode and device. - */ + * Further, in fs/namei.c:path_lookup() we store the inode and device. */ struct audit_names { - struct list_head list; /* audit_context->names_list */ - struct filename *name; - unsigned long ino; - dev_t dev; - umode_t mode; - kuid_t uid; - kgid_t gid; - dev_t rdev; - u32 osid; - struct audit_cap_data fcap; - unsigned int fcap_ver; - int name_len; /* number of name's characters to log */ - unsigned char type; /* record type */ - bool name_put; /* call __putname() for this name */ + struct list_head list; /* audit_context->names_list */ + const char *name; + unsigned long ino; + dev_t dev; + umode_t mode; + kuid_t uid; + kgid_t gid; + dev_t rdev; + u32 osid; + struct audit_cap_data fcap; + unsigned int fcap_ver; + int name_len; /* number of name's characters to log */ + bool name_put; /* call __putname() for this name */ /* * This was an allocated audit_names and not from the array of * names allocated in the task audit context. Thus this name * should be freed on syscall exit */ - bool should_free; + bool should_free; }; struct audit_aux_data { @@ -997,7 +998,7 @@ static inline void audit_free_names(struct audit_context *context) context->ino_count); list_for_each_entry(n, &context->names_list, list) { printk(KERN_ERR "names[%d] = %p = %s\n", i, - n->name, n->name->name ?: "(null)"); + n->name, n->name ?: "(null)"); } dump_stack(); return; @@ -1554,7 +1555,7 @@ static void audit_log_name(struct audit_context *context, struct audit_names *n, case AUDIT_NAME_FULL: /* log the full path */ audit_log_format(ab, " name="); - audit_log_untrustedstring(ab, n->name->name); + audit_log_untrustedstring(ab, n->name); break; case 0: /* name was specified as a relative path and the @@ -1564,7 +1565,7 @@ static void audit_log_name(struct audit_context *context, struct audit_names *n, default: /* log the name's directory component */ audit_log_format(ab, " name="); - audit_log_n_untrustedstring(ab, n->name->name, + audit_log_n_untrustedstring(ab, n->name, n->name_len); } } else @@ -1994,8 +1995,7 @@ static void handle_path(const struct dentry *dentry) #endif } -static struct audit_names *audit_alloc_name(struct audit_context *context, - unsigned char type) +static struct audit_names *audit_alloc_name(struct audit_context *context) { struct audit_names *aname; @@ -2010,7 +2010,6 @@ static struct audit_names *audit_alloc_name(struct audit_context *context, } aname->ino = (unsigned long)-1; - aname->type = type; list_add_tail(&aname->list, &context->names_list); context->name_count++; @@ -2020,29 +2019,6 @@ static struct audit_names *audit_alloc_name(struct audit_context *context, return aname; } -/** - * audit_reusename - fill out filename with info from existing entry - * @uptr: userland ptr to pathname - * - * Search the audit_names list for the current audit context. If there is an - * existing entry with a matching "uptr" then return the filename - * associated with that audit_name. If not, return NULL. - */ -struct filename * -__audit_reusename(const __user char *uptr) -{ - struct audit_context *context = current->audit_context; - struct audit_names *n; - - list_for_each_entry(n, &context->names_list, list) { - if (!n->name) - continue; - if (n->name->uptr == uptr) - return n->name; - } - return NULL; -} - /** * audit_getname - add a name to the list * @name: name to add @@ -2050,7 +2026,7 @@ __audit_reusename(const __user char *uptr) * Add a name to the list of audit names for this context. * Called from fs/namei.c:getname(). */ -void __audit_getname(struct filename *name) +void __audit_getname(const char *name) { struct audit_context *context = current->audit_context; struct audit_names *n; @@ -2064,19 +2040,13 @@ void __audit_getname(struct filename *name) return; } -#if AUDIT_DEBUG - /* The filename _must_ have a populated ->name */ - BUG_ON(!name->name); -#endif - - n = audit_alloc_name(context, AUDIT_TYPE_UNKNOWN); + n = audit_alloc_name(context); if (!n) return; n->name = name; n->name_len = AUDIT_NAME_FULL; n->name_put = true; - name->aname = n; if (!context->pwd.dentry) get_fs_pwd(current->fs, &context->pwd); @@ -2089,7 +2059,7 @@ void __audit_getname(struct filename *name) * then we delay the putname until syscall exit. * Called from include/linux/fs.h:putname(). */ -void audit_putname(struct filename *name) +void audit_putname(const char *name) { struct audit_context *context = current->audit_context; @@ -2104,7 +2074,7 @@ void audit_putname(struct filename *name) list_for_each_entry(n, &context->names_list, list) printk(KERN_ERR "name[%d] = %p = %s\n", i, - n->name, n->name->name ?: "(null)"); + n->name, n->name ?: "(null)"); } #endif __putname(name); @@ -2118,8 +2088,8 @@ void audit_putname(struct filename *name) " put_count=%d\n", __FILE__, __LINE__, context->serial, context->major, - context->in_syscall, name->name, - context->name_count, context->put_count); + context->in_syscall, name, context->name_count, + context->put_count); dump_stack(); } } @@ -2162,13 +2132,13 @@ static void audit_copy_inode(struct audit_names *name, const struct dentry *dent } /** - * __audit_inode - store the inode and device from a lookup + * audit_inode - store the inode and device from a lookup * @name: name being audited * @dentry: dentry being audited - * @parent: does this dentry represent the parent? + * + * Called from fs/namei.c:path_lookup(). */ -void __audit_inode(struct filename *name, const struct dentry *dentry, - unsigned int parent) +void __audit_inode(const char *name, const struct dentry *dentry) { struct audit_context *context = current->audit_context; const struct inode *inode = dentry->d_inode; @@ -2177,69 +2147,24 @@ void __audit_inode(struct filename *name, const struct dentry *dentry, if (!context->in_syscall) return; - if (!name) - goto out_alloc; - -#if AUDIT_DEBUG - /* The struct filename _must_ have a populated ->name */ - BUG_ON(!name->name); -#endif - /* - * If we have a pointer to an audit_names entry already, then we can - * just use it directly if the type is correct. - */ - n = name->aname; - if (n) { - if (parent) { - if (n->type == AUDIT_TYPE_PARENT || - n->type == AUDIT_TYPE_UNKNOWN) - goto out; - } else { - if (n->type != AUDIT_TYPE_PARENT) - goto out; - } - } - list_for_each_entry_reverse(n, &context->names_list, list) { - /* does the name pointer match? */ - if (!n->name || n->name->name != name->name) - continue; - - /* match the correct record type */ - if (parent) { - if (n->type == AUDIT_TYPE_PARENT || - n->type == AUDIT_TYPE_UNKNOWN) - goto out; - } else { - if (n->type != AUDIT_TYPE_PARENT) - goto out; - } + if (n->name && (n->name == name)) + goto out; } -out_alloc: - /* unable to find the name from a previous getname(). Allocate a new - * anonymous entry. - */ - n = audit_alloc_name(context, AUDIT_TYPE_NORMAL); + /* unable to find the name from a previous getname() */ + n = audit_alloc_name(context); if (!n) return; out: - if (parent) { - n->name_len = n->name ? parent_len(n->name->name) : AUDIT_NAME_FULL; - n->type = AUDIT_TYPE_PARENT; - } else { - n->name_len = AUDIT_NAME_FULL; - n->type = AUDIT_TYPE_NORMAL; - } handle_path(dentry); audit_copy_inode(n, dentry, inode); } /** - * __audit_inode_child - collect inode info for created/removed objects - * @parent: inode of dentry parent + * audit_inode_child - collect inode info for created/removed objects * @dentry: dentry being audited - * @type: AUDIT_TYPE_* value that we're looking for + * @parent: inode of dentry parent * * For syscalls that create or remove filesystem objects, audit_inode * can only collect information for the filesystem object's parent. @@ -2249,14 +2174,15 @@ void __audit_inode(struct filename *name, const struct dentry *dentry, * must be hooked prior, in order to capture the target inode during * unsuccessful attempts. */ -void __audit_inode_child(const struct inode *parent, - const struct dentry *dentry, - const unsigned char type) +void __audit_inode_child(const struct dentry *dentry, + const struct inode *parent) { struct audit_context *context = current->audit_context; + const char *found_parent = NULL, *found_child = NULL; const struct inode *inode = dentry->d_inode; const char *dname = dentry->d_name.name; - struct audit_names *n, *found_parent = NULL, *found_child = NULL; + struct audit_names *n; + int dirlen = 0; if (!context->in_syscall) return; @@ -2264,65 +2190,62 @@ void __audit_inode_child(const struct inode *parent, if (inode) handle_one(inode); - /* look for a parent entry first */ + /* parent is more likely, look for it first */ list_for_each_entry(n, &context->names_list, list) { - if (!n->name || n->type != AUDIT_TYPE_PARENT) + if (!n->name) continue; if (n->ino == parent->i_ino && - !audit_compare_dname_path(dname, n->name->name, n->name_len)) { - found_parent = n; - break; + !audit_compare_dname_path(dname, n->name, &dirlen)) { + n->name_len = dirlen; /* update parent data in place */ + found_parent = n->name; + goto add_names; } } - /* is there a matching child entry? */ + /* no matching parent, look for matching child */ list_for_each_entry(n, &context->names_list, list) { - /* can only match entries that have a name */ - if (!n->name || n->type != type) - continue; - - /* if we found a parent, make sure this one is a child of it */ - if (found_parent && (n->name != found_parent->name)) + if (!n->name) continue; - if (!strcmp(dname, n->name->name) || - !audit_compare_dname_path(dname, n->name->name, - found_parent ? - found_parent->name_len : - AUDIT_NAME_FULL)) { - found_child = n; - break; + /* strcmp() is the more likely scenario */ + if (!strcmp(dname, n->name) || + !audit_compare_dname_path(dname, n->name, &dirlen)) { + if (inode) + audit_copy_inode(n, NULL, inode); + else + n->ino = (unsigned long)-1; + found_child = n->name; + goto add_names; } } +add_names: if (!found_parent) { - /* create a new, "anonymous" parent record */ - n = audit_alloc_name(context, AUDIT_TYPE_PARENT); + n = audit_alloc_name(context); if (!n) return; audit_copy_inode(n, NULL, parent); } if (!found_child) { - found_child = audit_alloc_name(context, type); - if (!found_child) + n = audit_alloc_name(context); + if (!n) return; /* Re-use the name belonging to the slot for a matching parent * directory. All names for this context are relinquished in * audit_free_names() */ if (found_parent) { - found_child->name = found_parent->name; - found_child->name_len = AUDIT_NAME_FULL; + n->name = found_parent; + n->name_len = AUDIT_NAME_FULL; /* don't call __putname() */ - found_child->name_put = false; + n->name_put = false; } + + if (inode) + audit_copy_inode(n, NULL, inode); } - if (inode) - audit_copy_inode(found_child, dentry, inode); - else - found_child->ino = (unsigned long)-1; } EXPORT_SYMBOL_GPL(__audit_inode_child); diff --git a/trunk/kernel/debug/debug_core.c b/trunk/kernel/debug/debug_core.c index 9a61738cefc8..17e073c309e6 100644 --- a/trunk/kernel/debug/debug_core.c +++ b/trunk/kernel/debug/debug_core.c @@ -696,22 +696,6 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs) return ret; } -/* - * GDB places a breakpoint at this function to know dynamically - * loaded objects. It's not defined static so that only one instance with this - * name exists in the kernel. - */ - -static int module_event(struct notifier_block *self, unsigned long val, - void *data) -{ - return 0; -} - -static struct notifier_block dbg_module_load_nb = { - .notifier_call = module_event, -}; - int kgdb_nmicallback(int cpu, void *regs) { #ifdef CONFIG_SMP @@ -840,7 +824,6 @@ static void kgdb_register_callbacks(void) kgdb_arch_init(); if (!dbg_is_early) kgdb_arch_late(); - register_module_notifier(&dbg_module_load_nb); register_reboot_notifier(&dbg_reboot_notifier); atomic_notifier_chain_register(&panic_notifier_list, &kgdb_panic_event_nb); @@ -864,7 +847,6 @@ static void kgdb_unregister_callbacks(void) if (kgdb_io_module_registered) { kgdb_io_module_registered = 0; unregister_reboot_notifier(&dbg_reboot_notifier); - unregister_module_notifier(&dbg_module_load_nb); atomic_notifier_chain_unregister(&panic_notifier_list, &kgdb_panic_event_nb); kgdb_arch_exit(); diff --git a/trunk/kernel/debug/kdb/kdb_bt.c b/trunk/kernel/debug/kdb/kdb_bt.c index b03e0e814e43..07c9bbb94a0b 100644 --- a/trunk/kernel/debug/kdb/kdb_bt.c +++ b/trunk/kernel/debug/kdb/kdb_bt.c @@ -129,8 +129,6 @@ kdb_bt(int argc, const char **argv) } /* Now the inactive tasks */ kdb_do_each_thread(g, p) { - if (KDB_FLAG(CMD_INTERRUPT)) - return 0; if (task_curr(p)) continue; if (kdb_bt1(p, mask, argcount, btaprompt)) diff --git a/trunk/kernel/debug/kdb/kdb_io.c b/trunk/kernel/debug/kdb/kdb_io.c index 14ff4849262c..0a69d2adc4f3 100644 --- a/trunk/kernel/debug/kdb/kdb_io.c +++ b/trunk/kernel/debug/kdb/kdb_io.c @@ -552,7 +552,6 @@ int vkdb_printf(const char *fmt, va_list ap) { int diag; int linecount; - int colcount; int logging, saved_loglevel = 0; int saved_trap_printk; int got_printf_lock = 0; @@ -585,10 +584,6 @@ int vkdb_printf(const char *fmt, va_list ap) if (diag || linecount <= 1) linecount = 24; - diag = kdbgetintenv("COLUMNS", &colcount); - if (diag || colcount <= 1) - colcount = 80; - diag = kdbgetintenv("LOGGING", &logging); if (diag) logging = 0; @@ -695,7 +690,7 @@ int vkdb_printf(const char *fmt, va_list ap) gdbstub_msg_write(kdb_buffer, retlen); } else { if (dbg_io_ops && !dbg_io_ops->is_console) { - len = retlen; + len = strlen(kdb_buffer); cp = kdb_buffer; while (len--) { dbg_io_ops->write_char(*cp); @@ -714,29 +709,11 @@ int vkdb_printf(const char *fmt, va_list ap) printk(KERN_INFO "%s", kdb_buffer); } - if (KDB_STATE(PAGER)) { - /* - * Check printed string to decide how to bump the - * kdb_nextline to control when the more prompt should - * show up. - */ - int got = 0; - len = retlen; - while (len--) { - if (kdb_buffer[len] == '\n') { - kdb_nextline++; - got = 0; - } else if (kdb_buffer[len] == '\r') { - got = 0; - } else { - got++; - } - } - kdb_nextline += got / (colcount + 1); - } + if (KDB_STATE(PAGER) && strchr(kdb_buffer, '\n')) + kdb_nextline++; /* check for having reached the LINES number of printed lines */ - if (kdb_nextline >= linecount) { + if (kdb_nextline == linecount) { char buf1[16] = ""; /* Watch out for recursion here. Any routine that calls @@ -788,7 +765,7 @@ int vkdb_printf(const char *fmt, va_list ap) kdb_grepping_flag = 0; kdb_printf("\n"); } else if (buf1[0] == ' ') { - kdb_printf("\r"); + kdb_printf("\n"); suspend_grep = 1; /* for this recursion */ } else if (buf1[0] == '\n') { kdb_nextline = linecount - 1; diff --git a/trunk/kernel/debug/kdb/kdb_main.c b/trunk/kernel/debug/kdb/kdb_main.c index 4d5f8d5612f3..1261dc7eaeb9 100644 --- a/trunk/kernel/debug/kdb/kdb_main.c +++ b/trunk/kernel/debug/kdb/kdb_main.c @@ -2101,8 +2101,6 @@ static int kdb_dmesg(int argc, const char **argv) } if (!lines--) break; - if (KDB_FLAG(CMD_INTERRUPT)) - return 0; kdb_printf("%.*s\n", (int)len - 1, buf); } diff --git a/trunk/kernel/events/core.c b/trunk/kernel/events/core.c index dbccf83c134d..cda3ebd49e86 100644 --- a/trunk/kernel/events/core.c +++ b/trunk/kernel/events/core.c @@ -372,8 +372,6 @@ void perf_cgroup_switch(struct task_struct *task, int mode) list_for_each_entry_rcu(pmu, &pmus, entry) { cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); - if (cpuctx->unique_pmu != pmu) - continue; /* ensure we process each cpuctx once */ /* * perf_cgroup_events says at least one @@ -397,10 +395,9 @@ void perf_cgroup_switch(struct task_struct *task, int mode) if (mode & PERF_CGROUP_SWIN) { WARN_ON_ONCE(cpuctx->cgrp); - /* - * set cgrp before ctxsw in to allow - * event_filter_match() to not have to pass - * task around + /* set cgrp before ctxsw in to + * allow event_filter_match() to not + * have to pass task around */ cpuctx->cgrp = perf_cgroup_from_task(task); cpu_ctx_sched_in(cpuctx, EVENT_ALL, task); @@ -4415,7 +4412,7 @@ static void perf_event_task_event(struct perf_task_event *task_event) rcu_read_lock(); list_for_each_entry_rcu(pmu, &pmus, entry) { cpuctx = get_cpu_ptr(pmu->pmu_cpu_context); - if (cpuctx->unique_pmu != pmu) + if (cpuctx->active_pmu != pmu) goto next; perf_event_task_ctx(&cpuctx->ctx, task_event); @@ -4561,7 +4558,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event) rcu_read_lock(); list_for_each_entry_rcu(pmu, &pmus, entry) { cpuctx = get_cpu_ptr(pmu->pmu_cpu_context); - if (cpuctx->unique_pmu != pmu) + if (cpuctx->active_pmu != pmu) goto next; perf_event_comm_ctx(&cpuctx->ctx, comm_event); @@ -4757,7 +4754,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) rcu_read_lock(); list_for_each_entry_rcu(pmu, &pmus, entry) { cpuctx = get_cpu_ptr(pmu->pmu_cpu_context); - if (cpuctx->unique_pmu != pmu) + if (cpuctx->active_pmu != pmu) goto next; perf_event_mmap_ctx(&cpuctx->ctx, mmap_event, vma->vm_flags & VM_EXEC); @@ -5858,8 +5855,8 @@ static void update_pmu_context(struct pmu *pmu, struct pmu *old_pmu) cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu); - if (cpuctx->unique_pmu == old_pmu) - cpuctx->unique_pmu = pmu; + if (cpuctx->active_pmu == old_pmu) + cpuctx->active_pmu = pmu; } } @@ -5994,7 +5991,7 @@ int perf_pmu_register(struct pmu *pmu, char *name, int type) cpuctx->ctx.pmu = pmu; cpuctx->jiffies_interval = 1; INIT_LIST_HEAD(&cpuctx->rotation_list); - cpuctx->unique_pmu = pmu; + cpuctx->active_pmu = pmu; } got_cpu_context: diff --git a/trunk/kernel/kmod.c b/trunk/kernel/kmod.c index 1c317e386831..6f99aead66c6 100644 --- a/trunk/kernel/kmod.c +++ b/trunk/kernel/kmod.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -222,13 +221,11 @@ static int ____call_usermodehelper(void *data) retval = kernel_execve(sub_info->path, (const char *const *)sub_info->argv, (const char *const *)sub_info->envp); - if (!retval) - return 0; /* Exec failed? */ fail: sub_info->retval = retval; - do_exit(0); + return 0; } static int call_helper(void *data) @@ -295,7 +292,7 @@ static int wait_for_helper(void *data) } umh_complete(sub_info); - do_exit(0); + return 0; } /* This is run by khelper thread */ diff --git a/trunk/kernel/kthread.c b/trunk/kernel/kthread.c index 29fb60caecb5..146a6fa96825 100644 --- a/trunk/kernel/kthread.c +++ b/trunk/kernel/kthread.c @@ -16,7 +16,6 @@ #include #include #include -#include #include static DEFINE_SPINLOCK(kthread_create_lock); diff --git a/trunk/mm/swapfile.c b/trunk/mm/swapfile.c index 71cd288b2001..14e254c768fc 100644 --- a/trunk/mm/swapfile.c +++ b/trunk/mm/swapfile.c @@ -1483,7 +1483,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) struct file *swap_file, *victim; struct address_space *mapping; struct inode *inode; - struct filename *pathname; + char *pathname; int oom_score_adj; int i, type, prev; int err; @@ -1498,7 +1498,8 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) if (IS_ERR(pathname)) goto out; - victim = file_open_name(pathname, O_RDWR|O_LARGEFILE, 0); + victim = filp_open(pathname, O_RDWR|O_LARGEFILE, 0); + putname(pathname); err = PTR_ERR(victim); if (IS_ERR(victim)) goto out; @@ -1935,7 +1936,7 @@ static int setup_swap_map_and_extents(struct swap_info_struct *p, SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) { struct swap_info_struct *p; - struct filename *name; + char *name; struct file *swap_file = NULL; struct address_space *mapping; int i; @@ -1966,7 +1967,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) name = NULL; goto bad_swap; } - swap_file = file_open_name(name, O_RDWR|O_LARGEFILE, 0); + swap_file = filp_open(name, O_RDWR|O_LARGEFILE, 0); if (IS_ERR(swap_file)) { error = PTR_ERR(swap_file); swap_file = NULL; @@ -2052,7 +2053,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) printk(KERN_INFO "Adding %uk swap on %s. " "Priority:%d extents:%d across:%lluk %s%s%s\n", - p->pages<<(PAGE_SHIFT-10), name->name, p->prio, + p->pages<<(PAGE_SHIFT-10), name, p->prio, nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10), (p->flags & SWP_SOLIDSTATE) ? "SS" : "", (p->flags & SWP_DISCARDABLE) ? "D" : "", diff --git a/trunk/net/bluetooth/af_bluetooth.c b/trunk/net/bluetooth/af_bluetooth.c index 9d49ee6d7219..ba033f09196e 100644 --- a/trunk/net/bluetooth/af_bluetooth.c +++ b/trunk/net/bluetooth/af_bluetooth.c @@ -591,7 +591,7 @@ static int bt_seq_show(struct seq_file *seq, void *v) atomic_read(&sk->sk_refcnt), sk_rmem_alloc_get(sk), sk_wmem_alloc_get(sk), - sock_i_uid(sk), + from_kuid(seq_user_ns(seq), sock_i_uid(sk)), sock_i_ino(sk), &src_baswapped, &dst_baswapped, diff --git a/trunk/net/bridge/br_netfilter.c b/trunk/net/bridge/br_netfilter.c index fe43bc7b063f..68e8f364bbf8 100644 --- a/trunk/net/bridge/br_netfilter.c +++ b/trunk/net/bridge/br_netfilter.c @@ -265,9 +265,6 @@ static int br_parse_ip_options(struct sk_buff *skb) struct net_device *dev = skb->dev; u32 len; - if (!pskb_may_pull(skb, sizeof(struct iphdr))) - goto inhdr_error; - iph = ip_hdr(skb); opt = &(IPCB(skb)->opt); diff --git a/trunk/net/core/pktgen.c b/trunk/net/core/pktgen.c index d1dc14c2aac4..148e73d2c451 100644 --- a/trunk/net/core/pktgen.c +++ b/trunk/net/core/pktgen.c @@ -248,8 +248,8 @@ struct pktgen_dev { int removal_mark; /* non-zero => the device is marked for * removal by worker thread */ - int min_pkt_size; - int max_pkt_size; + int min_pkt_size; /* = ETH_ZLEN; */ + int max_pkt_size; /* = ETH_ZLEN; */ int pkt_overhead; /* overhead for MPLS, VLANs, IPSEC etc */ int nfrags; struct page *page; @@ -449,6 +449,8 @@ static void pktgen_stop_all_threads_ifs(void); static void pktgen_stop(struct pktgen_thread *t); static void pktgen_clear_counters(struct pktgen_dev *pkt_dev); +static unsigned int scan_ip6(const char *s, char ip[16]); + /* Module parameters, defaults. */ static int pg_count_d __read_mostly = 1000; static int pg_delay_d __read_mostly; @@ -700,8 +702,8 @@ static int pktgen_if_show(struct seq_file *seq, void *v) &pkt_dev->cur_in6_saddr, &pkt_dev->cur_in6_daddr); } else - seq_printf(seq, " cur_saddr: %pI4 cur_daddr: %pI4\n", - &pkt_dev->cur_saddr, &pkt_dev->cur_daddr); + seq_printf(seq, " cur_saddr: 0x%x cur_daddr: 0x%x\n", + pkt_dev->cur_saddr, pkt_dev->cur_daddr); seq_printf(seq, " cur_udp_dst: %d cur_udp_src: %d\n", pkt_dev->cur_udp_dst, pkt_dev->cur_udp_src); @@ -1297,7 +1299,7 @@ static ssize_t pktgen_if_write(struct file *file, return -EFAULT; buf[len] = 0; - in6_pton(buf, -1, pkt_dev->in6_daddr.s6_addr, -1, NULL); + scan_ip6(buf, pkt_dev->in6_daddr.s6_addr); snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->in6_daddr); pkt_dev->cur_in6_daddr = pkt_dev->in6_daddr; @@ -1320,7 +1322,7 @@ static ssize_t pktgen_if_write(struct file *file, return -EFAULT; buf[len] = 0; - in6_pton(buf, -1, pkt_dev->min_in6_daddr.s6_addr, -1, NULL); + scan_ip6(buf, pkt_dev->min_in6_daddr.s6_addr); snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->min_in6_daddr); pkt_dev->cur_in6_daddr = pkt_dev->min_in6_daddr; @@ -1342,7 +1344,7 @@ static ssize_t pktgen_if_write(struct file *file, return -EFAULT; buf[len] = 0; - in6_pton(buf, -1, pkt_dev->max_in6_daddr.s6_addr, -1, NULL); + scan_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->max_in6_daddr); if (debug) @@ -1363,7 +1365,7 @@ static ssize_t pktgen_if_write(struct file *file, return -EFAULT; buf[len] = 0; - in6_pton(buf, -1, pkt_dev->in6_saddr.s6_addr, -1, NULL); + scan_ip6(buf, pkt_dev->in6_saddr.s6_addr); snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->in6_saddr); pkt_dev->cur_in6_saddr = pkt_dev->in6_saddr; @@ -2034,17 +2036,19 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) /* Set up Dest MAC */ memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN); + /* Set up pkt size */ + pkt_dev->cur_pkt_size = pkt_dev->min_pkt_size; + if (pkt_dev->flags & F_IPV6) { + /* + * Skip this automatic address setting until locks or functions + * gets exported + */ + +#ifdef NOTNOW int i, set = 0, err = 1; struct inet6_dev *idev; - if (pkt_dev->min_pkt_size == 0) { - pkt_dev->min_pkt_size = 14 + sizeof(struct ipv6hdr) - + sizeof(struct udphdr) - + sizeof(struct pktgen_hdr) - + pkt_dev->pkt_overhead; - } - for (i = 0; i < IN6_ADDR_HSIZE; i++) if (pkt_dev->cur_in6_saddr.s6_addr[i]) { set = 1; @@ -2065,8 +2069,9 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) struct inet6_ifaddr *ifp; read_lock_bh(&idev->lock); - list_for_each_entry(ifp, &idev->addr_list, if_list) { - if ((ifp->scope & IFA_LINK) && + for (ifp = idev->addr_list; ifp; + ifp = ifp->if_next) { + if (ifp->scope == IFA_LINK && !(ifp->flags & IFA_F_TENTATIVE)) { pkt_dev->cur_in6_saddr = ifp->addr; err = 0; @@ -2079,14 +2084,8 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) if (err) pr_err("ERROR: IPv6 link address not available\n"); } +#endif } else { - if (pkt_dev->min_pkt_size == 0) { - pkt_dev->min_pkt_size = 14 + sizeof(struct iphdr) - + sizeof(struct udphdr) - + sizeof(struct pktgen_hdr) - + pkt_dev->pkt_overhead; - } - pkt_dev->saddr_min = 0; pkt_dev->saddr_max = 0; if (strlen(pkt_dev->src_min) == 0) { @@ -2112,10 +2111,6 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) pkt_dev->daddr_max = in_aton(pkt_dev->dst_max); } /* Initialize current values. */ - pkt_dev->cur_pkt_size = pkt_dev->min_pkt_size; - if (pkt_dev->min_pkt_size > pkt_dev->max_pkt_size) - pkt_dev->max_pkt_size = pkt_dev->min_pkt_size; - pkt_dev->cur_dst_mac_offset = 0; pkt_dev->cur_src_mac_offset = 0; pkt_dev->cur_saddr = pkt_dev->saddr_min; @@ -2763,6 +2758,97 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, return skb; } +/* + * scan_ip6, fmt_ip taken from dietlibc-0.21 + * Author Felix von Leitner + * + * Slightly modified for kernel. + * Should be candidate for net/ipv4/utils.c + * --ro + */ + +static unsigned int scan_ip6(const char *s, char ip[16]) +{ + unsigned int i; + unsigned int len = 0; + unsigned long u; + char suffix[16]; + unsigned int prefixlen = 0; + unsigned int suffixlen = 0; + __be32 tmp; + char *pos; + + for (i = 0; i < 16; i++) + ip[i] = 0; + + for (;;) { + if (*s == ':') { + len++; + if (s[1] == ':') { /* Found "::", skip to part 2 */ + s += 2; + len++; + break; + } + s++; + } + + u = simple_strtoul(s, &pos, 16); + i = pos - s; + if (!i) + return 0; + if (prefixlen == 12 && s[i] == '.') { + + /* the last 4 bytes may be written as IPv4 address */ + + tmp = in_aton(s); + memcpy((struct in_addr *)(ip + 12), &tmp, sizeof(tmp)); + return i + len; + } + ip[prefixlen++] = (u >> 8); + ip[prefixlen++] = (u & 255); + s += i; + len += i; + if (prefixlen == 16) + return len; + } + +/* part 2, after "::" */ + for (;;) { + if (*s == ':') { + if (suffixlen == 0) + break; + s++; + len++; + } else if (suffixlen != 0) + break; + + u = simple_strtol(s, &pos, 16); + i = pos - s; + if (!i) { + if (*s) + len--; + break; + } + if (suffixlen + prefixlen <= 12 && s[i] == '.') { + tmp = in_aton(s); + memcpy((struct in_addr *)(suffix + suffixlen), &tmp, + sizeof(tmp)); + suffixlen += 4; + len += strlen(s); + break; + } + suffix[suffixlen++] = (u >> 8); + suffix[suffixlen++] = (u & 255); + s += i; + len += i; + if (prefixlen + suffixlen == 16) + break; + } + for (i = 0; i < suffixlen; i++) + ip[16 - suffixlen + i] = suffix[i]; + return len; +} + static struct sk_buff *fill_packet_ipv6(struct net_device *odev, struct pktgen_dev *pkt_dev) { @@ -2841,7 +2927,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, sizeof(struct ipv6hdr) - sizeof(struct udphdr) - pkt_dev->pkt_overhead; - if (datalen < 0 || datalen < sizeof(struct pktgen_hdr)) { + if (datalen < sizeof(struct pktgen_hdr)) { datalen = sizeof(struct pktgen_hdr); net_info_ratelimited("increased datalen to %d\n", datalen); } @@ -3462,6 +3548,8 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) } pkt_dev->removal_mark = 0; + pkt_dev->min_pkt_size = ETH_ZLEN; + pkt_dev->max_pkt_size = ETH_ZLEN; pkt_dev->nfrags = 0; pkt_dev->delay = pg_delay_d; pkt_dev->count = pg_count_d; diff --git a/trunk/net/core/utils.c b/trunk/net/core/utils.c index e3487e461939..f5613d569c23 100644 --- a/trunk/net/core/utils.c +++ b/trunk/net/core/utils.c @@ -107,18 +107,6 @@ static inline int xdigit2bin(char c, int delim) return IN6PTON_UNKNOWN; } -/** - * in4_pton - convert an IPv4 address from literal to binary representation - * @src: the start of the IPv4 address string - * @srclen: the length of the string, -1 means strlen(src) - * @dst: the binary (u8[4] array) representation of the IPv4 address - * @delim: the delimiter of the IPv4 address in @src, -1 means no delimiter - * @end: A pointer to the end of the parsed string will be placed here - * - * Return one on success, return zero when any error occurs - * and @end will point to the end of the parsed string. - * - */ int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end) @@ -173,18 +161,6 @@ int in4_pton(const char *src, int srclen, } EXPORT_SYMBOL(in4_pton); -/** - * in6_pton - convert an IPv6 address from literal to binary representation - * @src: the start of the IPv6 address string - * @srclen: the length of the string, -1 means strlen(src) - * @dst: the binary (u8[16] array) representation of the IPv6 address - * @delim: the delimiter of the IPv6 address in @src, -1 means no delimiter - * @end: A pointer to the end of the parsed string will be placed here - * - * Return one on success, return zero when any error occurs - * and @end will point to the end of the parsed string. - * - */ int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end) diff --git a/trunk/net/ipv4/ip_vti.c b/trunk/net/ipv4/ip_vti.c index 1831092f999f..978bca4818ae 100644 --- a/trunk/net/ipv4/ip_vti.c +++ b/trunk/net/ipv4/ip_vti.c @@ -374,7 +374,7 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) memset(&fl4, 0, sizeof(fl4)); flowi4_init_output(&fl4, tunnel->parms.link, - be32_to_cpu(tunnel->parms.i_key), RT_TOS(tos), + htonl(tunnel->parms.i_key), RT_TOS(tos), RT_SCOPE_UNIVERSE, IPPROTO_IPIP, 0, dst, tiph->saddr, 0, 0); @@ -441,7 +441,7 @@ static int vti_tunnel_bind_dev(struct net_device *dev) struct flowi4 fl4; memset(&fl4, 0, sizeof(fl4)); flowi4_init_output(&fl4, tunnel->parms.link, - be32_to_cpu(tunnel->parms.i_key), + htonl(tunnel->parms.i_key), RT_TOS(iph->tos), RT_SCOPE_UNIVERSE, IPPROTO_IPIP, 0, iph->daddr, iph->saddr, 0, 0); diff --git a/trunk/net/ipv4/route.c b/trunk/net/ipv4/route.c index 432f4bb77238..1a0da8dc8180 100644 --- a/trunk/net/ipv4/route.c +++ b/trunk/net/ipv4/route.c @@ -2220,7 +2220,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, goto nla_put_failure; if (fl4->flowi4_mark && - nla_put_u32(skb, RTA_MARK, fl4->flowi4_mark)) + nla_put_be32(skb, RTA_MARK, fl4->flowi4_mark)) goto nla_put_failure; error = rt->dst.error; diff --git a/trunk/net/ipv4/sysctl_net_ipv4.c b/trunk/net/ipv4/sysctl_net_ipv4.c index 63d4eccc674d..9205e492dc9d 100644 --- a/trunk/net/ipv4/sysctl_net_ipv4.c +++ b/trunk/net/ipv4/sysctl_net_ipv4.c @@ -248,8 +248,6 @@ int proc_tcp_fastopen_key(ctl_table *ctl, int write, void __user *buffer, ctxt = rcu_dereference(tcp_fastopen_ctx); if (ctxt) memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH); - else - memset(user_key, 0, sizeof(user_key)); rcu_read_unlock(); snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x", diff --git a/trunk/net/ipv4/tcp_ipv4.c b/trunk/net/ipv4/tcp_ipv4.c index ef998b008a57..75735c9a6a9d 100644 --- a/trunk/net/ipv4/tcp_ipv4.c +++ b/trunk/net/ipv4/tcp_ipv4.c @@ -708,11 +708,10 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) arg.csumoffset = offsetof(struct tcphdr, check) / 2; arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; /* When socket is gone, all binding information is lost. - * routing might fail in this case. No choice here, if we choose to force - * input interface, we will misroute in case of asymmetric route. + * routing might fail in this case. using iif for oif to + * make sure we can deliver it */ - if (sk) - arg.bound_dev_if = sk->sk_bound_dev_if; + arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb); net = dev_net(skb_dst(skb)->dev); arg.tos = ip_hdr(skb)->tos; diff --git a/trunk/net/ipv6/tcp_ipv6.c b/trunk/net/ipv6/tcp_ipv6.c index 26175bffbaa0..49c890386ce9 100644 --- a/trunk/net/ipv6/tcp_ipv6.c +++ b/trunk/net/ipv6/tcp_ipv6.c @@ -877,8 +877,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, __tcp_v6_send_check(buff, &fl6.saddr, &fl6.daddr); fl6.flowi6_proto = IPPROTO_TCP; - if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL) - fl6.flowi6_oif = inet6_iif(skb); + fl6.flowi6_oif = inet6_iif(skb); fl6.fl6_dport = t1->dest; fl6.fl6_sport = t1->source; security_skb_classify_flow(skb, flowi6_to_flowi(&fl6)); diff --git a/trunk/net/mac80211/mesh_sync.c b/trunk/net/mac80211/mesh_sync.c index a16b7b4b1e02..accfa00ffcdf 100644 --- a/trunk/net/mac80211/mesh_sync.c +++ b/trunk/net/mac80211/mesh_sync.c @@ -56,6 +56,7 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata) u64 tsfdelta; spin_lock_bh(&ifmsh->sync_offset_lock); + if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) { msync_dbg(sdata, "TBTT : max clockdrift=%lld; adjusting\n", (long long) ifmsh->sync_offset_clockdrift_max); @@ -68,11 +69,11 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata) tsfdelta = -beacon_int_fraction; ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction; } - spin_unlock_bh(&ifmsh->sync_offset_lock); tsf = drv_get_tsf(local, sdata); if (tsf != -1ULL) drv_set_tsf(local, sdata, tsf + tsfdelta); + spin_unlock_bh(&ifmsh->sync_offset_lock); } static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, diff --git a/trunk/net/mac80211/status.c b/trunk/net/mac80211/status.c index 3af0cc4130f1..2ce89732d0f2 100644 --- a/trunk/net/mac80211/status.c +++ b/trunk/net/mac80211/status.c @@ -34,7 +34,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, skb_queue_len(&local->skb_queue_unreliable); while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT && (skb = skb_dequeue(&local->skb_queue_unreliable))) { - ieee80211_free_txskb(hw, skb); + dev_kfree_skb_irq(skb); tmp--; I802_DEBUG_INC(local->tx_status_drop); } @@ -159,7 +159,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n", skb_queue_len(&sta->tx_filtered[ac]), !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies); - ieee80211_free_txskb(&local->hw, skb); + dev_kfree_skb(skb); } static void ieee80211_check_pending_bar(struct sta_info *sta, u8 *addr, u8 tid) diff --git a/trunk/net/mac80211/tx.c b/trunk/net/mac80211/tx.c index c9bf83f36657..e0e0d1d0e830 100644 --- a/trunk/net/mac80211/tx.c +++ b/trunk/net/mac80211/tx.c @@ -354,7 +354,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) total += skb_queue_len(&sta->ps_tx_buf[ac]); if (skb) { purged++; - ieee80211_free_txskb(&local->hw, skb); + dev_kfree_skb(skb); break; } } @@ -466,7 +466,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) ps_dbg(tx->sdata, "STA %pM TX buffer for AC %d full - dropping oldest frame\n", sta->sta.addr, ac); - ieee80211_free_txskb(&local->hw, old); + dev_kfree_skb(old); } else tx->local->total_ps_buffered++; @@ -1103,7 +1103,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, spin_unlock(&tx->sta->lock); if (purge_skb) - ieee80211_free_txskb(&tx->local->hw, purge_skb); + dev_kfree_skb(purge_skb); } /* reset session timer */ @@ -1214,7 +1214,7 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local, #ifdef CONFIG_MAC80211_VERBOSE_DEBUG if (WARN_ON_ONCE(q >= local->hw.queues)) { __skb_unlink(skb, skbs); - ieee80211_free_txskb(&local->hw, skb); + dev_kfree_skb(skb); continue; } #endif @@ -1356,7 +1356,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) if (unlikely(res == TX_DROP)) { I802_DEBUG_INC(tx->local->tx_handlers_drop); if (tx->skb) - ieee80211_free_txskb(&tx->local->hw, tx->skb); + dev_kfree_skb(tx->skb); else __skb_queue_purge(&tx->skbs); return -1; @@ -1393,7 +1393,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, res_prepare = ieee80211_tx_prepare(sdata, &tx, skb); if (unlikely(res_prepare == TX_DROP)) { - ieee80211_free_txskb(&local->hw, skb); + dev_kfree_skb(skb); goto out; } else if (unlikely(res_prepare == TX_QUEUED)) { goto out; @@ -1465,7 +1465,7 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) headroom = max_t(int, 0, headroom); if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { - ieee80211_free_txskb(&local->hw, skb); + dev_kfree_skb(skb); rcu_read_unlock(); return; } @@ -2050,10 +2050,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, head_need += IEEE80211_ENCRYPT_HEADROOM; head_need += local->tx_headroom; head_need = max_t(int, 0, head_need); - if (ieee80211_skb_resize(sdata, skb, head_need, true)) { - ieee80211_free_txskb(&local->hw, skb); - return NETDEV_TX_OK; - } + if (ieee80211_skb_resize(sdata, skb, head_need, true)) + goto fail; } if (encaps_data) { @@ -2186,7 +2184,7 @@ void ieee80211_tx_pending(unsigned long data) struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); if (WARN_ON(!info->control.vif)) { - ieee80211_free_txskb(&local->hw, skb); + kfree_skb(skb); continue; } diff --git a/trunk/net/sunrpc/svc_xprt.c b/trunk/net/sunrpc/svc_xprt.c index 194d865fae72..bac973a31367 100644 --- a/trunk/net/sunrpc/svc_xprt.c +++ b/trunk/net/sunrpc/svc_xprt.c @@ -208,35 +208,6 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, return xcl->xcl_ops->xpo_create(serv, net, sap, len, flags); } -/* - * svc_xprt_received conditionally queues the transport for processing - * by another thread. The caller must hold the XPT_BUSY bit and must - * not thereafter touch transport data. - * - * Note: XPT_DATA only gets cleared when a read-attempt finds no (or - * insufficient) data. - */ -static void svc_xprt_received(struct svc_xprt *xprt) -{ - BUG_ON(!test_bit(XPT_BUSY, &xprt->xpt_flags)); - /* As soon as we clear busy, the xprt could be closed and - * 'put', so we need a reference to call svc_xprt_enqueue with: - */ - svc_xprt_get(xprt); - clear_bit(XPT_BUSY, &xprt->xpt_flags); - svc_xprt_enqueue(xprt); - svc_xprt_put(xprt); -} - -void svc_add_new_perm_xprt(struct svc_serv *serv, struct svc_xprt *new) -{ - clear_bit(XPT_TEMP, &new->xpt_flags); - spin_lock_bh(&serv->sv_lock); - list_add(&new->xpt_list, &serv->sv_permsocks); - spin_unlock_bh(&serv->sv_lock); - svc_xprt_received(new); -} - int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, struct net *net, const int family, const unsigned short port, int flags) @@ -261,8 +232,13 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, module_put(xcl->xcl_owner); return PTR_ERR(newxprt); } - svc_add_new_perm_xprt(serv, newxprt); + + clear_bit(XPT_TEMP, &newxprt->xpt_flags); + spin_lock_bh(&serv->sv_lock); + list_add(&newxprt->xpt_list, &serv->sv_permsocks); + spin_unlock_bh(&serv->sv_lock); newport = svc_xprt_local_port(newxprt); + clear_bit(XPT_BUSY, &newxprt->xpt_flags); return newport; } err: @@ -418,6 +394,27 @@ static struct svc_xprt *svc_xprt_dequeue(struct svc_pool *pool) return xprt; } +/* + * svc_xprt_received conditionally queues the transport for processing + * by another thread. The caller must hold the XPT_BUSY bit and must + * not thereafter touch transport data. + * + * Note: XPT_DATA only gets cleared when a read-attempt finds no (or + * insufficient) data. + */ +void svc_xprt_received(struct svc_xprt *xprt) +{ + BUG_ON(!test_bit(XPT_BUSY, &xprt->xpt_flags)); + /* As soon as we clear busy, the xprt could be closed and + * 'put', so we need a reference to call svc_xprt_enqueue with: + */ + svc_xprt_get(xprt); + clear_bit(XPT_BUSY, &xprt->xpt_flags); + svc_xprt_enqueue(xprt); + svc_xprt_put(xprt); +} +EXPORT_SYMBOL_GPL(svc_xprt_received); + /** * svc_reserve - change the space reserved for the reply to a request. * @rqstp: The request in question @@ -568,12 +565,33 @@ static void svc_check_conn_limits(struct svc_serv *serv) } } -int svc_alloc_arg(struct svc_rqst *rqstp) +/* + * Receive the next request on any transport. This code is carefully + * organised not to touch any cachelines in the shared svc_serv + * structure, only cachelines in the local svc_pool. + */ +int svc_recv(struct svc_rqst *rqstp, long timeout) { - struct svc_serv *serv = rqstp->rq_server; - struct xdr_buf *arg; - int pages; - int i; + struct svc_xprt *xprt = NULL; + struct svc_serv *serv = rqstp->rq_server; + struct svc_pool *pool = rqstp->rq_pool; + int len, i; + int pages; + struct xdr_buf *arg; + DECLARE_WAITQUEUE(wait, current); + long time_left; + + dprintk("svc: server %p waiting for data (to = %ld)\n", + rqstp, timeout); + + if (rqstp->rq_xprt) + printk(KERN_ERR + "svc_recv: service %p, transport not NULL!\n", + rqstp); + if (waitqueue_active(&rqstp->rq_wait)) + printk(KERN_ERR + "svc_recv: service %p, wait queue active!\n", + rqstp); /* now allocate needed pages. If we get a failure, sleep briefly */ pages = (serv->sv_max_mesg + PAGE_SIZE) / PAGE_SIZE; @@ -603,15 +621,11 @@ int svc_alloc_arg(struct svc_rqst *rqstp) arg->page_len = (pages-2)*PAGE_SIZE; arg->len = (pages-1)*PAGE_SIZE; arg->tail[0].iov_len = 0; - return 0; -} -struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) -{ - struct svc_xprt *xprt; - struct svc_pool *pool = rqstp->rq_pool; - DECLARE_WAITQUEUE(wait, current); - long time_left; + try_to_freeze(); + cond_resched(); + if (signalled() || kthread_should_stop()) + return -EINTR; /* Normally we will wait up to 5 seconds for any required * cache information to be provided. @@ -649,7 +663,7 @@ struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) if (kthread_should_stop()) { set_current_state(TASK_RUNNING); spin_unlock_bh(&pool->sp_lock); - return ERR_PTR(-EINTR); + return -EINTR; } add_wait_queue(&rqstp->rq_wait, &wait); @@ -670,58 +684,48 @@ struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) spin_unlock_bh(&pool->sp_lock); dprintk("svc: server %p, no data yet\n", rqstp); if (signalled() || kthread_should_stop()) - return ERR_PTR(-EINTR); + return -EINTR; else - return ERR_PTR(-EAGAIN); + return -EAGAIN; } } spin_unlock_bh(&pool->sp_lock); - return xprt; -} - -void svc_add_new_temp_xprt(struct svc_serv *serv, struct svc_xprt *newxpt) -{ - spin_lock_bh(&serv->sv_lock); - set_bit(XPT_TEMP, &newxpt->xpt_flags); - list_add(&newxpt->xpt_list, &serv->sv_tempsocks); - serv->sv_tmpcnt++; - if (serv->sv_temptimer.function == NULL) { - /* setup timer to age temp transports */ - setup_timer(&serv->sv_temptimer, svc_age_temp_xprts, - (unsigned long)serv); - mod_timer(&serv->sv_temptimer, - jiffies + svc_conn_age_period * HZ); - } - spin_unlock_bh(&serv->sv_lock); - svc_xprt_received(newxpt); -} - -static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt) -{ - struct svc_serv *serv = rqstp->rq_server; - int len = 0; + len = 0; if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { dprintk("svc_recv: found XPT_CLOSE\n"); svc_delete_xprt(xprt); /* Leave XPT_BUSY set on the dead xprt: */ - return 0; + goto out; } if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { struct svc_xprt *newxpt; - /* - * We know this module_get will succeed because the - * listener holds a reference too - */ - __module_get(xprt->xpt_class->xcl_owner); - svc_check_conn_limits(xprt->xpt_server); newxpt = xprt->xpt_ops->xpo_accept(xprt); - if (newxpt) - svc_add_new_temp_xprt(serv, newxpt); + if (newxpt) { + /* + * We know this module_get will succeed because the + * listener holds a reference too + */ + __module_get(newxpt->xpt_class->xcl_owner); + svc_check_conn_limits(xprt->xpt_server); + spin_lock_bh(&serv->sv_lock); + set_bit(XPT_TEMP, &newxpt->xpt_flags); + list_add(&newxpt->xpt_list, &serv->sv_tempsocks); + serv->sv_tmpcnt++; + if (serv->sv_temptimer.function == NULL) { + /* setup timer to age temp transports */ + setup_timer(&serv->sv_temptimer, + svc_age_temp_xprts, + (unsigned long)serv); + mod_timer(&serv->sv_temptimer, + jiffies + svc_conn_age_period * HZ); + } + spin_unlock_bh(&serv->sv_lock); + svc_xprt_received(newxpt); + } } else if (xprt->xpt_ops->xpo_has_wspace(xprt)) { - /* XPT_DATA|XPT_DEFERRED case: */ dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", - rqstp, rqstp->rq_pool->sp_id, xprt, + rqstp, pool->sp_id, xprt, atomic_read(&xprt->xpt_ref.refcount)); rqstp->rq_deferred = svc_deferred_dequeue(xprt); if (rqstp->rq_deferred) @@ -732,51 +736,10 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt) rqstp->rq_reserved = serv->sv_max_mesg; atomic_add(rqstp->rq_reserved, &xprt->xpt_reserved); } - /* clear XPT_BUSY: */ svc_xprt_received(xprt); - return len; -} - -/* - * Receive the next request on any transport. This code is carefully - * organised not to touch any cachelines in the shared svc_serv - * structure, only cachelines in the local svc_pool. - */ -int svc_recv(struct svc_rqst *rqstp, long timeout) -{ - struct svc_xprt *xprt = NULL; - struct svc_serv *serv = rqstp->rq_server; - int len, err; - - dprintk("svc: server %p waiting for data (to = %ld)\n", - rqstp, timeout); - - if (rqstp->rq_xprt) - printk(KERN_ERR - "svc_recv: service %p, transport not NULL!\n", - rqstp); - if (waitqueue_active(&rqstp->rq_wait)) - printk(KERN_ERR - "svc_recv: service %p, wait queue active!\n", - rqstp); - - err = svc_alloc_arg(rqstp); - if (err) - return err; - - try_to_freeze(); - cond_resched(); - if (signalled() || kthread_should_stop()) - return -EINTR; - - xprt = svc_get_next_xprt(rqstp, timeout); - if (IS_ERR(xprt)) - return PTR_ERR(xprt); - - len = svc_handle_xprt(rqstp, xprt); /* No data, incomplete (TCP) read, or accept() */ - if (len <= 0) + if (len == 0 || len == -EAGAIN) goto out; clear_bit(XPT_OLD, &xprt->xpt_flags); @@ -954,18 +917,16 @@ void svc_close_xprt(struct svc_xprt *xprt) } EXPORT_SYMBOL_GPL(svc_close_xprt); -static void svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, struct net *net) +static void svc_close_list(struct list_head *xprt_list, struct net *net) { struct svc_xprt *xprt; - spin_lock(&serv->sv_lock); list_for_each_entry(xprt, xprt_list, xpt_list) { if (xprt->xpt_net != net) continue; set_bit(XPT_CLOSE, &xprt->xpt_flags); set_bit(XPT_BUSY, &xprt->xpt_flags); } - spin_unlock(&serv->sv_lock); } static void svc_clear_pools(struct svc_serv *serv, struct net *net) @@ -988,28 +949,24 @@ static void svc_clear_pools(struct svc_serv *serv, struct net *net) } } -static void svc_clear_list(struct svc_serv *serv, struct list_head *xprt_list, struct net *net) +static void svc_clear_list(struct list_head *xprt_list, struct net *net) { struct svc_xprt *xprt; struct svc_xprt *tmp; - LIST_HEAD(victims); - spin_lock(&serv->sv_lock); list_for_each_entry_safe(xprt, tmp, xprt_list, xpt_list) { if (xprt->xpt_net != net) continue; - list_move(&xprt->xpt_list, &victims); - } - spin_unlock(&serv->sv_lock); - - list_for_each_entry_safe(xprt, tmp, &victims, xpt_list) svc_delete_xprt(xprt); + } + list_for_each_entry(xprt, xprt_list, xpt_list) + BUG_ON(xprt->xpt_net == net); } void svc_close_net(struct svc_serv *serv, struct net *net) { - svc_close_list(serv, &serv->sv_tempsocks, net); - svc_close_list(serv, &serv->sv_permsocks, net); + svc_close_list(&serv->sv_tempsocks, net); + svc_close_list(&serv->sv_permsocks, net); svc_clear_pools(serv, net); /* @@ -1017,8 +974,8 @@ void svc_close_net(struct svc_serv *serv, struct net *net) * svc_xprt_enqueue will not add new entries without taking the * sp_lock and checking XPT_BUSY. */ - svc_clear_list(serv, &serv->sv_tempsocks, net); - svc_clear_list(serv, &serv->sv_permsocks, net); + svc_clear_list(&serv->sv_tempsocks, net); + svc_clear_list(&serv->sv_permsocks, net); } /* diff --git a/trunk/net/sunrpc/svcsock.c b/trunk/net/sunrpc/svcsock.c index 03827cef1fa7..998aa8c1807c 100644 --- a/trunk/net/sunrpc/svcsock.c +++ b/trunk/net/sunrpc/svcsock.c @@ -59,7 +59,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *, - int flags); + int *errp, int flags); static void svc_udp_data_ready(struct sock *, int); static int svc_udp_recvfrom(struct svc_rqst *); static int svc_udp_sendto(struct svc_rqst *); @@ -305,6 +305,57 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining) return len; } +/** + * svc_sock_names - construct a list of listener names in a string + * @serv: pointer to RPC service + * @buf: pointer to a buffer to fill in with socket names + * @buflen: size of the buffer to be filled + * @toclose: pointer to '\0'-terminated C string containing the name + * of a listener to be closed + * + * Fills in @buf with a '\n'-separated list of names of listener + * sockets. If @toclose is not NULL, the socket named by @toclose + * is closed, and is not included in the output list. + * + * Returns positive length of the socket name string, or a negative + * errno value on error. + */ +int svc_sock_names(struct svc_serv *serv, char *buf, const size_t buflen, + const char *toclose) +{ + struct svc_sock *svsk, *closesk = NULL; + int len = 0; + + if (!serv) + return 0; + + spin_lock_bh(&serv->sv_lock); + list_for_each_entry(svsk, &serv->sv_permsocks, sk_xprt.xpt_list) { + int onelen = svc_one_sock_name(svsk, buf + len, buflen - len); + if (onelen < 0) { + len = onelen; + break; + } + if (toclose && strcmp(toclose, buf + len) == 0) { + closesk = svsk; + svc_xprt_get(&closesk->sk_xprt); + } else + len += onelen; + } + spin_unlock_bh(&serv->sv_lock); + + if (closesk) { + /* Should unregister with portmap, but you cannot + * unregister just one protocol... + */ + svc_close_xprt(&closesk->sk_xprt); + svc_xprt_put(&closesk->sk_xprt); + } else if (toclose) + return -ENOENT; + return len; +} +EXPORT_SYMBOL_GPL(svc_sock_names); + /* * Check input queue length */ @@ -547,9 +598,11 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp) dprintk("svc: recvfrom returned error %d\n", -err); set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); } - return 0; + return -EAGAIN; } len = svc_addr_len(svc_addr(rqstp)); + if (len == 0) + return -EAFNOSUPPORT; rqstp->rq_addrlen = len; if (skb->tstamp.tv64 == 0) { skb->tstamp = ktime_get_real(); @@ -567,7 +620,10 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp) if (!svc_udp_get_dest_address(rqstp, cmh)) { net_warn_ratelimited("svc: received unknown control message %d/%d; dropping RPC reply datagram\n", cmh->cmsg_level, cmh->cmsg_type); - goto out_free; +out_free: + trace_kfree_skb(skb, svc_udp_recvfrom); + skb_free_datagram_locked(svsk->sk_sk, skb); + return 0; } rqstp->rq_daddrlen = svc_addr_len(svc_daddr(rqstp)); @@ -606,10 +662,6 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp) serv->sv_stats->netudpcnt++; return len; -out_free: - trace_kfree_skb(skb, svc_udp_recvfrom); - skb_free_datagram_locked(svsk->sk_sk, skb); - return 0; } static int @@ -848,9 +900,8 @@ static struct svc_xprt *svc_tcp_accept(struct svc_xprt *xprt) */ newsock->sk->sk_sndtimeo = HZ*30; - newsvsk = svc_setup_socket(serv, newsock, - (SVC_SOCK_ANONYMOUS | SVC_SOCK_TEMPORARY)); - if (IS_ERR(newsvsk)) + if (!(newsvsk = svc_setup_socket(serv, newsock, &err, + (SVC_SOCK_ANONYMOUS | SVC_SOCK_TEMPORARY)))) goto failed; svc_xprt_set_remote(&newsvsk->sk_xprt, sin, slen); err = kernel_getsockname(newsock, sin, &slen); @@ -1123,13 +1174,13 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) if (len != -EAGAIN) goto err_other; dprintk("RPC: TCP recvfrom got EAGAIN\n"); - return 0; + return -EAGAIN; err_other: printk(KERN_NOTICE "%s: recvfrom returned errno %d\n", svsk->sk_xprt.xpt_server->sv_name, -len); set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); err_noclose: - return 0; /* record not complete */ + return -EAGAIN; /* record not complete */ } /* @@ -1332,29 +1383,29 @@ EXPORT_SYMBOL_GPL(svc_sock_update_bufs); */ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, struct socket *sock, - int flags) + int *errp, int flags) { struct svc_sock *svsk; struct sock *inet; int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); - int err = 0; dprintk("svc: svc_setup_socket %p\n", sock); - svsk = kzalloc(sizeof(*svsk), GFP_KERNEL); - if (!svsk) - return ERR_PTR(-ENOMEM); + if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { + *errp = -ENOMEM; + return NULL; + } inet = sock->sk; /* Register socket with portmapper */ - if (pmap_register) - err = svc_register(serv, sock_net(sock->sk), inet->sk_family, + if (*errp >= 0 && pmap_register) + *errp = svc_register(serv, sock_net(sock->sk), inet->sk_family, inet->sk_protocol, ntohs(inet_sk(inet)->inet_sport)); - if (err < 0) { + if (*errp < 0) { kfree(svsk); - return ERR_PTR(err); + return NULL; } inet->sk_user_data = svsk; @@ -1399,38 +1450,42 @@ int svc_addsock(struct svc_serv *serv, const int fd, char *name_return, int err = 0; struct socket *so = sockfd_lookup(fd, &err); struct svc_sock *svsk = NULL; - struct sockaddr_storage addr; - struct sockaddr *sin = (struct sockaddr *)&addr; - int salen; if (!so) return err; - err = -EAFNOSUPPORT; if ((so->sk->sk_family != PF_INET) && (so->sk->sk_family != PF_INET6)) - goto out; - err = -EPROTONOSUPPORT; - if (so->sk->sk_protocol != IPPROTO_TCP && + err = -EAFNOSUPPORT; + else if (so->sk->sk_protocol != IPPROTO_TCP && so->sk->sk_protocol != IPPROTO_UDP) - goto out; - err = -EISCONN; - if (so->state > SS_UNCONNECTED) - goto out; - err = -ENOENT; - if (!try_module_get(THIS_MODULE)) - goto out; - svsk = svc_setup_socket(serv, so, SVC_SOCK_DEFAULTS); - if (IS_ERR(svsk)) { - module_put(THIS_MODULE); - err = PTR_ERR(svsk); - goto out; + err = -EPROTONOSUPPORT; + else if (so->state > SS_UNCONNECTED) + err = -EISCONN; + else { + if (!try_module_get(THIS_MODULE)) + err = -ENOENT; + else + svsk = svc_setup_socket(serv, so, &err, + SVC_SOCK_DEFAULTS); + if (svsk) { + struct sockaddr_storage addr; + struct sockaddr *sin = (struct sockaddr *)&addr; + int salen; + if (kernel_getsockname(svsk->sk_sock, sin, &salen) == 0) + svc_xprt_set_local(&svsk->sk_xprt, sin, salen); + clear_bit(XPT_TEMP, &svsk->sk_xprt.xpt_flags); + spin_lock_bh(&serv->sv_lock); + list_add(&svsk->sk_xprt.xpt_list, &serv->sv_permsocks); + spin_unlock_bh(&serv->sv_lock); + svc_xprt_received(&svsk->sk_xprt); + err = 0; + } else + module_put(THIS_MODULE); + } + if (err) { + sockfd_put(so); + return err; } - if (kernel_getsockname(svsk->sk_sock, sin, &salen) == 0) - svc_xprt_set_local(&svsk->sk_xprt, sin, salen); - svc_add_new_perm_xprt(serv, &svsk->sk_xprt); return svc_one_sock_name(svsk, name_return, len); -out: - sockfd_put(so); - return err; } EXPORT_SYMBOL_GPL(svc_addsock); @@ -1508,13 +1563,11 @@ static struct svc_xprt *svc_create_socket(struct svc_serv *serv, goto bummer; } - svsk = svc_setup_socket(serv, sock, flags); - if (IS_ERR(svsk)) { - error = PTR_ERR(svsk); - goto bummer; + if ((svsk = svc_setup_socket(serv, sock, &error, flags)) != NULL) { + svc_xprt_set_local(&svsk->sk_xprt, newsin, newlen); + return (struct svc_xprt *)svsk; } - svc_xprt_set_local(&svsk->sk_xprt, newsin, newlen); - return (struct svc_xprt *)svsk; + bummer: dprintk("svc: svc_create_socket error = %d\n", -error); sock_release(sock); diff --git a/trunk/net/sunrpc/xprtrdma/svc_rdma_transport.c b/trunk/net/sunrpc/xprtrdma/svc_rdma_transport.c index 62e4f9bcc387..73b428bef598 100644 --- a/trunk/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/trunk/net/sunrpc/xprtrdma/svc_rdma_transport.c @@ -578,6 +578,10 @@ static void handle_connect_req(struct rdma_cm_id *new_cma_id, size_t client_ird) list_add_tail(&newxprt->sc_accept_q, &listen_xprt->sc_accept_q); spin_unlock_bh(&listen_xprt->sc_lock); + /* + * Can't use svc_xprt_received here because we are not on a + * rqstp thread + */ set_bit(XPT_CONN, &listen_xprt->sc_xprt.xpt_flags); svc_xprt_enqueue(&listen_xprt->sc_xprt); } diff --git a/trunk/tools/perf/Makefile b/trunk/tools/perf/Makefile index 247264502fb7..86258c2a2c23 100644 --- a/trunk/tools/perf/Makefile +++ b/trunk/tools/perf/Makefile @@ -45,8 +45,6 @@ include config/utilities.mak # # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf # backtrace post unwind. -# -# Define NO_BACKTRACE if you do not want stack backtrace debug feature $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) @@ -187,7 +185,7 @@ strip-libs = $(filter-out -l%,$(1)) PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py -$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) +$(OUTPUT)python/perf.so: $(PYRF_OBJS) $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ --quiet build_ext; \ mkdir -p $(OUTPUT)python && \ @@ -270,7 +268,6 @@ LIB_H += util/include/linux/magic.h LIB_H += util/include/linux/poison.h LIB_H += util/include/linux/prefetch.h LIB_H += util/include/linux/rbtree.h -LIB_H += util/include/linux/rbtree_augmented.h LIB_H += util/include/linux/string.h LIB_H += util/include/linux/types.h LIB_H += util/include/linux/linkage.h @@ -449,6 +446,20 @@ BUILTIN_OBJS += $(OUTPUT)builtin-inject.o PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) +# Files needed for the python binding, perf.so +# pyrf is just an internal name needed for all those wrappers. +# This has to be in sync with what is in the 'sources' variable in +# tools/perf/util/setup.py + +PYRF_OBJS += $(OUTPUT)util/cpumap.o +PYRF_OBJS += $(OUTPUT)util/ctype.o +PYRF_OBJS += $(OUTPUT)util/evlist.o +PYRF_OBJS += $(OUTPUT)util/evsel.o +PYRF_OBJS += $(OUTPUT)util/python.o +PYRF_OBJS += $(OUTPUT)util/thread_map.o +PYRF_OBJS += $(OUTPUT)util/util.o +PYRF_OBJS += $(OUTPUT)util/xyarray.o + # # Platform specific tweaks # @@ -475,13 +486,7 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) NO_DWARF := 1 NO_DEMANGLE := 1 endif -else - FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS) - ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y) - msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); - NO_DWARF := 1 - endif # Dwarf support -endif # SOURCE_LIBELF +endif endif # NO_LIBELF ifndef NO_LIBUNWIND @@ -506,6 +511,8 @@ ifneq ($(OUTPUT),) endif ifdef NO_LIBELF +BASIC_CFLAGS += -DNO_LIBELF_SUPPORT + EXTLIBS := $(filter-out -lelf,$(EXTLIBS)) # Remove ELF/DWARF dependent codes @@ -520,12 +527,17 @@ BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS)) LIB_OBJS += $(OUTPUT)util/symbol-minimal.o else # NO_LIBELF -BASIC_CFLAGS += -DLIBELF_SUPPORT -ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) - BASIC_CFLAGS += -DLIBELF_MMAP +ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) + BASIC_CFLAGS += -DLIBELF_NO_MMAP endif +FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS) +ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y) + msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); + NO_DWARF := 1 +endif # Dwarf support + ifndef NO_DWARF ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); @@ -538,33 +550,38 @@ endif # PERF_HAVE_DWARF_REGS endif # NO_DWARF endif # NO_LIBELF -ifndef NO_LIBUNWIND - BASIC_CFLAGS += -DLIBUNWIND_SUPPORT +ifdef NO_LIBUNWIND + BASIC_CFLAGS += -DNO_LIBUNWIND_SUPPORT +else EXTLIBS += $(LIBUNWIND_LIBS) BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) LIB_OBJS += $(OUTPUT)util/unwind.o endif -ifndef NO_LIBAUDIT +ifdef NO_LIBAUDIT + BASIC_CFLAGS += -DNO_LIBAUDIT_SUPPORT +else FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT)),y) msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); + BASIC_CFLAGS += -DNO_LIBAUDIT_SUPPORT else - BASIC_CFLAGS += -DLIBAUDIT_SUPPORT BUILTIN_OBJS += $(OUTPUT)builtin-trace.o EXTLIBS += -laudit endif endif -ifndef NO_NEWT +ifdef NO_NEWT + BASIC_CFLAGS += -DNO_NEWT_SUPPORT +else FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y) msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); + BASIC_CFLAGS += -DNO_NEWT_SUPPORT else # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h BASIC_CFLAGS += -I/usr/include/slang - BASIC_CFLAGS += -DNEWT_SUPPORT EXTLIBS += -lnewt -lslang LIB_OBJS += $(OUTPUT)ui/setup.o LIB_OBJS += $(OUTPUT)ui/browser.o @@ -586,15 +603,17 @@ ifndef NO_NEWT endif endif -ifndef NO_GTK2 +ifdef NO_GTK2 + BASIC_CFLAGS += -DNO_GTK2_SUPPORT +else FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); + BASIC_CFLAGS += -DNO_GTK2_SUPPORT else ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y) BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR endif - BASIC_CFLAGS += -DGTK2_SUPPORT BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) LIB_OBJS += $(OUTPUT)ui/gtk/browser.o @@ -602,7 +621,7 @@ ifndef NO_GTK2 LIB_OBJS += $(OUTPUT)ui/gtk/util.o LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o # Make sure that it'd be included only once. - ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),) + ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) LIB_OBJS += $(OUTPUT)ui/setup.o LIB_OBJS += $(OUTPUT)ui/util.o endif @@ -743,18 +762,23 @@ ifeq ($(NO_PERF_REGS),0) ifeq ($(ARCH),x86) LIB_H += arch/x86/include/perf_regs.h endif - BASIC_CFLAGS += -DHAVE_PERF_REGS +else + BASIC_CFLAGS += -DNO_PERF_REGS endif -ifndef NO_STRLCPY - ifeq ($(call try-cc,$(SOURCE_STRLCPY),),y) - BASIC_CFLAGS += -DHAVE_STRLCPY +ifdef NO_STRLCPY + BASIC_CFLAGS += -DNO_STRLCPY +else + ifneq ($(call try-cc,$(SOURCE_STRLCPY),),y) + BASIC_CFLAGS += -DNO_STRLCPY endif endif -ifndef NO_BACKTRACE - ifeq ($(call try-cc,$(SOURCE_BACKTRACE),),y) - BASIC_CFLAGS += -DBACKTRACE_SUPPORT +ifdef NO_BACKTRACE + BASIC_CFLAGS += -DNO_BACKTRACE +else + ifneq ($(call try-cc,$(SOURCE_BACKTRACE),),y) + BASIC_CFLAGS += -DNO_BACKTRACE endif endif @@ -882,7 +906,7 @@ $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< + $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< $(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls $< diff --git a/trunk/tools/perf/bash_completion b/trunk/tools/perf/bash_completion index 56e6a12aab59..1958fa539d0f 100644 --- a/trunk/tools/perf/bash_completion +++ b/trunk/tools/perf/bash_completion @@ -1,59 +1,23 @@ # perf completion -function_exists() -{ - declare -F $1 > /dev/null - return $? -} - -function_exists __ltrim_colon_completions || -__ltrim_colon_completions() -{ - if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then - # Remove colon-word prefix from COMPREPLY items - local colon_word=${1%${1##*:}} - local i=${#COMPREPLY[*]} - while [[ $((--i)) -ge 0 ]]; do - COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} - done - fi -} - have perf && _perf() { - local cur prev cmd + local cur cmd COMPREPLY=() - if function_exists _get_comp_words_by_ref; then - _get_comp_words_by_ref -n : cur prev - else - cur=$(_get_cword :) - prev=${COMP_WORDS[COMP_CWORD-1]} - fi + _get_comp_words_by_ref cur prev cmd=${COMP_WORDS[0]} - # List perf subcommands or long options + # List perf subcommands if [ $COMP_CWORD -eq 1 ]; then - if [[ $cur == --* ]]; then - COMPREPLY=( $( compgen -W '--help --version \ - --exec-path --html-path --paginate --no-pager \ - --perf-dir --work-tree --debugfs-dir' -- "$cur" ) ) - else - cmds=$($cmd --list-cmds) - COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) ) - fi + cmds=$($cmd --list-cmds) + COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) ) # List possible events for -e option elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then - evts=$($cmd list --raw-dump) - COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) ) - __ltrim_colon_completions $cur - # List long option names - elif [[ $cur == --* ]]; then - subcmd=${COMP_WORDS[1]} - opts=$($cmd $subcmd --list-opts) - COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) ) + cmds=$($cmd list --raw-dump) + COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) ) # Fall down to list regular files else _filedir diff --git a/trunk/tools/perf/builtin-buildid-cache.c b/trunk/tools/perf/builtin-buildid-cache.c index d37e077f4b14..83654557e108 100644 --- a/trunk/tools/perf/builtin-buildid-cache.c +++ b/trunk/tools/perf/builtin-buildid-cache.c @@ -15,6 +15,22 @@ #include "util/strlist.h" #include "util/symbol.h" +static char const *add_name_list_str, *remove_name_list_str; + +static const char * const buildid_cache_usage[] = { + "perf buildid-cache []", + NULL +}; + +static const struct option buildid_cache_options[] = { + OPT_STRING('a', "add", &add_name_list_str, + "file list", "file(s) to add"), + OPT_STRING('r', "remove", &remove_name_list_str, "file list", + "file(s) to remove"), + OPT_INCR('v', "verbose", &verbose, "be more verbose"), + OPT_END() +}; + static int build_id_cache__add_file(const char *filename, const char *debugdir) { char sbuild_id[BUILD_ID_SIZE * 2 + 1]; @@ -35,8 +51,8 @@ static int build_id_cache__add_file(const char *filename, const char *debugdir) return err; } -static int build_id_cache__remove_file(const char *filename, - const char *debugdir) +static int build_id_cache__remove_file(const char *filename __maybe_unused, + const char *debugdir __maybe_unused) { u8 build_id[BUILD_ID_SIZE]; char sbuild_id[BUILD_ID_SIZE * 2 + 1]; @@ -57,34 +73,11 @@ static int build_id_cache__remove_file(const char *filename, return err; } -int cmd_buildid_cache(int argc, const char **argv, - const char *prefix __maybe_unused) +static int __cmd_buildid_cache(void) { struct strlist *list; struct str_node *pos; char debugdir[PATH_MAX]; - char const *add_name_list_str = NULL, - *remove_name_list_str = NULL; - const struct option buildid_cache_options[] = { - OPT_STRING('a', "add", &add_name_list_str, - "file list", "file(s) to add"), - OPT_STRING('r', "remove", &remove_name_list_str, "file list", - "file(s) to remove"), - OPT_INCR('v', "verbose", &verbose, "be more verbose"), - OPT_END() - }; - const char * const buildid_cache_usage[] = { - "perf buildid-cache []", - NULL - }; - - argc = parse_options(argc, argv, buildid_cache_options, - buildid_cache_usage, 0); - - if (symbol__init() < 0) - return -1; - - setup_pager(); snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir); @@ -126,3 +119,16 @@ int cmd_buildid_cache(int argc, const char **argv, return 0; } + +int cmd_buildid_cache(int argc, const char **argv, + const char *prefix __maybe_unused) +{ + argc = parse_options(argc, argv, buildid_cache_options, + buildid_cache_usage, 0); + + if (symbol__init() < 0) + return -1; + + setup_pager(); + return __cmd_buildid_cache(); +} diff --git a/trunk/tools/perf/builtin-buildid-list.c b/trunk/tools/perf/builtin-buildid-list.c index a0e94fffa03e..1159feeebb19 100644 --- a/trunk/tools/perf/builtin-buildid-list.c +++ b/trunk/tools/perf/builtin-buildid-list.c @@ -16,6 +16,27 @@ #include "util/session.h" #include "util/symbol.h" +static const char *input_name; +static bool force; +static bool show_kernel; +static bool with_hits; + +static const char * const buildid_list_usage[] = { + "perf buildid-list []", + NULL +}; + +static const struct option options[] = { + OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"), + OPT_STRING('i', "input", &input_name, "file", + "input file name"), + OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), + OPT_BOOLEAN('k', "kernel", &show_kernel, "Show current kernel build id"), + OPT_INCR('v', "verbose", &verbose, + "be more verbose"), + OPT_END() +}; + static int sysfs__fprintf_build_id(FILE *fp) { u8 kallsyms_build_id[BUILD_ID_SIZE]; @@ -44,8 +65,7 @@ static int filename__fprintf_build_id(const char *name, FILE *fp) return fprintf(fp, "%s\n", sbuild_id); } -static int perf_session__list_build_ids(const char *input_name, - bool force, bool with_hits) +static int perf_session__list_build_ids(void) { struct perf_session *session; @@ -75,31 +95,18 @@ static int perf_session__list_build_ids(const char *input_name, return 0; } +static int __cmd_buildid_list(void) +{ + if (show_kernel) + return sysfs__fprintf_build_id(stdout); + + return perf_session__list_build_ids(); +} + int cmd_buildid_list(int argc, const char **argv, const char *prefix __maybe_unused) { - bool show_kernel = false; - bool with_hits = false; - bool force = false; - const char *input_name = NULL; - const struct option options[] = { - OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"), - OPT_STRING('i', "input", &input_name, "file", "input file name"), - OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), - OPT_BOOLEAN('k', "kernel", &show_kernel, "Show current kernel build id"), - OPT_INCR('v', "verbose", &verbose, "be more verbose"), - OPT_END() - }; - const char * const buildid_list_usage[] = { - "perf buildid-list []", - NULL - }; - argc = parse_options(argc, argv, options, buildid_list_usage, 0); setup_pager(); - - if (show_kernel) - return sysfs__fprintf_build_id(stdout); - - return perf_session__list_build_ids(input_name, force, with_hits); + return __cmd_buildid_list(); } diff --git a/trunk/tools/perf/builtin-diff.c b/trunk/tools/perf/builtin-diff.c index a0b531c14b97..761f4197a9e2 100644 --- a/trunk/tools/perf/builtin-diff.c +++ b/trunk/tools/perf/builtin-diff.c @@ -70,8 +70,8 @@ static struct perf_tool tool = { .ordering_requires_timestamps = true, }; -static void insert_hist_entry_by_name(struct rb_root *root, - struct hist_entry *he) +static void perf_session__insert_hist_entry_by_name(struct rb_root *root, + struct hist_entry *he) { struct rb_node **p = &root->rb_node; struct rb_node *parent = NULL; @@ -90,7 +90,7 @@ static void insert_hist_entry_by_name(struct rb_root *root, rb_insert_color(&he->rb_node, root); } -static void hists__name_resort(struct hists *self, bool sort) +static void hists__resort_entries(struct hists *self) { unsigned long position = 1; struct rb_root tmp = RB_ROOT; @@ -100,16 +100,12 @@ static void hists__name_resort(struct hists *self, bool sort) struct hist_entry *n = rb_entry(next, struct hist_entry, rb_node); next = rb_next(&n->rb_node); + rb_erase(&n->rb_node, &self->entries); n->position = position++; - - if (sort) { - rb_erase(&n->rb_node, &self->entries); - insert_hist_entry_by_name(&tmp, n); - } + perf_session__insert_hist_entry_by_name(&tmp, n); } - if (sort) - self->entries = tmp; + self->entries = tmp; } static struct hist_entry *hists__find_entry(struct hists *self, @@ -125,7 +121,7 @@ static struct hist_entry *hists__find_entry(struct hists *self, n = n->rb_left; else if (cmp > 0) n = n->rb_right; - else + else return iter; } @@ -154,24 +150,6 @@ static struct perf_evsel *evsel_match(struct perf_evsel *evsel, return NULL; } -static void perf_evlist__resort_hists(struct perf_evlist *evlist, bool name) -{ - struct perf_evsel *evsel; - - list_for_each_entry(evsel, &evlist->entries, node) { - struct hists *hists = &evsel->hists; - - hists__output_resort(hists); - - /* - * The hists__name_resort only sets possition - * if name is false. - */ - if (name || ((!name) && show_displacement)) - hists__name_resort(hists, name); - } -} - static int __cmd_diff(void) { int ret, i; @@ -198,8 +176,15 @@ static int __cmd_diff(void) evlist_old = older->evlist; evlist_new = newer->evlist; - perf_evlist__resort_hists(evlist_old, true); - perf_evlist__resort_hists(evlist_new, false); + list_for_each_entry(evsel, &evlist_new->entries, node) + hists__output_resort(&evsel->hists); + + list_for_each_entry(evsel, &evlist_old->entries, node) { + hists__output_resort(&evsel->hists); + + if (show_displacement) + hists__resort_entries(&evsel->hists); + } list_for_each_entry(evsel, &evlist_new->entries, node) { struct perf_evsel *evsel_old; @@ -214,7 +199,8 @@ static int __cmd_diff(void) first = false; hists__match(&evsel_old->hists, &evsel->hists); - hists__fprintf(&evsel->hists, true, 0, 0, stdout); + hists__fprintf(&evsel->hists, &evsel_old->hists, + show_displacement, true, 0, 0, stdout); } out_delete: @@ -256,21 +242,6 @@ static const struct option options[] = { OPT_END() }; -static void ui_init(void) -{ - perf_hpp__init(); - - /* No overhead column. */ - perf_hpp__column_enable(PERF_HPP__OVERHEAD, false); - - /* Display baseline/delta/displacement columns. */ - perf_hpp__column_enable(PERF_HPP__BASELINE, true); - perf_hpp__column_enable(PERF_HPP__DELTA, true); - - if (show_displacement) - perf_hpp__column_enable(PERF_HPP__DISPL, true); -} - int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) { sort_order = diff__default_sort_order; @@ -293,8 +264,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) if (symbol__init() < 0) return -1; - ui_init(); - + perf_hpp__init(true, show_displacement); setup_sorting(diff_usage, options); setup_pager(); diff --git a/trunk/tools/perf/builtin-evlist.c b/trunk/tools/perf/builtin-evlist.c index 997afb82691b..1fb164164fd0 100644 --- a/trunk/tools/perf/builtin-evlist.c +++ b/trunk/tools/perf/builtin-evlist.c @@ -108,20 +108,23 @@ static int __cmd_evlist(const char *input_name, struct perf_attr_details *detail return 0; } +static const char * const evlist_usage[] = { + "perf evlist []", + NULL +}; + int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused) { struct perf_attr_details details = { .verbose = false, }; const char *input_name = NULL; const struct option options[] = { - OPT_STRING('i', "input", &input_name, "file", "Input file name"), - OPT_BOOLEAN('F', "freq", &details.freq, "Show the sample frequency"), - OPT_BOOLEAN('v', "verbose", &details.verbose, - "Show all event attr details"), - OPT_END() - }; - const char * const evlist_usage[] = { - "perf evlist []", - NULL + OPT_STRING('i', "input", &input_name, "file", + "Input file name"), + OPT_BOOLEAN('F', "freq", &details.freq, + "Show the sample frequency"), + OPT_BOOLEAN('v', "verbose", &details.verbose, + "Show all event attr details"), + OPT_END() }; argc = parse_options(argc, argv, options, evlist_usage, 0); diff --git a/trunk/tools/perf/builtin-help.c b/trunk/tools/perf/builtin-help.c index 411ee5664e98..25c8b942ff85 100644 --- a/trunk/tools/perf/builtin-help.c +++ b/trunk/tools/perf/builtin-help.c @@ -30,6 +30,23 @@ enum help_format { HELP_FORMAT_WEB, }; +static bool show_all = false; +static enum help_format help_format = HELP_FORMAT_NONE; +static struct option builtin_help_options[] = { + OPT_BOOLEAN('a', "all", &show_all, "print all available commands"), + OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN), + OPT_SET_UINT('w', "web", &help_format, "show manual in web browser", + HELP_FORMAT_WEB), + OPT_SET_UINT('i', "info", &help_format, "show info page", + HELP_FORMAT_INFO), + OPT_END(), +}; + +static const char * const builtin_help_usage[] = { + "perf help [--all] [--man|--web|--info] [command]", + NULL +}; + static enum help_format parse_help_format(const char *format) { if (!strcmp(format, "man")) @@ -241,13 +258,11 @@ static int add_man_viewer_info(const char *var, const char *value) static int perf_help_config(const char *var, const char *value, void *cb) { - enum help_format *help_formatp = cb; - if (!strcmp(var, "help.format")) { if (!value) return config_error_nonbool(var); - *help_formatp = parse_help_format(value); - if (*help_formatp == HELP_FORMAT_NONE) + help_format = parse_help_format(value); + if (help_format == HELP_FORMAT_NONE) return -1; return 0; } @@ -413,27 +428,12 @@ static int show_html_page(const char *perf_cmd) int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused) { - bool show_all = false; - enum help_format help_format = HELP_FORMAT_NONE; - struct option builtin_help_options[] = { - OPT_BOOLEAN('a', "all", &show_all, "print all available commands"), - OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN), - OPT_SET_UINT('w', "web", &help_format, "show manual in web browser", - HELP_FORMAT_WEB), - OPT_SET_UINT('i', "info", &help_format, "show info page", - HELP_FORMAT_INFO), - OPT_END(), - }; - const char * const builtin_help_usage[] = { - "perf help [--all] [--man|--web|--info] [command]", - NULL - }; const char *alias; int rc = 0; load_command_list("perf-", &main_cmds, &other_cmds); - perf_config(perf_help_config, &help_format); + perf_config(perf_help_config, NULL); argc = parse_options(argc, argv, builtin_help_options, builtin_help_usage, 0); diff --git a/trunk/tools/perf/builtin-inject.c b/trunk/tools/perf/builtin-inject.c index 4688bea95c12..1eaa6617c814 100644 --- a/trunk/tools/perf/builtin-inject.c +++ b/trunk/tools/perf/builtin-inject.c @@ -14,10 +14,8 @@ #include "util/parse-options.h" -struct perf_inject { - struct perf_tool tool; - bool build_ids; -}; +static char const *input_name = "-"; +static bool inject_build_ids; static int perf_event__repipe_synth(struct perf_tool *tool __maybe_unused, union perf_event *event, @@ -196,7 +194,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, * account this as unresolved. */ } else { -#ifdef LIBELF_SUPPORT +#ifndef NO_LIBELF_SUPPORT pr_warning("no symbols found in %s, maybe " "install a debug package?\n", al.map->dso->long_name); @@ -210,6 +208,22 @@ static int perf_event__inject_buildid(struct perf_tool *tool, return 0; } +struct perf_tool perf_inject = { + .sample = perf_event__repipe_sample, + .mmap = perf_event__repipe, + .comm = perf_event__repipe, + .fork = perf_event__repipe, + .exit = perf_event__repipe, + .lost = perf_event__repipe, + .read = perf_event__repipe_sample, + .throttle = perf_event__repipe, + .unthrottle = perf_event__repipe, + .attr = perf_event__repipe_attr, + .event_type = perf_event__repipe_event_type_synth, + .tracing_data = perf_event__repipe_tracing_data_synth, + .build_id = perf_event__repipe_op2_synth, +}; + extern volatile int session_done; static void sig_handler(int sig __maybe_unused) @@ -217,72 +231,56 @@ static void sig_handler(int sig __maybe_unused) session_done = 1; } -static int __cmd_inject(struct perf_inject *inject) +static int __cmd_inject(void) { struct perf_session *session; int ret = -EINVAL; signal(SIGINT, sig_handler); - if (inject->build_ids) { - inject->tool.sample = perf_event__inject_buildid; - inject->tool.mmap = perf_event__repipe_mmap; - inject->tool.fork = perf_event__repipe_task; - inject->tool.tracing_data = perf_event__repipe_tracing_data; + if (inject_build_ids) { + perf_inject.sample = perf_event__inject_buildid; + perf_inject.mmap = perf_event__repipe_mmap; + perf_inject.fork = perf_event__repipe_task; + perf_inject.tracing_data = perf_event__repipe_tracing_data; } - session = perf_session__new("-", O_RDONLY, false, true, &inject->tool); + session = perf_session__new(input_name, O_RDONLY, false, true, &perf_inject); if (session == NULL) return -ENOMEM; - ret = perf_session__process_events(session, &inject->tool); + ret = perf_session__process_events(session, &perf_inject); perf_session__delete(session); return ret; } +static const char * const report_usage[] = { + "perf inject []", + NULL +}; + +static const struct option options[] = { + OPT_BOOLEAN('b', "build-ids", &inject_build_ids, + "Inject build-ids into the output stream"), + OPT_INCR('v', "verbose", &verbose, + "be more verbose (show build ids, etc)"), + OPT_END() +}; + int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) { - struct perf_inject inject = { - .tool = { - .sample = perf_event__repipe_sample, - .mmap = perf_event__repipe, - .comm = perf_event__repipe, - .fork = perf_event__repipe, - .exit = perf_event__repipe, - .lost = perf_event__repipe, - .read = perf_event__repipe_sample, - .throttle = perf_event__repipe, - .unthrottle = perf_event__repipe, - .attr = perf_event__repipe_attr, - .event_type = perf_event__repipe_event_type_synth, - .tracing_data = perf_event__repipe_tracing_data_synth, - .build_id = perf_event__repipe_op2_synth, - }, - }; - const struct option options[] = { - OPT_BOOLEAN('b', "build-ids", &inject.build_ids, - "Inject build-ids into the output stream"), - OPT_INCR('v', "verbose", &verbose, - "be more verbose (show build ids, etc)"), - OPT_END() - }; - const char * const inject_usage[] = { - "perf inject []", - NULL - }; - - argc = parse_options(argc, argv, options, inject_usage, 0); + argc = parse_options(argc, argv, options, report_usage, 0); /* * Any (unrecognized) arguments left? */ if (argc) - usage_with_options(inject_usage, options); + usage_with_options(report_usage, options); if (symbol__init() < 0) return -1; - return __cmd_inject(&inject); + return __cmd_inject(); } diff --git a/trunk/tools/perf/builtin-kmem.c b/trunk/tools/perf/builtin-kmem.c index 14bf82f63659..bc912c68f49a 100644 --- a/trunk/tools/perf/builtin-kmem.c +++ b/trunk/tools/perf/builtin-kmem.c @@ -21,6 +21,8 @@ struct alloc_stat; typedef int (*sort_fn_t)(struct alloc_stat *, struct alloc_stat *); +static const char *input_name; + static int alloc_flag; static int caller_flag; @@ -29,6 +31,8 @@ static int caller_lines = -1; static bool raw_ip; +static char default_sort_order[] = "frag,hit,bytes"; + static int *cpunode_map; static int max_cpu_num; @@ -477,7 +481,7 @@ static void sort_result(void) __sort_result(&root_caller_stat, &root_caller_sorted, &caller_sort); } -static int __cmd_kmem(const char *input_name) +static int __cmd_kmem(void) { int err = -EINVAL; struct perf_session *session; @@ -516,6 +520,11 @@ static int __cmd_kmem(const char *input_name) return err; } +static const char * const kmem_usage[] = { + "perf kmem [] {record|stat}", + NULL +}; + static int ptr_cmp(struct alloc_stat *l, struct alloc_stat *r) { if (l->ptr < r->ptr) @@ -711,17 +720,41 @@ static int parse_line_opt(const struct option *opt __maybe_unused, return 0; } -static int __cmd_record(int argc, const char **argv) -{ - const char * const record_args[] = { - "record", "-a", "-R", "-f", "-c", "1", +static const struct option kmem_options[] = { + OPT_STRING('i', "input", &input_name, "file", + "input file name"), + OPT_CALLBACK_NOOPT(0, "caller", NULL, NULL, + "show per-callsite statistics", + parse_caller_opt), + OPT_CALLBACK_NOOPT(0, "alloc", NULL, NULL, + "show per-allocation statistics", + parse_alloc_opt), + OPT_CALLBACK('s', "sort", NULL, "key[,key2...]", + "sort by keys: ptr, call_site, bytes, hit, pingpong, frag", + parse_sort_opt), + OPT_CALLBACK('l', "line", NULL, "num", + "show n lines", + parse_line_opt), + OPT_BOOLEAN(0, "raw-ip", &raw_ip, "show raw ip instead of symbol"), + OPT_END() +}; + +static const char *record_args[] = { + "record", + "-a", + "-R", + "-f", + "-c", "1", "-e", "kmem:kmalloc", "-e", "kmem:kmalloc_node", "-e", "kmem:kfree", "-e", "kmem:kmem_cache_alloc", "-e", "kmem:kmem_cache_alloc_node", "-e", "kmem:kmem_cache_free", - }; +}; + +static int __cmd_record(int argc, const char **argv) +{ unsigned int rec_argc, i, j; const char **rec_argv; @@ -742,25 +775,6 @@ static int __cmd_record(int argc, const char **argv) int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) { - const char * const default_sort_order = "frag,hit,bytes"; - const char *input_name = NULL; - const struct option kmem_options[] = { - OPT_STRING('i', "input", &input_name, "file", "input file name"), - OPT_CALLBACK_NOOPT(0, "caller", NULL, NULL, - "show per-callsite statistics", parse_caller_opt), - OPT_CALLBACK_NOOPT(0, "alloc", NULL, NULL, - "show per-allocation statistics", parse_alloc_opt), - OPT_CALLBACK('s', "sort", NULL, "key[,key2...]", - "sort by keys: ptr, call_site, bytes, hit, pingpong, frag", - parse_sort_opt), - OPT_CALLBACK('l', "line", NULL, "num", "show n lines", parse_line_opt), - OPT_BOOLEAN(0, "raw-ip", &raw_ip, "show raw ip instead of symbol"), - OPT_END() - }; - const char * const kmem_usage[] = { - "perf kmem [] {record|stat}", - NULL - }; argc = parse_options(argc, argv, kmem_options, kmem_usage, 0); if (!argc) @@ -779,7 +793,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) if (list_empty(&alloc_sort)) setup_sorting(&alloc_sort, default_sort_order); - return __cmd_kmem(input_name); + return __cmd_kmem(); } else usage_with_options(kmem_usage, kmem_options); diff --git a/trunk/tools/perf/builtin-kvm.c b/trunk/tools/perf/builtin-kvm.c index 260abc535b5b..a28c9cad9048 100644 --- a/trunk/tools/perf/builtin-kvm.c +++ b/trunk/tools/perf/builtin-kvm.c @@ -32,76 +32,16 @@ struct event_key { int info; }; -struct kvm_event_stats { - u64 time; - struct stats stats; -}; - -struct kvm_event { - struct list_head hash_entry; - struct rb_node rb; - - struct event_key key; - - struct kvm_event_stats total; - - #define DEFAULT_VCPU_NUM 8 - int max_vcpu; - struct kvm_event_stats *vcpu; -}; - -typedef int (*key_cmp_fun)(struct kvm_event*, struct kvm_event*, int); - -struct kvm_event_key { - const char *name; - key_cmp_fun key; -}; - - -struct perf_kvm; - struct kvm_events_ops { bool (*is_begin_event)(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key); bool (*is_end_event)(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key); - void (*decode_key)(struct perf_kvm *kvm, struct event_key *key, - char decode[20]); + void (*decode_key)(struct event_key *key, char decode[20]); const char *name; }; -struct exit_reasons_table { - unsigned long exit_code; - const char *reason; -}; - -#define EVENTS_BITS 12 -#define EVENTS_CACHE_SIZE (1UL << EVENTS_BITS) - -struct perf_kvm { - struct perf_tool tool; - struct perf_session *session; - - const char *file_name; - const char *report_event; - const char *sort_key; - int trace_vcpu; - - struct exit_reasons_table *exit_reasons; - int exit_reasons_size; - const char *exit_reasons_isa; - - struct kvm_events_ops *events_ops; - key_cmp_fun compare; - struct list_head kvm_events_cache[EVENTS_CACHE_SIZE]; - u64 total_time; - u64 total_count; - - struct rb_root result; -}; - - static void exit_event_get_key(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key) @@ -138,35 +78,45 @@ static bool exit_event_end(struct perf_evsel *evsel, return kvm_entry_event(evsel); } -static struct exit_reasons_table vmx_exit_reasons[] = { +struct exit_reasons_table { + unsigned long exit_code; + const char *reason; +}; + +struct exit_reasons_table vmx_exit_reasons[] = { VMX_EXIT_REASONS }; -static struct exit_reasons_table svm_exit_reasons[] = { +struct exit_reasons_table svm_exit_reasons[] = { SVM_EXIT_REASONS }; -static const char *get_exit_reason(struct perf_kvm *kvm, u64 exit_code) +static int cpu_isa; + +static const char *get_exit_reason(u64 exit_code) { - int i = kvm->exit_reasons_size; - struct exit_reasons_table *tbl = kvm->exit_reasons; + int table_size = ARRAY_SIZE(svm_exit_reasons); + struct exit_reasons_table *table = svm_exit_reasons; + + if (cpu_isa == 1) { + table = vmx_exit_reasons; + table_size = ARRAY_SIZE(vmx_exit_reasons); + } - while (i--) { - if (tbl->exit_code == exit_code) - return tbl->reason; - tbl++; + while (table_size--) { + if (table->exit_code == exit_code) + return table->reason; + table++; } pr_err("unknown kvm exit code:%lld on %s\n", - (unsigned long long)exit_code, kvm->exit_reasons_isa); + (unsigned long long)exit_code, cpu_isa ? "VMX" : "SVM"); return "UNKNOWN"; } -static void exit_event_decode_key(struct perf_kvm *kvm, - struct event_key *key, - char decode[20]) +static void exit_event_decode_key(struct event_key *key, char decode[20]) { - const char *exit_reason = get_exit_reason(kvm, key->key); + const char *exit_reason = get_exit_reason(key->key); scnprintf(decode, 20, "%s", exit_reason); } @@ -178,11 +128,11 @@ static struct kvm_events_ops exit_events = { .name = "VM-EXIT" }; -/* - * For the mmio events, we treat: - * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry - * the time of MMIO read: kvm_exit -> kvm_mmio(KVM_TRACE_MMIO_READ...). - */ + /* + * For the mmio events, we treat: + * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry + * the time of MMIO read: kvm_exit -> kvm_mmio(KVM_TRACE_MMIO_READ...). + */ static void mmio_event_get_key(struct perf_evsel *evsel, struct perf_sample *sample, struct event_key *key) { @@ -228,9 +178,7 @@ static bool mmio_event_end(struct perf_evsel *evsel, struct perf_sample *sample, return false; } -static void mmio_event_decode_key(struct perf_kvm *kvm __maybe_unused, - struct event_key *key, - char decode[20]) +static void mmio_event_decode_key(struct event_key *key, char decode[20]) { scnprintf(decode, 20, "%#lx:%s", (unsigned long)key->key, key->info == KVM_TRACE_MMIO_WRITE ? "W" : "R"); @@ -271,9 +219,7 @@ static bool ioport_event_end(struct perf_evsel *evsel, return kvm_entry_event(evsel); } -static void ioport_event_decode_key(struct perf_kvm *kvm __maybe_unused, - struct event_key *key, - char decode[20]) +static void ioport_event_decode_key(struct event_key *key, char decode[20]) { scnprintf(decode, 20, "%#llx:%s", (unsigned long long)key->key, key->info ? "POUT" : "PIN"); @@ -286,37 +232,64 @@ static struct kvm_events_ops ioport_events = { .name = "IO Port Access" }; -static bool register_kvm_events_ops(struct perf_kvm *kvm) +static const char *report_event = "vmexit"; +struct kvm_events_ops *events_ops; + +static bool register_kvm_events_ops(void) { bool ret = true; - if (!strcmp(kvm->report_event, "vmexit")) - kvm->events_ops = &exit_events; - else if (!strcmp(kvm->report_event, "mmio")) - kvm->events_ops = &mmio_events; - else if (!strcmp(kvm->report_event, "ioport")) - kvm->events_ops = &ioport_events; + if (!strcmp(report_event, "vmexit")) + events_ops = &exit_events; + else if (!strcmp(report_event, "mmio")) + events_ops = &mmio_events; + else if (!strcmp(report_event, "ioport")) + events_ops = &ioport_events; else { - pr_err("Unknown report event:%s\n", kvm->report_event); + pr_err("Unknown report event:%s\n", report_event); ret = false; } return ret; } +struct kvm_event_stats { + u64 time; + struct stats stats; +}; + +struct kvm_event { + struct list_head hash_entry; + struct rb_node rb; + + struct event_key key; + + struct kvm_event_stats total; + + #define DEFAULT_VCPU_NUM 8 + int max_vcpu; + struct kvm_event_stats *vcpu; +}; + struct vcpu_event_record { int vcpu_id; u64 start_time; struct kvm_event *last_event; }; +#define EVENTS_BITS 12 +#define EVENTS_CACHE_SIZE (1UL << EVENTS_BITS) + +static u64 total_time; +static u64 total_count; +static struct list_head kvm_events_cache[EVENTS_CACHE_SIZE]; -static void init_kvm_event_record(struct perf_kvm *kvm) +static void init_kvm_event_record(void) { int i; for (i = 0; i < (int)EVENTS_CACHE_SIZE; i++) - INIT_LIST_HEAD(&kvm->kvm_events_cache[i]); + INIT_LIST_HEAD(&kvm_events_cache[i]); } static int kvm_events_hash_fn(u64 key) @@ -360,15 +333,14 @@ static struct kvm_event *kvm_alloc_init_event(struct event_key *key) return event; } -static struct kvm_event *find_create_kvm_event(struct perf_kvm *kvm, - struct event_key *key) +static struct kvm_event *find_create_kvm_event(struct event_key *key) { struct kvm_event *event; struct list_head *head; BUG_ON(key->key == INVALID_KEY); - head = &kvm->kvm_events_cache[kvm_events_hash_fn(key->key)]; + head = &kvm_events_cache[kvm_events_hash_fn(key->key)]; list_for_each_entry(event, head, hash_entry) if (event->key.key == key->key && event->key.info == key->info) return event; @@ -381,14 +353,13 @@ static struct kvm_event *find_create_kvm_event(struct perf_kvm *kvm, return event; } -static bool handle_begin_event(struct perf_kvm *kvm, - struct vcpu_event_record *vcpu_record, +static bool handle_begin_event(struct vcpu_event_record *vcpu_record, struct event_key *key, u64 timestamp) { struct kvm_event *event = NULL; if (key->key != INVALID_KEY) - event = find_create_kvm_event(kvm, key); + event = find_create_kvm_event(key); vcpu_record->last_event = event; vcpu_record->start_time = timestamp; @@ -425,10 +396,8 @@ static bool update_kvm_event(struct kvm_event *event, int vcpu_id, return true; } -static bool handle_end_event(struct perf_kvm *kvm, - struct vcpu_event_record *vcpu_record, - struct event_key *key, - u64 timestamp) +static bool handle_end_event(struct vcpu_event_record *vcpu_record, + struct event_key *key, u64 timestamp) { struct kvm_event *event; u64 time_begin, time_diff; @@ -450,7 +419,7 @@ static bool handle_end_event(struct perf_kvm *kvm, return true; if (!event) - event = find_create_kvm_event(kvm, key); + event = find_create_kvm_event(key); if (!event) return false; @@ -486,9 +455,7 @@ struct vcpu_event_record *per_vcpu_record(struct thread *thread, return thread->priv; } -static bool handle_kvm_event(struct perf_kvm *kvm, - struct thread *thread, - struct perf_evsel *evsel, +static bool handle_kvm_event(struct thread *thread, struct perf_evsel *evsel, struct perf_sample *sample) { struct vcpu_event_record *vcpu_record; @@ -498,15 +465,22 @@ static bool handle_kvm_event(struct perf_kvm *kvm, if (!vcpu_record) return true; - if (kvm->events_ops->is_begin_event(evsel, sample, &key)) - return handle_begin_event(kvm, vcpu_record, &key, sample->time); + if (events_ops->is_begin_event(evsel, sample, &key)) + return handle_begin_event(vcpu_record, &key, sample->time); - if (kvm->events_ops->is_end_event(evsel, sample, &key)) - return handle_end_event(kvm, vcpu_record, &key, sample->time); + if (events_ops->is_end_event(evsel, sample, &key)) + return handle_end_event(vcpu_record, &key, sample->time); return true; } +typedef int (*key_cmp_fun)(struct kvm_event*, struct kvm_event*, int); +struct kvm_event_key { + const char *name; + key_cmp_fun key; +}; + +static int trace_vcpu = -1; #define GET_EVENT_KEY(func, field) \ static u64 get_event_ ##func(struct kvm_event *event, int vcpu) \ { \ @@ -541,25 +515,29 @@ static struct kvm_event_key keys[] = { { NULL, NULL } }; -static bool select_key(struct perf_kvm *kvm) +static const char *sort_key = "sample"; +static key_cmp_fun compare; + +static bool select_key(void) { int i; for (i = 0; keys[i].name; i++) { - if (!strcmp(keys[i].name, kvm->sort_key)) { - kvm->compare = keys[i].key; + if (!strcmp(keys[i].name, sort_key)) { + compare = keys[i].key; return true; } } - pr_err("Unknown compare key:%s\n", kvm->sort_key); + pr_err("Unknown compare key:%s\n", sort_key); return false; } -static void insert_to_result(struct rb_root *result, struct kvm_event *event, - key_cmp_fun bigger, int vcpu) +static struct rb_root result; +static void insert_to_result(struct kvm_event *event, key_cmp_fun bigger, + int vcpu) { - struct rb_node **rb = &result->rb_node; + struct rb_node **rb = &result.rb_node; struct rb_node *parent = NULL; struct kvm_event *p; @@ -574,15 +552,13 @@ static void insert_to_result(struct rb_root *result, struct kvm_event *event, } rb_link_node(&event->rb, parent, rb); - rb_insert_color(&event->rb, result); + rb_insert_color(&event->rb, &result); } -static void update_total_count(struct perf_kvm *kvm, struct kvm_event *event) +static void update_total_count(struct kvm_event *event, int vcpu) { - int vcpu = kvm->trace_vcpu; - - kvm->total_count += get_event_count(event, vcpu); - kvm->total_time += get_event_time(event, vcpu); + total_count += get_event_count(event, vcpu); + total_time += get_event_time(event, vcpu); } static bool event_is_valid(struct kvm_event *event, int vcpu) @@ -590,30 +566,28 @@ static bool event_is_valid(struct kvm_event *event, int vcpu) return !!get_event_count(event, vcpu); } -static void sort_result(struct perf_kvm *kvm) +static void sort_result(int vcpu) { unsigned int i; - int vcpu = kvm->trace_vcpu; struct kvm_event *event; for (i = 0; i < EVENTS_CACHE_SIZE; i++) - list_for_each_entry(event, &kvm->kvm_events_cache[i], hash_entry) + list_for_each_entry(event, &kvm_events_cache[i], hash_entry) if (event_is_valid(event, vcpu)) { - update_total_count(kvm, event); - insert_to_result(&kvm->result, event, - kvm->compare, vcpu); + update_total_count(event, vcpu); + insert_to_result(event, compare, vcpu); } } /* returns left most element of result, and erase it */ -static struct kvm_event *pop_from_result(struct rb_root *result) +static struct kvm_event *pop_from_result(void) { - struct rb_node *node = rb_first(result); + struct rb_node *node = rb_first(&result); if (!node) return NULL; - rb_erase(node, result); + rb_erase(node, &result); return container_of(node, struct kvm_event, rb); } @@ -627,15 +601,14 @@ static void print_vcpu_info(int vcpu) pr_info("VCPU %d:\n\n", vcpu); } -static void print_result(struct perf_kvm *kvm) +static void print_result(int vcpu) { char decode[20]; struct kvm_event *event; - int vcpu = kvm->trace_vcpu; pr_info("\n\n"); print_vcpu_info(vcpu); - pr_info("%20s ", kvm->events_ops->name); + pr_info("%20s ", events_ops->name); pr_info("%10s ", "Samples"); pr_info("%9s ", "Samples%"); @@ -643,34 +616,33 @@ static void print_result(struct perf_kvm *kvm) pr_info("%16s ", "Avg time"); pr_info("\n\n"); - while ((event = pop_from_result(&kvm->result))) { + while ((event = pop_from_result())) { u64 ecount, etime; ecount = get_event_count(event, vcpu); etime = get_event_time(event, vcpu); - kvm->events_ops->decode_key(kvm, &event->key, decode); + events_ops->decode_key(&event->key, decode); pr_info("%20s ", decode); pr_info("%10llu ", (unsigned long long)ecount); - pr_info("%8.2f%% ", (double)ecount / kvm->total_count * 100); - pr_info("%8.2f%% ", (double)etime / kvm->total_time * 100); + pr_info("%8.2f%% ", (double)ecount / total_count * 100); + pr_info("%8.2f%% ", (double)etime / total_time * 100); pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount/1e3, kvm_event_rel_stddev(vcpu, event)); pr_info("\n"); } pr_info("\nTotal Samples:%lld, Total events handled time:%.2fus.\n\n", - (unsigned long long)kvm->total_count, kvm->total_time / 1e3); + (unsigned long long)total_count, total_time / 1e3); } -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine) { struct thread *thread = machine__findnew_thread(machine, sample->tid); - struct perf_kvm *kvm = container_of(tool, struct perf_kvm, tool); if (thread == NULL) { pr_debug("problem processing %d event, skipping it.\n", @@ -678,12 +650,18 @@ static int process_sample_event(struct perf_tool *tool, return -1; } - if (!handle_kvm_event(kvm, thread, evsel, sample)) + if (!handle_kvm_event(thread, evsel, sample)) return -1; return 0; } +static struct perf_tool eops = { + .sample = process_sample_event, + .comm = perf_event__process_comm, + .ordered_samples = true, +}; + static int get_cpu_isa(struct perf_session *session) { char *cpuid = session->header.env.cpuid; @@ -701,43 +679,34 @@ static int get_cpu_isa(struct perf_session *session) return isa; } -static int read_events(struct perf_kvm *kvm) +static const char *file_name; + +static int read_events(void) { + struct perf_session *kvm_session; int ret; - struct perf_tool eops = { - .sample = process_sample_event, - .comm = perf_event__process_comm, - .ordered_samples = true, - }; - - kvm->tool = eops; - kvm->session = perf_session__new(kvm->file_name, O_RDONLY, 0, false, - &kvm->tool); - if (!kvm->session) { + kvm_session = perf_session__new(file_name, O_RDONLY, 0, false, &eops); + if (!kvm_session) { pr_err("Initializing perf session failed\n"); return -EINVAL; } - if (!perf_session__has_traces(kvm->session, "kvm record")) + if (!perf_session__has_traces(kvm_session, "kvm record")) return -EINVAL; /* * Do not use 'isa' recorded in kvm_exit tracepoint since it is not * traced in the old kernel. */ - ret = get_cpu_isa(kvm->session); + ret = get_cpu_isa(kvm_session); if (ret < 0) return ret; - if (ret == 1) { - kvm->exit_reasons = vmx_exit_reasons; - kvm->exit_reasons_size = ARRAY_SIZE(vmx_exit_reasons); - kvm->exit_reasons_isa = "VMX"; - } + cpu_isa = ret; - return perf_session__process_events(kvm->session, &kvm->tool); + return perf_session__process_events(kvm_session, &eops); } static bool verify_vcpu(int vcpu) @@ -750,30 +719,28 @@ static bool verify_vcpu(int vcpu) return true; } -static int kvm_events_report_vcpu(struct perf_kvm *kvm) +static int kvm_events_report_vcpu(int vcpu) { int ret = -EINVAL; - int vcpu = kvm->trace_vcpu; if (!verify_vcpu(vcpu)) goto exit; - if (!select_key(kvm)) + if (!select_key()) goto exit; - if (!register_kvm_events_ops(kvm)) + if (!register_kvm_events_ops()) goto exit; - init_kvm_event_record(kvm); + init_kvm_event_record(); setup_pager(); - ret = read_events(kvm); + ret = read_events(); if (ret) goto exit; - sort_result(kvm); - print_result(kvm); - + sort_result(vcpu); + print_result(vcpu); exit: return ret; } @@ -798,7 +765,7 @@ static const char * const record_args[] = { _p; \ }) -static int kvm_events_record(struct perf_kvm *kvm, int argc, const char **argv) +static int kvm_events_record(int argc, const char **argv) { unsigned int rec_argc, i, j; const char **rec_argv; @@ -813,7 +780,7 @@ static int kvm_events_record(struct perf_kvm *kvm, int argc, const char **argv) rec_argv[i] = STRDUP_FAIL_EXIT(record_args[i]); rec_argv[i++] = STRDUP_FAIL_EXIT("-o"); - rec_argv[i++] = STRDUP_FAIL_EXIT(kvm->file_name); + rec_argv[i++] = STRDUP_FAIL_EXIT(file_name); for (j = 1; j < (unsigned int)argc; j++, i++) rec_argv[i] = argv[j]; @@ -821,24 +788,24 @@ static int kvm_events_record(struct perf_kvm *kvm, int argc, const char **argv) return cmd_record(i, rec_argv, NULL); } -static int kvm_events_report(struct perf_kvm *kvm, int argc, const char **argv) -{ - const struct option kvm_events_report_options[] = { - OPT_STRING(0, "event", &kvm->report_event, "report event", - "event for reporting: vmexit, mmio, ioport"), - OPT_INTEGER(0, "vcpu", &kvm->trace_vcpu, - "vcpu id to report"), - OPT_STRING('k', "key", &kvm->sort_key, "sort-key", - "key for sorting: sample(sort by samples number)" - " time (sort by avg time)"), - OPT_END() - }; +static const char * const kvm_events_report_usage[] = { + "perf kvm stat report []", + NULL +}; - const char * const kvm_events_report_usage[] = { - "perf kvm stat report []", - NULL - }; +static const struct option kvm_events_report_options[] = { + OPT_STRING(0, "event", &report_event, "report event", + "event for reporting: vmexit, mmio, ioport"), + OPT_INTEGER(0, "vcpu", &trace_vcpu, + "vcpu id to report"), + OPT_STRING('k', "key", &sort_key, "sort-key", + "key for sorting: sample(sort by samples number)" + " time (sort by avg time)"), + OPT_END() +}; +static int kvm_events_report(int argc, const char **argv) +{ symbol__init(); if (argc) { @@ -850,7 +817,7 @@ static int kvm_events_report(struct perf_kvm *kvm, int argc, const char **argv) kvm_events_report_options); } - return kvm_events_report_vcpu(kvm); + return kvm_events_report_vcpu(trace_vcpu); } static void print_kvm_stat_usage(void) @@ -864,7 +831,7 @@ static void print_kvm_stat_usage(void) printf("\nOtherwise, it is the alias of 'perf stat':\n"); } -static int kvm_cmd_stat(struct perf_kvm *kvm, int argc, const char **argv) +static int kvm_cmd_stat(int argc, const char **argv) { if (argc == 1) { print_kvm_stat_usage(); @@ -872,16 +839,44 @@ static int kvm_cmd_stat(struct perf_kvm *kvm, int argc, const char **argv) } if (!strncmp(argv[1], "rec", 3)) - return kvm_events_record(kvm, argc - 1, argv + 1); + return kvm_events_record(argc - 1, argv + 1); if (!strncmp(argv[1], "rep", 3)) - return kvm_events_report(kvm, argc - 1 , argv + 1); + return kvm_events_report(argc - 1 , argv + 1); perf_stat: return cmd_stat(argc, argv, NULL); } -static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) +static char name_buffer[256]; + +static const char * const kvm_usage[] = { + "perf kvm [] {top|record|report|diff|buildid-list|stat}", + NULL +}; + +static const struct option kvm_options[] = { + OPT_STRING('i', "input", &file_name, "file", + "Input file name"), + OPT_STRING('o', "output", &file_name, "file", + "Output file name"), + OPT_BOOLEAN(0, "guest", &perf_guest, + "Collect guest os data"), + OPT_BOOLEAN(0, "host", &perf_host, + "Collect host os data"), + OPT_STRING(0, "guestmount", &symbol_conf.guestmount, "directory", + "guest mount directory under which every guest os" + " instance has a subdir"), + OPT_STRING(0, "guestvmlinux", &symbol_conf.default_guest_vmlinux_name, + "file", "file saving guest os vmlinux"), + OPT_STRING(0, "guestkallsyms", &symbol_conf.default_guest_kallsyms, + "file", "file saving guest os /proc/kallsyms"), + OPT_STRING(0, "guestmodules", &symbol_conf.default_guest_modules, + "file", "file saving guest os /proc/modules"), + OPT_END() +}; + +static int __cmd_record(int argc, const char **argv) { int rec_argc, i = 0, j; const char **rec_argv; @@ -890,7 +885,7 @@ static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) rec_argv = calloc(rec_argc + 1, sizeof(char *)); rec_argv[i++] = strdup("record"); rec_argv[i++] = strdup("-o"); - rec_argv[i++] = strdup(kvm->file_name); + rec_argv[i++] = strdup(file_name); for (j = 1; j < argc; j++, i++) rec_argv[i] = argv[j]; @@ -899,7 +894,7 @@ static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) return cmd_record(i, rec_argv, NULL); } -static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) +static int __cmd_report(int argc, const char **argv) { int rec_argc, i = 0, j; const char **rec_argv; @@ -908,7 +903,7 @@ static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) rec_argv = calloc(rec_argc + 1, sizeof(char *)); rec_argv[i++] = strdup("report"); rec_argv[i++] = strdup("-i"); - rec_argv[i++] = strdup(kvm->file_name); + rec_argv[i++] = strdup(file_name); for (j = 1; j < argc; j++, i++) rec_argv[i] = argv[j]; @@ -917,7 +912,7 @@ static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) return cmd_report(i, rec_argv, NULL); } -static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) +static int __cmd_buildid_list(int argc, const char **argv) { int rec_argc, i = 0, j; const char **rec_argv; @@ -926,7 +921,7 @@ static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) rec_argv = calloc(rec_argc + 1, sizeof(char *)); rec_argv[i++] = strdup("buildid-list"); rec_argv[i++] = strdup("-i"); - rec_argv[i++] = strdup(kvm->file_name); + rec_argv[i++] = strdup(file_name); for (j = 1; j < argc; j++, i++) rec_argv[i] = argv[j]; @@ -937,43 +932,6 @@ static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused) { - struct perf_kvm kvm = { - .trace_vcpu = -1, - .report_event = "vmexit", - .sort_key = "sample", - - .exit_reasons = svm_exit_reasons, - .exit_reasons_size = ARRAY_SIZE(svm_exit_reasons), - .exit_reasons_isa = "SVM", - }; - - const struct option kvm_options[] = { - OPT_STRING('i', "input", &kvm.file_name, "file", - "Input file name"), - OPT_STRING('o', "output", &kvm.file_name, "file", - "Output file name"), - OPT_BOOLEAN(0, "guest", &perf_guest, - "Collect guest os data"), - OPT_BOOLEAN(0, "host", &perf_host, - "Collect host os data"), - OPT_STRING(0, "guestmount", &symbol_conf.guestmount, "directory", - "guest mount directory under which every guest os" - " instance has a subdir"), - OPT_STRING(0, "guestvmlinux", &symbol_conf.default_guest_vmlinux_name, - "file", "file saving guest os vmlinux"), - OPT_STRING(0, "guestkallsyms", &symbol_conf.default_guest_kallsyms, - "file", "file saving guest os /proc/kallsyms"), - OPT_STRING(0, "guestmodules", &symbol_conf.default_guest_modules, - "file", "file saving guest os /proc/modules"), - OPT_END() - }; - - - const char * const kvm_usage[] = { - "perf kvm [] {top|record|report|diff|buildid-list|stat}", - NULL - }; - perf_host = 0; perf_guest = 1; @@ -985,32 +943,28 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused) if (!perf_host) perf_guest = 1; - if (!kvm.file_name) { + if (!file_name) { if (perf_host && !perf_guest) - kvm.file_name = strdup("perf.data.host"); + sprintf(name_buffer, "perf.data.host"); else if (!perf_host && perf_guest) - kvm.file_name = strdup("perf.data.guest"); + sprintf(name_buffer, "perf.data.guest"); else - kvm.file_name = strdup("perf.data.kvm"); - - if (!kvm.file_name) { - pr_err("Failed to allocate memory for filename\n"); - return -ENOMEM; - } + sprintf(name_buffer, "perf.data.kvm"); + file_name = name_buffer; } if (!strncmp(argv[0], "rec", 3)) - return __cmd_record(&kvm, argc, argv); + return __cmd_record(argc, argv); else if (!strncmp(argv[0], "rep", 3)) - return __cmd_report(&kvm, argc, argv); + return __cmd_report(argc, argv); else if (!strncmp(argv[0], "diff", 4)) return cmd_diff(argc, argv, NULL); else if (!strncmp(argv[0], "top", 3)) return cmd_top(argc, argv, NULL); else if (!strncmp(argv[0], "buildid-list", 12)) - return __cmd_buildid_list(&kvm, argc, argv); + return __cmd_buildid_list(argc, argv); else if (!strncmp(argv[0], "stat", 4)) - return kvm_cmd_stat(&kvm, argc, argv); + return kvm_cmd_stat(argc, argv); else usage_with_options(kvm_usage, kvm_options); diff --git a/trunk/tools/perf/builtin-lock.c b/trunk/tools/perf/builtin-lock.c index 6f5f328157aa..7d6e09949880 100644 --- a/trunk/tools/perf/builtin-lock.c +++ b/trunk/tools/perf/builtin-lock.c @@ -823,6 +823,12 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, return 0; } +static struct perf_tool eops = { + .sample = process_sample_event, + .comm = perf_event__process_comm, + .ordered_samples = true, +}; + static const struct perf_evsel_str_handler lock_tracepoints[] = { { "lock:lock_acquire", perf_evsel__process_lock_acquire, }, /* CONFIG_LOCKDEP */ { "lock:lock_acquired", perf_evsel__process_lock_acquired, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */ @@ -832,11 +838,6 @@ static const struct perf_evsel_str_handler lock_tracepoints[] = { static int read_events(void) { - struct perf_tool eops = { - .sample = process_sample_event, - .comm = perf_event__process_comm, - .ordered_samples = true, - }; session = perf_session__new(input_name, O_RDONLY, 0, false, &eops); if (!session) { pr_err("Initializing perf session failed\n"); @@ -877,11 +878,53 @@ static int __cmd_report(void) return 0; } +static const char * const report_usage[] = { + "perf lock report []", + NULL +}; + +static const struct option report_options[] = { + OPT_STRING('k', "key", &sort_key, "acquired", + "key for sorting (acquired / contended / wait_total / wait_max / wait_min)"), + /* TODO: type */ + OPT_END() +}; + +static const char * const info_usage[] = { + "perf lock info []", + NULL +}; + +static const struct option info_options[] = { + OPT_BOOLEAN('t', "threads", &info_threads, + "dump thread list in perf.data"), + OPT_BOOLEAN('m', "map", &info_map, + "map of lock instances (address:name table)"), + OPT_END() +}; + +static const char * const lock_usage[] = { + "perf lock [] {record|report|script|info}", + NULL +}; + +static const struct option lock_options[] = { + OPT_STRING('i', "input", &input_name, "file", "input file name"), + OPT_INCR('v', "verbose", &verbose, "be more verbose (show symbol address, etc)"), + OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, "dump raw trace in ASCII"), + OPT_END() +}; + +static const char *record_args[] = { + "record", + "-R", + "-f", + "-m", "1024", + "-c", "1", +}; + static int __cmd_record(int argc, const char **argv) { - const char *record_args[] = { - "record", "-R", "-f", "-m", "1024", "-c", "1", - }; unsigned int rec_argc, i, j; const char **rec_argv; @@ -920,37 +963,6 @@ static int __cmd_record(int argc, const char **argv) int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) { - const struct option info_options[] = { - OPT_BOOLEAN('t', "threads", &info_threads, - "dump thread list in perf.data"), - OPT_BOOLEAN('m', "map", &info_map, - "map of lock instances (address:name table)"), - OPT_END() - }; - const struct option lock_options[] = { - OPT_STRING('i', "input", &input_name, "file", "input file name"), - OPT_INCR('v', "verbose", &verbose, "be more verbose (show symbol address, etc)"), - OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, "dump raw trace in ASCII"), - OPT_END() - }; - const struct option report_options[] = { - OPT_STRING('k', "key", &sort_key, "acquired", - "key for sorting (acquired / contended / wait_total / wait_max / wait_min)"), - /* TODO: type */ - OPT_END() - }; - const char * const info_usage[] = { - "perf lock info []", - NULL - }; - const char * const lock_usage[] = { - "perf lock [] {record|report|script|info}", - NULL - }; - const char * const report_usage[] = { - "perf lock report []", - NULL - }; unsigned int i; int rc = 0; diff --git a/trunk/tools/perf/builtin-probe.c b/trunk/tools/perf/builtin-probe.c index de38a034b129..118aa8946573 100644 --- a/trunk/tools/perf/builtin-probe.c +++ b/trunk/tools/perf/builtin-probe.c @@ -250,20 +250,19 @@ static int opt_set_filter(const struct option *opt __maybe_unused, return 0; } -int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) -{ - const char * const probe_usage[] = { - "perf probe [] 'PROBEDEF' ['PROBEDEF' ...]", - "perf probe [] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", - "perf probe [] --del '[GROUP:]EVENT' ...", - "perf probe --list", +static const char * const probe_usage[] = { + "perf probe [] 'PROBEDEF' ['PROBEDEF' ...]", + "perf probe [] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", + "perf probe [] --del '[GROUP:]EVENT' ...", + "perf probe --list", #ifdef DWARF_SUPPORT - "perf probe [] --line 'LINEDESC'", - "perf probe [] --vars 'PROBEPOINT'", + "perf probe [] --line 'LINEDESC'", + "perf probe [] --vars 'PROBEPOINT'", #endif - NULL + NULL }; - const struct option options[] = { + +static const struct option options[] = { OPT_INCR('v', "verbose", &verbose, "be more verbose (show parsed arguments, etc)"), OPT_BOOLEAN('l', "list", ¶ms.list_events, @@ -326,7 +325,10 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) OPT_CALLBACK('x', "exec", NULL, "executable|path", "target executable name or path", opt_set_target), OPT_END() - }; +}; + +int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) +{ int ret; argc = parse_options(argc, argv, options, probe_usage, diff --git a/trunk/tools/perf/builtin-record.c b/trunk/tools/perf/builtin-record.c index e9231659754d..f14cb5fdb91f 100644 --- a/trunk/tools/perf/builtin-record.c +++ b/trunk/tools/perf/builtin-record.c @@ -31,6 +31,15 @@ #include #include +#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " + +#ifdef NO_LIBUNWIND_SUPPORT +static char callchain_help[] = CALLCHAIN_HELP "[fp]"; +#else +static unsigned long default_stack_dump_size = 8192; +static char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; +#endif + enum write_mode_t { WRITE_FORCE, WRITE_APPEND @@ -791,7 +800,7 @@ parse_branch_stack(const struct option *opt, const char *str, int unset) return ret; } -#ifdef LIBUNWIND_SUPPORT +#ifndef NO_LIBUNWIND_SUPPORT static int get_stack_size(char *str, unsigned long *_size) { char *endptr; @@ -817,7 +826,7 @@ static int get_stack_size(char *str, unsigned long *_size) max_size, str); return -1; } -#endif /* LIBUNWIND_SUPPORT */ +#endif /* !NO_LIBUNWIND_SUPPORT */ static int parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, @@ -856,11 +865,9 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, "needed for -g fp\n"); break; -#ifdef LIBUNWIND_SUPPORT +#ifndef NO_LIBUNWIND_SUPPORT /* Dwarf style */ } else if (!strncmp(name, "dwarf", sizeof("dwarf"))) { - const unsigned long default_stack_dump_size = 8192; - ret = 0; rec->opts.call_graph = CALLCHAIN_DWARF; rec->opts.stack_dump_size = default_stack_dump_size; @@ -876,7 +883,7 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, if (!ret) pr_debug("callchain: stack dump size %d\n", rec->opts.stack_dump_size); -#endif /* LIBUNWIND_SUPPORT */ +#endif /* !NO_LIBUNWIND_SUPPORT */ } else { pr_err("callchain: Unknown -g option " "value: %s\n", arg); @@ -923,14 +930,6 @@ static struct perf_record record = { .file_new = true, }; -#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " - -#ifdef LIBUNWIND_SUPPORT -static const char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; -#else -static const char callchain_help[] = CALLCHAIN_HELP "[fp]"; -#endif - /* * XXX Will stay a global variable till we fix builtin-script.c to stop messing * with it and switch to use the library functions in perf_evlist that came diff --git a/trunk/tools/perf/builtin-report.c b/trunk/tools/perf/builtin-report.c index a61725d89d3e..1da243dfbc3e 100644 --- a/trunk/tools/perf/builtin-report.c +++ b/trunk/tools/perf/builtin-report.c @@ -320,7 +320,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist, const char *evname = perf_evsel__name(pos); hists__fprintf_nr_sample_events(hists, evname, stdout); - hists__fprintf(hists, true, 0, 0, stdout); + hists__fprintf(hists, NULL, false, true, 0, 0, stdout); fprintf(stdout, "\n\n"); } @@ -691,7 +691,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) setup_browser(true); else { use_browser = 0; - perf_hpp__init(); + perf_hpp__init(false, false); } setup_sorting(report_usage, options); diff --git a/trunk/tools/perf/builtin-sched.c b/trunk/tools/perf/builtin-sched.c index 3488ead3b60c..9b9e32eaa805 100644 --- a/trunk/tools/perf/builtin-sched.c +++ b/trunk/tools/perf/builtin-sched.c @@ -1426,7 +1426,7 @@ static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_ struct perf_evsel *evsel, struct machine *machine) { - struct thread *thread = machine__findnew_thread(machine, sample->tid); + struct thread *thread = machine__findnew_thread(machine, sample->pid); int err = 0; if (thread == NULL) { diff --git a/trunk/tools/perf/builtin-script.c b/trunk/tools/perf/builtin-script.c index fb9625083a2e..1be843aa1546 100644 --- a/trunk/tools/perf/builtin-script.c +++ b/trunk/tools/perf/builtin-script.c @@ -24,6 +24,7 @@ static u64 last_timestamp; static u64 nr_unordered; extern const struct option record_options[]; static bool no_callchain; +static bool show_full_info; static bool system_wide; static const char *cpu_list; static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); @@ -472,6 +473,8 @@ static int cleanup_scripting(void) return scripting_ops->stop_script(); } +static const char *input_name; + static int process_sample_event(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, @@ -1153,40 +1156,20 @@ static int has_required_arg(char *script_path) return n_args; } -static int have_cmd(int argc, const char **argv) -{ - char **__argv = malloc(sizeof(const char *) * argc); - - if (!__argv) { - pr_err("malloc failed\n"); - return -1; - } - - memcpy(__argv, argv, sizeof(const char *) * argc); - argc = parse_options(argc, (const char **)__argv, record_options, - NULL, PARSE_OPT_STOP_AT_NON_OPTION); - free(__argv); - - system_wide = (argc == 0); - - return 0; -} +static const char * const script_usage[] = { + "perf script []", + "perf script [] record