···11+22+ CPU frequency and voltage scaling statictics in the Linux(TM) kernel33+44+55+ L i n u x c p u f r e q - s t a t s d r i v e r66+77+ - information for users -88+99+1010+ Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>1111+1212+Contents1313+1. Introduction1414+2. Statistics Provided (with example)1515+3. Configuring cpufreq-stats1616+1717+1818+1. Introduction1919+2020+cpufreq-stats is a driver that provices CPU frequency statistics for each CPU.2121+This statistics is provided in /sysfs as a bunch of read_only interfaces. This2222+interface (when configured) will appear in a seperate directory under cpufreq2323+in /sysfs (<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/) for each CPU.2424+Various statistics will form read_only files under this directory.2525+2626+This driver is designed to be independent of any particular cpufreq_driver2727+that may be running on your CPU. So, it will work with any cpufreq_driver.2828+2929+3030+2. Statistics Provided (with example)3131+3232+cpufreq stats provides following statistics (explained in detail below).3333+- time_in_state3434+- total_trans3535+- trans_table3636+3737+All the statistics will be from the time the stats driver has been inserted 3838+to the time when a read of a particular statistic is done. Obviously, stats 3939+driver will not have any information about the the frequcny transitions before4040+the stats driver insertion.4141+4242+--------------------------------------------------------------------------------4343+<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l4444+total 04545+drwxr-xr-x 2 root root 0 May 14 16:06 .4646+drwxr-xr-x 3 root root 0 May 14 15:58 ..4747+-r--r--r-- 1 root root 4096 May 14 16:06 time_in_state4848+-r--r--r-- 1 root root 4096 May 14 16:06 total_trans4949+-r--r--r-- 1 root root 4096 May 14 16:06 trans_table5050+--------------------------------------------------------------------------------5151+5252+- time_in_state5353+This gives the amount of time spent in each of the frequencies supported by5454+this CPU. The cat output will have "<frequency> <time>" pair in each line, which5555+will mean this CPU spent <time> usertime units of time at <frequency>. Output5656+will have one line for each of the supported freuencies. usertime units here 5757+is 10mS (similar to other time exported in /proc).5858+5959+--------------------------------------------------------------------------------6060+<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state 6161+3600000 20896262+3400000 1366363+3200000 346464+3000000 676565+2800000 1724886666+--------------------------------------------------------------------------------6767+6868+6969+- total_trans7070+This gives the total number of frequency transitions on this CPU. The cat 7171+output will have a single count which is the total number of frequency7272+transitions.7373+7474+--------------------------------------------------------------------------------7575+<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans7676+207777+--------------------------------------------------------------------------------7878+7979+- trans_table8080+This will give a fine grained information about all the CPU frequency8181+transitions. The cat output here is a two dimensional matrix, where an entry8282+<i,j> (row i, column j) represents the count of number of transitions from 8383+Freq_i to Freq_j. Freq_i is in descending order with increasing rows and 8484+Freq_j is in descending order with increasing columns. The output here also 8585+contains the actual freq values for each row and column for better readability.8686+8787+--------------------------------------------------------------------------------8888+<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table8989+ From : To9090+ : 3600000 3400000 3200000 3000000 2800000 9191+ 3600000: 0 5 0 0 0 9292+ 3400000: 4 0 2 0 0 9393+ 3200000: 0 1 0 2 0 9494+ 3000000: 0 0 1 0 3 9595+ 2800000: 0 0 0 2 0 9696+--------------------------------------------------------------------------------9797+9898+9999+3. Configuring cpufreq-stats100100+101101+To configure cpufreq-stats in your kernel102102+Config Main Menu103103+ Power management options (ACPI, APM) --->104104+ CPU Frequency scaling --->105105+ [*] CPU Frequency scaling106106+ <*> CPU frequency translation statistics 107107+ [*] CPU frequency translation statistics details108108+109109+110110+"CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configure111111+cpufreq-stats.112112+113113+"CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT) provides the114114+basic statistics which includes time_in_state and total_trans.115115+116116+"CPU frequency translation statistics details" (CONFIG_CPU_FREQ_STAT_DETAILS)117117+provides fine grained cpufreq stats by trans_table. The reason for having a118118+seperate config option for trans_table is:119119+- trans_table goes against the traditional /sysfs rule of one value per120120+ interface. It provides a whole bunch of value in a 2 dimensional matrix121121+ form.122122+123123+Once these two options are enabled and your CPU supports cpufrequency, you124124+will be able to see the CPU frequency statistics in /sysfs.125125+126126+127127+128128+
···5454void default_idle(void)5555{5656 while(1) {5757- if (need_resched()) {5757+ if (!need_resched()) {5858 local_irq_enable();5959 __asm__("sleep");6060 local_irq_disable();
+13-1
arch/i386/kernel/cpu/cpufreq/Kconfig
···2323 If in doubt, say N.24242525config ELAN_CPUFREQ2626- tristate "AMD Elan"2626+ tristate "AMD Elan SC400 and SC410"2727 select CPU_FREQ_TABLE2828 depends on X86_ELAN2929 ---help---···3737 For details, take a look at <file:Documentation/cpu-freq/>.38383939 If in doubt, say N.4040+4141+config SC520_CPUFREQ4242+ tristate "AMD Elan SC520"4343+ select CPU_FREQ_TABLE4444+ depends on X86_ELAN4545+ ---help---4646+ This adds the CPUFreq driver for AMD Elan SC520 processor.4747+4848+ For details, take a look at <file:Documentation/cpu-freq/>.4949+5050+ If in doubt, say N.5151+40524153config X86_POWERNOW_K64254 tristate "AMD Mobile K6-2/K6-3 PowerNow!"
···336336 if (!prev_speed)337337 return -EIO;338338339339- dprintk("previous seped is %u\n", prev_speed);339339+ dprintk("previous speed is %u\n", prev_speed);340340341341 local_irq_save(flags);342342···348348 goto out;349349 }350350351351- dprintk("low seped is %u\n", *low_speed);351351+ dprintk("low speed is %u\n", *low_speed);352352353353 /* switch to high state */354354 set_state(SPEEDSTEP_HIGH);···358358 goto out;359359 }360360361361- dprintk("high seped is %u\n", *high_speed);361361+ dprintk("high speed is %u\n", *high_speed);362362363363 if (*low_speed == *high_speed) {364364 ret = -ENODEV;
+3
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
···357357 case SPEEDSTEP_PROCESSOR_PIII_C:358358 case SPEEDSTEP_PROCESSOR_PIII_C_EARLY:359359 break;360360+ case SPEEDSTEP_PROCESSOR_P4M:361361+ printk(KERN_INFO "speedstep-smi: you're trying to use this cpufreq driver on a Pentium 4-based CPU. Most likely it will not work.\n");362362+ break;360363 default:361364 speedstep_processor = 0;362365 }
+1-1
arch/i386/kernel/cpu/intel_cacheinfo.c
···118118};119119120120#define MAX_CACHE_LEAVES 4121121-static unsigned short __devinitdata num_cache_leaves;121121+static unsigned short num_cache_leaves;122122123123static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)124124{
···10741074 cpu_set(cpu, cpu_sibling_map[cpu]);10751075 }1076107610771077- if (siblings != smp_num_siblings)10771077+ if (siblings != smp_num_siblings) {10781078 printk(KERN_WARNING "WARNING: %d siblings found for CPU%d, should be %d\n", siblings, cpu, smp_num_siblings);10791079+ smp_num_siblings = siblings;10801080+ }1079108110801082 if (c->x86_num_cores > 1) {10811083 for (i = 0; i < NR_CPUS; i++) {
+4-2
arch/i386/kernel/timers/common.c
···66#include <linux/timex.h>77#include <linux/errno.h>88#include <linux/jiffies.h>99+#include <linux/module.h>9101011#include <asm/io.h>1112#include <asm/timer.h>···25242625#define CALIBRATE_TIME (5 * 1000020/HZ)27262828-unsigned long __init calibrate_tsc(void)2727+unsigned long calibrate_tsc(void)2928{3029 mach_prepare_counter();3130···140139#endif141140142141/* calculate cpu_khz */143143-void __init init_cpu_khz(void)142142+void init_cpu_khz(void)144143{145144 if (cpu_has_tsc) {146145 unsigned long tsc_quotient = calibrate_tsc();···159158 }160159 }161160}161161+
···24272427{24282428 struct epoll_event *events64 = NULL;24292429 mm_segment_t old_fs = get_fs();24302430- int error, numevents, size;24302430+ int numevents, size;24312431 int evt_idx;24322432 int do_free_pages = 0;24332433
+2-2
arch/ia64/kernel/entry.S
···11821182 ;;11831183(pNonSys) mov out2=0 // out2==0 => not a syscall11841184 .fframe 1611851185- .spillpsp ar.unat, 16 // (note that offset is relative to psp+0x10!)11851185+ .spillsp ar.unat, 1611861186 st8 [sp]=r9,-16 // allocate space for ar.unat and save it11871187 st8 [out1]=loc1,-8 // save ar.pfs, out1=&sigscratch11881188 .body···12081208 adds out2=8,sp // out2=&sigscratch->ar_pfs12091209 ;;12101210 .fframe 1612111211- .spillpsp ar.unat, 16 // (note that offset is relative to psp+0x10!)12111211+ .spillsp ar.unat, 1612121212 st8 [sp]=r9,-16 // allocate space for ar.unat and save it12131213 st8 [out2]=loc1,-8 // save ar.pfs, out2=&sigscratch12141214 .body
+4-4
arch/ia64/kernel/mca.c
···11031103 return IRQ_HANDLED;11041104}1105110511061106-#endif /* CONFIG_ACPI */11071107-11081106/*11091107 * ia64_mca_cpe_poll11101108 *···11191121 /* Trigger a CPE interrupt cascade */11201122 platform_send_ipi(first_cpu(cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);11211123}11241124+11251125+#endif /* CONFIG_ACPI */1122112611231127/*11241128 * C portion of the OS INIT handler···13901390 register_percpu_irq(IA64_MCA_WAKEUP_VECTOR, &mca_wkup_irqaction);1391139113921392#ifdef CONFIG_ACPI13931393- /* Setup the CPEI/P vector and handler */13941394- cpe_vector = acpi_request_vector(ACPI_INTERRUPT_CPEI);13931393+ /* Setup the CPEI/P handler */13951394 register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction);13961395#endif13971396···1435143614361437#ifdef CONFIG_ACPI14371438 /* Setup the CPEI/P vector and handler */14391439+ cpe_vector = acpi_request_vector(ACPI_INTERRUPT_CPEI);14381440 init_timer(&cpe_poll_timer);14391441 cpe_poll_timer.function = ia64_mca_cpe_poll;14401442
+1-2
arch/ia64/kernel/minstate.h
···4141(pKStk) addl r3=THIS_CPU(ia64_mca_data),r3;; \4242(pKStk) ld8 r3 = [r3];; \4343(pKStk) addl r3=IA64_MCA_CPU_INIT_STACK_OFFSET,r3;; \4444-(pKStk) addl sp=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r3; \4444+(pKStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r3; \4545(pUStk) mov ar.rsc=0; /* set enforced lazy mode, pl 0, little-endian, loadrs=0 */ \4646(pUStk) addl r22=IA64_RBS_OFFSET,r1; /* compute base of register backing store */ \4747 ;; \···5050(pUStk) mov r23=ar.bspstore; /* save ar.bspstore */ \5151(pUStk) dep r22=-1,r22,61,3; /* compute kernel virtual addr of RBS */ \5252 ;; \5353-(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1; /* if in kernel mode, use sp (r12) */ \5453(pUStk) mov ar.bspstore=r22; /* switch to kernel RBS */ \5554 ;; \5655(pUStk) mov r18=ar.bsp; \
+160-15
arch/ia64/kernel/perfmon.c
···1111 * Version Perfmon-2.x is a rewrite of perfmon-1.x1212 * by Stephane Eranian, Hewlett Packard Co.1313 *1414- * Copyright (C) 1999-2003, 2005 Hewlett Packard Co1414+ * Copyright (C) 1999-2005 Hewlett Packard Co1515 * Stephane Eranian <eranian@hpl.hp.com>1616 * David Mosberger-Tang <davidm@hpl.hp.com>1717 *···497497static pfm_stats_t pfm_stats[NR_CPUS];498498static pfm_session_t pfm_sessions; /* global sessions information */499499500500+static spinlock_t pfm_alt_install_check = SPIN_LOCK_UNLOCKED;501501+static pfm_intr_handler_desc_t *pfm_alt_intr_handler;502502+500503static struct proc_dir_entry *perfmon_dir;501504static pfm_uuid_t pfm_null_uuid = {0,};502505···609606DEFINE_PER_CPU(struct task_struct *, pmu_owner);610607DEFINE_PER_CPU(pfm_context_t *, pmu_ctx);611608DEFINE_PER_CPU(unsigned long, pmu_activation_number);609609+EXPORT_PER_CPU_SYMBOL_GPL(pfm_syst_info);612610613611614612/* forward declaration */···13291325error_conflict:13301326 DPRINT(("system wide not possible, conflicting session [%d] on CPU%d\n",13311327 pfm_sessions.pfs_sys_session[cpu]->pid,13321332- smp_processor_id()));13281328+ cpu));13331329abort:13341330 UNLOCK_PFS(flags);13351331···55595555 int ret;5560555655615557 this_cpu = get_cpu();55625562- min = pfm_stats[this_cpu].pfm_ovfl_intr_cycles_min;55635563- max = pfm_stats[this_cpu].pfm_ovfl_intr_cycles_max;55585558+ if (likely(!pfm_alt_intr_handler)) {55595559+ min = pfm_stats[this_cpu].pfm_ovfl_intr_cycles_min;55605560+ max = pfm_stats[this_cpu].pfm_ovfl_intr_cycles_max;5564556155655565- start_cycles = ia64_get_itc();55625562+ start_cycles = ia64_get_itc();5566556355675567- ret = pfm_do_interrupt_handler(irq, arg, regs);55645564+ ret = pfm_do_interrupt_handler(irq, arg, regs);5568556555695569- total_cycles = ia64_get_itc();55665566+ total_cycles = ia64_get_itc();5570556755715571- /*55725572- * don't measure spurious interrupts55735573- */55745574- if (likely(ret == 0)) {55755575- total_cycles -= start_cycles;55685568+ /*55695569+ * don't measure spurious interrupts55705570+ */55715571+ if (likely(ret == 0)) {55725572+ total_cycles -= start_cycles;5576557355775577- if (total_cycles < min) pfm_stats[this_cpu].pfm_ovfl_intr_cycles_min = total_cycles;55785578- if (total_cycles > max) pfm_stats[this_cpu].pfm_ovfl_intr_cycles_max = total_cycles;55745574+ if (total_cycles < min) pfm_stats[this_cpu].pfm_ovfl_intr_cycles_min = total_cycles;55755575+ if (total_cycles > max) pfm_stats[this_cpu].pfm_ovfl_intr_cycles_max = total_cycles;5579557655805580- pfm_stats[this_cpu].pfm_ovfl_intr_cycles += total_cycles;55775577+ pfm_stats[this_cpu].pfm_ovfl_intr_cycles += total_cycles;55785578+ }55815579 }55805580+ else {55815581+ (*pfm_alt_intr_handler->handler)(irq, arg, regs);55825582+ }55835583+55825584 put_cpu_no_resched();55835585 return IRQ_HANDLED;55845586}···64346424 .flags = SA_INTERRUPT,64356425 .name = "perfmon"64366426};64276427+64286428+static void64296429+pfm_alt_save_pmu_state(void *data)64306430+{64316431+ struct pt_regs *regs;64326432+64336433+ regs = ia64_task_regs(current);64346434+64356435+ DPRINT(("called\n"));64366436+64376437+ /*64386438+ * should not be necessary but64396439+ * let's take not risk64406440+ */64416441+ pfm_clear_psr_up();64426442+ pfm_clear_psr_pp();64436443+ ia64_psr(regs)->pp = 0;64446444+64456445+ /*64466446+ * This call is required64476447+ * May cause a spurious interrupt on some processors64486448+ */64496449+ pfm_freeze_pmu();64506450+64516451+ ia64_srlz_d();64526452+}64536453+64546454+void64556455+pfm_alt_restore_pmu_state(void *data)64566456+{64576457+ struct pt_regs *regs;64586458+64596459+ regs = ia64_task_regs(current);64606460+64616461+ DPRINT(("called\n"));64626462+64636463+ /*64646464+ * put PMU back in state expected64656465+ * by perfmon64666466+ */64676467+ pfm_clear_psr_up();64686468+ pfm_clear_psr_pp();64696469+ ia64_psr(regs)->pp = 0;64706470+64716471+ /*64726472+ * perfmon runs with PMU unfrozen at all times64736473+ */64746474+ pfm_unfreeze_pmu();64756475+64766476+ ia64_srlz_d();64776477+}64786478+64796479+int64806480+pfm_install_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)64816481+{64826482+ int ret, i;64836483+ int reserve_cpu;64846484+64856485+ /* some sanity checks */64866486+ if (hdl == NULL || hdl->handler == NULL) return -EINVAL;64876487+64886488+ /* do the easy test first */64896489+ if (pfm_alt_intr_handler) return -EBUSY;64906490+64916491+ /* one at a time in the install or remove, just fail the others */64926492+ if (!spin_trylock(&pfm_alt_install_check)) {64936493+ return -EBUSY;64946494+ }64956495+64966496+ /* reserve our session */64976497+ for_each_online_cpu(reserve_cpu) {64986498+ ret = pfm_reserve_session(NULL, 1, reserve_cpu);64996499+ if (ret) goto cleanup_reserve;65006500+ }65016501+65026502+ /* save the current system wide pmu states */65036503+ ret = on_each_cpu(pfm_alt_save_pmu_state, NULL, 0, 1);65046504+ if (ret) {65056505+ DPRINT(("on_each_cpu() failed: %d\n", ret));65066506+ goto cleanup_reserve;65076507+ }65086508+65096509+ /* officially change to the alternate interrupt handler */65106510+ pfm_alt_intr_handler = hdl;65116511+65126512+ spin_unlock(&pfm_alt_install_check);65136513+65146514+ return 0;65156515+65166516+cleanup_reserve:65176517+ for_each_online_cpu(i) {65186518+ /* don't unreserve more than we reserved */65196519+ if (i >= reserve_cpu) break;65206520+65216521+ pfm_unreserve_session(NULL, 1, i);65226522+ }65236523+65246524+ spin_unlock(&pfm_alt_install_check);65256525+65266526+ return ret;65276527+}65286528+EXPORT_SYMBOL_GPL(pfm_install_alt_pmu_interrupt);65296529+65306530+int65316531+pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)65326532+{65336533+ int i;65346534+ int ret;65356535+65366536+ if (hdl == NULL) return -EINVAL;65376537+65386538+ /* cannot remove someone else's handler! */65396539+ if (pfm_alt_intr_handler != hdl) return -EINVAL;65406540+65416541+ /* one at a time in the install or remove, just fail the others */65426542+ if (!spin_trylock(&pfm_alt_install_check)) {65436543+ return -EBUSY;65446544+ }65456545+65466546+ pfm_alt_intr_handler = NULL;65476547+65486548+ ret = on_each_cpu(pfm_alt_restore_pmu_state, NULL, 0, 1);65496549+ if (ret) {65506550+ DPRINT(("on_each_cpu() failed: %d\n", ret));65516551+ }65526552+65536553+ for_each_online_cpu(i) {65546554+ pfm_unreserve_session(NULL, 1, i);65556555+ }65566556+65576557+ spin_unlock(&pfm_alt_install_check);65586558+65596559+ return 0;65606560+}65616561+EXPORT_SYMBOL_GPL(pfm_remove_alt_pmu_interrupt);6437656264386563/*64396564 * perfmon initialization routine, called from the initcall() table
+17-3
arch/ia64/kernel/ptrace.c
···692692 unsigned long cfm)693693{694694 struct unw_frame_info info, prev_info;695695- unsigned long ip, pr;695695+ unsigned long ip, sp, pr;696696697697 unw_init_from_blocked_task(&info, child);698698 while (1) {699699 prev_info = info;700700 if (unw_unwind(&info) < 0)701701 return;702702- if (unw_get_rp(&info, &ip) < 0)702702+703703+ unw_get_sp(&info, &sp);704704+ if ((long)((unsigned long)child + IA64_STK_OFFSET - sp)705705+ < IA64_PT_REGS_SIZE) {706706+ dprintk("ptrace.%s: ran off the top of the kernel "707707+ "stack\n", __FUNCTION__);703708 return;704704- if (ip < FIXADDR_USER_END)709709+ }710710+ if (unw_get_pr (&prev_info, &pr) < 0) {711711+ unw_get_rp(&prev_info, &ip);712712+ dprintk("ptrace.%s: failed to read "713713+ "predicate register (ip=0x%lx)\n",714714+ __FUNCTION__, ip);715715+ return;716716+ }717717+ if (unw_is_intr_frame(&info)718718+ && (pr & (1UL << PRED_USER_STACK)))705719 break;706720 }707721
···182182 }183183 }184184185185- /*186186- * A zero mmap always succeeds in Linux, independent of whether or not the187187- * remaining arguments are valid.188188- */189189- if (len == 0)190190- goto out;191191-192185 /* Careful about overflows.. */193186 len = PAGE_ALIGN(len);194187 if (!len || len > TASK_SIZE) {
+2
arch/ia64/sn/kernel/setup.c
···271271 int major = sn_sal_rev_major(), minor = sn_sal_rev_minor();272272 extern void sn_cpu_init(void);273273274274+ ia64_sn_plat_set_error_handling_features();275275+274276 /*275277 * If the generic code has enabled vga console support - lets276278 * get rid of it again. This is a kludge for the fact that ACPI
···11#22# Automatically generated make config: don't edit33-# Linux kernel version: 2.6.11-rc144-# Thu Jan 20 01:25:35 200533+# Linux kernel version: 2.6.12-rc444+# Tue May 17 11:56:01 200555#66CONFIG_MMU=y77CONFIG_GENERIC_HARDIRQS=y···1111CONFIG_PPC=y1212CONFIG_PPC32=y1313CONFIG_GENERIC_NVRAM=y1414+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y14151516#1617# Code maturity level options···1918CONFIG_EXPERIMENTAL=y2019CONFIG_CLEAN_COMPILE=y2120CONFIG_BROKEN_ON_SMP=y2121+CONFIG_INIT_ENV_ARG_LIMIT=3222222323#2424# General setup···3129# CONFIG_BSD_PROCESS_ACCT is not set3230CONFIG_SYSCTL=y3331# CONFIG_AUDIT is not set3434-CONFIG_LOG_BUF_SHIFT=143532# CONFIG_HOTPLUG is not set3633CONFIG_KOBJECT_UEVENT=y3734# CONFIG_IKCONFIG is not set3835CONFIG_EMBEDDED=y3936# CONFIG_KALLSYMS is not set3737+CONFIG_PRINTK=y3838+CONFIG_BUG=y3939+CONFIG_BASE_FULL=y4040CONFIG_FUTEX=y4141# CONFIG_EPOLL is not set4242# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set···4844CONFIG_CC_ALIGN_LOOPS=04945CONFIG_CC_ALIGN_JUMPS=05046# CONFIG_TINY_SHMEM is not set4747+CONFIG_BASE_SMALL=051485249#5350# Loadable module support···6762CONFIG_E500=y6863CONFIG_BOOKE=y6964CONFIG_FSL_BOOKE=y6565+# CONFIG_PHYS_64BIT is not set7066CONFIG_SPE=y7167CONFIG_MATH_EMULATION=y7268# CONFIG_CPU_FREQ is not set7369CONFIG_PPC_GEN550=y7070+# CONFIG_PM is not set7471CONFIG_85xx=y7572CONFIG_PPC_INDIRECT_PCI_BE=y7673···8376CONFIG_MPC8555_CDS=y8477# CONFIG_MPC8560_ADS is not set8578# CONFIG_SBC8560 is not set7979+# CONFIG_STX_GP3 is not set8680CONFIG_MPC8555=y8781CONFIG_85xx_PCI2=y8882···9890CONFIG_BINFMT_ELF=y9991# CONFIG_BINFMT_MISC is not set10092# CONFIG_CMDLINE_BOOL is not set9393+CONFIG_ISA_DMA_API=y1019410295#10396# Bus options···112103# PCCARD (PCMCIA/CardBus) support113104#114105# CONFIG_PCCARD is not set115115-116116-#117117-# PC-card bridges118118-#119106120107#121108# Advanced setup···185180#186181# ATA/ATAPI/MFM/RLL support187182#188188-# CONFIG_IDE is not set183183+CONFIG_IDE=y184184+CONFIG_BLK_DEV_IDE=y185185+186186+#187187+# Please see Documentation/ide.txt for help/info on IDE drives188188+#189189+# CONFIG_BLK_DEV_IDE_SATA is not set190190+CONFIG_BLK_DEV_IDEDISK=y191191+# CONFIG_IDEDISK_MULTI_MODE is not set192192+# CONFIG_BLK_DEV_IDECD is not set193193+# CONFIG_BLK_DEV_IDETAPE is not set194194+# CONFIG_BLK_DEV_IDEFLOPPY is not set195195+# CONFIG_IDE_TASK_IOCTL is not set196196+197197+#198198+# IDE chipset support/bugfixes199199+#200200+CONFIG_IDE_GENERIC=y201201+CONFIG_BLK_DEV_IDEPCI=y202202+CONFIG_IDEPCI_SHARE_IRQ=y203203+# CONFIG_BLK_DEV_OFFBOARD is not set204204+CONFIG_BLK_DEV_GENERIC=y205205+# CONFIG_BLK_DEV_OPTI621 is not set206206+# CONFIG_BLK_DEV_SL82C105 is not set207207+CONFIG_BLK_DEV_IDEDMA_PCI=y208208+# CONFIG_BLK_DEV_IDEDMA_FORCED is not set209209+CONFIG_IDEDMA_PCI_AUTO=y210210+# CONFIG_IDEDMA_ONLYDISK is not set211211+# CONFIG_BLK_DEV_AEC62XX is not set212212+# CONFIG_BLK_DEV_ALI15X3 is not set213213+# CONFIG_BLK_DEV_AMD74XX is not set214214+# CONFIG_BLK_DEV_CMD64X is not set215215+# CONFIG_BLK_DEV_TRIFLEX is not set216216+# CONFIG_BLK_DEV_CY82C693 is not set217217+# CONFIG_BLK_DEV_CS5520 is not set218218+# CONFIG_BLK_DEV_CS5530 is not set219219+# CONFIG_BLK_DEV_HPT34X is not set220220+# CONFIG_BLK_DEV_HPT366 is not set221221+# CONFIG_BLK_DEV_SC1200 is not set222222+# CONFIG_BLK_DEV_PIIX is not set223223+# CONFIG_BLK_DEV_NS87415 is not set224224+# CONFIG_BLK_DEV_PDC202XX_OLD is not set225225+# CONFIG_BLK_DEV_PDC202XX_NEW is not set226226+# CONFIG_BLK_DEV_SVWKS is not set227227+# CONFIG_BLK_DEV_SIIMAGE is not set228228+# CONFIG_BLK_DEV_SLC90E66 is not set229229+# CONFIG_BLK_DEV_TRM290 is not set230230+CONFIG_BLK_DEV_VIA82CXXX=y231231+# CONFIG_IDE_ARM is not set232232+CONFIG_BLK_DEV_IDEDMA=y233233+# CONFIG_IDEDMA_IVB is not set234234+CONFIG_IDEDMA_AUTO=y235235+# CONFIG_BLK_DEV_HD is not set189236190237#191238# SCSI device support···277220#278221CONFIG_PACKET=y279222# CONFIG_PACKET_MMAP is not set280280-# CONFIG_NETLINK_DEV is not set281223CONFIG_UNIX=y282224# CONFIG_NET_KEY is not set283225CONFIG_INET=y···426370# CONFIG_INPUT_EVBUG is not set427371428372#429429-# Input I/O drivers430430-#431431-# CONFIG_GAMEPORT is not set432432-CONFIG_SOUND_GAMEPORT=y433433-# CONFIG_SERIO is not set434434-# CONFIG_SERIO_I8042 is not set435435-436436-#437373# Input Device Drivers438374#439375# CONFIG_INPUT_KEYBOARD is not set···433385# CONFIG_INPUT_JOYSTICK is not set434386# CONFIG_INPUT_TOUCHSCREEN is not set435387# CONFIG_INPUT_MISC is not set388388+389389+#390390+# Hardware I/O ports391391+#392392+# CONFIG_SERIO is not set393393+# CONFIG_GAMEPORT is not set394394+CONFIG_SOUND_GAMEPORT=y436395437396#438397# Character devices···461406CONFIG_SERIAL_CORE=y462407CONFIG_SERIAL_CORE_CONSOLE=y463408# CONFIG_SERIAL_CPM is not set409409+# CONFIG_SERIAL_JSM is not set464410CONFIG_UNIX98_PTYS=y465411CONFIG_LEGACY_PTYS=y466412CONFIG_LEGACY_PTY_COUNT=256···490434# CONFIG_RAW_DRIVER is not set491435492436#437437+# TPM devices438438+#439439+# CONFIG_TCG_TPM is not set440440+441441+#493442# I2C support494443#495444CONFIG_I2C=y···517456# CONFIG_I2C_AMD8111 is not set518457# CONFIG_I2C_I801 is not set519458# CONFIG_I2C_I810 is not set459459+# CONFIG_I2C_PIIX4 is not set520460# CONFIG_I2C_ISA is not set521461CONFIG_I2C_MPC=y522462# CONFIG_I2C_NFORCE2 is not set523463# CONFIG_I2C_PARPORT_LIGHT is not set524524-# CONFIG_I2C_PIIX4 is not set525464# CONFIG_I2C_PROSAVAGE is not set526465# CONFIG_I2C_SAVAGE4 is not set527466# CONFIG_SCx200_ACB is not set···544483# CONFIG_SENSORS_ASB100 is not set545484# CONFIG_SENSORS_DS1621 is not set546485# CONFIG_SENSORS_FSCHER is not set486486+# CONFIG_SENSORS_FSCPOS is not set547487# CONFIG_SENSORS_GL518SM is not set488488+# CONFIG_SENSORS_GL520SM is not set548489# CONFIG_SENSORS_IT87 is not set549490# CONFIG_SENSORS_LM63 is not set550491# CONFIG_SENSORS_LM75 is not set···557494# CONFIG_SENSORS_LM85 is not set558495# CONFIG_SENSORS_LM87 is not set559496# CONFIG_SENSORS_LM90 is not set497497+# CONFIG_SENSORS_LM92 is not set560498# CONFIG_SENSORS_MAX1619 is not set561499# CONFIG_SENSORS_PC87360 is not set562500# CONFIG_SENSORS_SMSC47B397 is not set501501+# CONFIG_SENSORS_SIS5595 is not set563502# CONFIG_SENSORS_SMSC47M1 is not set564503# CONFIG_SENSORS_VIA686A is not set565504# CONFIG_SENSORS_W83781D is not set···571506#572507# Other I2C Chip support573508#509509+# CONFIG_SENSORS_DS1337 is not set574510# CONFIG_SENSORS_EEPROM is not set575511# CONFIG_SENSORS_PCF8574 is not set576512# CONFIG_SENSORS_PCF8591 is not set577513# CONFIG_SENSORS_RTC8564 is not set514514+# CONFIG_SENSORS_M41T00 is not set578515# CONFIG_I2C_DEBUG_CORE is not set579516# CONFIG_I2C_DEBUG_ALGO is not set580517# CONFIG_I2C_DEBUG_BUS is not set···605538# Graphics support606539#607540# CONFIG_FB is not set608608-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set609541610542#611543# Sound···614548#615549# USB support616550#617617-# CONFIG_USB is not set618551CONFIG_USB_ARCH_HAS_HCD=y619552CONFIG_USB_ARCH_HAS_OHCI=y620620-621621-#622622-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information623623-#553553+# CONFIG_USB is not set624554625555#626556# USB Gadget Support···647585CONFIG_FS_MBCACHE=y648586# CONFIG_REISERFS_FS is not set649587# CONFIG_JFS_FS is not set588588+589589+#590590+# XFS support591591+#650592# CONFIG_XFS_FS is not set651593# CONFIG_MINIX_FS is not set652594# CONFIG_ROMFS_FS is not set···712646# CONFIG_NFSD is not set713647CONFIG_ROOT_NFS=y714648CONFIG_LOCKD=y715715-# CONFIG_EXPORTFS is not set716649CONFIG_SUNRPC=y717650# CONFIG_RPCSEC_GSS_KRB5 is not set718651# CONFIG_RPCSEC_GSS_SPKM3 is not set···763698#764699# Kernel hacking765700#701701+# CONFIG_PRINTK_TIME is not set766702# CONFIG_DEBUG_KERNEL is not set703703+CONFIG_LOG_BUF_SHIFT=14767704# CONFIG_KGDB_CONSOLE is not set768705# CONFIG_SERIAL_TEXT_DEBUG is not set769706
+14-1
arch/ppc/kernel/head_fsl_booke.S
···232232 tlbwe233233234234/* 7. Jump to KERNELBASE mapping */235235- li r7,0235235+ lis r7,MSR_KERNEL@h236236+ ori r7,r7,MSR_KERNEL@l236237 bl 1f /* Find our address */2372381: mflr r9238239 rlwimi r6,r9,0,20,31···292291 mfspr r2,SPRN_HID0293292 oris r2,r2,HID0_DOZE@h294293 mtspr SPRN_HID0, r2294294+#endif295295+296296+#if !defined(CONFIG_BDI_SWITCH)297297+ /*298298+ * The Abatron BDI JTAG debugger does not tolerate others299299+ * mucking with the debug registers.300300+ */301301+ lis r2,DBCR0_IDM@h302302+ mtspr SPRN_DBCR0,r2303303+ /* clear any residual debug events */304304+ li r2,-1305305+ mtspr SPRN_DBSR,r2295306#endif296307297308 /*
+1-6
arch/ppc/kernel/traps.c
···408408409409 /* Early out if we are an invalid form of lswx */410410 if ((instword & INST_STRING_MASK) == INST_LSWX)411411- if ((rA >= rT) || (NB_RB >= rT) || (rT == rA) || (rT == NB_RB))412412- return -EINVAL;413413-414414- /* Early out if we are an invalid form of lswi */415415- if ((instword & INST_STRING_MASK) == INST_LSWI)416416- if ((rA >= rT) || (rT == rA))411411+ if ((rT == rA) || (rT == NB_RB))417412 return -EINVAL;418413419414 EA = (rA == 0) ? 0 : regs->gpr[rA];
-1
arch/ppc/platforms/83xx/mpc834x_sys.c
···127127{128128 /* we steal the lowest ioremap addr for virt space */129129 io_block_mapping(VIRT_IMMRBAR, immrbar, 1024*1024, _PAGE_IO);130130- io_block_mapping(BCSR_VIRT_ADDR, BCSR_PHYS_ADDR, BCSR_SIZE, _PAGE_IO);131130}132131133132int
···11-/*22- * (C) Copyright 200333- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.44- *55- * (C) Copyright 2004 Red Hat, Inc.66- *77- * See file CREDITS for list of people who contributed to this88- * project.99- *1010- * This program is free software; you can redistribute it and/or1111- * modify it under the terms of the GNU General Public License as1212- * published by the Free Software Foundation; either version 2 of1313- * the License, or (at your option) any later version.1414- *1515- * This program is distributed in the hope that it will be useful,1616- * but WITHOUT ANY WARRANTY; without even the implied warranty of1717- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1818- * GNU General Public License for more details.1919- *2020- * You should have received a copy of the GNU General Public License2121- * along with this program; if not, write to the Free Software2222- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,2323- * MA 02111-1307 USA2424- */2525-2626-#include <linux/kernel.h>2727-#include <linux/init.h>2828-#include <linux/pci.h>2929-#include <linux/slab.h>3030-#include <linux/delay.h>3131-3232-#include <asm/byteorder.h>3333-#include <asm/io.h>3434-#include <asm/irq.h>3535-#include <asm/uaccess.h>3636-#include <asm/machdep.h>3737-#include <asm/pci-bridge.h>3838-#include <asm/immap_cpm2.h>3939-#include <asm/mpc8260.h>4040-4141-#include "m8260_pci.h"4242-4343-4444-/* PCI bus configuration registers.4545- */4646-4747-static void __init m8260_setup_pci(struct pci_controller *hose)4848-{4949- volatile cpm2_map_t *immap = cpm2_immr;5050- unsigned long pocmr;5151- u16 tempShort;5252-5353-#ifndef CONFIG_ATC /* already done in U-Boot */5454- /* 5555- * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]), 5656- * and local bus for PCI (SIUMCR [LBPC]).5757- */5858- immap->im_siu_conf.siu_82xx.sc_siumcr = 0x00640000;5959-#endif6060-6161- /* Make PCI lowest priority */6262- /* Each 4 bits is a device bus request and the MS 4bits 6363- is highest priority */6464- /* Bus 4bit value 6565- --- ----------6666- CPM high 0b00006767- CPM middle 0b00016868- CPM low 0b00106969- PCI reguest 0b00117070- Reserved 0b01007171- Reserved 0b01017272- Internal Core 0b01107373- External Master 1 0b01117474- External Master 2 0b10007575- External Master 3 0b10017676- The rest are reserved */7777- immap->im_siu_conf.siu_82xx.sc_ppc_alrh = 0x61207893;7878-7979- /* Park bus on core while modifying PCI Bus accesses */8080- immap->im_siu_conf.siu_82xx.sc_ppc_acr = 0x6;8181-8282- /* 8383- * Set up master window that allows the CPU to access PCI space. This 8484- * window is set up using the first SIU PCIBR registers.8585- */8686- immap->im_memctl.memc_pcimsk0 = MPC826x_PCI_MASK;8787- immap->im_memctl.memc_pcibr0 = MPC826x_PCI_BASE | PCIBR_ENABLE;8888-8989- /* Disable machine check on no response or target abort */9090- immap->im_pci.pci_emr = cpu_to_le32(0x1fe7);9191- /* Release PCI RST (by default the PCI RST signal is held low) */9292- immap->im_pci.pci_gcr = cpu_to_le32(PCIGCR_PCI_BUS_EN);9393-9494- /* give it some time */9595- mdelay(1);9696-9797- /* 9898- * Set up master window that allows the CPU to access PCI Memory (prefetch) 9999- * space. This window is set up using the first set of Outbound ATU registers.100100- */101101- immap->im_pci.pci_potar0 = cpu_to_le32(MPC826x_PCI_LOWER_MEM >> 12);102102- immap->im_pci.pci_pobar0 = cpu_to_le32((MPC826x_PCI_LOWER_MEM - MPC826x_PCI_MEM_OFFSET) >> 12);103103- pocmr = ((MPC826x_PCI_UPPER_MEM - MPC826x_PCI_LOWER_MEM) >> 12) ^ 0xfffff;104104- immap->im_pci.pci_pocmr0 = cpu_to_le32(pocmr | POCMR_ENABLE | POCMR_PREFETCH_EN);105105-106106- /* 107107- * Set up master window that allows the CPU to access PCI Memory (non-prefetch) 108108- * space. This window is set up using the second set of Outbound ATU registers.109109- */110110- immap->im_pci.pci_potar1 = cpu_to_le32(MPC826x_PCI_LOWER_MMIO >> 12);111111- immap->im_pci.pci_pobar1 = cpu_to_le32((MPC826x_PCI_LOWER_MMIO - MPC826x_PCI_MMIO_OFFSET) >> 12);112112- pocmr = ((MPC826x_PCI_UPPER_MMIO - MPC826x_PCI_LOWER_MMIO) >> 12) ^ 0xfffff;113113- immap->im_pci.pci_pocmr1 = cpu_to_le32(pocmr | POCMR_ENABLE);114114-115115- /* 116116- * Set up master window that allows the CPU to access PCI IO space. This window117117- * is set up using the third set of Outbound ATU registers.118118- */119119- immap->im_pci.pci_potar2 = cpu_to_le32(MPC826x_PCI_IO_BASE >> 12);120120- immap->im_pci.pci_pobar2 = cpu_to_le32(MPC826x_PCI_LOWER_IO >> 12);121121- pocmr = ((MPC826x_PCI_UPPER_IO - MPC826x_PCI_LOWER_IO) >> 12) ^ 0xfffff;122122- immap->im_pci.pci_pocmr2 = cpu_to_le32(pocmr | POCMR_ENABLE | POCMR_PCI_IO);123123-124124- /* 125125- * Set up slave window that allows PCI masters to access MPC826x local memory. 126126- * This window is set up using the first set of Inbound ATU registers127127- */128128-129129- immap->im_pci.pci_pitar0 = cpu_to_le32(MPC826x_PCI_SLAVE_MEM_LOCAL >> 12);130130- immap->im_pci.pci_pibar0 = cpu_to_le32(MPC826x_PCI_SLAVE_MEM_BUS >> 12);131131- pocmr = ((MPC826x_PCI_SLAVE_MEM_SIZE-1) >> 12) ^ 0xfffff;132132- immap->im_pci.pci_picmr0 = cpu_to_le32(pocmr | PICMR_ENABLE | PICMR_PREFETCH_EN);133133-134134- /* See above for description - puts PCI request as highest priority */135135- immap->im_siu_conf.siu_82xx.sc_ppc_alrh = 0x03124567;136136-137137- /* Park the bus on the PCI */138138- immap->im_siu_conf.siu_82xx.sc_ppc_acr = PPC_ACR_BUS_PARK_PCI;139139-140140- /* Host mode - specify the bridge as a host-PCI bridge */141141- early_write_config_word(hose, 0, 0, PCI_CLASS_DEVICE, PCI_CLASS_BRIDGE_HOST);142142-143143- /* Enable the host bridge to be a master on the PCI bus, and to act as a PCI memory target */144144- early_read_config_word(hose, 0, 0, PCI_COMMAND, &tempShort);145145- early_write_config_word(hose, 0, 0, PCI_COMMAND,146146- tempShort | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);147147-}148148-149149-void __init m8260_find_bridges(void)150150-{151151- extern int pci_assign_all_busses;152152- struct pci_controller * hose;153153-154154- pci_assign_all_busses = 1;155155-156156- hose = pcibios_alloc_controller();157157-158158- if (!hose)159159- return;160160-161161- ppc_md.pci_swizzle = common_swizzle;162162-163163- hose->first_busno = 0;164164- hose->bus_offset = 0;165165- hose->last_busno = 0xff;166166-167167- setup_m8260_indirect_pci(hose, 168168- (unsigned long)&cpm2_immr->im_pci.pci_cfg_addr,169169- (unsigned long)&cpm2_immr->im_pci.pci_cfg_data);170170-171171- m8260_setup_pci(hose);172172- hose->pci_mem_offset = MPC826x_PCI_MEM_OFFSET;173173-174174- hose->io_base_virt = ioremap(MPC826x_PCI_IO_BASE,175175- MPC826x_PCI_IO_SIZE);176176- isa_io_base = (unsigned long) hose->io_base_virt;177177-178178- /* setup resources */179179- pci_init_resource(&hose->mem_resources[0],180180- MPC826x_PCI_LOWER_MEM,181181- MPC826x_PCI_UPPER_MEM,182182- IORESOURCE_MEM|IORESOURCE_PREFETCH, "PCI prefetchable memory");183183-184184- pci_init_resource(&hose->mem_resources[1],185185- MPC826x_PCI_LOWER_MMIO,186186- MPC826x_PCI_UPPER_MMIO,187187- IORESOURCE_MEM, "PCI memory");188188-189189- pci_init_resource(&hose->io_resource,190190- MPC826x_PCI_LOWER_IO,191191- MPC826x_PCI_UPPER_IO,192192- IORESOURCE_IO, "PCI I/O");193193-}
-76
arch/ppc/syslib/m8260_pci.h
···11-22-#ifndef _PPC_KERNEL_M8260_PCI_H33-#define _PPC_KERNEL_M8260_PCI_H44-55-#include <asm/m8260_pci.h>66-77-/*88- * Local->PCI map (from CPU) controlled by99- * MPC826x master window1010- *1111- * 0x80000000 - 0xBFFFFFFF Total CPU2PCI space PCIBR01212- * 1313- * 0x80000000 - 0x9FFFFFFF PCI Mem with prefetch (Outbound ATU #1)1414- * 0xA0000000 - 0xAFFFFFFF PCI Mem w/o prefetch (Outbound ATU #2)1515- * 0xB0000000 - 0xB0FFFFFF 32-bit PCI IO (Outbound ATU #3)1616- * 1717- * PCI->Local map (from PCI)1818- * MPC826x slave window controlled by1919- *2020- * 0x00000000 - 0x07FFFFFF MPC826x local memory (Inbound ATU #1)2121- */2222-2323-/* 2424- * Slave window that allows PCI masters to access MPC826x local memory. 2525- * This window is set up using the first set of Inbound ATU registers2626- */2727-2828-#ifndef MPC826x_PCI_SLAVE_MEM_LOCAL2929-#define MPC826x_PCI_SLAVE_MEM_LOCAL (((struct bd_info *)__res)->bi_memstart)3030-#define MPC826x_PCI_SLAVE_MEM_BUS (((struct bd_info *)__res)->bi_memstart)3131-#define MPC826x_PCI_SLAVE_MEM_SIZE (((struct bd_info *)__res)->bi_memsize)3232-#endif3333-3434-/* 3535- * This is the window that allows the CPU to access PCI address space.3636- * It will be setup with the SIU PCIBR0 register. All three PCI master3737- * windows, which allow the CPU to access PCI prefetch, non prefetch,3838- * and IO space (see below), must all fit within this window. 3939- */4040-#ifndef MPC826x_PCI_BASE4141-#define MPC826x_PCI_BASE 0x800000004242-#define MPC826x_PCI_MASK 0xc00000004343-#endif4444-4545-#ifndef MPC826x_PCI_LOWER_MEM4646-#define MPC826x_PCI_LOWER_MEM 0x800000004747-#define MPC826x_PCI_UPPER_MEM 0x9fffffff4848-#define MPC826x_PCI_MEM_OFFSET 0x000000004949-#endif5050-5151-#ifndef MPC826x_PCI_LOWER_MMIO5252-#define MPC826x_PCI_LOWER_MMIO 0xa00000005353-#define MPC826x_PCI_UPPER_MMIO 0xafffffff5454-#define MPC826x_PCI_MMIO_OFFSET 0x000000005555-#endif5656-5757-#ifndef MPC826x_PCI_LOWER_IO5858-#define MPC826x_PCI_LOWER_IO 0x000000005959-#define MPC826x_PCI_UPPER_IO 0x00ffffff6060-#define MPC826x_PCI_IO_BASE 0xb00000006161-#define MPC826x_PCI_IO_SIZE 0x010000006262-#endif6363-6464-#ifndef _IO_BASE6565-#define _IO_BASE isa_io_base6666-#endif6767-6868-#ifdef CONFIG_8260_PCI96969-struct pci_controller;7070-extern void setup_m8260_indirect_pci(struct pci_controller* hose,7171- u32 cfg_addr, u32 cfg_data);7272-#else7373-#define setup_m8260_indirect_pci setup_indirect_pci7474-#endif7575-7676-#endif /* _PPC_KERNEL_M8260_PCI_H */
+5-5
arch/ppc/syslib/m8260_pci_erratum9.c
···3131#include <asm/immap_cpm2.h>3232#include <asm/cpm2.h>33333434-#include "m8260_pci.h"3434+#include "m82xx_pci.h"35353636#ifdef CONFIG_8260_PCI93737/*#include <asm/mpc8260_pci9.h>*/ /* included in asm/io.h */···248248249249static inline int is_pci_mem(unsigned long addr)250250{251251- if (addr >= MPC826x_PCI_LOWER_MMIO &&252252- addr <= MPC826x_PCI_UPPER_MMIO)251251+ if (addr >= M82xx_PCI_LOWER_MMIO &&252252+ addr <= M82xx_PCI_UPPER_MMIO)253253 return 1;254254- if (addr >= MPC826x_PCI_LOWER_MEM &&255255- addr <= MPC826x_PCI_UPPER_MEM)254254+ if (addr >= M82xx_PCI_LOWER_MEM &&255255+ addr <= M82xx_PCI_UPPER_MEM)256256 return 1;257257 return 0;258258}
+9-2
arch/ppc/syslib/m8260_setup.c
···3434unsigned char __res[sizeof(bd_t)];35353636extern void cpm2_reset(void);3737-extern void m8260_find_bridges(void);3737+extern void pq2_find_bridges(void);3838+extern void pq2pci_init_irq(void);3839extern void idma_pci9_init(void);39404041/* Place-holder for board-specific init */···5756 idma_pci9_init();5857#endif5958#ifdef CONFIG_PCI_82606060- m8260_find_bridges();5959+ pq2_find_bridges();6160#endif6261#ifdef CONFIG_BLK_DEV_INITRD6362 if (initrd_start)···174173 * in case the boot rom changed something on us.175174 */176175 cpm2_immr->im_intctl.ic_siprr = 0x05309770;176176+177177+#if defined(CONFIG_PCI) && (defined(CONFIG_ADS8272) || defined(CONFIG_PQ2FADS))178178+ /* Initialize stuff for the 82xx CPLD IC and install demux */179179+ pq2pci_init_irq();180180+#endif181181+177182}178183179184/*
+383
arch/ppc/syslib/m82xx_pci.c
···11+/*22+ *33+ * (C) Copyright 200344+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.55+ *66+ * (C) Copyright 2004 Red Hat, Inc.77+ *88+ * 2005 (c) MontaVista Software, Inc.99+ * Vitaly Bordug <vbordug@ru.mvista.com>1010+ *1111+ * See file CREDITS for list of people who contributed to this1212+ * project.1313+ *1414+ * This program is free software; you can redistribute it and/or1515+ * modify it under the terms of the GNU General Public License as1616+ * published by the Free Software Foundation; either version 2 of1717+ * the License, or (at your option) any later version.1818+ *1919+ * This program is distributed in the hope that it will be useful,2020+ * but WITHOUT ANY WARRANTY; without even the implied warranty of2121+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2222+ * GNU General Public License for more details.2323+ *2424+ * You should have received a copy of the GNU General Public License2525+ * along with this program; if not, write to the Free Software2626+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,2727+ * MA 02111-1307 USA2828+ */2929+3030+#include <linux/kernel.h>3131+#include <linux/init.h>3232+#include <linux/pci.h>3333+#include <linux/slab.h>3434+#include <linux/delay.h>3535+#include <linux/irq.h>3636+#include <linux/interrupt.h>3737+3838+#include <asm/byteorder.h>3939+#include <asm/io.h>4040+#include <asm/irq.h>4141+#include <asm/uaccess.h>4242+#include <asm/machdep.h>4343+#include <asm/pci-bridge.h>4444+#include <asm/immap_cpm2.h>4545+#include <asm/mpc8260.h>4646+#include <asm/cpm2.h>4747+4848+#include "m82xx_pci.h"4949+5050+/*5151+ * Interrupt routing5252+ */5353+5454+static inline int5555+pq2pci_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)5656+{5757+ static char pci_irq_table[][4] =5858+ /*5959+ * PCI IDSEL/INTPIN->INTLINE6060+ * A B C D6161+ */6262+ {6363+ { PIRQA, PIRQB, PIRQC, PIRQD }, /* IDSEL 22 - PCI slot 0 */6464+ { PIRQD, PIRQA, PIRQB, PIRQC }, /* IDSEL 23 - PCI slot 1 */6565+ { PIRQC, PIRQD, PIRQA, PIRQB }, /* IDSEL 24 - PCI slot 2 */6666+ };6767+6868+ const long min_idsel = 22, max_idsel = 24, irqs_per_slot = 4;6969+ return PCI_IRQ_TABLE_LOOKUP;7070+}7171+7272+static void7373+pq2pci_mask_irq(unsigned int irq)7474+{7575+ int bit = irq - NR_CPM_INTS;7676+7777+ *(volatile unsigned long *) PCI_INT_MASK_REG |= (1 << (31 - bit));7878+ return;7979+}8080+8181+static void8282+pq2pci_unmask_irq(unsigned int irq)8383+{8484+ int bit = irq - NR_CPM_INTS;8585+8686+ *(volatile unsigned long *) PCI_INT_MASK_REG &= ~(1 << (31 - bit));8787+ return;8888+}8989+9090+static void9191+pq2pci_mask_and_ack(unsigned int irq)9292+{9393+ int bit = irq - NR_CPM_INTS;9494+9595+ *(volatile unsigned long *) PCI_INT_MASK_REG |= (1 << (31 - bit));9696+ return;9797+}9898+9999+static void100100+pq2pci_end_irq(unsigned int irq)101101+{102102+ int bit = irq - NR_CPM_INTS;103103+104104+ *(volatile unsigned long *) PCI_INT_MASK_REG &= ~(1 << (31 - bit));105105+ return;106106+}107107+108108+struct hw_interrupt_type pq2pci_ic = {109109+ "PQ2 PCI",110110+ NULL,111111+ NULL,112112+ pq2pci_unmask_irq,113113+ pq2pci_mask_irq,114114+ pq2pci_mask_and_ack,115115+ pq2pci_end_irq,116116+ 0117117+};118118+119119+static irqreturn_t120120+pq2pci_irq_demux(int irq, void *dev_id, struct pt_regs *regs)121121+{122122+ unsigned long stat, mask, pend;123123+ int bit;124124+125125+ for(;;) {126126+ stat = *(volatile unsigned long *) PCI_INT_STAT_REG;127127+ mask = *(volatile unsigned long *) PCI_INT_MASK_REG;128128+ pend = stat & ~mask & 0xf0000000;129129+ if (!pend)130130+ break;131131+ for (bit = 0; pend != 0; ++bit, pend <<= 1) {132132+ if (pend & 0x80000000)133133+ __do_IRQ(NR_CPM_INTS + bit, regs);134134+ }135135+ }136136+137137+ return IRQ_HANDLED;138138+}139139+140140+static struct irqaction pq2pci_irqaction = {141141+ .handler = pq2pci_irq_demux,142142+ .flags = SA_INTERRUPT,143143+ .mask = CPU_MASK_NONE,144144+ .name = "PQ2 PCI cascade",145145+};146146+147147+148148+void149149+pq2pci_init_irq(void)150150+{151151+ int irq;152152+ volatile cpm2_map_t *immap = cpm2_immr;153153+#if defined CONFIG_ADS8272154154+ /* configure chip select for PCI interrupt controller */155155+ immap->im_memctl.memc_br3 = PCI_INT_STAT_REG | 0x00001801;156156+ immap->im_memctl.memc_or3 = 0xffff8010;157157+#elif defined CONFIG_PQ2FADS158158+ immap->im_memctl.memc_br8 = PCI_INT_STAT_REG | 0x00001801;159159+ immap->im_memctl.memc_or8 = 0xffff8010;160160+#endif161161+ for (irq = NR_CPM_INTS; irq < NR_CPM_INTS + 4; irq++)162162+ irq_desc[irq].handler = &pq2pci_ic;163163+164164+ /* make PCI IRQ level sensitive */165165+ immap->im_intctl.ic_siexr &=166166+ ~(1 << (14 - (PCI_INT_TO_SIU - SIU_INT_IRQ1)));167167+168168+ /* mask all PCI interrupts */169169+ *(volatile unsigned long *) PCI_INT_MASK_REG |= 0xfff00000;170170+171171+ /* install the demultiplexer for the PCI cascade interrupt */172172+ setup_irq(PCI_INT_TO_SIU, &pq2pci_irqaction);173173+ return;174174+}175175+176176+static int177177+pq2pci_exclude_device(u_char bus, u_char devfn)178178+{179179+ return PCIBIOS_SUCCESSFUL;180180+}181181+182182+/* PCI bus configuration registers.183183+ */184184+static void185185+pq2ads_setup_pci(struct pci_controller *hose)186186+{187187+ __u32 val;188188+ volatile cpm2_map_t *immap = cpm2_immr;189189+ bd_t* binfo = (bd_t*) __res;190190+ u32 sccr = immap->im_clkrst.car_sccr;191191+ uint pci_div,freq,time;192192+ /* PCI int lowest prio */193193+ /* Each 4 bits is a device bus request and the MS 4bits194194+ is highest priority */195195+ /* Bus 4bit value196196+ --- ----------197197+ CPM high 0b0000198198+ CPM middle 0b0001199199+ CPM low 0b0010200200+ PCI reguest 0b0011201201+ Reserved 0b0100202202+ Reserved 0b0101203203+ Internal Core 0b0110204204+ External Master 1 0b0111205205+ External Master 2 0b1000206206+ External Master 3 0b1001207207+ The rest are reserved208208+ */209209+ immap->im_siu_conf.siu_82xx.sc_ppc_alrh = 0x61207893;210210+ /* park bus on core */211211+ immap->im_siu_conf.siu_82xx.sc_ppc_acr = PPC_ACR_BUS_PARK_CORE;212212+ /*213213+ * Set up master windows that allow the CPU to access PCI space. These214214+ * windows are set up using the two SIU PCIBR registers.215215+ */216216+217217+ immap->im_memctl.memc_pcimsk0 = M82xx_PCI_PRIM_WND_SIZE;218218+ immap->im_memctl.memc_pcibr0 = M82xx_PCI_PRIM_WND_BASE | PCIBR_ENABLE;219219+220220+#ifdef M82xx_PCI_SEC_WND_SIZE221221+ immap->im_memctl.memc_pcimsk1 = M82xx_PCI_SEC_WND_SIZE;222222+ immap->im_memctl.memc_pcibr1 = M82xx_PCI_SEC_WND_BASE | PCIBR_ENABLE;223223+#endif224224+225225+#if defined CONFIG_ADS8272226226+ immap->im_siu_conf.siu_82xx.sc_siumcr =227227+ (immap->im_siu_conf.siu_82xx.sc_siumcr &228228+ ~(SIUMCR_BBD | SIUMCR_ESE | SIUMCR_PBSE |229229+ SIUMCR_CDIS | SIUMCR_DPPC11 | SIUMCR_L2CPC11 |230230+ SIUMCR_LBPC11 | SIUMCR_APPC11 |231231+ SIUMCR_CS10PC11 | SIUMCR_BCTLC11 | SIUMCR_MMR11)) |232232+ SIUMCR_DPPC11 | SIUMCR_L2CPC01 | SIUMCR_LBPC00 |233233+ SIUMCR_APPC10 | SIUMCR_CS10PC00 |234234+ SIUMCR_BCTLC00 | SIUMCR_MMR11 ;235235+236236+#elif defined CONFIG_PQ2FADS237237+ /*238238+ * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]),239239+ * and local bus for PCI (SIUMCR [LBPC]).240240+ */241241+ immap->im_siu_conf.siu_82xx.sc_siumcr = (immap->im_siu_conf.sc_siumcr &242242+ ~(SIUMCR_L2PC11 | SIUMCR_LBPC11 | SIUMCR_CS10PC11 | SIUMCR_APPC11) |243243+ SIUMCR_BBD | SIUMCR_LBPC01 | SIUMCR_DPPC11 | SIUMCR_APPC10;244244+#endif245245+ /* Enable PCI */246246+ immap->im_pci.pci_gcr = cpu_to_le32(PCIGCR_PCI_BUS_EN);247247+248248+ pci_div = ( (sccr & SCCR_PCI_MODCK) ? 2 : 1) *249249+ ( ( (sccr & SCCR_PCIDF_MSK) >> SCCR_PCIDF_SHIFT) + 1);250250+ freq = (uint)((2*binfo->bi_cpmfreq)/(pci_div));251251+ time = (int)666666/freq;252252+ /* due to PCI Local Bus spec, some devices needs to wait such a long253253+ time after RST deassertion. More specifically, 0.508s for 66MHz & twice more for 33 */254254+ printk("%s: The PCI bus is %d Mhz.\nWaiting %s after deasserting RST...\n",__FILE__,freq,255255+ (time==1) ? "0.5 seconds":"1 second" );256256+257257+ {258258+ int i;259259+ for(i=0;i<(500*time);i++)260260+ udelay(1000);261261+ }262262+263263+ /* setup ATU registers */264264+ immap->im_pci.pci_pocmr0 = cpu_to_le32(POCMR_ENABLE | POCMR_PCI_IO |265265+ ((~(M82xx_PCI_IO_SIZE - 1U)) >> POTA_ADDR_SHIFT));266266+ immap->im_pci.pci_potar0 = cpu_to_le32(M82xx_PCI_LOWER_IO >> POTA_ADDR_SHIFT);267267+ immap->im_pci.pci_pobar0 = cpu_to_le32(M82xx_PCI_IO_BASE >> POTA_ADDR_SHIFT);268268+269269+ /* Set-up non-prefetchable window */270270+ immap->im_pci.pci_pocmr1 = cpu_to_le32(POCMR_ENABLE | ((~(M82xx_PCI_MMIO_SIZE-1U)) >> POTA_ADDR_SHIFT));271271+ immap->im_pci.pci_potar1 = cpu_to_le32(M82xx_PCI_LOWER_MMIO >> POTA_ADDR_SHIFT);272272+ immap->im_pci.pci_pobar1 = cpu_to_le32((M82xx_PCI_LOWER_MMIO - M82xx_PCI_MMIO_OFFSET) >> POTA_ADDR_SHIFT);273273+274274+ /* Set-up prefetchable window */275275+ immap->im_pci.pci_pocmr2 = cpu_to_le32(POCMR_ENABLE |POCMR_PREFETCH_EN |276276+ (~(M82xx_PCI_MEM_SIZE-1U) >> POTA_ADDR_SHIFT));277277+ immap->im_pci.pci_potar2 = cpu_to_le32(M82xx_PCI_LOWER_MEM >> POTA_ADDR_SHIFT);278278+ immap->im_pci.pci_pobar2 = cpu_to_le32((M82xx_PCI_LOWER_MEM - M82xx_PCI_MEM_OFFSET) >> POTA_ADDR_SHIFT);279279+280280+ /* Inbound transactions from PCI memory space */281281+ immap->im_pci.pci_picmr0 = cpu_to_le32(PICMR_ENABLE | PICMR_PREFETCH_EN |282282+ ((~(M82xx_PCI_SLAVE_MEM_SIZE-1U)) >> PITA_ADDR_SHIFT));283283+ immap->im_pci.pci_pibar0 = cpu_to_le32(M82xx_PCI_SLAVE_MEM_BUS >> PITA_ADDR_SHIFT);284284+ immap->im_pci.pci_pitar0 = cpu_to_le32(M82xx_PCI_SLAVE_MEM_LOCAL>> PITA_ADDR_SHIFT);285285+286286+#if defined CONFIG_ADS8272287287+ /* PCI int highest prio */288288+ immap->im_siu_conf.siu_82xx.sc_ppc_alrh = 0x01236745;289289+#elif defined CONFIG_PQ2FADS290290+ immap->im_siu_conf.siu_82xx.sc_ppc_alrh = 0x03124567;291291+#endif292292+ /* park bus on PCI */293293+ immap->im_siu_conf.siu_82xx.sc_ppc_acr = PPC_ACR_BUS_PARK_PCI;294294+295295+ /* Enable bus mastering and inbound memory transactions */296296+ early_read_config_dword(hose, hose->first_busno, 0, PCI_COMMAND, &val);297297+ val &= 0xffff0000;298298+ val |= PCI_COMMAND_MEMORY|PCI_COMMAND_MASTER;299299+ early_write_config_dword(hose, hose->first_busno, 0, PCI_COMMAND, val);300300+301301+}302302+303303+void __init pq2_find_bridges(void)304304+{305305+ extern int pci_assign_all_busses;306306+ struct pci_controller * hose;307307+ int host_bridge;308308+309309+ pci_assign_all_busses = 1;310310+311311+ hose = pcibios_alloc_controller();312312+313313+ if (!hose)314314+ return;315315+316316+ ppc_md.pci_swizzle = common_swizzle;317317+318318+ hose->first_busno = 0;319319+ hose->bus_offset = 0;320320+ hose->last_busno = 0xff;321321+322322+#ifdef CONFIG_ADS8272323323+ hose->set_cfg_type = 1;324324+#endif325325+326326+ setup_m8260_indirect_pci(hose,327327+ (unsigned long)&cpm2_immr->im_pci.pci_cfg_addr,328328+ (unsigned long)&cpm2_immr->im_pci.pci_cfg_data);329329+330330+ /* Make sure it is a supported bridge */331331+ early_read_config_dword(hose,332332+ 0,333333+ PCI_DEVFN(0,0),334334+ PCI_VENDOR_ID,335335+ &host_bridge);336336+ switch (host_bridge) {337337+ case PCI_DEVICE_ID_MPC8265:338338+ break;339339+ case PCI_DEVICE_ID_MPC8272:340340+ break;341341+ default:342342+ printk("Attempting to use unrecognized host bridge ID"343343+ " 0x%08x.\n", host_bridge);344344+ break;345345+ }346346+347347+ pq2ads_setup_pci(hose);348348+349349+ hose->io_space.start = M82xx_PCI_LOWER_IO;350350+ hose->io_space.end = M82xx_PCI_UPPER_IO;351351+ hose->mem_space.start = M82xx_PCI_LOWER_MEM;352352+ hose->mem_space.end = M82xx_PCI_UPPER_MMIO;353353+ hose->pci_mem_offset = M82xx_PCI_MEM_OFFSET;354354+355355+ isa_io_base =356356+ (unsigned long) ioremap(M82xx_PCI_IO_BASE,357357+ M82xx_PCI_IO_SIZE);358358+ hose->io_base_virt = (void *) isa_io_base;359359+360360+ /* setup resources */361361+ pci_init_resource(&hose->mem_resources[0],362362+ M82xx_PCI_LOWER_MEM,363363+ M82xx_PCI_UPPER_MEM,364364+ IORESOURCE_MEM|IORESOURCE_PREFETCH, "PCI prefetchable memory");365365+366366+ pci_init_resource(&hose->mem_resources[1],367367+ M82xx_PCI_LOWER_MMIO,368368+ M82xx_PCI_UPPER_MMIO,369369+ IORESOURCE_MEM, "PCI memory");370370+371371+ pci_init_resource(&hose->io_resource,372372+ M82xx_PCI_LOWER_IO,373373+ M82xx_PCI_UPPER_IO,374374+ IORESOURCE_IO | 1, "PCI I/O");375375+376376+ ppc_md.pci_exclude_device = pq2pci_exclude_device;377377+ hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);378378+379379+ ppc_md.pci_map_irq = pq2pci_map_irq;380380+ ppc_md.pcibios_fixup = NULL;381381+ ppc_md.pcibios_fixup_bus = NULL;382382+383383+}
+92
arch/ppc/syslib/m82xx_pci.h
···11+22+#ifndef _PPC_KERNEL_M82XX_PCI_H33+#define _PPC_KERNEL_M82XX_PCI_H44+55+#include <asm/m8260_pci.h>66+/*77+ * Local->PCI map (from CPU) controlled by88+ * MPC826x master window99+ *1010+ * 0xF6000000 - 0xF7FFFFFF IO space1111+ * 0x80000000 - 0xBFFFFFFF CPU2PCI memory space PCIBR01212+ *1313+ * 0x80000000 - 0x9FFFFFFF PCI Mem with prefetch (Outbound ATU #1)1414+ * 0xA0000000 - 0xBFFFFFFF PCI Mem w/o prefetch (Outbound ATU #2)1515+ * 0xF6000000 - 0xF7FFFFFF 32-bit PCI IO (Outbound ATU #3)1616+ *1717+ * PCI->Local map (from PCI)1818+ * MPC826x slave window controlled by1919+ *2020+ * 0x00000000 - 0x07FFFFFF MPC826x local memory (Inbound ATU #1)2121+ */2222+2323+/*2424+ * Slave window that allows PCI masters to access MPC826x local memory.2525+ * This window is set up using the first set of Inbound ATU registers2626+ */2727+2828+#ifndef M82xx_PCI_SLAVE_MEM_LOCAL2929+#define M82xx_PCI_SLAVE_MEM_LOCAL (((struct bd_info *)__res)->bi_memstart)3030+#define M82xx_PCI_SLAVE_MEM_BUS (((struct bd_info *)__res)->bi_memstart)3131+#define M82xx_PCI_SLAVE_MEM_SIZE (((struct bd_info *)__res)->bi_memsize)3232+#endif3333+3434+/*3535+ * This is the window that allows the CPU to access PCI address space.3636+ * It will be setup with the SIU PCIBR0 register. All three PCI master3737+ * windows, which allow the CPU to access PCI prefetch, non prefetch,3838+ * and IO space (see below), must all fit within this window.3939+ */4040+4141+#ifndef M82xx_PCI_LOWER_MEM4242+#define M82xx_PCI_LOWER_MEM 0x800000004343+#define M82xx_PCI_UPPER_MEM 0x9fffffff4444+#define M82xx_PCI_MEM_OFFSET 0x000000004545+#define M82xx_PCI_MEM_SIZE 0x200000004646+#endif4747+4848+#ifndef M82xx_PCI_LOWER_MMIO4949+#define M82xx_PCI_LOWER_MMIO 0xa00000005050+#define M82xx_PCI_UPPER_MMIO 0xafffffff5151+#define M82xx_PCI_MMIO_OFFSET 0x000000005252+#define M82xx_PCI_MMIO_SIZE 0x200000005353+#endif5454+5555+#ifndef M82xx_PCI_LOWER_IO5656+#define M82xx_PCI_LOWER_IO 0x000000005757+#define M82xx_PCI_UPPER_IO 0x01ffffff5858+#define M82xx_PCI_IO_BASE 0xf60000005959+#define M82xx_PCI_IO_SIZE 0x020000006060+#endif6161+6262+#ifndef M82xx_PCI_PRIM_WND_SIZE6363+#define M82xx_PCI_PRIM_WND_SIZE ~(M82xx_PCI_IO_SIZE - 1U)6464+#define M82xx_PCI_PRIM_WND_BASE (M82xx_PCI_IO_BASE)6565+#endif6666+6767+#ifndef M82xx_PCI_SEC_WND_SIZE6868+#define M82xx_PCI_SEC_WND_SIZE ~(M82xx_PCI_MEM_SIZE + M82xx_PCI_MMIO_SIZE - 1U)6969+#define M82xx_PCI_SEC_WND_BASE (M82xx_PCI_LOWER_MEM)7070+#endif7171+7272+#ifndef POTA_ADDR_SHIFT7373+#define POTA_ADDR_SHIFT 127474+#endif7575+7676+#ifndef PITA_ADDR_SHIFT7777+#define PITA_ADDR_SHIFT 127878+#endif7979+8080+#ifndef _IO_BASE8181+#define _IO_BASE isa_io_base8282+#endif8383+8484+#ifdef CONFIG_8260_PCI98585+struct pci_controller;8686+extern void setup_m8260_indirect_pci(struct pci_controller* hose,8787+ u32 cfg_addr, u32 cfg_data);8888+#else8989+#define setup_m8260_indirect_pci setup_indirect_pci9090+#endif9191+9292+#endif /* _PPC_KERNEL_M8260_PCI_H */
+1-3
arch/ppc/syslib/open_pic.c
···275275}276276#endif277277278278-#if defined(CONFIG_EPIC_SERIAL_MODE) || defined(CONFIG_PM)278278+#if defined(CONFIG_EPIC_SERIAL_MODE)279279static void openpic_reset(void)280280{281281 openpic_setfield(&OpenPIC->Global.Global_Configuration0,···992992 spin_unlock_irqrestore(&openpic_setup_lock, flags);993993 return 0;994994 }995995-996996- openpic_reset();997995998996 /* OpenPIC sometimes seem to need some time to be fully back up... */999997 do {
+28
arch/ppc/syslib/ppc83xx_setup.c
···2929#include <asm/mmu.h>3030#include <asm/ppc_sys.h>3131#include <asm/kgdb.h>3232+#include <asm/delay.h>32333334#include <syslib/ppc83xx_setup.h>3435···118117void119118mpc83xx_restart(char *cmd)120119{120120+ volatile unsigned char __iomem *reg;121121+ unsigned char tmp;122122+123123+ reg = ioremap(BCSR_PHYS_ADDR, BCSR_SIZE);124124+121125 local_irq_disable();126126+127127+ /*128128+ * Unlock the BCSR bits so a PRST will update the contents.129129+ * Otherwise the reset asserts but doesn't clear.130130+ */131131+ tmp = in_8(reg + BCSR_MISC_REG3_OFF);132132+ tmp |= BCSR_MISC_REG3_CNFLOCK; /* low true, high false */133133+ out_8(reg + BCSR_MISC_REG3_OFF, tmp);134134+135135+ /*136136+ * Trigger a reset via a low->high transition of the137137+ * PORESET bit.138138+ */139139+ tmp = in_8(reg + BCSR_MISC_REG2_OFF);140140+ tmp &= ~BCSR_MISC_REG2_PORESET;141141+ out_8(reg + BCSR_MISC_REG2_OFF, tmp);142142+143143+ udelay(1);144144+145145+ tmp |= BCSR_MISC_REG2_PORESET;146146+ out_8(reg + BCSR_MISC_REG2_OFF, tmp);147147+122148 for(;;);123149}124150
···626626 l = call_prom("package-to-path", 3, 1, node,627627 mem_start, mem_end - mem_start);628628 if (l >= 0) {629629+ char *p, *ep;630630+629631 np->full_name = PTRUNRELOC((char *) mem_start);630632 *(char *)(mem_start + l) = 0;633633+ /* Fixup an Apple bug where they have bogus \0 chars in the634634+ * middle of the path in some properties635635+ */636636+ for (p = (char *)mem_start, ep = p + l; p < ep; p++)637637+ if ((*p) == '\0') {638638+ memmove(p, p+1, ep - p);639639+ ep--;640640+ }631641 mem_start = ALIGNUL(mem_start + l + 1);632642 }633643
-8
arch/ppc64/kernel/pSeries_reconfig.c
···4747 remove_proc_entry(pp->name, np->pde);4848 pp = pp->next;4949 }5050-5151- /* Assuming that symlinks have the same parent directory as5252- * np->pde.5353- */5454- if (np->name_link)5555- remove_proc_entry(np->name_link->name, parent->pde);5656- if (np->addr_link)5757- remove_proc_entry(np->addr_link->name, parent->pde);5850 if (np->pde)5951 remove_proc_entry(np->pde->name, parent->pde);6052}
+76-42
arch/ppc64/kernel/prom_init.c
···211211 */212212#define ADDR(x) (u32) ((unsigned long)(x) - offset)213213214214+/*215215+ * Error results ... some OF calls will return "-1" on error, some216216+ * will return 0, some will return either. To simplify, here are217217+ * macros to use with any ihandle or phandle return value to check if218218+ * it is valid219219+ */220220+221221+#define PROM_ERROR (-1u)222222+#define PHANDLE_VALID(p) ((p) != 0 && (p) != PROM_ERROR)223223+#define IHANDLE_VALID(i) ((i) != 0 && (i) != PROM_ERROR)224224+225225+214226/* This is the one and *ONLY* place where we actually call open215227 * firmware from, since we need to make sure we're running in 32b216228 * mode when we do. We switch back to 64b mode upon return.217229 */218218-219219-#define PROM_ERROR (-1)220230221231static int __init call_prom(const char *service, int nargs, int nret, ...)222232{···597587{598588 unsigned long offset = reloc_offset();599589 ihandle elfloader;600600- int ret;601590602591 elfloader = call_prom("open", 1, 1, ADDR("/packages/elf-loader"));603592 if (elfloader == 0) {604593 prom_printf("couldn't open /packages/elf-loader\n");605594 return;606595 }607607- ret = call_prom("call-method", 3, 1, ADDR("process-elf-header"),596596+ call_prom("call-method", 3, 1, ADDR("process-elf-header"),608597 elfloader, ADDR(&fake_elf));609598 call_prom("close", 1, 0, elfloader);610599}···655646 base = _ALIGN_UP(base + 0x100000, align)) {656647 prom_debug(" trying: 0x%x\n\r", base);657648 addr = (unsigned long)prom_claim(base, size, 0);658658- if ((int)addr != PROM_ERROR)649649+ if (addr != PROM_ERROR)659650 break;660651 addr = 0;661652 if (align == 0)···717708 for(; base > RELOC(alloc_bottom); base = _ALIGN_DOWN(base - 0x100000, align)) {718709 prom_debug(" trying: 0x%x\n\r", base);719710 addr = (unsigned long)prom_claim(base, size, 0);720720- if ((int)addr != PROM_ERROR)711711+ if (addr != PROM_ERROR)721712 break;722713 addr = 0;723714 }···911902{912903 unsigned long offset = reloc_offset();913904 struct prom_t *_prom = PTRRELOC(&prom);914914- phandle prom_rtas, rtas_node;905905+ phandle rtas_node;906906+ ihandle rtas_inst;915907 u32 base, entry = 0;916908 u32 size = 0;917909918910 prom_debug("prom_instantiate_rtas: start...\n");919911920920- prom_rtas = call_prom("finddevice", 1, 1, ADDR("/rtas"));921921- prom_debug("prom_rtas: %x\n", prom_rtas);922922- if (prom_rtas == (phandle) -1)912912+ rtas_node = call_prom("finddevice", 1, 1, ADDR("/rtas"));913913+ prom_debug("rtas_node: %x\n", rtas_node);914914+ if (!PHANDLE_VALID(rtas_node))923915 return;924916925925- prom_getprop(prom_rtas, "rtas-size", &size, sizeof(size));917917+ prom_getprop(rtas_node, "rtas-size", &size, sizeof(size));926918 if (size == 0)927919 return;928920···932922 prom_printf("RTAS allocation failed !\n");933923 return;934924 }935935- prom_printf("instantiating rtas at 0x%x", base);936925937937- rtas_node = call_prom("open", 1, 1, ADDR("/rtas"));938938- prom_printf("...");926926+ rtas_inst = call_prom("open", 1, 1, ADDR("/rtas"));927927+ if (!IHANDLE_VALID(rtas_inst)) {928928+ prom_printf("opening rtas package failed");929929+ return;930930+ }931931+932932+ prom_printf("instantiating rtas at 0x%x ...", base);939933940934 if (call_prom("call-method", 3, 2,941935 ADDR("instantiate-rtas"),942942- rtas_node, base) != PROM_ERROR) {936936+ rtas_inst, base) != PROM_ERROR) {943937 entry = (long)_prom->args.rets[1];944938 }945939 if (entry == 0) {···954940955941 reserve_mem(base, size);956942957957- prom_setprop(prom_rtas, "linux,rtas-base", &base, sizeof(base));958958- prom_setprop(prom_rtas, "linux,rtas-entry", &entry, sizeof(entry));943943+ prom_setprop(rtas_node, "linux,rtas-base", &base, sizeof(base));944944+ prom_setprop(rtas_node, "linux,rtas-entry", &entry, sizeof(entry));959945960946 prom_debug("rtas base = 0x%x\n", base);961947 prom_debug("rtas entry = 0x%x\n", entry);···1076106210771063 prom_printf("opening PHB %s", path);10781064 phb_node = call_prom("open", 1, 1, path);10791079- if ( (long)phb_node <= 0)10651065+ if (phb_node == 0)10801066 prom_printf("... failed\n");10811067 else10821068 prom_printf("... done\n");···1293127912941280 /* get a handle for the stdout device */12951281 _prom->chosen = call_prom("finddevice", 1, 1, ADDR("/chosen"));12961296- if ((long)_prom->chosen <= 0)12821282+ if (!PHANDLE_VALID(_prom->chosen))12971283 prom_panic("cannot find chosen"); /* msg won't be printed :( */1298128412991285 /* get device tree root */13001286 _prom->root = call_prom("finddevice", 1, 1, ADDR("/"));13011301- if ((long)_prom->root <= 0)12871287+ if (!PHANDLE_VALID(_prom->root))13021288 prom_panic("cannot find device tree root"); /* msg won't be printed :( */13031289}13041290···13701356 }13711357 /* Default to pSeries. We need to know if we are running LPAR */13721358 rtas = call_prom("finddevice", 1, 1, ADDR("/rtas"));13731373- if (rtas != (phandle) -1) {13741374- unsigned long x;13751375- x = prom_getproplen(rtas, "ibm,hypertas-functions");13591359+ if (!PHANDLE_VALID(rtas)) {13601360+ int x = prom_getproplen(rtas, "ibm,hypertas-functions");13761361 if (x != PROM_ERROR) {13771362 prom_printf("Hypertas detected, assuming LPAR !\n");13781363 return PLATFORM_PSERIES_LPAR;···14391426 * leave some room at the end of the path for appending extra14401427 * arguments14411428 */14421442- if (call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-10) < 0)14291429+ if (call_prom("package-to-path", 3, 1, node, path,14301430+ PROM_SCRATCH_SIZE-10) == PROM_ERROR)14431431 continue;14441432 prom_printf("found display : %s, opening ... ", path);1445143314461434 ih = call_prom("open", 1, 1, path);14471447- if (ih == (ihandle)0 || ih == (ihandle)-1) {14351435+ if (ih == 0) {14481436 prom_printf("failed\n");14491437 continue;14501438 }···15281514 return 0;15291515}1530151615171517+/*15181518+ * The Open Firmware 1275 specification states properties must be 31 bytes or15191519+ * less, however not all firmwares obey this. Make it 64 bytes to be safe.15201520+ */15211521+#define MAX_PROPERTY_NAME 6415221522+15311523static void __init scan_dt_build_strings(phandle node, unsigned long *mem_start,15321524 unsigned long *mem_end)15331525{···15471527 /* get and store all property names */15481528 prev_name = RELOC("");15491529 for (;;) {15501550-15511551- /* 32 is max len of name including nul. */15521552- namep = make_room(mem_start, mem_end, 32, 1);15531553- if (call_prom("nextprop", 3, 1, node, prev_name, namep) <= 0) {15301530+ int rc;15311531+15321532+ /* 64 is max len of name including nul. */15331533+ namep = make_room(mem_start, mem_end, MAX_PROPERTY_NAME, 1);15341534+ rc = call_prom("nextprop", 3, 1, node, prev_name, namep);15351535+ if (rc != 1) {15541536 /* No more nodes: unwind alloc */15551537 *mem_start = (unsigned long)namep;15561538 break;···15771555 }15781556}1579155715801580-/*15811581- * The Open Firmware 1275 specification states properties must be 31 bytes or15821582- * less, however not all firmwares obey this. Make it 64 bytes to be safe.15831583- */15841584-#define MAX_PROPERTY_NAME 6415851585-15861558static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,15871559 unsigned long *mem_end)15881560{15891561 int l, align;15901562 phandle child;15911591- char *namep, *prev_name, *sstart;15631563+ char *namep, *prev_name, *sstart, *p, *ep;15921564 unsigned long soff;15931565 unsigned char *valp;15941566 unsigned long offset = reloc_offset();···16041588 call_prom("package-to-path", 3, 1, node, namep, l);16051589 }16061590 namep[l] = '\0';15911591+ /* Fixup an Apple bug where they have bogus \0 chars in the15921592+ * middle of the path in some properties15931593+ */15941594+ for (p = namep, ep = namep + l; p < ep; p++)15951595+ if (*p == '\0') {15961596+ memmove(p, p+1, ep - p);15971597+ ep--; l--;15981598+ }16071599 *mem_start = _ALIGN(((unsigned long) namep) + strlen(namep) + 1, 4);16081600 }16091601···16231599 prev_name = RELOC("");16241600 sstart = (char *)RELOC(dt_string_start);16251601 for (;;) {16261626- if (call_prom("nextprop", 3, 1, node, prev_name, pname) <= 0)16021602+ int rc;16031603+16041604+ rc = call_prom("nextprop", 3, 1, node, prev_name, pname);16051605+ if (rc != 1)16271606 break;1628160716291608 /* find string offset */···16421615 l = call_prom("getproplen", 2, 1, node, pname);1643161616441617 /* sanity checks */16451645- if (l < 0)16181618+ if (l == PROM_ERROR)16461619 continue;16471620 if (l > MAX_PROPERTY_LENGTH) {16481621 prom_printf("WARNING: ignoring large property ");···1790176317911764 /* Some G5s have a missing interrupt definition, fix it up here */17921765 u3 = call_prom("finddevice", 1, 1, ADDR("/u3@0,f8000000"));17931793- if ((long)u3 <= 0)17661766+ if (!PHANDLE_VALID(u3))17941767 return;17951768 i2c = call_prom("finddevice", 1, 1, ADDR("/u3@0,f8000000/i2c@f8001000"));17961796- if ((long)i2c <= 0)17691769+ if (!PHANDLE_VALID(i2c))17971770 return;17981771 mpic = call_prom("finddevice", 1, 1, ADDR("/u3@0,f8000000/mpic@f8040000"));17991799- if ((long)mpic <= 0)17721772+ if (!PHANDLE_VALID(mpic))18001773 return;1801177418021775 /* check if proper rev of u3 */18031803- if (prom_getprop(u3, "device-rev", &u3_rev, sizeof(u3_rev)) <= 0)17761776+ if (prom_getprop(u3, "device-rev", &u3_rev, sizeof(u3_rev))17771777+ == PROM_ERROR)18041778 return;18051779 if (u3_rev != 0x35)18061780 return;···19071879 getprop_rval = RELOC(of_platform);19081880 prom_setprop(_prom->chosen, "linux,platform",19091881 &getprop_rval, sizeof(getprop_rval));18821882+18831883+ /*18841884+ * On pSeries, inform the firmware about our capabilities18851885+ */18861886+ if (RELOC(of_platform) & PLATFORM_PSERIES)18871887+ prom_send_capabilities();1910188819111889 /*19121890 * On pSeries, copy the CPU hold code
···117117118118#define STRBUF_TAG_VALID 0x02UL119119120120-static void sbus_strbuf_flush(struct sbus_iommu *iommu, u32 base, unsigned long npages)120120+static void sbus_strbuf_flush(struct sbus_iommu *iommu, u32 base, unsigned long npages, int direction)121121{122122 unsigned long n;123123 int limit;124124125125- iommu->strbuf_flushflag = 0UL;126125 n = npages;127126 while (n--)128127 upa_writeq(base + (n << IO_PAGE_SHIFT),129128 iommu->strbuf_regs + STRBUF_PFLUSH);129129+130130+ /* If the device could not have possibly put dirty data into131131+ * the streaming cache, no flush-flag synchronization needs132132+ * to be performed.133133+ */134134+ if (direction == SBUS_DMA_TODEVICE)135135+ return;136136+137137+ iommu->strbuf_flushflag = 0UL;130138131139 /* Whoopee cushion! */132140 upa_writeq(__pa(&iommu->strbuf_flushflag),···429421430422 spin_lock_irqsave(&iommu->lock, flags);431423 free_streaming_cluster(iommu, dma_base, size >> IO_PAGE_SHIFT);432432- sbus_strbuf_flush(iommu, dma_base, size >> IO_PAGE_SHIFT);424424+ sbus_strbuf_flush(iommu, dma_base, size >> IO_PAGE_SHIFT, direction);433425 spin_unlock_irqrestore(&iommu->lock, flags);434426}435427···592584 iommu = sdev->bus->iommu;593585 spin_lock_irqsave(&iommu->lock, flags);594586 free_streaming_cluster(iommu, dvma_base, size >> IO_PAGE_SHIFT);595595- sbus_strbuf_flush(iommu, dvma_base, size >> IO_PAGE_SHIFT);587587+ sbus_strbuf_flush(iommu, dvma_base, size >> IO_PAGE_SHIFT, direction);596588 spin_unlock_irqrestore(&iommu->lock, flags);597589}598590···604596 size = (IO_PAGE_ALIGN(base + size) - (base & IO_PAGE_MASK));605597606598 spin_lock_irqsave(&iommu->lock, flags);607607- sbus_strbuf_flush(iommu, base & IO_PAGE_MASK, size >> IO_PAGE_SHIFT);599599+ sbus_strbuf_flush(iommu, base & IO_PAGE_MASK, size >> IO_PAGE_SHIFT, direction);608600 spin_unlock_irqrestore(&iommu->lock, flags);609601}610602···628620 size = IO_PAGE_ALIGN(sg[i].dma_address + sg[i].dma_length) - base;629621630622 spin_lock_irqsave(&iommu->lock, flags);631631- sbus_strbuf_flush(iommu, base, size >> IO_PAGE_SHIFT);623623+ sbus_strbuf_flush(iommu, base, size >> IO_PAGE_SHIFT, direction);632624 spin_unlock_irqrestore(&iommu->lock, flags);633625}634626
-4
arch/um/Kconfig.debug
···2233source "lib/Kconfig.debug"4455-config FRAME_POINTER66- bool77- default y if DEBUG_INFO88-95config PT_PROXY106 bool "Enable ptrace proxy"117 depends on XTERM_CHAN && DEBUG_INFO && MODE_TT
+11-5
arch/um/drivers/random.c
···11-/* Much of this ripped from hw_random.c */22-11+/* Copyright (C) 2005 Jeff Dike <jdike@addtoit.com> */22+/* Much of this ripped from drivers/char/hw_random.c, see there for other33+ * copyright.44+ *55+ * This software may be used and distributed according to the terms66+ * of the GNU General Public License, incorporated herein by reference.77+ */38#include <linux/module.h>49#include <linux/fs.h>510#include <linux/miscdevice.h>···1712 */1813#define RNG_VERSION "1.0.0"1914#define RNG_MODULE_NAME "random"2020-#define RNG_DRIVER_NAME RNG_MODULE_NAME " virtual driver " RNG_VERSION2121-#define PFX RNG_MODULE_NAME ": "22152316#define RNG_MISCDEV_MINOR 183 /* official */2417···1019810299 err = misc_register (&rng_miscdev);103100 if (err) {104104- printk (KERN_ERR PFX "misc device register failed\n");101101+ printk (KERN_ERR RNG_MODULE_NAME ": misc device register failed\n");105102 goto err_out_cleanup_hw;106103 }107104···123120124121module_init (rng_init);125122module_exit (rng_cleanup);123123+124124+MODULE_DESCRIPTION("UML Host Random Number Generator (RNG) driver");125125+MODULE_LICENSE("GPL");
-1
arch/um/drivers/ssl.c
···2222#include "init.h"2323#include "irq_user.h"2424#include "mconsole_kern.h"2525-#include "2_5compat.h"26252726static int ssl_version = 1;2827
···4949#include "irq_user.h"5050#include "irq_kern.h"5151#include "ubd_user.h"5252-#include "2_5compat.h"5352#include "os.h"5453#include "mem.h"5554#include "mem_kern.h"···439440__setup("udb", udb_setup);440441__uml_help(udb_setup,441442"udb\n"442442-" This option is here solely to catch ubd -> udb typos, which can be\n\n"443443-" to impossible to catch visually unless you specifically look for\n\n"444444-" them. The only result of any option starting with 'udb' is an error\n\n"443443+" This option is here solely to catch ubd -> udb typos, which can be\n"444444+" to impossible to catch visually unless you specifically look for\n"445445+" them. The only result of any option starting with 'udb' is an error\n"445446" in the boot output.\n\n"446447);447448
-24
arch/um/include/2_5compat.h
···11-/* 22- * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)33- * Licensed under the GPL44- */55-66-#ifndef __2_5_COMPAT_H__77-#define __2_5_COMPAT_H__88-99-#define INIT_HARDSECT(arr, maj, sizes)1010-1111-#define SET_PRI(task) do ; while(0)1212-1313-#endif1414-1515-/*1616- * Overrides for Emacs so that we follow Linus's tabbing style.1717- * Emacs will notice this stuff at the end of the file and automatically1818- * adjust the settings for this buffer only. This must remain at the end1919- * of the file.2020- * ---------------------------------------------------------------------------2121- * Local variables:2222- * c-file-style: "linux"2323- * End:2424- */
+2-1
arch/um/include/sysrq.h
···11#ifndef __UM_SYSRQ_H22#define __UM_SYSRQ_H3344-extern void show_trace(unsigned long *stack);44+struct task_struct;55+extern void show_trace(struct task_struct* task, unsigned long *stack);5667#endif
···11-/*22- * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)33- * Licensed under the GPL44- */55-66-#include "linux/init.h"77-#include "linux/bootmem.h"88-#include "linux/initrd.h"99-#include "asm/types.h"1010-#include "user_util.h"1111-#include "kern_util.h"1212-#include "initrd.h"1313-#include "init.h"1414-#include "os.h"1515-1616-/* Changed by uml_initrd_setup, which is a setup */1717-static char *initrd __initdata = NULL;1818-1919-static int __init read_initrd(void)2020-{2121- void *area;2222- long long size;2323- int err;2424-2525- if(initrd == NULL) return 0;2626- err = os_file_size(initrd, &size);2727- if(err) return 0;2828- area = alloc_bootmem(size);2929- if(area == NULL) return 0;3030- if(load_initrd(initrd, area, size) == -1) return 0;3131- initrd_start = (unsigned long) area;3232- initrd_end = initrd_start + size;3333- return 0;3434-}3535-3636-__uml_postsetup(read_initrd);3737-3838-static int __init uml_initrd_setup(char *line, int *add)3939-{4040- initrd = line;4141- return 0;4242-}4343-4444-__uml_setup("initrd=", uml_initrd_setup, 4545-"initrd=<initrd image>\n"4646-" This is used to boot UML from an initrd image. The argument is the\n"4747-" name of the file containing the image.\n\n"4848-);4949-5050-/*5151- * Overrides for Emacs so that we follow Linus's tabbing style.5252- * Emacs will notice this stuff at the end of the file and automatically5353- * adjust the settings for this buffer only. This must remain at the end5454- * of the file.5555- * ---------------------------------------------------------------------------5656- * Local variables:5757- * c-file-style: "linux"5858- * End:5959- */
-46
arch/um/kernel/initrd_user.c
···11-/*22- * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)33- * Licensed under the GPL44- */55-66-#include <unistd.h>77-#include <sys/types.h>88-#include <sys/stat.h>99-#include <errno.h>1010-1111-#include "user_util.h"1212-#include "kern_util.h"1313-#include "user.h"1414-#include "initrd.h"1515-#include "os.h"1616-1717-int load_initrd(char *filename, void *buf, int size)1818-{1919- int fd, n;2020-2121- fd = os_open_file(filename, of_read(OPENFLAGS()), 0);2222- if(fd < 0){2323- printk("Opening '%s' failed - err = %d\n", filename, -fd);2424- return(-1);2525- }2626- n = os_read_file(fd, buf, size);2727- if(n != size){2828- printk("Read of %d bytes from '%s' failed, err = %d\n", size,2929- filename, -n);3030- return(-1);3131- }3232-3333- os_close_file(fd);3434- return(0);3535-}3636-3737-/*3838- * Overrides for Emacs so that we follow Linus's tabbing style.3939- * Emacs will notice this stuff at the end of the file and automatically4040- * adjust the settings for this buffer only. This must remain at the end4141- * of the file.4242- * ---------------------------------------------------------------------------4343- * Local variables:4444- * c-file-style: "linux"4545- * End:4646- */
+22-20
arch/um/kernel/main.c
···71717272static void last_ditch_exit(int sig)7373{7474- CHOOSE_MODE(kmalloc_ok = 0, (void) 0);7474+ kmalloc_ok = 0;7575 signal(SIGINT, SIG_DFL);7676 signal(SIGTERM, SIG_DFL);7777 signal(SIGHUP, SIG_DFL);···8787{8888 char **new_argv;8989 sigset_t mask;9090- int ret, i;9090+ int ret, i, err;91919292 /* Enable all signals except SIGIO - in some environments, we can9393 * enter with some signals blocked···160160 */161161 change_sig(SIGPROF, 0);162162163163+ /* This signal stuff used to be in the reboot case. However,164164+ * sometimes a SIGVTALRM can come in when we're halting (reproducably165165+ * when writing out gcov information, presumably because that takes166166+ * some time) and cause a segfault.167167+ */168168+169169+ /* stop timers and set SIG*ALRM to be ignored */170170+ disable_timer();171171+172172+ /* disable SIGIO for the fds and set SIGIO to be ignored */173173+ err = deactivate_all_fds();174174+ if(err)175175+ printf("deactivate_all_fds failed, errno = %d\n", -err);176176+177177+ /* Let any pending signals fire now. This ensures178178+ * that they won't be delivered after the exec, when179179+ * they are definitely not expected.180180+ */181181+ unblock_signals();182182+163183 /* Reboot */164184 if(ret){165165- int err;166166-167185 printf("\n");168168-169169- /* stop timers and set SIG*ALRM to be ignored */170170- disable_timer();171171-172172- /* disable SIGIO for the fds and set SIGIO to be ignored */173173- err = deactivate_all_fds();174174- if(err)175175- printf("deactivate_all_fds failed, errno = %d\n",176176- -err);177177-178178- /* Let any pending signals fire now. This ensures179179- * that they won't be delivered after the exec, when180180- * they are definitely not expected.181181- */182182- unblock_signals();183183-184186 execvp(new_argv[0], new_argv);185187 perror("Failed to exec kernel");186188 ret = 1;
-36
arch/um/kernel/process_kern.c
···4343#include "tlb.h"4444#include "frame_kern.h"4545#include "sigcontext.h"4646-#include "2_5compat.h"4746#include "os.h"4847#include "mode.h"4948#include "mode_kern.h"···5354 * entry.5455 */5556struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } };5656-5757-struct task_struct *get_task(int pid, int require)5858-{5959- struct task_struct *ret;6060-6161- read_lock(&tasklist_lock);6262- ret = find_task_by_pid(pid);6363- read_unlock(&tasklist_lock);6464-6565- if(require && (ret == NULL)) panic("get_task couldn't find a task\n");6666- return(ret);6767-}68576958int external_pid(void *t)7059{···176189177190 while(1){178191 /* endless idle loop with no priority at all */179179- SET_PRI(current);180192181193 /*182194 * although we are an idle CPU, we do not want to···196210int page_size(void)197211{198212 return(PAGE_SIZE);199199-}200200-201201-unsigned long page_mask(void)202202-{203203- return(PAGE_MASK);204213}205214206215void *um_virt_to_phys(struct task_struct *task, unsigned long addr, ···330349 return(new);331350}332351333333-void *get_init_task(void)334334-{335335- return(&init_thread_union.thread_info.task);336336-}337337-338352int copy_to_user_proc(void __user *to, void *from, int size)339353{340354 return(copy_to_user(to, from, size));···456480 return sp & ~0xf;457481}458482#endif459459-460460-461461-/*462462- * Overrides for Emacs so that we follow Linus's tabbing style.463463- * Emacs will notice this stuff at the end of the file and automatically464464- * adjust the settings for this buffer only. This must remain at the end465465- * of the file.466466- * ---------------------------------------------------------------------------467467- * Local variables:468468- * c-file-style: "linux"469469- * End:470470- */
+3-16
arch/um/kernel/ptrace.c
···322322 UPT_SYSCALL_ARG2(regs),323323 UPT_SYSCALL_ARG3(regs),324324 UPT_SYSCALL_ARG4(regs));325325- else {326326- int res = UPT_SYSCALL_RET(regs);327327- audit_syscall_exit(current, AUDITSC_RESULT(res),328328- res);329329- }325325+ else audit_syscall_exit(current,326326+ AUDITSC_RESULT(UPT_SYSCALL_RET(regs)),327327+ UPT_SYSCALL_RET(regs));330328 }331329332330 /* Fake a debug trap */···354356 current->exit_code = 0;355357 }356358}357357-358358-/*359359- * Overrides for Emacs so that we follow Linus's tabbing style.360360- * Emacs will notice this stuff at the end of the file and automatically361361- * adjust the settings for this buffer only. This must remain at the end362362- * of the file.363363- * ---------------------------------------------------------------------------364364- * Local variables:365365- * c-file-style: "linux"366366- * End:367367- */
+14-7
arch/um/kernel/sysrq.c
···33 * Licensed under the GPL44 */5566+#include "linux/config.h"67#include "linux/sched.h"78#include "linux/kernel.h"89#include "linux/module.h"···1312#include "sysrq.h"1413#include "user_util.h"15141616-void show_trace(unsigned long * stack)1515+/* Catch non-i386 SUBARCH's. */1616+#if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT)1717+void show_trace(struct task_struct *task, unsigned long * stack)1718{1818- /* XXX: Copy the CONFIG_FRAME_POINTER stack-walking backtrace from1919- * arch/i386/kernel/traps.c, and then move this to sys-i386/sysrq.c.*/2019 unsigned long addr;21202221 if (!stack) {2323- stack = (unsigned long*) &stack;2222+ stack = (unsigned long*) &stack;2423 WARN_ON(1);2524 }2625···3635 }3736 printk("\n");3837}3838+#endif39394040/*4141 * stack dumps generator - this is used by arch-independent code.···4644{4745 unsigned long stack;48464949- show_trace(&stack);4747+ show_trace(current, &stack);5048}5149EXPORT_SYMBOL(dump_stack);5250···6159 int i;62606361 if (esp == NULL) {6464- if (task != current) {6262+ if (task != current && task != NULL) {6363+ /* XXX: Isn't this bogus? I.e. isn't this the6464+ * *userspace* stack of this task? If not so, use this6565+ * even when task == current (as in i386).6666+ */6567 esp = (unsigned long *) KSTK_ESP(task);6668 /* Which one? No actual difference - just coding style.*/6769 //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs);···8377 printk("%08lx ", *stack++);8478 }85798686- show_trace(esp);8080+ printk("Call Trace: \n");8181+ show_trace(current, esp);8782}
···3232 unsigned long flags;3333 int err, vtalrm, alrm, prof, cpu;3434 char c;3535- /* jailing and SMP are incompatible, so this doesn't need to be 3636- * made per-cpu 3737- */3838- static int reading;39354036 from = prev;4137 to = next;···5559 c = 0;5660 set_current(to);57615858- reading = 0;5962 err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c));6063 if(err != sizeof(c))6164 panic("write of switch_pipe failed, err = %d", -err);62656363- reading = 1;6464- if(from->thread.mode.tt.switch_pipe[0] == -1)6666+ if(from->thread.mode.tt.switch_pipe[0] == -1)6567 os_kill_process(os_getpid(), 0);66686769 err = os_read_file(from->thread.mode.tt.switch_pipe[0], &c, sizeof(c));
-6
arch/um/kernel/um_arch.c
···111111 .show = show_cpuinfo,112112};113113114114-pte_t * __bad_pagetable(void)115115-{116116- panic("Someone should implement __bad_pagetable");117117- return(NULL);118118-}119119-120114/* Set in linux_main */121115unsigned long host_task_size;122116unsigned long task_size;
+79-1
arch/um/sys-i386/sysrq.c
···33 * Licensed under the GPL44 */5566+#include "linux/config.h"67#include "linux/kernel.h"78#include "linux/smp.h"89#include "linux/sched.h"1010+#include "linux/kallsyms.h"911#include "asm/ptrace.h"1012#include "sysrq.h"11131414+/* This is declared by <linux/sched.h> */1215void show_regs(struct pt_regs *regs)1316{1417 printk("\n");···3431 0xffff & PT_REGS_DS(regs), 3532 0xffff & PT_REGS_ES(regs));36333737- show_trace((unsigned long *) ®s);3434+ show_trace(NULL, (unsigned long *) ®s);3835}3636+3737+/* Copied from i386. */3838+static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)3939+{4040+ return p > (void *)tinfo &&4141+ p < (void *)tinfo + THREAD_SIZE - 3;4242+}4343+4444+/* Adapted from i386 (we also print the address we read from). */4545+static inline unsigned long print_context_stack(struct thread_info *tinfo,4646+ unsigned long *stack, unsigned long ebp)4747+{4848+ unsigned long addr;4949+5050+#ifdef CONFIG_FRAME_POINTER5151+ while (valid_stack_ptr(tinfo, (void *)ebp)) {5252+ addr = *(unsigned long *)(ebp + 4);5353+ printk("%08lx: [<%08lx>]", ebp + 4, addr);5454+ print_symbol(" %s", addr);5555+ printk("\n");5656+ ebp = *(unsigned long *)ebp;5757+ }5858+#else5959+ while (valid_stack_ptr(tinfo, stack)) {6060+ addr = *stack;6161+ if (__kernel_text_address(addr)) {6262+ printk("%08lx: [<%08lx>]", (unsigned long) stack, addr);6363+ print_symbol(" %s", addr);6464+ printk("\n");6565+ }6666+ stack++;6767+ }6868+#endif6969+ return ebp;7070+}7171+7272+void show_trace(struct task_struct* task, unsigned long * stack)7373+{7474+ unsigned long ebp;7575+ struct thread_info *context;7676+7777+ /* Turn this into BUG_ON if possible. */7878+ if (!stack) {7979+ stack = (unsigned long*) &stack;8080+ printk("show_trace: got NULL stack, implicit assumption task == current");8181+ WARN_ON(1);8282+ }8383+8484+ if (!task)8585+ task = current;8686+8787+ if (task != current) {8888+ //ebp = (unsigned long) KSTK_EBP(task);8989+ /* Which one? No actual difference - just coding style.*/9090+ ebp = (unsigned long) PT_REGS_EBP(&task->thread.regs);9191+ } else {9292+ asm ("movl %%ebp, %0" : "=r" (ebp) : );9393+ }9494+9595+ context = (struct thread_info *)9696+ ((unsigned long)stack & (~(THREAD_SIZE - 1)));9797+ print_context_stack(context, stack, ebp);9898+9999+ /*while (((long) stack & (THREAD_SIZE-1)) != 0) {100100+ addr = *stack;101101+ if (__kernel_text_address(addr)) {102102+ printk("%08lx: [<%08lx>]", (unsigned long) stack, addr);103103+ print_symbol(" %s", addr);104104+ printk("\n");105105+ }106106+ stack++;107107+ }*/108108+ printk("\n");109109+}110110+
+1-13
arch/um/sys-ppc/sysrq.c
···2727 0xffff & regs->xds, 0xffff & regs->xes);2828#endif29293030- show_trace(®s->gpr[1]);3030+ show_trace(current, ®s->gpr[1]);3131}3232-3333-3434-/*3535- * Overrides for Emacs so that we follow Linus's tabbing style.3636- * Emacs will notice this stuff at the end of the file and automatically3737- * adjust the settings for this buffer only. This must remain at the end3838- * of the file.3939- * ---------------------------------------------------------------------------4040- * Local variables:4141- * c-file-style: "linux"4242- * End:4343- */
+10-6
arch/um/sys-x86_64/syscalls.c
···133133134134#ifdef CONFIG_MODE_SKAS135135136136+/* XXX: Must also call arch_prctl in the host, beside saving the segment bases! */136137static long arch_prctl_skas(int code, unsigned long addr)137138{138139 long ret = 0;139140140141 switch(code){141141- case ARCH_SET_GS:142142- current->thread.regs.regs.skas.regs[GS_BASE / sizeof(unsigned long)] = addr;143143- break;144142 case ARCH_SET_FS:145143 current->thread.regs.regs.skas.regs[FS_BASE / sizeof(unsigned long)] = addr;146144 break;145145+ case ARCH_SET_GS:146146+ current->thread.regs.regs.skas.regs[GS_BASE / sizeof(unsigned long)] = addr;147147+ break;147148 case ARCH_GET_FS:148148- ret = put_user(current->thread.regs.regs.skas.regs[GS / sizeof(unsigned long)], &addr);149149+ ret = put_user(current->thread.regs.regs.skas.150150+ regs[FS_BASE / sizeof(unsigned long)],151151+ (unsigned long __user *)addr);149152 break;150153 case ARCH_GET_GS:151151- ret = put_user(current->thread.regs.regs.skas.regs[FS / sizeof(unsigned \152152-long)], &addr);154154+ ret = put_user(current->thread.regs.regs.skas.155155+ regs[GS_BASE / sizeof(unsigned long)],156156+ (unsigned long __user *)addr);153157 break;154158 default:155159 ret = -EINVAL;
+1-10
arch/um/sys-x86_64/sysrq.c
···3636void show_regs(struct pt_regs *regs)3737{3838 __show_regs(regs);3939- show_trace((unsigned long *) ®s);3939+ show_trace(current, (unsigned long *) ®s);4040}4141-4242-/* Emacs will notice this stuff at the end of the file and automatically4343- * adjust the settings for this buffer only. This must remain at the end4444- * of the file.4545- * ---------------------------------------------------------------------------4646- * Local variables:4747- * c-file-style: "linux"4848- * End:4949- */
+1
arch/x86_64/Kconfig
···305305306306config X86_PM_TIMER307307 bool "PM timer"308308+ depends on ACPI308309 default y309310 help310311 Support the ACPI PM timer for time keeping. This is slow,
···3030#include <asm/pgalloc.h>3131#include <asm/io_apic.h>3232#include <asm/proto.h>3333+#include <asm/acpi.h>33343435/* Have we found an MP table */3536int smp_found_config;
···4646 This will show detail CPU frequency translation table in sysfs file4747 system48484949+# Note that it is not currently possible to set the other governors (such as ondemand)5050+# as the default, since if they fail to initialise, cpufreq will be5151+# left in an undefined state.5252+4953choice5054 prompt "Default CPUFreq governor"5155 default CPU_FREQ_DEFAULT_GOV_USERSPACE if CPU_FREQ_SA1100 || CPU_FREQ_SA1110···114110 The support for this governor depends on CPU capability to115111 do fast frequency switching (i.e, very low latency frequency116112 transitions). 113113+114114+ For details, take a look at linux/Documentation/cpu-freq.115115+116116+ If in doubt, say N.117117+118118+config CPU_FREQ_GOV_CONSERVATIVE119119+ tristate "'conservative' cpufreq governor"120120+ depends on CPU_FREQ121121+ help122122+ 'conservative' - this driver is rather similar to the 'ondemand'123123+ governor both in its source code and its purpose, the difference is124124+ its optimisation for better suitability in a battery powered125125+ environment. The frequency is gracefully increased and decreased126126+ rather than jumping to 100% when speed is required.127127+128128+ If you have a desktop machine then you should really be considering129129+ the 'ondemand' governor instead, however if you are using a laptop,130130+ PDA or even an AMD64 based computer (due to the unacceptable131131+ step-by-step latency issues between the minimum and maximum frequency132132+ transitions in the CPU) you will probably want to use this governor.117133118134 For details, take a look at linux/Documentation/cpu-freq.119135
···258258 (likely(cpufreq_cpu_data[freqs->cpu]->cur)) &&259259 (unlikely(freqs->old != cpufreq_cpu_data[freqs->cpu]->cur)))260260 {261261- printk(KERN_WARNING "Warning: CPU frequency is %u, "261261+ dprintk(KERN_WARNING "Warning: CPU frequency is %u, "262262 "cpufreq assumed %u kHz.\n", freqs->old, cpufreq_cpu_data[freqs->cpu]->cur);263263 freqs->old = cpufreq_cpu_data[freqs->cpu]->cur;264264 }···814814{815815 struct cpufreq_freqs freqs;816816817817- printk(KERN_WARNING "Warning: CPU frequency out of sync: cpufreq and timing "817817+ dprintk(KERN_WARNING "Warning: CPU frequency out of sync: cpufreq and timing "818818 "core thinks of %u, is %u kHz.\n", old_freq, new_freq);819819820820 freqs.cpu = cpu;···923923 struct cpufreq_freqs freqs;924924925925 if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN))926926- printk(KERN_DEBUG "Warning: CPU frequency is %u, "926926+ dprintk(KERN_DEBUG "Warning: CPU frequency is %u, "927927 "cpufreq assumed %u kHz.\n",928928 cur_freq, cpu_policy->cur);929929···10041004 struct cpufreq_freqs freqs;1005100510061006 if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN))10071007- printk(KERN_WARNING "Warning: CPU frequency"10071007+ dprintk(KERN_WARNING "Warning: CPU frequency"10081008 "is %u, cpufreq assumed %u kHz.\n",10091009 cur_freq, cpu_policy->cur);10101010
+586
drivers/cpufreq/cpufreq_conservative.c
···11+/*22+ * drivers/cpufreq/cpufreq_conservative.c33+ *44+ * Copyright (C) 2001 Russell King55+ * (C) 2003 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>.66+ * Jun Nakajima <jun.nakajima@intel.com>77+ * (C) 2004 Alexander Clouter <alex-kernel@digriz.org.uk>88+ *99+ * This program is free software; you can redistribute it and/or modify1010+ * it under the terms of the GNU General Public License version 2 as1111+ * published by the Free Software Foundation.1212+ */1313+1414+#include <linux/kernel.h>1515+#include <linux/module.h>1616+#include <linux/smp.h>1717+#include <linux/init.h>1818+#include <linux/interrupt.h>1919+#include <linux/ctype.h>2020+#include <linux/cpufreq.h>2121+#include <linux/sysctl.h>2222+#include <linux/types.h>2323+#include <linux/fs.h>2424+#include <linux/sysfs.h>2525+#include <linux/sched.h>2626+#include <linux/kmod.h>2727+#include <linux/workqueue.h>2828+#include <linux/jiffies.h>2929+#include <linux/kernel_stat.h>3030+#include <linux/percpu.h>3131+3232+/*3333+ * dbs is used in this file as a shortform for demandbased switching3434+ * It helps to keep variable names smaller, simpler3535+ */3636+3737+#define DEF_FREQUENCY_UP_THRESHOLD (80)3838+#define MIN_FREQUENCY_UP_THRESHOLD (0)3939+#define MAX_FREQUENCY_UP_THRESHOLD (100)4040+4141+#define DEF_FREQUENCY_DOWN_THRESHOLD (20)4242+#define MIN_FREQUENCY_DOWN_THRESHOLD (0)4343+#define MAX_FREQUENCY_DOWN_THRESHOLD (100)4444+4545+/* 4646+ * The polling frequency of this governor depends on the capability of 4747+ * the processor. Default polling frequency is 1000 times the transition4848+ * latency of the processor. The governor will work on any processor with 4949+ * transition latency <= 10mS, using appropriate sampling 5050+ * rate.5151+ * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL)5252+ * this governor will not work.5353+ * All times here are in uS.5454+ */5555+static unsigned int def_sampling_rate;5656+#define MIN_SAMPLING_RATE (def_sampling_rate / 2)5757+#define MAX_SAMPLING_RATE (500 * def_sampling_rate)5858+#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (100000)5959+#define DEF_SAMPLING_DOWN_FACTOR (5)6060+#define TRANSITION_LATENCY_LIMIT (10 * 1000)6161+6262+static void do_dbs_timer(void *data);6363+6464+struct cpu_dbs_info_s {6565+ struct cpufreq_policy *cur_policy;6666+ unsigned int prev_cpu_idle_up;6767+ unsigned int prev_cpu_idle_down;6868+ unsigned int enable;6969+};7070+static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info);7171+7272+static unsigned int dbs_enable; /* number of CPUs using this policy */7373+7474+static DECLARE_MUTEX (dbs_sem);7575+static DECLARE_WORK (dbs_work, do_dbs_timer, NULL);7676+7777+struct dbs_tuners {7878+ unsigned int sampling_rate;7979+ unsigned int sampling_down_factor;8080+ unsigned int up_threshold;8181+ unsigned int down_threshold;8282+ unsigned int ignore_nice;8383+ unsigned int freq_step;8484+};8585+8686+static struct dbs_tuners dbs_tuners_ins = {8787+ .up_threshold = DEF_FREQUENCY_UP_THRESHOLD,8888+ .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD,8989+ .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR,9090+};9191+9292+static inline unsigned int get_cpu_idle_time(unsigned int cpu)9393+{9494+ return kstat_cpu(cpu).cpustat.idle +9595+ kstat_cpu(cpu).cpustat.iowait +9696+ ( !dbs_tuners_ins.ignore_nice ? 9797+ kstat_cpu(cpu).cpustat.nice :9898+ 0);9999+}100100+101101+/************************** sysfs interface ************************/102102+static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)103103+{104104+ return sprintf (buf, "%u\n", MAX_SAMPLING_RATE);105105+}106106+107107+static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)108108+{109109+ return sprintf (buf, "%u\n", MIN_SAMPLING_RATE);110110+}111111+112112+#define define_one_ro(_name) \113113+static struct freq_attr _name = \114114+__ATTR(_name, 0444, show_##_name, NULL)115115+116116+define_one_ro(sampling_rate_max);117117+define_one_ro(sampling_rate_min);118118+119119+/* cpufreq_conservative Governor Tunables */120120+#define show_one(file_name, object) \121121+static ssize_t show_##file_name \122122+(struct cpufreq_policy *unused, char *buf) \123123+{ \124124+ return sprintf(buf, "%u\n", dbs_tuners_ins.object); \125125+}126126+show_one(sampling_rate, sampling_rate);127127+show_one(sampling_down_factor, sampling_down_factor);128128+show_one(up_threshold, up_threshold);129129+show_one(down_threshold, down_threshold);130130+show_one(ignore_nice, ignore_nice);131131+show_one(freq_step, freq_step);132132+133133+static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, 134134+ const char *buf, size_t count)135135+{136136+ unsigned int input;137137+ int ret;138138+ ret = sscanf (buf, "%u", &input);139139+ if (ret != 1 )140140+ return -EINVAL;141141+142142+ down(&dbs_sem);143143+ dbs_tuners_ins.sampling_down_factor = input;144144+ up(&dbs_sem);145145+146146+ return count;147147+}148148+149149+static ssize_t store_sampling_rate(struct cpufreq_policy *unused, 150150+ const char *buf, size_t count)151151+{152152+ unsigned int input;153153+ int ret;154154+ ret = sscanf (buf, "%u", &input);155155+156156+ down(&dbs_sem);157157+ if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) {158158+ up(&dbs_sem);159159+ return -EINVAL;160160+ }161161+162162+ dbs_tuners_ins.sampling_rate = input;163163+ up(&dbs_sem);164164+165165+ return count;166166+}167167+168168+static ssize_t store_up_threshold(struct cpufreq_policy *unused, 169169+ const char *buf, size_t count)170170+{171171+ unsigned int input;172172+ int ret;173173+ ret = sscanf (buf, "%u", &input);174174+175175+ down(&dbs_sem);176176+ if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || 177177+ input < MIN_FREQUENCY_UP_THRESHOLD ||178178+ input <= dbs_tuners_ins.down_threshold) {179179+ up(&dbs_sem);180180+ return -EINVAL;181181+ }182182+183183+ dbs_tuners_ins.up_threshold = input;184184+ up(&dbs_sem);185185+186186+ return count;187187+}188188+189189+static ssize_t store_down_threshold(struct cpufreq_policy *unused, 190190+ const char *buf, size_t count)191191+{192192+ unsigned int input;193193+ int ret;194194+ ret = sscanf (buf, "%u", &input);195195+196196+ down(&dbs_sem);197197+ if (ret != 1 || input > MAX_FREQUENCY_DOWN_THRESHOLD || 198198+ input < MIN_FREQUENCY_DOWN_THRESHOLD ||199199+ input >= dbs_tuners_ins.up_threshold) {200200+ up(&dbs_sem);201201+ return -EINVAL;202202+ }203203+204204+ dbs_tuners_ins.down_threshold = input;205205+ up(&dbs_sem);206206+207207+ return count;208208+}209209+210210+static ssize_t store_ignore_nice(struct cpufreq_policy *policy,211211+ const char *buf, size_t count)212212+{213213+ unsigned int input;214214+ int ret;215215+216216+ unsigned int j;217217+218218+ ret = sscanf (buf, "%u", &input);219219+ if ( ret != 1 )220220+ return -EINVAL;221221+222222+ if ( input > 1 )223223+ input = 1;224224+225225+ down(&dbs_sem);226226+ if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */227227+ up(&dbs_sem);228228+ return count;229229+ }230230+ dbs_tuners_ins.ignore_nice = input;231231+232232+ /* we need to re-evaluate prev_cpu_idle_up and prev_cpu_idle_down */233233+ for_each_online_cpu(j) {234234+ struct cpu_dbs_info_s *j_dbs_info;235235+ j_dbs_info = &per_cpu(cpu_dbs_info, j);236236+ j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j);237237+ j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up;238238+ }239239+ up(&dbs_sem);240240+241241+ return count;242242+}243243+244244+static ssize_t store_freq_step(struct cpufreq_policy *policy,245245+ const char *buf, size_t count)246246+{247247+ unsigned int input;248248+ int ret;249249+250250+ ret = sscanf (buf, "%u", &input);251251+252252+ if ( ret != 1 )253253+ return -EINVAL;254254+255255+ if ( input > 100 )256256+ input = 100;257257+258258+ /* no need to test here if freq_step is zero as the user might actually259259+ * want this, they would be crazy though :) */260260+ down(&dbs_sem);261261+ dbs_tuners_ins.freq_step = input;262262+ up(&dbs_sem);263263+264264+ return count;265265+}266266+267267+#define define_one_rw(_name) \268268+static struct freq_attr _name = \269269+__ATTR(_name, 0644, show_##_name, store_##_name)270270+271271+define_one_rw(sampling_rate);272272+define_one_rw(sampling_down_factor);273273+define_one_rw(up_threshold);274274+define_one_rw(down_threshold);275275+define_one_rw(ignore_nice);276276+define_one_rw(freq_step);277277+278278+static struct attribute * dbs_attributes[] = {279279+ &sampling_rate_max.attr,280280+ &sampling_rate_min.attr,281281+ &sampling_rate.attr,282282+ &sampling_down_factor.attr,283283+ &up_threshold.attr,284284+ &down_threshold.attr,285285+ &ignore_nice.attr,286286+ &freq_step.attr,287287+ NULL288288+};289289+290290+static struct attribute_group dbs_attr_group = {291291+ .attrs = dbs_attributes,292292+ .name = "conservative",293293+};294294+295295+/************************** sysfs end ************************/296296+297297+static void dbs_check_cpu(int cpu)298298+{299299+ unsigned int idle_ticks, up_idle_ticks, down_idle_ticks;300300+ unsigned int freq_step;301301+ unsigned int freq_down_sampling_rate;302302+ static int down_skip[NR_CPUS];303303+ static int requested_freq[NR_CPUS];304304+ static unsigned short init_flag = 0;305305+ struct cpu_dbs_info_s *this_dbs_info;306306+ struct cpu_dbs_info_s *dbs_info;307307+308308+ struct cpufreq_policy *policy;309309+ unsigned int j;310310+311311+ this_dbs_info = &per_cpu(cpu_dbs_info, cpu);312312+ if (!this_dbs_info->enable)313313+ return;314314+315315+ policy = this_dbs_info->cur_policy;316316+317317+ if ( init_flag == 0 ) {318318+ for ( /* NULL */; init_flag < NR_CPUS; init_flag++ ) {319319+ dbs_info = &per_cpu(cpu_dbs_info, init_flag);320320+ requested_freq[cpu] = dbs_info->cur_policy->cur;321321+ }322322+ init_flag = 1;323323+ }324324+325325+ /* 326326+ * The default safe range is 20% to 80% 327327+ * Every sampling_rate, we check328328+ * - If current idle time is less than 20%, then we try to 329329+ * increase frequency330330+ * Every sampling_rate*sampling_down_factor, we check331331+ * - If current idle time is more than 80%, then we try to332332+ * decrease frequency333333+ *334334+ * Any frequency increase takes it to the maximum frequency. 335335+ * Frequency reduction happens at minimum steps of 336336+ * 5% (default) of max_frequency 337337+ */338338+339339+ /* Check for frequency increase */340340+341341+ idle_ticks = UINT_MAX;342342+ for_each_cpu_mask(j, policy->cpus) {343343+ unsigned int tmp_idle_ticks, total_idle_ticks;344344+ struct cpu_dbs_info_s *j_dbs_info;345345+346346+ j_dbs_info = &per_cpu(cpu_dbs_info, j);347347+ /* Check for frequency increase */348348+ total_idle_ticks = get_cpu_idle_time(j);349349+ tmp_idle_ticks = total_idle_ticks -350350+ j_dbs_info->prev_cpu_idle_up;351351+ j_dbs_info->prev_cpu_idle_up = total_idle_ticks;352352+353353+ if (tmp_idle_ticks < idle_ticks)354354+ idle_ticks = tmp_idle_ticks;355355+ }356356+357357+ /* Scale idle ticks by 100 and compare with up and down ticks */358358+ idle_ticks *= 100;359359+ up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) *360360+ usecs_to_jiffies(dbs_tuners_ins.sampling_rate);361361+362362+ if (idle_ticks < up_idle_ticks) {363363+ down_skip[cpu] = 0;364364+ for_each_cpu_mask(j, policy->cpus) {365365+ struct cpu_dbs_info_s *j_dbs_info;366366+367367+ j_dbs_info = &per_cpu(cpu_dbs_info, j);368368+ j_dbs_info->prev_cpu_idle_down = 369369+ j_dbs_info->prev_cpu_idle_up;370370+ }371371+ /* if we are already at full speed then break out early */372372+ if (requested_freq[cpu] == policy->max)373373+ return;374374+375375+ freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100;376376+377377+ /* max freq cannot be less than 100. But who knows.... */378378+ if (unlikely(freq_step == 0))379379+ freq_step = 5;380380+381381+ requested_freq[cpu] += freq_step;382382+ if (requested_freq[cpu] > policy->max)383383+ requested_freq[cpu] = policy->max;384384+385385+ __cpufreq_driver_target(policy, requested_freq[cpu], 386386+ CPUFREQ_RELATION_H);387387+ return;388388+ }389389+390390+ /* Check for frequency decrease */391391+ down_skip[cpu]++;392392+ if (down_skip[cpu] < dbs_tuners_ins.sampling_down_factor)393393+ return;394394+395395+ idle_ticks = UINT_MAX;396396+ for_each_cpu_mask(j, policy->cpus) {397397+ unsigned int tmp_idle_ticks, total_idle_ticks;398398+ struct cpu_dbs_info_s *j_dbs_info;399399+400400+ j_dbs_info = &per_cpu(cpu_dbs_info, j);401401+ total_idle_ticks = j_dbs_info->prev_cpu_idle_up;402402+ tmp_idle_ticks = total_idle_ticks -403403+ j_dbs_info->prev_cpu_idle_down;404404+ j_dbs_info->prev_cpu_idle_down = total_idle_ticks;405405+406406+ if (tmp_idle_ticks < idle_ticks)407407+ idle_ticks = tmp_idle_ticks;408408+ }409409+410410+ /* Scale idle ticks by 100 and compare with up and down ticks */411411+ idle_ticks *= 100;412412+ down_skip[cpu] = 0;413413+414414+ freq_down_sampling_rate = dbs_tuners_ins.sampling_rate *415415+ dbs_tuners_ins.sampling_down_factor;416416+ down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *417417+ usecs_to_jiffies(freq_down_sampling_rate);418418+419419+ if (idle_ticks > down_idle_ticks) {420420+ /* if we are already at the lowest speed then break out early421421+ * or if we 'cannot' reduce the speed as the user might want422422+ * freq_step to be zero */423423+ if (requested_freq[cpu] == policy->min424424+ || dbs_tuners_ins.freq_step == 0)425425+ return;426426+427427+ freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100;428428+429429+ /* max freq cannot be less than 100. But who knows.... */430430+ if (unlikely(freq_step == 0))431431+ freq_step = 5;432432+433433+ requested_freq[cpu] -= freq_step;434434+ if (requested_freq[cpu] < policy->min)435435+ requested_freq[cpu] = policy->min;436436+437437+ __cpufreq_driver_target(policy,438438+ requested_freq[cpu],439439+ CPUFREQ_RELATION_H);440440+ return;441441+ }442442+}443443+444444+static void do_dbs_timer(void *data)445445+{ 446446+ int i;447447+ down(&dbs_sem);448448+ for_each_online_cpu(i)449449+ dbs_check_cpu(i);450450+ schedule_delayed_work(&dbs_work, 451451+ usecs_to_jiffies(dbs_tuners_ins.sampling_rate));452452+ up(&dbs_sem);453453+} 454454+455455+static inline void dbs_timer_init(void)456456+{457457+ INIT_WORK(&dbs_work, do_dbs_timer, NULL);458458+ schedule_delayed_work(&dbs_work,459459+ usecs_to_jiffies(dbs_tuners_ins.sampling_rate));460460+ return;461461+}462462+463463+static inline void dbs_timer_exit(void)464464+{465465+ cancel_delayed_work(&dbs_work);466466+ return;467467+}468468+469469+static int cpufreq_governor_dbs(struct cpufreq_policy *policy,470470+ unsigned int event)471471+{472472+ unsigned int cpu = policy->cpu;473473+ struct cpu_dbs_info_s *this_dbs_info;474474+ unsigned int j;475475+476476+ this_dbs_info = &per_cpu(cpu_dbs_info, cpu);477477+478478+ switch (event) {479479+ case CPUFREQ_GOV_START:480480+ if ((!cpu_online(cpu)) || 481481+ (!policy->cur))482482+ return -EINVAL;483483+484484+ if (policy->cpuinfo.transition_latency >485485+ (TRANSITION_LATENCY_LIMIT * 1000))486486+ return -EINVAL;487487+ if (this_dbs_info->enable) /* Already enabled */488488+ break;489489+490490+ down(&dbs_sem);491491+ for_each_cpu_mask(j, policy->cpus) {492492+ struct cpu_dbs_info_s *j_dbs_info;493493+ j_dbs_info = &per_cpu(cpu_dbs_info, j);494494+ j_dbs_info->cur_policy = policy;495495+496496+ j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j);497497+ j_dbs_info->prev_cpu_idle_down498498+ = j_dbs_info->prev_cpu_idle_up;499499+ }500500+ this_dbs_info->enable = 1;501501+ sysfs_create_group(&policy->kobj, &dbs_attr_group);502502+ dbs_enable++;503503+ /*504504+ * Start the timerschedule work, when this governor505505+ * is used for first time506506+ */507507+ if (dbs_enable == 1) {508508+ unsigned int latency;509509+ /* policy latency is in nS. Convert it to uS first */510510+511511+ latency = policy->cpuinfo.transition_latency;512512+ if (latency < 1000)513513+ latency = 1000;514514+515515+ def_sampling_rate = (latency / 1000) *516516+ DEF_SAMPLING_RATE_LATENCY_MULTIPLIER;517517+ dbs_tuners_ins.sampling_rate = def_sampling_rate;518518+ dbs_tuners_ins.ignore_nice = 0;519519+ dbs_tuners_ins.freq_step = 5;520520+521521+ dbs_timer_init();522522+ }523523+524524+ up(&dbs_sem);525525+ break;526526+527527+ case CPUFREQ_GOV_STOP:528528+ down(&dbs_sem);529529+ this_dbs_info->enable = 0;530530+ sysfs_remove_group(&policy->kobj, &dbs_attr_group);531531+ dbs_enable--;532532+ /*533533+ * Stop the timerschedule work, when this governor534534+ * is used for first time535535+ */536536+ if (dbs_enable == 0) 537537+ dbs_timer_exit();538538+539539+ up(&dbs_sem);540540+541541+ break;542542+543543+ case CPUFREQ_GOV_LIMITS:544544+ down(&dbs_sem);545545+ if (policy->max < this_dbs_info->cur_policy->cur)546546+ __cpufreq_driver_target(547547+ this_dbs_info->cur_policy,548548+ policy->max, CPUFREQ_RELATION_H);549549+ else if (policy->min > this_dbs_info->cur_policy->cur)550550+ __cpufreq_driver_target(551551+ this_dbs_info->cur_policy,552552+ policy->min, CPUFREQ_RELATION_L);553553+ up(&dbs_sem);554554+ break;555555+ }556556+ return 0;557557+}558558+559559+static struct cpufreq_governor cpufreq_gov_dbs = {560560+ .name = "conservative",561561+ .governor = cpufreq_governor_dbs,562562+ .owner = THIS_MODULE,563563+};564564+565565+static int __init cpufreq_gov_dbs_init(void)566566+{567567+ return cpufreq_register_governor(&cpufreq_gov_dbs);568568+}569569+570570+static void __exit cpufreq_gov_dbs_exit(void)571571+{572572+ /* Make sure that the scheduled work is indeed not running */573573+ flush_scheduled_work();574574+575575+ cpufreq_unregister_governor(&cpufreq_gov_dbs);576576+}577577+578578+579579+MODULE_AUTHOR ("Alexander Clouter <alex-kernel@digriz.org.uk>");580580+MODULE_DESCRIPTION ("'cpufreq_conservative' - A dynamic cpufreq governor for "581581+ "Low Latency Frequency Transition capable processors "582582+ "optimised for use in a battery environment");583583+MODULE_LICENSE ("GPL");584584+585585+module_init(cpufreq_gov_dbs_init);586586+module_exit(cpufreq_gov_dbs_exit);
+94-92
drivers/cpufreq/cpufreq_ondemand.c
···3434 */35353636#define DEF_FREQUENCY_UP_THRESHOLD (80)3737-#define MIN_FREQUENCY_UP_THRESHOLD (0)3737+#define MIN_FREQUENCY_UP_THRESHOLD (11)3838#define MAX_FREQUENCY_UP_THRESHOLD (100)3939-4040-#define DEF_FREQUENCY_DOWN_THRESHOLD (20)4141-#define MIN_FREQUENCY_DOWN_THRESHOLD (0)4242-#define MAX_FREQUENCY_DOWN_THRESHOLD (100)43394440/* 4541 * The polling frequency of this governor depends on the capability of ···5155#define MIN_SAMPLING_RATE (def_sampling_rate / 2)5256#define MAX_SAMPLING_RATE (500 * def_sampling_rate)5357#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000)5454-#define DEF_SAMPLING_DOWN_FACTOR (10)5858+#define DEF_SAMPLING_DOWN_FACTOR (1)5959+#define MAX_SAMPLING_DOWN_FACTOR (10)5560#define TRANSITION_LATENCY_LIMIT (10 * 1000)5656-#define sampling_rate_in_HZ(x) (((x * HZ) < (1000 * 1000))?1:((x * HZ) / (1000 * 1000)))57615862static void do_dbs_timer(void *data);5963···7478 unsigned int sampling_rate;7579 unsigned int sampling_down_factor;7680 unsigned int up_threshold;7777- unsigned int down_threshold;8181+ unsigned int ignore_nice;7882};79838084static struct dbs_tuners dbs_tuners_ins = {8185 .up_threshold = DEF_FREQUENCY_UP_THRESHOLD,8282- .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD,8386 .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR,8487};8888+8989+static inline unsigned int get_cpu_idle_time(unsigned int cpu)9090+{9191+ return kstat_cpu(cpu).cpustat.idle +9292+ kstat_cpu(cpu).cpustat.iowait +9393+ ( !dbs_tuners_ins.ignore_nice ? 9494+ kstat_cpu(cpu).cpustat.nice :9595+ 0);9696+}85978698/************************** sysfs interface ************************/8799static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)···119115show_one(sampling_rate, sampling_rate);120116show_one(sampling_down_factor, sampling_down_factor);121117show_one(up_threshold, up_threshold);122122-show_one(down_threshold, down_threshold);118118+show_one(ignore_nice, ignore_nice);123119124120static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, 125121 const char *buf, size_t count)···128124 int ret;129125 ret = sscanf (buf, "%u", &input);130126 if (ret != 1 )127127+ return -EINVAL;128128+129129+ if (input > MAX_SAMPLING_DOWN_FACTOR || input < 1)131130 return -EINVAL;132131133132 down(&dbs_sem);···168161169162 down(&dbs_sem);170163 if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || 171171- input < MIN_FREQUENCY_UP_THRESHOLD ||172172- input <= dbs_tuners_ins.down_threshold) {164164+ input < MIN_FREQUENCY_UP_THRESHOLD) {173165 up(&dbs_sem);174166 return -EINVAL;175167 }···179173 return count;180174}181175182182-static ssize_t store_down_threshold(struct cpufreq_policy *unused, 176176+static ssize_t store_ignore_nice(struct cpufreq_policy *policy,183177 const char *buf, size_t count)184178{185179 unsigned int input;186180 int ret;181181+182182+ unsigned int j;183183+187184 ret = sscanf (buf, "%u", &input);188188-189189- down(&dbs_sem);190190- if (ret != 1 || input > MAX_FREQUENCY_DOWN_THRESHOLD || 191191- input < MIN_FREQUENCY_DOWN_THRESHOLD ||192192- input >= dbs_tuners_ins.up_threshold) {193193- up(&dbs_sem);185185+ if ( ret != 1 )194186 return -EINVAL;195195- }196187197197- dbs_tuners_ins.down_threshold = input;188188+ if ( input > 1 )189189+ input = 1;190190+191191+ down(&dbs_sem);192192+ if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */193193+ up(&dbs_sem);194194+ return count;195195+ }196196+ dbs_tuners_ins.ignore_nice = input;197197+198198+ /* we need to re-evaluate prev_cpu_idle_up and prev_cpu_idle_down */199199+ for_each_online_cpu(j) {200200+ struct cpu_dbs_info_s *j_dbs_info;201201+ j_dbs_info = &per_cpu(cpu_dbs_info, j);202202+ j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j);203203+ j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up;204204+ }198205 up(&dbs_sem);199206200207 return count;···220201define_one_rw(sampling_rate);221202define_one_rw(sampling_down_factor);222203define_one_rw(up_threshold);223223-define_one_rw(down_threshold);204204+define_one_rw(ignore_nice);224205225206static struct attribute * dbs_attributes[] = {226207 &sampling_rate_max.attr,···228209 &sampling_rate.attr,229210 &sampling_down_factor.attr,230211 &up_threshold.attr,231231- &down_threshold.attr,212212+ &ignore_nice.attr,232213 NULL233214};234215···241222242223static void dbs_check_cpu(int cpu)243224{244244- unsigned int idle_ticks, up_idle_ticks, down_idle_ticks;245245- unsigned int total_idle_ticks;246246- unsigned int freq_down_step;225225+ unsigned int idle_ticks, up_idle_ticks, total_ticks;226226+ unsigned int freq_next;247227 unsigned int freq_down_sampling_rate;248228 static int down_skip[NR_CPUS];249229 struct cpu_dbs_info_s *this_dbs_info;···256238257239 policy = this_dbs_info->cur_policy;258240 /* 259259- * The default safe range is 20% to 80% 260260- * Every sampling_rate, we check261261- * - If current idle time is less than 20%, then we try to 262262- * increase frequency263263- * Every sampling_rate*sampling_down_factor, we check264264- * - If current idle time is more than 80%, then we try to265265- * decrease frequency241241+ * Every sampling_rate, we check, if current idle time is less242242+ * than 20% (default), then we try to increase frequency243243+ * Every sampling_rate*sampling_down_factor, we look for a the lowest244244+ * frequency which can sustain the load while keeping idle time over245245+ * 30%. If such a frequency exist, we try to decrease to this frequency.266246 *267247 * Any frequency increase takes it to the maximum frequency. 268248 * Frequency reduction happens at minimum steps of 269269- * 5% of max_frequency 249249+ * 5% (default) of current frequency 270250 */271251272252 /* Check for frequency increase */273273- total_idle_ticks = kstat_cpu(cpu).cpustat.idle +274274- kstat_cpu(cpu).cpustat.iowait;275275- idle_ticks = total_idle_ticks -276276- this_dbs_info->prev_cpu_idle_up;277277- this_dbs_info->prev_cpu_idle_up = total_idle_ticks;278278-279279-253253+ idle_ticks = UINT_MAX;280254 for_each_cpu_mask(j, policy->cpus) {281281- unsigned int tmp_idle_ticks;255255+ unsigned int tmp_idle_ticks, total_idle_ticks;282256 struct cpu_dbs_info_s *j_dbs_info;283257284284- if (j == cpu)285285- continue;286286-287258 j_dbs_info = &per_cpu(cpu_dbs_info, j);288288- /* Check for frequency increase */289289- total_idle_ticks = kstat_cpu(j).cpustat.idle +290290- kstat_cpu(j).cpustat.iowait;259259+ total_idle_ticks = get_cpu_idle_time(j);291260 tmp_idle_ticks = total_idle_ticks -292261 j_dbs_info->prev_cpu_idle_up;293262 j_dbs_info->prev_cpu_idle_up = total_idle_ticks;···286281 /* Scale idle ticks by 100 and compare with up and down ticks */287282 idle_ticks *= 100;288283 up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) *289289- sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate);284284+ usecs_to_jiffies(dbs_tuners_ins.sampling_rate);290285291286 if (idle_ticks < up_idle_ticks) {287287+ down_skip[cpu] = 0;288288+ for_each_cpu_mask(j, policy->cpus) {289289+ struct cpu_dbs_info_s *j_dbs_info;290290+291291+ j_dbs_info = &per_cpu(cpu_dbs_info, j);292292+ j_dbs_info->prev_cpu_idle_down = 293293+ j_dbs_info->prev_cpu_idle_up;294294+ }295295+ /* if we are already at full speed then break out early */296296+ if (policy->cur == policy->max)297297+ return;298298+292299 __cpufreq_driver_target(policy, policy->max, 293300 CPUFREQ_RELATION_H);294294- down_skip[cpu] = 0;295295- this_dbs_info->prev_cpu_idle_down = total_idle_ticks;296301 return;297302 }298303···311296 if (down_skip[cpu] < dbs_tuners_ins.sampling_down_factor)312297 return;313298314314- total_idle_ticks = kstat_cpu(cpu).cpustat.idle +315315- kstat_cpu(cpu).cpustat.iowait;316316- idle_ticks = total_idle_ticks -317317- this_dbs_info->prev_cpu_idle_down;318318- this_dbs_info->prev_cpu_idle_down = total_idle_ticks;319319-299299+ idle_ticks = UINT_MAX;320300 for_each_cpu_mask(j, policy->cpus) {321321- unsigned int tmp_idle_ticks;301301+ unsigned int tmp_idle_ticks, total_idle_ticks;322302 struct cpu_dbs_info_s *j_dbs_info;323303324324- if (j == cpu)325325- continue;326326-327304 j_dbs_info = &per_cpu(cpu_dbs_info, j);328328- /* Check for frequency increase */329329- total_idle_ticks = kstat_cpu(j).cpustat.idle +330330- kstat_cpu(j).cpustat.iowait;305305+ /* Check for frequency decrease */306306+ total_idle_ticks = j_dbs_info->prev_cpu_idle_up;331307 tmp_idle_ticks = total_idle_ticks -332308 j_dbs_info->prev_cpu_idle_down;333309 j_dbs_info->prev_cpu_idle_down = total_idle_ticks;···327321 idle_ticks = tmp_idle_ticks;328322 }329323330330- /* Scale idle ticks by 100 and compare with up and down ticks */331331- idle_ticks *= 100;332324 down_skip[cpu] = 0;325325+ /* if we cannot reduce the frequency anymore, break out early */326326+ if (policy->cur == policy->min)327327+ return;333328329329+ /* Compute how many ticks there are between two measurements */334330 freq_down_sampling_rate = dbs_tuners_ins.sampling_rate *335331 dbs_tuners_ins.sampling_down_factor;336336- down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) *337337- sampling_rate_in_HZ(freq_down_sampling_rate);332332+ total_ticks = usecs_to_jiffies(freq_down_sampling_rate);338333339339- if (idle_ticks > down_idle_ticks ) {340340- freq_down_step = (5 * policy->max) / 100;334334+ /*335335+ * The optimal frequency is the frequency that is the lowest that336336+ * can support the current CPU usage without triggering the up337337+ * policy. To be safe, we focus 10 points under the threshold.338338+ */339339+ freq_next = ((total_ticks - idle_ticks) * 100) / total_ticks;340340+ freq_next = (freq_next * policy->cur) / 341341+ (dbs_tuners_ins.up_threshold - 10);341342342342- /* max freq cannot be less than 100. But who knows.... */343343- if (unlikely(freq_down_step == 0))344344- freq_down_step = 5;345345-346346- __cpufreq_driver_target(policy,347347- policy->cur - freq_down_step, 348348- CPUFREQ_RELATION_H);349349- return;350350- }343343+ if (freq_next <= ((policy->cur * 95) / 100))344344+ __cpufreq_driver_target(policy, freq_next, CPUFREQ_RELATION_L);351345}352346353347static void do_dbs_timer(void *data)354348{ 355349 int i;356350 down(&dbs_sem);357357- for (i = 0; i < NR_CPUS; i++)358358- if (cpu_online(i))359359- dbs_check_cpu(i);351351+ for_each_online_cpu(i)352352+ dbs_check_cpu(i);360353 schedule_delayed_work(&dbs_work, 361361- sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));354354+ usecs_to_jiffies(dbs_tuners_ins.sampling_rate));362355 up(&dbs_sem);363356} 364357···365360{366361 INIT_WORK(&dbs_work, do_dbs_timer, NULL);367362 schedule_delayed_work(&dbs_work,368368- sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate));363363+ usecs_to_jiffies(dbs_tuners_ins.sampling_rate));369364 return;370365}371366···402397 j_dbs_info = &per_cpu(cpu_dbs_info, j);403398 j_dbs_info->cur_policy = policy;404399405405- j_dbs_info->prev_cpu_idle_up = 406406- kstat_cpu(j).cpustat.idle +407407- kstat_cpu(j).cpustat.iowait;408408- j_dbs_info->prev_cpu_idle_down = 409409- kstat_cpu(j).cpustat.idle +410410- kstat_cpu(j).cpustat.iowait;400400+ j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j);401401+ j_dbs_info->prev_cpu_idle_down402402+ = j_dbs_info->prev_cpu_idle_up;411403 }412404 this_dbs_info->enable = 1;413405 sysfs_create_group(&policy->kobj, &dbs_attr_group);···424422 def_sampling_rate = (latency / 1000) *425423 DEF_SAMPLING_RATE_LATENCY_MULTIPLIER;426424 dbs_tuners_ins.sampling_rate = def_sampling_rate;425425+ dbs_tuners_ins.ignore_nice = 0;427426428427 dbs_timer_init();429428 }···464461 return 0;465462}466463467467-struct cpufreq_governor cpufreq_gov_dbs = {464464+static struct cpufreq_governor cpufreq_gov_dbs = {468465 .name = "ondemand",469466 .governor = cpufreq_governor_dbs,470467 .owner = THIS_MODULE,471468};472472-EXPORT_SYMBOL(cpufreq_gov_dbs);473469474470static int __init cpufreq_gov_dbs_init(void)475471{
+30-17
drivers/cpufreq/cpufreq_stats.c
···1919#include <linux/percpu.h>2020#include <linux/kobject.h>2121#include <linux/spinlock.h>2222+#include <asm/cputime.h>22232324static spinlock_t cpufreq_stats_lock;2425···3029 .show = _show,\3130};32313333-static unsigned long3434-delta_time(unsigned long old, unsigned long new)3535-{3636- return (old > new) ? (old - new): (new + ~old + 1);3737-}3838-3932struct cpufreq_stats {4033 unsigned int cpu;4134 unsigned int total_trans;4242- unsigned long long last_time;3535+ unsigned long long last_time;4336 unsigned int max_state;4437 unsigned int state_num;4538 unsigned int last_index;4646- unsigned long long *time_in_state;3939+ cputime64_t *time_in_state;4740 unsigned int *freq_table;4841#ifdef CONFIG_CPU_FREQ_STAT_DETAILS4942 unsigned int *trans_table;···5560cpufreq_stats_update (unsigned int cpu)5661{5762 struct cpufreq_stats *stat;6363+ unsigned long long cur_time;6464+6565+ cur_time = get_jiffies_64();5866 spin_lock(&cpufreq_stats_lock);5967 stat = cpufreq_stats_table[cpu];6068 if (stat->time_in_state)6161- stat->time_in_state[stat->last_index] +=6262- delta_time(stat->last_time, jiffies);6363- stat->last_time = jiffies;6969+ stat->time_in_state[stat->last_index] =7070+ cputime64_add(stat->time_in_state[stat->last_index],7171+ cputime_sub(cur_time, stat->last_time));7272+ stat->last_time = cur_time;6473 spin_unlock(&cpufreq_stats_lock);6574 return 0;6675}···8990 return 0;9091 cpufreq_stats_update(stat->cpu);9192 for (i = 0; i < stat->state_num; i++) {9292- len += sprintf(buf + len, "%u %llu\n",9393- stat->freq_table[i], stat->time_in_state[i]);9393+ len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i], 9494+ (unsigned long long)cputime64_to_clock_t(stat->time_in_state[i]));9495 }9596 return len;9697}···106107 if(!stat)107108 return 0;108109 cpufreq_stats_update(stat->cpu);110110+ len += snprintf(buf + len, PAGE_SIZE - len, " From : To\n");111111+ len += snprintf(buf + len, PAGE_SIZE - len, " : ");109112 for (i = 0; i < stat->state_num; i++) {110113 if (len >= PAGE_SIZE)111114 break;112112- len += snprintf(buf + len, PAGE_SIZE - len, "%9u:\t",115115+ len += snprintf(buf + len, PAGE_SIZE - len, "%9u ",116116+ stat->freq_table[i]);117117+ }118118+ if (len >= PAGE_SIZE)119119+ return len;120120+121121+ len += snprintf(buf + len, PAGE_SIZE - len, "\n");122122+123123+ for (i = 0; i < stat->state_num; i++) {124124+ if (len >= PAGE_SIZE)125125+ break;126126+127127+ len += snprintf(buf + len, PAGE_SIZE - len, "%9u: ",113128 stat->freq_table[i]);114129115130 for (j = 0; j < stat->state_num; j++) {116131 if (len >= PAGE_SIZE)117132 break;118118- len += snprintf(buf + len, PAGE_SIZE - len, "%u\t",133133+ len += snprintf(buf + len, PAGE_SIZE - len, "%9u ",119134 stat->trans_table[i*stat->max_state+j]);120135 }121136 len += snprintf(buf + len, PAGE_SIZE - len, "\n");···210197 count++;211198 }212199213213- alloc_size = count * sizeof(int) + count * sizeof(long long);200200+ alloc_size = count * sizeof(int) + count * sizeof(cputime64_t);214201215202#ifdef CONFIG_CPU_FREQ_STAT_DETAILS216203 alloc_size += count * count * sizeof(int);···237224 }238225 stat->state_num = j;239226 spin_lock(&cpufreq_stats_lock);240240- stat->last_time = jiffies;227227+ stat->last_time = get_jiffies_64();241228 stat->last_index = freq_table_get_index(stat, policy->cur);242229 spin_unlock(&cpufreq_stats_lock);243230 cpufreq_cpu_put(data);
+1
drivers/firmware/pcdp.c
···1111 * published by the Free Software Foundation.1212 */13131414+#include <linux/config.h>1415#include <linux/acpi.h>1516#include <linux/console.h>1617#include <linux/efi.h>
+31-15
drivers/i2c/busses/i2c-ali1563.c
···22 * i2c-ali1563.c - i2c driver for the ALi 1563 Southbridge33 *44 * Copyright (C) 2004 Patrick Mochel55+ * 2005 Rudolf Marek <r.marek@sh.cvut.cz>56 *67 * The 1563 southbridge is deceptively similar to the 1533, with a78 * few notable exceptions. One of those happens to be the fact they···5857#define HST_CNTL2_BLOCK 0x05595860596060+#define HST_CNTL2_SIZEMASK 0x3861616262static unsigned short ali1563_smba;63636464-static int ali1563_transaction(struct i2c_adapter * a)6464+static int ali1563_transaction(struct i2c_adapter * a, int size)6565{6666 u32 data;6767 int timeout;···75737674 data = inb_p(SMB_HST_STS);7775 if (data & HST_STS_BAD) {7878- dev_warn(&a->dev,"ali1563: Trying to reset busy device\n");7676+ dev_err(&a->dev, "ali1563: Trying to reset busy device\n");7977 outb_p(data | HST_STS_BAD,SMB_HST_STS);8078 data = inb_p(SMB_HST_STS);8179 if (data & HST_STS_BAD)···96949795 if (timeout && !(data & HST_STS_BAD))9896 return 0;9999- dev_warn(&a->dev, "SMBus Error: %s%s%s%s%s\n",100100- timeout ? "Timeout " : "",101101- data & HST_STS_FAIL ? "Transaction Failed " : "",102102- data & HST_STS_BUSERR ? "No response or Bus Collision " : "",103103- data & HST_STS_DEVERR ? "Device Error " : "",104104- !(data & HST_STS_DONE) ? "Transaction Never Finished " : "");10597106106- if (!(data & HST_STS_DONE))9898+ if (!timeout) {9999+ dev_err(&a->dev, "Timeout - Trying to KILL transaction!\n");107100 /* Issue 'kill' to host controller */108101 outb_p(HST_CNTL2_KILL,SMB_HST_CNTL2);109109- else110110- /* Issue timeout to reset all devices on bus */102102+ data = inb_p(SMB_HST_STS);103103+ }104104+105105+ /* device error - no response, ignore the autodetection case */106106+ if ((data & HST_STS_DEVERR) && (size != HST_CNTL2_QUICK)) {107107+ dev_err(&a->dev, "Device error!\n");108108+ }109109+110110+ /* bus collision */111111+ if (data & HST_STS_BUSERR) {112112+ dev_err(&a->dev, "Bus collision!\n");113113+ /* Issue timeout, hoping it helps */111114 outb_p(HST_CNTL1_TIMEOUT,SMB_HST_CNTL1);115115+ }116116+117117+ if (data & HST_STS_FAIL) {118118+ dev_err(&a->dev, "Cleaning fail after KILL!\n");119119+ outb_p(0x0,SMB_HST_CNTL2);120120+ }121121+112122 return -1;113123}114124···163149164150 if (timeout && !(data & HST_STS_BAD))165151 return 0;166166- dev_warn(&a->dev, "SMBus Error: %s%s%s%s%s\n",152152+ dev_err(&a->dev, "SMBus Error: %s%s%s%s%s\n",167153 timeout ? "Timeout " : "",168154 data & HST_STS_FAIL ? "Transaction Failed " : "",169155 data & HST_STS_BUSERR ? "No response or Bus Collision " : "",···256242 }257243258244 outb_p(((addr & 0x7f) << 1) | (rw & 0x01), SMB_HST_ADD);259259- outb_p(inb_p(SMB_HST_CNTL2) | (size << 3), SMB_HST_CNTL2);245245+ outb_p((inb_p(SMB_HST_CNTL2) & ~HST_CNTL2_SIZEMASK) | (size << 3), SMB_HST_CNTL2);260246261247 /* Write the command register */248248+262249 switch(size) {263250 case HST_CNTL2_BYTE:264251 if (rw== I2C_SMBUS_WRITE)265265- outb_p(cmd, SMB_HST_CMD);252252+ /* Beware it uses DAT0 register and not CMD! */253253+ outb_p(cmd, SMB_HST_DAT0);266254 break;267255 case HST_CNTL2_BYTE_DATA:268256 outb_p(cmd, SMB_HST_CMD);···284268 goto Done;285269 }286270287287- if ((error = ali1563_transaction(a)))271271+ if ((error = ali1563_transaction(a, size)))288272 goto Done;289273290274 if ((rw == I2C_SMBUS_WRITE) || (size == HST_CNTL2_QUICK))
+1-1
drivers/ide/ide-cd.c
···19361936 * NOTE! The "len" and "addr" checks should possibly have19371937 * separate masks.19381938 */19391939- if ((rq->data_len & mask) || (addr & mask))19391939+ if ((rq->data_len & 15) || (addr & mask))19401940 info->dma = 0;19411941 }19421942
···6868 depends on PCI69697070endif7171-7272-# Yes, SOUND_GAMEPORT looks a bit odd. Yes, it ends up being turned on7373-# in every .config. Please don't touch it. It is here to handle an7474-# unusual dependency between GAMEPORT and sound drivers.7575-#7676-# Some sound drivers call gameport functions. If GAMEPORT is7777-# not selected, empty stubs are provided for the functions and all is7878-# well.7979-# If GAMEPORT is built in, everything is fine.8080-# If GAMEPORT is a module, however, it would need to be loaded for the8181-# sound driver to be able to link properly. Therefore, the sound8282-# driver must be a module as well in that case. Since there's no way8383-# to express that directly in Kconfig, we use SOUND_GAMEPORT to8484-# express it. SOUND_GAMEPORT boils down to "if GAMEPORT is 'm',8585-# anything that depends on SOUND_GAMEPORT must be 'm' as well. if8686-# GAMEPORT is 'y' or 'n', it can be anything".8787-config SOUND_GAMEPORT8888- tristate8989- default m if GAMEPORT=m9090- default y
+1-1
drivers/input/joydev.c
···422422 joydev->nkey++;423423 }424424425425- for (i = 0; i < BTN_JOYSTICK - BTN_MISC + 1; i++)425425+ for (i = 0; i < BTN_JOYSTICK - BTN_MISC; i++)426426 if (test_bit(i + BTN_MISC, dev->keybit)) {427427 joydev->keymap[i] = joydev->nkey;428428 joydev->keypam[joydev->nkey] = i + BTN_MISC;
···518518/*519519 * First, we check if it's a mouse. It should send 0x00 or 0x03520520 * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer.521521+ * Sunrex K8561 IR Keyboard/Mouse reports 0xff on second and subsequent522522+ * ID queries, probably due to a firmware bug.521523 */522524523525 param[0] = 0xa5;524526 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETID))525527 return -1;526528527527- if (param[0] != 0x00 && param[0] != 0x03 && param[0] != 0x04)529529+ if (param[0] != 0x00 && param[0] != 0x03 &&530530+ param[0] != 0x04 && param[0] != 0xff)528531 return -1;529532530533/*···975972 return -EINVAL;976973977974 if (!strncmp(val, "any", 3)) {978978- *((unsigned int *)kp->arg) = -1UL;975975+ *((unsigned int *)kp->arg) = -1U;979976 return 0;980977 }981978
+5-34
drivers/input/mouse/synaptics.c
···143143 return -1;144144}145145146146-static void print_ident(struct synaptics_data *priv)147147-{148148- printk(KERN_INFO "Synaptics Touchpad, model: %ld\n", SYN_ID_MODEL(priv->identity));149149- printk(KERN_INFO " Firmware: %ld.%ld\n", SYN_ID_MAJOR(priv->identity),150150- SYN_ID_MINOR(priv->identity));151151- if (SYN_MODEL_ROT180(priv->model_id))152152- printk(KERN_INFO " 180 degree mounted touchpad\n");153153- if (SYN_MODEL_PORTRAIT(priv->model_id))154154- printk(KERN_INFO " portrait touchpad\n");155155- printk(KERN_INFO " Sensor: %ld\n", SYN_MODEL_SENSOR(priv->model_id));156156- if (SYN_MODEL_NEWABS(priv->model_id))157157- printk(KERN_INFO " new absolute packet format\n");158158- if (SYN_MODEL_PEN(priv->model_id))159159- printk(KERN_INFO " pen detection\n");160160-161161- if (SYN_CAP_EXTENDED(priv->capabilities)) {162162- printk(KERN_INFO " Touchpad has extended capability bits\n");163163- if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))164164- printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n",165165- (int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)));166166- if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))167167- printk(KERN_INFO " -> middle button\n");168168- if (SYN_CAP_FOUR_BUTTON(priv->capabilities))169169- printk(KERN_INFO " -> four buttons\n");170170- if (SYN_CAP_MULTIFINGER(priv->capabilities))171171- printk(KERN_INFO " -> multifinger detection\n");172172- if (SYN_CAP_PALMDETECT(priv->capabilities))173173- printk(KERN_INFO " -> palm detection\n");174174- if (SYN_CAP_PASS_THROUGH(priv->capabilities))175175- printk(KERN_INFO " -> pass-through port\n");176176- }177177-}178178-179146static int synaptics_query_hardware(struct psmouse *psmouse)180147{181148 int retries = 0;···633666634667 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;635668636636- print_ident(priv);669669+ printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx\n",670670+ SYN_ID_MODEL(priv->identity),671671+ SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),672672+ priv->model_id, priv->capabilities, priv->ext_cap);673673+637674 set_input_params(&psmouse->dev, priv);638675639676 psmouse->protocol_handler = synaptics_process_byte;
···36663666 dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma);36673667}3668366836693669+void ata_host_stop (struct ata_host_set *host_set)36703670+{36713671+ if (host_set->mmio_base)36723672+ iounmap(host_set->mmio_base);36733673+}36743674+36753675+36693676/**36703677 * ata_host_remove - Unregister SCSI host structure with upper layers36713678 * @ap: Port to unregister···42784271 }4279427242804273 free_irq(host_set->irq, host_set);42814281- if (host_set->ops->host_stop)42824282- host_set->ops->host_stop(host_set);42834283- if (host_set->mmio_base)42844284- iounmap(host_set->mmio_base);4285427442864275 for (i = 0; i < host_set->n_ports; i++) {42874276 ap = host_set->ports[i];···4295429242964293 scsi_host_put(ap->host);42974294 }42954295+42964296+ if (host_set->ops->host_stop)42974297+ host_set->ops->host_stop(host_set);4298429842994299 kfree(host_set);43004300···43874381EXPORT_SYMBOL_GPL(ata_exec_command);43884382EXPORT_SYMBOL_GPL(ata_port_start);43894383EXPORT_SYMBOL_GPL(ata_port_stop);43844384+EXPORT_SYMBOL_GPL(ata_host_stop);43904385EXPORT_SYMBOL_GPL(ata_interrupt);43914386EXPORT_SYMBOL_GPL(ata_qc_prep);43924387EXPORT_SYMBOL_GPL(ata_bmdma_setup);
+1-1
drivers/scsi/libata.h
···2626#define __LIBATA_H__27272828#define DRV_NAME "libata"2929-#define DRV_VERSION "1.10" /* must be exactly four chars */2929+#define DRV_VERSION "1.11" /* must be exactly four chars */30303131struct ata_scsi_args {3232 u16 *id;
···124124 To compile this driver as a module, choose M here: the125125 module will be called sl811-hcd.126126127127+config USB_SL811_CS128128+ tristate "CF/PCMCIA support for SL811HS HCD"129129+ depends on USB_SL811_HCD && PCMCIA130130+ default N131131+ help132132+ Wraps a PCMCIA driver around the SL811HS HCD, supporting the RATOC133133+ REX-CFU1U CF card (often used with PDAs). If unsure, say N.134134+135135+ To compile this driver as a module, choose M here: the136136+ module will be called "sl811_cs".137137+
···144144145145/* ELV USB Module UO100 (PID sent by Stefan Frings) */146146#define FTDI_ELV_UO100_PID 0xFB58 /* Product Id */147147+/* ELV USB Module UM100 (PID sent by Arnim Laeuger) */148148+#define FTDI_ELV_UM100_PID 0xFB5A /* Product Id */147149148150/*149151 * Definitions for ID TECH (www.idt-net.com) devices
+10-10
drivers/usb/serial/usb-serial.c
···12971297 goto exit_bus;12981298 }1299129913001300- /* register the generic driver, if we should */13011301- result = usb_serial_generic_register(debug);13021302- if (result < 0) {13031303- err("%s - registering generic driver failed", __FUNCTION__);13041304- goto exit_generic;13051305- }13061306-13071300 usb_serial_tty_driver->owner = THIS_MODULE;13081301 usb_serial_tty_driver->driver_name = "usbserial";13091302 usb_serial_tty_driver->devfs_name = "usb/tts/";···13221329 goto exit_tty;13231330 }1324133113321332+ /* register the generic driver, if we should */13331333+ result = usb_serial_generic_register(debug);13341334+ if (result < 0) {13351335+ err("%s - registering generic driver failed", __FUNCTION__);13361336+ goto exit_generic;13371337+ }13381338+13251339 info(DRIVER_DESC " " DRIVER_VERSION);1326134013271341 return result;13421342+13431343+exit_generic:13441344+ usb_deregister(&usb_serial_driver);1328134513291346exit_tty:13301347 tty_unregister_driver(usb_serial_tty_driver);1331134813321349exit_reg_driver:13331333- usb_serial_generic_deregister();13341334-13351335-exit_generic:13361350 bus_unregister(&usb_serial_bus_type);1337135113381352exit_bus:
+11-11
drivers/video/intelfb/intelfbdrv.c
···228228MODULE_LICENSE("Dual BSD/GPL");229229MODULE_DEVICE_TABLE(pci, intelfb_pci_table);230230231231-static int accel __initdata = 1;232232-static int vram __initdata = 4;233233-static int hwcursor __initdata = 1;234234-static int mtrr __initdata = 1;235235-static int fixed __initdata = 0;236236-static int noinit __initdata = 0;237237-static int noregister __initdata = 0;238238-static int probeonly __initdata = 0;239239-static int idonly __initdata = 0;240240-static int bailearly __initdata = 0;241241-static char *mode __initdata = NULL;231231+static int accel = 1;232232+static int vram = 4;233233+static int hwcursor = 1;234234+static int mtrr = 1;235235+static int fixed = 0;236236+static int noinit = 0;237237+static int noregister = 0;238238+static int probeonly = 0;239239+static int idonly = 0;240240+static int bailearly = 0;241241+static char *mode = NULL;242242243243module_param(accel, bool, S_IRUGO);244244MODULE_PARM_DESC(accel, "Enable console acceleration");
+2-2
fs/cifs/README
···371371 on newly created files, directories, and devices (create, 372372 mkdir, mknod) which will result in the server setting the373373 uid and gid to the default (usually the server uid of the374374- usern who mounted the share). Letting the server (rather than374374+ user who mounted the share). Letting the server (rather than375375 the client) set the uid and gid is the default. This376376 parameter has no effect if the CIFS Unix Extensions are not377377 negotiated.···384384 client (e.g. when the application is doing large sequential385385 reads bigger than page size without rereading the same data) 386386 this can provide better performance than the default387387- behavior which caches reads (reaadahead) and writes 387387+ behavior which caches reads (readahead) and writes 388388 (writebehind) through the local Linux client pagecache 389389 if oplock (caching token) is granted and held. Note that390390 direct allows write operations larger than page size
+1-1
fs/cifs/cifsproto.h
···228228 const struct nls_table *nls_codepage, 229229 int remap_special_chars);230230#endif /* CONFIG_CIFS_EXPERIMENTAL */231231-extern int cifs_convertUCSpath(char *target, const __u16 *source, int maxlen,231231+extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen,232232 const struct nls_table * codepage);233233extern int cifsConvertToUCS(__le16 * target, const char *source, int maxlen,234234 const struct nls_table * cp, int mapChars);
···392392 rc = 0;393393 d_add(direntry, NULL);394394 } else {395395- cERROR(1,("Error 0x%x or on cifs_get_inode_info in lookup",rc));395395+ cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s",396396+ rc,full_path));396397 /* BB special case check for Access Denied - watch security 397398 exposure of returning dir info implicitly via different rc 398399 if file exists or not but no access BB */
+15-9
fs/cifs/inode.c
···422422 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);423423424424 if (!rc) {425425- direntry->d_inode->i_nlink--;425425+ if(direntry->d_inode)426426+ direntry->d_inode->i_nlink--;426427 } else if (rc == -ENOENT) {427428 d_drop(direntry);428429 } else if (rc == -ETXTBSY) {···441440 cifs_sb->mnt_cifs_flags & 442441 CIFS_MOUNT_MAP_SPECIAL_CHR);443442 CIFSSMBClose(xid, pTcon, netfid);444444- direntry->d_inode->i_nlink--;443443+ if(direntry->d_inode)444444+ direntry->d_inode->i_nlink--;445445 }446446 } else if (rc == -EACCES) {447447 /* try only if r/o attribute set in local lookup data? */···496494 cifs_sb->mnt_cifs_flags & 497495 CIFS_MOUNT_MAP_SPECIAL_CHR);498496 if (!rc) {499499- direntry->d_inode->i_nlink--;497497+ if(direntry->d_inode)498498+ direntry->d_inode->i_nlink--;500499 } else if (rc == -ETXTBSY) {501500 int oplock = FALSE;502501 __u16 netfid;···517514 cifs_sb->mnt_cifs_flags &518515 CIFS_MOUNT_MAP_SPECIAL_CHR);519516 CIFSSMBClose(xid, pTcon, netfid);520520- direntry->d_inode->i_nlink--;517517+ if(direntry->d_inode)518518+ direntry->d_inode->i_nlink--;521519 }522520 /* BB if rc = -ETXTBUSY goto the rename logic BB */523521 }524522 }525523 }526526- cifsInode = CIFS_I(direntry->d_inode);527527- cifsInode->time = 0; /* will force revalidate to get info when528528- needed */529529- direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime =530530- current_fs_time(inode->i_sb);524524+ if(direntry->d_inode) {525525+ cifsInode = CIFS_I(direntry->d_inode);526526+ cifsInode->time = 0; /* will force revalidate to get info527527+ when needed */528528+ direntry->d_inode->i_ctime = current_fs_time(inode->i_sb);529529+ }530530+ inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);531531 cifsInode = CIFS_I(inode);532532 cifsInode->time = 0; /* force revalidate of dir as well */533533
+1
fs/cifs/misc.c
···571571 break;572572 case UNI_LESSTHAN:573573 target[j] = '<';574574+ break;574575 default: 575576 len = cp->uni2char(src_char, &target[j], 576577 NLS_MAX_CHARSET_SIZE);
···1212#include <asm/uaccess.h>13131414#ifndef HAVE_ARCH_DEVTREE_FIXUPS1515-static inline void set_node_proc_entry(struct device_node *np, struct proc_dir_entry *de)1616-{1717-}1818-1919-static void inline set_node_name_link(struct device_node *np, struct proc_dir_entry *de)2020-{2121-}2222-2323-static void inline set_node_addr_link(struct device_node *np, struct proc_dir_entry *de)1515+static inline void set_node_proc_entry(struct device_node *np,1616+ struct proc_dir_entry *de)2417{2518}2619#endif···5158/*5259 * Process a node, adding entries for its children and its properties.5360 */5454-void proc_device_tree_add_node(struct device_node *np, struct proc_dir_entry *de)6161+void proc_device_tree_add_node(struct device_node *np,6262+ struct proc_dir_entry *de)5563{5664 struct property *pp;5765 struct proc_dir_entry *ent;5858- struct device_node *child, *sib;5959- const char *p, *at;6060- int l;6161- struct proc_dir_entry *list, **lastp, *al;6666+ struct device_node *child;6767+ struct proc_dir_entry *list = NULL, **lastp;6868+ const char *p;62696370 set_node_proc_entry(np, de);6471 lastp = &list;7272+ for (child = NULL; (child = of_get_next_child(np, child));) {7373+ p = strrchr(child->full_name, '/');7474+ if (!p)7575+ p = child->full_name;7676+ else7777+ ++p;7878+ ent = proc_mkdir(p, de);7979+ if (ent == 0)8080+ break;8181+ *lastp = ent;8282+ ent->next = NULL;8383+ lastp = &ent->next;8484+ proc_device_tree_add_node(child, ent);8585+ }8686+ of_node_put(child);6587 for (pp = np->properties; pp != 0; pp = pp->next) {8888+ /*8989+ * Yet another Apple device-tree bogosity: on some machines,9090+ * they have properties & nodes with the same name. Those9191+ * properties are quite unimportant for us though, thus we9292+ * simply "skip" them here, but we do have to check.9393+ */9494+ for (ent = list; ent != NULL; ent = ent->next)9595+ if (!strcmp(ent->name, pp->name))9696+ break;9797+ if (ent != NULL) {9898+ printk(KERN_WARNING "device-tree: property \"%s\" name"9999+ " conflicts with node in %s\n", pp->name,100100+ np->full_name);101101+ continue;102102+ }103103+66104 /*67105 * Unfortunately proc_register puts each new entry68106 * at the beginning of the list. So we rearrange them.69107 */7070- ent = create_proc_read_entry(pp->name, strncmp(pp->name, "security-", 9) ?7171- S_IRUGO : S_IRUSR, de, property_read_proc, pp);108108+ ent = create_proc_read_entry(pp->name,109109+ strncmp(pp->name, "security-", 9)110110+ ? S_IRUGO : S_IRUSR, de,111111+ property_read_proc, pp);72112 if (ent == 0)73113 break;74114 if (!strncmp(pp->name, "security-", 9))75115 ent->size = 0; /* don't leak number of password chars */76116 else77117 ent->size = pp->length;118118+ ent->next = NULL;78119 *lastp = ent;79120 lastp = &ent->next;80121 }8181- child = NULL;8282- while ((child = of_get_next_child(np, child))) {8383- p = strrchr(child->full_name, '/');8484- if (!p)8585- p = child->full_name;8686- else8787- ++p;8888- /* chop off '@0' if the name ends with that */8989- l = strlen(p);9090- if (l > 2 && p[l-2] == '@' && p[l-1] == '0')9191- l -= 2;9292- ent = proc_mkdir(p, de);9393- if (ent == 0)9494- break;9595- *lastp = ent;9696- lastp = &ent->next;9797- proc_device_tree_add_node(child, ent);9898-9999- /*100100- * If we left the address part on the name, consider101101- * adding symlinks from the name and address parts.102102- */103103- if (p[l] != 0 || (at = strchr(p, '@')) == 0)104104- continue;105105-106106- /*107107- * If this is the first node with a given name property,108108- * add a symlink with the name property as its name.109109- */110110- sib = NULL;111111- while ((sib = of_get_next_child(np, sib)) && sib != child)112112- if (sib->name && strcmp(sib->name, child->name) == 0)113113- break;114114- if (sib == child && strncmp(p, child->name, l) != 0) {115115- al = proc_symlink(child->name, de, ent->name);116116- if (al == 0) {117117- of_node_put(sib);118118- break;119119- }120120- set_node_name_link(child, al);121121- *lastp = al;122122- lastp = &al->next;123123- }124124- of_node_put(sib);125125- /*126126- * Add another directory with the @address part as its name.127127- */128128- al = proc_symlink(at, de, ent->name);129129- if (al == 0)130130- break;131131- set_node_addr_link(child, al);132132- *lastp = al;133133- lastp = &al->next;134134- }135135- of_node_put(child);136136- *lastp = NULL;137122 de->subdir = list;138123}139124
+1-1
fs/udf/udftime.c
···4646#endif47474848/* How many days come before each month (0-12). */4949-const unsigned short int __mon_yday[2][13] =4949+static const unsigned short int __mon_yday[2][13] =5050{5151 /* Normal years. */5252 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+1
include/asm-i386/timer.h
···53535454extern unsigned long calibrate_tsc(void);5555extern void init_cpu_khz(void);5656+extern int recalibrate_cpu_khz(void);5657#ifdef CONFIG_HPET_TIMER5758extern struct init_timer_opts timer_hpet_init;5859extern unsigned long calibrate_tsc_hpet(unsigned long *tsc_hpet_quotient_ptr);
···1919 * Define the vendor/device ID for the MPC8265.2020 */2121#define PCI_DEVICE_ID_MPC8265 ((0x18C0 << 16) | PCI_VENDOR_ID_MOTOROLA)2222+#define PCI_DEVICE_ID_MPC8272 ((0x18C1 << 16) | PCI_VENDOR_ID_MOTOROLA)22232324#define M8265_PCIBR0 0x101ac2425#define M8265_PCIBR1 0x101b0
+1-1
include/asm-ppc/mpc8260.h
···4141#endif42424343#ifdef CONFIG_PCI_82604444-#include <syslib/m8260_pci.h>4444+#include <syslib/m82xx_pci.h>4545#endif46464747/* Make sure the memory translation stuff is there if PCI not used.
+1-12
include/asm-ppc64/prom.h
···147147 struct device_node *sibling;148148 struct device_node *next; /* next device of same type */149149 struct device_node *allnext; /* next in list of all nodes */150150- struct proc_dir_entry *pde; /* this node's proc directory */151151- struct proc_dir_entry *name_link; /* name symlink */152152- struct proc_dir_entry *addr_link; /* addr symlink */150150+ struct proc_dir_entry *pde; /* this node's proc directory */153151 struct kref kref;154152 unsigned long _flags;155153};···172174 dn->pde = de;173175}174176175175-static void inline set_node_name_link(struct device_node *dn, struct proc_dir_entry *de)176176-{177177- dn->name_link = de;178178-}179179-180180-static void inline set_node_addr_link(struct device_node *dn, struct proc_dir_entry *de)181181-{182182- dn->addr_link = de;183183-}184177185178/* OBSOLETE: Old stlye node lookup */186179extern struct device_node *find_devices(const char *name);
+1-1
include/asm-sh/thread_info.h
···27272828#endif29293030-#define PREEMPT_ACTIVE 0x40000003030+#define PREEMPT_ACTIVE 0x1000000031313232/*3333 * macros/functions for gaining access to the thread information structure
+1-1
include/asm-sh64/thread_info.h
···73737474#define THREAD_SIZE 819275757676-#define PREEMPT_ACTIVE 0x40000007676+#define PREEMPT_ACTIVE 0x1000000077777878/* thread information flags */7979#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
···1515#include <asm/io.h>1616#include <asm/page.h>1717#include <asm/oplib.h>1818+#include <asm/iommu.h>18191920/* The abstraction used here is that there are PCI controllers,2021 * each with one (Sabre) or two (PSYCHO/SCHIZO) PCI bus modules···4039 * streaming buffers underneath.4140 */4241 spinlock_t lock;4343-4444- /* Context allocator. */4545- unsigned int iommu_cur_ctx;46424743 /* IOMMU page table, a linear array of ioptes. */4844 iopte_t *page_table; /* The page table itself. */···8486 u16 next;8587 u16 flush;8688 } alloc_info[PBM_NCLUSTERS];8989+9090+ /* CTX allocation. */9191+ unsigned long ctx_lowest_free;9292+ unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)];87938894 /* Here a PCI controller driver describes the areas of8995 * PCI memory space where DMA to/from physical memory
+7-1
include/asm-um/page.h
···98989999extern unsigned long to_phys(void *virt);100100extern void *to_virt(unsigned long phys);101101-#define __pa(virt) to_phys((void *) virt)101101+102102+/* Cast to unsigned long before casting to void * to avoid a warning from103103+ * mmap_kmem about cutting a long long down to a void *. Not sure that104104+ * casting is the right thing, but 32-bit UML can't have 64-bit virtual105105+ * addresses106106+ */107107+#define __pa(virt) to_phys((void *) (unsigned long) virt)102108#define __va(phys) to_virt((unsigned long) phys)103109104110#define page_to_pfn(page) ((page) - mem_map)
-8
include/asm-um/pgtable.h
···114114extern unsigned long pg0[1024];115115116116/*117117- * BAD_PAGETABLE is used when we need a bogus page-table, while118118- * BAD_PAGE is used for a bogus page.119119- *120117 * ZERO_PAGE is a global shared page that is always zero: used121118 * for zero-mapped memory areas etc..122119 */123123-extern pte_t __bad_page(void);124124-extern pte_t * __bad_pagetable(void);125125-126126-#define BAD_PAGETABLE __bad_pagetable()127127-#define BAD_PAGE __bad_page()128120129121#define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)130122
+4-5
include/asm-um/thread_info.h
···4141#define init_thread_info (init_thread_union.thread_info)4242#define init_stack (init_thread_union.stack)43434444+#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)4445/* how to get the thread information struct from C */4546static inline struct thread_info *current_thread_info(void)4647{4748 struct thread_info *ti;4848- unsigned long mask = PAGE_SIZE *4949- (1 << CONFIG_KERNEL_STACK_ORDER) - 1;5050- ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);4949+ unsigned long mask = THREAD_SIZE - 1;5050+ ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);5151 return ti;5252}53535454/* thread information allocation */5555-#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)5655#define alloc_thread_info(tsk) \5756 ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL))5857#define free_thread_info(ti) kfree(ti)···61626263#endif63646464-#define PREEMPT_ACTIVE 0x40000006565+#define PREEMPT_ACTIVE 0x1000000065666667#define TIF_SYSCALL_TRACE 0 /* syscall trace active */6768#define TIF_SIGPENDING 1 /* signal pending */
+1-1
include/linux/cpufreq.h
···4949/* Frequency values here are CPU kHz so that hardware which doesn't run 5050 * with some frequencies can complain without having to guess what per 5151 * cent / per mille means. 5252- * Maximum transition latency is in microseconds - if it's unknown,5252+ * Maximum transition latency is in nanoseconds - if it's unknown,5353 * CPUFREQ_ETERNAL shall be used.5454 */5555
+18-4
include/linux/etherdevice.h
···5656}57575858/**5959+ * is_multicast_ether_addr - Determine if the given Ethernet address is a6060+ * multicast address.6161+ *6262+ * @addr: Pointer to a six-byte array containing the Ethernet address6363+ *6464+ * Return true if the address is a multicast address.6565+ */6666+static inline int is_multicast_ether_addr(const u8 *addr)6767+{6868+ return addr[0] & 0x01;6969+}7070+7171+/**5972 * is_valid_ether_addr - Determine if the given Ethernet address is valid6073 * @addr: Pointer to a six-byte array containing the Ethernet address6174 *6275 * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not6363- * a multicast address, and is not FF:FF:FF:FF:FF:FF. The multicast6464- * and FF:FF:... tests are combined into the single test "!(addr[0]&1)".7676+ * a multicast address, and is not FF:FF:FF:FF:FF:FF.6577 *6678 * Return true if the address is valid.6779 */6880static inline int is_valid_ether_addr(const u8 *addr)6981{7070- return !(addr[0]&1) && !is_zero_ether_addr(addr);8282+ /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to8383+ * explicitly check for it here. */8484+ return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);7185}72867387/**···9783 addr [0] &= 0xfe; /* clear multicast bit */9884 addr [0] |= 0x02; /* set local assignment bit (IEEE802) */9985}100100-#endif8686+#endif /* __KERNEL__ */1018710288#endif /* _LINUX_ETHERDEVICE_H */
···442442443443config MODVERSIONS444444 bool "Module versioning support (EXPERIMENTAL)"445445- depends on MODULES && EXPERIMENTAL && !UML445445+ depends on MODULES && EXPERIMENTAL446446 help447447 Usually, you have to use modules compiled with your kernel.448448 Saying Y here makes it sometimes possible to use modules
···17581758 const char __user *uargs)17591759{17601760 struct module *mod;17611761+ mm_segment_t old_fs = get_fs();17611762 int ret = 0;1762176317631764 /* Must have permission */···17761775 return PTR_ERR(mod);17771776 }1778177717781778+ /* flush the icache in correct context */17791779+ set_fs(KERNEL_DS);17801780+17791781 /* Flush the instruction cache, since we've played with text */17801782 if (mod->module_init)17811783 flush_icache_range((unsigned long)mod->module_init,···17861782 + mod->init_size);17871783 flush_icache_range((unsigned long)mod->module_core,17881784 (unsigned long)mod->module_core + mod->core_size);17851785+17861786+ set_fs(old_fs);1789178717901788 /* Now sew it into the lists. They won't access us, since17911789 strong_try_module_get() will fail. */
+2-1
lib/Kconfig.debug
···151151152152config FRAME_POINTER153153 bool "Compile the kernel with frame pointers"154154- depends on DEBUG_KERNEL && ((X86 && !X86_64) || CRIS || M68K || M68KNOMMU || FRV)154154+ depends on DEBUG_KERNEL && ((X86 && !X86_64) || CRIS || M68K || M68KNOMMU || FRV || UML)155155+ default y if DEBUG_INFO && UML155156 help156157 If you say Y here the resulting kernel image will be slightly larger157158 and slower, but it will give very useful debugging information.
···314314 return mtu;315315}316316317317+/*318318+ * Recomputes features using slave's features319319+ */320320+void br_features_recompute(struct net_bridge *br)321321+{322322+ struct net_bridge_port *p;323323+ unsigned long features, checksum;324324+325325+ features = NETIF_F_SG | NETIF_F_FRAGLIST 326326+ | NETIF_F_HIGHDMA | NETIF_F_TSO;327327+ checksum = NETIF_F_IP_CSUM; /* least commmon subset */328328+329329+ list_for_each_entry(p, &br->port_list, list) {330330+ if (!(p->dev->features 331331+ & (NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM)))332332+ checksum = 0;333333+ features &= p->dev->features;334334+ }335335+336336+ br->dev->features = features | checksum | NETIF_F_LLTX;337337+}338338+317339/* called with RTNL */318340int br_add_if(struct net_bridge *br, struct net_device *dev)319341{···390368391369 spin_lock_bh(&br->lock);392370 br_stp_recalculate_bridge_id(br);371371+ br_features_recompute(br);393372 spin_unlock_bh(&br->lock);394373395374 return 0;
+5-3
net/bridge/br_input.c
···2626#ifdef CONFIG_NETFILTER_DEBUG2727 skb->nf_debug = 0;2828#endif2929- netif_rx(skb);2929+ netif_receive_skb(skb);30303131 return 0;3232}···5353 struct net_bridge *br = p->br;5454 struct net_bridge_fdb_entry *dst;5555 int passedup = 0;5656+5757+ /* insert into forwarding database after filtering to avoid spoofing */5858+ br_fdb_update(p->br, p, eth_hdr(skb)->h_source);56595760 if (br->dev->flags & IFF_PROMISC) {5861 struct sk_buff *skb2;···111108 if (!is_valid_ether_addr(eth_hdr(skb)->h_source))112109 goto err;113110114114- if (p->state == BR_STATE_LEARNING ||115115- p->state == BR_STATE_FORWARDING)111111+ if (p->state == BR_STATE_LEARNING)116112 br_fdb_update(p->br, p, eth_hdr(skb)->h_source);117113118114 if (p->br->stp_enabled &&
+9
net/bridge/br_notify.c
···6565 }6666 break;67676868+ case NETDEV_FEAT_CHANGE:6969+ if (br->dev->flags & IFF_UP) 7070+ br_features_recompute(br);7171+7272+ /* could do recursive feature change notification7373+ * but who would care?? 7474+ */7575+ break;7676+6877 case NETDEV_DOWN:6978 if (br->dev->flags & IFF_UP)7079 br_stp_disable_port(p);
+1
net/bridge/br_private.h
···174174extern int br_del_if(struct net_bridge *br,175175 struct net_device *dev);176176extern int br_min_mtu(const struct net_bridge *br);177177+extern void br_features_recompute(struct net_bridge *br);177178178179/* br_input.c */179180extern int br_handle_frame_finish(struct sk_buff *skb);
+3
net/bridge/br_stp_bpdu.c
···140140 struct net_bridge *br = p->br;141141 unsigned char *buf;142142143143+ /* insert into forwarding database after filtering to avoid spoofing */144144+ br_fdb_update(p->br, p, eth_hdr(skb)->h_source);145145+143146 /* need at least the 802 and STP headers */144147 if (!pskb_may_pull(skb, sizeof(header)+1) ||145148 memcmp(skb->data, header, sizeof(header)))
+12
net/core/dev.c
···761761}762762763763/**764764+ * netdev_features_change - device changes fatures765765+ * @dev: device to cause notification766766+ *767767+ * Called to indicate a device has changed features.768768+ */769769+void netdev_features_change(struct net_device *dev)770770+{771771+ notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev);772772+}773773+EXPORT_SYMBOL(netdev_features_change);774774+775775+/**764776 * netdev_state_change - device changes state765777 * @dev: device to cause notification766778 *
+18-2
net/core/ethtool.c
···29293030u32 ethtool_op_get_tx_csum(struct net_device *dev)3131{3232- return (dev->features & NETIF_F_IP_CSUM) != 0;3232+ return (dev->features & (NETIF_F_IP_CSUM | NETIF_F_HW_CSUM)) != 0;3333}34343535int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)···4242 return 0;4343}44444545+int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data)4646+{4747+ if (data)4848+ dev->features |= NETIF_F_HW_CSUM;4949+ else5050+ dev->features &= ~NETIF_F_HW_CSUM;5151+5252+ return 0;5353+}4554u32 ethtool_op_get_sg(struct net_device *dev)4655{4756 return (dev->features & NETIF_F_SG) != 0;···691682 void __user *useraddr = ifr->ifr_data;692683 u32 ethcmd;693684 int rc;685685+ unsigned long old_features;694686695687 /*696688 * XXX: This can be pushed down into the ethtool_* handlers that···713703 if ((rc = dev->ethtool_ops->begin(dev)) < 0)714704 return rc;715705706706+ old_features = dev->features;707707+716708 switch (ethcmd) {717709 case ETHTOOL_GSET:718710 rc = ethtool_get_settings(dev, useraddr);···724712 break;725713 case ETHTOOL_GDRVINFO:726714 rc = ethtool_get_drvinfo(dev, useraddr);727727-728715 break;729716 case ETHTOOL_GREGS:730717 rc = ethtool_get_regs(dev, useraddr);···812801813802 if(dev->ethtool_ops->complete)814803 dev->ethtool_ops->complete(dev);804804+805805+ if (old_features != dev->features)806806+ netdev_features_change(dev);807807+815808 return rc;816809817810 ioctl:···832817EXPORT_SYMBOL(ethtool_op_set_sg);833818EXPORT_SYMBOL(ethtool_op_set_tso);834819EXPORT_SYMBOL(ethtool_op_set_tx_csum);820820+EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum);
···478478{479479 struct xfrm_decap_state decap;480480481481- if (sizeof(struct esp_decap_data) <481481+ if (sizeof(struct esp_decap_data) >482482 sizeof(decap.decap_data)) {483483 extern void decap_data_too_small(void);484484
+1-17
net/ipv4/multipath_drr.c
···57575858static struct multipath_device state[MULTIPATH_MAX_DEVICECANDIDATES];5959static DEFINE_SPINLOCK(state_lock);6060-static struct rtable *last_selection = NULL;61606261static int inline __multipath_findslot(void)6362{···110111 .notifier_call = drr_dev_event,111112};112113113113-static void drr_remove(struct rtable *rt)114114-{115115- if (last_selection == rt)116116- last_selection = NULL;117117-}118114119115static void drr_safe_inc(atomic_t *usecount)120116{···137143 int min_usecount = -1; 138144 int devidx = -1;139145 int cur_min_devidx = -1;140140-141141- /* if necessary and possible utilize the old alternative */142142- if ((flp->flags & FLOWI_FLAG_MULTIPATHOLDROUTE) != 0 &&143143- last_selection != NULL) {144144- result = last_selection;145145- *rp = result;146146- return;147147- }148146149147 /* 1. make sure all alt. nexthops have the same GC related data */150148 /* 2. determine the new candidate to be returned */···215229 }216230217231 *rp = result;218218- last_selection = result;219232}220233221234static struct ip_mp_alg_ops drr_ops = {222235 .mp_alg_select_route = drr_select_route,223223- .mp_alg_remove = drr_remove,224236};225237226238static int __init drr_init(void)···228244 if (err)229245 return err;230246231231- err = multipath_alg_register(&drr_ops, IP_MP_ALG_RR);247247+ err = multipath_alg_register(&drr_ops, IP_MP_ALG_DRR);232248 if (err)233249 goto fail;234250
-20
net/ipv4/multipath_rr.c
···4747#include <net/checksum.h>4848#include <net/ip_mp_alg.h>49495050-#define MULTIPATH_MAX_CANDIDATES 405151-5252-static struct rtable* last_used = NULL;5353-5454-static void rr_remove(struct rtable *rt)5555-{5656- if (last_used == rt)5757- last_used = NULL;5858-}5959-6050static void rr_select_route(const struct flowi *flp,6151 struct rtable *first, struct rtable **rp)6252{6353 struct rtable *nh, *result, *min_use_cand = NULL;6454 int min_use = -1;6565-6666- /* if necessary and possible utilize the old alternative */6767- if ((flp->flags & FLOWI_FLAG_MULTIPATHOLDROUTE) != 0 &&6868- last_used != NULL) {6969- result = last_used;7070- goto out;7171- }72557356 /* 1. make sure all alt. nexthops have the same GC related data7457 * 2. determine the new candidate to be returned···7390 if (!result)7491 result = first;75927676-out:7777- last_used = result;7893 result->u.dst.__use++;7994 *rp = result;8095}81968297static struct ip_mp_alg_ops rr_ops = {8398 .mp_alg_select_route = rr_select_route,8484- .mp_alg_remove = rr_remove,8599};8610087101static int __init rr_init(void)
+10
net/ipv4/netfilter/ip_queue.c
···33 * communicating with userspace via netlink.44 *55 * (C) 2000-2002 James Morris <jmorris@intercode.com.au>66+ * (C) 2003-2005 Netfilter Core Team <coreteam@netfilter.org>67 *78 * This program is free software; you can redistribute it and/or modify89 * it under the terms of the GNU General Public License version 2 as···1817 * 2005-01-10: Added /proc counter for dropped packets; fixed so1918 * packets aren't delivered to user space if they're going 2019 * to be dropped. 2020+ * 2005-05-26: local_bh_{disable,enable} around nf_reinject (Harald Welte)2121 *2222 */2323#include <linux/module.h>···7371static void7472ipq_issue_verdict(struct ipq_queue_entry *entry, int verdict)7573{7474+ /* TCP input path (and probably other bits) assume to be called7575+ * from softirq context, not from syscall, like ipq_issue_verdict is7676+ * called. TCP input path deadlocks with locks taken from timer7777+ * softirq, e.g. We therefore emulate this by local_bh_disable() */7878+7979+ local_bh_disable();7680 nf_reinject(entry->skb, entry->info, verdict);8181+ local_bh_enable();8282+7783 kfree(entry);7884}7985
+6-6
net/ipv4/udp.c
···738738 unsigned long amount;739739740740 amount = 0;741741- spin_lock_irq(&sk->sk_receive_queue.lock);741741+ spin_lock_bh(&sk->sk_receive_queue.lock);742742 skb = skb_peek(&sk->sk_receive_queue);743743 if (skb != NULL) {744744 /*···748748 */749749 amount = skb->len - sizeof(struct udphdr);750750 }751751- spin_unlock_irq(&sk->sk_receive_queue.lock);751751+ spin_unlock_bh(&sk->sk_receive_queue.lock);752752 return put_user(amount, (int __user *)arg);753753 }754754···848848 /* Clear queue. */849849 if (flags&MSG_PEEK) {850850 int clear = 0;851851- spin_lock_irq(&sk->sk_receive_queue.lock);851851+ spin_lock_bh(&sk->sk_receive_queue.lock);852852 if (skb == skb_peek(&sk->sk_receive_queue)) {853853 __skb_unlink(skb, &sk->sk_receive_queue);854854 clear = 1;855855 }856856- spin_unlock_irq(&sk->sk_receive_queue.lock);856856+ spin_unlock_bh(&sk->sk_receive_queue.lock);857857 if (clear)858858 kfree_skb(skb);859859 }···13341334 struct sk_buff_head *rcvq = &sk->sk_receive_queue;13351335 struct sk_buff *skb;1336133613371337- spin_lock_irq(&rcvq->lock);13371337+ spin_lock_bh(&rcvq->lock);13381338 while ((skb = skb_peek(rcvq)) != NULL) {13391339 if (udp_checksum_complete(skb)) {13401340 UDP_INC_STATS_BH(UDP_MIB_INERRORS);···13451345 break;13461346 }13471347 }13481348- spin_unlock_irq(&rcvq->lock);13481348+ spin_unlock_bh(&rcvq->lock);1349134913501350 /* nothing to see, move along */13511351 if (skb == NULL)
+6-4
net/ipv6/ip6_flowlabel.c
···535535 if (err)536536 goto done;537537538538- /* Do not check for fault */539539- if (!freq.flr_label)540540- copy_to_user(&((struct in6_flowlabel_req __user *) optval)->flr_label,541541- &fl->label, sizeof(fl->label));538538+ if (!freq.flr_label) {539539+ if (copy_to_user(&((struct in6_flowlabel_req __user *) optval)->flr_label,540540+ &fl->label, sizeof(fl->label))) {541541+ /* Intentionally ignore fault. */542542+ }543543+ }542544543545 sfl1->fl = fl;544546 sfl1->next = np->ipv6_fl_list;
+11-5
net/sched/sch_dsmark.c
···1818#include <asm/byteorder.h>191920202121-#if 1 /* control */2121+#if 0 /* control */2222#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)2323#else2424#define DPRINTK(format,args...)···73737474 DPRINTK("dsmark_graft(sch %p,[qdisc %p],new %p,old %p)\n",sch,p,new,7575 old);7676- if (!new)7777- new = &noop_qdisc;7676+7777+ if (new == NULL) {7878+ new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops);7979+ if (new == NULL)8080+ new = &noop_qdisc;8181+ }8282+7883 sch_tree_lock(sch);7984 *old = xchg(&p->q,new);8085 if (*old)···168163 return;169164 for (i = 0; i < p->indices; i++) {170165 if (p->mask[i] == 0xff && !p->value[i])171171- continue;166166+ goto ignore;172167 if (walker->count >= walker->skip) {173168 if (walker->fn(sch, i+1, walker) < 0) {174169 walker->stop = 1;175170 break;176171 }177172 }178178- walker->count++;173173+ignore: 174174+ walker->count++;179175 }180176}181177
+6-6
sound/oss/Kconfig
···112112113113config SOUND_ES1370114114 tristate "Ensoniq AudioPCI (ES1370)"115115- depends on SOUND_PRIME!=n && SOUND && PCI && SOUND_GAMEPORT115115+ depends on SOUND_PRIME!=n && SOUND && PCI116116 help117117 Say Y or M if you have a PCI sound card utilizing the Ensoniq118118 ES1370 chipset, such as Ensoniq's AudioPCI (non-97). To find···125125126126config SOUND_ES1371127127 tristate "Creative Ensoniq AudioPCI 97 (ES1371)"128128- depends on SOUND_PRIME!=n && SOUND && PCI && SOUND_GAMEPORT128128+ depends on SOUND_PRIME!=n && SOUND && PCI129129 help130130 Say Y or M if you have a PCI sound card utilizing the Ensoniq131131 ES1371 chipset, such as Ensoniq's AudioPCI97. To find out if···138138139139config SOUND_ESSSOLO1140140 tristate "ESS Technology Solo1" 141141- depends on SOUND_PRIME!=n && SOUND && SOUND_GAMEPORT && PCI141141+ depends on SOUND_PRIME!=n && SOUND && PCI142142 help143143 Say Y or M if you have a PCI sound card utilizing the ESS Technology144144 Solo1 chip. To find out if your sound card uses a···179179180180config SOUND_SONICVIBES181181 tristate "S3 SonicVibes"182182- depends on SOUND_PRIME!=n && SOUND && SOUND_GAMEPORT182182+ depends on SOUND_PRIME!=n && SOUND183183 help184184 Say Y or M if you have a PCI sound card utilizing the S3185185 SonicVibes chipset. To find out if your sound card uses a···226226227227config SOUND_TRIDENT228228 tristate "Trident 4DWave DX/NX, SiS 7018 or ALi 5451 PCI Audio Core"229229- depends on SOUND_PRIME!=n && SOUND && SOUND_GAMEPORT229229+ depends on SOUND_PRIME!=n && SOUND230230 ---help---231231 Say Y or M if you have a PCI sound card utilizing the Trident232232 4DWave-DX/NX chipset or your mother board chipset has SiS 7018···739739740740config SOUND_MAD16741741 tristate "OPTi MAD16 and/or Mozart based cards"742742- depends on SOUND_OSS && SOUND_GAMEPORT742742+ depends on SOUND_OSS743743 ---help---744744 Answer Y if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi745745 82C928 or 82C929 or 82C931) audio interface chip. These chips are
+19-11
sound/ppc/pmac.c
···876876 */877877static int __init snd_pmac_detect(pmac_t *chip)878878{879879- struct device_node *sound;879879+ struct device_node *sound = NULL;880880 unsigned int *prop, l;881881 struct macio_chip* macio;882882···906906 chip->is_pbook_G3 = 1;907907 chip->node = find_devices("awacs");908908 if (chip->node)909909- return 0; /* ok */909909+ sound = chip->node;910910911911 /*912912 * powermac G3 models have a node called "davbus"913913 * with a child called "sound".914914 */915915- chip->node = find_devices("davbus");915915+ if (!chip->node)916916+ chip->node = find_devices("davbus");916917 /*917918 * if we didn't find a davbus device, try 'i2s-a' since918919 * this seems to be what iBooks have919920 */920921 if (! chip->node) {921922 chip->node = find_devices("i2s-a");922922- if (chip->node && chip->node->parent && chip->node->parent->parent) {923923+ if (chip->node && chip->node->parent &&924924+ chip->node->parent->parent) {923925 if (device_is_compatible(chip->node->parent->parent,924926 "K2-Keylargo"))925927 chip->is_k2 = 1;···930928 if (! chip->node)931929 return -ENODEV;932930933933- sound = find_devices("sound");934934- while (sound && sound->parent != chip->node)935935- sound = sound->next;931931+ if (!sound) {932932+ sound = find_devices("sound");933933+ while (sound && sound->parent != chip->node)934934+ sound = sound->next;935935+ }936936 if (! sound)937937 return -ENODEV;938938 prop = (unsigned int *) get_property(sound, "sub-frame", NULL);···10231019 }10241020 }10251021 if (chip->pdev == NULL)10261026- printk(KERN_WARNING "snd-powermac: can't locate macio PCI device !\n");10221022+ printk(KERN_WARNING "snd-powermac: can't locate macio PCI"10231023+ " device !\n");1027102410281025 detect_byte_swap(chip);10291026···10321027 are available */10331028 prop = (unsigned int *) get_property(sound, "sample-rates", &l);10341029 if (! prop)10351035- prop = (unsigned int *) get_property(sound, "output-frame-rates", &l);10301030+ prop = (unsigned int *) get_property(sound,10311031+ "output-frame-rates", &l);10361032 if (prop) {10371033 int i;10381034 chip->freqs_ok = 0;···10601054/*10611055 * exported - boolean info callbacks for ease of programming10621056 */10631063-int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)10571057+int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol,10581058+ snd_ctl_elem_info_t *uinfo)10641059{10651060 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;10661061 uinfo->count = 2;···10701063 return 0;10711064}1072106510731073-int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)10661066+int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol,10671067+ snd_ctl_elem_info_t *uinfo)10741068{10751069 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;10761070 uinfo->count = 1;