-mm1 --- diff/Documentation/Changes 2004-02-18 08:54:06.000000000 +0000 +++ source/Documentation/Changes 2004-02-18 09:03:58.000000000 +0000 @@ -216,13 +216,6 @@ as root before you can use this. You'll probably also want to get the user-space microcode_ctl utility to use with this. -If you have compiled the driver as a module you may need to add -the following line: - -alias char-major-10-184 microcode - -to your /etc/modules.conf file. - Powertweak ---------- @@ -259,17 +252,6 @@ as root. -If you build ppp support as modules, you will need the following in -your /etc/modules.conf file: - -alias char-major-108 ppp_generic -alias /dev/ppp ppp_generic -alias tty-ldisc-3 ppp_async -alias tty-ldisc-14 ppp_synctty -alias ppp-compress-21 bsd_comp -alias ppp-compress-24 ppp_deflate -alias ppp-compress-26 ppp_deflate - If you use devfsd and build ppp support as modules, you will need the following in your /etc/devfsd.conf file: --- diff/Documentation/CodingStyle 2003-07-22 18:54:26.000000000 +0100 +++ source/Documentation/CodingStyle 2004-02-18 09:03:58.000000000 +0000 @@ -1,42 +1,75 @@ - Linux kernel coding style + Linux kernel coding style This is a short document describing the preferred coding style for the linux kernel. Coding style is very personal, and I won't _force_ my views on anybody, but this is what goes for anything that I have to be able to maintain, and I'd prefer it for most other things too. Please -at least consider the points made here. +at least consider the points made here. First off, I'd suggest printing out a copy of the GNU coding standards, -and NOT read it. Burn them, it's a great symbolic gesture. +and NOT read it. Burn them, it's a great symbolic gesture. Anyway, here goes: Chapter 1: Indentation -Tabs are 8 characters, and thus indentations are also 8 characters. +Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to -be 3. +be 3. Rationale: The whole idea behind indentation is to clearly define where a block of control starts and ends. Especially when you've been looking at your screen for 20 straight hours, you'll find it a lot easier to see -how the indentation works if you have large indentations. +how the indentation works if you have large indentations. Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix -your program. +your program. In short, 8-char indents make things easier to read, and have the added -benefit of warning you when you're nesting your functions too deep. -Heed that warning. +benefit of warning you when you're nesting your functions too deep. +Heed that warning. +Don't put multiple statements on a single line unless you have +something to hide: - Chapter 2: Placing Braces + if (condition) do_this; + do_something_everytime; + +Outside of comments, documentation and except in Kconfig, spaces are never +used for indentation, and the above example is deliberately broken. + +Get a decent editor and don't leave whitespace at the end of lines. + + + Chapter 2: Breaking long lines and strings + +Coding style is all about readability and maintainability using commonly +available tools. + +The limit on the length of lines is 80 columns and this is a hard limit. + +Statements longer than 80 columns will be broken into sensible chunks. +Descendants are always substantially shorter than the parent and are placed +substantially to the right. The same applies to function headers with a long +argument list. Long strings are as well broken into shorter strings. + +void fun(int a, int b, int c) +{ + if (condition) + printk(KERN_WARNING "Warning this is a long printk with " + "3 parameters a: %u b: %u " + "c: %u \n", a, b, c); + else + next_statement; +} + + Chapter 3: Placing Braces The other issue that always comes up in C styling is the placement of braces. Unlike the indent size, there are few technical reasons to @@ -59,7 +92,7 @@ Heretic people all over the world have claimed that this inconsistency is ... well ... inconsistent, but all right-thinking people know that (a) K&R are _right_ and (b) K&R are right. Besides, functions are -special anyway (you can't nest them in C). +special anyway (you can't nest them in C). Note that the closing brace is empty on a line of its own, _except_ in the cases where it is followed by a continuation of the same statement, @@ -79,60 +112,60 @@ } else { .... } - -Rationale: K&R. + +Rationale: K&R. Also, note that this brace-placement also minimizes the number of empty (or almost empty) lines, without any loss of readability. Thus, as the supply of new-lines on your screen is not a renewable resource (think 25-line terminal screens here), you have more empty lines to put -comments on. +comments on. - Chapter 3: Naming + Chapter 4: Naming C is a Spartan language, and so should your naming be. Unlike Modula-2 and Pascal programmers, C programmers do not use cute names like ThisVariableIsATemporaryCounter. A C programmer would call that variable "tmp", which is much easier to write, and not the least more -difficult to understand. +difficult to understand. HOWEVER, while mixed-case names are frowned upon, descriptive names for global variables are a must. To call a global function "foo" is a -shooting offense. +shooting offense. GLOBAL variables (to be used only if you _really_ need them) need to have descriptive names, as do global functions. If you have a function that counts the number of active users, you should call that -"count_active_users()" or similar, you should _not_ call it "cntusr()". +"count_active_users()" or similar, you should _not_ call it "cntusr()". Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged - the compiler knows the types anyway and can check those, and it only confuses the programmer. No wonder MicroSoft -makes buggy programs. +makes buggy programs. LOCAL variable names should be short, and to the point. If you have -some random integer loop counter, it should probably be called "i". +some random integer loop counter, it should probably be called "i". Calling it "loop_counter" is non-productive, if there is no chance of it being mis-understood. Similarly, "tmp" can be just about any type of -variable that is used to hold a temporary value. +variable that is used to hold a temporary value. If you are afraid to mix up your local variable names, you have another -problem, which is called the function-growth-hormone-imbalance syndrome. -See next chapter. +problem, which is called the function-growth-hormone-imbalance syndrome. +See next chapter. - - Chapter 4: Functions + + Chapter 5: Functions Functions should be short and sweet, and do just one thing. They should fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24, -as we all know), and do one thing and do that well. +as we all know), and do one thing and do that well. The maximum length of a function is inversely proportional to the complexity and indentation level of that function. So, if you have a conceptually simple function that is just one long (but simple) case-statement, where you have to do lots of small things for a lot of -different cases, it's OK to have a longer function. +different cases, it's OK to have a longer function. However, if you have a complex function, and you suspect that a less-than-gifted first-year high-school student might not even @@ -140,41 +173,78 @@ maximum limits all the more closely. Use helper functions with descriptive names (you can ask the compiler to in-line them if you think it's performance-critical, and it will probably do a better job of it -than you would have done). +than you would have done). Another measure of the function is the number of local variables. They shouldn't exceed 5-10, or you're doing something wrong. Re-think the function, and split it into smaller pieces. A human brain can generally easily keep track of about 7 different things, anything more and it gets confused. You know you're brilliant, but maybe you'd like -to understand what you did 2 weeks from now. +to understand what you did 2 weeks from now. + + + Chapter 6: Centralized exiting of functions +Albeit deprecated by some people, the equivalent of the goto statement is +used frequently by compilers in form of the unconditional jump instruction. - Chapter 5: Commenting +The goto statement comes in handy when a function exits from multiple +locations and some common work such as cleanup has to be done. + +The rationale is: + +- unconditional statements are easier to understand and follow +- nesting is reduced +- errors by not updating individual exit points when making + modifications are prevented +- saves the compiler work to optimize redundant code away ;) + +int fun(int ) +{ + int result = 0; + char *buffer = kmalloc(SIZE); + + if (buffer == NULL) + return -ENOMEM; + + if (condition1) { + while (loop1) { + ... + } + result = 1; + goto out; + } + ... +out: + kfree(buffer); + return result; +} + + Chapter 7: Commenting Comments are good, but there is also a danger of over-commenting. NEVER try to explain HOW your code works in a comment: it's much better to write the code so that the _working_ is obvious, and it's a waste of -time to explain badly written code. +time to explain badly written code. -Generally, you want your comments to tell WHAT your code does, not HOW. +Generally, you want your comments to tell WHAT your code does, not HOW. Also, try to avoid putting comments inside a function body: if the function is so complex that you need to separately comment parts of it, -you should probably go back to chapter 4 for a while. You can make +you should probably go back to chapter 5 for a while. You can make small comments to note or warn about something particularly clever (or ugly), but try to avoid excess. Instead, put the comments at the head of the function, telling people what it does, and possibly WHY it does -it. +it. - Chapter 6: You've made a mess of it + Chapter 8: You've made a mess of it That's OK, we all do. You've probably been told by your long-time Unix user helper that "GNU emacs" automatically formats the C sources for you, and you've noticed that yes, it does do that, but the defaults it uses are less than desirable (in fact, they are worse than random typing - an infinite number of monkeys typing into GNU emacs would never -make a good program). +make a good program). So, you can either get rid of GNU emacs, or change it to use saner values. To do the latter, you can stick the following in your .emacs file: @@ -192,7 +262,7 @@ to add (setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode) - auto-mode-alist)) + auto-mode-alist)) to your .emacs file if you want to have linux-c-mode switched on automagically when you edit source files under /usr/src/linux. @@ -201,33 +271,36 @@ everything is lost: use "indent". Now, again, GNU indent has the same brain-dead settings that GNU emacs -has, which is why you need to give it a few command line options. +has, which is why you need to give it a few command line options. However, that's not too bad, because even the makers of GNU indent recognize the authority of K&R (the GNU people aren't evil, they are just severely misguided in this matter), so you just give indent the -options "-kr -i8" (stands for "K&R, 8 character indents"). +options "-kr -i8" (stands for "K&R, 8 character indents"), or use +"scripts/Lindent", which indents in the latest style. "indent" has a lot of options, and especially when it comes to comment -re-formatting you may want to take a look at the manual page. But -remember: "indent" is not a fix for bad programming. +re-formatting you may want to take a look at the man page. But +remember: "indent" is not a fix for bad programming. - Chapter 7: Configuration-files + Chapter 9: Configuration-files -For configuration options (arch/xxx/config.in, and all the Config.in files), +For configuration options (arch/xxx/Kconfig, and all the Kconfig files), somewhat different indentation is used. -An indention level of 3 is used in the code, while the text in the config- -options should have an indention-level of 2 to indicate dependencies. The -latter only applies to bool/tristate options. For other options, just use -common sense. An example: - -if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'Apply nitroglycerine inside the keyboard (DANGEROUS)' CONFIG_BOOM - if [ "$CONFIG_BOOM" != "n" ]; then - bool ' Output nice messages when you explode' CONFIG_CHEER - fi -fi +Help text is indented with 2 spaces. + +if CONFIG_EXPERIMENTAL + tristate CONFIG_BOOM + default n + help + Apply nitroglycerine inside the keyboard (DANGEROUS) + bool CONFIG_CHEER + depends on CONFIG_BOOM + default y + help + Output nice messages when you explode +endif Generally, CONFIG_EXPERIMENTAL should surround all options not considered stable. All options that are known to trash data (experimental write- @@ -235,20 +308,20 @@ experimental options should be denoted (EXPERIMENTAL). - Chapter 8: Data structures + Chapter 10: Data structures Data structures that have visibility outside the single-threaded environment they are created and destroyed in should always have reference counts. In the kernel, garbage collection doesn't exist (and outside the kernel garbage collection is slow and inefficient), which -means that you absolutely _have_ to reference count all your uses. +means that you absolutely _have_ to reference count all your uses. Reference counting means that you can avoid locking, and allows multiple users to have access to the data structure in parallel - and not having to worry about the structure suddenly going away from under them just -because they slept or did something else for a while. +because they slept or did something else for a while. -Note that locking is _not_ a replacement for reference counting. +Note that locking is _not_ a replacement for reference counting. Locking is used to keep data structures coherent, while reference counting is a memory management technique. Usually both are needed, and they are not to be confused with each other. @@ -264,3 +337,87 @@ Remember: if another thread can find your data structure, and you don't have a reference count on it, you almost certainly have a bug. + + + Chapter 11: Macros, Enums, Inline functions and RTL + +Names of macros defining constants and labels in enums are capitalized. + +#define CONSTANT 0x12345 + +Enums are preferred when defining several related constants. + +CAPITALIZED macro names are appreciated but macros resembling functions +may be named in lower case. + +Generally, inline functions are preferable to macros resembling functions. + +Macros with multiple statements should be enclosed in a do - while block: + +#define macrofun(a,b,c) \ + do { \ + if (a == 5) \ + do_this(b,c); \ + } while (0) + +Things to avoid when using macros: + +1) macros that affect control flow: + +#define FOO(x) \ + do { \ + if (blah(x) < 0) \ + return -EBUGGERED; \ + } while(0) + +is a _very_ bad idea.  It looks like a function call but exits the "calling" +function; don't break the internal parsers of those who will read the code. + +2) macros that depend on having a local variable with a magic name: + +#define FOO(val) bar(index, val) + +might look like a good thing, but it's confusing as hell when one reads the +code and it's prone to breakage from seemingly innocent changes. + +3) macros with arguments that are used as l-values: FOO(x) = y; will +bite you if somebody e.g. turns FOO into an inline function. + +4) forgetting about precedence: macros defining constants using expressions +must enclose the expression in parentheses. Beware of similar issues with +macros using parameters. + +#define CONSTANT 0x4000 +#define CONSTEXP (CONSTANT | 3) + +The cpp manual deals with macros exhaustively. The gcc internals manual also +covers RTL which is used frequently with assembly language in the kernel. + + + Chapter 12: Printing kernel messages + +Kernel developers like to be seen as literate. Do mind the spelling +of kernel messages to make a good impression. Do not use crippled +words like "dont" and use "do not" or "don't" instead. + +Kernel messages do not have to be terminated with a period. + +Printing numbers in parentheses (%d) adds no value and should be avoided. + + + Chapter 13: References + +The C Programming Language, Second Edition +by Brian W. Kernighan and Dennis M. Ritchie. +Prentice Hall, Inc., 1988. +ISBN 0-13-110362-8 (paperback), 0-13-110370-9 (hardback). + +The Practice of Programming +Brian W. Kernighan, Rob Pike +Addison-Wesley, 1999, ISBN 0-201-61586-X + +GNU manuals - where in compliance with K&R and this text - for cpp, gcc, +gcc internals and indent, all available from www.gnu.org. + +-- +Last updated on 16 February 2004 by a community effort on LKML. --- diff/Documentation/binfmt_misc.txt 2003-10-09 09:47:33.000000000 +0100 +++ source/Documentation/binfmt_misc.txt 2004-02-18 09:03:58.000000000 +0000 @@ -15,7 +15,7 @@ mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc To actually register a new binary type, you have to set up a string looking like -:name:type:offset:magic:mask:interpreter: (where you can choose the ':' upon +:name:type:offset:magic:mask:interpreter:flags (where you can choose the ':' upon your needs) and echo it to /proc/sys/fs/binfmt_misc/register. Here is what the fields mean: - 'name' is an identifier string. A new /proc file will be created with this @@ -34,6 +34,28 @@ The mask is anded with the byte sequence of the file. - 'interpreter' is the program that should be invoked with the binary as first argument (specify the full path) + - 'flags' is an optional field that controls several aspects of the invocation + of the interpreter. It is a string of capital letters, each controls a certain + aspect. The following flags are supported - + 'P' - preserve-argv[0]. Legacy behavior of binfmt_misc is to overwrite the + original argv[0] with the full path to the binary. When this flag is + included, binfmt_misc will add an argument to the argument vector for + this purpose, thus preserving the original argv[0]. + 'O' - open-binary. Legacy behavior of binfmt_misc is to pass the full path + of the binary to the interpreter as an argument. When this flag is + included, binfmt_misc will open the file for reading and pass its + descriptor as an argument, instead of the full path, thus allowing + the interpreter to execute non-readable binaries. This feature should + be used with care - the interpreter has to be trusted not to emit + the contents of the non-readable binary. + 'C' - credentials. Currently, the behavior of binfmt_misc is to calculate + the credentials and security token of the new process according to + the interpreter. When this flag is included, these attributes are + calculated according to the binary. It also implies the 'O' flag. + This feature should be used with care as the interpreter + will run with root permissions when a setuid binary owned by root + is run with binfmt_misc. + There are some restrictions: - the whole register string may not exceed 255 characters @@ -83,9 +105,9 @@ write a wrapper script for it. See Documentation/java.txt for an example. -Your interpreter should NOT look in the PATH for the filename; the -kernel passes it the full filename to use. Using the PATH can cause -unexpected behaviour and be a security hazard. +Your interpreter should NOT look in the PATH for the filename; the kernel +passes it the full filename (or the file descriptor) to use. Using $PATH can +cause unexpected behaviour and can be a security hazard. There is a web page about binfmt_misc at --- diff/Documentation/computone.txt 2003-08-20 14:16:23.000000000 +0100 +++ source/Documentation/computone.txt 2004-02-18 09:03:58.000000000 +0000 @@ -41,11 +41,11 @@ Note the hardware address from the Computone ISA cards installed into the system. These are required for editing ip2.c or editing - /etc/modules.conf, or for specification on the modprobe + /etc/modprobe.conf, or for specification on the modprobe command line. - Note that the /etc/modules.conf file is named /etc/conf.modules - with older versions of the module utilities. + Note that the /etc/modules.conf should be used for older (pre-2.6) + kernels. Software - @@ -58,7 +58,7 @@ c) Set address on ISA cards then: edit /usr/src/linux/drivers/char/ip2.c if needed or - edit /etc/modules.conf if needed (module). + edit /etc/modprobe.conf if needed (module). or both to match this setting. d) Run "make modules" e) Run "make modules_install" @@ -145,11 +145,11 @@ selects polled mode). If no base addresses are specified the defaults in ip2.c are used. If you are autoloading the driver module with kerneld or kmod the base addresses and interrupt number must also be set in ip2.c -and recompile or just insert and options line in /etc/modules.conf or both. +and recompile or just insert and options line in /etc/modprobe.conf or both. The options line is equivalent to the command line and takes precidence over what is in ip2.c. -/etc/modules.conf sample: +/etc/modprobe.conf sample: options ip2 io=1,0x328 irq=1,10 alias char-major-71 ip2 alias char-major-72 ip2 --- diff/Documentation/crypto/api-intro.txt 2003-10-09 09:47:33.000000000 +0100 +++ source/Documentation/crypto/api-intro.txt 2004-02-18 09:03:58.000000000 +0000 @@ -68,7 +68,7 @@ CONFIGURATION NOTES As Triple DES is part of the DES module, for those using modular builds, -add the following line to /etc/modules.conf: +add the following line to /etc/modprobe.conf: alias des3_ede des --- diff/Documentation/digiboard.txt 2003-10-09 09:47:16.000000000 +0100 +++ source/Documentation/digiboard.txt 2004-02-18 09:03:58.000000000 +0000 @@ -24,7 +24,7 @@ The pcxx driver can be configured using the command line feature while loading the kernel with LILO or LOADLIN or, if built as a module, with arguments to insmod and modprobe or with parameters in -/etc/modules.conf for modprobe and kerneld. +/etc/modprobe.conf for modprobe and kerneld. After configuring the driver you need to create the device special files as described in "Device file creation:" below and set the appropriate @@ -91,13 +91,13 @@ The remaining board still uses ttyD8-ttyD15 and cud8-cud15. -Example line for /etc/modules.conf for use with kerneld and as default +Example line for /etc/modprobe.conf for use with kerneld and as default parameters for modprobe: options pcxx io=0x200 numports=8 -For kerneld to work you will likely need to add these two lines to your -/etc/modules.conf: +For kmod to work you will likely need to add these two lines to your +/etc/modprobe.conf: alias char-major-22 pcxx alias char-major-23 pcxx --- diff/Documentation/fb/intel810.txt 2003-01-02 10:43:02.000000000 +0000 +++ source/Documentation/fb/intel810.txt 2004-02-18 09:03:58.000000000 +0000 @@ -194,7 +194,7 @@ modprobe i810fb vram=2 xres=1024 bpp=8 hsync1=30 hsync2=55 vsync1=50 \ vsync2=85 accel=1 mtrr=1 -Or just add the following to /etc/modules.conf +Or just add the following to /etc/modprobe.conf options i810fb vram=2 xres=1024 bpp=16 hsync1=30 hsync2=55 vsync1=50 \ vsync2=85 accel=1 mtrr=1 --- diff/Documentation/filesystems/jfs.txt 2003-10-27 09:20:36.000000000 +0000 +++ source/Documentation/filesystems/jfs.txt 2004-02-18 09:03:58.000000000 +0000 @@ -12,10 +12,9 @@ The following mount options are supported: iocharset=name Character set to use for converting from Unicode to - ASCII. The default is compiled into the kernel as - CONFIG_NLS_DEFAULT. Use iocharset=utf8 for UTF8 - translations. This requires CONFIG_NLS_UTF8 to be set - in the kernel .config file. + ASCII. The default is to do no conversion. Use + iocharset=utf8 for UTF8 translations. This requires + CONFIG_NLS_UTF8 to be set in the kernel .config file. resize=value Resize the volume to blocks. JFS only supports growing a volume, not shrinking it. This option is only @@ -36,18 +35,6 @@ errors=remount-ro Default. Remount the filesystem read-only on an error. errors=panic Panic and halt the machine if an error occurs. -JFS TODO list: - -Plans for our near term development items - - - enhance support for logfile on dedicated partition - -Longer term work items - - - implement defrag utility, for online defragmenting - - add quota support - - add support for block sizes (512,1024,2048) - Please send bugs, comments, cards and letters to shaggy@austin.ibm.com. The JFS mailing list can be subscribed to by using the link labeled --- diff/Documentation/filesystems/proc.txt 2003-09-17 12:28:01.000000000 +0100 +++ source/Documentation/filesystems/proc.txt 2004-02-18 09:03:58.000000000 +0000 @@ -900,6 +900,15 @@ Every mounted file system needs a super block, so if you plan to mount lots of file systems, you may want to increase these numbers. +aio-nr and aio-max-nr +--------------------- + +aio-nr is the running total of the number of events specified on the +io_setup system call for all currently active aio contexts. If aio-nr +reaches aio-max-nr then io_setup will fail with EAGAIN. Note that +raising aio-max-nr does not result in the pre-allocation or re-sizing +of any kernel data structures. + 2.2 /proc/sys/fs/binfmt_misc - Miscellaneous binary formats ----------------------------------------------------------- --- diff/Documentation/ftape.txt 2003-10-09 09:47:33.000000000 +0100 +++ source/Documentation/ftape.txt 2004-02-18 09:03:58.000000000 +0000 @@ -242,15 +242,15 @@ Module parameters can be specified either directly when invoking the program 'insmod' at the shell prompt: - insmod ftape.o ft_tracing=4 + modprobe ftape ft_tracing=4 - or by editing the file `/etc/modules.conf' in which case they take + or by editing the file `/etc/modprobe.conf' in which case they take effect each time when the module is loaded with `modprobe' (please refer to the respective manual pages). Thus, you should add a line options ftape ft_tracing=4 - to `/etc/modules.conf` if you intend to increase the debugging + to `/etc/modprobe.conf` if you intend to increase the debugging output of the driver. @@ -298,7 +298,7 @@ 5. Example module parameter setting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To do the same, but with ftape compiled as a loadable kernel - module, add the following line to `/etc/modules.conf': + module, add the following line to `/etc/modprobe.conf': options ftape ft_probe_fc10=1 ft_tracing=4 --- diff/Documentation/hayes-esp.txt 2002-10-16 04:27:12.000000000 +0100 +++ source/Documentation/hayes-esp.txt 2004-02-18 09:03:58.000000000 +0000 @@ -109,7 +109,7 @@ insmod esp dma=3 trigger=512 The esp module can be automatically loaded when needed. To cause this to -happen, add the following lines to /etc/modules.conf (replacing the last line +happen, add the following lines to /etc/modprobe.conf (replacing the last line with options for your configuration): alias char-major-57 esp --- diff/Documentation/ide.txt 2003-10-27 09:20:36.000000000 +0000 +++ source/Documentation/ide.txt 2004-02-18 09:03:58.000000000 +0000 @@ -198,12 +198,11 @@ can only be compiled into the kernel, and the core code (ide.c) can be compiled as a loadable module provided no chipset support is needed. -When using ide.c/ide-tape.c as modules in combination with kerneld, add: +When using ide.c as a module in combination with kmod, add: alias block-major-3 ide-probe - alias char-major-37 ide-tape -respectively to /etc/modules.conf. +to /etc/modprobe.conf. When ide.c is used as a module, you can pass command line parameters to the driver using the "options=" keyword to insmod, while replacing any ',' with --- diff/Documentation/kbuild/modules.txt 2004-01-19 10:22:54.000000000 +0000 +++ source/Documentation/kbuild/modules.txt 2004-02-18 09:03:58.000000000 +0000 @@ -17,12 +17,52 @@ Compiling modules outside the official kernel --------------------------------------------- -Often modules are developed outside the official kernel. -To keep up with changes in the build system the most portable way -to compile a module outside the kernel is to use the following command-line: + +Often modules are developed outside the official kernel. To keep up +with changes in the build system the most portable way to compile a +module outside the kernel is to use the kernel build system, +kbuild. Use the following command-line: make -C path/to/kernel/src SUBDIRS=$PWD modules This requires that a makefile exits made in accordance to -Documentation/kbuild/makefiles.txt. +Documentation/kbuild/makefiles.txt. Read that file for more details on +the build system. + +The following is a short summary of how to write your Makefile to get +you up and running fast. Assuming your module will be called +yourmodule.ko, your code should be in yourmodule.c and your Makefile +should include + +obj-m := yourmodule.o + +If the code for your module is in multiple files that need to be +linked, you need to tell the build system which files to compile. In +the case of multiple files, none of these files can be named +yourmodule.c because doing so would cause a problem with the linking +step. Assuming your code exists in file1.c, file2.c, and file3.c and +you want to build yourmodule.ko from them, your Makefile should +include + +obj-m := yourmodule.o +yourmodule-objs := file1.o file2.o file3.o + +Now for a final example to put it all together. Assuming the +KERNEL_SOURCE environment variable is set to the directory where you +compiled the kernel, a simple Makefile that builds yourmodule.ko as +described above would look like + +# Tells the build system to build yourmodule.ko. +obj-m := yourmodule.o + +# Tells the build system to build these object files and link them as +# yourmodule.o, before building yourmodule.ko. This line can be left +# out if all the code for your module is in one file, yourmodule.c. If +# you are using multiple files, none of these files can be named +# yourmodule.c. +yourmodule-objs := file1.o file2.o file3.o +# Invokes the kernel build system to come back to the current +# directory and build yourmodule.ko. +default: + make -C ${KERNEL_SOURCE} SUBDIRS=`pwd` modules --- diff/Documentation/kernel-parameters.txt 2004-02-09 10:36:07.000000000 +0000 +++ source/Documentation/kernel-parameters.txt 2004-02-18 09:03:58.000000000 +0000 @@ -174,11 +174,18 @@ atascsi= [HW,SCSI] Atari SCSI - atkbd.set= [HW] Select keyboard code set - Format: + atkbd.extra= [HW] Enable extra LEDs and keys on IBM RapidAccess, EzKey + and similar keyboards + + atkbd.reset= [HW] Reset keyboard during initialization + + atkbd.set= [HW] Select keyboard code set + Format: (2 = AT (default) 3 = PS/2) + + atkbd.scroll= [HW] Enable scroll wheel on MS Office and similar keyboards + atkbd.softrepeat= [HW] Use software keyboard repeat - atkbd.reset= [HW] Reset keyboard during initialization autotest [IA64] @@ -237,7 +244,7 @@ Forces specified timesource (if avaliable) to be used when calculating gettimeofday(). If specicified timesource is not avalible, it defaults to PIT. - Format: { pit | tsc | cyclone | ... } + Format: { pit | tsc | cyclone | pmtmr } hpet= [IA-32,HPET] option to disable HPET and use PIT. Format: disable @@ -292,6 +299,9 @@ devfs= [DEVFS] See Documentation/filesystems/devfs/boot-options. + + dhash_entries= [KNL] + Set number of hash buckets for dentry cache. digi= [HW,SERIAL] IO parameters + enable/disable command. @@ -310,6 +320,23 @@ dtc3181e= [HW,SCSI] + earlyprintk= [x86, x86_64] + early_printk=vga + early_printk=serial[,ttySn[,baudrate]] + + Append ,keep to not disable it when the real console + takes over. + + Only vga or serial at a time, not both. + + Currently only ttyS0 and ttyS1 are supported. + + Interaction with the standard serial driver is not + very good. + + The VGA output is eventually overwritten by the real + console. + eata= [HW,SCSI] eda= [HW,PS2] @@ -424,6 +451,9 @@ idle= [HW] Format: idle=poll or idle=halt + ihash_entries= [KNL] + Set number of hash buckets for inode cache. + in2000= [HW,SCSI] See header of drivers/scsi/in2000.c. @@ -873,6 +903,9 @@ resume= [SWSUSP] Specify the partition device for software suspension + rhash_entries= [KNL,NET] + Set number of hash buckets for route cache + riscom8= [HW,SERIAL] Format: [,[,...]] @@ -1135,6 +1168,9 @@ tgfx_2= See Documentation/input/joystick-parport.txt. tgfx_3= + thash_entries= [KNL,NET] + Set number of hash buckets for TCP connection + tipar= [HW] See header of drivers/char/tipar.c. --- diff/Documentation/networking/baycom.txt 2002-10-16 04:28:34.000000000 +0100 +++ source/Documentation/networking/baycom.txt 2004-02-18 09:03:58.000000000 +0000 @@ -93,10 +93,10 @@ modems it should access at which ports. This can be done with the setbaycom utility. If you are only using one modem, you can also configure the driver from the insmod command line (or by means of an option line in -/etc/modules.conf). +/etc/modprobe.conf). Examples: - insmod baycom_ser_fdx mode="ser12*" iobase=0x3f8 irq=4 + modprobe baycom_ser_fdx mode="ser12*" iobase=0x3f8 irq=4 sethdlc -i bcsf0 -p mode "ser12*" io 0x3f8 irq 4 Both lines configure the first port to drive a ser12 modem at the first --- diff/Documentation/networking/bonding.txt 2004-02-18 08:54:06.000000000 +0000 +++ source/Documentation/networking/bonding.txt 2004-02-18 09:03:58.000000000 +0000 @@ -73,9 +73,9 @@ Bond Configuration ================== -You will need to add at least the following line to /etc/modules.conf +You will need to add at least the following line to /etc/modprobe.conf so the bonding driver will automatically load when the bond0 interface is -configured. Refer to the modules.conf manual page for specific modules.conf +configured. Refer to the modprobe.conf manual page for specific modprobe.conf syntax details. The Module Parameters section of this document describes each bonding driver parameter. @@ -132,10 +132,10 @@ appropriate rc directory. If you specifically need all network drivers loaded before the bonding driver, -adding the following line to modules.conf will cause the network driver for +adding the following line to modprobe.conf will cause the network driver for eth0 and eth1 to be loaded before the bonding driver. -probeall bond0 eth0 eth1 bonding +install bond0 /sbin/modprobe -a eth0 eth1 && /sbin/modprobe bonding Be careful not to reference bond0 itself at the end of the line, or modprobe will die in an endless recursive loop. @@ -191,7 +191,7 @@ Optional parameters for the bonding driver can be supplied as command line arguments to the insmod command. Typically, these parameters are specified in -the file /etc/modules.conf (see the manual page for modules.conf). The +the file /etc/modprobe.conf (see the manual page for modprobe.conf). The available bonding driver parameters are listed below. If a parameter is not specified the default value is used. When initially configuring a bond, it is recommended "tail -f /var/log/messages" be run in a separate window to @@ -742,9 +742,8 @@ # modprobe bonding miimon=100 -Or, put the following lines in /etc/modules.conf: +Or, put the following line in /etc/modprobe.conf: - alias bond0 bonding options bond0 miimon=100 There are currently two policies for high availability. They are dependent on @@ -815,9 +814,8 @@ # modprobe bonding miimon=100 mode=1 -Or, put in your /etc/modules.conf : +Or, put in your /etc/modprobe.conf : - alias bond0 bonding options bond0 miimon=100 mode=active-backup Example 1: Using multiple host and multiple switches to build a "no single @@ -919,7 +917,6 @@ must add the promisc flag there; it will be propagated down to the slave interfaces at ifenslave time; a full example might look like: - grep bond0 /etc/modules.conf || echo alias bond0 bonding >/etc/modules.conf ifconfig bond0 promisc up for if in eth1 eth2 ...;do ifconfig $if up --- diff/Documentation/networking/dl2k.txt 2002-10-16 04:28:29.000000000 +0100 +++ source/Documentation/networking/dl2k.txt 2004-02-18 09:03:58.000000000 +0000 @@ -37,15 +37,15 @@ Install linux driver as following command: 1. make all -2. insmod dl2k.o +2. insmod dl2k.ko 3. ifconfig eth0 up 10.xxx.xxx.xxx netmask 255.0.0.0 ^^^^^^^^^^^^^^^\ ^^^^^^^^\ IP NETMASK Now eth0 should active, you can test it by "ping" or get more information by "ifconfig". If tested ok, continue the next step. -4. cp dl2k.o /lib/modules/`uname -r`/kernel/drivers/net -5. Add the following lines to /etc/modules.conf: +4. cp dl2k.ko /lib/modules/`uname -r`/kernel/drivers/net +5. Add the following line to /etc/modprobe.conf: alias eth0 dl2k 6. Run "netconfig" or "netconf" to create configuration script ifcfg-eth0 located at /etc/sysconfig/network-scripts or create it manually. @@ -154,8 +154,8 @@ ----------------- 1. Copy dl2k.o to the network modules directory, typically /lib/modules/2.x.x-xx/net or /lib/modules/2.x.x/kernel/drivers/net. - 2. Locate the boot module configuration file, most commonly modules.conf - or conf.modules in the /etc directory. Add the following lines: + 2. Locate the boot module configuration file, most commonly modprobe.conf + or modules.conf (for 2.4) in the /etc directory. Add the following lines: alias ethx dl2k options dl2k --- diff/Documentation/networking/ifenslave.c 2004-02-18 08:54:06.000000000 +0000 +++ source/Documentation/networking/ifenslave.c 2004-02-18 09:03:58.000000000 +0000 @@ -89,13 +89,13 @@ * while it is running. It was already set during enslave. To * simplify things, it is now handeled separately. * - * - 2003/09/24 - Shmulik Hen + * - 2003/12/01 - Shmulik Hen * - Code cleanup and style changes * set version to 1.1.0 */ #define APP_VERSION "1.1.0" -#define APP_RELDATE "Septemer 24, 2003" +#define APP_RELDATE "December 1, 2003" #define APP_NAME "ifenslave" static char *version = --- diff/Documentation/networking/ltpc.txt 2002-10-16 04:27:48.000000000 +0100 +++ source/Documentation/networking/ltpc.txt 2004-02-18 09:03:58.000000000 +0000 @@ -25,7 +25,7 @@ If you load the driver as a module, you can pass the parameters "io=", "irq=", and "dma=" on the command line with insmod or modprobe, or add -them as options in /etc/modules.conf: +them as options in /etc/modprobe.conf: alias lt0 ltpc # autoload the module when the interface is configured options ltpc io=0x240 irq=9 dma=1 --- diff/Documentation/networking/sk98lin.txt 2004-02-09 10:36:07.000000000 +0000 +++ source/Documentation/networking/sk98lin.txt 2004-02-18 09:03:58.000000000 +0000 @@ -174,7 +174,7 @@ to the driver module. If you use the kernel module loader, you can set driver parameters -in the file /etc/modules.conf (or old name: /etc/conf.modules). +in the file /etc/modprobe.conf (or /etc/modules.conf in 2.4 or earlier). To set the driver parameters in this file, proceed as follows: 1. Insert a line of the form : --- diff/Documentation/networking/tuntap.txt 2003-05-21 11:49:49.000000000 +0100 +++ source/Documentation/networking/tuntap.txt 2004-02-18 09:03:58.000000000 +0000 @@ -45,13 +45,10 @@ bogus network interfaces to trick firewalls or administrators. Driver module autoloading - Make sure that "Kernel module loader" - module auto-loading support is enabled - in your kernel. - Add the following line to the /etc/modules.conf: - alias char-major-10-200 tun - and run - depmod -a + Make sure that "Kernel module loader" - module auto-loading + support is enabled in your kernel. The kernel should load it on + first access. Manual loading insert the module by hand: --- diff/Documentation/networking/vortex.txt 2003-08-20 14:16:23.000000000 +0100 +++ source/Documentation/networking/vortex.txt 2004-02-18 09:03:58.000000000 +0000 @@ -59,8 +59,8 @@ ================= There are several parameters which may be provided to the driver when -its module is loaded. These are usually placed in /etc/modules.conf -(used to be conf.modules). Example: +its module is loaded. These are usually placed in /etc/modprobe.conf +(/etc/modules.conf in 2.4). Example: options 3c59x debug=3 rx_copybreak=300 @@ -216,6 +216,19 @@ to increase this value on LANs which have very high collision rates. The default value is 5000 (5.0 seconds). +enable_wol=N1,N2,N3,... + + Enable Wake-on-LAN support for the relevant interface. Donald + Becker's `ether-wake' application may be used to wake suspended + machines. + + Also enables the NIC's power management support. + +global_enable_wol=N + + Sets enable_wol mode for all 3c59x NICs in the machine. Entries in + the `enable_wol' array above will override any setting of this. + Media selection --------------- @@ -413,9 +426,9 @@ 1) Increase the debug level. Usually this is done via: - a) modprobe driver.o debug=7 - b) In /etc/conf.modules (or modules.conf): - options driver_name debug=7 + a) modprobe driver debug=7 + b) In /etc/modprobe.conf (or /etc/modules.conf for 2.4): + options driver debug=7 2) Recreate the problem with the higher debug level, send all logs to the maintainer. --- diff/Documentation/parport.txt 2002-10-16 04:28:25.000000000 +0100 +++ source/Documentation/parport.txt 2004-02-18 09:03:58.000000000 +0000 @@ -39,7 +39,7 @@ KMod ---- -If you use kmod, you will find it useful to edit /etc/modules.conf. +If you use kmod, you will find it useful to edit /etc/modprobe.conf. Here is an example of the lines that need to be added: alias parport_lowlevel parport_pc --- diff/Documentation/rocket.txt 2003-06-30 10:07:18.000000000 +0100 +++ source/Documentation/rocket.txt 2004-02-18 09:03:58.000000000 +0000 @@ -43,7 +43,7 @@ If installed as a module, the module must be loaded. This can be done manually by entering "modprobe rocket". To have the module loaded automatically -upon system boot, edit the /etc/modules.conf file and add the line +upon system boot, edit the /etc/modprobe.conf file and add the line "alias char-major-46 rocket". In order to use the ports, their device names (nodes) must be created with mknod. --- diff/Documentation/s390/3270.txt 2003-08-20 14:16:23.000000000 +0100 +++ source/Documentation/s390/3270.txt 2004-02-18 09:03:58.000000000 +0000 @@ -48,7 +48,7 @@ script and the resulting /tmp/mkdev3270. If you have chosen to make tub3270 a module, you add a line to -/etc/modules.conf. If you are working on a VM virtual machine, you +/etc/modprobe.conf. If you are working on a VM virtual machine, you can use DEF GRAF to define virtual 3270 devices. You may generate both 3270 and 3215 console support, or one or the @@ -60,7 +60,7 @@ In brief, these are the steps: 1. Install the tub3270 patch - 2. (If a module) add a line to /etc/modules.conf + 2. (If a module) add a line to /etc/modprobe.conf 3. (If VM) define devices with DEF GRAF 4. Reboot 5. Configure @@ -84,13 +84,13 @@ make modules_install 2. (Perform this step only if you have configured tub3270 as a - module.) Add a line to /etc/modules.conf to automatically + module.) Add a line to /etc/modprobe.conf to automatically load the driver when it's needed. With this line added, you will see login prompts appear on your 3270s as soon as boot is complete (or with emulated 3270s, as soon as you dial into your vm guest using the command "DIAL "). Since the line-mode major number is 227, the line to add to - /etc/modules.conf should be: + /etc/modprobe.conf should be: alias char-major-227 tub3270 3. Define graphic devices to your vm guest machine, if you --- diff/Documentation/scsi/aic79xx.txt 2004-01-19 10:22:54.000000000 +0000 +++ source/Documentation/scsi/aic79xx.txt 2004-02-18 09:03:58.000000000 +0000 @@ -210,7 +210,7 @@ INCORRECTLY CAN RENDER YOUR SYSTEM INOPERABLE. USE THEM WITH CAUTION. - Edit the file "modules.conf" in the directory /etc and add/edit a + Edit the file "modprobe.conf" in the directory /etc and add/edit a line containing 'options aic79xx aic79xx=[command[,command...]]' where 'command' is one or more of the following: ----------------------------------------------------------------- --- diff/Documentation/scsi/aic7xxx.txt 2004-01-19 10:22:54.000000000 +0000 +++ source/Documentation/scsi/aic7xxx.txt 2004-02-18 09:03:58.000000000 +0000 @@ -186,7 +186,7 @@ INCORRECTLY CAN RENDER YOUR SYSTEM INOPERABLE. USE THEM WITH CAUTION. - Edit the file "modules.conf" in the directory /etc and add/edit a + Edit the file "modprobe.conf" in the directory /etc and add/edit a line containing 'options aic7xxx aic7xxx=[command[,command...]]' where 'command' is one or more of the following: ----------------------------------------------------------------- --- diff/Documentation/scsi/osst.txt 2002-11-18 10:11:54.000000000 +0000 +++ source/Documentation/scsi/osst.txt 2004-02-18 09:03:58.000000000 +0000 @@ -67,7 +67,7 @@ If you want to have the module autoloaded on access to /dev/osst, you may add something like alias char-major-206 osst -to your /etc/modules.conf (old name: conf.modules). +to your /etc/modprobe.conf (before 2.6: modules.conf). You may find it convenient to create a symbolic link ln -s nosst0 /dev/tape --- diff/Documentation/sonypi.txt 2003-09-17 12:28:01.000000000 +0100 +++ source/Documentation/sonypi.txt 2004-02-18 09:03:58.000000000 +0000 @@ -43,7 +43,7 @@ --------------- Several options can be passed to the sonypi driver, either by adding them -to /etc/modules.conf file, when the driver is compiled as a module or by +to /etc/modprobe.conf file, when the driver is compiled as a module or by adding the following to the kernel command line (in your bootloader): sonypi=minor[,verbose[,fnkeyinit[,camera[,compat[,mask[,useinput]]]]]] @@ -109,7 +109,7 @@ ----------- In order to automatically load the sonypi module on use, you can put those -lines in your /etc/modules.conf file: +lines in your /etc/modprobe.conf file: alias char-major-10-250 sonypi options sonypi minor=250 --- diff/Documentation/sound/oss/AWE32 2002-10-16 04:28:25.000000000 +0100 +++ source/Documentation/sound/oss/AWE32 2004-02-18 09:03:58.000000000 +0000 @@ -47,12 +47,12 @@ Copy it to a directory of your choice, and unpack it there. -4) Edit /etc/modules.conf, and insert the following lines at the end of the +4) Edit /etc/modprobe.conf, and insert the following lines at the end of the file: alias sound-slot-0 sb alias sound-service-0-1 awe_wave - post-install awe_wave /usr/local/bin/sfxload PATH_TO_SOUND_BANK_FILE + install awe_wave /sbin/modprobe --first-time -i awe_wave && /usr/local/bin/sfxload PATH_TO_SOUND_BANK_FILE You will of course have to change "PATH_TO_SOUND_BANK_FILE" to the full path of of the sound bank file. That will enable the Sound Blaster and AWE --- diff/Documentation/sound/oss/AudioExcelDSP16 2002-10-16 04:27:08.000000000 +0100 +++ source/Documentation/sound/oss/AudioExcelDSP16 2004-02-18 09:03:58.000000000 +0000 @@ -41,7 +41,7 @@ (0x300, 0x310, 0x320 or 0x330) mpu_irq MPU-401 irq line (5, 7, 9, 10 or 0) -The /etc/modules.conf will have lines like this: +The /etc/modprobe.conf will have lines like this: options opl3 io=0x388 options ad1848 io=0x530 irq=11 dma=3 @@ -51,11 +51,11 @@ ad1848 are the corresponding options for the MSS and OPL3 modules. Loading MSS and OPL3 needs to pre load the aedsp16 module to set up correctly -the sound card. Installation dependencies must be written in the modules.conf +the sound card. Installation dependencies must be written in the modprobe.conf file: -pre-install ad1848 modprobe aedsp16 -pre-install opl3 modprobe aedsp16 +install ad1848 /sbin/modprobe aedsp16 && /sbin/modprobe -i ad1848 +install opl3 /sbin/modprobe aedsp16 && /sbin/modprobe -i opl3 Then you must load the sound modules stack in this order: sound -> aedsp16 -> [ ad1848, opl3 ] --- diff/Documentation/sound/oss/CMI8330 2004-01-19 10:22:54.000000000 +0000 +++ source/Documentation/sound/oss/CMI8330 2004-02-18 09:03:58.000000000 +0000 @@ -143,7 +143,7 @@ -Alma Chao suggests the following /etc/modules.conf: +Alma Chao suggests the following /etc/modprobe.conf: alias sound ad1848 alias synth0 opl3 --- diff/Documentation/sound/oss/Introduction 2004-01-19 10:22:54.000000000 +0000 +++ source/Documentation/sound/oss/Introduction 2004-02-18 09:03:58.000000000 +0000 @@ -168,7 +168,7 @@ ========= If loading via modprobe, these common files are automatically loaded -when requested by modprobe. For example, my /etc/modules.conf contains: +when requested by modprobe. For example, my /etc/modprobe.conf contains: alias sound sb options sb io=0x240 irq=9 dma=3 dma16=5 mpu_io=0x300 @@ -228,7 +228,7 @@ driver, you should do the following: 1. remove sound modules (detailed above) -2. remove the sound modules from /etc/modules.conf +2. remove the sound modules from /etc/modprobe.conf 3. move the sound modules from /lib/modules//misc (for example, I make a /lib/modules//misc/tmp directory and copy the sound module files to that @@ -265,7 +265,7 @@ sb.o could be copied (or symlinked) to sb1.o for the second SoundBlaster. -2. Make a second entry in /etc/modules.conf, for example, +2. Make a second entry in /etc/modprobe.conf, for example, sound1 or sb1. This second entry should refer to the new module names for example sb1, and should include the I/O, etc. for the second sound card. @@ -369,7 +369,7 @@ 2) On the command line when using insmod or in a bash script using command line calls to load sound. -3) In /etc/modules.conf when using modprobe. +3) In /etc/modprobe.conf when using modprobe. 4) Via Red Hat's GPL'd /usr/sbin/sndconfig program (text based). --- diff/Documentation/sound/oss/MAD16 2002-10-16 04:29:06.000000000 +0100 +++ source/Documentation/sound/oss/MAD16 2004-02-18 09:03:58.000000000 +0000 @@ -1,4 +1,5 @@ -(This recipe has been edited to update the configuration symbols.) +(This recipe has been edited to update the configuration symbols, + and change over to modprobe.conf for 2.6) From: Shaw Carruthers @@ -20,9 +21,9 @@ CONFIG_SOUND_MAD16=m CONFIG_SOUND_YM3812=m -modules.conf has: +modprobe.conf has: -alias char-major-14 mad16 +alias char-major-14-* mad16 options sb mad16=1 options mad16 io=0x530 irq=7 dma=0 dma16=1 && /usr/local/bin/aumix -w 15 -p 20 -m 0 -1 0 -2 0 -3 0 -i 0 --- diff/Documentation/sound/oss/Maestro3 2002-10-16 04:28:34.000000000 +0100 +++ source/Documentation/sound/oss/Maestro3 2004-02-18 09:03:58.000000000 +0000 @@ -64,7 +64,7 @@ installed with the rest of the modules for the kernel on the system. Typically this will be in /lib/modules/ somewhere. 'alias sound-slot-0 maestro3' should also be added to your module configs (typically -/etc/modules.conf) if you're using modular OSS/Lite sound and want to +/etc/modprobe.conf) if you're using modular OSS/Lite sound and want to default to using a maestro3 chip. There are very few options to the driver. One is 'debug' which will --- diff/Documentation/sound/oss/OPL3-SA2 2002-10-16 04:27:14.000000000 +0100 +++ source/Documentation/sound/oss/OPL3-SA2 2004-02-18 09:03:58.000000000 +0000 @@ -162,7 +162,7 @@ modprobe opl3 io=0x388 See the section "Automatic Module Loading" below for how to set up -/etc/modules.conf to automate this. +/etc/modprobe.conf to automate this. An important thing to remember that the opl3sa2 module's io argument is for it's own control port, which handles the card's master mixer for @@ -196,7 +196,7 @@ Lastly, if you're using modules and want to set up automatic module loading with kmod, the kernel module loader, here is the section I -currently use in my modules.conf file: +currently use in my modprobe.conf file: # Sound alias sound-slot-0 opl3sa2 --- diff/Documentation/sound/oss/Opti 2002-10-16 04:27:53.000000000 +0100 +++ source/Documentation/sound/oss/Opti 2004-02-18 09:03:58.000000000 +0000 @@ -18,7 +18,7 @@ If you have another OS installed on your computer it is recommended that Linux and the other OS use the same resources. -Also, it is recommended that resources specified in /etc/modules.conf +Also, it is recommended that resources specified in /etc/modprobe.conf and resources specified in /etc/isapnp.conf agree. Compiling the sound driver @@ -68,9 +68,9 @@ Using kmod and autoloading the sound driver ------------------------------------------- Comment: as of linux-2.1.90 kmod is replacing kerneld. -The config file '/etc/modules.conf' is used as before. +The config file '/etc/modprobe.conf' is used as before. -This is the sound part of my /etc/modules.conf file. +This is the sound part of my /etc/modprobe.conf file. Following that I will explain each line. alias mixer0 mad16 @@ -80,7 +80,7 @@ options sb mad16=1 options mad16 irq=10 dma=0 dma16=1 io=0x530 joystick=1 cdtype=0 options opl3 io=0x388 -post-install mad16 /sbin/ad1848_mixer_reroute 14 8 15 3 16 6 +install mad16 /sbin/modprobe -i mad16 && /sbin/ad1848_mixer_reroute 14 8 15 3 16 6 If you have an MPU daughtercard or onboard MPU you will want to add to the "options mad16" line - eg --- diff/Documentation/sound/oss/PAS16 2004-01-19 10:22:54.000000000 +0000 +++ source/Documentation/sound/oss/PAS16 2004-02-18 09:03:58.000000000 +0000 @@ -129,7 +129,7 @@ You can then get OPL3 functionality by issuing the command: insmod opl3 In addition, you must either add the following line to - /etc/modules.conf: + /etc/modprobe.conf: options opl3 io=0x388 or else add the following line to /etc/lilo.conf: opl3=0x388 @@ -159,5 +159,5 @@ append="pas2=0x388,10,3,-1,0,-1,-1,-1 opl3=0x388" If sound is built totally modular, the above options may be -specified in /etc/modules.conf for pas2.o, sb.o and opl3.o +specified in /etc/modprobe.conf for pas2, sb and opl3 respectively. --- diff/Documentation/sound/oss/README.modules 2002-10-16 04:27:53.000000000 +0100 +++ source/Documentation/sound/oss/README.modules 2004-02-18 09:03:58.000000000 +0000 @@ -26,10 +26,10 @@ drivers/sound dir. Now one simply configures and makes one's kernel and modules in the usual way. - Then, add to your /etc/modules.conf something like: + Then, add to your /etc/modprobe.conf something like: -alias char-major-14 sb -post-install sb /sbin/modprobe "-k" "adlib_card" +alias char-major-14-* sb +install sb /sbin/modprobe -i sb && /sbin/modprobe adlib_card options sb io=0x220 irq=7 dma=1 dma16=5 mpu_io=0x330 options adlib_card io=0x388 # FM synthesizer @@ -65,12 +65,12 @@ Note that at present there is no way to configure the io, irq and other parameters for the modular drivers as one does for the wired drivers.. One needs to pass the modules the necessary parameters as arguments, either -with /etc/modules.conf or with command-line args to modprobe, e.g. +with /etc/modprobe.conf or with command-line args to modprobe, e.g. -modprobe -k sb io=0x220 irq=7 dma=1 dma16=5 mpu_io=0x330 -modprobe -k adlib_card io=0x388 +modprobe sb io=0x220 irq=7 dma=1 dma16=5 mpu_io=0x330 +modprobe adlib_card io=0x388 - recommend using /etc/modules.conf. + recommend using /etc/modprobe.conf. Persistent DMA Buffers: @@ -88,7 +88,7 @@ To make the sound driver use persistent DMA buffers we need to pass the sound.o module a "dmabuf=1" command-line argument. This is normally done -in /etc/modules.conf like so: +in /etc/modprobe.conf like so: options sound dmabuf=1 --- diff/Documentation/sound/oss/Wavefront 2004-01-19 10:22:54.000000000 +0000 +++ source/Documentation/sound/oss/Wavefront 2004-02-18 09:03:58.000000000 +0000 @@ -189,16 +189,15 @@ 6) How do I configure my card ? ************************************************************ -You need to edit /etc/modules.conf. Here's mine (edited to show the +You need to edit /etc/modprobe.conf. Here's mine (edited to show the relevant details): # Sound system - alias char-major-14 wavefront + alias char-major-14-* wavefront alias synth0 wavefront alias mixer0 cs4232 alias audio0 cs4232 - pre-install wavefront modprobe "-k" "cs4232" - post-install wavefront modprobe "-k" "opl3" + install wavefront /sbin/modprobe cs4232 && /sbin/modprobe -i wavefront && /sbin/modprobe opl3 options wavefront io=0x200 irq=9 options cs4232 synthirq=9 synthio=0x200 io=0x530 irq=5 dma=1 dma2=0 options opl3 io=0x388 --- diff/Documentation/sysctl/fs.txt 2003-01-02 10:43:02.000000000 +0000 +++ source/Documentation/sysctl/fs.txt 2004-02-18 09:03:58.000000000 +0000 @@ -138,3 +138,13 @@ can have. You only need to increase super-max if you need to mount more filesystems than the current value in super-max allows you to. + +============================================================== + +aio-nr & aio-max-nr: + +aio-nr shows the current system-wide number of asynchronous io +requests. aio-max-nr allows you to change the maximum value +aio-nr can grow to. + +============================================================== --- diff/Documentation/usb/acm.txt 2002-10-16 04:27:22.000000000 +0100 +++ source/Documentation/usb/acm.txt 2004-02-18 09:03:58.000000000 +0000 @@ -28,7 +28,7 @@ 1. Usage ~~~~~~~~ - The drivers/usb/acm.c drivers works with USB modems and USB ISDN terminal + The drivers/usb/class/cdc-acm.c drivers works with USB modems and USB ISDN terminal adapters that conform to the Universal Serial Bus Communication Device Class Abstract Control Model (USB CDC ACM) specification. @@ -65,9 +65,9 @@ To use the modems you need these modules loaded: - usbcore.o - usb-[uo]hci.o or uhci.o - acm.o + usbcore.ko + uhci-hcd.ko ohci-hcd.ko or ehci-hcd.ko + cdc-acm.ko After that, the modem[s] should be accessible. You should be able to use minicom, ppp and mgetty with them. --- diff/Documentation/usb/scanner.txt 2003-05-21 11:49:49.000000000 +0100 +++ source/Documentation/usb/scanner.txt 2004-02-18 09:03:58.000000000 +0000 @@ -146,14 +146,14 @@ options scanner vendor=0x#### product=0x**** -to the /etc/modules.conf file replacing the #'s and the *'s with the +to the /etc/modprobe.conf file replacing the #'s and the *'s with the correct IDs. The IDs can be retrieved from the messages file or using "cat /proc/bus/usb/devices". If the default timeout is too low, i.e. there are frequent "timeout" messages, you may want to increase the timeout manually by using the parameter "read_timeout". The time is given in seconds. This is an example for -modules.conf with a timeout of 60 seconds: +modprobe.conf with a timeout of 60 seconds: options scanner read_timeout=60 --- diff/Documentation/video4linux/CQcam.txt 2003-10-09 09:47:33.000000000 +0100 +++ source/Documentation/video4linux/CQcam.txt 2004-02-18 09:03:58.000000000 +0000 @@ -62,7 +62,7 @@ The configuration requires module configuration and device configuration. I like kmod or kerneld process with the -/etc/modules.conf file so the modules can automatically load/unload as +/etc/modprobe.conf file so the modules can automatically load/unload as they are used. The video devices could already exist, be generated using MAKEDEV, or need to be created. The following sections detail these procedures. @@ -71,15 +71,15 @@ 2.1 Module Configuration Using modules requires a bit of work to install and pass the -parameters. Understand that entries in /etc/modules.conf of: +parameters. Understand that entries in /etc/modprobe.conf of: alias parport_lowlevel parport_pc options parport_pc io=0x378 irq=none alias char-major-81 videodev alias char-major-81-0 c-qcam -will cause the kmod/kerneld/modprobe to do certain things. If you are -using kmod or kerneld, then a request for a 'char-major-81-0' will cause +will cause the kmod/modprobe to do certain things. If you are +using kmod, then a request for a 'char-major-81-0' will cause the 'c-qcam' module to load. If you have other video sources with modules, you might want to assign the different minor numbers to different modules. --- diff/Documentation/video4linux/Zoran 2003-09-30 15:46:10.000000000 +0100 +++ source/Documentation/video4linux/Zoran 2004-02-18 09:03:58.000000000 +0000 @@ -233,7 +233,7 @@ option with X being the card number as given in the previous section. To have more than one card, use card=X1[,X2[,X3,[X4[..]]]] -To automate this, add the following to your /etc/modules.conf: +To automate this, add the following to your /etc/modprobe.conf: options zr36067 card=X1[,X2[,X3[,X4[..]]]] alias char-major-81-0 zr36067 --- diff/Documentation/video4linux/bttv/Modules.conf 2002-10-16 04:28:23.000000000 +0100 +++ source/Documentation/video4linux/bttv/Modules.conf 2004-02-18 09:03:58.000000000 +0000 @@ -1,3 +1,6 @@ +# For modern kernels (2.6 or above), this belongs in /etc/modprobe.conf +# For for 2.4 kernels or earlier, this belongs in /etc/modules.conf. + # i2c alias char-major-89 i2c-dev options i2c-core i2c_debug=1 --- diff/Documentation/video4linux/bttv/README 2004-02-09 10:36:07.000000000 +0000 +++ source/Documentation/video4linux/bttv/README 2004-02-18 09:03:58.000000000 +0000 @@ -22,7 +22,7 @@ cards is in CARDLIST.bttv If bttv takes very long to load (happens sometimes with the cheap -cards which have no tuner), try adding this to your modules.conf: +cards which have no tuner), try adding this to your modprobe.conf: options i2c-algo-bit bit_test=1 For the WinTV/PVR you need one firmware file from the driver CD: --- diff/Documentation/video4linux/meye.txt 2003-11-25 15:24:57.000000000 +0000 +++ source/Documentation/video4linux/meye.txt 2004-02-18 09:03:58.000000000 +0000 @@ -42,7 +42,7 @@ --------------- Several options can be passed to the meye driver, either by adding them -to /etc/modules.conf file, when the driver is compiled as a module, or +to /etc/modprobe.conf file, when the driver is compiled as a module, or by adding the following to the kernel command line (in your bootloader): meye=gbuffers[,gbufsize[,video_nr]] @@ -59,7 +59,7 @@ ----------- In order to automatically load the meye module on use, you can put those lines -in your /etc/modules.conf file: +in your /etc/modprobe.conf file: alias char-major-81 videodev alias char-major-81-0 meye --- diff/MAINTAINERS 2004-02-18 08:54:06.000000000 +0000 +++ source/MAINTAINERS 2004-02-18 09:04:03.000000000 +0000 @@ -1186,6 +1186,12 @@ W: http://developer.osdl.org/rddunlap/kj-patches/ S: Maintained +KGDB FOR I386 PLATFORM +P: George Anzinger +M: george@mvista.com +L: linux-net@vger.kernel.org +S: Supported + KERNEL NFSD P: Neil Brown M: neilb@cse.unsw.edu.au --- diff/Makefile 2004-02-18 08:54:06.000000000 +0000 +++ source/Makefile 2004-02-18 09:04:03.000000000 +0000 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 3 -EXTRAVERSION = +EXTRAVERSION = -mm1 NAME=Feisty Dunnart # *DOCUMENTATION* @@ -444,6 +444,7 @@ ifdef CONFIG_DEBUG_INFO CFLAGS += -g +AFLAGS += -g endif # warn about C99 declaration after statement --- diff/arch/alpha/kernel/alpha_ksyms.c 2003-06-30 10:07:32.000000000 +0100 +++ source/arch/alpha/kernel/alpha_ksyms.c 2004-02-18 09:03:57.000000000 +0000 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include --- diff/arch/alpha/kernel/irq.c 2004-01-19 10:22:54.000000000 +0000 +++ source/arch/alpha/kernel/irq.c 2004-02-18 09:03:57.000000000 +0000 @@ -252,7 +252,7 @@ irq_affinity_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, irq_affinity[(long)data]); + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); @@ -333,7 +333,7 @@ prof_cpu_mask_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, *(cpumask_t *)data); + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/alpha/kernel/osf_sys.c 2003-08-20 14:16:23.000000000 +0100 +++ source/arch/alpha/kernel/osf_sys.c 2004-02-18 09:03:57.000000000 +0000 @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -46,7 +47,6 @@ #include extern int do_pipe(int *); -extern asmlinkage unsigned long sys_brk(unsigned long); /* * Brk needs to return an error. Still support Linux's brk(0) query idiom, @@ -821,7 +821,6 @@ affects all sorts of things, like timeval and itimerval. */ extern struct timezone sys_tz; -extern asmlinkage int sys_utimes(char *, struct timeval *); extern int do_adjtimex(struct timex *); struct timeval32 @@ -1315,8 +1314,6 @@ } #ifdef CONFIG_OSF4_COMPAT -extern ssize_t sys_readv(unsigned long, const struct iovec *, unsigned long); -extern ssize_t sys_writev(unsigned long, const struct iovec *, unsigned long); /* Clear top 32 bits of iov_len in the user's buffer for compatibility with old versions of OSF/1 where iov_len --- diff/arch/alpha/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/alpha/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -503,6 +503,7 @@ time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq(&xtime_lock); + clock_was_set(); return 0; } --- diff/arch/arm/Kconfig 2004-02-18 08:54:06.000000000 +0000 +++ source/arch/arm/Kconfig 2004-02-18 09:03:57.000000000 +0000 @@ -639,6 +639,8 @@ source "fs/Kconfig" +source "arch/arm/oprofile/Kconfig" + source "drivers/video/Kconfig" if ARCH_ACORN || ARCH_CLPS7500 || ARCH_TBOX || ARCH_SHARK || ARCH_SA1100 || PCI --- diff/arch/arm/Makefile 2004-01-19 10:22:54.000000000 +0000 +++ source/arch/arm/Makefile 2004-02-18 09:03:57.000000000 +0000 @@ -116,6 +116,7 @@ core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) +drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ drivers-$(CONFIG_ARCH_CLPS7500) += drivers/acorn/char/ drivers-$(CONFIG_ARCH_L7200) += drivers/acorn/char/ --- diff/arch/arm/kernel/armksyms.c 2004-01-19 10:22:54.000000000 +0000 +++ source/arch/arm/kernel/armksyms.c 2004-02-18 09:03:57.000000000 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -44,14 +45,6 @@ extern void __bad_xchg(volatile void *ptr, int size); /* - * syscalls - */ -extern int sys_write(int, const char *, int); -extern int sys_read(int, char *, int); -extern int sys_lseek(int, off_t, int); -extern int sys_exit(int); - -/* * libgcc functions - functions that are used internally by the * compiler... (prototypes are not correct though, but that * doesn't really matter since they're not versioned). --- diff/arch/arm/kernel/sys_arm.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/arm/kernel/sys_arm.c 2004-02-18 09:03:57.000000000 +0000 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -137,7 +138,6 @@ * Perform the select(nd, in, out, ex, tv) and mmap() system * calls. */ -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); struct sel_arg_struct { unsigned long n; --- diff/arch/arm/kernel/time.c 2004-02-18 08:54:06.000000000 +0000 +++ source/arch/arm/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -85,6 +85,9 @@ */ static inline void do_profile(struct pt_regs *regs) { + + profile_hook(regs); + if (!user_mode(regs) && prof_buffer && current->pid) { --- diff/arch/arm26/Kconfig 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/arm26/Kconfig 2004-02-18 09:03:57.000000000 +0000 @@ -216,11 +216,6 @@ source "drivers/char/Kconfig" -config KBDMOUSE - bool - depends on ARCH_ACORN && BUSMOUSE=y - default y - source "drivers/media/Kconfig" source "fs/Kconfig" --- diff/arch/arm26/kernel/armksyms.c 2003-06-30 10:07:18.000000000 +0100 +++ source/arch/arm26/kernel/armksyms.c 2004-02-18 09:03:57.000000000 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -43,14 +44,6 @@ extern void __bad_xchg(volatile void *ptr, int size); /* - * syscalls - */ -extern int sys_write(int, const char *, int); -extern int sys_read(int, char *, int); -extern int sys_lseek(int, off_t, int); -extern int sys_exit(int); - -/* * libgcc functions - functions that are used internally by the * compiler... (prototypes are not correct though, but that * doesn't really matter since they're not versioned). --- diff/arch/arm26/kernel/sys_arm.c 2003-06-30 10:07:18.000000000 +0100 +++ source/arch/arm26/kernel/sys_arm.c 2004-02-18 09:03:57.000000000 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -138,7 +139,6 @@ * Perform the select(nd, in, out, ex, tv) and mmap() system * calls. */ -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); struct sel_arg_struct { unsigned long n; --- diff/arch/arm26/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/arm26/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -179,6 +179,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq(&xtime_lock); + clock_was_set(); return 0; } --- diff/arch/cris/arch-v10/drivers/ethernet.c 2003-07-11 09:39:49.000000000 +0100 +++ source/arch/cris/arch-v10/drivers/ethernet.c 2004-02-18 09:03:57.000000000 +0000 @@ -482,7 +482,7 @@ /* Register device */ err = register_netdev(dev); if (err) { - kfree(dev); + free_netdev(dev); return err; } --- diff/arch/cris/kernel/sys_cris.c 2003-07-11 09:39:50.000000000 +0100 +++ source/arch/cris/kernel/sys_cris.c 2004-02-18 09:03:57.000000000 +0000 @@ -11,6 +11,7 @@ #include #include +#include #include #include #include --- diff/arch/cris/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/cris/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -108,6 +108,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; local_irq_restore(flags); + clock_was_set(); return 0; } --- diff/arch/h8300/kernel/signal.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/h8300/kernel/signal.c 2004-02-18 09:03:57.000000000 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -46,8 +47,6 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) -asmlinkage long sys_wait4(pid_t pid, unsigned int * stat_addr, int options, - struct rusage * ru); asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs); /* --- diff/arch/h8300/kernel/sys_h8300.c 2003-08-20 14:16:24.000000000 +0100 +++ source/arch/h8300/kernel/sys_h8300.c 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -155,8 +156,6 @@ } #endif -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - struct sel_arg_struct { unsigned long n; fd_set *inp, *outp, *exp; @@ -261,7 +260,7 @@ return -EINVAL; } -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) +asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on) { return -ENOSYS; } --- diff/arch/h8300/kernel/time.c 2003-11-25 15:24:57.000000000 +0000 +++ source/arch/h8300/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -139,6 +139,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq(&xtime_lock); + clock_was_set(); return 0; } --- diff/arch/i386/Kconfig 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/Kconfig 2004-02-18 09:03:57.000000000 +0000 @@ -43,6 +43,15 @@ help Choose this option if your computer is a standard PC or compatible. +config X86_ELAN + bool "AMD Elan" + help + Select this for an AMD Elan processor. + + Do not use this option for K6/Athlon/Opteron processors! + + If unsure, choose "PC-compatible" instead. + config X86_VOYAGER bool "Voyager (NCR)" help @@ -130,6 +139,8 @@ default y depends on SMP && X86_ES7000 && MPENTIUMIII +if !X86_ELAN + choice prompt "Processor family" default M686 @@ -222,14 +233,20 @@ extended prefetch instructions in addition to the Pentium II extensions. +config MPENTIUMM + bool "Pentium M" + help + Select this for Intel Pentium M (not Pentium-4 M) + notebook chips. + config MPENTIUM4 - bool "Pentium-4/Celeron(P4-based)/Xeon" + bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon" help - Select this for Intel Pentium 4 chips. This includes both - the Pentium 4 and P4-based Celeron chips. This option - enables compile flags optimized for the chip, uses the - correct cache shift, and applies any applicable Pentium III - optimizations. + Select this for Intel Pentium 4 chips. This includes the + Pentium 4, P4-based Celeron and Xeon, and Pentium-4 M + (not Pentium M) chips. This option enables compile flags + optimized for the chip, uses the correct cache shift, and + applies any applicable Pentium III optimizations. config MK6 bool "K6/K6-II/K6-III" @@ -312,6 +329,8 @@ when it has moderate overhead. This is intended for generic distributions kernels. +endif + # # Define implied options from the CPU selection here # @@ -328,9 +347,9 @@ config X86_L1_CACHE_SHIFT int default "7" if MPENTIUM4 || X86_GENERIC - default "4" if MELAN || M486 || M386 + default "4" if X86_ELAN || M486 || M386 default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 - default "6" if MK7 || MK8 + default "6" if MK7 || MK8 || MPENTIUMM config RWSEM_GENERIC_SPINLOCK bool @@ -374,22 +393,22 @@ config X86_ALIGNMENT_16 bool - depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2 + depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || X86_ELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2 default y config X86_GOOD_APIC bool - depends on MK7 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 + depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 default y config X86_INTEL_USERCOPY bool - depends on MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 + depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 default y config X86_USE_PPRO_CHECKSUM bool - depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 + depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 default y config X86_USE_3DNOW @@ -402,6 +421,54 @@ depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6) && MTRR default y +config X86_4G + bool "4 GB kernel-space and 4 GB user-space virtual memory support" + help + This option is only useful for systems that have more than 1 GB + of RAM. + + The default kernel VM layout leaves 1 GB of virtual memory for + kernel-space mappings, and 3 GB of VM for user-space applications. + This option ups both the kernel-space VM and the user-space VM to + 4 GB. + + The cost of this option is additional TLB flushes done at + system-entry points that transition from user-mode into kernel-mode. + I.e. system calls and page faults, and IRQs that interrupt user-mode + code. There's also additional overhead to kernel operations that copy + memory to/from user-space. The overhead from this is hard to tell and + depends on the workload - it can be anything from no visible overhead + to 20-30% overhead. A good rule of thumb is to count with a runtime + overhead of 20%. + + The upside is the much increased kernel-space VM, which more than + quadruples the maximum amount of RAM supported. Kernels compiled with + this option boot on 64GB of RAM and still have more than 3.1 GB of + 'lowmem' left. Another bonus is that highmem IO bouncing decreases, + if used with drivers that still use bounce-buffers. + + There's also a 33% increase in user-space VM size - database + applications might see a boost from this. + + But the cost of the TLB flushes and the runtime overhead has to be + weighed against the bonuses offered by the larger VM spaces. The + dividing line depends on the actual workload - there might be 4 GB + systems that benefit from this option. Systems with less than 4 GB + of RAM will rarely see a benefit from this option - but it's not + out of question, the exact circumstances have to be considered. + +config X86_SWITCH_PAGETABLES + def_bool X86_4G + +config X86_4G_VM_LAYOUT + def_bool X86_4G + +config X86_UACCESS_INDIRECT + def_bool X86_4G + +config X86_HIGH_ENTRY + def_bool X86_4G + config HPET_TIMER bool "HPET Timer Support" help @@ -459,6 +526,16 @@ This is purely to save memory - each supported CPU adds approximately eight kilobytes to the kernel image. +config SCHED_SMT + bool "SMT (Hyperthreading) scheduler support" + depends on SMP + default off + help + SMT scheduler support improves the CPU scheduler's decision making + when dealing with Intel Pentium 4 chips with HyperThreading at a + cost of slightly increased overhead in some places. If unsure say + N here. + config PREEMPT bool "Preemptible Kernel" help @@ -513,7 +590,7 @@ config X86_TSC bool - depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2) && !X86_NUMAQ + depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2) && !X86_NUMAQ default y config X86_MCE @@ -603,8 +680,6 @@ To compile this driver as a module, choose M here: the module will be called microcode. - If you use modprobe or kmod you may also want to add the line - 'alias char-major-10-184 microcode' to your /etc/modules.conf file. config X86_MSR tristate "/dev/cpu/*/msr - Model-specific register support" @@ -701,7 +776,7 @@ # Common NUMA Features config NUMA bool "Numa Memory Allocation Support" - depends on SMP && HIGHMEM64G && (X86_PC || X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI)) + depends on SMP && HIGHMEM64G && (X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI)) default n if X86_PC default y if (X86_NUMAQ || X86_SUMMIT) @@ -809,6 +884,14 @@ anything about EFI). However, even with this option, the resultant kernel should continue to boot on existing non-EFI platforms. +config IRQBALANCE + bool "Enable kernel irq balancing" + depends on SMP + default y + help + The defalut yes will allow the kernel to do irq load balancing. + Saying no will keep the kernel from doing irq load balancing. + config HAVE_DEC_LOCK bool depends on (SMP || PREEMPT) && X86_CMPXCHG @@ -821,6 +904,19 @@ depends on (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI)) default y +config REGPARM + bool "Use register arguments (EXPERIMENTAL)" + depends on EXPERIMENTAL + default n + help + Compile the kernel with -mregparm=3. This uses an different ABI + and passes the first three arguments of a function call in registers. + This will probably break binary only modules. + + This feature is only enabled for gcc-3.0 and later - earlier compilers + generate incorrect output with certain kernel constructs when + -mregparm=3 is used. + endmenu @@ -1030,12 +1126,16 @@ PCI-based systems don't have any BIOS at all. Linux can also try to detect the PCI hardware directly without using the BIOS. - With this option, you can specify how Linux should detect the PCI - devices. If you choose "BIOS", the BIOS will be used, if you choose - "Direct", the BIOS won't be used, and if you choose "Any", the - kernel will try the direct access method and falls back to the BIOS - if that doesn't work. If unsure, go with the default, which is - "Any". + With this option, you can specify how Linux should detect the + PCI devices. If you choose "BIOS", the BIOS will be used, + if you choose "Direct", the BIOS won't be used, and if you + choose "MMConfig", then PCI Express MMCONFIG will be used. + If you choose "Any", the kernel will try MMCONFIG, then the + direct access method and falls back to the BIOS if that doesn't + work. If unsure, go with the default, which is "Any". + +config PCI_GOMMCONFIG + bool "MMConfig" config PCI_GODIRECT bool "Direct" @@ -1055,6 +1155,12 @@ depends on PCI && ((PCI_GODIRECT || PCI_GOANY) || X86_VISWS) default y +config PCI_MMCONFIG + bool + depends on PCI && (PCI_GOMMCONFIG || PCI_GOANY) + select ACPI_BOOT + default y + config PCI_USE_VECTOR bool "Vector-based interrupt indexing" depends on X86_LOCAL_APIC && X86_IO_APIC @@ -1177,6 +1283,19 @@ Say Y here if you are developing drivers or trying to debug and identify kernel problems. +config EARLY_PRINTK + bool "Early printk" if EMBEDDED + default y + help + Write kernel log output directly into the VGA buffer or to a serial + port. + + This is useful for kernel debugging when your machine crashes very + early before the console code is initialized. For normal operation + it is not recommended because it looks ugly and doesn't cooperate + with klogd/syslogd or the X server. You should normally N here, + unless you want to debug such a crash. + config DEBUG_STACKOVERFLOW bool "Check for stack overflows" depends on DEBUG_KERNEL @@ -1231,6 +1350,15 @@ This results in a large slowdown, but helps to find certain types of memory corruptions. +config SPINLINE + bool "Spinlock inlining" + depends on DEBUG_KERNEL + help + This will change spinlocks from out of line to inline, making them + account cost to the callers in readprofile, rather than the lock + itself (as ".text.lock.filename"). This can be helpful for finding + the callers of locks. + config DEBUG_HIGHMEM bool "Highmem debugging" depends on DEBUG_KERNEL && HIGHMEM @@ -1247,20 +1375,208 @@ Say Y here only if you plan to use gdb to debug the kernel. If you don't debug the kernel, you can say N. +config LOCKMETER + bool "Kernel lock metering" + depends on SMP + help + Say Y to enable kernel lock metering, which adds overhead to SMP locks, + but allows you to see various statistics using the lockstat command. + config DEBUG_SPINLOCK_SLEEP bool "Sleep-inside-spinlock checking" help If you say Y here, various routines which may sleep will become very noisy if they are called with a spinlock held. +config KGDB + bool "Include kgdb kernel debugger" + depends on DEBUG_KERNEL + help + If you say Y here, the system will be compiled with the debug + option (-g) and a debugging stub will be included in the + kernel. This stub communicates with gdb on another (host) + computer via a serial port. The host computer should have + access to the kernel binary file (vmlinux) and a serial port + that is connected to the target machine. Gdb can be made to + configure the serial port or you can use stty and setserial to + do this. See the 'target' command in gdb. This option also + configures in the ability to request a breakpoint early in the + boot process. To request the breakpoint just include 'kgdb' + as a boot option when booting the target machine. The system + will then break as soon as it looks at the boot options. This + option also installs a breakpoint in panic and sends any + kernel faults to the debugger. For more information see the + Documentation/i386/kgdb/kgdb.txt file. + +choice + depends on KGDB + prompt "Debug serial port BAUD" + default KGDB_115200BAUD + help + Gdb and the kernel stub need to agree on the baud rate to be + used. Some systems (x86 family at this writing) allow this to + be configured. + +config KGDB_9600BAUD + bool "9600" + +config KGDB_19200BAUD + bool "19200" + +config KGDB_38400BAUD + bool "38400" + +config KGDB_57600BAUD + bool "57600" + +config KGDB_115200BAUD + bool "115200" +endchoice + +config KGDB_PORT + hex "hex I/O port address of the debug serial port" + depends on KGDB + default 3f8 + help + Some systems (x86 family at this writing) allow the port + address to be configured. The number entered is assumed to be + hex, don't put 0x in front of it. The standard address are: + COM1 3f8 , irq 4 and COM2 2f8 irq 3. Setserial /dev/ttySx + will tell you what you have. It is good to test the serial + connection with a live system before trying to debug. + +config KGDB_IRQ + int "IRQ of the debug serial port" + depends on KGDB + default 4 + help + This is the irq for the debug port. If everything is working + correctly and the kernel has interrupts on a control C to the + port should cause a break into the kernel debug stub. + +config DEBUG_INFO + bool + depends on KGDB + default y + +config KGDB_MORE + bool "Add any additional compile options" + depends on KGDB + default n + help + Saying yes here turns on the ability to enter additional + compile options. + + +config KGDB_OPTIONS + depends on KGDB_MORE + string "Additional compile arguments" + default "-O1" + help + This option allows you enter additional compile options for + the whole kernel compile. Each platform will have a default + that seems right for it. For example on PPC "-ggdb -O1", and + for i386 "-O1". Note that by configuring KGDB "-g" is already + turned on. In addition, on i386 platforms + "-fomit-frame-pointer" is deleted from the standard compile + options. + +config NO_KGDB_CPUS + int "Number of CPUs" + depends on KGDB && SMP + default NR_CPUS + help + + This option sets the number of cpus for kgdb ONLY. It is used + to prune some internal structures so they look "nice" when + displayed with gdb. This is to overcome possibly larger + numbers that may have been entered above. Enter the real + number to get nice clean kgdb_info displays. + +config KGDB_TS + bool "Enable kgdb time stamp macros?" + depends on KGDB + default n + help + Kgdb event macros allow you to instrument your code with calls + to the kgdb event recording function. The event log may be + examined with gdb at a break point. Turning on this + capability also allows you to choose how many events to + keep. Kgdb always keeps the lastest events. + +choice + depends on KGDB_TS + prompt "Max number of time stamps to save?" + default KGDB_TS_128 + +config KGDB_TS_64 + bool "64" + +config KGDB_TS_128 + bool "128" + +config KGDB_TS_256 + bool "256" + +config KGDB_TS_512 + bool "512" + +config KGDB_TS_1024 + bool "1024" + +endchoice + +config STACK_OVERFLOW_TEST + bool "Turn on kernel stack overflow testing?" + depends on KGDB + default n + help + This option enables code in the front line interrupt handlers + to check for kernel stack overflow on interrupts and system + calls. This is part of the kgdb code on x86 systems. + +config KGDB_CONSOLE + bool "Enable serial console thru kgdb port" + depends on KGDB + default n + help + This option enables the command line "console=kgdb" option. + When the system is booted with this option in the command line + all kernel printk output is sent to gdb (as well as to other + consoles). For this to work gdb must be connected. For this + reason, this command line option will generate a breakpoint if + gdb has not yet connected. After the gdb continue command is + given all pent up console output will be printed by gdb on the + host machine. Neither this option, nor KGDB require the + serial driver to be configured. + +config KGDB_SYSRQ + bool "Turn on SysRq 'G' command to do a break?" + depends on KGDB + default y + help + This option includes an option in the SysRq code that allows + you to enter SysRq G which generates a breakpoint to the KGDB + stub. This will work if the keyboard is alive and can + interrupt the system. Because of constraints on when the + serial port interrupt can be enabled, this code may allow you + to interrupt the system before the serial port control C is + available. Just say yes here. + config FRAME_POINTER bool "Compile the kernel with frame pointers" + default KGDB help If you say Y here the resulting kernel image will be slightly larger and slower, but it will give very useful debugging information. If you don't debug the kernel, you can say N, but we may not be able to solve problems without frame pointers. +config MAGIC_SYSRQ + bool + depends on KGDB_SYSRQ + default y + config X86_FIND_SMP_CONFIG bool depends on X86_LOCAL_APIC || X86_VOYAGER --- diff/arch/i386/Makefile 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/Makefile 2004-02-18 09:03:57.000000000 +0000 @@ -19,7 +19,7 @@ OBJCOPYFLAGS := -O binary -R .note -R .comment -S LDFLAGS_vmlinux := -CFLAGS += -pipe +CFLAGS += -pipe -msoft-float # prevent gcc from keeping the stack 16 byte aligned CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,) @@ -34,8 +34,9 @@ cflags-$(CONFIG_M686) += -march=i686 cflags-$(CONFIG_MPENTIUMII) += $(call check_gcc,-march=pentium2,-march=i686) cflags-$(CONFIG_MPENTIUMIII) += $(call check_gcc,-march=pentium3,-march=i686) +cflags-$(CONFIG_MPENTIUMM) += $(call check_gcc,-march=pentium3,-march=i686) cflags-$(CONFIG_MPENTIUM4) += $(call check_gcc,-march=pentium4,-march=i686) -cflags-$(CONFIG_MK6) += $(call check_gcc,-march=k6,-march=i586) +cflags-$(CONFIG_MK6) += -march=k6 # Please note, that patches that add -march=athlon-xp and friends are pointless. # They make zero difference whatsosever to performance at this time. cflags-$(CONFIG_MK7) += $(call check_gcc,-march=athlon,-march=i686 $(align)-functions=4) @@ -47,6 +48,18 @@ cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-march=c3,-march=i486) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 cflags-$(CONFIG_MVIAC3_2) += $(call check_gcc,-march=c3-2,-march=i686) +# AMD Elan support +cflags-$(CONFIG_X86_ELAN) += -march=i486 + +# -mregparm=3 works ok on gcc-3.0 and later +# +GCC_VERSION := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) +cflags-$(CONFIG_REGPARM) += $(shell if [ $(GCC_VERSION) -ge 0300 ] ; then echo "-mregparm=3"; fi ;) + +# Enable unit-at-a-time mode when possible. It shrinks the +# kernel considerably. +CFLAGS += $(call check_gcc,-funit-at-a-time,) + CFLAGS += $(cflags-y) # Default subarch .c files @@ -84,6 +97,9 @@ # default subarch .h files mflags-y += -Iinclude/asm-i386/mach-default +mflags-$(CONFIG_KGDB) += -gdwarf-2 +mflags-$(CONFIG_KGDB_MORE) += $(shell echo $(CONFIG_KGDB_OPTIONS) | sed -e 's/"//g') + head-y := arch/i386/kernel/head.o arch/i386/kernel/init_task.o libs-y += arch/i386/lib/ --- diff/arch/i386/boot/Makefile 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/i386/boot/Makefile 2004-02-18 09:03:57.000000000 +0000 @@ -31,6 +31,8 @@ host-progs := tools/build +HOSTCFLAGS_build.o := -Iinclude + # --------------------------------------------------------------------------- $(obj)/zImage: IMAGE_OFFSET := 0x1000 --- diff/arch/i386/boot/setup.S 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/boot/setup.S 2004-02-18 09:03:57.000000000 +0000 @@ -164,7 +164,7 @@ # can be located anywhere in # low memory 0x10000 or higher. -ramdisk_max: .long MAXMEM-1 # (Header version 0x0203 or later) +ramdisk_max: .long __MAXMEM-1 # (Header version 0x0203 or later) # The highest safe address for # the contents of an initrd @@ -776,7 +776,7 @@ # AMD Elan bug fix by Robert Schwebel. # -#if defined(CONFIG_MELAN) +#if defined(CONFIG_X86_ELAN) movb $0x02, %al # alternate A20 gate outb %al, $0x92 # this works on SC410/SC520 a20_elan_wait: --- diff/arch/i386/kernel/Makefile 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/kernel/Makefile 2004-02-18 09:03:57.000000000 +0000 @@ -7,13 +7,14 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \ pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ - doublefault.o + doublefault.o entry_trampoline.o obj-y += cpu/ obj-y += timers/ obj-$(CONFIG_ACPI_BOOT) += acpi/ obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o obj-$(CONFIG_MCA) += mca.o +obj-$(CONFIG_KGDB) += kgdb_stub.o obj-$(CONFIG_X86_MSR) += msr.o obj-$(CONFIG_X86_CPUID) += cpuid.o obj-$(CONFIG_MICROCODE) += microcode.o @@ -31,6 +32,7 @@ obj-$(CONFIG_ACPI_SRAT) += srat.o obj-$(CONFIG_HPET_TIMER) += time_hpet.o obj-$(CONFIG_EFI) += efi.o efi_stub.o +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o EXTRA_AFLAGS := -traditional --- diff/arch/i386/kernel/acpi/boot.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/acpi/boot.c 2004-02-18 09:03:57.000000000 +0000 @@ -96,6 +96,31 @@ } +#ifdef CONFIG_PCI_MMCONFIG +static int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size) +{ + struct acpi_table_mcfg *mcfg; + + if (!phys_addr || !size) + return -EINVAL; + + mcfg = (struct acpi_table_mcfg *) __acpi_map_table(phys_addr, size); + if (!mcfg) { + printk(KERN_WARNING PREFIX "Unable to map MCFG\n"); + return -ENODEV; + } + + if (mcfg->base_reserved) { + printk(KERN_ERR PREFIX "MMCONFIG not in low 4GB of memory\n"); + return -ENODEV; + } + + pci_mmcfg_base_addr = mcfg->base_address; + + return 0; +} +#endif /* CONFIG_PCI_MMCONFIG */ + #ifdef CONFIG_X86_LOCAL_APIC static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; @@ -339,7 +364,7 @@ * RSDP signature. */ for (offset = 0; offset < length; offset += 16) { - if (strncmp((char *) (start + offset), "RSD PTR ", sig_len)) + if (strncmp((char *) __va(start + offset), "RSD PTR ", sig_len)) continue; return (start + offset); } @@ -376,6 +401,37 @@ } #endif +/* detect the location of the ACPI PM Timer */ +#ifdef CONFIG_X86_PM_TIMER +extern u32 pmtmr_ioport; + +static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) +{ + struct fadt_descriptor_rev2 *fadt =0; + + fadt = (struct fadt_descriptor_rev2*) __acpi_map_table(phys,size); + if(!fadt) { + printk(KERN_WARNING PREFIX "Unable to map FADT\n"); + return 0; + } + + if (fadt->revision >= FADT2_REVISION_ID) { + /* FADT rev. 2 */ + if (fadt->xpm_tmr_blk.address_space_id != ACPI_ADR_SPACE_SYSTEM_IO) + return 0; + + pmtmr_ioport = fadt->xpm_tmr_blk.address; + } else { + /* FADT rev. 1 */ + pmtmr_ioport = fadt->V1_pm_tmr_blk; + } + if (pmtmr_ioport) + printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", pmtmr_ioport); + return 0; +} +#endif + + unsigned long __init acpi_find_rsdp (void) { @@ -398,55 +454,14 @@ return rsdp_phys; } -/* - * acpi_boot_init() - * called from setup_arch(), always. - * 1. maps ACPI tables for later use - * 2. enumerates lapics - * 3. enumerates io-apics - * - * side effects: - * acpi_lapic = 1 if LAPIC found - * acpi_ioapic = 1 if IOAPIC found - * if (acpi_lapic && acpi_ioapic) smp_found_config = 1; - * if acpi_blacklisted() acpi_disabled = 1; - * acpi_irq_model=... - * ... - * - * return value: (currently ignored) - * 0: success - * !0: failure - */ -int __init -acpi_boot_init (void) +static int acpi_apic_setup(void) { - int result = 0; + int result; - if (acpi_disabled && !acpi_ht) - return 1; - - /* - * The default interrupt routing model is PIC (8259). This gets - * overriden if IOAPICs are enumerated (below). - */ - acpi_irq_model = ACPI_IRQ_MODEL_PIC; - - /* - * Initialize the ACPI boot-time table parser. - */ - result = acpi_table_init(); - if (result) { - acpi_disabled = 1; - return result; - } - - result = acpi_blacklisted(); - if (result) { - printk(KERN_WARNING PREFIX "BIOS listed in blacklist, disabling ACPI support\n"); - acpi_disabled = 1; - return result; - } +#ifdef CONFIG_X86_PM_TIMER + acpi_table_parse(ACPI_FADT, acpi_parse_fadt); +#endif #ifdef CONFIG_X86_LOCAL_APIC @@ -506,24 +521,17 @@ acpi_lapic = 1; -#endif /*CONFIG_X86_LOCAL_APIC*/ +#endif /* CONFIG_X86_LOCAL_APIC */ #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) /* * I/O APIC - * -------- */ - /* - * ACPI interpreter is required to complete interrupt setup, - * so if it is off, don't enumerate the io-apics with ACPI. - * If MPS is present, it will handle them, - * otherwise the system will stay in PIC mode - */ - if (acpi_disabled || acpi_noirq) { + if (acpi_noirq) { return 1; - } + } /* * if "noapic" boot option, don't look for IO-APICs @@ -538,8 +546,7 @@ if (!result) { printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); return -ENODEV; - } - else if (result < 0) { + } else if (result < 0) { printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n"); return result; } @@ -569,16 +576,87 @@ #endif /* CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER */ -#ifdef CONFIG_X86_LOCAL_APIC if (acpi_lapic && acpi_ioapic) { smp_found_config = 1; clustered_apic_check(); } -#endif + + return 0; +} + +/* + * acpi_boot_init() + * called from setup_arch(), always. + * 1. maps ACPI tables for later use + * 2. enumerates lapics + * 3. enumerates io-apics + * + * side effects: + * acpi_lapic = 1 if LAPIC found + * acpi_ioapic = 1 if IOAPIC found + * if (acpi_lapic && acpi_ioapic) smp_found_config = 1; + * if acpi_blacklisted() acpi_disabled = 1; + * acpi_irq_model=... + * ... + * + * return value: (currently ignored) + * 0: success + * !0: failure + */ + +int __init +acpi_boot_init (void) +{ + int result, error; + + if (acpi_disabled && !acpi_ht) + return 1; + + /* + * The default interrupt routing model is PIC (8259). This gets + * overriden if IOAPICs are enumerated (below). + */ + acpi_irq_model = ACPI_IRQ_MODEL_PIC; + + /* + * Initialize the ACPI boot-time table parser. + */ + result = acpi_table_init(); + if (result) { + acpi_disabled = 1; + return result; + } + + result = acpi_blacklisted(); + if (result) { + printk(KERN_WARNING PREFIX "BIOS listed in blacklist, disabling ACPI support\n"); + acpi_disabled = 1; + return result; + } + + error = acpi_apic_setup(); + +#ifdef CONFIG_PCI_MMCONFIG + result = acpi_table_parse(ACPI_MCFG, acpi_parse_mcfg); + if (result < 0) { + printk(KERN_ERR PREFIX "Error %d parsing MCFG\n", result); + if (!error) + error = result; + } else if (result > 1) { + printk(KERN_WARNING PREFIX "Multiple MCFG tables exist\n"); + } +#endif /* CONFIG_PCI_MMCONFIG */ #ifdef CONFIG_HPET_TIMER - acpi_table_parse(ACPI_HPET, acpi_parse_hpet); + result = acpi_table_parse(ACPI_HPET, acpi_parse_hpet); + if (result < 0) { + printk(KERN_ERR PREFIX "Error %d parsing HPET\n", result); + if (!error) + error = result; + } else if (result > 1) { + printk(KERN_WARNING PREFIX "Multiple HPET tables exist\n"); + } #endif - return 0; + return error; } --- diff/arch/i386/kernel/asm-offsets.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/asm-offsets.c 2004-02-18 09:03:57.000000000 +0000 @@ -4,9 +4,11 @@ * to extract and format the required data. */ +#include #include #include #include "sigframe.h" +#include #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) @@ -28,4 +30,17 @@ DEFINE(RT_SIGFRAME_sigcontext, offsetof (struct rt_sigframe, uc.uc_mcontext)); + DEFINE(TI_task, offsetof (struct thread_info, task)); + DEFINE(TI_exec_domain, offsetof (struct thread_info, exec_domain)); + DEFINE(TI_flags, offsetof (struct thread_info, flags)); + DEFINE(TI_preempt_count, offsetof (struct thread_info, preempt_count)); + DEFINE(TI_addr_limit, offsetof (struct thread_info, addr_limit)); + DEFINE(TI_real_stack, offsetof (struct thread_info, real_stack)); + DEFINE(TI_virtual_stack, offsetof (struct thread_info, virtual_stack)); + DEFINE(TI_user_pgd, offsetof (struct thread_info, user_pgd)); + + DEFINE(FIX_ENTRY_TRAMPOLINE_0_addr, __fix_to_virt(FIX_ENTRY_TRAMPOLINE_0)); + DEFINE(FIX_VSYSCALL_addr, __fix_to_virt(FIX_VSYSCALL)); + DEFINE(PAGE_SIZE_asm, PAGE_SIZE); + DEFINE(task_thread_db7, offsetof (struct task_struct, thread.debugreg[7])); } --- diff/arch/i386/kernel/cpu/centaur.c 2003-05-21 11:49:49.000000000 +0100 +++ source/arch/i386/kernel/cpu/centaur.c 2004-02-18 09:03:57.000000000 +0000 @@ -246,7 +246,15 @@ lo&=~0x1C0; /* blank bits 8-6 */ wrmsr(MSR_IDT_MCR_CTRL, lo, hi); } -#endif +#endif /* CONFIG_X86_OOSTORE */ + +#define ACE_PRESENT (1 << 6) +#define ACE_ENABLED (1 << 7) +#define ACE_FCR (1 << 28) /* MSR_VIA_FCR */ + +#define RNG_PRESENT (1 << 2) +#define RNG_ENABLED (1 << 3) +#define RNG_ENABLE (1 << 6) /* MSR_VIA_RNG */ static void __init init_c3(struct cpuinfo_x86 *c) { @@ -254,6 +262,24 @@ /* Test for Centaur Extended Feature Flags presence */ if (cpuid_eax(0xC0000000) >= 0xC0000001) { + u32 tmp = cpuid_edx(0xC0000001); + + /* enable ACE unit, if present and disabled */ + if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) { + rdmsr (MSR_VIA_FCR, lo, hi); + lo |= ACE_FCR; /* enable ACE unit */ + wrmsr (MSR_VIA_FCR, lo, hi); + printk(KERN_INFO "CPU: Enabled ACE h/w crypto\n"); + } + + /* enable RNG unit, if present and disabled */ + if ((tmp & (RNG_PRESENT | RNG_ENABLED)) == RNG_PRESENT) { + rdmsr (MSR_VIA_RNG, lo, hi); + lo |= RNG_ENABLE; /* enable RNG unit */ + wrmsr (MSR_VIA_RNG, lo, hi); + printk(KERN_INFO "CPU: Enabled h/w RNG\n"); + } + /* store Centaur Extended Feature Flags as * word 5 of the CPU capability bit array */ --- diff/arch/i386/kernel/cpu/common.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/kernel/cpu/common.c 2004-02-18 09:03:57.000000000 +0000 @@ -514,12 +514,16 @@ set_tss_desc(cpu,t); cpu_gdt_table[cpu][GDT_ENTRY_TSS].b &= 0xfffffdff; load_TR_desc(); - load_LDT(&init_mm.context); + if (cpu) + load_LDT(&init_mm.context); /* Set up doublefault TSS pointer in the GDT */ __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss); cpu_gdt_table[cpu][GDT_ENTRY_DOUBLEFAULT_TSS].b &= 0xfffffdff; + if (cpu) + trap_init_virtual_GDT(); + /* Clear %fs and %gs. */ asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs"); --- diff/arch/i386/kernel/cpu/cpufreq/Kconfig 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/i386/kernel/cpu/cpufreq/Kconfig 2004-02-18 09:03:57.000000000 +0000 @@ -54,7 +54,7 @@ config ELAN_CPUFREQ tristate "AMD Elan" - depends on CPU_FREQ_TABLE && MELAN + depends on CPU_FREQ_TABLE && X86_ELAN ---help--- This adds the CPUFreq driver for AMD Elan SC400 and SC410 processors. --- diff/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 2004-02-18 09:03:57.000000000 +0000 @@ -57,8 +57,7 @@ u32 l, h; cpumask_t cpus_allowed, affected_cpu_map; struct cpufreq_freqs freqs; - int hyperthreading = 0; - int sibling = 0; + int j; if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV)) @@ -68,13 +67,10 @@ cpus_allowed = current->cpus_allowed; /* only run on CPU to be set, or on its sibling */ - affected_cpu_map = cpumask_of_cpu(cpu); -#ifdef CONFIG_X86_HT - hyperthreading = ((cpu_has_ht) && (smp_num_siblings == 2)); - if (hyperthreading) { - sibling = cpu_sibling_map[cpu]; - cpu_set(sibling, affected_cpu_map); - } +#ifdef CONFIG_SMP + affected_cpu_map = cpu_sibling_map[cpu]; +#else + affected_cpu_map = cpumask_of_cpu(cpu); #endif set_cpus_allowed(current, affected_cpu_map); BUG_ON(!cpu_isset(smp_processor_id(), affected_cpu_map)); @@ -97,11 +93,11 @@ /* notifiers */ freqs.old = stock_freq * l / 8; freqs.new = stock_freq * newstate / 8; - freqs.cpu = cpu; - cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); - if (hyperthreading) { - freqs.cpu = sibling; - cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + for_each_cpu(j) { + if (cpu_isset(j, affected_cpu_map)) { + freqs.cpu = j; + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + } } rdmsr(MSR_IA32_THERM_STATUS, l, h); @@ -132,10 +128,11 @@ set_cpus_allowed(current, cpus_allowed); /* notifiers */ - cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); - if (hyperthreading) { - freqs.cpu = cpu; - cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + for_each_cpu(j) { + if (cpu_isset(j, affected_cpu_map)) { + freqs.cpu = j; + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + } } return 0; --- diff/arch/i386/kernel/cpu/intel.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/cpu/intel.c 2004-02-18 09:03:57.000000000 +0000 @@ -10,6 +10,7 @@ #include #include #include +#include #include "cpu.h" @@ -19,8 +20,6 @@ #include #endif -extern int trap_init_f00f_bug(void); - #ifdef CONFIG_X86_INTEL_USERCOPY /* * Alignment at which movsl is preferred for bulk memory copies. @@ -165,7 +164,7 @@ c->f00f_bug = 1; if ( !f00f_workaround_enabled ) { - trap_init_f00f_bug(); + trap_init_virtual_IDT(); printk(KERN_NOTICE "Intel Pentium with F0 0F bug - workaround enabled.\n"); f00f_workaround_enabled = 1; } @@ -248,6 +247,12 @@ /* SEP CPUID bug: Pentium Pro reports SEP but doesn't have it until model 3 mask 3 */ if ((c->x86<<8 | c->x86_model<<4 | c->x86_mask) < 0x633) clear_bit(X86_FEATURE_SEP, c->x86_capability); + /* + * FIXME: SEP is disabled for 4G/4G for now: + */ +#ifdef CONFIG_X86_HIGH_ENTRY + clear_bit(X86_FEATURE_SEP, c->x86_capability); +#endif /* Names for the Pentium II/Celeron processors detectable only by also checking the cache size. --- diff/arch/i386/kernel/cpu/mcheck/non-fatal.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/i386/kernel/cpu/mcheck/non-fatal.c 2004-02-18 09:03:57.000000000 +0000 @@ -24,8 +24,6 @@ #include "mce.h" -static struct timer_list mce_timer; -static int timerset; static int firstbank; #define MCE_RATE 15*HZ /* timer rate is 15s */ @@ -35,14 +33,15 @@ u32 low, high; int i; - preempt_disable(); for (i=firstbank; i 1) - schedule_work (&mce_work); -#endif - mce_timer.expires = jiffies + MCE_RATE; - add_timer (&mce_timer); -} - static int __init init_nonfatal_mce_checker(void) { struct cpuinfo_x86 *c = &boot_cpu_data; @@ -91,17 +80,11 @@ else firstbank = 0; - if (timerset == 0) { - /* Set the timer to check for non-fatal - errors every MCE_RATE seconds */ - init_timer (&mce_timer); - mce_timer.expires = jiffies + MCE_RATE; - mce_timer.data = 0; - mce_timer.function = &mce_timerfunc; - add_timer (&mce_timer); - timerset = 1; - printk(KERN_INFO "Machine check exception polling timer started.\n"); - } + /* + * Check for non-fatal errors every MCE_RATE s + */ + schedule_delayed_work(&mce_work, MCE_RATE); + printk(KERN_INFO "Machine check exception polling timer started.\n"); return 0; } module_init(init_nonfatal_mce_checker); --- diff/arch/i386/kernel/cpu/proc.c 2003-08-26 10:00:51.000000000 +0100 +++ source/arch/i386/kernel/cpu/proc.c 2004-02-18 09:03:57.000000000 +0000 @@ -50,7 +50,7 @@ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* VIA/Cyrix/Centaur-defined */ - NULL, NULL, "xstore", NULL, NULL, NULL, NULL, NULL, + NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, --- diff/arch/i386/kernel/doublefault.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/doublefault.c 2004-02-18 09:03:57.000000000 +0000 @@ -7,12 +7,13 @@ #include #include #include +#include #define DOUBLEFAULT_STACKSIZE (1024) static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE]; #define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE) -#define ptr_ok(x) ((x) > 0xc0000000 && (x) < 0xc1000000) +#define ptr_ok(x) (((x) > __PAGE_OFFSET && (x) < (__PAGE_OFFSET + 0x01000000)) || ((x) >= FIXADDR_START)) static void doublefault_fn(void) { @@ -38,8 +39,8 @@ printk("eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n", t->eax, t->ebx, t->ecx, t->edx); - printk("esi = %08lx, edi = %08lx\n", - t->esi, t->edi); + printk("esi = %08lx, edi = %08lx, ebp = %08lx\n", + t->esi, t->edi, t->ebp); } } --- diff/arch/i386/kernel/edd.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/edd.c 2004-02-18 09:03:57.000000000 +0000 @@ -134,18 +134,18 @@ for (i = 0; i < 4; i++) { if (isprint(info->params.host_bus_type[i])) { - p += snprintf(p, left, "%c", info->params.host_bus_type[i]); + p += scnprintf(p, left, "%c", info->params.host_bus_type[i]); } else { - p += snprintf(p, left, " "); + p += scnprintf(p, left, " "); } } if (!strncmp(info->params.host_bus_type, "ISA", 3)) { - p += snprintf(p, left, "\tbase_address: %x\n", + p += scnprintf(p, left, "\tbase_address: %x\n", info->params.interface_path.isa.base_address); } else if (!strncmp(info->params.host_bus_type, "PCIX", 4) || !strncmp(info->params.host_bus_type, "PCI", 3)) { - p += snprintf(p, left, + p += scnprintf(p, left, "\t%02x:%02x.%d channel: %u\n", info->params.interface_path.pci.bus, info->params.interface_path.pci.slot, @@ -154,12 +154,12 @@ } else if (!strncmp(info->params.host_bus_type, "IBND", 4) || !strncmp(info->params.host_bus_type, "XPRS", 4) || !strncmp(info->params.host_bus_type, "HTPT", 4)) { - p += snprintf(p, left, + p += scnprintf(p, left, "\tTBD: %llx\n", info->params.interface_path.ibnd.reserved); } else { - p += snprintf(p, left, "\tunknown: %llx\n", + p += scnprintf(p, left, "\tunknown: %llx\n", info->params.interface_path.unknown.reserved); } return (p - buf); @@ -178,43 +178,43 @@ for (i = 0; i < 8; i++) { if (isprint(info->params.interface_type[i])) { - p += snprintf(p, left, "%c", info->params.interface_type[i]); + p += scnprintf(p, left, "%c", info->params.interface_type[i]); } else { - p += snprintf(p, left, " "); + p += scnprintf(p, left, " "); } } if (!strncmp(info->params.interface_type, "ATAPI", 5)) { - p += snprintf(p, left, "\tdevice: %u lun: %u\n", + p += scnprintf(p, left, "\tdevice: %u lun: %u\n", info->params.device_path.atapi.device, info->params.device_path.atapi.lun); } else if (!strncmp(info->params.interface_type, "ATA", 3)) { - p += snprintf(p, left, "\tdevice: %u\n", + p += scnprintf(p, left, "\tdevice: %u\n", info->params.device_path.ata.device); } else if (!strncmp(info->params.interface_type, "SCSI", 4)) { - p += snprintf(p, left, "\tid: %u lun: %llu\n", + p += scnprintf(p, left, "\tid: %u lun: %llu\n", info->params.device_path.scsi.id, info->params.device_path.scsi.lun); } else if (!strncmp(info->params.interface_type, "USB", 3)) { - p += snprintf(p, left, "\tserial_number: %llx\n", + p += scnprintf(p, left, "\tserial_number: %llx\n", info->params.device_path.usb.serial_number); } else if (!strncmp(info->params.interface_type, "1394", 4)) { - p += snprintf(p, left, "\teui: %llx\n", + p += scnprintf(p, left, "\teui: %llx\n", info->params.device_path.i1394.eui); } else if (!strncmp(info->params.interface_type, "FIBRE", 5)) { - p += snprintf(p, left, "\twwid: %llx lun: %llx\n", + p += scnprintf(p, left, "\twwid: %llx lun: %llx\n", info->params.device_path.fibre.wwid, info->params.device_path.fibre.lun); } else if (!strncmp(info->params.interface_type, "I2O", 3)) { - p += snprintf(p, left, "\tidentity_tag: %llx\n", + p += scnprintf(p, left, "\tidentity_tag: %llx\n", info->params.device_path.i2o.identity_tag); } else if (!strncmp(info->params.interface_type, "RAID", 4)) { - p += snprintf(p, left, "\tidentity_tag: %x\n", + p += scnprintf(p, left, "\tidentity_tag: %x\n", info->params.device_path.raid.array_number); } else if (!strncmp(info->params.interface_type, "SATA", 4)) { - p += snprintf(p, left, "\tdevice: %u\n", + p += scnprintf(p, left, "\tdevice: %u\n", info->params.device_path.sata.device); } else { - p += snprintf(p, left, "\tunknown: %llx %llx\n", + p += scnprintf(p, left, "\tunknown: %llx %llx\n", info->params.device_path.unknown.reserved1, info->params.device_path.unknown.reserved2); } @@ -256,7 +256,7 @@ return -EINVAL; } - p += snprintf(p, left, "0x%02x\n", info->version); + p += scnprintf(p, left, "0x%02x\n", info->version); return (p - buf); } @@ -264,7 +264,7 @@ edd_show_disk80_sig(struct edd_device *edev, char *buf) { char *p = buf; - p += snprintf(p, left, "0x%08x\n", edd_disk80_sig); + p += scnprintf(p, left, "0x%08x\n", edd_disk80_sig); return (p - buf); } @@ -278,16 +278,16 @@ } if (info->interface_support & EDD_EXT_FIXED_DISK_ACCESS) { - p += snprintf(p, left, "Fixed disk access\n"); + p += scnprintf(p, left, "Fixed disk access\n"); } if (info->interface_support & EDD_EXT_DEVICE_LOCKING_AND_EJECTING) { - p += snprintf(p, left, "Device locking and ejecting\n"); + p += scnprintf(p, left, "Device locking and ejecting\n"); } if (info->interface_support & EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT) { - p += snprintf(p, left, "Enhanced Disk Drive support\n"); + p += scnprintf(p, left, "Enhanced Disk Drive support\n"); } if (info->interface_support & EDD_EXT_64BIT_EXTENSIONS) { - p += snprintf(p, left, "64-bit extensions\n"); + p += scnprintf(p, left, "64-bit extensions\n"); } return (p - buf); } @@ -302,21 +302,21 @@ } if (info->params.info_flags & EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT) - p += snprintf(p, left, "DMA boundary error transparent\n"); + p += scnprintf(p, left, "DMA boundary error transparent\n"); if (info->params.info_flags & EDD_INFO_GEOMETRY_VALID) - p += snprintf(p, left, "geometry valid\n"); + p += scnprintf(p, left, "geometry valid\n"); if (info->params.info_flags & EDD_INFO_REMOVABLE) - p += snprintf(p, left, "removable\n"); + p += scnprintf(p, left, "removable\n"); if (info->params.info_flags & EDD_INFO_WRITE_VERIFY) - p += snprintf(p, left, "write verify\n"); + p += scnprintf(p, left, "write verify\n"); if (info->params.info_flags & EDD_INFO_MEDIA_CHANGE_NOTIFICATION) - p += snprintf(p, left, "media change notification\n"); + p += scnprintf(p, left, "media change notification\n"); if (info->params.info_flags & EDD_INFO_LOCKABLE) - p += snprintf(p, left, "lockable\n"); + p += scnprintf(p, left, "lockable\n"); if (info->params.info_flags & EDD_INFO_NO_MEDIA_PRESENT) - p += snprintf(p, left, "no media present\n"); + p += scnprintf(p, left, "no media present\n"); if (info->params.info_flags & EDD_INFO_USE_INT13_FN50) - p += snprintf(p, left, "use int13 fn50\n"); + p += scnprintf(p, left, "use int13 fn50\n"); return (p - buf); } @@ -329,7 +329,7 @@ return -EINVAL; } - p += snprintf(p, left, "0x%x\n", info->params.num_default_cylinders); + p += scnprintf(p, left, "0x%x\n", info->params.num_default_cylinders); return (p - buf); } @@ -342,7 +342,7 @@ return -EINVAL; } - p += snprintf(p, left, "0x%x\n", info->params.num_default_heads); + p += scnprintf(p, left, "0x%x\n", info->params.num_default_heads); return (p - buf); } @@ -355,7 +355,7 @@ return -EINVAL; } - p += snprintf(p, left, "0x%x\n", info->params.sectors_per_track); + p += scnprintf(p, left, "0x%x\n", info->params.sectors_per_track); return (p - buf); } @@ -368,7 +368,7 @@ return -EINVAL; } - p += snprintf(p, left, "0x%llx\n", info->params.number_of_sectors); + p += scnprintf(p, left, "0x%llx\n", info->params.number_of_sectors); return (p - buf); } --- diff/arch/i386/kernel/entry.S 2003-11-25 15:24:57.000000000 +0000 +++ source/arch/i386/kernel/entry.S 2004-02-18 09:03:57.000000000 +0000 @@ -43,11 +43,25 @@ #include #include #include +#include #include #include +#include #include #include #include "irq_vectors.h" + /* We do not recover from a stack overflow, but at least + * we know it happened and should be able to track it down. + */ +#ifdef CONFIG_STACK_OVERFLOW_TEST +#define STACK_OVERFLOW_TEST \ + testl $7680,%esp; \ + jnz 10f; \ + call stack_overflow; \ +10: +#else +#define STACK_OVERFLOW_TEST +#endif #define nr_syscalls ((syscall_table_size)/4) @@ -87,7 +101,102 @@ #define resume_kernel restore_all #endif -#define SAVE_ALL \ +#ifdef CONFIG_X86_HIGH_ENTRY + +#ifdef CONFIG_X86_SWITCH_PAGETABLES + +#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) +/* + * If task is preempted in __SWITCH_KERNELSPACE, and moved to another cpu, + * __switch_to repoints %esp to the appropriate virtual stack; but %ebp is + * left stale, so we must check whether to repeat the real stack calculation. + */ +#define repeat_if_esp_changed \ + xorl %esp, %ebp; \ + testl $0xffffe000, %ebp; \ + jnz 0b +#else +#define repeat_if_esp_changed +#endif + +/* clobbers ebx, edx and ebp */ + +#define __SWITCH_KERNELSPACE \ + cmpl $0xff000000, %esp; \ + jb 1f; \ + \ + /* \ + * switch pagetables and load the real stack, \ + * keep the stack offset: \ + */ \ + \ + movl $swapper_pg_dir-__PAGE_OFFSET, %edx; \ + \ + /* GET_THREAD_INFO(%ebp) intermixed */ \ +0: \ + movl %esp, %ebp; \ + movl %esp, %ebx; \ + andl $0xffffe000, %ebp; \ + andl $0x00001fff, %ebx; \ + orl TI_real_stack(%ebp), %ebx; \ + repeat_if_esp_changed; \ + \ + movl %edx, %cr3; \ + movl %ebx, %esp; \ +1: + +#endif + + +#define __SWITCH_USERSPACE \ + /* interrupted any of the user return paths? */ \ + \ + movl EIP(%esp), %eax; \ + \ + cmpl $int80_ret_start_marker, %eax; \ + jb 33f; /* nope - continue with sysexit check */\ + cmpl $int80_ret_end_marker, %eax; \ + jb 22f; /* yes - switch to virtual stack */ \ +33: \ + cmpl $sysexit_ret_start_marker, %eax; \ + jb 44f; /* nope - continue with user check */ \ + cmpl $sysexit_ret_end_marker, %eax; \ + jb 22f; /* yes - switch to virtual stack */ \ + /* return to userspace? */ \ +44: \ + movl EFLAGS(%esp),%ecx; \ + movb CS(%esp),%cl; \ + testl $(VM_MASK | 3),%ecx; \ + jz 2f; \ +22: \ + /* \ + * switch to the virtual stack, then switch to \ + * the userspace pagetables. \ + */ \ + \ + GET_THREAD_INFO(%ebp); \ + movl TI_virtual_stack(%ebp), %edx; \ + movl TI_user_pgd(%ebp), %ecx; \ + \ + movl %esp, %ebx; \ + andl $0x1fff, %ebx; \ + orl %ebx, %edx; \ +int80_ret_start_marker: \ + movl %edx, %esp; \ + movl %ecx, %cr3; \ + \ + __RESTORE_ALL; \ +int80_ret_end_marker: \ +2: + +#else /* !CONFIG_X86_HIGH_ENTRY */ + +#define __SWITCH_KERNELSPACE +#define __SWITCH_USERSPACE + +#endif + +#define __SAVE_ALL \ cld; \ pushl %es; \ pushl %ds; \ @@ -102,7 +211,7 @@ movl %edx, %ds; \ movl %edx, %es; -#define RESTORE_INT_REGS \ +#define __RESTORE_INT_REGS \ popl %ebx; \ popl %ecx; \ popl %edx; \ @@ -111,29 +220,28 @@ popl %ebp; \ popl %eax -#define RESTORE_REGS \ - RESTORE_INT_REGS; \ -1: popl %ds; \ -2: popl %es; \ +#define __RESTORE_REGS \ + __RESTORE_INT_REGS; \ +111: popl %ds; \ +222: popl %es; \ .section .fixup,"ax"; \ -3: movl $0,(%esp); \ - jmp 1b; \ -4: movl $0,(%esp); \ - jmp 2b; \ +444: movl $0,(%esp); \ + jmp 111b; \ +555: movl $0,(%esp); \ + jmp 222b; \ .previous; \ .section __ex_table,"a";\ .align 4; \ - .long 1b,3b; \ - .long 2b,4b; \ + .long 111b,444b;\ + .long 222b,555b;\ .previous - -#define RESTORE_ALL \ - RESTORE_REGS \ +#define __RESTORE_ALL \ + __RESTORE_REGS \ addl $4, %esp; \ -1: iret; \ +333: iret; \ .section .fixup,"ax"; \ -2: sti; \ +666: sti; \ movl $(__USER_DS), %edx; \ movl %edx, %ds; \ movl %edx, %es; \ @@ -142,10 +250,19 @@ .previous; \ .section __ex_table,"a";\ .align 4; \ - .long 1b,2b; \ + .long 333b,666b;\ .previous +#define SAVE_ALL \ + __SAVE_ALL; \ + __SWITCH_KERNELSPACE; \ + STACK_OVERFLOW_TEST; + +#define RESTORE_ALL \ + __SWITCH_USERSPACE; \ + __RESTORE_ALL; +.section .entry.text,"ax" ENTRY(lcall7) pushfl # We get a different stack layout with call @@ -163,7 +280,7 @@ movl %edx,EIP(%ebp) # Now we move them to their "normal" places movl %ecx,CS(%ebp) # andl $-8192, %ebp # GET_THREAD_INFO - movl TI_EXEC_DOMAIN(%ebp), %edx # Get the execution domain + movl TI_exec_domain(%ebp), %edx # Get the execution domain call *4(%edx) # Call the lcall7 handler for the domain addl $4, %esp popl %eax @@ -208,7 +325,7 @@ cli # make sure we don't miss an interrupt # setting need_resched or sigpending # between sampling and the iret - movl TI_FLAGS(%ebp), %ecx + movl TI_flags(%ebp), %ecx andl $_TIF_WORK_MASK, %ecx # is there any work to be done on # int/exception return? jne work_pending @@ -216,18 +333,18 @@ #ifdef CONFIG_PREEMPT ENTRY(resume_kernel) - cmpl $0,TI_PRE_COUNT(%ebp) # non-zero preempt_count ? + cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ? jnz restore_all need_resched: - movl TI_FLAGS(%ebp), %ecx # need_resched set ? + movl TI_flags(%ebp), %ecx # need_resched set ? testb $_TIF_NEED_RESCHED, %cl jz restore_all testl $IF_MASK,EFLAGS(%esp) # interrupts off (exception path) ? jz restore_all - movl $PREEMPT_ACTIVE,TI_PRE_COUNT(%ebp) + movl $PREEMPT_ACTIVE,TI_preempt_count(%ebp) sti call schedule - movl $0,TI_PRE_COUNT(%ebp) + movl $0,TI_preempt_count(%ebp) cli jmp need_resched #endif @@ -246,37 +363,50 @@ pushl $(__USER_CS) pushl $SYSENTER_RETURN -/* - * Load the potential sixth argument from user stack. - * Careful about security. - */ - cmpl $__PAGE_OFFSET-3,%ebp - jae syscall_fault -1: movl (%ebp),%ebp -.section __ex_table,"a" - .align 4 - .long 1b,syscall_fault -.previous - pushl %eax SAVE_ALL GET_THREAD_INFO(%ebp) cmpl $(nr_syscalls), %eax jae syscall_badsys - testb $_TIF_SYSCALL_TRACE,TI_FLAGS(%ebp) + testb $_TIF_SYSCALL_TRACE,TI_flags(%ebp) jnz syscall_trace_entry call *sys_call_table(,%eax,4) movl %eax,EAX(%esp) cli - movl TI_FLAGS(%ebp), %ecx + movl TI_flags(%ebp), %ecx testw $_TIF_ALLWORK_MASK, %cx jne syscall_exit_work + +#ifdef CONFIG_X86_SWITCH_PAGETABLES + + GET_THREAD_INFO(%ebp) + movl TI_virtual_stack(%ebp), %edx + movl TI_user_pgd(%ebp), %ecx + movl %esp, %ebx + andl $0x1fff, %ebx + orl %ebx, %edx +sysexit_ret_start_marker: + movl %edx, %esp + movl %ecx, %cr3 +#endif + /* + * only ebx is not restored by the userspace sysenter vsyscall + * code, it assumes it to be callee-saved. + */ + movl EBX(%esp), %ebx + /* if something modifies registers it must also disable sysexit */ + movl EIP(%esp), %edx movl OLDESP(%esp), %ecx + sti sysexit +#ifdef CONFIG_X86_SWITCH_PAGETABLES +sysexit_ret_end_marker: + nop +#endif # system call handler stub @@ -287,7 +417,7 @@ cmpl $(nr_syscalls), %eax jae syscall_badsys # system call tracing in operation - testb $_TIF_SYSCALL_TRACE,TI_FLAGS(%ebp) + testb $_TIF_SYSCALL_TRACE,TI_flags(%ebp) jnz syscall_trace_entry syscall_call: call *sys_call_table(,%eax,4) @@ -296,10 +426,23 @@ cli # make sure we don't miss an interrupt # setting need_resched or sigpending # between sampling and the iret - movl TI_FLAGS(%ebp), %ecx + movl TI_flags(%ebp), %ecx testw $_TIF_ALLWORK_MASK, %cx # current->work jne syscall_exit_work restore_all: +#ifdef CONFIG_TRAP_BAD_SYSCALL_EXITS + movl EFLAGS(%esp), %eax # mix EFLAGS and CS + movb CS(%esp), %al + testl $(VM_MASK | 3), %eax + jz resume_kernelX # returning to kernel or vm86-space + + cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ? + jz resume_kernelX + + int $3 + +resume_kernelX: +#endif RESTORE_ALL # perform work that needs to be done immediately before resumption @@ -312,7 +455,7 @@ cli # make sure we don't miss an interrupt # setting need_resched or sigpending # between sampling and the iret - movl TI_FLAGS(%ebp), %ecx + movl TI_flags(%ebp), %ecx andl $_TIF_WORK_MASK, %ecx # is there any work to be done other # than syscall tracing? jz restore_all @@ -327,6 +470,22 @@ # vm86-space xorl %edx, %edx call do_notify_resume + +#if CONFIG_X86_HIGH_ENTRY + /* + * Reload db7 if necessary: + */ + movl TI_flags(%ebp), %ecx + testb $_TIF_DB7, %cl + jnz work_db7 + + jmp restore_all + +work_db7: + movl TI_task(%ebp), %edx; + movl task_thread_db7(%edx), %edx; + movl %edx, %db7; +#endif jmp restore_all ALIGN @@ -382,7 +541,7 @@ */ .data ENTRY(interrupt) -.text +.previous vector=0 ENTRY(irq_entries_start) @@ -392,7 +551,7 @@ jmp common_interrupt .data .long 1b -.text +.previous vector=vector+1 .endr @@ -433,12 +592,17 @@ movl ES(%esp), %edi # get the function address movl %eax, ORIG_EAX(%esp) movl %ecx, ES(%esp) - movl %esp, %edx pushl %esi # push the error code - pushl %edx # push the pt_regs pointer movl $(__USER_DS), %edx movl %edx, %ds movl %edx, %es + +/* clobbers edx, ebx and ebp */ + __SWITCH_KERNELSPACE + + leal 4(%esp), %edx # prepare pt_regs + pushl %edx # push pt_regs + call *%edi addl $8, %esp jmp ret_from_exception @@ -515,8 +679,8 @@ /* Do not access memory above the end of our stack page, * it might not exist. */ - andl $0x1fff,%eax - cmpl $0x1fec,%eax + andl $(THREAD_SIZE-1),%eax + cmpl $(THREAD_SIZE-20),%eax popl %eax jae nmi_stack_correct cmpl $sysenter_entry,12(%esp) @@ -529,7 +693,7 @@ pushl %edx call do_nmi addl $8, %esp - RESTORE_ALL + jmp restore_all nmi_stack_fixup: FIX_STACK(12,nmi_stack_correct, 1) @@ -606,6 +770,8 @@ pushl $do_spurious_interrupt_bug jmp error_code +.previous + .data ENTRY(sys_call_table) .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ --- diff/arch/i386/kernel/head.S 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/head.S 2004-02-18 09:03:57.000000000 +0000 @@ -16,6 +16,8 @@ #include #include #include +#include +#include #define OLD_CL_MAGIC_ADDR 0x90020 #define OLD_CL_MAGIC 0xA33F @@ -325,12 +327,12 @@ ret ENTRY(stack_start) - .long init_thread_union+8192 + .long init_thread_union+THREAD_SIZE .long __BOOT_DS /* This is the default interrupt "handler" :-) */ int_msg: - .asciz "Unknown interrupt\n" + .asciz "Unknown interrupt or fault at EIP %p %p %p\n" ALIGN ignore_int: cld @@ -342,9 +344,17 @@ movl $(__KERNEL_DS),%eax movl %eax,%ds movl %eax,%es + pushl 16(%esp) + pushl 24(%esp) + pushl 32(%esp) + pushl 40(%esp) pushl $int_msg call printk popl %eax + popl %eax + popl %eax + popl %eax + popl %eax popl %ds popl %es popl %edx @@ -377,23 +387,27 @@ .fill NR_CPUS-1,8,0 # space for the other GDT descriptors /* - * This is initialized to create an identity-mapping at 0-8M (for bootup - * purposes) and another mapping of the 0-8M area at virtual address + * This is initialized to create an identity-mapping at 0-16M (for bootup + * purposes) and another mapping of the 0-16M area at virtual address * PAGE_OFFSET. */ .org 0x1000 ENTRY(swapper_pg_dir) .long 0x00102007 .long 0x00103007 - .fill BOOT_USER_PGD_PTRS-2,4,0 - /* default: 766 entries */ + .long 0x00104007 + .long 0x00105007 + .fill BOOT_USER_PGD_PTRS-4,4,0 + /* default: 764 entries */ .long 0x00102007 .long 0x00103007 - /* default: 254 entries */ - .fill BOOT_KERNEL_PGD_PTRS-2,4,0 + .long 0x00104007 + .long 0x00105007 + /* default: 252 entries */ + .fill BOOT_KERNEL_PGD_PTRS-4,4,0 /* - * The page tables are initialized to only 8MB here - the final page + * The page tables are initialized to only 16MB here - the final page * tables are set up later depending on memory size. */ .org 0x2000 @@ -402,15 +416,21 @@ .org 0x3000 ENTRY(pg1) +.org 0x4000 +ENTRY(pg2) + +.org 0x5000 +ENTRY(pg3) + /* * empty_zero_page must immediately follow the page tables ! (The * initialization loop counts until empty_zero_page) */ -.org 0x4000 +.org 0x6000 ENTRY(empty_zero_page) -.org 0x5000 +.org 0x7000 /* * Real beginning of normal "text" segment @@ -419,12 +439,12 @@ ENTRY(_stext) /* - * This starts the data section. Note that the above is all - * in the text section because it has alignment requirements - * that we cannot fulfill any other way. + * This starts the data section. */ .data +.align PAGE_SIZE_asm + /* * The Global Descriptor Table contains 28 quadwords, per-CPU. */ @@ -439,7 +459,9 @@ .quad 0x00cf9a000000ffff /* kernel 4GB code at 0x00000000 */ .quad 0x00cf92000000ffff /* kernel 4GB data at 0x00000000 */ #endif - .align L1_CACHE_BYTES + +.align PAGE_SIZE_asm + ENTRY(cpu_gdt_table) .quad 0x0000000000000000 /* NULL descriptor */ .quad 0x0000000000000000 /* 0x0b reserved */ --- diff/arch/i386/kernel/i386_ksyms.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/i386_ksyms.c 2004-02-18 09:03:57.000000000 +0000 @@ -97,7 +97,6 @@ EXPORT_SYMBOL_NOVERS(__down_failed_trylock); EXPORT_SYMBOL_NOVERS(__up_wakeup); /* Networking helper routines. */ -EXPORT_SYMBOL(csum_partial_copy_generic); /* Delay loops */ EXPORT_SYMBOL(__ndelay); EXPORT_SYMBOL(__udelay); @@ -111,13 +110,17 @@ EXPORT_SYMBOL(strpbrk); EXPORT_SYMBOL(strstr); +#if !defined(CONFIG_X86_UACCESS_INDIRECT) EXPORT_SYMBOL(strncpy_from_user); -EXPORT_SYMBOL(__strncpy_from_user); +EXPORT_SYMBOL(__direct_strncpy_from_user); EXPORT_SYMBOL(clear_user); EXPORT_SYMBOL(__clear_user); EXPORT_SYMBOL(__copy_from_user_ll); EXPORT_SYMBOL(__copy_to_user_ll); EXPORT_SYMBOL(strnlen_user); +#else /* CONFIG_X86_UACCESS_INDIRECT */ +EXPORT_SYMBOL(direct_csum_partial_copy_generic); +#endif EXPORT_SYMBOL(dma_alloc_coherent); EXPORT_SYMBOL(dma_free_coherent); --- diff/arch/i386/kernel/i387.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/i387.c 2004-02-18 09:03:57.000000000 +0000 @@ -218,6 +218,7 @@ static int convert_fxsr_to_user( struct _fpstate __user *buf, struct i387_fxsave_struct *fxsave ) { + struct _fpreg tmp[8]; /* 80 bytes scratch area */ unsigned long env[7]; struct _fpreg __user *to; struct _fpxreg *from; @@ -234,23 +235,25 @@ if ( __copy_to_user( buf, env, 7 * sizeof(unsigned long) ) ) return 1; - to = &buf->_st[0]; + to = tmp; from = (struct _fpxreg *) &fxsave->st_space[0]; for ( i = 0 ; i < 8 ; i++, to++, from++ ) { unsigned long *t = (unsigned long *)to; unsigned long *f = (unsigned long *)from; - if (__put_user(*f, t) || - __put_user(*(f + 1), t + 1) || - __put_user(from->exponent, &to->exponent)) - return 1; + *t = *f; + *(t + 1) = *(f+1); + to->exponent = from->exponent; } + if (copy_to_user(buf->_st, tmp, sizeof(struct _fpreg [8]))) + return 1; return 0; } static int convert_fxsr_from_user( struct i387_fxsave_struct *fxsave, struct _fpstate __user *buf ) { + struct _fpreg tmp[8]; /* 80 bytes scratch area */ unsigned long env[7]; struct _fpxreg *to; struct _fpreg __user *from; @@ -258,6 +261,8 @@ if ( __copy_from_user( env, buf, 7 * sizeof(long) ) ) return 1; + if (copy_from_user(tmp, buf->_st, sizeof(struct _fpreg [8]))) + return 1; fxsave->cwd = (unsigned short)(env[0] & 0xffff); fxsave->swd = (unsigned short)(env[1] & 0xffff); @@ -269,15 +274,14 @@ fxsave->fos = env[6]; to = (struct _fpxreg *) &fxsave->st_space[0]; - from = &buf->_st[0]; + from = tmp; for ( i = 0 ; i < 8 ; i++, to++, from++ ) { unsigned long *t = (unsigned long *)to; unsigned long *f = (unsigned long *)from; - if (__get_user(*t, f) || - __get_user(*(t + 1), f + 1) || - __get_user(to->exponent, &from->exponent)) - return 1; + *t = *f; + *(t + 1) = *(f + 1); + to->exponent = from->exponent; } return 0; } --- diff/arch/i386/kernel/init_task.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/i386/kernel/init_task.c 2004-02-18 09:03:57.000000000 +0000 @@ -26,7 +26,7 @@ */ union thread_union init_thread_union __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; + { INIT_THREAD_INFO(init_task, init_thread_union) }; /* * Initial task structure. @@ -44,5 +44,5 @@ * section. Since TSS's are completely CPU-local, we want them * on exact cacheline boundaries, to eliminate cacheline ping-pong. */ -struct tss_struct init_tss[NR_CPUS] __cacheline_aligned = { [0 ... NR_CPUS-1] = INIT_TSS }; +struct tss_struct init_tss[NR_CPUS] __attribute__((__section__(".data.tss"))) = { [0 ... NR_CPUS-1] = INIT_TSS }; --- diff/arch/i386/kernel/io_apic.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/i386/kernel/io_apic.c 2004-02-18 09:03:57.000000000 +0000 @@ -280,7 +280,7 @@ spin_unlock_irqrestore(&ioapic_lock, flags); } -#if defined(CONFIG_SMP) +#if defined(CONFIG_IRQBALANCE) # include /* kernel_thread() */ # include /* kstat */ # include /* kmalloc() */ @@ -317,8 +317,7 @@ #define IRQ_ALLOWED(cpu, allowed_mask) cpu_isset(cpu, allowed_mask) -#define CPU_TO_PACKAGEINDEX(i) \ - ((physical_balance && i > cpu_sibling_map[i]) ? cpu_sibling_map[i] : i) +#define CPU_TO_PACKAGEINDEX(i) (first_cpu(cpu_sibling_map[i])) #define MAX_BALANCED_IRQ_INTERVAL (5*HZ) #define MIN_BALANCED_IRQ_INTERVAL (HZ/2) @@ -401,6 +400,7 @@ unsigned long max_cpu_irq = 0, min_cpu_irq = (~0); unsigned long move_this_load = 0; int max_loaded = 0, min_loaded = 0; + int load; unsigned long useful_load_threshold = balanced_irq_interval + 10; int selected_irq; int tmp_loaded, first_attempt = 1; @@ -452,7 +452,7 @@ for (i = 0; i < NR_CPUS; i++) { if (!cpu_online(i)) continue; - if (physical_balance && i > cpu_sibling_map[i]) + if (i != CPU_TO_PACKAGEINDEX(i)) continue; if (min_cpu_irq > CPU_IRQ(i)) { min_cpu_irq = CPU_IRQ(i); @@ -471,7 +471,7 @@ for (i = 0; i < NR_CPUS; i++) { if (!cpu_online(i)) continue; - if (physical_balance && i > cpu_sibling_map[i]) + if (i != CPU_TO_PACKAGEINDEX(i)) continue; if (max_cpu_irq <= CPU_IRQ(i)) continue; @@ -551,9 +551,14 @@ * We seek the least loaded sibling by making the comparison * (A+B)/2 vs B */ - if (physical_balance && (CPU_IRQ(min_loaded) >> 1) > - CPU_IRQ(cpu_sibling_map[min_loaded])) - min_loaded = cpu_sibling_map[min_loaded]; + load = CPU_IRQ(min_loaded) >> 1; + for_each_cpu_mask(j, cpu_sibling_map[min_loaded]) { + if (load > CPU_IRQ(j)) { + /* This won't change cpu_sibling_map[min_loaded] */ + load = CPU_IRQ(j); + min_loaded = j; + } + } cpus_and(allowed_mask, cpu_online_map, irq_affinity[selected_irq]); target_cpu_mask = cpumask_of_cpu(min_loaded); @@ -689,9 +694,11 @@ __initcall(balanced_irq_init); -#else /* !SMP */ +#else /* !CONFIG_IRQBALANCE */ static inline void move_irq(int irq) { } +#endif /* CONFIG_IRQBALANCE */ +#ifndef CONFIG_SMP void send_IPI_self(int vector) { unsigned int cfg; @@ -706,7 +713,7 @@ */ apic_write_around(APIC_ICR, cfg); } -#endif /* defined(CONFIG_SMP) */ +#endif /* !CONFIG_SMP */ /* @@ -2150,6 +2157,10 @@ { int pin1, pin2; int vector; + unsigned int ver; + + ver = apic_read(APIC_LVR); + ver = GET_APIC_VERSION(ver); /* * get/set the timer IRQ vector: @@ -2163,11 +2174,17 @@ * mode for the 8259A whenever interrupts are routed * through I/O APICs. Also IRQ0 has to be enabled in * the 8259A which implies the virtual wire has to be - * disabled in the local APIC. + * disabled in the local APIC. Finally timer interrupts + * need to be acknowledged manually in the 8259A for + * do_slow_timeoffset() and for the i82489DX when using + * the NMI watchdog. */ apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); init_8259A(1); - timer_ack = 1; + if (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver)) + timer_ack = 1; + else + timer_ack = !cpu_has_tsc; enable_8259A_irq(0); pin1 = find_isa_irq_pin(0, mp_INT); @@ -2185,7 +2202,8 @@ disable_8259A_irq(0); setup_nmi(); enable_8259A_irq(0); - check_nmi_watchdog(); + if (check_nmi_watchdog() < 0); + timer_ack = !cpu_has_tsc; } return; } @@ -2208,7 +2226,8 @@ add_pin_to_irq(0, 0, pin2); if (nmi_watchdog == NMI_IO_APIC) { setup_nmi(); - check_nmi_watchdog(); + if (check_nmi_watchdog() < 0); + timer_ack = !cpu_has_tsc; } return; } --- diff/arch/i386/kernel/irq.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/kernel/irq.c 2004-02-18 09:03:57.000000000 +0000 @@ -435,7 +435,7 @@ long esp; __asm__ __volatile__("andl %%esp,%0" : - "=r" (esp) : "0" (8191)); + "=r" (esp) : "0" (THREAD_SIZE - 1)); if (unlikely(esp < (sizeof(struct thread_info) + 1024))) { printk("do_IRQ: stack overflow: %ld\n", esp - sizeof(struct thread_info)); @@ -508,6 +508,8 @@ irq_exit(); + kgdb_process_breakpoint(); + return 1; } @@ -927,7 +929,7 @@ static int irq_affinity_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, irq_affinity[(long)data]); + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); @@ -968,7 +970,7 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, *(cpumask_t *)data); + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/i386/kernel/ldt.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/ldt.c 2004-02-18 09:03:57.000000000 +0000 @@ -2,7 +2,7 @@ * linux/kernel/ldt.c * * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds - * Copyright (C) 1999 Ingo Molnar + * Copyright (C) 1999, 2003 Ingo Molnar */ #include @@ -18,6 +18,8 @@ #include #include #include +#include +#include #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ static void flush_ldt(void *null) @@ -29,34 +31,31 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) { - void *oldldt; - void *newldt; - int oldsize; + int oldsize, newsize, i; if (mincount <= pc->size) return 0; + /* + * LDT got larger - reallocate if necessary. + */ oldsize = pc->size; mincount = (mincount+511)&(~511); - if (mincount*LDT_ENTRY_SIZE > PAGE_SIZE) - newldt = vmalloc(mincount*LDT_ENTRY_SIZE); - else - newldt = kmalloc(mincount*LDT_ENTRY_SIZE, GFP_KERNEL); - - if (!newldt) - return -ENOMEM; - - if (oldsize) - memcpy(newldt, pc->ldt, oldsize*LDT_ENTRY_SIZE); - oldldt = pc->ldt; - memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE); - pc->ldt = newldt; - wmb(); + newsize = mincount*LDT_ENTRY_SIZE; + for (i = 0; i < newsize; i += PAGE_SIZE) { + int nr = i/PAGE_SIZE; + BUG_ON(i >= 64*1024); + if (!pc->ldt_pages[nr]) { + pc->ldt_pages[nr] = alloc_page(GFP_HIGHUSER); + if (!pc->ldt_pages[nr]) + return -ENOMEM; + clear_highpage(pc->ldt_pages[nr]); + } + } pc->size = mincount; - wmb(); - if (reload) { #ifdef CONFIG_SMP cpumask_t mask; + preempt_disable(); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); @@ -67,21 +66,20 @@ load_LDT(pc); #endif } - if (oldsize) { - if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE) - vfree(oldldt); - else - kfree(oldldt); - } return 0; } static inline int copy_ldt(mm_context_t *new, mm_context_t *old) { - int err = alloc_ldt(new, old->size, 0); - if (err < 0) + int i, err, size = old->size, nr_pages = (size*LDT_ENTRY_SIZE + PAGE_SIZE-1)/PAGE_SIZE; + + err = alloc_ldt(new, size, 0); + if (err < 0) { + new->size = 0; return err; - memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE); + } + for (i = 0; i < nr_pages; i++) + copy_user_highpage(new->ldt_pages[i], old->ldt_pages[i], 0); return 0; } @@ -96,6 +94,7 @@ init_MUTEX(&mm->context.sem); mm->context.size = 0; + memset(mm->context.ldt_pages, 0, sizeof(struct page *) * MAX_LDT_PAGES); old_mm = current->mm; if (old_mm && old_mm->context.size > 0) { down(&old_mm->context.sem); @@ -107,23 +106,21 @@ /* * No need to lock the MM as we are the last user + * Do not touch the ldt register, we are already + * in the next thread. */ void destroy_context(struct mm_struct *mm) { - if (mm->context.size) { - if (mm == current->active_mm) - clear_LDT(); - if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE) - vfree(mm->context.ldt); - else - kfree(mm->context.ldt); - mm->context.size = 0; - } + int i, nr_pages = (mm->context.size*LDT_ENTRY_SIZE + PAGE_SIZE-1) / PAGE_SIZE; + + for (i = 0; i < nr_pages; i++) + __free_page(mm->context.ldt_pages[i]); + mm->context.size = 0; } static int read_ldt(void __user * ptr, unsigned long bytecount) { - int err; + int err, i; unsigned long size; struct mm_struct * mm = current->mm; @@ -138,8 +135,25 @@ size = bytecount; err = 0; - if (copy_to_user(ptr, mm->context.ldt, size)) - err = -EFAULT; + /* + * This is necessary just in case we got here straight from a + * context-switch where the ptes were set but no tlb flush + * was done yet. We rather avoid doing a TLB flush in the + * context-switch path and do it here instead. + */ + __flush_tlb_global(); + + for (i = 0; i < size; i += PAGE_SIZE) { + int nr = i / PAGE_SIZE, bytes; + char *kaddr = kmap(mm->context.ldt_pages[nr]); + + bytes = size - i; + if (bytes > PAGE_SIZE) + bytes = PAGE_SIZE; + if (copy_to_user(ptr + i, kaddr, size - i)) + err = -EFAULT; + kunmap(mm->context.ldt_pages[nr]); + } up(&mm->context.sem); if (err < 0) return err; @@ -158,7 +172,7 @@ err = 0; address = &default_ldt[0]; - size = 5*sizeof(struct desc_struct); + size = 5*LDT_ENTRY_SIZE; if (size > bytecount) size = bytecount; @@ -200,7 +214,15 @@ goto out_unlock; } - lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) mm->context.ldt); + /* + * No rescheduling allowed from this point to the install. + * + * We do a TLB flush for the same reason as in the read_ldt() path. + */ + preempt_disable(); + __flush_tlb_global(); + lp = (__u32 *) ((ldt_info.entry_number << 3) + + (char *) __kmap_atomic_vaddr(KM_LDT_PAGE0)); /* Allow LDTs to be cleared by the user. */ if (ldt_info.base_addr == 0 && ldt_info.limit == 0) { @@ -221,6 +243,7 @@ *lp = entry_1; *(lp+1) = entry_2; error = 0; + preempt_enable(); out_unlock: up(&mm->context.sem); @@ -248,3 +271,26 @@ } return ret; } + +/* + * load one particular LDT into the current CPU + */ +void load_LDT_nolock(mm_context_t *pc, int cpu) +{ + struct page **pages = pc->ldt_pages; + int count = pc->size; + int nr_pages, i; + + if (likely(!count)) { + pages = &default_ldt_page; + count = 5; + } + nr_pages = (count*LDT_ENTRY_SIZE + PAGE_SIZE-1) / PAGE_SIZE; + + for (i = 0; i < nr_pages; i++) { + __kunmap_atomic_type(KM_LDT_PAGE0 - i); + __kmap_atomic(pages[i], KM_LDT_PAGE0 - i); + } + set_ldt_desc(cpu, (void *)__kmap_atomic_vaddr(KM_LDT_PAGE0), count); + load_LDT_desc(); +} --- diff/arch/i386/kernel/microcode.c 2003-10-27 09:20:43.000000000 +0000 +++ source/arch/i386/kernel/microcode.c 2004-02-18 09:03:57.000000000 +0000 @@ -507,3 +507,4 @@ module_init(microcode_init) module_exit(microcode_exit) +MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); --- diff/arch/i386/kernel/mpparse.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/mpparse.c 2004-02-18 09:03:57.000000000 +0000 @@ -668,7 +668,7 @@ * Read the physical hardware table. Anything here will * override the defaults. */ - if (!smp_read_mpc((void *)mpf->mpf_physptr)) { + if (!smp_read_mpc((void *)phys_to_virt(mpf->mpf_physptr))) { smp_found_config = 0; printk(KERN_ERR "BIOS bug, MP table errors detected!...\n"); printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n"); --- diff/arch/i386/kernel/nmi.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/nmi.c 2004-02-18 09:03:57.000000000 +0000 @@ -31,7 +31,16 @@ #include #include +#ifdef CONFIG_KGDB +#include +#ifdef CONFIG_SMP +unsigned int nmi_watchdog = NMI_IO_APIC; +#else +unsigned int nmi_watchdog = NMI_LOCAL_APIC; +#endif +#else unsigned int nmi_watchdog = NMI_NONE; +#endif static unsigned int nmi_hz = HZ; unsigned int nmi_perfctr_msr; /* the MSR to reset in NMI handler */ extern void show_registers(struct pt_regs *regs); @@ -42,7 +51,7 @@ * be enabled * -1: the lapic NMI watchdog is disabled, but can be enabled */ -static int nmi_active; +int nmi_active; #define K7_EVNTSEL_ENABLE (1 << 22) #define K7_EVNTSEL_INT (1 << 20) @@ -408,6 +417,9 @@ for (i = 0; i < NR_CPUS; i++) alert_counter[i] = 0; } +#ifdef CONFIG_KGDB +int tune_watchdog = 5*HZ; +#endif void nmi_watchdog_tick (struct pt_regs * regs) { @@ -421,12 +433,24 @@ sum = irq_stat[cpu].apic_timer_irqs; +#ifdef CONFIG_KGDB + if (! in_kgdb(regs) && last_irq_sums[cpu] == sum ) { + +#else if (last_irq_sums[cpu] == sum) { +#endif /* * Ayiee, looks like this CPU is stuck ... * wait a few IRQs (5 seconds) before doing the oops ... */ alert_counter[cpu]++; +#ifdef CONFIG_KGDB + if (alert_counter[cpu] == tune_watchdog) { + kgdb_handle_exception(2, SIGPWR, 0, regs); + last_irq_sums[cpu] = sum; + alert_counter[cpu] = 0; + } +#endif if (alert_counter[cpu] == 5*nmi_hz) { spin_lock(&nmi_print_lock); /* @@ -462,6 +486,7 @@ } } +EXPORT_SYMBOL(nmi_active); EXPORT_SYMBOL(nmi_watchdog); EXPORT_SYMBOL(disable_lapic_nmi_watchdog); EXPORT_SYMBOL(enable_lapic_nmi_watchdog); --- diff/arch/i386/kernel/process.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/process.c 2004-02-18 09:03:57.000000000 +0000 @@ -47,6 +47,7 @@ #include #include #include +#include #ifdef CONFIG_MATH_EMULATION #include #endif @@ -304,6 +305,9 @@ struct task_struct *tsk = current; memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8); +#ifdef CONFIG_X86_HIGH_ENTRY + clear_thread_flag(TIF_DB7); +#endif memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); /* * Forget coprocessor state.. @@ -317,9 +321,8 @@ if (dead_task->mm) { // temporary debugging check if (dead_task->mm->context.size) { - printk("WARNING: dead process %8s still has LDT? <%p/%d>\n", + printk("WARNING: dead process %8s still has LDT? <%d>\n", dead_task->comm, - dead_task->mm->context.ldt, dead_task->mm->context.size); BUG(); } @@ -354,7 +357,17 @@ p->thread.esp = (unsigned long) childregs; p->thread.esp0 = (unsigned long) (childregs+1); + /* + * get the two stack pages, for the virtual stack. + * + * IMPORTANT: this code relies on the fact that the task + * structure is an 8K aligned piece of physical memory. + */ + p->thread.stack_page0 = virt_to_page((unsigned long)p->thread_info); + p->thread.stack_page1 = virt_to_page((unsigned long)p->thread_info + PAGE_SIZE); + p->thread.eip = (unsigned long) ret_from_fork; + p->thread_info->real_stack = p->thread_info; savesegment(fs,p->thread.fs); savesegment(gs,p->thread.gs); @@ -506,10 +519,41 @@ __unlazy_fpu(prev_p); +#ifdef CONFIG_X86_HIGH_ENTRY + /* + * Set the ptes of the virtual stack. (NOTE: a one-page TLB flush is + * needed because otherwise NMIs could interrupt the + * user-return code with a virtual stack and stale TLBs.) + */ + __kunmap_atomic_type(KM_VSTACK0); + __kunmap_atomic_type(KM_VSTACK1); + __kmap_atomic(next->stack_page0, KM_VSTACK0); + __kmap_atomic(next->stack_page1, KM_VSTACK1); + + /* + * NOTE: here we rely on the task being the stack as well + */ + next_p->thread_info->virtual_stack = + (void *)__kmap_atomic_vaddr(KM_VSTACK0); + +#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) + /* + * If next was preempted on entry from userspace to kernel, + * and now it's on a different cpu, we need to adjust %esp. + * This assumes that entry.S does not copy %esp while on the + * virtual stack (with interrupts enabled): which is so, + * except within __SWITCH_KERNELSPACE itself. + */ + if (unlikely(next->esp >= TASK_SIZE)) { + next->esp &= THREAD_SIZE - 1; + next->esp |= (unsigned long) next_p->thread_info->virtual_stack; + } +#endif +#endif /* * Reload esp0, LDT and the page table pointer: */ - load_esp0(tss, next); + load_virtual_esp0(tss, next_p); /* * Load the per-thread Thread-Local Storage descriptor. @@ -637,6 +681,8 @@ extern void scheduling_functions_end_here(void); #define first_sched ((unsigned long) scheduling_functions_start_here) #define last_sched ((unsigned long) scheduling_functions_end_here) +#define top_esp (THREAD_SIZE - sizeof(unsigned long)) +#define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long)) unsigned long get_wchan(struct task_struct *p) { @@ -647,12 +693,12 @@ return 0; stack_page = (unsigned long)p->thread_info; esp = p->thread.esp; - if (!stack_page || esp < stack_page || esp > 8188+stack_page) + if (!stack_page || esp < stack_page || esp > top_esp+stack_page) return 0; /* include/asm-i386/system.h:switch_to() pushes ebp last. */ ebp = *(unsigned long *) esp; do { - if (ebp < stack_page || ebp > 8184+stack_page) + if (ebp < stack_page || ebp > top_ebp+stack_page) return 0; eip = *(unsigned long *) (ebp+4); if (eip < first_sched || eip >= last_sched) --- diff/arch/i386/kernel/reboot.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/kernel/reboot.c 2004-02-18 09:03:57.000000000 +0000 @@ -155,12 +155,11 @@ CMOS_WRITE(0x00, 0x8f); spin_unlock_irqrestore(&rtc_lock, flags); - /* Remap the kernel at virtual address zero, as well as offset zero - from the kernel segment. This assumes the kernel segment starts at - virtual address PAGE_OFFSET. */ - - memcpy (swapper_pg_dir, swapper_pg_dir + USER_PGD_PTRS, - sizeof (swapper_pg_dir [0]) * KERNEL_PGD_PTRS); + /* + * Remap the first 16 MB of RAM (which includes the kernel image) + * at virtual address zero: + */ + setup_identity_mappings(swapper_pg_dir, 0, 16*1024*1024); /* * Use `swapper_pg_dir' as our page directory. --- diff/arch/i386/kernel/setup.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/setup.c 2004-02-18 09:03:57.000000000 +0000 @@ -1118,6 +1118,19 @@ #endif paging_init(); +#ifdef CONFIG_EARLY_PRINTK + { + char *s = strstr(*cmdline_p, "earlyprintk="); + if (s) { + extern void setup_early_printk(char *); + + setup_early_printk(s); + printk("early console enabled\n"); + } + } +#endif + + dmi_scan_machine(); #ifdef CONFIG_X86_GENERICARCH --- diff/arch/i386/kernel/signal.c 2003-11-25 15:24:57.000000000 +0000 +++ source/arch/i386/kernel/signal.c 2004-02-18 09:03:57.000000000 +0000 @@ -128,28 +128,29 @@ */ static int -restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax) +restore_sigcontext(struct pt_regs *regs, + struct sigcontext __user *__sc, int *peax) { - unsigned int err = 0; + struct sigcontext scratch; /* 88 bytes of scratch area */ /* Always make any pending restarted system calls return -EINTR */ current_thread_info()->restart_block.fn = do_no_restart_syscall; -#define COPY(x) err |= __get_user(regs->x, &sc->x) + if (copy_from_user(&scratch, __sc, sizeof(scratch))) + return -EFAULT; + +#define COPY(x) regs->x = scratch.x #define COPY_SEG(seg) \ - { unsigned short tmp; \ - err |= __get_user(tmp, &sc->seg); \ + { unsigned short tmp = scratch.seg; \ regs->x##seg = tmp; } #define COPY_SEG_STRICT(seg) \ - { unsigned short tmp; \ - err |= __get_user(tmp, &sc->seg); \ + { unsigned short tmp = scratch.seg; \ regs->x##seg = tmp|3; } #define GET_SEG(seg) \ - { unsigned short tmp; \ - err |= __get_user(tmp, &sc->seg); \ + { unsigned short tmp = scratch.seg; \ loadsegment(seg,tmp); } GET_SEG(gs); @@ -168,27 +169,23 @@ COPY_SEG_STRICT(ss); { - unsigned int tmpflags; - err |= __get_user(tmpflags, &sc->eflags); + unsigned int tmpflags = scratch.eflags; regs->eflags = (regs->eflags & ~0x40DD5) | (tmpflags & 0x40DD5); regs->orig_eax = -1; /* disable syscall checks */ } { - struct _fpstate __user * buf; - err |= __get_user(buf, &sc->fpstate); + struct _fpstate * buf = scratch.fpstate; if (buf) { if (verify_area(VERIFY_READ, buf, sizeof(*buf))) - goto badframe; - err |= restore_i387(buf); + return -EFAULT; + if (restore_i387(buf)) + return -EFAULT; } } - err |= __get_user(*peax, &sc->eax); - return err; - -badframe: - return 1; + *peax = scratch.eax; + return 0; } asmlinkage int sys_sigreturn(unsigned long __unused) @@ -266,46 +263,47 @@ */ static int -setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate, +setup_sigcontext(struct sigcontext __user *__sc, struct _fpstate __user *fpstate, struct pt_regs *regs, unsigned long mask) { - int tmp, err = 0; + struct sigcontext sc; /* 88 bytes of scratch area */ + int tmp; tmp = 0; __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->gs); + *(unsigned int *)&sc.gs = tmp; __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->fs); - - err |= __put_user(regs->xes, (unsigned int *)&sc->es); - err |= __put_user(regs->xds, (unsigned int *)&sc->ds); - err |= __put_user(regs->edi, &sc->edi); - err |= __put_user(regs->esi, &sc->esi); - err |= __put_user(regs->ebp, &sc->ebp); - err |= __put_user(regs->esp, &sc->esp); - err |= __put_user(regs->ebx, &sc->ebx); - err |= __put_user(regs->edx, &sc->edx); - err |= __put_user(regs->ecx, &sc->ecx); - err |= __put_user(regs->eax, &sc->eax); - err |= __put_user(current->thread.trap_no, &sc->trapno); - err |= __put_user(current->thread.error_code, &sc->err); - err |= __put_user(regs->eip, &sc->eip); - err |= __put_user(regs->xcs, (unsigned int *)&sc->cs); - err |= __put_user(regs->eflags, &sc->eflags); - err |= __put_user(regs->esp, &sc->esp_at_signal); - err |= __put_user(regs->xss, (unsigned int *)&sc->ss); + *(unsigned int *)&sc.fs = tmp; + *(unsigned int *)&sc.es = regs->xes; + *(unsigned int *)&sc.ds = regs->xds; + sc.edi = regs->edi; + sc.esi = regs->esi; + sc.ebp = regs->ebp; + sc.esp = regs->esp; + sc.ebx = regs->ebx; + sc.edx = regs->edx; + sc.ecx = regs->ecx; + sc.eax = regs->eax; + sc.trapno = current->thread.trap_no; + sc.err = current->thread.error_code; + sc.eip = regs->eip; + *(unsigned int *)&sc.cs = regs->xcs; + sc.eflags = regs->eflags; + sc.esp_at_signal = regs->esp; + *(unsigned int *)&sc.ss = regs->xss; tmp = save_i387(fpstate); if (tmp < 0) - err = 1; - else - err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate); + return 1; + sc.fpstate = tmp ? fpstate : NULL; /* non-iBCS2 extensions.. */ - err |= __put_user(mask, &sc->oldmask); - err |= __put_user(current->thread.cr2, &sc->cr2); + sc.oldmask = mask; + sc.cr2 = current->thread.cr2; - return err; + if (copy_to_user(__sc, &sc, sizeof(sc))) + return 1; + return 0; } /* @@ -443,7 +441,7 @@ /* Create the ucontext. */ err |= __put_user(0, &frame->uc.uc_flags); err |= __put_user(0, &frame->uc.uc_link); - err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); + err |= __put_user(current->sas_ss_sp, (unsigned long *)&frame->uc.uc_stack.ss_sp); err |= __put_user(sas_ss_flags(regs->esp), &frame->uc.uc_stack.ss_flags); err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); --- diff/arch/i386/kernel/smp.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/smp.c 2004-02-18 09:03:57.000000000 +0000 @@ -327,10 +327,12 @@ if (flush_mm == cpu_tlbstate[cpu].active_mm) { if (cpu_tlbstate[cpu].state == TLBSTATE_OK) { +#ifndef CONFIG_X86_SWITCH_PAGETABLES if (flush_va == FLUSH_ALL) local_flush_tlb(); else __flush_tlb_one(flush_va); +#endif } else leave_mm(cpu); } @@ -396,21 +398,6 @@ spin_unlock(&tlbstate_lock); } -void flush_tlb_current_task(void) -{ - struct mm_struct *mm = current->mm; - cpumask_t cpu_mask; - - preempt_disable(); - cpu_mask = mm->cpu_vm_mask; - cpu_clear(smp_processor_id(), cpu_mask); - - local_flush_tlb(); - if (!cpus_empty(cpu_mask)) - flush_tlb_others(cpu_mask, mm, FLUSH_ALL); - preempt_enable(); -} - void flush_tlb_mm (struct mm_struct * mm) { cpumask_t cpu_mask; @@ -442,7 +429,10 @@ if (current->active_mm == mm) { if(current->mm) - __flush_tlb_one(va); +#ifndef CONFIG_X86_SWITCH_PAGETABLES + __flush_tlb_one(va) +#endif + ; else leave_mm(smp_processor_id()); } @@ -466,7 +456,17 @@ { on_each_cpu(do_flush_tlb_all, 0, 1, 1); } - +#ifdef CONFIG_KGDB +/* + * By using the NMI code instead of a vector we just sneak thru the + * word generator coming out with just what we want. AND it does + * not matter if clustered_apic_mode is set or not. + */ +void smp_send_nmi_allbutself(void) +{ + send_IPI_allbutself(APIC_DM_NMI); +} +#endif /* * this function sends a 'reschedule' IPI to another CPU. * it goes straight through and wastes no time serializing --- diff/arch/i386/kernel/smpboot.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/i386/kernel/smpboot.c 2004-02-18 09:03:57.000000000 +0000 @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -934,7 +935,7 @@ /* Where the IO area was mapped on multiquad, always 0 otherwise */ void *xquad_portio; -int cpu_sibling_map[NR_CPUS] __cacheline_aligned; +cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; static void __init smp_boot_cpus(unsigned int max_cpus) { @@ -948,10 +949,13 @@ printk("CPU%d: ", 0); print_cpu_info(&cpu_data[0]); + boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); boot_cpu_logical_apicid = logical_smp_processor_id(); current_thread_info()->cpu = 0; smp_tune_scheduling(); + cpus_clear(cpu_sibling_map[0]); + cpu_set(0, cpu_sibling_map[0]); /* * If we couldn't find an SMP configuration at boot time, @@ -1008,8 +1012,6 @@ setup_local_APIC(); map_cpu_to_logical_apicid(); - if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid) - BUG(); setup_portio_remap(); @@ -1080,32 +1082,34 @@ Dprintk("Boot done.\n"); /* - * If Hyper-Threading is avaialble, construct cpu_sibling_map[], so - * that we can tell the sibling CPU efficiently. + * construct cpu_sibling_map[], so that we can tell sibling CPUs + * efficiently. */ - if (cpu_has_ht && smp_num_siblings > 1) { - for (cpu = 0; cpu < NR_CPUS; cpu++) - cpu_sibling_map[cpu] = NO_PROC_ID; - - for (cpu = 0; cpu < NR_CPUS; cpu++) { - int i; - if (!cpu_isset(cpu, cpu_callout_map)) - continue; + for (cpu = 0; cpu < NR_CPUS; cpu++) + cpus_clear(cpu_sibling_map[cpu]); + + for (cpu = 0; cpu < NR_CPUS; cpu++) { + int siblings = 0; + int i; + if (!cpu_isset(cpu, cpu_callout_map)) + continue; + if (smp_num_siblings > 1) { for (i = 0; i < NR_CPUS; i++) { - if (i == cpu || !cpu_isset(i, cpu_callout_map)) + if (!cpu_isset(i, cpu_callout_map)) continue; if (phys_proc_id[cpu] == phys_proc_id[i]) { - cpu_sibling_map[cpu] = i; - printk("cpu_sibling_map[%d] = %d\n", cpu, cpu_sibling_map[cpu]); - break; + siblings++; + cpu_set(i, cpu_sibling_map[cpu]); } } - if (cpu_sibling_map[cpu] == NO_PROC_ID) { - smp_num_siblings = 1; - printk(KERN_WARNING "WARNING: No sibling found for CPU %d.\n", cpu); - } + } else { + siblings++; + cpu_set(cpu, cpu_sibling_map[cpu]); } + + if (siblings != smp_num_siblings) + printk(KERN_WARNING "WARNING: %d siblings found for CPU%d, should be %d\n", siblings, cpu, smp_num_siblings); } smpboot_setup_io_apic(); @@ -1119,6 +1123,207 @@ synchronize_tsc_bp(); } +#ifdef CONFIG_SCHED_SMT +#ifdef CONFIG_NUMA +static struct sched_group sched_group_cpus[NR_CPUS]; +static struct sched_group sched_group_phys[NR_CPUS]; +static struct sched_group sched_group_nodes[MAX_NUMNODES]; +static DEFINE_PER_CPU(struct sched_domain, phys_domains); +static DEFINE_PER_CPU(struct sched_domain, node_domains); +__init void arch_init_sched_domains(void) +{ + int i; + struct sched_group *first_cpu = NULL, *last_cpu = NULL; + + /* Set up domains */ + for_each_cpu_mask(i, cpu_online_map) { + struct sched_domain *cpu_domain = cpu_sched_domain(i); + struct sched_domain *phys_domain = &per_cpu(phys_domains, i); + struct sched_domain *node_domain = &per_cpu(node_domains, i); + int node = cpu_to_node(i); + cpumask_t nodemask = node_to_cpumask(node); + + *cpu_domain = SD_SIBLING_INIT; + cpu_domain->span = cpu_sibling_map[i]; + + *phys_domain = SD_CPU_INIT; + phys_domain->span = nodemask; + phys_domain->flags |= SD_FLAG_IDLE; + + *node_domain = SD_NODE_INIT; + node_domain->span = cpu_online_map; + } + + /* Set up CPU (sibling) groups */ + for_each_cpu_mask(i, cpu_online_map) { + struct sched_domain *cpu_domain = cpu_sched_domain(i); + int j; + first_cpu = last_cpu = NULL; + + if (i != first_cpu(cpu_domain->span)) + continue; + + for_each_cpu_mask(j, cpu_domain->span) { + struct sched_group *cpu = &sched_group_cpus[j]; + + cpu->cpumask = CPU_MASK_NONE; + cpu_set(j, cpu->cpumask); + + if (!first_cpu) + first_cpu = cpu; + if (last_cpu) + last_cpu->next = cpu; + last_cpu = cpu; + } + last_cpu->next = first_cpu; + } + + for (i = 0; i < MAX_NUMNODES; i++) { + int j; + cpumask_t nodemask; + cpus_and(nodemask, node_to_cpumask(i), cpu_online_map); + + if (cpus_empty(nodemask)) + continue; + + first_cpu = last_cpu = NULL; + /* Set up physical groups */ + for_each_cpu_mask(j, nodemask) { + struct sched_domain *cpu_domain = cpu_sched_domain(j); + struct sched_group *cpu = &sched_group_phys[j]; + + if (j != first_cpu(cpu_domain->span)) + continue; + + cpu->cpumask = cpu_domain->span; + + if (!first_cpu) + first_cpu = cpu; + if (last_cpu) + last_cpu->next = cpu; + last_cpu = cpu; + } + last_cpu->next = first_cpu; + } + + /* Set up nodes */ + first_cpu = last_cpu = NULL; + for (i = 0; i < MAX_NUMNODES; i++) { + struct sched_group *cpu = &sched_group_nodes[i]; + cpumask_t nodemask; + cpus_and(nodemask, node_to_cpumask(i), cpu_online_map); + + if (cpus_empty(nodemask)) + continue; + + cpu->cpumask = nodemask; + + if (!first_cpu) + first_cpu = cpu; + if (last_cpu) + last_cpu->next = cpu; + last_cpu = cpu; + } + last_cpu->next = first_cpu; + + + mb(); + for_each_cpu_mask(i, cpu_online_map) { + int node = cpu_to_node(i); + struct sched_domain *cpu_domain = cpu_sched_domain(i); + struct sched_domain *phys_domain = &per_cpu(phys_domains, i); + struct sched_domain *node_domain = &per_cpu(node_domains, i); + struct sched_group *cpu_group = &sched_group_cpus[i]; + struct sched_group *phys_group = &sched_group_phys[first_cpu(cpu_domain->span)]; + struct sched_group *node_group = &sched_group_nodes[node]; + + cpu_domain->parent = phys_domain; + phys_domain->parent = node_domain; + + node_domain->groups = node_group; + phys_domain->groups = phys_group; + cpu_domain->groups = cpu_group; + } +} +#else /* CONFIG_NUMA */ +static struct sched_group sched_group_cpus[NR_CPUS]; +static struct sched_group sched_group_phys[NR_CPUS]; +static DEFINE_PER_CPU(struct sched_domain, phys_domains); +__init void arch_init_sched_domains(void) +{ + int i; + struct sched_group *first_cpu = NULL, *last_cpu = NULL; + + /* Set up domains */ + for_each_cpu_mask(i, cpu_online_map) { + struct sched_domain *cpu_domain = cpu_sched_domain(i); + struct sched_domain *phys_domain = &per_cpu(phys_domains, i); + + *cpu_domain = SD_SIBLING_INIT; + cpu_domain->span = cpu_sibling_map[i]; + + *phys_domain = SD_CPU_INIT; + phys_domain->span = cpu_online_map; + phys_domain->flags |= SD_FLAG_IDLE; + } + + /* Set up CPU (sibling) groups */ + for_each_cpu_mask(i, cpu_online_map) { + struct sched_domain *cpu_domain = cpu_sched_domain(i); + int j; + first_cpu = last_cpu = NULL; + + if (i != first_cpu(cpu_domain->span)) + continue; + + for_each_cpu_mask(j, cpu_domain->span) { + struct sched_group *cpu = &sched_group_cpus[j]; + + cpus_clear(cpu->cpumask); + cpu_set(j, cpu->cpumask); + + if (!first_cpu) + first_cpu = cpu; + if (last_cpu) + last_cpu->next = cpu; + last_cpu = cpu; + } + last_cpu->next = first_cpu; + } + + first_cpu = last_cpu = NULL; + /* Set up physical groups */ + for_each_cpu_mask(i, cpu_online_map) { + struct sched_domain *cpu_domain = cpu_sched_domain(i); + struct sched_group *cpu = &sched_group_phys[i]; + + if (i != first_cpu(cpu_domain->span)) + continue; + + cpu->cpumask = cpu_domain->span; + + if (!first_cpu) + first_cpu = cpu; + if (last_cpu) + last_cpu->next = cpu; + last_cpu = cpu; + } + last_cpu->next = first_cpu; + + mb(); + for_each_cpu_mask(i, cpu_online_map) { + struct sched_domain *cpu_domain = cpu_sched_domain(i); + struct sched_domain *phys_domain = &per_cpu(phys_domains, i); + struct sched_group *cpu_group = &sched_group_cpus[i]; + struct sched_group *phys_group = &sched_group_phys[first_cpu(cpu_domain->span)]; + cpu_domain->parent = phys_domain; + phys_domain->groups = phys_group; + cpu_domain->groups = cpu_group; + } +} +#endif /* CONFIG_NUMA */ +#endif /* CONFIG_SCHED_SMT */ + /* These are wrappers to interface to the new boot process. Someone who understands all this stuff should rewrite it properly. --RR 15/Jul/02 */ void __init smp_prepare_cpus(unsigned int max_cpus) --- diff/arch/i386/kernel/sys_i386.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/i386/kernel/sys_i386.c 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -106,8 +107,6 @@ } -extern asmlinkage int sys_select(int, fd_set __user *, fd_set __user *, fd_set __user *, struct timeval __user *); - struct sel_arg_struct { unsigned long n; fd_set __user *inp, *outp, *exp; --- diff/arch/i386/kernel/sysenter.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/sysenter.c 2004-02-18 09:03:57.000000000 +0000 @@ -18,13 +18,18 @@ #include #include #include +#include extern asmlinkage void sysenter_entry(void); void enable_sep_cpu(void *info) { int cpu = get_cpu(); +#ifdef CONFIG_X86_HIGH_ENTRY + struct tss_struct *tss = (struct tss_struct *) __fix_to_virt(FIX_TSS_0) + cpu; +#else struct tss_struct *tss = init_tss + cpu; +#endif tss->ss1 = __KERNEL_CS; tss->esp1 = sizeof(struct tss_struct) + (unsigned long) tss; --- diff/arch/i386/kernel/timers/Makefile 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/i386/kernel/timers/Makefile 2004-02-18 09:03:57.000000000 +0000 @@ -6,3 +6,4 @@ obj-$(CONFIG_X86_CYCLONE_TIMER) += timer_cyclone.o obj-$(CONFIG_HPET_TIMER) += timer_hpet.o +obj-$(CONFIG_X86_PM_TIMER) += timer_pm.o --- diff/arch/i386/kernel/timers/common.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/i386/kernel/timers/common.c 2004-02-18 09:03:57.000000000 +0000 @@ -137,3 +137,23 @@ } #endif +/* calculate cpu_khz */ +void __init init_cpu_khz(void) +{ + if (cpu_has_tsc) { + unsigned long tsc_quotient = calibrate_tsc(); + if (tsc_quotient) { + /* report CPU clock rate in Hz. + * The formula is (10^6 * 2^32) / (2^32 * 1 / (clocks/us)) = + * clock/second. Our precision is about 100 ppm. + */ + { unsigned long eax=0, edx=1000; + __asm__("divl %2" + :"=a" (cpu_khz), "=d" (edx) + :"r" (tsc_quotient), + "0" (eax), "1" (edx)); + printk("Detected %lu.%03lu MHz processor.\n", cpu_khz / 1000, cpu_khz % 1000); + } + } + } +} --- diff/arch/i386/kernel/timers/timer.c 2003-09-17 12:28:01.000000000 +0100 +++ source/arch/i386/kernel/timers/timer.c 2004-02-18 09:03:57.000000000 +0000 @@ -19,6 +19,9 @@ #ifdef CONFIG_HPET_TIMER &timer_hpet, #endif +#ifdef CONFIG_X86_PM_TIMER + &timer_pmtmr, +#endif &timer_tsc, &timer_pit, NULL, --- diff/arch/i386/kernel/timers/timer_cyclone.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/kernel/timers/timer_cyclone.c 2004-02-18 09:03:57.000000000 +0000 @@ -212,26 +212,7 @@ } } - /* init cpu_khz. - * XXX - This should really be done elsewhere, - * and in a more generic fashion. -johnstul@us.ibm.com - */ - if (cpu_has_tsc) { - unsigned long tsc_quotient = calibrate_tsc(); - if (tsc_quotient) { - /* report CPU clock rate in Hz. - * The formula is (10^6 * 2^32) / (2^32 * 1 / (clocks/us)) = - * clock/second. Our precision is about 100 ppm. - */ - { unsigned long eax=0, edx=1000; - __asm__("divl %2" - :"=a" (cpu_khz), "=d" (edx) - :"r" (tsc_quotient), - "0" (eax), "1" (edx)); - printk("Detected %lu.%03lu MHz processor.\n", cpu_khz / 1000, cpu_khz % 1000); - } - } - } + init_cpu_khz(); /* Everything looks good! */ return 0; --- diff/arch/i386/kernel/traps.c 2003-10-27 09:20:36.000000000 +0000 +++ source/arch/i386/kernel/traps.c 2004-02-18 09:03:57.000000000 +0000 @@ -54,12 +54,8 @@ #include "mach_traps.h" -asmlinkage int system_call(void); -asmlinkage void lcall7(void); -asmlinkage void lcall27(void); - -struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 } }; +struct desc_struct default_ldt[] __attribute__((__section__(".data.default_ldt"))) = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; +struct page *default_ldt_page; /* Do we ignore FPU interrupts ? */ char ignore_fpu_irq = 0; @@ -91,6 +87,43 @@ asmlinkage void spurious_interrupt_bug(void); asmlinkage void machine_check(void); +#ifdef CONFIG_KGDB +extern void sysenter_entry(void); +#include +#include +extern void int3(void); +extern void debug(void); +void set_intr_gate(unsigned int n, void *addr); +static void set_intr_usr_gate(unsigned int n, void *addr); +/* + * Should be able to call this breakpoint() very early in + * bring up. Just hard code the call where needed. + * The breakpoint() code is here because set_?_gate() functions + * are local (static) to trap.c. They need be done only once, + * but it does not hurt to do them over. + */ +void breakpoint(void) +{ + init_entry_mappings(); + set_intr_usr_gate(3,&int3); /* disable ints on trap */ + set_intr_gate(1,&debug); + set_intr_gate(14,&page_fault); + + BREAKPOINT; +} +#define CHK_REMOTE_DEBUG(trapnr,signr,error_code,regs,after) \ + { \ + if (!user_mode(regs) ) \ + { \ + kgdb_handle_exception(trapnr, signr, error_code, regs); \ + after; \ + } else if ((trapnr == 3) && (regs->eflags &0x200)) local_irq_enable(); \ + } +#else +#define CHK_REMOTE_DEBUG(trapnr,signr,error_code,regs,after) +#endif + + static int kstack_depth_to_print = 24; void show_trace(struct task_struct *task, unsigned long * stack) @@ -119,7 +152,7 @@ unsigned long esp = tsk->thread.esp; /* User space on another CPU? */ - if ((esp ^ (unsigned long)tsk->thread_info) & (PAGE_MASK<<1)) + if ((esp ^ (unsigned long)tsk->thread_info) & ~(THREAD_SIZE - 1)) return; show_trace(tsk, (unsigned long *)esp); } @@ -175,8 +208,9 @@ ss = regs->xss & 0xffff; } print_modules(); - printk("CPU: %d\nEIP: %04x:[<%08lx>] %s\nEFLAGS: %08lx\n", - smp_processor_id(), 0xffff & regs->xcs, regs->eip, print_tainted(), regs->eflags); + printk("CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\nEFLAGS: %08lx\n", + smp_processor_id(), 0xffff & regs->xcs, + regs->eip, print_tainted(), regs->eflags); print_symbol("EIP is at %s\n", regs->eip); printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", @@ -192,23 +226,27 @@ * time of the fault.. */ if (in_kernel) { + u8 *eip; printk("\nStack: "); show_stack(NULL, (unsigned long*)esp); printk("Code: "); - if(regs->eip < PAGE_OFFSET) - goto bad; - for(i=0;i<20;i++) - { - unsigned char c; - if(__get_user(c, &((unsigned char*)regs->eip)[i])) { -bad: + eip = (u8 *)regs->eip - 43; + for (i = 0; i < 64; i++, eip++) { + unsigned char c = 0xff; + + if ((user_mode(regs) && get_user(c, eip)) || + (!user_mode(regs) && __direct_get_user(c, eip))) { + printk(" Bad EIP value."); break; } - printk("%02x ", c); + if (eip == (u8 *)regs->eip) + printk("<%02x> ", c); + else + printk("%02x ", c); } } printk("\n"); @@ -255,12 +293,36 @@ void die(const char * str, struct pt_regs * regs, long err) { static int die_counter; + int nl = 0; console_verbose(); spin_lock_irq(&die_lock); bust_spinlocks(1); handle_BUG(regs); printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); +#ifdef CONFIG_PREEMPT + printk("PREEMPT "); + nl = 1; +#endif +#ifdef CONFIG_SMP + printk("SMP "); + nl = 1; +#endif +#ifdef CONFIG_DEBUG_PAGEALLOC + printk("DEBUG_PAGEALLOC"); + nl = 1; +#endif + if (nl) + printk("\n"); +#ifdef CONFIG_KGDB + /* This is about the only place we want to go to kgdb even if in + * user mode. But we must go in via a trap so within kgdb we will + * always be in kernel mode. + */ + if (user_mode(regs)) + BREAKPOINT; +#endif + CHK_REMOTE_DEBUG(0,SIGTRAP,err,regs,) show_registers(regs); bust_spinlocks(0); spin_unlock_irq(&die_lock); @@ -330,6 +392,7 @@ #define DO_ERROR(trapnr, signr, str, name) \ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ { \ + CHK_REMOTE_DEBUG(trapnr,signr,error_code,regs,)\ do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \ } @@ -347,7 +410,9 @@ #define DO_VM86_ERROR(trapnr, signr, str, name) \ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ { \ + CHK_REMOTE_DEBUG(trapnr, signr, error_code,regs, return)\ do_trap(trapnr, signr, str, 1, regs, error_code, NULL); \ + return; \ } #define DO_VM86_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ @@ -394,8 +459,10 @@ return; gp_in_kernel: - if (!fixup_exception(regs)) + if (!fixup_exception(regs)){ + CHK_REMOTE_DEBUG(13,SIGSEGV,error_code,regs,) die("general protection fault", regs, error_code); + } } static void mem_parity_error(unsigned char reason, struct pt_regs * regs) @@ -534,10 +601,18 @@ if (regs->eflags & X86_EFLAGS_IF) local_irq_enable(); - /* Mask out spurious debug traps due to lazy DR7 setting */ + /* + * Mask out spurious debug traps due to lazy DR7 setting or + * due to 4G/4G kernel mode: + */ if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) { if (!tsk->thread.debugreg[7]) goto clear_dr7; + if (!user_mode(regs)) { + // restore upon return-to-userspace: + set_thread_flag(TIF_DB7); + goto clear_dr7; + } } if (regs->eflags & VM_MASK) @@ -557,8 +632,18 @@ * allowing programs to debug themselves without the ptrace() * interface. */ +#ifdef CONFIG_KGDB + /* + * I think this is the only "real" case of a TF in the kernel + * that really belongs to user space. Others are + * "Ours all ours!" + */ + if (((regs->xcs & 3) == 0) && ((void *)regs->eip == sysenter_entry)) + goto clear_TF_reenable; +#else if ((regs->xcs & 3) == 0) goto clear_TF_reenable; +#endif if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE) goto clear_TF; } @@ -570,6 +655,17 @@ info.si_errno = 0; info.si_code = TRAP_BRKPT; +#ifdef CONFIG_KGDB + /* + * If this is a kernel mode trap, we need to reset db7 to allow us + * to continue sanely ALSO skip the signal delivery + */ + if ((regs->xcs & 3) == 0) + goto clear_dr7; + + /* if not kernel, allow ints but only if they were on */ + if ( regs->eflags & 0x200) local_irq_enable(); +#endif /* If this is a kernel mode trap, save the user PC on entry to * the kernel, that's what the debugger can make sense of. */ @@ -584,6 +680,7 @@ __asm__("movl %0,%%db7" : /* no output */ : "r" (0)); + CHK_REMOTE_DEBUG(1,SIGTRAP,error_code,regs,) return; debug_vm86: @@ -779,19 +876,53 @@ #endif /* CONFIG_MATH_EMULATION */ -#ifdef CONFIG_X86_F00F_BUG -void __init trap_init_f00f_bug(void) +void __init trap_init_virtual_IDT(void) { - __set_fixmap(FIX_F00F_IDT, __pa(&idt_table), PAGE_KERNEL_RO); - /* - * Update the IDT descriptor and reload the IDT so that - * it uses the read-only mapped virtual address. + * "idt" is magic - it overlaps the idt_descr + * variable so that updating idt will automatically + * update the idt descriptor.. */ - idt_descr.address = fix_to_virt(FIX_F00F_IDT); + __set_fixmap(FIX_IDT, __pa(&idt_table), PAGE_KERNEL_RO); + idt_descr.address = __fix_to_virt(FIX_IDT); + __asm__ __volatile__("lidt %0" : : "m" (idt_descr)); } + +void __init trap_init_virtual_GDT(void) +{ + int cpu = smp_processor_id(); + struct Xgt_desc_struct *gdt_desc = cpu_gdt_descr + cpu; + struct Xgt_desc_struct tmp_desc = {0, 0}; + struct tss_struct * t; + + __asm__ __volatile__("sgdt %0": "=m" (tmp_desc): :"memory"); + +#ifdef CONFIG_X86_HIGH_ENTRY + if (!cpu) { + __set_fixmap(FIX_GDT_0, __pa(cpu_gdt_table), PAGE_KERNEL); + __set_fixmap(FIX_GDT_1, __pa(cpu_gdt_table) + PAGE_SIZE, PAGE_KERNEL); + __set_fixmap(FIX_TSS_0, __pa(init_tss), PAGE_KERNEL); + __set_fixmap(FIX_TSS_1, __pa(init_tss) + 1*PAGE_SIZE, PAGE_KERNEL); + __set_fixmap(FIX_TSS_2, __pa(init_tss) + 2*PAGE_SIZE, PAGE_KERNEL); + __set_fixmap(FIX_TSS_3, __pa(init_tss) + 3*PAGE_SIZE, PAGE_KERNEL); + } + + gdt_desc->address = __fix_to_virt(FIX_GDT_0) + sizeof(cpu_gdt_table[0]) * cpu; +#else + gdt_desc->address = (unsigned long)cpu_gdt_table[cpu]; +#endif + __asm__ __volatile__("lgdt %0": "=m" (*gdt_desc)); + +#ifdef CONFIG_X86_HIGH_ENTRY + t = (struct tss_struct *) __fix_to_virt(FIX_TSS_0) + cpu; +#else + t = init_tss + cpu; #endif + set_tss_desc(cpu, t); + cpu_gdt_table[cpu][GDT_ENTRY_TSS].b &= 0xfffffdff; + load_TR_desc(); +} #define _set_gate(gate_addr,type,dpl,addr,seg) \ do { \ @@ -818,20 +949,26 @@ _set_gate(idt_table+n,14,0,addr,__KERNEL_CS); } -static void __init set_trap_gate(unsigned int n, void *addr) +void __init set_trap_gate(unsigned int n, void *addr) { _set_gate(idt_table+n,15,0,addr,__KERNEL_CS); } -static void __init set_system_gate(unsigned int n, void *addr) +void __init set_system_gate(unsigned int n, void *addr) { _set_gate(idt_table+n,15,3,addr,__KERNEL_CS); } -static void __init set_call_gate(void *a, void *addr) +void __init set_call_gate(void *a, void *addr) { _set_gate(a,12,3,addr,__KERNEL_CS); } +#ifdef CONFIG_KGDB +void set_intr_usr_gate(unsigned int n, void *addr) +{ + _set_gate(idt_table+n,14,3,addr,__KERNEL_CS); +} +#endif static void __init set_task_gate(unsigned int n, unsigned int gdt_entry) { @@ -850,11 +987,16 @@ #ifdef CONFIG_X86_LOCAL_APIC init_apic_mappings(); #endif + init_entry_mappings(); set_trap_gate(0,÷_error); set_intr_gate(1,&debug); set_intr_gate(2,&nmi); +#ifndef CONFIG_KGDB set_system_gate(3,&int3); /* int3-5 can be called from all */ +#else + set_intr_usr_gate(3,&int3); /* int3-5 can be called from all */ +#endif set_system_gate(4,&overflow); set_system_gate(5,&bounds); set_trap_gate(6,&invalid_op); --- diff/arch/i386/kernel/vm86.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/kernel/vm86.c 2004-02-18 09:03:57.000000000 +0000 @@ -125,7 +125,7 @@ tss = init_tss + get_cpu(); current->thread.esp0 = current->thread.saved_esp0; current->thread.sysenter_cs = __KERNEL_CS; - load_esp0(tss, ¤t->thread); + load_virtual_esp0(tss, current); current->thread.saved_esp0 = 0; put_cpu(); @@ -305,7 +305,7 @@ tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0; if (cpu_has_sep) tsk->thread.sysenter_cs = 0; - load_esp0(tss, &tsk->thread); + load_virtual_esp0(tss, tsk); put_cpu(); tsk->thread.screen_bitmap = info->screen_bitmap; --- diff/arch/i386/kernel/vmlinux.lds.S 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/vmlinux.lds.S 2004-02-18 09:03:57.000000000 +0000 @@ -3,6 +3,9 @@ */ #include +#include +#include +#include OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) @@ -10,7 +13,7 @@ jiffies = jiffies_64; SECTIONS { - . = 0xC0000000 + 0x100000; + . = __PAGE_OFFSET + 0x100000; /* read-only */ _text = .; /* Text and read-only data */ .text : { @@ -19,6 +22,19 @@ *(.gnu.warning) } = 0x9090 +#ifdef CONFIG_X86_4G + . = ALIGN(PAGE_SIZE_asm); + __entry_tramp_start = .; + . = FIX_ENTRY_TRAMPOLINE_0_addr; + __start___entry_text = .; + .entry.text : AT (__entry_tramp_start) { *(.entry.text) } + __entry_tramp_end = __entry_tramp_start + SIZEOF(.entry.text); + . = __entry_tramp_end; + . = ALIGN(PAGE_SIZE_asm); +#else + .entry.text : { *(.entry.text) } +#endif + _etext = .; /* End of text section */ . = ALIGN(16); /* Exception table */ @@ -34,15 +50,12 @@ CONSTRUCTORS } - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE_asm); __nosave_begin = .; .data_nosave : { *(.data.nosave) } - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE_asm); __nosave_end = .; - . = ALIGN(4096); - .data.page_aligned : { *(.data.idt) } - . = ALIGN(32); .data.cacheline_aligned : { *(.data.cacheline_aligned) } @@ -52,7 +65,7 @@ .data.init_task : { *(.data.init_task) } /* will be freed after init */ - . = ALIGN(4096); /* Init code and data */ + . = ALIGN(PAGE_SIZE_asm); /* Init code and data */ __init_begin = .; .init.text : { _sinittext = .; @@ -91,7 +104,7 @@ from .altinstructions and .eh_frame */ .exit.text : { *(.exit.text) } .exit.data : { *(.exit.data) } - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE_asm); __initramfs_start = .; .init.ramfs : { *(.init.ramfs) } __initramfs_end = .; @@ -99,10 +112,22 @@ __per_cpu_start = .; .data.percpu : { *(.data.percpu) } __per_cpu_end = .; - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE_asm); __init_end = .; /* freed after init ends here */ - + + . = ALIGN(PAGE_SIZE_asm); + .data.page_aligned_tss : { *(.data.tss) } + + . = ALIGN(PAGE_SIZE_asm); + .data.page_aligned_default_ldt : { *(.data.default_ldt) } + + . = ALIGN(PAGE_SIZE_asm); + .data.page_aligned_idt : { *(.data.idt) } + + . = ALIGN(PAGE_SIZE_asm); + .data.page_aligned_gdt : { *(.data.gdt) } + __bss_start = .; /* BSS */ .bss : { *(.bss) } __bss_stop = .; @@ -122,4 +147,6 @@ .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + + } --- diff/arch/i386/kernel/vsyscall-sysenter.S 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/vsyscall-sysenter.S 2004-02-18 09:03:57.000000000 +0000 @@ -7,6 +7,11 @@ .type __kernel_vsyscall,@function __kernel_vsyscall: .LSTART_vsyscall: + cmpl $192, %eax + jne 1f + int $0x80 + ret +1: push %ecx .Lpush_ecx: push %edx --- diff/arch/i386/kernel/vsyscall.lds 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/kernel/vsyscall.lds 2004-02-18 09:03:57.000000000 +0000 @@ -5,7 +5,7 @@ */ /* This must match . */ -VSYSCALL_BASE = 0xffffe000; +VSYSCALL_BASE = 0xffffd000; SECTIONS { --- diff/arch/i386/lib/Makefile 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/lib/Makefile 2004-02-18 09:03:57.000000000 +0000 @@ -9,4 +9,5 @@ lib-$(CONFIG_X86_USE_3DNOW) += mmx.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o +lib-$(CONFIG_KGDB) += kgdb_serial.o lib-$(CONFIG_DEBUG_IOVIRT) += iodebug.o --- diff/arch/i386/lib/checksum.S 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/lib/checksum.S 2004-02-18 09:03:57.000000000 +0000 @@ -280,14 +280,14 @@ .previous .align 4 -.globl csum_partial_copy_generic +.globl direct_csum_partial_copy_generic #ifndef CONFIG_X86_USE_PPRO_CHECKSUM #define ARGBASE 16 #define FP 12 -csum_partial_copy_generic: +direct_csum_partial_copy_generic: subl $4,%esp pushl %edi pushl %esi @@ -422,7 +422,7 @@ #define ARGBASE 12 -csum_partial_copy_generic: +direct_csum_partial_copy_generic: pushl %ebx pushl %edi pushl %esi --- diff/arch/i386/lib/dec_and_lock.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/lib/dec_and_lock.c 2004-02-18 09:03:57.000000000 +0000 @@ -10,6 +10,7 @@ #include #include +#ifndef ATOMIC_DEC_AND_LOCK int atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock) { int counter; @@ -38,3 +39,5 @@ spin_unlock(lock); return 0; } +#endif + --- diff/arch/i386/lib/getuser.S 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/lib/getuser.S 2004-02-18 09:03:57.000000000 +0000 @@ -9,6 +9,7 @@ * return value. */ #include +#include /* @@ -28,7 +29,7 @@ .globl __get_user_1 __get_user_1: GET_THREAD_INFO(%edx) - cmpl TI_ADDR_LIMIT(%edx),%eax + cmpl TI_addr_limit(%edx),%eax jae bad_get_user 1: movzbl (%eax),%edx xorl %eax,%eax @@ -40,7 +41,7 @@ addl $1,%eax jc bad_get_user GET_THREAD_INFO(%edx) - cmpl TI_ADDR_LIMIT(%edx),%eax + cmpl TI_addr_limit(%edx),%eax jae bad_get_user 2: movzwl -1(%eax),%edx xorl %eax,%eax @@ -52,7 +53,7 @@ addl $3,%eax jc bad_get_user GET_THREAD_INFO(%edx) - cmpl TI_ADDR_LIMIT(%edx),%eax + cmpl TI_addr_limit(%edx),%eax jae bad_get_user 3: movl -3(%eax),%edx xorl %eax,%eax --- diff/arch/i386/lib/usercopy.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/lib/usercopy.c 2004-02-18 09:03:57.000000000 +0000 @@ -76,7 +76,7 @@ * and returns @count. */ long -__strncpy_from_user(char *dst, const char __user *src, long count) +__direct_strncpy_from_user(char *dst, const char __user *src, long count) { long res; __do_strncpy_from_user(dst, src, count, res); @@ -102,7 +102,7 @@ * and returns @count. */ long -strncpy_from_user(char *dst, const char __user *src, long count) +direct_strncpy_from_user(char *dst, const char __user *src, long count) { long res = -EFAULT; if (access_ok(VERIFY_READ, src, 1)) @@ -147,7 +147,7 @@ * On success, this will be zero. */ unsigned long -clear_user(void __user *to, unsigned long n) +direct_clear_user(void __user *to, unsigned long n) { might_sleep(); if (access_ok(VERIFY_WRITE, to, n)) @@ -167,7 +167,7 @@ * On success, this will be zero. */ unsigned long -__clear_user(void __user *to, unsigned long n) +__direct_clear_user(void __user *to, unsigned long n) { __do_clear_user(to, n); return n; @@ -184,7 +184,7 @@ * On exception, returns 0. * If the string is too long, returns a value greater than @n. */ -long strnlen_user(const char __user *s, long n) +long direct_strnlen_user(const char __user *s, long n) { unsigned long mask = -__addr_ok(s); unsigned long res, tmp; @@ -575,3 +575,4 @@ n = __copy_user_zeroing_intel(to, (const void *) from, n); return n; } + --- diff/arch/i386/math-emu/fpu_system.h 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/math-emu/fpu_system.h 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include /* This sets the pointer FPU_info to point to the argument part of the stack frame of math_emulate() */ @@ -22,7 +23,7 @@ /* s is always from a cpu register, and the cpu does bounds checking * during register load --> no further bounds checks needed */ -#define LDT_DESCRIPTOR(s) (((struct desc_struct *)current->mm->context.ldt)[(s) >> 3]) +#define LDT_DESCRIPTOR(s) (((struct desc_struct *)__kmap_atomic_vaddr(KM_LDT_PAGE0))[(s) >> 3]) #define SEG_D_SIZE(x) ((x).b & (3 << 21)) #define SEG_G_BIT(x) ((x).b & (1 << 23)) #define SEG_GRANULARITY(x) (((x).b & (1 << 23)) ? 4096 : 1) --- diff/arch/i386/mm/fault.c 2003-12-19 09:51:11.000000000 +0000 +++ source/arch/i386/mm/fault.c 2004-02-18 09:03:57.000000000 +0000 @@ -27,6 +27,7 @@ #include #include #include +#include extern void die(const char *,struct pt_regs *,long); @@ -104,8 +105,17 @@ if (seg & (1<<2)) { /* Must lock the LDT while reading it. */ down(¤t->mm->context.sem); +#if 1 + /* horrible hack for 4/4 disabled kernels. + I'm not quite sure what the TLB flush is good for, + it's mindlessly copied from the read_ldt code */ + __flush_tlb_global(); + desc = kmap(current->mm->context.ldt_pages[(seg&~7)/PAGE_SIZE]); + desc = (void *)desc + ((seg & ~7) % PAGE_SIZE); +#else desc = current->mm->context.ldt; desc = (void *)desc + (seg & ~7); +#endif } else { /* Must disable preemption while reading the GDT. */ desc = (u32 *)&cpu_gdt_table[get_cpu()]; @@ -118,6 +128,9 @@ (desc[1] & 0xff000000); if (seg & (1<<2)) { +#if 1 + kunmap((void *)((unsigned long)desc & PAGE_MASK)); +#endif up(¤t->mm->context.sem); } else put_cpu(); @@ -243,6 +256,19 @@ * (error_code & 4) == 0, and that the fault was not a * protection error (error_code & 1) == 0. */ +#ifdef CONFIG_X86_4G + /* + * On 4/4 all kernels faults are either bugs, vmalloc or prefetch + */ + if (unlikely((regs->xcs & 3) == 0)) { + if (error_code & 3) + goto bad_area_nosemaphore; + + /* If it's vm86 fall through */ + if (!(regs->eflags & VM_MASK)) + goto vmalloc_fault; + } +#else if (unlikely(address >= TASK_SIZE)) { if (!(error_code & 5)) goto vmalloc_fault; @@ -252,6 +278,7 @@ */ goto bad_area_nosemaphore; } +#endif mm = tsk->mm; @@ -403,6 +430,12 @@ * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. */ +#ifdef CONFIG_KGDB + if (!user_mode(regs)){ + kgdb_handle_exception(14,SIGBUS, error_code, regs); + return; + } +#endif bust_spinlocks(1); --- diff/arch/i386/mm/hugetlbpage.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/mm/hugetlbpage.c 2004-02-18 09:03:57.000000000 +0000 @@ -61,6 +61,27 @@ static void free_huge_page(struct page *page); +#ifdef CONFIG_NUMA + +static inline void huge_inc_rss(struct mm_struct *mm, struct page *page) +{ + mm->rss += (HPAGE_SIZE / PAGE_SIZE); + mm->pernode_rss[page_to_nid(page)] += (HPAGE_SIZE / PAGE_SIZE); +} + +static inline void huge_dec_rss(struct mm_struct *mm, struct page *page) +{ + mm->rss -= (HPAGE_SIZE / PAGE_SIZE); + mm->pernode_rss[page_to_nid(page)] -= (HPAGE_SIZE / PAGE_SIZE); +} + +#else /* !CONFIG_NUMA */ + +#define huge_inc_rss(mm, page) ((mm)->rss += (HPAGE_SIZE / PAGE_SIZE)) +#define huge_dec_rss(mm, page) ((mm)->rss -= (HPAGE_SIZE / PAGE_SIZE)) + +#endif /* CONFIG_NUMA */ + static struct page *alloc_hugetlb_page(void) { int i; @@ -105,7 +126,7 @@ { pte_t entry; - mm->rss += (HPAGE_SIZE / PAGE_SIZE); + huge_inc_rss(mm, page); if (write_access) { entry = pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot))); @@ -145,7 +166,7 @@ ptepage = pte_page(entry); get_page(ptepage); set_pte(dst_pte, entry); - dst->rss += (HPAGE_SIZE / PAGE_SIZE); + huge_inc_rss(dst, ptepage); addr += HPAGE_SIZE; } return 0; @@ -314,8 +335,8 @@ page = pte_page(*pte); huge_page_release(page); pte_clear(pte); + huge_dec_rss(mm, page); } - mm->rss -= (end - start) >> PAGE_SHIFT; flush_tlb_range(vma, start, end); } --- diff/arch/i386/mm/init.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/i386/mm/init.c 2004-02-18 09:03:57.000000000 +0000 @@ -40,125 +40,13 @@ #include #include #include +#include DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); unsigned long highstart_pfn, highend_pfn; static int do_test_wp_bit(void); -/* - * Creates a middle page table and puts a pointer to it in the - * given global directory entry. This only returns the gd entry - * in non-PAE compilation mode, since the middle layer is folded. - */ -static pmd_t * __init one_md_table_init(pgd_t *pgd) -{ - pmd_t *pmd_table; - -#ifdef CONFIG_X86_PAE - pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); - set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); - if (pmd_table != pmd_offset(pgd, 0)) - BUG(); -#else - pmd_table = pmd_offset(pgd, 0); -#endif - - return pmd_table; -} - -/* - * Create a page table and place a pointer to it in a middle page - * directory entry. - */ -static pte_t * __init one_page_table_init(pmd_t *pmd) -{ - if (pmd_none(*pmd)) { - pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); - set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); - if (page_table != pte_offset_kernel(pmd, 0)) - BUG(); - - return page_table; - } - - return pte_offset_kernel(pmd, 0); -} - -/* - * This function initializes a certain range of kernel virtual memory - * with new bootmem page tables, everywhere page tables are missing in - * the given range. - */ - -/* - * NOTE: The pagetables are allocated contiguous on the physical space - * so we can cache the place of the first one and move around without - * checking the pgd every time. - */ -static void __init page_table_range_init (unsigned long start, unsigned long end, pgd_t *pgd_base) -{ - pgd_t *pgd; - pmd_t *pmd; - int pgd_idx, pmd_idx; - unsigned long vaddr; - - vaddr = start; - pgd_idx = pgd_index(vaddr); - pmd_idx = pmd_index(vaddr); - pgd = pgd_base + pgd_idx; - - for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd++, pgd_idx++) { - if (pgd_none(*pgd)) - one_md_table_init(pgd); - - pmd = pmd_offset(pgd, vaddr); - for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end); pmd++, pmd_idx++) { - if (pmd_none(*pmd)) - one_page_table_init(pmd); - - vaddr += PMD_SIZE; - } - pmd_idx = 0; - } -} - -/* - * This maps the physical memory to kernel virtual address space, a total - * of max_low_pfn pages, by creating page tables starting from address - * PAGE_OFFSET. - */ -static void __init kernel_physical_mapping_init(pgd_t *pgd_base) -{ - unsigned long pfn; - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; - int pgd_idx, pmd_idx, pte_ofs; - - pgd_idx = pgd_index(PAGE_OFFSET); - pgd = pgd_base + pgd_idx; - pfn = 0; - - for (; pgd_idx < PTRS_PER_PGD; pgd++, pgd_idx++) { - pmd = one_md_table_init(pgd); - if (pfn >= max_low_pfn) - continue; - for (pmd_idx = 0; pmd_idx < PTRS_PER_PMD && pfn < max_low_pfn; pmd++, pmd_idx++) { - /* Map with big pages if possible, otherwise create normal page tables. */ - if (cpu_has_pse) { - set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE)); - pfn += PTRS_PER_PTE; - } else { - pte = one_page_table_init(pmd); - - for (pte_ofs = 0; pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, pte_ofs++) - set_pte(pte, pfn_pte(pfn, PAGE_KERNEL)); - } - } - } -} - static inline int page_kills_ppro(unsigned long pagenr) { if (pagenr >= 0x70000 && pagenr <= 0x7003F) @@ -206,11 +94,8 @@ return 0; } -#ifdef CONFIG_HIGHMEM pte_t *kmap_pte; -pgprot_t kmap_prot; -EXPORT_SYMBOL(kmap_prot); EXPORT_SYMBOL(kmap_pte); #define kmap_get_fixmap_pte(vaddr) \ @@ -218,29 +103,7 @@ void __init kmap_init(void) { - unsigned long kmap_vstart; - - /* cache the first kmap pte */ - kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); - kmap_pte = kmap_get_fixmap_pte(kmap_vstart); - - kmap_prot = PAGE_KERNEL; -} - -void __init permanent_kmaps_init(pgd_t *pgd_base) -{ - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; - unsigned long vaddr; - - vaddr = PKMAP_BASE; - page_table_range_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base); - - pgd = swapper_pg_dir + pgd_index(vaddr); - pmd = pmd_offset(pgd, vaddr); - pte = pte_offset_kernel(pmd, vaddr); - pkmap_page_table = pte; + kmap_pte = kmap_get_fixmap_pte(__fix_to_virt(FIX_KMAP_BEGIN)); } void __init one_highpage_init(struct page *page, int pfn, int bad_ppro) @@ -255,6 +118,8 @@ SetPageReserved(page); } +#ifdef CONFIG_HIGHMEM + #ifndef CONFIG_DISCONTIGMEM void __init set_highmem_pages_init(int bad_ppro) { @@ -266,12 +131,9 @@ #else extern void set_highmem_pages_init(int); #endif /* !CONFIG_DISCONTIGMEM */ - #else -#define kmap_init() do { } while (0) -#define permanent_kmaps_init(pgd_base) do { } while (0) -#define set_highmem_pages_init(bad_ppro) do { } while (0) -#endif /* CONFIG_HIGHMEM */ +# define set_highmem_pages_init(bad_ppro) do { } while (0) +#endif unsigned long __PAGE_KERNEL = _PAGE_KERNEL; @@ -281,30 +143,125 @@ extern void __init remap_numa_kva(void); #endif -static void __init pagetable_init (void) +static __init void prepare_pagetables(pgd_t *pgd_base, unsigned long address) +{ + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; + + pgd = pgd_base + pgd_index(address); + pmd = pmd_offset(pgd, address); + if (!pmd_present(*pmd)) { + pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); + set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); + } +} + +static void __init fixrange_init (unsigned long start, unsigned long end, pgd_t *pgd_base) { unsigned long vaddr; - pgd_t *pgd_base = swapper_pg_dir; + for (vaddr = start; vaddr != end; vaddr += PAGE_SIZE) + prepare_pagetables(pgd_base, vaddr); +} + +void setup_identity_mappings(pgd_t *pgd_base, unsigned long start, unsigned long end) +{ + unsigned long vaddr; + pgd_t *pgd; + int i, j, k; + pmd_t *pmd; + pte_t *pte, *pte_base; + + pgd = pgd_base; + + for (i = 0; i < PTRS_PER_PGD; pgd++, i++) { + vaddr = i*PGDIR_SIZE; + if (end && (vaddr >= end)) + break; + pmd = pmd_offset(pgd, 0); + for (j = 0; j < PTRS_PER_PMD; pmd++, j++) { + vaddr = i*PGDIR_SIZE + j*PMD_SIZE; + if (end && (vaddr >= end)) + break; + if (vaddr < start) + continue; + if (cpu_has_pse) { + unsigned long __pe; + + set_in_cr4(X86_CR4_PSE); + boot_cpu_data.wp_works_ok = 1; + __pe = _KERNPG_TABLE + _PAGE_PSE + vaddr - start; + /* Make it "global" too if supported */ + if (cpu_has_pge) { + set_in_cr4(X86_CR4_PGE); +#if !defined(CONFIG_X86_SWITCH_PAGETABLES) + __pe += _PAGE_GLOBAL; + __PAGE_KERNEL |= _PAGE_GLOBAL; +#endif + } + set_pmd(pmd, __pmd(__pe)); + continue; + } + if (!pmd_present(*pmd)) + pte_base = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); + else + pte_base = (pte_t *) page_address(pmd_page(*pmd)); + pte = pte_base; + for (k = 0; k < PTRS_PER_PTE; pte++, k++) { + vaddr = i*PGDIR_SIZE + j*PMD_SIZE + k*PAGE_SIZE; + if (end && (vaddr >= end)) + break; + if (vaddr < start) + continue; + *pte = mk_pte_phys(vaddr-start, PAGE_KERNEL); + } + set_pmd(pmd, __pmd(_KERNPG_TABLE + __pa(pte_base))); + } + } +} + +static void __init pagetable_init (void) +{ + unsigned long vaddr, end; + pgd_t *pgd_base; #ifdef CONFIG_X86_PAE int i; - /* Init entries of the first-level page table to the zero page */ - for (i = 0; i < PTRS_PER_PGD; i++) - set_pgd(pgd_base + i, __pgd(__pa(empty_zero_page) | _PAGE_PRESENT)); #endif - /* Enable PSE if available */ - if (cpu_has_pse) { - set_in_cr4(X86_CR4_PSE); - } + /* + * This can be zero as well - no problem, in that case we exit + * the loops anyway due to the PTRS_PER_* conditions. + */ + end = (unsigned long)__va(max_low_pfn*PAGE_SIZE); - /* Enable PGE if available */ - if (cpu_has_pge) { - set_in_cr4(X86_CR4_PGE); - __PAGE_KERNEL |= _PAGE_GLOBAL; + pgd_base = swapper_pg_dir; +#ifdef CONFIG_X86_PAE + /* + * It causes too many problems if there's no proper pmd set up + * for all 4 entries of the PGD - so we allocate all of them. + * PAE systems will not miss this extra 4-8K anyway ... + */ + for (i = 0; i < PTRS_PER_PGD; i++) { + pmd_t *pmd = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); + set_pgd(pgd_base + i, __pgd(__pa(pmd) + 0x1)); } +#endif + /* + * Set up lowmem-sized identity mappings at PAGE_OFFSET: + */ + setup_identity_mappings(pgd_base, PAGE_OFFSET, end); - kernel_physical_mapping_init(pgd_base); + /* + * Add flat-mode identity-mappings - SMP needs it when + * starting up on an AP from real-mode. (In the non-PAE + * case we already have these mappings through head.S.) + * All user-space mappings are explicitly cleared after + * SMP startup. + */ +#if defined(CONFIG_SMP) && defined(CONFIG_X86_PAE) + setup_identity_mappings(pgd_base, 0, 16*1024*1024); +#endif remap_numa_kva(); /* @@ -312,38 +269,64 @@ * created - mappings will be set by set_fixmap(): */ vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; - page_table_range_init(vaddr, 0, pgd_base); + fixrange_init(vaddr, 0, pgd_base); - permanent_kmaps_init(pgd_base); +#ifdef CONFIG_HIGHMEM + { + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; -#ifdef CONFIG_X86_PAE - /* - * Add low memory identity-mappings - SMP needs it when - * starting up on an AP from real-mode. In the non-PAE - * case we already have these mappings through head.S. - * All user-space mappings are explicitly cleared after - * SMP startup. - */ - pgd_base[0] = pgd_base[USER_PTRS_PER_PGD]; + /* + * Permanent kmaps: + */ + vaddr = PKMAP_BASE; + fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base); + + pgd = swapper_pg_dir + pgd_index(vaddr); + pmd = pmd_offset(pgd, vaddr); + pte = pte_offset_kernel(pmd, vaddr); + pkmap_page_table = pte; + } #endif } -void zap_low_mappings (void) +/* + * Clear kernel pagetables in a PMD_SIZE-aligned range. + */ +static void clear_mappings(pgd_t *pgd_base, unsigned long start, unsigned long end) { - int i; + unsigned long vaddr; + pgd_t *pgd; + pmd_t *pmd; + int i, j; + + pgd = pgd_base; + + for (i = 0; i < PTRS_PER_PGD; pgd++, i++) { + vaddr = i*PGDIR_SIZE; + if (end && (vaddr >= end)) + break; + pmd = pmd_offset(pgd, 0); + for (j = 0; j < PTRS_PER_PMD; pmd++, j++) { + vaddr = i*PGDIR_SIZE + j*PMD_SIZE; + if (end && (vaddr >= end)) + break; + if (vaddr < start) + continue; + pmd_clear(pmd); + } + } + flush_tlb_all(); +} + +void zap_low_mappings(void) +{ + printk("zapping low mappings.\n"); /* * Zap initial low-memory mappings. - * - * Note that "pgd_clear()" doesn't do it for - * us, because pgd_clear() is a no-op on i386. */ - for (i = 0; i < USER_PTRS_PER_PGD; i++) -#ifdef CONFIG_X86_PAE - set_pgd(swapper_pg_dir+i, __pgd(1 + __pa(empty_zero_page))); -#else - set_pgd(swapper_pg_dir+i, __pgd(0)); -#endif - flush_tlb_all(); + clear_mappings(swapper_pg_dir, 0, 16*1024*1024); } #ifndef CONFIG_DISCONTIGMEM @@ -393,7 +376,15 @@ set_in_cr4(X86_CR4_PAE); #endif __flush_tlb_all(); - + /* + * Subtle. SMP is doing it's boot stuff late (because it has to + * fork idle threads) - but it also needs low mappings for the + * protected-mode entry to work. We zap these entries only after + * the WP-bit has been tested. + */ +#ifndef CONFIG_SMP + zap_low_mappings(); +#endif kmap_init(); zone_sizes_init(); } @@ -515,22 +506,18 @@ if (boot_cpu_data.wp_works_ok < 0) test_wp_bit(); - /* - * Subtle. SMP is doing it's boot stuff late (because it has to - * fork idle threads) - but it also needs low mappings for the - * protected-mode entry to work. We zap these entries only after - * the WP-bit has been tested. - */ -#ifndef CONFIG_SMP - zap_low_mappings(); -#endif + entry_trampoline_setup(); + default_ldt_page = virt_to_page(default_ldt); + load_LDT(&init_mm.context); } -kmem_cache_t *pgd_cache; -kmem_cache_t *pmd_cache; +kmem_cache_t *pgd_cache, *pmd_cache, *kpmd_cache; void __init pgtable_cache_init(void) { + void (*ctor)(void *, kmem_cache_t *, unsigned long); + void (*dtor)(void *, kmem_cache_t *, unsigned long); + if (PTRS_PER_PMD > 1) { pmd_cache = kmem_cache_create("pmd", PTRS_PER_PMD*sizeof(pmd_t), @@ -540,13 +527,36 @@ NULL); if (!pmd_cache) panic("pgtable_cache_init(): cannot create pmd cache"); + + if (TASK_SIZE > PAGE_OFFSET) { + kpmd_cache = kmem_cache_create("kpmd", + PTRS_PER_PMD*sizeof(pmd_t), + 0, + SLAB_HWCACHE_ALIGN | SLAB_MUST_HWCACHE_ALIGN, + kpmd_ctor, + NULL); + if (!kpmd_cache) + panic("pgtable_cache_init(): " + "cannot create kpmd cache"); + } } + + if (PTRS_PER_PMD == 1 || TASK_SIZE <= PAGE_OFFSET) + ctor = pgd_ctor; + else + ctor = NULL; + + if (PTRS_PER_PMD == 1 && TASK_SIZE <= PAGE_OFFSET) + dtor = pgd_dtor; + else + dtor = NULL; + pgd_cache = kmem_cache_create("pgd", PTRS_PER_PGD*sizeof(pgd_t), 0, SLAB_HWCACHE_ALIGN | SLAB_MUST_HWCACHE_ALIGN, - pgd_ctor, - PTRS_PER_PMD == 1 ? pgd_dtor : NULL); + ctor, + dtor); if (!pgd_cache) panic("pgtable_cache_init(): Cannot create pgd cache"); } --- diff/arch/i386/mm/pgtable.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/i386/mm/pgtable.c 2004-02-18 09:03:57.000000000 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include void show_mem(void) { @@ -157,11 +158,20 @@ memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); } +void kpmd_ctor(void *__pmd, kmem_cache_t *cache, unsigned long flags) +{ + pmd_t *kpmd, *pmd; + kpmd = pmd_offset(&swapper_pg_dir[PTRS_PER_PGD-1], + (PTRS_PER_PMD - NR_SHARED_PMDS)*PMD_SIZE); + pmd = (pmd_t *)__pmd + (PTRS_PER_PMD - NR_SHARED_PMDS); + + memset(__pmd, 0, (PTRS_PER_PMD - NR_SHARED_PMDS)*sizeof(pmd_t)); + memcpy(pmd, kpmd, NR_SHARED_PMDS*sizeof(pmd_t)); +} + /* - * List of all pgd's needed for non-PAE so it can invalidate entries - * in both cached and uncached pgd's; not needed for PAE since the - * kernel pmd is shared. If PAE were not to share the pmd a similar - * tactic would be needed. This is essentially codepath-based locking + * List of all pgd's needed so it can invalidate entries in both cached + * and uncached pgd's. This is essentially codepath-based locking * against pageattr.c; it is the unique case in which a valid change * of kernel pagetables can't be lazily synchronized by vmalloc faults. * vmalloc faults work because attached pagetables are never freed. @@ -170,30 +180,60 @@ * could be used. The locking scheme was chosen on the basis of * manfred's recommendations and having no core impact whatsoever. * -- wli + * + * The entire issue goes away when XKVA is configured. */ spinlock_t pgd_lock = SPIN_LOCK_UNLOCKED; LIST_HEAD(pgd_list); -void pgd_ctor(void *pgd, kmem_cache_t *cache, unsigned long unused) +/* + * This is not that hard to figure out. + * (a) PTRS_PER_PMD == 1 means non-PAE. + * (b) PTRS_PER_PMD > 1 means PAE. + * (c) TASK_SIZE > PAGE_OFFSET means XKVA. + * (d) TASK_SIZE <= PAGE_OFFSET means non-XKVA. + * + * Do *NOT* back out the preconstruction like the patch I'm cleaning + * up after this very instant did, or at all, for that matter. + * This is never called when PTRS_PER_PMD > 1 && TASK_SIZE > PAGE_OFFSET. + * -- wli + */ +void pgd_ctor(void *__pgd, kmem_cache_t *cache, unsigned long unused) { + pgd_t *pgd = (pgd_t *)__pgd; unsigned long flags; - if (PTRS_PER_PMD == 1) - spin_lock_irqsave(&pgd_lock, flags); + if (PTRS_PER_PMD == 1) { + if (TASK_SIZE <= PAGE_OFFSET) + spin_lock_irqsave(&pgd_lock, flags); + else + memcpy(&pgd[PTRS_PER_PGD - NR_SHARED_PMDS], + &swapper_pg_dir[PTRS_PER_PGD - NR_SHARED_PMDS], + NR_SHARED_PMDS * sizeof(pgd_t)); + } - memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD, - swapper_pg_dir + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + if (TASK_SIZE <= PAGE_OFFSET) + memcpy(pgd + USER_PTRS_PER_PGD, + swapper_pg_dir + USER_PTRS_PER_PGD, + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); if (PTRS_PER_PMD > 1) return; - list_add(&virt_to_page(pgd)->lru, &pgd_list); - spin_unlock_irqrestore(&pgd_lock, flags); - memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t)); + if (TASK_SIZE > PAGE_OFFSET) + memset(pgd, 0, (PTRS_PER_PGD - NR_SHARED_PMDS)*sizeof(pgd_t)); + else { + list_add(&virt_to_page(pgd)->lru, &pgd_list); + spin_unlock_irqrestore(&pgd_lock, flags); + memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t)); + } } -/* never called when PTRS_PER_PMD > 1 */ +/* + * Never called when PTRS_PER_PMD > 1 || TASK_SIZE > PAGE_OFFSET + * for with PAE we would list_del() multiple times, and for non-PAE + * with XKVA all the AGP pgd shootdown code is unnecessary. + */ void pgd_dtor(void *pgd, kmem_cache_t *cache, unsigned long unused) { unsigned long flags; /* can be called from interrupt context */ @@ -203,6 +243,12 @@ spin_unlock_irqrestore(&pgd_lock, flags); } +/* + * See the comments above pgd_ctor() wrt. preconstruction. + * Do *NOT* memcpy() here. If you do, you back out important + * anti- cache pollution code. + * + */ pgd_t *pgd_alloc(struct mm_struct *mm) { int i; @@ -211,15 +257,33 @@ if (PTRS_PER_PMD == 1 || !pgd) return pgd; + /* + * In the 4G userspace case alias the top 16 MB virtual + * memory range into the user mappings as well (these + * include the trampoline and CPU data structures). + */ for (i = 0; i < USER_PTRS_PER_PGD; ++i) { - pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL); + kmem_cache_t *cache; + pmd_t *pmd; + + if (TASK_SIZE > PAGE_OFFSET && i == USER_PTRS_PER_PGD - 1) + cache = kpmd_cache; + else + cache = pmd_cache; + + pmd = kmem_cache_alloc(cache, GFP_KERNEL); if (!pmd) goto out_oom; set_pgd(&pgd[i], __pgd(1 + __pa((u64)((u32)pmd)))); } - return pgd; + return pgd; out_oom: + /* + * we don't have to handle the kpmd_cache here, since it's the + * last allocation, and has either nothing to free or when it + * succeeds the whole operation succeeds. + */ for (i--; i >= 0; i--) kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1)); kmem_cache_free(pgd_cache, pgd); @@ -230,10 +294,29 @@ { int i; - /* in the PAE case user pgd entries are overwritten before usage */ - if (PTRS_PER_PMD > 1) - for (i = 0; i < USER_PTRS_PER_PGD; ++i) - kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1)); /* in the non-PAE case, clear_page_tables() clears user pgd entries */ + if (PTRS_PER_PMD == 1) + goto out_free; + + /* in the PAE case user pgd entries are overwritten before usage */ + for (i = 0; i < USER_PTRS_PER_PGD; ++i) { + kmem_cache_t *cache; + pmd_t *pmd = __va(pgd_val(pgd[i]) - 1); + + /* + * only userspace pmd's are cleared for us + * by mm/memory.c; it's a slab cache invariant + * that we must separate the kernel pmd slab + * all times, else we'll have bad pmd's. + */ + if (TASK_SIZE > PAGE_OFFSET && i == USER_PTRS_PER_PGD - 1) + cache = kpmd_cache; + else + cache = pmd_cache; + + kmem_cache_free(cache, pmd); + } +out_free: kmem_cache_free(pgd_cache, pgd); } + --- diff/arch/i386/oprofile/nmi_int.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/i386/oprofile/nmi_int.c 2004-02-18 09:03:57.000000000 +0000 @@ -335,7 +335,9 @@ if (cpu_model > 0xd) return 0; - if (cpu_model > 5) { + if (cpu_model == 9) { + nmi_ops.cpu_type = "i386/p6_mobile"; + } else if (cpu_model > 5) { nmi_ops.cpu_type = "i386/piii"; } else if (cpu_model > 2) { nmi_ops.cpu_type = "i386/pii"; --- diff/arch/i386/oprofile/nmi_timer_int.c 2003-06-30 10:07:32.000000000 +0100 +++ source/arch/i386/oprofile/nmi_timer_int.c 2004-02-18 09:03:57.000000000 +0000 @@ -48,9 +48,13 @@ .cpu_type = "timer" }; - int __init nmi_timer_init(struct oprofile_operations ** ops) { + extern int nmi_active; + + if (nmi_active <= 0) + return -ENODEV; + *ops = &nmi_timer_ops; printk(KERN_INFO "oprofile: using NMI timer interrupt.\n"); return 0; --- diff/arch/i386/oprofile/op_model_p4.c 2003-08-26 10:00:51.000000000 +0100 +++ source/arch/i386/oprofile/op_model_p4.c 2004-02-18 09:03:57.000000000 +0000 @@ -382,11 +382,8 @@ static unsigned int get_stagger(void) { #ifdef CONFIG_SMP - int cpu; - if (smp_num_siblings > 1) { - cpu = smp_processor_id(); - return (cpu_sibling_map[cpu] > cpu) ? 0 : 1; - } + int cpu = smp_processor_id(); + return (cpu != first_cpu(cpu_sibling_map[cpu])); #endif return 0; } --- diff/arch/i386/oprofile/op_model_ppro.c 2003-08-26 10:00:51.000000000 +0100 +++ source/arch/i386/oprofile/op_model_ppro.c 2004-02-18 09:03:57.000000000 +0000 @@ -13,6 +13,7 @@ #include #include #include +#include #include "op_x86_model.h" #include "op_counter.h" @@ -101,6 +102,10 @@ } } + /* Only P6 based Pentium M need to re-unmask the apic vector but it + * doesn't hurt other P6 variant */ + apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED); + /* We can't work out if we really handled an interrupt. We * might have caught a *second* counter just after overflowing * the interrupt for this counter then arrives --- diff/arch/i386/pci/Makefile 2003-07-08 09:55:17.000000000 +0100 +++ source/arch/i386/pci/Makefile 2004-02-18 09:03:57.000000000 +0000 @@ -1,6 +1,7 @@ obj-y := i386.o obj-$(CONFIG_PCI_BIOS) += pcbios.o +obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o obj-$(CONFIG_PCI_DIRECT) += direct.o pci-y := fixup.o --- diff/arch/i386/pci/common.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/i386/pci/common.c 2004-02-18 09:03:57.000000000 +0000 @@ -20,7 +20,8 @@ extern void pcibios_sort(void); #endif -unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2; +unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 | + PCI_PROBE_MMCONF; int pcibios_last_bus = -1; struct pci_bus *pci_root_bus = NULL; @@ -198,6 +199,12 @@ return NULL; } #endif +#ifdef CONFIG_PCI_MMCONFIG + else if (!strcmp(str, "nommconf")) { + pci_probe &= ~PCI_PROBE_MMCONF; + return NULL; + } +#endif else if (!strcmp(str, "noacpi")) { acpi_noirq_set(); return NULL; --- diff/arch/i386/pci/pci.h 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/i386/pci/pci.h 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,9 @@ #define PCI_PROBE_BIOS 0x0001 #define PCI_PROBE_CONF1 0x0002 #define PCI_PROBE_CONF2 0x0004 +#define PCI_PROBE_MMCONF 0x0008 +#define PCI_PROBE_MASK 0x000f + #define PCI_NO_SORT 0x0100 #define PCI_BIOS_SORT 0x0200 #define PCI_NO_CHECKS 0x0400 --- diff/arch/ia64/Kconfig 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/Kconfig 2004-02-18 09:03:57.000000000 +0000 @@ -662,6 +662,13 @@ Say Y here only if you plan to use gdb to debug the kernel. If you don't debug the kernel, you can say N. +config LOCKMETER + bool "Kernel lock metering" + depends on SMP + help + Say Y to enable kernel lock metering, which adds overhead to SMP locks, + but allows you to see various statistics using the lockstat command. + endmenu source "security/Kconfig" --- diff/arch/ia64/hp/sim/simeth.c 2003-08-20 14:16:08.000000000 +0100 +++ source/arch/ia64/hp/sim/simeth.c 2004-02-18 09:03:57.000000000 +0000 @@ -224,7 +224,7 @@ err = register_netdev(dev); if (err) { - kfree(dev); + free_netdev(dev); return err; } --- diff/arch/ia64/ia32/ia32_ioctl.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/ia64/ia32/ia32_ioctl.c 2004-02-18 09:03:57.000000000 +0000 @@ -8,6 +8,7 @@ */ #include /* argh, msdos_fs.h isn't self-contained... */ +#include #include "ia32priv.h" #define INCLUDES @@ -26,8 +27,6 @@ _ret; \ }) -asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); - #define CODE #include "compat_ioctl.c" --- diff/arch/ia64/ia32/ia32_signal.c 2003-11-25 15:24:57.000000000 +0000 +++ source/arch/ia64/ia32/ia32_signal.c 2004-02-18 09:03:57.000000000 +0000 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -550,9 +551,6 @@ } -extern asmlinkage long sys_rt_sigprocmask (int how, sigset_t *set, sigset_t *oset, - size_t sigsetsize); - asmlinkage long sys32_rt_sigprocmask (int how, compat_sigset_t *set, compat_sigset_t *oset, unsigned int sigsetsize) { @@ -584,8 +582,6 @@ sys32_rt_sigtimedwait (compat_sigset_t *uthese, siginfo_t32 *uinfo, struct compat_timespec *uts, unsigned int sigsetsize) { - extern asmlinkage long sys_rt_sigtimedwait (const sigset_t *, siginfo_t *, - const struct timespec *, size_t); extern int copy_siginfo_to_user32 (siginfo_t32 *, siginfo_t *); mm_segment_t old_fs = get_fs(); struct timespec t; @@ -611,7 +607,6 @@ asmlinkage long sys32_rt_sigqueueinfo (int pid, int sig, siginfo_t32 *uinfo) { - extern asmlinkage long sys_rt_sigqueueinfo (int, int, siginfo_t *); extern int copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 *from); mm_segment_t old_fs = get_fs(); siginfo_t info; --- diff/arch/ia64/ia32/sys_ia32.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/ia32/sys_ia32.c 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -55,6 +56,7 @@ #include #include #include +#include #include "ia32priv.h" @@ -81,16 +83,9 @@ #define high2lowuid(uid) ((uid) > 65535 ? 65534 : (uid)) #define high2lowgid(gid) ((gid) > 65535 ? 65534 : (gid)) -extern asmlinkage long sys_execve (char *, char **, char **, struct pt_regs *); -extern asmlinkage long sys_mprotect (unsigned long, size_t, unsigned long); -extern asmlinkage long sys_munmap (unsigned long, size_t); extern unsigned long arch_get_unmapped_area (struct file *, unsigned long, unsigned long, unsigned long, unsigned long); -/* forward declaration: */ -asmlinkage long sys32_mprotect (unsigned int, unsigned int, int); -asmlinkage unsigned long sys_brk(unsigned long); - /* * Anything that modifies or inspects ia32 user virtual memory must hold this semaphore * while doing so. @@ -949,9 +944,6 @@ (struct compat_timeval *) A(a.tvp)); } -asmlinkage ssize_t sys_readv (unsigned long,const struct iovec *,unsigned long); -asmlinkage ssize_t sys_writev (unsigned long,const struct iovec *,unsigned long); - static struct iovec * get_compat_iovec (struct compat_iovec *iov32, struct iovec *iov_buf, u32 count, int type) { @@ -2023,9 +2015,6 @@ return 0; } -extern asmlinkage long sys_ptrace (long, pid_t, unsigned long, unsigned long, long, long, long, - long, long); - /* * Note that the IA32 version of `ptrace' calls the IA64 routine for * many of the requests. This will only work for requests that do @@ -2284,8 +2273,6 @@ return -ERESTARTNOHAND; } -asmlinkage long sys_msync (unsigned long start, size_t len, int flags); - asmlinkage int sys32_msync (unsigned int start, unsigned int len, int flags) { @@ -2307,8 +2294,6 @@ unsigned int __unused[4]; }; -extern asmlinkage long sys_sysctl(struct __sysctl_args *args); - asmlinkage long sys32_sysctl (struct sysctl32 *args) { @@ -2358,7 +2343,6 @@ asmlinkage long sys32_newuname (struct new_utsname *name) { - extern asmlinkage long sys_newuname(struct new_utsname * name); int ret = sys_newuname(name); if (!ret) @@ -2367,8 +2351,6 @@ return ret; } -extern asmlinkage long sys_getresuid (uid_t *ruid, uid_t *euid, uid_t *suid); - asmlinkage long sys32_getresuid16 (u16 *ruid, u16 *euid, u16 *suid) { @@ -2385,8 +2367,6 @@ return ret; } -extern asmlinkage long sys_getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid); - asmlinkage long sys32_getresgid16 (u16 *rgid, u16 *egid, u16 *sgid) { @@ -2407,65 +2387,100 @@ asmlinkage long sys32_lseek (unsigned int fd, int offset, unsigned int whence) { - extern off_t sys_lseek (unsigned int fd, off_t offset, unsigned int origin); - /* Sign-extension of "offset" is important here... */ return sys_lseek(fd, offset, whence); } -extern asmlinkage long sys_getgroups (int gidsetsize, gid_t *grouplist); +static int +groups16_to_user(short *grouplist, struct group_info *group_info) +{ + int i; + short group; + + for (i = 0; i < group_info->ngroups; i++) { + group = (short)GROUP_AT(group_info, i); + if (put_user(group, grouplist+i)) + return -EFAULT; + } + + return 0; +} + +static int +groups16_from_user(struct group_info *group_info, short *grouplist) +{ + int i; + short group; + + for (i = 0; i < group_info->ngroups; i++) { + if (get_user(group, grouplist+i)) + return -EFAULT; + GROUP_AT(group_info, i) = (gid_t)group; + } + + return 0; +} asmlinkage long sys32_getgroups16 (int gidsetsize, short *grouplist) { - mm_segment_t old_fs = get_fs(); - gid_t gl[NGROUPS]; - int ret, i; + int i; - set_fs(KERNEL_DS); - ret = sys_getgroups(gidsetsize, gl); - set_fs(old_fs); + if (gidsetsize < 0) + return -EINVAL; - if (gidsetsize && ret > 0 && ret <= NGROUPS) - for (i = 0; i < ret; i++, grouplist++) - if (put_user(gl[i], grouplist)) - return -EFAULT; - return ret; + get_group_info(current->group_info); + i = current->group_info->ngroups; + if (gidsetsize) { + if (i > gidsetsize) { + i = -EINVAL; + goto out; + } + if (groups16_to_user(grouplist, current->group_info)) { + i = -EFAULT; + goto out; + } + } +out: + put_group_info(current->group_info); + return i; } -extern asmlinkage long sys_setgroups (int gidsetsize, gid_t *grouplist); - asmlinkage long sys32_setgroups16 (int gidsetsize, short *grouplist) { - mm_segment_t old_fs = get_fs(); - gid_t gl[NGROUPS]; - int ret, i; + struct group_info *group_info; + int retval; - if ((unsigned) gidsetsize > NGROUPS) + if (!capable(CAP_SETGID)) + return -EPERM; + if ((unsigned)gidsetsize > NGROUPS_MAX) return -EINVAL; - for (i = 0; i < gidsetsize; i++, grouplist++) - if (get_user(gl[i], grouplist)) - return -EFAULT; - set_fs(KERNEL_DS); - ret = sys_setgroups(gidsetsize, gl); - set_fs(old_fs); - return ret; + + group_info = groups_alloc(gidsetsize); + if (!group_info) + return -ENOMEM; + retval = groups16_from_user(group_info, grouplist); + if (retval) { + put_group_info(group_info); + return retval; + } + + retval = set_current_groups(group_info); + put_group_info(group_info); + + return retval; } asmlinkage long sys32_truncate64 (unsigned int path, unsigned int len_lo, unsigned int len_hi) { - extern asmlinkage long sys_truncate (const char *path, unsigned long length); - return sys_truncate((const char *) A(path), ((unsigned long) len_hi << 32) | len_lo); } asmlinkage long sys32_ftruncate64 (int fd, unsigned int len_lo, unsigned int len_hi) { - extern asmlinkage long sys_ftruncate (int fd, unsigned long length); - return sys_ftruncate(fd, ((unsigned long) len_hi << 32) | len_lo); } @@ -2554,7 +2569,6 @@ asmlinkage long sys32_sysinfo (struct sysinfo32 *info) { - extern asmlinkage long sys_sysinfo (struct sysinfo *); struct sysinfo s; long ret, err; int bitcount = 0; @@ -2606,7 +2620,6 @@ asmlinkage long sys32_sched_rr_get_interval (pid_t pid, struct compat_timespec *interval) { - extern asmlinkage long sys_sched_rr_get_interval (pid_t, struct timespec *); mm_segment_t old_fs = get_fs(); struct timespec t; long ret; @@ -2622,21 +2635,18 @@ asmlinkage long sys32_pread (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi) { - extern asmlinkage long sys_pread64 (unsigned int, char *, size_t, loff_t); return sys_pread64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo); } asmlinkage long sys32_pwrite (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi) { - extern asmlinkage long sys_pwrite64 (unsigned int, const char *, size_t, loff_t); return sys_pwrite64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo); } asmlinkage long sys32_sendfile (int out_fd, int in_fd, int *offset, unsigned int count) { - extern asmlinkage long sys_sendfile (int, int, off_t *, size_t); mm_segment_t old_fs = get_fs(); long ret; off_t of; @@ -2657,7 +2667,6 @@ asmlinkage long sys32_personality (unsigned int personality) { - extern asmlinkage long sys_personality (unsigned long); long ret; if (current->personality == PER_LINUX32 && personality == PER_LINUX) @@ -2949,8 +2958,6 @@ return err; } -extern long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice); - long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, __u32 len_low, __u32 len_high, int advice) { @@ -3049,9 +3056,6 @@ return 0; } -extern asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, - unsigned long new_flags, void *data); - #define SMBFS_NAME "smbfs" #define NCPFS_NAME "ncpfs" @@ -3116,8 +3120,6 @@ } } -extern asmlinkage long sys_setreuid(uid_t ruid, uid_t euid); - asmlinkage long sys32_setreuid(compat_uid_t ruid, compat_uid_t euid) { uid_t sruid, seuid; @@ -3127,8 +3129,6 @@ return sys_setreuid(sruid, seuid); } -extern asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); - asmlinkage long sys32_setresuid(compat_uid_t ruid, compat_uid_t euid, compat_uid_t suid) @@ -3141,8 +3141,6 @@ return sys_setresuid(sruid, seuid, ssuid); } -extern asmlinkage long sys_setregid(gid_t rgid, gid_t egid); - asmlinkage long sys32_setregid(compat_gid_t rgid, compat_gid_t egid) { @@ -3153,8 +3151,6 @@ return sys_setregid(srgid, segid); } -extern asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); - asmlinkage long sys32_setresgid(compat_gid_t rgid, compat_gid_t egid, compat_gid_t sgid) @@ -3284,8 +3280,6 @@ return err; } -extern asmlinkage long sys_nfsservctl(int cmd, void *arg, void *resp); - int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32) { --- diff/arch/ia64/kernel/irq.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/kernel/irq.c 2004-02-18 09:03:57.000000000 +0000 @@ -940,7 +940,7 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, irq_affinity[(long)data]); + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); @@ -1005,7 +1005,7 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, *(cpumask_t *)data); + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/ia64/kernel/sys_ia64.c 2003-09-17 12:28:01.000000000 +0100 +++ source/arch/ia64/kernel/sys_ia64.c 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,7 @@ #include /* doh, must come after sched.h... */ #include #include +#include #include #include @@ -74,7 +75,6 @@ asmlinkage long ia64_getpriority (int which, int who) { - extern long sys_getpriority (int, int); long prio; prio = sys_getpriority(which, who); --- diff/arch/ia64/lib/dec_and_lock.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/ia64/lib/dec_and_lock.c 2004-02-18 09:03:57.000000000 +0000 @@ -13,6 +13,7 @@ #include #include +#ifndef CONFIG_LOCKMETER /* * Decrement REFCOUNT and if the count reaches zero, acquire the spinlock. Both of these * operations have to be done atomically, so that the count doesn't drop to zero without @@ -40,3 +41,4 @@ } EXPORT_SYMBOL(atomic_dec_and_lock); +#endif --- diff/arch/ia64/pci/pci.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/pci/pci.c 2004-02-18 09:03:57.000000000 +0000 @@ -55,8 +55,11 @@ #define PCI_SAL_ADDRESS(seg, bus, devfn, reg) \ ((u64)(seg << 24) | (u64)(bus << 16) | \ - (u64)(devfn << 8) | (u64)(reg)) + (u64)(devfn << 8) | (u64)(reg)), 0 +#define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ + ((u64)(seg << 28) | (u64)(bus << 20) | \ + (u64)(devfn << 12) | (u64)(reg)), 1 static int pci_sal_read (int seg, int bus, int devfn, int reg, int len, u32 *value) @@ -64,10 +67,14 @@ int result = 0; u64 data = 0; - if (!value || (seg > 255) || (bus > 255) || (devfn > 255) || (reg > 255)) + if (!value || (seg > 65535) || (bus > 255) || (devfn > 255) || (reg > 4095)) return -EINVAL; - result = ia64_sal_pci_config_read(PCI_SAL_ADDRESS(seg, bus, devfn, reg), len, &data); + if ((seg < 256) && (reg < 256)) { + result = ia64_sal_pci_config_read(PCI_SAL_ADDRESS(seg, bus, devfn, reg), len, &data); + } else { + result = ia64_sal_pci_config_read(PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg), len, &data); + } *value = (u32) data; @@ -77,13 +84,17 @@ static int pci_sal_write (int seg, int bus, int devfn, int reg, int len, u32 value) { - if ((seg > 255) || (bus > 255) || (devfn > 255) || (reg > 255)) + if ((seg > 65535) || (bus > 255) || (devfn > 255) || (reg > 4095)) return -EINVAL; - return ia64_sal_pci_config_write(PCI_SAL_ADDRESS(seg, bus, devfn, reg), len, value); + if ((seg < 256) && (reg < 256)) { + return ia64_sal_pci_config_write(PCI_SAL_ADDRESS(seg, bus, devfn, reg), len, value); + } else { + return ia64_sal_pci_config_write(PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg), len, value); + } } -struct pci_raw_ops pci_sal_ops = { +static struct pci_raw_ops pci_sal_ops = { .read = pci_sal_read, .write = pci_sal_write }; --- diff/arch/ia64/sn/io/drivers/ioconfig_bus.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/sn/io/drivers/ioconfig_bus.c 2004-02-18 09:03:57.000000000 +0000 @@ -16,6 +16,7 @@ #include +#include #include #include #include --- diff/arch/ia64/sn/io/io.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/io.c 2004-02-18 09:03:57.000000000 +0000 @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/machvec/pci_bus_cvlink.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/machvec/pci_bus_cvlink.c 2004-02-18 09:03:57.000000000 +0000 @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/bte_error.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/bte_error.c 2004-02-18 09:03:57.000000000 +0000 @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/geo_op.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/geo_op.c 2004-02-18 09:03:57.000000000 +0000 @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/klconflib.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/klconflib.c 2004-02-18 09:03:57.000000000 +0000 @@ -474,8 +474,6 @@ return(0); } -#include "asm/sn/sn_private.h" - /* * Format a module id for printing. * --- diff/arch/ia64/sn/io/sn2/ml_SN_init.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/ml_SN_init.c 2004-02-18 09:03:57.000000000 +0000 @@ -11,12 +11,12 @@ #include #include #include -#include #include #include #include #include #include +#include int maxcpus; @@ -69,12 +69,15 @@ } void -init_platform_hubinfo(nodepda_t **nodepdaindr) { +init_platform_hubinfo(nodepda_t **nodepdaindr) +{ cnodeid_t cnode; hubinfo_t hubinfo; nodepda_t *npda; extern int numionodes; + if (IS_RUNNING_ON_SIMULATOR()) + return; for (cnode = 0; cnode < numionodes; cnode++) { npda = nodepdaindr[cnode]; hubinfo = (hubinfo_t)npda->pdinfo; --- diff/arch/ia64/sn/io/sn2/ml_SN_intr.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/ml_SN_intr.c 2004-02-18 09:03:57.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include extern irqpda_t *irqpdaindr; extern cnodeid_t master_node_get(vertex_hdl_t vhdl); @@ -216,7 +217,6 @@ { cpuid_t cpu, best_cpu = CPU_NONE; int slice, min_count = 1000; - irqpda_t *irqs; for (slice = CPUS_PER_NODE - 1; slice >= 0; slice--) { int intrs; @@ -227,8 +227,7 @@ if (!cpu_online(cpu)) continue; - irqs = irqpdaindr; - intrs = irqs->num_irq_used; + intrs = pdacpu(cpu)->sn_num_irqs; if (min_count > intrs) { min_count = intrs; @@ -243,6 +242,7 @@ } } } + pdacpu(best_cpu)->sn_num_irqs++; return best_cpu; } --- diff/arch/ia64/sn/io/sn2/pcibr/pcibr_ate.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/pcibr/pcibr_ate.c 2004-02-18 09:03:57.000000000 +0000 @@ -8,7 +8,6 @@ #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/pcibr/pcibr_config.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/pcibr/pcibr_config.c 2004-02-18 09:03:57.000000000 +0000 @@ -8,7 +8,6 @@ #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/pcibr/pcibr_intr.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/pcibr/pcibr_intr.c 2004-02-18 09:03:57.000000000 +0000 @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/pcibr/pcibr_reg.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/pcibr/pcibr_reg.c 2004-02-18 09:03:57.000000000 +0000 @@ -8,7 +8,6 @@ #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c 2004-02-18 09:03:57.000000000 +0000 @@ -8,7 +8,6 @@ #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/shub.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/shub.c 2004-02-18 09:03:57.000000000 +0000 @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/shub_intr.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/shub_intr.c 2004-02-18 09:03:57.000000000 +0000 @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/sn2/shuberror.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/sn2/shuberror.c 2004-02-18 09:03:57.000000000 +0000 @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/io/xswitch.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/io/xswitch.c 2004-02-18 09:03:57.000000000 +0000 @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include --- diff/arch/ia64/sn/kernel/irq.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/kernel/irq.c 2004-02-18 09:03:57.000000000 +0000 @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -121,7 +120,7 @@ static void sn_set_affinity_irq(unsigned int irq, unsigned long cpu) { -#if CONFIG_SMP +#ifdef CONFIG_SMP int redir = 0; struct sn_intr_list_t *p = sn_intr_list[irq]; pcibr_intr_t intr; --- diff/arch/ia64/sn/kernel/setup.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ia64/sn/kernel/setup.c 2004-02-18 09:03:57.000000000 +0000 @@ -85,6 +85,7 @@ u64 master_node_bedrock_address; static void sn_init_pdas(char **); +static void scan_for_ionodes(void); static nodepda_t *nodepdaindr[MAX_COMPACT_NODES]; @@ -131,7 +132,7 @@ * may not be initialized yet. */ -static int +static int __init pxm_to_nasid(int pxm) { int i; @@ -358,11 +359,10 @@ * * One time setup for Node Data Area. Called by sn_setup(). */ -void +void __init sn_init_pdas(char **cmdline_p) { cnodeid_t cnode; - void scan_for_ionodes(void); /* * Make sure that the PDA fits entirely in the same page as the @@ -498,7 +498,7 @@ * physical_node_map and the pda and increment numionodes. */ -void +static void __init scan_for_ionodes(void) { int nasid = 0; --- diff/arch/m68k/Kconfig 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/m68k/Kconfig 2004-02-18 09:03:57.000000000 +0000 @@ -1030,8 +1030,7 @@ precision in some cases. To compile this driver as a module, choose M here: the - module will be called genrtc. To load the module automatically - add 'alias char-major-10-135 genrtc' to your /etc/modules.conf + module will be called genrtc. config GEN_RTC_X bool "Extended RTC operation" --- diff/arch/m68k/amiga/amiints.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/amiga/amiints.c 2004-02-18 09:03:57.000000000 +0000 @@ -49,6 +49,7 @@ #include #include #include +#include extern int cia_request_irq(struct ciabase *base,int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), --- diff/arch/m68k/bvme6000/bvmeints.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/bvme6000/bvmeints.c 2004-02-18 09:03:57.000000000 +0000 @@ -20,6 +20,7 @@ #include #include #include +#include static irqreturn_t bvme6000_defhand (int irq, void *dev_id, struct pt_regs *fp); --- diff/arch/m68k/hp300/time.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/hp300/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -17,6 +17,7 @@ #include #include #include +#include #include "ints.h" /* Clock hardware definitions */ --- diff/arch/m68k/kernel/signal.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/m68k/kernel/signal.c 2004-02-18 09:03:57.000000000 +0000 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include --- diff/arch/m68k/kernel/sys_m68k.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/kernel/sys_m68k.c 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -156,8 +157,6 @@ } #endif -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - struct sel_arg_struct { unsigned long n; fd_set *inp, *outp, *exp; @@ -262,7 +261,7 @@ return -EINVAL; } -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) +asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on) { return -ENOSYS; } --- diff/arch/m68k/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/m68k/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -174,6 +174,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq(&xtime_lock); + clock_was_set(); return 0; } --- diff/arch/m68k/mac/iop.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/mac/iop.c 2004-02-18 09:03:57.000000000 +0000 @@ -118,6 +118,7 @@ #include #include #include +#include /*#define DEBUG_IOP*/ --- diff/arch/m68k/mac/macints.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/mac/macints.c 2004-02-18 09:03:57.000000000 +0000 @@ -132,8 +132,8 @@ #include #include #include - #include +#include #define DEBUG_SPURIOUS #define SHUTUP_SONIC --- diff/arch/m68k/mac/oss.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/mac/oss.c 2004-02-18 09:03:57.000000000 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include int oss_present; volatile struct mac_oss *oss; --- diff/arch/m68k/mac/psc.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/mac/psc.c 2004-02-18 09:03:57.000000000 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include #define DEBUG_PSC --- diff/arch/m68k/mac/via.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/mac/via.c 2004-02-18 09:03:57.000000000 +0000 @@ -23,7 +23,6 @@ #include #include #include - #include #include @@ -33,6 +32,7 @@ #include #include #include +#include volatile __u8 *via1, *via2; #if 0 --- diff/arch/m68k/q40/q40ints.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/m68k/q40/q40ints.c 2004-02-18 09:03:57.000000000 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include --- diff/arch/m68k/sun3/sun3ints.c 2003-06-09 14:18:17.000000000 +0100 +++ source/arch/m68k/sun3/sun3ints.c 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include extern void sun3_leds (unsigned char); --- diff/arch/m68knommu/kernel/signal.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/m68knommu/kernel/signal.c 2004-02-18 09:03:57.000000000 +0000 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -50,8 +51,6 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) -asmlinkage long sys_wait4(pid_t pid, unsigned int * stat_addr, int options, - struct rusage * ru); asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs); /* --- diff/arch/m68knommu/kernel/sys_m68k.c 2002-11-11 11:09:42.000000000 +0000 +++ source/arch/m68knommu/kernel/sys_m68k.c 2004-02-18 09:03:57.000000000 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -111,8 +112,6 @@ return error; } -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - struct sel_arg_struct { unsigned long n; fd_set *inp, *outp, *exp; @@ -194,7 +193,7 @@ return -EINVAL; } -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) +asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on) { return -ENOSYS; } --- diff/arch/m68knommu/kernel/time.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/m68knommu/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -199,6 +199,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq(&xtime_lock); + clock_was_set(); return 0; } --- diff/arch/mips/kernel/ioctl32.c 2003-09-17 12:28:02.000000000 +0100 +++ source/arch/mips/kernel/ioctl32.c 2004-02-18 09:03:57.000000000 +0000 @@ -60,6 +60,7 @@ #include #include #include +#include #include #include @@ -94,8 +95,6 @@ #include #endif -long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); - static int w_long(unsigned int fd, unsigned int cmd, unsigned long arg) { mm_segment_t old_fs = get_fs(); --- diff/arch/mips/kernel/irixioctl.c 2003-07-08 09:55:17.000000000 +0100 +++ source/arch/mips/kernel/irixioctl.c 2004-02-18 09:03:57.000000000 +0000 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -26,9 +27,6 @@ cc_t c_cc[NCCS]; }; -extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, - unsigned long arg); -extern asmlinkage int sys_write(unsigned int fd,char * buf,unsigned int count); extern void start_tty(struct tty_struct *tty); static struct tty_struct *get_tty(int fd) { --- diff/arch/mips/kernel/irq.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/mips/kernel/irq.c 2004-02-18 09:03:57.000000000 +0000 @@ -835,7 +835,7 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, irq_affinity[(long)data]); + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); @@ -873,7 +873,7 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, *(cpumask_t *)data); + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/mips/kernel/linux32.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/mips/kernel/linux32.c 2004-02-18 09:03:57.000000000 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -123,8 +124,6 @@ } -asmlinkage long sys_truncate(const char * path, unsigned long length); - asmlinkage int sys_truncate64(const char *path, unsigned int high, unsigned int low) { @@ -133,8 +132,6 @@ return sys_truncate(path, ((long) high << 32) | low); } -asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); - asmlinkage int sys_ftruncate64(unsigned int fd, unsigned int high, unsigned int low) { @@ -375,8 +372,6 @@ return; } -asmlinkage long sys_getdents(unsigned int fd, void * dirent, unsigned int count); - asmlinkage long sys32_getdents(unsigned int fd, void * dirent32, unsigned int count) { @@ -497,8 +492,6 @@ char _f[8]; }; -extern asmlinkage int sys_sysinfo(struct sysinfo *info); - asmlinkage int sys32_sysinfo(struct sysinfo32 *info) { struct sysinfo s; @@ -633,10 +626,6 @@ return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); } -extern asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, - unsigned long offset_low, loff_t * result, - unsigned int origin); - asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, unsigned int offset_low, loff_t * result, unsigned int origin) @@ -1018,10 +1007,6 @@ } - -extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, - struct timespec *interval); - asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval) { @@ -1668,9 +1653,6 @@ #endif /* CONFIG_SYSCTL */ -extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len, - unsigned long *user_mask_ptr); - asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len, u32 *user_mask_ptr) { @@ -1692,9 +1674,6 @@ return ret; } -extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len, - unsigned long *user_mask_ptr); - asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len, u32 *user_mask_ptr) { @@ -1734,8 +1713,6 @@ return ret; } -extern asmlinkage long sys_personality(unsigned long); - asmlinkage int sys32_personality(unsigned long personality) { int ret; @@ -1820,8 +1797,6 @@ return ret; } -extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count); - asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) { @@ -1842,8 +1817,6 @@ return ret; } -asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); - asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3, size_t count) { --- diff/arch/mips/kernel/signal32.c 2003-08-20 14:16:36.000000000 +0100 +++ source/arch/mips/kernel/signal32.c 2004-02-18 09:03:57.000000000 +0000 @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -761,9 +762,6 @@ return ret; } -asmlinkage long sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, - size_t sigsetsize); - asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, unsigned int sigsetsize) { @@ -785,8 +783,6 @@ return ret; } -asmlinkage long sys_rt_sigpending(sigset_t *set, size_t sigsetsize); - asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, unsigned int sigsetsize) { @@ -895,8 +891,6 @@ return ret; } -extern asmlinkage int sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo); - asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo) { siginfo_t info; --- diff/arch/mips/kernel/syscall.c 2003-08-20 14:16:25.000000000 +0100 +++ source/arch/mips/kernel/syscall.c 2004-02-18 09:03:57.000000000 +0000 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include --- diff/arch/mips/kernel/sysirix.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/mips/kernel/sysirix.c 2004-02-18 09:03:57.000000000 +0000 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -235,13 +236,6 @@ #undef DEBUG_PROCGRPS extern unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt); -extern asmlinkage int sys_setpgid(pid_t pid, pid_t pgid); -extern void sys_sync(void); -extern asmlinkage int sys_getsid(pid_t pid); -extern asmlinkage long sys_write (unsigned int fd, const char *buf, unsigned long count); -extern asmlinkage long sys_lseek (unsigned int fd, off_t offset, unsigned int origin); -extern asmlinkage int sys_getgroups(int gidsetsize, gid_t *grouplist); -extern asmlinkage int sys_setgroups(int gidsetsize, gid_t *grouplist); extern int getrusage(struct task_struct *p, int who, struct rusage *ru); extern char *prom_getenv(char *name); extern long prom_setenv(char *name, char *value); @@ -368,7 +362,7 @@ retval = HZ; goto out; case 4: - retval = NGROUPS; + retval = NGROUPS_MAX; goto out; case 5: retval = NR_OPEN; @@ -694,9 +688,6 @@ return -EINTR; } -extern asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, - unsigned long new_flags, void * data); - /* XXX need more than this... */ asmlinkage int irix_mount(char *dev_name, char *dir_name, unsigned long flags, char *type, void *data, int datalen) @@ -792,9 +783,6 @@ return error; } -extern asmlinkage int sys_setpgid(pid_t pid, pid_t pgid); -extern asmlinkage int sys_setsid(void); - asmlinkage int irix_setpgrp(int flags) { int error; @@ -883,8 +871,6 @@ return -EINVAL; } -extern asmlinkage int sys_socket(int family, int type, int protocol); - asmlinkage int irix_socket(int family, int type, int protocol) { switch(type) { @@ -1356,8 +1342,6 @@ return error; } -extern asmlinkage int sys_mknod(const char * filename, int mode, unsigned dev); - asmlinkage int irix_xmknod(int ver, char *filename, int mode, unsigned dev) { int retval; @@ -1501,9 +1485,6 @@ return -EINVAL; } -extern asmlinkage int sys_truncate(const char * path, unsigned long length); -extern asmlinkage int sys_ftruncate(unsigned int fd, unsigned long length); - asmlinkage int irix_truncate64(char *name, int pad, int size1, int size2) { int retval; @@ -1532,10 +1513,6 @@ return retval; } -extern asmlinkage unsigned long -sys_mmap(unsigned long addr, size_t len, int prot, int flags, int fd, - off_t offset); - asmlinkage int irix_mmap64(struct pt_regs *regs) { int len, prot, flags, fd, off1, off2, error, base = 0; @@ -2106,9 +2083,6 @@ #undef DEBUG_FCNTL -extern asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, - unsigned long arg); - #define IRIX_F_ALLOCSP 10 asmlinkage int irix_fcntl(int fd, int cmd, int arg) --- diff/arch/mips/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/mips/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -132,7 +132,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq(&xtime_lock); - + clock_was_set(); return 0; } --- diff/arch/parisc/hpux/ioctl.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/parisc/hpux/ioctl.c 2004-02-18 09:03:57.000000000 +0000 @@ -35,13 +35,12 @@ #include #include +#include #include #include #include #include -int sys_ioctl(unsigned int, unsigned int, unsigned long); - static int hpux_ioctl_t(int fd, unsigned long cmd, unsigned long arg) { int result = -EOPNOTSUPP; --- diff/arch/parisc/hpux/sys_hpux.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/parisc/hpux/sys_hpux.c 2004-02-18 09:03:57.000000000 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -34,8 +35,6 @@ #include #include -unsigned long sys_brk(unsigned long addr); - unsigned long hpux_brk(unsigned long addr) { /* Sigh. Looks like HP/UX libc relies on kernel bugs. */ @@ -61,7 +60,6 @@ int hpux_wait(int *stat_loc) { - extern int sys_waitpid(int, int *, int); return sys_waitpid(-1, stat_loc, 0); } @@ -213,7 +211,6 @@ kfree(kpath); /* just fake it, beginning of structures match */ - extern int sys_statfs(const char *, struct statfs *); error = sys_statfs(path, (struct statfs *) buf); /* ignoring rest of statfs struct, but it should be zeros. Need to do @@ -269,9 +266,6 @@ return error; } -int sys_sethostname(char *, int); -int sys_gethostname(char *, int); - /* Note: HP-UX just uses the old suser() function to check perms * in this system call. We'll use capable(CAP_SYS_ADMIN). */ --- diff/arch/parisc/kernel/ioctl32.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/parisc/kernel/ioctl32.c 2004-02-18 09:03:57.000000000 +0000 @@ -8,6 +8,8 @@ * ioctls. */ +#include + #define INCLUDES #include "compat_ioctl.c" --- diff/arch/parisc/kernel/parisc_ksyms.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/parisc/kernel/parisc_ksyms.c 2004-02-18 09:03:57.000000000 +0000 @@ -27,6 +27,7 @@ #include #include #include +#include #include EXPORT_SYMBOL(memchr); @@ -83,10 +84,6 @@ EXPORT_SYMBOL(__memset_io); #include -extern long sys_open(const char *, int, int); -extern off_t sys_lseek(int, off_t, int); -extern int sys_read(int, char *, int); -extern int sys_write(int, const char *, int); EXPORT_SYMBOL(sys_open); EXPORT_SYMBOL(sys_lseek); EXPORT_SYMBOL(sys_read); --- diff/arch/parisc/kernel/signal32.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/parisc/kernel/signal32.c 2004-02-18 09:03:57.000000000 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -92,9 +93,6 @@ int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, unsigned int sigsetsize) { - extern long sys_rt_sigprocmask(int how, - sigset_t *set, sigset_t *oset, - size_t sigsetsize); sigset_t old_set, new_set; int ret; @@ -115,7 +113,6 @@ { int ret; sigset_t set; - extern long sys_rt_sigpending(sigset_t *set, size_t sigsetsize); KERNEL_SYSCALL(ret, sys_rt_sigpending, &set, sigsetsize); --- diff/arch/parisc/kernel/sys_parisc.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/parisc/kernel/sys_parisc.c 2004-02-18 09:03:57.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include int sys_pipe(int *fildes) { @@ -182,10 +183,6 @@ /* Fucking broken ABI */ #ifdef CONFIG_PARISC64 -extern asmlinkage long sys_truncate(const char *, unsigned long); -extern asmlinkage long sys_ftruncate(unsigned int, unsigned long); -extern asmlinkage long sys_fcntl(unsigned int, unsigned int, unsigned long); - asmlinkage long parisc_truncate64(const char * path, unsigned int high, unsigned int low) { @@ -214,9 +211,6 @@ } #else -extern asmlinkage long sys_truncate64(const char *, loff_t); -extern asmlinkage long sys_ftruncate64(unsigned int, loff_t); - asmlinkage long parisc_truncate64(const char * path, unsigned int high, unsigned int low) { @@ -230,12 +224,6 @@ } #endif -extern asmlinkage ssize_t sys_pread64(unsigned int fd, char *buf, - size_t count, loff_t pos); -extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char *buf, - size_t count, loff_t pos); -extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); - asmlinkage ssize_t parisc_pread64(unsigned int fd, char *buf, size_t count, unsigned int high, unsigned int low) { @@ -257,7 +245,7 @@ /* * This changes the io permissions bitmap in the current task. */ -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on) +asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) { return -ENOSYS; } --- diff/arch/parisc/kernel/sys_parisc32.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/parisc/kernel/sys_parisc32.c 2004-02-18 09:03:57.000000000 +0000 @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -357,7 +358,6 @@ { struct timespec t; int ret; - extern asmlinkage long sys_sched_rr_get_interval(pid_t pid, struct timespec *interval); KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, &t); if (put_compat_timespec(&t, interval)) @@ -1089,7 +1089,6 @@ } -extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count); asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) { mm_segment_t old_fs = get_fs(); @@ -1197,7 +1196,6 @@ return ret; } -extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count); typedef long __kernel_loff_t32; /* move this to asm/posix_types.h? */ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, __kernel_loff_t32 *offset, s32 count) @@ -1345,8 +1343,6 @@ * half of the argument has been zeroed by syscall.S. */ -extern asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin); - asmlinkage int sys32_lseek(unsigned int fd, int offset, unsigned int origin) { return sys_lseek(fd, offset, origin); @@ -1367,8 +1363,6 @@ return sys_semctl (semid, semnum, cmd, arg); } -extern long sys_lookup_dcookie(u64 cookie64, char *buf, size_t len); - long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len) { --- diff/arch/parisc/kernel/time.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/parisc/kernel/time.c 2004-02-18 09:03:57.000000000 +0000 @@ -230,6 +230,7 @@ time_esterror = NTP_PHASE_LIMIT; } write_sequnlock_irq(&xtime_lock); + clock_was_set(); return 0; } EXPORT_SYMBOL(do_settimeofday); --- diff/arch/ppc/8260_io/enet.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/ppc/8260_io/enet.c 2004-02-18 09:03:58.000000000 +0000 @@ -851,7 +851,7 @@ err = register_netdev(dev); if (err) { - kfree(dev); + free_netdev(dev); return err; } --- diff/arch/ppc/8260_io/fcc_enet.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/ppc/8260_io/fcc_enet.c 2004-02-18 09:03:58.000000000 +0000 @@ -1371,7 +1371,7 @@ err = register_netdev(dev); if (err) { - kfree(dev); + free_netdev(dev); return err; } --- diff/arch/ppc/8xx_io/enet.c 2003-09-30 15:46:11.000000000 +0100 +++ source/arch/ppc/8xx_io/enet.c 2004-02-18 09:03:58.000000000 +0000 @@ -949,7 +949,7 @@ err = register_netdev(dev); if (err) { - kfree(dev); + free_netdev(dev); return err; } --- diff/arch/ppc/8xx_io/fec.c 2003-06-30 10:07:19.000000000 +0100 +++ source/arch/ppc/8xx_io/fec.c 2004-02-18 09:03:58.000000000 +0000 @@ -1748,7 +1748,7 @@ err = register_netdev(dev); if (err) { - kfree(dev); + free_netdev(dev); return err; } --- diff/arch/ppc/boot/ld.script 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/ppc/boot/ld.script 2004-02-18 09:03:58.000000000 +0000 @@ -82,6 +82,7 @@ *(__ksymtab) *(__ksymtab_strings) *(__bug_table) + *(__kcrctab) } } --- diff/arch/ppc/kernel/irq.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/ppc/kernel/irq.c 2004-02-18 09:03:58.000000000 +0000 @@ -575,7 +575,7 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, irq_affinity[(long)data]); + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); @@ -616,7 +616,7 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, *(cpumask_t *)data); + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/ppc/kernel/setup.c 2004-02-18 08:54:07.000000000 +0000 +++ source/arch/ppc/kernel/setup.c 2004-02-18 09:03:58.000000000 +0000 @@ -53,7 +53,7 @@ extern void power4_idle(void); extern boot_infos_t *boot_infos; -char saved_command_line[256]; +char saved_command_line[COMMAND_LINE_SIZE]; unsigned char aux_device_present; struct ide_machdep_calls ppc_ide_md; char *sysmap; @@ -501,7 +501,7 @@ ulong *data = rec->data; switch (rec->tag) { case BI_CMD_LINE: - memcpy(cmd_line, (void *)data, rec->size); + strlcpy(cmd_line, (void *)data, sizeof(cmd_line)); break; case BI_SYSMAP: sysmap = (char *)((data[0] >= (KERNELBASE)) ? data[0] : @@ -538,7 +538,7 @@ unsigned long r6, unsigned long r7) { #ifdef CONFIG_CMDLINE - strcpy(cmd_line, CONFIG_CMDLINE); + strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); #endif /* CONFIG_CMDLINE */ #ifdef CONFIG_6xx @@ -676,7 +676,7 @@ init_mm.brk = (unsigned long) klimit; /* Save unparsed command line copy for /proc/cmdline */ - strcpy(saved_command_line, cmd_line); + strlcpy(saved_command_line, cmd_line, sizeof(saved_command_line)); *cmdline_p = cmd_line; /* set up the bootmem stuff with available memory */ --- diff/arch/ppc/kernel/syscalls.c 2004-02-09 10:36:07.000000000 +0000 +++ source/arch/ppc/kernel/syscalls.c 2004-02-18 09:03:58.000000000 +0000 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -200,8 +201,6 @@ return err; } -extern int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - /* * Due to some executables calling the wrong select we sometimes * get wrong args. This determines how the args are being passed --- diff/arch/ppc/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/ppc/kernel/time.c 2004-02-18 09:03:58.000000000 +0000 @@ -294,6 +294,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irqrestore(&xtime_lock, flags); + clock_was_set(); return 0; } --- diff/arch/ppc64/kernel/iSeries_irq.c 2004-02-09 10:36:08.000000000 +0000 +++ source/arch/ppc64/kernel/iSeries_irq.c 2004-02-18 09:03:57.000000000 +0000 @@ -57,6 +57,7 @@ void iSeries_init_irq_desc(irq_desc_t *desc) { + desc->handler = &iSeries_IRQ_handler; } /* This is called by init_IRQ. set in ppc_md.init_IRQ by iSeries_setup.c */ @@ -87,22 +88,6 @@ #define IRQ_TO_IDSEL(irq) (((((irq) - 1) >> 3) & 7) + 1) #define IRQ_TO_FUNC(irq) (((irq) - 1) & 7) -/* - * This is called out of iSeries_scan_slot to assign the EADS slot - * to its IRQ number - */ -int __init iSeries_assign_IRQ(int irq, HvBusNumber busNumber, - HvSubBusNumber subBusNumber, HvAgentId deviceId) -{ - irq_desc_t *desc = get_real_irq_desc(irq); - - if (desc == NULL) - return -1; - desc->handler = &iSeries_IRQ_handler; - return 0; -} - - /* This is called by iSeries_activate_IRQs */ static unsigned int iSeries_startup_IRQ(unsigned int irq) { @@ -125,6 +110,11 @@ } /* + * Temporary hack + */ +#define get_irq_desc(irq) &irq_desc[(irq)] + +/* * This is called out of iSeries_fixup to activate interrupt * generation for usable slots */ --- diff/arch/ppc64/kernel/iSeries_pci.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/iSeries_pci.c 2004-02-18 09:03:57.000000000 +0000 @@ -406,7 +406,6 @@ /* iSeries_allocate_IRQ.: 0x18.00.12(0xA3) */ Irq = iSeries_allocate_IRQ(Bus, 0, EADsIdSel); - iSeries_assign_IRQ(Irq, Bus, 0, EADsIdSel); PPCDBG(PPCDBG_BUSWALK, "PCI:- allocate and assign IRQ 0x%02X.%02X.%02X = 0x%02X\n", Bus, 0, EADsIdSel, Irq); --- diff/arch/ppc64/kernel/iSeries_setup.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/iSeries_setup.c 2004-02-18 09:03:57.000000000 +0000 @@ -315,7 +315,6 @@ ppc_md.setup_residual = iSeries_setup_residual; ppc_md.get_cpuinfo = iSeries_get_cpuinfo; ppc_md.init_IRQ = iSeries_init_IRQ; - ppc_md.init_irq_desc = iSeries_init_irq_desc; ppc_md.get_irq = iSeries_get_irq; ppc_md.init = NULL; --- diff/arch/ppc64/kernel/ioctl32.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/ppc64/kernel/ioctl32.c 2004-02-18 09:03:57.000000000 +0000 @@ -23,6 +23,7 @@ #define INCLUDES #include "compat_ioctl.c" #include +#include #include #define CODE --- diff/arch/ppc64/kernel/irq.c 2004-02-09 10:36:08.000000000 +0000 +++ source/arch/ppc64/kernel/irq.c 2004-02-18 09:03:57.000000000 +0000 @@ -664,7 +664,7 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, irq_affinity[(long)data]); + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); @@ -702,7 +702,7 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, *(cpumask_t *)data); + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/ppc64/kernel/lparcfg.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/lparcfg.c 2004-02-18 09:03:57.000000000 +0000 @@ -134,7 +134,7 @@ memset(buf, 0, size); shared = (int)(lpaca->xLpPacaPtr->xSharedProc); - n += snprintf(buf, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf, LPARCFG_BUFF_SIZE - n, "serial_number=%c%c%c%c%c%c%c\n", e2a(xItExtVpdPanel.mfgID[2]), e2a(xItExtVpdPanel.mfgID[3]), @@ -144,7 +144,7 @@ e2a(xItExtVpdPanel.systemSerial[4]), e2a(xItExtVpdPanel.systemSerial[5])); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "system_type=%c%c%c%c\n", e2a(xItExtVpdPanel.machineType[0]), e2a(xItExtVpdPanel.machineType[1]), @@ -152,23 +152,23 @@ e2a(xItExtVpdPanel.machineType[3])); lp_index = HvLpConfig_getLpIndex(); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_id=%d\n", (int)lp_index); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "system_active_processors=%d\n", (int)HvLpConfig_getSystemPhysicalProcessors()); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "system_potential_processors=%d\n", (int)HvLpConfig_getSystemPhysicalProcessors()); processors = (int)HvLpConfig_getPhysicalProcessors(); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_active_processors=%d\n", processors); max_processors = (int)HvLpConfig_getMaxPhysicalProcessors(); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_potential_processors=%d\n", max_processors); if(shared) { @@ -178,22 +178,22 @@ entitled_capacity = processors * 100; max_entitled_capacity = max_processors * 100; } - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_entitled_capacity=%d\n", entitled_capacity); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_max_entitled_capacity=%d\n", max_entitled_capacity); if(shared) { pool_id = HvLpConfig_getSharedPoolIndex(); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, "pool=%d\n", + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "pool=%d\n", (int)pool_id); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "pool_capacity=%d\n", (int)(HvLpConfig_getNumProcsInSharedPool(pool_id)*100)); } - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "shared_processor_mode=%d\n", shared); return 0; @@ -297,13 +297,13 @@ if(lp_index_ptr) lp_index = *lp_index_ptr; } - n = snprintf(buf, LPARCFG_BUFF_SIZE - n, + n = scnprintf(buf, LPARCFG_BUFF_SIZE - n, "serial_number=%s\n", system_id); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "system_type=%s\n", model); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_id=%d\n", (int)lp_index); rtas_node = find_path_device("/rtas"); @@ -317,74 +317,74 @@ if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { h_get_ppp(&h_entitled,&h_unallocated,&h_aggregation,&h_resource); #ifdef DEBUG - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "R4=0x%lx\n", h_entitled); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "R5=0x%lx\n", h_unallocated); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "R6=0x%lx\n", h_aggregation); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "R7=0x%lx\n", h_resource); #endif /* DEBUG */ } if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { system_potential_processors = get_splpar_potential_characteristics(); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "system_active_processors=%ld\n", (h_resource >> 2*8) & 0xffff); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "system_potential_processors=%d\n", system_potential_processors); } else { system_potential_processors = system_active_processors; - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "system_active_processors=%d\n", system_active_processors); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "system_potential_processors=%d\n", system_potential_processors); } processors = systemcfg->processorCount; - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_active_processors=%d\n", processors); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_potential_processors=%d\n", system_active_processors); /* max_entitled_capacity will come out of get_splpar_potential_characteristics() when that function is complete */ max_entitled_capacity = system_active_processors * 100; if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_entitled_capacity=%ld\n", h_entitled); } else { - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_entitled_capacity=%d\n", system_active_processors*100); } - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "partition_max_entitled_capacity=%d\n", max_entitled_capacity); shared = 0; - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "shared_processor_mode=%d\n", shared); if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "pool=%ld\n", (h_aggregation >> 0*8)&0xffff); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "pool_capacity=%ld\n", (h_resource >> 3*8) &0xffff); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "group=%ld\n", (h_aggregation >> 2*8)&0xffff); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "capped=%ld\n", (h_resource >> 6*8)&0x40); - n += snprintf(buf+n, LPARCFG_BUFF_SIZE - n, + n += scnprintf(buf+n, LPARCFG_BUFF_SIZE - n, "capacity_weight=%d\n", (int)(h_resource>>5*8)&0xFF); } return 0; --- diff/arch/ppc64/kernel/ppc_ksyms.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/ppc_ksyms.c 2004-02-18 09:03:57.000000000 +0000 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -48,7 +49,6 @@ #include #endif -extern int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); extern int do_signal(sigset_t *, struct pt_regs *); int abs(int); --- diff/arch/ppc64/kernel/prom.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/prom.c 2004-02-18 09:03:57.000000000 +0000 @@ -186,12 +186,13 @@ extern char cmd_line[512]; /* XXX */ unsigned long dev_tree_size; +unsigned long _get_PIR(void); #ifdef CONFIG_HMT struct { unsigned int pir; unsigned int threadid; -} hmt_thread_data[NR_CPUS] = {0}; +} hmt_thread_data[NR_CPUS]; #endif /* CONFIG_HMT */ char testString[] = "LINUX\n"; --- diff/arch/ppc64/kernel/rtas-proc.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/rtas-proc.c 2004-02-18 09:03:57.000000000 +0000 @@ -287,9 +287,9 @@ char stkbuf[40]; /* its small, its on stack */ int n, sn; if (power_on_time == 0) - n = snprintf(stkbuf, 40, "Power on time not set\n"); + n = scnprintf(stkbuf,sizeof(stkbuf),"Power on time not set\n"); else - n = snprintf(stkbuf, 40, "%lu\n", power_on_time); + n = scnprintf(stkbuf,sizeof(stkbuf),"%lu\n",power_on_time); sn = strlen (stkbuf) +1; if (*ppos >= sn) @@ -410,9 +410,10 @@ if (error != 0){ printk(KERN_WARNING "error: reading the clock returned: %s\n", ppc_rtas_process_error(error)); - n = snprintf (stkbuf, 40, "0"); + n = scnprintf (stkbuf, sizeof(stkbuf), "0"); } else { - n = snprintf (stkbuf, 40, "%lu\n", mktime(year, mon, day, hour, min, sec)); + n = scnprintf (stkbuf, sizeof(stkbuf), "%lu\n", + mktime(year, mon, day, hour, min, sec)); } kfree(ret); @@ -819,7 +820,7 @@ n += check_location_string(ret, buffer + n); n += sprintf ( buffer+n, " "); /* see how many characters we have printed */ - snprintf ( t, 50, "%s ", ret); + scnprintf(t, sizeof(t), "%s ", ret); pos += strlen(t); if (pos >= llen) pos=0; @@ -863,7 +864,7 @@ int n, sn; char stkbuf[40]; /* its small, its on stack */ - n = snprintf(stkbuf, 40, "%lu\n", rtas_tone_frequency); + n = scnprintf(stkbuf, 40, "%lu\n", rtas_tone_frequency); sn = strlen (stkbuf) +1; if (*ppos >= sn) @@ -917,7 +918,7 @@ int n, sn; char stkbuf[40]; /* its small, its on stack */ - n = snprintf(stkbuf, 40, "%lu\n", rtas_tone_volume); + n = scnprintf(stkbuf, 40, "%lu\n", rtas_tone_volume); sn = strlen (stkbuf) +1; if (*ppos >= sn) --- diff/arch/ppc64/kernel/rtasd.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/rtasd.c 2004-02-18 09:03:57.000000000 +0000 @@ -336,8 +336,6 @@ return 0; } -extern long sys_sched_get_priority_max(int policy); - static int rtasd(void *unused) { unsigned int err_type; --- diff/arch/ppc64/kernel/setup.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/setup.c 2004-02-18 09:03:57.000000000 +0000 @@ -80,7 +80,7 @@ int powersave_nap; -char saved_command_line[256]; +char saved_command_line[COMMAND_LINE_SIZE]; unsigned char aux_device_present; void parse_cmd_line(unsigned long r3, unsigned long r4, unsigned long r5, @@ -536,7 +536,7 @@ for ( ; rec->tag != BI_LAST ; rec = bi_rec_next(rec) ) { switch (rec->tag) { case BI_CMD_LINE: - memcpy(cmd_line, (void *)rec->data, rec->size); + strlcpy(cmd_line, (void *)rec->data, sizeof(cmd_line)); break; case BI_SYSMAP: sysmap = __va(rec->data[0]); @@ -620,7 +620,7 @@ init_mm.brk = klimit; /* Save unparsed command line copy for /proc/cmdline */ - strcpy(saved_command_line, cmd_line); + strlcpy(saved_command_line, cmd_line, sizeof(saved_command_line)); *cmdline_p = cmd_line; /* set up the bootmem stuff with available memory */ --- diff/arch/ppc64/kernel/signal32.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/ppc64/kernel/signal32.c 2004-02-18 09:03:58.000000000 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include --- diff/arch/ppc64/kernel/sys_ppc32.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/sys_ppc32.c 2004-02-18 09:03:58.000000000 +0000 @@ -54,6 +54,8 @@ #include #include #include +#include +#include #include #include #include @@ -65,6 +67,7 @@ #include #include #include +#include #include @@ -778,8 +781,6 @@ return err; } -extern asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2); - /* Note: it is necessary to treat option as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -1155,8 +1156,6 @@ char _f[20-2*sizeof(int)-sizeof(int)]; }; -extern asmlinkage long sys_sysinfo(struct sysinfo *info); - asmlinkage long sys32_sysinfo(struct sysinfo32 *info) { struct sysinfo s; @@ -1868,8 +1867,6 @@ return err; } -extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t* offset, size_t count); - /* Note: it is necessary to treat out_fd and in_fd as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -1894,8 +1891,6 @@ return ret; } -extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count); - asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count) { mm_segment_t old_fs = get_fs(); @@ -2158,9 +2153,6 @@ #endif /* CONFIG_ALTIVEC */ } -extern asmlinkage int sys_prctl(int option, unsigned long arg2, unsigned long arg3, - unsigned long arg4, unsigned long arg5); - /* Note: it is necessary to treat option as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2175,14 +2167,12 @@ (unsigned long) arg5); } -extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval); - /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ -asmlinkage int sys32_sched_rr_get_interval(u32 pid, struct compat_timespec *interval) +asmlinkage long sys32_sched_rr_get_interval(u32 pid, struct compat_timespec *interval) { struct timespec t; int ret; @@ -2196,9 +2186,6 @@ return ret; } -extern asmlinkage int sys_pciconfig_read(unsigned long bus, unsigned long dfn, unsigned long off, - unsigned long len, unsigned char *buf); - asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) { return sys_pciconfig_read((unsigned long) bus, @@ -2208,12 +2195,6 @@ (unsigned char *)AA(ubuf)); } - - - -extern asmlinkage int sys_pciconfig_write(unsigned long bus, unsigned long dfn, unsigned long off, - unsigned long len, unsigned char *buf); - asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) { return sys_pciconfig_write((unsigned long) bus, @@ -2281,8 +2262,6 @@ } -extern asmlinkage int sys_newuname(struct new_utsname * name); - asmlinkage int ppc64_newuname(struct new_utsname * name) { int errno = sys_newuname(name); @@ -2295,8 +2274,6 @@ return errno; } -extern asmlinkage long sys_personality(unsigned long); - asmlinkage int ppc64_personality(unsigned long personality) { int ret; @@ -2310,8 +2287,6 @@ -extern asmlinkage long sys_access(const char * filename, int mode); - /* Note: it is necessary to treat mode as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2323,8 +2298,6 @@ } -extern asmlinkage long sys_creat(const char * pathname, int mode); - /* Note: it is necessary to treat mode as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2336,8 +2309,6 @@ } -extern asmlinkage long sys_waitpid(pid_t pid, unsigned int * stat_addr, int options); - /* Note: it is necessary to treat pid and options as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2349,8 +2320,6 @@ } -extern asmlinkage long sys_getgroups(int gidsetsize, gid_t *grouplist); - /* Note: it is necessary to treat gidsetsize as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2362,8 +2331,6 @@ } -extern asmlinkage long sys_getpgid(pid_t pid); - /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2375,8 +2342,6 @@ } -extern asmlinkage long sys_getpriority(int which, int who); - /* Note: it is necessary to treat which and who as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2388,8 +2353,6 @@ } -extern asmlinkage long sys_getsid(pid_t pid); - /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2400,7 +2363,6 @@ return sys_getsid((int)pid); } -extern asmlinkage long sys_kill(int pid, int sig); /* Note: it is necessary to treat pid and sig as unsigned ints, * with the corresponding cast to a signed int to insure that the @@ -2413,8 +2375,6 @@ } -extern asmlinkage long sys_mkdir(const char * pathname, int mode); - /* Note: it is necessary to treat mode as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2425,16 +2385,12 @@ return sys_mkdir(pathname, (int)mode); } -extern asmlinkage long sys_nice(int increment); - long sys32_nice(u32 increment) { /* sign extend increment */ return sys_nice((int)increment); } -extern off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin); - off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin) { /* sign extend n */ @@ -2472,8 +2428,6 @@ goto out; } -extern asmlinkage long sys_readlink(const char * path, char * buf, int bufsiz); - /* Note: it is necessary to treat bufsiz as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2484,8 +2438,6 @@ return sys_readlink(path, buf, (int)bufsiz); } -extern asmlinkage long sys_sched_get_priority_max(int policy); - /* Note: it is necessary to treat option as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2497,8 +2449,6 @@ } -extern asmlinkage long sys_sched_get_priority_min(int policy); - /* Note: it is necessary to treat policy as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2510,8 +2460,6 @@ } -extern asmlinkage long sys_sched_getparam(pid_t pid, struct sched_param *param); - /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2523,8 +2471,6 @@ } -extern asmlinkage long sys_sched_getscheduler(pid_t pid); - /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2536,8 +2482,6 @@ } -extern asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param *param); - /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2549,8 +2493,6 @@ } -extern asmlinkage long sys_sched_setscheduler(pid_t pid, int policy, struct sched_param *param); - /* Note: it is necessary to treat pid and policy as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2562,8 +2504,6 @@ } -extern asmlinkage long sys_setdomainname(char *name, int len); - /* Note: it is necessary to treat len as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2575,8 +2515,6 @@ } -extern asmlinkage long sys_setgroups(int gidsetsize, gid_t *grouplist); - /* Note: it is necessary to treat gidsetsize as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2588,8 +2526,6 @@ } -extern asmlinkage long sys_sethostname(char *name, int len); - asmlinkage long sys32_sethostname(char *name, u32 len) { /* sign extend len */ @@ -2597,8 +2533,6 @@ } -extern asmlinkage long sys_setpgid(pid_t pid, pid_t pgid); - /* Note: it is necessary to treat pid and pgid as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2610,16 +2544,12 @@ } -extern asmlinkage long sys_setpriority(int which, int who, int niceval); - long sys32_setpriority(u32 which, u32 who, u32 niceval) { /* sign extend which, who and niceval */ return sys_setpriority((int)which, (int)who, (int)niceval); } -extern asmlinkage long sys_ssetmask(int newmask); - /* Note: it is necessary to treat newmask as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2630,8 +2560,6 @@ return sys_ssetmask((int) newmask); } -extern asmlinkage long sys_syslog(int type, char * buf, int len); - long sys32_syslog(u32 type, char * buf, u32 len) { /* sign extend len */ @@ -2639,8 +2567,6 @@ } -extern asmlinkage long sys_umask(int mask); - /* Note: it is necessary to treat mask as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2652,8 +2578,6 @@ } -extern asmlinkage long sys_umount(char * name, int flags); - /* Note: it is necessary to treat flags as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) @@ -2756,10 +2680,6 @@ return error; } -extern unsigned long sys_mmap(unsigned long addr, size_t len, - unsigned long prot, unsigned long flags, - unsigned long fd, off_t offset); - unsigned long sys32_mmap2(unsigned long addr, size_t len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) @@ -2801,8 +2721,6 @@ return ret; } -extern long sys_tgkill(int tgid, int pid, int sig); - long sys32_tgkill(u32 tgid, u32 pid, int sig) { /* sign extend tgid, pid */ @@ -2813,11 +2731,6 @@ * long long munging: * The 32 bit ABI passes long longs in an odd even register pair. */ -extern ssize_t sys_pread64(unsigned int fd, char *buf, size_t count, - loff_t pos); - -extern ssize_t sys_pwrite64(unsigned int fd, const char *buf, size_t count, - loff_t pos); compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf, compat_size_t count, u32 reg6, u32 poshi, u32 poslo) @@ -2831,16 +2744,11 @@ return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); } -extern ssize_t sys_readahead(int fd, loff_t offset, size_t count); - compat_ssize_t sys32_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count) { return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count); } -extern asmlinkage long sys_truncate(const char * path, unsigned long length); -extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); - asmlinkage int sys32_truncate64(const char * path, u32 reg4, unsigned long high, unsigned long low) { @@ -2853,8 +2761,6 @@ return sys_ftruncate(fd, (high << 32) | low); } -extern long sys_lookup_dcookie(u64 cookie64, char *buf, size_t len); - long ppc32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len) { @@ -2862,8 +2768,6 @@ buf, len); } -extern int sys_fadvise64(int fd, loff_t offset, size_t len, int advice); - long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low, size_t len, int advice) { --- diff/arch/ppc64/kernel/syscalls.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/ppc64/kernel/syscalls.c 2004-02-18 09:03:58.000000000 +0000 @@ -22,6 +22,7 @@ #include #include +#include #include #include #include --- diff/arch/ppc64/kernel/time.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/ppc64/kernel/time.c 2004-02-18 09:03:58.000000000 +0000 @@ -418,6 +418,7 @@ } write_sequnlock_irqrestore(&xtime_lock, flags); + clock_was_set(); return 0; } --- diff/arch/s390/kernel/compat_linux.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/s390/kernel/compat_linux.c 2004-02-18 09:03:58.000000000 +0000 @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -71,17 +72,6 @@ #include "compat_linux.h" -extern asmlinkage long sys_chown(const char *, uid_t,gid_t); -extern asmlinkage long sys_lchown(const char *, uid_t,gid_t); -extern asmlinkage long sys_fchown(unsigned int, uid_t,gid_t); -extern asmlinkage long sys_setregid(gid_t, gid_t); -extern asmlinkage long sys_setgid(gid_t); -extern asmlinkage long sys_setreuid(uid_t, uid_t); -extern asmlinkage long sys_setuid(uid_t); -extern asmlinkage long sys_setresuid(uid_t, uid_t, uid_t); -extern asmlinkage long sys_setresgid(gid_t, gid_t, gid_t); -extern asmlinkage long sys_setfsuid(uid_t); -extern asmlinkage long sys_setfsgid(gid_t); /* For this source file, we want overflow handling. */ @@ -190,40 +180,81 @@ return sys_setfsgid((gid_t)gid); } +static int groups16_to_user(u16 *grouplist, struct group_info *group_info) +{ + int i; + u16 group; + + for (i = 0; i < group_info->ngroups; i++) { + group = (u16)GROUP_AT(group_info, i); + if (put_user(group, grouplist+i)) + return -EFAULT; + } + + return 0; +} + +static int groups16_from_user(struct group_info *group_info, u16 *grouplist) +{ + int i; + u16 group; + + for (i = 0; i < group_info->ngroups; i++) { + if (get_user(group, grouplist+i)) + return -EFAULT; + GROUP_AT(group_info, i) = (gid_t)group; + } + + return 0; +} + asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) { - u16 groups[NGROUPS]; - int i,j; + int i; if (gidsetsize < 0) return -EINVAL; - i = current->ngroups; + + get_group_info(current->group_info); + i = current->group_info->ngroups; if (gidsetsize) { - if (i > gidsetsize) - return -EINVAL; - for(j=0;jgroups[j]; - if (copy_to_user(grouplist, groups, sizeof(u16)*i)) - return -EFAULT; + if (i > gidsetsize) { + i = -EINVAL; + goto out; + } + if (groups16_to_user(grouplist, current->group_info)) { + i = -EFAULT; + goto out; + } } +out: + put_group_info(current->group_info); return i; } asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) { - u16 groups[NGROUPS]; - int i; + struct group_info *group_info; + int retval; if (!capable(CAP_SETGID)) return -EPERM; - if ((unsigned) gidsetsize > NGROUPS) + if ((unsigned)gidsetsize > NGROUPS_MAX) return -EINVAL; - if (copy_from_user(groups, grouplist, gidsetsize * sizeof(u16))) - return -EFAULT; - for (i = 0 ; i < gidsetsize ; i++) - current->groups[i] = (gid_t)groups[i]; - current->ngroups = gidsetsize; - return 0; + + group_info = groups_alloc(gidsetsize); + if (!group_info) + return -ENOMEM; + retval = groups16_from_user(group_info, grouplist); + if (retval) { + put_group_info(group_info); + return retval; + } + + retval = set_current_groups(group_info); + put_group_info(group_info); + + return retval; } asmlinkage long sys32_getuid16(void) @@ -884,9 +915,6 @@ return err; } -extern asmlinkage long sys_truncate(const char * path, unsigned long length); -extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); - asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low) { if ((int)high < 0) @@ -1356,8 +1384,6 @@ return err; } -extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2); - asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2) { return sys_sysfs(option, arg1, arg2); @@ -1531,9 +1557,7 @@ char _f[8]; }; -extern asmlinkage int sys_sysinfo(struct sysinfo *info); - -asmlinkage int sys32_sysinfo(struct sysinfo32 *info) +asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info) { struct sysinfo s; int ret, err; @@ -1561,10 +1585,8 @@ return ret; } -extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval); - asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, - struct compat_timespec *interval) + struct compat_timespec __user *interval) { struct timespec t; int ret; @@ -1578,9 +1600,8 @@ return ret; } -extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize); - -asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize) +asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, + compat_sigset_t __user *oset, compat_size_t sigsetsize) { sigset_t s; compat_sigset_t s32; @@ -1614,9 +1635,8 @@ return 0; } -extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize); - -asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize) +asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, + compat_size_t sigsetsize) { sigset_t s; compat_sigset_t s32; @@ -1723,11 +1743,8 @@ return ret; } -extern asmlinkage int -sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo); - asmlinkage int -sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo) +sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo) { siginfo_t info; int ret; @@ -1956,40 +1973,30 @@ #ifdef CONFIG_MODULES -extern asmlinkage int sys_init_module(const char *name_user, struct module *mod_user); - -/* Hey, when you're trying to init module, take time and prepare us a nice 64bit - * module structure, even if from 32bit modutils... Why to pollute kernel... :)) - */ -asmlinkage int sys32_init_module(const char *name_user, struct module *mod_user) +asmlinkage int +sys32_init_module(void __user *umod, unsigned long len, + const char __user *uargs) { - return sys_init_module(name_user, mod_user); + return sys_init_module(umod, len, uargs); } -extern asmlinkage int sys_delete_module(const char *name_user); - -asmlinkage int sys32_delete_module(const char *name_user) +asmlinkage int +sys32_delete_module(const char __user *name_user, unsigned int flags) { - return sys_delete_module(name_user); + return sys_delete_module(name_user, flags); } -struct module_info32 { - u32 addr; - u32 size; - u32 flags; - s32 usecount; -}; - #else /* CONFIG_MODULES */ asmlinkage int -sys32_init_module(const char *name_user, struct module *mod_user) +sys32_init_module(void __user *umod, unsigned long len, + const char __user *uargs) { return -ENOSYS; } asmlinkage int -sys32_delete_module(const char *name_user) +sys32_delete_module(const char __user *name_user, unsigned int flags) { return -ENOSYS; } @@ -2153,10 +2160,6 @@ return copy_to_user(res32, kres, sizeof(*res32)) ? -EFAULT : 0; } -/* -asmlinkage long sys_ni_syscall(void); -*/ - int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32) { struct nfsctl_arg *karg = NULL; @@ -2271,9 +2274,8 @@ return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); } -asmlinkage int sys_utimes(char *, struct timeval *); - -asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs) +asmlinkage int sys32_utimes(char __user *filename, + struct compat_timeval __user *tvs) { char *kfilename; struct timeval ktvs[2]; @@ -2307,8 +2309,6 @@ return -ERESTARTNOHAND; } -extern asmlinkage int sys_prctl(int option, unsigned long arg2, unsigned long arg3, - unsigned long arg4, unsigned long arg5); asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) { @@ -2320,12 +2320,6 @@ } -extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf, - size_t count, loff_t pos); - -extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf, - size_t count, loff_t pos); - asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf, compat_size_t count, u32 poshi, u32 poslo) { @@ -2342,15 +2336,11 @@ return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); } -extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); - asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count) { return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); } -extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count); - asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) { mm_segment_t old_fs = get_fs(); @@ -2370,9 +2360,6 @@ return ret; } -extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, - loff_t *offset, size_t count); - asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count) { @@ -2466,8 +2453,6 @@ return ret; } -extern asmlinkage long sys_setpriority(int which, int who, int niceval); - asmlinkage int sys_setpriority32(u32 which, u32 who, u32 niceval) { return sys_setpriority((int) which, @@ -2485,7 +2470,7 @@ u32 __unused[4]; }; -extern asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) +asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) { struct __sysctl_args32 tmp; int error; @@ -2677,8 +2662,6 @@ return error; } -asmlinkage ssize_t sys_read(unsigned int fd, char * buf, size_t count); - asmlinkage compat_ssize_t sys32_read(unsigned int fd, char * buf, size_t count) { if ((compat_ssize_t) count < 0) @@ -2687,8 +2670,6 @@ return sys_read(fd, buf, count); } -asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count); - asmlinkage compat_ssize_t sys32_write(unsigned int fd, char * buf, size_t count) { if ((compat_ssize_t) count < 0) --- diff/arch/s390/kernel/compat_linux.h 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/s390/kernel/compat_linux.h 2004-02-18 09:03:58.000000000 +0000 @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include --- diff/arch/s390/kernel/compat_wrapper.S 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/s390/kernel/compat_wrapper.S 2004-02-18 09:03:58.000000000 +0000 @@ -567,13 +567,15 @@ .globl sys32_init_module_wrapper sys32_init_module_wrapper: - llgtr %r2,%r2 # const char * - llgtr %r3,%r3 # struct module * + llgtr %r2,%r2 # void * + llgfr %r3,%r3 # unsigned long + llgtr %r4,%r4 # char * jg sys32_init_module # branch to system call .globl sys32_delete_module_wrapper sys32_delete_module_wrapper: llgtr %r2,%r2 # const char * + llgfr %r3,%r3 # unsigned int jg sys32_delete_module # branch to system call .globl sys32_quotactl_wrapper --- diff/arch/s390/kernel/s390_ksyms.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/s390/kernel/s390_ksyms.c 2004-02-18 09:03:58.000000000 +0000 @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include --- diff/arch/s390/kernel/sys_s390.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/s390/kernel/sys_s390.c 2004-02-18 09:03:58.000000000 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -125,8 +126,6 @@ return error; } -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - #ifndef CONFIG_ARCH_S390X struct sel_arg_struct { unsigned long n; @@ -290,15 +289,13 @@ return error; } -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) +asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on) { return -ENOSYS; } #else /* CONFIG_ARCH_S390X */ -extern asmlinkage int sys_newuname(struct new_utsname * name); - asmlinkage int s390x_newuname(struct new_utsname * name) { int ret = sys_newuname(name); @@ -310,8 +307,6 @@ return ret; } -extern asmlinkage long sys_personality(unsigned long); - asmlinkage int s390x_personality(unsigned long personality) { int ret; @@ -331,8 +326,6 @@ */ #ifndef CONFIG_ARCH_S390X -extern asmlinkage long sys_fadvise64(int, loff_t, size_t, int); - asmlinkage long s390_fadvise64(int fd, u32 offset_high, u32 offset_low, size_t len, int advice) { @@ -342,8 +335,6 @@ #endif -extern asmlinkage long sys_fadvise64_64(int, loff_t, loff_t, int); - struct fadvise64_64_args { int fd; long long offset; --- diff/arch/s390/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/s390/kernel/time.c 2004-02-18 09:03:58.000000000 +0000 @@ -142,6 +142,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq(&xtime_lock); + clock_was_set(); return 0; } --- diff/arch/sh/kernel/sys_sh.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/sh/kernel/sys_sh.c 2004-02-18 09:03:58.000000000 +0000 @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -240,16 +241,12 @@ asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char * buf, size_t count, long dummy, loff_t pos) { - extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf, - size_t count, loff_t pos); return sys_pread64(fd, buf, count, pos); } asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char * buf, size_t count, long dummy, loff_t pos) { - extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf, - size_t count, loff_t pos); return sys_pwrite64(fd, buf, count, pos); } --- diff/arch/sparc/kernel/setup.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/sparc/kernel/setup.c 2004-02-18 09:03:58.000000000 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -66,7 +67,6 @@ extern unsigned long trapbase; void (*prom_palette)(int); -asmlinkage void sys_sync(void); /* it's really int */ /* Pretty sick eh? */ void prom_sync_me(void) --- diff/arch/sparc/kernel/sunos_ioctl.c 2002-10-16 04:27:53.000000000 +0100 +++ source/arch/sparc/kernel/sunos_ioctl.c 2004-02-18 09:03:58.000000000 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,6 @@ /* NR_OPEN is now larger and dynamic in recent kernels. */ #define SUNOS_NR_OPEN 256 -extern asmlinkage int sys_ioctl(unsigned int, unsigned int, unsigned long); extern asmlinkage int sys_setsid(void); asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg) --- diff/arch/sparc/kernel/sys_sparc.c 2003-07-22 18:54:27.000000000 +0100 +++ source/arch/sparc/kernel/sys_sparc.c 2004-02-18 09:03:58.000000000 +0000 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -78,8 +79,6 @@ } } -extern asmlinkage unsigned long sys_brk(unsigned long brk); - asmlinkage unsigned long sparc_brk(unsigned long brk) { if(ARCH_SUN4C_SUN4) { --- diff/arch/sparc/kernel/sys_sunos.c 2003-09-17 12:28:03.000000000 +0100 +++ source/arch/sparc/kernel/sys_sunos.c 2004-02-18 09:03:58.000000000 +0000 @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -564,8 +565,6 @@ } /* SunOS mount system call emulation */ -extern asmlinkage int -sys_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp); asmlinkage int sunos_select(int width, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp) { @@ -621,11 +620,6 @@ }; -extern asmlinkage int sys_connect(int fd, struct sockaddr *uservaddr, int addrlen); -extern asmlinkage int sys_socket(int family, int type, int protocol); -extern asmlinkage int sys_bind(int fd, struct sockaddr *umyaddr, int addrlen); - - /* Bind the socket on a local reserved port and connect it to the * remote server. This on Linux/i386 is done by the mount program, * not by the kernel. @@ -814,8 +808,6 @@ return ret; } -extern asmlinkage int sys_setsid(void); -extern asmlinkage int sys_setpgid(pid_t, pid_t); asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid) { @@ -1050,15 +1042,6 @@ return ret; } -extern asmlinkage ssize_t sys_read(unsigned int fd,char *buf,int count); -extern asmlinkage ssize_t sys_write(unsigned int fd,char *buf,int count); -extern asmlinkage int sys_recv(int fd, void * ubuf, int size, unsigned flags); -extern asmlinkage int sys_send(int fd, void * buff, int len, unsigned flags); -extern asmlinkage int sys_accept(int fd, struct sockaddr *sa, int *addrlen); -extern asmlinkage int sys_readv(unsigned long fd, const struct iovec * vector, long count); -extern asmlinkage int sys_writev(unsigned long fd, const struct iovec * vector, long count); - - asmlinkage int sunos_read(unsigned int fd,char *buf,int count) { int ret; @@ -1164,9 +1147,6 @@ } -extern asmlinkage int sys_setsockopt(int fd, int level, int optname, char *optval, int optlen); -extern asmlinkage int sys_getsockopt(int fd, int level, int optname, char *optval, int *optlen); - asmlinkage int sunos_setsockopt(int fd, int level, int optname, char *optval, int optlen) { --- diff/arch/sparc/kernel/time.c 2003-12-19 09:51:02.000000000 +0000 +++ source/arch/sparc/kernel/time.c 2004-02-18 09:03:58.000000000 +0000 @@ -535,6 +535,7 @@ write_seqlock_irq(&xtime_lock); ret = bus_do_settimeofday(tv); write_sequnlock_irq(&xtime_lock); + clock_was_set(); return ret; } --- diff/arch/sparc/prom/printf.c 2002-10-16 04:27:16.000000000 +0100 +++ source/arch/sparc/prom/printf.c 2004-02-18 09:03:58.000000000 +0000 @@ -39,7 +39,7 @@ int i; va_start(args, fmt); - i = vsnprintf(ppbuf, sizeof(ppbuf), fmt, args); + i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args); va_end(args); prom_write(ppbuf, i); --- diff/arch/sparc64/Kconfig 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/sparc64/Kconfig 2004-02-18 09:03:58.000000000 +0000 @@ -718,12 +718,19 @@ depends on DEBUG_KERNEL bool "Debug BOOTMEM initialization" +config LOCKMETER + bool "Kernel lock metering" + depends on SMP && !PREEMPT + help + Say Y to enable kernel lock metering, which adds overhead to SMP locks, + but allows you to see various statistics using the lockstat command. + # We have a custom atomic_dec_and_lock() implementation but it's not # compatible with spinlock debugging so we need to fall back on # the generic version in that case. config HAVE_DEC_LOCK bool - depends on SMP && !DEBUG_SPINLOCK + depends on SMP && !DEBUG_SPINLOCK && !LOCKMETER default y config MCOUNT --- diff/arch/sparc64/kernel/ioctl32.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/sparc64/kernel/ioctl32.c 2004-02-18 09:03:58.000000000 +0000 @@ -12,6 +12,7 @@ #define INCLUDES #include "compat_ioctl.c" #include +#include #include #include #include --- diff/arch/sparc64/kernel/irq.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/sparc64/kernel/irq.c 2004-02-18 09:03:58.000000000 +0000 @@ -1211,7 +1211,7 @@ if (cpus_empty(mask)) mask = cpu_online_map; - len = cpumask_snprintf(page, count, mask); + len = cpumask_scnprintf(page, count, mask); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/sparc64/kernel/setup.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/sparc64/kernel/setup.c 2004-02-18 09:03:58.000000000 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,6 @@ void (*prom_palette)(int); void (*prom_keyboard)(void); -asmlinkage void sys_sync(void); /* it's really int */ static void prom_console_write(struct console *con, const char *s, unsigned n) @@ -603,7 +603,7 @@ } console_initcall(set_preferred_console); -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) +asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on) { return -EIO; } --- diff/arch/sparc64/kernel/sparc64_ksyms.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/sparc64/kernel/sparc64_ksyms.c 2004-02-18 09:03:58.000000000 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -84,21 +85,13 @@ extern u32 sunos_sys_table[], sys_call_table32[]; extern void tl0_solaris(void); extern void sys_sigsuspend(void); -extern int sys_getppid(void); -extern int sys_getpid(void); -extern int sys_geteuid(void); -extern int sys_getuid(void); -extern int sys_getegid(void); -extern int sys_getgid(void); extern int svr4_getcontext(svr4_ucontext_t *uc, struct pt_regs *regs); extern int svr4_setcontext(svr4_ucontext_t *uc, struct pt_regs *regs); -extern int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); extern int (*handle_mathemu)(struct pt_regs *, struct fpustate *); extern long sparc32_open(const char * filename, int flags, int mode); extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset, unsigned long size, pgprot_t prot, int space); -extern long sys_close(unsigned int); - + extern int __ashrdi3(int, int); extern void dump_thread(struct pt_regs *, struct user *); --- diff/arch/sparc64/kernel/sunos_ioctl32.c 2003-05-21 11:50:14.000000000 +0100 +++ source/arch/sparc64/kernel/sunos_ioctl32.c 2004-02-18 09:03:58.000000000 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -90,8 +91,6 @@ compat_caddr_t ifcbuf; }; -extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); - extern asmlinkage int compat_sys_ioctl(unsigned int, unsigned int, u32); extern asmlinkage int sys_setsid(void); --- diff/arch/sparc64/kernel/sys_sparc.c 2003-07-22 18:54:27.000000000 +0100 +++ source/arch/sparc64/kernel/sys_sparc.c 2004-02-18 09:03:58.000000000 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -161,8 +162,6 @@ return addr; } -extern asmlinkage unsigned long sys_brk(unsigned long brk); - asmlinkage unsigned long sparc_brk(unsigned long brk) { /* People could try to be nasty and use ta 0x6d in 32bit programs */ @@ -280,8 +279,6 @@ return err; } -extern asmlinkage int sys_newuname(struct new_utsname __user *name); - asmlinkage int sparc64_newuname(struct new_utsname __user *name) { int ret = sys_newuname(name); @@ -292,8 +289,6 @@ return ret; } -extern asmlinkage long sys_personality(unsigned long); - asmlinkage int sparc64_personality(unsigned long personality) { int ret; --- diff/arch/sparc64/kernel/sys_sparc32.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/sparc64/kernel/sys_sparc32.c 2004-02-18 09:03:58.000000000 +0000 @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -88,17 +89,6 @@ __ret; \ }) -extern asmlinkage long sys_chown(const char *, uid_t,gid_t); -extern asmlinkage long sys_lchown(const char *, uid_t,gid_t); -extern asmlinkage long sys_fchown(unsigned int, uid_t,gid_t); -extern asmlinkage long sys_setregid(gid_t, gid_t); -extern asmlinkage long sys_setgid(gid_t); -extern asmlinkage long sys_setreuid(uid_t, uid_t); -extern asmlinkage long sys_setuid(uid_t); -extern asmlinkage long sys_setresuid(uid_t, uid_t, uid_t); -extern asmlinkage long sys_setresgid(gid_t, gid_t, gid_t); -extern asmlinkage long sys_setfsuid(uid_t); -extern asmlinkage long sys_setfsgid(gid_t); asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) { @@ -179,40 +169,81 @@ return sys_setfsgid((gid_t)gid); } +static int groups16_to_user(u16 *grouplist, struct group_info *group_info) +{ + int i; + u16 group; + + for (i = 0; i < group_info->ngroups; i++) { + group = (u16)GROUP_AT(group_info, i); + if (put_user(group, grouplist+i)) + return -EFAULT; + } + + return 0; +} + +static int groups16_from_user(struct group_info *group_info, u16 *grouplist) +{ + int i; + u16 group; + + for (i = 0; i < group_info->ngroups; i++) { + if (get_user(group, grouplist+i)) + return -EFAULT; + GROUP_AT(group_info, i) = (gid_t)group; + } + + return 0; +} + asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) { - u16 groups[NGROUPS]; - int i,j; + int i; if (gidsetsize < 0) return -EINVAL; - i = current->ngroups; + + get_group_info(current->group_info); + i = current->group_info->ngroups; if (gidsetsize) { - if (i > gidsetsize) - return -EINVAL; - for(j=0;jgroups[j]; - if (copy_to_user(grouplist, groups, sizeof(u16)*i)) - return -EFAULT; + if (i > gidsetsize) { + i = -EINVAL; + goto out; + } + if (groups16_to_user(grouplist, current->group_info)) { + i = -EFAULT; + goto out; + } } +out: + put_group_info(current->group_info); return i; } asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) { - u16 groups[NGROUPS]; - int i; + struct group_info *group_info; + int retval; if (!capable(CAP_SETGID)) return -EPERM; - if ((unsigned) gidsetsize > NGROUPS) + if ((unsigned)gidsetsize > NGROUPS_MAX) return -EINVAL; - if (copy_from_user(groups, grouplist, gidsetsize * sizeof(u16))) - return -EFAULT; - for (i = 0 ; i < gidsetsize ; i++) - current->groups[i] = (gid_t)groups[i]; - current->ngroups = gidsetsize; - return 0; + + group_info = groups_alloc(gidsetsize); + if (!group_info) + return -ENOMEM; + retval = groups16_from_user(group_info, grouplist); + if (retval) { + put_group_info(group_info); + return retval; + } + + retval = set_current_groups(group_info); + put_group_info(group_info); + + return retval; } asmlinkage long sys32_getuid16(void) @@ -251,9 +282,7 @@ __put_user(i->tv_usec, &o->tv_usec))); } -extern asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on); - -asmlinkage int sys32_ioperm(u32 from, u32 num, int on) +asmlinkage long sys32_ioperm(u32 from, u32 num, int on) { return sys_ioperm((unsigned long)from, (unsigned long)num, on); } @@ -795,9 +824,6 @@ return err; } -extern asmlinkage long sys_truncate(const char * path, unsigned long length); -extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); - asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low) { if ((int)high < 0) @@ -1303,8 +1329,6 @@ return err; } -extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2); - asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2) { return sys_sysfs(option, arg1, arg2); @@ -1530,8 +1554,6 @@ char _f[20-2*sizeof(int)-sizeof(int)]; }; -extern asmlinkage int sys_sysinfo(struct sysinfo *info); - asmlinkage int sys32_sysinfo(struct sysinfo32 *info) { struct sysinfo s; @@ -1579,8 +1601,6 @@ return ret; } -extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval); - asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval) { struct timespec t; @@ -1595,8 +1615,6 @@ return ret; } -extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize); - asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize) { sigset_t s; @@ -1631,8 +1649,6 @@ return 0; } -extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize); - asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize) { sigset_t s; @@ -1740,9 +1756,6 @@ return ret; } -extern asmlinkage int -sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo); - asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo) { @@ -2073,15 +2086,11 @@ #ifdef CONFIG_MODULES -extern asmlinkage long sys_init_module(void *, unsigned long, const char *); - asmlinkage int sys32_init_module(void *umod, u32 len, const char *uargs) { return sys_init_module(umod, len, uargs); } -extern asmlinkage long sys_delete_module(const char *, unsigned int); - asmlinkage int sys32_delete_module(const char *name_user, unsigned int flags) { return sys_delete_module(name_user, flags); @@ -2323,7 +2332,6 @@ return err; } #else /* !NFSD */ -extern asmlinkage long sys_ni_syscall(void); int asmlinkage sys32_nfsservctl(int cmd, void *notused, void *notused2) { return sys_ni_syscall(); @@ -2416,17 +2424,6 @@ } /* PCI config space poking. */ -extern asmlinkage int sys_pciconfig_read(unsigned long bus, - unsigned long dfn, - unsigned long off, - unsigned long len, - unsigned char *buf); - -extern asmlinkage int sys_pciconfig_write(unsigned long bus, - unsigned long dfn, - unsigned long off, - unsigned long len, - unsigned char *buf); asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) { @@ -2446,9 +2443,6 @@ (unsigned char *)AA(ubuf)); } -extern asmlinkage int sys_prctl(int option, unsigned long arg2, unsigned long arg3, - unsigned long arg4, unsigned long arg5); - asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) { return sys_prctl(option, @@ -2459,12 +2453,6 @@ } -extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf, - size_t count, loff_t pos); - -extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf, - size_t count, loff_t pos); - asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf, compat_size_t count, u32 poshi, u32 poslo) { @@ -2477,8 +2465,6 @@ return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); } -extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); - asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count) { return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); @@ -2495,8 +2481,6 @@ ((loff_t)AA(lenhi)<<32)|AA(lenlo), advice); } -extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count); - asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) { mm_segment_t old_fs = get_fs(); @@ -2516,8 +2500,6 @@ return ret; } -extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count); - asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count) { mm_segment_t old_fs = get_fs(); @@ -2692,8 +2674,6 @@ return ret; } -extern asmlinkage long sys_setpriority(int which, int who, int niceval); - asmlinkage int sys_setpriority32(u32 which, u32 who, u32 niceval) { return sys_setpriority((int) which, @@ -2753,8 +2733,6 @@ #endif } -extern long sys_lookup_dcookie(u64 cookie64, char *buf, size_t len); - long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len) { return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low, --- diff/arch/sparc64/kernel/sys_sunos32.c 2003-09-17 12:28:03.000000000 +0100 +++ source/arch/sparc64/kernel/sys_sunos32.c 2004-02-18 09:03:58.000000000 +0000 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -584,11 +585,6 @@ char *netname; /* server's netname */ }; -extern asmlinkage int sys_mount(char *, char *, char *, unsigned long, void *); -extern asmlinkage int sys_connect(int fd, struct sockaddr *uservaddr, int addrlen); -extern asmlinkage int sys_socket(int family, int type, int protocol); -extern asmlinkage int sys_bind(int fd, struct sockaddr *umyaddr, int addrlen); - /* Bind the socket on a local reserved port and connect it to the * remote server. This on Linux/i386 is done by the mount program, @@ -781,8 +777,6 @@ return ret; } -extern asmlinkage int sys_setsid(void); -extern asmlinkage int sys_setpgid(pid_t, pid_t); asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid) { @@ -1200,11 +1194,6 @@ return ret; } -extern asmlinkage ssize_t sys_read(unsigned int fd, char *buf, unsigned long count); -extern asmlinkage ssize_t sys_write(unsigned int fd, char *buf, unsigned long count); -extern asmlinkage int sys_recv(int fd, void *ubuf, size_t size, unsigned flags); -extern asmlinkage int sys_send(int fd, void *buff, size_t len, unsigned flags); -extern asmlinkage int sys_accept(int fd, struct sockaddr *sa, int *addrlen); extern asmlinkage int sys32_readv(u32 fd, u32 vector, s32 count); extern asmlinkage int sys32_writev(u32 fd, u32 vector, s32 count); @@ -1302,9 +1291,6 @@ return ret; } -extern asmlinkage int sys_setsockopt(int fd, int level, int optname, - char *optval, int optlen); - asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval, int optlen) { --- diff/arch/sparc64/kernel/time.c 2003-11-25 15:24:57.000000000 +0000 +++ source/arch/sparc64/kernel/time.c 2004-02-18 09:03:58.000000000 +0000 @@ -1126,6 +1126,7 @@ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq(&xtime_lock); + clock_was_set(); return 0; } --- diff/arch/sparc64/lib/rwlock.S 2003-11-25 15:24:57.000000000 +0000 +++ source/arch/sparc64/lib/rwlock.S 2004-02-18 09:03:58.000000000 +0000 @@ -85,5 +85,20 @@ __write_trylock_fail: retl mov 0, %o0 + + .globl __read_trylock +__read_trylock: /* %o0 = lock_ptr */ + ldsw [%o0], %g5 + brlz,pn %g5, 100f + add %g5, 1, %g7 + cas [%o0], %g5, %g7 + cmp %g5, %g7 + bne,pn %icc, __read_trylock + membar #StoreLoad | #StoreStore + retl + mov 1, %o0 +100: retl + mov 0, %o0 + rwlock_impl_end: --- diff/arch/sparc64/prom/printf.c 2003-05-21 11:50:14.000000000 +0100 +++ source/arch/sparc64/prom/printf.c 2004-02-18 09:03:58.000000000 +0000 @@ -40,7 +40,7 @@ int i; va_start(args, fmt); - i = vsnprintf(ppbuf, sizeof(ppbuf), fmt, args); + i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args); va_end(args); prom_write(ppbuf, i); --- diff/arch/sparc64/solaris/ioctl.c 2003-05-21 11:50:14.000000000 +0100 +++ source/arch/sparc64/solaris/ioctl.c 2004-02-18 09:03:58.000000000 +0000 @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -34,8 +35,6 @@ #include "conv.h" #include "socksys.h" -extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, - unsigned long arg); extern asmlinkage int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg); --- diff/arch/sparc64/solaris/socksys.c 2003-09-17 12:28:03.000000000 +0100 +++ source/arch/sparc64/solaris/socksys.c 2004-02-18 09:03:58.000000000 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -35,9 +36,6 @@ #include "conv.h" #include "socksys.h" -extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, - unsigned long arg); - static int af_inet_protocols[] = { IPPROTO_ICMP, IPPROTO_ICMP, IPPROTO_IGMP, IPPROTO_IPIP, IPPROTO_TCP, IPPROTO_EGP, IPPROTO_PUP, IPPROTO_UDP, IPPROTO_IDP, IPPROTO_RAW, --- diff/arch/sparc64/solaris/timod.c 2003-09-17 12:28:03.000000000 +0100 +++ source/arch/sparc64/solaris/timod.c 2004-02-18 09:03:58.000000000 +0000 @@ -27,8 +27,6 @@ #include "conv.h" #include "socksys.h" -extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, - unsigned long arg); asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg); static spinlock_t timod_pagelock = SPIN_LOCK_UNLOCKED; --- diff/arch/um/drivers/net_kern.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/um/drivers/net_kern.c 2004-02-18 09:03:58.000000000 +0000 @@ -358,8 +358,12 @@ rtnl_lock(); err = register_netdevice(dev); rtnl_unlock(); - if (err) + if (err) { + device->dev = NULL; + /* XXX: should we call ->remove() here? */ + free_netdev(dev); return 1; + } lp = dev->priv; INIT_LIST_HEAD(&lp->list); --- diff/arch/um/include/kern_util.h 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/um/include/kern_util.h 2004-02-18 09:03:58.000000000 +0000 @@ -45,7 +45,6 @@ extern int need_finish_fork(void); extern void free_stack(unsigned long stack, int order); extern void add_input_request(int op, void (*proc)(int), void *arg); -extern int sys_execve(char *file, char **argv, char **env); extern char *current_cmd(void); extern void timer_handler(int sig, union uml_pt_regs *regs); extern int set_signals(int enable); --- diff/arch/um/kernel/irq.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/um/kernel/irq.c 2004-02-18 09:03:58.000000000 +0000 @@ -575,7 +575,7 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, irq_affinity[(long)data]); + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); @@ -613,7 +613,7 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, *(cpumask_t *)data); + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/um/kernel/sys_call_table.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/um/kernel/sys_call_table.c 2004-02-18 09:03:58.000000000 +0000 @@ -8,6 +8,7 @@ #include "linux/version.h" #include "linux/sys.h" #include "linux/swap.h" +#include "linux/syscalls.h" #include "linux/sysctl.h" #include "asm/signal.h" #include "sysdep/syscalls.h" @@ -268,9 +269,9 @@ [ __NR_creat ] = sys_creat, [ __NR_link ] = sys_link, [ __NR_unlink ] = sys_unlink, + [ __NR_execve ] = (syscall_handler_t *) sys_execve, /* declared differently in kern_util.h */ - [ __NR_execve ] = (syscall_handler_t *) sys_execve, [ __NR_chdir ] = sys_chdir, [ __NR_time ] = um_time, [ __NR_mknod ] = sys_mknod, --- diff/arch/um/kernel/syscall_kern.c 2003-10-09 09:47:16.000000000 +0100 +++ source/arch/um/kernel/syscall_kern.c 2004-02-18 09:03:58.000000000 +0000 @@ -11,6 +11,7 @@ #include "linux/msg.h" #include "linux/shm.h" #include "linux/sys.h" +#include "linux/syscalls.h" #include "linux/unistd.h" #include "linux/slab.h" #include "linux/utime.h" --- diff/arch/um/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/um/kernel/time.c 2004-02-18 09:03:58.000000000 +0000 @@ -93,6 +93,7 @@ gettimeofday(tv, NULL); timeradd(tv, &local_offset, tv); time_unlock(flags); + clock_was_set(); } EXPORT_SYMBOL(do_gettimeofday); --- diff/arch/v850/kernel/syscalls.c 2002-12-30 10:17:12.000000000 +0000 +++ source/arch/v850/kernel/syscalls.c 2004-02-18 09:03:58.000000000 +0000 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include --- diff/arch/v850/kernel/time.c 2003-10-09 09:47:33.000000000 +0100 +++ source/arch/v850/kernel/time.c 2004-02-18 09:03:58.000000000 +0000 @@ -193,6 +193,7 @@ time_esterror = NTP_PHASE_LIMIT; write_sequnlock_irq (&xtime_lock); + clock_was_set(); return 0; } --- diff/arch/x86_64/Kconfig 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/x86_64/Kconfig 2004-02-18 09:03:58.000000000 +0000 @@ -48,12 +48,14 @@ bool default y help - Write kernel log output directly into the VGA buffer. This is useful - for kernel debugging when your machine crashes very early before - the console code is initialized. For normal operation it is not - recommended because it looks ugly and doesn't cooperate with - klogd/syslogd or the X server. You should normally N here, unless - you want to debug such a crash. + Write kernel log output directly into the VGA buffer or to a serial + port. + + This is useful for kernel debugging when your machine crashes very + early before the console code is initialized. For normal operation + it is not recommended because it looks ugly and doesn't cooperate + with klogd/syslogd or the X server. You should normally N here, + unless you want to debug such a crash. config HPET_TIMER bool @@ -433,6 +435,7 @@ config DEBUG_INFO bool "Compile the kernel with debug info" depends on DEBUG_KERNEL + default n help If you say Y here the resulting kernel image will include debugging info resulting in a larger kernel image. @@ -464,9 +467,8 @@ help Add a simple leak tracer to the IOMMU code. This is useful when you are debugging a buggy device driver that leaks IOMMU mappings. - -#config X86_REMOTE_DEBUG -# bool "kgdb debugging stub" + +source "arch/x86_64/Kconfig.kgdb" endmenu --- diff/arch/x86_64/Makefile 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/x86_64/Makefile 2004-02-18 09:03:58.000000000 +0000 @@ -52,7 +52,10 @@ ifneq ($(CONFIG_DEBUG_INFO),y) CFLAGS += -fno-asynchronous-unwind-tables endif -#CFLAGS += $(call check_gcc,-funit-at-a-time,) + +# Enable unit-at-a-time mode when possible. It shrinks the +# kernel considerably. +CFLAGS += $(call check_gcc,-funit-at-a-time,) head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o --- diff/arch/x86_64/ia32/ia32_ioctl.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/x86_64/ia32/ia32_ioctl.c 2004-02-18 09:03:58.000000000 +0000 @@ -10,12 +10,11 @@ */ #define INCLUDES +#include #include "compat_ioctl.c" #include #include -extern asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); - #define CODE #include "compat_ioctl.c" --- diff/arch/x86_64/ia32/ipc32.c 2003-08-20 14:16:26.000000000 +0100 +++ source/arch/x86_64/ia32/ipc32.c 2004-02-18 09:03:58.000000000 +0000 @@ -1,5 +1,6 @@ #include #include +#include #include #include #include --- diff/arch/x86_64/ia32/ptrace32.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/x86_64/ia32/ptrace32.c 2004-02-18 09:03:58.000000000 +0000 @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include #include @@ -223,8 +225,6 @@ } -extern asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, unsigned long data); - asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) { struct task_struct *child; --- diff/arch/x86_64/ia32/sys_ia32.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/x86_64/ia32/sys_ia32.c 2004-02-18 09:03:58.000000000 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -110,9 +111,6 @@ return 0; } -extern long sys_truncate(char *, loff_t); -extern long sys_ftruncate(int, loff_t); - asmlinkage long sys32_truncate64(char * filename, unsigned long offset_low, unsigned long offset_high) { @@ -236,8 +234,6 @@ return retval; } -extern asmlinkage long sys_mprotect(unsigned long start,size_t len,unsigned long prot); - asmlinkage long sys32_mprotect(unsigned long start, size_t len, unsigned long prot) { @@ -363,12 +359,9 @@ return ret; } -extern asmlinkage long sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, - size_t sigsetsize); - asmlinkage long -sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, - unsigned int sigsetsize) +sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, + compat_sigset_t __user *oset, unsigned int sigsetsize) { sigset_t s; compat_sigset_t s32; @@ -734,9 +727,6 @@ (struct compat_timeval *)A(a.tvp)); } -asmlinkage ssize_t sys_readv(unsigned long,const struct iovec *,unsigned long); -asmlinkage ssize_t sys_writev(unsigned long,const struct iovec *,unsigned long); - static struct iovec * get_compat_iovec(struct compat_iovec *iov32, struct iovec *iov_buf, u32 *count, int type, int *errp) { @@ -878,18 +868,12 @@ /* 32-bit timeval and related flotsam. */ -extern asmlinkage long sys_sysfs(int option, unsigned long arg1, - unsigned long arg2); - asmlinkage long sys32_sysfs(int option, u32 arg1, u32 arg2) { return sys_sysfs(option, arg1, arg2); } -extern asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, - unsigned long new_flags, void *data); - static char *badfs[] = { "smbfs", "ncpfs", NULL }; @@ -940,8 +924,6 @@ char _f[20-2*sizeof(u32)-sizeof(int)]; }; -extern asmlinkage long sys_sysinfo(struct sysinfo *info); - asmlinkage long sys32_sysinfo(struct sysinfo32 *info) { @@ -991,9 +973,6 @@ return 0; } -extern asmlinkage long sys_sched_rr_get_interval(pid_t pid, - struct timespec *interval); - asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval) { @@ -1009,10 +988,8 @@ return ret; } -extern asmlinkage long sys_rt_sigpending(sigset_t *set, size_t sigsetsize); - asmlinkage long -sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize) +sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize) { sigset_t s; compat_sigset_t s32; @@ -1035,9 +1012,6 @@ return ret; } -extern asmlinkage long -sys_rt_sigtimedwait(const sigset_t *uthese, siginfo_t *uinfo, - const struct timespec *uts, size_t sigsetsize); asmlinkage long sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo, @@ -1077,9 +1051,6 @@ return ret; } -extern asmlinkage long -sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo); - asmlinkage long sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo) { @@ -1165,12 +1136,6 @@ #endif } -extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf, - size_t count, loff_t pos); - -extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf, - size_t count, loff_t pos); - /* warning: next two assume little endian */ asmlinkage long sys32_pread(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi) @@ -1187,8 +1152,6 @@ } -extern asmlinkage long sys_personality(unsigned long); - asmlinkage long sys32_personality(unsigned long personality) { @@ -1202,9 +1165,6 @@ return ret; } -extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, - size_t count); - asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) { @@ -1375,9 +1335,7 @@ return err?-EFAULT:0; } -extern int sys_ustat(dev_t, struct ustat *); - -long sys32_ustat(unsigned dev, struct ustat32 *u32p) +long sys32_ustat(unsigned dev, struct ustat32 __user *u32p) { struct ustat u; mm_segment_t seg; @@ -1500,15 +1458,11 @@ * Some system calls that need sign extended arguments. This could be done by a generic wrapper. */ -extern off_t sys_lseek (unsigned int fd, off_t offset, unsigned int origin); - long sys32_lseek (unsigned int fd, int offset, unsigned int whence) { return sys_lseek(fd, offset, whence); } -extern int sys_kill(pid_t pid, int sig); - long sys32_kill(int pid, int sig) { return sys_kill(pid, sig); @@ -1736,15 +1690,12 @@ return err; } #else /* !NFSD */ -extern asmlinkage long sys_ni_syscall(void); long asmlinkage sys32_nfsservctl(int cmd, void *notused, void *notused2) { return sys_ni_syscall(); } #endif -extern long sys_io_setup(unsigned nr_reqs, aio_context_t *ctx); - long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p) { long ret; @@ -1802,11 +1753,6 @@ return i ? i : ret; } -extern asmlinkage long sys_io_getevents(aio_context_t ctx_id, - long min_nr, - long nr, - struct io_event *events, - struct timespec *timeout); asmlinkage long sys32_io_getevents(aio_context_t ctx_id, unsigned long min_nr, @@ -1895,8 +1841,6 @@ return err; } -extern long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice); - long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, __u32 len_low, __u32 len_high, int advice) { --- diff/arch/x86_64/kernel/Makefile 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/x86_64/kernel/Makefile 2004-02-18 09:03:58.000000000 +0000 @@ -24,6 +24,7 @@ obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o obj-$(CONFIG_MODULES) += module.o +obj-$(CONFIG_KGDB) += kgdb_stub.o obj-y += topology.o --- diff/arch/x86_64/kernel/early_printk.c 2003-06-09 14:18:18.000000000 +0100 +++ source/arch/x86_64/kernel/early_printk.c 2004-02-18 09:03:58.000000000 +0000 @@ -7,7 +7,11 @@ /* Simple VGA output */ +#ifdef __i386__ +#define VGABASE __pa(__PAGE_OFFSET + 0xb8000UL) +#else #define VGABASE 0xffffffff800b8000UL +#endif #define MAX_YPOS 25 #define MAX_XPOS 80 @@ -22,15 +26,14 @@ while ((c = *str++) != '\0' && n-- > 0) { if (current_ypos >= MAX_YPOS) { /* scroll 1 line up */ - for(k = 1, j = 0; k < MAX_YPOS; k++, j++) { - for(i = 0; i < MAX_XPOS; i++) { + for (k = 1, j = 0; k < MAX_YPOS; k++, j++) { + for (i = 0; i < MAX_XPOS; i++) { writew(readw(VGABASE + 2*(MAX_XPOS*k + i)), VGABASE + 2*(MAX_XPOS*j + i)); } } - for(i = 0; i < MAX_XPOS; i++) { + for (i = 0; i < MAX_XPOS; i++) writew(0x720, VGABASE + 2*(MAX_XPOS*j + i)); - } current_ypos = MAX_YPOS-1; } if (c == '\n') { @@ -38,7 +41,8 @@ current_ypos++; } else if (c != '\r') { writew(((0x7 << 8) | (unsigned short) c), - VGABASE + 2*(MAX_XPOS*current_ypos + current_xpos++)); + VGABASE + 2*(MAX_XPOS*current_ypos + + current_xpos++)); if (current_xpos >= MAX_XPOS) { current_xpos = 0; current_ypos++; @@ -78,7 +82,7 @@ { unsigned timeout = 0xffff; while ((inb(early_serial_base + LSR) & XMTRDY) == 0 && --timeout) - rep_nop(); + cpu_relax(); outb(ch, early_serial_base + TXR); return timeout ? 0 : -1; } @@ -93,10 +97,13 @@ } } +#define DEFAULT_BAUD 9600 + static __init void early_serial_init(char *opt) { unsigned char c; - unsigned divisor, baud = 38400; + unsigned divisor; + unsigned baud = DEFAULT_BAUD; char *s, *e; if (*opt == ',') @@ -109,25 +116,26 @@ early_serial_base = simple_strtoul(s, &e, 16); } else { static int bases[] = { 0x3f8, 0x2f8 }; - if (!strncmp(s,"ttyS",4)) - s+=4; - port = simple_strtoul(s, &e, 10); - if (port > 1 || s == e) - port = 0; - early_serial_base = bases[port]; - } + + if (!strncmp(s,"ttyS",4)) + s += 4; + port = simple_strtoul(s, &e, 10); + if (port > 1 || s == e) + port = 0; + early_serial_base = bases[port]; + } } - outb(0x3, early_serial_base + LCR); /* 8n1 */ - outb(0, early_serial_base + IER); /* no interrupt */ - outb(0, early_serial_base + FCR); /* no fifo */ - outb(0x3, early_serial_base + MCR); /* DTR + RTS */ + outb(0x3, early_serial_base + LCR); /* 8n1 */ + outb(0, early_serial_base + IER); /* no interrupt */ + outb(0, early_serial_base + FCR); /* no fifo */ + outb(0x3, early_serial_base + MCR); /* DTR + RTS */ s = strsep(&opt, ","); if (s != NULL) { baud = simple_strtoul(s, &e, 0); if (baud == 0 || s == e) - baud = 38400; + baud = DEFAULT_BAUD; } divisor = 115200 / baud; @@ -154,8 +162,9 @@ char buf[512]; int n; va_list ap; + va_start(ap,fmt); - n = vsnprintf(buf,512,fmt,ap); + n = vscnprintf(buf,512,fmt,ap); early_console->write(early_console,buf,n); va_end(ap); } @@ -170,6 +179,8 @@ if (early_console_initialized) return -1; + opt = strchr(opt, '=') + 1; + strlcpy(buf,opt,sizeof(buf)); space = strchr(buf, ' '); if (space) @@ -200,19 +211,12 @@ if (!early_console_initialized || !early_console) return; if (!keep_early) { - printk("disabling early console...\n"); + printk("disabling early console\n"); unregister_console(early_console); early_console_initialized = 0; } else { - printk("keeping early console.\n"); + printk("keeping early console\n"); } } -/* syntax: earlyprintk=vga - earlyprintk=serial[,ttySn[,baudrate]] - Append ,keep to not disable it when the real console takes over. - Only vga or serial at a time, not both. - Currently only ttyS0 and ttyS1 are supported. - Interaction with the standard serial driver is not very good. - The VGA output is eventually overwritten by the real console. */ -__setup("earlyprintk=", setup_early_printk); +__setup("earlyprintk=", setup_early_printk); --- diff/arch/x86_64/kernel/head64.c 2003-05-21 11:50:00.000000000 +0100 +++ source/arch/x86_64/kernel/head64.c 2004-02-18 09:03:58.000000000 +0000 @@ -83,9 +83,9 @@ /* default console: */ if (!strstr(saved_command_line, "console=")) strcat(saved_command_line, " console=tty0"); - s = strstr(saved_command_line, "earlyprintk="); + s = strstr(saved_command_line, "earlyprintk="); if (s != NULL) - setup_early_printk(s+12); + setup_early_printk(s); #ifdef CONFIG_DISCONTIGMEM s = strstr(saved_command_line, "numa="); if (s != NULL) --- diff/arch/x86_64/kernel/irq.c 2004-01-19 10:22:55.000000000 +0000 +++ source/arch/x86_64/kernel/irq.c 2004-02-18 09:03:58.000000000 +0000 @@ -405,6 +405,9 @@ spin_unlock(&desc->lock); irq_exit(); + + kgdb_process_breakpoint(); + return 1; } @@ -826,7 +829,7 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, irq_affinity[(long)data]); + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); @@ -864,7 +867,7 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { - int len = cpumask_snprintf(page, count, *(cpumask_t *)data); + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); --- diff/arch/x86_64/kernel/smp.c 2003-11-25 15:24:57.000000000 +0000 +++ source/arch/x86_64/kernel/smp.c 2004-02-18 09:03:58.000000000 +0000 @@ -362,6 +362,18 @@ send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR); } +#ifdef CONFIG_KGDB +/* + * By using the NMI code instead of a vector we just sneak thru the + * word generator coming out with just what we want. AND it does + * not matter if clustered_apic_mode is set or not. + */ +void smp_send_nmi_allbutself(void) +{ + send_IPI_allbutself(APIC_DM_NMI); +} +#endif + /* * Structure and data for smp_call_function(). This is designed to minimise * static memory requirements. It also looks cleaner. --- diff/arch/x86_64/kernel/sys_x86_64.c 2004-02-18 08:54:08.000000000 +0000 +++ source/arch/x86_64/kernel/sys_x86_64.c 2004-02-18 09:03:58.000000000 +0000 @@ -4,6 +4,7 @@ #include #include +#include #include #include #include --- diff/arch/x86_64/kernel/traps.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/x86_64/kernel/traps.c 2004-02-18 09:03:58.000000000 +0000 @@ -45,6 +45,9 @@ #include #include +#ifdef CONFIG_KGDB +#include +#endif extern struct gate_struct idt_table[256]; --- diff/arch/x86_64/kernel/x8664_ksyms.c 2004-02-09 10:36:09.000000000 +0000 +++ source/arch/x86_64/kernel/x8664_ksyms.c 2004-02-18 09:03:58.000000000 +0000 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -180,8 +181,6 @@ EXPORT_SYMBOL_NOVERS(__memcpy); /* syscall export needed for misdesigned sound drivers. */ -extern ssize_t sys_read(unsigned int fd, char * buf, size_t count); -extern off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin); EXPORT_SYMBOL(sys_read); EXPORT_SYMBOL(sys_lseek); EXPORT_SYMBOL(sys_open); --- diff/arch/x86_64/lib/Makefile 2003-06-30 10:07:20.000000000 +0100 +++ source/arch/x86_64/lib/Makefile 2004-02-18 09:03:58.000000000 +0000 @@ -11,3 +11,4 @@ lib-$(CONFIG_IO_DEBUG) += iodebug.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o +lib-$(CONFIG_KGDB) += kgdb_serial.o --- diff/drivers/Makefile 2003-09-17 12:28:03.000000000 +0100 +++ source/drivers/Makefile 2004-02-18 09:04:00.000000000 +0000 @@ -45,7 +45,7 @@ obj-$(CONFIG_PHONE) += telephony/ obj-$(CONFIG_MD) += md/ obj-$(CONFIG_BT) += bluetooth/ -obj-$(CONFIG_ISDN_BOOL) += isdn/ +obj-$(CONFIG_ISDN) += isdn/ obj-$(CONFIG_MCA) += mca/ obj-$(CONFIG_EISA) += eisa/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ --- diff/drivers/acpi/Kconfig 2004-02-18 08:54:08.000000000 +0000 +++ source/drivers/acpi/Kconfig 2004-02-18 09:03:58.000000000 +0000 @@ -263,5 +263,23 @@ particular, many Toshiba laptops require this for correct operation of the AC module. +config X86_PM_TIMER + bool "Power Management Timer Support" + depends on X86 && ACPI + depends on ACPI_BOOT && EXPERIMENTAL + default n + help + The Power Management Timer is available on all ACPI-capable, + in most cases even if ACPI is unusable or blacklisted. + + This timing source is not affected by powermanagement features + like aggressive processor idling, throttling, frequency and/or + voltage scaling, unlike the commonly used Time Stamp Counter + (TSC) timing source. + + So, if you see messages like 'Losing too many ticks!' in the + kernel logs, and/or you are using a this on a notebook which + does not yet have an HPET, you should say "Y" here. + endmenu --- diff/drivers/acpi/dispatcher/dsmthdat.c 2004-02-09 10:36:09.000000000 +0000 +++ source/drivers/acpi/dispatcher/dsmthdat.c 2004-02-18 09:03:58.000000000 +0000 @@ -206,8 +206,7 @@ * Store the argument in the method/walk descriptor. * Do not copy the arg in order to implement call by reference */ - status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], - walk_state); + status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], walk_state); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -465,6 +464,7 @@ return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); default: + ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode)); return_ACPI_STATUS (AE_AML_INTERNAL); } } @@ -597,7 +597,10 @@ /* * If the reference count on the object is more than one, we must - * take a copy of the object before we store. + * take a copy of the object before we store. A reference count + * of exactly 1 means that the object was just created during the + * evaluation of an expression, and we can safely use it since it + * is not used anywhere else. */ new_obj_desc = obj_desc; if (obj_desc->common.reference_count > 1) { --- diff/drivers/acpi/dispatcher/dsobject.c 2004-02-09 10:36:09.000000000 +0000 +++ source/drivers/acpi/dispatcher/dsobject.c 2004-02-18 09:03:58.000000000 +0000 @@ -582,6 +582,11 @@ obj_desc->reference.opcode = AML_ARG_OP; obj_desc->reference.offset = opcode - AML_ARG_OP; + +#ifndef ACPI_NO_METHOD_EXECUTION + status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset, + walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); +#endif break; default: /* Other literals, etc.. */ --- diff/drivers/acpi/dispatcher/dsopcode.c 2004-02-09 10:36:09.000000000 +0000 +++ source/drivers/acpi/dispatcher/dsopcode.c 2004-02-18 09:03:58.000000000 +0000 @@ -243,8 +243,8 @@ node = obj_desc->buffer.node; if (!node) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "No pointer back to NS node in buffer %p\n", obj_desc)); + ACPI_REPORT_ERROR (( + "No pointer back to NS node in buffer obj %p\n", obj_desc)); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -290,7 +290,7 @@ node = obj_desc->package.node; if (!node) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + ACPI_REPORT_ERROR (( "No pointer back to NS node in package %p\n", obj_desc)); return_ACPI_STATUS (AE_AML_INTERNAL); } --- diff/drivers/acpi/dispatcher/dsutils.c 2004-02-09 10:36:09.000000000 +0000 +++ source/drivers/acpi/dispatcher/dsutils.c 2004-02-18 09:03:58.000000000 +0000 @@ -280,7 +280,8 @@ /* * Attempt to resolve each of the valid operands - * Method arguments are passed by value, not by reference + * Method arguments are passed by reference, not by value. This means + * that the actual objects are passed, not copies of the objects. */ for (i = 0; i < walk_state->num_operands; i++) { status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state); --- diff/drivers/acpi/dispatcher/dswstate.c 2004-02-09 10:36:09.000000000 +0000 +++ source/drivers/acpi/dispatcher/dswstate.c 2004-02-18 09:03:58.000000000 +0000 @@ -328,7 +328,7 @@ state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result stack frame\n")); + ACPI_REPORT_ERROR (("No result stack frame during push\n")); return (AE_AML_INTERNAL); } --- diff/drivers/acpi/executer/exconvrt.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exconvrt.c 2004-02-18 09:03:58.000000000 +0000 @@ -55,8 +55,9 @@ * * FUNCTION: acpi_ex_convert_to_integer * - * PARAMETERS: *obj_desc - Object to be converted. Must be an + * PARAMETERS: obj_desc - Object to be converted. Must be an * Integer, Buffer, or String + * result_desc - Where the new Integer object is returned * walk_state - Current method state * * RETURN: Status @@ -189,8 +190,9 @@ * * FUNCTION: acpi_ex_convert_to_buffer * - * PARAMETERS: *obj_desc - Object to be converted. Must be an + * PARAMETERS: obj_desc - Object to be converted. Must be an * Integer, Buffer, or String + * result_desc - Where the new buffer object is returned * walk_state - Current method state * * RETURN: Status @@ -319,6 +321,7 @@ ACPI_FUNCTION_ENTRY (); + if (data_width < sizeof (acpi_integer)) { leading_zero = FALSE; length = data_width; @@ -328,22 +331,21 @@ length = sizeof (acpi_integer); } - switch (base) { case 10: remainder = 0; - for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0 ; i--) { + for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0; i--) { /* Divide by nth factor of 10 */ digit = integer; - for (j = 1; j < i; j++) { + for (j = 0; j < i; j++) { (void) acpi_ut_short_divide (&digit, 10, &digit, &remainder); } /* Create the decimal digit */ - if (digit != 0) { + if (remainder != 0) { leading_zero = FALSE; } @@ -354,6 +356,7 @@ } break; + case 16: /* Copy the integer to the buffer */ @@ -372,13 +375,14 @@ } break; + default: break; } /* * Since leading zeros are supressed, we must check for the case where - * the integer equals 0. + * the integer equals 0 * * Finally, null terminate the string and return the length */ @@ -396,8 +400,11 @@ * * FUNCTION: acpi_ex_convert_to_string * - * PARAMETERS: *obj_desc - Object to be converted. Must be an - * Integer, Buffer, or String + * PARAMETERS: obj_desc - Object to be converted. Must be an + * Integer, Buffer, or String + * result_desc - Where the string object is returned + * Base - 10 or 16 + * max_length - Max length of the returned string * walk_state - Current method state * * RETURN: Status @@ -415,10 +422,10 @@ struct acpi_walk_state *walk_state) { union acpi_operand_object *ret_desc; - u32 i; - u32 string_length; u8 *new_buf; u8 *pointer; + u32 string_length; + u32 i; ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_string", obj_desc); @@ -539,7 +546,6 @@ return_ACPI_STATUS (AE_TYPE); } - /* * If we are about to overwrite the original object on the operand stack, * we must remove a reference on the original object because we are @@ -562,6 +568,7 @@ * * PARAMETERS: destination_type - Current type of the destination * source_desc - Source object to be converted. + * result_desc - Where the converted object is returned * walk_state - Current method state * * RETURN: Status @@ -653,6 +660,8 @@ default: + ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n", + destination_type)); status = AE_AML_INTERNAL; break; } @@ -672,6 +681,8 @@ GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args), walk_state->op_info->name, acpi_ut_get_type_name (destination_type))); + ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n", + GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args))) status = AE_AML_INTERNAL; } --- diff/drivers/acpi/executer/exfldio.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exfldio.c 2004-02-18 09:03:58.000000000 +0000 @@ -507,8 +507,8 @@ default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, Wrong object type - %s\n", - obj_desc, acpi_ut_get_object_type_name (obj_desc))); + ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n", + ACPI_GET_OBJECT_TYPE (obj_desc))); status = AE_AML_INTERNAL; break; } --- diff/drivers/acpi/executer/exmisc.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exmisc.c 2004-02-18 09:03:58.000000000 +0000 @@ -103,7 +103,7 @@ default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %X\n", + ACPI_REPORT_ERROR (("Unknown Reference subtype in get ref %X\n", obj_desc->reference.opcode)); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -121,8 +121,8 @@ default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p has invalid descriptor [%s]\n", - obj_desc, acpi_ut_get_descriptor_name (obj_desc))); + ACPI_REPORT_ERROR (("Invalid descriptor type in get ref: %X\n", + ACPI_GET_DESCRIPTOR_TYPE (obj_desc))); return_ACPI_STATUS (AE_TYPE); } @@ -349,6 +349,8 @@ /* Invalid object type, should not happen here */ + ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n", + ACPI_GET_OBJECT_TYPE (obj_desc1))); status = AE_AML_INTERNAL; return_desc = NULL; } --- diff/drivers/acpi/executer/exoparg2.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exoparg2.c 2004-02-18 09:03:58.000000000 +0000 @@ -329,6 +329,8 @@ break; default: + ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n", + ACPI_GET_OBJECT_TYPE (operand[0]))); status = AE_AML_INTERNAL; } @@ -433,7 +435,7 @@ } return_desc->reference.target_type = ACPI_TYPE_PACKAGE; - return_desc->reference.object = operand[0]->package.elements [index]; + return_desc->reference.object = operand[0]; return_desc->reference.where = &operand[0]->package.elements [index]; } else { --- diff/drivers/acpi/executer/exprep.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exprep.c 2004-02-18 09:03:58.000000000 +0000 @@ -507,7 +507,7 @@ (info->field_bit_position / ACPI_MUL_8 (obj_desc->field.access_byte_width)); if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Index Object\n")); + ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); return_ACPI_STATUS (AE_AML_INTERNAL); } --- diff/drivers/acpi/executer/exresolv.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exresolv.c 2004-02-18 09:03:58.000000000 +0000 @@ -238,8 +238,8 @@ /* Invalid reference object */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown target_type %X in Index/Reference obj %p\n", + ACPI_REPORT_ERROR (( + "During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); status = AE_AML_INTERNAL; break; @@ -258,7 +258,7 @@ default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X (%s) in %p\n", + ACPI_REPORT_ERROR (("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); status = AE_AML_INTERNAL; break; --- diff/drivers/acpi/executer/exresop.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exresop.c 2004-02-18 09:03:58.000000000 +0000 @@ -154,7 +154,7 @@ arg_types = op_info->runtime_args; if (arg_types == ARGI_INVALID_OPCODE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - %X is not a valid AML opcode\n", + ACPI_REPORT_ERROR (("resolve_operands: %X is not a valid AML opcode\n", opcode)); return_ACPI_STATUS (AE_AML_INTERNAL); @@ -172,7 +172,7 @@ */ while (GET_CURRENT_ARG_TYPE (arg_types)) { if (!stack_ptr || !*stack_ptr) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null stack entry at %p\n", + ACPI_REPORT_ERROR (("resolve_operands: Null stack entry at %p\n", stack_ptr)); return_ACPI_STATUS (AE_AML_INTERNAL); --- diff/drivers/acpi/executer/exstore.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exstore.c 2004-02-18 09:03:58.000000000 +0000 @@ -125,7 +125,7 @@ default: - /* Destination is not an Reference */ + /* Destination is not a Reference object */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Destination is not a Reference or Constant object [%p]\n", dest_desc)); @@ -189,35 +189,38 @@ switch (ACPI_GET_OBJECT_TYPE (source_desc)) { case ACPI_TYPE_INTEGER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (source_desc->integer.value))); break; case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length %.2X\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X", (u32) source_desc->buffer.length)); + ACPI_DUMP_BUFFER (source_desc->buffer.pointer, + (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); break; case ACPI_TYPE_STRING: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s\n", source_desc->string.pointer)); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X, \"%s\"\n", + source_desc->string.length, source_desc->string.pointer)); break; case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements Ptr - %p\n", - source_desc->package.elements)); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Size 0x%.2X Elements Ptr - %p\n", + source_desc->package.count, source_desc->package.elements)); break; default: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Type %s %p\n", - acpi_ut_get_object_type_name (source_desc), source_desc)); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", + source_desc)); break; } @@ -227,7 +230,7 @@ default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X\n", + ACPI_REPORT_ERROR (("ex_store: Unknown Reference opcode %X\n", ref_desc->reference.opcode)); ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR); @@ -263,6 +266,7 @@ union acpi_operand_object *obj_desc; union acpi_operand_object *new_desc; u8 value = 0; + u32 i; ACPI_FUNCTION_TRACE ("ex_store_object_to_index"); @@ -283,6 +287,7 @@ /* * The object at *(index_desc->Reference.Where) is the * element within the package that is to be modified. + * The parent package object is at index_desc->Reference.Object */ obj_desc = *(index_desc->reference.where); @@ -309,6 +314,12 @@ if (new_desc == source_desc) { acpi_ut_add_reference (new_desc); } + + /* Increment reference count by the ref count of the parent package -1 */ + + for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { + acpi_ut_add_reference (new_desc); + } } break; --- diff/drivers/acpi/executer/exstoren.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/executer/exstoren.c 2004-02-18 09:03:58.000000000 +0000 @@ -112,6 +112,12 @@ } } + /* For copy_object, no further validation necessary */ + + if (walk_state->opcode == AML_COPY_OP) { + break; + } + /* * Must have a Integer, Buffer, or String */ @@ -136,7 +142,7 @@ /* * Aliases are resolved by acpi_ex_prep_operands */ - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into Alias - should never happen\n")); + ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); status = AE_AML_INTERNAL; break; --- diff/drivers/acpi/namespace/nsaccess.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/namespace/nsaccess.c 2004-02-18 09:03:58.000000000 +0000 @@ -314,7 +314,7 @@ else { prefix_node = scope_info->scope.node; if (ACPI_GET_DESCRIPTOR_TYPE (prefix_node) != ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p Not a namespace node [%s]\n", + ACPI_REPORT_ERROR (("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name (prefix_node))); return_ACPI_STATUS (AE_AML_INTERNAL); } --- diff/drivers/acpi/parser/psargs.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/acpi/parser/psargs.c 2004-02-18 09:03:58.000000000 +0000 @@ -315,8 +315,8 @@ acpi_ps_append_arg (arg, name_op); if (!method_desc) { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Control Method - %p has no attached object\n", + ACPI_REPORT_ERROR (( + "ps_get_next_namepath: Control Method %p has no attached object\n", node)); return_ACPI_STATUS (AE_AML_INTERNAL); } --- diff/drivers/acpi/tables.c 2004-02-18 08:54:08.000000000 +0000 +++ source/drivers/acpi/tables.c 2004-02-18 09:03:58.000000000 +0000 @@ -58,6 +58,7 @@ [ACPI_SSDT] = "SSDT", [ACPI_SPMI] = "SPMI", [ACPI_HPET] = "HPET", + [ACPI_MCFG] = "MCFG", }; static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" }; --- diff/drivers/base/Makefile 2004-02-18 08:54:08.000000000 +0000 +++ source/drivers/base/Makefile 2004-02-18 09:03:58.000000000 +0000 @@ -2,7 +2,8 @@ obj-y := core.o sys.o interface.o bus.o \ driver.o class.o class_simple.o platform.o \ - cpu.o firmware.o init.o map.o dmapool.o + cpu.o firmware.o init.o map.o +obj-$(CONFIG_PCI) += dmapool.o obj-y += power/ obj-$(CONFIG_FW_LOADER) += firmware_class.o obj-$(CONFIG_NUMA) += node.o --- diff/drivers/base/cpu.c 2003-10-27 09:20:43.000000000 +0000 +++ source/drivers/base/cpu.c 2004-02-18 09:03:58.000000000 +0000 @@ -7,6 +7,7 @@ #include #include #include +#include struct sysdev_class cpu_sysdev_class = { @@ -14,6 +15,46 @@ }; EXPORT_SYMBOL(cpu_sysdev_class); +#ifdef CONFIG_HOTPLUG_CPU +static ssize_t show_online(struct sys_device *dev, char *buf) +{ + struct cpu *cpu = container_of(dev, struct cpu, sysdev); + + return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); +} + +static ssize_t store_online(struct sys_device *dev, const char *buf, + size_t count) +{ + struct cpu *cpu = container_of(dev, struct cpu, sysdev); + ssize_t ret; + + switch (buf[0]) { + case '0': + ret = cpu_down(cpu->sysdev.id); + break; + case '1': + ret = cpu_up(cpu->sysdev.id); + break; + default: + ret = -EINVAL; + } + + if (ret >= 0) + ret = count; + return ret; +} +static SYSDEV_ATTR(online, 0600, show_online, store_online); + +static void __init register_cpu_control(struct cpu *cpu) +{ + sysdev_create_file(&cpu->sysdev, &attr_online); +} +#else /* ... !CONFIG_HOTPLUG_CPU */ +static void __init register_cpu_control(struct cpu *cpu) +{ +} +#endif /* CONFIG_HOTPLUG_CPU */ /* * register_cpu - Setup a driverfs device for a CPU. @@ -34,6 +75,8 @@ error = sysfs_create_link(&root->sysdev.kobj, &cpu->sysdev.kobj, kobject_name(&cpu->sysdev.kobj)); + if (!error) + register_cpu_control(cpu); return error; } --- diff/drivers/base/dmapool.c 2004-02-18 08:54:08.000000000 +0000 +++ source/drivers/base/dmapool.c 2004-02-18 09:03:58.000000000 +0000 @@ -52,7 +52,7 @@ next = buf; size = PAGE_SIZE; - temp = snprintf (next, size, "poolinfo - 0.1\n"); + temp = scnprintf(next, size, "poolinfo - 0.1\n"); size -= temp; next += temp; @@ -67,7 +67,7 @@ } /* per-pool info, no real statistics yet */ - temp = snprintf (next, size, "%-16s %4u %4Zu %4Zu %2u\n", + temp = scnprintf(next, size, "%-16s %4u %4Zu %4Zu %2u\n", pool->name, blocks, pages * pool->blocks_per_page, pool->size, pages); --- diff/drivers/base/node.c 2004-01-19 10:22:55.000000000 +0000 +++ source/drivers/base/node.c 2004-02-18 09:03:58.000000000 +0000 @@ -23,7 +23,7 @@ /* FIXME - someone should pass us a buffer size (count) or * use seq_file or something to avoid buffer overrun risk. */ - len = cpumask_snprintf(buf, 99 /* XXX FIXME */, mask); + len = cpumask_scnprintf(buf, 99 /* XXX FIXME */, mask); len += sprintf(buf + len, "\n"); return len; } --- diff/drivers/block/Kconfig.iosched 2003-10-09 09:47:16.000000000 +0100 +++ source/drivers/block/Kconfig.iosched 2004-02-18 09:03:58.000000000 +0000 @@ -27,3 +27,10 @@ a disk at any one time, its behaviour is almost identical to the anticipatory I/O scheduler and so is a good choice. +config IOSCHED_CFQ + bool "CFQ I/O scheduler" if EMBEDDED + default y + ---help--- + The CFQ I/O scheduler tries to distribute bandwidth equally + among all processes in the system. It should provide a fair + working environment, suitable for desktop systems. --- diff/drivers/block/Makefile 2003-10-27 09:20:37.000000000 +0000 +++ source/drivers/block/Makefile 2004-02-18 09:03:58.000000000 +0000 @@ -18,6 +18,7 @@ obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o obj-$(CONFIG_IOSCHED_AS) += as-iosched.o obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o +obj-$(CONFIG_IOSCHED_CFQ) += cfq-iosched.o obj-$(CONFIG_MAC_FLOPPY) += swim3.o obj-$(CONFIG_BLK_DEV_FD) += floppy.o obj-$(CONFIG_BLK_DEV_FD98) += floppy98.o --- diff/drivers/block/cryptoloop.c 2003-08-26 10:00:52.000000000 +0100 +++ source/drivers/block/cryptoloop.c 2004-02-18 09:03:58.000000000 +0000 @@ -87,43 +87,49 @@ static int -cryptoloop_transfer_ecb(struct loop_device *lo, int cmd, char *raw_buf, - char *loop_buf, int size, sector_t IV) +cryptoloop_transfer_ecb(struct loop_device *lo, int cmd, + struct page *raw_page, unsigned raw_off, + struct page *loop_page, unsigned loop_off, + int size, sector_t IV) { struct crypto_tfm *tfm = (struct crypto_tfm *) lo->key_data; struct scatterlist sg_out = { 0, }; struct scatterlist sg_in = { 0, }; encdec_ecb_t encdecfunc; - char const *in; - char *out; + struct page *in_page, *out_page; + unsigned in_offs, out_offs; if (cmd == READ) { - in = raw_buf; - out = loop_buf; + in_page = raw_page; + in_offs = raw_off; + out_page = loop_page; + out_offs = loop_off; encdecfunc = tfm->crt_u.cipher.cit_decrypt; } else { - in = loop_buf; - out = raw_buf; + in_page = loop_page; + in_offs = loop_off; + out_page = raw_page; + out_offs = raw_off; encdecfunc = tfm->crt_u.cipher.cit_encrypt; } while (size > 0) { const int sz = min(size, LOOP_IV_SECTOR_SIZE); - sg_in.page = virt_to_page(in); - sg_in.offset = (unsigned long)in & ~PAGE_MASK; + sg_in.page = in_page; + sg_in.offset = in_offs; sg_in.length = sz; - sg_out.page = virt_to_page(out); - sg_out.offset = (unsigned long)out & ~PAGE_MASK; + sg_out.page = out_page; + sg_out.offset = out_offs; sg_out.length = sz; encdecfunc(tfm, &sg_out, &sg_in, sz); size -= sz; - in += sz; - out += sz; + in_offs += sz; + out_offs += sz; } return 0; @@ -135,24 +141,30 @@ unsigned int nsg, u8 *iv); static int -cryptoloop_transfer_cbc(struct loop_device *lo, int cmd, char *raw_buf, - char *loop_buf, int size, sector_t IV) +cryptoloop_transfer_cbc(struct loop_device *lo, int cmd, + struct page *raw_page, unsigned raw_off, + struct page *loop_page, unsigned loop_off, + int size, sector_t IV) { struct crypto_tfm *tfm = (struct crypto_tfm *) lo->key_data; struct scatterlist sg_out = { 0, }; struct scatterlist sg_in = { 0, }; encdec_cbc_t encdecfunc; - char const *in; - char *out; + struct page *in_page, *out_page; + unsigned in_offs, out_offs; if (cmd == READ) { - in = raw_buf; - out = loop_buf; + in_page = raw_page; + in_offs = raw_off; + out_page = loop_page; + out_offs = loop_off; encdecfunc = tfm->crt_u.cipher.cit_decrypt_iv; } else { - in = loop_buf; - out = raw_buf; + in_page = loop_page; + in_offs = loop_off; + out_page = raw_page; + out_offs = raw_off; encdecfunc = tfm->crt_u.cipher.cit_encrypt_iv; } @@ -161,39 +173,43 @@ u32 iv[4] = { 0, }; iv[0] = cpu_to_le32(IV & 0xffffffff); - sg_in.page = virt_to_page(in); - sg_in.offset = offset_in_page(in); + sg_in.page = in_page; + sg_in.offset = in_offs; sg_in.length = sz; - sg_out.page = virt_to_page(out); - sg_out.offset = offset_in_page(out); + sg_out.page = out_page; + sg_out.offset = out_offs; sg_out.length = sz; encdecfunc(tfm, &sg_out, &sg_in, sz, (u8 *)iv); IV++; size -= sz; - in += sz; - out += sz; + in_offs += sz; + out_offs += sz; } return 0; } static int -cryptoloop_transfer(struct loop_device *lo, int cmd, char *raw_buf, - char *loop_buf, int size, sector_t IV) +cryptoloop_transfer(struct loop_device *lo, int cmd, + struct page *raw_page, unsigned raw_off, + struct page *loop_page, unsigned loop_off, + int size, sector_t IV) { struct crypto_tfm *tfm = (struct crypto_tfm *) lo->key_data; if(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB) { lo->transfer = cryptoloop_transfer_ecb; - return cryptoloop_transfer_ecb(lo, cmd, raw_buf, loop_buf, size, IV); + return cryptoloop_transfer_ecb(lo, cmd, raw_page, raw_off, + loop_page, loop_off, size, IV); } if(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_CBC) { lo->transfer = cryptoloop_transfer_cbc; - return cryptoloop_transfer_cbc(lo, cmd, raw_buf, loop_buf, size, IV); + return cryptoloop_transfer_cbc(lo, cmd, raw_page, raw_off, + loop_page, loop_off, size, IV); } /* This is not supposed to happen */ --- diff/drivers/block/genhd.c 2004-02-18 08:54:08.000000000 +0000 +++ source/drivers/block/genhd.c 2004-02-18 09:03:58.000000000 +0000 @@ -262,8 +262,9 @@ /* Don't show non-partitionable removeable devices or empty devices */ if (!get_capacity(sgp) || - (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)) - ) + (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE))) + return 0; + if (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO) return 0; /* show the full disk and all non-0 size partitions of it */ --- diff/drivers/block/ll_rw_blk.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/block/ll_rw_blk.c 2004-02-18 09:03:58.000000000 +0000 @@ -27,6 +27,7 @@ #include #include #include +#include static void blk_unplug_work(void *data); static void blk_unplug_timeout(unsigned long data); @@ -521,10 +522,10 @@ { int bits, i; - if (depth > q->nr_requests * 2) { - depth = q->nr_requests * 2; - printk(KERN_ERR "%s: adjusted depth to %d\n", - __FUNCTION__, depth); + if (depth > q->nr_requests / 2) { + q->nr_requests = depth * 2; + printk(KERN_INFO "%s: large TCQ depth: adjusted nr_requests " + "to %lu\n", __FUNCTION__, q->nr_requests); } tags->tag_index = kmalloc(depth * sizeof(struct request *), GFP_ATOMIC); @@ -1334,6 +1335,8 @@ &iosched_as; #elif defined(CONFIG_IOSCHED_DEADLINE) &iosched_deadline; +#elif defined(CONFIG_IOSCHED_CFQ) + &iosched_cfq; #elif defined(CONFIG_IOSCHED_NOOP) &elevator_noop; #else @@ -1352,6 +1355,10 @@ if (!strcmp(str, "as")) chosen_elevator = &iosched_as; #endif +#ifdef CONFIG_IOSCHED_CFQ + if (!strcmp(str, "cfq")) + chosen_elevator = &iosched_cfq; +#endif #ifdef CONFIG_IOSCHED_NOOP if (!strcmp(str, "noop")) chosen_elevator = &elevator_noop; @@ -1884,18 +1891,22 @@ * Waits for up to @timeout jiffies for a queue (any queue) to exit congestion. * If no queues are congested then just wait for the next request to be * returned. + * + * Returns the number of jiffies remaining, this is zero, unless we returned + * before @timeout expired. */ -void blk_congestion_wait(int rw, long timeout) +long blk_congestion_wait(int rw, long timeout) { + long ret; DEFINE_WAIT(wait); wait_queue_head_t *wqh = &congestion_wqh[rw]; blk_run_queues(); prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); - io_schedule_timeout(timeout); + ret = io_schedule_timeout(timeout); finish_wait(wqh, &wait); + return ret; } - EXPORT_SYMBOL(blk_congestion_wait); /* @@ -2305,6 +2316,15 @@ mod_page_state(pgpgout, count); else mod_page_state(pgpgin, count); + + if (unlikely(block_dump)) { + char b[BDEVNAME_SIZE]; + printk("%s(%d): %s block %Lu on %s\n", + current->comm, current->pid, + (rw & WRITE) ? "WRITE" : "READ", + (unsigned long long)bio->bi_sector, bdevname(bio->bi_bdev,b)); + } + generic_make_request(bio); return 1; } @@ -2592,10 +2612,22 @@ unsigned long duration = jiffies - req->start_time; switch (rq_data_dir(req)) { case WRITE: + /* + * schedule the writeout of pending dirty data when the disk is idle. + * (Writeback is not postponed by writes, only by reads.) + */ + if (unlikely(laptop_mode)) + disk_is_spun_up(0); disk_stat_inc(disk, writes); disk_stat_add(disk, write_ticks, duration); break; case READ: + /* + * schedule the writeout of pending dirty data when the disk is idle. + * (postpone writeback until system is quiescent again.) + */ + if (unlikely(laptop_mode)) + disk_is_spun_up(1); disk_stat_inc(disk, reads); disk_stat_add(disk, read_ticks, duration); break; --- diff/drivers/block/loop.c 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/block/loop.c 2004-02-18 09:03:58.000000000 +0000 @@ -76,24 +76,34 @@ /* * Transfer functions */ -static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf, - char *loop_buf, int size, sector_t real_block) +static int transfer_none(struct loop_device *lo, int cmd, + struct page *raw_page, unsigned raw_off, + struct page *loop_page, unsigned loop_off, + int size, sector_t real_block) { - if (raw_buf != loop_buf) { - if (cmd == READ) - memcpy(loop_buf, raw_buf, size); - else - memcpy(raw_buf, loop_buf, size); - } + char *raw_buf = kmap_atomic(raw_page, KM_USER0) + raw_off; + char *loop_buf = kmap_atomic(loop_page, KM_USER1) + loop_off; + + if (cmd == READ) + memcpy(loop_buf, raw_buf, size); + else + memcpy(raw_buf, loop_buf, size); + kunmap_atomic(raw_buf, KM_USER0); + kunmap_atomic(loop_buf, KM_USER1); + cond_resched(); return 0; } -static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf, - char *loop_buf, int size, sector_t real_block) +static int transfer_xor(struct loop_device *lo, int cmd, + struct page *raw_page, unsigned raw_off, + struct page *loop_page, unsigned loop_off, + int size, sector_t real_block) { - char *in, *out, *key; - int i, keysize; + char *raw_buf = kmap_atomic(raw_page, KM_USER0) + raw_off; + char *loop_buf = kmap_atomic(loop_page, KM_USER1) + loop_off; + char *in, *out, *key; + int i, keysize; if (cmd == READ) { in = raw_buf; @@ -107,6 +117,10 @@ keysize = lo->lo_encrypt_key_size; for (i = 0; i < size; i++) *out++ = *in++ ^ key[(i & 511) % keysize]; + + kunmap_atomic(raw_buf, KM_USER0); + kunmap_atomic(loop_buf, KM_USER1); + cond_resched(); return 0; } @@ -162,13 +176,15 @@ } static inline int -lo_do_transfer(struct loop_device *lo, int cmd, char *rbuf, - char *lbuf, int size, sector_t rblock) +lo_do_transfer(struct loop_device *lo, int cmd, + struct page *rpage, unsigned roffs, + struct page *lpage, unsigned loffs, + int size, sector_t rblock) { if (!lo->transfer) return 0; - return lo->transfer(lo, cmd, rbuf, lbuf, size, rblock); + return lo->transfer(lo, cmd, rpage, roffs, lpage, loffs, size, rblock); } static int @@ -178,16 +194,15 @@ struct address_space *mapping = file->f_mapping; struct address_space_operations *aops = mapping->a_ops; struct page *page; - char *kaddr, *data; pgoff_t index; - unsigned size, offset; + unsigned size, offset, bv_offs; int len; int ret = 0; down(&mapping->host->i_sem); index = pos >> PAGE_CACHE_SHIFT; offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1); - data = kmap(bvec->bv_page) + bvec->bv_offset; + bv_offs = bvec->bv_offset; len = bvec->bv_len; while (len > 0) { sector_t IV; @@ -204,25 +219,28 @@ goto fail; if (aops->prepare_write(file, page, offset, offset+size)) goto unlock; - kaddr = kmap(page); - transfer_result = lo_do_transfer(lo, WRITE, kaddr + offset, - data, size, IV); + transfer_result = lo_do_transfer(lo, WRITE, page, offset, + bvec->bv_page, bv_offs, + size, IV); if (transfer_result) { + char *kaddr; + /* * The transfer failed, but we still write the data to * keep prepare/commit calls balanced. */ printk(KERN_ERR "loop: transfer error block %llu\n", (unsigned long long)index); + kaddr = kmap_atomic(page, KM_USER0); memset(kaddr + offset, 0, size); + kunmap_atomic(kaddr, KM_USER0); } flush_dcache_page(page); - kunmap(page); if (aops->commit_write(file, page, offset, offset+size)) goto unlock; if (transfer_result) goto unlock; - data += size; + bv_offs += size; len -= size; offset = 0; index++; @@ -232,7 +250,6 @@ } up(&mapping->host->i_sem); out: - kunmap(bvec->bv_page); return ret; unlock: @@ -247,12 +264,10 @@ static int lo_send(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos) { - unsigned vecnr; - int ret = 0; - - for (vecnr = 0; vecnr < bio->bi_vcnt; vecnr++) { - struct bio_vec *bvec = &bio->bi_io_vec[vecnr]; + struct bio_vec *bvec; + int i, ret = 0; + bio_for_each_segment(bvec, bio, i) { ret = do_lo_send(lo, bvec, bsize, pos); if (ret < 0) break; @@ -263,7 +278,8 @@ struct lo_read_data { struct loop_device *lo; - char *data; + struct page *page; + unsigned offset; int bsize; }; @@ -271,7 +287,6 @@ lo_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset, unsigned long size) { - char *kaddr; unsigned long count = desc->count; struct lo_read_data *p = (struct lo_read_data*)desc->buf; struct loop_device *lo = p->lo; @@ -282,18 +297,16 @@ if (size > count) size = count; - kaddr = kmap(page); - if (lo_do_transfer(lo, READ, kaddr + offset, p->data, size, IV)) { + if (lo_do_transfer(lo, READ, page, offset, p->page, p->offset, size, IV)) { size = 0; printk(KERN_ERR "loop: transfer error block %ld\n", page->index); desc->error = -EINVAL; } - kunmap(page); desc->count = count - size; desc->written += size; - p->data += size; + p->offset += size; return size; } @@ -306,24 +319,22 @@ int retval; cookie.lo = lo; - cookie.data = kmap(bvec->bv_page) + bvec->bv_offset; + cookie.page = bvec->bv_page; + cookie.offset = bvec->bv_offset; cookie.bsize = bsize; file = lo->lo_backing_file; retval = file->f_op->sendfile(file, &pos, bvec->bv_len, lo_read_actor, &cookie); - kunmap(bvec->bv_page); return (retval < 0)? retval: 0; } static int lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos) { - unsigned vecnr; - int ret = 0; - - for (vecnr = 0; vecnr < bio->bi_vcnt; vecnr++) { - struct bio_vec *bvec = &bio->bi_io_vec[vecnr]; + struct bio_vec *bvec; + int i, ret = 0; + bio_for_each_segment(bvec, bio, i) { ret = do_lo_receive(lo, bvec, bsize, pos); if (ret < 0) break; @@ -345,23 +356,6 @@ return ret; } -static int loop_end_io_transfer(struct bio *, unsigned int, int); - -static void loop_put_buffer(struct bio *bio) -{ - /* - * check bi_end_io, may just be a remapped bio - */ - if (bio && bio->bi_end_io == loop_end_io_transfer) { - int i; - - for (i = 0; i < bio->bi_vcnt; i++) - __free_page(bio->bi_io_vec[i].bv_page); - - bio_put(bio); - } -} - /* * Add bio to back of pending list */ @@ -399,129 +393,8 @@ return bio; } -/* - * if this was a WRITE lo->transfer stuff has already been done. for READs, - * queue it for the loop thread and let it do the transfer out of - * bi_end_io context (we don't want to do decrypt of a page with irqs - * disabled) - */ -static int loop_end_io_transfer(struct bio *bio, unsigned int bytes_done, int err) -{ - struct bio *rbh = bio->bi_private; - struct loop_device *lo = rbh->bi_bdev->bd_disk->private_data; - - if (bio->bi_size) - return 1; - - if (err || bio_rw(bio) == WRITE) { - bio_endio(rbh, rbh->bi_size, err); - if (atomic_dec_and_test(&lo->lo_pending)) - up(&lo->lo_bh_mutex); - loop_put_buffer(bio); - } else - loop_add_bio(lo, bio); - - return 0; -} - -static struct bio *loop_copy_bio(struct bio *rbh) -{ - struct bio *bio; - struct bio_vec *bv; - int i; - - bio = bio_alloc(__GFP_NOWARN, rbh->bi_vcnt); - if (!bio) - return NULL; - - /* - * iterate iovec list and alloc pages - */ - __bio_for_each_segment(bv, rbh, i, 0) { - struct bio_vec *bbv = &bio->bi_io_vec[i]; - - bbv->bv_page = alloc_page(__GFP_NOWARN|__GFP_HIGHMEM); - if (bbv->bv_page == NULL) - goto oom; - - bbv->bv_len = bv->bv_len; - bbv->bv_offset = bv->bv_offset; - } - - bio->bi_vcnt = rbh->bi_vcnt; - bio->bi_size = rbh->bi_size; - - return bio; - -oom: - while (--i >= 0) - __free_page(bio->bi_io_vec[i].bv_page); - - bio_put(bio); - return NULL; -} - -static struct bio *loop_get_buffer(struct loop_device *lo, struct bio *rbh) -{ - struct bio *bio; - - /* - * When called on the page reclaim -> writepage path, this code can - * trivially consume all memory. So we drop PF_MEMALLOC to avoid - * stealing all the page reserves and throttle to the writeout rate. - * pdflush will have been woken by page reclaim. Let it do its work. - */ - do { - int flags = current->flags; - - current->flags &= ~PF_MEMALLOC; - bio = loop_copy_bio(rbh); - if (flags & PF_MEMALLOC) - current->flags |= PF_MEMALLOC; - - if (bio == NULL) - blk_congestion_wait(WRITE, HZ/10); - } while (bio == NULL); - - bio->bi_end_io = loop_end_io_transfer; - bio->bi_private = rbh; - bio->bi_sector = rbh->bi_sector + (lo->lo_offset >> 9); - bio->bi_rw = rbh->bi_rw; - bio->bi_bdev = lo->lo_device; - - return bio; -} - -static int loop_transfer_bio(struct loop_device *lo, - struct bio *to_bio, struct bio *from_bio) -{ - sector_t IV; - struct bio_vec *from_bvec, *to_bvec; - char *vto, *vfrom; - int ret = 0, i; - - IV = from_bio->bi_sector + (lo->lo_offset >> 9); - - __bio_for_each_segment(from_bvec, from_bio, i, 0) { - to_bvec = &to_bio->bi_io_vec[i]; - - kmap(from_bvec->bv_page); - kmap(to_bvec->bv_page); - vfrom = page_address(from_bvec->bv_page) + from_bvec->bv_offset; - vto = page_address(to_bvec->bv_page) + to_bvec->bv_offset; - ret |= lo_do_transfer(lo, bio_data_dir(to_bio), vto, vfrom, - from_bvec->bv_len, IV); - kunmap(from_bvec->bv_page); - kunmap(to_bvec->bv_page); - IV += from_bvec->bv_len >> 9; - } - - return ret; -} - static int loop_make_request(request_queue_t *q, struct bio *old_bio) { - struct bio *new_bio = NULL; struct loop_device *lo = q->queuedata; int rw = bio_rw(old_bio); @@ -543,31 +416,11 @@ printk(KERN_ERR "loop: unknown command (%x)\n", rw); goto err; } - - /* - * file backed, queue for loop_thread to handle - */ - if (lo->lo_flags & LO_FLAGS_DO_BMAP) { - loop_add_bio(lo, old_bio); - return 0; - } - - /* - * piggy old buffer on original, and submit for I/O - */ - new_bio = loop_get_buffer(lo, old_bio); - if (rw == WRITE) { - if (loop_transfer_bio(lo, new_bio, old_bio)) - goto err; - } - - generic_make_request(new_bio); + loop_add_bio(lo, old_bio); return 0; - err: if (atomic_dec_and_test(&lo->lo_pending)) up(&lo->lo_bh_mutex); - loop_put_buffer(new_bio); out: bio_io_error(old_bio, old_bio->bi_size); return 0; @@ -580,20 +433,8 @@ { int ret; - /* - * For block backed loop, we know this is a READ - */ - if (lo->lo_flags & LO_FLAGS_DO_BMAP) { - ret = do_bio_filebacked(lo, bio); - bio_endio(bio, bio->bi_size, ret); - } else { - struct bio *rbh = bio->bi_private; - - ret = loop_transfer_bio(lo, bio, rbh); - - bio_endio(rbh, rbh->bi_size, ret); - loop_put_buffer(bio); - } + ret = do_bio_filebacked(lo, bio); + bio_endio(bio, bio->bi_size, ret); } /* @@ -684,31 +525,23 @@ lo_flags |= LO_FLAGS_READ_ONLY; error = -EINVAL; - if (S_ISBLK(inode->i_mode)) { - lo_device = I_BDEV(inode); - if (lo_device == bdev) { - error = -EBUSY; - goto out_putf; - } - lo_blocksize = block_size(lo_device); - if (bdev_read_only(lo_device)) - lo_flags |= LO_FLAGS_READ_ONLY; - } else if (S_ISREG(inode->i_mode)) { + if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) { struct address_space_operations *aops = mapping->a_ops; /* * If we can't read - sorry. If we only can't write - well, * it's going to be read-only. */ - if (!inode->i_fop->sendfile) + if (!lo_file->f_op->sendfile) goto out_putf; if (!aops->prepare_write || !aops->commit_write) lo_flags |= LO_FLAGS_READ_ONLY; lo_blocksize = inode->i_blksize; - lo_flags |= LO_FLAGS_DO_BMAP; - } else + error = 0; + } else { goto out_putf; + } if (!(lo_file->f_mode & FMODE_WRITE)) lo_flags |= LO_FLAGS_READ_ONLY; @@ -738,21 +571,6 @@ blk_queue_make_request(lo->lo_queue, loop_make_request); lo->lo_queue->queuedata = lo; - /* - * we remap to a block device, make sure we correctly stack limits - */ - if (S_ISBLK(inode->i_mode)) { - request_queue_t *q = bdev_get_queue(lo_device); - - blk_queue_max_sectors(lo->lo_queue, q->max_sectors); - blk_queue_max_phys_segments(lo->lo_queue,q->max_phys_segments); - blk_queue_max_hw_segments(lo->lo_queue, q->max_hw_segments); - blk_queue_hardsect_size(lo->lo_queue, queue_hardsect_size(q)); - blk_queue_max_segment_size(lo->lo_queue, q->max_segment_size); - blk_queue_segment_boundary(lo->lo_queue, q->seg_boundary_mask); - blk_queue_merge_bvec(lo->lo_queue, q->merge_bvec_fn); - } - set_blocksize(bdev, lo_blocksize); kernel_thread(loop_thread, lo, CLONE_KERNEL); @@ -1196,7 +1014,6 @@ lo->lo_queue = blk_alloc_queue(GFP_KERNEL); if (!lo->lo_queue) goto out_mem4; - disks[i]->queue = lo->lo_queue; init_MUTEX(&lo->lo_ctl_mutex); init_MUTEX_LOCKED(&lo->lo_sem); init_MUTEX_LOCKED(&lo->lo_bh_mutex); @@ -1209,14 +1026,18 @@ sprintf(disk->devfs_name, "loop/%d", i); disk->private_data = lo; disk->queue = lo->lo_queue; - add_disk(disk); } + + /* We cannot fail after we call this, so another loop!*/ + for (i = 0; i < max_loop; i++) + add_disk(disks[i]); printk(KERN_INFO "loop: loaded (max %d devices)\n", max_loop); return 0; out_mem4: while (i--) blk_put_queue(loop_dev[i].lo_queue); + devfs_remove("loop"); i = max_loop; out_mem3: while (i--) --- diff/drivers/block/nbd.c 2003-08-26 10:00:52.000000000 +0100 +++ source/drivers/block/nbd.c 2004-02-18 09:03:58.000000000 +0000 @@ -741,6 +741,7 @@ disk->first_minor = i; disk->fops = &nbd_fops; disk->private_data = &nbd_dev[i]; + disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; sprintf(disk->disk_name, "nbd%d", i); sprintf(disk->devfs_name, "nbd/%d", i); set_capacity(disk, 0x3ffffe); --- diff/drivers/block/rd.c 2003-10-09 09:47:16.000000000 +0100 +++ source/drivers/block/rd.c 2004-02-18 09:03:58.000000000 +0000 @@ -1,15 +1,15 @@ /* * ramdisk.c - Multiple RAM disk driver - gzip-loading version - v. 0.8 beta. - * - * (C) Chad Page, Theodore Ts'o, et. al, 1995. + * + * (C) Chad Page, Theodore Ts'o, et. al, 1995. * * This RAM disk is designed to have filesystems created on it and mounted - * just like a regular floppy disk. - * + * just like a regular floppy disk. + * * It also does something suggested by Linus: use the buffer cache as the * RAM disk data. This makes it possible to dynamically allocate the RAM disk - * buffer - with some consequences I have to deal with as I write this. - * + * buffer - with some consequences I have to deal with as I write this. + * * This code is based on the original ramdisk.c, written mostly by * Theodore Ts'o (TYT) in 1991. The code was largely rewritten by * Chad Page to use the buffer cache to store the RAM disk data in @@ -33,7 +33,7 @@ * * Added initrd: Werner Almesberger & Hans Lermen, Feb '96 * - * 4/25/96 : Made RAM disk size a parameter (default is now 4 MB) + * 4/25/96 : Made RAM disk size a parameter (default is now 4 MB) * - Chad Page * * Add support for fs images split across >1 disk, Paul Gortmaker, Mar '98 @@ -60,7 +60,7 @@ #include /* The RAM disk size is now a parameter */ -#define NUM_RAMDISKS 16 /* This cannot be overridden (yet) */ +#define NUM_RAMDISKS 16 /* This cannot be overridden (yet) */ /* Various static variables go here. Most are used only in the RAM disk code. */ @@ -73,7 +73,7 @@ * Parameters for the boot-loading of the RAM disk. These are set by * init/main.c (from arguments to the kernel command line) or from the * architecture-specific setup routine (from the stored boot sector - * information). + * information). */ int rd_size = CONFIG_BLK_DEV_RAM_SIZE; /* Size of the RAM disks */ /* @@ -94,7 +94,7 @@ * 2000 Transmeta Corp. * aops copied from ramfs. */ -static int ramdisk_readpage(struct file *file, struct page * page) +static int ramdisk_readpage(struct file *file, struct page *page) { if (!PageUptodate(page)) { void *kaddr = kmap_atomic(page, KM_USER0); @@ -108,7 +108,8 @@ return 0; } -static int ramdisk_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to) +static int ramdisk_prepare_write(struct file *file, struct page *page, + unsigned offset, unsigned to) { if (!PageUptodate(page)) { void *kaddr = kmap_atomic(page, KM_USER0); @@ -122,7 +123,8 @@ return 0; } -static int ramdisk_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to) +static int ramdisk_commit_write(struct file *file, struct page *page, + unsigned offset, unsigned to) { return 0; } @@ -212,7 +214,7 @@ * 19-JAN-1998 Richard Gooch Added devfs support * */ -static int rd_make_request(request_queue_t * q, struct bio *bio) +static int rd_make_request(request_queue_t *q, struct bio *bio) { struct block_device *bdev = bio->bi_bdev; struct address_space * mapping = bdev->bd_inode->i_mapping; @@ -242,7 +244,8 @@ return 0; } -static int rd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +static int rd_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) { int error; struct block_device *bdev = inode->i_bdev; @@ -250,9 +253,11 @@ if (cmd != BLKFLSBUF) return -EINVAL; - /* special: we want to release the ramdisk memory, - it's not like with the other blockdevices where - this ioctl only flushes away the buffer cache. */ + /* + * special: we want to release the ramdisk memory, it's not like with + * the other blockdevices where this ioctl only flushes away the buffer + * cache + */ error = -EBUSY; down(&bdev->bd_sem); if (bdev->bd_openers <= 2) { @@ -268,7 +273,7 @@ .memory_backed = 1, /* Does not contribute to dirty memory */ }; -static int rd_open(struct inode * inode, struct file * filp) +static int rd_open(struct inode *inode, struct file *filp) { unsigned unit = iminor(inode); @@ -295,12 +300,14 @@ .ioctl = rd_ioctl, }; -/* Before freeing the module, invalidate all of the protected buffers! */ -static void __exit rd_cleanup (void) +/* + * Before freeing the module, invalidate all of the protected buffers! + */ +static void __exit rd_cleanup(void) { int i; - for (i = 0 ; i < NUM_RAMDISKS; i++) { + for (i = 0; i < NUM_RAMDISKS; i++) { struct block_device *bdev = rd_bdev[i]; rd_bdev[i] = NULL; if (bdev) { @@ -311,17 +318,19 @@ put_disk(rd_disks[i]); } devfs_remove("rd"); - unregister_blkdev(RAMDISK_MAJOR, "ramdisk" ); + unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); } -/* This is the registration and initialization section of the RAM disk driver */ -static int __init rd_init (void) +/* + * This is the registration and initialization section of the RAM disk driver + */ +static int __init rd_init(void) { int i; int err = -ENOMEM; if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 || - (rd_blocksize & (rd_blocksize-1))) { + (rd_blocksize & (rd_blocksize-1))) { printk("RAMDISK: wrong blocksize %d, reverting to defaults\n", rd_blocksize); rd_blocksize = BLOCK_SIZE; @@ -354,6 +363,7 @@ disk->first_minor = i; disk->fops = &rd_bd_op; disk->queue = rd_queue[i]; + disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; sprintf(disk->disk_name, "ram%d", i); sprintf(disk->devfs_name, "rd/%d", i); set_capacity(disk, rd_size * 2); @@ -362,8 +372,8 @@ /* rd_size is given in kB */ printk("RAMDISK driver initialized: " - "%d RAM disks of %dK size %d blocksize\n", - NUM_RAMDISKS, rd_size, rd_blocksize); + "%d RAM disks of %dK size %d blocksize\n", + NUM_RAMDISKS, rd_size, rd_blocksize); return 0; out_queue: --- diff/drivers/block/scsi_ioctl.c 2004-02-18 08:54:08.000000000 +0000 +++ source/drivers/block/scsi_ioctl.c 2004-02-18 09:03:58.000000000 +0000 @@ -312,7 +312,7 @@ return -EFAULT; if (in_len > PAGE_SIZE || out_len > PAGE_SIZE) return -EINVAL; - if (get_user(opcode, sic->data)) + if (get_user(opcode, (int *)sic->data)) return -EFAULT; bytes = max(in_len, out_len); --- diff/drivers/char/Kconfig 2004-02-18 08:54:09.000000000 +0000 +++ source/drivers/char/Kconfig 2004-02-18 09:03:58.000000000 +0000 @@ -445,7 +445,8 @@ source "drivers/serial/Kconfig" config UNIX98_PTYS - bool "Unix98 PTY support" + bool "Unix98 PTY support" if EMBEDDED + default y ---help--- A pseudo terminal (PTY) is a software device consisting of two halves: a master and a slave. The slave device behaves identical to @@ -463,28 +464,38 @@ terminal slave can be accessed as /dev/pts/. What was traditionally /dev/ttyp2 will then be /dev/pts/2, for example. - The entries in /dev/pts/ are created on the fly by a virtual - file system; therefore, if you say Y here you should say Y to - "/dev/pts file system for Unix98 PTYs" as well. - - If you want to say Y here, you need to have the C library glibc 2.1 - or later (equal to libc-6.1, check with "ls -l /lib/libc.so.*"). - Read the instructions in pertaining to - pseudo terminals. It's safe to say N. - -config UNIX98_PTY_COUNT - int "Maximum number of Unix98 PTYs in use (0-2048)" - depends on UNIX98_PTYS + All modern Linux systems use the Unix98 ptys. Say Y unless + you're on an embedded system and want to conserve memory. + +config LEGACY_PTYS + bool "Legacy (BSD) PTY support" + default y + ---help--- + A pseudo terminal (PTY) is a software device consisting of two + halves: a master and a slave. The slave device behaves identical to + a physical terminal; the master device is used by a process to + read data from and write data to the slave, thereby emulating a + terminal. Typical programs for the master side are telnet servers + and xterms. + + Linux has traditionally used the BSD-like names /dev/ptyxx + for masters and /dev/ttyxx for slaves of pseudo + terminals. This scheme has a number of problems, including + security. This option enables these legacy devices; on most + systems, it is safe to say N. + + +config LEGACY_PTY_COUNT + int "Maximum number of legacy PTY in use" + depends on LEGACY_PTYS default "256" - help - The maximum number of Unix98 PTYs that can be used at any one time. - The default is 256, and should be enough for desktop systems. Server - machines which support incoming telnet/rlogin/ssh connections and/or - serve several X terminals may want to increase this: every incoming - connection and every xterm uses up one PTY. + ---help--- + The maximum number of legacy PTYs that can be used at any one time. + The default is 256, and should be more than enough. Embedded + systems may want to reduce this to save memory. - When not in use, each additional set of 256 PTYs occupy - approximately 8 KB of kernel memory on 32-bit architectures. + When not in use, each legacy PTY occupies 12 bytes on 32-bit + architectures and 24 bytes on 64-bit architectures. config PRINTER tristate "Parallel printer support" @@ -588,30 +599,6 @@ bool "Support for console on line printer" depends on PC9800_OLDLP - -menu "Mice" - -config BUSMOUSE - tristate "Bus Mouse Support" - ---help--- - Say Y here if your machine has a bus mouse as opposed to a serial - mouse. Most people have a regular serial MouseSystem or - Microsoft mouse (made by Logitech) that plugs into a COM port - (rectangular with 9 or 25 pins). These people say N here. - - If you have a laptop, you either have to check the documentation or - experiment a bit to find out whether the trackball is a serial mouse - or not; it's best to say Y here for you. - - This is the generic bus mouse driver code. If you have a bus mouse, - you will have to say Y here and also to the specific driver for your - mouse below. - - To compile this driver as a module, choose M here: the - module will be called busmouse. - -endmenu - config QIC02_TAPE tristate "QIC-02 tape support" help @@ -794,8 +781,7 @@ precision in some cases. To compile this driver as a module, choose M here: the - module will be called genrtc. To load the module automatically - add 'alias char-major-10-135 genrtc' to your /etc/modules.conf + module will be called genrtc. config GEN_RTC_X bool "Extended RTC operation" --- diff/drivers/char/Makefile 2004-02-18 08:54:09.000000000 +0000 +++ source/drivers/char/Makefile 2004-02-18 09:03:58.000000000 +0000 @@ -49,7 +49,6 @@ obj-$(CONFIG_TIPAR) += tipar.o obj-$(CONFIG_PC9800_OLDLP) += lp_old98.o -obj-$(CONFIG_BUSMOUSE) += busmouse.o obj-$(CONFIG_DTLK) += dtlk.o obj-$(CONFIG_R3964) += n_r3964.o obj-$(CONFIG_APPLICOM) += applicom.o --- diff/drivers/char/agp/intel-agp.c 2004-01-19 10:22:56.000000000 +0000 +++ source/drivers/char/agp/intel-agp.c 2004-02-18 09:03:58.000000000 +0000 @@ -1432,6 +1432,8 @@ intel_configure(); else if (bridge->driver == &intel_845_driver) intel_845_configure(); + else if (bridge->driver == &intel_830mp_driver) + intel_830mp_configure(); return 0; } --- diff/drivers/char/amiserial.c 2003-10-09 09:47:33.000000000 +0100 +++ source/drivers/char/amiserial.c 2004-02-18 09:03:58.000000000 +0000 @@ -1248,57 +1248,48 @@ } -static int get_modem_info(struct async_struct * info, unsigned int *value) +static int rs_tiocmget(struct tty_struct *tty, struct file *file) { + struct async_struct * info = (struct async_struct *)tty->driver_data; unsigned char control, status; - unsigned int result; unsigned long flags; + if (serial_paranoia_check(info, tty->name, "rs_ioctl")) + return -ENODEV; + if (tty->flags & (1 << TTY_IO_ERROR)) + return -EIO; + control = info->MCR; local_irq_save(flags); status = ciab.pra; local_irq_restore(flags); - result = ((control & SER_RTS) ? TIOCM_RTS : 0) + return ((control & SER_RTS) ? TIOCM_RTS : 0) | ((control & SER_DTR) ? TIOCM_DTR : 0) | (!(status & SER_DCD) ? TIOCM_CAR : 0) | (!(status & SER_DSR) ? TIOCM_DSR : 0) | (!(status & SER_CTS) ? TIOCM_CTS : 0); - if (copy_to_user(value, &result, sizeof(int))) - return -EFAULT; - return 0; } -static int set_modem_info(struct async_struct * info, unsigned int cmd, - unsigned int *value) +static int rs_tiocmset(struct tty_struct *tty, struct file *file, + unsigned int set, unsigned int clear) { - unsigned int arg; + struct async_struct * info = (struct async_struct *)tty->driver_data; unsigned long flags; - if (copy_from_user(&arg, value, sizeof(int))) - return -EFAULT; + if (serial_paranoia_check(info, tty->name, "rs_ioctl")) + return -ENODEV; + if (tty->flags & (1 << TTY_IO_ERROR)) + return -EIO; - switch (cmd) { - case TIOCMBIS: - if (arg & TIOCM_RTS) - info->MCR |= SER_RTS; - if (arg & TIOCM_DTR) - info->MCR |= SER_DTR; - break; - case TIOCMBIC: - if (arg & TIOCM_RTS) - info->MCR &= ~SER_RTS; - if (arg & TIOCM_DTR) - info->MCR &= ~SER_DTR; - break; - case TIOCMSET: - info->MCR = ((info->MCR & ~(SER_RTS | SER_DTR)) - | ((arg & TIOCM_RTS) ? SER_RTS : 0) - | ((arg & TIOCM_DTR) ? SER_DTR : 0)); - break; - default: - return -EINVAL; - } local_irq_save(flags); + if (set & TIOCM_RTS) + info->MCR |= SER_RTS; + if (set & TIOCM_DTR) + info->MCR |= SER_DTR; + if (clear & TIOCM_RTS) + info->MCR &= ~SER_RTS; + if (clear & TIOCM_DTR) + info->MCR &= ~SER_DTR; rtsdtr_ctrl(info->MCR); local_irq_restore(flags); return 0; @@ -1344,12 +1335,6 @@ } switch (cmd) { - case TIOCMGET: - return get_modem_info(info, (unsigned int *) arg); - case TIOCMBIS: - case TIOCMBIC: - case TIOCMSET: - return set_modem_info(info, cmd, (unsigned int *) arg); case TIOCGSERIAL: return get_serial_info(info, (struct serial_struct *) arg); @@ -2045,6 +2030,8 @@ .send_xchar = rs_send_xchar, .wait_until_sent = rs_wait_until_sent, .read_proc = rs_read_proc, + .tiocmget = rs_tiocmget, + .tiocmset = rs_tiocmset, }; /* --- diff/drivers/char/cyclades.c 2003-10-09 09:47:33.000000000 +0100 +++ source/drivers/char/cyclades.c 2004-02-18 09:03:58.000000000 +0000 @@ -3632,8 +3632,9 @@ } static int -get_modem_info(struct cyclades_port * info, unsigned int *value) +cy_tiocmget(struct tty_struct *tty, struct file *file) { + struct cyclades_port * info = (struct cyclades_port *)tty->driver_data; int card,chip,channel,index; unsigned char *base_addr; unsigned long flags; @@ -3645,6 +3646,9 @@ struct BOARD_CTRL *board_ctrl; struct CH_CTRL *ch_ctrl; + if (serial_paranoia_check(info, tty->name, __FUNCTION__)) + return -ENODEV; + card = info->card; channel = (info->line) - (cy_card[card].first_line); if (!IS_CYC_Z(cy_card[card])) { @@ -3700,24 +3704,27 @@ } } - return cy_put_user(result, value); -} /* get_modem_info */ + return result; +} /* cy_tiomget */ static int -set_modem_info(struct cyclades_port * info, unsigned int cmd, - unsigned int *value) +cy_tiocmset(struct tty_struct *tty, struct file *file, + unsigned int set, unsigned int clear) { + struct cyclades_port * info = (struct cyclades_port *)tty->driver_data; int card,chip,channel,index; unsigned char *base_addr; unsigned long flags; - unsigned int arg = cy_get_user((unsigned long *) value); struct FIRM_ID *firm_id; struct ZFW_CTRL *zfw_ctrl; struct BOARD_CTRL *board_ctrl; struct CH_CTRL *ch_ctrl; int retval; + if (serial_paranoia_check(info, tty->name, __FUNCTION__)) + return -ENODEV; + card = info->card; channel = (info->line) - (cy_card[card].first_line); if (!IS_CYC_Z(cy_card[card])) { @@ -3728,66 +3735,7 @@ (cy_card[card].base_addr + (cy_chip_offset[chip]<rtsdtr_inv) { - cy_writeb((u_long)base_addr+(CyMSVR2<rtsdtr_inv) { - cy_writeb((u_long)base_addr+(CyMSVR1<rtsdtr_inv) { - cy_writeb((u_long)base_addr+(CyMSVR2<rtsdtr_inv) { - cy_writeb((u_long)base_addr+(CyMSVR1<rtsdtr_inv) { @@ -3796,7 +3744,8 @@ cy_writeb((u_long)base_addr+(CyMSVR1<rtsdtr_inv) { @@ -3805,8 +3754,8 @@ cy_writeb((u_long)base_addr+(CyMSVR1<rtsdtr_inv) { @@ -3821,7 +3770,8 @@ cy_readb(base_addr+(CyMSVR2<rtsdtr_inv) { @@ -3837,10 +3787,6 @@ cy_readb(base_addr+(CyMSVR2<board_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl; - switch (cmd) { - case TIOCMBIS: - if (arg & TIOCM_RTS){ - CY_LOCK(info, flags); - cy_writel(&ch_ctrl[channel].rs_control, - cy_readl(&ch_ctrl[channel].rs_control) | C_RS_RTS); - CY_UNLOCK(info, flags); - } - if (arg & TIOCM_DTR){ - CY_LOCK(info, flags); - cy_writel(&ch_ctrl[channel].rs_control, - cy_readl(&ch_ctrl[channel].rs_control) | C_RS_DTR); -#ifdef CY_DEBUG_DTR - printk("cyc:set_modem_info raising Z DTR\n"); -#endif - CY_UNLOCK(info, flags); - } - break; - case TIOCMBIC: - if (arg & TIOCM_RTS){ - CY_LOCK(info, flags); - cy_writel(&ch_ctrl[channel].rs_control, - cy_readl(&ch_ctrl[channel].rs_control) & ~C_RS_RTS); - CY_UNLOCK(info, flags); - } - if (arg & TIOCM_DTR){ - CY_LOCK(info, flags); - cy_writel(&ch_ctrl[channel].rs_control, - cy_readl(&ch_ctrl[channel].rs_control) & ~C_RS_DTR); -#ifdef CY_DEBUG_DTR - printk("cyc:set_modem_info clearing Z DTR\n"); -#endif - CY_UNLOCK(info, flags); - } - break; - case TIOCMSET: - if (arg & TIOCM_RTS){ + if (set & TIOCM_RTS){ CY_LOCK(info, flags); cy_writel(&ch_ctrl[channel].rs_control, cy_readl(&ch_ctrl[channel].rs_control) | C_RS_RTS); CY_UNLOCK(info, flags); - }else{ + } + if (clear & TIOCM_RTS) { CY_LOCK(info, flags); cy_writel(&ch_ctrl[channel].rs_control, cy_readl(&ch_ctrl[channel].rs_control) & ~C_RS_RTS); CY_UNLOCK(info, flags); - } - if (arg & TIOCM_DTR){ + } + if (set & TIOCM_DTR){ CY_LOCK(info, flags); cy_writel(&ch_ctrl[channel].rs_control, cy_readl(&ch_ctrl[channel].rs_control) | C_RS_DTR); @@ -3909,7 +3820,8 @@ printk("cyc:set_modem_info raising Z DTR\n"); #endif CY_UNLOCK(info, flags); - }else{ + } + if (clear & TIOCM_DTR) { CY_LOCK(info, flags); cy_writel(&ch_ctrl[channel].rs_control, cy_readl(&ch_ctrl[channel].rs_control) & ~C_RS_DTR); @@ -3917,10 +3829,6 @@ printk("cyc:set_modem_info clearing Z DTR\n"); #endif CY_UNLOCK(info, flags); - } - break; - default: - return -EINVAL; } }else{ return -ENODEV; @@ -3935,7 +3843,7 @@ CY_UNLOCK(info, flags); } return 0; -} /* set_modem_info */ +} /* cy_tiocmset */ /* * cy_break() --- routine which turns the break handling on or off @@ -4242,14 +4150,6 @@ case CYGETWAIT: ret_val = info->closing_wait / (HZ/100); break; - case TIOCMGET: - ret_val = get_modem_info(info, (unsigned int *) arg); - break; - case TIOCMBIS: - case TIOCMBIC: - case TIOCMSET: - ret_val = set_modem_info(info, cmd, (unsigned int *) arg); - break; case TIOCGSERIAL: ret_val = get_serial_info(info, (struct serial_struct *) arg); break; @@ -5429,6 +5329,8 @@ .break_ctl = cy_break, .wait_until_sent = cy_wait_until_sent, .read_proc = cyclades_get_proc_info, + .tiocmget = cy_tiocmget, + .tiocmset = cy_tiocmset, }; static int __init --- diff/drivers/char/drm/Kconfig 2004-02-09 10:36:10.000000000 +0000 +++ source/drivers/char/drm/Kconfig 2004-02-18 09:03:58.000000000 +0000 @@ -76,7 +76,7 @@ tristate "SiS video cards" depends on DRM && AGP help - Choose this option if you have a SiS 630 or compatibel video + Choose this option if you have a SiS 630 or compatible video chipset. If M is selected the module will be called sis. AGP support is required for this driver to work. --- diff/drivers/char/drm/drm.h 2003-07-22 18:54:27.000000000 +0100 +++ source/drivers/char/drm/drm.h 2004-02-18 09:03:58.000000000 +0000 @@ -580,6 +580,16 @@ unsigned long handle; /**< Used for mapping / unmapping */ } drm_scatter_gather_t; +/** + * DRM_IOCTL_SET_VERSION ioctl argument type. + */ +typedef struct drm_set_version { + int drm_di_major; + int drm_di_minor; + int drm_dd_major; + int drm_dd_minor; +} drm_set_version_t; + #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) @@ -594,6 +604,7 @@ #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t) #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t) #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t) +#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, drm_set_version_t) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t) --- diff/drivers/char/drm/drmP.h 2004-01-19 10:22:56.000000000 +0000 +++ source/drivers/char/drm/drmP.h 2004-02-18 09:03:58.000000000 +0000 @@ -92,8 +92,8 @@ #ifndef __HAVE_DMA #define __HAVE_DMA 0 #endif -#ifndef __HAVE_DMA_IRQ -#define __HAVE_DMA_IRQ 0 +#ifndef __HAVE_IRQ +#define __HAVE_IRQ 0 #endif #ifndef __HAVE_DMA_WAITLIST #define __HAVE_DMA_WAITLIST 0 @@ -324,6 +324,7 @@ #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist) +#define DRM_IF_VERSION(maj, min) ((maj) << 16 | (min)) /** * Get the private SAREA mapping. * @@ -362,10 +363,13 @@ typedef int drm_ioctl_t( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -typedef struct drm_pci_list { - u16 vendor; - u16 device; -} drm_pci_list_t; +typedef struct drm_pci_id_list +{ + int vendor; + int device; + long driver_private; + char *name; +} drm_pci_id_list_t; typedef struct drm_ioctl_desc { drm_ioctl_t *func; @@ -488,6 +492,9 @@ struct drm_device *dev; int remove_auth_on_close; unsigned long lock_count; +#ifdef DRIVER_FILE_FIELDS + DRIVER_FILE_FIELDS; +#endif } drm_file_t; /** Wait queue */ @@ -622,6 +629,8 @@ int unique_len; /**< Length of unique field */ dev_t device; /**< Device number for mknod */ char *devname; /**< For /proc/interrupts */ + int minor; /**< Minor device number */ + int if_version; /**< Highest interface version set */ int blocked; /**< Blocked due to VC switch? */ struct proc_dir_entry *root; /**< Root for this device's entries */ @@ -679,6 +688,7 @@ /** \name Context support */ /*@{*/ int irq; /**< Interrupt used by board */ + int irq_enabled; /**< True if irq handler is enabled */ __volatile__ long context_flag; /**< Context swapping flag */ __volatile__ long interrupt_flag; /**< Interruption handler flag */ __volatile__ long dma_flag; /**< DMA dispatch flag */ @@ -714,7 +724,12 @@ #if __REALLY_HAVE_AGP drm_agp_head_t *agp; /**< AGP data */ #endif - struct pci_dev *pdev; /**< PCI device structure */ + + struct pci_dev *pdev; /**< PCI device structure */ + int pci_domain; /**< PCI bus domain number */ + int pci_bus; /**< PCI bus number */ + int pci_slot; /**< PCI slot number */ + int pci_func; /**< PCI function number */ #ifdef __alpha__ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) struct pci_controler *hose; @@ -804,8 +819,8 @@ #endif /* Misc. IOCTL support (drm_ioctl.h) */ -extern int DRM(irq_busid)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +extern int DRM(irq_by_busid)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); extern int DRM(getunique)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int DRM(setunique)(struct inode *inode, struct file *filp, @@ -816,6 +831,8 @@ unsigned int cmd, unsigned long arg); extern int DRM(getstats)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +extern int DRM(setversion)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); /* Context IOCTL support (drm_context.h) */ extern int DRM(resctx)( struct inode *inode, struct file *filp, @@ -900,12 +917,17 @@ extern void DRM(dma_takedown)(drm_device_t *dev); extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf); extern void DRM(reclaim_buffers)( struct file *filp ); -#if __HAVE_DMA_IRQ +#endif /* __HAVE_DMA */ + + /* IRQ support (drm_irq.h) */ +#if __HAVE_IRQ || __HAVE_DMA extern int DRM(control)( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(irq_install)( drm_device_t *dev, int irq ); +#endif +#if __HAVE_IRQ +extern int DRM(irq_install)( drm_device_t *dev ); extern int DRM(irq_uninstall)( drm_device_t *dev ); -extern irqreturn_t DRM(dma_service)( DRM_IRQ_ARGS ); +extern irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ); extern void DRM(driver_irq_preinstall)( drm_device_t *dev ); extern void DRM(driver_irq_postinstall)( drm_device_t *dev ); extern void DRM(driver_irq_uninstall)( drm_device_t *dev ); @@ -915,12 +937,11 @@ extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq); extern void DRM(vbl_send_signals)( drm_device_t *dev ); #endif -#if __HAVE_DMA_IRQ_BH -extern void DRM(dma_immediate_bh)( void *dev ); +#if __HAVE_IRQ_BH +extern void DRM(irq_immediate_bh)( void *dev ); #endif #endif -#endif /* __HAVE_DMA */ #if __REALLY_HAVE_AGP /* AGP/GART support (drm_agpsupport.h) */ --- diff/drivers/char/drm/drm_bufs.h 2003-07-22 18:54:27.000000000 +0100 +++ source/drivers/char/drm/drm_bufs.h 2004-02-18 09:03:58.000000000 +0000 @@ -147,7 +147,9 @@ MTRR_TYPE_WRCOMB, 1 ); } #endif - map->handle = DRM(ioremap)( map->offset, map->size, dev ); + if (map->type == _DRM_REGISTERS) + map->handle = DRM(ioremap)( map->offset, map->size, + dev ); break; case _DRM_SHM: @@ -160,6 +162,12 @@ } map->offset = (unsigned long)map->handle; if ( map->flags & _DRM_CONTAINS_LOCK ) { + /* Prevent a 2nd X Server from creating a 2nd lock */ + if (dev->lock.hw_lock != NULL) { + vfree( map->handle ); + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EBUSY; + } dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */ } --- diff/drivers/char/drm/drm_dma.h 2003-07-22 18:54:27.000000000 +0100 +++ source/drivers/char/drm/drm_dma.h 2004-02-18 09:03:58.000000000 +0000 @@ -43,15 +43,6 @@ #ifndef __HAVE_DMA_RECLAIM #define __HAVE_DMA_RECLAIM 0 #endif -#ifndef __HAVE_SHARED_IRQ -#define __HAVE_SHARED_IRQ 0 -#endif - -#if __HAVE_SHARED_IRQ -#define DRM_IRQ_TYPE SA_SHIRQ -#else -#define DRM_IRQ_TYPE 0 -#endif #if __HAVE_DMA @@ -214,293 +205,11 @@ } #endif - - - -#if __HAVE_DMA_IRQ - -/** - * Install IRQ handler. - * - * \param dev DRM device. - * \param irq IRQ number. - * - * Initializes the IRQ related data, and setups drm_device::vbl_queue. Installs the handler, calling the driver - * \c DRM(driver_irq_preinstall)() and \c DRM(driver_irq_postinstall)() functions - * before and after the installation. - */ -int DRM(irq_install)( drm_device_t *dev, int irq ) -{ - int ret; - - if ( !irq ) - return -EINVAL; - - down( &dev->struct_sem ); - - /* Driver must have been initialized */ - if ( !dev->dev_private ) { - up( &dev->struct_sem ); - return -EINVAL; - } - - if ( dev->irq ) { - up( &dev->struct_sem ); - return -EBUSY; - } - dev->irq = irq; - up( &dev->struct_sem ); - - DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); - - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - - dev->dma->next_buffer = NULL; - dev->dma->next_queue = NULL; - dev->dma->this_buffer = NULL; - -#if __HAVE_DMA_IRQ_BH - INIT_WORK(&dev->work, DRM(dma_immediate_bh), dev); -#endif - -#if __HAVE_VBL_IRQ - init_waitqueue_head(&dev->vbl_queue); - - spin_lock_init( &dev->vbl_lock ); - - INIT_LIST_HEAD( &dev->vbl_sigs.head ); - - dev->vbl_pending = 0; -#endif - - /* Before installing handler */ - DRM(driver_irq_preinstall)(dev); - - /* Install handler */ - ret = request_irq( dev->irq, DRM(dma_service), - DRM_IRQ_TYPE, dev->devname, dev ); - if ( ret < 0 ) { - down( &dev->struct_sem ); - dev->irq = 0; - up( &dev->struct_sem ); - return ret; - } - - /* After installing handler */ - DRM(driver_irq_postinstall)(dev); - - return 0; -} - -/** - * Uninstall the IRQ handler. - * - * \param dev DRM device. - * - * Calls the driver's \c DRM(driver_irq_uninstall)() function, and stops the irq. - */ -int DRM(irq_uninstall)( drm_device_t *dev ) -{ - int irq; - - down( &dev->struct_sem ); - irq = dev->irq; - dev->irq = 0; - up( &dev->struct_sem ); - - if ( !irq ) - return -EINVAL; - - DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); - - DRM(driver_irq_uninstall)( dev ); - - free_irq( irq, dev ); - - return 0; -} - -/** - * IRQ control ioctl. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_control structure. - * \return zero on success or a negative number on failure. - * - * Calls irq_install() or irq_uninstall() according to \p arg. - */ -int DRM(control)( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_control_t ctl; - - if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) ) - return -EFAULT; - - switch ( ctl.func ) { - case DRM_INST_HANDLER: - return DRM(irq_install)( dev, ctl.irq ); - case DRM_UNINST_HANDLER: - return DRM(irq_uninstall)( dev ); - default: - return -EINVAL; - } -} - -#if __HAVE_VBL_IRQ - -/** - * Wait for VBLANK. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param data user argument, pointing to a drm_wait_vblank structure. - * \return zero on success or a negative number on failure. - * - * Verifies the IRQ is installed. - * - * If a signal is requested checks if this task has already scheduled the same signal - * for the same vblank sequence number - nothing to be done in - * that case. If the number of tasks waiting for the interrupt exceeds 100 the - * function fails. Otherwise adds a new entry to drm_device::vbl_sigs for this - * task. - * - * If a signal is not requested, then calls vblank_wait(). - */ -int DRM(wait_vblank)( DRM_IOCTL_ARGS ) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_wait_vblank_t vblwait; - struct timeval now; - int ret = 0; - unsigned int flags; - - if (!dev->irq) - return -EINVAL; - - DRM_COPY_FROM_USER_IOCTL( vblwait, (drm_wait_vblank_t *)data, - sizeof(vblwait) ); - - switch ( vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK ) { - case _DRM_VBLANK_RELATIVE: - vblwait.request.sequence += atomic_read( &dev->vbl_received ); - vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; - case _DRM_VBLANK_ABSOLUTE: - break; - default: - return -EINVAL; - } - - flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; - - if ( flags & _DRM_VBLANK_SIGNAL ) { - unsigned long irqflags; - drm_vbl_sig_t *vbl_sig; - - vblwait.reply.sequence = atomic_read( &dev->vbl_received ); - - spin_lock_irqsave( &dev->vbl_lock, irqflags ); - - /* Check if this task has already scheduled the same signal - * for the same vblank sequence number; nothing to be done in - * that case - */ - list_for_each_entry( vbl_sig, &dev->vbl_sigs.head, head ) { - if (vbl_sig->sequence == vblwait.request.sequence - && vbl_sig->info.si_signo == vblwait.request.signal - && vbl_sig->task == current) - { - spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - goto done; - } - } - - if ( dev->vbl_pending >= 100 ) { - spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - return -EBUSY; - } - - dev->vbl_pending++; - - spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - - if ( !( vbl_sig = DRM_MALLOC( sizeof( drm_vbl_sig_t ) ) ) ) { - return -ENOMEM; - } - - memset( (void *)vbl_sig, 0, sizeof(*vbl_sig) ); - - vbl_sig->sequence = vblwait.request.sequence; - vbl_sig->info.si_signo = vblwait.request.signal; - vbl_sig->task = current; - - spin_lock_irqsave( &dev->vbl_lock, irqflags ); - - list_add_tail( (struct list_head *) vbl_sig, &dev->vbl_sigs.head ); - - spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - } else { - ret = DRM(vblank_wait)( dev, &vblwait.request.sequence ); - - do_gettimeofday( &now ); - vblwait.reply.tval_sec = now.tv_sec; - vblwait.reply.tval_usec = now.tv_usec; - } - -done: - DRM_COPY_TO_USER_IOCTL( (drm_wait_vblank_t *)data, vblwait, - sizeof(vblwait) ); - - return ret; -} - -/** - * Send the VBLANK signals. - * - * \param dev DRM device. - * - * Sends a signal for each task in drm_device::vbl_sigs and empties the list. - * - * If a signal is not requested, then calls vblank_wait(). +#if !__HAVE_IRQ +/* This stub DRM_IOCTL_CONTROL handler is for the drivers that used to require + * IRQs for DMA but no longer do. It maintains compatibility with the X Servers + * that try to use the control ioctl by simply returning success. */ -void DRM(vbl_send_signals)( drm_device_t *dev ) -{ - struct list_head *list, *tmp; - drm_vbl_sig_t *vbl_sig; - unsigned int vbl_seq = atomic_read( &dev->vbl_received ); - unsigned long flags; - - spin_lock_irqsave( &dev->vbl_lock, flags ); - - list_for_each_safe( list, tmp, &dev->vbl_sigs.head ) { - vbl_sig = list_entry( list, drm_vbl_sig_t, head ); - if ( ( vbl_seq - vbl_sig->sequence ) <= (1<<23) ) { - vbl_sig->info.si_code = vbl_seq; - send_sig_info( vbl_sig->info.si_signo, &vbl_sig->info, vbl_sig->task ); - - list_del( list ); - - DRM_FREE( vbl_sig, sizeof(*vbl_sig) ); - - dev->vbl_pending--; - } - } - - spin_unlock_irqrestore( &dev->vbl_lock, flags ); -} - -#endif /* __HAVE_VBL_IRQ */ - -#else - int DRM(control)( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ) { @@ -517,7 +226,6 @@ return -EINVAL; } } - -#endif /* __HAVE_DMA_IRQ */ +#endif #endif /* __HAVE_DMA */ --- diff/drivers/char/drm/drm_drv.h 2003-10-27 09:20:43.000000000 +0000 +++ source/drivers/char/drm/drm_drv.h 2004-02-18 09:03:58.000000000 +0000 @@ -58,8 +58,8 @@ #ifndef __HAVE_CTX_BITMAP #define __HAVE_CTX_BITMAP 0 #endif -#ifndef __HAVE_DMA_IRQ -#define __HAVE_DMA_IRQ 0 +#ifndef __HAVE_IRQ +#define __HAVE_IRQ 0 #endif #ifndef __HAVE_DMA_QUEUE #define __HAVE_DMA_QUEUE 0 @@ -126,6 +126,9 @@ #ifndef DRIVER_IOCTLS #define DRIVER_IOCTLS #endif +#ifndef DRIVER_OPEN_HELPER +#define DRIVER_OPEN_HELPER( priv, dev ) +#endif #ifndef DRIVER_FOPS #define DRIVER_FOPS \ static struct file_operations DRM(fops) = { \ @@ -159,15 +162,8 @@ #undef DRM_OPTIONS_FUNC #endif -/** - * The default number of instances (minor numbers) to initialize. - */ -#ifndef DRIVER_NUM_CARDS -#define DRIVER_NUM_CARDS 1 -#endif - -static drm_device_t *DRM(device); -static int *DRM(minor); +#define MAX_DEVICES 4 +static drm_device_t DRM(device)[MAX_DEVICES]; static int DRM(numdevs) = 0; DRIVER_FOPS; @@ -177,10 +173,13 @@ [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { DRM(getunique), 0, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { DRM(getmagic), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { DRM(irq_busid), 0, 1 }, +#if __HAVE_IRQ + [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { DRM(irq_by_busid), 0, 1 }, +#endif [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = { DRM(getmap), 0, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { DRM(getclient), 0, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { DRM(getstats), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)] = { DRM(setversion), 0, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { DRM(setunique), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { DRM(noop), 1, 1 }, @@ -222,9 +221,9 @@ [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { DRM(infobufs), 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { DRM(mapbufs), 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { DRM(freebufs), 1, 0 }, - - /* The DRM_IOCTL_DMA ioctl should be defined by the driver. - */ + /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ +#endif +#if __HAVE_IRQ || __HAVE_DMA [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, #endif @@ -337,7 +336,7 @@ dev->queue_reserved = 0; dev->queue_slots = 0; dev->queuelist = NULL; - dev->irq = 0; + dev->irq_enabled = 0; dev->context_flag = 0; dev->interrupt_flag = 0; dev->dma_flag = 0; @@ -345,6 +344,7 @@ dev->last_switch = 0; dev->last_checked = 0; init_waitqueue_head( &dev->context_wait ); + dev->if_version = 0; dev->ctx_start = 0; dev->lck_start = 0; @@ -391,8 +391,8 @@ DRM_DEBUG( "\n" ); DRIVER_PRETAKEDOWN(); -#if __HAVE_DMA_IRQ - if ( dev->irq ) DRM(irq_uninstall)( dev ); +#if __HAVE_IRQ + if ( dev->irq_enabled ) DRM(irq_uninstall)( dev ); #endif down( &dev->struct_sem ); @@ -534,52 +534,111 @@ return 0; } -/** - * Figure out how many instances to initialize. - * - * \return number of cards found. - * - * Searches for every PCI card in \c DRIVER_CARD_LIST with matching vendor and device ids. - */ -static int drm_count_cards(void) +static drm_pci_id_list_t DRM(pciidlist)[] = { + DRIVER_PCI_IDS +}; + +static int DRM(probe)(struct pci_dev *pdev) { - int num = 0; -#if defined(DRIVER_CARD_LIST) - int i; - drm_pci_list_t *l; - u16 device, vendor; - struct pci_dev *pdev = NULL; + drm_device_t *dev; +#if __HAVE_CTX_BITMAP + int retcode; #endif + int i; + char *desc = NULL; DRM_DEBUG( "\n" ); -#if defined(DRIVER_COUNT_CARDS) - num = DRIVER_COUNT_CARDS(); -#elif defined(DRIVER_CARD_LIST) - for (i = 0, l = DRIVER_CARD_LIST; l[i].vendor != 0; i++) { - pdev = NULL; - vendor = l[i].vendor; - device = l[i].device; - if(device == 0xffff) device = PCI_ANY_ID; - if(vendor == 0xffff) vendor = PCI_ANY_ID; - while ((pdev = pci_find_device(vendor, device, pdev))) { - num++; + for (i = 0; DRM(pciidlist)[i].vendor != 0; i++) { + if ((DRM(pciidlist)[i].vendor == pdev->vendor) && + (DRM(pciidlist)[i].device == pdev->device)) { + desc = DRM(pciidlist)[i].name; } } + if (desc == NULL) + return -ENODEV; + + if (DRM(numdevs) >= MAX_DEVICES) + return -ENODEV; + + dev = &(DRM(device)[DRM(numdevs)]); + + memset( (void *)dev, 0, sizeof(*dev) ); + dev->count_lock = SPIN_LOCK_UNLOCKED; + init_timer( &dev->timer ); + sema_init( &dev->struct_sem, 1 ); + + if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) + return -EPERM; + dev->device = MKDEV(DRM_MAJOR, dev->minor ); + dev->name = DRIVER_NAME; + + dev->pdev = pdev; +#ifdef __alpha__ + dev->hose = pdev->sysdata; + dev->pci_domain = dev->hose->bus->number; #else - num = DRIVER_NUM_CARDS; + dev->pci_domain = 0; +#endif + dev->pci_bus = pdev->bus->number; + dev->pci_slot = PCI_SLOT(pdev->devfn); + dev->pci_func = PCI_FUNC(pdev->devfn); + dev->irq = pdev->irq; + + DRIVER_PREINIT(); + +#if __REALLY_HAVE_AGP + dev->agp = DRM(agp_init)(); +#if __MUST_HAVE_AGP + if ( dev->agp == NULL ) { + DRM_ERROR( "Cannot initialize the agpgart module.\n" ); + DRM(stub_unregister)(dev->minor); + DRM(takedown)( dev ); + return -ENOMEM; + } +#endif +#if __REALLY_HAVE_MTRR + if (dev->agp) + dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size*1024*1024, + MTRR_TYPE_WRCOMB, + 1 ); +#endif +#endif + +#if __HAVE_CTX_BITMAP + retcode = DRM(ctxbitmap_init)( dev ); + if( retcode ) { + DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); + DRM(stub_unregister)(dev->minor); + DRM(takedown)( dev ); + return retcode; + } #endif - DRM_DEBUG("numdevs = %d\n", num); - return num; + DRM(numdevs)++; /* no errors, mark it reserved */ + + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + dev->minor, + desc ); + + DRIVER_POSTINIT(); + + return 0; } + /** * Module initialization. Called via init_module at module load time, or via * linux/init/main.c (this is not currently supported). * * \return zero on success or a negative number on failure. * - * Allocates and initialize an array of drm_device structures, and attempts to + * Initializes an array of drm_device structures, and attempts to * initialize all available devices, using consecutive minors, registering the * stubs and initializing the AGP device. * @@ -588,88 +647,19 @@ */ static int __init drm_init( void ) { + struct pci_dev *pdev = NULL; - drm_device_t *dev; - int i; -#if __HAVE_CTX_BITMAP - int retcode; -#endif DRM_DEBUG( "\n" ); #ifdef MODULE DRM(parse_options)( drm_opts ); #endif - DRM(numdevs) = drm_count_cards(); - /* Force at least one instance. */ - if (DRM(numdevs) <= 0) - DRM(numdevs) = 1; - - DRM(device) = kmalloc(sizeof(*DRM(device)) * DRM(numdevs), GFP_KERNEL); - if (!DRM(device)) { - return -ENOMEM; - } - DRM(minor) = kmalloc(sizeof(*DRM(minor)) * DRM(numdevs), GFP_KERNEL); - if (!DRM(minor)) { - kfree(DRM(device)); - return -ENOMEM; - } - - DRIVER_PREINIT(); - DRM(mem_init)(); - for (i = 0; i < DRM(numdevs); i++) { - dev = &(DRM(device)[i]); - memset( (void *)dev, 0, sizeof(*dev) ); - dev->count_lock = SPIN_LOCK_UNLOCKED; - init_timer( &dev->timer ); - sema_init( &dev->struct_sem, 1 ); - - if ((DRM(minor)[i] = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) - return -EPERM; - dev->device = MKDEV(DRM_MAJOR, DRM(minor)[i] ); - dev->name = DRIVER_NAME; - -#if __REALLY_HAVE_AGP - dev->agp = DRM(agp_init)(); -#if __MUST_HAVE_AGP - if ( dev->agp == NULL ) { - DRM_ERROR( "Cannot initialize the agpgart module.\n" ); - DRM(stub_unregister)(DRM(minor)[i]); - DRM(takedown)( dev ); - return -EINVAL; - } -#endif -#if __REALLY_HAVE_MTRR - if (dev->agp) - dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size*1024*1024, - MTRR_TYPE_WRCOMB, - 1 ); -#endif -#endif - -#if __HAVE_CTX_BITMAP - retcode = DRM(ctxbitmap_init)( dev ); - if( retcode ) { - DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); - DRM(stub_unregister)(DRM(minor)[i]); - DRM(takedown)( dev ); - return retcode; - } -#endif - DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n", - DRIVER_NAME, - DRIVER_MAJOR, - DRIVER_MINOR, - DRIVER_PATCHLEVEL, - DRIVER_DATE, - DRM(minor)[i] ); + while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { + DRM(probe)(pdev); } - - DRIVER_POSTINIT(); - return 0; } @@ -689,10 +679,10 @@ for (i = DRM(numdevs) - 1; i >= 0; i--) { dev = &(DRM(device)[i]); - if ( DRM(stub_unregister)(DRM(minor)[i]) ) { + if ( DRM(stub_unregister)(dev->minor) ) { DRM_ERROR( "Cannot unload module\n" ); } else { - DRM_DEBUG("minor %d unregistered\n", DRM(minor)[i]); + DRM_DEBUG("minor %d unregistered\n", dev->minor); if (i == 0) { DRM_INFO( "Module unloaded\n" ); } @@ -722,8 +712,6 @@ #endif } DRIVER_POSTCLEANUP(); - kfree(DRM(minor)); - kfree(DRM(device)); DRM(numdevs) = 0; } @@ -795,7 +783,7 @@ int i; for (i = 0; i < DRM(numdevs); i++) { - if (iminor(inode) == DRM(minor)[i]) { + if (iminor(inode) == DRM(device)[i].minor) { dev = &(DRM(device)[i]); break; } --- diff/drivers/char/drm/drm_fops.h 2003-10-09 09:47:16.000000000 +0100 +++ source/drivers/char/drm/drm_fops.h 2004-02-18 09:03:58.000000000 +0000 @@ -72,6 +72,8 @@ priv->authenticated = capable(CAP_SYS_ADMIN); priv->lock_count = 0; + DRIVER_OPEN_HELPER( priv, dev ); + down(&dev->struct_sem); if (!dev->file_last) { priv->next = NULL; --- diff/drivers/char/drm/drm_ioctl.h 2003-07-22 18:54:27.000000000 +0100 +++ source/drivers/char/drm/drm_ioctl.h 2004-02-18 09:03:58.000000000 +0000 @@ -35,69 +35,7 @@ #include "drmP.h" - -/** - * Get interrupt from bus id. - * - * \param inode device inode. - * \param filp file pointer. - * \param cmd command. - * \param arg user argument, pointing to a drm_irq_busid structure. - * \return zero on success or a negative number on failure. - * - * Finds the PCI device with the specified bus id and gets its IRQ number. - */ -int DRM(irq_busid)(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_irq_busid_t p; - struct pci_dev *dev; - - if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p))) - return -EFAULT; -#ifdef __alpha__ - { - int domain = p.busnum >> 8; - p.busnum &= 0xff; - - /* - * Find the hose the device is on (the domain number is the - * hose index) and offset the bus by the root bus of that - * hose. - */ - for(dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,NULL); - dev; - dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,dev)) { - struct pci_controller *hose = dev->sysdata; - - if (hose->index == domain) { - p.busnum += hose->bus->number; - break; - } - } - } -#endif - dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum)); - if (!dev) { - DRM_ERROR("pci_find_slot failed for %d:%d:%d\n", - p.busnum, p.devnum, p.funcnum); - p.irq = 0; - goto out; - } - if (pci_enable_device(dev) != 0) { - DRM_ERROR("pci_enable_device failed for %d:%d:%d\n", - p.busnum, p.devnum, p.funcnum); - p.irq = 0; - goto out; - } - p.irq = dev->irq; - out: - DRM_DEBUG("%d:%d:%d => IRQ %d\n", - p.busnum, p.devnum, p.funcnum, p.irq); - if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p))) - return -EFAULT; - return 0; -} +#include /** * Get the bus id. @@ -138,8 +76,10 @@ * \param arg user argument, pointing to a drm_unique structure. * \return zero on success or a negative number on failure. * - * Copies the bus id from userspace into drm_device::unique, and searches for - * the respective PCI device, updating drm_device::pdev. + * Copies the bus id from userspace into drm_device::unique, and verifies that + * it matches the device this DRM is attached to (EINVAL otherwise). Deprecated + * in interface version 1.1 and will return EBUSY when setversion has requested + * version 1.1 or greater. */ int DRM(setunique)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) @@ -147,6 +87,7 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_unique_t u; + int domain, bus, slot, func, ret; if (dev->unique_len || dev->unique) return -EBUSY; @@ -164,55 +105,42 @@ dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2, DRM_MEM_DRIVER); - if(!dev->devname) { - DRM(free)(dev->devname, sizeof(*dev->devname), DRM_MEM_DRIVER); + if (!dev->devname) return -ENOMEM; - } + sprintf(dev->devname, "%s@%s", dev->name, dev->unique); - do { - struct pci_dev *pci_dev; - int domain, b, d, f; - char *p; - - for(p = dev->unique; p && *p && *p != ':'; p++); - if (!p || !*p) break; - b = (int)simple_strtoul(p+1, &p, 10); - if (*p != ':') break; - d = (int)simple_strtoul(p+1, &p, 10); - if (*p != ':') break; - f = (int)simple_strtoul(p+1, &p, 10); - if (*p) break; - - domain = b >> 8; - b &= 0xff; - -#ifdef __alpha__ - /* - * Find the hose the device is on (the domain number is the - * hose index) and offset the bus by the root bus of that - * hose. - */ - for(pci_dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,NULL); - pci_dev; - pci_dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,pci_dev)) { - struct pci_controller *hose = pci_dev->sysdata; - - if (hose->index == domain) { - b += hose->bus->number; - break; - } - } -#endif + /* Return error if the busid submitted doesn't match the device's actual + * busid. + */ + ret = sscanf(dev->unique, "PCI:%d:%d:%d", &bus, &slot, &func); + if (ret != 3) + return DRM_ERR(EINVAL); + domain = bus >> 8; + bus &= 0xff; + + if ((domain != dev->pci_domain) || + (bus != dev->pci_bus) || + (slot != dev->pci_slot) || + (func != dev->pci_func)) + return -EINVAL; - pci_dev = pci_find_slot(b, PCI_DEVFN(d,f)); - if (pci_dev) { - dev->pdev = pci_dev; -#ifdef __alpha__ - dev->hose = pci_dev->sysdata; -#endif - } - } while(0); + return 0; +} + +static int +DRM(set_busid)(drm_device_t *dev) +{ + if (dev->unique != NULL) + return EBUSY; + + dev->unique_len = 20; + dev->unique = DRM(alloc)(dev->unique_len + 1, DRM_MEM_DRIVER); + if (dev->unique == NULL) + return ENOMEM; + + snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", + dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); return 0; } @@ -363,3 +291,48 @@ return -EFAULT; return 0; } + +#define DRM_IF_MAJOR 1 +#define DRM_IF_MINOR 2 + +int DRM(setversion)(DRM_IOCTL_ARGS) +{ + DRM_DEVICE; + drm_set_version_t sv; + drm_set_version_t retv; + int if_version; + + DRM_COPY_FROM_USER_IOCTL(sv, (drm_set_version_t *)data, sizeof(sv)); + + retv.drm_di_major = DRM_IF_MAJOR; + retv.drm_di_minor = DRM_IF_MINOR; + retv.drm_dd_major = DRIVER_MAJOR; + retv.drm_dd_minor = DRIVER_MINOR; + + DRM_COPY_TO_USER_IOCTL((drm_set_version_t *)data, retv, sizeof(sv)); + + if (sv.drm_di_major != -1) { + if (sv.drm_di_major != DRM_IF_MAJOR || + sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) + return EINVAL; + if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_dd_minor); + dev->if_version = DRM_MAX(if_version, dev->if_version); + if (sv.drm_di_minor >= 1) { + /* + * Version 1.1 includes tying of DRM to specific device + */ + DRM(set_busid)(dev); + } + } + + if (sv.drm_dd_major != -1) { + if (sv.drm_dd_major != DRIVER_MAJOR || + sv.drm_dd_minor < 0 || sv.drm_dd_minor > DRIVER_MINOR) + return EINVAL; +#ifdef DRIVER_SETVERSION + DRIVER_SETVERSION(dev, &sv); +#endif + } + return 0; +} + --- diff/drivers/char/drm/drm_os_linux.h 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/drm_os_linux.h 2004-02-18 09:03:58.000000000 +0000 @@ -62,8 +62,12 @@ verify_area( VERIFY_READ, uaddr, size ) #define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \ __copy_from_user(arg1, arg2, arg3) +#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \ + __copy_to_user(arg1, arg2, arg3) #define DRM_GET_USER_UNCHECKED(val, uaddr) \ __get_user(val, uaddr) +#define DRM_PUT_USER_UNCHECKED(uaddr, val) \ + __put_user(val, uaddr) /** 'malloc' without the overhead of DRM(alloc)() */ @@ -71,6 +75,8 @@ /** 'free' without the overhead of DRM(free)() */ #define DRM_FREE(x,size) kfree(x) +#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data + /** * Get the pointer to the SAREA. * --- diff/drivers/char/drm/gamma.h 2003-05-21 11:50:14.000000000 +0100 +++ source/drivers/char/drm/gamma.h 2004-02-18 09:03:58.000000000 +0000 @@ -53,6 +53,10 @@ [DRM_IOCTL_NR(DRM_IOCTL_GAMMA_INIT)] = { gamma_dma_init, 1, 1 }, \ [DRM_IOCTL_NR(DRM_IOCTL_GAMMA_COPY)] = { gamma_dma_copy, 1, 1 } +#define DRIVER_PCI_IDS \ + {0x3d3d, 0x0008, 0, "3DLabs GLINT Gamma G1"}, \ + {0, 0, 0, NULL} + #define IOCTL_TABLE_NAME DRM(ioctls) #define IOCTL_FUNC_NAME DRM(ioctl) @@ -104,8 +108,8 @@ return 0; \ } while (0) -#define __HAVE_DMA_IRQ 1 -#define __HAVE_DMA_IRQ_BH 1 +#define __HAVE_IRQ 1 +#define __HAVE_IRQ_BH 1 #define DRIVER_AGP_BUFFERS_MAP( dev ) \ ((drm_gamma_private_t *)((dev)->dev_private))->buffers --- diff/drivers/char/drm/gamma_dma.c 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/gamma_dma.c 2004-02-18 09:03:58.000000000 +0000 @@ -116,7 +116,7 @@ return (!GAMMA_READ(GAMMA_DMACOUNT)); } -irqreturn_t gamma_dma_service( DRM_IRQ_ARGS ) +irqreturn_t gamma_irq_handler( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *)arg; drm_device_dma_t *dma = dev->dma; @@ -262,7 +262,7 @@ gamma_dma_schedule((drm_device_t *)dev, 0); } -void gamma_dma_immediate_bh(void *dev) +void gamma_irq_immediate_bh(void *dev) { gamma_dma_schedule(dev, 0); } @@ -656,12 +656,12 @@ { DRM_DEBUG( "%s\n", __FUNCTION__ ); -#if _HAVE_DMA_IRQ +#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if ( dev->irq ) DRM(irq_uninstall)(dev); + if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); #endif if ( dev->dev_private ) { --- diff/drivers/char/drm/gamma_drv.c 2003-05-21 11:50:14.000000000 +0100 +++ source/drivers/char/drm/gamma_drv.c 2004-02-18 09:03:58.000000000 +0000 @@ -48,6 +48,7 @@ #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" +#include "drm_irq.h" #include "gamma_lists.h" /* NOTE */ #include "drm_lock.h" #include "gamma_lock.h" /* NOTE */ --- diff/drivers/char/drm/i810.h 2003-08-26 10:00:52.000000000 +0100 +++ source/drivers/char/drm/i810.h 2004-02-18 09:03:58.000000000 +0000 @@ -77,7 +77,14 @@ [DRM_IOCTL_NR(DRM_IOCTL_I810_MC)] = { i810_dma_mc, 1, 1 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I810_RSTATUS)] = { i810_rstatus, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I810_FLIP)] = { i810_flip_bufs, 1, 0 } - + +#define DRIVER_PCI_IDS \ + {0x8086, 0x7121, 0, "Intel i810 GMCH"}, \ + {0x8086, 0x7123, 0, "Intel i810-DC100 GMCH"}, \ + {0x8086, 0x7125, 0, "Intel i810E GMCH"}, \ + {0x8086, 0x1132, 0, "Intel i815 GMCH"}, \ + {0, 0, 0, NULL} + #define __HAVE_COUNTERS 4 #define __HAVE_COUNTER6 _DRM_STAT_IRQ @@ -112,7 +119,7 @@ * a noop stub is generated for compatibility. */ /* XXX: Add vblank support? */ -#define __HAVE_DMA_IRQ 0 +#define __HAVE_IRQ 0 /* Buffer customization: */ --- diff/drivers/char/drm/i810_dma.c 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/i810_dma.c 2004-02-18 09:03:58.000000000 +0000 @@ -53,41 +53,41 @@ static inline void i810_print_status_page(drm_device_t *dev) { - drm_device_dma_t *dma = dev->dma; - drm_i810_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_i810_private_t *dev_priv = dev->dev_private; u32 *temp = dev_priv->hw_status_page; - int i; + int i; - DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]); - DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]); - DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]); - DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]); + DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]); + DRM_DEBUG( "hw_status: LpRing Head ptr : %x\n", temp[1]); + DRM_DEBUG( "hw_status: IRing Head ptr : %x\n", temp[2]); + DRM_DEBUG( "hw_status: Reserved : %x\n", temp[3]); DRM_DEBUG( "hw_status: Last Render: %x\n", temp[4]); - DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]); - for(i = 6; i < dma->buf_count + 6; i++) { - DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 6, temp[i]); + DRM_DEBUG( "hw_status: Driver Counter : %d\n", temp[5]); + for(i = 6; i < dma->buf_count + 6; i++) { + DRM_DEBUG( "buffer status idx : %d used: %d\n", i - 6, temp[i]); } } static drm_buf_t *i810_freelist_get(drm_device_t *dev) { - drm_device_dma_t *dma = dev->dma; + drm_device_dma_t *dma = dev->dma; int i; - int used; + int used; /* Linear search might not be the best solution */ - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; /* In use is already a pointer */ - used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, + used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, I810_BUF_CLIENT); if (used == I810_BUF_FREE) { return buf; } } - return NULL; + return NULL; } /* This should only be called if the buffer is not sent to the hardware @@ -96,17 +96,17 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf) { - drm_i810_buf_priv_t *buf_priv = buf->dev_private; - int used; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; + int used; - /* In use is already a pointer */ - used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE); + /* In use is already a pointer */ + used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE); if (used != I810_BUF_CLIENT) { - DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); - return -EINVAL; + DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); + return -EINVAL; } - return 0; + return 0; } static struct file_operations i810_buffer_fops = { @@ -135,7 +135,7 @@ vma->vm_flags |= (VM_IO | VM_DONTCOPY); vma->vm_file = filp; - buf_priv->currently_mapped = I810_BUF_MAPPED; + buf_priv->currently_mapped = I810_BUF_MAPPED; unlock_kernel(); if (remap_page_range(DRM_RPR_ARG(vma) vma->vm_start, @@ -150,8 +150,8 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - drm_i810_private_t *dev_priv = dev->dev_private; - struct file_operations *old_fops; + drm_i810_private_t *dev_priv = dev->dev_private; + struct file_operations *old_fops; int retcode = 0; if (buf_priv->currently_mapped == I810_BUF_MAPPED) @@ -192,8 +192,8 @@ (size_t) buf->total); up_write(¤t->mm->mmap_sem); - buf_priv->currently_mapped = I810_BUF_UNMAPPED; - buf_priv->virtual = 0; + buf_priv->currently_mapped = I810_BUF_UNMAPPED; + buf_priv->virtual = 0; return retcode; } @@ -208,22 +208,22 @@ buf = i810_freelist_get(dev); if (!buf) { retcode = -ENOMEM; - DRM_DEBUG("retcode=%d\n", retcode); + DRM_DEBUG("retcode=%d\n", retcode); return retcode; } retcode = i810_map_buffer(buf, filp); if (retcode) { i810_freelist_put(dev, buf); - DRM_ERROR("mapbuf failed, retcode %d\n", retcode); + DRM_ERROR("mapbuf failed, retcode %d\n", retcode); return retcode; } buf->filp = filp; buf_priv = buf->dev_private; d->granted = 1; - d->request_idx = buf->idx; - d->request_size = buf->total; - d->virtual = buf_priv->virtual; + d->request_idx = buf->idx; + d->request_size = buf->total; + d->virtual = buf_priv->virtual; return retcode; } @@ -232,33 +232,33 @@ { drm_device_dma_t *dma = dev->dma; -#if _HAVE_DMA_IRQ +#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if (dev->irq) DRM(irq_uninstall)(dev); + if (dev->irq_enabled) DRM(irq_uninstall)(dev); #endif if (dev->dev_private) { int i; - drm_i810_private_t *dev_priv = - (drm_i810_private_t *) dev->dev_private; + drm_i810_private_t *dev_priv = + (drm_i810_private_t *) dev->dev_private; if (dev_priv->ring.virtual_start) { - DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, + DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, dev_priv->ring.Size, dev); } - if (dev_priv->hw_status_page) { - pci_free_consistent(dev->pdev, PAGE_SIZE, + if (dev_priv->hw_status_page) { + pci_free_consistent(dev->pdev, PAGE_SIZE, dev_priv->hw_status_page, dev_priv->dma_status_page); - /* Need to rewrite hardware status page */ - I810_WRITE(0x02080, 0x1ffff000); + /* Need to rewrite hardware status page */ + I810_WRITE(0x02080, 0x1ffff000); } - DRM(free)(dev->dev_private, sizeof(drm_i810_private_t), + DRM(free)(dev->dev_private, sizeof(drm_i810_private_t), DRM_MEM_DRIVER); - dev->dev_private = NULL; + dev->dev_private = NULL; for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; @@ -267,73 +267,73 @@ DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total, dev); } } - return 0; + return 0; } static int i810_wait_ring(drm_device_t *dev, int n) { - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_ring_buffer_t *ring = &(dev_priv->ring); - int iters = 0; - unsigned long end; + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_ring_buffer_t *ring = &(dev_priv->ring); + int iters = 0; + unsigned long end; unsigned int last_head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; end = jiffies + (HZ*3); - while (ring->space < n) { - ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->space = ring->head - (ring->tail+8); + while (ring->space < n) { + ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; + ring->space = ring->head - (ring->tail+8); if (ring->space < 0) ring->space += ring->Size; - + if (ring->head != last_head) { end = jiffies + (HZ*3); last_head = ring->head; } - iters++; + iters++; if (time_before(end, jiffies)) { - DRM_ERROR("space: %d wanted %d\n", ring->space, n); - DRM_ERROR("lockup\n"); - goto out_wait_ring; + DRM_ERROR("space: %d wanted %d\n", ring->space, n); + DRM_ERROR("lockup\n"); + goto out_wait_ring; } udelay(1); } out_wait_ring: - return iters; + return iters; } static void i810_kernel_lost_context(drm_device_t *dev) { - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_ring_buffer_t *ring = &(dev_priv->ring); + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_ring_buffer_t *ring = &(dev_priv->ring); - ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->tail = I810_READ(LP_RING + RING_TAIL); - ring->space = ring->head - (ring->tail+8); - if (ring->space < 0) ring->space += ring->Size; + ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; + ring->tail = I810_READ(LP_RING + RING_TAIL); + ring->space = ring->head - (ring->tail+8); + if (ring->space < 0) ring->space += ring->Size; } static int i810_freelist_init(drm_device_t *dev, drm_i810_private_t *dev_priv) { - drm_device_dma_t *dma = dev->dma; - int my_idx = 24; - u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx); - int i; + drm_device_dma_t *dma = dev->dma; + int my_idx = 24; + u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx); + int i; if (dma->buf_count > 1019) { - /* Not enough space in the status page for the freelist */ - return -EINVAL; + /* Not enough space in the status page for the freelist */ + return -EINVAL; } - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; - buf_priv->in_use = hw_status++; - buf_priv->my_use_idx = my_idx; - my_idx += 4; + buf_priv->in_use = hw_status++; + buf_priv->my_use_idx = my_idx; + my_idx += 4; - *buf_priv->in_use = I810_BUF_FREE; + *buf_priv->in_use = I810_BUF_FREE; buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, buf->total, dev); @@ -347,7 +347,7 @@ { struct list_head *list; - memset(dev_priv, 0, sizeof(drm_i810_private_t)); + memset(dev_priv, 0, sizeof(drm_i810_private_t)); list_for_each(list, &dev->maplist->head) { drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head); @@ -355,51 +355,51 @@ r_list->map->type == _DRM_SHM && r_list->map->flags & _DRM_CONTAINS_LOCK ) { dev_priv->sarea_map = r_list->map; - break; - } - } + break; + } + } if (!dev_priv->sarea_map) { dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("can not find sarea!\n"); - return -EINVAL; + i810_dma_cleanup(dev); + DRM_ERROR("can not find sarea!\n"); + return -EINVAL; } DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); if (!dev_priv->mmio_map) { dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("can not find mmio map!\n"); - return -EINVAL; + i810_dma_cleanup(dev); + DRM_ERROR("can not find mmio map!\n"); + return -EINVAL; } DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); if (!dev_priv->buffer_map) { dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("can not find dma buffer map!\n"); - return -EINVAL; + i810_dma_cleanup(dev); + DRM_ERROR("can not find dma buffer map!\n"); + return -EINVAL; } dev_priv->sarea_priv = (drm_i810_sarea_t *) ((u8 *)dev_priv->sarea_map->handle + init->sarea_priv_offset); - dev_priv->ring.Start = init->ring_start; - dev_priv->ring.End = init->ring_end; - dev_priv->ring.Size = init->ring_size; + dev_priv->ring.Start = init->ring_start; + dev_priv->ring.End = init->ring_end; + dev_priv->ring.Size = init->ring_size; - dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base + + dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base + init->ring_start, init->ring_size, dev); - if (dev_priv->ring.virtual_start == NULL) { + if (dev_priv->ring.virtual_start == NULL) { dev->dev_private = (void *) dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("can not ioremap virtual address for" + i810_dma_cleanup(dev); + DRM_ERROR("can not ioremap virtual address for" " ring buffer\n"); - return -ENOMEM; + return -ENOMEM; } - dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; + dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; dev_priv->w = init->w; dev_priv->h = init->h; @@ -415,33 +415,33 @@ dev_priv->back_di1 = init->back_offset | init->pitch_bits; dev_priv->zi1 = init->depth_offset | init->pitch_bits; - /* Program Hardware Status Page */ - dev_priv->hw_status_page = + /* Program Hardware Status Page */ + dev_priv->hw_status_page = pci_alloc_consistent(dev->pdev, PAGE_SIZE, &dev_priv->dma_status_page); - if (!dev_priv->hw_status_page) { + if (!dev_priv->hw_status_page) { dev->dev_private = (void *)dev_priv; i810_dma_cleanup(dev); DRM_ERROR("Can not allocate hardware status page\n"); return -ENOMEM; } - memset(dev_priv->hw_status_page, 0, PAGE_SIZE); - DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page); + memset(dev_priv->hw_status_page, 0, PAGE_SIZE); + DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page); I810_WRITE(0x02080, dev_priv->dma_status_page); - DRM_DEBUG("Enabled hardware status page\n"); + DRM_DEBUG("Enabled hardware status page\n"); - /* Now we need to init our freelist */ + /* Now we need to init our freelist */ if (i810_freelist_init(dev, dev_priv) != 0) { dev->dev_private = (void *)dev_priv; - i810_dma_cleanup(dev); - DRM_ERROR("Not enough space in the status page for" + i810_dma_cleanup(dev); + DRM_ERROR("Not enough space in the status page for" " the freelist\n"); - return -ENOMEM; + return -ENOMEM; } dev->dev_private = (void *)dev_priv; - return 0; + return 0; } /* i810 DRM version 1.1 used a smaller init structure with different @@ -476,12 +476,12 @@ /* This is a v1.1 client, fix the params */ DRM_INFO("Using PRE v1.2 init.\n"); - init->pitch_bits = init->h; - init->pitch = init->w; - init->h = init->overlay_physical; - init->w = init->overlay_offset; - init->overlay_physical = 0; - init->overlay_offset = 0; + init->pitch_bits = init->h; + init->pitch = init->w; + init->h = init->overlay_physical; + init->w = init->overlay_offset; + init->overlay_physical = 0; + init->overlay_offset = 0; } return 0; @@ -490,55 +490,55 @@ int i810_dma_init(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_i810_private_t *dev_priv; - drm_i810_init_t init; - int retcode = 0; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_i810_private_t *dev_priv; + drm_i810_init_t init; + int retcode = 0; /* Get only the init func */ if (copy_from_user(&init, (void *)arg, sizeof(drm_i810_init_func_t))) return -EFAULT; - switch(init.func) { - case I810_INIT_DMA: - /* This case is for backward compatibility. It + switch(init.func) { + case I810_INIT_DMA: + /* This case is for backward compatibility. It * handles XFree 4.1.0 and 4.2.0, and has to * do some parameter checking as described below. * It will someday go away. */ retcode = i810_dma_init_compat(&init, arg); - if (retcode) + if (retcode) return retcode; - dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), + dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), DRM_MEM_DRIVER); - if (dev_priv == NULL) - return -ENOMEM; - retcode = i810_dma_initialize(dev, dev_priv, &init); + if (dev_priv == NULL) + return -ENOMEM; + retcode = i810_dma_initialize(dev, dev_priv, &init); break; default: - case I810_INIT_DMA_1_4: + case I810_INIT_DMA_1_4: DRM_INFO("Using v1.4 init.\n"); - if (copy_from_user(&init, (drm_i810_init_t *)arg, + if (copy_from_user(&init, (drm_i810_init_t *)arg, sizeof(drm_i810_init_t))) { return -EFAULT; } - dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), + dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) return -ENOMEM; - retcode = i810_dma_initialize(dev, dev_priv, &init); + retcode = i810_dma_initialize(dev, dev_priv, &init); break; - case I810_CLEANUP_DMA: - DRM_INFO("DMA Cleanup\n"); - retcode = i810_dma_cleanup(dev); - break; + case I810_CLEANUP_DMA: + DRM_INFO("DMA Cleanup\n"); + retcode = i810_dma_cleanup(dev); + break; } - return retcode; + return retcode; } @@ -552,7 +552,7 @@ static void i810EmitContextVerified( drm_device_t *dev, volatile unsigned int *code ) { - drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; RING_LOCALS; @@ -586,7 +586,7 @@ static void i810EmitTexVerified( drm_device_t *dev, volatile unsigned int *code ) { - drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; RING_LOCALS; @@ -622,7 +622,7 @@ static void i810EmitDestVerified( drm_device_t *dev, volatile unsigned int *code ) { - drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_private_t *dev_priv = dev->dev_private; unsigned int tmp; RING_LOCALS; @@ -658,8 +658,8 @@ static void i810EmitState( drm_device_t *dev ) { - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int dirty = sarea_priv->dirty; DRM_DEBUG("%s %x\n", __FUNCTION__, dirty); @@ -693,8 +693,8 @@ unsigned int clear_color, unsigned int clear_zval ) { - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; int pitch = dev_priv->pitch; @@ -703,17 +703,17 @@ RING_LOCALS; if ( dev_priv->current_page == 1 ) { - unsigned int tmp = flags; - + unsigned int tmp = flags; + flags &= ~(I810_FRONT | I810_BACK); if (tmp & I810_FRONT) flags |= I810_BACK; if (tmp & I810_BACK) flags |= I810_FRONT; } - i810_kernel_lost_context(dev); + i810_kernel_lost_context(dev); - if (nbox > I810_NR_SAREA_CLIPRECTS) - nbox = I810_NR_SAREA_CLIPRECTS; + if (nbox > I810_NR_SAREA_CLIPRECTS) + nbox = I810_NR_SAREA_CLIPRECTS; for (i = 0 ; i < nbox ; i++, pbox++) { unsigned int x = pbox->x1; @@ -728,7 +728,7 @@ pbox->y2 > dev_priv->h) continue; - if ( flags & I810_FRONT ) { + if ( flags & I810_FRONT ) { BEGIN_LP_RING( 6 ); OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); @@ -768,8 +768,8 @@ static void i810_dma_dispatch_swap( drm_device_t *dev ) { - drm_i810_private_t *dev_priv = dev->dev_private; - drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; int pitch = dev_priv->pitch; @@ -779,10 +779,10 @@ DRM_DEBUG("swapbuffers\n"); - i810_kernel_lost_context(dev); + i810_kernel_lost_context(dev); - if (nbox > I810_NR_SAREA_CLIPRECTS) - nbox = I810_NR_SAREA_CLIPRECTS; + if (nbox > I810_NR_SAREA_CLIPRECTS) + nbox = I810_NR_SAREA_CLIPRECTS; for (i = 0 ; i < nbox; i++, pbox++) { @@ -820,19 +820,19 @@ int discard, int used) { - drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_clip_rect_t *box = sarea_priv->boxes; - int nbox = sarea_priv->nbox; + drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_clip_rect_t *box = sarea_priv->boxes; + int nbox = sarea_priv->nbox; unsigned long address = (unsigned long)buf->bus_address; unsigned long start = address - dev->agp->base; int i = 0; - RING_LOCALS; + RING_LOCALS; - i810_kernel_lost_context(dev); + i810_kernel_lost_context(dev); - if (nbox > I810_NR_SAREA_CLIPRECTS) + if (nbox > I810_NR_SAREA_CLIPRECTS) nbox = I810_NR_SAREA_CLIPRECTS; if (used > 4*1024) @@ -898,7 +898,7 @@ static void i810_dma_dispatch_flip( drm_device_t *dev ) { - drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_private_t *dev_priv = dev->dev_private; int pitch = dev_priv->pitch; RING_LOCALS; @@ -907,10 +907,10 @@ dev_priv->current_page, dev_priv->sarea_priv->pf_current_page); - i810_kernel_lost_context(dev); + i810_kernel_lost_context(dev); BEGIN_LP_RING( 2 ); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); OUT_RING( 0 ); ADVANCE_LP_RING(); @@ -945,44 +945,44 @@ void i810_dma_quiescent(drm_device_t *dev) { - drm_i810_private_t *dev_priv = dev->dev_private; - RING_LOCALS; + drm_i810_private_t *dev_priv = dev->dev_private; + RING_LOCALS; -/* printk("%s\n", __FUNCTION__); */ +/* printk("%s\n", __FUNCTION__); */ - i810_kernel_lost_context(dev); + i810_kernel_lost_context(dev); - BEGIN_LP_RING(4); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( 0 ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); + BEGIN_LP_RING(4); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); i810_wait_ring( dev, dev_priv->ring.Size - 8 ); } static int i810_flush_queue(drm_device_t *dev) { - drm_i810_private_t *dev_priv = dev->dev_private; + drm_i810_private_t *dev_priv = dev->dev_private; drm_device_dma_t *dma = dev->dma; - int i, ret = 0; - RING_LOCALS; + int i, ret = 0; + RING_LOCALS; -/* printk("%s\n", __FUNCTION__); */ +/* printk("%s\n", __FUNCTION__); */ - i810_kernel_lost_context(dev); + i810_kernel_lost_context(dev); - BEGIN_LP_RING(2); - OUT_RING( CMD_REPORT_HEAD ); - OUT_RING( 0 ); - ADVANCE_LP_RING(); + BEGIN_LP_RING(2); + OUT_RING( CMD_REPORT_HEAD ); + OUT_RING( 0 ); + ADVANCE_LP_RING(); i810_wait_ring( dev, dev_priv->ring.Size - 8 ); - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; + for (i = 0; i < dma->buf_count; i++) { + drm_buf_t *buf = dma->buflist[ i ]; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE, I810_BUF_FREE); @@ -993,7 +993,7 @@ DRM_DEBUG("still on client\n"); } - return ret; + return ret; } /* Must be called with the lock held */ @@ -1005,14 +1005,14 @@ int i; if (!dma) return; - if (!dev->dev_private) return; + if (!dev->dev_private) return; if (!dma->buflist) return; - i810_flush_queue(dev); + i810_flush_queue(dev); for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_i810_buf_priv_t *buf_priv = buf->dev_private; + drm_buf_t *buf = dma->buflist[ i ]; + drm_i810_buf_priv_t *buf_priv = buf->dev_private; if (buf->filp == filp && buf_priv) { int used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, @@ -1021,7 +1021,7 @@ if (used == I810_BUF_CLIENT) DRM_DEBUG("reclaimed from client\n"); if (buf_priv->currently_mapped == I810_BUF_MAPPED) - buf_priv->currently_mapped = I810_BUF_UNMAPPED; + buf_priv->currently_mapped = I810_BUF_UNMAPPED; } } } @@ -1029,16 +1029,16 @@ int i810_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_flush_ioctl called without lock held\n"); return -EINVAL; } - i810_flush_queue(dev); - return 0; + i810_flush_queue(dev); + return 0; } @@ -1048,10 +1048,10 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_device_dma_t *dma = dev->dma; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u32 *hw_status = dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + u32 *hw_status = dev_priv->hw_status_page; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; drm_i810_vertex_t vertex; if (copy_from_user(&vertex, (drm_i810_vertex_t *)arg, sizeof(vertex))) @@ -1072,10 +1072,10 @@ dma->buflist[ vertex.idx ], vertex.discard, vertex.used ); - atomic_add(vertex.used, &dev->counts[_DRM_STAT_SECONDARY]); + atomic_add(vertex.used, &dev->counts[_DRM_STAT_SECONDARY]); atomic_inc(&dev->counts[_DRM_STAT_DMA]); sarea_priv->last_enqueue = dev_priv->counter-1; - sarea_priv->last_dispatch = (int) hw_status[5]; + sarea_priv->last_dispatch = (int) hw_status[5]; return 0; } @@ -1089,7 +1089,7 @@ drm_device_t *dev = priv->dev; drm_i810_clear_t clear; - if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear))) + if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear))) return -EFAULT; if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { @@ -1097,15 +1097,15 @@ return -EINVAL; } - /* GH: Someone's doing nasty things... */ - if (!dev->dev_private) { - return -EINVAL; - } + /* GH: Someone's doing nasty things... */ + if (!dev->dev_private) { + return -EINVAL; + } i810_dma_dispatch_clear( dev, clear.flags, clear.clear_color, clear.clear_depth ); - return 0; + return 0; } int i810_swap_bufs(struct inode *inode, struct file *filp, @@ -1122,20 +1122,20 @@ } i810_dma_dispatch_swap( dev ); - return 0; + return 0; } int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - drm_file_t *priv = filp->private_data; + drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u32 *hw_status = dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + u32 *hw_status = dev_priv->hw_status_page; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; - sarea_priv->last_dispatch = (int) hw_status[5]; + sarea_priv->last_dispatch = (int) hw_status[5]; return 0; } @@ -1146,12 +1146,12 @@ drm_device_t *dev = priv->dev; int retcode = 0; drm_i810_dma_t d; - drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - u32 *hw_status = dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; + u32 *hw_status = dev_priv->hw_status_page; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; - if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d))) + if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d))) return -EFAULT; if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { @@ -1168,7 +1168,7 @@ if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d))) return -EFAULT; - sarea_priv->last_dispatch = (int) hw_status[5]; + sarea_priv->last_dispatch = (int) hw_status[5]; return retcode; } @@ -1384,5 +1384,5 @@ i810_do_init_pageflip( dev ); i810_dma_dispatch_flip( dev ); - return 0; + return 0; } --- diff/drivers/char/drm/i830.h 2003-05-21 11:50:14.000000000 +0100 +++ source/drivers/char/drm/i830.h 2004-02-18 09:03:58.000000000 +0000 @@ -77,6 +77,13 @@ [DRM_IOCTL_NR(DRM_IOCTL_I830_GETPARAM)] = { i830_getparam, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I830_SETPARAM)] = { i830_setparam, 1, 0 } +#define DRIVER_PCI_IDS \ + {0x8086, 0x3577, 0, "Intel i830M GMCH"}, \ + {0x8086, 0x2562, 0, "Intel i845G GMCH"}, \ + {0x8086, 0x3582, 0, "Intel i852GM/i855GM GMCH"}, \ + {0x8086, 0x2572, 0, "Intel i865G GMCH"}, \ + {0, 0, 0, NULL} + #define __HAVE_COUNTERS 4 #define __HAVE_COUNTER6 _DRM_STAT_IRQ #define __HAVE_COUNTER7 _DRM_STAT_PRIMARY @@ -115,10 +122,10 @@ #define USE_IRQS 0 #if USE_IRQS -#define __HAVE_DMA_IRQ 1 +#define __HAVE_IRQ 1 #define __HAVE_SHARED_IRQ 1 #else -#define __HAVE_DMA_IRQ 0 +#define __HAVE_IRQ 0 #endif --- diff/drivers/char/drm/i830_dma.c 2003-06-09 14:18:18.000000000 +0100 +++ source/drivers/char/drm/i830_dma.c 2004-02-18 09:03:58.000000000 +0000 @@ -231,12 +231,12 @@ { drm_device_dma_t *dma = dev->dma; -#if _HAVE_DMA_IRQ +#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if (dev->irq) DRM(irq_uninstall)(dev); + if (dev->irq_enabled) DRM(irq_uninstall)(dev); #endif if (dev->dev_private) { @@ -1539,7 +1539,7 @@ switch( param.param ) { case I830_PARAM_IRQ_ACTIVE: - value = dev->irq ? 1 : 0; + value = dev->irq_enabled; break; default: return -EINVAL; --- diff/drivers/char/drm/i830_drv.c 2003-05-21 11:50:14.000000000 +0100 +++ source/drivers/char/drm/i830_drv.c 2004-02-18 09:03:58.000000000 +0000 @@ -50,6 +50,7 @@ #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" +#include "drm_irq.h" #include "drm_lock.h" #include "drm_memory.h" #include "drm_proc.h" --- diff/drivers/char/drm/i830_irq.c 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/i830_irq.c 2004-02-18 09:03:58.000000000 +0000 @@ -35,7 +35,7 @@ #include -irqreturn_t DRM(dma_service)( DRM_IRQ_ARGS ) +irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *)arg; drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; --- diff/drivers/char/drm/mga.h 2003-05-21 11:50:14.000000000 +0100 +++ source/drivers/char/drm/mga.h 2004-02-18 09:03:58.000000000 +0000 @@ -64,6 +64,12 @@ [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_MGA_GETPARAM)]= { mga_getparam, 1, 0 }, +#define DRIVER_PCI_IDS \ + {0x102b, 0x0521, 0, "Matrox G200 (AGP)"}, \ + {0x102b, 0x0525, 0, "Matrox G400/G450 (AGP)"}, \ + {0x102b, 0x2527, 0, "Matrox G550 (AGP)"}, \ + {0, 0, 0, NULL} + #define __HAVE_COUNTERS 3 #define __HAVE_COUNTER6 _DRM_STAT_IRQ #define __HAVE_COUNTER7 _DRM_STAT_PRIMARY @@ -78,7 +84,7 @@ /* DMA customization: */ #define __HAVE_DMA 1 -#define __HAVE_DMA_IRQ 1 +#define __HAVE_IRQ 1 #define __HAVE_VBL_IRQ 1 #define __HAVE_SHARED_IRQ 1 --- diff/drivers/char/drm/mga_dma.c 2003-06-09 14:18:18.000000000 +0100 +++ source/drivers/char/drm/mga_dma.c 2004-02-18 09:03:58.000000000 +0000 @@ -500,14 +500,6 @@ return DRM_ERR(EINVAL); } - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR( "failed to find framebuffer!\n" ); - /* Assign dev_private so we can do cleanup. */ - dev->dev_private = (void *)dev_priv; - mga_do_cleanup_dma( dev ); - return DRM_ERR(EINVAL); - } DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); if(!dev_priv->mmio) { DRM_ERROR( "failed to find mmio region!\n" ); @@ -639,12 +631,12 @@ { DRM_DEBUG( "\n" ); -#if _HAVE_DMA_IRQ +#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if ( dev->irq ) DRM(irq_uninstall)(dev); + if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); #endif if ( dev->dev_private ) { --- diff/drivers/char/drm/mga_drv.c 2002-10-16 04:27:56.000000000 +0100 +++ source/drivers/char/drm/mga_drv.c 2004-02-18 09:03:58.000000000 +0000 @@ -45,6 +45,7 @@ #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" +#include "drm_irq.h" #include "drm_lock.h" #include "drm_memory.h" #include "drm_proc.h" --- diff/drivers/char/drm/mga_drv.h 2003-06-09 14:18:18.000000000 +0100 +++ source/drivers/char/drm/mga_drv.h 2004-02-18 09:03:58.000000000 +0000 @@ -91,7 +91,6 @@ unsigned int texture_size; drm_local_map_t *sarea; - drm_local_map_t *fb; drm_local_map_t *mmio; drm_local_map_t *status; drm_local_map_t *warp; --- diff/drivers/char/drm/mga_irq.c 2003-05-21 11:50:14.000000000 +0100 +++ source/drivers/char/drm/mga_irq.c 2004-02-18 09:03:58.000000000 +0000 @@ -36,7 +36,7 @@ #include "mga_drm.h" #include "mga_drv.h" -irqreturn_t mga_dma_service( DRM_IRQ_ARGS ) +irqreturn_t mga_irq_handler( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *) arg; drm_mga_private_t *dev_priv = --- diff/drivers/char/drm/r128.h 2003-08-26 10:00:52.000000000 +0100 +++ source/drivers/char/drm/r128.h 2004-02-18 09:03:58.000000000 +0000 @@ -79,6 +79,46 @@ [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, \ [DRM_IOCTL_NR(DRM_IOCTL_R128_GETPARAM)] = { r128_getparam, 1, 0 }, +#define DRIVER_PCI_IDS \ + {0x1002, 0x4c45, 0, "ATI Rage 128 Mobility LE (PCI)"}, \ + {0x1002, 0x4c46, 0, "ATI Rage 128 Mobility LF (AGP)"}, \ + {0x1002, 0x4d46, 0, "ATI Rage 128 Mobility MF (AGP)"}, \ + {0x1002, 0x4d4c, 0, "ATI Rage 128 Mobility ML (AGP)"}, \ + {0x1002, 0x5041, 0, "ATI Rage 128 Pro PA (PCI)"}, \ + {0x1002, 0x5042, 0, "ATI Rage 128 Pro PB (AGP)"}, \ + {0x1002, 0x5043, 0, "ATI Rage 128 Pro PC (AGP)"}, \ + {0x1002, 0x5044, 0, "ATI Rage 128 Pro PD (PCI)"}, \ + {0x1002, 0x5045, 0, "ATI Rage 128 Pro PE (AGP)"}, \ + {0x1002, 0x5046, 0, "ATI Rage 128 Pro PF (AGP)"}, \ + {0x1002, 0x5047, 0, "ATI Rage 128 Pro PG (PCI)"}, \ + {0x1002, 0x5048, 0, "ATI Rage 128 Pro PH (AGP)"}, \ + {0x1002, 0x5049, 0, "ATI Rage 128 Pro PI (AGP)"}, \ + {0x1002, 0x504A, 0, "ATI Rage 128 Pro PJ (PCI)"}, \ + {0x1002, 0x504B, 0, "ATI Rage 128 Pro PK (AGP)"}, \ + {0x1002, 0x504C, 0, "ATI Rage 128 Pro PL (AGP)"}, \ + {0x1002, 0x504D, 0, "ATI Rage 128 Pro PM (PCI)"}, \ + {0x1002, 0x504E, 0, "ATI Rage 128 Pro PN (AGP)"}, \ + {0x1002, 0x504F, 0, "ATI Rage 128 Pro PO (AGP)"}, \ + {0x1002, 0x5050, 0, "ATI Rage 128 Pro PP (PCI)"}, \ + {0x1002, 0x5051, 0, "ATI Rage 128 Pro PQ (AGP)"}, \ + {0x1002, 0x5052, 0, "ATI Rage 128 Pro PR (PCI)"}, \ + {0x1002, 0x5053, 0, "ATI Rage 128 Pro PS (PCI)"}, \ + {0x1002, 0x5054, 0, "ATI Rage 128 Pro PT (AGP)"}, \ + {0x1002, 0x5055, 0, "ATI Rage 128 Pro PU (AGP)"}, \ + {0x1002, 0x5056, 0, "ATI Rage 128 Pro PV (PCI)"}, \ + {0x1002, 0x5057, 0, "ATI Rage 128 Pro PW (AGP)"}, \ + {0x1002, 0x5058, 0, "ATI Rage 128 Pro PX (AGP)"}, \ + {0x1002, 0x5245, 0, "ATI Rage 128 RE (PCI)"}, \ + {0x1002, 0x5246, 0, "ATI Rage 128 RF (AGP)"}, \ + {0x1002, 0x5247, 0, "ATI Rage 128 RG (AGP)"}, \ + {0x1002, 0x524b, 0, "ATI Rage 128 RK (PCI)"}, \ + {0x1002, 0x524c, 0, "ATI Rage 128 RL (AGP)"}, \ + {0x1002, 0x534d, 0, "ATI Rage 128 SM (AGP)"}, \ + {0x1002, 0x5446, 0, "ATI Rage 128 Pro Ultra TF (AGP)"}, \ + {0x1002, 0x544C, 0, "ATI Rage 128 Pro Ultra TL (AGP)"}, \ + {0x1002, 0x5452, 0, "ATI Rage 128 Pro Ultra TR (AGP)"}, \ + {0, 0, 0, NULL} + /* Driver customization: */ #define DRIVER_PRERELEASE() do { \ @@ -97,7 +137,7 @@ /* DMA customization: */ #define __HAVE_DMA 1 -#define __HAVE_DMA_IRQ 1 +#define __HAVE_IRQ 1 #define __HAVE_VBL_IRQ 1 #define __HAVE_SHARED_IRQ 1 --- diff/drivers/char/drm/r128_cce.c 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/r128_cce.c 2004-02-18 09:03:58.000000000 +0000 @@ -212,7 +212,7 @@ int i; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( GET_RING_HEAD( &dev_priv->ring ) == dev_priv->ring.tail ) { + if ( GET_RING_HEAD( dev_priv ) == dev_priv->ring.tail ) { int pm4stat = R128_READ( R128_PM4_STAT ); if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >= dev_priv->cce_fifo_size ) && @@ -238,7 +238,8 @@ r128_do_wait_for_idle( dev_priv ); R128_WRITE( R128_PM4_BUFFER_CNTL, - dev_priv->cce_mode | dev_priv->ring.size_l2qw ); + dev_priv->cce_mode | dev_priv->ring.size_l2qw + | R128_PM4_BUFFER_CNTL_NOUPDATE ); R128_READ( R128_PM4_BUFFER_ADDR ); /* as per the sample code */ R128_WRITE( R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN ); @@ -253,7 +254,6 @@ { R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); - SET_RING_HEAD( &dev_priv->ring, 0 ); dev_priv->ring.tail = 0; } @@ -264,7 +264,8 @@ static void r128_do_cce_stop( drm_r128_private_t *dev_priv ) { R128_WRITE( R128_PM4_MICRO_CNTL, 0 ); - R128_WRITE( R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4 ); + R128_WRITE( R128_PM4_BUFFER_CNTL, + R128_PM4_NONPM4 | R128_PM4_BUFFER_CNTL_NOUPDATE ); dev_priv->cce_running = 0; } @@ -333,26 +334,6 @@ R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); - /* DL_RPTR_ADDR is a physical address in AGP space. */ - SET_RING_HEAD( &dev_priv->ring, 0 ); - - if ( !dev_priv->is_pci ) { - R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, - dev_priv->ring_rptr->offset ); - } else { - drm_sg_mem_t *entry = dev->sg; - unsigned long tmp_ofs, page_ofs; - - tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; - page_ofs = tmp_ofs >> PAGE_SHIFT; - - R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, - entry->busaddr[page_ofs]); - DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n", - (unsigned long) entry->busaddr[page_ofs], - entry->handle + tmp_ofs ); - } - /* Set watermark control */ R128_WRITE( R128_PM4_BUFFER_WM_CNTL, ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) @@ -486,13 +467,6 @@ return DRM_ERR(EINVAL); } - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR("could not find framebuffer!\n"); - dev->dev_private = (void *)dev_priv; - r128_do_cleanup_cce( dev ); - return DRM_ERR(EINVAL); - } DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); if(!dev_priv->mmio) { DRM_ERROR("could not find mmio region!\n"); @@ -567,9 +541,6 @@ #endif dev_priv->cce_buffers_offset = dev->sg->handle; - dev_priv->ring.head = ((__volatile__ u32 *) - dev_priv->ring_rptr->handle); - dev_priv->ring.start = (u32 *)dev_priv->cce_ring->handle; dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle + init->ring_size / sizeof(u32)); @@ -580,7 +551,6 @@ (dev_priv->ring.size / sizeof(u32)) - 1; dev_priv->ring.high_mark = 128; - dev_priv->ring.ring_rptr = dev_priv->ring_rptr; dev_priv->sarea_priv->last_frame = 0; R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame ); @@ -589,8 +559,9 @@ R128_WRITE( R128_LAST_DISPATCH_REG, dev_priv->sarea_priv->last_dispatch ); -#if __REALLY_HAVE_SG +#if __REALLY_HAVE_AGP if ( dev_priv->is_pci ) { +#endif if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, &dev_priv->bus_pci_gart) ) { DRM_ERROR( "failed to init PCI GART!\n" ); @@ -599,6 +570,7 @@ return DRM_ERR(ENOMEM); } R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart ); +#if __REALLY_HAVE_AGP } #endif @@ -615,12 +587,12 @@ int r128_do_cleanup_cce( drm_device_t *dev ) { -#if _HAVE_DMA_IRQ +#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if ( dev->irq ) DRM(irq_uninstall)(dev); + if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); #endif if ( dev->dev_private ) { @@ -901,7 +873,7 @@ int i; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - r128_update_ring_snapshot( ring ); + r128_update_ring_snapshot( dev_priv ); if ( ring->space >= n ) return 0; DRM_UDELAY( 1 ); --- diff/drivers/char/drm/r128_drv.c 2002-10-16 04:27:48.000000000 +0100 +++ source/drivers/char/drm/r128_drv.c 2004-02-18 09:03:58.000000000 +0000 @@ -47,6 +47,7 @@ #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" +#include "drm_irq.h" #include "drm_lock.h" #include "drm_memory.h" #include "drm_proc.h" --- diff/drivers/char/drm/r128_drv.h 2003-08-20 14:16:27.000000000 +0100 +++ source/drivers/char/drm/r128_drv.h 2004-02-18 09:03:58.000000000 +0000 @@ -34,8 +34,7 @@ #ifndef __R128_DRV_H__ #define __R128_DRV_H__ -#define GET_RING_HEAD(ring) DRM_READ32( (ring)->ring_rptr, 0 ) /* (ring)->head */ -#define SET_RING_HEAD(ring,val) DRM_WRITE32( (ring)->ring_rptr, 0, (val) ) /* (ring)->head */ +#define GET_RING_HEAD(dev_priv) R128_READ( R128_PM4_BUFFER_DL_RPTR ) typedef struct drm_r128_freelist { unsigned int age; @@ -50,13 +49,11 @@ int size; int size_l2qw; - volatile u32 *head; u32 tail; u32 tail_mask; int space; int high_mark; - drm_local_map_t *ring_rptr; } drm_r128_ring_buffer_t; typedef struct drm_r128_private { @@ -100,7 +97,6 @@ u32 span_pitch_offset_c; drm_local_map_t *sarea; - drm_local_map_t *fb; drm_local_map_t *mmio; drm_local_map_t *cce_ring; drm_local_map_t *ring_rptr; @@ -132,14 +128,6 @@ extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); -static __inline__ void -r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring ) -{ - ring->space = (GET_RING_HEAD( ring ) - ring->tail) * sizeof(u32); - if ( ring->space <= 0 ) - ring->space += ring->size; -} - extern int r128_do_cce_idle( drm_r128_private_t *dev_priv ); extern int r128_do_cleanup_cce( drm_device_t *dev ); extern int r128_do_cleanup_pageflip( drm_device_t *dev ); @@ -279,6 +267,7 @@ # define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) # define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) # define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) +# define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27) #define R128_PM4_BUFFER_WM_CNTL 0x0708 # define R128_WMA_SHIFT 0 @@ -403,6 +392,15 @@ (pkt) | ((n) << 16)) +static __inline__ void +r128_update_ring_snapshot( drm_r128_private_t *dev_priv ) +{ + drm_r128_ring_buffer_t *ring = &dev_priv->ring; + ring->space = (GET_RING_HEAD( dev_priv ) - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; +} + /* ================================================================ * Misc helper macros */ @@ -412,7 +410,7 @@ drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i; \ if ( ring->space < ring->high_mark ) { \ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ - r128_update_ring_snapshot( ring ); \ + r128_update_ring_snapshot( dev_priv ); \ if ( ring->space >= ring->high_mark ) \ goto __ring_space_done; \ DRM_UDELAY(1); \ @@ -445,17 +443,10 @@ * Ring control */ -#if defined(__powerpc__) -#define r128_flush_write_combine() (void) GET_RING_HEAD( &dev_priv->ring ) -#else -#define r128_flush_write_combine() DRM_WRITEMEMORYBARRIER() -#endif - - #define R128_VERBOSE 0 #define RING_LOCALS \ - int write; unsigned int tail_mask; volatile u32 *ring; + int write, _nr; unsigned int tail_mask; volatile u32 *ring; #define BEGIN_RING( n ) do { \ if ( R128_VERBOSE ) { \ @@ -463,9 +454,10 @@ (n), __FUNCTION__ ); \ } \ if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ + COMMIT_RING(); \ r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \ } \ - dev_priv->ring.space -= (n) * sizeof(u32); \ + _nr = n; dev_priv->ring.space -= (n) * sizeof(u32); \ ring = dev_priv->ring.start; \ write = dev_priv->ring.tail; \ tail_mask = dev_priv->ring.tail_mask; \ @@ -488,9 +480,23 @@ dev_priv->ring.start, \ write * sizeof(u32) ); \ } \ - r128_flush_write_combine(); \ - dev_priv->ring.tail = write; \ - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); \ + if (((dev_priv->ring.tail + _nr) & tail_mask) != write) { \ + DRM_ERROR( \ + "ADVANCE_RING(): mismatch: nr: %x write: %x line: %d\n", \ + ((dev_priv->ring.tail + _nr) & tail_mask), \ + write, __LINE__); \ + } else \ + dev_priv->ring.tail = write; \ +} while (0) + +#define COMMIT_RING() do { \ + if ( R128_VERBOSE ) { \ + DRM_INFO( "COMMIT_RING() tail=0x%06x\n", \ + dev_priv->ring.tail ); \ + } \ + DRM_MEMORYBARRIER(); \ + R128_WRITE( R128_PM4_BUFFER_DL_WPTR, dev_priv->ring.tail ); \ + R128_READ( R128_PM4_BUFFER_DL_WPTR ); \ } while (0) #define OUT_RING( x ) do { \ --- diff/drivers/char/drm/r128_irq.c 2003-05-21 11:50:14.000000000 +0100 +++ source/drivers/char/drm/r128_irq.c 2004-02-18 09:03:58.000000000 +0000 @@ -36,7 +36,7 @@ #include "r128_drm.h" #include "r128_drv.h" -irqreturn_t r128_dma_service( DRM_IRQ_ARGS ) +irqreturn_t r128_irq_handler( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *) arg; drm_r128_private_t *dev_priv = --- diff/drivers/char/drm/r128_state.c 2003-08-20 14:16:27.000000000 +0100 +++ source/drivers/char/drm/r128_state.c 2004-02-18 09:03:58.000000000 +0000 @@ -45,7 +45,7 @@ RING_LOCALS; DRM_DEBUG( " %s\n", __FUNCTION__ ); - BEGIN_RING( 17 ); + BEGIN_RING( (count < 3? count: 3) * 5 + 2 ); if ( count >= 1 ) { OUT_RING( CCE_PACKET0( R128_AUX1_SC_LEFT, 3 ) ); @@ -1269,6 +1269,7 @@ sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; r128_cce_dispatch_clear( dev, &clear ); + COMMIT_RING(); /* Make sure we restore the 3D state next time. */ @@ -1304,8 +1305,10 @@ R128_WRITE( R128_CRTC_OFFSET, dev_priv->crtc_offset ); R128_WRITE( R128_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); - if (dev_priv->current_page != 0) + if (dev_priv->current_page != 0) { r128_cce_dispatch_flip( dev ); + COMMIT_RING(); + } dev_priv->page_flipping = 0; return 0; @@ -1330,6 +1333,7 @@ r128_cce_dispatch_flip( dev ); + COMMIT_RING(); return 0; } @@ -1351,6 +1355,7 @@ dev_priv->sarea_priv->dirty |= (R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS); + COMMIT_RING(); return 0; } @@ -1410,6 +1415,7 @@ r128_cce_dispatch_vertex( dev, buf ); + COMMIT_RING(); return 0; } @@ -1481,6 +1487,7 @@ r128_cce_dispatch_indices( dev, buf, elts.start, elts.end, count ); + COMMIT_RING(); return 0; } @@ -1490,6 +1497,7 @@ drm_device_dma_t *dma = dev->dma; drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_blit_t blit; + int ret; LOCK_TEST_WITH_RETURN( dev, filp ); @@ -1507,7 +1515,10 @@ RING_SPACE_TEST_WITH_RETURN( dev_priv ); VB_AGE_TEST_WITH_RETURN( dev_priv ); - return r128_cce_dispatch_blit( filp, dev, &blit ); + ret = r128_cce_dispatch_blit( filp, dev, &blit ); + + COMMIT_RING(); + return ret; } int r128_cce_depth( DRM_IOCTL_ARGS ) @@ -1515,6 +1526,7 @@ DRM_DEVICE; drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_depth_t depth; + int ret; LOCK_TEST_WITH_RETURN( dev, filp ); @@ -1523,18 +1535,20 @@ RING_SPACE_TEST_WITH_RETURN( dev_priv ); + ret = DRM_ERR(EINVAL); switch ( depth.func ) { case R128_WRITE_SPAN: - return r128_cce_dispatch_write_span( dev, &depth ); + ret = r128_cce_dispatch_write_span( dev, &depth ); case R128_WRITE_PIXELS: - return r128_cce_dispatch_write_pixels( dev, &depth ); + ret = r128_cce_dispatch_write_pixels( dev, &depth ); case R128_READ_SPAN: - return r128_cce_dispatch_read_span( dev, &depth ); + ret = r128_cce_dispatch_read_span( dev, &depth ); case R128_READ_PIXELS: - return r128_cce_dispatch_read_pixels( dev, &depth ); + ret = r128_cce_dispatch_read_pixels( dev, &depth ); } - return DRM_ERR(EINVAL); + COMMIT_RING(); + return ret; } int r128_cce_stipple( DRM_IOCTL_ARGS ) @@ -1557,6 +1571,7 @@ r128_cce_dispatch_stipple( dev, mask ); + COMMIT_RING(); return 0; } @@ -1632,6 +1647,7 @@ */ r128_cce_dispatch_indirect( dev, buf, indirect.start, indirect.end ); + COMMIT_RING(); return 0; } --- diff/drivers/char/drm/radeon.h 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/radeon.h 2004-02-18 09:03:58.000000000 +0000 @@ -51,7 +51,7 @@ #define DRIVER_DATE "20020828" #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 9 +#define DRIVER_MINOR 10 #define DRIVER_PATCHLEVEL 0 /* Interface history: @@ -81,6 +81,9 @@ * Add 'GET' queries for starting additional clients on different VT's. * 1.9 - Add DRM_IOCTL_RADEON_CP_RESUME ioctl. * Add texture rectangle support for r100. + * 1.10- Add SETPARAM ioctl; first parameter to set is FB_LOCATION, which + * clients use to tell the DRM where they think the framebuffer is + * located in the card's address space */ #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ @@ -106,10 +109,82 @@ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_ALLOC)] = { radeon_mem_alloc, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FREE)] = { radeon_mem_free, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INIT_HEAP)] = { radeon_mem_init_heap, 1, 1 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_EMIT)] = { radeon_irq_emit, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_WAIT)] = { radeon_irq_wait, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_EMIT)] = { radeon_irq_emit, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_WAIT)] = { radeon_irq_wait, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SETPARAM)] = { radeon_cp_setparam, 1, 0 }, \ + +#define DRIVER_PCI_IDS \ + {0x1002, 0x4136, 0, "ATI Radeon RS100 IGP 320M"}, \ + {0x1002, 0x4137, 0, "ATI Radeon RS200 IGP"}, \ + {0x1002, 0x4237, 0, "ATI Radeon RS250 IGP"}, \ + {0x1002, 0x4242, 0, "ATI Radeon BB R200 AIW 8500DV"}, \ + {0x1002, 0x4242, 0, "ATI Radeon BC R200"}, \ + {0x1002, 0x4336, 0, "ATI Radeon RS100 Mobility U1"}, \ + {0x1002, 0x4337, 0, "ATI Radeon RS200 Mobility IGP 340M"}, \ + {0x1002, 0x4437, 0, "ATI Radeon RS250 Mobility IGP"}, \ + {0x1002, 0x4964, 0, "ATI Radeon Id R250 9000"}, \ + {0x1002, 0x4965, 0, "ATI Radeon Ie R250 9000"}, \ + {0x1002, 0x4966, 0, "ATI Radeon If R250 9000"}, \ + {0x1002, 0x4967, 0, "ATI Radeon Ig R250 9000"}, \ + {0x1002, 0x4C57, 0, "ATI Radeon LW Mobility 7500 M7"}, \ + {0x1002, 0x4C58, 0, "ATI Radeon LX RV200 Mobility FireGL 7800 M7"}, \ + {0x1002, 0x4C59, 0, "ATI Radeon LY Mobility M6"}, \ + {0x1002, 0x4C5A, 0, "ATI Radeon LZ Mobility M6"}, \ + {0x1002, 0x4C64, 0, "ATI Radeon Ld R250 Mobility 9000 M9"}, \ + {0x1002, 0x4C65, 0, "ATI Radeon Le R250 Mobility 9000 M9"}, \ + {0x1002, 0x4C66, 0, "ATI Radeon Lf R250 Mobility 9000 M9"}, \ + {0x1002, 0x4C67, 0, "ATI Radeon Lg R250 Mobility 9000 M9"}, \ + {0x1002, 0x5144, 0, "ATI Radeon QD R100"}, \ + {0x1002, 0x5145, 0, "ATI Radeon QE R100"}, \ + {0x1002, 0x5146, 0, "ATI Radeon QF R100"}, \ + {0x1002, 0x5147, 0, "ATI Radeon QG R100"}, \ + {0x1002, 0x5148, 0, "ATI Radeon QH R200 8500"}, \ + {0x1002, 0x5149, 0, "ATI Radeon QI R200"}, \ + {0x1002, 0x514A, 0, "ATI Radeon QJ R200"}, \ + {0x1002, 0x514B, 0, "ATI Radeon QK R200"}, \ + {0x1002, 0x514C, 0, "ATI Radeon QL R200 8500 LE"}, \ + {0x1002, 0x514D, 0, "ATI Radeon QM R200 9100"}, \ + {0x1002, 0x514E, 0, "ATI Radeon QN R200 8500 LE"}, \ + {0x1002, 0x514F, 0, "ATI Radeon QO R200 8500 LE"}, \ + {0x1002, 0x5157, 0, "ATI Radeon QW RV200 7500"}, \ + {0x1002, 0x5158, 0, "ATI Radeon QX RV200 7500"}, \ + {0x1002, 0x5159, 0, "ATI Radeon QY RV100 7000/VE"}, \ + {0x1002, 0x515A, 0, "ATI Radeon QZ RV100 7000/VE"}, \ + {0x1002, 0x5168, 0, "ATI Radeon Qh R200"}, \ + {0x1002, 0x5169, 0, "ATI Radeon Qi R200"}, \ + {0x1002, 0x516A, 0, "ATI Radeon Qj R200"}, \ + {0x1002, 0x516B, 0, "ATI Radeon Qk R200"}, \ + {0x1002, 0x516C, 0, "ATI Radeon Ql R200"}, \ + {0x1002, 0x5834, 0, "ATI Radeon RS300 IGP"}, \ + {0x1002, 0x5835, 0, "ATI Radeon RS300 Mobility IGP"}, \ + {0x1002, 0x5836, 0, "ATI Radeon RS300 IGP"}, \ + {0x1002, 0x5837, 0, "ATI Radeon RS300 IGP"}, \ + {0x1002, 0x5960, 0, "ATI Radeon RV280 9200"}, \ + {0x1002, 0x5961, 0, "ATI Radeon RV280 9200 SE"}, \ + {0x1002, 0x5962, 0, "ATI Radeon RV280 9200"}, \ + {0x1002, 0x5963, 0, "ATI Radeon RV280 9200"}, \ + {0x1002, 0x5964, 0, "ATI Radeon RV280 9200 SE"}, \ + {0x1002, 0x5968, 0, "ATI Radeon RV280 9200"}, \ + {0x1002, 0x5969, 0, "ATI Radeon RV280 9200"}, \ + {0x1002, 0x596A, 0, "ATI Radeon RV280 9200"}, \ + {0x1002, 0x596B, 0, "ATI Radeon RV280 9200"}, \ + {0x1002, 0x5c61, 0, "ATI Radeon RV280 Mobility"}, \ + {0x1002, 0x5c62, 0, "ATI Radeon RV280"}, \ + {0x1002, 0x5c63, 0, "ATI Radeon RV280 Mobility"}, \ + {0x1002, 0x5c64, 0, "ATI Radeon RV280"}, \ + {0, 0, 0, NULL} +#define DRIVER_FILE_FIELDS \ + int64_t radeon_fb_delta; \ +#define DRIVER_OPEN_HELPER( filp_priv, dev ) \ +do { \ + drm_radeon_private_t *dev_priv = dev->dev_private; \ + if ( dev_priv ) \ + filp_priv->radeon_fb_delta = dev_priv->fb_location; \ + else \ + filp_priv->radeon_fb_delta = 0; \ +} while( 0 ) /* When a client dies: * - Check for and clean up flipped page state @@ -125,7 +200,7 @@ radeon_do_cleanup_pageflip( dev ); \ } \ radeon_mem_release( filp, dev_priv->gart_heap ); \ - radeon_mem_release( filp, dev_priv->fb_heap ); \ + radeon_mem_release( filp, dev_priv->fb_heap ); \ } \ } while (0) @@ -142,7 +217,7 @@ /* DMA customization: */ #define __HAVE_DMA 1 -#define __HAVE_DMA_IRQ 1 +#define __HAVE_IRQ 1 #define __HAVE_VBL_IRQ 1 #define __HAVE_SHARED_IRQ 1 --- diff/drivers/char/drm/radeon_cp.c 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/radeon_cp.c 2004-02-18 09:03:58.000000000 +0000 @@ -855,7 +855,8 @@ /* Initialize the memory controller */ RADEON_WRITE( RADEON_MC_FB_LOCATION, - (dev_priv->gart_vm_start - 1) & 0xffff0000 ); + ( ( dev_priv->gart_vm_start - 1 ) & 0xffff0000 ) + | ( dev_priv->fb_location >> 16 ) ); #if __REALLY_HAVE_AGP if ( !dev_priv->is_pci ) { @@ -1071,13 +1072,6 @@ dev_priv->depth_offset = init->depth_offset; dev_priv->depth_pitch = init->depth_pitch; - dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) | - (dev_priv->front_offset >> 10)); - dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) | - (dev_priv->back_offset >> 10)); - dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) | - (dev_priv->depth_offset >> 10)); - /* Hardware state for depth clears. Remove this if/when we no * longer clear the depth buffer with a 3D rectangle. Hard-code * all values to prevent unwanted 3D state from slipping through @@ -1124,13 +1118,6 @@ return DRM_ERR(EINVAL); } - DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); - if(!dev_priv->fb) { - DRM_ERROR("could not find framebuffer!\n"); - dev->dev_private = (void *)dev_priv; - radeon_do_cleanup_cp(dev); - return DRM_ERR(EINVAL); - } DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); if(!dev_priv->mmio) { DRM_ERROR("could not find mmio region!\n"); @@ -1204,9 +1191,26 @@ dev_priv->buffers->handle ); } + dev_priv->fb_location = ( RADEON_READ( RADEON_MC_FB_LOCATION ) + & 0xffff ) << 16; + + dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) | + ( ( dev_priv->front_offset + + dev_priv->fb_location ) >> 10 ) ); + + dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) | + ( ( dev_priv->back_offset + + dev_priv->fb_location ) >> 10 ) ); + + dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) | + ( ( dev_priv->depth_offset + + dev_priv->fb_location ) >> 10 ) ); + dev_priv->gart_size = init->gart_size; - dev_priv->gart_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE ); + dev_priv->gart_vm_start = dev_priv->fb_location + + RADEON_READ( RADEON_CONFIG_APER_SIZE ); + #if __REALLY_HAVE_AGP if ( !dev_priv->is_pci ) dev_priv->gart_buffers_offset = (dev_priv->buffers->offset @@ -1271,12 +1275,12 @@ { DRM_DEBUG( "\n" ); -#if _HAVE_DMA_IRQ +#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ - if ( dev->irq ) DRM(irq_uninstall)(dev); + if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); #endif if ( dev->dev_private ) { --- diff/drivers/char/drm/radeon_drm.h 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/radeon_drm.h 2004-02-18 09:03:58.000000000 +0000 @@ -390,6 +390,7 @@ #define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( 0x57, drm_radeon_irq_wait_t) /* added by Charl P. Botha - see radeon_cp.c for details */ #define DRM_IOCTL_RADEON_CP_RESUME DRM_IO(0x58) +#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW(0x59, drm_radeon_setparam_t) typedef struct drm_radeon_init { enum { @@ -502,7 +503,7 @@ } drm_radeon_tex_image_t; typedef struct drm_radeon_texture { - int offset; + unsigned int offset; int pitch; int format; int width; /* Texture image coordinates */ @@ -537,6 +538,7 @@ #define RADEON_PARAM_STATUS_HANDLE 8 #define RADEON_PARAM_SAREA_HANDLE 9 #define RADEON_PARAM_GART_TEX_HANDLE 10 +#define RADEON_PARAM_SCRATCH_OFFSET 11 typedef struct drm_radeon_getparam { int param; @@ -578,4 +580,16 @@ } drm_radeon_irq_wait_t; +/* 1.10: Clients tell the DRM where they think the framebuffer is located in + * the card's address space, via a new generic ioctl to set parameters + */ + +typedef struct drm_radeon_setparam { + unsigned int param; + int64_t value; +} drm_radeon_setparam_t; + +#define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */ + + #endif --- diff/drivers/char/drm/radeon_drv.c 2003-07-22 18:54:27.000000000 +0100 +++ source/drivers/char/drm/radeon_drv.c 2004-02-18 09:03:58.000000000 +0000 @@ -48,6 +48,7 @@ #include "drm_fops.h" #include "drm_init.h" #include "drm_ioctl.h" +#include "drm_irq.h" #include "drm_lock.h" #include "drm_memory.h" #include "drm_proc.h" --- diff/drivers/char/drm/radeon_drv.h 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/radeon_drv.h 2004-02-18 09:03:58.000000000 +0000 @@ -73,6 +73,8 @@ drm_radeon_ring_buffer_t ring; drm_radeon_sarea_t *sarea_priv; + u32 fb_location; + int gart_size; u32 gart_vm_start; unsigned long gart_buffers_offset; @@ -133,7 +135,6 @@ unsigned long gart_textures_offset; drm_local_map_t *sarea; - drm_local_map_t *fb; drm_local_map_t *mmio; drm_local_map_t *cp_ring; drm_local_map_t *ring_rptr; @@ -184,6 +185,7 @@ extern int radeon_cp_vertex2( DRM_IOCTL_ARGS ); extern int radeon_cp_cmdbuf( DRM_IOCTL_ARGS ); extern int radeon_cp_getparam( DRM_IOCTL_ARGS ); +extern int radeon_cp_setparam( DRM_IOCTL_ARGS ); extern int radeon_cp_flip( DRM_IOCTL_ARGS ); extern int radeon_mem_alloc( DRM_IOCTL_ARGS ); @@ -239,6 +241,7 @@ #define RADEON_CRTC2_OFFSET 0x0324 #define RADEON_CRTC2_OFFSET_CNTL 0x0328 +#define RADEON_RB3D_COLOROFFSET 0x1c40 #define RADEON_RB3D_COLORPITCH 0x1c48 #define RADEON_DP_GUI_MASTER_CNTL 0x146c @@ -332,6 +335,7 @@ #define RADEON_PP_MISC 0x1c14 #define RADEON_PP_ROT_MATRIX_0 0x1d58 #define RADEON_PP_TXFILTER_0 0x1c54 +#define RADEON_PP_TXOFFSET_0 0x1c5c #define RADEON_PP_TXFILTER_1 0x1c6c #define RADEON_PP_TXFILTER_2 0x1c84 --- diff/drivers/char/drm/radeon_irq.c 2003-05-21 11:50:14.000000000 +0100 +++ source/drivers/char/drm/radeon_irq.c 2004-02-18 09:03:58.000000000 +0000 @@ -54,7 +54,7 @@ * tied to dma at all, this is just a hangover from dri prehistory. */ -irqreturn_t DRM(dma_service)( DRM_IRQ_ARGS ) +irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *) arg; drm_radeon_private_t *dev_priv = --- diff/drivers/char/drm/radeon_state.c 2004-02-18 08:54:09.000000000 +0000 +++ source/drivers/char/drm/radeon_state.c 2004-02-18 09:03:58.000000000 +0000 @@ -36,6 +36,151 @@ /* ================================================================ + * Helper functions for client state checking and fixup + */ + +static __inline__ int radeon_check_and_fixup_offset( drm_radeon_private_t *dev_priv, + drm_file_t *filp_priv, + u32 *offset ) { + u32 off = *offset; + + if ( off >= dev_priv->fb_location && + off < ( dev_priv->gart_vm_start + dev_priv->gart_size ) ) + return 0; + + off += filp_priv->radeon_fb_delta; + + DRM_DEBUG( "offset fixed up to 0x%x\n", off ); + + if ( off < dev_priv->fb_location || + off >= ( dev_priv->gart_vm_start + dev_priv->gart_size ) ) + return DRM_ERR( EINVAL ); + + *offset = off; + + return 0; +} + +static __inline__ int radeon_check_and_fixup_offset_user( drm_radeon_private_t *dev_priv, + drm_file_t *filp_priv, + u32 *offset ) { + u32 off; + + DRM_GET_USER_UNCHECKED( off, offset ); + + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, &off ) ) + return DRM_ERR( EINVAL ); + + DRM_PUT_USER_UNCHECKED( offset, off ); + + return 0; +} + +static __inline__ int radeon_check_and_fixup_packets( drm_radeon_private_t *dev_priv, + drm_file_t *filp_priv, + int id, + u32 *data ) { + if ( id == RADEON_EMIT_PP_MISC && + radeon_check_and_fixup_offset_user( dev_priv, filp_priv, + &data[( RADEON_RB3D_DEPTHOFFSET + - RADEON_PP_MISC ) / 4] ) ) { + DRM_ERROR( "Invalid depth buffer offset\n" ); + return DRM_ERR( EINVAL ); + } else if ( id == RADEON_EMIT_PP_CNTL && + radeon_check_and_fixup_offset_user( dev_priv, filp_priv, + &data[( RADEON_RB3D_COLOROFFSET + - RADEON_PP_CNTL ) / 4] ) ) { + DRM_ERROR( "Invalid colour buffer offset\n" ); + return DRM_ERR( EINVAL ); + } else if ( id >= R200_EMIT_PP_TXOFFSET_0 && + id <= R200_EMIT_PP_TXOFFSET_5 && + radeon_check_and_fixup_offset_user( dev_priv, filp_priv, + &data[0] ) ) { + DRM_ERROR( "Invalid R200 texture offset\n" ); + return DRM_ERR( EINVAL ); + } else if ( ( id == RADEON_EMIT_PP_TXFILTER_0 || id == RADEON_EMIT_PP_TXFILTER_1 || + id == RADEON_EMIT_PP_TXFILTER_2 /*|| id == RADEON_EMIT_PP_TXFILTER_3 || + id == RADEON_EMIT_PP_TXFILTER_4 || id == RADEON_EMIT_PP_TXFILTER_5*/ ) && + radeon_check_and_fixup_offset_user( dev_priv, filp_priv, + &data[( RADEON_PP_TXOFFSET_0 + - RADEON_PP_TXFILTER_0 ) / 4] ) ) { + DRM_ERROR( "Invalid R100 texture offset\n" ); + return DRM_ERR( EINVAL ); + } else if ( id == R200_PP_CUBIC_OFFSET_F1_0 || id == R200_PP_CUBIC_OFFSET_F1_1 || + id == R200_PP_CUBIC_OFFSET_F1_2 || id == R200_PP_CUBIC_OFFSET_F1_3 || + id == R200_PP_CUBIC_OFFSET_F1_4 || id == R200_PP_CUBIC_OFFSET_F1_5 ) { + int i; + for ( i = 0; i < 6; i++ ) { + if ( radeon_check_and_fixup_offset_user( dev_priv, + filp_priv, + &data[i] ) ) { + DRM_ERROR( "Invalid R200 cubic texture offset\n" ); + return DRM_ERR( EINVAL ); + } + } + } + + return 0; +} + +static __inline__ int radeon_check_and_fixup_packet3( drm_radeon_private_t *dev_priv, + drm_file_t *filp_priv, + drm_radeon_cmd_buffer_t *cmdbuf, + unsigned int *cmdsz ) { + u32 tmp[4], *cmd = ( u32* )cmdbuf->buf; + + if ( DRM_COPY_FROM_USER_UNCHECKED( tmp, cmd, sizeof( tmp ) ) ) { + DRM_ERROR( "Failed to copy data from user space\n" ); + return DRM_ERR( EFAULT ); + } + + *cmdsz = 2 + ( ( tmp[0] & RADEON_CP_PACKET_COUNT_MASK ) >> 16 ); + + if ( ( tmp[0] & 0xc0000000 ) != RADEON_CP_PACKET3 ) { + DRM_ERROR( "Not a type 3 packet\n" ); + return DRM_ERR( EINVAL ); + } + + if ( 4 * *cmdsz > cmdbuf->bufsz ) { + DRM_ERROR( "Packet size larger than size of data provided\n" ); + return DRM_ERR( EINVAL ); + } + + /* Check client state and fix it up if necessary */ + if ( tmp[0] & 0x8000 ) { /* MSB of opcode: next DWORD GUI_CNTL */ + u32 offset; + + if ( tmp[1] & ( RADEON_GMC_SRC_PITCH_OFFSET_CNTL + | RADEON_GMC_DST_PITCH_OFFSET_CNTL ) ) { + offset = tmp[2] << 10; + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, &offset ) ) { + DRM_ERROR( "Invalid first packet offset\n" ); + return DRM_ERR( EINVAL ); + } + tmp[2] = ( tmp[2] & 0xffc00000 ) | offset >> 10; + } + + if ( ( tmp[1] & RADEON_GMC_SRC_PITCH_OFFSET_CNTL ) && + ( tmp[1] & RADEON_GMC_DST_PITCH_OFFSET_CNTL ) ) { + offset = tmp[3] << 10; + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, &offset ) ) { + DRM_ERROR( "Invalid second packet offset\n" ); + return DRM_ERR( EINVAL ); + } + tmp[3] = ( tmp[3] & 0xffc00000 ) | offset >> 10; + } + + if ( DRM_COPY_TO_USER_UNCHECKED( cmd, tmp, sizeof( tmp ) ) ) { + DRM_ERROR( "Failed to copy data to user space\n" ); + return DRM_ERR( EFAULT ); + } + } + + return 0; +} + + +/* ================================================================ * CP hardware state programming functions */ @@ -57,15 +202,28 @@ /* Emit 1.1 state */ -static void radeon_emit_state( drm_radeon_private_t *dev_priv, - drm_radeon_context_regs_t *ctx, - drm_radeon_texture_regs_t *tex, - unsigned int dirty ) +static int radeon_emit_state( drm_radeon_private_t *dev_priv, + drm_file_t *filp_priv, + drm_radeon_context_regs_t *ctx, + drm_radeon_texture_regs_t *tex, + unsigned int dirty ) { RING_LOCALS; DRM_DEBUG( "dirty=0x%08x\n", dirty ); if ( dirty & RADEON_UPLOAD_CONTEXT ) { + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, + &ctx->rb3d_depthoffset ) ) { + DRM_ERROR( "Invalid depth buffer offset\n" ); + return DRM_ERR( EINVAL ); + } + + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, + &ctx->rb3d_coloroffset ) ) { + DRM_ERROR( "Invalid depth buffer offset\n" ); + return DRM_ERR( EINVAL ); + } + BEGIN_RING( 14 ); OUT_RING( CP_PACKET0( RADEON_PP_MISC, 6 ) ); OUT_RING( ctx->pp_misc ); @@ -149,6 +307,12 @@ } if ( dirty & RADEON_UPLOAD_TEX0 ) { + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, + &tex[0].pp_txoffset ) ) { + DRM_ERROR( "Invalid texture offset for unit 0\n" ); + return DRM_ERR( EINVAL ); + } + BEGIN_RING( 9 ); OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_0, 5 ) ); OUT_RING( tex[0].pp_txfilter ); @@ -163,6 +327,12 @@ } if ( dirty & RADEON_UPLOAD_TEX1 ) { + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, + &tex[1].pp_txoffset ) ) { + DRM_ERROR( "Invalid texture offset for unit 1\n" ); + return DRM_ERR( EINVAL ); + } + BEGIN_RING( 9 ); OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_1, 5 ) ); OUT_RING( tex[1].pp_txfilter ); @@ -177,6 +347,12 @@ } if ( dirty & RADEON_UPLOAD_TEX2 ) { + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, + &tex[2].pp_txoffset ) ) { + DRM_ERROR( "Invalid texture offset for unit 2\n" ); + return DRM_ERR( EINVAL ); + } + BEGIN_RING( 9 ); OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_2, 5 ) ); OUT_RING( tex[2].pp_txfilter ); @@ -189,12 +365,15 @@ OUT_RING( tex[2].pp_border_color ); ADVANCE_RING(); } + + return 0; } /* Emit 1.2 state */ -static void radeon_emit_state2( drm_radeon_private_t *dev_priv, - drm_radeon_state_t *state ) +static int radeon_emit_state2( drm_radeon_private_t *dev_priv, + drm_file_t *filp_priv, + drm_radeon_state_t *state ) { RING_LOCALS; @@ -206,7 +385,7 @@ ADVANCE_RING(); } - radeon_emit_state( dev_priv, &state->context, + return radeon_emit_state( dev_priv, filp_priv, &state->context, state->tex, state->dirty ); } @@ -1065,6 +1244,7 @@ drm_radeon_tex_image_t *image ) { drm_radeon_private_t *dev_priv = dev->dev_private; + drm_file_t *filp_priv; drm_buf_t *buf; u32 format; u32 *buffer; @@ -1074,6 +1254,13 @@ int i; RING_LOCALS; + DRM_GET_PRIV_WITH_RETURN( filp_priv, filp ); + + if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, &tex->offset ) ) { + DRM_ERROR( "Invalid destination offset\n" ); + return DRM_ERR( EINVAL ); + } + dev_priv->stats.boxes |= RADEON_BOX_TEXTURE_LOAD; /* Flush the pixel cache. This ensures no pixel data gets mixed @@ -1377,6 +1564,7 @@ { DRM_DEVICE; drm_radeon_private_t *dev_priv = dev->dev_private; + drm_file_t *filp_priv; drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_device_dma_t *dma = dev->dma; drm_buf_t *buf; @@ -1390,6 +1578,8 @@ return DRM_ERR(EINVAL); } + DRM_GET_PRIV_WITH_RETURN( filp_priv, filp ); + DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex_t *)data, sizeof(vertex) ); @@ -1429,11 +1619,14 @@ buf->used = vertex.count; /* not used? */ if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeon_emit_state( dev_priv, - &sarea_priv->context_state, - sarea_priv->tex_state, - sarea_priv->dirty ); - + if ( radeon_emit_state( dev_priv, filp_priv, + &sarea_priv->context_state, + sarea_priv->tex_state, + sarea_priv->dirty ) ) { + DRM_ERROR( "radeon_emit_state failed\n" ); + return DRM_ERR( EINVAL ); + } + sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | RADEON_UPLOAD_TEX1IMAGES | RADEON_UPLOAD_TEX2IMAGES | @@ -1461,6 +1654,7 @@ { DRM_DEVICE; drm_radeon_private_t *dev_priv = dev->dev_private; + drm_file_t *filp_priv; drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_device_dma_t *dma = dev->dma; drm_buf_t *buf; @@ -1475,6 +1669,8 @@ return DRM_ERR(EINVAL); } + DRM_GET_PRIV_WITH_RETURN( filp_priv, filp ); + DRM_COPY_FROM_USER_IOCTL( elts, (drm_radeon_indices_t *)data, sizeof(elts) ); @@ -1523,10 +1719,13 @@ buf->used = elts.end; if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeon_emit_state( dev_priv, - &sarea_priv->context_state, - sarea_priv->tex_state, - sarea_priv->dirty ); + if ( radeon_emit_state( dev_priv, filp_priv, + &sarea_priv->context_state, + sarea_priv->tex_state, + sarea_priv->dirty ) ) { + DRM_ERROR( "radeon_emit_state failed\n" ); + return DRM_ERR( EINVAL ); + } sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | RADEON_UPLOAD_TEX1IMAGES | @@ -1686,6 +1885,7 @@ { DRM_DEVICE; drm_radeon_private_t *dev_priv = dev->dev_private; + drm_file_t *filp_priv; drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_device_dma_t *dma = dev->dma; drm_buf_t *buf; @@ -1700,6 +1900,8 @@ return DRM_ERR(EINVAL); } + DRM_GET_PRIV_WITH_RETURN( filp_priv, filp ); + DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex2_t *)data, sizeof(vertex) ); @@ -1747,7 +1949,10 @@ sizeof(state) ) ) return DRM_ERR(EFAULT); - radeon_emit_state2( dev_priv, &state ); + if ( radeon_emit_state2( dev_priv, filp_priv, &state ) ) { + DRM_ERROR( "radeon_emit_state2 failed\n" ); + return DRM_ERR( EINVAL ); + } laststate = prim.stateidx; } @@ -1784,6 +1989,7 @@ static int radeon_emit_packets( drm_radeon_private_t *dev_priv, + drm_file_t *filp_priv, drm_radeon_cmd_header_t header, drm_radeon_cmd_buffer_t *cmdbuf ) { @@ -1798,8 +2004,15 @@ sz = packet[id].len; reg = packet[id].start; - if (sz * sizeof(int) > cmdbuf->bufsz) + if (sz * sizeof(int) > cmdbuf->bufsz) { + DRM_ERROR( "Packet size provided larger than data provided\n" ); return DRM_ERR(EINVAL); + } + + if ( radeon_check_and_fixup_packets( dev_priv, filp_priv, id, data ) ) { + DRM_ERROR( "Packet verification failed\n" ); + return DRM_ERR( EINVAL ); + } BEGIN_RING(sz+1); OUT_RING( CP_PACKET0( reg, (sz-1) ) ); @@ -1882,24 +2095,21 @@ static int radeon_emit_packet3( drm_device_t *dev, + drm_file_t *filp_priv, drm_radeon_cmd_buffer_t *cmdbuf ) { drm_radeon_private_t *dev_priv = dev->dev_private; - int cmdsz, tmp; - int *cmd = (int *)cmdbuf->buf; + unsigned int cmdsz; + int *cmd = (int *)cmdbuf->buf, ret; RING_LOCALS; - DRM_DEBUG("\n"); - if (DRM_GET_USER_UNCHECKED( tmp, &cmd[0])) - return DRM_ERR(EFAULT); - - cmdsz = 2 + ((tmp & RADEON_CP_PACKET_COUNT_MASK) >> 16); - - if ((tmp & 0xc0000000) != RADEON_CP_PACKET3 || - cmdsz * 4 > cmdbuf->bufsz) - return DRM_ERR(EINVAL); + if ( ( ret = radeon_check_and_fixup_packet3( dev_priv, filp_priv, + cmdbuf, &cmdsz ) ) ) { + DRM_ERROR( "Packet verification failed\n" ); + return ret; + } BEGIN_RING( cmdsz ); OUT_RING_USER_TABLE( cmd, cmdsz ); @@ -1912,27 +2122,25 @@ static int radeon_emit_packet3_cliprect( drm_device_t *dev, + drm_file_t *filp_priv, drm_radeon_cmd_buffer_t *cmdbuf, int orig_nbox ) { drm_radeon_private_t *dev_priv = dev->dev_private; drm_clip_rect_t box; - int cmdsz, tmp; - int *cmd = (int *)cmdbuf->buf; + unsigned int cmdsz; + int *cmd = (int *)cmdbuf->buf, ret; drm_clip_rect_t *boxes = cmdbuf->boxes; int i = 0; RING_LOCALS; DRM_DEBUG("\n"); - if (DRM_GET_USER_UNCHECKED( tmp, &cmd[0])) - return DRM_ERR(EFAULT); - - cmdsz = 2 + ((tmp & RADEON_CP_PACKET_COUNT_MASK) >> 16); - - if ((tmp & 0xc0000000) != RADEON_CP_PACKET3 || - cmdsz * 4 > cmdbuf->bufsz) - return DRM_ERR(EINVAL); + if ( ( ret = radeon_check_and_fixup_packet3( dev_priv, filp_priv, + cmdbuf, &cmdsz ) ) ) { + DRM_ERROR( "Packet verification failed\n" ); + return ret; + } if (!orig_nbox) goto out; @@ -2009,6 +2217,7 @@ { DRM_DEVICE; drm_radeon_private_t *dev_priv = dev->dev_private; + drm_file_t *filp_priv; drm_device_dma_t *dma = dev->dma; drm_buf_t *buf = 0; int idx; @@ -2023,6 +2232,8 @@ return DRM_ERR(EINVAL); } + DRM_GET_PRIV_WITH_RETURN( filp_priv, filp ); + DRM_COPY_FROM_USER_IOCTL( cmdbuf, (drm_radeon_cmd_buffer_t *)data, sizeof(cmdbuf) ); @@ -2053,7 +2264,7 @@ switch (header.header.cmd_type) { case RADEON_CMD_PACKET: DRM_DEBUG("RADEON_CMD_PACKET\n"); - if (radeon_emit_packets( dev_priv, header, &cmdbuf )) { + if (radeon_emit_packets( dev_priv, filp_priv, header, &cmdbuf )) { DRM_ERROR("radeon_emit_packets failed\n"); return DRM_ERR(EINVAL); } @@ -2096,7 +2307,7 @@ case RADEON_CMD_PACKET3: DRM_DEBUG("RADEON_CMD_PACKET3\n"); - if (radeon_emit_packet3( dev, &cmdbuf )) { + if (radeon_emit_packet3( dev, filp_priv, &cmdbuf )) { DRM_ERROR("radeon_emit_packet3 failed\n"); return DRM_ERR(EINVAL); } @@ -2104,7 +2315,7 @@ case RADEON_CMD_PACKET3_CLIP: DRM_DEBUG("RADEON_CMD_PACKET3_CLIP\n"); - if (radeon_emit_packet3_cliprect( dev, &cmdbuf, orig_nbox )) { + if (radeon_emit_packet3_cliprect( dev, filp_priv, &cmdbuf, orig_nbox )) { DRM_ERROR("radeon_emit_packet3_clip failed\n"); return DRM_ERR(EINVAL); } @@ -2214,3 +2425,31 @@ return 0; } + +int radeon_cp_setparam( DRM_IOCTL_ARGS ) { + DRM_DEVICE; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_file_t *filp_priv; + drm_radeon_setparam_t sp; + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return DRM_ERR( EINVAL ); + } + + DRM_GET_PRIV_WITH_RETURN( filp_priv, filp ); + + DRM_COPY_FROM_USER_IOCTL( sp, ( drm_radeon_setparam_t* )data, + sizeof( sp ) ); + + switch( sp.param ) { + case RADEON_SETPARAM_FB_LOCATION: + filp_priv->radeon_fb_delta = dev_priv->fb_location - sp.value; + break; + default: + DRM_DEBUG( "Invalid parameter %d\n", sp.param ); + return DRM_ERR( EINVAL ); + } + + return 0; +} --- diff/drivers/char/drm/sis.h 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/sis.h 2004-02-18 09:03:58.000000000 +0000 @@ -62,6 +62,13 @@ [DRM_IOCTL_NR(DRM_IOCTL_SIS_AGP_FREE)] = { sis_ioctl_agp_free, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_SIS_FB_INIT)] = { sis_fb_init, 1, 1 } +#define DRIVER_PCI_IDS \ + {0x1039, 0x0300, 0, "SiS 300/305"}, \ + {0x1039, 0x5300, 0, "SiS 540"}, \ + {0x1039, 0x6300, 0, "SiS 630"}, \ + {0x1039, 0x7300, 0, "SiS 730"}, \ + {0, 0, 0, NULL} + #define __HAVE_COUNTERS 5 /* Buffer customization: --- diff/drivers/char/drm/sis_mm.c 2003-09-30 15:46:12.000000000 +0100 +++ source/drivers/char/drm/sis_mm.c 2004-02-18 09:03:58.000000000 +0000 @@ -34,7 +34,11 @@ #include "sis_drv.h" #include "sis_ds.h" #if defined(__linux__) && defined(CONFIG_FB_SIS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #include