diff options
727 files changed, 15122 insertions, 8677 deletions
@@ -3241,14 +3241,9 @@ S: 12725 SW Millikan Way, Suite 400 | |||
3241 | S: Beaverton, Oregon 97005 | 3241 | S: Beaverton, Oregon 97005 |
3242 | S: USA | 3242 | S: USA |
3243 | 3243 | ||
3244 | N: Marcelo W. Tosatti | 3244 | N: Marcelo Tosatti |
3245 | E: marcelo.tosatti@cyclades.com | 3245 | E: marcelo@kvack.org |
3246 | D: Miscellaneous kernel hacker | ||
3247 | D: v2.4 kernel maintainer | 3246 | D: v2.4 kernel maintainer |
3248 | D: Current pc300/cyclades maintainer | ||
3249 | S: Cyclades Corporation | ||
3250 | S: Av Cristovao Colombo, 462. Floresta. | ||
3251 | S: Porto Alegre | ||
3252 | S: Brazil | 3247 | S: Brazil |
3253 | 3248 | ||
3254 | N: Stefan Traby | 3249 | N: Stefan Traby |
diff --git a/Documentation/devices.txt b/Documentation/devices.txt index 3c406acd4dfa..b369a8c46a73 100644 --- a/Documentation/devices.txt +++ b/Documentation/devices.txt | |||
@@ -1721,11 +1721,6 @@ Your cooperation is appreciated. | |||
1721 | These devices support the same API as the generic SCSI | 1721 | These devices support the same API as the generic SCSI |
1722 | devices. | 1722 | devices. |
1723 | 1723 | ||
1724 | 97 block Packet writing for CD/DVD devices | ||
1725 | 0 = /dev/pktcdvd0 First packet-writing module | ||
1726 | 1 = /dev/pktcdvd1 Second packet-writing module | ||
1727 | ... | ||
1728 | |||
1729 | 98 char Control and Measurement Device (comedi) | 1724 | 98 char Control and Measurement Device (comedi) |
1730 | 0 = /dev/comedi0 First comedi device | 1725 | 0 = /dev/comedi0 First comedi device |
1731 | 1 = /dev/comedi1 Second comedi device | 1726 | 1 = /dev/comedi1 Second comedi device |
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware index 15fc8fbef67e..4820366b6ae8 100644 --- a/Documentation/dvb/get_dvb_firmware +++ b/Documentation/dvb/get_dvb_firmware | |||
@@ -259,9 +259,9 @@ sub dibusb { | |||
259 | } | 259 | } |
260 | 260 | ||
261 | sub nxt2002 { | 261 | sub nxt2002 { |
262 | my $sourcefile = "Broadband4PC_4_2_11.zip"; | 262 | my $sourcefile = "Technisat_DVB-PC_4_4_COMPACT.zip"; |
263 | my $url = "http://www.bbti.us/download/windows/$sourcefile"; | 263 | my $url = "http://www.bbti.us/download/windows/$sourcefile"; |
264 | my $hash = "c6d2ea47a8f456d887ada0cfb718ff2a"; | 264 | my $hash = "476befae8c7c1bb9648954060b1eec1f"; |
265 | my $outfile = "dvb-fe-nxt2002.fw"; | 265 | my $outfile = "dvb-fe-nxt2002.fw"; |
266 | my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); | 266 | my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); |
267 | 267 | ||
@@ -269,8 +269,8 @@ sub nxt2002 { | |||
269 | 269 | ||
270 | wgetfile($sourcefile, $url); | 270 | wgetfile($sourcefile, $url); |
271 | unzip($sourcefile, $tmpdir); | 271 | unzip($sourcefile, $tmpdir); |
272 | verify("$tmpdir/SkyNETU.sys", $hash); | 272 | verify("$tmpdir/SkyNET.sys", $hash); |
273 | extract("$tmpdir/SkyNETU.sys", 375832, 5908, $outfile); | 273 | extract("$tmpdir/SkyNET.sys", 331624, 5908, $outfile); |
274 | 274 | ||
275 | $outfile; | 275 | $outfile; |
276 | } | 276 | } |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 421bcfff6ad2..43ab119963d5 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -57,6 +57,15 @@ Who: Jody McIntyre <scjody@steamballoon.com> | |||
57 | 57 | ||
58 | --------------------------- | 58 | --------------------------- |
59 | 59 | ||
60 | What: sbp2: module parameter "force_inquiry_hack" | ||
61 | When: July 2006 | ||
62 | Why: Superceded by parameter "workarounds". Both parameters are meant to be | ||
63 | used ad-hoc and for single devices only, i.e. not in modprobe.conf, | ||
64 | therefore the impact of this feature replacement should be low. | ||
65 | Who: Stefan Richter <stefanr@s5r6.in-berlin.de> | ||
66 | |||
67 | --------------------------- | ||
68 | |||
60 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. | 69 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. |
61 | When: July 2006 | 70 | When: July 2006 |
62 | Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 | 71 | Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 |
diff --git a/Documentation/firmware_class/README b/Documentation/firmware_class/README index 43e836c07ae8..e9cc8bb26f7d 100644 --- a/Documentation/firmware_class/README +++ b/Documentation/firmware_class/README | |||
@@ -105,20 +105,3 @@ | |||
105 | on the setup, so I think that the choice on what firmware to make | 105 | on the setup, so I think that the choice on what firmware to make |
106 | persistent should be left to userspace. | 106 | persistent should be left to userspace. |
107 | 107 | ||
108 | - Why register_firmware()+__init can be useful: | ||
109 | - For boot devices needing firmware. | ||
110 | - To make the transition easier: | ||
111 | The firmware can be declared __init and register_firmware() | ||
112 | called on module_init. Then the firmware is warranted to be | ||
113 | there even if "firmware hotplug userspace" is not there yet or | ||
114 | it doesn't yet provide the needed firmware. | ||
115 | Once the firmware is widely available in userspace, it can be | ||
116 | removed from the kernel. Or made optional (CONFIG_.*_FIRMWARE). | ||
117 | |||
118 | In either case, if firmware hotplug support is there, it can move the | ||
119 | firmware out of kernel memory into the real filesystem for later | ||
120 | usage. | ||
121 | |||
122 | Note: If persistence is implemented on top of initramfs, | ||
123 | register_firmware() may not be appropriate. | ||
124 | |||
diff --git a/Documentation/firmware_class/firmware_sample_driver.c b/Documentation/firmware_class/firmware_sample_driver.c index ad3edaba4533..87feccdb5c9f 100644 --- a/Documentation/firmware_class/firmware_sample_driver.c +++ b/Documentation/firmware_class/firmware_sample_driver.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * | 5 | * |
6 | * Sample code on how to use request_firmware() from drivers. | 6 | * Sample code on how to use request_firmware() from drivers. |
7 | * | 7 | * |
8 | * Note that register_firmware() is currently useless. | ||
9 | * | ||
10 | */ | 8 | */ |
11 | 9 | ||
12 | #include <linux/module.h> | 10 | #include <linux/module.h> |
@@ -17,11 +15,6 @@ | |||
17 | 15 | ||
18 | #include "linux/firmware.h" | 16 | #include "linux/firmware.h" |
19 | 17 | ||
20 | #define WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE | ||
21 | #ifdef WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE | ||
22 | char __init inkernel_firmware[] = "let's say that this is firmware\n"; | ||
23 | #endif | ||
24 | |||
25 | static struct device ghost_device = { | 18 | static struct device ghost_device = { |
26 | .bus_id = "ghost0", | 19 | .bus_id = "ghost0", |
27 | }; | 20 | }; |
@@ -104,10 +97,6 @@ static void sample_probe_async(void) | |||
104 | 97 | ||
105 | static int sample_init(void) | 98 | static int sample_init(void) |
106 | { | 99 | { |
107 | #ifdef WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE | ||
108 | register_firmware("sample_driver_fw", inkernel_firmware, | ||
109 | sizeof(inkernel_firmware)); | ||
110 | #endif | ||
111 | device_initialize(&ghost_device); | 100 | device_initialize(&ghost_device); |
112 | /* since there is no real hardware insertion I just call the | 101 | /* since there is no real hardware insertion I just call the |
113 | * sample probe functions here */ | 102 | * sample probe functions here */ |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index b3a6187e5305..a853e8607865 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -147,6 +147,9 @@ running once the system is up. | |||
147 | acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA | 147 | acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA |
148 | Format: <irq>,<irq>... | 148 | Format: <irq>,<irq>... |
149 | 149 | ||
150 | acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS | ||
151 | Format: To spoof as Windows 98: ="Microsoft Windows" | ||
152 | |||
150 | acpi_osi= [HW,ACPI] empty param disables _OSI | 153 | acpi_osi= [HW,ACPI] empty param disables _OSI |
151 | 154 | ||
152 | acpi_serialize [HW,ACPI] force serialization of AML methods | 155 | acpi_serialize [HW,ACPI] force serialization of AML methods |
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index 92f0056d928c..4710845dbac4 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt | |||
@@ -19,6 +19,7 @@ Contents: | |||
19 | - Control dependencies. | 19 | - Control dependencies. |
20 | - SMP barrier pairing. | 20 | - SMP barrier pairing. |
21 | - Examples of memory barrier sequences. | 21 | - Examples of memory barrier sequences. |
22 | - Read memory barriers vs load speculation. | ||
22 | 23 | ||
23 | (*) Explicit kernel barriers. | 24 | (*) Explicit kernel barriers. |
24 | 25 | ||
@@ -248,7 +249,7 @@ And there are a number of things that _must_ or _must_not_ be assumed: | |||
248 | we may get either of: | 249 | we may get either of: |
249 | 250 | ||
250 | STORE *A = X; Y = LOAD *A; | 251 | STORE *A = X; Y = LOAD *A; |
251 | STORE *A = Y; | 252 | STORE *A = Y = X; |
252 | 253 | ||
253 | 254 | ||
254 | ========================= | 255 | ========================= |
@@ -344,9 +345,12 @@ Memory barriers come in four basic varieties: | |||
344 | 345 | ||
345 | (4) General memory barriers. | 346 | (4) General memory barriers. |
346 | 347 | ||
347 | A general memory barrier is a combination of both a read memory barrier | 348 | A general memory barrier gives a guarantee that all the LOAD and STORE |
348 | and a write memory barrier. It is a partial ordering over both loads and | 349 | operations specified before the barrier will appear to happen before all |
349 | stores. | 350 | the LOAD and STORE operations specified after the barrier with respect to |
351 | the other components of the system. | ||
352 | |||
353 | A general memory barrier is a partial ordering over both loads and stores. | ||
350 | 354 | ||
351 | General memory barriers imply both read and write memory barriers, and so | 355 | General memory barriers imply both read and write memory barriers, and so |
352 | can substitute for either. | 356 | can substitute for either. |
@@ -546,9 +550,9 @@ write barrier, though, again, a general barrier is viable: | |||
546 | =============== =============== | 550 | =============== =============== |
547 | a = 1; | 551 | a = 1; |
548 | <write barrier> | 552 | <write barrier> |
549 | b = 2; x = a; | 553 | b = 2; x = b; |
550 | <read barrier> | 554 | <read barrier> |
551 | y = b; | 555 | y = a; |
552 | 556 | ||
553 | Or: | 557 | Or: |
554 | 558 | ||
@@ -563,6 +567,18 @@ Or: | |||
563 | Basically, the read barrier always has to be there, even though it can be of | 567 | Basically, the read barrier always has to be there, even though it can be of |
564 | the "weaker" type. | 568 | the "weaker" type. |
565 | 569 | ||
570 | [!] Note that the stores before the write barrier would normally be expected to | ||
571 | match the loads after the read barrier or data dependency barrier, and vice | ||
572 | versa: | ||
573 | |||
574 | CPU 1 CPU 2 | ||
575 | =============== =============== | ||
576 | a = 1; }---- --->{ v = c | ||
577 | b = 2; } \ / { w = d | ||
578 | <write barrier> \ <read barrier> | ||
579 | c = 3; } / \ { x = a; | ||
580 | d = 4; }---- --->{ y = b; | ||
581 | |||
566 | 582 | ||
567 | EXAMPLES OF MEMORY BARRIER SEQUENCES | 583 | EXAMPLES OF MEMORY BARRIER SEQUENCES |
568 | ------------------------------------ | 584 | ------------------------------------ |
@@ -600,8 +616,8 @@ STORE B, STORE C } all occuring before the unordered set of { STORE D, STORE E | |||
600 | | | +------+ | 616 | | | +------+ |
601 | +-------+ : : | 617 | +-------+ : : |
602 | | | 618 | | |
603 | | Sequence in which stores committed to memory system | 619 | | Sequence in which stores are committed to the |
604 | | by CPU 1 | 620 | | memory system by CPU 1 |
605 | V | 621 | V |
606 | 622 | ||
607 | 623 | ||
@@ -683,14 +699,12 @@ then the following will occur: | |||
683 | | : : | | | 699 | | : : | | |
684 | | : : | CPU 2 | | 700 | | : : | CPU 2 | |
685 | | +-------+ | | | 701 | | +-------+ | | |
686 | \ | X->9 |------>| | | 702 | | | X->9 |------>| | |
687 | \ +-------+ | | | 703 | | +-------+ | | |
688 | ----->| B->2 | | | | 704 | Makes sure all effects ---> \ ddddddddddddddddd | | |
689 | +-------+ | | | 705 | prior to the store of C \ +-------+ | | |
690 | Makes sure all effects ---> ddddddddddddddddd | | | 706 | are perceptible to ----->| B->2 |------>| | |
691 | prior to the store of C +-------+ | | | 707 | subsequent loads +-------+ | | |
692 | are perceptible to | B->2 |------>| | | ||
693 | successive loads +-------+ | | | ||
694 | : : +-------+ | 708 | : : +-------+ |
695 | 709 | ||
696 | 710 | ||
@@ -699,73 +713,239 @@ following sequence of events: | |||
699 | 713 | ||
700 | CPU 1 CPU 2 | 714 | CPU 1 CPU 2 |
701 | ======================= ======================= | 715 | ======================= ======================= |
716 | { A = 0, B = 9 } | ||
702 | STORE A=1 | 717 | STORE A=1 |
703 | STORE B=2 | ||
704 | STORE C=3 | ||
705 | <write barrier> | 718 | <write barrier> |
706 | STORE D=4 | 719 | STORE B=2 |
707 | STORE E=5 | ||
708 | LOAD A | ||
709 | LOAD B | 720 | LOAD B |
710 | LOAD C | 721 | LOAD A |
711 | LOAD D | ||
712 | LOAD E | ||
713 | 722 | ||
714 | Without intervention, CPU 2 may then choose to perceive the events on CPU 1 in | 723 | Without intervention, CPU 2 may then choose to perceive the events on CPU 1 in |
715 | some effectively random order, despite the write barrier issued by CPU 1: | 724 | some effectively random order, despite the write barrier issued by CPU 1: |
716 | 725 | ||
717 | +-------+ : : | 726 | +-------+ : : : : |
718 | | | +------+ | 727 | | | +------+ +-------+ |
719 | | |------>| C=3 | } | 728 | | |------>| A=1 |------ --->| A->0 | |
720 | | | : +------+ } | 729 | | | +------+ \ +-------+ |
721 | | | : | A=1 | } | 730 | | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 | |
722 | | | : +------+ } | 731 | | | +------+ | +-------+ |
723 | | CPU 1 | : | B=2 | }--- | 732 | | |------>| B=2 |--- | : : |
724 | | | +------+ } \ | 733 | | | +------+ \ | : : +-------+ |
725 | | | wwwwwwwwwwwww} \ | 734 | +-------+ : : \ | +-------+ | | |
726 | | | +------+ } \ : : +-------+ | 735 | ---------->| B->2 |------>| | |
727 | | | : | E=5 | } \ +-------+ | | | 736 | | +-------+ | CPU 2 | |
728 | | | : +------+ } \ { | C->3 |------>| | | 737 | | | A->0 |------>| | |
729 | | |------>| D=4 | } \ { +-------+ : | | | 738 | | +-------+ | | |
730 | | | +------+ \ { | E->5 | : | | | 739 | | : : +-------+ |
731 | +-------+ : : \ { +-------+ : | | | 740 | \ : : |
732 | Transfer -->{ | A->1 | : | CPU 2 | | 741 | \ +-------+ |
733 | from CPU 1 { +-------+ : | | | 742 | ---->| A->1 | |
734 | to CPU 2 { | D->4 | : | | | 743 | +-------+ |
735 | { +-------+ : | | | 744 | : : |
736 | { | B->2 |------>| | | ||
737 | +-------+ | | | ||
738 | : : +-------+ | ||
739 | |||
740 | |||
741 | If, however, a read barrier were to be placed between the load of C and the | ||
742 | load of D on CPU 2, then the partial ordering imposed by CPU 1 will be | ||
743 | perceived correctly by CPU 2. | ||
744 | 745 | ||
745 | +-------+ : : | 746 | |
746 | | | +------+ | 747 | If, however, a read barrier were to be placed between the load of E and the |
747 | | |------>| C=3 | } | 748 | load of A on CPU 2: |
748 | | | : +------+ } | 749 | |
749 | | | : | A=1 | }--- | 750 | CPU 1 CPU 2 |
750 | | | : +------+ } \ | 751 | ======================= ======================= |
751 | | CPU 1 | : | B=2 | } \ | 752 | { A = 0, B = 9 } |
752 | | | +------+ \ | 753 | STORE A=1 |
753 | | | wwwwwwwwwwwwwwww \ | 754 | <write barrier> |
754 | | | +------+ \ : : +-------+ | 755 | STORE B=2 |
755 | | | : | E=5 | } \ +-------+ | | | 756 | LOAD B |
756 | | | : +------+ }--- \ { | C->3 |------>| | | 757 | <read barrier> |
757 | | |------>| D=4 | } \ \ { +-------+ : | | | 758 | LOAD A |
758 | | | +------+ \ -->{ | B->2 | : | | | 759 | |
759 | +-------+ : : \ { +-------+ : | | | 760 | then the partial ordering imposed by CPU 1 will be perceived correctly by CPU |
760 | \ { | A->1 | : | CPU 2 | | 761 | 2: |
761 | \ +-------+ | | | 762 | |
762 | At this point the read ----> \ rrrrrrrrrrrrrrrrr | | | 763 | +-------+ : : : : |
763 | barrier causes all effects \ +-------+ | | | 764 | | | +------+ +-------+ |
764 | prior to the storage of C \ { | E->5 | : | | | 765 | | |------>| A=1 |------ --->| A->0 | |
765 | to be perceptible to CPU 2 -->{ +-------+ : | | | 766 | | | +------+ \ +-------+ |
766 | { | D->4 |------>| | | 767 | | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 | |
767 | +-------+ | | | 768 | | | +------+ | +-------+ |
768 | : : +-------+ | 769 | | |------>| B=2 |--- | : : |
770 | | | +------+ \ | : : +-------+ | ||
771 | +-------+ : : \ | +-------+ | | | ||
772 | ---------->| B->2 |------>| | | ||
773 | | +-------+ | CPU 2 | | ||
774 | | : : | | | ||
775 | | : : | | | ||
776 | At this point the read ----> \ rrrrrrrrrrrrrrrrr | | | ||
777 | barrier causes all effects \ +-------+ | | | ||
778 | prior to the storage of B ---->| A->1 |------>| | | ||
779 | to be perceptible to CPU 2 +-------+ | | | ||
780 | : : +-------+ | ||
781 | |||
782 | |||
783 | To illustrate this more completely, consider what could happen if the code | ||
784 | contained a load of A either side of the read barrier: | ||
785 | |||
786 | CPU 1 CPU 2 | ||
787 | ======================= ======================= | ||
788 | { A = 0, B = 9 } | ||
789 | STORE A=1 | ||
790 | <write barrier> | ||
791 | STORE B=2 | ||
792 | LOAD B | ||
793 | LOAD A [first load of A] | ||
794 | <read barrier> | ||
795 | LOAD A [second load of A] | ||
796 | |||
797 | Even though the two loads of A both occur after the load of B, they may both | ||
798 | come up with different values: | ||
799 | |||
800 | +-------+ : : : : | ||
801 | | | +------+ +-------+ | ||
802 | | |------>| A=1 |------ --->| A->0 | | ||
803 | | | +------+ \ +-------+ | ||
804 | | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 | | ||
805 | | | +------+ | +-------+ | ||
806 | | |------>| B=2 |--- | : : | ||
807 | | | +------+ \ | : : +-------+ | ||
808 | +-------+ : : \ | +-------+ | | | ||
809 | ---------->| B->2 |------>| | | ||
810 | | +-------+ | CPU 2 | | ||
811 | | : : | | | ||
812 | | : : | | | ||
813 | | +-------+ | | | ||
814 | | | A->0 |------>| 1st | | ||
815 | | +-------+ | | | ||
816 | At this point the read ----> \ rrrrrrrrrrrrrrrrr | | | ||
817 | barrier causes all effects \ +-------+ | | | ||
818 | prior to the storage of B ---->| A->1 |------>| 2nd | | ||
819 | to be perceptible to CPU 2 +-------+ | | | ||
820 | : : +-------+ | ||
821 | |||
822 | |||
823 | But it may be that the update to A from CPU 1 becomes perceptible to CPU 2 | ||
824 | before the read barrier completes anyway: | ||
825 | |||
826 | +-------+ : : : : | ||
827 | | | +------+ +-------+ | ||
828 | | |------>| A=1 |------ --->| A->0 | | ||
829 | | | +------+ \ +-------+ | ||
830 | | CPU 1 | wwwwwwwwwwwwwwww \ --->| B->9 | | ||
831 | | | +------+ | +-------+ | ||
832 | | |------>| B=2 |--- | : : | ||
833 | | | +------+ \ | : : +-------+ | ||
834 | +-------+ : : \ | +-------+ | | | ||
835 | ---------->| B->2 |------>| | | ||
836 | | +-------+ | CPU 2 | | ||
837 | | : : | | | ||
838 | \ : : | | | ||
839 | \ +-------+ | | | ||
840 | ---->| A->1 |------>| 1st | | ||
841 | +-------+ | | | ||
842 | rrrrrrrrrrrrrrrrr | | | ||
843 | +-------+ | | | ||
844 | | A->1 |------>| 2nd | | ||
845 | +-------+ | | | ||
846 | : : +-------+ | ||
847 | |||
848 | |||
849 | The guarantee is that the second load will always come up with A == 1 if the | ||
850 | load of B came up with B == 2. No such guarantee exists for the first load of | ||
851 | A; that may come up with either A == 0 or A == 1. | ||
852 | |||
853 | |||
854 | READ MEMORY BARRIERS VS LOAD SPECULATION | ||
855 | ---------------------------------------- | ||
856 | |||
857 | Many CPUs speculate with loads: that is they see that they will need to load an | ||
858 | item from memory, and they find a time where they're not using the bus for any | ||
859 | other loads, and so do the load in advance - even though they haven't actually | ||
860 | got to that point in the instruction execution flow yet. This permits the | ||
861 | actual load instruction to potentially complete immediately because the CPU | ||
862 | already has the value to hand. | ||
863 | |||
864 | It may turn out that the CPU didn't actually need the value - perhaps because a | ||
865 | branch circumvented the load - in which case it can discard the value or just | ||
866 | cache it for later use. | ||
867 | |||
868 | Consider: | ||
869 | |||
870 | CPU 1 CPU 2 | ||
871 | ======================= ======================= | ||
872 | LOAD B | ||
873 | DIVIDE } Divide instructions generally | ||
874 | DIVIDE } take a long time to perform | ||
875 | LOAD A | ||
876 | |||
877 | Which might appear as this: | ||
878 | |||
879 | : : +-------+ | ||
880 | +-------+ | | | ||
881 | --->| B->2 |------>| | | ||
882 | +-------+ | CPU 2 | | ||
883 | : :DIVIDE | | | ||
884 | +-------+ | | | ||
885 | The CPU being busy doing a ---> --->| A->0 |~~~~ | | | ||
886 | division speculates on the +-------+ ~ | | | ||
887 | LOAD of A : : ~ | | | ||
888 | : :DIVIDE | | | ||
889 | : : ~ | | | ||
890 | Once the divisions are complete --> : : ~-->| | | ||
891 | the CPU can then perform the : : | | | ||
892 | LOAD with immediate effect : : +-------+ | ||
893 | |||
894 | |||
895 | Placing a read barrier or a data dependency barrier just before the second | ||
896 | load: | ||
897 | |||
898 | CPU 1 CPU 2 | ||
899 | ======================= ======================= | ||
900 | LOAD B | ||
901 | DIVIDE | ||
902 | DIVIDE | ||
903 | <read barrier> | ||
904 | LOAD A | ||
905 | |||
906 | will force any value speculatively obtained to be reconsidered to an extent | ||
907 | dependent on the type of barrier used. If there was no change made to the | ||
908 | speculated memory location, then the speculated value will just be used: | ||
909 | |||
910 | : : +-------+ | ||
911 | +-------+ | | | ||
912 | --->| B->2 |------>| | | ||
913 | +-------+ | CPU 2 | | ||
914 | : :DIVIDE | | | ||
915 | +-------+ | | | ||
916 | The CPU being busy doing a ---> --->| A->0 |~~~~ | | | ||
917 | division speculates on the +-------+ ~ | | | ||
918 | LOAD of A : : ~ | | | ||
919 | : :DIVIDE | | | ||
920 | : : ~ | | | ||
921 | : : ~ | | | ||
922 | rrrrrrrrrrrrrrrr~ | | | ||
923 | : : ~ | | | ||
924 | : : ~-->| | | ||
925 | : : | | | ||
926 | : : +-------+ | ||
927 | |||
928 | |||
929 | but if there was an update or an invalidation from another CPU pending, then | ||
930 | the speculation will be cancelled and the value reloaded: | ||
931 | |||
932 | : : +-------+ | ||
933 | +-------+ | | | ||
934 | --->| B->2 |------>| | | ||
935 | +-------+ | CPU 2 | | ||
936 | : :DIVIDE | | | ||
937 | +-------+ | | | ||
938 | The CPU being busy doing a ---> --->| A->0 |~~~~ | | | ||
939 | division speculates on the +-------+ ~ | | | ||
940 | LOAD of A : : ~ | | | ||
941 | : :DIVIDE | | | ||
942 | : : ~ | | | ||
943 | : : ~ | | | ||
944 | rrrrrrrrrrrrrrrrr | | | ||
945 | +-------+ | | | ||
946 | The speculation is discarded ---> --->| A->1 |------>| | | ||
947 | and an updated value is +-------+ | | | ||
948 | retrieved : : +-------+ | ||
769 | 949 | ||
770 | 950 | ||
771 | ======================== | 951 | ======================== |
@@ -901,7 +1081,7 @@ IMPLICIT KERNEL MEMORY BARRIERS | |||
901 | =============================== | 1081 | =============================== |
902 | 1082 | ||
903 | Some of the other functions in the linux kernel imply memory barriers, amongst | 1083 | Some of the other functions in the linux kernel imply memory barriers, amongst |
904 | which are locking, scheduling and memory allocation functions. | 1084 | which are locking and scheduling functions. |
905 | 1085 | ||
906 | This specification is a _minimum_ guarantee; any particular architecture may | 1086 | This specification is a _minimum_ guarantee; any particular architecture may |
907 | provide more substantial guarantees, but these may not be relied upon outside | 1087 | provide more substantial guarantees, but these may not be relied upon outside |
@@ -966,6 +1146,20 @@ equivalent to a full barrier, but a LOCK followed by an UNLOCK is not. | |||
966 | barriers is that the effects instructions outside of a critical section may | 1146 | barriers is that the effects instructions outside of a critical section may |
967 | seep into the inside of the critical section. | 1147 | seep into the inside of the critical section. |
968 | 1148 | ||
1149 | A LOCK followed by an UNLOCK may not be assumed to be full memory barrier | ||
1150 | because it is possible for an access preceding the LOCK to happen after the | ||
1151 | LOCK, and an access following the UNLOCK to happen before the UNLOCK, and the | ||
1152 | two accesses can themselves then cross: | ||
1153 | |||
1154 | *A = a; | ||
1155 | LOCK | ||
1156 | UNLOCK | ||
1157 | *B = b; | ||
1158 | |||
1159 | may occur as: | ||
1160 | |||
1161 | LOCK, STORE *B, STORE *A, UNLOCK | ||
1162 | |||
969 | Locks and semaphores may not provide any guarantee of ordering on UP compiled | 1163 | Locks and semaphores may not provide any guarantee of ordering on UP compiled |
970 | systems, and so cannot be counted on in such a situation to actually achieve | 1164 | systems, and so cannot be counted on in such a situation to actually achieve |
971 | anything at all - especially with respect to I/O accesses - unless combined | 1165 | anything at all - especially with respect to I/O accesses - unless combined |
@@ -1016,8 +1210,6 @@ Other functions that imply barriers: | |||
1016 | 1210 | ||
1017 | (*) schedule() and similar imply full memory barriers. | 1211 | (*) schedule() and similar imply full memory barriers. |
1018 | 1212 | ||
1019 | (*) Memory allocation and release functions imply full memory barriers. | ||
1020 | |||
1021 | 1213 | ||
1022 | ================================= | 1214 | ================================= |
1023 | INTER-CPU LOCKING BARRIER EFFECTS | 1215 | INTER-CPU LOCKING BARRIER EFFECTS |
@@ -1031,7 +1223,7 @@ conflict on any particular lock. | |||
1031 | LOCKS VS MEMORY ACCESSES | 1223 | LOCKS VS MEMORY ACCESSES |
1032 | ------------------------ | 1224 | ------------------------ |
1033 | 1225 | ||
1034 | Consider the following: the system has a pair of spinlocks (N) and (Q), and | 1226 | Consider the following: the system has a pair of spinlocks (M) and (Q), and |
1035 | three CPUs; then should the following sequence of events occur: | 1227 | three CPUs; then should the following sequence of events occur: |
1036 | 1228 | ||
1037 | CPU 1 CPU 2 | 1229 | CPU 1 CPU 2 |
@@ -1678,7 +1870,7 @@ CPU's caches by some other cache event: | |||
1678 | smp_wmb(); | 1870 | smp_wmb(); |
1679 | <A:modify v=2> <C:busy> | 1871 | <A:modify v=2> <C:busy> |
1680 | <C:queue v=2> | 1872 | <C:queue v=2> |
1681 | p = &b; q = p; | 1873 | p = &v; q = p; |
1682 | <D:request p> | 1874 | <D:request p> |
1683 | <B:modify p=&v> <D:commit p=&v> | 1875 | <B:modify p=&v> <D:commit p=&v> |
1684 | <D:read p> | 1876 | <D:read p> |
diff --git a/Documentation/serial/driver b/Documentation/serial/driver index df82116a9f26..88ad615dd338 100644 --- a/Documentation/serial/driver +++ b/Documentation/serial/driver | |||
@@ -214,12 +214,13 @@ hardware. | |||
214 | The interaction of the iflag bits is as follows (parity error | 214 | The interaction of the iflag bits is as follows (parity error |
215 | given as an example): | 215 | given as an example): |
216 | Parity error INPCK IGNPAR | 216 | Parity error INPCK IGNPAR |
217 | None n/a n/a character received | 217 | n/a 0 n/a character received, marked as |
218 | Yes n/a 0 character discarded | ||
219 | Yes 0 1 character received, marked as | ||
220 | TTY_NORMAL | 218 | TTY_NORMAL |
221 | Yes 1 1 character received, marked as | 219 | None 1 n/a character received, marked as |
220 | TTY_NORMAL | ||
221 | Yes 1 0 character received, marked as | ||
222 | TTY_PARITY | 222 | TTY_PARITY |
223 | Yes 1 1 character discarded | ||
223 | 224 | ||
224 | Other flags may be used (eg, xon/xoff characters) if your | 225 | Other flags may be used (eg, xon/xoff characters) if your |
225 | hardware supports hardware "soft" flow control. | 226 | hardware supports hardware "soft" flow control. |
diff --git a/Documentation/spi/pxa2xx b/Documentation/spi/pxa2xx new file mode 100644 index 000000000000..9c45f3df2e18 --- /dev/null +++ b/Documentation/spi/pxa2xx | |||
@@ -0,0 +1,234 @@ | |||
1 | PXA2xx SPI on SSP driver HOWTO | ||
2 | =================================================== | ||
3 | This a mini howto on the pxa2xx_spi driver. The driver turns a PXA2xx | ||
4 | synchronous serial port into a SPI master controller | ||
5 | (see Documentation/spi/spi_summary). The driver has the following features | ||
6 | |||
7 | - Support for any PXA2xx SSP | ||
8 | - SSP PIO and SSP DMA data transfers. | ||
9 | - External and Internal (SSPFRM) chip selects. | ||
10 | - Per slave device (chip) configuration. | ||
11 | - Full suspend, freeze, resume support. | ||
12 | |||
13 | The driver is built around a "spi_message" fifo serviced by workqueue and a | ||
14 | tasklet. The workqueue, "pump_messages", drives message fifo and the tasklet | ||
15 | (pump_transfer) is responsible for queuing SPI transactions and setting up and | ||
16 | launching the dma/interrupt driven transfers. | ||
17 | |||
18 | Declaring PXA2xx Master Controllers | ||
19 | ----------------------------------- | ||
20 | Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a | ||
21 | "platform device". The master configuration is passed to the driver via a table | ||
22 | found in include/asm-arm/arch-pxa/pxa2xx_spi.h: | ||
23 | |||
24 | struct pxa2xx_spi_master { | ||
25 | enum pxa_ssp_type ssp_type; | ||
26 | u32 clock_enable; | ||
27 | u16 num_chipselect; | ||
28 | u8 enable_dma; | ||
29 | }; | ||
30 | |||
31 | The "pxa2xx_spi_master.ssp_type" field must have a value between 1 and 3 and | ||
32 | informs the driver which features a particular SSP supports. | ||
33 | |||
34 | The "pxa2xx_spi_master.clock_enable" field is used to enable/disable the | ||
35 | corresponding SSP peripheral block in the "Clock Enable Register (CKEN"). See | ||
36 | the "PXA2xx Developer Manual" section "Clocks and Power Management". | ||
37 | |||
38 | The "pxa2xx_spi_master.num_chipselect" field is used to determine the number of | ||
39 | slave device (chips) attached to this SPI master. | ||
40 | |||
41 | The "pxa2xx_spi_master.enable_dma" field informs the driver that SSP DMA should | ||
42 | be used. This caused the driver to acquire two DMA channels: rx_channel and | ||
43 | tx_channel. The rx_channel has a higher DMA service priority the tx_channel. | ||
44 | See the "PXA2xx Developer Manual" section "DMA Controller". | ||
45 | |||
46 | NSSP MASTER SAMPLE | ||
47 | ------------------ | ||
48 | Below is a sample configuration using the PXA255 NSSP. | ||
49 | |||
50 | static struct resource pxa_spi_nssp_resources[] = { | ||
51 | [0] = { | ||
52 | .start = __PREG(SSCR0_P(2)), /* Start address of NSSP */ | ||
53 | .end = __PREG(SSCR0_P(2)) + 0x2c, /* Range of registers */ | ||
54 | .flags = IORESOURCE_MEM, | ||
55 | }, | ||
56 | [1] = { | ||
57 | .start = IRQ_NSSP, /* NSSP IRQ */ | ||
58 | .end = IRQ_NSSP, | ||
59 | .flags = IORESOURCE_IRQ, | ||
60 | }, | ||
61 | }; | ||
62 | |||
63 | static struct pxa2xx_spi_master pxa_nssp_master_info = { | ||
64 | .ssp_type = PXA25x_NSSP, /* Type of SSP */ | ||
65 | .clock_enable = CKEN9_NSSP, /* NSSP Peripheral clock */ | ||
66 | .num_chipselect = 1, /* Matches the number of chips attached to NSSP */ | ||
67 | .enable_dma = 1, /* Enables NSSP DMA */ | ||
68 | }; | ||
69 | |||
70 | static struct platform_device pxa_spi_nssp = { | ||
71 | .name = "pxa2xx-spi", /* MUST BE THIS VALUE, so device match driver */ | ||
72 | .id = 2, /* Bus number, MUST MATCH SSP number 1..n */ | ||
73 | .resource = pxa_spi_nssp_resources, | ||
74 | .num_resources = ARRAY_SIZE(pxa_spi_nssp_resources), | ||
75 | .dev = { | ||
76 | .platform_data = &pxa_nssp_master_info, /* Passed to driver */ | ||
77 | }, | ||
78 | }; | ||
79 | |||
80 | static struct platform_device *devices[] __initdata = { | ||
81 | &pxa_spi_nssp, | ||
82 | }; | ||
83 | |||
84 | static void __init board_init(void) | ||
85 | { | ||
86 | (void)platform_add_device(devices, ARRAY_SIZE(devices)); | ||
87 | } | ||
88 | |||
89 | Declaring Slave Devices | ||
90 | ----------------------- | ||
91 | Typically each SPI slave (chip) is defined in the arch/.../mach-*/board-*.c | ||
92 | using the "spi_board_info" structure found in "linux/spi/spi.h". See | ||
93 | "Documentation/spi/spi_summary" for additional information. | ||
94 | |||
95 | Each slave device attached to the PXA must provide slave specific configuration | ||
96 | information via the structure "pxa2xx_spi_chip" found in | ||
97 | "include/asm-arm/arch-pxa/pxa2xx_spi.h". The pxa2xx_spi master controller driver | ||
98 | will uses the configuration whenever the driver communicates with the slave | ||
99 | device. | ||
100 | |||
101 | struct pxa2xx_spi_chip { | ||
102 | u8 tx_threshold; | ||
103 | u8 rx_threshold; | ||
104 | u8 dma_burst_size; | ||
105 | u32 timeout_microsecs; | ||
106 | u8 enable_loopback; | ||
107 | void (*cs_control)(u32 command); | ||
108 | }; | ||
109 | |||
110 | The "pxa2xx_spi_chip.tx_threshold" and "pxa2xx_spi_chip.rx_threshold" fields are | ||
111 | used to configure the SSP hardware fifo. These fields are critical to the | ||
112 | performance of pxa2xx_spi driver and misconfiguration will result in rx | ||
113 | fifo overruns (especially in PIO mode transfers). Good default values are | ||
114 | |||
115 | .tx_threshold = 12, | ||
116 | .rx_threshold = 4, | ||
117 | |||
118 | The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA | ||
119 | engine and is related the "spi_device.bits_per_word" field. Read and understand | ||
120 | the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers | ||
121 | to determine the correct value. An SSP configured for byte-wide transfers would | ||
122 | use a value of 8. | ||
123 | |||
124 | The "pxa2xx_spi_chip.timeout_microsecs" fields is used to efficiently handle | ||
125 | trailing bytes in the SSP receiver fifo. The correct value for this field is | ||
126 | dependent on the SPI bus speed ("spi_board_info.max_speed_hz") and the specific | ||
127 | slave device. Please note the the PXA2xx SSP 1 does not support trailing byte | ||
128 | timeouts and must busy-wait any trailing bytes. | ||
129 | |||
130 | The "pxa2xx_spi_chip.enable_loopback" field is used to place the SSP porting | ||
131 | into internal loopback mode. In this mode the SSP controller internally | ||
132 | connects the SSPTX pin the the SSPRX pin. This is useful for initial setup | ||
133 | testing. | ||
134 | |||
135 | The "pxa2xx_spi_chip.cs_control" field is used to point to a board specific | ||
136 | function for asserting/deasserting a slave device chip select. If the field is | ||
137 | NULL, the pxa2xx_spi master controller driver assumes that the SSP port is | ||
138 | configured to use SSPFRM instead. | ||
139 | |||
140 | NSSP SALVE SAMPLE | ||
141 | ----------------- | ||
142 | The pxa2xx_spi_chip structure is passed to the pxa2xx_spi driver in the | ||
143 | "spi_board_info.controller_data" field. Below is a sample configuration using | ||
144 | the PXA255 NSSP. | ||
145 | |||
146 | /* Chip Select control for the CS8415A SPI slave device */ | ||
147 | static void cs8415a_cs_control(u32 command) | ||
148 | { | ||
149 | if (command & PXA2XX_CS_ASSERT) | ||
150 | GPCR(2) = GPIO_bit(2); | ||
151 | else | ||
152 | GPSR(2) = GPIO_bit(2); | ||
153 | } | ||
154 | |||
155 | /* Chip Select control for the CS8405A SPI slave device */ | ||
156 | static void cs8405a_cs_control(u32 command) | ||
157 | { | ||
158 | if (command & PXA2XX_CS_ASSERT) | ||
159 | GPCR(3) = GPIO_bit(3); | ||
160 | else | ||
161 | GPSR(3) = GPIO_bit(3); | ||
162 | } | ||
163 | |||
164 | static struct pxa2xx_spi_chip cs8415a_chip_info = { | ||
165 | .tx_threshold = 12, /* SSP hardward FIFO threshold */ | ||
166 | .rx_threshold = 4, /* SSP hardward FIFO threshold */ | ||
167 | .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */ | ||
168 | .timeout_microsecs = 64, /* Wait at least 64usec to handle trailing */ | ||
169 | .cs_control = cs8415a_cs_control, /* Use external chip select */ | ||
170 | }; | ||
171 | |||
172 | static struct pxa2xx_spi_chip cs8405a_chip_info = { | ||
173 | .tx_threshold = 12, /* SSP hardward FIFO threshold */ | ||
174 | .rx_threshold = 4, /* SSP hardward FIFO threshold */ | ||
175 | .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */ | ||
176 | .timeout_microsecs = 64, /* Wait at least 64usec to handle trailing */ | ||
177 | .cs_control = cs8405a_cs_control, /* Use external chip select */ | ||
178 | }; | ||
179 | |||
180 | static struct spi_board_info streetracer_spi_board_info[] __initdata = { | ||
181 | { | ||
182 | .modalias = "cs8415a", /* Name of spi_driver for this device */ | ||
183 | .max_speed_hz = 3686400, /* Run SSP as fast a possbile */ | ||
184 | .bus_num = 2, /* Framework bus number */ | ||
185 | .chip_select = 0, /* Framework chip select */ | ||
186 | .platform_data = NULL; /* No spi_driver specific config */ | ||
187 | .controller_data = &cs8415a_chip_info, /* Master chip config */ | ||
188 | .irq = STREETRACER_APCI_IRQ, /* Slave device interrupt */ | ||
189 | }, | ||
190 | { | ||
191 | .modalias = "cs8405a", /* Name of spi_driver for this device */ | ||
192 | .max_speed_hz = 3686400, /* Run SSP as fast a possbile */ | ||
193 | .bus_num = 2, /* Framework bus number */ | ||
194 | .chip_select = 1, /* Framework chip select */ | ||
195 | .controller_data = &cs8405a_chip_info, /* Master chip config */ | ||
196 | .irq = STREETRACER_APCI_IRQ, /* Slave device interrupt */ | ||
197 | }, | ||
198 | }; | ||
199 | |||
200 | static void __init streetracer_init(void) | ||
201 | { | ||
202 | spi_register_board_info(streetracer_spi_board_info, | ||
203 | ARRAY_SIZE(streetracer_spi_board_info)); | ||
204 | } | ||
205 | |||
206 | |||
207 | DMA and PIO I/O Support | ||
208 | ----------------------- | ||
209 | The pxa2xx_spi driver support both DMA and interrupt driven PIO message | ||
210 | transfers. The driver defaults to PIO mode and DMA transfers must enabled by | ||
211 | setting the "enable_dma" flag in the "pxa2xx_spi_master" structure and and | ||
212 | ensuring that the "pxa2xx_spi_chip.dma_burst_size" field is non-zero. The DMA | ||
213 | mode support both coherent and stream based DMA mappings. | ||
214 | |||
215 | The following logic is used to determine the type of I/O to be used on | ||
216 | a per "spi_transfer" basis: | ||
217 | |||
218 | if !enable_dma or dma_burst_size == 0 then | ||
219 | always use PIO transfers | ||
220 | |||
221 | if spi_message.is_dma_mapped and rx_dma_buf != 0 and tx_dma_buf != 0 then | ||
222 | use coherent DMA mode | ||
223 | |||
224 | if rx_buf and tx_buf are aligned on 8 byte boundary then | ||
225 | use streaming DMA mode | ||
226 | |||
227 | otherwise | ||
228 | use PIO transfer | ||
229 | |||
230 | THANKS TO | ||
231 | --------- | ||
232 | |||
233 | David Brownell and others for mentoring the development of this driver. | ||
234 | |||
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index a5ffba33a351..068732d32276 100644 --- a/Documentation/spi/spi-summary +++ b/Documentation/spi/spi-summary | |||
@@ -414,7 +414,33 @@ to get the driver-private data allocated for that device. | |||
414 | The driver will initialize the fields of that spi_master, including the | 414 | The driver will initialize the fields of that spi_master, including the |
415 | bus number (maybe the same as the platform device ID) and three methods | 415 | bus number (maybe the same as the platform device ID) and three methods |
416 | used to interact with the SPI core and SPI protocol drivers. It will | 416 | used to interact with the SPI core and SPI protocol drivers. It will |
417 | also initialize its own internal state. | 417 | also initialize its own internal state. (See below about bus numbering |
418 | and those methods.) | ||
419 | |||
420 | After you initialize the spi_master, then use spi_register_master() to | ||
421 | publish it to the rest of the system. At that time, device nodes for | ||
422 | the controller and any predeclared spi devices will be made available, | ||
423 | and the driver model core will take care of binding them to drivers. | ||
424 | |||
425 | If you need to remove your SPI controller driver, spi_unregister_master() | ||
426 | will reverse the effect of spi_register_master(). | ||
427 | |||
428 | |||
429 | BUS NUMBERING | ||
430 | |||
431 | Bus numbering is important, since that's how Linux identifies a given | ||
432 | SPI bus (shared SCK, MOSI, MISO). Valid bus numbers start at zero. On | ||
433 | SOC systems, the bus numbers should match the numbers defined by the chip | ||
434 | manufacturer. For example, hardware controller SPI2 would be bus number 2, | ||
435 | and spi_board_info for devices connected to it would use that number. | ||
436 | |||
437 | If you don't have such hardware-assigned bus number, and for some reason | ||
438 | you can't just assign them, then provide a negative bus number. That will | ||
439 | then be replaced by a dynamically assigned number. You'd then need to treat | ||
440 | this as a non-static configuration (see above). | ||
441 | |||
442 | |||
443 | SPI MASTER METHODS | ||
418 | 444 | ||
419 | master->setup(struct spi_device *spi) | 445 | master->setup(struct spi_device *spi) |
420 | This sets up the device clock rate, SPI mode, and word sizes. | 446 | This sets up the device clock rate, SPI mode, and word sizes. |
@@ -431,6 +457,9 @@ also initialize its own internal state. | |||
431 | state it dynamically associates with that device. If you do that, | 457 | state it dynamically associates with that device. If you do that, |
432 | be sure to provide the cleanup() method to free that state. | 458 | be sure to provide the cleanup() method to free that state. |
433 | 459 | ||
460 | |||
461 | SPI MESSAGE QUEUE | ||
462 | |||
434 | The bulk of the driver will be managing the I/O queue fed by transfer(). | 463 | The bulk of the driver will be managing the I/O queue fed by transfer(). |
435 | 464 | ||
436 | That queue could be purely conceptual. For example, a driver used only | 465 | That queue could be purely conceptual. For example, a driver used only |
@@ -440,6 +469,9 @@ But the queue will probably be very real, using message->queue, PIO, | |||
440 | often DMA (especially if the root filesystem is in SPI flash), and | 469 | often DMA (especially if the root filesystem is in SPI flash), and |
441 | execution contexts like IRQ handlers, tasklets, or workqueues (such | 470 | execution contexts like IRQ handlers, tasklets, or workqueues (such |
442 | as keventd). Your driver can be as fancy, or as simple, as you need. | 471 | as keventd). Your driver can be as fancy, or as simple, as you need. |
472 | Such a transfer() method would normally just add the message to a | ||
473 | queue, and then start some asynchronous transfer engine (unless it's | ||
474 | already running). | ||
443 | 475 | ||
444 | 476 | ||
445 | THANKS TO | 477 | THANKS TO |
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt index c5beb548cfc4..21ed51173662 100644 --- a/Documentation/watchdog/watchdog-api.txt +++ b/Documentation/watchdog/watchdog-api.txt | |||
@@ -36,6 +36,9 @@ timeout or margin. The simplest way to ping the watchdog is to write | |||
36 | some data to the device. So a very simple watchdog daemon would look | 36 | some data to the device. So a very simple watchdog daemon would look |
37 | like this: | 37 | like this: |
38 | 38 | ||
39 | #include <stdlib.h> | ||
40 | #include <fcntl.h> | ||
41 | |||
39 | int main(int argc, const char *argv[]) { | 42 | int main(int argc, const char *argv[]) { |
40 | int fd=open("/dev/watchdog",O_WRONLY); | 43 | int fd=open("/dev/watchdog",O_WRONLY); |
41 | if (fd==-1) { | 44 | if (fd==-1) { |
diff --git a/MAINTAINERS b/MAINTAINERS index 5e3355871416..c3c5842402df 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -40,11 +40,20 @@ trivial patch so apply some common sense. | |||
40 | PLEASE document known bugs. If it doesn't work for everything | 40 | PLEASE document known bugs. If it doesn't work for everything |
41 | or does something very odd once a month document it. | 41 | or does something very odd once a month document it. |
42 | 42 | ||
43 | PLEASE remember that submissions must be made under the terms | ||
44 | of the OSDL certificate of contribution | ||
45 | (http://www.osdl.org/newsroom/press_releases/2004/2004_05_24_dco.html) | ||
46 | and should include a Signed-off-by: line. | ||
47 | |||
43 | 6. Make sure you have the right to send any changes you make. If you | 48 | 6. Make sure you have the right to send any changes you make. If you |
44 | do changes at work you may find your employer owns the patch | 49 | do changes at work you may find your employer owns the patch |
45 | not you. | 50 | not you. |
46 | 51 | ||
47 | 7. Happy hacking. | 52 | 7. When sending security related changes or reports to a maintainer |
53 | please Cc: security@kernel.org, especially if the maintainer | ||
54 | does not respond. | ||
55 | |||
56 | 8. Happy hacking. | ||
48 | 57 | ||
49 | ----------------------------------- | 58 | ----------------------------------- |
50 | 59 | ||
@@ -556,7 +565,19 @@ BROADBAND PROCESSOR ARCHITECTURE | |||
556 | P: Arnd Bergmann | 565 | P: Arnd Bergmann |
557 | M: arnd@arndb.de | 566 | M: arnd@arndb.de |
558 | L: linuxppc-dev@ozlabs.org | 567 | L: linuxppc-dev@ozlabs.org |
559 | W: http://linuxppc64.org | 568 | W: http://www.penguinppc.org/ppc64/ |
569 | S: Supported | ||
570 | |||
571 | BROADCOM BNX2 GIGABIT ETHERNET DRIVER | ||
572 | P: Michael Chan | ||
573 | M: mchan@broadcom.com | ||
574 | L: netdev@vger.kernel.org | ||
575 | S: Supported | ||
576 | |||
577 | BROADCOM TG3 GIGABIT ETHERNET DRIVER | ||
578 | P: Michael Chan | ||
579 | M: mchan@broadcom.com | ||
580 | L: netdev@vger.kernel.org | ||
560 | S: Supported | 581 | S: Supported |
561 | 582 | ||
562 | BTTV VIDEO4LINUX DRIVER | 583 | BTTV VIDEO4LINUX DRIVER |
@@ -969,7 +990,7 @@ S: Maintained | |||
969 | EXT3 FILE SYSTEM | 990 | EXT3 FILE SYSTEM |
970 | P: Stephen Tweedie, Andrew Morton | 991 | P: Stephen Tweedie, Andrew Morton |
971 | M: sct@redhat.com, akpm@osdl.org, adilger@clusterfs.com | 992 | M: sct@redhat.com, akpm@osdl.org, adilger@clusterfs.com |
972 | L: ext3-users@redhat.com | 993 | L: ext2-devel@lists.sourceforge.net |
973 | S: Maintained | 994 | S: Maintained |
974 | 995 | ||
975 | F71805F HARDWARE MONITORING DRIVER | 996 | F71805F HARDWARE MONITORING DRIVER |
@@ -1530,12 +1551,28 @@ W: http://jfs.sourceforge.net/ | |||
1530 | T: git kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git | 1551 | T: git kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git |
1531 | S: Supported | 1552 | S: Supported |
1532 | 1553 | ||
1554 | JOURNALLING LAYER FOR BLOCK DEVICS (JBD) | ||
1555 | P: Stephen Tweedie, Andrew Morton | ||
1556 | M: sct@redhat.com, akpm@osdl.org | ||
1557 | L: ext2-devel@lists.sourceforge.net | ||
1558 | S: Maintained | ||
1559 | |||
1533 | KCONFIG | 1560 | KCONFIG |
1534 | P: Roman Zippel | 1561 | P: Roman Zippel |
1535 | M: zippel@linux-m68k.org | 1562 | M: zippel@linux-m68k.org |
1536 | L: kbuild-devel@lists.sourceforge.net | 1563 | L: kbuild-devel@lists.sourceforge.net |
1537 | S: Maintained | 1564 | S: Maintained |
1538 | 1565 | ||
1566 | KDUMP | ||
1567 | P: Vivek Goyal | ||
1568 | M: vgoyal@in.ibm.com | ||
1569 | P: Haren Myneni | ||
1570 | M: hbabu@us.ibm.com | ||
1571 | L: fastboot@lists.osdl.org | ||
1572 | L: linux-kernel@vger.kernel.org | ||
1573 | W: http://lse.sourceforge.net/kdump/ | ||
1574 | S: Maintained | ||
1575 | |||
1539 | KERNEL AUTOMOUNTER (AUTOFS) | 1576 | KERNEL AUTOMOUNTER (AUTOFS) |
1540 | P: H. Peter Anvin | 1577 | P: H. Peter Anvin |
1541 | M: hpa@zytor.com | 1578 | M: hpa@zytor.com |
@@ -1603,6 +1640,11 @@ M: James.Bottomley@HansenPartnership.com | |||
1603 | L: linux-scsi@vger.kernel.org | 1640 | L: linux-scsi@vger.kernel.org |
1604 | S: Maintained | 1641 | S: Maintained |
1605 | 1642 | ||
1643 | LED SUBSYSTEM | ||
1644 | P: Richard Purdie | ||
1645 | M: rpurdie@rpsys.net | ||
1646 | S: Maintained | ||
1647 | |||
1606 | LEGO USB Tower driver | 1648 | LEGO USB Tower driver |
1607 | P: Juergen Stuber | 1649 | P: Juergen Stuber |
1608 | M: starblue@users.sourceforge.net | 1650 | M: starblue@users.sourceforge.net |
@@ -1662,7 +1704,7 @@ S: Maintained | |||
1662 | 1704 | ||
1663 | LINUX FOR POWERPC EMBEDDED PPC8XX | 1705 | LINUX FOR POWERPC EMBEDDED PPC8XX |
1664 | P: Marcelo Tosatti | 1706 | P: Marcelo Tosatti |
1665 | M: marcelo.tosatti@cyclades.com | 1707 | M: marcelo@kvack.org |
1666 | W: http://www.penguinppc.org/ | 1708 | W: http://www.penguinppc.org/ |
1667 | L: linuxppc-embedded@ozlabs.org | 1709 | L: linuxppc-embedded@ozlabs.org |
1668 | S: Maintained | 1710 | S: Maintained |
@@ -1686,7 +1728,7 @@ M: paulus@au.ibm.com | |||
1686 | P: Anton Blanchard | 1728 | P: Anton Blanchard |
1687 | M: anton@samba.org | 1729 | M: anton@samba.org |
1688 | M: anton@au.ibm.com | 1730 | M: anton@au.ibm.com |
1689 | W: http://linuxppc64.org | 1731 | W: http://www.penguinppc.org/ppc64/ |
1690 | L: linuxppc-dev@ozlabs.org | 1732 | L: linuxppc-dev@ozlabs.org |
1691 | S: Supported | 1733 | S: Supported |
1692 | 1734 | ||
@@ -1847,6 +1889,11 @@ L: linux-kernel@vger.kernel.org | |||
1847 | W: http://www.atnf.csiro.au/~rgooch/linux/kernel-patches.html | 1889 | W: http://www.atnf.csiro.au/~rgooch/linux/kernel-patches.html |
1848 | S: Maintained | 1890 | S: Maintained |
1849 | 1891 | ||
1892 | MULTIMEDIA CARD SUBSYSTEM | ||
1893 | P: Russell King | ||
1894 | M: rmk+mmc@arm.linux.org.uk | ||
1895 | S: Maintained | ||
1896 | |||
1850 | MULTISOUND SOUND DRIVER | 1897 | MULTISOUND SOUND DRIVER |
1851 | P: Andrew Veliath | 1898 | P: Andrew Veliath |
1852 | M: andrewtv@usa.net | 1899 | M: andrewtv@usa.net |
@@ -1869,6 +1916,12 @@ M: James.Bottomley@HansenPartnership.com | |||
1869 | L: linux-scsi@vger.kernel.org | 1916 | L: linux-scsi@vger.kernel.org |
1870 | S: Maintained | 1917 | S: Maintained |
1871 | 1918 | ||
1919 | NETEM NETWORK EMULATOR | ||
1920 | P: Stephen Hemminger | ||
1921 | M: shemminger@osdl.org | ||
1922 | L: netem@osdl.org | ||
1923 | S: Maintained | ||
1924 | |||
1872 | NETFILTER/IPTABLES/IPCHAINS | 1925 | NETFILTER/IPTABLES/IPCHAINS |
1873 | P: Rusty Russell | 1926 | P: Rusty Russell |
1874 | P: Marc Boucher | 1927 | P: Marc Boucher |
@@ -2513,6 +2566,12 @@ M: perex@suse.cz | |||
2513 | L: alsa-devel@alsa-project.org | 2566 | L: alsa-devel@alsa-project.org |
2514 | S: Maintained | 2567 | S: Maintained |
2515 | 2568 | ||
2569 | SPI SUBSYSTEM | ||
2570 | P: David Brownell | ||
2571 | M: dbrownell@users.sourceforge.net | ||
2572 | L: spi-devel-general@lists.sourceforge.net | ||
2573 | S: Maintained | ||
2574 | |||
2516 | TPM DEVICE DRIVER | 2575 | TPM DEVICE DRIVER |
2517 | P: Kylene Hall | 2576 | P: Kylene Hall |
2518 | M: kjhall@us.ibm.com | 2577 | M: kjhall@us.ibm.com |
@@ -1,8 +1,8 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 17 | 3 | SUBLEVEL = 17 |
4 | EXTRAVERSION =-rc4 | 4 | EXTRAVERSION =-rc6 |
5 | NAME=Sliding Snow Leopard | 5 | NAME=Crazed Snow-Weasel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
8 | # To see a list of typical targets execute "make help" | 8 | # To see a list of typical targets execute "make help" |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 8290b69da202..213c7850d5fb 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -453,7 +453,7 @@ config ALPHA_IRONGATE | |||
453 | 453 | ||
454 | config GENERIC_HWEIGHT | 454 | config GENERIC_HWEIGHT |
455 | bool | 455 | bool |
456 | default y if !ALPHA_EV6 && !ALPHA_EV67 | 456 | default y if !ALPHA_EV67 |
457 | 457 | ||
458 | config ALPHA_AVANTI | 458 | config ALPHA_AVANTI |
459 | bool | 459 | bool |
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c index c645c5e14786..2b245ad731ee 100644 --- a/arch/alpha/kernel/alpha_ksyms.c +++ b/arch/alpha/kernel/alpha_ksyms.c | |||
@@ -182,7 +182,6 @@ EXPORT_SYMBOL(smp_num_cpus); | |||
182 | EXPORT_SYMBOL(smp_call_function); | 182 | EXPORT_SYMBOL(smp_call_function); |
183 | EXPORT_SYMBOL(smp_call_function_on_cpu); | 183 | EXPORT_SYMBOL(smp_call_function_on_cpu); |
184 | EXPORT_SYMBOL(_atomic_dec_and_lock); | 184 | EXPORT_SYMBOL(_atomic_dec_and_lock); |
185 | EXPORT_SYMBOL(cpu_present_mask); | ||
186 | #endif /* CONFIG_SMP */ | 185 | #endif /* CONFIG_SMP */ |
187 | 186 | ||
188 | /* | 187 | /* |
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 9924fd07743a..c760a831fd1a 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c | |||
@@ -94,7 +94,7 @@ common_shutdown_1(void *generic_ptr) | |||
94 | if (cpuid != boot_cpuid) { | 94 | if (cpuid != boot_cpuid) { |
95 | flags |= 0x00040000UL; /* "remain halted" */ | 95 | flags |= 0x00040000UL; /* "remain halted" */ |
96 | *pflags = flags; | 96 | *pflags = flags; |
97 | clear_bit(cpuid, &cpu_present_mask); | 97 | cpu_clear(cpuid, cpu_present_map); |
98 | halt(); | 98 | halt(); |
99 | } | 99 | } |
100 | #endif | 100 | #endif |
@@ -120,8 +120,8 @@ common_shutdown_1(void *generic_ptr) | |||
120 | 120 | ||
121 | #ifdef CONFIG_SMP | 121 | #ifdef CONFIG_SMP |
122 | /* Wait for the secondaries to halt. */ | 122 | /* Wait for the secondaries to halt. */ |
123 | cpu_clear(boot_cpuid, cpu_possible_map); | 123 | cpu_clear(boot_cpuid, cpu_present_map); |
124 | while (cpus_weight(cpu_possible_map)) | 124 | while (cpus_weight(cpu_present_map)) |
125 | barrier(); | 125 | barrier(); |
126 | #endif | 126 | #endif |
127 | 127 | ||
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index 185255416e85..4dc273e537fd 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c | |||
@@ -68,7 +68,6 @@ enum ipi_message_type { | |||
68 | static int smp_secondary_alive __initdata = 0; | 68 | static int smp_secondary_alive __initdata = 0; |
69 | 69 | ||
70 | /* Which cpus ids came online. */ | 70 | /* Which cpus ids came online. */ |
71 | cpumask_t cpu_present_mask; | ||
72 | cpumask_t cpu_online_map; | 71 | cpumask_t cpu_online_map; |
73 | 72 | ||
74 | EXPORT_SYMBOL(cpu_online_map); | 73 | EXPORT_SYMBOL(cpu_online_map); |
@@ -439,7 +438,7 @@ setup_smp(void) | |||
439 | if ((cpu->flags & 0x1cc) == 0x1cc) { | 438 | if ((cpu->flags & 0x1cc) == 0x1cc) { |
440 | smp_num_probed++; | 439 | smp_num_probed++; |
441 | /* Assume here that "whami" == index */ | 440 | /* Assume here that "whami" == index */ |
442 | cpu_set(i, cpu_present_mask); | 441 | cpu_set(i, cpu_present_map); |
443 | cpu->pal_revision = boot_cpu_palrev; | 442 | cpu->pal_revision = boot_cpu_palrev; |
444 | } | 443 | } |
445 | 444 | ||
@@ -450,11 +449,10 @@ setup_smp(void) | |||
450 | } | 449 | } |
451 | } else { | 450 | } else { |
452 | smp_num_probed = 1; | 451 | smp_num_probed = 1; |
453 | cpu_set(boot_cpuid, cpu_present_mask); | ||
454 | } | 452 | } |
455 | 453 | ||
456 | printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", | 454 | printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_map = %lx\n", |
457 | smp_num_probed, cpu_possible_map.bits[0]); | 455 | smp_num_probed, cpu_present_map.bits[0]); |
458 | } | 456 | } |
459 | 457 | ||
460 | /* | 458 | /* |
@@ -473,7 +471,7 @@ smp_prepare_cpus(unsigned int max_cpus) | |||
473 | 471 | ||
474 | /* Nothing to do on a UP box, or when told not to. */ | 472 | /* Nothing to do on a UP box, or when told not to. */ |
475 | if (smp_num_probed == 1 || max_cpus == 0) { | 473 | if (smp_num_probed == 1 || max_cpus == 0) { |
476 | cpu_present_mask = cpumask_of_cpu(boot_cpuid); | 474 | cpu_present_map = cpumask_of_cpu(boot_cpuid); |
477 | printk(KERN_INFO "SMP mode deactivated.\n"); | 475 | printk(KERN_INFO "SMP mode deactivated.\n"); |
478 | return; | 476 | return; |
479 | } | 477 | } |
@@ -486,10 +484,6 @@ smp_prepare_cpus(unsigned int max_cpus) | |||
486 | void __devinit | 484 | void __devinit |
487 | smp_prepare_boot_cpu(void) | 485 | smp_prepare_boot_cpu(void) |
488 | { | 486 | { |
489 | /* | ||
490 | * Mark the boot cpu (current cpu) as online | ||
491 | */ | ||
492 | cpu_set(smp_processor_id(), cpu_online_map); | ||
493 | } | 487 | } |
494 | 488 | ||
495 | int __devinit | 489 | int __devinit |
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c index 5f84417eeb7b..2551fb49ae09 100644 --- a/arch/alpha/kernel/sys_titan.c +++ b/arch/alpha/kernel/sys_titan.c | |||
@@ -66,7 +66,7 @@ titan_update_irq_hw(unsigned long mask) | |||
66 | register int bcpu = boot_cpuid; | 66 | register int bcpu = boot_cpuid; |
67 | 67 | ||
68 | #ifdef CONFIG_SMP | 68 | #ifdef CONFIG_SMP |
69 | cpumask_t cpm = cpu_present_mask; | 69 | cpumask_t cpm = cpu_present_map; |
70 | volatile unsigned long *dim0, *dim1, *dim2, *dim3; | 70 | volatile unsigned long *dim0, *dim1, *dim2, *dim3; |
71 | unsigned long mask0, mask1, mask2, mask3, dummy; | 71 | unsigned long mask0, mask1, mask2, mask3, dummy; |
72 | 72 | ||
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 5d3acff8c596..d22f38b957db 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -101,7 +101,7 @@ config DEBUG_S3C2410_UART | |||
101 | help | 101 | help |
102 | Choice for UART for kernel low-level using S3C2410 UARTS, | 102 | Choice for UART for kernel low-level using S3C2410 UARTS, |
103 | should be between zero and two. The port must have been | 103 | should be between zero and two. The port must have been |
104 | initalised by the boot-loader before use. | 104 | initialised by the boot-loader before use. |
105 | 105 | ||
106 | The uncompressor code port configuration is now handled | 106 | The uncompressor code port configuration is now handled |
107 | by CONFIG_S3C2410_LOWLEVEL_UART_PORT. | 107 | by CONFIG_S3C2410_LOWLEVEL_UART_PORT. |
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 45fdf4a51a2a..396efba9bacd 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c | |||
@@ -99,6 +99,8 @@ int main(void) | |||
99 | DEFINE(MACHINFO_NAME, offsetof(struct machine_desc, name)); | 99 | DEFINE(MACHINFO_NAME, offsetof(struct machine_desc, name)); |
100 | DEFINE(MACHINFO_PHYSIO, offsetof(struct machine_desc, phys_io)); | 100 | DEFINE(MACHINFO_PHYSIO, offsetof(struct machine_desc, phys_io)); |
101 | DEFINE(MACHINFO_PGOFFIO, offsetof(struct machine_desc, io_pg_offst)); | 101 | DEFINE(MACHINFO_PGOFFIO, offsetof(struct machine_desc, io_pg_offst)); |
102 | BLANK(); | ||
103 | DEFINE(PROC_INFO_SZ, sizeof(struct proc_info_list)); | ||
102 | DEFINE(PROCINFO_INITFUNC, offsetof(struct proc_info_list, __cpu_flush)); | 104 | DEFINE(PROCINFO_INITFUNC, offsetof(struct proc_info_list, __cpu_flush)); |
103 | DEFINE(PROCINFO_MMUFLAGS, offsetof(struct proc_info_list, __cpu_mmu_flags)); | 105 | DEFINE(PROCINFO_MMUFLAGS, offsetof(struct proc_info_list, __cpu_mmu_flags)); |
104 | return 0; | 106 | return 0; |
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c index 03532769a97f..0a3e9ad297d8 100644 --- a/arch/arm/kernel/dma-isa.c +++ b/arch/arm/kernel/dma-isa.c | |||
@@ -143,12 +143,23 @@ static struct dma_ops isa_dma_ops = { | |||
143 | .residue = isa_get_dma_residue, | 143 | .residue = isa_get_dma_residue, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | static struct resource dma_resources[] = { | 146 | static struct resource dma_resources[] = { { |
147 | { "dma1", 0x0000, 0x000f }, | 147 | .name = "dma1", |
148 | { "dma low page", 0x0080, 0x008f }, | 148 | .start = 0x0000, |
149 | { "dma2", 0x00c0, 0x00df }, | 149 | .end = 0x000f |
150 | { "dma high page", 0x0480, 0x048f } | 150 | }, { |
151 | }; | 151 | .name = "dma low page", |
152 | .start = 0x0080, | ||
153 | .end = 0x008f | ||
154 | }, { | ||
155 | .name = "dma2", | ||
156 | .start = 0x00c0, | ||
157 | .end = 0x00df | ||
158 | }, { | ||
159 | .name = "dma high page", | ||
160 | .start = 0x0480, | ||
161 | .end = 0x048f | ||
162 | } }; | ||
152 | 163 | ||
153 | void __init isa_init_dma(dma_t *dma) | 164 | void __init isa_init_dma(dma_t *dma) |
154 | { | 165 | { |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 1a1539e3a946..7df6e1aaa323 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -311,7 +311,7 @@ void free_thread_info(struct thread_info *thread) | |||
311 | struct thread_info_list *th = &get_cpu_var(thread_info_list); | 311 | struct thread_info_list *th = &get_cpu_var(thread_info_list); |
312 | if (th->nr < EXTRA_TASK_STRUCT) { | 312 | if (th->nr < EXTRA_TASK_STRUCT) { |
313 | unsigned long *p = (unsigned long *)thread; | 313 | unsigned long *p = (unsigned long *)thread; |
314 | p[0] = th->head; | 314 | p[0] = (unsigned long)th->head; |
315 | th->head = p; | 315 | th->head = p; |
316 | th->nr += 1; | 316 | th->nr += 1; |
317 | put_cpu_var(thread_info_list); | 317 | put_cpu_var(thread_info_list); |
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S index 3bdc8c6949c5..16153c86c3f8 100644 --- a/arch/arm/lib/backtrace.S +++ b/arch/arm/lib/backtrace.S | |||
@@ -122,7 +122,7 @@ ENTRY(c_backtrace) | |||
122 | #define reg r5 | 122 | #define reg r5 |
123 | #define stack r6 | 123 | #define stack r6 |
124 | 124 | ||
125 | .Ldumpstm: stmfd sp!, {instr, reg, stack, r7, lr} | 125 | .Ldumpstm: stmfd sp!, {instr, reg, stack, r7, r8, lr} |
126 | mov stack, r0 | 126 | mov stack, r0 |
127 | mov instr, r1 | 127 | mov instr, r1 |
128 | mov reg, #9 | 128 | mov reg, #9 |
@@ -145,7 +145,7 @@ ENTRY(c_backtrace) | |||
145 | adrne r0, .Lcr | 145 | adrne r0, .Lcr |
146 | blne printk | 146 | blne printk |
147 | mov r0, stack | 147 | mov r0, stack |
148 | LOADREGS(fd, sp!, {instr, reg, stack, r7, pc}) | 148 | LOADREGS(fd, sp!, {instr, reg, stack, r7, r8, pc}) |
149 | 149 | ||
150 | .Lfp: .asciz " r%d = %08X%c" | 150 | .Lfp: .asciz " r%d = %08X%c" |
151 | .Lcr: .asciz "\n" | 151 | .Lcr: .asciz "\n" |
diff --git a/arch/arm/lib/div64.S b/arch/arm/lib/div64.S index ec9a1cd6176f..58eef6607629 100644 --- a/arch/arm/lib/div64.S +++ b/arch/arm/lib/div64.S | |||
@@ -189,12 +189,12 @@ ENTRY(__do_div64) | |||
189 | moveq pc, lr | 189 | moveq pc, lr |
190 | 190 | ||
191 | @ Division by 0: | 191 | @ Division by 0: |
192 | str lr, [sp, #-4]! | 192 | str lr, [sp, #-8]! |
193 | bl __div0 | 193 | bl __div0 |
194 | 194 | ||
195 | @ as wrong as it could be... | 195 | @ as wrong as it could be... |
196 | mov yl, #0 | 196 | mov yl, #0 |
197 | mov yh, #0 | 197 | mov yh, #0 |
198 | mov xh, #0 | 198 | mov xh, #0 |
199 | ldr pc, [sp], #4 | 199 | ldr pc, [sp], #8 |
200 | 200 | ||
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c index 9be01b0c3f48..e24566b88a78 100644 --- a/arch/arm/mach-ep93xx/ts72xx.c +++ b/arch/arm/mach-ep93xx/ts72xx.c | |||
@@ -111,21 +111,21 @@ static void __init ts72xx_map_io(void) | |||
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | static unsigned char ts72xx_rtc_readb(unsigned long addr) | 114 | static unsigned char ts72xx_rtc_readbyte(unsigned long addr) |
115 | { | 115 | { |
116 | __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); | 116 | __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); |
117 | return __raw_readb(TS72XX_RTC_DATA_VIRT_BASE); | 117 | return __raw_readb(TS72XX_RTC_DATA_VIRT_BASE); |
118 | } | 118 | } |
119 | 119 | ||
120 | static void ts72xx_rtc_writeb(unsigned char value, unsigned long addr) | 120 | static void ts72xx_rtc_writebyte(unsigned char value, unsigned long addr) |
121 | { | 121 | { |
122 | __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); | 122 | __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); |
123 | __raw_writeb(value, TS72XX_RTC_DATA_VIRT_BASE); | 123 | __raw_writeb(value, TS72XX_RTC_DATA_VIRT_BASE); |
124 | } | 124 | } |
125 | 125 | ||
126 | static struct m48t86_ops ts72xx_rtc_ops = { | 126 | static struct m48t86_ops ts72xx_rtc_ops = { |
127 | .readb = ts72xx_rtc_readb, | 127 | .readbyte = ts72xx_rtc_readbyte, |
128 | .writeb = ts72xx_rtc_writeb, | 128 | .writebyte = ts72xx_rtc_writebyte, |
129 | }; | 129 | }; |
130 | 130 | ||
131 | static struct platform_device ts72xx_rtc_device = { | 131 | static struct platform_device ts72xx_rtc_device = { |
diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c index eeb8a6d4a399..a5de5f1da9f2 100644 --- a/arch/arm/mach-imx/irq.c +++ b/arch/arm/mach-imx/irq.c | |||
@@ -127,7 +127,7 @@ static void | |||
127 | imx_gpio_ack_irq(unsigned int irq) | 127 | imx_gpio_ack_irq(unsigned int irq) |
128 | { | 128 | { |
129 | DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, irq); | 129 | DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, irq); |
130 | ISR(IRQ_TO_REG(irq)) |= 1 << ((irq - IRQ_GPIOA(0)) % 32); | 130 | ISR(IRQ_TO_REG(irq)) = 1 << ((irq - IRQ_GPIOA(0)) % 32); |
131 | } | 131 | } |
132 | 132 | ||
133 | static void | 133 | static void |
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index a0724f2b24ce..9f55f5ae1044 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
@@ -232,8 +232,6 @@ static void __init intcp_init_irq(void) | |||
232 | for (i = IRQ_PIC_START; i <= IRQ_PIC_END; i++) { | 232 | for (i = IRQ_PIC_START; i <= IRQ_PIC_END; i++) { |
233 | if (i == 11) | 233 | if (i == 11) |
234 | i = 22; | 234 | i = 22; |
235 | if (i == IRQ_CP_CPPLDINT) | ||
236 | i++; | ||
237 | if (i == 29) | 235 | if (i == 29) |
238 | break; | 236 | break; |
239 | set_irq_chip(i, &pic_chip); | 237 | set_irq_chip(i, &pic_chip); |
@@ -259,8 +257,7 @@ static void __init intcp_init_irq(void) | |||
259 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); | 257 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); |
260 | } | 258 | } |
261 | 259 | ||
262 | set_irq_handler(IRQ_CP_CPPLDINT, sic_handle_irq); | 260 | set_irq_chained_handler(IRQ_CP_CPPLDINT, sic_handle_irq); |
263 | pic_unmask_irq(IRQ_CP_CPPLDINT); | ||
264 | } | 261 | } |
265 | 262 | ||
266 | /* | 263 | /* |
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c index 092ee12ced42..affd1d5d7440 100644 --- a/arch/arm/mach-ixp23xx/core.c +++ b/arch/arm/mach-ixp23xx/core.c | |||
@@ -178,8 +178,12 @@ static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type) | |||
178 | 178 | ||
179 | static void ixp23xx_irq_mask(unsigned int irq) | 179 | static void ixp23xx_irq_mask(unsigned int irq) |
180 | { | 180 | { |
181 | volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32); | 181 | volatile unsigned long *intr_reg; |
182 | 182 | ||
183 | if (irq >= 56) | ||
184 | irq += 8; | ||
185 | |||
186 | intr_reg = IXP23XX_INTR_EN1 + (irq / 32); | ||
183 | *intr_reg &= ~(1 << (irq % 32)); | 187 | *intr_reg &= ~(1 << (irq % 32)); |
184 | } | 188 | } |
185 | 189 | ||
@@ -199,17 +203,25 @@ static void ixp23xx_irq_ack(unsigned int irq) | |||
199 | */ | 203 | */ |
200 | static void ixp23xx_irq_level_unmask(unsigned int irq) | 204 | static void ixp23xx_irq_level_unmask(unsigned int irq) |
201 | { | 205 | { |
202 | volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32); | 206 | volatile unsigned long *intr_reg; |
203 | 207 | ||
204 | ixp23xx_irq_ack(irq); | 208 | ixp23xx_irq_ack(irq); |
205 | 209 | ||
210 | if (irq >= 56) | ||
211 | irq += 8; | ||
212 | |||
213 | intr_reg = IXP23XX_INTR_EN1 + (irq / 32); | ||
206 | *intr_reg |= (1 << (irq % 32)); | 214 | *intr_reg |= (1 << (irq % 32)); |
207 | } | 215 | } |
208 | 216 | ||
209 | static void ixp23xx_irq_edge_unmask(unsigned int irq) | 217 | static void ixp23xx_irq_edge_unmask(unsigned int irq) |
210 | { | 218 | { |
211 | volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32); | 219 | volatile unsigned long *intr_reg; |
220 | |||
221 | if (irq >= 56) | ||
222 | irq += 8; | ||
212 | 223 | ||
224 | intr_reg = IXP23XX_INTR_EN1 + (irq / 32); | ||
213 | *intr_reg |= (1 << (irq % 32)); | 225 | *intr_reg |= (1 << (irq % 32)); |
214 | } | 226 | } |
215 | 227 | ||
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index 2a39f9e481ad..3b23f43cb160 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig | |||
@@ -141,7 +141,7 @@ config IXP4XX_INDIRECT_PCI | |||
141 | 2) If > 64MB of memory space is required, the IXP4xx can be | 141 | 2) If > 64MB of memory space is required, the IXP4xx can be |
142 | configured to use indirect registers to access PCI This allows | 142 | configured to use indirect registers to access PCI This allows |
143 | for up to 128MB (0x48000000 to 0x4fffffff) of memory on the bus. | 143 | for up to 128MB (0x48000000 to 0x4fffffff) of memory on the bus. |
144 | The disadvantadge of this is that every PCI access requires | 144 | The disadvantage of this is that every PCI access requires |
145 | three local register accesses plus a spinlock, but in some | 145 | three local register accesses plus a spinlock, but in some |
146 | cases the performance hit is acceptable. In addition, you cannot | 146 | cases the performance hit is acceptable. In addition, you cannot |
147 | mmap() PCI devices in this case due to the indirect nature | 147 | mmap() PCI devices in this case due to the indirect nature |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 98356f810007..b307f11951df 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -95,7 +95,10 @@ static void __init mainstone_init_irq(void) | |||
95 | for(irq = MAINSTONE_IRQ(0); irq <= MAINSTONE_IRQ(15); irq++) { | 95 | for(irq = MAINSTONE_IRQ(0); irq <= MAINSTONE_IRQ(15); irq++) { |
96 | set_irq_chip(irq, &mainstone_irq_chip); | 96 | set_irq_chip(irq, &mainstone_irq_chip); |
97 | set_irq_handler(irq, do_level_IRQ); | 97 | set_irq_handler(irq, do_level_IRQ); |
98 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | 98 | if (irq == MAINSTONE_IRQ(10) || irq == MAINSTONE_IRQ(14)) |
99 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE | IRQF_NOAUTOEN); | ||
100 | else | ||
101 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
99 | } | 102 | } |
100 | set_irq_flags(MAINSTONE_IRQ(8), 0); | 103 | set_irq_flags(MAINSTONE_IRQ(8), 0); |
101 | set_irq_flags(MAINSTONE_IRQ(12), 0); | 104 | set_irq_flags(MAINSTONE_IRQ(12), 0); |
@@ -490,6 +493,7 @@ static void __init mainstone_map_io(void) | |||
490 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") | 493 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") |
491 | /* Maintainer: MontaVista Software Inc. */ | 494 | /* Maintainer: MontaVista Software Inc. */ |
492 | .phys_io = 0x40000000, | 495 | .phys_io = 0x40000000, |
496 | .boot_params = 0xa0000100, /* BLOB boot parameter setting */ | ||
493 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 497 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
494 | .map_io = mainstone_map_io, | 498 | .map_io = mainstone_map_io, |
495 | .init_irq = mainstone_init_irq, | 499 | .init_irq = mainstone_init_irq, |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 19b372df544a..44bcb8097c7a 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -371,6 +371,7 @@ static int spitz_ohci_init(struct device *dev) | |||
371 | static struct pxaohci_platform_data spitz_ohci_platform_data = { | 371 | static struct pxaohci_platform_data spitz_ohci_platform_data = { |
372 | .port_mode = PMM_NPS_MODE, | 372 | .port_mode = PMM_NPS_MODE, |
373 | .init = spitz_ohci_init, | 373 | .init = spitz_ohci_init, |
374 | .power_budget = 150, | ||
374 | }; | 375 | }; |
375 | 376 | ||
376 | 377 | ||
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index d4a586e38d5b..693fb1e396e0 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c | |||
@@ -137,8 +137,11 @@ static struct amba_device *amba_devs[] __initdata = { | |||
137 | static void __init gic_init_irq(void) | 137 | static void __init gic_init_irq(void) |
138 | { | 138 | { |
139 | #ifdef CONFIG_REALVIEW_MPCORE | 139 | #ifdef CONFIG_REALVIEW_MPCORE |
140 | unsigned int pldctrl; | ||
140 | writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK)); | 141 | writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK)); |
141 | writel(0x008003c0, __io_address(REALVIEW_SYS_BASE) + 0xd8); | 142 | pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + 0xd8); |
143 | pldctrl |= 0x00800000; /* New irq mode */ | ||
144 | writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + 0xd8); | ||
142 | writel(0x00000000, __io_address(REALVIEW_SYS_LOCK)); | 145 | writel(0x00000000, __io_address(REALVIEW_SYS_LOCK)); |
143 | #endif | 146 | #endif |
144 | gic_dist_init(__io_address(REALVIEW_GIC_DIST_BASE)); | 147 | gic_dist_init(__io_address(REALVIEW_GIC_DIST_BASE)); |
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig index ce7d81000695..970f98dadffc 100644 --- a/arch/arm/mach-s3c2410/Kconfig +++ b/arch/arm/mach-s3c2410/Kconfig | |||
@@ -170,7 +170,7 @@ config S3C2410_PM_DEBUG | |||
170 | depends on ARCH_S3C2410 && PM | 170 | depends on ARCH_S3C2410 && PM |
171 | help | 171 | help |
172 | Say Y here if you want verbose debugging from the PM Suspend and | 172 | Say Y here if you want verbose debugging from the PM Suspend and |
173 | Resume code. See `Documentation/arm/Samsing-S3C24XX/Suspend.txt` | 173 | Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt> |
174 | for more information. | 174 | for more information. |
175 | 175 | ||
176 | config S3C2410_PM_CHECK | 176 | config S3C2410_PM_CHECK |
diff --git a/arch/arm/mach-s3c2410/sleep.S b/arch/arm/mach-s3c2410/sleep.S index 832fb86a03b4..73de2eaca22a 100644 --- a/arch/arm/mach-s3c2410/sleep.S +++ b/arch/arm/mach-s3c2410/sleep.S | |||
@@ -59,8 +59,7 @@ ENTRY(s3c2410_cpu_suspend) | |||
59 | mrc p15, 0, r5, c13, c0, 0 @ PID | 59 | mrc p15, 0, r5, c13, c0, 0 @ PID |
60 | mrc p15, 0, r6, c3, c0, 0 @ Domain ID | 60 | mrc p15, 0, r6, c3, c0, 0 @ Domain ID |
61 | mrc p15, 0, r7, c2, c0, 0 @ translation table base address | 61 | mrc p15, 0, r7, c2, c0, 0 @ translation table base address |
62 | mrc p15, 0, r8, c2, c0, 0 @ auxiliary control register | 62 | mrc p15, 0, r8, c1, c0, 0 @ control register |
63 | mrc p15, 0, r9, c1, c0, 0 @ control register | ||
64 | 63 | ||
65 | stmia r0, { r4 - r13 } | 64 | stmia r0, { r4 - r13 } |
66 | 65 | ||
@@ -165,7 +164,6 @@ ENTRY(s3c2410_cpu_resume) | |||
165 | mcr p15, 0, r5, c13, c0, 0 @ PID | 164 | mcr p15, 0, r5, c13, c0, 0 @ PID |
166 | mcr p15, 0, r6, c3, c0, 0 @ Domain ID | 165 | mcr p15, 0, r6, c3, c0, 0 @ Domain ID |
167 | mcr p15, 0, r7, c2, c0, 0 @ translation table base | 166 | mcr p15, 0, r7, c2, c0, 0 @ translation table base |
168 | mcr p15, 0, r8, c1, c1, 0 @ auxilliary control | ||
169 | 167 | ||
170 | #ifdef CONFIG_DEBUG_RESUME | 168 | #ifdef CONFIG_DEBUG_RESUME |
171 | mov r3, #'R' | 169 | mov r3, #'R' |
@@ -173,7 +171,7 @@ ENTRY(s3c2410_cpu_resume) | |||
173 | #endif | 171 | #endif |
174 | 172 | ||
175 | ldr r2, =resume_with_mmu | 173 | ldr r2, =resume_with_mmu |
176 | mcr p15, 0, r9, c1, c0, 0 @ turn on MMU, etc | 174 | mcr p15, 0, r8, c1, c0, 0 @ turn on MMU, etc |
177 | nop @ second-to-last before mmu | 175 | nop @ second-to-last before mmu |
178 | mov pc, r2 @ go back to virtual address | 176 | mov pc, r2 @ go back to virtual address |
179 | 177 | ||
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c index 9e02bc3712a0..af6d2775cf82 100644 --- a/arch/arm/mach-sa1100/neponset.c +++ b/arch/arm/mach-sa1100/neponset.c | |||
@@ -59,6 +59,14 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg | |||
59 | if (irr & (IRR_ETHERNET | IRR_USAR)) { | 59 | if (irr & (IRR_ETHERNET | IRR_USAR)) { |
60 | desc->chip->mask(irq); | 60 | desc->chip->mask(irq); |
61 | 61 | ||
62 | /* | ||
63 | * Ack the interrupt now to prevent re-entering | ||
64 | * this neponset handler. Again, this is safe | ||
65 | * since we'll check the IRR register prior to | ||
66 | * leaving. | ||
67 | */ | ||
68 | desc->chip->ack(irq); | ||
69 | |||
62 | if (irr & IRR_ETHERNET) { | 70 | if (irr & IRR_ETHERNET) { |
63 | d = irq_desc + IRQ_NEPONSET_SMC9196; | 71 | d = irq_desc + IRQ_NEPONSET_SMC9196; |
64 | desc_handle_irq(IRQ_NEPONSET_SMC9196, d, regs); | 72 | desc_handle_irq(IRQ_NEPONSET_SMC9196, d, regs); |
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 799697d32dec..cebd48a3dae4 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -112,10 +112,9 @@ void __init versatile_init_irq(void) | |||
112 | { | 112 | { |
113 | unsigned int i; | 113 | unsigned int i; |
114 | 114 | ||
115 | vic_init(VA_VIC_BASE, IRQ_VIC_START, ~(1 << 31)); | 115 | vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0); |
116 | 116 | ||
117 | set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq); | 117 | set_irq_chained_handler(IRQ_VICSOURCE31, sic_handle_irq); |
118 | enable_irq(IRQ_VICSOURCE31); | ||
119 | 118 | ||
120 | /* Do second interrupt controller */ | 119 | /* Do second interrupt controller */ |
121 | writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); | 120 | writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); |
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index 25e0ca3e598c..c1f7180c7bed 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c | |||
@@ -141,7 +141,7 @@ __ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, | |||
141 | return NULL; | 141 | return NULL; |
142 | addr = (unsigned long)area->addr; | 142 | addr = (unsigned long)area->addr; |
143 | if (remap_area_pages(addr, pfn, size, flags)) { | 143 | if (remap_area_pages(addr, pfn, size, flags)) { |
144 | vfree((void *)addr); | 144 | vunmap((void *)addr); |
145 | return NULL; | 145 | return NULL; |
146 | } | 146 | } |
147 | return (void __iomem *) (offset + (char *)addr); | 147 | return (void __iomem *) (offset + (char *)addr); |
@@ -173,7 +173,7 @@ EXPORT_SYMBOL(__ioremap); | |||
173 | 173 | ||
174 | void __iounmap(void __iomem *addr) | 174 | void __iounmap(void __iomem *addr) |
175 | { | 175 | { |
176 | vfree((void *) (PAGE_MASK & (unsigned long) addr)); | 176 | vunmap((void *)(PAGE_MASK & (unsigned long)addr)); |
177 | } | 177 | } |
178 | EXPORT_SYMBOL(__iounmap); | 178 | EXPORT_SYMBOL(__iounmap); |
179 | 179 | ||
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c index f14b2d0f3690..95273de4f772 100644 --- a/arch/arm/mm/mm-armv.c +++ b/arch/arm/mm/mm-armv.c | |||
@@ -376,7 +376,7 @@ void __init build_mem_type_table(void) | |||
376 | ecc_mask = 0; | 376 | ecc_mask = 0; |
377 | } | 377 | } |
378 | 378 | ||
379 | if (cpu_arch <= CPU_ARCH_ARMv5TEJ) { | 379 | if (cpu_arch <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale()) { |
380 | for (i = 0; i < ARRAY_SIZE(mem_types); i++) { | 380 | for (i = 0; i < ARRAY_SIZE(mem_types); i++) { |
381 | if (mem_types[i].prot_l1) | 381 | if (mem_types[i].prot_l1) |
382 | mem_types[i].prot_l1 |= PMD_BIT4; | 382 | mem_types[i].prot_l1 |= PMD_BIT4; |
@@ -631,7 +631,7 @@ void setup_mm_for_reboot(char mode) | |||
631 | pgd = init_mm.pgd; | 631 | pgd = init_mm.pgd; |
632 | 632 | ||
633 | base_pmdval = PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT; | 633 | base_pmdval = PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT; |
634 | if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ) | 634 | if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale()) |
635 | base_pmdval |= PMD_BIT4; | 635 | base_pmdval |= PMD_BIT4; |
636 | 636 | ||
637 | for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) { | 637 | for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) { |
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S index 80873b36c3f7..8d32e21fe151 100644 --- a/arch/arm/mm/proc-xsc3.S +++ b/arch/arm/mm/proc-xsc3.S | |||
@@ -427,12 +427,13 @@ __xsc3_setup: | |||
427 | #endif | 427 | #endif |
428 | mcr p15, 0, r0, c1, c0, 1 @ set auxiliary control reg | 428 | mcr p15, 0, r0, c1, c0, 1 @ set auxiliary control reg |
429 | mrc p15, 0, r0, c1, c0, 0 @ get control register | 429 | mrc p15, 0, r0, c1, c0, 0 @ get control register |
430 | bic r0, r0, #0x0200 @ .... ..R. .... .... | ||
431 | bic r0, r0, #0x0002 @ .... .... .... ..A. | 430 | bic r0, r0, #0x0002 @ .... .... .... ..A. |
432 | orr r0, r0, #0x0005 @ .... .... .... .C.M | 431 | orr r0, r0, #0x0005 @ .... .... .... .C.M |
433 | #if BTB_ENABLE | 432 | #if BTB_ENABLE |
433 | bic r0, r0, #0x0200 @ .... ..R. .... .... | ||
434 | orr r0, r0, #0x3900 @ ..VI Z..S .... .... | 434 | orr r0, r0, #0x3900 @ ..VI Z..S .... .... |
435 | #else | 435 | #else |
436 | bic r0, r0, #0x0a00 @ .... Z.R. .... .... | ||
436 | orr r0, r0, #0x3100 @ ..VI ...S .... .... | 437 | orr r0, r0, #0x3100 @ ..VI ...S .... .... |
437 | #endif | 438 | #endif |
438 | #if L2_CACHE_ENABLE | 439 | #if L2_CACHE_ENABLE |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index c6fe99e57a05..8dfa3054f10f 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -758,10 +758,10 @@ config HOTPLUG_CPU | |||
758 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | 758 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" |
759 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER | 759 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER |
760 | ---help--- | 760 | ---help--- |
761 | Say Y here to experiment with turning CPUs off and on. CPUs | 761 | Say Y here to experiment with turning CPUs off and on, and to |
762 | can be controlled through /sys/devices/system/cpu. | 762 | enable suspend on SMP systems. CPUs can be controlled through |
763 | /sys/devices/system/cpu. | ||
763 | 764 | ||
764 | Say N. | ||
765 | 765 | ||
766 | endmenu | 766 | endmenu |
767 | 767 | ||
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 40e5aba3ad3d..5ccbf58ec94f 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -215,7 +215,7 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) | |||
215 | { | 215 | { |
216 | struct acpi_table_madt *madt = NULL; | 216 | struct acpi_table_madt *madt = NULL; |
217 | 217 | ||
218 | if (!phys_addr || !size) | 218 | if (!phys_addr || !size || !cpu_has_apic) |
219 | return -EINVAL; | 219 | return -EINVAL; |
220 | 220 | ||
221 | madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); | 221 | madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); |
@@ -621,9 +621,9 @@ extern u32 pmtmr_ioport; | |||
621 | 621 | ||
622 | static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) | 622 | static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) |
623 | { | 623 | { |
624 | struct fadt_descriptor_rev2 *fadt = NULL; | 624 | struct fadt_descriptor *fadt = NULL; |
625 | 625 | ||
626 | fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size); | 626 | fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size); |
627 | if (!fadt) { | 627 | if (!fadt) { |
628 | printk(KERN_WARNING PREFIX "Unable to map FADT\n"); | 628 | printk(KERN_WARNING PREFIX "Unable to map FADT\n"); |
629 | return 0; | 629 | return 0; |
@@ -754,7 +754,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) | |||
754 | return -ENODEV; | 754 | return -ENODEV; |
755 | } | 755 | } |
756 | 756 | ||
757 | if (!cpu_has_apic) | 757 | if (!cpu_has_apic) |
758 | return -ENODEV; | 758 | return -ENODEV; |
759 | 759 | ||
760 | /* | 760 | /* |
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c index 2e3b643a4dc4..1649a175a206 100644 --- a/arch/i386/kernel/acpi/earlyquirk.c +++ b/arch/i386/kernel/acpi/earlyquirk.c | |||
@@ -5,17 +5,34 @@ | |||
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
8 | #include <linux/acpi.h> | ||
9 | |||
8 | #include <asm/pci-direct.h> | 10 | #include <asm/pci-direct.h> |
9 | #include <asm/acpi.h> | 11 | #include <asm/acpi.h> |
10 | #include <asm/apic.h> | 12 | #include <asm/apic.h> |
11 | 13 | ||
14 | #ifdef CONFIG_ACPI | ||
15 | |||
16 | static int nvidia_hpet_detected __initdata; | ||
17 | |||
18 | static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) | ||
19 | { | ||
20 | nvidia_hpet_detected = 1; | ||
21 | return 0; | ||
22 | } | ||
23 | #endif | ||
24 | |||
12 | static int __init check_bridge(int vendor, int device) | 25 | static int __init check_bridge(int vendor, int device) |
13 | { | 26 | { |
14 | #ifdef CONFIG_ACPI | 27 | #ifdef CONFIG_ACPI |
15 | /* According to Nvidia all timer overrides are bogus. Just ignore | 28 | /* According to Nvidia all timer overrides are bogus unless HPET |
16 | them all. */ | 29 | is enabled. */ |
17 | if (vendor == PCI_VENDOR_ID_NVIDIA) { | 30 | if (vendor == PCI_VENDOR_ID_NVIDIA) { |
18 | acpi_skip_timer_override = 1; | 31 | nvidia_hpet_detected = 0; |
32 | acpi_table_parse(ACPI_HPET, nvidia_hpet_check); | ||
33 | if (nvidia_hpet_detected == 0) { | ||
34 | acpi_skip_timer_override = 1; | ||
35 | } | ||
19 | } | 36 | } |
20 | #endif | 37 | #endif |
21 | if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) { | 38 | if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) { |
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index 013b85df18c6..3d4b2f3d116a 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c | |||
@@ -1341,6 +1341,14 @@ int __init APIC_init_uniprocessor (void) | |||
1341 | 1341 | ||
1342 | connect_bsp_APIC(); | 1342 | connect_bsp_APIC(); |
1343 | 1343 | ||
1344 | /* | ||
1345 | * Hack: In case of kdump, after a crash, kernel might be booting | ||
1346 | * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid | ||
1347 | * might be zero if read from MP tables. Get it from LAPIC. | ||
1348 | */ | ||
1349 | #ifdef CONFIG_CRASH_DUMP | ||
1350 | boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); | ||
1351 | #endif | ||
1344 | phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid); | 1352 | phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid); |
1345 | 1353 | ||
1346 | setup_local_APIC(); | 1354 | setup_local_APIC(); |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index d77e89ac0d54..dd6b0e3386ce 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -1320,6 +1320,8 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat | |||
1320 | probe_roms(); | 1320 | probe_roms(); |
1321 | for (i = 0; i < e820.nr_map; i++) { | 1321 | for (i = 0; i < e820.nr_map; i++) { |
1322 | struct resource *res; | 1322 | struct resource *res; |
1323 | if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL) | ||
1324 | continue; | ||
1323 | res = kzalloc(sizeof(struct resource), GFP_ATOMIC); | 1325 | res = kzalloc(sizeof(struct resource), GFP_ATOMIC); |
1324 | switch (e820.map[i].type) { | 1326 | switch (e820.map[i].type) { |
1325 | case E820_RAM: res->name = "System RAM"; break; | 1327 | case E820_RAM: res->name = "System RAM"; break; |
@@ -1545,15 +1547,18 @@ void __init setup_arch(char **cmdline_p) | |||
1545 | if (efi_enabled) | 1547 | if (efi_enabled) |
1546 | efi_map_memmap(); | 1548 | efi_map_memmap(); |
1547 | 1549 | ||
1548 | #ifdef CONFIG_X86_IO_APIC | ||
1549 | check_acpi_pci(); /* Checks more than just ACPI actually */ | ||
1550 | #endif | ||
1551 | |||
1552 | #ifdef CONFIG_ACPI | 1550 | #ifdef CONFIG_ACPI |
1553 | /* | 1551 | /* |
1554 | * Parse the ACPI tables for possible boot-time SMP configuration. | 1552 | * Parse the ACPI tables for possible boot-time SMP configuration. |
1555 | */ | 1553 | */ |
1556 | acpi_boot_table_init(); | 1554 | acpi_boot_table_init(); |
1555 | #endif | ||
1556 | |||
1557 | #ifdef CONFIG_X86_IO_APIC | ||
1558 | check_acpi_pci(); /* Checks more than just ACPI actually */ | ||
1559 | #endif | ||
1560 | |||
1561 | #ifdef CONFIG_ACPI | ||
1557 | acpi_boot_init(); | 1562 | acpi_boot_init(); |
1558 | 1563 | ||
1559 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) | 1564 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) |
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S index f48bef15b4f0..af56987f69b0 100644 --- a/arch/i386/kernel/syscall_table.S +++ b/arch/i386/kernel/syscall_table.S | |||
@@ -315,3 +315,4 @@ ENTRY(sys_call_table) | |||
315 | .long sys_splice | 315 | .long sys_splice |
316 | .long sys_sync_file_range | 316 | .long sys_sync_file_range |
317 | .long sys_tee /* 315 */ | 317 | .long sys_tee /* 315 */ |
318 | .long sys_vmsplice | ||
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index 2d22f5761b1d..0e498369f35e 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -130,9 +130,8 @@ static inline int print_addr_and_symbol(unsigned long addr, char *log_lvl, | |||
130 | print_symbol("%s", addr); | 130 | print_symbol("%s", addr); |
131 | 131 | ||
132 | printed = (printed + 1) % CONFIG_STACK_BACKTRACE_COLS; | 132 | printed = (printed + 1) % CONFIG_STACK_BACKTRACE_COLS; |
133 | |||
134 | if (printed) | 133 | if (printed) |
135 | printk(" "); | 134 | printk(" "); |
136 | else | 135 | else |
137 | printk("\n"); | 136 | printk("\n"); |
138 | 137 | ||
@@ -212,7 +211,6 @@ static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp, | |||
212 | } | 211 | } |
213 | 212 | ||
214 | stack = esp; | 213 | stack = esp; |
215 | printk(log_lvl); | ||
216 | for(i = 0; i < kstack_depth_to_print; i++) { | 214 | for(i = 0; i < kstack_depth_to_print; i++) { |
217 | if (kstack_end(stack)) | 215 | if (kstack_end(stack)) |
218 | break; | 216 | break; |
diff --git a/arch/i386/mach-generic/probe.c b/arch/i386/mach-generic/probe.c index cea5b3ce4b57..d55fa7b187ab 100644 --- a/arch/i386/mach-generic/probe.c +++ b/arch/i386/mach-generic/probe.c | |||
@@ -93,9 +93,11 @@ int __init mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid | |||
93 | int i; | 93 | int i; |
94 | for (i = 0; apic_probe[i]; ++i) { | 94 | for (i = 0; apic_probe[i]; ++i) { |
95 | if (apic_probe[i]->mps_oem_check(mpc,oem,productid)) { | 95 | if (apic_probe[i]->mps_oem_check(mpc,oem,productid)) { |
96 | genapic = apic_probe[i]; | 96 | if (!cmdline_apic) { |
97 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | 97 | genapic = apic_probe[i]; |
98 | genapic->name); | 98 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", |
99 | genapic->name); | ||
100 | } | ||
99 | return 1; | 101 | return 1; |
100 | } | 102 | } |
101 | } | 103 | } |
@@ -107,9 +109,11 @@ int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | |||
107 | int i; | 109 | int i; |
108 | for (i = 0; apic_probe[i]; ++i) { | 110 | for (i = 0; apic_probe[i]; ++i) { |
109 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { | 111 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { |
110 | genapic = apic_probe[i]; | 112 | if (!cmdline_apic) { |
111 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | 113 | genapic = apic_probe[i]; |
112 | genapic->name); | 114 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", |
115 | genapic->name); | ||
116 | } | ||
113 | return 1; | 117 | return 1; |
114 | } | 118 | } |
115 | } | 119 | } |
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index ae6534ad8161..3df1371d4520 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c | |||
@@ -651,7 +651,7 @@ void __init mem_init(void) | |||
651 | * Specifically, in the case of x86, we will always add | 651 | * Specifically, in the case of x86, we will always add |
652 | * memory to the highmem for now. | 652 | * memory to the highmem for now. |
653 | */ | 653 | */ |
654 | #ifdef CONFIG_HOTPLUG_MEMORY | 654 | #ifdef CONFIG_MEMORY_HOTPLUG |
655 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 655 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
656 | int add_memory(u64 start, u64 size) | 656 | int add_memory(u64 start, u64 size) |
657 | { | 657 | { |
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c index 1a2076ce6f6a..ec0fd3cfa774 100644 --- a/arch/i386/oprofile/nmi_int.c +++ b/arch/i386/oprofile/nmi_int.c | |||
@@ -332,10 +332,11 @@ static int __init ppro_init(char ** cpu_type) | |||
332 | { | 332 | { |
333 | __u8 cpu_model = boot_cpu_data.x86_model; | 333 | __u8 cpu_model = boot_cpu_data.x86_model; |
334 | 334 | ||
335 | if (cpu_model > 0xd) | 335 | if (cpu_model == 14) |
336 | *cpu_type = "i386/core"; | ||
337 | else if (cpu_model > 0xd) | ||
336 | return 0; | 338 | return 0; |
337 | 339 | else if (cpu_model == 9) { | |
338 | if (cpu_model == 9) { | ||
339 | *cpu_type = "i386/p6_mobile"; | 340 | *cpu_type = "i386/p6_mobile"; |
340 | } else if (cpu_model > 5) { | 341 | } else if (cpu_model > 5) { |
341 | *cpu_type = "i386/piii"; | 342 | *cpu_type = "i386/piii"; |
diff --git a/arch/i386/power/cpu.c b/arch/i386/power/cpu.c index 50a0bef8c85f..79b2370c7fac 100644 --- a/arch/i386/power/cpu.c +++ b/arch/i386/power/cpu.c | |||
@@ -92,7 +92,7 @@ void __restore_processor_state(struct saved_context *ctxt) | |||
92 | write_cr4(ctxt->cr4); | 92 | write_cr4(ctxt->cr4); |
93 | write_cr3(ctxt->cr3); | 93 | write_cr3(ctxt->cr3); |
94 | write_cr2(ctxt->cr2); | 94 | write_cr2(ctxt->cr2); |
95 | write_cr2(ctxt->cr0); | 95 | write_cr0(ctxt->cr0); |
96 | 96 | ||
97 | /* | 97 | /* |
98 | * now restore the descriptor tables to their proper values | 98 | * now restore the descriptor tables to their proper values |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 0f3076a820c3..f0252eda12a8 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -77,6 +77,7 @@ choice | |||
77 | config IA64_GENERIC | 77 | config IA64_GENERIC |
78 | bool "generic" | 78 | bool "generic" |
79 | select ACPI | 79 | select ACPI |
80 | select PCI | ||
80 | select NUMA | 81 | select NUMA |
81 | select ACPI_NUMA | 82 | select ACPI_NUMA |
82 | help | 83 | help |
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index f6a8853cd1b4..9ea35398e10d 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig | |||
@@ -134,7 +134,7 @@ CONFIG_ARCH_FLATMEM_ENABLE=y | |||
134 | CONFIG_ARCH_SPARSEMEM_ENABLE=y | 134 | CONFIG_ARCH_SPARSEMEM_ENABLE=y |
135 | CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y | 135 | CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y |
136 | CONFIG_NUMA=y | 136 | CONFIG_NUMA=y |
137 | CONFIG_NODES_SHIFT=8 | 137 | CONFIG_NODES_SHIFT=10 |
138 | CONFIG_VIRTUAL_MEM_MAP=y | 138 | CONFIG_VIRTUAL_MEM_MAP=y |
139 | CONFIG_HOLES_IN_ZONE=y | 139 | CONFIG_HOLES_IN_ZONE=y |
140 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y | 140 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y |
@@ -1159,7 +1159,7 @@ CONFIG_DETECT_SOFTLOCKUP=y | |||
1159 | # CONFIG_SCHEDSTATS is not set | 1159 | # CONFIG_SCHEDSTATS is not set |
1160 | # CONFIG_DEBUG_SLAB is not set | 1160 | # CONFIG_DEBUG_SLAB is not set |
1161 | CONFIG_DEBUG_PREEMPT=y | 1161 | CONFIG_DEBUG_PREEMPT=y |
1162 | CONFIG_DEBUG_MUTEXES=y | 1162 | # CONFIG_DEBUG_MUTEXES is not set |
1163 | # CONFIG_DEBUG_SPINLOCK is not set | 1163 | # CONFIG_DEBUG_SPINLOCK is not set |
1164 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1164 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1165 | # CONFIG_DEBUG_KOBJECT is not set | 1165 | # CONFIG_DEBUG_KOBJECT is not set |
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index bdccd0b1eb60..dd4a2f792632 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -1999,7 +1999,7 @@ acpi_sba_ioc_add(struct acpi_device *device) | |||
1999 | if (!iovp_shift) | 1999 | if (!iovp_shift) |
2000 | iovp_shift = min(PAGE_SHIFT, 16); | 2000 | iovp_shift = min(PAGE_SHIFT, 16); |
2001 | } | 2001 | } |
2002 | ACPI_MEM_FREE(dev_info); | 2002 | kfree(dev_info); |
2003 | 2003 | ||
2004 | /* | 2004 | /* |
2005 | * default anything not caught above or specified on cmdline to 4k | 2005 | * default anything not caught above or specified on cmdline to 4k |
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index 7956eb9058fc..d58c1c5c903a 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c | |||
@@ -416,7 +416,7 @@ iosapic_end_level_irq (unsigned int irq) | |||
416 | ia64_vector vec = irq_to_vector(irq); | 416 | ia64_vector vec = irq_to_vector(irq); |
417 | struct iosapic_rte_info *rte; | 417 | struct iosapic_rte_info *rte; |
418 | 418 | ||
419 | move_irq(irq); | 419 | move_native_irq(irq); |
420 | list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list) | 420 | list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list) |
421 | iosapic_eoi(rte->addr, vec); | 421 | iosapic_eoi(rte->addr, vec); |
422 | } | 422 | } |
@@ -458,7 +458,7 @@ iosapic_ack_edge_irq (unsigned int irq) | |||
458 | { | 458 | { |
459 | irq_desc_t *idesc = irq_descp(irq); | 459 | irq_desc_t *idesc = irq_descp(irq); |
460 | 460 | ||
461 | move_irq(irq); | 461 | move_native_irq(irq); |
462 | /* | 462 | /* |
463 | * Once we have recorded IRQ_PENDING already, we can mask the | 463 | * Once we have recorded IRQ_PENDING already, we can mask the |
464 | * interrupt for real. This prevents IRQ storms from unhandled | 464 | * interrupt for real. This prevents IRQ storms from unhandled |
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c index 5ce908ef9c95..9c72ea3f6432 100644 --- a/arch/ia64/kernel/irq.c +++ b/arch/ia64/kernel/irq.c | |||
@@ -101,7 +101,6 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir) | |||
101 | 101 | ||
102 | if (irq < NR_IRQS) { | 102 | if (irq < NR_IRQS) { |
103 | irq_affinity[irq] = mask; | 103 | irq_affinity[irq] = mask; |
104 | set_irq_info(irq, mask); | ||
105 | irq_redir[irq] = (char) (redir & 0xff); | 104 | irq_redir[irq] = (char) (redir & 0xff); |
106 | } | 105 | } |
107 | } | 106 | } |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ee5fbb02b28f..e8ff09fe73d9 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -13,7 +13,7 @@ choice | |||
13 | default SGI_IP22 | 13 | default SGI_IP22 |
14 | 14 | ||
15 | config MIPS_MTX1 | 15 | config MIPS_MTX1 |
16 | bool "Support for 4G Systems MTX-1 board" | 16 | bool "4G Systems MTX-1 board" |
17 | select DMA_NONCOHERENT | 17 | select DMA_NONCOHERENT |
18 | select HW_HAS_PCI | 18 | select HW_HAS_PCI |
19 | select SOC_AU1500 | 19 | select SOC_AU1500 |
@@ -120,7 +120,7 @@ config MIPS_MIRAGE | |||
120 | select SYS_SUPPORTS_LITTLE_ENDIAN | 120 | select SYS_SUPPORTS_LITTLE_ENDIAN |
121 | 121 | ||
122 | config MIPS_COBALT | 122 | config MIPS_COBALT |
123 | bool "Support for Cobalt Server" | 123 | bool "Cobalt Server" |
124 | select DMA_NONCOHERENT | 124 | select DMA_NONCOHERENT |
125 | select HW_HAS_PCI | 125 | select HW_HAS_PCI |
126 | select I8259 | 126 | select I8259 |
@@ -132,7 +132,7 @@ config MIPS_COBALT | |||
132 | select SYS_SUPPORTS_LITTLE_ENDIAN | 132 | select SYS_SUPPORTS_LITTLE_ENDIAN |
133 | 133 | ||
134 | config MACH_DECSTATION | 134 | config MACH_DECSTATION |
135 | bool "Support for DECstations" | 135 | bool "DECstations" |
136 | select BOOT_ELF32 | 136 | select BOOT_ELF32 |
137 | select DMA_NONCOHERENT | 137 | select DMA_NONCOHERENT |
138 | select EARLY_PRINTK | 138 | select EARLY_PRINTK |
@@ -158,7 +158,7 @@ config MACH_DECSTATION | |||
158 | otherwise choose R3000. | 158 | otherwise choose R3000. |
159 | 159 | ||
160 | config MIPS_EV64120 | 160 | config MIPS_EV64120 |
161 | bool "Support for Galileo EV64120 Evaluation board (EXPERIMENTAL)" | 161 | bool "Galileo EV64120 Evaluation board (EXPERIMENTAL)" |
162 | depends on EXPERIMENTAL | 162 | depends on EXPERIMENTAL |
163 | select DMA_NONCOHERENT | 163 | select DMA_NONCOHERENT |
164 | select HW_HAS_PCI | 164 | select HW_HAS_PCI |
@@ -175,7 +175,7 @@ config MIPS_EV64120 | |||
175 | kernel for this platform. | 175 | kernel for this platform. |
176 | 176 | ||
177 | config MIPS_EV96100 | 177 | config MIPS_EV96100 |
178 | bool "Support for Galileo EV96100 Evaluation board (EXPERIMENTAL)" | 178 | bool "Galileo EV96100 Evaluation board (EXPERIMENTAL)" |
179 | depends on EXPERIMENTAL | 179 | depends on EXPERIMENTAL |
180 | select DMA_NONCOHERENT | 180 | select DMA_NONCOHERENT |
181 | select HW_HAS_PCI | 181 | select HW_HAS_PCI |
@@ -195,7 +195,7 @@ config MIPS_EV96100 | |||
195 | here if you wish to build a kernel for this platform. | 195 | here if you wish to build a kernel for this platform. |
196 | 196 | ||
197 | config MIPS_IVR | 197 | config MIPS_IVR |
198 | bool "Support for Globespan IVR board" | 198 | bool "Globespan IVR board" |
199 | select DMA_NONCOHERENT | 199 | select DMA_NONCOHERENT |
200 | select HW_HAS_PCI | 200 | select HW_HAS_PCI |
201 | select ITE_BOARD_GEN | 201 | select ITE_BOARD_GEN |
@@ -211,7 +211,7 @@ config MIPS_IVR | |||
211 | build a kernel for this platform. | 211 | build a kernel for this platform. |
212 | 212 | ||
213 | config MIPS_ITE8172 | 213 | config MIPS_ITE8172 |
214 | bool "Support for ITE 8172G board" | 214 | bool "ITE 8172G board" |
215 | select DMA_NONCOHERENT | 215 | select DMA_NONCOHERENT |
216 | select HW_HAS_PCI | 216 | select HW_HAS_PCI |
217 | select ITE_BOARD_GEN | 217 | select ITE_BOARD_GEN |
@@ -228,7 +228,7 @@ config MIPS_ITE8172 | |||
228 | a kernel for this platform. | 228 | a kernel for this platform. |
229 | 229 | ||
230 | config MACH_JAZZ | 230 | config MACH_JAZZ |
231 | bool "Support for the Jazz family of machines" | 231 | bool "Jazz family of machines" |
232 | select ARC | 232 | select ARC |
233 | select ARC32 | 233 | select ARC32 |
234 | select ARCH_MAY_HAVE_PC_FDC | 234 | select ARCH_MAY_HAVE_PC_FDC |
@@ -246,7 +246,7 @@ config MACH_JAZZ | |||
246 | Olivetti M700-10 workstations. | 246 | Olivetti M700-10 workstations. |
247 | 247 | ||
248 | config LASAT | 248 | config LASAT |
249 | bool "Support for LASAT Networks platforms" | 249 | bool "LASAT Networks platforms" |
250 | select DMA_NONCOHERENT | 250 | select DMA_NONCOHERENT |
251 | select HW_HAS_PCI | 251 | select HW_HAS_PCI |
252 | select MIPS_GT64120 | 252 | select MIPS_GT64120 |
@@ -258,7 +258,7 @@ config LASAT | |||
258 | select SYS_SUPPORTS_LITTLE_ENDIAN | 258 | select SYS_SUPPORTS_LITTLE_ENDIAN |
259 | 259 | ||
260 | config MIPS_ATLAS | 260 | config MIPS_ATLAS |
261 | bool "Support for MIPS Atlas board" | 261 | bool "MIPS Atlas board" |
262 | select BOOT_ELF32 | 262 | select BOOT_ELF32 |
263 | select DMA_NONCOHERENT | 263 | select DMA_NONCOHERENT |
264 | select IRQ_CPU | 264 | select IRQ_CPU |
@@ -283,7 +283,7 @@ config MIPS_ATLAS | |||
283 | board. | 283 | board. |
284 | 284 | ||
285 | config MIPS_MALTA | 285 | config MIPS_MALTA |
286 | bool "Support for MIPS Malta board" | 286 | bool "MIPS Malta board" |
287 | select ARCH_MAY_HAVE_PC_FDC | 287 | select ARCH_MAY_HAVE_PC_FDC |
288 | select BOOT_ELF32 | 288 | select BOOT_ELF32 |
289 | select HAVE_STD_PC_SERIAL_PORT | 289 | select HAVE_STD_PC_SERIAL_PORT |
@@ -311,7 +311,7 @@ config MIPS_MALTA | |||
311 | board. | 311 | board. |
312 | 312 | ||
313 | config MIPS_SEAD | 313 | config MIPS_SEAD |
314 | bool "Support for MIPS SEAD board (EXPERIMENTAL)" | 314 | bool "MIPS SEAD board (EXPERIMENTAL)" |
315 | depends on EXPERIMENTAL | 315 | depends on EXPERIMENTAL |
316 | select IRQ_CPU | 316 | select IRQ_CPU |
317 | select DMA_NONCOHERENT | 317 | select DMA_NONCOHERENT |
@@ -328,7 +328,7 @@ config MIPS_SEAD | |||
328 | board. | 328 | board. |
329 | 329 | ||
330 | config MIPS_SIM | 330 | config MIPS_SIM |
331 | bool 'Support for MIPS simulator (MIPSsim)' | 331 | bool 'MIPS simulator (MIPSsim)' |
332 | select DMA_NONCOHERENT | 332 | select DMA_NONCOHERENT |
333 | select IRQ_CPU | 333 | select IRQ_CPU |
334 | select SYS_HAS_CPU_MIPS32_R1 | 334 | select SYS_HAS_CPU_MIPS32_R1 |
@@ -341,7 +341,7 @@ config MIPS_SIM | |||
341 | emulator. | 341 | emulator. |
342 | 342 | ||
343 | config MOMENCO_JAGUAR_ATX | 343 | config MOMENCO_JAGUAR_ATX |
344 | bool "Support for Momentum Jaguar board" | 344 | bool "Momentum Jaguar board" |
345 | select BOOT_ELF32 | 345 | select BOOT_ELF32 |
346 | select DMA_NONCOHERENT | 346 | select DMA_NONCOHERENT |
347 | select HW_HAS_PCI | 347 | select HW_HAS_PCI |
@@ -361,7 +361,7 @@ config MOMENCO_JAGUAR_ATX | |||
361 | Momentum Computer <http://www.momenco.com/>. | 361 | Momentum Computer <http://www.momenco.com/>. |
362 | 362 | ||
363 | config MOMENCO_OCELOT | 363 | config MOMENCO_OCELOT |
364 | bool "Support for Momentum Ocelot board" | 364 | bool "Momentum Ocelot board" |
365 | select DMA_NONCOHERENT | 365 | select DMA_NONCOHERENT |
366 | select HW_HAS_PCI | 366 | select HW_HAS_PCI |
367 | select IRQ_CPU | 367 | select IRQ_CPU |
@@ -378,7 +378,7 @@ config MOMENCO_OCELOT | |||
378 | Momentum Computer <http://www.momenco.com/>. | 378 | Momentum Computer <http://www.momenco.com/>. |
379 | 379 | ||
380 | config MOMENCO_OCELOT_3 | 380 | config MOMENCO_OCELOT_3 |
381 | bool "Support for Momentum Ocelot-3 board" | 381 | bool "Momentum Ocelot-3 board" |
382 | select BOOT_ELF32 | 382 | select BOOT_ELF32 |
383 | select DMA_NONCOHERENT | 383 | select DMA_NONCOHERENT |
384 | select HW_HAS_PCI | 384 | select HW_HAS_PCI |
@@ -397,7 +397,7 @@ config MOMENCO_OCELOT_3 | |||
397 | PMC-Sierra Rm79000 core. | 397 | PMC-Sierra Rm79000 core. |
398 | 398 | ||
399 | config MOMENCO_OCELOT_C | 399 | config MOMENCO_OCELOT_C |
400 | bool "Support for Momentum Ocelot-C board" | 400 | bool "Momentum Ocelot-C board" |
401 | select DMA_NONCOHERENT | 401 | select DMA_NONCOHERENT |
402 | select HW_HAS_PCI | 402 | select HW_HAS_PCI |
403 | select IRQ_CPU | 403 | select IRQ_CPU |
@@ -414,7 +414,7 @@ config MOMENCO_OCELOT_C | |||
414 | Momentum Computer <http://www.momenco.com/>. | 414 | Momentum Computer <http://www.momenco.com/>. |
415 | 415 | ||
416 | config MOMENCO_OCELOT_G | 416 | config MOMENCO_OCELOT_G |
417 | bool "Support for Momentum Ocelot-G board" | 417 | bool "Momentum Ocelot-G board" |
418 | select DMA_NONCOHERENT | 418 | select DMA_NONCOHERENT |
419 | select HW_HAS_PCI | 419 | select HW_HAS_PCI |
420 | select IRQ_CPU | 420 | select IRQ_CPU |
@@ -431,23 +431,23 @@ config MOMENCO_OCELOT_G | |||
431 | Momentum Computer <http://www.momenco.com/>. | 431 | Momentum Computer <http://www.momenco.com/>. |
432 | 432 | ||
433 | config MIPS_XXS1500 | 433 | config MIPS_XXS1500 |
434 | bool "Support for MyCable XXS1500 board" | 434 | bool "MyCable XXS1500 board" |
435 | select DMA_NONCOHERENT | 435 | select DMA_NONCOHERENT |
436 | select SOC_AU1500 | 436 | select SOC_AU1500 |
437 | select SYS_SUPPORTS_LITTLE_ENDIAN | 437 | select SYS_SUPPORTS_LITTLE_ENDIAN |
438 | 438 | ||
439 | config PNX8550_V2PCI | 439 | config PNX8550_V2PCI |
440 | bool "Support for Philips PNX8550 based Viper2-PCI board" | 440 | bool "Philips PNX8550 based Viper2-PCI board" |
441 | select PNX8550 | 441 | select PNX8550 |
442 | select SYS_SUPPORTS_LITTLE_ENDIAN | 442 | select SYS_SUPPORTS_LITTLE_ENDIAN |
443 | 443 | ||
444 | config PNX8550_JBS | 444 | config PNX8550_JBS |
445 | bool "Support for Philips PNX8550 based JBS board" | 445 | bool "Philips PNX8550 based JBS board" |
446 | select PNX8550 | 446 | select PNX8550 |
447 | select SYS_SUPPORTS_LITTLE_ENDIAN | 447 | select SYS_SUPPORTS_LITTLE_ENDIAN |
448 | 448 | ||
449 | config DDB5074 | 449 | config DDB5074 |
450 | bool "Support for NEC DDB Vrc-5074 (EXPERIMENTAL)" | 450 | bool "NEC DDB Vrc-5074 (EXPERIMENTAL)" |
451 | depends on EXPERIMENTAL | 451 | depends on EXPERIMENTAL |
452 | select DDB5XXX_COMMON | 452 | select DDB5XXX_COMMON |
453 | select DMA_NONCOHERENT | 453 | select DMA_NONCOHERENT |
@@ -465,7 +465,7 @@ config DDB5074 | |||
465 | evaluation board. | 465 | evaluation board. |
466 | 466 | ||
467 | config DDB5476 | 467 | config DDB5476 |
468 | bool "Support for NEC DDB Vrc-5476" | 468 | bool "NEC DDB Vrc-5476" |
469 | select DDB5XXX_COMMON | 469 | select DDB5XXX_COMMON |
470 | select DMA_NONCOHERENT | 470 | select DMA_NONCOHERENT |
471 | select HAVE_STD_PC_SERIAL_PORT | 471 | select HAVE_STD_PC_SERIAL_PORT |
@@ -486,7 +486,7 @@ config DDB5476 | |||
486 | IDE controller, PS2 keyboard, PS2 mouse, etc. | 486 | IDE controller, PS2 keyboard, PS2 mouse, etc. |
487 | 487 | ||
488 | config DDB5477 | 488 | config DDB5477 |
489 | bool "Support for NEC DDB Vrc-5477" | 489 | bool "NEC DDB Vrc-5477" |
490 | select DDB5XXX_COMMON | 490 | select DDB5XXX_COMMON |
491 | select DMA_NONCOHERENT | 491 | select DMA_NONCOHERENT |
492 | select HW_HAS_PCI | 492 | select HW_HAS_PCI |
@@ -504,13 +504,13 @@ config DDB5477 | |||
504 | ether port USB, AC97, PCI, etc. | 504 | ether port USB, AC97, PCI, etc. |
505 | 505 | ||
506 | config MACH_VR41XX | 506 | config MACH_VR41XX |
507 | bool "Support for NEC VR4100 series based machines" | 507 | bool "NEC VR41XX-based machines" |
508 | select SYS_HAS_CPU_VR41XX | 508 | select SYS_HAS_CPU_VR41XX |
509 | select SYS_SUPPORTS_32BIT_KERNEL | 509 | select SYS_SUPPORTS_32BIT_KERNEL |
510 | select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL | 510 | select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL |
511 | 511 | ||
512 | config PMC_YOSEMITE | 512 | config PMC_YOSEMITE |
513 | bool "Support for PMC-Sierra Yosemite eval board" | 513 | bool "PMC-Sierra Yosemite eval board" |
514 | select DMA_COHERENT | 514 | select DMA_COHERENT |
515 | select HW_HAS_PCI | 515 | select HW_HAS_PCI |
516 | select IRQ_CPU | 516 | select IRQ_CPU |
@@ -527,7 +527,7 @@ config PMC_YOSEMITE | |||
527 | manufactured by PMC-Sierra. | 527 | manufactured by PMC-Sierra. |
528 | 528 | ||
529 | config QEMU | 529 | config QEMU |
530 | bool "Support for Qemu" | 530 | bool "Qemu" |
531 | select DMA_COHERENT | 531 | select DMA_COHERENT |
532 | select GENERIC_ISA_DMA | 532 | select GENERIC_ISA_DMA |
533 | select HAVE_STD_PC_SERIAL_PORT | 533 | select HAVE_STD_PC_SERIAL_PORT |
@@ -547,7 +547,7 @@ config QEMU | |||
547 | can be found at http://www.linux-mips.org/wiki/Qemu. | 547 | can be found at http://www.linux-mips.org/wiki/Qemu. |
548 | 548 | ||
549 | config SGI_IP22 | 549 | config SGI_IP22 |
550 | bool "Support for SGI IP22 (Indy/Indigo2)" | 550 | bool "SGI IP22 (Indy/Indigo2)" |
551 | select ARC | 551 | select ARC |
552 | select ARC32 | 552 | select ARC32 |
553 | select BOOT_ELF32 | 553 | select BOOT_ELF32 |
@@ -567,7 +567,7 @@ config SGI_IP22 | |||
567 | that runs on these, say Y here. | 567 | that runs on these, say Y here. |
568 | 568 | ||
569 | config SGI_IP27 | 569 | config SGI_IP27 |
570 | bool "Support for SGI IP27 (Origin200/2000)" | 570 | bool "SGI IP27 (Origin200/2000)" |
571 | select ARC | 571 | select ARC |
572 | select ARC64 | 572 | select ARC64 |
573 | select BOOT_ELF64 | 573 | select BOOT_ELF64 |
@@ -583,7 +583,7 @@ config SGI_IP27 | |||
583 | here. | 583 | here. |
584 | 584 | ||
585 | config SGI_IP32 | 585 | config SGI_IP32 |
586 | bool "Support for SGI IP32 (O2) (EXPERIMENTAL)" | 586 | bool "SGI IP32 (O2) (EXPERIMENTAL)" |
587 | depends on EXPERIMENTAL | 587 | depends on EXPERIMENTAL |
588 | select ARC | 588 | select ARC |
589 | select ARC32 | 589 | select ARC32 |
@@ -604,7 +604,7 @@ config SGI_IP32 | |||
604 | If you want this kernel to run on SGI O2 workstation, say Y here. | 604 | If you want this kernel to run on SGI O2 workstation, say Y here. |
605 | 605 | ||
606 | config SIBYTE_BIGSUR | 606 | config SIBYTE_BIGSUR |
607 | bool "Support for Sibyte BCM91480B-BigSur" | 607 | bool "Sibyte BCM91480B-BigSur" |
608 | select BOOT_ELF32 | 608 | select BOOT_ELF32 |
609 | select DMA_COHERENT | 609 | select DMA_COHERENT |
610 | select PCI_DOMAINS | 610 | select PCI_DOMAINS |
@@ -615,7 +615,7 @@ config SIBYTE_BIGSUR | |||
615 | select SYS_SUPPORTS_LITTLE_ENDIAN | 615 | select SYS_SUPPORTS_LITTLE_ENDIAN |
616 | 616 | ||
617 | config SIBYTE_SWARM | 617 | config SIBYTE_SWARM |
618 | bool "Support for Sibyte BCM91250A-SWARM" | 618 | bool "Sibyte BCM91250A-SWARM" |
619 | select BOOT_ELF32 | 619 | select BOOT_ELF32 |
620 | select DMA_COHERENT | 620 | select DMA_COHERENT |
621 | select SIBYTE_SB1250 | 621 | select SIBYTE_SB1250 |
@@ -626,7 +626,7 @@ config SIBYTE_SWARM | |||
626 | select SYS_SUPPORTS_LITTLE_ENDIAN | 626 | select SYS_SUPPORTS_LITTLE_ENDIAN |
627 | 627 | ||
628 | config SIBYTE_SENTOSA | 628 | config SIBYTE_SENTOSA |
629 | bool "Support for Sibyte BCM91250E-Sentosa" | 629 | bool "Sibyte BCM91250E-Sentosa" |
630 | depends on EXPERIMENTAL | 630 | depends on EXPERIMENTAL |
631 | select BOOT_ELF32 | 631 | select BOOT_ELF32 |
632 | select DMA_COHERENT | 632 | select DMA_COHERENT |
@@ -637,7 +637,7 @@ config SIBYTE_SENTOSA | |||
637 | select SYS_SUPPORTS_LITTLE_ENDIAN | 637 | select SYS_SUPPORTS_LITTLE_ENDIAN |
638 | 638 | ||
639 | config SIBYTE_RHONE | 639 | config SIBYTE_RHONE |
640 | bool "Support for Sibyte BCM91125E-Rhone" | 640 | bool "Sibyte BCM91125E-Rhone" |
641 | depends on EXPERIMENTAL | 641 | depends on EXPERIMENTAL |
642 | select BOOT_ELF32 | 642 | select BOOT_ELF32 |
643 | select DMA_COHERENT | 643 | select DMA_COHERENT |
@@ -648,7 +648,7 @@ config SIBYTE_RHONE | |||
648 | select SYS_SUPPORTS_LITTLE_ENDIAN | 648 | select SYS_SUPPORTS_LITTLE_ENDIAN |
649 | 649 | ||
650 | config SIBYTE_CARMEL | 650 | config SIBYTE_CARMEL |
651 | bool "Support for Sibyte BCM91120x-Carmel" | 651 | bool "Sibyte BCM91120x-Carmel" |
652 | depends on EXPERIMENTAL | 652 | depends on EXPERIMENTAL |
653 | select BOOT_ELF32 | 653 | select BOOT_ELF32 |
654 | select DMA_COHERENT | 654 | select DMA_COHERENT |
@@ -659,7 +659,7 @@ config SIBYTE_CARMEL | |||
659 | select SYS_SUPPORTS_LITTLE_ENDIAN | 659 | select SYS_SUPPORTS_LITTLE_ENDIAN |
660 | 660 | ||
661 | config SIBYTE_PTSWARM | 661 | config SIBYTE_PTSWARM |
662 | bool "Support for Sibyte BCM91250PT-PTSWARM" | 662 | bool "Sibyte BCM91250PT-PTSWARM" |
663 | depends on EXPERIMENTAL | 663 | depends on EXPERIMENTAL |
664 | select BOOT_ELF32 | 664 | select BOOT_ELF32 |
665 | select DMA_COHERENT | 665 | select DMA_COHERENT |
@@ -671,7 +671,7 @@ config SIBYTE_PTSWARM | |||
671 | select SYS_SUPPORTS_LITTLE_ENDIAN | 671 | select SYS_SUPPORTS_LITTLE_ENDIAN |
672 | 672 | ||
673 | config SIBYTE_LITTLESUR | 673 | config SIBYTE_LITTLESUR |
674 | bool "Support for Sibyte BCM91250C2-LittleSur" | 674 | bool "Sibyte BCM91250C2-LittleSur" |
675 | depends on EXPERIMENTAL | 675 | depends on EXPERIMENTAL |
676 | select BOOT_ELF32 | 676 | select BOOT_ELF32 |
677 | select DMA_COHERENT | 677 | select DMA_COHERENT |
@@ -683,7 +683,7 @@ config SIBYTE_LITTLESUR | |||
683 | select SYS_SUPPORTS_LITTLE_ENDIAN | 683 | select SYS_SUPPORTS_LITTLE_ENDIAN |
684 | 684 | ||
685 | config SIBYTE_CRHINE | 685 | config SIBYTE_CRHINE |
686 | bool "Support for Sibyte BCM91120C-CRhine" | 686 | bool "Sibyte BCM91120C-CRhine" |
687 | depends on EXPERIMENTAL | 687 | depends on EXPERIMENTAL |
688 | select BOOT_ELF32 | 688 | select BOOT_ELF32 |
689 | select DMA_COHERENT | 689 | select DMA_COHERENT |
@@ -694,7 +694,7 @@ config SIBYTE_CRHINE | |||
694 | select SYS_SUPPORTS_LITTLE_ENDIAN | 694 | select SYS_SUPPORTS_LITTLE_ENDIAN |
695 | 695 | ||
696 | config SIBYTE_CRHONE | 696 | config SIBYTE_CRHONE |
697 | bool "Support for Sibyte BCM91125C-CRhone" | 697 | bool "Sibyte BCM91125C-CRhone" |
698 | depends on EXPERIMENTAL | 698 | depends on EXPERIMENTAL |
699 | select BOOT_ELF32 | 699 | select BOOT_ELF32 |
700 | select DMA_COHERENT | 700 | select DMA_COHERENT |
@@ -706,7 +706,7 @@ config SIBYTE_CRHONE | |||
706 | select SYS_SUPPORTS_LITTLE_ENDIAN | 706 | select SYS_SUPPORTS_LITTLE_ENDIAN |
707 | 707 | ||
708 | config SNI_RM200_PCI | 708 | config SNI_RM200_PCI |
709 | bool "Support for SNI RM200 PCI" | 709 | bool "SNI RM200 PCI" |
710 | select ARC | 710 | select ARC |
711 | select ARC32 | 711 | select ARC32 |
712 | select ARCH_MAY_HAVE_PC_FDC | 712 | select ARCH_MAY_HAVE_PC_FDC |
@@ -732,7 +732,7 @@ config SNI_RM200_PCI | |||
732 | support this machine type. | 732 | support this machine type. |
733 | 733 | ||
734 | config TOSHIBA_JMR3927 | 734 | config TOSHIBA_JMR3927 |
735 | bool "Support for Toshiba JMR-TX3927 board" | 735 | bool "Toshiba JMR-TX3927 board" |
736 | select DMA_NONCOHERENT | 736 | select DMA_NONCOHERENT |
737 | select HW_HAS_PCI | 737 | select HW_HAS_PCI |
738 | select MIPS_TX3927 | 738 | select MIPS_TX3927 |
@@ -743,7 +743,7 @@ config TOSHIBA_JMR3927 | |||
743 | select TOSHIBA_BOARDS | 743 | select TOSHIBA_BOARDS |
744 | 744 | ||
745 | config TOSHIBA_RBTX4927 | 745 | config TOSHIBA_RBTX4927 |
746 | bool "Support for Toshiba TBTX49[23]7 board" | 746 | bool "Toshiba TBTX49[23]7 board" |
747 | select DMA_NONCOHERENT | 747 | select DMA_NONCOHERENT |
748 | select HAS_TXX9_SERIAL | 748 | select HAS_TXX9_SERIAL |
749 | select HW_HAS_PCI | 749 | select HW_HAS_PCI |
@@ -760,7 +760,7 @@ config TOSHIBA_RBTX4927 | |||
760 | support this machine type | 760 | support this machine type |
761 | 761 | ||
762 | config TOSHIBA_RBTX4938 | 762 | config TOSHIBA_RBTX4938 |
763 | bool "Support for Toshiba RBTX4938 board" | 763 | bool "Toshiba RBTX4938 board" |
764 | select HAVE_STD_PC_SERIAL_PORT | 764 | select HAVE_STD_PC_SERIAL_PORT |
765 | select DMA_NONCOHERENT | 765 | select DMA_NONCOHERENT |
766 | select GENERIC_ISA_DMA | 766 | select GENERIC_ISA_DMA |
@@ -1411,13 +1411,12 @@ config PAGE_SIZE_8KB | |||
1411 | 1411 | ||
1412 | config PAGE_SIZE_16KB | 1412 | config PAGE_SIZE_16KB |
1413 | bool "16kB" | 1413 | bool "16kB" |
1414 | depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX | 1414 | depends on !CPU_R3000 && !CPU_TX39XX |
1415 | help | 1415 | help |
1416 | Using 16kB page size will result in higher performance kernel at | 1416 | Using 16kB page size will result in higher performance kernel at |
1417 | the price of higher memory consumption. This option is available on | 1417 | the price of higher memory consumption. This option is available on |
1418 | all non-R3000 family processor. Not that at the time of this | 1418 | all non-R3000 family processors. Note that you will need a suitable |
1419 | writing this option is still high experimental; there are also | 1419 | Linux distribution to support this. |
1420 | issues with compatibility of user applications. | ||
1421 | 1420 | ||
1422 | config PAGE_SIZE_64KB | 1421 | config PAGE_SIZE_64KB |
1423 | bool "64kB" | 1422 | bool "64kB" |
@@ -1426,8 +1425,7 @@ config PAGE_SIZE_64KB | |||
1426 | Using 64kB page size will result in higher performance kernel at | 1425 | Using 64kB page size will result in higher performance kernel at |
1427 | the price of higher memory consumption. This option is available on | 1426 | the price of higher memory consumption. This option is available on |
1428 | all non-R3000 family processor. Not that at the time of this | 1427 | all non-R3000 family processor. Not that at the time of this |
1429 | writing this option is still high experimental; there are also | 1428 | writing this option is still high experimental. |
1430 | issues with compatibility of user applications. | ||
1431 | 1429 | ||
1432 | endchoice | 1430 | endchoice |
1433 | 1431 | ||
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c index da61de776154..afe05ec12c27 100644 --- a/arch/mips/au1000/common/irq.c +++ b/arch/mips/au1000/common/irq.c | |||
@@ -68,6 +68,7 @@ | |||
68 | 68 | ||
69 | extern void set_debug_traps(void); | 69 | extern void set_debug_traps(void); |
70 | extern irq_cpustat_t irq_stat [NR_CPUS]; | 70 | extern irq_cpustat_t irq_stat [NR_CPUS]; |
71 | extern void mips_timer_interrupt(struct pt_regs *regs); | ||
71 | 72 | ||
72 | static void setup_local_irq(unsigned int irq, int type, int int_req); | 73 | static void setup_local_irq(unsigned int irq, int type, int int_req); |
73 | static unsigned int startup_irq(unsigned int irq); | 74 | static unsigned int startup_irq(unsigned int irq); |
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c index 9c171afd9a53..ae7d8c57bf3f 100644 --- a/arch/mips/au1000/common/prom.c +++ b/arch/mips/au1000/common/prom.c | |||
@@ -1,10 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * BRIEF MODULE DESCRIPTION | 3 | * BRIEF MODULE DESCRIPTION |
4 | * PROM library initialisation code, assuming a version of | 4 | * PROM library initialisation code, assuming YAMON is the boot loader. |
5 | * pmon is the boot code. | ||
6 | * | 5 | * |
7 | * Copyright 2000,2001 MontaVista Software Inc. | 6 | * Copyright 2000, 2001, 2006 MontaVista Software Inc. |
8 | * Author: MontaVista Software, Inc. | 7 | * Author: MontaVista Software, Inc. |
9 | * ppopov@mvista.com or source@mvista.com | 8 | * ppopov@mvista.com or source@mvista.com |
10 | * | 9 | * |
@@ -49,9 +48,9 @@ extern char **prom_argv, **prom_envp; | |||
49 | 48 | ||
50 | typedef struct | 49 | typedef struct |
51 | { | 50 | { |
52 | char *name; | 51 | char *name; |
53 | /* char *val; */ | 52 | char *val; |
54 | }t_env_var; | 53 | } t_env_var; |
55 | 54 | ||
56 | 55 | ||
57 | char * prom_getcmdline(void) | 56 | char * prom_getcmdline(void) |
@@ -85,21 +84,16 @@ char *prom_getenv(char *envname) | |||
85 | { | 84 | { |
86 | /* | 85 | /* |
87 | * Return a pointer to the given environment variable. | 86 | * Return a pointer to the given environment variable. |
88 | * Environment variables are stored in the form of "memsize=64". | ||
89 | */ | 87 | */ |
90 | 88 | ||
91 | t_env_var *env = (t_env_var *)prom_envp; | 89 | t_env_var *env = (t_env_var *)prom_envp; |
92 | int i; | ||
93 | |||
94 | i = strlen(envname); | ||
95 | 90 | ||
96 | while(env->name) { | 91 | while (env->name) { |
97 | if(strncmp(envname, env->name, i) == 0) { | 92 | if (strcmp(envname, env->name) == 0) |
98 | return(env->name + strlen(envname) + 1); | 93 | return env->val; |
99 | } | ||
100 | env++; | 94 | env++; |
101 | } | 95 | } |
102 | return(NULL); | 96 | return NULL; |
103 | } | 97 | } |
104 | 98 | ||
105 | inline unsigned char str2hexnum(unsigned char c) | 99 | inline unsigned char str2hexnum(unsigned char c) |
diff --git a/arch/mips/au1000/common/sleeper.S b/arch/mips/au1000/common/sleeper.S index 44dac3b0df3b..683d9da84b66 100644 --- a/arch/mips/au1000/common/sleeper.S +++ b/arch/mips/au1000/common/sleeper.S | |||
@@ -112,6 +112,11 @@ sdsleep: | |||
112 | mtc0 k0, CP0_PAGEMASK | 112 | mtc0 k0, CP0_PAGEMASK |
113 | lw k0, 0x14(sp) | 113 | lw k0, 0x14(sp) |
114 | mtc0 k0, CP0_CONFIG | 114 | mtc0 k0, CP0_CONFIG |
115 | |||
116 | /* We need to catch the ealry Alchemy SOCs with | ||
117 | * the write-only Config[OD] bit and set it back to one... | ||
118 | */ | ||
119 | jal au1x00_fixup_config_od | ||
115 | lw $1, PT_R1(sp) | 120 | lw $1, PT_R1(sp) |
116 | lw $2, PT_R2(sp) | 121 | lw $2, PT_R2(sp) |
117 | lw $3, PT_R3(sp) | 122 | lw $3, PT_R3(sp) |
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c index f85f1524b366..f74d66a58a21 100644 --- a/arch/mips/au1000/common/time.c +++ b/arch/mips/au1000/common/time.c | |||
@@ -116,6 +116,7 @@ void mips_timer_interrupt(struct pt_regs *regs) | |||
116 | 116 | ||
117 | null: | 117 | null: |
118 | ack_r4ktimer(0); | 118 | ack_r4ktimer(0); |
119 | irq_exit(); | ||
119 | } | 120 | } |
120 | 121 | ||
121 | #ifdef CONFIG_PM | 122 | #ifdef CONFIG_PM |
diff --git a/arch/mips/ddb5xxx/ddb5476/dbg_io.c b/arch/mips/ddb5xxx/ddb5476/dbg_io.c index 85e9e5013679..f2296a999953 100644 --- a/arch/mips/ddb5xxx/ddb5476/dbg_io.c +++ b/arch/mips/ddb5xxx/ddb5476/dbg_io.c | |||
@@ -86,7 +86,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) | |||
86 | /* disable interrupts */ | 86 | /* disable interrupts */ |
87 | UART16550_WRITE(OFS_INTR_ENABLE, 0); | 87 | UART16550_WRITE(OFS_INTR_ENABLE, 0); |
88 | 88 | ||
89 | /* set up buad rate */ | 89 | /* set up baud rate */ |
90 | { | 90 | { |
91 | uint32 divisor; | 91 | uint32 divisor; |
92 | 92 | ||
diff --git a/arch/mips/ddb5xxx/ddb5477/kgdb_io.c b/arch/mips/ddb5xxx/ddb5477/kgdb_io.c index 1d18d590495b..385bbdb10170 100644 --- a/arch/mips/ddb5xxx/ddb5477/kgdb_io.c +++ b/arch/mips/ddb5xxx/ddb5477/kgdb_io.c | |||
@@ -86,7 +86,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) | |||
86 | /* disable interrupts */ | 86 | /* disable interrupts */ |
87 | UART16550_WRITE(OFS_INTR_ENABLE, 0); | 87 | UART16550_WRITE(OFS_INTR_ENABLE, 0); |
88 | 88 | ||
89 | /* set up buad rate */ | 89 | /* set up baud rate */ |
90 | { | 90 | { |
91 | uint32 divisor; | 91 | uint32 divisor; |
92 | 92 | ||
diff --git a/arch/mips/gt64120/ev64120/serialGT.c b/arch/mips/gt64120/ev64120/serialGT.c index 16e34a546e54..8f0d835491ff 100644 --- a/arch/mips/gt64120/ev64120/serialGT.c +++ b/arch/mips/gt64120/ev64120/serialGT.c | |||
@@ -149,7 +149,7 @@ void serial_set(int channel, unsigned long baud) | |||
149 | #else | 149 | #else |
150 | /* | 150 | /* |
151 | * Note: Set baud rate, hardcoded here for rate of 115200 | 151 | * Note: Set baud rate, hardcoded here for rate of 115200 |
152 | * since became unsure of above "buad rate" algorithm (??). | 152 | * since became unsure of above "baud rate" algorithm (??). |
153 | */ | 153 | */ |
154 | outreg(channel, LCR, 0x83); | 154 | outreg(channel, LCR, 0x83); |
155 | outreg(channel, DLM, 0x00); // See note above | 155 | outreg(channel, DLM, 0x00); // See note above |
diff --git a/arch/mips/gt64120/momenco_ocelot/dbg_io.c b/arch/mips/gt64120/momenco_ocelot/dbg_io.c index 8720bccfdea2..f0a6a38fcf4d 100644 --- a/arch/mips/gt64120/momenco_ocelot/dbg_io.c +++ b/arch/mips/gt64120/momenco_ocelot/dbg_io.c | |||
@@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) | |||
73 | /* disable interrupts */ | 73 | /* disable interrupts */ |
74 | UART16550_WRITE(OFS_INTR_ENABLE, 0); | 74 | UART16550_WRITE(OFS_INTR_ENABLE, 0); |
75 | 75 | ||
76 | /* set up buad rate */ | 76 | /* set up baud rate */ |
77 | { | 77 | { |
78 | uint32 divisor; | 78 | uint32 divisor; |
79 | 79 | ||
diff --git a/arch/mips/ite-boards/generic/dbg_io.c b/arch/mips/ite-boards/generic/dbg_io.c index c4f8530fd07e..6a7ccaf93502 100644 --- a/arch/mips/ite-boards/generic/dbg_io.c +++ b/arch/mips/ite-boards/generic/dbg_io.c | |||
@@ -72,7 +72,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) | |||
72 | /* disable interrupts */ | 72 | /* disable interrupts */ |
73 | UART16550_WRITE(OFS_INTR_ENABLE, 0); | 73 | UART16550_WRITE(OFS_INTR_ENABLE, 0); |
74 | 74 | ||
75 | /* set up buad rate */ | 75 | /* set up baud rate */ |
76 | { | 76 | { |
77 | uint32 divisor; | 77 | uint32 divisor; |
78 | 78 | ||
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c index 92b28b674d6f..0facfaf4e950 100644 --- a/arch/mips/kernel/asm-offsets.c +++ b/arch/mips/kernel/asm-offsets.c | |||
@@ -272,8 +272,8 @@ void output_sc_defines(void) | |||
272 | text("/* Linux sigcontext offsets. */"); | 272 | text("/* Linux sigcontext offsets. */"); |
273 | offset("#define SC_REGS ", struct sigcontext, sc_regs); | 273 | offset("#define SC_REGS ", struct sigcontext, sc_regs); |
274 | offset("#define SC_FPREGS ", struct sigcontext, sc_fpregs); | 274 | offset("#define SC_FPREGS ", struct sigcontext, sc_fpregs); |
275 | offset("#define SC_MDHI ", struct sigcontext, sc_hi); | 275 | offset("#define SC_MDHI ", struct sigcontext, sc_mdhi); |
276 | offset("#define SC_MDLO ", struct sigcontext, sc_lo); | 276 | offset("#define SC_MDLO ", struct sigcontext, sc_mdlo); |
277 | offset("#define SC_PC ", struct sigcontext, sc_pc); | 277 | offset("#define SC_PC ", struct sigcontext, sc_pc); |
278 | offset("#define SC_FPC_CSR ", struct sigcontext, sc_fpc_csr); | 278 | offset("#define SC_FPC_CSR ", struct sigcontext, sc_fpc_csr); |
279 | linefeed; | 279 | linefeed; |
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c index 47a087b6c11b..d268827c62bd 100644 --- a/arch/mips/kernel/cpu-bugs64.c +++ b/arch/mips/kernel/cpu-bugs64.c | |||
@@ -206,7 +206,7 @@ static inline void check_daddi(void) | |||
206 | "daddi %0, %1, %3\n\t" | 206 | "daddi %0, %1, %3\n\t" |
207 | ".set pop" | 207 | ".set pop" |
208 | : "=r" (v), "=&r" (tmp) | 208 | : "=r" (v), "=&r" (tmp) |
209 | : "I" (0xffffffffffffdb9a), "I" (0x1234)); | 209 | : "I" (0xffffffffffffdb9aUL), "I" (0x1234)); |
210 | set_except_vector(12, handler); | 210 | set_except_vector(12, handler); |
211 | local_irq_restore(flags); | 211 | local_irq_restore(flags); |
212 | 212 | ||
@@ -224,7 +224,7 @@ static inline void check_daddi(void) | |||
224 | "dsrl %1, %1, 1\n\t" | 224 | "dsrl %1, %1, 1\n\t" |
225 | "daddi %0, %1, %3" | 225 | "daddi %0, %1, %3" |
226 | : "=r" (v), "=&r" (tmp) | 226 | : "=r" (v), "=&r" (tmp) |
227 | : "I" (0xffffffffffffdb9a), "I" (0x1234)); | 227 | : "I" (0xffffffffffffdb9aUL), "I" (0x1234)); |
228 | set_except_vector(12, handler); | 228 | set_except_vector(12, handler); |
229 | local_irq_restore(flags); | 229 | local_irq_restore(flags); |
230 | 230 | ||
@@ -280,7 +280,7 @@ static inline void check_daddiu(void) | |||
280 | "daddu %1, %2\n\t" | 280 | "daddu %1, %2\n\t" |
281 | ".set pop" | 281 | ".set pop" |
282 | : "=&r" (v), "=&r" (w), "=&r" (tmp) | 282 | : "=&r" (v), "=&r" (w), "=&r" (tmp) |
283 | : "I" (0xffffffffffffdb9a), "I" (0x1234)); | 283 | : "I" (0xffffffffffffdb9aUL), "I" (0x1234)); |
284 | 284 | ||
285 | if (v == w) { | 285 | if (v == w) { |
286 | printk("no.\n"); | 286 | printk("no.\n"); |
@@ -296,7 +296,7 @@ static inline void check_daddiu(void) | |||
296 | "addiu %1, $0, %4\n\t" | 296 | "addiu %1, $0, %4\n\t" |
297 | "daddu %1, %2" | 297 | "daddu %1, %2" |
298 | : "=&r" (v), "=&r" (w), "=&r" (tmp) | 298 | : "=&r" (v), "=&r" (w), "=&r" (tmp) |
299 | : "I" (0xffffffffffffdb9a), "I" (0x1234)); | 299 | : "I" (0xffffffffffffdb9aUL), "I" (0x1234)); |
300 | 300 | ||
301 | if (v == w) { | 301 | if (v == w) { |
302 | printk("yes.\n"); | 302 | printk("yes.\n"); |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 58b3b14873cb..8c2c359a05f4 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -121,6 +121,7 @@ static inline void check_wait(void) | |||
121 | case CPU_24K: | 121 | case CPU_24K: |
122 | case CPU_25KF: | 122 | case CPU_25KF: |
123 | case CPU_34K: | 123 | case CPU_34K: |
124 | case CPU_74K: | ||
124 | case CPU_PR4450: | 125 | case CPU_PR4450: |
125 | cpu_wait = r4k_wait; | 126 | cpu_wait = r4k_wait; |
126 | printk(" available.\n"); | 127 | printk(" available.\n"); |
@@ -432,6 +433,15 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c) | |||
432 | MIPS_CPU_LLSC; | 433 | MIPS_CPU_LLSC; |
433 | c->tlbsize = 64; | 434 | c->tlbsize = 64; |
434 | break; | 435 | break; |
436 | case PRID_IMP_R14000: | ||
437 | c->cputype = CPU_R14000; | ||
438 | c->isa_level = MIPS_CPU_ISA_IV; | ||
439 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | | ||
440 | MIPS_CPU_FPU | MIPS_CPU_32FPR | | ||
441 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | | ||
442 | MIPS_CPU_LLSC; | ||
443 | c->tlbsize = 64; | ||
444 | break; | ||
435 | } | 445 | } |
436 | } | 446 | } |
437 | 447 | ||
@@ -593,6 +603,9 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c) | |||
593 | case PRID_IMP_34K: | 603 | case PRID_IMP_34K: |
594 | c->cputype = CPU_34K; | 604 | c->cputype = CPU_34K; |
595 | break; | 605 | break; |
606 | case PRID_IMP_74K: | ||
607 | c->cputype = CPU_74K; | ||
608 | break; | ||
596 | } | 609 | } |
597 | } | 610 | } |
598 | 611 | ||
@@ -642,7 +655,7 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c) | |||
642 | case PRID_IMP_SB1: | 655 | case PRID_IMP_SB1: |
643 | c->cputype = CPU_SB1; | 656 | c->cputype = CPU_SB1; |
644 | /* FPU in pass1 is known to have issues. */ | 657 | /* FPU in pass1 is known to have issues. */ |
645 | if ((c->processor_id & 0xff) < 0x20) | 658 | if ((c->processor_id & 0xff) < 0x02) |
646 | c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); | 659 | c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); |
647 | break; | 660 | break; |
648 | case PRID_IMP_SB1A: | 661 | case PRID_IMP_SB1A: |
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S index d101d2fb24ca..a9c6de1b9542 100644 --- a/arch/mips/kernel/entry.S +++ b/arch/mips/kernel/entry.S | |||
@@ -101,7 +101,7 @@ FEXPORT(restore_all) # restore full frame | |||
101 | EMT | 101 | EMT |
102 | 1: | 102 | 1: |
103 | mfc0 v1, CP0_TCSTATUS | 103 | mfc0 v1, CP0_TCSTATUS |
104 | /* We set IXMT above, XOR should cler it here */ | 104 | /* We set IXMT above, XOR should clear it here */ |
105 | xori v1, v1, TCSTATUS_IXMT | 105 | xori v1, v1, TCSTATUS_IXMT |
106 | or v1, v0, v1 | 106 | or v1, v0, v1 |
107 | mtc0 v1, CP0_TCSTATUS | 107 | mtc0 v1, CP0_TCSTATUS |
diff --git a/arch/mips/kernel/gdb-low.S b/arch/mips/kernel/gdb-low.S index 10f28fb9f008..5fd7a8af0c62 100644 --- a/arch/mips/kernel/gdb-low.S +++ b/arch/mips/kernel/gdb-low.S | |||
@@ -54,9 +54,11 @@ | |||
54 | */ | 54 | */ |
55 | mfc0 k0, CP0_CAUSE | 55 | mfc0 k0, CP0_CAUSE |
56 | andi k0, k0, 0x7c | 56 | andi k0, k0, 0x7c |
57 | add k1, k1, k0 | 57 | #ifdef CONFIG_64BIT |
58 | PTR_L k0, saved_vectors(k1) | 58 | dsll k0, k0, 1 |
59 | jr k0 | 59 | #endif |
60 | PTR_L k1, saved_vectors(k0) | ||
61 | jr k1 | ||
60 | nop | 62 | nop |
61 | 1: | 63 | 1: |
62 | move k0, sp | 64 | move k0, sp |
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c index e54a7f442f8a..d7bf0215bc1d 100644 --- a/arch/mips/kernel/module.c +++ b/arch/mips/kernel/module.c | |||
@@ -288,6 +288,9 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, | |||
288 | sym = (Elf_Sym *)sechdrs[symindex].sh_addr | 288 | sym = (Elf_Sym *)sechdrs[symindex].sh_addr |
289 | + ELF_MIPS_R_SYM(rel[i]); | 289 | + ELF_MIPS_R_SYM(rel[i]); |
290 | if (!sym->st_value) { | 290 | if (!sym->st_value) { |
291 | /* Ignore unresolved weak symbol */ | ||
292 | if (ELF_ST_BIND(sym->st_info) == STB_WEAK) | ||
293 | continue; | ||
291 | printk(KERN_WARNING "%s: Unknown symbol %s\n", | 294 | printk(KERN_WARNING "%s: Unknown symbol %s\n", |
292 | me->name, strtab + sym->st_name); | 295 | me->name, strtab + sym->st_name); |
293 | return -ENOENT; | 296 | return -ENOENT; |
@@ -325,6 +328,9 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, | |||
325 | sym = (Elf_Sym *)sechdrs[symindex].sh_addr | 328 | sym = (Elf_Sym *)sechdrs[symindex].sh_addr |
326 | + ELF_MIPS_R_SYM(rel[i]); | 329 | + ELF_MIPS_R_SYM(rel[i]); |
327 | if (!sym->st_value) { | 330 | if (!sym->st_value) { |
331 | /* Ignore unresolved weak symbol */ | ||
332 | if (ELF_ST_BIND(sym->st_info) == STB_WEAK) | ||
333 | continue; | ||
328 | printk(KERN_WARNING "%s: Unknown symbol %s\n", | 334 | printk(KERN_WARNING "%s: Unknown symbol %s\n", |
329 | me->name, strtab + sym->st_name); | 335 | me->name, strtab + sym->st_name); |
330 | return -ENOENT; | 336 | return -ENOENT; |
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index 84ab959f924a..9def554f335b 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c | |||
@@ -42,6 +42,7 @@ static const char *cpu_name[] = { | |||
42 | [CPU_R8000] = "R8000", | 42 | [CPU_R8000] = "R8000", |
43 | [CPU_R10000] = "R10000", | 43 | [CPU_R10000] = "R10000", |
44 | [CPU_R12000] = "R12000", | 44 | [CPU_R12000] = "R12000", |
45 | [CPU_R14000] = "R14000", | ||
45 | [CPU_R4300] = "R4300", | 46 | [CPU_R4300] = "R4300", |
46 | [CPU_R4650] = "R4650", | 47 | [CPU_R4650] = "R4650", |
47 | [CPU_R4700] = "R4700", | 48 | [CPU_R4700] = "R4700", |
@@ -74,6 +75,7 @@ static const char *cpu_name[] = { | |||
74 | [CPU_24K] = "MIPS 24K", | 75 | [CPU_24K] = "MIPS 24K", |
75 | [CPU_25KF] = "MIPS 25Kf", | 76 | [CPU_25KF] = "MIPS 25Kf", |
76 | [CPU_34K] = "MIPS 34K", | 77 | [CPU_34K] = "MIPS 34K", |
78 | [CPU_74K] = "MIPS 74K", | ||
77 | [CPU_VR4111] = "NEC VR4111", | 79 | [CPU_VR4111] = "NEC VR4111", |
78 | [CPU_VR4121] = "NEC VR4121", | 80 | [CPU_VR4121] = "NEC VR4121", |
79 | [CPU_VR4122] = "NEC VR4122", | 81 | [CPU_VR4122] = "NEC VR4122", |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index b53a9207f530..8efb23a84131 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -209,7 +209,7 @@ sys_call_table: | |||
209 | PTR sys_fork | 209 | PTR sys_fork |
210 | PTR sys_read | 210 | PTR sys_read |
211 | PTR sys_write | 211 | PTR sys_write |
212 | PTR sys_open /* 4005 */ | 212 | PTR compat_sys_open /* 4005 */ |
213 | PTR sys_close | 213 | PTR sys_close |
214 | PTR sys_waitpid | 214 | PTR sys_waitpid |
215 | PTR sys_creat | 215 | PTR sys_creat |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index bcf1b10e518f..397a70e651b5 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -246,7 +246,7 @@ static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_en | |||
246 | #ifdef CONFIG_64BIT | 246 | #ifdef CONFIG_64BIT |
247 | /* HACK: Guess if the sign extension was forgotten */ | 247 | /* HACK: Guess if the sign extension was forgotten */ |
248 | if (start > 0x0000000080000000 && start < 0x00000000ffffffff) | 248 | if (start > 0x0000000080000000 && start < 0x00000000ffffffff) |
249 | start |= 0xffffffff00000000; | 249 | start |= 0xffffffff00000000UL; |
250 | #endif | 250 | #endif |
251 | 251 | ||
252 | end = start + size; | 252 | end = start + size; |
@@ -355,8 +355,6 @@ static inline void bootmem_init(void) | |||
355 | } | 355 | } |
356 | #endif | 356 | #endif |
357 | 357 | ||
358 | memory_present(0, first_usable_pfn, max_low_pfn); | ||
359 | |||
360 | /* Initialize the boot-time allocator with low memory only. */ | 358 | /* Initialize the boot-time allocator with low memory only. */ |
361 | bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn); | 359 | bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn); |
362 | 360 | ||
@@ -410,6 +408,7 @@ static inline void bootmem_init(void) | |||
410 | 408 | ||
411 | /* Register lowmem ranges */ | 409 | /* Register lowmem ranges */ |
412 | free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size)); | 410 | free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size)); |
411 | memory_present(0, curr_pfn, curr_pfn + size - 1); | ||
413 | } | 412 | } |
414 | 413 | ||
415 | /* Reserve the bootmap memory. */ | 414 | /* Reserve the bootmap memory. */ |
@@ -419,17 +418,20 @@ static inline void bootmem_init(void) | |||
419 | #ifdef CONFIG_BLK_DEV_INITRD | 418 | #ifdef CONFIG_BLK_DEV_INITRD |
420 | initrd_below_start_ok = 1; | 419 | initrd_below_start_ok = 1; |
421 | if (initrd_start) { | 420 | if (initrd_start) { |
422 | unsigned long initrd_size = ((unsigned char *)initrd_end) - ((unsigned char *)initrd_start); | 421 | unsigned long initrd_size = ((unsigned char *)initrd_end) - |
422 | ((unsigned char *)initrd_start); | ||
423 | const int width = sizeof(long) * 2; | ||
424 | |||
423 | printk("Initial ramdisk at: 0x%p (%lu bytes)\n", | 425 | printk("Initial ramdisk at: 0x%p (%lu bytes)\n", |
424 | (void *)initrd_start, initrd_size); | 426 | (void *)initrd_start, initrd_size); |
425 | 427 | ||
426 | if (CPHYSADDR(initrd_end) > PFN_PHYS(max_low_pfn)) { | 428 | if (CPHYSADDR(initrd_end) > PFN_PHYS(max_low_pfn)) { |
427 | printk("initrd extends beyond end of memory " | 429 | printk("initrd extends beyond end of memory " |
428 | "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n", | 430 | "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n", |
429 | sizeof(long) * 2, | 431 | width, |
430 | (unsigned long long)CPHYSADDR(initrd_end), | 432 | (unsigned long long) CPHYSADDR(initrd_end), |
431 | sizeof(long) * 2, | 433 | width, |
432 | (unsigned long long)PFN_PHYS(max_low_pfn)); | 434 | (unsigned long long) PFN_PHYS(max_low_pfn)); |
433 | initrd_start = initrd_end = 0; | 435 | initrd_start = initrd_end = 0; |
434 | initrd_reserve_bootmem = 0; | 436 | initrd_reserve_bootmem = 0; |
435 | } | 437 | } |
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h index 3ca786215d48..ce6cb915c0a7 100644 --- a/arch/mips/kernel/signal-common.h +++ b/arch/mips/kernel/signal-common.h | |||
@@ -31,7 +31,6 @@ setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
31 | save_gp_reg(31); | 31 | save_gp_reg(31); |
32 | #undef save_gp_reg | 32 | #undef save_gp_reg |
33 | 33 | ||
34 | #ifdef CONFIG_32BIT | ||
35 | err |= __put_user(regs->hi, &sc->sc_mdhi); | 34 | err |= __put_user(regs->hi, &sc->sc_mdhi); |
36 | err |= __put_user(regs->lo, &sc->sc_mdlo); | 35 | err |= __put_user(regs->lo, &sc->sc_mdlo); |
37 | if (cpu_has_dsp) { | 36 | if (cpu_has_dsp) { |
@@ -43,20 +42,6 @@ setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
43 | err |= __put_user(mflo3(), &sc->sc_lo3); | 42 | err |= __put_user(mflo3(), &sc->sc_lo3); |
44 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); | 43 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); |
45 | } | 44 | } |
46 | #endif | ||
47 | #ifdef CONFIG_64BIT | ||
48 | err |= __put_user(regs->hi, &sc->sc_hi[0]); | ||
49 | err |= __put_user(regs->lo, &sc->sc_lo[0]); | ||
50 | if (cpu_has_dsp) { | ||
51 | err |= __put_user(mfhi1(), &sc->sc_hi[1]); | ||
52 | err |= __put_user(mflo1(), &sc->sc_lo[1]); | ||
53 | err |= __put_user(mfhi2(), &sc->sc_hi[2]); | ||
54 | err |= __put_user(mflo2(), &sc->sc_lo[2]); | ||
55 | err |= __put_user(mfhi3(), &sc->sc_hi[3]); | ||
56 | err |= __put_user(mflo3(), &sc->sc_lo[3]); | ||
57 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); | ||
58 | } | ||
59 | #endif | ||
60 | 45 | ||
61 | err |= __put_user(!!used_math(), &sc->sc_used_math); | 46 | err |= __put_user(!!used_math(), &sc->sc_used_math); |
62 | 47 | ||
@@ -92,7 +77,6 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
92 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | 77 | current_thread_info()->restart_block.fn = do_no_restart_syscall; |
93 | 78 | ||
94 | err |= __get_user(regs->cp0_epc, &sc->sc_pc); | 79 | err |= __get_user(regs->cp0_epc, &sc->sc_pc); |
95 | #ifdef CONFIG_32BIT | ||
96 | err |= __get_user(regs->hi, &sc->sc_mdhi); | 80 | err |= __get_user(regs->hi, &sc->sc_mdhi); |
97 | err |= __get_user(regs->lo, &sc->sc_mdlo); | 81 | err |= __get_user(regs->lo, &sc->sc_mdlo); |
98 | if (cpu_has_dsp) { | 82 | if (cpu_has_dsp) { |
@@ -104,20 +88,6 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
104 | err |= __get_user(treg, &sc->sc_lo3); mtlo3(treg); | 88 | err |= __get_user(treg, &sc->sc_lo3); mtlo3(treg); |
105 | err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK); | 89 | err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK); |
106 | } | 90 | } |
107 | #endif | ||
108 | #ifdef CONFIG_64BIT | ||
109 | err |= __get_user(regs->hi, &sc->sc_hi[0]); | ||
110 | err |= __get_user(regs->lo, &sc->sc_lo[0]); | ||
111 | if (cpu_has_dsp) { | ||
112 | err |= __get_user(treg, &sc->sc_hi[1]); mthi1(treg); | ||
113 | err |= __get_user(treg, &sc->sc_lo[1]); mthi1(treg); | ||
114 | err |= __get_user(treg, &sc->sc_hi[2]); mthi2(treg); | ||
115 | err |= __get_user(treg, &sc->sc_lo[2]); mthi2(treg); | ||
116 | err |= __get_user(treg, &sc->sc_hi[3]); mthi3(treg); | ||
117 | err |= __get_user(treg, &sc->sc_lo[3]); mthi3(treg); | ||
118 | err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK); | ||
119 | } | ||
120 | #endif | ||
121 | 91 | ||
122 | #define restore_gp_reg(i) do { \ | 92 | #define restore_gp_reg(i) do { \ |
123 | err |= __get_user(regs->regs[i], &sc->sc_regs[i]); \ | 93 | err |= __get_user(regs->regs[i], &sc->sc_regs[i]); \ |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index d42f358754ad..298f82fe8440 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -247,6 +247,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
247 | current_thread_info()->cpu = 0; | 247 | current_thread_info()->cpu = 0; |
248 | smp_tune_scheduling(); | 248 | smp_tune_scheduling(); |
249 | plat_prepare_cpus(max_cpus); | 249 | plat_prepare_cpus(max_cpus); |
250 | #ifndef CONFIG_HOTPLUG_CPU | ||
251 | cpu_present_map = cpu_possible_map; | ||
252 | #endif | ||
250 | } | 253 | } |
251 | 254 | ||
252 | /* preload SMP state for boot cpu */ | 255 | /* preload SMP state for boot cpu */ |
@@ -442,7 +445,7 @@ static int __init topology_init(void) | |||
442 | int cpu; | 445 | int cpu; |
443 | int ret; | 446 | int ret; |
444 | 447 | ||
445 | for_each_cpu(cpu) { | 448 | for_each_present_cpu(cpu) { |
446 | ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL); | 449 | ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL); |
447 | if (ret) | 450 | if (ret) |
448 | printk(KERN_WARNING "topology_init: register_cpu %d " | 451 | printk(KERN_WARNING "topology_init: register_cpu %d " |
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 2aeaa2fd4b32..5e8a18a8e2bd 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -276,31 +276,9 @@ void sys_set_thread_area(unsigned long addr) | |||
276 | 276 | ||
277 | asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) | 277 | asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) |
278 | { | 278 | { |
279 | int tmp, len; | 279 | int tmp; |
280 | char __user *name; | ||
281 | 280 | ||
282 | switch(cmd) { | 281 | switch(cmd) { |
283 | case SETNAME: { | ||
284 | char nodename[__NEW_UTS_LEN + 1]; | ||
285 | |||
286 | if (!capable(CAP_SYS_ADMIN)) | ||
287 | return -EPERM; | ||
288 | |||
289 | name = (char __user *) arg1; | ||
290 | |||
291 | len = strncpy_from_user(nodename, name, __NEW_UTS_LEN); | ||
292 | if (len < 0) | ||
293 | return -EFAULT; | ||
294 | |||
295 | down_write(&uts_sem); | ||
296 | strncpy(system_utsname.nodename, nodename, len); | ||
297 | nodename[__NEW_UTS_LEN] = '\0'; | ||
298 | strlcpy(system_utsname.nodename, nodename, | ||
299 | sizeof(system_utsname.nodename)); | ||
300 | up_write(&uts_sem); | ||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | case MIPS_ATOMIC_SET: | 282 | case MIPS_ATOMIC_SET: |
305 | printk(KERN_CRIT "How did I get here?\n"); | 283 | printk(KERN_CRIT "How did I get here?\n"); |
306 | return -EINVAL; | 284 | return -EINVAL; |
@@ -313,9 +291,6 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) | |||
313 | case FLUSH_CACHE: | 291 | case FLUSH_CACHE: |
314 | __flush_cache_all(); | 292 | __flush_cache_all(); |
315 | return 0; | 293 | return 0; |
316 | |||
317 | case MIPS_RDNVRAM: | ||
318 | return -EIO; | ||
319 | } | 294 | } |
320 | 295 | ||
321 | return -EINVAL; | 296 | return -EINVAL; |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 4901f0a37fca..a7564b08eb4d 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -819,15 +819,30 @@ asmlinkage void do_watch(struct pt_regs *regs) | |||
819 | 819 | ||
820 | asmlinkage void do_mcheck(struct pt_regs *regs) | 820 | asmlinkage void do_mcheck(struct pt_regs *regs) |
821 | { | 821 | { |
822 | const int field = 2 * sizeof(unsigned long); | ||
823 | int multi_match = regs->cp0_status & ST0_TS; | ||
824 | |||
822 | show_regs(regs); | 825 | show_regs(regs); |
823 | dump_tlb_all(); | 826 | |
827 | if (multi_match) { | ||
828 | printk("Index : %0x\n", read_c0_index()); | ||
829 | printk("Pagemask: %0x\n", read_c0_pagemask()); | ||
830 | printk("EntryHi : %0*lx\n", field, read_c0_entryhi()); | ||
831 | printk("EntryLo0: %0*lx\n", field, read_c0_entrylo0()); | ||
832 | printk("EntryLo1: %0*lx\n", field, read_c0_entrylo1()); | ||
833 | printk("\n"); | ||
834 | dump_tlb_all(); | ||
835 | } | ||
836 | |||
837 | show_code((unsigned int *) regs->cp0_epc); | ||
838 | |||
824 | /* | 839 | /* |
825 | * Some chips may have other causes of machine check (e.g. SB1 | 840 | * Some chips may have other causes of machine check (e.g. SB1 |
826 | * graduation timer) | 841 | * graduation timer) |
827 | */ | 842 | */ |
828 | panic("Caught Machine Check exception - %scaused by multiple " | 843 | panic("Caught Machine Check exception - %scaused by multiple " |
829 | "matching entries in the TLB.", | 844 | "matching entries in the TLB.", |
830 | (regs->cp0_status & ST0_TS) ? "" : "not "); | 845 | (multi_match) ? "" : "not "); |
831 | } | 846 | } |
832 | 847 | ||
833 | asmlinkage void do_mt(struct pt_regs *regs) | 848 | asmlinkage void do_mt(struct pt_regs *regs) |
@@ -902,6 +917,7 @@ static inline void parity_protection_init(void) | |||
902 | { | 917 | { |
903 | switch (current_cpu_data.cputype) { | 918 | switch (current_cpu_data.cputype) { |
904 | case CPU_24K: | 919 | case CPU_24K: |
920 | case CPU_34K: | ||
905 | case CPU_5KC: | 921 | case CPU_5KC: |
906 | write_c0_ecc(0x80000000); | 922 | write_c0_ecc(0x80000000); |
907 | back_to_back_c0_hazard(); | 923 | back_to_back_c0_hazard(); |
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 14fa00e3cdfa..b84d1f9ce28e 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S | |||
@@ -151,23 +151,13 @@ SECTIONS | |||
151 | 151 | ||
152 | /* This is the MIPS specific mdebug section. */ | 152 | /* This is the MIPS specific mdebug section. */ |
153 | .mdebug : { *(.mdebug) } | 153 | .mdebug : { *(.mdebug) } |
154 | /* These are needed for ELF backends which have not yet been | 154 | |
155 | converted to the new style linker. */ | 155 | STABS_DEBUG |
156 | .stab 0 : { *(.stab) } | 156 | |
157 | .stabstr 0 : { *(.stabstr) } | 157 | DWARF_DEBUG |
158 | /* DWARF debug sections. | 158 | |
159 | Symbols in the .debug DWARF section are relative to the beginning of the | ||
160 | section so we begin .debug at 0. It's not clear yet what needs to happen | ||
161 | for the others. */ | ||
162 | .debug 0 : { *(.debug) } | ||
163 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | ||
164 | .debug_aranges 0 : { *(.debug_aranges) } | ||
165 | .debug_pubnames 0 : { *(.debug_pubnames) } | ||
166 | .debug_sfnames 0 : { *(.debug_sfnames) } | ||
167 | .line 0 : { *(.line) } | ||
168 | /* These must appear regardless of . */ | 159 | /* These must appear regardless of . */ |
169 | .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } | 160 | .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } |
170 | .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } | 161 | .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } |
171 | .comment : { *(.comment) } | ||
172 | .note : { *(.note) } | 162 | .note : { *(.note) } |
173 | } | 163 | } |
diff --git a/arch/mips/math-emu/dp_fint.c b/arch/mips/math-emu/dp_fint.c index a1962eb460f8..39a71de16f47 100644 --- a/arch/mips/math-emu/dp_fint.c +++ b/arch/mips/math-emu/dp_fint.c | |||
@@ -29,7 +29,9 @@ | |||
29 | 29 | ||
30 | ieee754dp ieee754dp_fint(int x) | 30 | ieee754dp ieee754dp_fint(int x) |
31 | { | 31 | { |
32 | COMPXDP; | 32 | u64 xm; |
33 | int xe; | ||
34 | int xs; | ||
33 | 35 | ||
34 | CLEARCX; | 36 | CLEARCX; |
35 | 37 | ||
diff --git a/arch/mips/math-emu/dp_flong.c b/arch/mips/math-emu/dp_flong.c index eae90a866aa1..f08f223e488a 100644 --- a/arch/mips/math-emu/dp_flong.c +++ b/arch/mips/math-emu/dp_flong.c | |||
@@ -29,7 +29,9 @@ | |||
29 | 29 | ||
30 | ieee754dp ieee754dp_flong(s64 x) | 30 | ieee754dp ieee754dp_flong(s64 x) |
31 | { | 31 | { |
32 | COMPXDP; | 32 | u64 xm; |
33 | int xe; | ||
34 | int xs; | ||
33 | 35 | ||
34 | CLEARCX; | 36 | CLEARCX; |
35 | 37 | ||
diff --git a/arch/mips/math-emu/sp_fint.c b/arch/mips/math-emu/sp_fint.c index 7aac13afb09a..e88e125e01c2 100644 --- a/arch/mips/math-emu/sp_fint.c +++ b/arch/mips/math-emu/sp_fint.c | |||
@@ -29,7 +29,9 @@ | |||
29 | 29 | ||
30 | ieee754sp ieee754sp_fint(int x) | 30 | ieee754sp ieee754sp_fint(int x) |
31 | { | 31 | { |
32 | COMPXSP; | 32 | unsigned xm; |
33 | int xe; | ||
34 | int xs; | ||
33 | 35 | ||
34 | CLEARCX; | 36 | CLEARCX; |
35 | 37 | ||
diff --git a/arch/mips/math-emu/sp_flong.c b/arch/mips/math-emu/sp_flong.c index 3d6c1d11c178..26d6919a269a 100644 --- a/arch/mips/math-emu/sp_flong.c +++ b/arch/mips/math-emu/sp_flong.c | |||
@@ -29,7 +29,9 @@ | |||
29 | 29 | ||
30 | ieee754sp ieee754sp_flong(s64 x) | 30 | ieee754sp ieee754sp_flong(s64 x) |
31 | { | 31 | { |
32 | COMPXDP; /* <--- need 64-bit mantissa temp */ | 32 | u64 xm; /* <--- need 64-bit mantissa temp */ |
33 | int xe; | ||
34 | int xs; | ||
33 | 35 | ||
34 | CLEARCX; | 36 | CLEARCX; |
35 | 37 | ||
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 4182e1176fae..4a43924cd4fc 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -29,6 +29,27 @@ | |||
29 | #include <asm/war.h> | 29 | #include <asm/war.h> |
30 | #include <asm/cacheflush.h> /* for run_uncached() */ | 30 | #include <asm/cacheflush.h> /* for run_uncached() */ |
31 | 31 | ||
32 | |||
33 | /* | ||
34 | * Special Variant of smp_call_function for use by cache functions: | ||
35 | * | ||
36 | * o No return value | ||
37 | * o collapses to normal function call on UP kernels | ||
38 | * o collapses to normal function call on systems with a single shared | ||
39 | * primary cache. | ||
40 | */ | ||
41 | static inline void r4k_on_each_cpu(void (*func) (void *info), void *info, | ||
42 | int retry, int wait) | ||
43 | { | ||
44 | preempt_disable(); | ||
45 | |||
46 | #if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC) | ||
47 | smp_call_function(func, info, retry, wait); | ||
48 | #endif | ||
49 | func(info); | ||
50 | preempt_enable(); | ||
51 | } | ||
52 | |||
32 | /* | 53 | /* |
33 | * Must die. | 54 | * Must die. |
34 | */ | 55 | */ |
@@ -299,7 +320,7 @@ static void r4k_flush_cache_all(void) | |||
299 | if (!cpu_has_dc_aliases) | 320 | if (!cpu_has_dc_aliases) |
300 | return; | 321 | return; |
301 | 322 | ||
302 | on_each_cpu(local_r4k_flush_cache_all, NULL, 1, 1); | 323 | r4k_on_each_cpu(local_r4k_flush_cache_all, NULL, 1, 1); |
303 | } | 324 | } |
304 | 325 | ||
305 | static inline void local_r4k___flush_cache_all(void * args) | 326 | static inline void local_r4k___flush_cache_all(void * args) |
@@ -314,13 +335,14 @@ static inline void local_r4k___flush_cache_all(void * args) | |||
314 | case CPU_R4400MC: | 335 | case CPU_R4400MC: |
315 | case CPU_R10000: | 336 | case CPU_R10000: |
316 | case CPU_R12000: | 337 | case CPU_R12000: |
338 | case CPU_R14000: | ||
317 | r4k_blast_scache(); | 339 | r4k_blast_scache(); |
318 | } | 340 | } |
319 | } | 341 | } |
320 | 342 | ||
321 | static void r4k___flush_cache_all(void) | 343 | static void r4k___flush_cache_all(void) |
322 | { | 344 | { |
323 | on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1); | 345 | r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1); |
324 | } | 346 | } |
325 | 347 | ||
326 | static inline void local_r4k_flush_cache_range(void * args) | 348 | static inline void local_r4k_flush_cache_range(void * args) |
@@ -341,7 +363,7 @@ static inline void local_r4k_flush_cache_range(void * args) | |||
341 | static void r4k_flush_cache_range(struct vm_area_struct *vma, | 363 | static void r4k_flush_cache_range(struct vm_area_struct *vma, |
342 | unsigned long start, unsigned long end) | 364 | unsigned long start, unsigned long end) |
343 | { | 365 | { |
344 | on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1); | 366 | r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1); |
345 | } | 367 | } |
346 | 368 | ||
347 | static inline void local_r4k_flush_cache_mm(void * args) | 369 | static inline void local_r4k_flush_cache_mm(void * args) |
@@ -370,7 +392,7 @@ static void r4k_flush_cache_mm(struct mm_struct *mm) | |||
370 | if (!cpu_has_dc_aliases) | 392 | if (!cpu_has_dc_aliases) |
371 | return; | 393 | return; |
372 | 394 | ||
373 | on_each_cpu(local_r4k_flush_cache_mm, mm, 1, 1); | 395 | r4k_on_each_cpu(local_r4k_flush_cache_mm, mm, 1, 1); |
374 | } | 396 | } |
375 | 397 | ||
376 | struct flush_cache_page_args { | 398 | struct flush_cache_page_args { |
@@ -461,7 +483,7 @@ static void r4k_flush_cache_page(struct vm_area_struct *vma, | |||
461 | args.addr = addr; | 483 | args.addr = addr; |
462 | args.pfn = pfn; | 484 | args.pfn = pfn; |
463 | 485 | ||
464 | on_each_cpu(local_r4k_flush_cache_page, &args, 1, 1); | 486 | r4k_on_each_cpu(local_r4k_flush_cache_page, &args, 1, 1); |
465 | } | 487 | } |
466 | 488 | ||
467 | static inline void local_r4k_flush_data_cache_page(void * addr) | 489 | static inline void local_r4k_flush_data_cache_page(void * addr) |
@@ -471,7 +493,7 @@ static inline void local_r4k_flush_data_cache_page(void * addr) | |||
471 | 493 | ||
472 | static void r4k_flush_data_cache_page(unsigned long addr) | 494 | static void r4k_flush_data_cache_page(unsigned long addr) |
473 | { | 495 | { |
474 | on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 1, 1); | 496 | r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 1, 1); |
475 | } | 497 | } |
476 | 498 | ||
477 | struct flush_icache_range_args { | 499 | struct flush_icache_range_args { |
@@ -514,7 +536,7 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end) | |||
514 | args.start = start; | 536 | args.start = start; |
515 | args.end = end; | 537 | args.end = end; |
516 | 538 | ||
517 | on_each_cpu(local_r4k_flush_icache_range, &args, 1, 1); | 539 | r4k_on_each_cpu(local_r4k_flush_icache_range, &args, 1, 1); |
518 | instruction_hazard(); | 540 | instruction_hazard(); |
519 | } | 541 | } |
520 | 542 | ||
@@ -590,7 +612,7 @@ static void r4k_flush_icache_page(struct vm_area_struct *vma, | |||
590 | args.vma = vma; | 612 | args.vma = vma; |
591 | args.page = page; | 613 | args.page = page; |
592 | 614 | ||
593 | on_each_cpu(local_r4k_flush_icache_page, &args, 1, 1); | 615 | r4k_on_each_cpu(local_r4k_flush_icache_page, &args, 1, 1); |
594 | } | 616 | } |
595 | 617 | ||
596 | 618 | ||
@@ -689,7 +711,7 @@ static void local_r4k_flush_cache_sigtramp(void * arg) | |||
689 | 711 | ||
690 | static void r4k_flush_cache_sigtramp(unsigned long addr) | 712 | static void r4k_flush_cache_sigtramp(unsigned long addr) |
691 | { | 713 | { |
692 | on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr, 1, 1); | 714 | r4k_on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr, 1, 1); |
693 | } | 715 | } |
694 | 716 | ||
695 | static void r4k_flush_icache_all(void) | 717 | static void r4k_flush_icache_all(void) |
@@ -812,6 +834,7 @@ static void __init probe_pcache(void) | |||
812 | 834 | ||
813 | case CPU_R10000: | 835 | case CPU_R10000: |
814 | case CPU_R12000: | 836 | case CPU_R12000: |
837 | case CPU_R14000: | ||
815 | icache_size = 1 << (12 + ((config & R10K_CONF_IC) >> 29)); | 838 | icache_size = 1 << (12 + ((config & R10K_CONF_IC) >> 29)); |
816 | c->icache.linesz = 64; | 839 | c->icache.linesz = 64; |
817 | c->icache.ways = 2; | 840 | c->icache.ways = 2; |
@@ -965,9 +988,11 @@ static void __init probe_pcache(void) | |||
965 | c->dcache.flags |= MIPS_CACHE_PINDEX; | 988 | c->dcache.flags |= MIPS_CACHE_PINDEX; |
966 | case CPU_R10000: | 989 | case CPU_R10000: |
967 | case CPU_R12000: | 990 | case CPU_R12000: |
991 | case CPU_R14000: | ||
968 | case CPU_SB1: | 992 | case CPU_SB1: |
969 | break; | 993 | break; |
970 | case CPU_24K: | 994 | case CPU_24K: |
995 | case CPU_34K: | ||
971 | if (!(read_c0_config7() & (1 << 16))) | 996 | if (!(read_c0_config7() & (1 << 16))) |
972 | default: | 997 | default: |
973 | if (c->dcache.waysize > PAGE_SIZE) | 998 | if (c->dcache.waysize > PAGE_SIZE) |
@@ -1091,6 +1116,7 @@ static void __init setup_scache(void) | |||
1091 | 1116 | ||
1092 | case CPU_R10000: | 1117 | case CPU_R10000: |
1093 | case CPU_R12000: | 1118 | case CPU_R12000: |
1119 | case CPU_R14000: | ||
1094 | scache_size = 0x80000 << ((config & R10K_CONF_SS) >> 16); | 1120 | scache_size = 0x80000 << ((config & R10K_CONF_SS) >> 16); |
1095 | c->scache.linesz = 64 << ((config >> 13) & 1); | 1121 | c->scache.linesz = 64 << ((config >> 13) & 1); |
1096 | c->scache.ways = 2; | 1122 | c->scache.ways = 2; |
@@ -1135,6 +1161,31 @@ static void __init setup_scache(void) | |||
1135 | c->options |= MIPS_CPU_SUBSET_CACHES; | 1161 | c->options |= MIPS_CPU_SUBSET_CACHES; |
1136 | } | 1162 | } |
1137 | 1163 | ||
1164 | void au1x00_fixup_config_od(void) | ||
1165 | { | ||
1166 | /* | ||
1167 | * c0_config.od (bit 19) was write only (and read as 0) | ||
1168 | * on the early revisions of Alchemy SOCs. It disables the bus | ||
1169 | * transaction overlapping and needs to be set to fix various errata. | ||
1170 | */ | ||
1171 | switch (read_c0_prid()) { | ||
1172 | case 0x00030100: /* Au1000 DA */ | ||
1173 | case 0x00030201: /* Au1000 HA */ | ||
1174 | case 0x00030202: /* Au1000 HB */ | ||
1175 | case 0x01030200: /* Au1500 AB */ | ||
1176 | /* | ||
1177 | * Au1100 errata actually keeps silence about this bit, so we set it | ||
1178 | * just in case for those revisions that require it to be set according | ||
1179 | * to arch/mips/au1000/common/cputable.c | ||
1180 | */ | ||
1181 | case 0x02030200: /* Au1100 AB */ | ||
1182 | case 0x02030201: /* Au1100 BA */ | ||
1183 | case 0x02030202: /* Au1100 BC */ | ||
1184 | set_c0_config(1 << 19); | ||
1185 | break; | ||
1186 | } | ||
1187 | } | ||
1188 | |||
1138 | static inline void coherency_setup(void) | 1189 | static inline void coherency_setup(void) |
1139 | { | 1190 | { |
1140 | change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT); | 1191 | change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT); |
@@ -1155,6 +1206,15 @@ static inline void coherency_setup(void) | |||
1155 | case CPU_R4400MC: | 1206 | case CPU_R4400MC: |
1156 | clear_c0_config(CONF_CU); | 1207 | clear_c0_config(CONF_CU); |
1157 | break; | 1208 | break; |
1209 | /* | ||
1210 | * We need to catch the ealry Alchemy SOCs with | ||
1211 | * the write-only co_config.od bit and set it back to one... | ||
1212 | */ | ||
1213 | case CPU_AU1000: /* rev. DA, HA, HB */ | ||
1214 | case CPU_AU1100: /* rev. AB, BA, BC ?? */ | ||
1215 | case CPU_AU1500: /* rev. AB */ | ||
1216 | au1x00_fixup_config_od(); | ||
1217 | break; | ||
1158 | } | 1218 | } |
1159 | } | 1219 | } |
1160 | 1220 | ||
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index c22308b93ff0..33f6e1cdfd5b 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -227,7 +227,7 @@ void __init mem_init(void) | |||
227 | for (tmp = 0; tmp < max_low_pfn; tmp++) | 227 | for (tmp = 0; tmp < max_low_pfn; tmp++) |
228 | if (page_is_ram(tmp)) { | 228 | if (page_is_ram(tmp)) { |
229 | ram++; | 229 | ram++; |
230 | if (PageReserved(mem_map+tmp)) | 230 | if (PageReserved(pfn_to_page(tmp))) |
231 | reservedpages++; | 231 | reservedpages++; |
232 | } | 232 | } |
233 | 233 | ||
diff --git a/arch/mips/mm/pg-r4k.c b/arch/mips/mm/pg-r4k.c index e4390dc3eb48..b7c749232ffe 100644 --- a/arch/mips/mm/pg-r4k.c +++ b/arch/mips/mm/pg-r4k.c | |||
@@ -357,6 +357,7 @@ void __init build_clear_page(void) | |||
357 | 357 | ||
358 | case CPU_R10000: | 358 | case CPU_R10000: |
359 | case CPU_R12000: | 359 | case CPU_R12000: |
360 | case CPU_R14000: | ||
360 | pref_src_mode = Pref_LoadStreamed; | 361 | pref_src_mode = Pref_LoadStreamed; |
361 | pref_dst_mode = Pref_StoreStreamed; | 362 | pref_dst_mode = Pref_StoreStreamed; |
362 | break; | 363 | break; |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 053dbacac56b..54507be2ab5b 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -875,6 +875,7 @@ static __init void build_tlb_write_entry(u32 **p, struct label **l, | |||
875 | 875 | ||
876 | case CPU_R10000: | 876 | case CPU_R10000: |
877 | case CPU_R12000: | 877 | case CPU_R12000: |
878 | case CPU_R14000: | ||
878 | case CPU_4KC: | 879 | case CPU_4KC: |
879 | case CPU_SB1: | 880 | case CPU_SB1: |
880 | case CPU_SB1A: | 881 | case CPU_SB1A: |
@@ -906,6 +907,7 @@ static __init void build_tlb_write_entry(u32 **p, struct label **l, | |||
906 | case CPU_4KEC: | 907 | case CPU_4KEC: |
907 | case CPU_24K: | 908 | case CPU_24K: |
908 | case CPU_34K: | 909 | case CPU_34K: |
910 | case CPU_74K: | ||
909 | i_ehb(p); | 911 | i_ehb(p); |
910 | tlbw(p); | 912 | tlbw(p); |
911 | break; | 913 | break; |
diff --git a/arch/mips/momentum/jaguar_atx/dbg_io.c b/arch/mips/momentum/jaguar_atx/dbg_io.c index 542eac82b63c..d7dea0a136aa 100644 --- a/arch/mips/momentum/jaguar_atx/dbg_io.c +++ b/arch/mips/momentum/jaguar_atx/dbg_io.c | |||
@@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) | |||
73 | /* disable interrupts */ | 73 | /* disable interrupts */ |
74 | UART16550_WRITE(OFS_INTR_ENABLE, 0); | 74 | UART16550_WRITE(OFS_INTR_ENABLE, 0); |
75 | 75 | ||
76 | /* set up buad rate */ | 76 | /* set up baud rate */ |
77 | { | 77 | { |
78 | uint32 divisor; | 78 | uint32 divisor; |
79 | 79 | ||
diff --git a/arch/mips/momentum/ocelot_c/dbg_io.c b/arch/mips/momentum/ocelot_c/dbg_io.c index 8720bccfdea2..f0a6a38fcf4d 100644 --- a/arch/mips/momentum/ocelot_c/dbg_io.c +++ b/arch/mips/momentum/ocelot_c/dbg_io.c | |||
@@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) | |||
73 | /* disable interrupts */ | 73 | /* disable interrupts */ |
74 | UART16550_WRITE(OFS_INTR_ENABLE, 0); | 74 | UART16550_WRITE(OFS_INTR_ENABLE, 0); |
75 | 75 | ||
76 | /* set up buad rate */ | 76 | /* set up baud rate */ |
77 | { | 77 | { |
78 | uint32 divisor; | 78 | uint32 divisor; |
79 | 79 | ||
diff --git a/arch/mips/momentum/ocelot_g/dbg_io.c b/arch/mips/momentum/ocelot_g/dbg_io.c index 8720bccfdea2..f0a6a38fcf4d 100644 --- a/arch/mips/momentum/ocelot_g/dbg_io.c +++ b/arch/mips/momentum/ocelot_g/dbg_io.c | |||
@@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) | |||
73 | /* disable interrupts */ | 73 | /* disable interrupts */ |
74 | UART16550_WRITE(OFS_INTR_ENABLE, 0); | 74 | UART16550_WRITE(OFS_INTR_ENABLE, 0); |
75 | 75 | ||
76 | /* set up buad rate */ | 76 | /* set up baud rate */ |
77 | { | 77 | { |
78 | uint32 divisor; | 78 | uint32 divisor; |
79 | 79 | ||
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c index f2b4862aaae5..c31e4cff64e0 100644 --- a/arch/mips/oprofile/common.c +++ b/arch/mips/oprofile/common.c | |||
@@ -14,8 +14,8 @@ | |||
14 | 14 | ||
15 | #include "op_impl.h" | 15 | #include "op_impl.h" |
16 | 16 | ||
17 | extern struct op_mips_model op_model_mipsxx __attribute__((weak)); | 17 | extern struct op_mips_model op_model_mipsxx_ops __attribute__((weak)); |
18 | extern struct op_mips_model op_model_rm9000 __attribute__((weak)); | 18 | extern struct op_mips_model op_model_rm9000_ops __attribute__((weak)); |
19 | 19 | ||
20 | static struct op_mips_model *model; | 20 | static struct op_mips_model *model; |
21 | 21 | ||
@@ -80,13 +80,14 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
80 | case CPU_24K: | 80 | case CPU_24K: |
81 | case CPU_25KF: | 81 | case CPU_25KF: |
82 | case CPU_34K: | 82 | case CPU_34K: |
83 | case CPU_74K: | ||
83 | case CPU_SB1: | 84 | case CPU_SB1: |
84 | case CPU_SB1A: | 85 | case CPU_SB1A: |
85 | lmodel = &op_model_mipsxx; | 86 | lmodel = &op_model_mipsxx_ops; |
86 | break; | 87 | break; |
87 | 88 | ||
88 | case CPU_RM9000: | 89 | case CPU_RM9000: |
89 | lmodel = &op_model_rm9000; | 90 | lmodel = &op_model_rm9000_ops; |
90 | break; | 91 | break; |
91 | }; | 92 | }; |
92 | 93 | ||
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c index 95d488ca0754..f26a00e13204 100644 --- a/arch/mips/oprofile/op_model_mipsxx.c +++ b/arch/mips/oprofile/op_model_mipsxx.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #define M_COUNTER_OVERFLOW (1UL << 31) | 24 | #define M_COUNTER_OVERFLOW (1UL << 31) |
25 | 25 | ||
26 | struct op_mips_model op_model_mipsxx; | 26 | struct op_mips_model op_model_mipsxx_ops; |
27 | 27 | ||
28 | static struct mipsxx_register_config { | 28 | static struct mipsxx_register_config { |
29 | unsigned int control[4]; | 29 | unsigned int control[4]; |
@@ -34,7 +34,7 @@ static struct mipsxx_register_config { | |||
34 | 34 | ||
35 | static void mipsxx_reg_setup(struct op_counter_config *ctr) | 35 | static void mipsxx_reg_setup(struct op_counter_config *ctr) |
36 | { | 36 | { |
37 | unsigned int counters = op_model_mipsxx.num_counters; | 37 | unsigned int counters = op_model_mipsxx_ops.num_counters; |
38 | int i; | 38 | int i; |
39 | 39 | ||
40 | /* Compute the performance counter control word. */ | 40 | /* Compute the performance counter control word. */ |
@@ -62,7 +62,7 @@ static void mipsxx_reg_setup(struct op_counter_config *ctr) | |||
62 | 62 | ||
63 | static void mipsxx_cpu_setup (void *args) | 63 | static void mipsxx_cpu_setup (void *args) |
64 | { | 64 | { |
65 | unsigned int counters = op_model_mipsxx.num_counters; | 65 | unsigned int counters = op_model_mipsxx_ops.num_counters; |
66 | 66 | ||
67 | switch (counters) { | 67 | switch (counters) { |
68 | case 4: | 68 | case 4: |
@@ -83,7 +83,7 @@ static void mipsxx_cpu_setup (void *args) | |||
83 | /* Start all counters on current CPU */ | 83 | /* Start all counters on current CPU */ |
84 | static void mipsxx_cpu_start(void *args) | 84 | static void mipsxx_cpu_start(void *args) |
85 | { | 85 | { |
86 | unsigned int counters = op_model_mipsxx.num_counters; | 86 | unsigned int counters = op_model_mipsxx_ops.num_counters; |
87 | 87 | ||
88 | switch (counters) { | 88 | switch (counters) { |
89 | case 4: | 89 | case 4: |
@@ -100,7 +100,7 @@ static void mipsxx_cpu_start(void *args) | |||
100 | /* Stop all counters on current CPU */ | 100 | /* Stop all counters on current CPU */ |
101 | static void mipsxx_cpu_stop(void *args) | 101 | static void mipsxx_cpu_stop(void *args) |
102 | { | 102 | { |
103 | unsigned int counters = op_model_mipsxx.num_counters; | 103 | unsigned int counters = op_model_mipsxx_ops.num_counters; |
104 | 104 | ||
105 | switch (counters) { | 105 | switch (counters) { |
106 | case 4: | 106 | case 4: |
@@ -116,7 +116,7 @@ static void mipsxx_cpu_stop(void *args) | |||
116 | 116 | ||
117 | static int mipsxx_perfcount_handler(struct pt_regs *regs) | 117 | static int mipsxx_perfcount_handler(struct pt_regs *regs) |
118 | { | 118 | { |
119 | unsigned int counters = op_model_mipsxx.num_counters; | 119 | unsigned int counters = op_model_mipsxx_ops.num_counters; |
120 | unsigned int control; | 120 | unsigned int control; |
121 | unsigned int counter; | 121 | unsigned int counter; |
122 | int handled = 0; | 122 | int handled = 0; |
@@ -187,33 +187,37 @@ static int __init mipsxx_init(void) | |||
187 | 187 | ||
188 | reset_counters(counters); | 188 | reset_counters(counters); |
189 | 189 | ||
190 | op_model_mipsxx.num_counters = counters; | 190 | op_model_mipsxx_ops.num_counters = counters; |
191 | switch (current_cpu_data.cputype) { | 191 | switch (current_cpu_data.cputype) { |
192 | case CPU_20KC: | 192 | case CPU_20KC: |
193 | op_model_mipsxx.cpu_type = "mips/20K"; | 193 | op_model_mipsxx_ops.cpu_type = "mips/20K"; |
194 | break; | 194 | break; |
195 | 195 | ||
196 | case CPU_24K: | 196 | case CPU_24K: |
197 | op_model_mipsxx.cpu_type = "mips/24K"; | 197 | op_model_mipsxx_ops.cpu_type = "mips/24K"; |
198 | break; | 198 | break; |
199 | 199 | ||
200 | case CPU_25KF: | 200 | case CPU_25KF: |
201 | op_model_mipsxx.cpu_type = "mips/25K"; | 201 | op_model_mipsxx_ops.cpu_type = "mips/25K"; |
202 | break; | 202 | break; |
203 | 203 | ||
204 | #ifndef CONFIG_SMP | 204 | #ifndef CONFIG_SMP |
205 | case CPU_34K: | 205 | case CPU_34K: |
206 | op_model_mipsxx.cpu_type = "mips/34K"; | 206 | op_model_mipsxx_ops.cpu_type = "mips/34K"; |
207 | break; | ||
208 | |||
209 | case CPU_74K: | ||
210 | op_model_mipsxx_ops.cpu_type = "mips/74K"; | ||
207 | break; | 211 | break; |
208 | #endif | 212 | #endif |
209 | 213 | ||
210 | case CPU_5KC: | 214 | case CPU_5KC: |
211 | op_model_mipsxx.cpu_type = "mips/5K"; | 215 | op_model_mipsxx_ops.cpu_type = "mips/5K"; |
212 | break; | 216 | break; |
213 | 217 | ||
214 | case CPU_SB1: | 218 | case CPU_SB1: |
215 | case CPU_SB1A: | 219 | case CPU_SB1A: |
216 | op_model_mipsxx.cpu_type = "mips/sb1"; | 220 | op_model_mipsxx_ops.cpu_type = "mips/sb1"; |
217 | break; | 221 | break; |
218 | 222 | ||
219 | default: | 223 | default: |
@@ -229,12 +233,12 @@ static int __init mipsxx_init(void) | |||
229 | 233 | ||
230 | static void mipsxx_exit(void) | 234 | static void mipsxx_exit(void) |
231 | { | 235 | { |
232 | reset_counters(op_model_mipsxx.num_counters); | 236 | reset_counters(op_model_mipsxx_ops.num_counters); |
233 | 237 | ||
234 | perf_irq = null_perf_irq; | 238 | perf_irq = null_perf_irq; |
235 | } | 239 | } |
236 | 240 | ||
237 | struct op_mips_model op_model_mipsxx = { | 241 | struct op_mips_model op_model_mipsxx_ops = { |
238 | .reg_setup = mipsxx_reg_setup, | 242 | .reg_setup = mipsxx_reg_setup, |
239 | .cpu_setup = mipsxx_cpu_setup, | 243 | .cpu_setup = mipsxx_cpu_setup, |
240 | .init = mipsxx_init, | 244 | .init = mipsxx_init, |
diff --git a/arch/mips/oprofile/op_model_rm9000.c b/arch/mips/oprofile/op_model_rm9000.c index 9b75e41c78ef..b7063fefa65b 100644 --- a/arch/mips/oprofile/op_model_rm9000.c +++ b/arch/mips/oprofile/op_model_rm9000.c | |||
@@ -126,7 +126,7 @@ static void rm9000_exit(void) | |||
126 | free_irq(rm9000_perfcount_irq, NULL); | 126 | free_irq(rm9000_perfcount_irq, NULL); |
127 | } | 127 | } |
128 | 128 | ||
129 | struct op_mips_model op_model_rm9000 = { | 129 | struct op_mips_model op_model_rm9000_ops = { |
130 | .reg_setup = rm9000_reg_setup, | 130 | .reg_setup = rm9000_reg_setup, |
131 | .cpu_setup = rm9000_cpu_setup, | 131 | .cpu_setup = rm9000_cpu_setup, |
132 | .init = rm9000_init, | 132 | .init = rm9000_init, |
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c index de01c9815bdd..8ba08047d164 100644 --- a/arch/mips/sgi-ip32/ip32-irq.c +++ b/arch/mips/sgi-ip32/ip32-irq.c | |||
@@ -31,12 +31,12 @@ | |||
31 | /* issue a PIO read to make sure no PIO writes are pending */ | 31 | /* issue a PIO read to make sure no PIO writes are pending */ |
32 | static void inline flush_crime_bus(void) | 32 | static void inline flush_crime_bus(void) |
33 | { | 33 | { |
34 | volatile unsigned long junk = crime->control; | 34 | crime->control; |
35 | } | 35 | } |
36 | 36 | ||
37 | static void inline flush_mace_bus(void) | 37 | static void inline flush_mace_bus(void) |
38 | { | 38 | { |
39 | volatile unsigned long junk = mace->perif.ctrl.misc; | 39 | mace->perif.ctrl.misc; |
40 | } | 40 | } |
41 | 41 | ||
42 | #undef DEBUG_IRQ | 42 | #undef DEBUG_IRQ |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 078fb5533541..f70bd090dacd 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -822,6 +822,7 @@ static void __init prom_send_capabilities(void) | |||
822 | /* try calling the ibm,client-architecture-support method */ | 822 | /* try calling the ibm,client-architecture-support method */ |
823 | if (call_prom_ret("call-method", 3, 2, &ret, | 823 | if (call_prom_ret("call-method", 3, 2, &ret, |
824 | ADDR("ibm,client-architecture-support"), | 824 | ADDR("ibm,client-architecture-support"), |
825 | root, | ||
825 | ADDR(ibm_architecture_vec)) == 0) { | 826 | ADDR(ibm_architecture_vec)) == 0) { |
826 | /* the call exists... */ | 827 | /* the call exists... */ |
827 | if (ret) | 828 | if (ret) |
@@ -1622,6 +1623,15 @@ static int __init prom_find_machine_type(void) | |||
1622 | if (strstr(p, RELOC("Power Macintosh")) || | 1623 | if (strstr(p, RELOC("Power Macintosh")) || |
1623 | strstr(p, RELOC("MacRISC"))) | 1624 | strstr(p, RELOC("MacRISC"))) |
1624 | return PLATFORM_POWERMAC; | 1625 | return PLATFORM_POWERMAC; |
1626 | #ifdef CONFIG_PPC64 | ||
1627 | /* We must make sure we don't detect the IBM Cell | ||
1628 | * blades as pSeries due to some firmware issues, | ||
1629 | * so we do it here. | ||
1630 | */ | ||
1631 | if (strstr(p, RELOC("IBM,CBEA")) || | ||
1632 | strstr(p, RELOC("IBM,CPBW-1.0"))) | ||
1633 | return PLATFORM_GENERIC; | ||
1634 | #endif /* CONFIG_PPC64 */ | ||
1625 | i += sl + 1; | 1635 | i += sl + 1; |
1626 | } | 1636 | } |
1627 | } | 1637 | } |
@@ -1636,7 +1646,7 @@ static int __init prom_find_machine_type(void) | |||
1636 | compat, sizeof(compat)-1); | 1646 | compat, sizeof(compat)-1); |
1637 | if (len <= 0) | 1647 | if (len <= 0) |
1638 | return PLATFORM_GENERIC; | 1648 | return PLATFORM_GENERIC; |
1639 | if (strncmp(compat, RELOC("chrp"), 4)) | 1649 | if (strcmp(compat, RELOC("chrp"))) |
1640 | return PLATFORM_GENERIC; | 1650 | return PLATFORM_GENERIC; |
1641 | 1651 | ||
1642 | /* Default to pSeries. We need to know if we are running LPAR */ | 1652 | /* Default to pSeries. We need to know if we are running LPAR */ |
@@ -2057,10 +2067,45 @@ static void __init flatten_device_tree(void) | |||
2057 | 2067 | ||
2058 | } | 2068 | } |
2059 | 2069 | ||
2060 | 2070 | #ifdef CONFIG_PPC_MAPLE | |
2061 | static void __init fixup_device_tree(void) | 2071 | /* PIBS Version 1.05.0000 04/26/2005 has an incorrect /ht/isa/ranges property. |
2072 | * The values are bad, and it doesn't even have the right number of cells. */ | ||
2073 | static void __init fixup_device_tree_maple(void) | ||
2062 | { | 2074 | { |
2075 | phandle isa; | ||
2076 | u32 isa_ranges[6]; | ||
2077 | |||
2078 | isa = call_prom("finddevice", 1, 1, ADDR("/ht@0/isa@4")); | ||
2079 | if (!PHANDLE_VALID(isa)) | ||
2080 | return; | ||
2081 | |||
2082 | if (prom_getprop(isa, "ranges", isa_ranges, sizeof(isa_ranges)) | ||
2083 | == PROM_ERROR) | ||
2084 | return; | ||
2085 | |||
2086 | if (isa_ranges[0] != 0x1 || | ||
2087 | isa_ranges[1] != 0xf4000000 || | ||
2088 | isa_ranges[2] != 0x00010000) | ||
2089 | return; | ||
2090 | |||
2091 | prom_printf("fixing up bogus ISA range on Maple...\n"); | ||
2092 | |||
2093 | isa_ranges[0] = 0x1; | ||
2094 | isa_ranges[1] = 0x0; | ||
2095 | isa_ranges[2] = 0x01002000; /* IO space; PCI device = 4 */ | ||
2096 | isa_ranges[3] = 0x0; | ||
2097 | isa_ranges[4] = 0x0; | ||
2098 | isa_ranges[5] = 0x00010000; | ||
2099 | prom_setprop(isa, "/ht@0/isa@4", "ranges", | ||
2100 | isa_ranges, sizeof(isa_ranges)); | ||
2101 | } | ||
2102 | #else | ||
2103 | #define fixup_device_tree_maple() | ||
2104 | #endif | ||
2105 | |||
2063 | #if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC) | 2106 | #if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC) |
2107 | static void __init fixup_device_tree_pmac(void) | ||
2108 | { | ||
2064 | phandle u3, i2c, mpic; | 2109 | phandle u3, i2c, mpic; |
2065 | u32 u3_rev; | 2110 | u32 u3_rev; |
2066 | u32 interrupts[2]; | 2111 | u32 interrupts[2]; |
@@ -2097,9 +2142,16 @@ static void __init fixup_device_tree(void) | |||
2097 | parent = (u32)mpic; | 2142 | parent = (u32)mpic; |
2098 | prom_setprop(i2c, "/u3@0,f8000000/i2c@f8001000", "interrupt-parent", | 2143 | prom_setprop(i2c, "/u3@0,f8000000/i2c@f8001000", "interrupt-parent", |
2099 | &parent, sizeof(parent)); | 2144 | &parent, sizeof(parent)); |
2100 | #endif | ||
2101 | } | 2145 | } |
2146 | #else | ||
2147 | #define fixup_device_tree_pmac() | ||
2148 | #endif | ||
2102 | 2149 | ||
2150 | static void __init fixup_device_tree(void) | ||
2151 | { | ||
2152 | fixup_device_tree_maple(); | ||
2153 | fixup_device_tree_pmac(); | ||
2154 | } | ||
2103 | 2155 | ||
2104 | static void __init prom_find_boot_cpu(void) | 2156 | static void __init prom_find_boot_cpu(void) |
2105 | { | 2157 | { |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 01e3c08cb550..8fdeca2d4597 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -803,10 +803,13 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int | |||
803 | if (__get_user(cmcp, &ucp->uc_regs)) | 803 | if (__get_user(cmcp, &ucp->uc_regs)) |
804 | return -EFAULT; | 804 | return -EFAULT; |
805 | mcp = (struct mcontext __user *)(u64)cmcp; | 805 | mcp = (struct mcontext __user *)(u64)cmcp; |
806 | /* no need to check access_ok(mcp), since mcp < 4GB */ | ||
806 | } | 807 | } |
807 | #else | 808 | #else |
808 | if (__get_user(mcp, &ucp->uc_regs)) | 809 | if (__get_user(mcp, &ucp->uc_regs)) |
809 | return -EFAULT; | 810 | return -EFAULT; |
811 | if (!access_ok(VERIFY_READ, mcp, sizeof(*mcp))) | ||
812 | return -EFAULT; | ||
810 | #endif | 813 | #endif |
811 | restore_sigmask(&set); | 814 | restore_sigmask(&set); |
812 | if (restore_user_regs(regs, mcp, sig)) | 815 | if (restore_user_regs(regs, mcp, sig)) |
@@ -908,13 +911,14 @@ int sys_debug_setcontext(struct ucontext __user *ctx, | |||
908 | { | 911 | { |
909 | struct sig_dbg_op op; | 912 | struct sig_dbg_op op; |
910 | int i; | 913 | int i; |
914 | unsigned char tmp; | ||
911 | unsigned long new_msr = regs->msr; | 915 | unsigned long new_msr = regs->msr; |
912 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) | 916 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) |
913 | unsigned long new_dbcr0 = current->thread.dbcr0; | 917 | unsigned long new_dbcr0 = current->thread.dbcr0; |
914 | #endif | 918 | #endif |
915 | 919 | ||
916 | for (i=0; i<ndbg; i++) { | 920 | for (i=0; i<ndbg; i++) { |
917 | if (__copy_from_user(&op, dbg, sizeof(op))) | 921 | if (copy_from_user(&op, dbg + i, sizeof(op))) |
918 | return -EFAULT; | 922 | return -EFAULT; |
919 | switch (op.dbg_type) { | 923 | switch (op.dbg_type) { |
920 | case SIG_DBG_SINGLE_STEPPING: | 924 | case SIG_DBG_SINGLE_STEPPING: |
@@ -959,6 +963,11 @@ int sys_debug_setcontext(struct ucontext __user *ctx, | |||
959 | current->thread.dbcr0 = new_dbcr0; | 963 | current->thread.dbcr0 = new_dbcr0; |
960 | #endif | 964 | #endif |
961 | 965 | ||
966 | if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx)) | ||
967 | || __get_user(tmp, (u8 __user *) ctx) | ||
968 | || __get_user(tmp, (u8 __user *) (ctx + 1) - 1)) | ||
969 | return -EFAULT; | ||
970 | |||
962 | /* | 971 | /* |
963 | * If we get a fault copying the context into the kernel's | 972 | * If we get a fault copying the context into the kernel's |
964 | * image of the user's registers, we can't just return -EFAULT | 973 | * image of the user's registers, we can't just return -EFAULT |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index 27f65b95184d..c2db642f4cdd 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -182,6 +182,8 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig, | |||
182 | err |= __get_user(msr, &sc->gp_regs[PT_MSR]); | 182 | err |= __get_user(msr, &sc->gp_regs[PT_MSR]); |
183 | if (err) | 183 | if (err) |
184 | return err; | 184 | return err; |
185 | if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128))) | ||
186 | return -EFAULT; | ||
185 | /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ | 187 | /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ |
186 | if (v_regs != 0 && (msr & MSR_VEC) != 0) | 188 | if (v_regs != 0 && (msr & MSR_VEC) != 0) |
187 | err |= __copy_from_user(current->thread.vr, v_regs, | 189 | err |= __copy_from_user(current->thread.vr, v_regs, |
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index cf56a1d499ff..26ed1f5ef16e 100644 --- a/arch/powerpc/kernel/systbl.S +++ b/arch/powerpc/kernel/systbl.S | |||
@@ -338,6 +338,8 @@ SYSCALL(symlinkat) | |||
338 | SYSCALL(readlinkat) | 338 | SYSCALL(readlinkat) |
339 | SYSCALL(fchmodat) | 339 | SYSCALL(fchmodat) |
340 | SYSCALL(faccessat) | 340 | SYSCALL(faccessat) |
341 | COMPAT_SYS(get_robust_list) | ||
342 | COMPAT_SYS(set_robust_list) | ||
341 | 343 | ||
342 | /* | 344 | /* |
343 | * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c | 345 | * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c |
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index 6574b22b3cf3..fd3e5609e3e0 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c | |||
@@ -125,14 +125,13 @@ static void __init cell_init_early(void) | |||
125 | 125 | ||
126 | static int __init cell_probe(void) | 126 | static int __init cell_probe(void) |
127 | { | 127 | { |
128 | /* XXX This is temporary, the Cell maintainer will come up with | ||
129 | * more appropriate detection logic | ||
130 | */ | ||
131 | unsigned long root = of_get_flat_dt_root(); | 128 | unsigned long root = of_get_flat_dt_root(); |
132 | if (!of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) | ||
133 | return 0; | ||
134 | 129 | ||
135 | return 1; | 130 | if (of_flat_dt_is_compatible(root, "IBM,CBEA") || |
131 | of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) | ||
132 | return 1; | ||
133 | |||
134 | return 0; | ||
136 | } | 135 | } |
137 | 136 | ||
138 | /* | 137 | /* |
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c index 95b36430aa0f..b47fcc5ddb78 100644 --- a/arch/powerpc/platforms/cell/spu_callbacks.c +++ b/arch/powerpc/platforms/cell/spu_callbacks.c | |||
@@ -258,6 +258,7 @@ void *spu_syscall_table[] = { | |||
258 | [__NR_futex] sys_futex, | 258 | [__NR_futex] sys_futex, |
259 | [__NR_sched_setaffinity] sys_sched_setaffinity, | 259 | [__NR_sched_setaffinity] sys_sched_setaffinity, |
260 | [__NR_sched_getaffinity] sys_sched_getaffinity, | 260 | [__NR_sched_getaffinity] sys_sched_getaffinity, |
261 | [224] sys_ni_syscall, | ||
261 | [__NR_tuxcall] sys_ni_syscall, | 262 | [__NR_tuxcall] sys_ni_syscall, |
262 | [226] sys_ni_syscall, | 263 | [226] sys_ni_syscall, |
263 | [__NR_io_setup] sys_io_setup, | 264 | [__NR_io_setup] sys_io_setup, |
@@ -332,19 +333,21 @@ void *spu_syscall_table[] = { | |||
332 | [__NR_readlinkat] sys_readlinkat, | 333 | [__NR_readlinkat] sys_readlinkat, |
333 | [__NR_fchmodat] sys_fchmodat, | 334 | [__NR_fchmodat] sys_fchmodat, |
334 | [__NR_faccessat] sys_faccessat, | 335 | [__NR_faccessat] sys_faccessat, |
336 | [__NR_get_robust_list] sys_get_robust_list, | ||
337 | [__NR_set_robust_list] sys_set_robust_list, | ||
335 | }; | 338 | }; |
336 | 339 | ||
337 | long spu_sys_callback(struct spu_syscall_block *s) | 340 | long spu_sys_callback(struct spu_syscall_block *s) |
338 | { | 341 | { |
339 | long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); | 342 | long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); |
340 | 343 | ||
341 | syscall = spu_syscall_table[s->nr_ret]; | ||
342 | |||
343 | if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) { | 344 | if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) { |
344 | pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret); | 345 | pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret); |
345 | return -ENOSYS; | 346 | return -ENOSYS; |
346 | } | 347 | } |
347 | 348 | ||
349 | syscall = spu_syscall_table[s->nr_ret]; | ||
350 | |||
348 | #ifdef DEBUG | 351 | #ifdef DEBUG |
349 | print_symbol(KERN_DEBUG "SPU-syscall %s:", (unsigned long)syscall); | 352 | print_symbol(KERN_DEBUG "SPU-syscall %s:", (unsigned long)syscall); |
350 | printk("syscall%ld(%lx, %lx, %lx, %lx, %lx, %lx)\n", | 353 | printk("syscall%ld(%lx, %lx, %lx, %lx, %lx, %lx)\n", |
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index df2343e1956b..c896ce83d412 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c | |||
@@ -1157,6 +1157,7 @@ EXPORT_SYMBOL_GPL(pmac_i2c_xfer); | |||
1157 | /* some quirks for platform function decoding */ | 1157 | /* some quirks for platform function decoding */ |
1158 | enum { | 1158 | enum { |
1159 | pmac_i2c_quirk_invmask = 0x00000001u, | 1159 | pmac_i2c_quirk_invmask = 0x00000001u, |
1160 | pmac_i2c_quirk_skip = 0x00000002u, | ||
1160 | }; | 1161 | }; |
1161 | 1162 | ||
1162 | static void pmac_i2c_devscan(void (*callback)(struct device_node *dev, | 1163 | static void pmac_i2c_devscan(void (*callback)(struct device_node *dev, |
@@ -1172,6 +1173,15 @@ static void pmac_i2c_devscan(void (*callback)(struct device_node *dev, | |||
1172 | /* XXX Study device-tree's & apple drivers are get the quirks | 1173 | /* XXX Study device-tree's & apple drivers are get the quirks |
1173 | * right ! | 1174 | * right ! |
1174 | */ | 1175 | */ |
1176 | /* Workaround: It seems that running the clockspreading | ||
1177 | * properties on the eMac will cause lockups during boot. | ||
1178 | * The machine seems to work fine without that. So for now, | ||
1179 | * let's make sure i2c-hwclock doesn't match about "imic" | ||
1180 | * clocks and we'll figure out if we really need to do | ||
1181 | * something special about those later. | ||
1182 | */ | ||
1183 | { "i2c-hwclock", "imic5002", pmac_i2c_quirk_skip }, | ||
1184 | { "i2c-hwclock", "imic5003", pmac_i2c_quirk_skip }, | ||
1175 | { "i2c-hwclock", NULL, pmac_i2c_quirk_invmask }, | 1185 | { "i2c-hwclock", NULL, pmac_i2c_quirk_invmask }, |
1176 | { "i2c-cpu-voltage", NULL, 0}, | 1186 | { "i2c-cpu-voltage", NULL, 0}, |
1177 | { "temp-monitor", NULL, 0 }, | 1187 | { "temp-monitor", NULL, 0 }, |
@@ -1198,6 +1208,8 @@ static void pmac_i2c_devscan(void (*callback)(struct device_node *dev, | |||
1198 | if (p->compatible && | 1208 | if (p->compatible && |
1199 | !device_is_compatible(np, p->compatible)) | 1209 | !device_is_compatible(np, p->compatible)) |
1200 | continue; | 1210 | continue; |
1211 | if (p->quirks & pmac_i2c_quirk_skip) | ||
1212 | break; | ||
1201 | callback(np, p->quirks); | 1213 | callback(np, p->quirks); |
1202 | break; | 1214 | break; |
1203 | } | 1215 | } |
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c index 4baa75b1d36f..f08173b0f065 100644 --- a/arch/powerpc/platforms/powermac/pfunc_core.c +++ b/arch/powerpc/platforms/powermac/pfunc_core.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/mutex.h> | ||
14 | 15 | ||
15 | #include <asm/semaphore.h> | 16 | #include <asm/semaphore.h> |
16 | #include <asm/prom.h> | 17 | #include <asm/prom.h> |
@@ -546,6 +547,7 @@ struct pmf_device { | |||
546 | 547 | ||
547 | static LIST_HEAD(pmf_devices); | 548 | static LIST_HEAD(pmf_devices); |
548 | static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED; | 549 | static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED; |
550 | static DEFINE_MUTEX(pmf_irq_mutex); | ||
549 | 551 | ||
550 | static void pmf_release_device(struct kref *kref) | 552 | static void pmf_release_device(struct kref *kref) |
551 | { | 553 | { |
@@ -864,15 +866,17 @@ int pmf_register_irq_client(struct device_node *target, | |||
864 | 866 | ||
865 | spin_lock_irqsave(&pmf_lock, flags); | 867 | spin_lock_irqsave(&pmf_lock, flags); |
866 | func = __pmf_find_function(target, name, PMF_FLAGS_INT_GEN); | 868 | func = __pmf_find_function(target, name, PMF_FLAGS_INT_GEN); |
867 | if (func == NULL) { | 869 | if (func) |
868 | spin_unlock_irqrestore(&pmf_lock, flags); | 870 | func = pmf_get_function(func); |
871 | spin_unlock_irqrestore(&pmf_lock, flags); | ||
872 | if (func == NULL) | ||
869 | return -ENODEV; | 873 | return -ENODEV; |
870 | } | 874 | mutex_lock(&pmf_irq_mutex); |
871 | if (list_empty(&func->irq_clients)) | 875 | if (list_empty(&func->irq_clients)) |
872 | func->dev->handlers->irq_enable(func); | 876 | func->dev->handlers->irq_enable(func); |
873 | list_add(&client->link, &func->irq_clients); | 877 | list_add(&client->link, &func->irq_clients); |
874 | client->func = func; | 878 | client->func = func; |
875 | spin_unlock_irqrestore(&pmf_lock, flags); | 879 | mutex_unlock(&pmf_irq_mutex); |
876 | 880 | ||
877 | return 0; | 881 | return 0; |
878 | } | 882 | } |
@@ -881,16 +885,16 @@ EXPORT_SYMBOL_GPL(pmf_register_irq_client); | |||
881 | void pmf_unregister_irq_client(struct pmf_irq_client *client) | 885 | void pmf_unregister_irq_client(struct pmf_irq_client *client) |
882 | { | 886 | { |
883 | struct pmf_function *func = client->func; | 887 | struct pmf_function *func = client->func; |
884 | unsigned long flags; | ||
885 | 888 | ||
886 | BUG_ON(func == NULL); | 889 | BUG_ON(func == NULL); |
887 | 890 | ||
888 | spin_lock_irqsave(&pmf_lock, flags); | 891 | mutex_lock(&pmf_irq_mutex); |
889 | client->func = NULL; | 892 | client->func = NULL; |
890 | list_del(&client->link); | 893 | list_del(&client->link); |
891 | if (list_empty(&func->irq_clients)) | 894 | if (list_empty(&func->irq_clients)) |
892 | func->dev->handlers->irq_disable(func); | 895 | func->dev->handlers->irq_disable(func); |
893 | spin_unlock_irqrestore(&pmf_lock, flags); | 896 | mutex_unlock(&pmf_irq_mutex); |
897 | pmf_put_function(func); | ||
894 | } | 898 | } |
895 | EXPORT_SYMBOL_GPL(pmf_unregister_irq_client); | 899 | EXPORT_SYMBOL_GPL(pmf_unregister_irq_client); |
896 | 900 | ||
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 4d15e396655c..b9200fb07815 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -463,11 +463,23 @@ static int pmac_pm_finish(suspend_state_t state) | |||
463 | return 0; | 463 | return 0; |
464 | } | 464 | } |
465 | 465 | ||
466 | static int pmac_pm_valid(suspend_state_t state) | ||
467 | { | ||
468 | switch (state) { | ||
469 | case PM_SUSPEND_DISK: | ||
470 | return 1; | ||
471 | /* can't do any other states via generic mechanism yet */ | ||
472 | default: | ||
473 | return 0; | ||
474 | } | ||
475 | } | ||
476 | |||
466 | static struct pm_ops pmac_pm_ops = { | 477 | static struct pm_ops pmac_pm_ops = { |
467 | .pm_disk_mode = PM_DISK_SHUTDOWN, | 478 | .pm_disk_mode = PM_DISK_SHUTDOWN, |
468 | .prepare = pmac_pm_prepare, | 479 | .prepare = pmac_pm_prepare, |
469 | .enter = pmac_pm_enter, | 480 | .enter = pmac_pm_enter, |
470 | .finish = pmac_pm_finish, | 481 | .finish = pmac_pm_finish, |
482 | .valid = pmac_pm_valid, | ||
471 | }; | 483 | }; |
472 | 484 | ||
473 | #endif /* CONFIG_SOFTWARE_SUSPEND */ | 485 | #endif /* CONFIG_SOFTWARE_SUSPEND */ |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 5eb55ef1c91c..3ba87835757e 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -255,7 +255,7 @@ static int __init pSeries_init_panel(void) | |||
255 | { | 255 | { |
256 | /* Manually leave the kernel version on the panel. */ | 256 | /* Manually leave the kernel version on the panel. */ |
257 | ppc_md.progress("Linux ppc64\n", 0); | 257 | ppc_md.progress("Linux ppc64\n", 0); |
258 | ppc_md.progress(system_utsname.version, 0); | 258 | ppc_md.progress(system_utsname.release, 0); |
259 | 259 | ||
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
@@ -389,6 +389,7 @@ static int __init pSeries_probe_hypertas(unsigned long node, | |||
389 | 389 | ||
390 | static int __init pSeries_probe(void) | 390 | static int __init pSeries_probe(void) |
391 | { | 391 | { |
392 | unsigned long root = of_get_flat_dt_root(); | ||
392 | char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(), | 393 | char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(), |
393 | "device_type", NULL); | 394 | "device_type", NULL); |
394 | if (dtype == NULL) | 395 | if (dtype == NULL) |
@@ -396,6 +397,13 @@ static int __init pSeries_probe(void) | |||
396 | if (strcmp(dtype, "chrp")) | 397 | if (strcmp(dtype, "chrp")) |
397 | return 0; | 398 | return 0; |
398 | 399 | ||
400 | /* Cell blades firmware claims to be chrp while it's not. Until this | ||
401 | * is fixed, we need to avoid those here. | ||
402 | */ | ||
403 | if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0") || | ||
404 | of_flat_dt_is_compatible(root, "IBM,CBEA")) | ||
405 | return 0; | ||
406 | |||
399 | DBG("pSeries detected, looking for LPAR capability...\n"); | 407 | DBG("pSeries detected, looking for LPAR capability...\n"); |
400 | 408 | ||
401 | /* Now try to figure out if we are running on LPAR */ | 409 | /* Now try to figure out if we are running on LPAR */ |
diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c index cc7c4aea9397..2f5c5e157617 100644 --- a/arch/ppc/kernel/asm-offsets.c +++ b/arch/ppc/kernel/asm-offsets.c | |||
@@ -134,7 +134,7 @@ main(void) | |||
134 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); | 134 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); |
135 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); | 135 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); |
136 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); | 136 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); |
137 | DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, flags)); | 137 | DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags)); |
138 | DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); | 138 | DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); |
139 | DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); | 139 | DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); |
140 | 140 | ||
diff --git a/arch/ppc/platforms/mpc8272ads_setup.c b/arch/ppc/platforms/mpc8272ads_setup.c index e62b75707f7a..abb7154de2c7 100644 --- a/arch/ppc/platforms/mpc8272ads_setup.c +++ b/arch/ppc/platforms/mpc8272ads_setup.c | |||
@@ -279,11 +279,11 @@ static int mpc8272ads_platform_notify(struct device *dev) | |||
279 | static const struct platform_notify_dev_map dev_map[] = { | 279 | static const struct platform_notify_dev_map dev_map[] = { |
280 | { | 280 | { |
281 | .bus_id = "fsl-cpm-fcc", | 281 | .bus_id = "fsl-cpm-fcc", |
282 | .rtn = mpc8272ads_fixup_enet_pdata | 282 | .rtn = mpc8272ads_fixup_enet_pdata, |
283 | }, | 283 | }, |
284 | { | 284 | { |
285 | .bus_id = "fsl-cpm-scc:uart", | 285 | .bus_id = "fsl-cpm-scc:uart", |
286 | .rtn = mpc | 286 | .rtn = mpc8272ads_fixup_uart_pdata, |
287 | }, | 287 | }, |
288 | { | 288 | { |
289 | .bus_id = NULL | 289 | .bus_id = NULL |
@@ -335,15 +335,15 @@ struct platform_device* early_uart_get_pdev(int index) | |||
335 | struct platform_device* pdev = NULL; | 335 | struct platform_device* pdev = NULL; |
336 | if(index) { /*assume SCC4 here*/ | 336 | if(index) { /*assume SCC4 here*/ |
337 | pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC4]; | 337 | pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC4]; |
338 | pinfo = &mpc8272<F12>_uart_pdata[1]; | 338 | pinfo = &mpc8272_uart_pdata[fsid_scc4_uart]; |
339 | } else { /*over SCC1*/ | 339 | } else { /*over SCC1*/ |
340 | pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC1]; | 340 | pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC1]; |
341 | pinfo = &mpc8272_uart_pdata[0]; | 341 | pinfo = &mpc8272_uart_pdata[fsid_scc1_uart]; |
342 | } | 342 | } |
343 | 343 | ||
344 | pinfo->uart_clk = bd->bi_intfreq; | 344 | pinfo->uart_clk = bd->bi_intfreq; |
345 | pdev->dev.platform_data = pinfo; | 345 | pdev->dev.platform_data = pinfo; |
346 | ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR); | 346 | ppc_sys_fixup_mem_resource(pdev, CPM_MAP_ADDR); |
347 | return NULL; | 347 | return NULL; |
348 | } | 348 | } |
349 | 349 | ||
diff --git a/arch/ppc/syslib/pq2_devices.c b/arch/ppc/syslib/pq2_devices.c index 0636aed7b827..8692d00c08c4 100644 --- a/arch/ppc/syslib/pq2_devices.c +++ b/arch/ppc/syslib/pq2_devices.c | |||
@@ -121,13 +121,13 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
121 | .num_resources = 3, | 121 | .num_resources = 3, |
122 | .resource = (struct resource[]) { | 122 | .resource = (struct resource[]) { |
123 | { | 123 | { |
124 | .name = "scc_mem", | 124 | .name = "regs", |
125 | .start = 0x11A00, | 125 | .start = 0x11A00, |
126 | .end = 0x11A1F, | 126 | .end = 0x11A1F, |
127 | .flags = IORESOURCE_MEM, | 127 | .flags = IORESOURCE_MEM, |
128 | }, | 128 | }, |
129 | { | 129 | { |
130 | .name = "scc_pram", | 130 | .name = "pram", |
131 | .start = 0x8000, | 131 | .start = 0x8000, |
132 | .end = 0x80ff, | 132 | .end = 0x80ff, |
133 | .flags = IORESOURCE_MEM, | 133 | .flags = IORESOURCE_MEM, |
@@ -145,13 +145,13 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
145 | .num_resources = 3, | 145 | .num_resources = 3, |
146 | .resource = (struct resource[]) { | 146 | .resource = (struct resource[]) { |
147 | { | 147 | { |
148 | .name = "scc_mem", | 148 | .name = "regs", |
149 | .start = 0x11A20, | 149 | .start = 0x11A20, |
150 | .end = 0x11A3F, | 150 | .end = 0x11A3F, |
151 | .flags = IORESOURCE_MEM, | 151 | .flags = IORESOURCE_MEM, |
152 | }, | 152 | }, |
153 | { | 153 | { |
154 | .name = "scc_pram", | 154 | .name = "pram", |
155 | .start = 0x8100, | 155 | .start = 0x8100, |
156 | .end = 0x81ff, | 156 | .end = 0x81ff, |
157 | .flags = IORESOURCE_MEM, | 157 | .flags = IORESOURCE_MEM, |
@@ -169,13 +169,13 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
169 | .num_resources = 3, | 169 | .num_resources = 3, |
170 | .resource = (struct resource[]) { | 170 | .resource = (struct resource[]) { |
171 | { | 171 | { |
172 | .name = "scc_mem", | 172 | .name = "regs", |
173 | .start = 0x11A40, | 173 | .start = 0x11A40, |
174 | .end = 0x11A5F, | 174 | .end = 0x11A5F, |
175 | .flags = IORESOURCE_MEM, | 175 | .flags = IORESOURCE_MEM, |
176 | }, | 176 | }, |
177 | { | 177 | { |
178 | .name = "scc_pram", | 178 | .name = "pram", |
179 | .start = 0x8200, | 179 | .start = 0x8200, |
180 | .end = 0x82ff, | 180 | .end = 0x82ff, |
181 | .flags = IORESOURCE_MEM, | 181 | .flags = IORESOURCE_MEM, |
@@ -193,13 +193,13 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
193 | .num_resources = 3, | 193 | .num_resources = 3, |
194 | .resource = (struct resource[]) { | 194 | .resource = (struct resource[]) { |
195 | { | 195 | { |
196 | .name = "scc_mem", | 196 | .name = "regs", |
197 | .start = 0x11A60, | 197 | .start = 0x11A60, |
198 | .end = 0x11A7F, | 198 | .end = 0x11A7F, |
199 | .flags = IORESOURCE_MEM, | 199 | .flags = IORESOURCE_MEM, |
200 | }, | 200 | }, |
201 | { | 201 | { |
202 | .name = "scc_pram", | 202 | .name = "pram", |
203 | .start = 0x8300, | 203 | .start = 0x8300, |
204 | .end = 0x83ff, | 204 | .end = 0x83ff, |
205 | .flags = IORESOURCE_MEM, | 205 | .flags = IORESOURCE_MEM, |
diff --git a/arch/ppc/syslib/pq2_sys.c b/arch/ppc/syslib/pq2_sys.c index 433b0fa203e1..fee8948162b9 100644 --- a/arch/ppc/syslib/pq2_sys.c +++ b/arch/ppc/syslib/pq2_sys.c | |||
@@ -139,13 +139,13 @@ struct ppc_sys_spec ppc_sys_specs[] = { | |||
139 | .ppc_sys_name = "8272", | 139 | .ppc_sys_name = "8272", |
140 | .mask = 0x0000ff00, | 140 | .mask = 0x0000ff00, |
141 | .value = 0x00000c00, | 141 | .value = 0x00000c00, |
142 | .num_devices = 11, | 142 | .num_devices = 12, |
143 | .device_list = (enum ppc_sys_devices[]) | 143 | .device_list = (enum ppc_sys_devices[]) |
144 | { | 144 | { |
145 | MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, | 145 | MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, |
146 | MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SMC1, | 146 | MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SCC4, |
147 | MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, | 147 | MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, |
148 | MPC82xx_CPM_USB, MPC82xx_SEC1, | 148 | MPC82xx_CPM_I2C, MPC82xx_CPM_USB, MPC82xx_SEC1, |
149 | }, | 149 | }, |
150 | }, | 150 | }, |
151 | /* below is a list of the 8280 family of processors */ | 151 | /* below is a list of the 8280 family of processors */ |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index ef5b9c44b86b..4d53b2739357 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1650,3 +1650,11 @@ sys_tee_wrapper: | |||
1650 | llgfr %r4,%r4 # size_t | 1650 | llgfr %r4,%r4 # size_t |
1651 | llgfr %r5,%r5 # unsigned int | 1651 | llgfr %r5,%r5 # unsigned int |
1652 | jg sys_tee | 1652 | jg sys_tee |
1653 | |||
1654 | .globl compat_sys_vmsplice_wrapper | ||
1655 | compat_sys_vmsplice_wrapper: | ||
1656 | lgfr %r2,%r2 # int | ||
1657 | llgtr %r3,%r3 # compat_iovec * | ||
1658 | llgfr %r4,%r4 # unsigned int | ||
1659 | llgfr %r5,%r5 # unsigned int | ||
1660 | jg compat_sys_vmsplice | ||
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index fc2c0767202b..93be1d56c036 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -317,3 +317,4 @@ SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list_wrapp | |||
317 | SYSCALL(sys_splice,sys_splice,sys_splice_wrapper) | 317 | SYSCALL(sys_splice,sys_splice,sys_splice_wrapper) |
318 | SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper) | 318 | SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper) |
319 | SYSCALL(sys_tee,sys_tee,sys_tee_wrapper) | 319 | SYSCALL(sys_tee,sys_tee,sys_tee_wrapper) |
320 | SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper) | ||
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index fea043b69b91..2a6c6efb6865 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -249,18 +249,19 @@ static inline void stop_hz_timer(void) | |||
249 | unsigned long flags; | 249 | unsigned long flags; |
250 | unsigned long seq, next; | 250 | unsigned long seq, next; |
251 | __u64 timer, todval; | 251 | __u64 timer, todval; |
252 | int cpu = smp_processor_id(); | ||
252 | 253 | ||
253 | if (sysctl_hz_timer != 0) | 254 | if (sysctl_hz_timer != 0) |
254 | return; | 255 | return; |
255 | 256 | ||
256 | cpu_set(smp_processor_id(), nohz_cpu_mask); | 257 | cpu_set(cpu, nohz_cpu_mask); |
257 | 258 | ||
258 | /* | 259 | /* |
259 | * Leave the clock comparator set up for the next timer | 260 | * Leave the clock comparator set up for the next timer |
260 | * tick if either rcu or a softirq is pending. | 261 | * tick if either rcu or a softirq is pending. |
261 | */ | 262 | */ |
262 | if (rcu_pending(smp_processor_id()) || local_softirq_pending()) { | 263 | if (rcu_needs_cpu(cpu) || local_softirq_pending()) { |
263 | cpu_clear(smp_processor_id(), nohz_cpu_mask); | 264 | cpu_clear(cpu, nohz_cpu_mask); |
264 | return; | 265 | return; |
265 | } | 266 | } |
266 | 267 | ||
@@ -271,7 +272,7 @@ static inline void stop_hz_timer(void) | |||
271 | next = next_timer_interrupt(); | 272 | next = next_timer_interrupt(); |
272 | do { | 273 | do { |
273 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 274 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
274 | timer = (__u64)(next - jiffies) + jiffies_64; | 275 | timer = ((__u64) next) - ((__u64) jiffies) + jiffies_64; |
275 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 276 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
276 | todval = -1ULL; | 277 | todval = -1ULL; |
277 | /* Be careful about overflows. */ | 278 | /* Be careful about overflows. */ |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 460f72e640e6..f9ff29734848 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -274,6 +274,11 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp) | |||
274 | if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0) | 274 | if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0) |
275 | goto err_noiommu; | 275 | goto err_noiommu; |
276 | 276 | ||
277 | /* Set the resource name, if known. */ | ||
278 | if (sdev) { | ||
279 | res->name = sdev->prom_name; | ||
280 | } | ||
281 | |||
277 | return (void *)res->start; | 282 | return (void *)res->start; |
278 | 283 | ||
279 | err_noiommu: | 284 | err_noiommu: |
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index 787d5f1347ec..598682f31ebf 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c | |||
@@ -113,6 +113,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, | |||
113 | 113 | ||
114 | switch (ELF32_R_TYPE(rel[i].r_info)) { | 114 | switch (ELF32_R_TYPE(rel[i].r_info)) { |
115 | case R_SPARC_32: | 115 | case R_SPARC_32: |
116 | case R_SPARC_UA32: | ||
116 | location[0] = v >> 24; | 117 | location[0] = v >> 24; |
117 | location[1] = v >> 16; | 118 | location[1] = v >> 16; |
118 | location[2] = v >> 8; | 119 | location[2] = v >> 8; |
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp.c index a93f5da6855d..40b42c88e6a7 100644 --- a/arch/sparc/kernel/smp.c +++ b/arch/sparc/kernel/smp.c | |||
@@ -69,6 +69,17 @@ void __init smp_store_cpu_info(int id) | |||
69 | "clock-frequency", 0); | 69 | "clock-frequency", 0); |
70 | cpu_data(id).prom_node = cpu_node; | 70 | cpu_data(id).prom_node = cpu_node; |
71 | cpu_data(id).mid = cpu_get_hwmid(cpu_node); | 71 | cpu_data(id).mid = cpu_get_hwmid(cpu_node); |
72 | |||
73 | /* this is required to tune the scheduler correctly */ | ||
74 | /* is it possible to have CPUs with different cache sizes? */ | ||
75 | if (id == boot_cpu_id) { | ||
76 | int cache_line,cache_nlines; | ||
77 | cache_line = 0x20; | ||
78 | cache_line = prom_getintdefault(cpu_node, "ecache-line-size", cache_line); | ||
79 | cache_nlines = 0x8000; | ||
80 | cache_nlines = prom_getintdefault(cpu_node, "ecache-nlines", cache_nlines); | ||
81 | max_cache_size = cache_line * cache_nlines; | ||
82 | } | ||
72 | if (cpu_data(id).mid < 0) | 83 | if (cpu_data(id).mid < 0) |
73 | panic("No MID found for CPU%d at node 0x%08d", id, cpu_node); | 84 | panic("No MID found for CPU%d at node 0x%08d", id, cpu_node); |
74 | } | 85 | } |
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index ec1c9687d679..4b376fae752c 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c | |||
@@ -251,19 +251,9 @@ EXPORT_SYMBOL(__prom_getchild); | |||
251 | EXPORT_SYMBOL(__prom_getsibling); | 251 | EXPORT_SYMBOL(__prom_getsibling); |
252 | 252 | ||
253 | /* sparc library symbols */ | 253 | /* sparc library symbols */ |
254 | EXPORT_SYMBOL(memchr); | ||
255 | EXPORT_SYMBOL(memscan); | 254 | EXPORT_SYMBOL(memscan); |
256 | EXPORT_SYMBOL(strlen); | 255 | EXPORT_SYMBOL(strlen); |
257 | EXPORT_SYMBOL(strnlen); | ||
258 | EXPORT_SYMBOL(strcpy); | ||
259 | EXPORT_SYMBOL(strncpy); | ||
260 | EXPORT_SYMBOL(strcat); | ||
261 | EXPORT_SYMBOL(strncat); | ||
262 | EXPORT_SYMBOL(strcmp); | ||
263 | EXPORT_SYMBOL(strncmp); | 256 | EXPORT_SYMBOL(strncmp); |
264 | EXPORT_SYMBOL(strchr); | ||
265 | EXPORT_SYMBOL(strrchr); | ||
266 | EXPORT_SYMBOL(strstr); | ||
267 | EXPORT_SYMBOL(page_kernel); | 257 | EXPORT_SYMBOL(page_kernel); |
268 | 258 | ||
269 | /* Special internal versions of library functions. */ | 259 | /* Special internal versions of library functions. */ |
@@ -317,6 +307,3 @@ EXPORT_SYMBOL(do_BUG); | |||
317 | 307 | ||
318 | /* Sun Power Management Idle Handler */ | 308 | /* Sun Power Management Idle Handler */ |
319 | EXPORT_SYMBOL(pm_idle); | 309 | EXPORT_SYMBOL(pm_idle); |
320 | |||
321 | /* Binfmt_misc needs this */ | ||
322 | EXPORT_SYMBOL(sys_close); | ||
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S index 6e1135cc03b0..2856551bddf1 100644 --- a/arch/sparc/kernel/systbls.S +++ b/arch/sparc/kernel/systbls.S | |||
@@ -79,6 +79,7 @@ sys_call_table: | |||
79 | /*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64 | 79 | /*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64 |
80 | /*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat | 80 | /*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat |
81 | /*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare | 81 | /*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare |
82 | /*300*/ .long sys_set_robust_list, sys_get_robust_list | ||
82 | 83 | ||
83 | #ifdef CONFIG_SUNOS_EMUL | 84 | #ifdef CONFIG_SUNOS_EMUL |
84 | /* Now the SunOS syscall table. */ | 85 | /* Now the SunOS syscall table. */ |
@@ -190,6 +191,6 @@ sunos_sys_table: | |||
190 | /*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys | 191 | /*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys |
191 | .long sunos_nosys, sunos_nosys, sunos_nosys | 192 | .long sunos_nosys, sunos_nosys, sunos_nosys |
192 | .long sunos_nosys, sunos_nosys, sunos_nosys | 193 | .long sunos_nosys, sunos_nosys, sunos_nosys |
193 | .long sunos_nosys | 194 | .long sunos_nosys, sunos_nosys, sunos_nosys |
194 | 195 | ||
195 | #endif | 196 | #endif |
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index 1317380fa937..f09a70b8aabd 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.16 | 3 | # Linux kernel version: 2.6.17-rc3 |
4 | # Sun Apr 2 19:31:04 2006 | 4 | # Fri May 12 12:43:49 2006 |
5 | # | 5 | # |
6 | CONFIG_SPARC=y | 6 | CONFIG_SPARC=y |
7 | CONFIG_SPARC64=y | 7 | CONFIG_SPARC64=y |
@@ -114,6 +114,7 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y | |||
114 | CONFIG_HUGETLB_PAGE_SIZE_4MB=y | 114 | CONFIG_HUGETLB_PAGE_SIZE_4MB=y |
115 | # CONFIG_HUGETLB_PAGE_SIZE_512K is not set | 115 | # CONFIG_HUGETLB_PAGE_SIZE_512K is not set |
116 | # CONFIG_HUGETLB_PAGE_SIZE_64K is not set | 116 | # CONFIG_HUGETLB_PAGE_SIZE_64K is not set |
117 | CONFIG_ARCH_SELECT_MEMORY_MODEL=y | ||
117 | CONFIG_ARCH_SPARSEMEM_ENABLE=y | 118 | CONFIG_ARCH_SPARSEMEM_ENABLE=y |
118 | CONFIG_ARCH_SPARSEMEM_DEFAULT=y | 119 | CONFIG_ARCH_SPARSEMEM_DEFAULT=y |
119 | CONFIG_LARGE_ALLOCS=y | 120 | CONFIG_LARGE_ALLOCS=y |
@@ -430,7 +431,6 @@ CONFIG_ISCSI_TCP=m | |||
430 | # CONFIG_SCSI_INIA100 is not set | 431 | # CONFIG_SCSI_INIA100 is not set |
431 | # CONFIG_SCSI_SYM53C8XX_2 is not set | 432 | # CONFIG_SCSI_SYM53C8XX_2 is not set |
432 | # CONFIG_SCSI_IPR is not set | 433 | # CONFIG_SCSI_IPR is not set |
433 | # CONFIG_SCSI_QLOGIC_FC is not set | ||
434 | # CONFIG_SCSI_QLOGIC_1280 is not set | 434 | # CONFIG_SCSI_QLOGIC_1280 is not set |
435 | # CONFIG_SCSI_QLOGICPTI is not set | 435 | # CONFIG_SCSI_QLOGICPTI is not set |
436 | # CONFIG_SCSI_QLA_FC is not set | 436 | # CONFIG_SCSI_QLA_FC is not set |
@@ -1042,9 +1042,7 @@ CONFIG_USB_HIDDEV=y | |||
1042 | # CONFIG_USB_ACECAD is not set | 1042 | # CONFIG_USB_ACECAD is not set |
1043 | # CONFIG_USB_KBTAB is not set | 1043 | # CONFIG_USB_KBTAB is not set |
1044 | # CONFIG_USB_POWERMATE is not set | 1044 | # CONFIG_USB_POWERMATE is not set |
1045 | # CONFIG_USB_MTOUCH is not set | 1045 | # CONFIG_USB_TOUCHSCREEN is not set |
1046 | # CONFIG_USB_ITMTOUCH is not set | ||
1047 | # CONFIG_USB_EGALAX is not set | ||
1048 | # CONFIG_USB_YEALINK is not set | 1046 | # CONFIG_USB_YEALINK is not set |
1049 | # CONFIG_USB_XPAD is not set | 1047 | # CONFIG_USB_XPAD is not set |
1050 | # CONFIG_USB_ATI_REMOTE is not set | 1048 | # CONFIG_USB_ATI_REMOTE is not set |
@@ -1115,6 +1113,14 @@ CONFIG_USB_HIDDEV=y | |||
1115 | # CONFIG_NEW_LEDS is not set | 1113 | # CONFIG_NEW_LEDS is not set |
1116 | 1114 | ||
1117 | # | 1115 | # |
1116 | # LED drivers | ||
1117 | # | ||
1118 | |||
1119 | # | ||
1120 | # LED Triggers | ||
1121 | # | ||
1122 | |||
1123 | # | ||
1118 | # InfiniBand support | 1124 | # InfiniBand support |
1119 | # | 1125 | # |
1120 | # CONFIG_INFINIBAND is not set | 1126 | # CONFIG_INFINIBAND is not set |
@@ -1303,6 +1309,7 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
1303 | # CONFIG_DEBUG_INFO is not set | 1309 | # CONFIG_DEBUG_INFO is not set |
1304 | CONFIG_DEBUG_FS=y | 1310 | CONFIG_DEBUG_FS=y |
1305 | # CONFIG_DEBUG_VM is not set | 1311 | # CONFIG_DEBUG_VM is not set |
1312 | # CONFIG_UNWIND_INFO is not set | ||
1306 | CONFIG_FORCED_INLINING=y | 1313 | CONFIG_FORCED_INLINING=y |
1307 | # CONFIG_RCU_TORTURE_TEST is not set | 1314 | # CONFIG_RCU_TORTURE_TEST is not set |
1308 | # CONFIG_DEBUG_STACK_USAGE is not set | 1315 | # CONFIG_DEBUG_STACK_USAGE is not set |
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S index 3eadac5e171e..31c5892f5acc 100644 --- a/arch/sparc64/kernel/head.S +++ b/arch/sparc64/kernel/head.S | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | #include <linux/version.h> | 11 | #include <linux/version.h> |
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/threads.h> | ||
13 | #include <asm/thread_info.h> | 14 | #include <asm/thread_info.h> |
14 | #include <asm/asi.h> | 15 | #include <asm/asi.h> |
15 | #include <asm/pstate.h> | 16 | #include <asm/pstate.h> |
@@ -493,6 +494,35 @@ tlb_fixup_done: | |||
493 | call prom_init | 494 | call prom_init |
494 | mov %l7, %o0 ! OpenPROM cif handler | 495 | mov %l7, %o0 ! OpenPROM cif handler |
495 | 496 | ||
497 | /* Initialize current_thread_info()->cpu as early as possible. | ||
498 | * In order to do that accurately we have to patch up the get_cpuid() | ||
499 | * assembler sequences. And that, in turn, requires that we know | ||
500 | * if we are on a Starfire box or not. While we're here, patch up | ||
501 | * the sun4v sequences as well. | ||
502 | */ | ||
503 | call check_if_starfire | ||
504 | nop | ||
505 | call per_cpu_patch | ||
506 | nop | ||
507 | call sun4v_patch | ||
508 | nop | ||
509 | |||
510 | #ifdef CONFIG_SMP | ||
511 | call hard_smp_processor_id | ||
512 | nop | ||
513 | cmp %o0, NR_CPUS | ||
514 | blu,pt %xcc, 1f | ||
515 | nop | ||
516 | call boot_cpu_id_too_large | ||
517 | nop | ||
518 | /* Not reached... */ | ||
519 | |||
520 | 1: | ||
521 | #else | ||
522 | mov 0, %o0 | ||
523 | #endif | ||
524 | stb %o0, [%g6 + TI_CPU] | ||
525 | |||
496 | /* Off we go.... */ | 526 | /* Off we go.... */ |
497 | call start_kernel | 527 | call start_kernel |
498 | nop | 528 | nop |
diff --git a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c index 6c83e372f75d..579871527699 100644 --- a/arch/sparc64/kernel/module.c +++ b/arch/sparc64/kernel/module.c | |||
@@ -143,6 +143,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
143 | location[3] = v >> 0; | 143 | location[3] = v >> 0; |
144 | break; | 144 | break; |
145 | 145 | ||
146 | case R_SPARC_DISP32: | ||
147 | v -= (Elf64_Addr) location; | ||
148 | *loc32 = v; | ||
149 | break; | ||
150 | |||
146 | case R_SPARC_WDISP30: | 151 | case R_SPARC_WDISP30: |
147 | v -= (Elf64_Addr) location; | 152 | v -= (Elf64_Addr) location; |
148 | *loc32 = (*loc32 & ~0x3fffffff) | | 153 | *loc32 = (*loc32 & ~0x3fffffff) | |
diff --git a/arch/sparc64/kernel/pci_iommu.c b/arch/sparc64/kernel/pci_iommu.c index 8efbc139769d..82e5455134c6 100644 --- a/arch/sparc64/kernel/pci_iommu.c +++ b/arch/sparc64/kernel/pci_iommu.c | |||
@@ -218,7 +218,7 @@ static inline void iommu_free_ctx(struct pci_iommu *iommu, int ctx) | |||
218 | * DMA for PCI device PDEV. Return non-NULL cpu-side address if | 218 | * DMA for PCI device PDEV. Return non-NULL cpu-side address if |
219 | * successful and set *DMA_ADDRP to the PCI side dma address. | 219 | * successful and set *DMA_ADDRP to the PCI side dma address. |
220 | */ | 220 | */ |
221 | static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) | 221 | static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp) |
222 | { | 222 | { |
223 | struct pcidev_cookie *pcp; | 223 | struct pcidev_cookie *pcp; |
224 | struct pci_iommu *iommu; | 224 | struct pci_iommu *iommu; |
@@ -232,7 +232,7 @@ static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr | |||
232 | if (order >= 10) | 232 | if (order >= 10) |
233 | return NULL; | 233 | return NULL; |
234 | 234 | ||
235 | first_page = __get_free_pages(GFP_ATOMIC, order); | 235 | first_page = __get_free_pages(gfp, order); |
236 | if (first_page == 0UL) | 236 | if (first_page == 0UL) |
237 | return NULL; | 237 | return NULL; |
238 | memset((char *)first_page, 0, PAGE_SIZE << order); | 238 | memset((char *)first_page, 0, PAGE_SIZE << order); |
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 9e94db2573a2..0c0895202970 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c | |||
@@ -154,7 +154,7 @@ static void pci_arena_free(struct pci_iommu_arena *arena, unsigned long base, un | |||
154 | __clear_bit(i, arena->map); | 154 | __clear_bit(i, arena->map); |
155 | } | 155 | } |
156 | 156 | ||
157 | static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) | 157 | static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp) |
158 | { | 158 | { |
159 | struct pcidev_cookie *pcp; | 159 | struct pcidev_cookie *pcp; |
160 | struct pci_iommu *iommu; | 160 | struct pci_iommu *iommu; |
@@ -169,7 +169,7 @@ static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr | |||
169 | 169 | ||
170 | npages = size >> IO_PAGE_SHIFT; | 170 | npages = size >> IO_PAGE_SHIFT; |
171 | 171 | ||
172 | first_page = __get_free_pages(GFP_ATOMIC, order); | 172 | first_page = __get_free_pages(gfp, order); |
173 | if (unlikely(first_page == 0UL)) | 173 | if (unlikely(first_page == 0UL)) |
174 | return NULL; | 174 | return NULL; |
175 | 175 | ||
@@ -599,18 +599,128 @@ struct pci_iommu_ops pci_sun4v_iommu_ops = { | |||
599 | 599 | ||
600 | /* SUN4V PCI configuration space accessors. */ | 600 | /* SUN4V PCI configuration space accessors. */ |
601 | 601 | ||
602 | static inline int pci_sun4v_out_of_range(struct pci_pbm_info *pbm, unsigned int bus, unsigned int device, unsigned int func) | 602 | struct pdev_entry { |
603 | struct pdev_entry *next; | ||
604 | u32 devhandle; | ||
605 | unsigned int bus; | ||
606 | unsigned int device; | ||
607 | unsigned int func; | ||
608 | }; | ||
609 | |||
610 | #define PDEV_HTAB_SIZE 16 | ||
611 | #define PDEV_HTAB_MASK (PDEV_HTAB_SIZE - 1) | ||
612 | static struct pdev_entry *pdev_htab[PDEV_HTAB_SIZE]; | ||
613 | |||
614 | static inline unsigned int pdev_hashfn(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func) | ||
603 | { | 615 | { |
604 | if (bus == pbm->pci_first_busno) { | 616 | unsigned int val; |
605 | if (device == 0 && func == 0) | 617 | |
606 | return 0; | 618 | val = (devhandle ^ (devhandle >> 4)); |
607 | return 1; | 619 | val ^= bus; |
620 | val ^= device; | ||
621 | val ^= func; | ||
622 | |||
623 | return val & PDEV_HTAB_MASK; | ||
624 | } | ||
625 | |||
626 | static int pdev_htab_add(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func) | ||
627 | { | ||
628 | struct pdev_entry *p = kmalloc(sizeof(*p), GFP_KERNEL); | ||
629 | struct pdev_entry **slot; | ||
630 | |||
631 | if (!p) | ||
632 | return -ENOMEM; | ||
633 | |||
634 | slot = &pdev_htab[pdev_hashfn(devhandle, bus, device, func)]; | ||
635 | p->next = *slot; | ||
636 | *slot = p; | ||
637 | |||
638 | p->devhandle = devhandle; | ||
639 | p->bus = bus; | ||
640 | p->device = device; | ||
641 | p->func = func; | ||
642 | |||
643 | return 0; | ||
644 | } | ||
645 | |||
646 | /* Recursively descend into the OBP device tree, rooted at toplevel_node, | ||
647 | * looking for a PCI device matching bus and devfn. | ||
648 | */ | ||
649 | static int obp_find(struct linux_prom_pci_registers *pregs, int toplevel_node, unsigned int bus, unsigned int devfn) | ||
650 | { | ||
651 | toplevel_node = prom_getchild(toplevel_node); | ||
652 | |||
653 | while (toplevel_node != 0) { | ||
654 | int ret = obp_find(pregs, toplevel_node, bus, devfn); | ||
655 | |||
656 | if (ret != 0) | ||
657 | return ret; | ||
658 | |||
659 | ret = prom_getproperty(toplevel_node, "reg", (char *) pregs, | ||
660 | sizeof(*pregs) * PROMREG_MAX); | ||
661 | if (ret == 0 || ret == -1) | ||
662 | goto next_sibling; | ||
663 | |||
664 | if (((pregs[0].phys_hi >> 16) & 0xff) == bus && | ||
665 | ((pregs[0].phys_hi >> 8) & 0xff) == devfn) | ||
666 | break; | ||
667 | |||
668 | next_sibling: | ||
669 | toplevel_node = prom_getsibling(toplevel_node); | ||
670 | } | ||
671 | |||
672 | return toplevel_node; | ||
673 | } | ||
674 | |||
675 | static int pdev_htab_populate(struct pci_pbm_info *pbm) | ||
676 | { | ||
677 | struct linux_prom_pci_registers pr[PROMREG_MAX]; | ||
678 | u32 devhandle = pbm->devhandle; | ||
679 | unsigned int bus; | ||
680 | |||
681 | for (bus = pbm->pci_first_busno; bus <= pbm->pci_last_busno; bus++) { | ||
682 | unsigned int devfn; | ||
683 | |||
684 | for (devfn = 0; devfn < 256; devfn++) { | ||
685 | unsigned int device = PCI_SLOT(devfn); | ||
686 | unsigned int func = PCI_FUNC(devfn); | ||
687 | |||
688 | if (obp_find(pr, pbm->prom_node, bus, devfn)) { | ||
689 | int err = pdev_htab_add(devhandle, bus, | ||
690 | device, func); | ||
691 | if (err) | ||
692 | return err; | ||
693 | } | ||
694 | } | ||
695 | } | ||
696 | |||
697 | return 0; | ||
698 | } | ||
699 | |||
700 | static struct pdev_entry *pdev_find(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func) | ||
701 | { | ||
702 | struct pdev_entry *p; | ||
703 | |||
704 | p = pdev_htab[pdev_hashfn(devhandle, bus, device, func)]; | ||
705 | while (p) { | ||
706 | if (p->devhandle == devhandle && | ||
707 | p->bus == bus && | ||
708 | p->device == device && | ||
709 | p->func == func) | ||
710 | break; | ||
711 | |||
712 | p = p->next; | ||
608 | } | 713 | } |
609 | 714 | ||
715 | return p; | ||
716 | } | ||
717 | |||
718 | static inline int pci_sun4v_out_of_range(struct pci_pbm_info *pbm, unsigned int bus, unsigned int device, unsigned int func) | ||
719 | { | ||
610 | if (bus < pbm->pci_first_busno || | 720 | if (bus < pbm->pci_first_busno || |
611 | bus > pbm->pci_last_busno) | 721 | bus > pbm->pci_last_busno) |
612 | return 1; | 722 | return 1; |
613 | return 0; | 723 | return pdev_find(pbm->devhandle, bus, device, func) == NULL; |
614 | } | 724 | } |
615 | 725 | ||
616 | static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, | 726 | static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, |
@@ -1063,6 +1173,8 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, int prom_node, u32 | |||
1063 | 1173 | ||
1064 | pci_sun4v_get_bus_range(pbm); | 1174 | pci_sun4v_get_bus_range(pbm); |
1065 | pci_sun4v_iommu_init(pbm); | 1175 | pci_sun4v_iommu_init(pbm); |
1176 | |||
1177 | pdev_htab_populate(pbm); | ||
1066 | } | 1178 | } |
1067 | 1179 | ||
1068 | void sun4v_pci_init(int node, char *model_name) | 1180 | void sun4v_pci_init(int node, char *model_name) |
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index 005167f82419..9cf1c88cd774 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c | |||
@@ -220,7 +220,7 @@ char reboot_command[COMMAND_LINE_SIZE]; | |||
220 | 220 | ||
221 | static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 }; | 221 | static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 }; |
222 | 222 | ||
223 | static void __init per_cpu_patch(void) | 223 | void __init per_cpu_patch(void) |
224 | { | 224 | { |
225 | struct cpuid_patch_entry *p; | 225 | struct cpuid_patch_entry *p; |
226 | unsigned long ver; | 226 | unsigned long ver; |
@@ -280,7 +280,7 @@ static void __init per_cpu_patch(void) | |||
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | static void __init sun4v_patch(void) | 283 | void __init sun4v_patch(void) |
284 | { | 284 | { |
285 | struct sun4v_1insn_patch_entry *p1; | 285 | struct sun4v_1insn_patch_entry *p1; |
286 | struct sun4v_2insn_patch_entry *p2; | 286 | struct sun4v_2insn_patch_entry *p2; |
@@ -315,6 +315,15 @@ static void __init sun4v_patch(void) | |||
315 | } | 315 | } |
316 | } | 316 | } |
317 | 317 | ||
318 | #ifdef CONFIG_SMP | ||
319 | void __init boot_cpu_id_too_large(int cpu) | ||
320 | { | ||
321 | prom_printf("Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n", | ||
322 | cpu, NR_CPUS); | ||
323 | prom_halt(); | ||
324 | } | ||
325 | #endif | ||
326 | |||
318 | void __init setup_arch(char **cmdline_p) | 327 | void __init setup_arch(char **cmdline_p) |
319 | { | 328 | { |
320 | /* Initialize PROM console and command line. */ | 329 | /* Initialize PROM console and command line. */ |
@@ -332,16 +341,6 @@ void __init setup_arch(char **cmdline_p) | |||
332 | conswitchp = &prom_con; | 341 | conswitchp = &prom_con; |
333 | #endif | 342 | #endif |
334 | 343 | ||
335 | /* Work out if we are starfire early on */ | ||
336 | check_if_starfire(); | ||
337 | |||
338 | /* Now we know enough to patch the get_cpuid sequences | ||
339 | * used by trap code. | ||
340 | */ | ||
341 | per_cpu_patch(); | ||
342 | |||
343 | sun4v_patch(); | ||
344 | |||
345 | boot_flags_init(*cmdline_p); | 344 | boot_flags_init(*cmdline_p); |
346 | 345 | ||
347 | idprom_init(); | 346 | idprom_init(); |
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 90eaca3ec9a6..f03d52d0b88d 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -1264,7 +1264,6 @@ void __init smp_tick_init(void) | |||
1264 | boot_cpu_id = hard_smp_processor_id(); | 1264 | boot_cpu_id = hard_smp_processor_id(); |
1265 | current_tick_offset = timer_tick_offset; | 1265 | current_tick_offset = timer_tick_offset; |
1266 | 1266 | ||
1267 | cpu_set(boot_cpu_id, cpu_online_map); | ||
1268 | prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1; | 1267 | prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1; |
1269 | } | 1268 | } |
1270 | 1269 | ||
@@ -1288,6 +1287,40 @@ int setup_profiling_timer(unsigned int multiplier) | |||
1288 | return 0; | 1287 | return 0; |
1289 | } | 1288 | } |
1290 | 1289 | ||
1290 | static void __init smp_tune_scheduling(void) | ||
1291 | { | ||
1292 | int instance, node; | ||
1293 | unsigned int def, smallest = ~0U; | ||
1294 | |||
1295 | def = ((tlb_type == hypervisor) ? | ||
1296 | (3 * 1024 * 1024) : | ||
1297 | (4 * 1024 * 1024)); | ||
1298 | |||
1299 | instance = 0; | ||
1300 | while (!cpu_find_by_instance(instance, &node, NULL)) { | ||
1301 | unsigned int val; | ||
1302 | |||
1303 | val = prom_getintdefault(node, "ecache-size", def); | ||
1304 | if (val < smallest) | ||
1305 | smallest = val; | ||
1306 | |||
1307 | instance++; | ||
1308 | } | ||
1309 | |||
1310 | /* Any value less than 256K is nonsense. */ | ||
1311 | if (smallest < (256U * 1024U)) | ||
1312 | smallest = 256 * 1024; | ||
1313 | |||
1314 | max_cache_size = smallest; | ||
1315 | |||
1316 | if (smallest < 1U * 1024U * 1024U) | ||
1317 | printk(KERN_INFO "Using max_cache_size of %uKB\n", | ||
1318 | smallest / 1024U); | ||
1319 | else | ||
1320 | printk(KERN_INFO "Using max_cache_size of %uMB\n", | ||
1321 | smallest / 1024U / 1024U); | ||
1322 | } | ||
1323 | |||
1291 | /* Constrain the number of cpus to max_cpus. */ | 1324 | /* Constrain the number of cpus to max_cpus. */ |
1292 | void __init smp_prepare_cpus(unsigned int max_cpus) | 1325 | void __init smp_prepare_cpus(unsigned int max_cpus) |
1293 | { | 1326 | { |
@@ -1323,6 +1356,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
1323 | } | 1356 | } |
1324 | 1357 | ||
1325 | smp_store_cpu_info(boot_cpu_id); | 1358 | smp_store_cpu_info(boot_cpu_id); |
1359 | smp_tune_scheduling(); | ||
1326 | } | 1360 | } |
1327 | 1361 | ||
1328 | /* Set this up early so that things like the scheduler can init | 1362 | /* Set this up early so that things like the scheduler can init |
@@ -1345,18 +1379,6 @@ void __init smp_setup_cpu_possible_map(void) | |||
1345 | 1379 | ||
1346 | void __devinit smp_prepare_boot_cpu(void) | 1380 | void __devinit smp_prepare_boot_cpu(void) |
1347 | { | 1381 | { |
1348 | int cpu = hard_smp_processor_id(); | ||
1349 | |||
1350 | if (cpu >= NR_CPUS) { | ||
1351 | prom_printf("Serious problem, boot cpu id >= NR_CPUS\n"); | ||
1352 | prom_halt(); | ||
1353 | } | ||
1354 | |||
1355 | current_thread_info()->cpu = cpu; | ||
1356 | __local_per_cpu_offset = __per_cpu_offset(cpu); | ||
1357 | |||
1358 | cpu_set(smp_processor_id(), cpu_online_map); | ||
1359 | cpu_set(smp_processor_id(), phys_cpu_present_map); | ||
1360 | } | 1382 | } |
1361 | 1383 | ||
1362 | int __devinit __cpu_up(unsigned int cpu) | 1384 | int __devinit __cpu_up(unsigned int cpu) |
@@ -1433,4 +1455,7 @@ void __init setup_per_cpu_areas(void) | |||
1433 | 1455 | ||
1434 | for (i = 0; i < NR_CPUS; i++, ptr += size) | 1456 | for (i = 0; i < NR_CPUS; i++, ptr += size) |
1435 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); | 1457 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); |
1458 | |||
1459 | /* Setup %g5 for the boot cpu. */ | ||
1460 | __local_per_cpu_offset = __per_cpu_offset(smp_processor_id()); | ||
1436 | } | 1461 | } |
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index 62d8a99271ea..38e569f786dd 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c | |||
@@ -297,7 +297,6 @@ EXPORT_SYMBOL(svr4_getcontext); | |||
297 | EXPORT_SYMBOL(svr4_setcontext); | 297 | EXPORT_SYMBOL(svr4_setcontext); |
298 | EXPORT_SYMBOL(compat_sys_ioctl); | 298 | EXPORT_SYMBOL(compat_sys_ioctl); |
299 | EXPORT_SYMBOL(sparc32_open); | 299 | EXPORT_SYMBOL(sparc32_open); |
300 | EXPORT_SYMBOL(sys_close); | ||
301 | #endif | 300 | #endif |
302 | 301 | ||
303 | /* Special internal versions of library functions. */ | 302 | /* Special internal versions of library functions. */ |
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index d4b39cd30310..1136fc465e37 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S | |||
@@ -78,8 +78,9 @@ sys_call_table32: | |||
78 | .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid | 78 | .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid |
79 | /*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat | 79 | /*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat |
80 | .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64 | 80 | .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64 |
81 | /*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat | 81 | /*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat |
82 | .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare | 82 | .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare |
83 | /*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list | ||
83 | 84 | ||
84 | #endif /* CONFIG_COMPAT */ | 85 | #endif /* CONFIG_COMPAT */ |
85 | 86 | ||
@@ -147,8 +148,9 @@ sys_call_table: | |||
147 | .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid | 148 | .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid |
148 | /*280*/ .word sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat | 149 | /*280*/ .word sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat |
149 | .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64 | 150 | .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64 |
150 | /*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat | 151 | /*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat |
151 | .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare | 152 | .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare |
153 | /*300*/ .word sys_set_robust_list, sys_get_robust_list | ||
152 | 154 | ||
153 | #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ | 155 | #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ |
154 | defined(CONFIG_SOLARIS_EMUL_MODULE) | 156 | defined(CONFIG_SOLARIS_EMUL_MODULE) |
@@ -261,5 +263,5 @@ sunos_sys_table: | |||
261 | /*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys | 263 | /*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys |
262 | .word sunos_nosys, sunos_nosys, sunos_nosys | 264 | .word sunos_nosys, sunos_nosys, sunos_nosys |
263 | .word sunos_nosys, sunos_nosys, sunos_nosys | 265 | .word sunos_nosys, sunos_nosys, sunos_nosys |
264 | .word sunos_nosys | 266 | .word sunos_nosys, sunos_nosys, sunos_nosys |
265 | #endif | 267 | #endif |
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 2793a5d82380..563db528e031 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c | |||
@@ -1797,7 +1797,9 @@ static const char *sun4v_err_type_to_str(u32 type) | |||
1797 | }; | 1797 | }; |
1798 | } | 1798 | } |
1799 | 1799 | ||
1800 | static void sun4v_log_error(struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt) | 1800 | extern void __show_regs(struct pt_regs * regs); |
1801 | |||
1802 | static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt) | ||
1801 | { | 1803 | { |
1802 | int cnt; | 1804 | int cnt; |
1803 | 1805 | ||
@@ -1830,6 +1832,8 @@ static void sun4v_log_error(struct sun4v_error_entry *ent, int cpu, const char * | |||
1830 | pfx, | 1832 | pfx, |
1831 | ent->err_raddr, ent->err_size, ent->err_cpu); | 1833 | ent->err_raddr, ent->err_size, ent->err_cpu); |
1832 | 1834 | ||
1835 | __show_regs(regs); | ||
1836 | |||
1833 | if ((cnt = atomic_read(ocnt)) != 0) { | 1837 | if ((cnt = atomic_read(ocnt)) != 0) { |
1834 | atomic_set(ocnt, 0); | 1838 | atomic_set(ocnt, 0); |
1835 | wmb(); | 1839 | wmb(); |
@@ -1862,7 +1866,7 @@ void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) | |||
1862 | 1866 | ||
1863 | put_cpu(); | 1867 | put_cpu(); |
1864 | 1868 | ||
1865 | sun4v_log_error(&local_copy, cpu, | 1869 | sun4v_log_error(regs, &local_copy, cpu, |
1866 | KERN_ERR "RESUMABLE ERROR", | 1870 | KERN_ERR "RESUMABLE ERROR", |
1867 | &sun4v_resum_oflow_cnt); | 1871 | &sun4v_resum_oflow_cnt); |
1868 | } | 1872 | } |
@@ -1910,7 +1914,7 @@ void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset) | |||
1910 | } | 1914 | } |
1911 | #endif | 1915 | #endif |
1912 | 1916 | ||
1913 | sun4v_log_error(&local_copy, cpu, | 1917 | sun4v_log_error(regs, &local_copy, cpu, |
1914 | KERN_EMERG "NON-RESUMABLE ERROR", | 1918 | KERN_EMERG "NON-RESUMABLE ERROR", |
1915 | &sun4v_nonresum_oflow_cnt); | 1919 | &sun4v_nonresum_oflow_cnt); |
1916 | 1920 | ||
@@ -2200,7 +2204,6 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw) | |||
2200 | void die_if_kernel(char *str, struct pt_regs *regs) | 2204 | void die_if_kernel(char *str, struct pt_regs *regs) |
2201 | { | 2205 | { |
2202 | static int die_counter; | 2206 | static int die_counter; |
2203 | extern void __show_regs(struct pt_regs * regs); | ||
2204 | extern void smp_report_regs(void); | 2207 | extern void smp_report_regs(void); |
2205 | int count = 0; | 2208 | int count = 0; |
2206 | 2209 | ||
diff --git a/arch/sparc64/lib/checksum.S b/arch/sparc64/lib/checksum.S index ba9cd3ccc2b2..1d230f693dc4 100644 --- a/arch/sparc64/lib/checksum.S +++ b/arch/sparc64/lib/checksum.S | |||
@@ -165,8 +165,9 @@ csum_partial_end_cruft: | |||
165 | sll %g1, 8, %g1 | 165 | sll %g1, 8, %g1 |
166 | or %o5, %g1, %o4 | 166 | or %o5, %g1, %o4 |
167 | 167 | ||
168 | 1: add %o2, %o4, %o2 | 168 | 1: addcc %o2, %o4, %o2 |
169 | addc %g0, %o2, %o2 | ||
169 | 170 | ||
170 | csum_partial_finish: | 171 | csum_partial_finish: |
171 | retl | 172 | retl |
172 | mov %o2, %o0 | 173 | srl %o2, 0, %o0 |
diff --git a/arch/sparc64/lib/csum_copy.S b/arch/sparc64/lib/csum_copy.S index 71af48839064..e566c770a0f6 100644 --- a/arch/sparc64/lib/csum_copy.S +++ b/arch/sparc64/lib/csum_copy.S | |||
@@ -221,11 +221,12 @@ FUNC_NAME: /* %o0=src, %o1=dst, %o2=len, %o3=sum */ | |||
221 | sll %g1, 8, %g1 | 221 | sll %g1, 8, %g1 |
222 | or %o5, %g1, %o4 | 222 | or %o5, %g1, %o4 |
223 | 223 | ||
224 | 1: add %o3, %o4, %o3 | 224 | 1: addcc %o3, %o4, %o3 |
225 | addc %g0, %o3, %o3 | ||
225 | 226 | ||
226 | 70: | 227 | 70: |
227 | retl | 228 | retl |
228 | mov %o3, %o0 | 229 | srl %o3, 0, %o0 |
229 | 230 | ||
230 | 95: mov 0, GLOBAL_SPARE | 231 | 95: mov 0, GLOBAL_SPARE |
231 | brlez,pn %o2, 4f | 232 | brlez,pn %o2, 4f |
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 index 7a0e04e34bf9..b65ca115ef77 100644 --- a/arch/um/Makefile-i386 +++ b/arch/um/Makefile-i386 | |||
@@ -33,5 +33,9 @@ include $(srctree)/arch/i386/Makefile.cpu | |||
33 | # prevent gcc from keeping the stack 16 byte aligned. Taken from i386. | 33 | # prevent gcc from keeping the stack 16 byte aligned. Taken from i386. |
34 | cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) | 34 | cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) |
35 | 35 | ||
36 | # Prevent sprintf in nfsd from being converted to strcpy and resulting in | ||
37 | # an unresolved reference. | ||
38 | cflags-y += -ffreestanding | ||
39 | |||
36 | CFLAGS += $(cflags-y) | 40 | CFLAGS += $(cflags-y) |
37 | USER_CFLAGS += $(cflags-y) | 41 | USER_CFLAGS += $(cflags-y) |
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h index efa3d33c0be6..310980b32173 100644 --- a/arch/um/include/kern_util.h +++ b/arch/um/include/kern_util.h | |||
@@ -120,20 +120,11 @@ extern int is_syscall(unsigned long addr); | |||
120 | extern void free_irq(unsigned int, void *); | 120 | extern void free_irq(unsigned int, void *); |
121 | extern int cpu(void); | 121 | extern int cpu(void); |
122 | 122 | ||
123 | extern void time_init_kern(void); | ||
124 | |||
123 | /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ | 125 | /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ |
124 | extern int __cant_sleep(void); | 126 | extern int __cant_sleep(void); |
125 | extern void segv_handler(int sig, union uml_pt_regs *regs); | 127 | extern void segv_handler(int sig, union uml_pt_regs *regs); |
126 | extern void sigio_handler(int sig, union uml_pt_regs *regs); | 128 | extern void sigio_handler(int sig, union uml_pt_regs *regs); |
127 | 129 | ||
128 | #endif | 130 | #endif |
129 | |||
130 | /* | ||
131 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
132 | * Emacs will notice this stuff at the end of the file and automatically | ||
133 | * adjust the settings for this buffer only. This must remain at the end | ||
134 | * of the file. | ||
135 | * --------------------------------------------------------------------------- | ||
136 | * Local variables: | ||
137 | * c-file-style: "linux" | ||
138 | * End: | ||
139 | */ | ||
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c index 528cf623f8b4..86f51d04c98d 100644 --- a/arch/um/kernel/time_kern.c +++ b/arch/um/kernel/time_kern.c | |||
@@ -84,6 +84,16 @@ void timer_irq(union uml_pt_regs *regs) | |||
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | |||
88 | void time_init_kern(void) | ||
89 | { | ||
90 | unsigned long long nsecs; | ||
91 | |||
92 | nsecs = os_nsecs(); | ||
93 | set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION, | ||
94 | -nsecs % BILLION); | ||
95 | } | ||
96 | |||
87 | void do_boot_timer_handler(struct sigcontext * sc) | 97 | void do_boot_timer_handler(struct sigcontext * sc) |
88 | { | 98 | { |
89 | struct pt_regs regs; | 99 | struct pt_regs regs; |
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index 3a0ac38e978b..90912aaca7aa 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c | |||
@@ -59,7 +59,7 @@ static __init void do_uml_initcalls(void) | |||
59 | initcall_t *call; | 59 | initcall_t *call; |
60 | 60 | ||
61 | call = &__uml_initcall_start; | 61 | call = &__uml_initcall_start; |
62 | while (call < &__uml_initcall_end){; | 62 | while (call < &__uml_initcall_end){ |
63 | (*call)(); | 63 | (*call)(); |
64 | call++; | 64 | call++; |
65 | } | 65 | } |
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index 6f7626775acb..280c4fb9b585 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c | |||
@@ -81,20 +81,12 @@ void uml_idle_timer(void) | |||
81 | set_interval(ITIMER_REAL); | 81 | set_interval(ITIMER_REAL); |
82 | } | 82 | } |
83 | 83 | ||
84 | extern void ktime_get_ts(struct timespec *ts); | ||
85 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) | ||
86 | |||
87 | void time_init(void) | 84 | void time_init(void) |
88 | { | 85 | { |
89 | struct timespec now; | ||
90 | |||
91 | if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR) | 86 | if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR) |
92 | panic("Couldn't set SIGVTALRM handler"); | 87 | panic("Couldn't set SIGVTALRM handler"); |
93 | set_interval(ITIMER_VIRTUAL); | 88 | set_interval(ITIMER_VIRTUAL); |
94 | 89 | time_init_kern(); | |
95 | do_posix_clock_monotonic_gettime(&now); | ||
96 | wall_to_monotonic.tv_sec = -now.tv_sec; | ||
97 | wall_to_monotonic.tv_nsec = -now.tv_nsec; | ||
98 | } | 90 | } |
99 | 91 | ||
100 | unsigned long long os_nsecs(void) | 92 | unsigned long long os_nsecs(void) |
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c index 749dd1bfe60f..710d5fb807e1 100644 --- a/arch/um/sys-i386/syscalls.c +++ b/arch/um/sys-i386/syscalls.c | |||
@@ -99,11 +99,12 @@ long sys_ipc (uint call, int first, int second, | |||
99 | 99 | ||
100 | switch (call) { | 100 | switch (call) { |
101 | case SEMOP: | 101 | case SEMOP: |
102 | return sys_semtimedop(first, (struct sembuf *) ptr, second, | 102 | return sys_semtimedop(first, (struct sembuf __user *) ptr, |
103 | NULL); | 103 | second, NULL); |
104 | case SEMTIMEDOP: | 104 | case SEMTIMEDOP: |
105 | return sys_semtimedop(first, (struct sembuf *) ptr, second, | 105 | return sys_semtimedop(first, (struct sembuf __user *) ptr, |
106 | (const struct timespec *) fifth); | 106 | second, |
107 | (const struct timespec __user *) fifth); | ||
107 | case SEMGET: | 108 | case SEMGET: |
108 | return sys_semget (first, second, third); | 109 | return sys_semget (first, second, third); |
109 | case SEMCTL: { | 110 | case SEMCTL: { |
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index a4c46a8af008..9edf114faf79 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "skas.h" | 21 | #include "skas.h" |
22 | 22 | ||
23 | static int copy_sc_from_user_skas(struct pt_regs *regs, | 23 | static int copy_sc_from_user_skas(struct pt_regs *regs, |
24 | struct sigcontext *from) | 24 | struct sigcontext __user *from) |
25 | { | 25 | { |
26 | int err = 0; | 26 | int err = 0; |
27 | 27 | ||
@@ -54,7 +54,8 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, | |||
54 | return(err); | 54 | return(err); |
55 | } | 55 | } |
56 | 56 | ||
57 | int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, | 57 | int copy_sc_to_user_skas(struct sigcontext __user *to, |
58 | struct _fpstate __user *to_fp, | ||
58 | struct pt_regs *regs, unsigned long mask, | 59 | struct pt_regs *regs, unsigned long mask, |
59 | unsigned long sp) | 60 | unsigned long sp) |
60 | { | 61 | { |
@@ -106,10 +107,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, | |||
106 | #endif | 107 | #endif |
107 | 108 | ||
108 | #ifdef CONFIG_MODE_TT | 109 | #ifdef CONFIG_MODE_TT |
109 | int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, | 110 | int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from, |
110 | int fpsize) | 111 | int fpsize) |
111 | { | 112 | { |
112 | struct _fpstate *to_fp, *from_fp; | 113 | struct _fpstate *to_fp; |
114 | struct _fpstate __user *from_fp; | ||
113 | unsigned long sigs; | 115 | unsigned long sigs; |
114 | int err; | 116 | int err; |
115 | 117 | ||
@@ -124,13 +126,14 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, | |||
124 | return(err); | 126 | return(err); |
125 | } | 127 | } |
126 | 128 | ||
127 | int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, | 129 | int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp, |
128 | struct sigcontext *from, int fpsize, unsigned long sp) | 130 | struct sigcontext *from, int fpsize, unsigned long sp) |
129 | { | 131 | { |
130 | struct _fpstate *to_fp, *from_fp; | 132 | struct _fpstate __user *to_fp; |
133 | struct _fpstate *from_fp; | ||
131 | int err; | 134 | int err; |
132 | 135 | ||
133 | to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); | 136 | to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1)); |
134 | from_fp = from->fpstate; | 137 | from_fp = from->fpstate; |
135 | err = copy_to_user(to, from, sizeof(*to)); | 138 | err = copy_to_user(to, from, sizeof(*to)); |
136 | /* The SP in the sigcontext is the updated one for the signal | 139 | /* The SP in the sigcontext is the updated one for the signal |
@@ -158,7 +161,8 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from) | |||
158 | return(ret); | 161 | return(ret); |
159 | } | 162 | } |
160 | 163 | ||
161 | static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, | 164 | static int copy_sc_to_user(struct sigcontext __user *to, |
165 | struct _fpstate __user *fp, | ||
162 | struct pt_regs *from, unsigned long mask, | 166 | struct pt_regs *from, unsigned long mask, |
163 | unsigned long sp) | 167 | unsigned long sp) |
164 | { | 168 | { |
@@ -169,7 +173,7 @@ static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, | |||
169 | 173 | ||
170 | struct rt_sigframe | 174 | struct rt_sigframe |
171 | { | 175 | { |
172 | char *pretcode; | 176 | char __user *pretcode; |
173 | struct ucontext uc; | 177 | struct ucontext uc; |
174 | struct siginfo info; | 178 | struct siginfo info; |
175 | }; | 179 | }; |
@@ -188,7 +192,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, | |||
188 | 192 | ||
189 | frame = (struct rt_sigframe __user *) | 193 | frame = (struct rt_sigframe __user *) |
190 | round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; | 194 | round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; |
191 | frame = (struct rt_sigframe *) ((unsigned long) frame - 128); | 195 | frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128); |
192 | 196 | ||
193 | if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) | 197 | if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) |
194 | goto out; | 198 | goto out; |
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index 6acee5c4ada6..6fce9f45dfdc 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -45,7 +45,7 @@ static long arch_prctl_tt(int code, unsigned long addr) | |||
45 | case ARCH_GET_GS: | 45 | case ARCH_GET_GS: |
46 | ret = arch_prctl(code, (unsigned long) &tmp); | 46 | ret = arch_prctl(code, (unsigned long) &tmp); |
47 | if(!ret) | 47 | if(!ret) |
48 | ret = put_user(tmp, &addr); | 48 | ret = put_user(tmp, (long __user *)addr); |
49 | break; | 49 | break; |
50 | default: | 50 | default: |
51 | ret = -EINVAL; | 51 | ret = -EINVAL; |
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 408d44a59756..6527a368fb9c 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -299,6 +299,7 @@ config X86_64_ACPI_NUMA | |||
299 | bool "ACPI NUMA detection" | 299 | bool "ACPI NUMA detection" |
300 | depends on NUMA | 300 | depends on NUMA |
301 | select ACPI | 301 | select ACPI |
302 | select PCI | ||
302 | select ACPI_NUMA | 303 | select ACPI_NUMA |
303 | default y | 304 | default y |
304 | help | 305 | help |
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c index e776139afb20..926c4743d13b 100644 --- a/arch/x86_64/ia32/ia32_binfmt.c +++ b/arch/x86_64/ia32/ia32_binfmt.c | |||
@@ -339,7 +339,7 @@ int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, | |||
339 | struct mm_struct *mm = current->mm; | 339 | struct mm_struct *mm = current->mm; |
340 | int i, ret; | 340 | int i, ret; |
341 | 341 | ||
342 | stack_base = IA32_STACK_TOP - MAX_ARG_PAGES * PAGE_SIZE; | 342 | stack_base = stack_top - MAX_ARG_PAGES * PAGE_SIZE; |
343 | mm->arg_start = bprm->p + stack_base; | 343 | mm->arg_start = bprm->p + stack_base; |
344 | 344 | ||
345 | bprm->p += stack_base; | 345 | bprm->p += stack_base; |
@@ -357,7 +357,7 @@ int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, | |||
357 | { | 357 | { |
358 | mpnt->vm_mm = mm; | 358 | mpnt->vm_mm = mm; |
359 | mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p; | 359 | mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p; |
360 | mpnt->vm_end = IA32_STACK_TOP; | 360 | mpnt->vm_end = stack_top; |
361 | if (executable_stack == EXSTACK_ENABLE_X) | 361 | if (executable_stack == EXSTACK_ENABLE_X) |
362 | mpnt->vm_flags = VM_STACK_FLAGS | VM_EXEC; | 362 | mpnt->vm_flags = VM_STACK_FLAGS | VM_EXEC; |
363 | else if (executable_stack == EXSTACK_DISABLE_X) | 363 | else if (executable_stack == EXSTACK_DISABLE_X) |
diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile index 4fe97071f297..080b9963f1bc 100644 --- a/arch/x86_64/kernel/acpi/Makefile +++ b/arch/x86_64/kernel/acpi/Makefile | |||
@@ -4,5 +4,6 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o | |||
4 | 4 | ||
5 | ifneq ($(CONFIG_ACPI_PROCESSOR),) | 5 | ifneq ($(CONFIG_ACPI_PROCESSOR),) |
6 | obj-y += processor.o | 6 | obj-y += processor.o |
7 | processor-y := ../../../i386/kernel/acpi/processor.o ../../../i386/kernel/acpi/cstate.o | ||
7 | endif | 8 | endif |
8 | 9 | ||
diff --git a/arch/x86_64/kernel/acpi/processor.c b/arch/x86_64/kernel/acpi/processor.c deleted file mode 100644 index 3bdc2baa5bb1..000000000000 --- a/arch/x86_64/kernel/acpi/processor.c +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* | ||
2 | * arch/x86_64/kernel/acpi/processor.c | ||
3 | * | ||
4 | * Copyright (C) 2005 Intel Corporation | ||
5 | * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
6 | * - Added _PDC for platforms with Intel CPUs | ||
7 | */ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/acpi.h> | ||
13 | |||
14 | #include <acpi/processor.h> | ||
15 | #include <asm/acpi.h> | ||
16 | |||
17 | static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) | ||
18 | { | ||
19 | struct acpi_object_list *obj_list; | ||
20 | union acpi_object *obj; | ||
21 | u32 *buf; | ||
22 | |||
23 | /* allocate and initialize pdc. It will be used later. */ | ||
24 | obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); | ||
25 | if (!obj_list) { | ||
26 | printk(KERN_ERR "Memory allocation error\n"); | ||
27 | return; | ||
28 | } | ||
29 | |||
30 | obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); | ||
31 | if (!obj) { | ||
32 | printk(KERN_ERR "Memory allocation error\n"); | ||
33 | kfree(obj_list); | ||
34 | return; | ||
35 | } | ||
36 | |||
37 | buf = kmalloc(12, GFP_KERNEL); | ||
38 | if (!buf) { | ||
39 | printk(KERN_ERR "Memory allocation error\n"); | ||
40 | kfree(obj); | ||
41 | kfree(obj_list); | ||
42 | return; | ||
43 | } | ||
44 | |||
45 | buf[0] = ACPI_PDC_REVISION_ID; | ||
46 | buf[1] = 1; | ||
47 | buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; | ||
48 | |||
49 | obj->type = ACPI_TYPE_BUFFER; | ||
50 | obj->buffer.length = 12; | ||
51 | obj->buffer.pointer = (u8 *) buf; | ||
52 | obj_list->count = 1; | ||
53 | obj_list->pointer = obj; | ||
54 | pr->pdc = obj_list; | ||
55 | |||
56 | return; | ||
57 | } | ||
58 | |||
59 | /* Initialize _PDC data based on the CPU vendor */ | ||
60 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | ||
61 | { | ||
62 | unsigned int cpu = pr->id; | ||
63 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
64 | |||
65 | pr->pdc = NULL; | ||
66 | if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST)) | ||
67 | init_intel_pdc(pr, c); | ||
68 | |||
69 | return; | ||
70 | } | ||
71 | |||
72 | EXPORT_SYMBOL(arch_acpi_processor_init_pdc); | ||
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c index 222b5b46d2b2..1ef6028f721e 100644 --- a/arch/x86_64/kernel/e820.c +++ b/arch/x86_64/kernel/e820.c | |||
@@ -149,7 +149,7 @@ unsigned long __init find_e820_area(unsigned long start, unsigned long end, unsi | |||
149 | addr = start; | 149 | addr = start; |
150 | if (addr > ei->addr + ei->size) | 150 | if (addr > ei->addr + ei->size) |
151 | continue; | 151 | continue; |
152 | while (bad_addr(&addr, size) && addr+size < ei->addr + ei->size) | 152 | while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size) |
153 | ; | 153 | ; |
154 | last = addr + size; | 154 | last = addr + size; |
155 | if (last > ei->addr + ei->size) | 155 | if (last > ei->addr + ei->size) |
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index c946e4fe67a7..586b34c00c48 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S | |||
@@ -281,12 +281,7 @@ tracesys: | |||
281 | ja 1f | 281 | ja 1f |
282 | movq %r10,%rcx /* fixup for C */ | 282 | movq %r10,%rcx /* fixup for C */ |
283 | call *sys_call_table(,%rax,8) | 283 | call *sys_call_table(,%rax,8) |
284 | movq %rax,RAX-ARGOFFSET(%rsp) | 284 | 1: movq %rax,RAX-ARGOFFSET(%rsp) |
285 | 1: SAVE_REST | ||
286 | movq %rsp,%rdi | ||
287 | call syscall_trace_leave | ||
288 | RESTORE_TOP_OF_STACK %rbx | ||
289 | RESTORE_REST | ||
290 | /* Use IRET because user could have changed frame */ | 285 | /* Use IRET because user could have changed frame */ |
291 | jmp int_ret_from_sys_call | 286 | jmp int_ret_from_sys_call |
292 | CFI_ENDPROC | 287 | CFI_ENDPROC |
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 0de3ea938830..9cc7031b7151 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -271,6 +271,18 @@ __setup("enable_8254_timer", setup_enable_8254_timer); | |||
271 | #include <linux/pci_ids.h> | 271 | #include <linux/pci_ids.h> |
272 | #include <linux/pci.h> | 272 | #include <linux/pci.h> |
273 | 273 | ||
274 | |||
275 | #ifdef CONFIG_ACPI | ||
276 | |||
277 | static int nvidia_hpet_detected __initdata; | ||
278 | |||
279 | static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) | ||
280 | { | ||
281 | nvidia_hpet_detected = 1; | ||
282 | return 0; | ||
283 | } | ||
284 | #endif | ||
285 | |||
274 | /* Temporary Hack. Nvidia and VIA boards currently only work with IO-APIC | 286 | /* Temporary Hack. Nvidia and VIA boards currently only work with IO-APIC |
275 | off. Check for an Nvidia or VIA PCI bridge and turn it off. | 287 | off. Check for an Nvidia or VIA PCI bridge and turn it off. |
276 | Use pci direct infrastructure because this runs before the PCI subsystem. | 288 | Use pci direct infrastructure because this runs before the PCI subsystem. |
@@ -317,11 +329,19 @@ void __init check_ioapic(void) | |||
317 | return; | 329 | return; |
318 | case PCI_VENDOR_ID_NVIDIA: | 330 | case PCI_VENDOR_ID_NVIDIA: |
319 | #ifdef CONFIG_ACPI | 331 | #ifdef CONFIG_ACPI |
320 | /* All timer overrides on Nvidia | 332 | /* |
321 | seem to be wrong. Skip them. */ | 333 | * All timer overrides on Nvidia are |
322 | acpi_skip_timer_override = 1; | 334 | * wrong unless HPET is enabled. |
323 | printk(KERN_INFO | 335 | */ |
324 | "Nvidia board detected. Ignoring ACPI timer override.\n"); | 336 | nvidia_hpet_detected = 0; |
337 | acpi_table_parse(ACPI_HPET, | ||
338 | nvidia_hpet_check); | ||
339 | if (nvidia_hpet_detected == 0) { | ||
340 | acpi_skip_timer_override = 1; | ||
341 | printk(KERN_INFO "Nvidia board " | ||
342 | "detected. Ignoring ACPI " | ||
343 | "timer override.\n"); | ||
344 | } | ||
325 | #endif | 345 | #endif |
326 | /* RED-PEN skip them on mptables too? */ | 346 | /* RED-PEN skip them on mptables too? */ |
327 | return; | 347 | return; |
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index 1eaa5dae6174..fa1d19ca700a 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c | |||
@@ -514,13 +514,13 @@ static void __kprobes resume_execution(struct kprobe *p, | |||
514 | *tos = orig_rip + (*tos - copy_rip); | 514 | *tos = orig_rip + (*tos - copy_rip); |
515 | break; | 515 | break; |
516 | case 0xff: | 516 | case 0xff: |
517 | if ((*insn & 0x30) == 0x10) { | 517 | if ((insn[1] & 0x30) == 0x10) { |
518 | /* call absolute, indirect */ | 518 | /* call absolute, indirect */ |
519 | /* Fix return addr; rip is correct. */ | 519 | /* Fix return addr; rip is correct. */ |
520 | next_rip = regs->rip; | 520 | next_rip = regs->rip; |
521 | *tos = orig_rip + (*tos - copy_rip); | 521 | *tos = orig_rip + (*tos - copy_rip); |
522 | } else if (((*insn & 0x31) == 0x20) || /* jmp near, absolute indirect */ | 522 | } else if (((insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */ |
523 | ((*insn & 0x31) == 0x21)) { /* jmp far, absolute indirect */ | 523 | ((insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */ |
524 | /* rip is correct. */ | 524 | /* rip is correct. */ |
525 | next_rip = regs->rip; | 525 | next_rip = regs->rip; |
526 | } | 526 | } |
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c index af035ede70cd..a9275c9557cf 100644 --- a/arch/x86_64/kernel/pci-dma.c +++ b/arch/x86_64/kernel/pci-dma.c | |||
@@ -54,6 +54,10 @@ dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order) | |||
54 | else | 54 | else |
55 | #endif | 55 | #endif |
56 | node = numa_node_id(); | 56 | node = numa_node_id(); |
57 | |||
58 | if (node < first_node(node_online_map)) | ||
59 | node = first_node(node_online_map); | ||
60 | |||
57 | page = alloc_pages_node(node, gfp, order); | 61 | page = alloc_pages_node(node, gfp, order); |
58 | return page ? page_address(page) : NULL; | 62 | return page ? page_address(page) : NULL; |
59 | } | 63 | } |
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index 2480d3f08a47..82a7c9bfdfa0 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c | |||
@@ -631,10 +631,8 @@ static int __init pci_iommu_init(void) | |||
631 | printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); | 631 | printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); |
632 | if (end_pfn > MAX_DMA32_PFN) { | 632 | if (end_pfn > MAX_DMA32_PFN) { |
633 | printk(KERN_ERR "WARNING more than 4GB of memory " | 633 | printk(KERN_ERR "WARNING more than 4GB of memory " |
634 | "but IOMMU not compiled in.\n" | 634 | "but IOMMU not available.\n" |
635 | KERN_ERR "WARNING 32bit PCI may malfunction.\n" | 635 | KERN_ERR "WARNING 32bit PCI may malfunction.\n"); |
636 | KERN_ERR "You might want to enable " | ||
637 | "CONFIG_GART_IOMMU\n"); | ||
638 | } | 636 | } |
639 | return -1; | 637 | return -1; |
640 | } | 638 | } |
diff --git a/arch/x86_64/kernel/pci-nommu.c b/arch/x86_64/kernel/pci-nommu.c index 44adcc2d5e5b..1f6ecc62061d 100644 --- a/arch/x86_64/kernel/pci-nommu.c +++ b/arch/x86_64/kernel/pci-nommu.c | |||
@@ -12,9 +12,10 @@ static int | |||
12 | check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) | 12 | check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) |
13 | { | 13 | { |
14 | if (hwdev && bus + size > *hwdev->dma_mask) { | 14 | if (hwdev && bus + size > *hwdev->dma_mask) { |
15 | printk(KERN_ERR | 15 | if (*hwdev->dma_mask >= 0xffffffffULL) |
16 | "nommu_%s: overflow %Lx+%lu of device mask %Lx\n", | 16 | printk(KERN_ERR |
17 | name, (long long)bus, size, (long long)*hwdev->dma_mask); | 17 | "nommu_%s: overflow %Lx+%lu of device mask %Lx\n", |
18 | name, (long long)bus, size, (long long)*hwdev->dma_mask); | ||
18 | return 0; | 19 | return 0; |
19 | } | 20 | } |
20 | return 1; | 21 | return 1; |
diff --git a/arch/x86_64/kernel/pmtimer.c b/arch/x86_64/kernel/pmtimer.c index b0444a415bd6..bf421ed26808 100644 --- a/arch/x86_64/kernel/pmtimer.c +++ b/arch/x86_64/kernel/pmtimer.c | |||
@@ -68,7 +68,7 @@ int pmtimer_mark_offset(void) | |||
68 | offset_delay = delta % (USEC_PER_SEC / HZ); | 68 | offset_delay = delta % (USEC_PER_SEC / HZ); |
69 | 69 | ||
70 | rdtscll(tsc); | 70 | rdtscll(tsc); |
71 | vxtime.last_tsc = tsc - offset_delay * cpu_khz; | 71 | vxtime.last_tsc = tsc - offset_delay * (u64)cpu_khz / 1000; |
72 | 72 | ||
73 | /* don't calculate delay for first run, | 73 | /* don't calculate delay for first run, |
74 | or if we've got less then a tick */ | 74 | or if we've got less then a tick */ |
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index f0870bef24d1..655b9192eeb3 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -1051,7 +1051,7 @@ static void srat_detect_node(void) | |||
1051 | for now. */ | 1051 | for now. */ |
1052 | node = apicid_to_node[hard_smp_processor_id()]; | 1052 | node = apicid_to_node[hard_smp_processor_id()]; |
1053 | if (node == NUMA_NO_NODE) | 1053 | if (node == NUMA_NO_NODE) |
1054 | node = 0; | 1054 | node = first_node(node_online_map); |
1055 | numa_set_node(cpu, node); | 1055 | numa_set_node(cpu, node); |
1056 | 1056 | ||
1057 | if (acpi_numa > 0) | 1057 | if (acpi_numa > 0) |
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 6b87268c5c2e..cea335e8746c 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c | |||
@@ -102,6 +102,8 @@ static inline void preempt_conditional_cli(struct pt_regs *regs) | |||
102 | { | 102 | { |
103 | if (regs->eflags & X86_EFLAGS_IF) | 103 | if (regs->eflags & X86_EFLAGS_IF) |
104 | local_irq_disable(); | 104 | local_irq_disable(); |
105 | /* Make sure to not schedule here because we could be running | ||
106 | on an exception stack. */ | ||
105 | preempt_enable_no_resched(); | 107 | preempt_enable_no_resched(); |
106 | } | 108 | } |
107 | 109 | ||
@@ -483,8 +485,6 @@ static void __kprobes do_trap(int trapnr, int signr, char *str, | |||
483 | { | 485 | { |
484 | struct task_struct *tsk = current; | 486 | struct task_struct *tsk = current; |
485 | 487 | ||
486 | conditional_sti(regs); | ||
487 | |||
488 | tsk->thread.error_code = error_code; | 488 | tsk->thread.error_code = error_code; |
489 | tsk->thread.trap_no = trapnr; | 489 | tsk->thread.trap_no = trapnr; |
490 | 490 | ||
@@ -521,6 +521,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ | |||
521 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ | 521 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ |
522 | == NOTIFY_STOP) \ | 522 | == NOTIFY_STOP) \ |
523 | return; \ | 523 | return; \ |
524 | conditional_sti(regs); \ | ||
524 | do_trap(trapnr, signr, str, regs, error_code, NULL); \ | 525 | do_trap(trapnr, signr, str, regs, error_code, NULL); \ |
525 | } | 526 | } |
526 | 527 | ||
@@ -535,6 +536,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ | |||
535 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ | 536 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ |
536 | == NOTIFY_STOP) \ | 537 | == NOTIFY_STOP) \ |
537 | return; \ | 538 | return; \ |
539 | conditional_sti(regs); \ | ||
538 | do_trap(trapnr, signr, str, regs, error_code, &info); \ | 540 | do_trap(trapnr, signr, str, regs, error_code, &info); \ |
539 | } | 541 | } |
540 | 542 | ||
@@ -548,7 +550,17 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) | |||
548 | DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) | 550 | DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) |
549 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) | 551 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) |
550 | DO_ERROR(18, SIGSEGV, "reserved", reserved) | 552 | DO_ERROR(18, SIGSEGV, "reserved", reserved) |
551 | DO_ERROR(12, SIGBUS, "stack segment", stack_segment) | 553 | |
554 | /* Runs on IST stack */ | ||
555 | asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code) | ||
556 | { | ||
557 | if (notify_die(DIE_TRAP, "stack segment", regs, error_code, | ||
558 | 12, SIGBUS) == NOTIFY_STOP) | ||
559 | return; | ||
560 | preempt_conditional_sti(regs); | ||
561 | do_trap(12, SIGBUS, "stack segment", regs, error_code, NULL); | ||
562 | preempt_conditional_cli(regs); | ||
563 | } | ||
552 | 564 | ||
553 | asmlinkage void do_double_fault(struct pt_regs * regs, long error_code) | 565 | asmlinkage void do_double_fault(struct pt_regs * regs, long error_code) |
554 | { | 566 | { |
@@ -682,8 +694,9 @@ asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) | |||
682 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { | 694 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { |
683 | return; | 695 | return; |
684 | } | 696 | } |
697 | preempt_conditional_sti(regs); | ||
685 | do_trap(3, SIGTRAP, "int3", regs, error_code, NULL); | 698 | do_trap(3, SIGTRAP, "int3", regs, error_code, NULL); |
686 | return; | 699 | preempt_conditional_cli(regs); |
687 | } | 700 | } |
688 | 701 | ||
689 | /* Help handler running on IST stack to switch back to user stack | 702 | /* Help handler running on IST stack to switch back to user stack |
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 15ae9fcd65a7..474df22c6ed2 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
@@ -34,7 +34,10 @@ static nodemask_t nodes_found __initdata; | |||
34 | static struct bootnode nodes[MAX_NUMNODES] __initdata; | 34 | static struct bootnode nodes[MAX_NUMNODES] __initdata; |
35 | static struct bootnode nodes_add[MAX_NUMNODES] __initdata; | 35 | static struct bootnode nodes_add[MAX_NUMNODES] __initdata; |
36 | static int found_add_area __initdata; | 36 | static int found_add_area __initdata; |
37 | int hotadd_percent __initdata = 10; | 37 | int hotadd_percent __initdata = 0; |
38 | #ifndef RESERVE_HOTADD | ||
39 | #define hotadd_percent 0 /* Ignore all settings */ | ||
40 | #endif | ||
38 | static u8 pxm2node[256] = { [0 ... 255] = 0xff }; | 41 | static u8 pxm2node[256] = { [0 ... 255] = 0xff }; |
39 | 42 | ||
40 | /* Too small nodes confuse the VM badly. Usually they result | 43 | /* Too small nodes confuse the VM badly. Usually they result |
@@ -103,6 +106,7 @@ static __init void bad_srat(void) | |||
103 | int i; | 106 | int i; |
104 | printk(KERN_ERR "SRAT: SRAT not used.\n"); | 107 | printk(KERN_ERR "SRAT: SRAT not used.\n"); |
105 | acpi_numa = -1; | 108 | acpi_numa = -1; |
109 | found_add_area = 0; | ||
106 | for (i = 0; i < MAX_LOCAL_APIC; i++) | 110 | for (i = 0; i < MAX_LOCAL_APIC; i++) |
107 | apicid_to_node[i] = NUMA_NO_NODE; | 111 | apicid_to_node[i] = NUMA_NO_NODE; |
108 | for (i = 0; i < MAX_NUMNODES; i++) | 112 | for (i = 0; i < MAX_NUMNODES; i++) |
@@ -154,7 +158,8 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) | |||
154 | int pxm, node; | 158 | int pxm, node; |
155 | if (srat_disabled()) | 159 | if (srat_disabled()) |
156 | return; | 160 | return; |
157 | if (pa->header.length != sizeof(struct acpi_table_processor_affinity)) { bad_srat(); | 161 | if (pa->header.length != sizeof(struct acpi_table_processor_affinity)) { |
162 | bad_srat(); | ||
158 | return; | 163 | return; |
159 | } | 164 | } |
160 | if (pa->flags.enabled == 0) | 165 | if (pa->flags.enabled == 0) |
@@ -191,15 +196,17 @@ static int hotadd_enough_memory(struct bootnode *nd) | |||
191 | allowed = (end_pfn - e820_hole_size(0, end_pfn)) * PAGE_SIZE; | 196 | allowed = (end_pfn - e820_hole_size(0, end_pfn)) * PAGE_SIZE; |
192 | allowed = (allowed / 100) * hotadd_percent; | 197 | allowed = (allowed / 100) * hotadd_percent; |
193 | if (allocated + mem > allowed) { | 198 | if (allocated + mem > allowed) { |
199 | unsigned long range; | ||
194 | /* Give them at least part of their hotadd memory upto hotadd_percent | 200 | /* Give them at least part of their hotadd memory upto hotadd_percent |
195 | It would be better to spread the limit out | 201 | It would be better to spread the limit out |
196 | over multiple hotplug areas, but that is too complicated | 202 | over multiple hotplug areas, but that is too complicated |
197 | right now */ | 203 | right now */ |
198 | if (allocated >= allowed) | 204 | if (allocated >= allowed) |
199 | return 0; | 205 | return 0; |
200 | pages = (allowed - allocated + mem) / sizeof(struct page); | 206 | range = allowed - allocated; |
207 | pages = (range / PAGE_SIZE); | ||
201 | mem = pages * sizeof(struct page); | 208 | mem = pages * sizeof(struct page); |
202 | nd->end = nd->start + pages*PAGE_SIZE; | 209 | nd->end = nd->start + range; |
203 | } | 210 | } |
204 | /* Not completely fool proof, but a good sanity check */ | 211 | /* Not completely fool proof, but a good sanity check */ |
205 | addr = find_e820_area(last_area_end, end_pfn<<PAGE_SHIFT, mem); | 212 | addr = find_e820_area(last_area_end, end_pfn<<PAGE_SHIFT, mem); |
@@ -392,8 +399,10 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
392 | /* First clean up the node list */ | 399 | /* First clean up the node list */ |
393 | for (i = 0; i < MAX_NUMNODES; i++) { | 400 | for (i = 0; i < MAX_NUMNODES; i++) { |
394 | cutoff_node(i, start, end); | 401 | cutoff_node(i, start, end); |
395 | if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) | 402 | if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) { |
396 | unparse_node(i); | 403 | unparse_node(i); |
404 | node_set_offline(i); | ||
405 | } | ||
397 | } | 406 | } |
398 | 407 | ||
399 | if (acpi_numa <= 0) | 408 | if (acpi_numa <= 0) |
diff --git a/block/as-iosched.c b/block/as-iosched.c index e25a5d79ab27..a7caf35ca0c2 100644 --- a/block/as-iosched.c +++ b/block/as-iosched.c | |||
@@ -1648,17 +1648,17 @@ static void as_exit_queue(elevator_t *e) | |||
1648 | * initialize elevator private data (as_data), and alloc a arq for | 1648 | * initialize elevator private data (as_data), and alloc a arq for |
1649 | * each request on the free lists | 1649 | * each request on the free lists |
1650 | */ | 1650 | */ |
1651 | static int as_init_queue(request_queue_t *q, elevator_t *e) | 1651 | static void *as_init_queue(request_queue_t *q, elevator_t *e) |
1652 | { | 1652 | { |
1653 | struct as_data *ad; | 1653 | struct as_data *ad; |
1654 | int i; | 1654 | int i; |
1655 | 1655 | ||
1656 | if (!arq_pool) | 1656 | if (!arq_pool) |
1657 | return -ENOMEM; | 1657 | return NULL; |
1658 | 1658 | ||
1659 | ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node); | 1659 | ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node); |
1660 | if (!ad) | 1660 | if (!ad) |
1661 | return -ENOMEM; | 1661 | return NULL; |
1662 | memset(ad, 0, sizeof(*ad)); | 1662 | memset(ad, 0, sizeof(*ad)); |
1663 | 1663 | ||
1664 | ad->q = q; /* Identify what queue the data belongs to */ | 1664 | ad->q = q; /* Identify what queue the data belongs to */ |
@@ -1667,7 +1667,7 @@ static int as_init_queue(request_queue_t *q, elevator_t *e) | |||
1667 | GFP_KERNEL, q->node); | 1667 | GFP_KERNEL, q->node); |
1668 | if (!ad->hash) { | 1668 | if (!ad->hash) { |
1669 | kfree(ad); | 1669 | kfree(ad); |
1670 | return -ENOMEM; | 1670 | return NULL; |
1671 | } | 1671 | } |
1672 | 1672 | ||
1673 | ad->arq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, | 1673 | ad->arq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, |
@@ -1675,7 +1675,7 @@ static int as_init_queue(request_queue_t *q, elevator_t *e) | |||
1675 | if (!ad->arq_pool) { | 1675 | if (!ad->arq_pool) { |
1676 | kfree(ad->hash); | 1676 | kfree(ad->hash); |
1677 | kfree(ad); | 1677 | kfree(ad); |
1678 | return -ENOMEM; | 1678 | return NULL; |
1679 | } | 1679 | } |
1680 | 1680 | ||
1681 | /* anticipatory scheduling helpers */ | 1681 | /* anticipatory scheduling helpers */ |
@@ -1696,14 +1696,13 @@ static int as_init_queue(request_queue_t *q, elevator_t *e) | |||
1696 | ad->antic_expire = default_antic_expire; | 1696 | ad->antic_expire = default_antic_expire; |
1697 | ad->batch_expire[REQ_SYNC] = default_read_batch_expire; | 1697 | ad->batch_expire[REQ_SYNC] = default_read_batch_expire; |
1698 | ad->batch_expire[REQ_ASYNC] = default_write_batch_expire; | 1698 | ad->batch_expire[REQ_ASYNC] = default_write_batch_expire; |
1699 | e->elevator_data = ad; | ||
1700 | 1699 | ||
1701 | ad->current_batch_expires = jiffies + ad->batch_expire[REQ_SYNC]; | 1700 | ad->current_batch_expires = jiffies + ad->batch_expire[REQ_SYNC]; |
1702 | ad->write_batch_count = ad->batch_expire[REQ_ASYNC] / 10; | 1701 | ad->write_batch_count = ad->batch_expire[REQ_ASYNC] / 10; |
1703 | if (ad->write_batch_count < 2) | 1702 | if (ad->write_batch_count < 2) |
1704 | ad->write_batch_count = 2; | 1703 | ad->write_batch_count = 2; |
1705 | 1704 | ||
1706 | return 0; | 1705 | return ad; |
1707 | } | 1706 | } |
1708 | 1707 | ||
1709 | /* | 1708 | /* |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 2540dfaa3e38..052b17487625 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -33,7 +33,7 @@ static int cfq_slice_idle = HZ / 70; | |||
33 | 33 | ||
34 | #define CFQ_KEY_ASYNC (0) | 34 | #define CFQ_KEY_ASYNC (0) |
35 | 35 | ||
36 | static DEFINE_RWLOCK(cfq_exit_lock); | 36 | static DEFINE_SPINLOCK(cfq_exit_lock); |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * for the hash of cfqq inside the cfqd | 39 | * for the hash of cfqq inside the cfqd |
@@ -133,6 +133,7 @@ struct cfq_data { | |||
133 | mempool_t *crq_pool; | 133 | mempool_t *crq_pool; |
134 | 134 | ||
135 | int rq_in_driver; | 135 | int rq_in_driver; |
136 | int hw_tag; | ||
136 | 137 | ||
137 | /* | 138 | /* |
138 | * schedule slice state info | 139 | * schedule slice state info |
@@ -500,10 +501,13 @@ static void cfq_resort_rr_list(struct cfq_queue *cfqq, int preempted) | |||
500 | 501 | ||
501 | /* | 502 | /* |
502 | * if queue was preempted, just add to front to be fair. busy_rr | 503 | * if queue was preempted, just add to front to be fair. busy_rr |
503 | * isn't sorted. | 504 | * isn't sorted, but insert at the back for fairness. |
504 | */ | 505 | */ |
505 | if (preempted || list == &cfqd->busy_rr) { | 506 | if (preempted || list == &cfqd->busy_rr) { |
506 | list_add(&cfqq->cfq_list, list); | 507 | if (preempted) |
508 | list = list->prev; | ||
509 | |||
510 | list_add_tail(&cfqq->cfq_list, list); | ||
507 | return; | 511 | return; |
508 | } | 512 | } |
509 | 513 | ||
@@ -664,6 +668,15 @@ static void cfq_activate_request(request_queue_t *q, struct request *rq) | |||
664 | struct cfq_data *cfqd = q->elevator->elevator_data; | 668 | struct cfq_data *cfqd = q->elevator->elevator_data; |
665 | 669 | ||
666 | cfqd->rq_in_driver++; | 670 | cfqd->rq_in_driver++; |
671 | |||
672 | /* | ||
673 | * If the depth is larger 1, it really could be queueing. But lets | ||
674 | * make the mark a little higher - idling could still be good for | ||
675 | * low queueing, and a low queueing number could also just indicate | ||
676 | * a SCSI mid layer like behaviour where limit+1 is often seen. | ||
677 | */ | ||
678 | if (!cfqd->hw_tag && cfqd->rq_in_driver > 4) | ||
679 | cfqd->hw_tag = 1; | ||
667 | } | 680 | } |
668 | 681 | ||
669 | static void cfq_deactivate_request(request_queue_t *q, struct request *rq) | 682 | static void cfq_deactivate_request(request_queue_t *q, struct request *rq) |
@@ -879,6 +892,13 @@ static struct cfq_queue *cfq_set_active_queue(struct cfq_data *cfqd) | |||
879 | cfqq = list_entry_cfqq(cfqd->cur_rr.next); | 892 | cfqq = list_entry_cfqq(cfqd->cur_rr.next); |
880 | 893 | ||
881 | /* | 894 | /* |
895 | * If no new queues are available, check if the busy list has some | ||
896 | * before falling back to idle io. | ||
897 | */ | ||
898 | if (!cfqq && !list_empty(&cfqd->busy_rr)) | ||
899 | cfqq = list_entry_cfqq(cfqd->busy_rr.next); | ||
900 | |||
901 | /* | ||
882 | * if we have idle queues and no rt or be queues had pending | 902 | * if we have idle queues and no rt or be queues had pending |
883 | * requests, either allow immediate service if the grace period | 903 | * requests, either allow immediate service if the grace period |
884 | * has passed or arm the idle grace timer | 904 | * has passed or arm the idle grace timer |
@@ -1284,7 +1304,7 @@ static void cfq_exit_io_context(struct io_context *ioc) | |||
1284 | /* | 1304 | /* |
1285 | * put the reference this task is holding to the various queues | 1305 | * put the reference this task is holding to the various queues |
1286 | */ | 1306 | */ |
1287 | read_lock_irqsave(&cfq_exit_lock, flags); | 1307 | spin_lock_irqsave(&cfq_exit_lock, flags); |
1288 | 1308 | ||
1289 | n = rb_first(&ioc->cic_root); | 1309 | n = rb_first(&ioc->cic_root); |
1290 | while (n != NULL) { | 1310 | while (n != NULL) { |
@@ -1294,7 +1314,7 @@ static void cfq_exit_io_context(struct io_context *ioc) | |||
1294 | n = rb_next(n); | 1314 | n = rb_next(n); |
1295 | } | 1315 | } |
1296 | 1316 | ||
1297 | read_unlock_irqrestore(&cfq_exit_lock, flags); | 1317 | spin_unlock_irqrestore(&cfq_exit_lock, flags); |
1298 | } | 1318 | } |
1299 | 1319 | ||
1300 | static struct cfq_io_context * | 1320 | static struct cfq_io_context * |
@@ -1303,17 +1323,12 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
1303 | struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); | 1323 | struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); |
1304 | 1324 | ||
1305 | if (cic) { | 1325 | if (cic) { |
1306 | RB_CLEAR(&cic->rb_node); | 1326 | memset(cic, 0, sizeof(*cic)); |
1307 | cic->key = NULL; | 1327 | RB_CLEAR_COLOR(&cic->rb_node); |
1308 | cic->cfqq[ASYNC] = NULL; | ||
1309 | cic->cfqq[SYNC] = NULL; | ||
1310 | cic->last_end_request = jiffies; | 1328 | cic->last_end_request = jiffies; |
1311 | cic->ttime_total = 0; | 1329 | INIT_LIST_HEAD(&cic->queue_list); |
1312 | cic->ttime_samples = 0; | ||
1313 | cic->ttime_mean = 0; | ||
1314 | cic->dtor = cfq_free_io_context; | 1330 | cic->dtor = cfq_free_io_context; |
1315 | cic->exit = cfq_exit_io_context; | 1331 | cic->exit = cfq_exit_io_context; |
1316 | INIT_LIST_HEAD(&cic->queue_list); | ||
1317 | atomic_inc(&ioc_count); | 1332 | atomic_inc(&ioc_count); |
1318 | } | 1333 | } |
1319 | 1334 | ||
@@ -1400,17 +1415,17 @@ static int cfq_ioc_set_ioprio(struct io_context *ioc, unsigned int ioprio) | |||
1400 | struct cfq_io_context *cic; | 1415 | struct cfq_io_context *cic; |
1401 | struct rb_node *n; | 1416 | struct rb_node *n; |
1402 | 1417 | ||
1403 | write_lock(&cfq_exit_lock); | 1418 | spin_lock(&cfq_exit_lock); |
1404 | 1419 | ||
1405 | n = rb_first(&ioc->cic_root); | 1420 | n = rb_first(&ioc->cic_root); |
1406 | while (n != NULL) { | 1421 | while (n != NULL) { |
1407 | cic = rb_entry(n, struct cfq_io_context, rb_node); | 1422 | cic = rb_entry(n, struct cfq_io_context, rb_node); |
1408 | 1423 | ||
1409 | changed_ioprio(cic); | 1424 | changed_ioprio(cic); |
1410 | n = rb_next(n); | 1425 | n = rb_next(n); |
1411 | } | 1426 | } |
1412 | 1427 | ||
1413 | write_unlock(&cfq_exit_lock); | 1428 | spin_unlock(&cfq_exit_lock); |
1414 | 1429 | ||
1415 | return 0; | 1430 | return 0; |
1416 | } | 1431 | } |
@@ -1458,7 +1473,8 @@ retry: | |||
1458 | * set ->slice_left to allow preemption for a new process | 1473 | * set ->slice_left to allow preemption for a new process |
1459 | */ | 1474 | */ |
1460 | cfqq->slice_left = 2 * cfqd->cfq_slice_idle; | 1475 | cfqq->slice_left = 2 * cfqd->cfq_slice_idle; |
1461 | cfq_mark_cfqq_idle_window(cfqq); | 1476 | if (!cfqd->hw_tag) |
1477 | cfq_mark_cfqq_idle_window(cfqq); | ||
1462 | cfq_mark_cfqq_prio_changed(cfqq); | 1478 | cfq_mark_cfqq_prio_changed(cfqq); |
1463 | cfq_init_prio_data(cfqq); | 1479 | cfq_init_prio_data(cfqq); |
1464 | } | 1480 | } |
@@ -1475,9 +1491,10 @@ out: | |||
1475 | static void | 1491 | static void |
1476 | cfq_drop_dead_cic(struct io_context *ioc, struct cfq_io_context *cic) | 1492 | cfq_drop_dead_cic(struct io_context *ioc, struct cfq_io_context *cic) |
1477 | { | 1493 | { |
1478 | read_lock(&cfq_exit_lock); | 1494 | spin_lock(&cfq_exit_lock); |
1479 | rb_erase(&cic->rb_node, &ioc->cic_root); | 1495 | rb_erase(&cic->rb_node, &ioc->cic_root); |
1480 | read_unlock(&cfq_exit_lock); | 1496 | list_del_init(&cic->queue_list); |
1497 | spin_unlock(&cfq_exit_lock); | ||
1481 | kmem_cache_free(cfq_ioc_pool, cic); | 1498 | kmem_cache_free(cfq_ioc_pool, cic); |
1482 | atomic_dec(&ioc_count); | 1499 | atomic_dec(&ioc_count); |
1483 | } | 1500 | } |
@@ -1545,11 +1562,11 @@ restart: | |||
1545 | BUG(); | 1562 | BUG(); |
1546 | } | 1563 | } |
1547 | 1564 | ||
1548 | read_lock(&cfq_exit_lock); | 1565 | spin_lock(&cfq_exit_lock); |
1549 | rb_link_node(&cic->rb_node, parent, p); | 1566 | rb_link_node(&cic->rb_node, parent, p); |
1550 | rb_insert_color(&cic->rb_node, &ioc->cic_root); | 1567 | rb_insert_color(&cic->rb_node, &ioc->cic_root); |
1551 | list_add(&cic->queue_list, &cfqd->cic_list); | 1568 | list_add(&cic->queue_list, &cfqd->cic_list); |
1552 | read_unlock(&cfq_exit_lock); | 1569 | spin_unlock(&cfq_exit_lock); |
1553 | } | 1570 | } |
1554 | 1571 | ||
1555 | /* | 1572 | /* |
@@ -1648,7 +1665,7 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1648 | { | 1665 | { |
1649 | int enable_idle = cfq_cfqq_idle_window(cfqq); | 1666 | int enable_idle = cfq_cfqq_idle_window(cfqq); |
1650 | 1667 | ||
1651 | if (!cic->ioc->task || !cfqd->cfq_slice_idle) | 1668 | if (!cic->ioc->task || !cfqd->cfq_slice_idle || cfqd->hw_tag) |
1652 | enable_idle = 0; | 1669 | enable_idle = 0; |
1653 | else if (sample_valid(cic->ttime_samples)) { | 1670 | else if (sample_valid(cic->ttime_samples)) { |
1654 | if (cic->ttime_mean > cfqd->cfq_slice_idle) | 1671 | if (cic->ttime_mean > cfqd->cfq_slice_idle) |
@@ -1739,14 +1756,24 @@ cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1739 | 1756 | ||
1740 | cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq); | 1757 | cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq); |
1741 | 1758 | ||
1759 | cic = crq->io_context; | ||
1760 | |||
1742 | /* | 1761 | /* |
1743 | * we never wait for an async request and we don't allow preemption | 1762 | * we never wait for an async request and we don't allow preemption |
1744 | * of an async request. so just return early | 1763 | * of an async request. so just return early |
1745 | */ | 1764 | */ |
1746 | if (!cfq_crq_is_sync(crq)) | 1765 | if (!cfq_crq_is_sync(crq)) { |
1766 | /* | ||
1767 | * sync process issued an async request, if it's waiting | ||
1768 | * then expire it and kick rq handling. | ||
1769 | */ | ||
1770 | if (cic == cfqd->active_cic && | ||
1771 | del_timer(&cfqd->idle_slice_timer)) { | ||
1772 | cfq_slice_expired(cfqd, 0); | ||
1773 | cfq_start_queueing(cfqd, cfqq); | ||
1774 | } | ||
1747 | return; | 1775 | return; |
1748 | 1776 | } | |
1749 | cic = crq->io_context; | ||
1750 | 1777 | ||
1751 | cfq_update_io_thinktime(cfqd, cic); | 1778 | cfq_update_io_thinktime(cfqd, cic); |
1752 | cfq_update_io_seektime(cfqd, cic, crq); | 1779 | cfq_update_io_seektime(cfqd, cic, crq); |
@@ -2164,10 +2191,9 @@ static void cfq_idle_class_timer(unsigned long data) | |||
2164 | * race with a non-idle queue, reset timer | 2191 | * race with a non-idle queue, reset timer |
2165 | */ | 2192 | */ |
2166 | end = cfqd->last_end_request + CFQ_IDLE_GRACE; | 2193 | end = cfqd->last_end_request + CFQ_IDLE_GRACE; |
2167 | if (!time_after_eq(jiffies, end)) { | 2194 | if (!time_after_eq(jiffies, end)) |
2168 | cfqd->idle_class_timer.expires = end; | 2195 | mod_timer(&cfqd->idle_class_timer, end); |
2169 | add_timer(&cfqd->idle_class_timer); | 2196 | else |
2170 | } else | ||
2171 | cfq_schedule_dispatch(cfqd); | 2197 | cfq_schedule_dispatch(cfqd); |
2172 | 2198 | ||
2173 | spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); | 2199 | spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); |
@@ -2187,7 +2213,7 @@ static void cfq_exit_queue(elevator_t *e) | |||
2187 | 2213 | ||
2188 | cfq_shutdown_timer_wq(cfqd); | 2214 | cfq_shutdown_timer_wq(cfqd); |
2189 | 2215 | ||
2190 | write_lock(&cfq_exit_lock); | 2216 | spin_lock(&cfq_exit_lock); |
2191 | spin_lock_irq(q->queue_lock); | 2217 | spin_lock_irq(q->queue_lock); |
2192 | 2218 | ||
2193 | if (cfqd->active_queue) | 2219 | if (cfqd->active_queue) |
@@ -2210,7 +2236,7 @@ static void cfq_exit_queue(elevator_t *e) | |||
2210 | } | 2236 | } |
2211 | 2237 | ||
2212 | spin_unlock_irq(q->queue_lock); | 2238 | spin_unlock_irq(q->queue_lock); |
2213 | write_unlock(&cfq_exit_lock); | 2239 | spin_unlock(&cfq_exit_lock); |
2214 | 2240 | ||
2215 | cfq_shutdown_timer_wq(cfqd); | 2241 | cfq_shutdown_timer_wq(cfqd); |
2216 | 2242 | ||
@@ -2220,14 +2246,14 @@ static void cfq_exit_queue(elevator_t *e) | |||
2220 | kfree(cfqd); | 2246 | kfree(cfqd); |
2221 | } | 2247 | } |
2222 | 2248 | ||
2223 | static int cfq_init_queue(request_queue_t *q, elevator_t *e) | 2249 | static void *cfq_init_queue(request_queue_t *q, elevator_t *e) |
2224 | { | 2250 | { |
2225 | struct cfq_data *cfqd; | 2251 | struct cfq_data *cfqd; |
2226 | int i; | 2252 | int i; |
2227 | 2253 | ||
2228 | cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL); | 2254 | cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL); |
2229 | if (!cfqd) | 2255 | if (!cfqd) |
2230 | return -ENOMEM; | 2256 | return NULL; |
2231 | 2257 | ||
2232 | memset(cfqd, 0, sizeof(*cfqd)); | 2258 | memset(cfqd, 0, sizeof(*cfqd)); |
2233 | 2259 | ||
@@ -2257,8 +2283,6 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e) | |||
2257 | for (i = 0; i < CFQ_QHASH_ENTRIES; i++) | 2283 | for (i = 0; i < CFQ_QHASH_ENTRIES; i++) |
2258 | INIT_HLIST_HEAD(&cfqd->cfq_hash[i]); | 2284 | INIT_HLIST_HEAD(&cfqd->cfq_hash[i]); |
2259 | 2285 | ||
2260 | e->elevator_data = cfqd; | ||
2261 | |||
2262 | cfqd->queue = q; | 2286 | cfqd->queue = q; |
2263 | 2287 | ||
2264 | cfqd->max_queued = q->nr_requests / 4; | 2288 | cfqd->max_queued = q->nr_requests / 4; |
@@ -2285,14 +2309,14 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e) | |||
2285 | cfqd->cfq_slice_async_rq = cfq_slice_async_rq; | 2309 | cfqd->cfq_slice_async_rq = cfq_slice_async_rq; |
2286 | cfqd->cfq_slice_idle = cfq_slice_idle; | 2310 | cfqd->cfq_slice_idle = cfq_slice_idle; |
2287 | 2311 | ||
2288 | return 0; | 2312 | return cfqd; |
2289 | out_crqpool: | 2313 | out_crqpool: |
2290 | kfree(cfqd->cfq_hash); | 2314 | kfree(cfqd->cfq_hash); |
2291 | out_cfqhash: | 2315 | out_cfqhash: |
2292 | kfree(cfqd->crq_hash); | 2316 | kfree(cfqd->crq_hash); |
2293 | out_crqhash: | 2317 | out_crqhash: |
2294 | kfree(cfqd); | 2318 | kfree(cfqd); |
2295 | return -ENOMEM; | 2319 | return NULL; |
2296 | } | 2320 | } |
2297 | 2321 | ||
2298 | static void cfq_slab_kill(void) | 2322 | static void cfq_slab_kill(void) |
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c index 399fa1e60e1f..3bd0415a9828 100644 --- a/block/deadline-iosched.c +++ b/block/deadline-iosched.c | |||
@@ -613,24 +613,24 @@ static void deadline_exit_queue(elevator_t *e) | |||
613 | * initialize elevator private data (deadline_data), and alloc a drq for | 613 | * initialize elevator private data (deadline_data), and alloc a drq for |
614 | * each request on the free lists | 614 | * each request on the free lists |
615 | */ | 615 | */ |
616 | static int deadline_init_queue(request_queue_t *q, elevator_t *e) | 616 | static void *deadline_init_queue(request_queue_t *q, elevator_t *e) |
617 | { | 617 | { |
618 | struct deadline_data *dd; | 618 | struct deadline_data *dd; |
619 | int i; | 619 | int i; |
620 | 620 | ||
621 | if (!drq_pool) | 621 | if (!drq_pool) |
622 | return -ENOMEM; | 622 | return NULL; |
623 | 623 | ||
624 | dd = kmalloc_node(sizeof(*dd), GFP_KERNEL, q->node); | 624 | dd = kmalloc_node(sizeof(*dd), GFP_KERNEL, q->node); |
625 | if (!dd) | 625 | if (!dd) |
626 | return -ENOMEM; | 626 | return NULL; |
627 | memset(dd, 0, sizeof(*dd)); | 627 | memset(dd, 0, sizeof(*dd)); |
628 | 628 | ||
629 | dd->hash = kmalloc_node(sizeof(struct list_head)*DL_HASH_ENTRIES, | 629 | dd->hash = kmalloc_node(sizeof(struct list_head)*DL_HASH_ENTRIES, |
630 | GFP_KERNEL, q->node); | 630 | GFP_KERNEL, q->node); |
631 | if (!dd->hash) { | 631 | if (!dd->hash) { |
632 | kfree(dd); | 632 | kfree(dd); |
633 | return -ENOMEM; | 633 | return NULL; |
634 | } | 634 | } |
635 | 635 | ||
636 | dd->drq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, | 636 | dd->drq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, |
@@ -638,7 +638,7 @@ static int deadline_init_queue(request_queue_t *q, elevator_t *e) | |||
638 | if (!dd->drq_pool) { | 638 | if (!dd->drq_pool) { |
639 | kfree(dd->hash); | 639 | kfree(dd->hash); |
640 | kfree(dd); | 640 | kfree(dd); |
641 | return -ENOMEM; | 641 | return NULL; |
642 | } | 642 | } |
643 | 643 | ||
644 | for (i = 0; i < DL_HASH_ENTRIES; i++) | 644 | for (i = 0; i < DL_HASH_ENTRIES; i++) |
@@ -653,8 +653,7 @@ static int deadline_init_queue(request_queue_t *q, elevator_t *e) | |||
653 | dd->writes_starved = writes_starved; | 653 | dd->writes_starved = writes_starved; |
654 | dd->front_merges = 1; | 654 | dd->front_merges = 1; |
655 | dd->fifo_batch = fifo_batch; | 655 | dd->fifo_batch = fifo_batch; |
656 | e->elevator_data = dd; | 656 | return dd; |
657 | return 0; | ||
658 | } | 657 | } |
659 | 658 | ||
660 | static void deadline_put_request(request_queue_t *q, struct request *rq) | 659 | static void deadline_put_request(request_queue_t *q, struct request *rq) |
diff --git a/block/elevator.c b/block/elevator.c index 8768a367fdde..a0afdd317cef 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -121,16 +121,16 @@ static struct elevator_type *elevator_get(const char *name) | |||
121 | return e; | 121 | return e; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int elevator_attach(request_queue_t *q, struct elevator_queue *eq) | 124 | static void *elevator_init_queue(request_queue_t *q, struct elevator_queue *eq) |
125 | { | 125 | { |
126 | int ret = 0; | 126 | return eq->ops->elevator_init_fn(q, eq); |
127 | } | ||
127 | 128 | ||
129 | static void elevator_attach(request_queue_t *q, struct elevator_queue *eq, | ||
130 | void *data) | ||
131 | { | ||
128 | q->elevator = eq; | 132 | q->elevator = eq; |
129 | 133 | eq->elevator_data = data; | |
130 | if (eq->ops->elevator_init_fn) | ||
131 | ret = eq->ops->elevator_init_fn(q, eq); | ||
132 | |||
133 | return ret; | ||
134 | } | 134 | } |
135 | 135 | ||
136 | static char chosen_elevator[16]; | 136 | static char chosen_elevator[16]; |
@@ -181,6 +181,7 @@ int elevator_init(request_queue_t *q, char *name) | |||
181 | struct elevator_type *e = NULL; | 181 | struct elevator_type *e = NULL; |
182 | struct elevator_queue *eq; | 182 | struct elevator_queue *eq; |
183 | int ret = 0; | 183 | int ret = 0; |
184 | void *data; | ||
184 | 185 | ||
185 | INIT_LIST_HEAD(&q->queue_head); | 186 | INIT_LIST_HEAD(&q->queue_head); |
186 | q->last_merge = NULL; | 187 | q->last_merge = NULL; |
@@ -202,10 +203,13 @@ int elevator_init(request_queue_t *q, char *name) | |||
202 | if (!eq) | 203 | if (!eq) |
203 | return -ENOMEM; | 204 | return -ENOMEM; |
204 | 205 | ||
205 | ret = elevator_attach(q, eq); | 206 | data = elevator_init_queue(q, eq); |
206 | if (ret) | 207 | if (!data) { |
207 | kobject_put(&eq->kobj); | 208 | kobject_put(&eq->kobj); |
209 | return -ENOMEM; | ||
210 | } | ||
208 | 211 | ||
212 | elevator_attach(q, eq, data); | ||
209 | return ret; | 213 | return ret; |
210 | } | 214 | } |
211 | 215 | ||
@@ -722,13 +726,16 @@ int elv_register_queue(struct request_queue *q) | |||
722 | return error; | 726 | return error; |
723 | } | 727 | } |
724 | 728 | ||
729 | static void __elv_unregister_queue(elevator_t *e) | ||
730 | { | ||
731 | kobject_uevent(&e->kobj, KOBJ_REMOVE); | ||
732 | kobject_del(&e->kobj); | ||
733 | } | ||
734 | |||
725 | void elv_unregister_queue(struct request_queue *q) | 735 | void elv_unregister_queue(struct request_queue *q) |
726 | { | 736 | { |
727 | if (q) { | 737 | if (q) |
728 | elevator_t *e = q->elevator; | 738 | __elv_unregister_queue(q->elevator); |
729 | kobject_uevent(&e->kobj, KOBJ_REMOVE); | ||
730 | kobject_del(&e->kobj); | ||
731 | } | ||
732 | } | 739 | } |
733 | 740 | ||
734 | int elv_register(struct elevator_type *e) | 741 | int elv_register(struct elevator_type *e) |
@@ -780,6 +787,7 @@ EXPORT_SYMBOL_GPL(elv_unregister); | |||
780 | static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) | 787 | static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) |
781 | { | 788 | { |
782 | elevator_t *old_elevator, *e; | 789 | elevator_t *old_elevator, *e; |
790 | void *data; | ||
783 | 791 | ||
784 | /* | 792 | /* |
785 | * Allocate new elevator | 793 | * Allocate new elevator |
@@ -788,6 +796,12 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) | |||
788 | if (!e) | 796 | if (!e) |
789 | return 0; | 797 | return 0; |
790 | 798 | ||
799 | data = elevator_init_queue(q, e); | ||
800 | if (!data) { | ||
801 | kobject_put(&e->kobj); | ||
802 | return 0; | ||
803 | } | ||
804 | |||
791 | /* | 805 | /* |
792 | * Turn on BYPASS and drain all requests w/ elevator private data | 806 | * Turn on BYPASS and drain all requests w/ elevator private data |
793 | */ | 807 | */ |
@@ -806,19 +820,19 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) | |||
806 | elv_drain_elevator(q); | 820 | elv_drain_elevator(q); |
807 | } | 821 | } |
808 | 822 | ||
809 | spin_unlock_irq(q->queue_lock); | ||
810 | |||
811 | /* | 823 | /* |
812 | * unregister old elevator data | 824 | * Remember old elevator. |
813 | */ | 825 | */ |
814 | elv_unregister_queue(q); | ||
815 | old_elevator = q->elevator; | 826 | old_elevator = q->elevator; |
816 | 827 | ||
817 | /* | 828 | /* |
818 | * attach and start new elevator | 829 | * attach and start new elevator |
819 | */ | 830 | */ |
820 | if (elevator_attach(q, e)) | 831 | elevator_attach(q, e, data); |
821 | goto fail; | 832 | |
833 | spin_unlock_irq(q->queue_lock); | ||
834 | |||
835 | __elv_unregister_queue(old_elevator); | ||
822 | 836 | ||
823 | if (elv_register_queue(q)) | 837 | if (elv_register_queue(q)) |
824 | goto fail_register; | 838 | goto fail_register; |
@@ -837,7 +851,6 @@ fail_register: | |||
837 | */ | 851 | */ |
838 | elevator_exit(e); | 852 | elevator_exit(e); |
839 | e = NULL; | 853 | e = NULL; |
840 | fail: | ||
841 | q->elevator = old_elevator; | 854 | q->elevator = old_elevator; |
842 | elv_register_queue(q); | 855 | elv_register_queue(q); |
843 | clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); | 856 | clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); |
diff --git a/block/genhd.c b/block/genhd.c index d96572589621..5a8d3bf02f17 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -182,7 +182,6 @@ static int exact_lock(dev_t dev, void *data) | |||
182 | */ | 182 | */ |
183 | void add_disk(struct gendisk *disk) | 183 | void add_disk(struct gendisk *disk) |
184 | { | 184 | { |
185 | get_device(disk->driverfs_dev); | ||
186 | disk->flags |= GENHD_FL_UP; | 185 | disk->flags |= GENHD_FL_UP; |
187 | blk_register_region(MKDEV(disk->major, disk->first_minor), | 186 | blk_register_region(MKDEV(disk->major, disk->first_minor), |
188 | disk->minors, NULL, exact_match, exact_lock, disk); | 187 | disk->minors, NULL, exact_match, exact_lock, disk); |
@@ -428,7 +427,6 @@ static struct attribute * default_attrs[] = { | |||
428 | static void disk_release(struct kobject * kobj) | 427 | static void disk_release(struct kobject * kobj) |
429 | { | 428 | { |
430 | struct gendisk *disk = to_disk(kobj); | 429 | struct gendisk *disk = to_disk(kobj); |
431 | put_device(disk->driverfs_dev); | ||
432 | kfree(disk->random); | 430 | kfree(disk->random); |
433 | kfree(disk->part); | 431 | kfree(disk->part); |
434 | free_disk_stats(disk); | 432 | free_disk_stats(disk); |
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index eac48bec1479..7eb36c53f4b7 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c | |||
@@ -3452,7 +3452,12 @@ void end_that_request_last(struct request *req, int uptodate) | |||
3452 | if (unlikely(laptop_mode) && blk_fs_request(req)) | 3452 | if (unlikely(laptop_mode) && blk_fs_request(req)) |
3453 | laptop_io_completion(); | 3453 | laptop_io_completion(); |
3454 | 3454 | ||
3455 | if (disk && blk_fs_request(req)) { | 3455 | /* |
3456 | * Account IO completion. bar_rq isn't accounted as a normal | ||
3457 | * IO on queueing nor completion. Accounting the containing | ||
3458 | * request is enough. | ||
3459 | */ | ||
3460 | if (disk && blk_fs_request(req) && req != &req->q->bar_rq) { | ||
3456 | unsigned long duration = jiffies - req->start_time; | 3461 | unsigned long duration = jiffies - req->start_time; |
3457 | const int rw = rq_data_dir(req); | 3462 | const int rw = rq_data_dir(req); |
3458 | 3463 | ||
diff --git a/block/noop-iosched.c b/block/noop-iosched.c index f370e4a7fe6d..56a7c620574f 100644 --- a/block/noop-iosched.c +++ b/block/noop-iosched.c | |||
@@ -65,16 +65,15 @@ noop_latter_request(request_queue_t *q, struct request *rq) | |||
65 | return list_entry(rq->queuelist.next, struct request, queuelist); | 65 | return list_entry(rq->queuelist.next, struct request, queuelist); |
66 | } | 66 | } |
67 | 67 | ||
68 | static int noop_init_queue(request_queue_t *q, elevator_t *e) | 68 | static void *noop_init_queue(request_queue_t *q, elevator_t *e) |
69 | { | 69 | { |
70 | struct noop_data *nd; | 70 | struct noop_data *nd; |
71 | 71 | ||
72 | nd = kmalloc(sizeof(*nd), GFP_KERNEL); | 72 | nd = kmalloc(sizeof(*nd), GFP_KERNEL); |
73 | if (!nd) | 73 | if (!nd) |
74 | return -ENOMEM; | 74 | return NULL; |
75 | INIT_LIST_HEAD(&nd->queue); | 75 | INIT_LIST_HEAD(&nd->queue); |
76 | e->elevator_data = nd; | 76 | return nd; |
77 | return 0; | ||
78 | } | 77 | } |
79 | 78 | ||
80 | static void noop_exit_queue(elevator_t *e) | 79 | static void noop_exit_queue(elevator_t *e) |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index c24652d31bf9..2b2fbec14540 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -10,9 +10,8 @@ menu "ACPI (Advanced Configuration and Power Interface) Support" | |||
10 | config ACPI | 10 | config ACPI |
11 | bool "ACPI Support" | 11 | bool "ACPI Support" |
12 | depends on IA64 || X86 | 12 | depends on IA64 || X86 |
13 | depends on PCI | ||
13 | select PM | 14 | select PM |
14 | select PCI | ||
15 | |||
16 | default y | 15 | default y |
17 | ---help--- | 16 | ---help--- |
18 | Advanced Configuration and Power Interface (ACPI) support for | 17 | Advanced Configuration and Power Interface (ACPI) support for |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index d882bf87fa96..e0a95ba72371 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -74,7 +74,7 @@ struct acpi_memory_device { | |||
74 | unsigned short caching; /* memory cache attribute */ | 74 | unsigned short caching; /* memory cache attribute */ |
75 | unsigned short write_protect; /* memory read/write attribute */ | 75 | unsigned short write_protect; /* memory read/write attribute */ |
76 | u64 start_addr; /* Memory Range start physical addr */ | 76 | u64 start_addr; /* Memory Range start physical addr */ |
77 | u64 end_addr; /* Memory Range end physical addr */ | 77 | u64 length; /* Memory Range length */ |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static int | 80 | static int |
@@ -97,12 +97,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
97 | if (ACPI_SUCCESS(status)) { | 97 | if (ACPI_SUCCESS(status)) { |
98 | if (address64.resource_type == ACPI_MEMORY_RANGE) { | 98 | if (address64.resource_type == ACPI_MEMORY_RANGE) { |
99 | /* Populate the structure */ | 99 | /* Populate the structure */ |
100 | mem_device->caching = | 100 | mem_device->caching = address64.info.mem.caching; |
101 | address64.info.mem.caching; | ||
102 | mem_device->write_protect = | 101 | mem_device->write_protect = |
103 | address64.info.mem.write_protect; | 102 | address64.info.mem.write_protect; |
104 | mem_device->start_addr = address64.minimum; | 103 | mem_device->start_addr = address64.minimum; |
105 | mem_device->end_addr = address64.maximum; | 104 | mem_device->length = address64.address_length; |
106 | } | 105 | } |
107 | } | 106 | } |
108 | 107 | ||
@@ -199,8 +198,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
199 | * Tell the VM there is more memory here... | 198 | * Tell the VM there is more memory here... |
200 | * Note: Assume that this function returns zero on success | 199 | * Note: Assume that this function returns zero on success |
201 | */ | 200 | */ |
202 | result = add_memory(mem_device->start_addr, | 201 | result = add_memory(mem_device->start_addr, mem_device->length); |
203 | (mem_device->end_addr - mem_device->start_addr) + 1); | ||
204 | if (result) { | 202 | if (result) { |
205 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); | 203 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); |
206 | mem_device->state = MEMORY_INVALID_STATE; | 204 | mem_device->state = MEMORY_INVALID_STATE; |
@@ -249,7 +247,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) | |||
249 | { | 247 | { |
250 | int result; | 248 | int result; |
251 | u64 start = mem_device->start_addr; | 249 | u64 start = mem_device->start_addr; |
252 | u64 len = mem_device->end_addr - start + 1; | 250 | u64 len = mem_device->length; |
253 | 251 | ||
254 | ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); | 252 | ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); |
255 | 253 | ||
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index f4c87750dbf2..90eb3c5a15ca 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -817,7 +817,7 @@ typedef int (proc_writefunc) (struct file * file, const char __user * buffer, | |||
817 | unsigned long count, void *data); | 817 | unsigned long count, void *data); |
818 | 818 | ||
819 | static int | 819 | static int |
820 | __init asus_proc_add(char *name, proc_writefunc * writefunc, | 820 | asus_proc_add(char *name, proc_writefunc * writefunc, |
821 | proc_readfunc * readfunc, mode_t mode, | 821 | proc_readfunc * readfunc, mode_t mode, |
822 | struct acpi_device *device) | 822 | struct acpi_device *device) |
823 | { | 823 | { |
@@ -836,7 +836,7 @@ __init asus_proc_add(char *name, proc_writefunc * writefunc, | |||
836 | return 0; | 836 | return 0; |
837 | } | 837 | } |
838 | 838 | ||
839 | static int __init asus_hotk_add_fs(struct acpi_device *device) | 839 | static int asus_hotk_add_fs(struct acpi_device *device) |
840 | { | 840 | { |
841 | struct proc_dir_entry *proc; | 841 | struct proc_dir_entry *proc; |
842 | mode_t mode; | 842 | mode_t mode; |
@@ -954,7 +954,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) | |||
954 | * This function is used to initialize the hotk with right values. In this | 954 | * This function is used to initialize the hotk with right values. In this |
955 | * method, we can make all the detection we want, and modify the hotk struct | 955 | * method, we can make all the detection we want, and modify the hotk struct |
956 | */ | 956 | */ |
957 | static int __init asus_hotk_get_info(void) | 957 | static int asus_hotk_get_info(void) |
958 | { | 958 | { |
959 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 959 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
960 | struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; | 960 | struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -970,7 +970,7 @@ static int __init asus_hotk_get_info(void) | |||
970 | * HID), this bit will be moved. A global variable asus_info contains | 970 | * HID), this bit will be moved. A global variable asus_info contains |
971 | * the DSDT header. | 971 | * the DSDT header. |
972 | */ | 972 | */ |
973 | status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); | 973 | status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); |
974 | if (ACPI_FAILURE(status)) | 974 | if (ACPI_FAILURE(status)) |
975 | printk(KERN_WARNING " Couldn't get the DSDT table header\n"); | 975 | printk(KERN_WARNING " Couldn't get the DSDT table header\n"); |
976 | else | 976 | else |
@@ -1101,7 +1101,7 @@ static int __init asus_hotk_get_info(void) | |||
1101 | return AE_OK; | 1101 | return AE_OK; |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | static int __init asus_hotk_check(void) | 1104 | static int asus_hotk_check(void) |
1105 | { | 1105 | { |
1106 | int result = 0; | 1106 | int result = 0; |
1107 | 1107 | ||
@@ -1119,7 +1119,9 @@ static int __init asus_hotk_check(void) | |||
1119 | return result; | 1119 | return result; |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | static int __init asus_hotk_add(struct acpi_device *device) | 1122 | static int asus_hotk_found; |
1123 | |||
1124 | static int asus_hotk_add(struct acpi_device *device) | ||
1123 | { | 1125 | { |
1124 | acpi_status status = AE_OK; | 1126 | acpi_status status = AE_OK; |
1125 | int result; | 1127 | int result; |
@@ -1180,6 +1182,8 @@ static int __init asus_hotk_add(struct acpi_device *device) | |||
1180 | } | 1182 | } |
1181 | } | 1183 | } |
1182 | 1184 | ||
1185 | asus_hotk_found = 1; | ||
1186 | |||
1183 | end: | 1187 | end: |
1184 | if (result) { | 1188 | if (result) { |
1185 | kfree(hotk); | 1189 | kfree(hotk); |
@@ -1226,7 +1230,19 @@ static int __init asus_acpi_init(void) | |||
1226 | asus_proc_dir->owner = THIS_MODULE; | 1230 | asus_proc_dir->owner = THIS_MODULE; |
1227 | 1231 | ||
1228 | result = acpi_bus_register_driver(&asus_hotk_driver); | 1232 | result = acpi_bus_register_driver(&asus_hotk_driver); |
1229 | if (result < 1) { | 1233 | if (result < 0) { |
1234 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | ||
1235 | return -ENODEV; | ||
1236 | } | ||
1237 | |||
1238 | /* | ||
1239 | * This is a bit of a kludge. We only want this module loaded | ||
1240 | * for ASUS systems, but there's currently no way to probe the | ||
1241 | * ACPI namespace for ASUS HIDs. So we just return failure if | ||
1242 | * we didn't find one, which will cause the module to be | ||
1243 | * unloaded. | ||
1244 | */ | ||
1245 | if (!asus_hotk_found) { | ||
1230 | acpi_bus_unregister_driver(&asus_hotk_driver); | 1246 | acpi_bus_unregister_driver(&asus_hotk_driver); |
1231 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | 1247 | remove_proc_entry(PROC_ASUS, acpi_root_dir); |
1232 | return -ENODEV; | 1248 | return -ENODEV; |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 606f8733a776..b77f03d51f0b 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -43,7 +43,7 @@ ACPI_MODULE_NAME("acpi_bus") | |||
43 | extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); | 43 | extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | FADT_DESCRIPTOR acpi_fadt; | 46 | struct fadt_descriptor acpi_fadt; |
47 | EXPORT_SYMBOL(acpi_fadt); | 47 | EXPORT_SYMBOL(acpi_fadt); |
48 | 48 | ||
49 | struct acpi_device *acpi_root; | 49 | struct acpi_device *acpi_root; |
@@ -596,6 +596,8 @@ void __init acpi_early_init(void) | |||
596 | if (acpi_disabled) | 596 | if (acpi_disabled) |
597 | return_VOID; | 597 | return_VOID; |
598 | 598 | ||
599 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); | ||
600 | |||
599 | /* enable workarounds, unless strict ACPI spec. compliance */ | 601 | /* enable workarounds, unless strict ACPI spec. compliance */ |
600 | if (!acpi_strict) | 602 | if (!acpi_strict) |
601 | acpi_gbl_enable_interpreter_slack = TRUE; | 603 | acpi_gbl_enable_interpreter_slack = TRUE; |
@@ -617,7 +619,7 @@ void __init acpi_early_init(void) | |||
617 | /* | 619 | /* |
618 | * Get a separate copy of the FADT for use by other drivers. | 620 | * Get a separate copy of the FADT for use by other drivers. |
619 | */ | 621 | */ |
620 | status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer); | 622 | status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &buffer); |
621 | if (ACPI_FAILURE(status)) { | 623 | if (ACPI_FAILURE(status)) { |
622 | printk(KERN_ERR PREFIX "Unable to get the FADT\n"); | 624 | printk(KERN_ERR PREFIX "Unable to get the FADT\n"); |
623 | goto error0; | 625 | goto error0; |
@@ -743,8 +745,6 @@ static int __init acpi_init(void) | |||
743 | 745 | ||
744 | ACPI_FUNCTION_TRACE("acpi_init"); | 746 | ACPI_FUNCTION_TRACE("acpi_init"); |
745 | 747 | ||
746 | printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION); | ||
747 | |||
748 | if (acpi_disabled) { | 748 | if (acpi_disabled) { |
749 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); | 749 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); |
750 | return_VALUE(-ENODEV); | 750 | return_VALUE(-ENODEV); |
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 76bc0463f6de..a6d77efb41a0 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c | |||
@@ -87,7 +87,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
87 | union acpi_operand_object *second_desc = NULL; | 87 | union acpi_operand_object *second_desc = NULL; |
88 | u32 flags; | 88 | u32 flags; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ds_create_buffer_field"); | 90 | ACPI_FUNCTION_TRACE(ds_create_buffer_field); |
91 | 91 | ||
92 | /* Get the name_string argument */ | 92 | /* Get the name_string argument */ |
93 | 93 | ||
@@ -210,7 +210,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
210 | acpi_status status; | 210 | acpi_status status; |
211 | acpi_integer position; | 211 | acpi_integer position; |
212 | 212 | ||
213 | ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info); | 213 | ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); |
214 | 214 | ||
215 | /* First field starts at bit zero */ | 215 | /* First field starts at bit zero */ |
216 | 216 | ||
@@ -342,7 +342,7 @@ acpi_ds_create_field(union acpi_parse_object *op, | |||
342 | union acpi_parse_object *arg; | 342 | union acpi_parse_object *arg; |
343 | struct acpi_create_field_info info; | 343 | struct acpi_create_field_info info; |
344 | 344 | ||
345 | ACPI_FUNCTION_TRACE_PTR("ds_create_field", op); | 345 | ACPI_FUNCTION_TRACE_PTR(ds_create_field, op); |
346 | 346 | ||
347 | /* First arg is the name of the parent op_region (must already exist) */ | 347 | /* First arg is the name of the parent op_region (must already exist) */ |
348 | 348 | ||
@@ -399,7 +399,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
399 | struct acpi_namespace_node *node; | 399 | struct acpi_namespace_node *node; |
400 | u8 type = 0; | 400 | u8 type = 0; |
401 | 401 | ||
402 | ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op); |
403 | 403 | ||
404 | switch (walk_state->opcode) { | 404 | switch (walk_state->opcode) { |
405 | case AML_FIELD_OP: | 405 | case AML_FIELD_OP: |
@@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
425 | * Walk the list of entries in the field_list | 425 | * Walk the list of entries in the field_list |
426 | */ | 426 | */ |
427 | while (arg) { | 427 | while (arg) { |
428 | |||
428 | /* Ignore OFFSET and ACCESSAS terms here */ | 429 | /* Ignore OFFSET and ACCESSAS terms here */ |
429 | 430 | ||
430 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { | 431 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { |
@@ -481,7 +482,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
481 | union acpi_parse_object *arg; | 482 | union acpi_parse_object *arg; |
482 | struct acpi_create_field_info info; | 483 | struct acpi_create_field_info info; |
483 | 484 | ||
484 | ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op); | 485 | ACPI_FUNCTION_TRACE_PTR(ds_create_bank_field, op); |
485 | 486 | ||
486 | /* First arg is the name of the parent op_region (must already exist) */ | 487 | /* First arg is the name of the parent op_region (must already exist) */ |
487 | 488 | ||
@@ -554,7 +555,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op, | |||
554 | union acpi_parse_object *arg; | 555 | union acpi_parse_object *arg; |
555 | struct acpi_create_field_info info; | 556 | struct acpi_create_field_info info; |
556 | 557 | ||
557 | ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op); | 558 | ACPI_FUNCTION_TRACE_PTR(ds_create_index_field, op); |
558 | 559 | ||
559 | /* First arg is the name of the Index register (must already exist) */ | 560 | /* First arg is the name of the Index register (must already exist) */ |
560 | 561 | ||
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index e65a07ad2422..bbdf990e9f65 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -184,7 +184,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
184 | * | 184 | * |
185 | * RETURN: Status | 185 | * RETURN: Status |
186 | * | 186 | * |
187 | * DESCRIPTION: Walk the namespace starting at "start_node" and perform any | 187 | * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any |
188 | * necessary initialization on the objects found therein | 188 | * necessary initialization on the objects found therein |
189 | * | 189 | * |
190 | ******************************************************************************/ | 190 | ******************************************************************************/ |
@@ -196,7 +196,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, | |||
196 | acpi_status status; | 196 | acpi_status status; |
197 | struct acpi_init_walk_info info; | 197 | struct acpi_init_walk_info info; |
198 | 198 | ||
199 | ACPI_FUNCTION_TRACE("ds_initialize_objects"); | 199 | ACPI_FUNCTION_TRACE(ds_initialize_objects); |
200 | 200 | ||
201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
202 | "**** Starting initialization of namespace objects ****\n")); | 202 | "**** Starting initialization of namespace objects ****\n")); |
@@ -213,7 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, | |||
213 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, | 213 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, |
214 | acpi_ds_init_one_object, &info, NULL); | 214 | acpi_ds_init_one_object, &info, NULL); |
215 | if (ACPI_FAILURE(status)) { | 215 | if (ACPI_FAILURE(status)) { |
216 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 216 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); |
217 | } | 217 | } |
218 | 218 | ||
219 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 219 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index c475546535b6..bc9aca4e7401 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
81 | /* Invoke the global exception handler */ | 81 | /* Invoke the global exception handler */ |
82 | 82 | ||
83 | if (acpi_gbl_exception_handler) { | 83 | if (acpi_gbl_exception_handler) { |
84 | |||
84 | /* Exit the interpreter, allow handler to execute methods */ | 85 | /* Exit the interpreter, allow handler to execute methods */ |
85 | 86 | ||
86 | acpi_ex_exit_interpreter(); | 87 | acpi_ex_exit_interpreter(); |
@@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
100 | } | 101 | } |
101 | #ifdef ACPI_DISASSEMBLER | 102 | #ifdef ACPI_DISASSEMBLER |
102 | if (ACPI_FAILURE(status)) { | 103 | if (ACPI_FAILURE(status)) { |
104 | |||
103 | /* Display method locals/args if disassembler is present */ | 105 | /* Display method locals/args if disassembler is present */ |
104 | 106 | ||
105 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); | 107 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); |
@@ -132,7 +134,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
132 | { | 134 | { |
133 | acpi_status status = AE_OK; | 135 | acpi_status status = AE_OK; |
134 | 136 | ||
135 | ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node); | 137 | ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node); |
136 | 138 | ||
137 | if (!method_node) { | 139 | if (!method_node) { |
138 | return_ACPI_STATUS(AE_NULL_ENTRY); | 140 | return_ACPI_STATUS(AE_NULL_ENTRY); |
@@ -168,11 +170,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
168 | 170 | ||
169 | /* | 171 | /* |
170 | * Get a unit from the method semaphore. This releases the | 172 | * Get a unit from the method semaphore. This releases the |
171 | * interpreter if we block | 173 | * interpreter if we block (then reacquires it) |
172 | */ | 174 | */ |
173 | status = | 175 | status = |
174 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, | 176 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, |
175 | ACPI_WAIT_FOREVER); | 177 | ACPI_WAIT_FOREVER); |
178 | if (ACPI_FAILURE(status)) { | ||
179 | return_ACPI_STATUS(status); | ||
180 | } | ||
176 | } | 181 | } |
177 | 182 | ||
178 | /* | 183 | /* |
@@ -183,7 +188,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
183 | if (!obj_desc->method.owner_id) { | 188 | if (!obj_desc->method.owner_id) { |
184 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | 189 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); |
185 | if (ACPI_FAILURE(status)) { | 190 | if (ACPI_FAILURE(status)) { |
186 | return_ACPI_STATUS(status); | 191 | goto cleanup; |
187 | } | 192 | } |
188 | } | 193 | } |
189 | 194 | ||
@@ -193,6 +198,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
193 | */ | 198 | */ |
194 | obj_desc->method.thread_count++; | 199 | obj_desc->method.thread_count++; |
195 | return_ACPI_STATUS(status); | 200 | return_ACPI_STATUS(status); |
201 | |||
202 | cleanup: | ||
203 | /* On error, must signal the method semaphore if present */ | ||
204 | |||
205 | if (obj_desc->method.semaphore) { | ||
206 | (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1); | ||
207 | } | ||
208 | return_ACPI_STATUS(status); | ||
196 | } | 209 | } |
197 | 210 | ||
198 | /******************************************************************************* | 211 | /******************************************************************************* |
@@ -218,10 +231,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
218 | struct acpi_namespace_node *method_node; | 231 | struct acpi_namespace_node *method_node; |
219 | struct acpi_walk_state *next_walk_state = NULL; | 232 | struct acpi_walk_state *next_walk_state = NULL; |
220 | union acpi_operand_object *obj_desc; | 233 | union acpi_operand_object *obj_desc; |
221 | struct acpi_parameter_info info; | 234 | struct acpi_evaluate_info *info; |
222 | u32 i; | 235 | u32 i; |
223 | 236 | ||
224 | ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state); | 237 | ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state); |
225 | 238 | ||
226 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 239 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
227 | "Execute method %p, currentstate=%p\n", | 240 | "Execute method %p, currentstate=%p\n", |
@@ -240,25 +253,31 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
240 | return_ACPI_STATUS(AE_NULL_OBJECT); | 253 | return_ACPI_STATUS(AE_NULL_OBJECT); |
241 | } | 254 | } |
242 | 255 | ||
243 | /* Init for new method, wait on concurrency semaphore */ | 256 | /* Init for new method, possibly wait on concurrency semaphore */ |
244 | 257 | ||
245 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 258 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
246 | this_walk_state->method_node); | 259 | this_walk_state->method_node); |
247 | if (ACPI_FAILURE(status)) { | 260 | if (ACPI_FAILURE(status)) { |
248 | goto cleanup; | 261 | return_ACPI_STATUS(status); |
249 | } | 262 | } |
250 | 263 | ||
264 | /* | ||
265 | * 1) Parse the method. All "normal" methods are parsed for each execution. | ||
266 | * Internal methods (_OSI, etc.) do not require parsing. | ||
267 | */ | ||
251 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { | 268 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { |
252 | /* 1) Parse: Create a new walk state for the preempting walk */ | 269 | |
270 | /* Create a new walk state for the parse */ | ||
253 | 271 | ||
254 | next_walk_state = | 272 | next_walk_state = |
255 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, | 273 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, |
256 | obj_desc, NULL); | 274 | obj_desc, NULL); |
257 | if (!next_walk_state) { | 275 | if (!next_walk_state) { |
258 | return_ACPI_STATUS(AE_NO_MEMORY); | 276 | status = AE_NO_MEMORY; |
277 | goto cleanup; | ||
259 | } | 278 | } |
260 | 279 | ||
261 | /* Create and init a Root Node */ | 280 | /* Create and init a parse tree root */ |
262 | 281 | ||
263 | op = acpi_ps_create_scope_op(); | 282 | op = acpi_ps_create_scope_op(); |
264 | if (!op) { | 283 | if (!op) { |
@@ -271,17 +290,20 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
271 | obj_desc->method.aml_length, | 290 | obj_desc->method.aml_length, |
272 | NULL, 1); | 291 | NULL, 1); |
273 | if (ACPI_FAILURE(status)) { | 292 | if (ACPI_FAILURE(status)) { |
274 | acpi_ds_delete_walk_state(next_walk_state); | 293 | acpi_ps_delete_parse_tree(op); |
275 | goto cleanup; | 294 | goto cleanup; |
276 | } | 295 | } |
277 | 296 | ||
278 | /* Begin AML parse */ | 297 | /* Begin AML parse (deletes next_walk_state) */ |
279 | 298 | ||
280 | status = acpi_ps_parse_aml(next_walk_state); | 299 | status = acpi_ps_parse_aml(next_walk_state); |
281 | acpi_ps_delete_parse_tree(op); | 300 | acpi_ps_delete_parse_tree(op); |
301 | if (ACPI_FAILURE(status)) { | ||
302 | goto cleanup; | ||
303 | } | ||
282 | } | 304 | } |
283 | 305 | ||
284 | /* 2) Execute: Create a new state for the preempting walk */ | 306 | /* 2) Begin method execution. Create a new walk state */ |
285 | 307 | ||
286 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, | 308 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, |
287 | NULL, obj_desc, thread); | 309 | NULL, obj_desc, thread); |
@@ -289,6 +311,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
289 | status = AE_NO_MEMORY; | 311 | status = AE_NO_MEMORY; |
290 | goto cleanup; | 312 | goto cleanup; |
291 | } | 313 | } |
314 | |||
292 | /* | 315 | /* |
293 | * The resolved arguments were put on the previous walk state's operand | 316 | * The resolved arguments were put on the previous walk state's operand |
294 | * stack. Operands on the previous walk state stack always | 317 | * stack. Operands on the previous walk state stack always |
@@ -296,12 +319,24 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
296 | */ | 319 | */ |
297 | this_walk_state->operands[this_walk_state->num_operands] = NULL; | 320 | this_walk_state->operands[this_walk_state->num_operands] = NULL; |
298 | 321 | ||
299 | info.parameters = &this_walk_state->operands[0]; | 322 | /* |
300 | info.parameter_type = ACPI_PARAM_ARGS; | 323 | * Allocate and initialize the evaluation information block |
324 | * TBD: this is somewhat inefficient, should change interface to | ||
325 | * ds_init_aml_walk. For now, keeps this struct off the CPU stack | ||
326 | */ | ||
327 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
328 | if (!info) { | ||
329 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
330 | } | ||
331 | |||
332 | info->parameters = &this_walk_state->operands[0]; | ||
333 | info->parameter_type = ACPI_PARAM_ARGS; | ||
301 | 334 | ||
302 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, | 335 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, |
303 | obj_desc->method.aml_start, | 336 | obj_desc->method.aml_start, |
304 | obj_desc->method.aml_length, &info, 3); | 337 | obj_desc->method.aml_length, info, 3); |
338 | |||
339 | ACPI_FREE(info); | ||
305 | if (ACPI_FAILURE(status)) { | 340 | if (ACPI_FAILURE(status)) { |
306 | goto cleanup; | 341 | goto cleanup; |
307 | } | 342 | } |
@@ -323,6 +358,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
323 | "Starting nested execution, newstate=%p\n", | 358 | "Starting nested execution, newstate=%p\n", |
324 | next_walk_state)); | 359 | next_walk_state)); |
325 | 360 | ||
361 | /* Invoke an internal method if necessary */ | ||
362 | |||
326 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 363 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
327 | status = obj_desc->method.implementation(next_walk_state); | 364 | status = obj_desc->method.implementation(next_walk_state); |
328 | } | 365 | } |
@@ -330,16 +367,14 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
330 | return_ACPI_STATUS(status); | 367 | return_ACPI_STATUS(status); |
331 | 368 | ||
332 | cleanup: | 369 | cleanup: |
333 | /* Decrement the thread count on the method parse tree */ | ||
334 | 370 | ||
335 | if (next_walk_state && (next_walk_state->method_desc)) { | 371 | /* On error, we must terminate the method properly */ |
336 | next_walk_state->method_desc->method.thread_count--; | ||
337 | } | ||
338 | 372 | ||
339 | /* On error, we must delete the new walk state */ | 373 | acpi_ds_terminate_control_method(obj_desc, next_walk_state); |
374 | if (next_walk_state) { | ||
375 | acpi_ds_delete_walk_state(next_walk_state); | ||
376 | } | ||
340 | 377 | ||
341 | acpi_ds_terminate_control_method(next_walk_state); | ||
342 | acpi_ds_delete_walk_state(next_walk_state); | ||
343 | return_ACPI_STATUS(status); | 378 | return_ACPI_STATUS(status); |
344 | } | 379 | } |
345 | 380 | ||
@@ -362,25 +397,33 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
362 | union acpi_operand_object *return_desc) | 397 | union acpi_operand_object *return_desc) |
363 | { | 398 | { |
364 | acpi_status status; | 399 | acpi_status status; |
400 | int same_as_implicit_return; | ||
365 | 401 | ||
366 | ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_restart_control_method, walk_state); |
367 | 403 | ||
368 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 404 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
369 | "****Restart [%4.4s] Op %p return_value_from_callee %p\n", | 405 | "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", |
370 | (char *)&walk_state->method_node->name, | 406 | (char *)&walk_state->method_node->name, |
371 | walk_state->method_call_op, return_desc)); | 407 | walk_state->method_call_op, return_desc)); |
372 | 408 | ||
373 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 409 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
374 | " return_from_this_method_used?=%X res_stack %p Walk %p\n", | 410 | " ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n", |
375 | walk_state->return_used, | 411 | walk_state->return_used, |
376 | walk_state->results, walk_state)); | 412 | walk_state->results, walk_state)); |
377 | 413 | ||
378 | /* Did the called method return a value? */ | 414 | /* Did the called method return a value? */ |
379 | 415 | ||
380 | if (return_desc) { | 416 | if (return_desc) { |
417 | |||
418 | /* Is the implicit return object the same as the return desc? */ | ||
419 | |||
420 | same_as_implicit_return = | ||
421 | (walk_state->implicit_return_obj == return_desc); | ||
422 | |||
381 | /* Are we actually going to use the return value? */ | 423 | /* Are we actually going to use the return value? */ |
382 | 424 | ||
383 | if (walk_state->return_used) { | 425 | if (walk_state->return_used) { |
426 | |||
384 | /* Save the return value from the previous method */ | 427 | /* Save the return value from the previous method */ |
385 | 428 | ||
386 | status = acpi_ds_result_push(return_desc, walk_state); | 429 | status = acpi_ds_result_push(return_desc, walk_state); |
@@ -397,18 +440,23 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
397 | } | 440 | } |
398 | 441 | ||
399 | /* | 442 | /* |
400 | * The following code is the | 443 | * The following code is the optional support for the so-called |
401 | * optional support for a so-called "implicit return". Some AML code | 444 | * "implicit return". Some AML code assumes that the last value of the |
402 | * assumes that the last value of the method is "implicitly" returned | 445 | * method is "implicitly" returned to the caller, in the absence of an |
403 | * to the caller. Just save the last result as the return value. | 446 | * explicit return value. |
447 | * | ||
448 | * Just save the last result of the method as the return value. | ||
449 | * | ||
404 | * NOTE: this is optional because the ASL language does not actually | 450 | * NOTE: this is optional because the ASL language does not actually |
405 | * support this behavior. | 451 | * support this behavior. |
406 | */ | 452 | */ |
407 | else if (!acpi_ds_do_implicit_return | 453 | else if (!acpi_ds_do_implicit_return |
408 | (return_desc, walk_state, FALSE)) { | 454 | (return_desc, walk_state, FALSE) |
455 | || same_as_implicit_return) { | ||
409 | /* | 456 | /* |
410 | * Delete the return value if it will not be used by the | 457 | * Delete the return value if it will not be used by the |
411 | * calling method | 458 | * calling method or remove one reference if the explicit return |
459 | * is the same as the implicit return value. | ||
412 | */ | 460 | */ |
413 | acpi_ut_remove_reference(return_desc); | 461 | acpi_ut_remove_reference(return_desc); |
414 | } | 462 | } |
@@ -421,7 +469,8 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
421 | * | 469 | * |
422 | * FUNCTION: acpi_ds_terminate_control_method | 470 | * FUNCTION: acpi_ds_terminate_control_method |
423 | * | 471 | * |
424 | * PARAMETERS: walk_state - State of the method | 472 | * PARAMETERS: method_desc - Method object |
473 | * walk_state - State associated with the method | ||
425 | * | 474 | * |
426 | * RETURN: None | 475 | * RETURN: None |
427 | * | 476 | * |
@@ -431,95 +480,100 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
431 | * | 480 | * |
432 | ******************************************************************************/ | 481 | ******************************************************************************/ |
433 | 482 | ||
434 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | 483 | void |
484 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | ||
485 | struct acpi_walk_state *walk_state) | ||
435 | { | 486 | { |
436 | union acpi_operand_object *obj_desc; | ||
437 | struct acpi_namespace_node *method_node; | 487 | struct acpi_namespace_node *method_node; |
438 | acpi_status status; | 488 | acpi_status status; |
439 | 489 | ||
440 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | 490 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); |
441 | 491 | ||
442 | if (!walk_state) { | 492 | /* method_desc is required, walk_state is optional */ |
443 | return_VOID; | ||
444 | } | ||
445 | 493 | ||
446 | /* The current method object was saved in the walk state */ | 494 | if (!method_desc) { |
447 | |||
448 | obj_desc = walk_state->method_desc; | ||
449 | if (!obj_desc) { | ||
450 | return_VOID; | 495 | return_VOID; |
451 | } | 496 | } |
452 | 497 | ||
453 | /* Delete all arguments and locals */ | 498 | if (walk_state) { |
454 | 499 | ||
455 | acpi_ds_method_data_delete_all(walk_state); | 500 | /* Delete all arguments and locals */ |
501 | |||
502 | acpi_ds_method_data_delete_all(walk_state); | ||
503 | } | ||
456 | 504 | ||
457 | /* | 505 | /* |
458 | * Lock the parser while we terminate this method. | 506 | * Lock the parser while we terminate this method. |
459 | * If this is the last thread executing the method, | 507 | * If this is the last thread executing the method, |
460 | * we have additional cleanup to perform | 508 | * we have additional cleanup to perform |
461 | */ | 509 | */ |
462 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); | 510 | status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD); |
463 | if (ACPI_FAILURE(status)) { | 511 | if (ACPI_FAILURE(status)) { |
464 | return_VOID; | 512 | return_VOID; |
465 | } | 513 | } |
466 | 514 | ||
467 | /* Signal completion of the execution of this method if necessary */ | 515 | /* Signal completion of the execution of this method if necessary */ |
468 | 516 | ||
469 | if (walk_state->method_desc->method.semaphore) { | 517 | if (method_desc->method.semaphore) { |
470 | status = | 518 | status = |
471 | acpi_os_signal_semaphore(walk_state->method_desc->method. | 519 | acpi_os_signal_semaphore(method_desc->method.semaphore, 1); |
472 | semaphore, 1); | ||
473 | if (ACPI_FAILURE(status)) { | 520 | if (ACPI_FAILURE(status)) { |
474 | ACPI_ERROR((AE_INFO, | ||
475 | "Could not signal method semaphore")); | ||
476 | 521 | ||
477 | /* Ignore error and continue cleanup */ | 522 | /* Ignore error and continue */ |
523 | |||
524 | ACPI_EXCEPTION((AE_INFO, status, | ||
525 | "Could not signal method semaphore")); | ||
478 | } | 526 | } |
479 | } | 527 | } |
480 | 528 | ||
481 | /* | 529 | if (walk_state) { |
482 | * There are no more threads executing this method. Perform | 530 | /* |
483 | * additional cleanup. | 531 | * Delete any objects created by this method during execution. |
484 | * | 532 | * The method Node is stored in the walk state |
485 | * The method Node is stored in the walk state | 533 | */ |
486 | */ | 534 | method_node = walk_state->method_node; |
487 | method_node = walk_state->method_node; | ||
488 | 535 | ||
489 | /* Lock namespace for possible update */ | 536 | /* Lock namespace for possible update */ |
490 | 537 | ||
491 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 538 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
492 | if (ACPI_FAILURE(status)) { | 539 | if (ACPI_FAILURE(status)) { |
493 | goto exit; | 540 | goto exit; |
494 | } | 541 | } |
495 | 542 | ||
496 | /* | 543 | /* |
497 | * Delete any namespace entries created immediately underneath | 544 | * Delete any namespace entries created immediately underneath |
498 | * the method | 545 | * the method |
499 | */ | 546 | */ |
500 | if (method_node->child) { | 547 | if (method_node && method_node->child) { |
501 | acpi_ns_delete_namespace_subtree(method_node); | 548 | acpi_ns_delete_namespace_subtree(method_node); |
549 | } | ||
550 | |||
551 | /* | ||
552 | * Delete any namespace entries created anywhere else within | ||
553 | * the namespace by the execution of this method | ||
554 | */ | ||
555 | acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); | ||
556 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
502 | } | 557 | } |
503 | 558 | ||
504 | /* | 559 | /* Decrement the thread count on the method */ |
505 | * Delete any namespace entries created anywhere else within | 560 | |
506 | * the namespace by the execution of this method | 561 | if (method_desc->method.thread_count) { |
507 | */ | 562 | method_desc->method.thread_count--; |
508 | acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. | 563 | } else { |
509 | owner_id); | 564 | ACPI_ERROR((AE_INFO, "Invalid zero thread count in method")); |
510 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 565 | } |
511 | 566 | ||
512 | /* Are there any other threads currently executing this method? */ | 567 | /* Are there any other threads currently executing this method? */ |
513 | 568 | ||
514 | if (walk_state->method_desc->method.thread_count) { | 569 | if (method_desc->method.thread_count) { |
515 | /* | 570 | /* |
516 | * Additional threads. Do not release the owner_id in this case, | 571 | * Additional threads. Do not release the owner_id in this case, |
517 | * we immediately reuse it for the next thread executing this method | 572 | * we immediately reuse it for the next thread executing this method |
518 | */ | 573 | */ |
519 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 574 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
520 | "*** Completed execution of one thread, %d threads remaining\n", | 575 | "*** Completed execution of one thread, %d threads remaining\n", |
521 | walk_state->method_desc->method. | 576 | method_desc->method.thread_count)); |
522 | thread_count)); | ||
523 | } else { | 577 | } else { |
524 | /* This is the only executing thread for this method */ | 578 | /* This is the only executing thread for this method */ |
525 | 579 | ||
@@ -533,22 +587,20 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
533 | * This code is here because we must wait until the last thread exits | 587 | * This code is here because we must wait until the last thread exits |
534 | * before creating the synchronization semaphore. | 588 | * before creating the synchronization semaphore. |
535 | */ | 589 | */ |
536 | if ((walk_state->method_desc->method.concurrency == 1) && | 590 | if ((method_desc->method.concurrency == 1) && |
537 | (!walk_state->method_desc->method.semaphore)) { | 591 | (!method_desc->method.semaphore)) { |
538 | status = acpi_os_create_semaphore(1, 1, | 592 | status = acpi_os_create_semaphore(1, 1, |
539 | &walk_state-> | 593 | &method_desc->method. |
540 | method_desc->method. | ||
541 | semaphore); | 594 | semaphore); |
542 | } | 595 | } |
543 | 596 | ||
544 | /* No more threads, we can free the owner_id */ | 597 | /* No more threads, we can free the owner_id */ |
545 | 598 | ||
546 | acpi_ut_release_owner_id(&walk_state->method_desc->method. | 599 | acpi_ut_release_owner_id(&method_desc->method.owner_id); |
547 | owner_id); | ||
548 | } | 600 | } |
549 | 601 | ||
550 | exit: | 602 | exit: |
551 | (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); | 603 | (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD); |
552 | return_VOID; | 604 | return_VOID; |
553 | } | 605 | } |
554 | 606 | ||
@@ -581,7 +633,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
581 | union acpi_parse_object *op; | 633 | union acpi_parse_object *op; |
582 | struct acpi_walk_state *walk_state; | 634 | struct acpi_walk_state *walk_state; |
583 | 635 | ||
584 | ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); | 636 | ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node); |
585 | 637 | ||
586 | /* Parameter Validation */ | 638 | /* Parameter Validation */ |
587 | 639 | ||
@@ -590,7 +642,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
590 | } | 642 | } |
591 | 643 | ||
592 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 644 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
593 | "**** Parsing [%4.4s] **** named_obj=%p\n", | 645 | "**** Parsing [%4.4s] **** NamedObj=%p\n", |
594 | acpi_ut_get_node_name(node), node)); | 646 | acpi_ut_get_node_name(node), node)); |
595 | 647 | ||
596 | /* Extract the method object from the method Node */ | 648 | /* Extract the method object from the method Node */ |
@@ -669,7 +721,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
669 | } | 721 | } |
670 | 722 | ||
671 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 723 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
672 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 724 | "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", |
673 | acpi_ut_get_node_name(node), node, op)); | 725 | acpi_ut_get_node_name(node), node, op)); |
674 | 726 | ||
675 | /* | 727 | /* |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index c025674f938b..459160ff9058 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -81,7 +81,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
81 | * special data types. | 81 | * special data types. |
82 | * | 82 | * |
83 | * NOTES: walk_state fields are initialized to zero by the | 83 | * NOTES: walk_state fields are initialized to zero by the |
84 | * ACPI_MEM_CALLOCATE(). | 84 | * ACPI_ALLOCATE_ZEROED(). |
85 | * | 85 | * |
86 | * A pseudo-Namespace Node is assigned to each argument and local | 86 | * A pseudo-Namespace Node is assigned to each argument and local |
87 | * so that ref_of() can return a pointer to the Node. | 87 | * so that ref_of() can return a pointer to the Node. |
@@ -92,7 +92,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
92 | { | 92 | { |
93 | u32 i; | 93 | u32 i; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE("ds_method_data_init"); | 95 | ACPI_FUNCTION_TRACE(ds_method_data_init); |
96 | 96 | ||
97 | /* Init the method arguments */ | 97 | /* Init the method arguments */ |
98 | 98 | ||
@@ -100,10 +100,10 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, | 100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, |
101 | NAMEOF_ARG_NTE); | 101 | NAMEOF_ARG_NTE); |
102 | walk_state->arguments[i].name.integer |= (i << 24); | 102 | walk_state->arguments[i].name.integer |= (i << 24); |
103 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; | 103 | walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; |
104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
105 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | | 105 | walk_state->arguments[i].flags = |
106 | ANOBJ_METHOD_ARG; | 106 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; |
107 | } | 107 | } |
108 | 108 | ||
109 | /* Init the method locals */ | 109 | /* Init the method locals */ |
@@ -113,11 +113,11 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
113 | NAMEOF_LOCAL_NTE); | 113 | NAMEOF_LOCAL_NTE); |
114 | 114 | ||
115 | walk_state->local_variables[i].name.integer |= (i << 24); | 115 | walk_state->local_variables[i].name.integer |= (i << 24); |
116 | walk_state->local_variables[i].descriptor = | 116 | walk_state->local_variables[i].descriptor_type = |
117 | ACPI_DESC_TYPE_NAMED; | 117 | ACPI_DESC_TYPE_NAMED; |
118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
119 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | | 119 | walk_state->local_variables[i].flags = |
120 | ANOBJ_METHOD_LOCAL; | 120 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; |
121 | } | 121 | } |
122 | 122 | ||
123 | return_VOID; | 123 | return_VOID; |
@@ -140,7 +140,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) | |||
140 | { | 140 | { |
141 | u32 index; | 141 | u32 index; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE("ds_method_data_delete_all"); | 143 | ACPI_FUNCTION_TRACE(ds_method_data_delete_all); |
144 | 144 | ||
145 | /* Detach the locals */ | 145 | /* Detach the locals */ |
146 | 146 | ||
@@ -199,7 +199,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
199 | acpi_status status; | 199 | acpi_status status; |
200 | u32 index = 0; | 200 | u32 index = 0; |
201 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params); | 202 | ACPI_FUNCTION_TRACE_PTR(ds_method_data_init_args, params); |
203 | 203 | ||
204 | if (!params) { | 204 | if (!params) { |
205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -251,7 +251,7 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
251 | struct acpi_walk_state *walk_state, | 251 | struct acpi_walk_state *walk_state, |
252 | struct acpi_namespace_node **node) | 252 | struct acpi_namespace_node **node) |
253 | { | 253 | { |
254 | ACPI_FUNCTION_TRACE("ds_method_data_get_node"); | 254 | ACPI_FUNCTION_TRACE(ds_method_data_get_node); |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * Method Locals and Arguments are supported | 257 | * Method Locals and Arguments are supported |
@@ -318,10 +318,10 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
318 | acpi_status status; | 318 | acpi_status status; |
319 | struct acpi_namespace_node *node; | 319 | struct acpi_namespace_node *node; |
320 | 320 | ||
321 | ACPI_FUNCTION_TRACE("ds_method_data_set_value"); | 321 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); |
322 | 322 | ||
323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
324 | "new_obj %p Opcode %X, Refs=%d [%s]\n", object, | 324 | "NewObj %p Opcode %X, Refs=%d [%s]\n", object, |
325 | opcode, object->common.reference_count, | 325 | opcode, object->common.reference_count, |
326 | acpi_ut_get_type_name(object->common.type))); | 326 | acpi_ut_get_type_name(object->common.type))); |
327 | 327 | ||
@@ -336,7 +336,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
336 | * Increment ref count so object can't be deleted while installed. | 336 | * Increment ref count so object can't be deleted while installed. |
337 | * NOTE: We do not copy the object in order to preserve the call by | 337 | * NOTE: We do not copy the object in order to preserve the call by |
338 | * reference semantics of ACPI Control Method invocation. | 338 | * reference semantics of ACPI Control Method invocation. |
339 | * (See ACPI specification 2.0_c) | 339 | * (See ACPI Specification 2.0_c) |
340 | */ | 340 | */ |
341 | acpi_ut_add_reference(object); | 341 | acpi_ut_add_reference(object); |
342 | 342 | ||
@@ -351,7 +351,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
351 | * FUNCTION: acpi_ds_method_data_get_value | 351 | * FUNCTION: acpi_ds_method_data_get_value |
352 | * | 352 | * |
353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
354 | * Index - which local_var or argument to get | 354 | * Index - Which local_var or argument to get |
355 | * walk_state - Current walk state object | 355 | * walk_state - Current walk state object |
356 | * dest_desc - Where Arg or Local value is returned | 356 | * dest_desc - Where Arg or Local value is returned |
357 | * | 357 | * |
@@ -372,7 +372,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
372 | struct acpi_namespace_node *node; | 372 | struct acpi_namespace_node *node; |
373 | union acpi_operand_object *object; | 373 | union acpi_operand_object *object; |
374 | 374 | ||
375 | ACPI_FUNCTION_TRACE("ds_method_data_get_value"); | 375 | ACPI_FUNCTION_TRACE(ds_method_data_get_value); |
376 | 376 | ||
377 | /* Validate the object descriptor */ | 377 | /* Validate the object descriptor */ |
378 | 378 | ||
@@ -459,7 +459,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
459 | * FUNCTION: acpi_ds_method_data_delete_value | 459 | * FUNCTION: acpi_ds_method_data_delete_value |
460 | * | 460 | * |
461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
462 | * Index - which local_var or argument to delete | 462 | * Index - Which local_var or argument to delete |
463 | * walk_state - Current walk state object | 463 | * walk_state - Current walk state object |
464 | * | 464 | * |
465 | * RETURN: None | 465 | * RETURN: None |
@@ -477,7 +477,7 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
477 | struct acpi_namespace_node *node; | 477 | struct acpi_namespace_node *node; |
478 | union acpi_operand_object *object; | 478 | union acpi_operand_object *object; |
479 | 479 | ||
480 | ACPI_FUNCTION_TRACE("ds_method_data_delete_value"); | 480 | ACPI_FUNCTION_TRACE(ds_method_data_delete_value); |
481 | 481 | ||
482 | /* Get the namespace node for the arg/local */ | 482 | /* Get the namespace node for the arg/local */ |
483 | 483 | ||
@@ -538,7 +538,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
538 | union acpi_operand_object *current_obj_desc; | 538 | union acpi_operand_object *current_obj_desc; |
539 | union acpi_operand_object *new_obj_desc; | 539 | union acpi_operand_object *new_obj_desc; |
540 | 540 | ||
541 | ACPI_FUNCTION_TRACE("ds_store_object_to_local"); | 541 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); |
542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", | 542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", |
543 | opcode, index, obj_desc)); | 543 | opcode, index, obj_desc)); |
544 | 544 | ||
@@ -614,7 +614,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
614 | && (current_obj_desc->reference.opcode == | 614 | && (current_obj_desc->reference.opcode == |
615 | AML_REF_OF_OP)) { | 615 | AML_REF_OF_OP)) { |
616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
617 | "Arg (%p) is an obj_ref(Node), storing in node %p\n", | 617 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", |
618 | new_obj_desc, | 618 | new_obj_desc, |
619 | current_obj_desc)); | 619 | current_obj_desc)); |
620 | 620 | ||
@@ -688,7 +688,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
688 | struct acpi_namespace_node *node; | 688 | struct acpi_namespace_node *node; |
689 | union acpi_operand_object *object; | 689 | union acpi_operand_object *object; |
690 | 690 | ||
691 | ACPI_FUNCTION_TRACE("ds_method_data_get_type"); | 691 | ACPI_FUNCTION_TRACE(ds_method_data_get_type); |
692 | 692 | ||
693 | /* Get the namespace node for the arg/local */ | 693 | /* Get the namespace node for the arg/local */ |
694 | 694 | ||
@@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
701 | 701 | ||
702 | object = acpi_ns_get_attached_object(node); | 702 | object = acpi_ns_get_attached_object(node); |
703 | if (!object) { | 703 | if (!object) { |
704 | |||
704 | /* Uninitialized local/arg, return TYPE_ANY */ | 705 | /* Uninitialized local/arg, return TYPE_ANY */ |
705 | 706 | ||
706 | return_VALUE(ACPI_TYPE_ANY); | 707 | return_VALUE(ACPI_TYPE_ANY); |
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 8b21f0f9e517..72190abb1d59 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -81,7 +81,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
81 | union acpi_operand_object *obj_desc; | 81 | union acpi_operand_object *obj_desc; |
82 | acpi_status status; | 82 | acpi_status status; |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("ds_build_internal_object"); | 84 | ACPI_FUNCTION_TRACE(ds_build_internal_object); |
85 | 85 | ||
86 | *obj_desc_ptr = NULL; | 86 | *obj_desc_ptr = NULL; |
87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
@@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
103 | common. | 103 | common. |
104 | node))); | 104 | node))); |
105 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
106 | |||
106 | /* Check if we are resolving a named reference within a package */ | 107 | /* Check if we are resolving a named reference within a package */ |
107 | 108 | ||
108 | if ((status == AE_NOT_FOUND) | 109 | if ((status == AE_NOT_FOUND) |
@@ -186,7 +187,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
186 | union acpi_parse_object *byte_list; | 187 | union acpi_parse_object *byte_list; |
187 | u32 byte_list_length = 0; | 188 | u32 byte_list_length = 0; |
188 | 189 | ||
189 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); | 190 | ACPI_FUNCTION_TRACE(ds_build_internal_buffer_obj); |
190 | 191 | ||
191 | /* | 192 | /* |
192 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". | 193 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". |
@@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
195 | */ | 196 | */ |
196 | obj_desc = *obj_desc_ptr; | 197 | obj_desc = *obj_desc_ptr; |
197 | if (!obj_desc) { | 198 | if (!obj_desc) { |
199 | |||
198 | /* Create a new buffer object */ | 200 | /* Create a new buffer object */ |
199 | 201 | ||
200 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 202 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
@@ -243,7 +245,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
243 | "Buffer defined with zero length in AML, creating\n")); | 245 | "Buffer defined with zero length in AML, creating\n")); |
244 | } else { | 246 | } else { |
245 | obj_desc->buffer.pointer = | 247 | obj_desc->buffer.pointer = |
246 | ACPI_MEM_CALLOCATE(obj_desc->buffer.length); | 248 | ACPI_ALLOCATE_ZEROED(obj_desc->buffer.length); |
247 | if (!obj_desc->buffer.pointer) { | 249 | if (!obj_desc->buffer.pointer) { |
248 | acpi_ut_delete_object_desc(obj_desc); | 250 | acpi_ut_delete_object_desc(obj_desc); |
249 | return_ACPI_STATUS(AE_NO_MEMORY); | 251 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -291,7 +293,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
291 | acpi_status status = AE_OK; | 293 | acpi_status status = AE_OK; |
292 | acpi_native_uint i; | 294 | acpi_native_uint i; |
293 | 295 | ||
294 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); | 296 | ACPI_FUNCTION_TRACE(ds_build_internal_package_obj); |
295 | 297 | ||
296 | /* Find the parent of a possibly nested package */ | 298 | /* Find the parent of a possibly nested package */ |
297 | 299 | ||
@@ -339,9 +341,10 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
339 | * individual objects). Add an extra pointer slot so | 341 | * individual objects). Add an extra pointer slot so |
340 | * that the list is always null terminated. | 342 | * that the list is always null terminated. |
341 | */ | 343 | */ |
342 | obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc-> | 344 | obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) |
343 | package.count + | 345 | obj_desc->package. |
344 | 1) * sizeof(void *)); | 346 | count + |
347 | 1) * sizeof(void *)); | ||
345 | 348 | ||
346 | if (!obj_desc->package.elements) { | 349 | if (!obj_desc->package.elements) { |
347 | acpi_ut_delete_object_desc(obj_desc); | 350 | acpi_ut_delete_object_desc(obj_desc); |
@@ -355,6 +358,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
355 | arg = arg->common.next; | 358 | arg = arg->common.next; |
356 | for (i = 0; arg; i++) { | 359 | for (i = 0; arg; i++) { |
357 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 360 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
361 | |||
358 | /* Object (package or buffer) is already built */ | 362 | /* Object (package or buffer) is already built */ |
359 | 363 | ||
360 | obj_desc->package.elements[i] = | 364 | obj_desc->package.elements[i] = |
@@ -396,7 +400,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
396 | acpi_status status; | 400 | acpi_status status; |
397 | union acpi_operand_object *obj_desc; | 401 | union acpi_operand_object *obj_desc; |
398 | 402 | ||
399 | ACPI_FUNCTION_TRACE_PTR("ds_create_node", op); | 403 | ACPI_FUNCTION_TRACE_PTR(ds_create_node, op); |
400 | 404 | ||
401 | /* | 405 | /* |
402 | * Because of the execution pass through the non-control-method | 406 | * Because of the execution pass through the non-control-method |
@@ -408,6 +412,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
408 | } | 412 | } |
409 | 413 | ||
410 | if (!op->common.value.arg) { | 414 | if (!op->common.value.arg) { |
415 | |||
411 | /* No arguments, there is nothing to do */ | 416 | /* No arguments, there is nothing to do */ |
412 | 417 | ||
413 | return_ACPI_STATUS(AE_OK); | 418 | return_ACPI_STATUS(AE_OK); |
@@ -464,11 +469,12 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
464 | union acpi_operand_object *obj_desc; | 469 | union acpi_operand_object *obj_desc; |
465 | acpi_status status = AE_OK; | 470 | acpi_status status = AE_OK; |
466 | 471 | ||
467 | ACPI_FUNCTION_TRACE("ds_init_object_from_op"); | 472 | ACPI_FUNCTION_TRACE(ds_init_object_from_op); |
468 | 473 | ||
469 | obj_desc = *ret_obj_desc; | 474 | obj_desc = *ret_obj_desc; |
470 | op_info = acpi_ps_get_opcode_info(opcode); | 475 | op_info = acpi_ps_get_opcode_info(opcode); |
471 | if (op_info->class == AML_CLASS_UNKNOWN) { | 476 | if (op_info->class == AML_CLASS_UNKNOWN) { |
477 | |||
472 | /* Unknown opcode */ | 478 | /* Unknown opcode */ |
473 | 479 | ||
474 | return_ACPI_STATUS(AE_TYPE); | 480 | return_ACPI_STATUS(AE_TYPE); |
@@ -626,6 +632,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
626 | default: /* Other literals, etc.. */ | 632 | default: /* Other literals, etc.. */ |
627 | 633 | ||
628 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 634 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
635 | |||
629 | /* Node was saved in Op */ | 636 | /* Node was saved in Op */ |
630 | 637 | ||
631 | obj_desc->reference.node = op->common.node; | 638 | obj_desc->reference.node = op->common.node; |
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 6229c10674e1..5b974a8fe614 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -91,7 +91,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node, | |||
91 | union acpi_parse_object *op; | 91 | union acpi_parse_object *op; |
92 | struct acpi_walk_state *walk_state; | 92 | struct acpi_walk_state *walk_state; |
93 | 93 | ||
94 | ACPI_FUNCTION_TRACE("ds_execute_arguments"); | 94 | ACPI_FUNCTION_TRACE(ds_execute_arguments); |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * Allocate a new parser op to be the root of the parsed tree | 97 | * Allocate a new parser op to be the root of the parsed tree |
@@ -193,7 +193,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
193 | struct acpi_namespace_node *node; | 193 | struct acpi_namespace_node *node; |
194 | acpi_status status; | 194 | acpi_status status; |
195 | 195 | ||
196 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); | 196 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc); |
197 | 197 | ||
198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
199 | return_ACPI_STATUS(AE_OK); | 199 | return_ACPI_STATUS(AE_OK); |
@@ -206,7 +206,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
206 | 206 | ||
207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); | 208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); |
209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", | 209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", |
210 | acpi_ut_get_node_name(node))); | 210 | acpi_ut_get_node_name(node))); |
211 | 211 | ||
212 | /* Execute the AML code for the term_arg arguments */ | 212 | /* Execute the AML code for the term_arg arguments */ |
@@ -235,7 +235,7 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) | |||
235 | struct acpi_namespace_node *node; | 235 | struct acpi_namespace_node *node; |
236 | acpi_status status; | 236 | acpi_status status; |
237 | 237 | ||
238 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); | 238 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc); |
239 | 239 | ||
240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
241 | return_ACPI_STATUS(AE_OK); | 241 | return_ACPI_STATUS(AE_OK); |
@@ -279,7 +279,7 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) | |||
279 | struct acpi_namespace_node *node; | 279 | struct acpi_namespace_node *node; |
280 | acpi_status status; | 280 | acpi_status status; |
281 | 281 | ||
282 | ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); | 282 | ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc); |
283 | 283 | ||
284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
285 | return_ACPI_STATUS(AE_OK); | 285 | return_ACPI_STATUS(AE_OK); |
@@ -324,7 +324,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
324 | acpi_status status; | 324 | acpi_status status; |
325 | union acpi_operand_object *extra_desc; | 325 | union acpi_operand_object *extra_desc; |
326 | 326 | ||
327 | ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); | 327 | ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc); |
328 | 328 | ||
329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | 329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
330 | return_ACPI_STATUS(AE_OK); | 330 | return_ACPI_STATUS(AE_OK); |
@@ -342,8 +342,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
343 | (ACPI_TYPE_REGION, node, NULL)); | 343 | (ACPI_TYPE_REGION, node, NULL)); |
344 | 344 | ||
345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", |
346 | "[%4.4s] op_region Arg Init at AML %p\n", | ||
347 | acpi_ut_get_node_name(node), | 346 | acpi_ut_get_node_name(node), |
348 | extra_desc->extra.aml_start)); | 347 | extra_desc->extra.aml_start)); |
349 | 348 | ||
@@ -352,6 +351,28 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
352 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | 351 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), |
353 | extra_desc->extra.aml_length, | 352 | extra_desc->extra.aml_length, |
354 | extra_desc->extra.aml_start); | 353 | extra_desc->extra.aml_start); |
354 | if (ACPI_FAILURE(status)) { | ||
355 | return_ACPI_STATUS(status); | ||
356 | } | ||
357 | |||
358 | /* Validate the region address/length via the host OS */ | ||
359 | |||
360 | status = acpi_os_validate_address(obj_desc->region.space_id, | ||
361 | obj_desc->region.address, | ||
362 | (acpi_size) obj_desc->region.length); | ||
363 | if (ACPI_FAILURE(status)) { | ||
364 | /* | ||
365 | * Invalid address/length. We will emit an error message and mark | ||
366 | * the region as invalid, so that it will cause an additional error if | ||
367 | * it is ever used. Then return AE_OK. | ||
368 | */ | ||
369 | ACPI_EXCEPTION((AE_INFO, status, | ||
370 | "During address validation of OpRegion [%4.4s]", | ||
371 | node->name.ascii)); | ||
372 | obj_desc->common.flags |= AOPOBJ_INVALID; | ||
373 | status = AE_OK; | ||
374 | } | ||
375 | |||
355 | return_ACPI_STATUS(status); | 376 | return_ACPI_STATUS(status); |
356 | } | 377 | } |
357 | 378 | ||
@@ -411,7 +432,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
411 | u8 field_flags; | 432 | u8 field_flags; |
412 | acpi_status status; | 433 | acpi_status status; |
413 | 434 | ||
414 | ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); | 435 | ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc); |
415 | 436 | ||
416 | /* Host object must be a Buffer */ | 437 | /* Host object must be a Buffer */ |
417 | 438 | ||
@@ -457,7 +478,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
457 | 478 | ||
458 | if (bit_count == 0) { | 479 | if (bit_count == 0) { |
459 | ACPI_ERROR((AE_INFO, | 480 | ACPI_ERROR((AE_INFO, |
460 | "Attempt to create_field of length zero")); | 481 | "Attempt to CreateField of length zero")); |
461 | status = AE_AML_OPERAND_VALUE; | 482 | status = AE_AML_OPERAND_VALUE; |
462 | goto cleanup; | 483 | goto cleanup; |
463 | } | 484 | } |
@@ -595,7 +616,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
595 | struct acpi_namespace_node *node; | 616 | struct acpi_namespace_node *node; |
596 | union acpi_parse_object *next_op; | 617 | union acpi_parse_object *next_op; |
597 | 618 | ||
598 | ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); | 619 | ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op); |
599 | 620 | ||
600 | /* | 621 | /* |
601 | * This is where we evaluate the address and length fields of the | 622 | * This is where we evaluate the address and length fields of the |
@@ -627,7 +648,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
627 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 648 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
628 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 649 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
629 | walk_state->num_operands, | 650 | walk_state->num_operands, |
630 | "after acpi_ex_resolve_operands"); | 651 | "after AcpiExResolveOperands"); |
631 | 652 | ||
632 | if (ACPI_FAILURE(status)) { | 653 | if (ACPI_FAILURE(status)) { |
633 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", | 654 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", |
@@ -640,6 +661,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
640 | /* Initialize the Buffer Field */ | 661 | /* Initialize the Buffer Field */ |
641 | 662 | ||
642 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { | 663 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { |
664 | |||
643 | /* NOTE: Slightly different operands for this opcode */ | 665 | /* NOTE: Slightly different operands for this opcode */ |
644 | 666 | ||
645 | status = | 667 | status = |
@@ -685,7 +707,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
685 | struct acpi_namespace_node *node; | 707 | struct acpi_namespace_node *node; |
686 | union acpi_parse_object *next_op; | 708 | union acpi_parse_object *next_op; |
687 | 709 | ||
688 | ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); | 710 | ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op); |
689 | 711 | ||
690 | /* | 712 | /* |
691 | * This is where we evaluate the address and length fields of the | 713 | * This is where we evaluate the address and length fields of the |
@@ -718,7 +740,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
718 | 740 | ||
719 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 741 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
720 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 742 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
721 | 1, "after acpi_ex_resolve_operands"); | 743 | 1, "after AcpiExResolveOperands"); |
722 | 744 | ||
723 | obj_desc = acpi_ns_get_attached_object(node); | 745 | obj_desc = acpi_ns_get_attached_object(node); |
724 | if (!obj_desc) { | 746 | if (!obj_desc) { |
@@ -744,7 +766,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
744 | operand_desc->integer.value; | 766 | operand_desc->integer.value; |
745 | acpi_ut_remove_reference(operand_desc); | 767 | acpi_ut_remove_reference(operand_desc); |
746 | 768 | ||
747 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 769 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", |
748 | obj_desc, | 770 | obj_desc, |
749 | ACPI_FORMAT_UINT64(obj_desc->region.address), | 771 | ACPI_FORMAT_UINT64(obj_desc->region.address), |
750 | obj_desc->region.length)); | 772 | obj_desc->region.length)); |
@@ -780,7 +802,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | |||
780 | union acpi_operand_object *arg_desc; | 802 | union acpi_operand_object *arg_desc; |
781 | u32 length; | 803 | u32 length; |
782 | 804 | ||
783 | ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); | 805 | ACPI_FUNCTION_TRACE(ds_eval_data_object_operands); |
784 | 806 | ||
785 | /* The first operand (for all of these data objects) is the length */ | 807 | /* The first operand (for all of these data objects) is the length */ |
786 | 808 | ||
@@ -874,7 +896,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | |||
874 | acpi_status status = AE_OK; | 896 | acpi_status status = AE_OK; |
875 | union acpi_generic_state *control_state; | 897 | union acpi_generic_state *control_state; |
876 | 898 | ||
877 | ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); | 899 | ACPI_FUNCTION_NAME(ds_exec_begin_control_op); |
878 | 900 | ||
879 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, | 901 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, |
880 | op->common.aml_opcode, walk_state)); | 902 | op->common.aml_opcode, walk_state)); |
@@ -952,7 +974,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
952 | acpi_status status = AE_OK; | 974 | acpi_status status = AE_OK; |
953 | union acpi_generic_state *control_state; | 975 | union acpi_generic_state *control_state; |
954 | 976 | ||
955 | ACPI_FUNCTION_NAME("ds_exec_end_control_op"); | 977 | ACPI_FUNCTION_NAME(ds_exec_end_control_op); |
956 | 978 | ||
957 | switch (op->common.aml_opcode) { | 979 | switch (op->common.aml_opcode) { |
958 | case AML_IF_OP: | 980 | case AML_IF_OP: |
@@ -984,6 +1006,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
984 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | 1006 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); |
985 | 1007 | ||
986 | if (walk_state->control_state->common.value) { | 1008 | if (walk_state->control_state->common.value) { |
1009 | |||
987 | /* Predicate was true, go back and evaluate it again! */ | 1010 | /* Predicate was true, go back and evaluate it again! */ |
988 | 1011 | ||
989 | status = AE_CTRL_PENDING; | 1012 | status = AE_CTRL_PENDING; |
@@ -1014,6 +1037,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1014 | * has been bubbled up the tree | 1037 | * has been bubbled up the tree |
1015 | */ | 1038 | */ |
1016 | if (op->common.value.arg) { | 1039 | if (op->common.value.arg) { |
1040 | |||
1017 | /* Since we have a real Return(), delete any implicit return */ | 1041 | /* Since we have a real Return(), delete any implicit return */ |
1018 | 1042 | ||
1019 | acpi_ds_clear_implicit_return(walk_state); | 1043 | acpi_ds_clear_implicit_return(walk_state); |
@@ -1047,6 +1071,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1047 | walk_state->return_desc = walk_state->operands[0]; | 1071 | walk_state->return_desc = walk_state->operands[0]; |
1048 | } else if ((walk_state->results) && | 1072 | } else if ((walk_state->results) && |
1049 | (walk_state->results->results.num_results > 0)) { | 1073 | (walk_state->results->results.num_results > 0)) { |
1074 | |||
1050 | /* Since we have a real Return(), delete any implicit return */ | 1075 | /* Since we have a real Return(), delete any implicit return */ |
1051 | 1076 | ||
1052 | acpi_ds_clear_implicit_return(walk_state); | 1077 | acpi_ds_clear_implicit_return(walk_state); |
@@ -1095,7 +1120,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1095 | } | 1120 | } |
1096 | 1121 | ||
1097 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1122 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1098 | "Completed RETURN_OP State=%p, ret_val=%p\n", | 1123 | "Completed RETURN_OP State=%p, RetVal=%p\n", |
1099 | walk_state, walk_state->return_desc)); | 1124 | walk_state, walk_state->return_desc)); |
1100 | 1125 | ||
1101 | /* End the control method execution right now */ | 1126 | /* End the control method execution right now */ |
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 53356a591ac1..05230baf5de8 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("dsutils") | |||
68 | ******************************************************************************/ | 68 | ******************************************************************************/ |
69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) | 69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) |
70 | { | 70 | { |
71 | ACPI_FUNCTION_NAME("ds_clear_implicit_return"); | 71 | ACPI_FUNCTION_NAME(ds_clear_implicit_return); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Slack must be enabled for this feature | 74 | * Slack must be enabled for this feature |
@@ -115,7 +115,7 @@ u8 | |||
115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, | 115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, |
116 | struct acpi_walk_state *walk_state, u8 add_reference) | 116 | struct acpi_walk_state *walk_state, u8 add_reference) |
117 | { | 117 | { |
118 | ACPI_FUNCTION_NAME("ds_do_implicit_return"); | 118 | ACPI_FUNCTION_NAME(ds_do_implicit_return); |
119 | 119 | ||
120 | /* | 120 | /* |
121 | * Slack must be enabled for this feature, and we must | 121 | * Slack must be enabled for this feature, and we must |
@@ -171,7 +171,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
171 | { | 171 | { |
172 | const struct acpi_opcode_info *parent_info; | 172 | const struct acpi_opcode_info *parent_info; |
173 | 173 | ||
174 | ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op); | 174 | ACPI_FUNCTION_TRACE_PTR(ds_is_result_used, op); |
175 | 175 | ||
176 | /* Must have both an Op and a Result Object */ | 176 | /* Must have both an Op and a Result Object */ |
177 | 177 | ||
@@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
202 | */ | 202 | */ |
203 | if ((!op->common.parent) || | 203 | if ((!op->common.parent) || |
204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { | 204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { |
205 | |||
205 | /* No parent, the return value cannot possibly be used */ | 206 | /* No parent, the return value cannot possibly be used */ |
206 | 207 | ||
207 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 208 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
@@ -340,7 +341,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | |||
340 | union acpi_operand_object *obj_desc; | 341 | union acpi_operand_object *obj_desc; |
341 | acpi_status status; | 342 | acpi_status status; |
342 | 343 | ||
343 | ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); | 344 | ACPI_FUNCTION_TRACE_PTR(ds_delete_result_if_not_used, result_obj); |
344 | 345 | ||
345 | if (!op) { | 346 | if (!op) { |
346 | ACPI_ERROR((AE_INFO, "Null Op")); | 347 | ACPI_ERROR((AE_INFO, "Null Op")); |
@@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | |||
352 | } | 353 | } |
353 | 354 | ||
354 | if (!acpi_ds_is_result_used(op, walk_state)) { | 355 | if (!acpi_ds_is_result_used(op, walk_state)) { |
356 | |||
355 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ | 357 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ |
356 | 358 | ||
357 | status = acpi_ds_result_pop(&obj_desc, walk_state); | 359 | status = acpi_ds_result_pop(&obj_desc, walk_state); |
@@ -382,7 +384,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state) | |||
382 | u32 i; | 384 | u32 i; |
383 | acpi_status status = AE_OK; | 385 | acpi_status status = AE_OK; |
384 | 386 | ||
385 | ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state); | 387 | ACPI_FUNCTION_TRACE_PTR(ds_resolve_operands, walk_state); |
386 | 388 | ||
387 | /* | 389 | /* |
388 | * Attempt to resolve each of the valid operands | 390 | * Attempt to resolve each of the valid operands |
@@ -417,7 +419,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state) | |||
417 | { | 419 | { |
418 | u32 i; | 420 | u32 i; |
419 | 421 | ||
420 | ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state); | 422 | ACPI_FUNCTION_TRACE_PTR(ds_clear_operands, walk_state); |
421 | 423 | ||
422 | /* Remove a reference on each operand on the stack */ | 424 | /* Remove a reference on each operand on the stack */ |
423 | 425 | ||
@@ -465,7 +467,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
465 | acpi_interpreter_mode interpreter_mode; | 467 | acpi_interpreter_mode interpreter_mode; |
466 | const struct acpi_opcode_info *op_info; | 468 | const struct acpi_opcode_info *op_info; |
467 | 469 | ||
468 | ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg); | 470 | ACPI_FUNCTION_TRACE_PTR(ds_create_operand, arg); |
469 | 471 | ||
470 | /* A valid name must be looked up in the namespace */ | 472 | /* A valid name must be looked up in the namespace */ |
471 | 473 | ||
@@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
498 | */ | 500 | */ |
499 | if ((walk_state->deferred_node) && | 501 | if ((walk_state->deferred_node) && |
500 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) | 502 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) |
501 | && (arg_index != 0)) { | 503 | && (arg_index == |
504 | (u32) ((walk_state->opcode == | ||
505 | AML_CREATE_FIELD_OP) ? 3 : 2))) { | ||
502 | obj_desc = | 506 | obj_desc = |
503 | ACPI_CAST_PTR(union acpi_operand_object, | 507 | ACPI_CAST_PTR(union acpi_operand_object, |
504 | walk_state->deferred_node); | 508 | walk_state->deferred_node); |
@@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
521 | && (parent_op->common.aml_opcode != AML_REGION_OP) | 525 | && (parent_op->common.aml_opcode != AML_REGION_OP) |
522 | && (parent_op->common.aml_opcode != | 526 | && (parent_op->common.aml_opcode != |
523 | AML_INT_NAMEPATH_OP)) { | 527 | AML_INT_NAMEPATH_OP)) { |
528 | |||
524 | /* Enter name into namespace if not found */ | 529 | /* Enter name into namespace if not found */ |
525 | 530 | ||
526 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; | 531 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; |
@@ -572,7 +577,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
572 | 577 | ||
573 | /* Free the namestring created above */ | 578 | /* Free the namestring created above */ |
574 | 579 | ||
575 | ACPI_MEM_FREE(name_string); | 580 | ACPI_FREE(name_string); |
576 | 581 | ||
577 | /* Check status from the lookup */ | 582 | /* Check status from the lookup */ |
578 | 583 | ||
@@ -696,7 +701,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
696 | union acpi_parse_object *arg; | 701 | union acpi_parse_object *arg; |
697 | u32 arg_count = 0; | 702 | u32 arg_count = 0; |
698 | 703 | ||
699 | ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg); | 704 | ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg); |
700 | 705 | ||
701 | /* For all arguments in the list... */ | 706 | /* For all arguments in the list... */ |
702 | 707 | ||
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index f1af655ff113..3acbd9145d72 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <acpi/acinterp.h> | 49 | #include <acpi/acinterp.h> |
50 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
51 | #include <acpi/acdebug.h> | 51 | #include <acpi/acdebug.h> |
52 | #include <acpi/acdisasm.h> | ||
53 | 52 | ||
54 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
55 | ACPI_MODULE_NAME("dswexec") | 54 | ACPI_MODULE_NAME("dswexec") |
@@ -93,7 +92,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
93 | union acpi_operand_object *obj_desc; | 92 | union acpi_operand_object *obj_desc; |
94 | union acpi_operand_object *local_obj_desc = NULL; | 93 | union acpi_operand_object *local_obj_desc = NULL; |
95 | 94 | ||
96 | ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state); | 95 | ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state); |
97 | 96 | ||
98 | walk_state->control_state->common.state = 0; | 97 | walk_state->control_state->common.state = 0; |
99 | 98 | ||
@@ -123,7 +122,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
123 | 122 | ||
124 | if (!obj_desc) { | 123 | if (!obj_desc) { |
125 | ACPI_ERROR((AE_INFO, | 124 | ACPI_ERROR((AE_INFO, |
126 | "No predicate obj_desc=%p State=%p", | 125 | "No predicate ObjDesc=%p State=%p", |
127 | obj_desc, walk_state)); | 126 | obj_desc, walk_state)); |
128 | 127 | ||
129 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | 128 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
@@ -140,7 +139,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
140 | 139 | ||
141 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { | 140 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { |
142 | ACPI_ERROR((AE_INFO, | 141 | ACPI_ERROR((AE_INFO, |
143 | "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X", | 142 | "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X", |
144 | obj_desc, walk_state, | 143 | obj_desc, walk_state, |
145 | ACPI_GET_OBJECT_TYPE(obj_desc))); | 144 | ACPI_GET_OBJECT_TYPE(obj_desc))); |
146 | 145 | ||
@@ -214,7 +213,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
214 | acpi_status status = AE_OK; | 213 | acpi_status status = AE_OK; |
215 | u32 opcode_class; | 214 | u32 opcode_class; |
216 | 215 | ||
217 | ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state); | 216 | ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state); |
218 | 217 | ||
219 | op = walk_state->op; | 218 | op = walk_state->op; |
220 | if (!op) { | 219 | if (!op) { |
@@ -296,7 +295,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
296 | 295 | ||
297 | case AML_CLASS_NAMED_OBJECT: | 296 | case AML_CLASS_NAMED_OBJECT: |
298 | 297 | ||
299 | if (walk_state->walk_type == ACPI_WALK_METHOD) { | 298 | if (walk_state->walk_type & ACPI_WALK_METHOD) { |
300 | /* | 299 | /* |
301 | * Found a named object declaration during method execution; | 300 | * Found a named object declaration during method execution; |
302 | * we must enter this object into the namespace. The created | 301 | * we must enter this object into the namespace. The created |
@@ -354,7 +353,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
354 | union acpi_parse_object *next_op; | 353 | union acpi_parse_object *next_op; |
355 | union acpi_parse_object *first_arg; | 354 | union acpi_parse_object *first_arg; |
356 | 355 | ||
357 | ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state); | 356 | ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state); |
358 | 357 | ||
359 | op = walk_state->op; | 358 | op = walk_state->op; |
360 | op_type = walk_state->op_info->type; | 359 | op_type = walk_state->op_info->type; |
@@ -409,6 +408,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
409 | * being the object_type and size_of operators. | 408 | * being the object_type and size_of operators. |
410 | */ | 409 | */ |
411 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { | 410 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { |
411 | |||
412 | /* Resolve all operands */ | 412 | /* Resolve all operands */ |
413 | 413 | ||
414 | status = acpi_ex_resolve_operands(walk_state->opcode, | 414 | status = acpi_ex_resolve_operands(walk_state->opcode, |
@@ -423,7 +423,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
423 | acpi_ps_get_opcode_name | 423 | acpi_ps_get_opcode_name |
424 | (walk_state->opcode), | 424 | (walk_state->opcode), |
425 | walk_state->num_operands, | 425 | walk_state->num_operands, |
426 | "after ex_resolve_operands"); | 426 | "after ExResolveOperands"); |
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
@@ -437,7 +437,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); | 437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); |
438 | } else { | 438 | } else { |
439 | /* | 439 | /* |
440 | * Treat constructs of the form "Store(local_x,local_x)" as noops when the | 440 | * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the |
441 | * Local is uninitialized. | 441 | * Local is uninitialized. |
442 | */ | 442 | */ |
443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && | 443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && |
@@ -548,6 +548,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
548 | */ | 548 | */ |
549 | status = acpi_ds_resolve_operands(walk_state); | 549 | status = acpi_ds_resolve_operands(walk_state); |
550 | if (ACPI_FAILURE(status)) { | 550 | if (ACPI_FAILURE(status)) { |
551 | |||
551 | /* On error, clear all resolved operands */ | 552 | /* On error, clear all resolved operands */ |
552 | 553 | ||
553 | acpi_ds_clear_operands(walk_state); | 554 | acpi_ds_clear_operands(walk_state); |
@@ -569,7 +570,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
569 | case AML_TYPE_CREATE_FIELD: | 570 | case AML_TYPE_CREATE_FIELD: |
570 | 571 | ||
571 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 572 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
572 | "Executing create_field Buffer/Index Op=%p\n", | 573 | "Executing CreateField Buffer/Index Op=%p\n", |
573 | op)); | 574 | op)); |
574 | 575 | ||
575 | status = acpi_ds_load2_end_op(walk_state); | 576 | status = acpi_ds_load2_end_op(walk_state); |
@@ -584,7 +585,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
584 | case AML_TYPE_CREATE_OBJECT: | 585 | case AML_TYPE_CREATE_OBJECT: |
585 | 586 | ||
586 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 587 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
587 | "Executing create_object (Buffer/Package) Op=%p\n", | 588 | "Executing CreateObject (Buffer/Package) Op=%p\n", |
588 | op)); | 589 | op)); |
589 | 590 | ||
590 | switch (op->common.parent->common.aml_opcode) { | 591 | switch (op->common.parent->common.aml_opcode) { |
@@ -657,7 +658,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
657 | 658 | ||
658 | if (op->common.aml_opcode == AML_REGION_OP) { | 659 | if (op->common.aml_opcode == AML_REGION_OP) { |
659 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 660 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
660 | "Executing op_region Address/Length Op=%p\n", | 661 | "Executing OpRegion Address/Length Op=%p\n", |
661 | op)); | 662 | op)); |
662 | 663 | ||
663 | status = | 664 | status = |
@@ -722,6 +723,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
722 | cleanup: | 723 | cleanup: |
723 | 724 | ||
724 | if (walk_state->result_obj) { | 725 | if (walk_state->result_obj) { |
726 | |||
725 | /* Break to debugger to display result */ | 727 | /* Break to debugger to display result */ |
726 | 728 | ||
727 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object | 729 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index d3d24da31c81..35074399c617 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
127 | char *path; | 127 | char *path; |
128 | u32 flags; | 128 | u32 flags; |
129 | 129 | ||
130 | ACPI_FUNCTION_TRACE("ds_load1_begin_op"); | 130 | ACPI_FUNCTION_TRACE(ds_load1_begin_op); |
131 | 131 | ||
132 | op = walk_state->op; | 132 | op = walk_state->op; |
133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -178,12 +178,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
178 | * Target of Scope() not found. Generate an External for it, and | 178 | * Target of Scope() not found. Generate an External for it, and |
179 | * insert the name into the namespace. | 179 | * insert the name into the namespace. |
180 | */ | 180 | */ |
181 | acpi_dm_add_to_external_list(path); | 181 | acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); |
182 | status = | 182 | status = |
183 | acpi_ns_lookup(walk_state->scope_info, path, | 183 | acpi_ns_lookup(walk_state->scope_info, path, |
184 | object_type, ACPI_IMODE_LOAD_PASS1, | 184 | object_type, ACPI_IMODE_LOAD_PASS1, |
185 | ACPI_NS_SEARCH_PARENT, walk_state, | 185 | ACPI_NS_SEARCH_PARENT, walk_state, |
186 | &(node)); | 186 | &node); |
187 | } | 187 | } |
188 | #endif | 188 | #endif |
189 | if (ACPI_FAILURE(status)) { | 189 | if (ACPI_FAILURE(status)) { |
@@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
261 | */ | 261 | */ |
262 | 262 | ||
263 | if (walk_state->deferred_node) { | 263 | if (walk_state->deferred_node) { |
264 | |||
264 | /* This name is already in the namespace, get the node */ | 265 | /* This name is already in the namespace, get the node */ |
265 | 266 | ||
266 | node = walk_state->deferred_node; | 267 | node = walk_state->deferred_node; |
@@ -300,10 +301,41 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
300 | status = | 301 | status = |
301 | acpi_ns_lookup(walk_state->scope_info, path, object_type, | 302 | acpi_ns_lookup(walk_state->scope_info, path, object_type, |
302 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, | 303 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, |
303 | &(node)); | 304 | &node); |
304 | if (ACPI_FAILURE(status)) { | 305 | if (ACPI_FAILURE(status)) { |
305 | ACPI_ERROR_NAMESPACE(path, status); | 306 | if (status == AE_ALREADY_EXISTS) { |
306 | return_ACPI_STATUS(status); | 307 | |
308 | /* The name already exists in this scope */ | ||
309 | |||
310 | if (node->flags & ANOBJ_IS_EXTERNAL) { | ||
311 | /* | ||
312 | * Allow one create on an object or segment that was | ||
313 | * previously declared External | ||
314 | */ | ||
315 | node->flags &= ~ANOBJ_IS_EXTERNAL; | ||
316 | node->type = (u8) object_type; | ||
317 | |||
318 | /* Just retyped a node, probably will need to open a scope */ | ||
319 | |||
320 | if (acpi_ns_opens_scope(object_type)) { | ||
321 | status = | ||
322 | acpi_ds_scope_stack_push | ||
323 | (node, object_type, | ||
324 | walk_state); | ||
325 | if (ACPI_FAILURE(status)) { | ||
326 | return_ACPI_STATUS | ||
327 | (status); | ||
328 | } | ||
329 | } | ||
330 | status = AE_OK; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | if (ACPI_FAILURE(status)) { | ||
335 | |||
336 | ACPI_ERROR_NAMESPACE(path, status); | ||
337 | return_ACPI_STATUS(status); | ||
338 | } | ||
307 | } | 339 | } |
308 | break; | 340 | break; |
309 | } | 341 | } |
@@ -311,6 +343,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
311 | /* Common exit */ | 343 | /* Common exit */ |
312 | 344 | ||
313 | if (!op) { | 345 | if (!op) { |
346 | |||
314 | /* Create a new op */ | 347 | /* Create a new op */ |
315 | 348 | ||
316 | op = acpi_ps_alloc_op(walk_state->opcode); | 349 | op = acpi_ps_alloc_op(walk_state->opcode); |
@@ -359,7 +392,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
359 | acpi_object_type object_type; | 392 | acpi_object_type object_type; |
360 | acpi_status status = AE_OK; | 393 | acpi_status status = AE_OK; |
361 | 394 | ||
362 | ACPI_FUNCTION_TRACE("ds_load1_end_op"); | 395 | ACPI_FUNCTION_TRACE(ds_load1_end_op); |
363 | 396 | ||
364 | op = walk_state->op; | 397 | op = walk_state->op; |
365 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 398 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -413,6 +446,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
413 | #endif | 446 | #endif |
414 | 447 | ||
415 | if (op->common.aml_opcode == AML_NAME_OP) { | 448 | if (op->common.aml_opcode == AML_NAME_OP) { |
449 | |||
416 | /* For Name opcode, get the object type from the argument */ | 450 | /* For Name opcode, get the object type from the argument */ |
417 | 451 | ||
418 | if (op->common.value.arg) { | 452 | if (op->common.value.arg) { |
@@ -445,7 +479,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
445 | * arguments.) | 479 | * arguments.) |
446 | */ | 480 | */ |
447 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 481 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
448 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 482 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
449 | walk_state, op, op->named.node)); | 483 | walk_state, op, op->named.node)); |
450 | 484 | ||
451 | if (!acpi_ns_get_attached_object(op->named.node)) { | 485 | if (!acpi_ns_get_attached_object(op->named.node)) { |
@@ -511,7 +545,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
511 | acpi_object_type object_type; | 545 | acpi_object_type object_type; |
512 | char *buffer_ptr; | 546 | char *buffer_ptr; |
513 | 547 | ||
514 | ACPI_FUNCTION_TRACE("ds_load2_begin_op"); | 548 | ACPI_FUNCTION_TRACE(ds_load2_begin_op); |
515 | 549 | ||
516 | op = walk_state->op; | 550 | op = walk_state->op; |
517 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 551 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -521,6 +555,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
521 | if ((walk_state->control_state) && | 555 | if ((walk_state->control_state) && |
522 | (walk_state->control_state->common.state == | 556 | (walk_state->control_state->common.state == |
523 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | 557 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { |
558 | |||
524 | /* We are executing a while loop outside of a method */ | 559 | /* We are executing a while loop outside of a method */ |
525 | 560 | ||
526 | status = acpi_ds_exec_begin_op(walk_state, out_op); | 561 | status = acpi_ds_exec_begin_op(walk_state, out_op); |
@@ -554,10 +589,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
554 | /* Get the name we are going to enter or lookup in the namespace */ | 589 | /* Get the name we are going to enter or lookup in the namespace */ |
555 | 590 | ||
556 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | 591 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { |
592 | |||
557 | /* For Namepath op, get the path string */ | 593 | /* For Namepath op, get the path string */ |
558 | 594 | ||
559 | buffer_ptr = op->common.value.string; | 595 | buffer_ptr = op->common.value.string; |
560 | if (!buffer_ptr) { | 596 | if (!buffer_ptr) { |
597 | |||
561 | /* No name, just exit */ | 598 | /* No name, just exit */ |
562 | 599 | ||
563 | return_ACPI_STATUS(AE_OK); | 600 | return_ACPI_STATUS(AE_OK); |
@@ -680,6 +717,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
680 | /* All other opcodes */ | 717 | /* All other opcodes */ |
681 | 718 | ||
682 | if (op && op->common.node) { | 719 | if (op && op->common.node) { |
720 | |||
683 | /* This op/node was previously entered into the namespace */ | 721 | /* This op/node was previously entered into the namespace */ |
684 | 722 | ||
685 | node = op->common.node; | 723 | node = op->common.node; |
@@ -705,6 +743,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
705 | * Note: Name may already exist if we are executing a deferred opcode. | 743 | * Note: Name may already exist if we are executing a deferred opcode. |
706 | */ | 744 | */ |
707 | if (walk_state->deferred_node) { | 745 | if (walk_state->deferred_node) { |
746 | |||
708 | /* This name is already in the namespace, get the node */ | 747 | /* This name is already in the namespace, get the node */ |
709 | 748 | ||
710 | node = walk_state->deferred_node; | 749 | node = walk_state->deferred_node; |
@@ -727,6 +766,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
727 | } | 766 | } |
728 | 767 | ||
729 | if (!op) { | 768 | if (!op) { |
769 | |||
730 | /* Create a new op */ | 770 | /* Create a new op */ |
731 | 771 | ||
732 | op = acpi_ps_alloc_op(walk_state->opcode); | 772 | op = acpi_ps_alloc_op(walk_state->opcode); |
@@ -776,7 +816,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
776 | u32 i; | 816 | u32 i; |
777 | #endif | 817 | #endif |
778 | 818 | ||
779 | ACPI_FUNCTION_TRACE("ds_load2_end_op"); | 819 | ACPI_FUNCTION_TRACE(ds_load2_end_op); |
780 | 820 | ||
781 | op = walk_state->op; | 821 | op = walk_state->op; |
782 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", | 822 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", |
@@ -870,7 +910,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
870 | */ | 910 | */ |
871 | 911 | ||
872 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 912 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
873 | "Create-Load [%s] State=%p Op=%p named_obj=%p\n", | 913 | "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", |
874 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 914 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
875 | walk_state, op, node)); | 915 | walk_state, op, node)); |
876 | 916 | ||
@@ -1045,7 +1085,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1045 | * arguments.) | 1085 | * arguments.) |
1046 | */ | 1086 | */ |
1047 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1087 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1048 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 1088 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
1049 | walk_state, op, op->named.node)); | 1089 | walk_state, op, op->named.node)); |
1050 | 1090 | ||
1051 | if (!acpi_ns_get_attached_object(op->named.node)) { | 1091 | if (!acpi_ns_get_attached_object(op->named.node)) { |
@@ -1090,7 +1130,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1090 | case AML_CLASS_METHOD_CALL: | 1130 | case AML_CLASS_METHOD_CALL: |
1091 | 1131 | ||
1092 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1132 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1093 | "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", | 1133 | "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", |
1094 | walk_state, op, node)); | 1134 | walk_state, op, node)); |
1095 | 1135 | ||
1096 | /* | 1136 | /* |
@@ -1104,7 +1144,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1104 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, | 1144 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, |
1105 | &(new_node)); | 1145 | &(new_node)); |
1106 | if (ACPI_SUCCESS(status)) { | 1146 | if (ACPI_SUCCESS(status)) { |
1107 | |||
1108 | /* | 1147 | /* |
1109 | * Make sure that what we found is indeed a method | 1148 | * Make sure that what we found is indeed a method |
1110 | * We didn't search for a method on purpose, to see if the name | 1149 | * We didn't search for a method on purpose, to see if the name |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index ada21ef4a174..c9228972f5f6 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -63,9 +63,10 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) | |||
63 | { | 63 | { |
64 | union acpi_generic_state *scope_info; | 64 | union acpi_generic_state *scope_info; |
65 | 65 | ||
66 | ACPI_FUNCTION_NAME("ds_scope_stack_clear"); | 66 | ACPI_FUNCTION_NAME(ds_scope_stack_clear); |
67 | 67 | ||
68 | while (walk_state->scope_info) { | 68 | while (walk_state->scope_info) { |
69 | |||
69 | /* Pop a scope off the stack */ | 70 | /* Pop a scope off the stack */ |
70 | 71 | ||
71 | scope_info = walk_state->scope_info; | 72 | scope_info = walk_state->scope_info; |
@@ -102,9 +103,10 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
102 | union acpi_generic_state *scope_info; | 103 | union acpi_generic_state *scope_info; |
103 | union acpi_generic_state *old_scope_info; | 104 | union acpi_generic_state *old_scope_info; |
104 | 105 | ||
105 | ACPI_FUNCTION_TRACE("ds_scope_stack_push"); | 106 | ACPI_FUNCTION_TRACE(ds_scope_stack_push); |
106 | 107 | ||
107 | if (!node) { | 108 | if (!node) { |
109 | |||
108 | /* Invalid scope */ | 110 | /* Invalid scope */ |
109 | 111 | ||
110 | ACPI_ERROR((AE_INFO, "Null scope parameter")); | 112 | ACPI_ERROR((AE_INFO, "Null scope parameter")); |
@@ -126,7 +128,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
126 | 128 | ||
127 | /* Init new scope object */ | 129 | /* Init new scope object */ |
128 | 130 | ||
129 | scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; | 131 | scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE; |
130 | scope_info->scope.node = node; | 132 | scope_info->scope.node = node; |
131 | scope_info->common.value = (u16) type; | 133 | scope_info->common.value = (u16) type; |
132 | 134 | ||
@@ -176,7 +178,7 @@ acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state) | |||
176 | union acpi_generic_state *scope_info; | 178 | union acpi_generic_state *scope_info; |
177 | union acpi_generic_state *new_scope_info; | 179 | union acpi_generic_state *new_scope_info; |
178 | 180 | ||
179 | ACPI_FUNCTION_TRACE("ds_scope_stack_pop"); | 181 | ACPI_FUNCTION_TRACE(ds_scope_stack_pop); |
180 | 182 | ||
181 | /* | 183 | /* |
182 | * Pop scope info object off the stack. | 184 | * Pop scope info object off the stack. |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index fa78cb74ee36..7817e5522679 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -66,7 +66,6 @@ void *acpi_ds_obj_stack_get_value(u32 index, | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #ifdef ACPI_FUTURE_USAGE | 68 | #ifdef ACPI_FUTURE_USAGE |
69 | |||
70 | /******************************************************************************* | 69 | /******************************************************************************* |
71 | * | 70 | * |
72 | * FUNCTION: acpi_ds_result_remove | 71 | * FUNCTION: acpi_ds_result_remove |
@@ -88,7 +87,7 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
88 | { | 87 | { |
89 | union acpi_generic_state *state; | 88 | union acpi_generic_state *state; |
90 | 89 | ||
91 | ACPI_FUNCTION_NAME("ds_result_remove"); | 90 | ACPI_FUNCTION_NAME(ds_result_remove); |
92 | 91 | ||
93 | state = walk_state->results; | 92 | state = walk_state->results; |
94 | if (!state) { | 93 | if (!state) { |
@@ -128,7 +127,6 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
128 | 127 | ||
129 | return (AE_OK); | 128 | return (AE_OK); |
130 | } | 129 | } |
131 | |||
132 | #endif /* ACPI_FUTURE_USAGE */ | 130 | #endif /* ACPI_FUTURE_USAGE */ |
133 | 131 | ||
134 | /******************************************************************************* | 132 | /******************************************************************************* |
@@ -152,7 +150,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, | |||
152 | acpi_native_uint index; | 150 | acpi_native_uint index; |
153 | union acpi_generic_state *state; | 151 | union acpi_generic_state *state; |
154 | 152 | ||
155 | ACPI_FUNCTION_NAME("ds_result_pop"); | 153 | ACPI_FUNCTION_NAME(ds_result_pop); |
156 | 154 | ||
157 | state = walk_state->results; | 155 | state = walk_state->results; |
158 | if (!state) { | 156 | if (!state) { |
@@ -170,6 +168,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, | |||
170 | state->results.num_results--; | 168 | state->results.num_results--; |
171 | 169 | ||
172 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { | 170 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { |
171 | |||
173 | /* Check for a valid result object */ | 172 | /* Check for a valid result object */ |
174 | 173 | ||
175 | if (state->results.obj_desc[index - 1]) { | 174 | if (state->results.obj_desc[index - 1]) { |
@@ -213,7 +212,7 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, | |||
213 | acpi_native_uint index; | 212 | acpi_native_uint index; |
214 | union acpi_generic_state *state; | 213 | union acpi_generic_state *state; |
215 | 214 | ||
216 | ACPI_FUNCTION_NAME("ds_result_pop_from_bottom"); | 215 | ACPI_FUNCTION_NAME(ds_result_pop_from_bottom); |
217 | 216 | ||
218 | state = walk_state->results; | 217 | state = walk_state->results; |
219 | if (!state) { | 218 | if (!state) { |
@@ -278,7 +277,7 @@ acpi_ds_result_push(union acpi_operand_object * object, | |||
278 | { | 277 | { |
279 | union acpi_generic_state *state; | 278 | union acpi_generic_state *state; |
280 | 279 | ||
281 | ACPI_FUNCTION_NAME("ds_result_push"); | 280 | ACPI_FUNCTION_NAME(ds_result_push); |
282 | 281 | ||
283 | state = walk_state->results; | 282 | state = walk_state->results; |
284 | if (!state) { | 283 | if (!state) { |
@@ -331,14 +330,14 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) | |||
331 | { | 330 | { |
332 | union acpi_generic_state *state; | 331 | union acpi_generic_state *state; |
333 | 332 | ||
334 | ACPI_FUNCTION_NAME("ds_result_stack_push"); | 333 | ACPI_FUNCTION_NAME(ds_result_stack_push); |
335 | 334 | ||
336 | state = acpi_ut_create_generic_state(); | 335 | state = acpi_ut_create_generic_state(); |
337 | if (!state) { | 336 | if (!state) { |
338 | return (AE_NO_MEMORY); | 337 | return (AE_NO_MEMORY); |
339 | } | 338 | } |
340 | 339 | ||
341 | state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; | 340 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; |
342 | acpi_ut_push_generic_state(&walk_state->results, state); | 341 | acpi_ut_push_generic_state(&walk_state->results, state); |
343 | 342 | ||
344 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", | 343 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", |
@@ -363,7 +362,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
363 | { | 362 | { |
364 | union acpi_generic_state *state; | 363 | union acpi_generic_state *state; |
365 | 364 | ||
366 | ACPI_FUNCTION_NAME("ds_result_stack_pop"); | 365 | ACPI_FUNCTION_NAME(ds_result_stack_pop); |
367 | 366 | ||
368 | /* Check for stack underflow */ | 367 | /* Check for stack underflow */ |
369 | 368 | ||
@@ -376,7 +375,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
376 | state = acpi_ut_pop_generic_state(&walk_state->results); | 375 | state = acpi_ut_pop_generic_state(&walk_state->results); |
377 | 376 | ||
378 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
379 | "Result=%p remaining_results=%X State=%p\n", | 378 | "Result=%p RemainingResults=%X State=%p\n", |
380 | state, state->results.num_results, walk_state)); | 379 | state, state->results.num_results, walk_state)); |
381 | 380 | ||
382 | acpi_ut_delete_generic_state(state); | 381 | acpi_ut_delete_generic_state(state); |
@@ -400,7 +399,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
400 | acpi_status | 399 | acpi_status |
401 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) | 400 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) |
402 | { | 401 | { |
403 | ACPI_FUNCTION_NAME("ds_obj_stack_push"); | 402 | ACPI_FUNCTION_NAME(ds_obj_stack_push); |
404 | 403 | ||
405 | /* Check for stack overflow */ | 404 | /* Check for stack overflow */ |
406 | 405 | ||
@@ -445,9 +444,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) | |||
445 | { | 444 | { |
446 | u32 i; | 445 | u32 i; |
447 | 446 | ||
448 | ACPI_FUNCTION_NAME("ds_obj_stack_pop"); | 447 | ACPI_FUNCTION_NAME(ds_obj_stack_pop); |
449 | 448 | ||
450 | for (i = 0; i < pop_count; i++) { | 449 | for (i = 0; i < pop_count; i++) { |
450 | |||
451 | /* Check for stack underflow */ | 451 | /* Check for stack underflow */ |
452 | 452 | ||
453 | if (walk_state->num_operands == 0) { | 453 | if (walk_state->num_operands == 0) { |
@@ -491,9 +491,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
491 | u32 i; | 491 | u32 i; |
492 | union acpi_operand_object *obj_desc; | 492 | union acpi_operand_object *obj_desc; |
493 | 493 | ||
494 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); | 494 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); |
495 | 495 | ||
496 | for (i = 0; i < pop_count; i++) { | 496 | for (i = 0; i < pop_count; i++) { |
497 | |||
497 | /* Check for stack underflow */ | 498 | /* Check for stack underflow */ |
498 | 499 | ||
499 | if (walk_state->num_operands == 0) { | 500 | if (walk_state->num_operands == 0) { |
@@ -538,13 +539,13 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
538 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state | 539 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state |
539 | *thread) | 540 | *thread) |
540 | { | 541 | { |
541 | ACPI_FUNCTION_NAME("ds_get_current_walk_state"); | 542 | ACPI_FUNCTION_NAME(ds_get_current_walk_state); |
542 | 543 | ||
543 | if (!thread) { | 544 | if (!thread) { |
544 | return (NULL); | 545 | return (NULL); |
545 | } | 546 | } |
546 | 547 | ||
547 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n", | 548 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current WalkState %p\n", |
548 | thread->walk_state_list)); | 549 | thread->walk_state_list)); |
549 | 550 | ||
550 | return (thread->walk_state_list); | 551 | return (thread->walk_state_list); |
@@ -567,7 +568,7 @@ void | |||
567 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, | 568 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, |
568 | struct acpi_thread_state *thread) | 569 | struct acpi_thread_state *thread) |
569 | { | 570 | { |
570 | ACPI_FUNCTION_TRACE("ds_push_walk_state"); | 571 | ACPI_FUNCTION_TRACE(ds_push_walk_state); |
571 | 572 | ||
572 | walk_state->next = thread->walk_state_list; | 573 | walk_state->next = thread->walk_state_list; |
573 | thread->walk_state_list = walk_state; | 574 | thread->walk_state_list = walk_state; |
@@ -593,11 +594,12 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
593 | { | 594 | { |
594 | struct acpi_walk_state *walk_state; | 595 | struct acpi_walk_state *walk_state; |
595 | 596 | ||
596 | ACPI_FUNCTION_TRACE("ds_pop_walk_state"); | 597 | ACPI_FUNCTION_TRACE(ds_pop_walk_state); |
597 | 598 | ||
598 | walk_state = thread->walk_state_list; | 599 | walk_state = thread->walk_state_list; |
599 | 600 | ||
600 | if (walk_state) { | 601 | if (walk_state) { |
602 | |||
601 | /* Next walk state becomes the current walk state */ | 603 | /* Next walk state becomes the current walk state */ |
602 | 604 | ||
603 | thread->walk_state_list = walk_state->next; | 605 | thread->walk_state_list = walk_state->next; |
@@ -618,7 +620,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
618 | * | 620 | * |
619 | * PARAMETERS: owner_id - ID for object creation | 621 | * PARAMETERS: owner_id - ID for object creation |
620 | * Origin - Starting point for this walk | 622 | * Origin - Starting point for this walk |
621 | * mth_desc - Method object | 623 | * method_desc - Method object |
622 | * Thread - Current thread state | 624 | * Thread - Current thread state |
623 | * | 625 | * |
624 | * RETURN: Pointer to the new walk state. | 626 | * RETURN: Pointer to the new walk state. |
@@ -632,24 +634,24 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
632 | union acpi_parse_object | 634 | union acpi_parse_object |
633 | *origin, | 635 | *origin, |
634 | union acpi_operand_object | 636 | union acpi_operand_object |
635 | *mth_desc, | 637 | *method_desc, |
636 | struct acpi_thread_state | 638 | struct acpi_thread_state |
637 | *thread) | 639 | *thread) |
638 | { | 640 | { |
639 | struct acpi_walk_state *walk_state; | 641 | struct acpi_walk_state *walk_state; |
640 | acpi_status status; | 642 | acpi_status status; |
641 | 643 | ||
642 | ACPI_FUNCTION_TRACE("ds_create_walk_state"); | 644 | ACPI_FUNCTION_TRACE(ds_create_walk_state); |
643 | 645 | ||
644 | walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state)); | 646 | walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state)); |
645 | if (!walk_state) { | 647 | if (!walk_state) { |
646 | return_PTR(NULL); | 648 | return_PTR(NULL); |
647 | } | 649 | } |
648 | 650 | ||
649 | walk_state->data_type = ACPI_DESC_TYPE_WALK; | 651 | walk_state->descriptor_type = ACPI_DESC_TYPE_WALK; |
652 | walk_state->method_desc = method_desc; | ||
650 | walk_state->owner_id = owner_id; | 653 | walk_state->owner_id = owner_id; |
651 | walk_state->origin = origin; | 654 | walk_state->origin = origin; |
652 | walk_state->method_desc = mth_desc; | ||
653 | walk_state->thread = thread; | 655 | walk_state->thread = thread; |
654 | 656 | ||
655 | walk_state->parser_state.start_op = origin; | 657 | walk_state->parser_state.start_op = origin; |
@@ -664,7 +666,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
664 | 666 | ||
665 | status = acpi_ds_result_stack_push(walk_state); | 667 | status = acpi_ds_result_stack_push(walk_state); |
666 | if (ACPI_FAILURE(status)) { | 668 | if (ACPI_FAILURE(status)) { |
667 | ACPI_MEM_FREE(walk_state); | 669 | ACPI_FREE(walk_state); |
668 | return_PTR(NULL); | 670 | return_PTR(NULL); |
669 | } | 671 | } |
670 | 672 | ||
@@ -701,13 +703,13 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
701 | struct acpi_namespace_node *method_node, | 703 | struct acpi_namespace_node *method_node, |
702 | u8 * aml_start, | 704 | u8 * aml_start, |
703 | u32 aml_length, | 705 | u32 aml_length, |
704 | struct acpi_parameter_info *info, u8 pass_number) | 706 | struct acpi_evaluate_info *info, u8 pass_number) |
705 | { | 707 | { |
706 | acpi_status status; | 708 | acpi_status status; |
707 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 709 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
708 | union acpi_parse_object *extra_op; | 710 | union acpi_parse_object *extra_op; |
709 | 711 | ||
710 | ACPI_FUNCTION_TRACE("ds_init_aml_walk"); | 712 | ACPI_FUNCTION_TRACE(ds_init_aml_walk); |
711 | 713 | ||
712 | walk_state->parser_state.aml = | 714 | walk_state->parser_state.aml = |
713 | walk_state->parser_state.aml_start = aml_start; | 715 | walk_state->parser_state.aml_start = aml_start; |
@@ -778,6 +780,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
778 | } | 780 | } |
779 | 781 | ||
780 | if (parser_state->start_node) { | 782 | if (parser_state->start_node) { |
783 | |||
781 | /* Push start scope on scope stack and make it current */ | 784 | /* Push start scope on scope stack and make it current */ |
782 | 785 | ||
783 | status = | 786 | status = |
@@ -810,21 +813,24 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
810 | { | 813 | { |
811 | union acpi_generic_state *state; | 814 | union acpi_generic_state *state; |
812 | 815 | ||
813 | ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state); | 816 | ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state); |
814 | 817 | ||
815 | if (!walk_state) { | 818 | if (!walk_state) { |
816 | return; | 819 | return; |
817 | } | 820 | } |
818 | 821 | ||
819 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 822 | if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) { |
820 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", | 823 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", |
821 | walk_state)); | 824 | walk_state)); |
822 | return; | 825 | return; |
823 | } | 826 | } |
824 | 827 | ||
828 | /* There should not be any open scopes */ | ||
829 | |||
825 | if (walk_state->parser_state.scope) { | 830 | if (walk_state->parser_state.scope) { |
826 | ACPI_ERROR((AE_INFO, "%p walk still has a scope list", | 831 | ACPI_ERROR((AE_INFO, "%p walk still has a scope list", |
827 | walk_state)); | 832 | walk_state)); |
833 | acpi_ps_cleanup_scope(&walk_state->parser_state); | ||
828 | } | 834 | } |
829 | 835 | ||
830 | /* Always must free any linked control states */ | 836 | /* Always must free any linked control states */ |
@@ -854,7 +860,7 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
854 | acpi_ut_delete_generic_state(state); | 860 | acpi_ut_delete_generic_state(state); |
855 | } | 861 | } |
856 | 862 | ||
857 | ACPI_MEM_FREE(walk_state); | 863 | ACPI_FREE(walk_state); |
858 | return_VOID; | 864 | return_VOID; |
859 | } | 865 | } |
860 | 866 | ||
@@ -879,7 +885,7 @@ acpi_ds_result_insert(void *object, | |||
879 | { | 885 | { |
880 | union acpi_generic_state *state; | 886 | union acpi_generic_state *state; |
881 | 887 | ||
882 | ACPI_FUNCTION_NAME("ds_result_insert"); | 888 | ACPI_FUNCTION_NAME(ds_result_insert); |
883 | 889 | ||
884 | state = walk_state->results; | 890 | state = walk_state->results; |
885 | if (!state) { | 891 | if (!state) { |
@@ -937,7 +943,7 @@ acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) | |||
937 | { | 943 | { |
938 | u32 i; | 944 | u32 i; |
939 | 945 | ||
940 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state); | 946 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_delete_all, walk_state); |
941 | 947 | ||
942 | /* The stack size is configurable, but fixed */ | 948 | /* The stack size is configurable, but fixed */ |
943 | 949 | ||
@@ -969,7 +975,7 @@ acpi_status | |||
969 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | 975 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, |
970 | struct acpi_walk_state *walk_state) | 976 | struct acpi_walk_state *walk_state) |
971 | { | 977 | { |
972 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_object"); | 978 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_object); |
973 | 979 | ||
974 | /* Check for stack underflow */ | 980 | /* Check for stack underflow */ |
975 | 981 | ||
@@ -1025,7 +1031,7 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | |||
1025 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) | 1031 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) |
1026 | { | 1032 | { |
1027 | 1033 | ||
1028 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state); | 1034 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_get_value, walk_state); |
1029 | 1035 | ||
1030 | /* Can't do it if the stack is empty */ | 1036 | /* Can't do it if the stack is empty */ |
1031 | 1037 | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index eee0864ba300..c036e2a69f33 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -763,8 +763,7 @@ static u32 acpi_ec_gpe_poll_handler(void *data) | |||
763 | 763 | ||
764 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | 764 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
765 | 765 | ||
766 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 766 | status = acpi_os_execute(OSL_EC_POLL_HANDLER, acpi_ec_gpe_query, ec); |
767 | acpi_ec_gpe_query, ec); | ||
768 | 767 | ||
769 | if (status == AE_OK) | 768 | if (status == AE_OK) |
770 | return ACPI_INTERRUPT_HANDLED; | 769 | return ACPI_INTERRUPT_HANDLED; |
@@ -799,7 +798,7 @@ static u32 acpi_ec_gpe_intr_handler(void *data) | |||
799 | 798 | ||
800 | if (value & ACPI_EC_FLAG_SCI) { | 799 | if (value & ACPI_EC_FLAG_SCI) { |
801 | atomic_add(1, &ec->intr.pending_gpe); | 800 | atomic_add(1, &ec->intr.pending_gpe); |
802 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 801 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
803 | acpi_ec_gpe_query, ec); | 802 | acpi_ec_gpe_query, ec); |
804 | return status == AE_OK ? | 803 | return status == AE_OK ? |
805 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 804 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
@@ -991,7 +990,6 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
991 | int result = 0; | 990 | int result = 0; |
992 | acpi_status status = AE_OK; | 991 | acpi_status status = AE_OK; |
993 | union acpi_ec *ec = NULL; | 992 | union acpi_ec *ec = NULL; |
994 | unsigned long uid; | ||
995 | 993 | ||
996 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 994 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
997 | 995 | ||
@@ -1014,10 +1012,9 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1014 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, | 1012 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, |
1015 | &ec->common.global_lock); | 1013 | &ec->common.global_lock); |
1016 | 1014 | ||
1017 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1015 | /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: |
1018 | we now have the *real* EC info, so kill the makeshift one. */ | 1016 | http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ |
1019 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | 1017 | if (ec_ecdt) { |
1020 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1021 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1018 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
1022 | ACPI_ADR_SPACE_EC, | 1019 | ACPI_ADR_SPACE_EC, |
1023 | &acpi_ec_space_handler); | 1020 | &acpi_ec_space_handler); |
@@ -1062,7 +1059,6 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1062 | int result = 0; | 1059 | int result = 0; |
1063 | acpi_status status = AE_OK; | 1060 | acpi_status status = AE_OK; |
1064 | union acpi_ec *ec = NULL; | 1061 | union acpi_ec *ec = NULL; |
1065 | unsigned long uid; | ||
1066 | 1062 | ||
1067 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 1063 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
1068 | 1064 | ||
@@ -1088,10 +1084,9 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1088 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, | 1084 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, |
1089 | &ec->common.global_lock); | 1085 | &ec->common.global_lock); |
1090 | 1086 | ||
1091 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1087 | /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: |
1092 | we now have the *real* EC info, so kill the makeshift one. */ | 1088 | http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ |
1093 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | 1089 | if (ec_ecdt) { |
1094 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1095 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1090 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
1096 | ACPI_ADR_SPACE_EC, | 1091 | ACPI_ADR_SPACE_EC, |
1097 | &acpi_ec_space_handler); | 1092 | &acpi_ec_space_handler); |
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index c9ac05c4685f..919037d6acff 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -68,7 +68,7 @@ acpi_status acpi_ev_initialize_events(void) | |||
68 | { | 68 | { |
69 | acpi_status status; | 69 | acpi_status status; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ev_initialize_events"); | 71 | ACPI_FUNCTION_TRACE(ev_initialize_events); |
72 | 72 | ||
73 | /* Make sure we have ACPI tables */ | 73 | /* Make sure we have ACPI tables */ |
74 | 74 | ||
@@ -118,7 +118,7 @@ acpi_status acpi_ev_install_fadt_gpes(void) | |||
118 | { | 118 | { |
119 | acpi_status status; | 119 | acpi_status status; |
120 | 120 | ||
121 | ACPI_FUNCTION_TRACE("ev_install_fadt_gpes"); | 121 | ACPI_FUNCTION_TRACE(ev_install_fadt_gpes); |
122 | 122 | ||
123 | /* Namespace must be locked */ | 123 | /* Namespace must be locked */ |
124 | 124 | ||
@@ -157,7 +157,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void) | |||
157 | { | 157 | { |
158 | acpi_status status; | 158 | acpi_status status; |
159 | 159 | ||
160 | ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers"); | 160 | ACPI_FUNCTION_TRACE(ev_install_xrupt_handlers); |
161 | 161 | ||
162 | /* Install the SCI handler */ | 162 | /* Install the SCI handler */ |
163 | 163 | ||
@@ -241,7 +241,7 @@ u32 acpi_ev_fixed_event_detect(void) | |||
241 | u32 fixed_enable; | 241 | u32 fixed_enable; |
242 | acpi_native_uint i; | 242 | acpi_native_uint i; |
243 | 243 | ||
244 | ACPI_FUNCTION_NAME("ev_fixed_event_detect"); | 244 | ACPI_FUNCTION_NAME(ev_fixed_event_detect); |
245 | 245 | ||
246 | /* | 246 | /* |
247 | * Read the fixed feature status and enable registers, as all the cases | 247 | * Read the fixed feature status and enable registers, as all the cases |
@@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void) | |||
260 | * Check for all possible Fixed Events and dispatch those that are active | 260 | * Check for all possible Fixed Events and dispatch those that are active |
261 | */ | 261 | */ |
262 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | 262 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
263 | |||
263 | /* Both the status and enable bits must be on for this event */ | 264 | /* Both the status and enable bits must be on for this event */ |
264 | 265 | ||
265 | if ((fixed_status & acpi_gbl_fixed_event_info[i]. | 266 | if ((fixed_status & acpi_gbl_fixed_event_info[i]. |
266 | status_bit_mask) | 267 | status_bit_mask) |
267 | && (fixed_enable & acpi_gbl_fixed_event_info[i]. | 268 | && (fixed_enable & acpi_gbl_fixed_event_info[i]. |
268 | enable_bit_mask)) { | 269 | enable_bit_mask)) { |
270 | |||
269 | /* Found an active (signalled) event */ | 271 | /* Found an active (signalled) event */ |
270 | 272 | ||
271 | int_status |= acpi_ev_fixed_event_dispatch((u32) i); | 273 | int_status |= acpi_ev_fixed_event_dispatch((u32) i); |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index f64f977dd3d5..f01d339407f8 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -69,7 +69,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) | |||
69 | { | 69 | { |
70 | acpi_status status; | 70 | acpi_status status; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ev_set_gpe_type"); | 72 | ACPI_FUNCTION_TRACE(ev_set_gpe_type); |
73 | 73 | ||
74 | /* Validate type and update register enable masks */ | 74 | /* Validate type and update register enable masks */ |
75 | 75 | ||
@@ -115,7 +115,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | |||
115 | struct acpi_gpe_register_info *gpe_register_info; | 115 | struct acpi_gpe_register_info *gpe_register_info; |
116 | u8 register_bit; | 116 | u8 register_bit; |
117 | 117 | ||
118 | ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks"); | 118 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); |
119 | 119 | ||
120 | gpe_register_info = gpe_event_info->register_info; | 120 | gpe_register_info = gpe_event_info->register_info; |
121 | if (!gpe_register_info) { | 121 | if (!gpe_register_info) { |
@@ -178,7 +178,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | |||
178 | { | 178 | { |
179 | acpi_status status; | 179 | acpi_status status; |
180 | 180 | ||
181 | ACPI_FUNCTION_TRACE("ev_enable_gpe"); | 181 | ACPI_FUNCTION_TRACE(ev_enable_gpe); |
182 | 182 | ||
183 | /* Make sure HW enable masks are updated */ | 183 | /* Make sure HW enable masks are updated */ |
184 | 184 | ||
@@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | |||
207 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); | 207 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); |
208 | 208 | ||
209 | if (write_to_hardware) { | 209 | if (write_to_hardware) { |
210 | |||
210 | /* Clear the GPE (of stale events), then enable it */ | 211 | /* Clear the GPE (of stale events), then enable it */ |
211 | 212 | ||
212 | status = acpi_hw_clear_gpe(gpe_event_info); | 213 | status = acpi_hw_clear_gpe(gpe_event_info); |
@@ -243,7 +244,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
243 | { | 244 | { |
244 | acpi_status status; | 245 | acpi_status status; |
245 | 246 | ||
246 | ACPI_FUNCTION_TRACE("ev_disable_gpe"); | 247 | ACPI_FUNCTION_TRACE(ev_disable_gpe); |
247 | 248 | ||
248 | if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { | 249 | if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { |
249 | return_ACPI_STATUS(AE_OK); | 250 | return_ACPI_STATUS(AE_OK); |
@@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
313 | /* A NULL gpe_block means use the FADT-defined GPE block(s) */ | 314 | /* A NULL gpe_block means use the FADT-defined GPE block(s) */ |
314 | 315 | ||
315 | if (!gpe_device) { | 316 | if (!gpe_device) { |
317 | |||
316 | /* Examine GPE Block 0 and 1 (These blocks are permanent) */ | 318 | /* Examine GPE Block 0 and 1 (These blocks are permanent) */ |
317 | 319 | ||
318 | for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { | 320 | for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { |
@@ -380,10 +382,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
380 | u32 status_reg; | 382 | u32 status_reg; |
381 | u32 enable_reg; | 383 | u32 enable_reg; |
382 | acpi_cpu_flags flags; | 384 | acpi_cpu_flags flags; |
385 | acpi_cpu_flags hw_flags; | ||
383 | acpi_native_uint i; | 386 | acpi_native_uint i; |
384 | acpi_native_uint j; | 387 | acpi_native_uint j; |
385 | 388 | ||
386 | ACPI_FUNCTION_NAME("ev_gpe_detect"); | 389 | ACPI_FUNCTION_NAME(ev_gpe_detect); |
387 | 390 | ||
388 | /* Check for the case where there are no GPEs */ | 391 | /* Check for the case where there are no GPEs */ |
389 | 392 | ||
@@ -391,9 +394,12 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
391 | return (int_status); | 394 | return (int_status); |
392 | } | 395 | } |
393 | 396 | ||
394 | /* Examine all GPE blocks attached to this interrupt level */ | 397 | /* We need to hold the GPE lock now, hardware lock in the loop */ |
395 | 398 | ||
396 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 399 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
400 | |||
401 | /* Examine all GPE blocks attached to this interrupt level */ | ||
402 | |||
397 | gpe_block = gpe_xrupt_list->gpe_block_list_head; | 403 | gpe_block = gpe_xrupt_list->gpe_block_list_head; |
398 | while (gpe_block) { | 404 | while (gpe_block) { |
399 | /* | 405 | /* |
@@ -402,10 +408,13 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
402 | * Find all currently active GP events. | 408 | * Find all currently active GP events. |
403 | */ | 409 | */ |
404 | for (i = 0; i < gpe_block->register_count; i++) { | 410 | for (i = 0; i < gpe_block->register_count; i++) { |
411 | |||
405 | /* Get the next status/enable pair */ | 412 | /* Get the next status/enable pair */ |
406 | 413 | ||
407 | gpe_register_info = &gpe_block->register_info[i]; | 414 | gpe_register_info = &gpe_block->register_info[i]; |
408 | 415 | ||
416 | hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | ||
417 | |||
409 | /* Read the Status Register */ | 418 | /* Read the Status Register */ |
410 | 419 | ||
411 | status = | 420 | status = |
@@ -414,6 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
414 | &gpe_register_info-> | 423 | &gpe_register_info-> |
415 | status_address); | 424 | status_address); |
416 | if (ACPI_FAILURE(status)) { | 425 | if (ACPI_FAILURE(status)) { |
426 | acpi_os_release_lock(acpi_gbl_hardware_lock, | ||
427 | hw_flags); | ||
417 | goto unlock_and_exit; | 428 | goto unlock_and_exit; |
418 | } | 429 | } |
419 | 430 | ||
@@ -424,6 +435,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
424 | &enable_reg, | 435 | &enable_reg, |
425 | &gpe_register_info-> | 436 | &gpe_register_info-> |
426 | enable_address); | 437 | enable_address); |
438 | acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags); | ||
439 | |||
427 | if (ACPI_FAILURE(status)) { | 440 | if (ACPI_FAILURE(status)) { |
428 | goto unlock_and_exit; | 441 | goto unlock_and_exit; |
429 | } | 442 | } |
@@ -437,6 +450,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
437 | 450 | ||
438 | enabled_status_byte = (u8) (status_reg & enable_reg); | 451 | enabled_status_byte = (u8) (status_reg & enable_reg); |
439 | if (!enabled_status_byte) { | 452 | if (!enabled_status_byte) { |
453 | |||
440 | /* No active GPEs in this register, move on */ | 454 | /* No active GPEs in this register, move on */ |
441 | 455 | ||
442 | continue; | 456 | continue; |
@@ -445,6 +459,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
445 | /* Now look at the individual GPEs in this byte register */ | 459 | /* Now look at the individual GPEs in this byte register */ |
446 | 460 | ||
447 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 461 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
462 | |||
448 | /* Examine one GPE bit */ | 463 | /* Examine one GPE bit */ |
449 | 464 | ||
450 | if (enabled_status_byte & | 465 | if (enabled_status_byte & |
@@ -483,9 +498,9 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
483 | * | 498 | * |
484 | * RETURN: None | 499 | * RETURN: None |
485 | * | 500 | * |
486 | * DESCRIPTION: Perform the actual execution of a GPE control method. This | 501 | * DESCRIPTION: Perform the actual execution of a GPE control method. This |
487 | * function is called from an invocation of acpi_os_queue_for_execution | 502 | * function is called from an invocation of acpi_os_execute and |
488 | * (and therefore does NOT execute at interrupt level) so that | 503 | * therefore does NOT execute at interrupt level - so that |
489 | * the control method itself is not executed in the context of | 504 | * the control method itself is not executed in the context of |
490 | * an interrupt handler. | 505 | * an interrupt handler. |
491 | * | 506 | * |
@@ -494,12 +509,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
494 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | 509 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) |
495 | { | 510 | { |
496 | struct acpi_gpe_event_info *gpe_event_info = (void *)context; | 511 | struct acpi_gpe_event_info *gpe_event_info = (void *)context; |
497 | u32 gpe_number = 0; | ||
498 | acpi_status status; | 512 | acpi_status status; |
499 | struct acpi_gpe_event_info local_gpe_event_info; | 513 | struct acpi_gpe_event_info local_gpe_event_info; |
500 | struct acpi_parameter_info info; | 514 | struct acpi_evaluate_info *info; |
501 | 515 | ||
502 | ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method"); | 516 | ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); |
503 | 517 | ||
504 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 518 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
505 | if (ACPI_FAILURE(status)) { | 519 | if (ACPI_FAILURE(status)) { |
@@ -535,22 +549,35 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
535 | */ | 549 | */ |
536 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == | 550 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == |
537 | ACPI_GPE_DISPATCH_METHOD) { | 551 | ACPI_GPE_DISPATCH_METHOD) { |
538 | /* | ||
539 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | ||
540 | * control method that corresponds to this GPE | ||
541 | */ | ||
542 | info.node = local_gpe_event_info.dispatch.method_node; | ||
543 | info.parameters = | ||
544 | ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info); | ||
545 | info.parameter_type = ACPI_PARAM_GPE; | ||
546 | 552 | ||
547 | status = acpi_ns_evaluate_by_handle(&info); | 553 | /* Allocate the evaluation information block */ |
554 | |||
555 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
556 | if (!info) { | ||
557 | status = AE_NO_MEMORY; | ||
558 | } else { | ||
559 | /* | ||
560 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | ||
561 | * control method that corresponds to this GPE | ||
562 | */ | ||
563 | info->prefix_node = | ||
564 | local_gpe_event_info.dispatch.method_node; | ||
565 | info->parameters = | ||
566 | ACPI_CAST_PTR(union acpi_operand_object *, | ||
567 | gpe_event_info); | ||
568 | info->parameter_type = ACPI_PARAM_GPE; | ||
569 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
570 | |||
571 | status = acpi_ns_evaluate(info); | ||
572 | ACPI_FREE(info); | ||
573 | } | ||
574 | |||
548 | if (ACPI_FAILURE(status)) { | 575 | if (ACPI_FAILURE(status)) { |
549 | ACPI_EXCEPTION((AE_INFO, status, | 576 | ACPI_EXCEPTION((AE_INFO, status, |
550 | "While evaluating method [%4.4s] for GPE[%2X]", | 577 | "While evaluating GPE method [%4.4s]", |
551 | acpi_ut_get_node_name | 578 | acpi_ut_get_node_name |
552 | (local_gpe_event_info.dispatch. | 579 | (local_gpe_event_info.dispatch. |
553 | method_node), gpe_number)); | 580 | method_node))); |
554 | } | 581 | } |
555 | } | 582 | } |
556 | 583 | ||
@@ -593,7 +620,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
593 | { | 620 | { |
594 | acpi_status status; | 621 | acpi_status status; |
595 | 622 | ||
596 | ACPI_FUNCTION_TRACE("ev_gpe_dispatch"); | 623 | ACPI_FUNCTION_TRACE(ev_gpe_dispatch); |
597 | 624 | ||
598 | /* | 625 | /* |
599 | * If edge-triggered, clear the GPE status bit now. Note that | 626 | * If edge-triggered, clear the GPE status bit now. Note that |
@@ -669,9 +696,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
669 | * Execute the method associated with the GPE | 696 | * Execute the method associated with the GPE |
670 | * NOTE: Level-triggered GPEs are cleared after the method completes. | 697 | * NOTE: Level-triggered GPEs are cleared after the method completes. |
671 | */ | 698 | */ |
672 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 699 | status = acpi_os_execute(OSL_GPE_HANDLER, |
673 | acpi_ev_asynch_execute_gpe_method, | 700 | acpi_ev_asynch_execute_gpe_method, |
674 | gpe_event_info); | 701 | gpe_event_info); |
675 | if (ACPI_FAILURE(status)) { | 702 | if (ACPI_FAILURE(status)) { |
676 | ACPI_EXCEPTION((AE_INFO, status, | 703 | ACPI_EXCEPTION((AE_INFO, status, |
677 | "Unable to queue handler for GPE[%2X] - event disabled", | 704 | "Unable to queue handler for GPE[%2X] - event disabled", |
@@ -716,7 +743,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
716 | * | 743 | * |
717 | * DESCRIPTION: Determine if a a GPE is "wake-only". | 744 | * DESCRIPTION: Determine if a a GPE is "wake-only". |
718 | * | 745 | * |
719 | * Called from Notify() code in interpreter when a "device_wake" | 746 | * Called from Notify() code in interpreter when a "DeviceWake" |
720 | * Notify comes in. | 747 | * Notify comes in. |
721 | * | 748 | * |
722 | ******************************************************************************/ | 749 | ******************************************************************************/ |
@@ -726,7 +753,7 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
726 | { | 753 | { |
727 | acpi_status status; | 754 | acpi_status status; |
728 | 755 | ||
729 | ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe"); | 756 | ACPI_FUNCTION_TRACE(ev_check_for_wake_only_gpe); |
730 | 757 | ||
731 | if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ | 758 | if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ |
732 | ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ | 759 | ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 0fd00b5ad650..95ddeb48bc0f 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -131,14 +131,14 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) | |||
131 | * | 131 | * |
132 | ******************************************************************************/ | 132 | ******************************************************************************/ |
133 | 133 | ||
134 | acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) | 134 | acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) |
135 | { | 135 | { |
136 | struct acpi_gpe_block_info *gpe_block; | 136 | struct acpi_gpe_block_info *gpe_block; |
137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
138 | acpi_status status = AE_OK; | 138 | acpi_status status = AE_OK; |
139 | acpi_cpu_flags flags; | 139 | acpi_cpu_flags flags; |
140 | 140 | ||
141 | ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); | 141 | ACPI_FUNCTION_TRACE(ev_walk_gpe_list); |
142 | 142 | ||
143 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 143 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
144 | 144 | ||
@@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) | |||
146 | 146 | ||
147 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | 147 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; |
148 | while (gpe_xrupt_info) { | 148 | while (gpe_xrupt_info) { |
149 | |||
149 | /* Walk all Gpe Blocks attached to this interrupt level */ | 150 | /* Walk all Gpe Blocks attached to this interrupt level */ |
150 | 151 | ||
151 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | 152 | gpe_block = gpe_xrupt_info->gpe_block_list_head; |
152 | while (gpe_block) { | 153 | while (gpe_block) { |
154 | |||
153 | /* One callback per GPE block */ | 155 | /* One callback per GPE block */ |
154 | 156 | ||
155 | status = gpe_walk_callback(gpe_xrupt_info, gpe_block); | 157 | status = gpe_walk_callback(gpe_xrupt_info, gpe_block); |
@@ -190,11 +192,12 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
190 | acpi_native_uint i; | 192 | acpi_native_uint i; |
191 | acpi_native_uint j; | 193 | acpi_native_uint j; |
192 | 194 | ||
193 | ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers"); | 195 | ACPI_FUNCTION_TRACE(ev_delete_gpe_handlers); |
194 | 196 | ||
195 | /* Examine each GPE Register within the block */ | 197 | /* Examine each GPE Register within the block */ |
196 | 198 | ||
197 | for (i = 0; i < gpe_block->register_count; i++) { | 199 | for (i = 0; i < gpe_block->register_count; i++) { |
200 | |||
198 | /* Now look at the individual GPEs in this byte register */ | 201 | /* Now look at the individual GPEs in this byte register */ |
199 | 202 | ||
200 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 203 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
@@ -204,7 +207,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
204 | 207 | ||
205 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 208 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
206 | ACPI_GPE_DISPATCH_HANDLER) { | 209 | ACPI_GPE_DISPATCH_HANDLER) { |
207 | ACPI_MEM_FREE(gpe_event_info->dispatch.handler); | 210 | ACPI_FREE(gpe_event_info->dispatch.handler); |
208 | gpe_event_info->dispatch.handler = NULL; | 211 | gpe_event_info->dispatch.handler = NULL; |
209 | gpe_event_info->flags &= | 212 | gpe_event_info->flags &= |
210 | ~ACPI_GPE_DISPATCH_MASK; | 213 | ~ACPI_GPE_DISPATCH_MASK; |
@@ -248,7 +251,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
248 | u8 type; | 251 | u8 type; |
249 | acpi_status status; | 252 | acpi_status status; |
250 | 253 | ||
251 | ACPI_FUNCTION_TRACE("ev_save_method_info"); | 254 | ACPI_FUNCTION_TRACE(ev_save_method_info); |
252 | 255 | ||
253 | /* | 256 | /* |
254 | * _Lxx and _Exx GPE method support | 257 | * _Lxx and _Exx GPE method support |
@@ -279,9 +282,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
279 | default: | 282 | default: |
280 | /* Unknown method type, just ignore it! */ | 283 | /* Unknown method type, just ignore it! */ |
281 | 284 | ||
282 | ACPI_ERROR((AE_INFO, | 285 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
283 | "Unknown GPE method type: %s (name not of form _Lxx or _Exx)", | 286 | "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)", |
284 | name)); | 287 | name)); |
285 | return_ACPI_STATUS(AE_OK); | 288 | return_ACPI_STATUS(AE_OK); |
286 | } | 289 | } |
287 | 290 | ||
@@ -289,11 +292,12 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
289 | 292 | ||
290 | gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); | 293 | gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); |
291 | if (gpe_number == ACPI_UINT32_MAX) { | 294 | if (gpe_number == ACPI_UINT32_MAX) { |
295 | |||
292 | /* Conversion failed; invalid method, just ignore it */ | 296 | /* Conversion failed; invalid method, just ignore it */ |
293 | 297 | ||
294 | ACPI_ERROR((AE_INFO, | 298 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
295 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", | 299 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", |
296 | name)); | 300 | name)); |
297 | return_ACPI_STATUS(AE_OK); | 301 | return_ACPI_STATUS(AE_OK); |
298 | } | 302 | } |
299 | 303 | ||
@@ -364,13 +368,14 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
364 | u32 gpe_number; | 368 | u32 gpe_number; |
365 | acpi_status status; | 369 | acpi_status status; |
366 | 370 | ||
367 | ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe"); | 371 | ACPI_FUNCTION_TRACE(ev_match_prw_and_gpe); |
368 | 372 | ||
369 | /* Check for a _PRW method under this device */ | 373 | /* Check for a _PRW method under this device */ |
370 | 374 | ||
371 | status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, | 375 | status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, |
372 | ACPI_BTYPE_PACKAGE, &pkg_desc); | 376 | ACPI_BTYPE_PACKAGE, &pkg_desc); |
373 | if (ACPI_FAILURE(status)) { | 377 | if (ACPI_FAILURE(status)) { |
378 | |||
374 | /* Ignore all errors from _PRW, we don't want to abort the subsystem */ | 379 | /* Ignore all errors from _PRW, we don't want to abort the subsystem */ |
375 | 380 | ||
376 | return_ACPI_STATUS(AE_OK); | 381 | return_ACPI_STATUS(AE_OK); |
@@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
394 | obj_desc = pkg_desc->package.elements[0]; | 399 | obj_desc = pkg_desc->package.elements[0]; |
395 | 400 | ||
396 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 401 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
402 | |||
397 | /* Use FADT-defined GPE device (from definition of _PRW) */ | 403 | /* Use FADT-defined GPE device (from definition of _PRW) */ |
398 | 404 | ||
399 | target_gpe_device = acpi_gbl_fadt_gpe_device; | 405 | target_gpe_device = acpi_gbl_fadt_gpe_device; |
@@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
402 | 408 | ||
403 | gpe_number = (u32) obj_desc->integer.value; | 409 | gpe_number = (u32) obj_desc->integer.value; |
404 | } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { | 410 | } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { |
411 | |||
405 | /* Package contains a GPE reference and GPE number within a GPE block */ | 412 | /* Package contains a GPE reference and GPE number within a GPE block */ |
406 | 413 | ||
407 | if ((obj_desc->package.count < 2) || | 414 | if ((obj_desc->package.count < 2) || |
@@ -482,7 +489,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
482 | acpi_status status; | 489 | acpi_status status; |
483 | acpi_cpu_flags flags; | 490 | acpi_cpu_flags flags; |
484 | 491 | ||
485 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); | 492 | ACPI_FUNCTION_TRACE(ev_get_gpe_xrupt_block); |
486 | 493 | ||
487 | /* No need for lock since we are not changing any list elements here */ | 494 | /* No need for lock since we are not changing any list elements here */ |
488 | 495 | ||
@@ -497,7 +504,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
497 | 504 | ||
498 | /* Not found, must allocate a new xrupt descriptor */ | 505 | /* Not found, must allocate a new xrupt descriptor */ |
499 | 506 | ||
500 | gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info)); | 507 | gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info)); |
501 | if (!gpe_xrupt) { | 508 | if (!gpe_xrupt) { |
502 | return_PTR(NULL); | 509 | return_PTR(NULL); |
503 | } | 510 | } |
@@ -556,7 +563,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
556 | acpi_status status; | 563 | acpi_status status; |
557 | acpi_cpu_flags flags; | 564 | acpi_cpu_flags flags; |
558 | 565 | ||
559 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); | 566 | ACPI_FUNCTION_TRACE(ev_delete_gpe_xrupt); |
560 | 567 | ||
561 | /* We never want to remove the SCI interrupt handler */ | 568 | /* We never want to remove the SCI interrupt handler */ |
562 | 569 | ||
@@ -588,7 +595,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
588 | 595 | ||
589 | /* Free the block */ | 596 | /* Free the block */ |
590 | 597 | ||
591 | ACPI_MEM_FREE(gpe_xrupt); | 598 | ACPI_FREE(gpe_xrupt); |
592 | return_ACPI_STATUS(AE_OK); | 599 | return_ACPI_STATUS(AE_OK); |
593 | } | 600 | } |
594 | 601 | ||
@@ -614,7 +621,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
614 | acpi_status status; | 621 | acpi_status status; |
615 | acpi_cpu_flags flags; | 622 | acpi_cpu_flags flags; |
616 | 623 | ||
617 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 624 | ACPI_FUNCTION_TRACE(ev_install_gpe_block); |
618 | 625 | ||
619 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 626 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
620 | if (ACPI_FAILURE(status)) { | 627 | if (ACPI_FAILURE(status)) { |
@@ -667,7 +674,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
667 | acpi_status status; | 674 | acpi_status status; |
668 | acpi_cpu_flags flags; | 675 | acpi_cpu_flags flags; |
669 | 676 | ||
670 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 677 | ACPI_FUNCTION_TRACE(ev_install_gpe_block); |
671 | 678 | ||
672 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 679 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
673 | if (ACPI_FAILURE(status)) { | 680 | if (ACPI_FAILURE(status)) { |
@@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
679 | status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); | 686 | status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); |
680 | 687 | ||
681 | if (!gpe_block->previous && !gpe_block->next) { | 688 | if (!gpe_block->previous && !gpe_block->next) { |
689 | |||
682 | /* This is the last gpe_block on this interrupt */ | 690 | /* This is the last gpe_block on this interrupt */ |
683 | 691 | ||
684 | status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); | 692 | status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); |
@@ -704,9 +712,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
704 | 712 | ||
705 | /* Free the gpe_block */ | 713 | /* Free the gpe_block */ |
706 | 714 | ||
707 | ACPI_MEM_FREE(gpe_block->register_info); | 715 | ACPI_FREE(gpe_block->register_info); |
708 | ACPI_MEM_FREE(gpe_block->event_info); | 716 | ACPI_FREE(gpe_block->event_info); |
709 | ACPI_MEM_FREE(gpe_block); | 717 | ACPI_FREE(gpe_block); |
710 | 718 | ||
711 | unlock_and_exit: | 719 | unlock_and_exit: |
712 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 720 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
@@ -736,17 +744,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
736 | acpi_native_uint j; | 744 | acpi_native_uint j; |
737 | acpi_status status; | 745 | acpi_status status; |
738 | 746 | ||
739 | ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks"); | 747 | ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks); |
740 | 748 | ||
741 | /* Allocate the GPE register information block */ | 749 | /* Allocate the GPE register information block */ |
742 | 750 | ||
743 | gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block-> | 751 | gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block-> |
744 | register_count * | 752 | register_count * |
745 | sizeof(struct | 753 | sizeof(struct |
746 | acpi_gpe_register_info)); | 754 | acpi_gpe_register_info)); |
747 | if (!gpe_register_info) { | 755 | if (!gpe_register_info) { |
748 | ACPI_ERROR((AE_INFO, | 756 | ACPI_ERROR((AE_INFO, |
749 | "Could not allocate the gpe_register_info table")); | 757 | "Could not allocate the GpeRegisterInfo table")); |
750 | return_ACPI_STATUS(AE_NO_MEMORY); | 758 | return_ACPI_STATUS(AE_NO_MEMORY); |
751 | } | 759 | } |
752 | 760 | ||
@@ -754,13 +762,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
754 | * Allocate the GPE event_info block. There are eight distinct GPEs | 762 | * Allocate the GPE event_info block. There are eight distinct GPEs |
755 | * per register. Initialization to zeros is sufficient. | 763 | * per register. Initialization to zeros is sufficient. |
756 | */ | 764 | */ |
757 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> | 765 | gpe_event_info = ACPI_ALLOCATE_ZEROED(((acpi_size) gpe_block-> |
758 | register_count * | 766 | register_count * |
759 | ACPI_GPE_REGISTER_WIDTH) * | 767 | ACPI_GPE_REGISTER_WIDTH) * |
760 | sizeof(struct acpi_gpe_event_info)); | 768 | sizeof(struct |
769 | acpi_gpe_event_info)); | ||
761 | if (!gpe_event_info) { | 770 | if (!gpe_event_info) { |
762 | ACPI_ERROR((AE_INFO, | 771 | ACPI_ERROR((AE_INFO, |
763 | "Could not allocate the gpe_event_info table")); | 772 | "Could not allocate the GpeEventInfo table")); |
764 | status = AE_NO_MEMORY; | 773 | status = AE_NO_MEMORY; |
765 | goto error_exit; | 774 | goto error_exit; |
766 | } | 775 | } |
@@ -780,6 +789,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
780 | this_event = gpe_event_info; | 789 | this_event = gpe_event_info; |
781 | 790 | ||
782 | for (i = 0; i < gpe_block->register_count; i++) { | 791 | for (i = 0; i < gpe_block->register_count; i++) { |
792 | |||
783 | /* Init the register_info for this GPE register (8 GPEs) */ | 793 | /* Init the register_info for this GPE register (8 GPEs) */ |
784 | 794 | ||
785 | this_register->base_gpe_number = | 795 | this_register->base_gpe_number = |
@@ -839,10 +849,10 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
839 | 849 | ||
840 | error_exit: | 850 | error_exit: |
841 | if (gpe_register_info) { | 851 | if (gpe_register_info) { |
842 | ACPI_MEM_FREE(gpe_register_info); | 852 | ACPI_FREE(gpe_register_info); |
843 | } | 853 | } |
844 | if (gpe_event_info) { | 854 | if (gpe_event_info) { |
845 | ACPI_MEM_FREE(gpe_event_info); | 855 | ACPI_FREE(gpe_event_info); |
846 | } | 856 | } |
847 | 857 | ||
848 | return_ACPI_STATUS(status); | 858 | return_ACPI_STATUS(status); |
@@ -878,7 +888,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
878 | acpi_status status; | 888 | acpi_status status; |
879 | struct acpi_gpe_block_info *gpe_block; | 889 | struct acpi_gpe_block_info *gpe_block; |
880 | 890 | ||
881 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); | 891 | ACPI_FUNCTION_TRACE(ev_create_gpe_block); |
882 | 892 | ||
883 | if (!register_count) { | 893 | if (!register_count) { |
884 | return_ACPI_STATUS(AE_OK); | 894 | return_ACPI_STATUS(AE_OK); |
@@ -886,7 +896,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
886 | 896 | ||
887 | /* Allocate a new GPE block */ | 897 | /* Allocate a new GPE block */ |
888 | 898 | ||
889 | gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info)); | 899 | gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info)); |
890 | if (!gpe_block) { | 900 | if (!gpe_block) { |
891 | return_ACPI_STATUS(AE_NO_MEMORY); | 901 | return_ACPI_STATUS(AE_NO_MEMORY); |
892 | } | 902 | } |
@@ -906,7 +916,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
906 | */ | 916 | */ |
907 | status = acpi_ev_create_gpe_info_blocks(gpe_block); | 917 | status = acpi_ev_create_gpe_info_blocks(gpe_block); |
908 | if (ACPI_FAILURE(status)) { | 918 | if (ACPI_FAILURE(status)) { |
909 | ACPI_MEM_FREE(gpe_block); | 919 | ACPI_FREE(gpe_block); |
910 | return_ACPI_STATUS(status); | 920 | return_ACPI_STATUS(status); |
911 | } | 921 | } |
912 | 922 | ||
@@ -914,7 +924,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
914 | 924 | ||
915 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); | 925 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); |
916 | if (ACPI_FAILURE(status)) { | 926 | if (ACPI_FAILURE(status)) { |
917 | ACPI_MEM_FREE(gpe_block); | 927 | ACPI_FREE(gpe_block); |
918 | return_ACPI_STATUS(status); | 928 | return_ACPI_STATUS(status); |
919 | } | 929 | } |
920 | 930 | ||
@@ -971,7 +981,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
971 | acpi_native_uint i; | 981 | acpi_native_uint i; |
972 | acpi_native_uint j; | 982 | acpi_native_uint j; |
973 | 983 | ||
974 | ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); | 984 | ACPI_FUNCTION_TRACE(ev_initialize_gpe_block); |
975 | 985 | ||
976 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ | 986 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ |
977 | 987 | ||
@@ -1013,6 +1023,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1013 | 1023 | ||
1014 | for (i = 0; i < gpe_block->register_count; i++) { | 1024 | for (i = 0; i < gpe_block->register_count; i++) { |
1015 | for (j = 0; j < 8; j++) { | 1025 | for (j = 0; j < 8; j++) { |
1026 | |||
1016 | /* Get the info block for this particular GPE */ | 1027 | /* Get the info block for this particular GPE */ |
1017 | 1028 | ||
1018 | gpe_event_info = | 1029 | gpe_event_info = |
@@ -1040,7 +1051,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1040 | 1051 | ||
1041 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); | 1052 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); |
1042 | if (ACPI_FAILURE(status)) { | 1053 | if (ACPI_FAILURE(status)) { |
1043 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p", | 1054 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", |
1044 | gpe_block)); | 1055 | gpe_block)); |
1045 | } | 1056 | } |
1046 | 1057 | ||
@@ -1066,7 +1077,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1066 | u32 gpe_number_max = 0; | 1077 | u32 gpe_number_max = 0; |
1067 | acpi_status status; | 1078 | acpi_status status; |
1068 | 1079 | ||
1069 | ACPI_FUNCTION_TRACE("ev_gpe_initialize"); | 1080 | ACPI_FUNCTION_TRACE(ev_gpe_initialize); |
1070 | 1081 | ||
1071 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 1082 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
1072 | if (ACPI_FAILURE(status)) { | 1083 | if (ACPI_FAILURE(status)) { |
@@ -1099,6 +1110,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1099 | * particular block is not supported. | 1110 | * particular block is not supported. |
1100 | */ | 1111 | */ |
1101 | if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { | 1112 | if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { |
1113 | |||
1102 | /* GPE block 0 exists (has both length and address > 0) */ | 1114 | /* GPE block 0 exists (has both length and address > 0) */ |
1103 | 1115 | ||
1104 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); | 1116 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); |
@@ -1121,6 +1133,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1121 | } | 1133 | } |
1122 | 1134 | ||
1123 | if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { | 1135 | if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { |
1136 | |||
1124 | /* GPE block 1 exists (has both length and address > 0) */ | 1137 | /* GPE block 1 exists (has both length and address > 0) */ |
1125 | 1138 | ||
1126 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); | 1139 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); |
@@ -1168,6 +1181,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1168 | /* Exit if there are no GPE registers */ | 1181 | /* Exit if there are no GPE registers */ |
1169 | 1182 | ||
1170 | if ((register_count0 + register_count1) == 0) { | 1183 | if ((register_count0 + register_count1) == 0) { |
1184 | |||
1171 | /* GPEs are not required by ACPI, this is OK */ | 1185 | /* GPEs are not required by ACPI, this is OK */ |
1172 | 1186 | ||
1173 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 1187 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 0909ba69577e..6eef4efddcf6 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -49,12 +49,13 @@ | |||
49 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evmisc") | 50 | ACPI_MODULE_NAME("evmisc") |
51 | 51 | ||
52 | /* Names for Notify() values, used for debug output */ | ||
52 | #ifdef ACPI_DEBUG_OUTPUT | 53 | #ifdef ACPI_DEBUG_OUTPUT |
53 | static const char *acpi_notify_value_names[] = { | 54 | static const char *acpi_notify_value_names[] = { |
54 | "Bus Check", | 55 | "Bus Check", |
55 | "Device Check", | 56 | "Device Check", |
56 | "Device Wake", | 57 | "Device Wake", |
57 | "Eject request", | 58 | "Eject Request", |
58 | "Device Check Light", | 59 | "Device Check Light", |
59 | "Frequency Mismatch", | 60 | "Frequency Mismatch", |
60 | "Bus Mode Mismatch", | 61 | "Bus Mode Mismatch", |
@@ -124,7 +125,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
124 | union acpi_generic_state *notify_info; | 125 | union acpi_generic_state *notify_info; |
125 | acpi_status status = AE_OK; | 126 | acpi_status status = AE_OK; |
126 | 127 | ||
127 | ACPI_FUNCTION_NAME("ev_queue_notify_request"); | 128 | ACPI_FUNCTION_NAME(ev_queue_notify_request); |
128 | 129 | ||
129 | /* | 130 | /* |
130 | * For value 3 (Ejection Request), some device method may need to be run. | 131 | * For value 3 (Ejection Request), some device method may need to be run. |
@@ -150,6 +151,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
150 | 151 | ||
151 | obj_desc = acpi_ns_get_attached_object(node); | 152 | obj_desc = acpi_ns_get_attached_object(node); |
152 | if (obj_desc) { | 153 | if (obj_desc) { |
154 | |||
153 | /* We have the notify object, Get the right handler */ | 155 | /* We have the notify object, Get the right handler */ |
154 | 156 | ||
155 | switch (node->type) { | 157 | switch (node->type) { |
@@ -184,14 +186,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
184 | return (AE_NO_MEMORY); | 186 | return (AE_NO_MEMORY); |
185 | } | 187 | } |
186 | 188 | ||
187 | notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; | 189 | notify_info->common.descriptor_type = |
190 | ACPI_DESC_TYPE_STATE_NOTIFY; | ||
188 | notify_info->notify.node = node; | 191 | notify_info->notify.node = node; |
189 | notify_info->notify.value = (u16) notify_value; | 192 | notify_info->notify.value = (u16) notify_value; |
190 | notify_info->notify.handler_obj = handler_obj; | 193 | notify_info->notify.handler_obj = handler_obj; |
191 | 194 | ||
192 | status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, | 195 | status = |
193 | acpi_ev_notify_dispatch, | 196 | acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, |
194 | notify_info); | 197 | notify_info); |
195 | if (ACPI_FAILURE(status)) { | 198 | if (ACPI_FAILURE(status)) { |
196 | acpi_ut_delete_generic_state(notify_info); | 199 | acpi_ut_delete_generic_state(notify_info); |
197 | } | 200 | } |
@@ -240,6 +243,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) | |||
240 | * to the device. | 243 | * to the device. |
241 | */ | 244 | */ |
242 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { | 245 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { |
246 | |||
243 | /* Global system notification handler */ | 247 | /* Global system notification handler */ |
244 | 248 | ||
245 | if (acpi_gbl_system_notify.handler) { | 249 | if (acpi_gbl_system_notify.handler) { |
@@ -297,6 +301,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) | |||
297 | /* Signal threads that are waiting for the lock */ | 301 | /* Signal threads that are waiting for the lock */ |
298 | 302 | ||
299 | if (acpi_gbl_global_lock_thread_count) { | 303 | if (acpi_gbl_global_lock_thread_count) { |
304 | |||
300 | /* Send sufficient units to the semaphore */ | 305 | /* Send sufficient units to the semaphore */ |
301 | 306 | ||
302 | status = | 307 | status = |
@@ -335,15 +340,16 @@ static u32 acpi_ev_global_lock_handler(void *context) | |||
335 | */ | 340 | */ |
336 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); | 341 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); |
337 | if (acquired) { | 342 | if (acquired) { |
343 | |||
338 | /* Got the lock, now wake all threads waiting for it */ | 344 | /* Got the lock, now wake all threads waiting for it */ |
339 | 345 | ||
340 | acpi_gbl_global_lock_acquired = TRUE; | 346 | acpi_gbl_global_lock_acquired = TRUE; |
341 | 347 | ||
342 | /* Run the Global Lock thread which will signal all waiting threads */ | 348 | /* Run the Global Lock thread which will signal all waiting threads */ |
343 | 349 | ||
344 | status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, | 350 | status = |
345 | acpi_ev_global_lock_thread, | 351 | acpi_os_execute(OSL_GLOBAL_LOCK_HANDLER, |
346 | context); | 352 | acpi_ev_global_lock_thread, context); |
347 | if (ACPI_FAILURE(status)) { | 353 | if (ACPI_FAILURE(status)) { |
348 | ACPI_EXCEPTION((AE_INFO, status, | 354 | ACPI_EXCEPTION((AE_INFO, status, |
349 | "Could not queue Global Lock thread")); | 355 | "Could not queue Global Lock thread")); |
@@ -371,7 +377,7 @@ acpi_status acpi_ev_init_global_lock_handler(void) | |||
371 | { | 377 | { |
372 | acpi_status status; | 378 | acpi_status status; |
373 | 379 | ||
374 | ACPI_FUNCTION_TRACE("ev_init_global_lock_handler"); | 380 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); |
375 | 381 | ||
376 | acpi_gbl_global_lock_present = TRUE; | 382 | acpi_gbl_global_lock_present = TRUE; |
377 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, | 383 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, |
@@ -413,7 +419,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
413 | acpi_status status = AE_OK; | 419 | acpi_status status = AE_OK; |
414 | u8 acquired = FALSE; | 420 | u8 acquired = FALSE; |
415 | 421 | ||
416 | ACPI_FUNCTION_TRACE("ev_acquire_global_lock"); | 422 | ACPI_FUNCTION_TRACE(ev_acquire_global_lock); |
417 | 423 | ||
418 | #ifndef ACPI_APPLICATION | 424 | #ifndef ACPI_APPLICATION |
419 | /* Make sure that we actually have a global lock */ | 425 | /* Make sure that we actually have a global lock */ |
@@ -439,6 +445,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
439 | 445 | ||
440 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); | 446 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); |
441 | if (acquired) { | 447 | if (acquired) { |
448 | |||
442 | /* We got the lock */ | 449 | /* We got the lock */ |
443 | 450 | ||
444 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 451 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -458,8 +465,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
458 | * Acquire the global lock semaphore first. | 465 | * Acquire the global lock semaphore first. |
459 | * Since this wait will block, we must release the interpreter | 466 | * Since this wait will block, we must release the interpreter |
460 | */ | 467 | */ |
461 | status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, | 468 | status = |
462 | timeout); | 469 | acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, |
470 | timeout); | ||
463 | return_ACPI_STATUS(status); | 471 | return_ACPI_STATUS(status); |
464 | } | 472 | } |
465 | 473 | ||
@@ -480,7 +488,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
480 | u8 pending = FALSE; | 488 | u8 pending = FALSE; |
481 | acpi_status status = AE_OK; | 489 | acpi_status status = AE_OK; |
482 | 490 | ||
483 | ACPI_FUNCTION_TRACE("ev_release_global_lock"); | 491 | ACPI_FUNCTION_TRACE(ev_release_global_lock); |
484 | 492 | ||
485 | if (!acpi_gbl_global_lock_thread_count) { | 493 | if (!acpi_gbl_global_lock_thread_count) { |
486 | ACPI_WARNING((AE_INFO, | 494 | ACPI_WARNING((AE_INFO, |
@@ -492,6 +500,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
492 | 500 | ||
493 | acpi_gbl_global_lock_thread_count--; | 501 | acpi_gbl_global_lock_thread_count--; |
494 | if (acpi_gbl_global_lock_thread_count) { | 502 | if (acpi_gbl_global_lock_thread_count) { |
503 | |||
495 | /* There are still some threads holding the lock, cannot release */ | 504 | /* There are still some threads holding the lock, cannot release */ |
496 | 505 | ||
497 | return_ACPI_STATUS(AE_OK); | 506 | return_ACPI_STATUS(AE_OK); |
@@ -533,7 +542,7 @@ void acpi_ev_terminate(void) | |||
533 | acpi_native_uint i; | 542 | acpi_native_uint i; |
534 | acpi_status status; | 543 | acpi_status status; |
535 | 544 | ||
536 | ACPI_FUNCTION_TRACE("ev_terminate"); | 545 | ACPI_FUNCTION_TRACE(ev_terminate); |
537 | 546 | ||
538 | if (acpi_gbl_events_initialized) { | 547 | if (acpi_gbl_events_initialized) { |
539 | /* | 548 | /* |
@@ -573,7 +582,7 @@ void acpi_ev_terminate(void) | |||
573 | if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { | 582 | if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { |
574 | status = acpi_disable(); | 583 | status = acpi_disable(); |
575 | if (ACPI_FAILURE(status)) { | 584 | if (ACPI_FAILURE(status)) { |
576 | ACPI_WARNING((AE_INFO, "acpi_disable failed")); | 585 | ACPI_WARNING((AE_INFO, "AcpiDisable failed")); |
577 | } | 586 | } |
578 | } | 587 | } |
579 | return_VOID; | 588 | return_VOID; |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 6da58e776413..094a17e4c86d 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -83,7 +83,7 @@ acpi_status acpi_ev_install_region_handlers(void) | |||
83 | acpi_status status; | 83 | acpi_status status; |
84 | acpi_native_uint i; | 84 | acpi_native_uint i; |
85 | 85 | ||
86 | ACPI_FUNCTION_TRACE("ev_install_region_handlers"); | 86 | ACPI_FUNCTION_TRACE(ev_install_region_handlers); |
87 | 87 | ||
88 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 88 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
89 | if (ACPI_FAILURE(status)) { | 89 | if (ACPI_FAILURE(status)) { |
@@ -153,7 +153,7 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
153 | acpi_status status; | 153 | acpi_status status; |
154 | acpi_native_uint i; | 154 | acpi_native_uint i; |
155 | 155 | ||
156 | ACPI_FUNCTION_TRACE("ev_initialize_op_regions"); | 156 | ACPI_FUNCTION_TRACE(ev_initialize_op_regions); |
157 | 157 | ||
158 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 158 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
159 | if (ACPI_FAILURE(status)) { | 159 | if (ACPI_FAILURE(status)) { |
@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
164 | * Run the _REG methods for op_regions in each default address space | 164 | * Run the _REG methods for op_regions in each default address space |
165 | */ | 165 | */ |
166 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { | 166 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { |
167 | |||
167 | /* TBD: Make sure handler is the DEFAULT handler, otherwise | 168 | /* TBD: Make sure handler is the DEFAULT handler, otherwise |
168 | * _REG will have already been run. | 169 | * _REG will have already been run. |
169 | */ | 170 | */ |
@@ -192,12 +193,12 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
192 | acpi_status | 193 | acpi_status |
193 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | 194 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) |
194 | { | 195 | { |
195 | struct acpi_parameter_info info; | 196 | struct acpi_evaluate_info *info; |
196 | union acpi_operand_object *params[3]; | 197 | union acpi_operand_object *args[3]; |
197 | union acpi_operand_object *region_obj2; | 198 | union acpi_operand_object *region_obj2; |
198 | acpi_status status; | 199 | acpi_status status; |
199 | 200 | ||
200 | ACPI_FUNCTION_TRACE("ev_execute_reg_method"); | 201 | ACPI_FUNCTION_TRACE(ev_execute_reg_method); |
201 | 202 | ||
202 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 203 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
203 | if (!region_obj2) { | 204 | if (!region_obj2) { |
@@ -208,48 +209,60 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
208 | return_ACPI_STATUS(AE_OK); | 209 | return_ACPI_STATUS(AE_OK); |
209 | } | 210 | } |
210 | 211 | ||
212 | /* Allocate and initialize the evaluation information block */ | ||
213 | |||
214 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
215 | if (!info) { | ||
216 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
217 | } | ||
218 | |||
219 | info->prefix_node = region_obj2->extra.method_REG; | ||
220 | info->pathname = NULL; | ||
221 | info->parameters = args; | ||
222 | info->parameter_type = ACPI_PARAM_ARGS; | ||
223 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
224 | |||
211 | /* | 225 | /* |
212 | * The _REG method has two arguments: | 226 | * The _REG method has two arguments: |
213 | * | 227 | * |
214 | * Arg0, Integer: Operation region space ID | 228 | * Arg0 - Integer: |
215 | * Same value as region_obj->Region.space_id | 229 | * Operation region space ID Same value as region_obj->Region.space_id |
216 | * Arg1, Integer: connection status | 230 | * |
217 | * 1 for connecting the handler, | 231 | * Arg1 - Integer: |
218 | * 0 for disconnecting the handler | 232 | * connection status 1 for connecting the handler, 0 for disconnecting |
219 | * Passed as a parameter | 233 | * the handler (Passed as a parameter) |
220 | */ | 234 | */ |
221 | params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 235 | args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
222 | if (!params[0]) { | 236 | if (!args[0]) { |
223 | return_ACPI_STATUS(AE_NO_MEMORY); | 237 | status = AE_NO_MEMORY; |
238 | goto cleanup1; | ||
224 | } | 239 | } |
225 | 240 | ||
226 | params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 241 | args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
227 | if (!params[1]) { | 242 | if (!args[1]) { |
228 | status = AE_NO_MEMORY; | 243 | status = AE_NO_MEMORY; |
229 | goto cleanup; | 244 | goto cleanup2; |
230 | } | 245 | } |
231 | 246 | ||
232 | /* Setup the parameter objects */ | 247 | /* Setup the parameter objects */ |
233 | 248 | ||
234 | params[0]->integer.value = region_obj->region.space_id; | 249 | args[0]->integer.value = region_obj->region.space_id; |
235 | params[1]->integer.value = function; | 250 | args[1]->integer.value = function; |
236 | params[2] = NULL; | 251 | args[2] = NULL; |
237 | |||
238 | info.node = region_obj2->extra.method_REG; | ||
239 | info.parameters = params; | ||
240 | info.parameter_type = ACPI_PARAM_ARGS; | ||
241 | 252 | ||
242 | /* Execute the method, no return value */ | 253 | /* Execute the method, no return value */ |
243 | 254 | ||
244 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 255 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
245 | (ACPI_TYPE_METHOD, info.node, NULL)); | 256 | (ACPI_TYPE_METHOD, info->prefix_node, NULL)); |
246 | status = acpi_ns_evaluate_by_handle(&info); | ||
247 | 257 | ||
248 | acpi_ut_remove_reference(params[1]); | 258 | status = acpi_ns_evaluate(info); |
259 | acpi_ut_remove_reference(args[1]); | ||
249 | 260 | ||
250 | cleanup: | 261 | cleanup2: |
251 | acpi_ut_remove_reference(params[0]); | 262 | acpi_ut_remove_reference(args[0]); |
252 | 263 | ||
264 | cleanup1: | ||
265 | ACPI_FREE(info); | ||
253 | return_ACPI_STATUS(status); | 266 | return_ACPI_STATUS(status); |
254 | } | 267 | } |
255 | 268 | ||
@@ -261,7 +274,8 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
261 | * Function - Read or Write operation | 274 | * Function - Read or Write operation |
262 | * Address - Where in the space to read or write | 275 | * Address - Where in the space to read or write |
263 | * bit_width - Field width in bits (8, 16, 32, or 64) | 276 | * bit_width - Field width in bits (8, 16, 32, or 64) |
264 | * Value - Pointer to in or out value | 277 | * Value - Pointer to in or out value, must be |
278 | * full 64-bit acpi_integer | ||
265 | * | 279 | * |
266 | * RETURN: Status | 280 | * RETURN: Status |
267 | * | 281 | * |
@@ -274,7 +288,7 @@ acpi_status | |||
274 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 288 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
275 | u32 function, | 289 | u32 function, |
276 | acpi_physical_address address, | 290 | acpi_physical_address address, |
277 | u32 bit_width, void *value) | 291 | u32 bit_width, acpi_integer * value) |
278 | { | 292 | { |
279 | acpi_status status; | 293 | acpi_status status; |
280 | acpi_status status2; | 294 | acpi_status status2; |
@@ -284,7 +298,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
284 | union acpi_operand_object *region_obj2; | 298 | union acpi_operand_object *region_obj2; |
285 | void *region_context = NULL; | 299 | void *region_context = NULL; |
286 | 300 | ||
287 | ACPI_FUNCTION_TRACE("ev_address_space_dispatch"); | 301 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); |
288 | 302 | ||
289 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 303 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
290 | if (!region_obj2) { | 304 | if (!region_obj2) { |
@@ -315,6 +329,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
315 | */ | 329 | */ |
316 | region_setup = handler_desc->address_space.setup; | 330 | region_setup = handler_desc->address_space.setup; |
317 | if (!region_setup) { | 331 | if (!region_setup) { |
332 | |||
318 | /* No initialization routine, exit with error */ | 333 | /* No initialization routine, exit with error */ |
319 | 334 | ||
320 | ACPI_ERROR((AE_INFO, | 335 | ACPI_ERROR((AE_INFO, |
@@ -361,9 +376,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
361 | region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; | 376 | region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; |
362 | 377 | ||
363 | if (region_obj2->extra.region_context) { | 378 | if (region_obj2->extra.region_context) { |
379 | |||
364 | /* The handler for this region was already installed */ | 380 | /* The handler for this region was already installed */ |
365 | 381 | ||
366 | ACPI_MEM_FREE(region_context); | 382 | ACPI_FREE(region_context); |
367 | } else { | 383 | } else { |
368 | /* | 384 | /* |
369 | * Save the returned context for use in all accesses to | 385 | * Save the returned context for use in all accesses to |
@@ -386,9 +402,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
386 | acpi_ut_get_region_name(region_obj->region. | 402 | acpi_ut_get_region_name(region_obj->region. |
387 | space_id))); | 403 | space_id))); |
388 | 404 | ||
389 | if (! | 405 | if (!(handler_desc->address_space.handler_flags & |
390 | (handler_desc->address_space. | 406 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
391 | hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | ||
392 | /* | 407 | /* |
393 | * For handlers other than the default (supplied) handlers, we must | 408 | * For handlers other than the default (supplied) handlers, we must |
394 | * exit the interpreter because the handler *might* block -- we don't | 409 | * exit the interpreter because the handler *might* block -- we don't |
@@ -409,9 +424,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
409 | space_id))); | 424 | space_id))); |
410 | } | 425 | } |
411 | 426 | ||
412 | if (! | 427 | if (!(handler_desc->address_space.handler_flags & |
413 | (handler_desc->address_space. | 428 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
414 | hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | ||
415 | /* | 429 | /* |
416 | * We just returned from a non-default handler, we must re-enter the | 430 | * We just returned from a non-default handler, we must re-enter the |
417 | * interpreter | 431 | * interpreter |
@@ -451,7 +465,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
451 | union acpi_operand_object *region_obj2; | 465 | union acpi_operand_object *region_obj2; |
452 | acpi_status status; | 466 | acpi_status status; |
453 | 467 | ||
454 | ACPI_FUNCTION_TRACE("ev_detach_region"); | 468 | ACPI_FUNCTION_TRACE(ev_detach_region); |
455 | 469 | ||
456 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 470 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
457 | if (!region_obj2) { | 471 | if (!region_obj2) { |
@@ -463,6 +477,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
463 | 477 | ||
464 | handler_obj = region_obj->region.handler; | 478 | handler_obj = region_obj->region.handler; |
465 | if (!handler_obj) { | 479 | if (!handler_obj) { |
480 | |||
466 | /* This region has no handler, all done */ | 481 | /* This region has no handler, all done */ |
467 | 482 | ||
468 | return_VOID; | 483 | return_VOID; |
@@ -474,6 +489,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
474 | last_obj_ptr = &handler_obj->address_space.region_list; | 489 | last_obj_ptr = &handler_obj->address_space.region_list; |
475 | 490 | ||
476 | while (obj_desc) { | 491 | while (obj_desc) { |
492 | |||
477 | /* Is this the correct Region? */ | 493 | /* Is this the correct Region? */ |
478 | 494 | ||
479 | if (obj_desc == region_obj) { | 495 | if (obj_desc == region_obj) { |
@@ -583,7 +599,7 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, | |||
583 | u8 acpi_ns_is_locked) | 599 | u8 acpi_ns_is_locked) |
584 | { | 600 | { |
585 | 601 | ||
586 | ACPI_FUNCTION_TRACE("ev_attach_region"); | 602 | ACPI_FUNCTION_TRACE(ev_attach_region); |
587 | 603 | ||
588 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 604 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
589 | "Adding Region [%4.4s] %p to address handler %p [%s]\n", | 605 | "Adding Region [%4.4s] %p to address handler %p [%s]\n", |
@@ -636,7 +652,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
636 | struct acpi_namespace_node *node; | 652 | struct acpi_namespace_node *node; |
637 | acpi_status status; | 653 | acpi_status status; |
638 | 654 | ||
639 | ACPI_FUNCTION_NAME("ev_install_handler"); | 655 | ACPI_FUNCTION_NAME(ev_install_handler); |
640 | 656 | ||
641 | handler_obj = (union acpi_operand_object *)context; | 657 | handler_obj = (union acpi_operand_object *)context; |
642 | 658 | ||
@@ -666,6 +682,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
666 | 682 | ||
667 | obj_desc = acpi_ns_get_attached_object(node); | 683 | obj_desc = acpi_ns_get_attached_object(node); |
668 | if (!obj_desc) { | 684 | if (!obj_desc) { |
685 | |||
669 | /* No object, just exit */ | 686 | /* No object, just exit */ |
670 | 687 | ||
671 | return (AE_OK); | 688 | return (AE_OK); |
@@ -674,10 +691,12 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
674 | /* Devices are handled different than regions */ | 691 | /* Devices are handled different than regions */ |
675 | 692 | ||
676 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { | 693 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { |
694 | |||
677 | /* Check if this Device already has a handler for this address space */ | 695 | /* Check if this Device already has a handler for this address space */ |
678 | 696 | ||
679 | next_handler_obj = obj_desc->device.handler; | 697 | next_handler_obj = obj_desc->device.handler; |
680 | while (next_handler_obj) { | 698 | while (next_handler_obj) { |
699 | |||
681 | /* Found a handler, is it for the same address space? */ | 700 | /* Found a handler, is it for the same address space? */ |
682 | 701 | ||
683 | if (next_handler_obj->address_space.space_id == | 702 | if (next_handler_obj->address_space.space_id == |
@@ -764,9 +783,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
764 | union acpi_operand_object *handler_obj; | 783 | union acpi_operand_object *handler_obj; |
765 | acpi_status status; | 784 | acpi_status status; |
766 | acpi_object_type type; | 785 | acpi_object_type type; |
767 | u16 flags = 0; | 786 | u8 flags = 0; |
768 | 787 | ||
769 | ACPI_FUNCTION_TRACE("ev_install_space_handler"); | 788 | ACPI_FUNCTION_TRACE(ev_install_space_handler); |
770 | 789 | ||
771 | /* | 790 | /* |
772 | * This registration is valid for only the types below | 791 | * This registration is valid for only the types below |
@@ -839,6 +858,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
839 | /* Walk the handler list for this device */ | 858 | /* Walk the handler list for this device */ |
840 | 859 | ||
841 | while (handler_obj) { | 860 | while (handler_obj) { |
861 | |||
842 | /* Same space_id indicates a handler already installed */ | 862 | /* Same space_id indicates a handler already installed */ |
843 | 863 | ||
844 | if (handler_obj->address_space.space_id == space_id) { | 864 | if (handler_obj->address_space.space_id == space_id) { |
@@ -921,7 +941,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
921 | /* Init handler obj */ | 941 | /* Init handler obj */ |
922 | 942 | ||
923 | handler_obj->address_space.space_id = (u8) space_id; | 943 | handler_obj->address_space.space_id = (u8) space_id; |
924 | handler_obj->address_space.hflags = flags; | 944 | handler_obj->address_space.handler_flags = flags; |
925 | handler_obj->address_space.region_list = NULL; | 945 | handler_obj->address_space.region_list = NULL; |
926 | handler_obj->address_space.node = node; | 946 | handler_obj->address_space.node = node; |
927 | handler_obj->address_space.handler = handler; | 947 | handler_obj->address_space.handler = handler; |
@@ -979,7 +999,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
979 | { | 999 | { |
980 | acpi_status status; | 1000 | acpi_status status; |
981 | 1001 | ||
982 | ACPI_FUNCTION_TRACE("ev_execute_reg_methods"); | 1002 | ACPI_FUNCTION_TRACE(ev_execute_reg_methods); |
983 | 1003 | ||
984 | /* | 1004 | /* |
985 | * Run all _REG methods for all Operation Regions for this | 1005 | * Run all _REG methods for all Operation Regions for this |
@@ -1001,7 +1021,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
1001 | * | 1021 | * |
1002 | * PARAMETERS: walk_namespace callback | 1022 | * PARAMETERS: walk_namespace callback |
1003 | * | 1023 | * |
1004 | * DESCRIPTION: Run _REg method for region objects of the requested space_iD | 1024 | * DESCRIPTION: Run _REG method for region objects of the requested space_iD |
1005 | * | 1025 | * |
1006 | ******************************************************************************/ | 1026 | ******************************************************************************/ |
1007 | 1027 | ||
@@ -1035,6 +1055,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, | |||
1035 | 1055 | ||
1036 | obj_desc = acpi_ns_get_attached_object(node); | 1056 | obj_desc = acpi_ns_get_attached_object(node); |
1037 | if (!obj_desc) { | 1057 | if (!obj_desc) { |
1058 | |||
1038 | /* No object, just exit */ | 1059 | /* No object, just exit */ |
1039 | 1060 | ||
1040 | return (AE_OK); | 1061 | return (AE_OK); |
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index baed8c1a1b9f..5b3c7a85eb9a 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -71,11 +71,22 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, | |||
71 | (union acpi_operand_object *)handle; | 71 | (union acpi_operand_object *)handle; |
72 | struct acpi_mem_space_context *local_region_context; | 72 | struct acpi_mem_space_context *local_region_context; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE("ev_system_memory_region_setup"); | 74 | ACPI_FUNCTION_TRACE(ev_system_memory_region_setup); |
75 | 75 | ||
76 | if (function == ACPI_REGION_DEACTIVATE) { | 76 | if (function == ACPI_REGION_DEACTIVATE) { |
77 | if (*region_context) { | 77 | if (*region_context) { |
78 | ACPI_MEM_FREE(*region_context); | 78 | local_region_context = |
79 | (struct acpi_mem_space_context *)*region_context; | ||
80 | |||
81 | /* Delete a cached mapping if present */ | ||
82 | |||
83 | if (local_region_context->mapped_length) { | ||
84 | acpi_os_unmap_memory(local_region_context-> | ||
85 | mapped_logical_address, | ||
86 | local_region_context-> | ||
87 | mapped_length); | ||
88 | } | ||
89 | ACPI_FREE(local_region_context); | ||
79 | *region_context = NULL; | 90 | *region_context = NULL; |
80 | } | 91 | } |
81 | return_ACPI_STATUS(AE_OK); | 92 | return_ACPI_STATUS(AE_OK); |
@@ -84,7 +95,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, | |||
84 | /* Create a new context */ | 95 | /* Create a new context */ |
85 | 96 | ||
86 | local_region_context = | 97 | local_region_context = |
87 | ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); | 98 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context)); |
88 | if (!(local_region_context)) { | 99 | if (!(local_region_context)) { |
89 | return_ACPI_STATUS(AE_NO_MEMORY); | 100 | return_ACPI_STATUS(AE_NO_MEMORY); |
90 | } | 101 | } |
@@ -118,7 +129,7 @@ acpi_ev_io_space_region_setup(acpi_handle handle, | |||
118 | u32 function, | 129 | u32 function, |
119 | void *handler_context, void **region_context) | 130 | void *handler_context, void **region_context) |
120 | { | 131 | { |
121 | ACPI_FUNCTION_TRACE("ev_io_space_region_setup"); | 132 | ACPI_FUNCTION_TRACE(ev_io_space_region_setup); |
122 | 133 | ||
123 | if (function == ACPI_REGION_DEACTIVATE) { | 134 | if (function == ACPI_REGION_DEACTIVATE) { |
124 | *region_context = NULL; | 135 | *region_context = NULL; |
@@ -161,7 +172,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
161 | (union acpi_operand_object *)handle; | 172 | (union acpi_operand_object *)handle; |
162 | struct acpi_device_id object_hID; | 173 | struct acpi_device_id object_hID; |
163 | 174 | ||
164 | ACPI_FUNCTION_TRACE("ev_pci_config_region_setup"); | 175 | ACPI_FUNCTION_TRACE(ev_pci_config_region_setup); |
165 | 176 | ||
166 | handler_obj = region_obj->region.handler; | 177 | handler_obj = region_obj->region.handler; |
167 | if (!handler_obj) { | 178 | if (!handler_obj) { |
@@ -178,7 +189,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
178 | *region_context = NULL; | 189 | *region_context = NULL; |
179 | if (function == ACPI_REGION_DEACTIVATE) { | 190 | if (function == ACPI_REGION_DEACTIVATE) { |
180 | if (pci_id) { | 191 | if (pci_id) { |
181 | ACPI_MEM_FREE(pci_id); | 192 | ACPI_FREE(pci_id); |
182 | } | 193 | } |
183 | return_ACPI_STATUS(status); | 194 | return_ACPI_STATUS(status); |
184 | } | 195 | } |
@@ -199,6 +210,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
199 | * handlers with that device. | 210 | * handlers with that device. |
200 | */ | 211 | */ |
201 | if (handler_obj->address_space.node == acpi_gbl_root_node) { | 212 | if (handler_obj->address_space.node == acpi_gbl_root_node) { |
213 | |||
202 | /* Start search from the parent object */ | 214 | /* Start search from the parent object */ |
203 | 215 | ||
204 | pci_root_node = parent_node; | 216 | pci_root_node = parent_node; |
@@ -220,6 +232,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
220 | PCI_EXPRESS_ROOT_HID_STRING, | 232 | PCI_EXPRESS_ROOT_HID_STRING, |
221 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) | 233 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) |
222 | { | 234 | { |
235 | |||
223 | /* Install a handler for this PCI root bridge */ | 236 | /* Install a handler for this PCI root bridge */ |
224 | 237 | ||
225 | status = | 238 | status = |
@@ -235,7 +248,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
235 | } else { | 248 | } else { |
236 | ACPI_EXCEPTION((AE_INFO, | 249 | ACPI_EXCEPTION((AE_INFO, |
237 | status, | 250 | status, |
238 | "Could not install pci_config handler for Root Bridge %4.4s", | 251 | "Could not install PciConfig handler for Root Bridge %4.4s", |
239 | acpi_ut_get_node_name | 252 | acpi_ut_get_node_name |
240 | (pci_root_node))); | 253 | (pci_root_node))); |
241 | } | 254 | } |
@@ -262,7 +275,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
262 | 275 | ||
263 | /* Region is still not initialized. Create a new context */ | 276 | /* Region is still not initialized. Create a new context */ |
264 | 277 | ||
265 | pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); | 278 | pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id)); |
266 | if (!pci_id) { | 279 | if (!pci_id) { |
267 | return_ACPI_STATUS(AE_NO_MEMORY); | 280 | return_ACPI_STATUS(AE_NO_MEMORY); |
268 | } | 281 | } |
@@ -337,7 +350,7 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle, | |||
337 | u32 function, | 350 | u32 function, |
338 | void *handler_context, void **region_context) | 351 | void *handler_context, void **region_context) |
339 | { | 352 | { |
340 | ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup"); | 353 | ACPI_FUNCTION_TRACE(ev_pci_bar_region_setup); |
341 | 354 | ||
342 | return_ACPI_STATUS(AE_OK); | 355 | return_ACPI_STATUS(AE_OK); |
343 | } | 356 | } |
@@ -364,7 +377,7 @@ acpi_ev_cmos_region_setup(acpi_handle handle, | |||
364 | u32 function, | 377 | u32 function, |
365 | void *handler_context, void **region_context) | 378 | void *handler_context, void **region_context) |
366 | { | 379 | { |
367 | ACPI_FUNCTION_TRACE("ev_cmos_region_setup"); | 380 | ACPI_FUNCTION_TRACE(ev_cmos_region_setup); |
368 | 381 | ||
369 | return_ACPI_STATUS(AE_OK); | 382 | return_ACPI_STATUS(AE_OK); |
370 | } | 383 | } |
@@ -389,7 +402,7 @@ acpi_ev_default_region_setup(acpi_handle handle, | |||
389 | u32 function, | 402 | u32 function, |
390 | void *handler_context, void **region_context) | 403 | void *handler_context, void **region_context) |
391 | { | 404 | { |
392 | ACPI_FUNCTION_TRACE("ev_default_region_setup"); | 405 | ACPI_FUNCTION_TRACE(ev_default_region_setup); |
393 | 406 | ||
394 | if (function == ACPI_REGION_DEACTIVATE) { | 407 | if (function == ACPI_REGION_DEACTIVATE) { |
395 | *region_context = NULL; | 408 | *region_context = NULL; |
@@ -435,7 +448,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
435 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | 448 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; |
436 | union acpi_operand_object *region_obj2; | 449 | union acpi_operand_object *region_obj2; |
437 | 450 | ||
438 | ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked); | 451 | ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); |
439 | 452 | ||
440 | if (!region_obj) { | 453 | if (!region_obj) { |
441 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 454 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -462,8 +475,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
462 | 475 | ||
463 | /* Find any "_REG" method associated with this region definition */ | 476 | /* Find any "_REG" method associated with this region definition */ |
464 | 477 | ||
465 | status = acpi_ns_search_node(*reg_name_ptr, node, | 478 | status = |
466 | ACPI_TYPE_METHOD, &method_node); | 479 | acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, |
480 | &method_node); | ||
467 | if (ACPI_SUCCESS(status)) { | 481 | if (ACPI_SUCCESS(status)) { |
468 | /* | 482 | /* |
469 | * The _REG method is optional and there can be only one per region | 483 | * The _REG method is optional and there can be only one per region |
@@ -478,11 +492,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
478 | * ie: acpi_gbl_root_node->parent_entry being set to NULL | 492 | * ie: acpi_gbl_root_node->parent_entry being set to NULL |
479 | */ | 493 | */ |
480 | while (node) { | 494 | while (node) { |
495 | |||
481 | /* Check to see if a handler exists */ | 496 | /* Check to see if a handler exists */ |
482 | 497 | ||
483 | handler_obj = NULL; | 498 | handler_obj = NULL; |
484 | obj_desc = acpi_ns_get_attached_object(node); | 499 | obj_desc = acpi_ns_get_attached_object(node); |
485 | if (obj_desc) { | 500 | if (obj_desc) { |
501 | |||
486 | /* Can only be a handler if the object exists */ | 502 | /* Can only be a handler if the object exists */ |
487 | 503 | ||
488 | switch (node->type) { | 504 | switch (node->type) { |
@@ -507,10 +523,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
507 | } | 523 | } |
508 | 524 | ||
509 | while (handler_obj) { | 525 | while (handler_obj) { |
526 | |||
510 | /* Is this handler of the correct type? */ | 527 | /* Is this handler of the correct type? */ |
511 | 528 | ||
512 | if (handler_obj->address_space.space_id == | 529 | if (handler_obj->address_space.space_id == |
513 | space_id) { | 530 | space_id) { |
531 | |||
514 | /* Found correct handler */ | 532 | /* Found correct handler */ |
515 | 533 | ||
516 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 534 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
@@ -571,7 +589,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
571 | /* If we get here, there is no handler for this region */ | 589 | /* If we get here, there is no handler for this region */ |
572 | 590 | ||
573 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 591 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
574 | "No handler for region_type %s(%X) (region_obj %p)\n", | 592 | "No handler for RegionType %s(%X) (RegionObj %p)\n", |
575 | acpi_ut_get_region_name(space_id), space_id, | 593 | acpi_ut_get_region_name(space_id), space_id, |
576 | region_obj)); | 594 | region_obj)); |
577 | 595 | ||
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 9a622169008a..8106215ad554 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c | |||
@@ -69,7 +69,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) | |||
69 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; | 69 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; |
70 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; | 70 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler"); | 72 | ACPI_FUNCTION_TRACE(ev_sci_xrupt_handler); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * We are guaranteed by the ACPI CA initialization/shutdown code that | 75 | * We are guaranteed by the ACPI CA initialization/shutdown code that |
@@ -108,7 +108,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) | |||
108 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; | 108 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; |
109 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; | 109 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; |
110 | 110 | ||
111 | ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler"); | 111 | ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler); |
112 | 112 | ||
113 | /* | 113 | /* |
114 | * We are guaranteed by the ACPI CA initialization/shutdown code that | 114 | * We are guaranteed by the ACPI CA initialization/shutdown code that |
@@ -140,7 +140,7 @@ u32 acpi_ev_install_sci_handler(void) | |||
140 | { | 140 | { |
141 | u32 status = AE_OK; | 141 | u32 status = AE_OK; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE("ev_install_sci_handler"); | 143 | ACPI_FUNCTION_TRACE(ev_install_sci_handler); |
144 | 144 | ||
145 | status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, | 145 | status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, |
146 | acpi_ev_sci_xrupt_handler, | 146 | acpi_ev_sci_xrupt_handler, |
@@ -171,7 +171,7 @@ acpi_status acpi_ev_remove_sci_handler(void) | |||
171 | { | 171 | { |
172 | acpi_status status; | 172 | acpi_status status; |
173 | 173 | ||
174 | ACPI_FUNCTION_TRACE("ev_remove_sci_handler"); | 174 | ACPI_FUNCTION_TRACE(ev_remove_sci_handler); |
175 | 175 | ||
176 | /* Just let the OS remove the handler and disable the level */ | 176 | /* Just let the OS remove the handler and disable the level */ |
177 | 177 | ||
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index b38b39dde543..76c34a66e0e0 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acevents.h> | 46 | #include <acpi/acevents.h> |
@@ -68,7 +66,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
68 | { | 66 | { |
69 | acpi_status status; | 67 | acpi_status status; |
70 | 68 | ||
71 | ACPI_FUNCTION_TRACE("acpi_install_exception_handler"); | 69 | ACPI_FUNCTION_TRACE(acpi_install_exception_handler); |
72 | 70 | ||
73 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 71 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
74 | if (ACPI_FAILURE(status)) { | 72 | if (ACPI_FAILURE(status)) { |
@@ -90,6 +88,8 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
90 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 88 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
91 | return_ACPI_STATUS(status); | 89 | return_ACPI_STATUS(status); |
92 | } | 90 | } |
91 | |||
92 | ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) | ||
93 | #endif /* ACPI_FUTURE_USAGE */ | 93 | #endif /* ACPI_FUTURE_USAGE */ |
94 | 94 | ||
95 | /******************************************************************************* | 95 | /******************************************************************************* |
@@ -107,14 +107,13 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
107 | * event. | 107 | * event. |
108 | * | 108 | * |
109 | ******************************************************************************/ | 109 | ******************************************************************************/ |
110 | |||
111 | acpi_status | 110 | acpi_status |
112 | acpi_install_fixed_event_handler(u32 event, | 111 | acpi_install_fixed_event_handler(u32 event, |
113 | acpi_event_handler handler, void *context) | 112 | acpi_event_handler handler, void *context) |
114 | { | 113 | { |
115 | acpi_status status; | 114 | acpi_status status; |
116 | 115 | ||
117 | ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler"); | 116 | ACPI_FUNCTION_TRACE(acpi_install_fixed_event_handler); |
118 | 117 | ||
119 | /* Parameter validation */ | 118 | /* Parameter validation */ |
120 | 119 | ||
@@ -161,7 +160,7 @@ acpi_install_fixed_event_handler(u32 event, | |||
161 | return_ACPI_STATUS(status); | 160 | return_ACPI_STATUS(status); |
162 | } | 161 | } |
163 | 162 | ||
164 | EXPORT_SYMBOL(acpi_install_fixed_event_handler); | 163 | ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler) |
165 | 164 | ||
166 | /******************************************************************************* | 165 | /******************************************************************************* |
167 | * | 166 | * |
@@ -175,13 +174,12 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler); | |||
175 | * DESCRIPTION: Disables the event and unregisters the event handler. | 174 | * DESCRIPTION: Disables the event and unregisters the event handler. |
176 | * | 175 | * |
177 | ******************************************************************************/ | 176 | ******************************************************************************/ |
178 | |||
179 | acpi_status | 177 | acpi_status |
180 | acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) | 178 | acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) |
181 | { | 179 | { |
182 | acpi_status status = AE_OK; | 180 | acpi_status status = AE_OK; |
183 | 181 | ||
184 | ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler"); | 182 | ACPI_FUNCTION_TRACE(acpi_remove_fixed_event_handler); |
185 | 183 | ||
186 | /* Parameter validation */ | 184 | /* Parameter validation */ |
187 | 185 | ||
@@ -216,7 +214,7 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) | |||
216 | return_ACPI_STATUS(status); | 214 | return_ACPI_STATUS(status); |
217 | } | 215 | } |
218 | 216 | ||
219 | EXPORT_SYMBOL(acpi_remove_fixed_event_handler); | 217 | ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) |
220 | 218 | ||
221 | /******************************************************************************* | 219 | /******************************************************************************* |
222 | * | 220 | * |
@@ -235,7 +233,6 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler); | |||
235 | * DESCRIPTION: Install a handler for notifies on an ACPI device | 233 | * DESCRIPTION: Install a handler for notifies on an ACPI device |
236 | * | 234 | * |
237 | ******************************************************************************/ | 235 | ******************************************************************************/ |
238 | |||
239 | acpi_status | 236 | acpi_status |
240 | acpi_install_notify_handler(acpi_handle device, | 237 | acpi_install_notify_handler(acpi_handle device, |
241 | u32 handler_type, | 238 | u32 handler_type, |
@@ -246,7 +243,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
246 | struct acpi_namespace_node *node; | 243 | struct acpi_namespace_node *node; |
247 | acpi_status status; | 244 | acpi_status status; |
248 | 245 | ||
249 | ACPI_FUNCTION_TRACE("acpi_install_notify_handler"); | 246 | ACPI_FUNCTION_TRACE(acpi_install_notify_handler); |
250 | 247 | ||
251 | /* Parameter validation */ | 248 | /* Parameter validation */ |
252 | 249 | ||
@@ -275,6 +272,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
275 | * only one <external> global handler can be regsitered (per notify type). | 272 | * only one <external> global handler can be regsitered (per notify type). |
276 | */ | 273 | */ |
277 | if (device == ACPI_ROOT_OBJECT) { | 274 | if (device == ACPI_ROOT_OBJECT) { |
275 | |||
278 | /* Make sure the handler is not already installed */ | 276 | /* Make sure the handler is not already installed */ |
279 | 277 | ||
280 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 278 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && |
@@ -317,6 +315,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
317 | 315 | ||
318 | obj_desc = acpi_ns_get_attached_object(node); | 316 | obj_desc = acpi_ns_get_attached_object(node); |
319 | if (obj_desc) { | 317 | if (obj_desc) { |
318 | |||
320 | /* Object exists - make sure there's no handler */ | 319 | /* Object exists - make sure there's no handler */ |
321 | 320 | ||
322 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 321 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && |
@@ -370,6 +369,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
370 | } | 369 | } |
371 | 370 | ||
372 | if (handler_type == ACPI_ALL_NOTIFY) { | 371 | if (handler_type == ACPI_ALL_NOTIFY) { |
372 | |||
373 | /* Extra ref if installed in both */ | 373 | /* Extra ref if installed in both */ |
374 | 374 | ||
375 | acpi_ut_add_reference(notify_obj); | 375 | acpi_ut_add_reference(notify_obj); |
@@ -381,7 +381,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
381 | return_ACPI_STATUS(status); | 381 | return_ACPI_STATUS(status); |
382 | } | 382 | } |
383 | 383 | ||
384 | EXPORT_SYMBOL(acpi_install_notify_handler); | 384 | ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) |
385 | 385 | ||
386 | /******************************************************************************* | 386 | /******************************************************************************* |
387 | * | 387 | * |
@@ -399,7 +399,6 @@ EXPORT_SYMBOL(acpi_install_notify_handler); | |||
399 | * DESCRIPTION: Remove a handler for notifies on an ACPI device | 399 | * DESCRIPTION: Remove a handler for notifies on an ACPI device |
400 | * | 400 | * |
401 | ******************************************************************************/ | 401 | ******************************************************************************/ |
402 | |||
403 | acpi_status | 402 | acpi_status |
404 | acpi_remove_notify_handler(acpi_handle device, | 403 | acpi_remove_notify_handler(acpi_handle device, |
405 | u32 handler_type, acpi_notify_handler handler) | 404 | u32 handler_type, acpi_notify_handler handler) |
@@ -409,7 +408,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
409 | struct acpi_namespace_node *node; | 408 | struct acpi_namespace_node *node; |
410 | acpi_status status; | 409 | acpi_status status; |
411 | 410 | ||
412 | ACPI_FUNCTION_TRACE("acpi_remove_notify_handler"); | 411 | ACPI_FUNCTION_TRACE(acpi_remove_notify_handler); |
413 | 412 | ||
414 | /* Parameter validation */ | 413 | /* Parameter validation */ |
415 | 414 | ||
@@ -535,7 +534,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
535 | return_ACPI_STATUS(status); | 534 | return_ACPI_STATUS(status); |
536 | } | 535 | } |
537 | 536 | ||
538 | EXPORT_SYMBOL(acpi_remove_notify_handler); | 537 | ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler) |
539 | 538 | ||
540 | /******************************************************************************* | 539 | /******************************************************************************* |
541 | * | 540 | * |
@@ -554,7 +553,6 @@ EXPORT_SYMBOL(acpi_remove_notify_handler); | |||
554 | * DESCRIPTION: Install a handler for a General Purpose Event. | 553 | * DESCRIPTION: Install a handler for a General Purpose Event. |
555 | * | 554 | * |
556 | ******************************************************************************/ | 555 | ******************************************************************************/ |
557 | |||
558 | acpi_status | 556 | acpi_status |
559 | acpi_install_gpe_handler(acpi_handle gpe_device, | 557 | acpi_install_gpe_handler(acpi_handle gpe_device, |
560 | u32 gpe_number, | 558 | u32 gpe_number, |
@@ -565,7 +563,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
565 | acpi_status status; | 563 | acpi_status status; |
566 | acpi_cpu_flags flags; | 564 | acpi_cpu_flags flags; |
567 | 565 | ||
568 | ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); | 566 | ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); |
569 | 567 | ||
570 | /* Parameter validation */ | 568 | /* Parameter validation */ |
571 | 569 | ||
@@ -596,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
596 | 594 | ||
597 | /* Allocate and init handler object */ | 595 | /* Allocate and init handler object */ |
598 | 596 | ||
599 | handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); | 597 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); |
600 | if (!handler) { | 598 | if (!handler) { |
601 | status = AE_NO_MEMORY; | 599 | status = AE_NO_MEMORY; |
602 | goto unlock_and_exit; | 600 | goto unlock_and_exit; |
@@ -630,7 +628,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
630 | return_ACPI_STATUS(status); | 628 | return_ACPI_STATUS(status); |
631 | } | 629 | } |
632 | 630 | ||
633 | EXPORT_SYMBOL(acpi_install_gpe_handler); | 631 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) |
634 | 632 | ||
635 | /******************************************************************************* | 633 | /******************************************************************************* |
636 | * | 634 | * |
@@ -646,7 +644,6 @@ EXPORT_SYMBOL(acpi_install_gpe_handler); | |||
646 | * DESCRIPTION: Remove a handler for a General Purpose acpi_event. | 644 | * DESCRIPTION: Remove a handler for a General Purpose acpi_event. |
647 | * | 645 | * |
648 | ******************************************************************************/ | 646 | ******************************************************************************/ |
649 | |||
650 | acpi_status | 647 | acpi_status |
651 | acpi_remove_gpe_handler(acpi_handle gpe_device, | 648 | acpi_remove_gpe_handler(acpi_handle gpe_device, |
652 | u32 gpe_number, acpi_event_handler address) | 649 | u32 gpe_number, acpi_event_handler address) |
@@ -656,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
656 | acpi_status status; | 653 | acpi_status status; |
657 | acpi_cpu_flags flags; | 654 | acpi_cpu_flags flags; |
658 | 655 | ||
659 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); | 656 | ACPI_FUNCTION_TRACE(acpi_remove_gpe_handler); |
660 | 657 | ||
661 | /* Parameter validation */ | 658 | /* Parameter validation */ |
662 | 659 | ||
@@ -724,14 +721,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
724 | 721 | ||
725 | /* Now we can free the handler object */ | 722 | /* Now we can free the handler object */ |
726 | 723 | ||
727 | ACPI_MEM_FREE(handler); | 724 | ACPI_FREE(handler); |
728 | 725 | ||
729 | unlock_and_exit: | 726 | unlock_and_exit: |
730 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 727 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
731 | return_ACPI_STATUS(status); | 728 | return_ACPI_STATUS(status); |
732 | } | 729 | } |
733 | 730 | ||
734 | EXPORT_SYMBOL(acpi_remove_gpe_handler); | 731 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) |
735 | 732 | ||
736 | /******************************************************************************* | 733 | /******************************************************************************* |
737 | * | 734 | * |
@@ -746,7 +743,6 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler); | |||
746 | * DESCRIPTION: Acquire the ACPI Global Lock | 743 | * DESCRIPTION: Acquire the ACPI Global Lock |
747 | * | 744 | * |
748 | ******************************************************************************/ | 745 | ******************************************************************************/ |
749 | |||
750 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | 746 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) |
751 | { | 747 | { |
752 | acpi_status status; | 748 | acpi_status status; |
@@ -771,7 +767,7 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
771 | return (status); | 767 | return (status); |
772 | } | 768 | } |
773 | 769 | ||
774 | EXPORT_SYMBOL(acpi_acquire_global_lock); | 770 | ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock) |
775 | 771 | ||
776 | /******************************************************************************* | 772 | /******************************************************************************* |
777 | * | 773 | * |
@@ -784,7 +780,6 @@ EXPORT_SYMBOL(acpi_acquire_global_lock); | |||
784 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. | 780 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. |
785 | * | 781 | * |
786 | ******************************************************************************/ | 782 | ******************************************************************************/ |
787 | |||
788 | acpi_status acpi_release_global_lock(u32 handle) | 783 | acpi_status acpi_release_global_lock(u32 handle) |
789 | { | 784 | { |
790 | acpi_status status; | 785 | acpi_status status; |
@@ -797,4 +792,4 @@ acpi_status acpi_release_global_lock(u32 handle) | |||
797 | return (status); | 792 | return (status); |
798 | } | 793 | } |
799 | 794 | ||
800 | EXPORT_SYMBOL(acpi_release_global_lock); | 795 | ACPI_EXPORT_SYMBOL(acpi_release_global_lock) |
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index ec9ce8429f15..7ebc2efac936 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acevents.h> | 45 | #include <acpi/acevents.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
@@ -65,7 +63,7 @@ acpi_status acpi_enable(void) | |||
65 | { | 63 | { |
66 | acpi_status status = AE_OK; | 64 | acpi_status status = AE_OK; |
67 | 65 | ||
68 | ACPI_FUNCTION_TRACE("acpi_enable"); | 66 | ACPI_FUNCTION_TRACE(acpi_enable); |
69 | 67 | ||
70 | /* Make sure we have the FADT */ | 68 | /* Make sure we have the FADT */ |
71 | 69 | ||
@@ -94,6 +92,8 @@ acpi_status acpi_enable(void) | |||
94 | return_ACPI_STATUS(status); | 92 | return_ACPI_STATUS(status); |
95 | } | 93 | } |
96 | 94 | ||
95 | ACPI_EXPORT_SYMBOL(acpi_enable) | ||
96 | |||
97 | /******************************************************************************* | 97 | /******************************************************************************* |
98 | * | 98 | * |
99 | * FUNCTION: acpi_disable | 99 | * FUNCTION: acpi_disable |
@@ -105,12 +105,11 @@ acpi_status acpi_enable(void) | |||
105 | * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. | 105 | * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. |
106 | * | 106 | * |
107 | ******************************************************************************/ | 107 | ******************************************************************************/ |
108 | |||
109 | acpi_status acpi_disable(void) | 108 | acpi_status acpi_disable(void) |
110 | { | 109 | { |
111 | acpi_status status = AE_OK; | 110 | acpi_status status = AE_OK; |
112 | 111 | ||
113 | ACPI_FUNCTION_TRACE("acpi_disable"); | 112 | ACPI_FUNCTION_TRACE(acpi_disable); |
114 | 113 | ||
115 | if (!acpi_gbl_FADT) { | 114 | if (!acpi_gbl_FADT) { |
116 | ACPI_WARNING((AE_INFO, "No FADT information present!")); | 115 | ACPI_WARNING((AE_INFO, "No FADT information present!")); |
@@ -137,6 +136,8 @@ acpi_status acpi_disable(void) | |||
137 | return_ACPI_STATUS(status); | 136 | return_ACPI_STATUS(status); |
138 | } | 137 | } |
139 | 138 | ||
139 | ACPI_EXPORT_SYMBOL(acpi_disable) | ||
140 | |||
140 | /******************************************************************************* | 141 | /******************************************************************************* |
141 | * | 142 | * |
142 | * FUNCTION: acpi_enable_event | 143 | * FUNCTION: acpi_enable_event |
@@ -149,13 +150,12 @@ acpi_status acpi_disable(void) | |||
149 | * DESCRIPTION: Enable an ACPI event (fixed) | 150 | * DESCRIPTION: Enable an ACPI event (fixed) |
150 | * | 151 | * |
151 | ******************************************************************************/ | 152 | ******************************************************************************/ |
152 | |||
153 | acpi_status acpi_enable_event(u32 event, u32 flags) | 153 | acpi_status acpi_enable_event(u32 event, u32 flags) |
154 | { | 154 | { |
155 | acpi_status status = AE_OK; | 155 | acpi_status status = AE_OK; |
156 | u32 value; | 156 | u32 value; |
157 | 157 | ||
158 | ACPI_FUNCTION_TRACE("acpi_enable_event"); | 158 | ACPI_FUNCTION_TRACE(acpi_enable_event); |
159 | 159 | ||
160 | /* Decode the Fixed Event */ | 160 | /* Decode the Fixed Event */ |
161 | 161 | ||
@@ -193,7 +193,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags) | |||
193 | return_ACPI_STATUS(status); | 193 | return_ACPI_STATUS(status); |
194 | } | 194 | } |
195 | 195 | ||
196 | EXPORT_SYMBOL(acpi_enable_event); | 196 | ACPI_EXPORT_SYMBOL(acpi_enable_event) |
197 | 197 | ||
198 | /******************************************************************************* | 198 | /******************************************************************************* |
199 | * | 199 | * |
@@ -208,13 +208,12 @@ EXPORT_SYMBOL(acpi_enable_event); | |||
208 | * DESCRIPTION: Set the type of an individual GPE | 208 | * DESCRIPTION: Set the type of an individual GPE |
209 | * | 209 | * |
210 | ******************************************************************************/ | 210 | ******************************************************************************/ |
211 | |||
212 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) | 211 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) |
213 | { | 212 | { |
214 | acpi_status status = AE_OK; | 213 | acpi_status status = AE_OK; |
215 | struct acpi_gpe_event_info *gpe_event_info; | 214 | struct acpi_gpe_event_info *gpe_event_info; |
216 | 215 | ||
217 | ACPI_FUNCTION_TRACE("acpi_set_gpe_type"); | 216 | ACPI_FUNCTION_TRACE(acpi_set_gpe_type); |
218 | 217 | ||
219 | /* Ensure that we have a valid GPE number */ | 218 | /* Ensure that we have a valid GPE number */ |
220 | 219 | ||
@@ -236,7 +235,7 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) | |||
236 | return_ACPI_STATUS(status); | 235 | return_ACPI_STATUS(status); |
237 | } | 236 | } |
238 | 237 | ||
239 | EXPORT_SYMBOL(acpi_set_gpe_type); | 238 | ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) |
240 | 239 | ||
241 | /******************************************************************************* | 240 | /******************************************************************************* |
242 | * | 241 | * |
@@ -252,13 +251,12 @@ EXPORT_SYMBOL(acpi_set_gpe_type); | |||
252 | * DESCRIPTION: Enable an ACPI event (general purpose) | 251 | * DESCRIPTION: Enable an ACPI event (general purpose) |
253 | * | 252 | * |
254 | ******************************************************************************/ | 253 | ******************************************************************************/ |
255 | |||
256 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 254 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
257 | { | 255 | { |
258 | acpi_status status = AE_OK; | 256 | acpi_status status = AE_OK; |
259 | struct acpi_gpe_event_info *gpe_event_info; | 257 | struct acpi_gpe_event_info *gpe_event_info; |
260 | 258 | ||
261 | ACPI_FUNCTION_TRACE("acpi_enable_gpe"); | 259 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); |
262 | 260 | ||
263 | /* Use semaphore lock if not executing at interrupt level */ | 261 | /* Use semaphore lock if not executing at interrupt level */ |
264 | 262 | ||
@@ -288,7 +286,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
288 | return_ACPI_STATUS(status); | 286 | return_ACPI_STATUS(status); |
289 | } | 287 | } |
290 | 288 | ||
291 | EXPORT_SYMBOL(acpi_enable_gpe); | 289 | ACPI_EXPORT_SYMBOL(acpi_enable_gpe) |
292 | 290 | ||
293 | /******************************************************************************* | 291 | /******************************************************************************* |
294 | * | 292 | * |
@@ -304,13 +302,12 @@ EXPORT_SYMBOL(acpi_enable_gpe); | |||
304 | * DESCRIPTION: Disable an ACPI event (general purpose) | 302 | * DESCRIPTION: Disable an ACPI event (general purpose) |
305 | * | 303 | * |
306 | ******************************************************************************/ | 304 | ******************************************************************************/ |
307 | |||
308 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 305 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
309 | { | 306 | { |
310 | acpi_status status = AE_OK; | 307 | acpi_status status = AE_OK; |
311 | struct acpi_gpe_event_info *gpe_event_info; | 308 | struct acpi_gpe_event_info *gpe_event_info; |
312 | 309 | ||
313 | ACPI_FUNCTION_TRACE("acpi_disable_gpe"); | 310 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); |
314 | 311 | ||
315 | /* Use semaphore lock if not executing at interrupt level */ | 312 | /* Use semaphore lock if not executing at interrupt level */ |
316 | 313 | ||
@@ -338,6 +335,8 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
338 | return_ACPI_STATUS(status); | 335 | return_ACPI_STATUS(status); |
339 | } | 336 | } |
340 | 337 | ||
338 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) | ||
339 | |||
341 | /******************************************************************************* | 340 | /******************************************************************************* |
342 | * | 341 | * |
343 | * FUNCTION: acpi_disable_event | 342 | * FUNCTION: acpi_disable_event |
@@ -350,13 +349,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
350 | * DESCRIPTION: Disable an ACPI event (fixed) | 349 | * DESCRIPTION: Disable an ACPI event (fixed) |
351 | * | 350 | * |
352 | ******************************************************************************/ | 351 | ******************************************************************************/ |
353 | |||
354 | acpi_status acpi_disable_event(u32 event, u32 flags) | 352 | acpi_status acpi_disable_event(u32 event, u32 flags) |
355 | { | 353 | { |
356 | acpi_status status = AE_OK; | 354 | acpi_status status = AE_OK; |
357 | u32 value; | 355 | u32 value; |
358 | 356 | ||
359 | ACPI_FUNCTION_TRACE("acpi_disable_event"); | 357 | ACPI_FUNCTION_TRACE(acpi_disable_event); |
360 | 358 | ||
361 | /* Decode the Fixed Event */ | 359 | /* Decode the Fixed Event */ |
362 | 360 | ||
@@ -392,7 +390,7 @@ acpi_status acpi_disable_event(u32 event, u32 flags) | |||
392 | return_ACPI_STATUS(status); | 390 | return_ACPI_STATUS(status); |
393 | } | 391 | } |
394 | 392 | ||
395 | EXPORT_SYMBOL(acpi_disable_event); | 393 | ACPI_EXPORT_SYMBOL(acpi_disable_event) |
396 | 394 | ||
397 | /******************************************************************************* | 395 | /******************************************************************************* |
398 | * | 396 | * |
@@ -405,12 +403,11 @@ EXPORT_SYMBOL(acpi_disable_event); | |||
405 | * DESCRIPTION: Clear an ACPI event (fixed) | 403 | * DESCRIPTION: Clear an ACPI event (fixed) |
406 | * | 404 | * |
407 | ******************************************************************************/ | 405 | ******************************************************************************/ |
408 | |||
409 | acpi_status acpi_clear_event(u32 event) | 406 | acpi_status acpi_clear_event(u32 event) |
410 | { | 407 | { |
411 | acpi_status status = AE_OK; | 408 | acpi_status status = AE_OK; |
412 | 409 | ||
413 | ACPI_FUNCTION_TRACE("acpi_clear_event"); | 410 | ACPI_FUNCTION_TRACE(acpi_clear_event); |
414 | 411 | ||
415 | /* Decode the Fixed Event */ | 412 | /* Decode the Fixed Event */ |
416 | 413 | ||
@@ -429,7 +426,7 @@ acpi_status acpi_clear_event(u32 event) | |||
429 | return_ACPI_STATUS(status); | 426 | return_ACPI_STATUS(status); |
430 | } | 427 | } |
431 | 428 | ||
432 | EXPORT_SYMBOL(acpi_clear_event); | 429 | ACPI_EXPORT_SYMBOL(acpi_clear_event) |
433 | 430 | ||
434 | /******************************************************************************* | 431 | /******************************************************************************* |
435 | * | 432 | * |
@@ -444,13 +441,12 @@ EXPORT_SYMBOL(acpi_clear_event); | |||
444 | * DESCRIPTION: Clear an ACPI event (general purpose) | 441 | * DESCRIPTION: Clear an ACPI event (general purpose) |
445 | * | 442 | * |
446 | ******************************************************************************/ | 443 | ******************************************************************************/ |
447 | |||
448 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 444 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
449 | { | 445 | { |
450 | acpi_status status = AE_OK; | 446 | acpi_status status = AE_OK; |
451 | struct acpi_gpe_event_info *gpe_event_info; | 447 | struct acpi_gpe_event_info *gpe_event_info; |
452 | 448 | ||
453 | ACPI_FUNCTION_TRACE("acpi_clear_gpe"); | 449 | ACPI_FUNCTION_TRACE(acpi_clear_gpe); |
454 | 450 | ||
455 | /* Use semaphore lock if not executing at interrupt level */ | 451 | /* Use semaphore lock if not executing at interrupt level */ |
456 | 452 | ||
@@ -478,6 +474,8 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
478 | return_ACPI_STATUS(status); | 474 | return_ACPI_STATUS(status); |
479 | } | 475 | } |
480 | 476 | ||
477 | ACPI_EXPORT_SYMBOL(acpi_clear_gpe) | ||
478 | |||
481 | #ifdef ACPI_FUTURE_USAGE | 479 | #ifdef ACPI_FUTURE_USAGE |
482 | /******************************************************************************* | 480 | /******************************************************************************* |
483 | * | 481 | * |
@@ -492,12 +490,11 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
492 | * DESCRIPTION: Obtains and returns the current status of the event | 490 | * DESCRIPTION: Obtains and returns the current status of the event |
493 | * | 491 | * |
494 | ******************************************************************************/ | 492 | ******************************************************************************/ |
495 | |||
496 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | 493 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) |
497 | { | 494 | { |
498 | acpi_status status = AE_OK; | 495 | acpi_status status = AE_OK; |
499 | 496 | ||
500 | ACPI_FUNCTION_TRACE("acpi_get_event_status"); | 497 | ACPI_FUNCTION_TRACE(acpi_get_event_status); |
501 | 498 | ||
502 | if (!event_status) { | 499 | if (!event_status) { |
503 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 500 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -518,6 +515,8 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
518 | return_ACPI_STATUS(status); | 515 | return_ACPI_STATUS(status); |
519 | } | 516 | } |
520 | 517 | ||
518 | ACPI_EXPORT_SYMBOL(acpi_get_event_status) | ||
519 | |||
521 | /******************************************************************************* | 520 | /******************************************************************************* |
522 | * | 521 | * |
523 | * FUNCTION: acpi_get_gpe_status | 522 | * FUNCTION: acpi_get_gpe_status |
@@ -533,7 +532,6 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
533 | * DESCRIPTION: Get status of an event (general purpose) | 532 | * DESCRIPTION: Get status of an event (general purpose) |
534 | * | 533 | * |
535 | ******************************************************************************/ | 534 | ******************************************************************************/ |
536 | |||
537 | acpi_status | 535 | acpi_status |
538 | acpi_get_gpe_status(acpi_handle gpe_device, | 536 | acpi_get_gpe_status(acpi_handle gpe_device, |
539 | u32 gpe_number, u32 flags, acpi_event_status * event_status) | 537 | u32 gpe_number, u32 flags, acpi_event_status * event_status) |
@@ -541,7 +539,7 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
541 | acpi_status status = AE_OK; | 539 | acpi_status status = AE_OK; |
542 | struct acpi_gpe_event_info *gpe_event_info; | 540 | struct acpi_gpe_event_info *gpe_event_info; |
543 | 541 | ||
544 | ACPI_FUNCTION_TRACE("acpi_get_gpe_status"); | 542 | ACPI_FUNCTION_TRACE(acpi_get_gpe_status); |
545 | 543 | ||
546 | /* Use semaphore lock if not executing at interrupt level */ | 544 | /* Use semaphore lock if not executing at interrupt level */ |
547 | 545 | ||
@@ -570,6 +568,8 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
570 | } | 568 | } |
571 | return_ACPI_STATUS(status); | 569 | return_ACPI_STATUS(status); |
572 | } | 570 | } |
571 | |||
572 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) | ||
573 | #endif /* ACPI_FUTURE_USAGE */ | 573 | #endif /* ACPI_FUTURE_USAGE */ |
574 | 574 | ||
575 | /******************************************************************************* | 575 | /******************************************************************************* |
@@ -586,7 +586,6 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
586 | * DESCRIPTION: Create and Install a block of GPE registers | 586 | * DESCRIPTION: Create and Install a block of GPE registers |
587 | * | 587 | * |
588 | ******************************************************************************/ | 588 | ******************************************************************************/ |
589 | |||
590 | acpi_status | 589 | acpi_status |
591 | acpi_install_gpe_block(acpi_handle gpe_device, | 590 | acpi_install_gpe_block(acpi_handle gpe_device, |
592 | struct acpi_generic_address *gpe_block_address, | 591 | struct acpi_generic_address *gpe_block_address, |
@@ -597,7 +596,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
597 | struct acpi_namespace_node *node; | 596 | struct acpi_namespace_node *node; |
598 | struct acpi_gpe_block_info *gpe_block; | 597 | struct acpi_gpe_block_info *gpe_block; |
599 | 598 | ||
600 | ACPI_FUNCTION_TRACE("acpi_install_gpe_block"); | 599 | ACPI_FUNCTION_TRACE(acpi_install_gpe_block); |
601 | 600 | ||
602 | if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { | 601 | if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { |
603 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 602 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -636,6 +635,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
636 | 635 | ||
637 | obj_desc = acpi_ns_get_attached_object(node); | 636 | obj_desc = acpi_ns_get_attached_object(node); |
638 | if (!obj_desc) { | 637 | if (!obj_desc) { |
638 | |||
639 | /* No object, create a new one */ | 639 | /* No object, create a new one */ |
640 | 640 | ||
641 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); | 641 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); |
@@ -665,7 +665,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
665 | return_ACPI_STATUS(status); | 665 | return_ACPI_STATUS(status); |
666 | } | 666 | } |
667 | 667 | ||
668 | EXPORT_SYMBOL(acpi_install_gpe_block); | 668 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_block) |
669 | 669 | ||
670 | /******************************************************************************* | 670 | /******************************************************************************* |
671 | * | 671 | * |
@@ -678,14 +678,13 @@ EXPORT_SYMBOL(acpi_install_gpe_block); | |||
678 | * DESCRIPTION: Remove a previously installed block of GPE registers | 678 | * DESCRIPTION: Remove a previously installed block of GPE registers |
679 | * | 679 | * |
680 | ******************************************************************************/ | 680 | ******************************************************************************/ |
681 | |||
682 | acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | 681 | acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) |
683 | { | 682 | { |
684 | union acpi_operand_object *obj_desc; | 683 | union acpi_operand_object *obj_desc; |
685 | acpi_status status; | 684 | acpi_status status; |
686 | struct acpi_namespace_node *node; | 685 | struct acpi_namespace_node *node; |
687 | 686 | ||
688 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_block"); | 687 | ACPI_FUNCTION_TRACE(acpi_remove_gpe_block); |
689 | 688 | ||
690 | if (!gpe_device) { | 689 | if (!gpe_device) { |
691 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 690 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -721,4 +720,4 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | |||
721 | return_ACPI_STATUS(status); | 720 | return_ACPI_STATUS(status); |
722 | } | 721 | } |
723 | 722 | ||
724 | EXPORT_SYMBOL(acpi_remove_gpe_block); | 723 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) |
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index abf5caca9ae5..e8b86a0baad0 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acevents.h> | 47 | #include <acpi/acevents.h> |
@@ -75,7 +73,7 @@ acpi_install_address_space_handler(acpi_handle device, | |||
75 | struct acpi_namespace_node *node; | 73 | struct acpi_namespace_node *node; |
76 | acpi_status status; | 74 | acpi_status status; |
77 | 75 | ||
78 | ACPI_FUNCTION_TRACE("acpi_install_address_space_handler"); | 76 | ACPI_FUNCTION_TRACE(acpi_install_address_space_handler); |
79 | 77 | ||
80 | /* Parameter validation */ | 78 | /* Parameter validation */ |
81 | 79 | ||
@@ -114,7 +112,7 @@ acpi_install_address_space_handler(acpi_handle device, | |||
114 | return_ACPI_STATUS(status); | 112 | return_ACPI_STATUS(status); |
115 | } | 113 | } |
116 | 114 | ||
117 | EXPORT_SYMBOL(acpi_install_address_space_handler); | 115 | ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler) |
118 | 116 | ||
119 | /******************************************************************************* | 117 | /******************************************************************************* |
120 | * | 118 | * |
@@ -129,7 +127,6 @@ EXPORT_SYMBOL(acpi_install_address_space_handler); | |||
129 | * DESCRIPTION: Remove a previously installed handler. | 127 | * DESCRIPTION: Remove a previously installed handler. |
130 | * | 128 | * |
131 | ******************************************************************************/ | 129 | ******************************************************************************/ |
132 | |||
133 | acpi_status | 130 | acpi_status |
134 | acpi_remove_address_space_handler(acpi_handle device, | 131 | acpi_remove_address_space_handler(acpi_handle device, |
135 | acpi_adr_space_type space_id, | 132 | acpi_adr_space_type space_id, |
@@ -142,7 +139,7 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
142 | struct acpi_namespace_node *node; | 139 | struct acpi_namespace_node *node; |
143 | acpi_status status; | 140 | acpi_status status; |
144 | 141 | ||
145 | ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler"); | 142 | ACPI_FUNCTION_TRACE(acpi_remove_address_space_handler); |
146 | 143 | ||
147 | /* Parameter validation */ | 144 | /* Parameter validation */ |
148 | 145 | ||
@@ -176,9 +173,11 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
176 | handler_obj = obj_desc->device.handler; | 173 | handler_obj = obj_desc->device.handler; |
177 | last_obj_ptr = &obj_desc->device.handler; | 174 | last_obj_ptr = &obj_desc->device.handler; |
178 | while (handler_obj) { | 175 | while (handler_obj) { |
176 | |||
179 | /* We have a handler, see if user requested this one */ | 177 | /* We have a handler, see if user requested this one */ |
180 | 178 | ||
181 | if (handler_obj->address_space.space_id == space_id) { | 179 | if (handler_obj->address_space.space_id == space_id) { |
180 | |||
182 | /* Matched space_id, first dereference this in the Regions */ | 181 | /* Matched space_id, first dereference this in the Regions */ |
183 | 182 | ||
184 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 183 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
@@ -229,7 +228,7 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
229 | /* The handler does not exist */ | 228 | /* The handler does not exist */ |
230 | 229 | ||
231 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 230 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
232 | "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", | 231 | "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n", |
233 | handler, acpi_ut_get_region_name(space_id), space_id, | 232 | handler, acpi_ut_get_region_name(space_id), space_id, |
234 | node, obj_desc)); | 233 | node, obj_desc)); |
235 | 234 | ||
@@ -240,4 +239,4 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
240 | return_ACPI_STATUS(status); | 239 | return_ACPI_STATUS(status); |
241 | } | 240 | } |
242 | 241 | ||
243 | EXPORT_SYMBOL(acpi_remove_address_space_handler); | 242 | ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler) |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index a29782fe3ecf..823352435e08 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -82,7 +82,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
82 | struct acpi_table_desc table_info; | 82 | struct acpi_table_desc table_info; |
83 | union acpi_operand_object *obj_desc; | 83 | union acpi_operand_object *obj_desc; |
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE("ex_add_table"); | 85 | ACPI_FUNCTION_TRACE(ex_add_table); |
86 | 86 | ||
87 | /* Create an object to be the table handle */ | 87 | /* Create an object to be the table handle */ |
88 | 88 | ||
@@ -100,7 +100,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
100 | 100 | ||
101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); | 101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); |
102 | 102 | ||
103 | table_info.type = ACPI_TABLE_SSDT; | 103 | table_info.type = ACPI_TABLE_ID_SSDT; |
104 | table_info.pointer = table; | 104 | table_info.pointer = table; |
105 | table_info.length = (acpi_size) table->length; | 105 | table_info.length = (acpi_size) table->length; |
106 | table_info.allocation = ACPI_MEM_ALLOCATED; | 106 | table_info.allocation = ACPI_MEM_ALLOCATED; |
@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
110 | 110 | ||
111 | if (ACPI_FAILURE(status)) { | 111 | if (ACPI_FAILURE(status)) { |
112 | if (status == AE_ALREADY_EXISTS) { | 112 | if (status == AE_ALREADY_EXISTS) { |
113 | |||
113 | /* Table already exists, just return the handle */ | 114 | /* Table already exists, just return the handle */ |
114 | 115 | ||
115 | return_ACPI_STATUS(AE_OK); | 116 | return_ACPI_STATUS(AE_OK); |
@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
121 | 122 | ||
122 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); | 123 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); |
123 | if (ACPI_FAILURE(status)) { | 124 | if (ACPI_FAILURE(status)) { |
125 | |||
124 | /* Uninstall table on error */ | 126 | /* Uninstall table on error */ |
125 | 127 | ||
126 | (void)acpi_tb_uninstall_table(table_info.installed_desc); | 128 | (void)acpi_tb_uninstall_table(table_info.installed_desc); |
@@ -160,7 +162,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
160 | struct acpi_namespace_node *parameter_node = NULL; | 162 | struct acpi_namespace_node *parameter_node = NULL; |
161 | union acpi_operand_object *ddb_handle; | 163 | union acpi_operand_object *ddb_handle; |
162 | 164 | ||
163 | ACPI_FUNCTION_TRACE("ex_load_table_op"); | 165 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
164 | 166 | ||
165 | #if 0 | 167 | #if 0 |
166 | /* | 168 | /* |
@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
169 | */ | 171 | */ |
170 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); | 172 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); |
171 | if (status == AE_OK) { | 173 | if (status == AE_OK) { |
174 | |||
172 | /* Signature matched -- don't allow override */ | 175 | /* Signature matched -- don't allow override */ |
173 | 176 | ||
174 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 177 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
@@ -211,9 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
211 | * location within the namespace where the table will be loaded. | 214 | * location within the namespace where the table will be loaded. |
212 | */ | 215 | */ |
213 | status = | 216 | status = |
214 | acpi_ns_get_node_by_path(operand[3]->string.pointer, | 217 | acpi_ns_get_node(start_node, operand[3]->string.pointer, |
215 | start_node, ACPI_NS_SEARCH_PARENT, | 218 | ACPI_NS_SEARCH_PARENT, &parent_node); |
216 | &parent_node); | ||
217 | if (ACPI_FAILURE(status)) { | 219 | if (ACPI_FAILURE(status)) { |
218 | return_ACPI_STATUS(status); | 220 | return_ACPI_STATUS(status); |
219 | } | 221 | } |
@@ -234,9 +236,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
234 | /* Find the node referenced by the parameter_path_string */ | 236 | /* Find the node referenced by the parameter_path_string */ |
235 | 237 | ||
236 | status = | 238 | status = |
237 | acpi_ns_get_node_by_path(operand[4]->string.pointer, | 239 | acpi_ns_get_node(start_node, operand[4]->string.pointer, |
238 | start_node, ACPI_NS_SEARCH_PARENT, | 240 | ACPI_NS_SEARCH_PARENT, ¶meter_node); |
239 | ¶meter_node); | ||
240 | if (ACPI_FAILURE(status)) { | 241 | if (ACPI_FAILURE(status)) { |
241 | return_ACPI_STATUS(status); | 242 | return_ACPI_STATUS(status); |
242 | } | 243 | } |
@@ -252,6 +253,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
252 | /* Parameter Data (optional) */ | 253 | /* Parameter Data (optional) */ |
253 | 254 | ||
254 | if (parameter_node) { | 255 | if (parameter_node) { |
256 | |||
255 | /* Store the parameter data into the optional parameter object */ | 257 | /* Store the parameter data into the optional parameter object */ |
256 | 258 | ||
257 | status = acpi_ex_store(operand[5], | 259 | status = acpi_ex_store(operand[5], |
@@ -294,9 +296,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
294 | struct acpi_table_header *table_ptr = NULL; | 296 | struct acpi_table_header *table_ptr = NULL; |
295 | acpi_physical_address address; | 297 | acpi_physical_address address; |
296 | struct acpi_table_header table_header; | 298 | struct acpi_table_header table_header; |
299 | acpi_integer temp; | ||
297 | u32 i; | 300 | u32 i; |
298 | 301 | ||
299 | ACPI_FUNCTION_TRACE("ex_load_op"); | 302 | ACPI_FUNCTION_TRACE(ex_load_op); |
300 | 303 | ||
301 | /* Object can be either an op_region or a Field */ | 304 | /* Object can be either an op_region or a Field */ |
302 | 305 | ||
@@ -322,7 +325,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
322 | 325 | ||
323 | address = obj_desc->region.address; | 326 | address = obj_desc->region.address; |
324 | 327 | ||
325 | /* Get the table length from the table header */ | 328 | /* Get part of the table header to get the table length */ |
326 | 329 | ||
327 | table_header.length = 0; | 330 | table_header.length = 0; |
328 | for (i = 0; i < 8; i++) { | 331 | for (i = 0; i < 8; i++) { |
@@ -330,11 +333,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
330 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | 333 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
331 | (acpi_physical_address) | 334 | (acpi_physical_address) |
332 | (i + address), 8, | 335 | (i + address), 8, |
333 | ((u8 *) & | 336 | &temp); |
334 | table_header) + i); | ||
335 | if (ACPI_FAILURE(status)) { | 337 | if (ACPI_FAILURE(status)) { |
336 | return_ACPI_STATUS(status); | 338 | return_ACPI_STATUS(status); |
337 | } | 339 | } |
340 | |||
341 | /* Get the one valid byte of the returned 64-bit value */ | ||
342 | |||
343 | ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp; | ||
338 | } | 344 | } |
339 | 345 | ||
340 | /* Sanity check the table length */ | 346 | /* Sanity check the table length */ |
@@ -345,7 +351,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
345 | 351 | ||
346 | /* Allocate a buffer for the entire table */ | 352 | /* Allocate a buffer for the entire table */ |
347 | 353 | ||
348 | table_ptr = ACPI_MEM_ALLOCATE(table_header.length); | 354 | table_ptr = ACPI_ALLOCATE(table_header.length); |
349 | if (!table_ptr) { | 355 | if (!table_ptr) { |
350 | return_ACPI_STATUS(AE_NO_MEMORY); | 356 | return_ACPI_STATUS(AE_NO_MEMORY); |
351 | } | 357 | } |
@@ -357,11 +363,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
357 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | 363 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
358 | (acpi_physical_address) | 364 | (acpi_physical_address) |
359 | (i + address), 8, | 365 | (i + address), 8, |
360 | ((u8 *) table_ptr + | 366 | &temp); |
361 | i)); | ||
362 | if (ACPI_FAILURE(status)) { | 367 | if (ACPI_FAILURE(status)) { |
363 | goto cleanup; | 368 | goto cleanup; |
364 | } | 369 | } |
370 | |||
371 | /* Get the one valid byte of the returned 64-bit value */ | ||
372 | |||
373 | ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp; | ||
365 | } | 374 | } |
366 | break; | 375 | break; |
367 | 376 | ||
@@ -407,12 +416,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
407 | 416 | ||
408 | /* The table must be either an SSDT or a PSDT */ | 417 | /* The table must be either an SSDT or a PSDT */ |
409 | 418 | ||
410 | if ((!ACPI_STRNCMP(table_ptr->signature, | 419 | if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) && |
411 | acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, | 420 | (!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) { |
412 | acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && | ||
413 | (!ACPI_STRNCMP(table_ptr->signature, | ||
414 | acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, | ||
415 | acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { | ||
416 | ACPI_ERROR((AE_INFO, | 421 | ACPI_ERROR((AE_INFO, |
417 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", | 422 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", |
418 | table_ptr->signature)); | 423 | table_ptr->signature)); |
@@ -424,6 +429,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
424 | 429 | ||
425 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); | 430 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); |
426 | if (ACPI_FAILURE(status)) { | 431 | if (ACPI_FAILURE(status)) { |
432 | |||
427 | /* On error, table_ptr was deallocated above */ | 433 | /* On error, table_ptr was deallocated above */ |
428 | 434 | ||
429 | return_ACPI_STATUS(status); | 435 | return_ACPI_STATUS(status); |
@@ -442,7 +448,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
442 | 448 | ||
443 | cleanup: | 449 | cleanup: |
444 | if (ACPI_FAILURE(status)) { | 450 | if (ACPI_FAILURE(status)) { |
445 | ACPI_MEM_FREE(table_ptr); | 451 | ACPI_FREE(table_ptr); |
446 | } | 452 | } |
447 | return_ACPI_STATUS(status); | 453 | return_ACPI_STATUS(status); |
448 | } | 454 | } |
@@ -465,7 +471,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
465 | union acpi_operand_object *table_desc = ddb_handle; | 471 | union acpi_operand_object *table_desc = ddb_handle; |
466 | struct acpi_table_desc *table_info; | 472 | struct acpi_table_desc *table_info; |
467 | 473 | ||
468 | ACPI_FUNCTION_TRACE("ex_unload_table"); | 474 | ACPI_FUNCTION_TRACE(ex_unload_table); |
469 | 475 | ||
470 | /* | 476 | /* |
471 | * Validate the handle | 477 | * Validate the handle |
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index e6d52e12d77a..b732e399b1ef 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -79,7 +79,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
79 | u32 count; | 79 | u32 count; |
80 | acpi_status status; | 80 | acpi_status status; |
81 | 81 | ||
82 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc); | 82 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc); |
83 | 83 | ||
84 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 84 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
85 | case ACPI_TYPE_INTEGER: | 85 | case ACPI_TYPE_INTEGER: |
@@ -199,7 +199,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, | |||
199 | union acpi_operand_object *return_desc; | 199 | union acpi_operand_object *return_desc; |
200 | u8 *new_buf; | 200 | u8 *new_buf; |
201 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc); | 202 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc); |
203 | 203 | ||
204 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 204 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
205 | case ACPI_TYPE_BUFFER: | 205 | case ACPI_TYPE_BUFFER: |
@@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
319 | remainder = 0; | 319 | remainder = 0; |
320 | 320 | ||
321 | for (i = decimal_length; i > 0; i--) { | 321 | for (i = decimal_length; i > 0; i--) { |
322 | |||
322 | /* Divide by nth factor of 10 */ | 323 | /* Divide by nth factor of 10 */ |
323 | 324 | ||
324 | digit = integer; | 325 | digit = integer; |
@@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
346 | 347 | ||
347 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); | 348 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); |
348 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { | 349 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { |
350 | |||
349 | /* Get one hex digit, most significant digits first */ | 351 | /* Get one hex digit, most significant digits first */ |
350 | 352 | ||
351 | string[k] = | 353 | string[k] = |
@@ -400,7 +402,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
400 | u16 base = 16; | 402 | u16 base = 16; |
401 | u8 separator = ','; | 403 | u8 separator = ','; |
402 | 404 | ||
403 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc); | 405 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc); |
404 | 406 | ||
405 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 407 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
406 | case ACPI_TYPE_STRING: | 408 | case ACPI_TYPE_STRING: |
@@ -567,7 +569,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
567 | { | 569 | { |
568 | acpi_status status = AE_OK; | 570 | acpi_status status = AE_OK; |
569 | 571 | ||
570 | ACPI_FUNCTION_TRACE("ex_convert_to_target_type"); | 572 | ACPI_FUNCTION_TRACE(ex_convert_to_target_type); |
571 | 573 | ||
572 | /* Default behavior */ | 574 | /* Default behavior */ |
573 | 575 | ||
@@ -657,7 +659,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
657 | 659 | ||
658 | default: | 660 | default: |
659 | ACPI_ERROR((AE_INFO, | 661 | ACPI_ERROR((AE_INFO, |
660 | "Unknown Target type ID 0x%X aml_opcode %X dest_type %s", | 662 | "Unknown Target type ID 0x%X AmlOpcode %X DestType %s", |
661 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> | 663 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> |
662 | runtime_args), | 664 | runtime_args), |
663 | walk_state->opcode, | 665 | walk_state->opcode, |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 680575402835..106dc7219df7 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -69,7 +69,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
69 | struct acpi_namespace_node *alias_node; | 69 | struct acpi_namespace_node *alias_node; |
70 | acpi_status status = AE_OK; | 70 | acpi_status status = AE_OK; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ex_create_alias"); | 72 | ACPI_FUNCTION_TRACE(ex_create_alias); |
73 | 73 | ||
74 | /* Get the source/alias operands (both namespace nodes) */ | 74 | /* Get the source/alias operands (both namespace nodes) */ |
75 | 75 | ||
@@ -164,7 +164,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) | |||
164 | acpi_status status; | 164 | acpi_status status; |
165 | union acpi_operand_object *obj_desc; | 165 | union acpi_operand_object *obj_desc; |
166 | 166 | ||
167 | ACPI_FUNCTION_TRACE("ex_create_event"); | 167 | ACPI_FUNCTION_TRACE(ex_create_event); |
168 | 168 | ||
169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); | 169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); |
170 | if (!obj_desc) { | 170 | if (!obj_desc) { |
@@ -216,7 +216,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) | |||
216 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
217 | union acpi_operand_object *obj_desc; | 217 | union acpi_operand_object *obj_desc; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS); | 219 | ACPI_FUNCTION_TRACE_PTR(ex_create_mutex, ACPI_WALK_OPERANDS); |
220 | 220 | ||
221 | /* Create the new mutex object */ | 221 | /* Create the new mutex object */ |
222 | 222 | ||
@@ -243,8 +243,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) | |||
243 | obj_desc->mutex.node = | 243 | obj_desc->mutex.node = |
244 | (struct acpi_namespace_node *)walk_state->operands[0]; | 244 | (struct acpi_namespace_node *)walk_state->operands[0]; |
245 | 245 | ||
246 | status = acpi_ns_attach_object(obj_desc->mutex.node, | 246 | status = |
247 | obj_desc, ACPI_TYPE_MUTEX); | 247 | acpi_ns_attach_object(obj_desc->mutex.node, obj_desc, |
248 | ACPI_TYPE_MUTEX); | ||
248 | 249 | ||
249 | cleanup: | 250 | cleanup: |
250 | /* | 251 | /* |
@@ -280,7 +281,7 @@ acpi_ex_create_region(u8 * aml_start, | |||
280 | struct acpi_namespace_node *node; | 281 | struct acpi_namespace_node *node; |
281 | union acpi_operand_object *region_obj2; | 282 | union acpi_operand_object *region_obj2; |
282 | 283 | ||
283 | ACPI_FUNCTION_TRACE("ex_create_region"); | 284 | ACPI_FUNCTION_TRACE(ex_create_region); |
284 | 285 | ||
285 | /* Get the Namespace Node */ | 286 | /* Get the Namespace Node */ |
286 | 287 | ||
@@ -300,7 +301,7 @@ acpi_ex_create_region(u8 * aml_start, | |||
300 | */ | 301 | */ |
301 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && | 302 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && |
302 | (region_space < ACPI_USER_REGION_BEGIN)) { | 303 | (region_space < ACPI_USER_REGION_BEGIN)) { |
303 | ACPI_ERROR((AE_INFO, "Invalid address_space type %X", | 304 | ACPI_ERROR((AE_INFO, "Invalid AddressSpace type %X", |
304 | region_space)); | 305 | region_space)); |
305 | return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); | 306 | return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); |
306 | } | 307 | } |
@@ -364,7 +365,7 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) | |||
364 | struct acpi_table_header *table; | 365 | struct acpi_table_header *table; |
365 | union acpi_operand_object *region_obj2; | 366 | union acpi_operand_object *region_obj2; |
366 | 367 | ||
367 | ACPI_FUNCTION_TRACE("ex_create_table_region"); | 368 | ACPI_FUNCTION_TRACE(ex_create_table_region); |
368 | 369 | ||
369 | /* Get the Node from the object stack */ | 370 | /* Get the Node from the object stack */ |
370 | 371 | ||
@@ -452,7 +453,7 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) | |||
452 | union acpi_operand_object *obj_desc; | 453 | union acpi_operand_object *obj_desc; |
453 | acpi_status status; | 454 | acpi_status status; |
454 | 455 | ||
455 | ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state); | 456 | ACPI_FUNCTION_TRACE_PTR(ex_create_processor, walk_state); |
456 | 457 | ||
457 | /* Create the processor object */ | 458 | /* Create the processor object */ |
458 | 459 | ||
@@ -464,9 +465,9 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) | |||
464 | /* Initialize the processor object from the operands */ | 465 | /* Initialize the processor object from the operands */ |
465 | 466 | ||
466 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; | 467 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; |
468 | obj_desc->processor.length = (u8) operand[3]->integer.value; | ||
467 | obj_desc->processor.address = | 469 | obj_desc->processor.address = |
468 | (acpi_io_address) operand[2]->integer.value; | 470 | (acpi_io_address) operand[2]->integer.value; |
469 | obj_desc->processor.length = (u8) operand[3]->integer.value; | ||
470 | 471 | ||
471 | /* Install the processor object in the parent Node */ | 472 | /* Install the processor object in the parent Node */ |
472 | 473 | ||
@@ -499,7 +500,7 @@ acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state) | |||
499 | acpi_status status; | 500 | acpi_status status; |
500 | union acpi_operand_object *obj_desc; | 501 | union acpi_operand_object *obj_desc; |
501 | 502 | ||
502 | ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state); | 503 | ACPI_FUNCTION_TRACE_PTR(ex_create_power_resource, walk_state); |
503 | 504 | ||
504 | /* Create the power resource object */ | 505 | /* Create the power resource object */ |
505 | 506 | ||
@@ -549,7 +550,7 @@ acpi_ex_create_method(u8 * aml_start, | |||
549 | acpi_status status; | 550 | acpi_status status; |
550 | u8 method_flags; | 551 | u8 method_flags; |
551 | 552 | ||
552 | ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state); | 553 | ACPI_FUNCTION_TRACE_PTR(ex_create_method, walk_state); |
553 | 554 | ||
554 | /* Create a new method object */ | 555 | /* Create a new method object */ |
555 | 556 | ||
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index a7cca8d4f855..7b9718e976bf 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -61,6 +61,10 @@ static void acpi_ex_out_pointer(char *title, void *value); | |||
61 | 61 | ||
62 | static void acpi_ex_out_address(char *title, acpi_physical_address value); | 62 | static void acpi_ex_out_address(char *title, acpi_physical_address value); |
63 | 63 | ||
64 | static void | ||
65 | acpi_ex_dump_object(union acpi_operand_object *obj_desc, | ||
66 | struct acpi_exdump_info *info); | ||
67 | |||
64 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); | 68 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); |
65 | 69 | ||
66 | static void | 70 | static void |
@@ -119,7 +123,7 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = { | |||
119 | 123 | ||
120 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { | 124 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { |
121 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, | 125 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, |
122 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, | 126 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"}, |
123 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, | 127 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, |
124 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, | 128 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, |
125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, | 129 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, |
@@ -263,12 +267,10 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { | |||
263 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} | 267 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} |
264 | }; | 268 | }; |
265 | 269 | ||
266 | static struct acpi_exdump_info acpi_ex_dump_node[6] = { | 270 | static struct acpi_exdump_info acpi_ex_dump_node[5] = { |
267 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, | 271 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, |
268 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, | 272 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, |
269 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, | 273 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, |
270 | {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count), | ||
271 | "Reference Count"}, | ||
272 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, | 274 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, |
273 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} | 275 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} |
274 | }; | 276 | }; |
@@ -330,7 +332,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
330 | 332 | ||
331 | if (!info) { | 333 | if (!info) { |
332 | acpi_os_printf | 334 | acpi_os_printf |
333 | ("ex_dump_object: Display not implemented for object type %s\n", | 335 | ("ExDumpObject: Display not implemented for object type %s\n", |
334 | acpi_ut_get_object_type_name(obj_desc)); | 336 | acpi_ut_get_object_type_name(obj_desc)); |
335 | return; | 337 | return; |
336 | } | 338 | } |
@@ -454,7 +456,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
454 | u32 length; | 456 | u32 length; |
455 | u32 index; | 457 | u32 index; |
456 | 458 | ||
457 | ACPI_FUNCTION_NAME("ex_dump_operand") | 459 | ACPI_FUNCTION_NAME(ex_dump_operand) |
458 | 460 | ||
459 | if (! | 461 | if (! |
460 | ((ACPI_LV_EXEC & acpi_dbg_level) | 462 | ((ACPI_LV_EXEC & acpi_dbg_level) |
@@ -463,6 +465,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
463 | } | 465 | } |
464 | 466 | ||
465 | if (!obj_desc) { | 467 | if (!obj_desc) { |
468 | |||
466 | /* This could be a null element of a package */ | 469 | /* This could be a null element of a package */ |
467 | 470 | ||
468 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); | 471 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); |
@@ -522,7 +525,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
522 | 525 | ||
523 | case AML_REF_OF_OP: | 526 | case AML_REF_OF_OP: |
524 | 527 | ||
525 | acpi_os_printf("Reference: (ref_of) %p\n", | 528 | acpi_os_printf("Reference: (RefOf) %p\n", |
526 | obj_desc->reference.object); | 529 | obj_desc->reference.object); |
527 | break; | 530 | break; |
528 | 531 | ||
@@ -532,6 +535,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
532 | obj_desc->reference.offset); | 535 | obj_desc->reference.offset); |
533 | 536 | ||
534 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 537 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
538 | |||
535 | /* Value is an Integer */ | 539 | /* Value is an Integer */ |
536 | 540 | ||
537 | acpi_os_printf(" value is [%8.8X%8.8x]", | 541 | acpi_os_printf(" value is [%8.8X%8.8x]", |
@@ -610,7 +614,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
610 | 614 | ||
611 | case ACPI_TYPE_PACKAGE: | 615 | case ACPI_TYPE_PACKAGE: |
612 | 616 | ||
613 | acpi_os_printf("Package [Len %X] element_array %p\n", | 617 | acpi_os_printf("Package [Len %X] ElementArray %p\n", |
614 | obj_desc->package.count, | 618 | obj_desc->package.count, |
615 | obj_desc->package.elements); | 619 | obj_desc->package.elements); |
616 | 620 | ||
@@ -662,13 +666,13 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
662 | 666 | ||
663 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 667 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
664 | 668 | ||
665 | acpi_os_printf("bank_field\n"); | 669 | acpi_os_printf("BankField\n"); |
666 | break; | 670 | break; |
667 | 671 | ||
668 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 672 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
669 | 673 | ||
670 | acpi_os_printf | 674 | acpi_os_printf |
671 | ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", | 675 | ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", |
672 | obj_desc->field.bit_length, | 676 | obj_desc->field.bit_length, |
673 | obj_desc->field.access_byte_width, | 677 | obj_desc->field.access_byte_width, |
674 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, | 678 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, |
@@ -681,12 +685,12 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
681 | 685 | ||
682 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 686 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
683 | 687 | ||
684 | acpi_os_printf("index_field\n"); | 688 | acpi_os_printf("IndexField\n"); |
685 | break; | 689 | break; |
686 | 690 | ||
687 | case ACPI_TYPE_BUFFER_FIELD: | 691 | case ACPI_TYPE_BUFFER_FIELD: |
688 | 692 | ||
689 | acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n", | 693 | acpi_os_printf("BufferField: %X bits at byte %X bit %X of\n", |
690 | obj_desc->buffer_field.bit_length, | 694 | obj_desc->buffer_field.bit_length, |
691 | obj_desc->buffer_field.base_byte_offset, | 695 | obj_desc->buffer_field.base_byte_offset, |
692 | obj_desc->buffer_field.start_field_bit_offset); | 696 | obj_desc->buffer_field.start_field_bit_offset); |
@@ -777,7 +781,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, | |||
777 | { | 781 | { |
778 | acpi_native_uint i; | 782 | acpi_native_uint i; |
779 | 783 | ||
780 | ACPI_FUNCTION_NAME("ex_dump_operands"); | 784 | ACPI_FUNCTION_NAME(ex_dump_operands); |
781 | 785 | ||
782 | if (!ident) { | 786 | if (!ident) { |
783 | ident = "?"; | 787 | ident = "?"; |
@@ -901,7 +905,7 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) | |||
901 | acpi_os_printf("Could not convert name to pathname\n"); | 905 | acpi_os_printf("Could not convert name to pathname\n"); |
902 | } else { | 906 | } else { |
903 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); | 907 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); |
904 | ACPI_MEM_FREE(ret_buf.pointer); | 908 | ACPI_FREE(ret_buf.pointer); |
905 | } | 909 | } |
906 | } else if (obj_desc->reference.object) { | 910 | } else if (obj_desc->reference.object) { |
907 | acpi_os_printf("\nReferenced Object: %p\n", | 911 | acpi_os_printf("\nReferenced Object: %p\n", |
@@ -1017,7 +1021,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, | |||
1017 | void | 1021 | void |
1018 | acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | 1022 | acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) |
1019 | { | 1023 | { |
1020 | ACPI_FUNCTION_TRACE("ex_dump_object_descriptor"); | 1024 | ACPI_FUNCTION_TRACE(ex_dump_object_descriptor); |
1021 | 1025 | ||
1022 | if (!obj_desc) { | 1026 | if (!obj_desc) { |
1023 | return_VOID; | 1027 | return_VOID; |
@@ -1046,7 +1050,7 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
1046 | 1050 | ||
1047 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 1051 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
1048 | acpi_os_printf | 1052 | acpi_os_printf |
1049 | ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", | 1053 | ("ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", |
1050 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); | 1054 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); |
1051 | return_VOID; | 1055 | return_VOID; |
1052 | } | 1056 | } |
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index e259201ce9a0..9ea9c3a67ca9 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c | |||
@@ -73,7 +73,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
73 | void *buffer; | 73 | void *buffer; |
74 | u8 locked; | 74 | u8 locked; |
75 | 75 | ||
76 | ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc); | 76 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); |
77 | 77 | ||
78 | /* Parameter validation */ | 78 | /* Parameter validation */ |
79 | 79 | ||
@@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
142 | length = | 142 | length = |
143 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); | 143 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); |
144 | if (length > acpi_gbl_integer_byte_width) { | 144 | if (length > acpi_gbl_integer_byte_width) { |
145 | |||
145 | /* Field is too large for an Integer, create a Buffer instead */ | 146 | /* Field is too large for an Integer, create a Buffer instead */ |
146 | 147 | ||
147 | buffer_desc = acpi_ut_create_buffer_object(length); | 148 | buffer_desc = acpi_ut_create_buffer_object(length); |
@@ -163,11 +164,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
163 | } | 164 | } |
164 | 165 | ||
165 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 166 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
166 | "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", | 167 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", |
167 | obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, | 168 | obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, |
168 | (u32) length)); | 169 | (u32) length)); |
169 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 170 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
170 | "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", | 171 | "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", |
171 | obj_desc->common_field.bit_length, | 172 | obj_desc->common_field.bit_length, |
172 | obj_desc->common_field.start_field_bit_offset, | 173 | obj_desc->common_field.start_field_bit_offset, |
173 | obj_desc->common_field.base_byte_offset)); | 174 | obj_desc->common_field.base_byte_offset)); |
@@ -219,7 +220,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
219 | u8 locked; | 220 | u8 locked; |
220 | union acpi_operand_object *buffer_desc; | 221 | union acpi_operand_object *buffer_desc; |
221 | 222 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc); | 223 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); |
223 | 224 | ||
224 | /* Parameter validation */ | 225 | /* Parameter validation */ |
225 | 226 | ||
@@ -329,9 +330,10 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
329 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); | 330 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); |
330 | 331 | ||
331 | if (length < required_length) { | 332 | if (length < required_length) { |
333 | |||
332 | /* We need to create a new buffer */ | 334 | /* We need to create a new buffer */ |
333 | 335 | ||
334 | new_buffer = ACPI_MEM_CALLOCATE(required_length); | 336 | new_buffer = ACPI_ALLOCATE_ZEROED(required_length); |
335 | if (!new_buffer) { | 337 | if (!new_buffer) { |
336 | return_ACPI_STATUS(AE_NO_MEMORY); | 338 | return_ACPI_STATUS(AE_NO_MEMORY); |
337 | } | 339 | } |
@@ -347,14 +349,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
347 | } | 349 | } |
348 | 350 | ||
349 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 351 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
350 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", | 352 | "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", |
351 | source_desc, | 353 | source_desc, |
352 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE | 354 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE |
353 | (source_desc)), | 355 | (source_desc)), |
354 | ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); | 356 | ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); |
355 | 357 | ||
356 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 358 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
357 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", | 359 | "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", |
358 | obj_desc, | 360 | obj_desc, |
359 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), | 361 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), |
360 | ACPI_GET_OBJECT_TYPE(obj_desc), | 362 | ACPI_GET_OBJECT_TYPE(obj_desc), |
@@ -375,7 +377,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
375 | /* Free temporary buffer if we used one */ | 377 | /* Free temporary buffer if we used one */ |
376 | 378 | ||
377 | if (new_buffer) { | 379 | if (new_buffer) { |
378 | ACPI_MEM_FREE(new_buffer); | 380 | ACPI_FREE(new_buffer); |
379 | } | 381 | } |
380 | 382 | ||
381 | return_ACPI_STATUS(status); | 383 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index bd1af35f7fcf..051053f7cccb 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -87,7 +87,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
87 | acpi_status status = AE_OK; | 87 | acpi_status status = AE_OK; |
88 | union acpi_operand_object *rgn_desc; | 88 | union acpi_operand_object *rgn_desc; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset); | 90 | ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset); |
91 | 91 | ||
92 | rgn_desc = obj_desc->common_field.region_obj; | 92 | rgn_desc = obj_desc->common_field.region_obj; |
93 | 93 | ||
@@ -112,7 +112,18 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /* Exit if Address/Length have been disallowed by the host OS */ | ||
116 | |||
117 | if (rgn_desc->common.flags & AOPOBJ_INVALID) { | ||
118 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * Exit now for SMBus address space, it has a non-linear address space | ||
123 | * and the request cannot be directly validated | ||
124 | */ | ||
115 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { | 125 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { |
126 | |||
116 | /* SMBus has a non-linear address space */ | 127 | /* SMBus has a non-linear address space */ |
117 | 128 | ||
118 | return_ACPI_STATUS(AE_OK); | 129 | return_ACPI_STATUS(AE_OK); |
@@ -134,10 +145,10 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
134 | * length of one field datum (access width) must fit within the region. | 145 | * length of one field datum (access width) must fit within the region. |
135 | * (Region length is specified in bytes) | 146 | * (Region length is specified in bytes) |
136 | */ | 147 | */ |
137 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + | 148 | if (rgn_desc->region.length < |
138 | field_datum_byte_offset + | 149 | (obj_desc->common_field.base_byte_offset + |
139 | obj_desc->common_field. | 150 | field_datum_byte_offset + |
140 | access_byte_width)) { | 151 | obj_desc->common_field.access_byte_width)) { |
141 | if (acpi_gbl_enable_interpreter_slack) { | 152 | if (acpi_gbl_enable_interpreter_slack) { |
142 | /* | 153 | /* |
143 | * Slack mode only: We will go ahead and allow access to this | 154 | * Slack mode only: We will go ahead and allow access to this |
@@ -217,7 +228,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
217 | union acpi_operand_object *rgn_desc; | 228 | union acpi_operand_object *rgn_desc; |
218 | acpi_physical_address address; | 229 | acpi_physical_address address; |
219 | 230 | ||
220 | ACPI_FUNCTION_TRACE("ex_access_region"); | 231 | ACPI_FUNCTION_TRACE(ex_access_region); |
221 | 232 | ||
222 | /* | 233 | /* |
223 | * Ensure that the region operands are fully evaluated and verify | 234 | * Ensure that the region operands are fully evaluated and verify |
@@ -246,7 +257,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
246 | } | 257 | } |
247 | 258 | ||
248 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, | 259 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, |
249 | " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", | 260 | " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", |
250 | acpi_ut_get_region_name(rgn_desc->region. | 261 | acpi_ut_get_region_name(rgn_desc->region. |
251 | space_id), | 262 | space_id), |
252 | rgn_desc->region.space_id, | 263 | rgn_desc->region.space_id, |
@@ -352,7 +363,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
352 | acpi_status status; | 363 | acpi_status status; |
353 | acpi_integer local_value; | 364 | acpi_integer local_value; |
354 | 365 | ||
355 | ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset); | 366 | ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); |
356 | 367 | ||
357 | if (read_write == ACPI_READ) { | 368 | if (read_write == ACPI_READ) { |
358 | if (!value) { | 369 | if (!value) { |
@@ -487,10 +498,11 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
487 | } | 498 | } |
488 | 499 | ||
489 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 500 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
490 | "I/O to Data Register: value_ptr %p\n", | 501 | "I/O to Data Register: ValuePtr %p\n", |
491 | value)); | 502 | value)); |
492 | 503 | ||
493 | if (read_write == ACPI_READ) { | 504 | if (read_write == ACPI_READ) { |
505 | |||
494 | /* Read the datum from the data_register */ | 506 | /* Read the datum from the data_register */ |
495 | 507 | ||
496 | status = | 508 | status = |
@@ -559,7 +571,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
559 | acpi_integer merged_value; | 571 | acpi_integer merged_value; |
560 | acpi_integer current_value; | 572 | acpi_integer current_value; |
561 | 573 | ||
562 | ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask); | 574 | ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); |
563 | 575 | ||
564 | /* Start with the new bits */ | 576 | /* Start with the new bits */ |
565 | 577 | ||
@@ -568,6 +580,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
568 | /* If the mask is all ones, we don't need to worry about the update rule */ | 580 | /* If the mask is all ones, we don't need to worry about the update rule */ |
569 | 581 | ||
570 | if (mask != ACPI_INTEGER_MAX) { | 582 | if (mask != ACPI_INTEGER_MAX) { |
583 | |||
571 | /* Decode the update rule */ | 584 | /* Decode the update rule */ |
572 | 585 | ||
573 | switch (obj_desc->common_field. | 586 | switch (obj_desc->common_field. |
@@ -614,7 +627,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
614 | default: | 627 | default: |
615 | 628 | ||
616 | ACPI_ERROR((AE_INFO, | 629 | ACPI_ERROR((AE_INFO, |
617 | "Unknown update_rule value: %X", | 630 | "Unknown UpdateRule value: %X", |
618 | (obj_desc->common_field. | 631 | (obj_desc->common_field. |
619 | field_flags & | 632 | field_flags & |
620 | AML_FIELD_UPDATE_RULE_MASK))); | 633 | AML_FIELD_UPDATE_RULE_MASK))); |
@@ -623,7 +636,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
623 | } | 636 | } |
624 | 637 | ||
625 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 638 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
626 | "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", | 639 | "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", |
627 | ACPI_FORMAT_UINT64(mask), | 640 | ACPI_FORMAT_UINT64(mask), |
628 | field_datum_byte_offset, | 641 | field_datum_byte_offset, |
629 | obj_desc->common_field.access_byte_width, | 642 | obj_desc->common_field.access_byte_width, |
@@ -666,7 +679,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
666 | u32 field_datum_count; | 679 | u32 field_datum_count; |
667 | u32 i; | 680 | u32 i; |
668 | 681 | ||
669 | ACPI_FUNCTION_TRACE("ex_extract_from_field"); | 682 | ACPI_FUNCTION_TRACE(ex_extract_from_field); |
670 | 683 | ||
671 | /* Validate target buffer and clear it */ | 684 | /* Validate target buffer and clear it */ |
672 | 685 | ||
@@ -704,6 +717,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
704 | /* Read the rest of the field */ | 717 | /* Read the rest of the field */ |
705 | 718 | ||
706 | for (i = 1; i < field_datum_count; i++) { | 719 | for (i = 1; i < field_datum_count; i++) { |
720 | |||
707 | /* Get next input datum from the field */ | 721 | /* Get next input datum from the field */ |
708 | 722 | ||
709 | field_offset += obj_desc->common_field.access_byte_width; | 723 | field_offset += obj_desc->common_field.access_byte_width; |
@@ -771,6 +785,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
771 | { | 785 | { |
772 | acpi_status status; | 786 | acpi_status status; |
773 | acpi_integer mask; | 787 | acpi_integer mask; |
788 | acpi_integer width_mask; | ||
774 | acpi_integer merged_datum; | 789 | acpi_integer merged_datum; |
775 | acpi_integer raw_datum = 0; | 790 | acpi_integer raw_datum = 0; |
776 | u32 field_offset = 0; | 791 | u32 field_offset = 0; |
@@ -780,7 +795,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
780 | u32 field_datum_count; | 795 | u32 field_datum_count; |
781 | u32 i; | 796 | u32 i; |
782 | 797 | ||
783 | ACPI_FUNCTION_TRACE("ex_insert_into_field"); | 798 | ACPI_FUNCTION_TRACE(ex_insert_into_field); |
784 | 799 | ||
785 | /* Validate input buffer */ | 800 | /* Validate input buffer */ |
786 | 801 | ||
@@ -795,15 +810,20 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
795 | 810 | ||
796 | /* Compute the number of datums (access width data items) */ | 811 | /* Compute the number of datums (access width data items) */ |
797 | 812 | ||
813 | width_mask = | ||
814 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width); | ||
798 | mask = | 815 | mask = |
799 | ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); | 816 | width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field. |
800 | datum_count = | 817 | start_field_bit_offset); |
801 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, | 818 | |
802 | obj_desc->common_field.access_bit_width); | 819 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
803 | field_datum_count = | 820 | obj_desc->common_field.access_bit_width); |
804 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + | 821 | |
805 | obj_desc->common_field.start_field_bit_offset, | 822 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + |
806 | obj_desc->common_field.access_bit_width); | 823 | obj_desc->common_field. |
824 | start_field_bit_offset, | ||
825 | obj_desc->common_field. | ||
826 | access_bit_width); | ||
807 | 827 | ||
808 | /* Get initial Datum from the input buffer */ | 828 | /* Get initial Datum from the input buffer */ |
809 | 829 | ||
@@ -817,6 +837,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
817 | /* Write the entire field */ | 837 | /* Write the entire field */ |
818 | 838 | ||
819 | for (i = 1; i < field_datum_count; i++) { | 839 | for (i = 1; i < field_datum_count; i++) { |
840 | |||
820 | /* Write merged datum to the target field */ | 841 | /* Write merged datum to the target field */ |
821 | 842 | ||
822 | merged_datum &= mask; | 843 | merged_datum &= mask; |
@@ -833,7 +854,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
833 | merged_datum = raw_datum >> | 854 | merged_datum = raw_datum >> |
834 | (obj_desc->common_field.access_bit_width - | 855 | (obj_desc->common_field.access_bit_width - |
835 | obj_desc->common_field.start_field_bit_offset); | 856 | obj_desc->common_field.start_field_bit_offset); |
836 | mask = ACPI_INTEGER_MAX; | 857 | mask = width_mask; |
837 | 858 | ||
838 | if (i == datum_count) { | 859 | if (i == datum_count) { |
839 | break; | 860 | break; |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 48c18d29222a..bd98aab017cf 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -72,7 +72,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
72 | union acpi_operand_object *reference_obj; | 72 | union acpi_operand_object *reference_obj; |
73 | union acpi_operand_object *referenced_obj; | 73 | union acpi_operand_object *referenced_obj; |
74 | 74 | ||
75 | ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); | 75 | ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc); |
76 | 76 | ||
77 | *return_desc = NULL; | 77 | *return_desc = NULL; |
78 | 78 | ||
@@ -168,7 +168,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
168 | acpi_size length1; | 168 | acpi_size length1; |
169 | acpi_size new_length; | 169 | acpi_size new_length; |
170 | 170 | ||
171 | ACPI_FUNCTION_TRACE("ex_concat_template"); | 171 | ACPI_FUNCTION_TRACE(ex_concat_template); |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Find the end_tag descriptor in each resource template. | 174 | * Find the end_tag descriptor in each resource template. |
@@ -250,7 +250,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
250 | char *new_buf; | 250 | char *new_buf; |
251 | acpi_status status; | 251 | acpi_status status; |
252 | 252 | ||
253 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); | 253 | ACPI_FUNCTION_TRACE(ex_do_concatenate); |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * Convert the second operand if necessary. The first operand | 256 | * Convert the second operand if necessary. The first operand |
@@ -445,10 +445,24 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) | |||
445 | 445 | ||
446 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ | 446 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ |
447 | 447 | ||
448 | /* | ||
449 | * We need to check if the shiftcount is larger than the integer bit | ||
450 | * width since the behavior of this is not well-defined in the C language. | ||
451 | */ | ||
452 | if (integer1 >= acpi_gbl_integer_bit_width) { | ||
453 | return (0); | ||
454 | } | ||
448 | return (integer0 << integer1); | 455 | return (integer0 << integer1); |
449 | 456 | ||
450 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ | 457 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ |
451 | 458 | ||
459 | /* | ||
460 | * We need to check if the shiftcount is larger than the integer bit | ||
461 | * width since the behavior of this is not well-defined in the C language. | ||
462 | */ | ||
463 | if (integer1 >= acpi_gbl_integer_bit_width) { | ||
464 | return (0); | ||
465 | } | ||
452 | return (integer0 >> integer1); | 466 | return (integer0 >> integer1); |
453 | 467 | ||
454 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ | 468 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ |
@@ -489,7 +503,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode, | |||
489 | acpi_status status = AE_OK; | 503 | acpi_status status = AE_OK; |
490 | u8 local_result = FALSE; | 504 | u8 local_result = FALSE; |
491 | 505 | ||
492 | ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); | 506 | ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op); |
493 | 507 | ||
494 | switch (opcode) { | 508 | switch (opcode) { |
495 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ | 509 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ |
@@ -557,7 +571,7 @@ acpi_ex_do_logical_op(u16 opcode, | |||
557 | u8 local_result = FALSE; | 571 | u8 local_result = FALSE; |
558 | int compare; | 572 | int compare; |
559 | 573 | ||
560 | ACPI_FUNCTION_TRACE("ex_do_logical_op"); | 574 | ACPI_FUNCTION_TRACE(ex_do_logical_op); |
561 | 575 | ||
562 | /* | 576 | /* |
563 | * Convert the second operand if necessary. The first operand | 577 | * Convert the second operand if necessary. The first operand |
@@ -649,6 +663,7 @@ acpi_ex_do_logical_op(u16 opcode, | |||
649 | /* Length and all bytes must be equal */ | 663 | /* Length and all bytes must be equal */ |
650 | 664 | ||
651 | if ((length0 == length1) && (compare == 0)) { | 665 | if ((length0 == length1) && (compare == 0)) { |
666 | |||
652 | /* Length and all bytes match ==> TRUE */ | 667 | /* Length and all bytes match ==> TRUE */ |
653 | 668 | ||
654 | local_result = TRUE; | 669 | local_result = TRUE; |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index f843b22e20b9..93098d68cadf 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -61,7 +61,7 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, | |||
61 | * | 61 | * |
62 | * RETURN: None | 62 | * RETURN: None |
63 | * | 63 | * |
64 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list | 64 | * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list |
65 | * | 65 | * |
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | 67 | ||
@@ -95,7 +95,7 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) | |||
95 | * | 95 | * |
96 | * RETURN: None | 96 | * RETURN: None |
97 | * | 97 | * |
98 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk | 98 | * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk |
99 | * | 99 | * |
100 | ******************************************************************************/ | 100 | ******************************************************************************/ |
101 | 101 | ||
@@ -144,7 +144,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
144 | { | 144 | { |
145 | acpi_status status; | 145 | acpi_status status; |
146 | 146 | ||
147 | ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc); | 147 | ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex, obj_desc); |
148 | 148 | ||
149 | if (!obj_desc) { | 149 | if (!obj_desc) { |
150 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 150 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -165,7 +165,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
165 | */ | 165 | */ |
166 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 166 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
167 | ACPI_ERROR((AE_INFO, | 167 | ACPI_ERROR((AE_INFO, |
168 | "Cannot acquire Mutex [%4.4s], incorrect sync_level", | 168 | "Cannot acquire Mutex [%4.4s], incorrect SyncLevel", |
169 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 169 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
170 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 170 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
171 | } | 171 | } |
@@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
173 | /* Support for multiple acquires by the owning thread */ | 173 | /* Support for multiple acquires by the owning thread */ |
174 | 174 | ||
175 | if (obj_desc->mutex.owner_thread) { | 175 | if (obj_desc->mutex.owner_thread) { |
176 | |||
176 | /* Special case for Global Lock, allow all threads */ | 177 | /* Special case for Global Lock, allow all threads */ |
177 | 178 | ||
178 | if ((obj_desc->mutex.owner_thread->thread_id == | 179 | if ((obj_desc->mutex.owner_thread->thread_id == |
@@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
192 | 193 | ||
193 | status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); | 194 | status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); |
194 | if (ACPI_FAILURE(status)) { | 195 | if (ACPI_FAILURE(status)) { |
196 | |||
195 | /* Includes failure from a timeout on time_desc */ | 197 | /* Includes failure from a timeout on time_desc */ |
196 | 198 | ||
197 | return_ACPI_STATUS(status); | 199 | return_ACPI_STATUS(status); |
@@ -232,7 +234,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
232 | { | 234 | { |
233 | acpi_status status; | 235 | acpi_status status; |
234 | 236 | ||
235 | ACPI_FUNCTION_TRACE("ex_release_mutex"); | 237 | ACPI_FUNCTION_TRACE(ex_release_mutex); |
236 | 238 | ||
237 | if (!obj_desc) { | 239 | if (!obj_desc) { |
238 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 240 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -277,7 +279,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
277 | */ | 279 | */ |
278 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 280 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
279 | ACPI_ERROR((AE_INFO, | 281 | ACPI_ERROR((AE_INFO, |
280 | "Cannot release Mutex [%4.4s], incorrect sync_level", | 282 | "Cannot release Mutex [%4.4s], incorrect SyncLevel", |
281 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 283 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
282 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 284 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
283 | } | 285 | } |
@@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
286 | 288 | ||
287 | obj_desc->mutex.acquisition_depth--; | 289 | obj_desc->mutex.acquisition_depth--; |
288 | if (obj_desc->mutex.acquisition_depth != 0) { | 290 | if (obj_desc->mutex.acquisition_depth != 0) { |
291 | |||
289 | /* Just decrement the depth and return */ | 292 | /* Just decrement the depth and return */ |
290 | 293 | ||
291 | return_ACPI_STATUS(AE_OK); | 294 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 054fe5e1a314..d3d70364626c 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -77,7 +77,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
77 | char *name_string; | 77 | char *name_string; |
78 | u32 size_needed; | 78 | u32 size_needed; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ex_allocate_name_string"); | 80 | ACPI_FUNCTION_TRACE(ex_allocate_name_string); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. | 83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. |
@@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
85 | * This may actually be somewhat longer than needed. | 85 | * This may actually be somewhat longer than needed. |
86 | */ | 86 | */ |
87 | if (prefix_count == ACPI_UINT32_MAX) { | 87 | if (prefix_count == ACPI_UINT32_MAX) { |
88 | |||
88 | /* Special case for root */ | 89 | /* Special case for root */ |
89 | 90 | ||
90 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; | 91 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; |
@@ -97,7 +98,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
97 | * Allocate a buffer for the name. | 98 | * Allocate a buffer for the name. |
98 | * This buffer must be deleted by the caller! | 99 | * This buffer must be deleted by the caller! |
99 | */ | 100 | */ |
100 | name_string = ACPI_MEM_ALLOCATE(size_needed); | 101 | name_string = ACPI_ALLOCATE(size_needed); |
101 | if (!name_string) { | 102 | if (!name_string) { |
102 | ACPI_ERROR((AE_INFO, | 103 | ACPI_ERROR((AE_INFO, |
103 | "Could not allocate size %d", size_needed)); | 104 | "Could not allocate size %d", size_needed)); |
@@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
119 | /* Set up Dual or Multi prefixes if needed */ | 120 | /* Set up Dual or Multi prefixes if needed */ |
120 | 121 | ||
121 | if (num_name_segs > 2) { | 122 | if (num_name_segs > 2) { |
123 | |||
122 | /* Set up multi prefixes */ | 124 | /* Set up multi prefixes */ |
123 | 125 | ||
124 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; | 126 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; |
125 | *temp_ptr++ = (char)num_name_segs; | 127 | *temp_ptr++ = (char)num_name_segs; |
126 | } else if (2 == num_name_segs) { | 128 | } else if (2 == num_name_segs) { |
129 | |||
127 | /* Set up dual prefixes */ | 130 | /* Set up dual prefixes */ |
128 | 131 | ||
129 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; | 132 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; |
@@ -159,7 +162,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
159 | u32 index; | 162 | u32 index; |
160 | char char_buf[5]; | 163 | char char_buf[5]; |
161 | 164 | ||
162 | ACPI_FUNCTION_TRACE("ex_name_segment"); | 165 | ACPI_FUNCTION_TRACE(ex_name_segment); |
163 | 166 | ||
164 | /* | 167 | /* |
165 | * If first character is a digit, then we know that we aren't looking at a | 168 | * If first character is a digit, then we know that we aren't looking at a |
@@ -176,7 +179,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
176 | 179 | ||
177 | for (index = 0; | 180 | for (index = 0; |
178 | (index < ACPI_NAME_SIZE) | 181 | (index < ACPI_NAME_SIZE) |
179 | && (acpi_ut_valid_acpi_character(*aml_address)); index++) { | 182 | && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { |
180 | char_buf[index] = *aml_address++; | 183 | char_buf[index] = *aml_address++; |
181 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); | 184 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); |
182 | } | 185 | } |
@@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
184 | /* Valid name segment */ | 187 | /* Valid name segment */ |
185 | 188 | ||
186 | if (index == 4) { | 189 | if (index == 4) { |
190 | |||
187 | /* Found 4 valid characters */ | 191 | /* Found 4 valid characters */ |
188 | 192 | ||
189 | char_buf[4] = '\0'; | 193 | char_buf[4] = '\0'; |
@@ -249,11 +253,12 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
249 | u32 prefix_count = 0; | 253 | u32 prefix_count = 0; |
250 | u8 has_prefix = FALSE; | 254 | u8 has_prefix = FALSE; |
251 | 255 | ||
252 | ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address); | 256 | ACPI_FUNCTION_TRACE_PTR(ex_get_name_string, aml_address); |
253 | 257 | ||
254 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || | 258 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || |
255 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || | 259 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || |
256 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { | 260 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { |
261 | |||
257 | /* Disallow prefixes for types associated with field_unit names */ | 262 | /* Disallow prefixes for types associated with field_unit names */ |
258 | 263 | ||
259 | name_string = acpi_ex_allocate_name_string(0, 1); | 264 | name_string = acpi_ex_allocate_name_string(0, 1); |
@@ -272,7 +277,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
272 | case AML_ROOT_PREFIX: | 277 | case AML_ROOT_PREFIX: |
273 | 278 | ||
274 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 279 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
275 | "root_prefix(\\) at %p\n", | 280 | "RootPrefix(\\) at %p\n", |
276 | aml_address)); | 281 | aml_address)); |
277 | 282 | ||
278 | /* | 283 | /* |
@@ -290,7 +295,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
290 | 295 | ||
291 | do { | 296 | do { |
292 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 297 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
293 | "parent_prefix (^) at %p\n", | 298 | "ParentPrefix (^) at %p\n", |
294 | aml_address)); | 299 | aml_address)); |
295 | 300 | ||
296 | aml_address++; | 301 | aml_address++; |
@@ -314,7 +319,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
314 | case AML_DUAL_NAME_PREFIX: | 319 | case AML_DUAL_NAME_PREFIX: |
315 | 320 | ||
316 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 321 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
317 | "dual_name_prefix at %p\n", | 322 | "DualNamePrefix at %p\n", |
318 | aml_address)); | 323 | aml_address)); |
319 | 324 | ||
320 | aml_address++; | 325 | aml_address++; |
@@ -341,7 +346,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
341 | case AML_MULTI_NAME_PREFIX_OP: | 346 | case AML_MULTI_NAME_PREFIX_OP: |
342 | 347 | ||
343 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 348 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
344 | "multi_name_prefix at %p\n", | 349 | "MultiNamePrefix at %p\n", |
345 | aml_address)); | 350 | aml_address)); |
346 | 351 | ||
347 | /* Fetch count of segments remaining in name path */ | 352 | /* Fetch count of segments remaining in name path */ |
@@ -377,7 +382,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
377 | 382 | ||
378 | if (prefix_count == ACPI_UINT32_MAX) { | 383 | if (prefix_count == ACPI_UINT32_MAX) { |
379 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 384 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
380 | "name_seg is \"\\\" followed by NULL\n")); | 385 | "NameSeg is \"\\\" followed by NULL\n")); |
381 | } | 386 | } |
382 | 387 | ||
383 | /* Consume the NULL byte */ | 388 | /* Consume the NULL byte */ |
@@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
410 | } | 415 | } |
411 | 416 | ||
412 | if (AE_CTRL_PENDING == status && has_prefix) { | 417 | if (AE_CTRL_PENDING == status && has_prefix) { |
418 | |||
413 | /* Ran out of segments after processing a prefix */ | 419 | /* Ran out of segments after processing a prefix */ |
414 | 420 | ||
415 | ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); | 421 | ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); |
@@ -418,7 +424,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
418 | 424 | ||
419 | if (ACPI_FAILURE(status)) { | 425 | if (ACPI_FAILURE(status)) { |
420 | if (name_string) { | 426 | if (name_string) { |
421 | ACPI_MEM_FREE(name_string); | 427 | ACPI_FREE(name_string); |
422 | } | 428 | } |
423 | return_ACPI_STATUS(status); | 429 | return_ACPI_STATUS(status); |
424 | } | 430 | } |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 23d0823bcd5e..6374d8be88e0 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -89,7 +89,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |||
89 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
90 | union acpi_operand_object *return_desc = NULL; | 90 | union acpi_operand_object *return_desc = NULL; |
91 | 91 | ||
92 | ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", | 92 | ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R, |
93 | acpi_ps_get_opcode_name(walk_state->opcode)); | 93 | acpi_ps_get_opcode_name(walk_state->opcode)); |
94 | 94 | ||
95 | /* Examine the AML opcode */ | 95 | /* Examine the AML opcode */ |
@@ -150,7 +150,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) | |||
150 | union acpi_operand_object **operand = &walk_state->operands[0]; | 150 | union acpi_operand_object **operand = &walk_state->operands[0]; |
151 | acpi_status status = AE_OK; | 151 | acpi_status status = AE_OK; |
152 | 152 | ||
153 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", | 153 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R, |
154 | acpi_ps_get_opcode_name(walk_state->opcode)); | 154 | acpi_ps_get_opcode_name(walk_state->opcode)); |
155 | 155 | ||
156 | /* Examine the AML opcode */ | 156 | /* Examine the AML opcode */ |
@@ -216,7 +216,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) | |||
216 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
217 | union acpi_operand_object **operand = &walk_state->operands[0]; | 217 | union acpi_operand_object **operand = &walk_state->operands[0]; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", | 219 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R, |
220 | acpi_ps_get_opcode_name(walk_state->opcode)); | 220 | acpi_ps_get_opcode_name(walk_state->opcode)); |
221 | 221 | ||
222 | /* Examine the AML opcode */ | 222 | /* Examine the AML opcode */ |
@@ -264,7 +264,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
264 | acpi_integer power_of_ten; | 264 | acpi_integer power_of_ten; |
265 | acpi_integer digit; | 265 | acpi_integer digit; |
266 | 266 | ||
267 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", | 267 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, |
268 | acpi_ps_get_opcode_name(walk_state->opcode)); | 268 | acpi_ps_get_opcode_name(walk_state->opcode)); |
269 | 269 | ||
270 | /* Examine the AML opcode */ | 270 | /* Examine the AML opcode */ |
@@ -322,8 +322,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
322 | 322 | ||
323 | /* Since the bit position is one-based, subtract from 33 (65) */ | 323 | /* Since the bit position is one-based, subtract from 33 (65) */ |
324 | 324 | ||
325 | return_desc->integer.value = temp32 == 0 ? 0 : | 325 | return_desc->integer.value = |
326 | (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | 326 | temp32 == |
327 | 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | ||
327 | break; | 328 | break; |
328 | 329 | ||
329 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ | 330 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ |
@@ -342,6 +343,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
342 | for (i = 0; | 343 | for (i = 0; |
343 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); | 344 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); |
344 | i++) { | 345 | i++) { |
346 | |||
345 | /* Get the least significant 4-bit BCD digit */ | 347 | /* Get the least significant 4-bit BCD digit */ |
346 | 348 | ||
347 | temp32 = ((u32) digit) & 0xF; | 349 | temp32 = ((u32) digit) & 0xF; |
@@ -487,6 +489,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
487 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 489 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
488 | ACPI_EXPLICIT_CONVERT_DECIMAL); | 490 | ACPI_EXPLICIT_CONVERT_DECIMAL); |
489 | if (return_desc == operand[0]) { | 491 | if (return_desc == operand[0]) { |
492 | |||
490 | /* No conversion performed, add ref to handle return value */ | 493 | /* No conversion performed, add ref to handle return value */ |
491 | acpi_ut_add_reference(return_desc); | 494 | acpi_ut_add_reference(return_desc); |
492 | } | 495 | } |
@@ -497,6 +500,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
497 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 500 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
498 | ACPI_EXPLICIT_CONVERT_HEX); | 501 | ACPI_EXPLICIT_CONVERT_HEX); |
499 | if (return_desc == operand[0]) { | 502 | if (return_desc == operand[0]) { |
503 | |||
500 | /* No conversion performed, add ref to handle return value */ | 504 | /* No conversion performed, add ref to handle return value */ |
501 | acpi_ut_add_reference(return_desc); | 505 | acpi_ut_add_reference(return_desc); |
502 | } | 506 | } |
@@ -506,6 +510,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
506 | 510 | ||
507 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); | 511 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); |
508 | if (return_desc == operand[0]) { | 512 | if (return_desc == operand[0]) { |
513 | |||
509 | /* No conversion performed, add ref to handle return value */ | 514 | /* No conversion performed, add ref to handle return value */ |
510 | acpi_ut_add_reference(return_desc); | 515 | acpi_ut_add_reference(return_desc); |
511 | } | 516 | } |
@@ -516,6 +521,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
516 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, | 521 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, |
517 | ACPI_ANY_BASE); | 522 | ACPI_ANY_BASE); |
518 | if (return_desc == operand[0]) { | 523 | if (return_desc == operand[0]) { |
524 | |||
519 | /* No conversion performed, add ref to handle return value */ | 525 | /* No conversion performed, add ref to handle return value */ |
520 | acpi_ut_add_reference(return_desc); | 526 | acpi_ut_add_reference(return_desc); |
521 | } | 527 | } |
@@ -541,6 +547,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
541 | } | 547 | } |
542 | 548 | ||
543 | if (ACPI_SUCCESS(status)) { | 549 | if (ACPI_SUCCESS(status)) { |
550 | |||
544 | /* Store the return value computed above into the target object */ | 551 | /* Store the return value computed above into the target object */ |
545 | 552 | ||
546 | status = acpi_ex_store(return_desc, operand[1], walk_state); | 553 | status = acpi_ex_store(return_desc, operand[1], walk_state); |
@@ -548,16 +555,18 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
548 | 555 | ||
549 | cleanup: | 556 | cleanup: |
550 | 557 | ||
551 | if (!walk_state->result_obj) { | ||
552 | walk_state->result_obj = return_desc; | ||
553 | } | ||
554 | |||
555 | /* Delete return object on error */ | 558 | /* Delete return object on error */ |
556 | 559 | ||
557 | if (ACPI_FAILURE(status)) { | 560 | if (ACPI_FAILURE(status)) { |
558 | acpi_ut_remove_reference(return_desc); | 561 | acpi_ut_remove_reference(return_desc); |
559 | } | 562 | } |
560 | 563 | ||
564 | /* Save return object on success */ | ||
565 | |||
566 | else if (!walk_state->result_obj) { | ||
567 | walk_state->result_obj = return_desc; | ||
568 | } | ||
569 | |||
561 | return_ACPI_STATUS(status); | 570 | return_ACPI_STATUS(status); |
562 | } | 571 | } |
563 | 572 | ||
@@ -582,7 +591,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
582 | u32 type; | 591 | u32 type; |
583 | acpi_integer value; | 592 | acpi_integer value; |
584 | 593 | ||
585 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", | 594 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, |
586 | acpi_ps_get_opcode_name(walk_state->opcode)); | 595 | acpi_ps_get_opcode_name(walk_state->opcode)); |
587 | 596 | ||
588 | /* Examine the AML opcode */ | 597 | /* Examine the AML opcode */ |
@@ -625,6 +634,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
625 | temp_desc = operand[0]; | 634 | temp_desc = operand[0]; |
626 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == | 635 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == |
627 | ACPI_DESC_TYPE_OPERAND) { | 636 | ACPI_DESC_TYPE_OPERAND) { |
637 | |||
628 | /* Internal reference object - prevent deletion */ | 638 | /* Internal reference object - prevent deletion */ |
629 | 639 | ||
630 | acpi_ut_add_reference(temp_desc); | 640 | acpi_ut_add_reference(temp_desc); |
@@ -689,6 +699,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
689 | if (ACPI_FAILURE(status)) { | 699 | if (ACPI_FAILURE(status)) { |
690 | goto cleanup; | 700 | goto cleanup; |
691 | } | 701 | } |
702 | |||
692 | /* Allocate a descriptor to hold the type. */ | 703 | /* Allocate a descriptor to hold the type. */ |
693 | 704 | ||
694 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 705 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
@@ -777,8 +788,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
777 | 788 | ||
778 | /* Check for a method local or argument, or standalone String */ | 789 | /* Check for a method local or argument, or standalone String */ |
779 | 790 | ||
780 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != | 791 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == |
781 | ACPI_DESC_TYPE_NAMED) { | 792 | ACPI_DESC_TYPE_NAMED) { |
793 | temp_desc = | ||
794 | acpi_ns_get_attached_object((struct | ||
795 | acpi_namespace_node *) | ||
796 | operand[0]); | ||
797 | if (temp_desc | ||
798 | && | ||
799 | ((ACPI_GET_OBJECT_TYPE(temp_desc) == | ||
800 | ACPI_TYPE_STRING) | ||
801 | || (ACPI_GET_OBJECT_TYPE(temp_desc) == | ||
802 | ACPI_TYPE_LOCAL_REFERENCE))) { | ||
803 | operand[0] = temp_desc; | ||
804 | acpi_ut_add_reference(temp_desc); | ||
805 | } else { | ||
806 | status = AE_AML_OPERAND_TYPE; | ||
807 | goto cleanup; | ||
808 | } | ||
809 | } else { | ||
782 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | 810 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { |
783 | case ACPI_TYPE_LOCAL_REFERENCE: | 811 | case ACPI_TYPE_LOCAL_REFERENCE: |
784 | /* | 812 | /* |
@@ -827,26 +855,35 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
827 | break; | 855 | break; |
828 | 856 | ||
829 | case ACPI_TYPE_STRING: | 857 | case ACPI_TYPE_STRING: |
858 | break; | ||
830 | 859 | ||
860 | default: | ||
861 | status = AE_AML_OPERAND_TYPE; | ||
862 | goto cleanup; | ||
863 | } | ||
864 | } | ||
865 | |||
866 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != | ||
867 | ACPI_DESC_TYPE_NAMED) { | ||
868 | if (ACPI_GET_OBJECT_TYPE(operand[0]) == | ||
869 | ACPI_TYPE_STRING) { | ||
831 | /* | 870 | /* |
832 | * This is a deref_of (String). The string is a reference | 871 | * This is a deref_of (String). The string is a reference |
833 | * to a named ACPI object. | 872 | * to a named ACPI object. |
834 | * | 873 | * |
835 | * 1) Find the owning Node | 874 | * 1) Find the owning Node |
836 | * 2) Dereference the node to an actual object. Could be a | 875 | * 2) Dereference the node to an actual object. Could be a |
837 | * Field, so we need to resolve the node to a value. | 876 | * Field, so we need to resolve the node to a value. |
838 | */ | 877 | */ |
839 | status = | 878 | status = |
840 | acpi_ns_get_node_by_path(operand[0]->string. | 879 | acpi_ns_get_node(walk_state->scope_info-> |
841 | pointer, | 880 | scope.node, |
842 | walk_state-> | 881 | operand[0]->string.pointer, |
843 | scope_info->scope. | 882 | ACPI_NS_SEARCH_PARENT, |
844 | node, | 883 | ACPI_CAST_INDIRECT_PTR |
845 | ACPI_NS_SEARCH_PARENT, | 884 | (struct |
846 | ACPI_CAST_INDIRECT_PTR | 885 | acpi_namespace_node, |
847 | (struct | 886 | &return_desc)); |
848 | acpi_namespace_node, | ||
849 | &return_desc)); | ||
850 | if (ACPI_FAILURE(status)) { | 887 | if (ACPI_FAILURE(status)) { |
851 | goto cleanup; | 888 | goto cleanup; |
852 | } | 889 | } |
@@ -857,11 +894,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
857 | (struct acpi_namespace_node, &return_desc), | 894 | (struct acpi_namespace_node, &return_desc), |
858 | walk_state); | 895 | walk_state); |
859 | goto cleanup; | 896 | goto cleanup; |
860 | |||
861 | default: | ||
862 | |||
863 | status = AE_AML_OPERAND_TYPE; | ||
864 | goto cleanup; | ||
865 | } | 897 | } |
866 | } | 898 | } |
867 | 899 | ||
@@ -937,13 +969,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
937 | acpi_ut_add_reference | 969 | acpi_ut_add_reference |
938 | (return_desc); | 970 | (return_desc); |
939 | } | 971 | } |
940 | |||
941 | break; | 972 | break; |
942 | 973 | ||
943 | default: | 974 | default: |
944 | 975 | ||
945 | ACPI_ERROR((AE_INFO, | 976 | ACPI_ERROR((AE_INFO, |
946 | "Unknown Index target_type %X in obj %p", | 977 | "Unknown Index TargetType %X in obj %p", |
947 | operand[0]->reference. | 978 | operand[0]->reference. |
948 | target_type, operand[0])); | 979 | target_type, operand[0])); |
949 | status = AE_AML_OPERAND_TYPE; | 980 | status = AE_AML_OPERAND_TYPE; |
@@ -957,7 +988,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
957 | 988 | ||
958 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == | 989 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == |
959 | ACPI_DESC_TYPE_NAMED) { | 990 | ACPI_DESC_TYPE_NAMED) { |
960 | |||
961 | return_desc = | 991 | return_desc = |
962 | acpi_ns_get_attached_object((struct | 992 | acpi_ns_get_attached_object((struct |
963 | acpi_namespace_node | 993 | acpi_namespace_node |
@@ -972,7 +1002,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
972 | 1002 | ||
973 | default: | 1003 | default: |
974 | ACPI_ERROR((AE_INFO, | 1004 | ACPI_ERROR((AE_INFO, |
975 | "Unknown opcode in ref(%p) - %X", | 1005 | "Unknown opcode in reference(%p) - %X", |
976 | operand[0], | 1006 | operand[0], |
977 | operand[0]->reference.opcode)); | 1007 | operand[0]->reference.opcode)); |
978 | 1008 | ||
@@ -998,6 +1028,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
998 | acpi_ut_remove_reference(return_desc); | 1028 | acpi_ut_remove_reference(return_desc); |
999 | } | 1029 | } |
1000 | 1030 | ||
1001 | walk_state->result_obj = return_desc; | 1031 | /* Save return object on success */ |
1032 | |||
1033 | else { | ||
1034 | walk_state->result_obj = return_desc; | ||
1035 | } | ||
1036 | |||
1002 | return_ACPI_STATUS(status); | 1037 | return_ACPI_STATUS(status); |
1003 | } | 1038 | } |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index e263a5ddd405..7d2cbc113160 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -92,7 +92,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
92 | u32 value; | 92 | u32 value; |
93 | acpi_status status = AE_OK; | 93 | acpi_status status = AE_OK; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R", | 95 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_0R, |
96 | acpi_ps_get_opcode_name(walk_state->opcode)); | 96 | acpi_ps_get_opcode_name(walk_state->opcode)); |
97 | 97 | ||
98 | /* Examine the opcode */ | 98 | /* Examine the opcode */ |
@@ -121,7 +121,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
121 | #ifdef ACPI_GPE_NOTIFY_CHECK | 121 | #ifdef ACPI_GPE_NOTIFY_CHECK |
122 | /* | 122 | /* |
123 | * GPE method wake/notify check. Here, we want to ensure that we | 123 | * GPE method wake/notify check. Here, we want to ensure that we |
124 | * don't receive any "device_wake" Notifies from a GPE _Lxx or _Exx | 124 | * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx |
125 | * GPE method during system runtime. If we do, the GPE is marked | 125 | * GPE method during system runtime. If we do, the GPE is marked |
126 | * as "wake-only" and disabled. | 126 | * as "wake-only" and disabled. |
127 | * | 127 | * |
@@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
138 | acpi_ev_check_for_wake_only_gpe(walk_state-> | 138 | acpi_ev_check_for_wake_only_gpe(walk_state-> |
139 | gpe_event_info); | 139 | gpe_event_info); |
140 | if (ACPI_FAILURE(status)) { | 140 | if (ACPI_FAILURE(status)) { |
141 | |||
141 | /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ | 142 | /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ |
142 | 143 | ||
143 | return_ACPI_STATUS(AE_OK) | 144 | return_ACPI_STATUS(AE_OK) |
@@ -185,7 +186,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
185 | union acpi_operand_object *return_desc2 = NULL; | 186 | union acpi_operand_object *return_desc2 = NULL; |
186 | acpi_status status; | 187 | acpi_status status; |
187 | 188 | ||
188 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R", | 189 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_2T_1R, |
189 | acpi_ps_get_opcode_name(walk_state->opcode)); | 190 | acpi_ps_get_opcode_name(walk_state->opcode)); |
190 | 191 | ||
191 | /* Execute the opcode */ | 192 | /* Execute the opcode */ |
@@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
252 | acpi_ut_remove_reference(return_desc2); | 253 | acpi_ut_remove_reference(return_desc2); |
253 | 254 | ||
254 | if (ACPI_FAILURE(status)) { | 255 | if (ACPI_FAILURE(status)) { |
256 | |||
255 | /* Delete the return object */ | 257 | /* Delete the return object */ |
256 | 258 | ||
257 | acpi_ut_remove_reference(return_desc1); | 259 | acpi_ut_remove_reference(return_desc1); |
@@ -281,12 +283,13 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
281 | acpi_status status = AE_OK; | 283 | acpi_status status = AE_OK; |
282 | acpi_size length; | 284 | acpi_size length; |
283 | 285 | ||
284 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R", | 286 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R, |
285 | acpi_ps_get_opcode_name(walk_state->opcode)); | 287 | acpi_ps_get_opcode_name(walk_state->opcode)); |
286 | 288 | ||
287 | /* Execute the opcode */ | 289 | /* Execute the opcode */ |
288 | 290 | ||
289 | if (walk_state->op_info->flags & AML_MATH) { | 291 | if (walk_state->op_info->flags & AML_MATH) { |
292 | |||
290 | /* All simple math opcodes (add, etc.) */ | 293 | /* All simple math opcodes (add, etc.) */ |
291 | 294 | ||
292 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 295 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
@@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
383 | goto cleanup; | 386 | goto cleanup; |
384 | } | 387 | } |
385 | 388 | ||
389 | /* Initialize the Index reference object */ | ||
390 | |||
386 | index = operand[1]->integer.value; | 391 | index = operand[1]->integer.value; |
392 | return_desc->reference.offset = (u32) index; | ||
393 | return_desc->reference.opcode = AML_INDEX_OP; | ||
387 | 394 | ||
388 | /* At this point, the Source operand is a Package, Buffer, or String */ | 395 | /* |
396 | * At this point, the Source operand is a String, Buffer, or Package. | ||
397 | * Verify that the index is within range. | ||
398 | */ | ||
399 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | ||
400 | case ACPI_TYPE_STRING: | ||
389 | 401 | ||
390 | if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { | 402 | if (index >= operand[0]->string.length) { |
391 | /* Object to be indexed is a Package */ | 403 | status = AE_AML_STRING_LIMIT; |
404 | } | ||
405 | |||
406 | return_desc->reference.target_type = | ||
407 | ACPI_TYPE_BUFFER_FIELD; | ||
408 | break; | ||
409 | |||
410 | case ACPI_TYPE_BUFFER: | ||
411 | |||
412 | if (index >= operand[0]->buffer.length) { | ||
413 | status = AE_AML_BUFFER_LIMIT; | ||
414 | } | ||
415 | |||
416 | return_desc->reference.target_type = | ||
417 | ACPI_TYPE_BUFFER_FIELD; | ||
418 | break; | ||
419 | |||
420 | case ACPI_TYPE_PACKAGE: | ||
392 | 421 | ||
393 | if (index >= operand[0]->package.count) { | 422 | if (index >= operand[0]->package.count) { |
394 | ACPI_ERROR((AE_INFO, | ||
395 | "Index value (%X%8.8X) beyond package end (%X)", | ||
396 | ACPI_FORMAT_UINT64(index), | ||
397 | operand[0]->package.count)); | ||
398 | status = AE_AML_PACKAGE_LIMIT; | 423 | status = AE_AML_PACKAGE_LIMIT; |
399 | goto cleanup; | ||
400 | } | 424 | } |
401 | 425 | ||
402 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; | 426 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; |
403 | return_desc->reference.object = operand[0]; | ||
404 | return_desc->reference.where = | 427 | return_desc->reference.where = |
405 | &operand[0]->package.elements[index]; | 428 | &operand[0]->package.elements[index]; |
406 | } else { | 429 | break; |
407 | /* Object to be indexed is a Buffer/String */ | ||
408 | 430 | ||
409 | if (index >= operand[0]->buffer.length) { | 431 | default: |
410 | ACPI_ERROR((AE_INFO, | ||
411 | "Index value (%X%8.8X) beyond end of buffer (%X)", | ||
412 | ACPI_FORMAT_UINT64(index), | ||
413 | operand[0]->buffer.length)); | ||
414 | status = AE_AML_BUFFER_LIMIT; | ||
415 | goto cleanup; | ||
416 | } | ||
417 | 432 | ||
418 | return_desc->reference.target_type = | 433 | status = AE_AML_INTERNAL; |
419 | ACPI_TYPE_BUFFER_FIELD; | 434 | goto cleanup; |
420 | return_desc->reference.object = operand[0]; | 435 | } |
436 | |||
437 | /* Failure means that the Index was beyond the end of the object */ | ||
438 | |||
439 | if (ACPI_FAILURE(status)) { | ||
440 | ACPI_EXCEPTION((AE_INFO, status, | ||
441 | "Index (%X%8.8X) is beyond end of object", | ||
442 | ACPI_FORMAT_UINT64(index))); | ||
443 | goto cleanup; | ||
421 | } | 444 | } |
422 | 445 | ||
423 | /* | 446 | /* |
424 | * Add a reference to the target package/buffer/string for the life | 447 | * Save the target object and add a reference to it for the life |
425 | * of the index. | 448 | * of the index |
426 | */ | 449 | */ |
450 | return_desc->reference.object = operand[0]; | ||
427 | acpi_ut_add_reference(operand[0]); | 451 | acpi_ut_add_reference(operand[0]); |
428 | 452 | ||
429 | /* Complete the Index reference object */ | ||
430 | |||
431 | return_desc->reference.opcode = AML_INDEX_OP; | ||
432 | return_desc->reference.offset = (u32) index; | ||
433 | |||
434 | /* Store the reference to the Target */ | 453 | /* Store the reference to the Target */ |
435 | 454 | ||
436 | status = acpi_ex_store(return_desc, operand[2], walk_state); | 455 | status = acpi_ex_store(return_desc, operand[2], walk_state); |
@@ -495,7 +514,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
495 | acpi_status status = AE_OK; | 514 | acpi_status status = AE_OK; |
496 | u8 logical_result = FALSE; | 515 | u8 logical_result = FALSE; |
497 | 516 | ||
498 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R", | 517 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_1R, |
499 | acpi_ps_get_opcode_name(walk_state->opcode)); | 518 | acpi_ps_get_opcode_name(walk_state->opcode)); |
500 | 519 | ||
501 | /* Create the internal return object */ | 520 | /* Create the internal return object */ |
@@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
509 | /* Execute the Opcode */ | 528 | /* Execute the Opcode */ |
510 | 529 | ||
511 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { | 530 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { |
531 | |||
512 | /* logical_op (Operand0, Operand1) */ | 532 | /* logical_op (Operand0, Operand1) */ |
513 | 533 | ||
514 | status = acpi_ex_do_logical_numeric_op(walk_state->opcode, | 534 | status = acpi_ex_do_logical_numeric_op(walk_state->opcode, |
@@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
518 | value, &logical_result); | 538 | value, &logical_result); |
519 | goto store_logical_result; | 539 | goto store_logical_result; |
520 | } else if (walk_state->op_info->flags & AML_LOGICAL) { | 540 | } else if (walk_state->op_info->flags & AML_LOGICAL) { |
541 | |||
521 | /* logical_op (Operand0, Operand1) */ | 542 | /* logical_op (Operand0, Operand1) */ |
522 | 543 | ||
523 | status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], | 544 | status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], |
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 6a3a883cb8a3..e2d945dfd509 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -88,20 +88,19 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |||
88 | struct acpi_signal_fatal_info *fatal; | 88 | struct acpi_signal_fatal_info *fatal; |
89 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
90 | 90 | ||
91 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R", | 91 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R, |
92 | acpi_ps_get_opcode_name(walk_state->opcode)); | 92 | acpi_ps_get_opcode_name(walk_state->opcode)); |
93 | 93 | ||
94 | switch (walk_state->opcode) { | 94 | switch (walk_state->opcode) { |
95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ | 95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ |
96 | 96 | ||
97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
98 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", | 98 | "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", |
99 | (u32) operand[0]->integer.value, | 99 | (u32) operand[0]->integer.value, |
100 | (u32) operand[1]->integer.value, | 100 | (u32) operand[1]->integer.value, |
101 | (u32) operand[2]->integer.value)); | 101 | (u32) operand[2]->integer.value)); |
102 | 102 | ||
103 | fatal = | 103 | fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); |
104 | ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); | ||
105 | if (fatal) { | 104 | if (fatal) { |
106 | fatal->type = (u32) operand[0]->integer.value; | 105 | fatal->type = (u32) operand[0]->integer.value; |
107 | fatal->code = (u32) operand[1]->integer.value; | 106 | fatal->code = (u32) operand[1]->integer.value; |
@@ -114,7 +113,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |||
114 | 113 | ||
115 | /* Might return while OS is shutting down, just continue */ | 114 | /* Might return while OS is shutting down, just continue */ |
116 | 115 | ||
117 | ACPI_MEM_FREE(fatal); | 116 | ACPI_FREE(fatal); |
118 | break; | 117 | break; |
119 | 118 | ||
120 | default: | 119 | default: |
@@ -151,7 +150,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
151 | acpi_integer index; | 150 | acpi_integer index; |
152 | acpi_size length; | 151 | acpi_size length; |
153 | 152 | ||
154 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R", | 153 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, |
155 | acpi_ps_get_opcode_name(walk_state->opcode)); | 154 | acpi_ps_get_opcode_name(walk_state->opcode)); |
156 | 155 | ||
157 | switch (walk_state->opcode) { | 156 | switch (walk_state->opcode) { |
@@ -196,7 +195,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
196 | 195 | ||
197 | /* Always allocate a new buffer for the String */ | 196 | /* Always allocate a new buffer for the String */ |
198 | 197 | ||
199 | buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); | 198 | buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); |
200 | if (!buffer) { | 199 | if (!buffer) { |
201 | status = AE_NO_MEMORY; | 200 | status = AE_NO_MEMORY; |
202 | goto cleanup; | 201 | goto cleanup; |
@@ -208,9 +207,10 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
208 | /* If the requested length is zero, don't allocate a buffer */ | 207 | /* If the requested length is zero, don't allocate a buffer */ |
209 | 208 | ||
210 | if (length > 0) { | 209 | if (length > 0) { |
210 | |||
211 | /* Allocate a new buffer for the Buffer */ | 211 | /* Allocate a new buffer for the Buffer */ |
212 | 212 | ||
213 | buffer = ACPI_MEM_CALLOCATE(length); | 213 | buffer = ACPI_ALLOCATE_ZEROED(length); |
214 | if (!buffer) { | 214 | if (!buffer) { |
215 | status = AE_NO_MEMORY; | 215 | status = AE_NO_MEMORY; |
216 | goto cleanup; | 216 | goto cleanup; |
@@ -225,6 +225,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
225 | } | 225 | } |
226 | 226 | ||
227 | if (buffer) { | 227 | if (buffer) { |
228 | |||
228 | /* We have a buffer, copy the portion requested */ | 229 | /* We have a buffer, copy the portion requested */ |
229 | 230 | ||
230 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, | 231 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, |
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index e043d924444f..f0c0ba6eb408 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c | |||
@@ -220,7 +220,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
220 | acpi_integer index; | 220 | acpi_integer index; |
221 | union acpi_operand_object *this_element; | 221 | union acpi_operand_object *this_element; |
222 | 222 | ||
223 | ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R", | 223 | ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, |
224 | acpi_ps_get_opcode_name(walk_state->opcode)); | 224 | acpi_ps_get_opcode_name(walk_state->opcode)); |
225 | 225 | ||
226 | switch (walk_state->opcode) { | 226 | switch (walk_state->opcode) { |
@@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
276 | * match was found. | 276 | * match was found. |
277 | */ | 277 | */ |
278 | for (; index < operand[0]->package.count; index++) { | 278 | for (; index < operand[0]->package.count; index++) { |
279 | |||
279 | /* Get the current package element */ | 280 | /* Get the current package element */ |
280 | 281 | ||
281 | this_element = operand[0]->package.elements[index]; | 282 | this_element = operand[0]->package.elements[index]; |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 7719ae5d4f16..44d064f427b9 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -97,7 +97,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
97 | u32 minimum_accesses = 0xFFFFFFFF; | 97 | u32 minimum_accesses = 0xFFFFFFFF; |
98 | u32 accesses; | 98 | u32 accesses; |
99 | 99 | ||
100 | ACPI_FUNCTION_TRACE("ex_generate_access"); | 100 | ACPI_FUNCTION_TRACE(ex_generate_access); |
101 | 101 | ||
102 | /* Round Field start offset and length to "minimal" byte boundaries */ | 102 | /* Round Field start offset and length to "minimal" byte boundaries */ |
103 | 103 | ||
@@ -146,7 +146,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
146 | accesses = field_end_offset - field_start_offset; | 146 | accesses = field_end_offset - field_start_offset; |
147 | 147 | ||
148 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 148 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
149 | "access_width %d end is within region\n", | 149 | "AccessWidth %d end is within region\n", |
150 | access_byte_width)); | 150 | access_byte_width)); |
151 | 151 | ||
152 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 152 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
@@ -173,7 +173,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
173 | } | 173 | } |
174 | } else { | 174 | } else { |
175 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 175 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
176 | "access_width %d end is NOT within region\n", | 176 | "AccessWidth %d end is NOT within region\n", |
177 | access_byte_width)); | 177 | access_byte_width)); |
178 | if (access_byte_width == 1) { | 178 | if (access_byte_width == 1) { |
179 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 179 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
@@ -228,7 +228,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
228 | u32 byte_alignment; | 228 | u32 byte_alignment; |
229 | u32 bit_length; | 229 | u32 bit_length; |
230 | 230 | ||
231 | ACPI_FUNCTION_TRACE("ex_decode_field_access"); | 231 | ACPI_FUNCTION_TRACE(ex_decode_field_access); |
232 | 232 | ||
233 | access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); | 233 | access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); |
234 | 234 | ||
@@ -322,7 +322,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
322 | u32 byte_alignment; | 322 | u32 byte_alignment; |
323 | u32 nearest_byte_address; | 323 | u32 nearest_byte_address; |
324 | 324 | ||
325 | ACPI_FUNCTION_TRACE("ex_prep_common_field_object"); | 325 | ACPI_FUNCTION_TRACE(ex_prep_common_field_object); |
326 | 326 | ||
327 | /* | 327 | /* |
328 | * Note: the structure being initialized is the | 328 | * Note: the structure being initialized is the |
@@ -415,13 +415,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
415 | u32 type; | 415 | u32 type; |
416 | acpi_status status; | 416 | acpi_status status; |
417 | 417 | ||
418 | ACPI_FUNCTION_TRACE("ex_prep_field_value"); | 418 | ACPI_FUNCTION_TRACE(ex_prep_field_value); |
419 | 419 | ||
420 | /* Parameter validation */ | 420 | /* Parameter validation */ |
421 | 421 | ||
422 | if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { | 422 | if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { |
423 | if (!info->region_node) { | 423 | if (!info->region_node) { |
424 | ACPI_ERROR((AE_INFO, "Null region_node")); | 424 | ACPI_ERROR((AE_INFO, "Null RegionNode")); |
425 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | 425 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
426 | } | 426 | } |
427 | 427 | ||
@@ -467,7 +467,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
467 | acpi_ut_add_reference(obj_desc->field.region_obj); | 467 | acpi_ut_add_reference(obj_desc->field.region_obj); |
468 | 468 | ||
469 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 469 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
470 | "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", | 470 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
471 | obj_desc->field.start_field_bit_offset, | 471 | obj_desc->field.start_field_bit_offset, |
472 | obj_desc->field.base_byte_offset, | 472 | obj_desc->field.base_byte_offset, |
473 | obj_desc->field.access_byte_width, | 473 | obj_desc->field.access_byte_width, |
@@ -488,7 +488,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
488 | acpi_ut_add_reference(obj_desc->bank_field.bank_obj); | 488 | acpi_ut_add_reference(obj_desc->bank_field.bank_obj); |
489 | 489 | ||
490 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 490 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
491 | "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", | 491 | "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n", |
492 | obj_desc->bank_field.start_field_bit_offset, | 492 | obj_desc->bank_field.start_field_bit_offset, |
493 | obj_desc->bank_field.base_byte_offset, | 493 | obj_desc->bank_field.base_byte_offset, |
494 | obj_desc->field.access_byte_width, | 494 | obj_desc->field.access_byte_width, |
@@ -519,16 +519,29 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
519 | acpi_ut_add_reference(obj_desc->index_field.index_obj); | 519 | acpi_ut_add_reference(obj_desc->index_field.index_obj); |
520 | 520 | ||
521 | /* | 521 | /* |
522 | * April 2006: Changed to match MS behavior | ||
523 | * | ||
522 | * The value written to the Index register is the byte offset of the | 524 | * The value written to the Index register is the byte offset of the |
523 | * target field | 525 | * target field in units of the granularity of the index_field |
524 | * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position) | 526 | * |
527 | * Previously, the value was calculated as an index in terms of the | ||
528 | * width of the Data register, as below: | ||
529 | * | ||
530 | * obj_desc->index_field.Value = (u32) | ||
531 | * (Info->field_bit_position / ACPI_MUL_8 ( | ||
532 | * obj_desc->Field.access_byte_width)); | ||
533 | * | ||
534 | * February 2006: Tried value as a byte offset: | ||
535 | * obj_desc->index_field.Value = (u32) | ||
536 | * ACPI_DIV_8 (Info->field_bit_position); | ||
525 | */ | 537 | */ |
526 | obj_desc->index_field.value = (u32) | 538 | obj_desc->index_field.value = |
527 | (info->field_bit_position / | 539 | (u32) ACPI_ROUND_DOWN(ACPI_DIV_8(info->field_bit_position), |
528 | ACPI_MUL_8(obj_desc->field.access_byte_width)); | 540 | obj_desc->index_field. |
541 | access_byte_width); | ||
529 | 542 | ||
530 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 543 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
531 | "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", | 544 | "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", |
532 | obj_desc->index_field.start_field_bit_offset, | 545 | obj_desc->index_field.start_field_bit_offset, |
533 | obj_desc->index_field.base_byte_offset, | 546 | obj_desc->index_field.base_byte_offset, |
534 | obj_desc->index_field.value, | 547 | obj_desc->index_field.value, |
@@ -550,7 +563,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
550 | acpi_ns_get_type(info->field_node)); | 563 | acpi_ns_get_type(info->field_node)); |
551 | 564 | ||
552 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 565 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
553 | "Set named_obj %p [%4.4s], obj_desc %p\n", | 566 | "Set NamedObj %p [%4.4s], ObjDesc %p\n", |
554 | info->field_node, | 567 | info->field_node, |
555 | acpi_ut_get_node_name(info->field_node), obj_desc)); | 568 | acpi_ut_get_node_name(info->field_node), obj_desc)); |
556 | 569 | ||
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 6a4cfdff606d..3cc97ba48b36 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -81,7 +81,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
81 | u32 remainder; | 81 | u32 remainder; |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("ex_system_memory_space_handler"); | 84 | ACPI_FUNCTION_TRACE(ex_system_memory_space_handler); |
85 | 85 | ||
86 | /* Validate and translate the bit width */ | 86 | /* Validate and translate the bit width */ |
87 | 87 | ||
@@ -103,7 +103,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
103 | break; | 103 | break; |
104 | 104 | ||
105 | default: | 105 | default: |
106 | ACPI_ERROR((AE_INFO, "Invalid system_memory width %d", | 106 | ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d", |
107 | bit_width)); | 107 | bit_width)); |
108 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | 108 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
109 | } | 109 | } |
@@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
135 | * Delete the existing mapping and create a new one. | 135 | * Delete the existing mapping and create a new one. |
136 | */ | 136 | */ |
137 | if (mem_info->mapped_length) { | 137 | if (mem_info->mapped_length) { |
138 | |||
138 | /* Valid mapping, delete it */ | 139 | /* Valid mapping, delete it */ |
139 | 140 | ||
140 | acpi_os_unmap_memory(mem_info->mapped_logical_address, | 141 | acpi_os_unmap_memory(mem_info->mapped_logical_address, |
@@ -181,8 +182,8 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
181 | (acpi_integer) mem_info->mapped_physical_address); | 182 | (acpi_integer) mem_info->mapped_physical_address); |
182 | 183 | ||
183 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 184 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
184 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", | 185 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", |
185 | function, bit_width, ACPI_FORMAT_UINT64(address))); | 186 | bit_width, function, ACPI_FORMAT_UINT64(address))); |
186 | 187 | ||
187 | /* | 188 | /* |
188 | * Perform the memory read or write | 189 | * Perform the memory read or write |
@@ -283,11 +284,11 @@ acpi_ex_system_io_space_handler(u32 function, | |||
283 | acpi_status status = AE_OK; | 284 | acpi_status status = AE_OK; |
284 | u32 value32; | 285 | u32 value32; |
285 | 286 | ||
286 | ACPI_FUNCTION_TRACE("ex_system_io_space_handler"); | 287 | ACPI_FUNCTION_TRACE(ex_system_io_space_handler); |
287 | 288 | ||
288 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 289 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
289 | "system_iO %d (%d width) Address=%8.8X%8.8X\n", | 290 | "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", |
290 | function, bit_width, ACPI_FORMAT_UINT64(address))); | 291 | bit_width, function, ACPI_FORMAT_UINT64(address))); |
291 | 292 | ||
292 | /* Decode the function parameter */ | 293 | /* Decode the function parameter */ |
293 | 294 | ||
@@ -342,7 +343,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
342 | struct acpi_pci_id *pci_id; | 343 | struct acpi_pci_id *pci_id; |
343 | u16 pci_register; | 344 | u16 pci_register; |
344 | 345 | ||
345 | ACPI_FUNCTION_TRACE("ex_pci_config_space_handler"); | 346 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); |
346 | 347 | ||
347 | /* | 348 | /* |
348 | * The arguments to acpi_os(Read|Write)pci_configuration are: | 349 | * The arguments to acpi_os(Read|Write)pci_configuration are: |
@@ -360,7 +361,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
360 | pci_register = (u16) (u32) address; | 361 | pci_register = (u16) (u32) address; |
361 | 362 | ||
362 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 363 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
363 | "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", | 364 | "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", |
364 | function, bit_width, pci_id->segment, pci_id->bus, | 365 | function, bit_width, pci_id->segment, pci_id->bus, |
365 | pci_id->device, pci_id->function, pci_register)); | 366 | pci_id->device, pci_id->function, pci_register)); |
366 | 367 | ||
@@ -414,7 +415,7 @@ acpi_ex_cmos_space_handler(u32 function, | |||
414 | { | 415 | { |
415 | acpi_status status = AE_OK; | 416 | acpi_status status = AE_OK; |
416 | 417 | ||
417 | ACPI_FUNCTION_TRACE("ex_cmos_space_handler"); | 418 | ACPI_FUNCTION_TRACE(ex_cmos_space_handler); |
418 | 419 | ||
419 | return_ACPI_STATUS(status); | 420 | return_ACPI_STATUS(status); |
420 | } | 421 | } |
@@ -446,7 +447,7 @@ acpi_ex_pci_bar_space_handler(u32 function, | |||
446 | { | 447 | { |
447 | acpi_status status = AE_OK; | 448 | acpi_status status = AE_OK; |
448 | 449 | ||
449 | ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler"); | 450 | ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler); |
450 | 451 | ||
451 | return_ACPI_STATUS(status); | 452 | return_ACPI_STATUS(status); |
452 | } | 453 | } |
@@ -476,23 +477,16 @@ acpi_ex_data_table_space_handler(u32 function, | |||
476 | acpi_integer * value, | 477 | acpi_integer * value, |
477 | void *handler_context, void *region_context) | 478 | void *handler_context, void *region_context) |
478 | { | 479 | { |
479 | acpi_status status = AE_OK; | 480 | ACPI_FUNCTION_TRACE(ex_data_table_space_handler); |
480 | u32 byte_width = ACPI_DIV_8(bit_width); | ||
481 | u32 i; | ||
482 | char *logical_addr_ptr; | ||
483 | |||
484 | ACPI_FUNCTION_TRACE("ex_data_table_space_handler"); | ||
485 | |||
486 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address); | ||
487 | 481 | ||
488 | /* Perform the memory read or write */ | 482 | /* Perform the memory read or write */ |
489 | 483 | ||
490 | switch (function) { | 484 | switch (function) { |
491 | case ACPI_READ: | 485 | case ACPI_READ: |
492 | 486 | ||
493 | for (i = 0; i < byte_width; i++) { | 487 | ACPI_MEMCPY(ACPI_CAST_PTR(char, value), |
494 | ((char *)value)[i] = logical_addr_ptr[i]; | 488 | ACPI_PHYSADDR_TO_PTR(address), |
495 | } | 489 | ACPI_DIV_8(bit_width)); |
496 | break; | 490 | break; |
497 | 491 | ||
498 | case ACPI_WRITE: | 492 | case ACPI_WRITE: |
@@ -501,5 +495,5 @@ acpi_ex_data_table_space_handler(u32 function, | |||
501 | return_ACPI_STATUS(AE_SUPPORT); | 495 | return_ACPI_STATUS(AE_SUPPORT); |
502 | } | 496 | } |
503 | 497 | ||
504 | return_ACPI_STATUS(status); | 498 | return_ACPI_STATUS(AE_OK); |
505 | } | 499 | } |
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 01b26c80d22b..3089b05a1368 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -87,7 +87,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
87 | struct acpi_namespace_node *node; | 87 | struct acpi_namespace_node *node; |
88 | acpi_object_type entry_type; | 88 | acpi_object_type entry_type; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ex_resolve_node_to_value"); | 90 | ACPI_FUNCTION_TRACE(ex_resolve_node_to_value); |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * The stack pointer points to a struct acpi_namespace_node (Node). Get the | 93 | * The stack pointer points to a struct acpi_namespace_node (Node). Get the |
@@ -97,12 +97,13 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
97 | source_desc = acpi_ns_get_attached_object(node); | 97 | source_desc = acpi_ns_get_attached_object(node); |
98 | entry_type = acpi_ns_get_type((acpi_handle) node); | 98 | entry_type = acpi_ns_get_type((acpi_handle) node); |
99 | 99 | ||
100 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", | 100 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n", |
101 | node, source_desc, | 101 | node, source_desc, |
102 | acpi_ut_get_type_name(entry_type))); | 102 | acpi_ut_get_type_name(entry_type))); |
103 | 103 | ||
104 | if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || | 104 | if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || |
105 | (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { | 105 | (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { |
106 | |||
106 | /* There is always exactly one level of indirection */ | 107 | /* There is always exactly one level of indirection */ |
107 | 108 | ||
108 | node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); | 109 | node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); |
@@ -113,10 +114,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
113 | 114 | ||
114 | /* | 115 | /* |
115 | * Several object types require no further processing: | 116 | * Several object types require no further processing: |
116 | * 1) Devices rarely have an attached object, return the Node | 117 | * 1) Device/Thermal objects don't have a "real" subobject, return the Node |
117 | * 2) Method locals and arguments have a pseudo-Node | 118 | * 2) Method locals and arguments have a pseudo-Node |
118 | */ | 119 | */ |
119 | if (entry_type == ACPI_TYPE_DEVICE || | 120 | if ((entry_type == ACPI_TYPE_DEVICE) || |
121 | (entry_type == ACPI_TYPE_THERMAL) || | ||
120 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { | 122 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { |
121 | return_ACPI_STATUS(AE_OK); | 123 | return_ACPI_STATUS(AE_OK); |
122 | } | 124 | } |
@@ -141,6 +143,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
141 | 143 | ||
142 | status = acpi_ds_get_package_arguments(source_desc); | 144 | status = acpi_ds_get_package_arguments(source_desc); |
143 | if (ACPI_SUCCESS(status)) { | 145 | if (ACPI_SUCCESS(status)) { |
146 | |||
144 | /* Return an additional reference to the object */ | 147 | /* Return an additional reference to the object */ |
145 | 148 | ||
146 | obj_desc = source_desc; | 149 | obj_desc = source_desc; |
@@ -158,6 +161,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
158 | 161 | ||
159 | status = acpi_ds_get_buffer_arguments(source_desc); | 162 | status = acpi_ds_get_buffer_arguments(source_desc); |
160 | if (ACPI_SUCCESS(status)) { | 163 | if (ACPI_SUCCESS(status)) { |
164 | |||
161 | /* Return an additional reference to the object */ | 165 | /* Return an additional reference to the object */ |
162 | 166 | ||
163 | obj_desc = source_desc; | 167 | obj_desc = source_desc; |
@@ -199,7 +203,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
199 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 203 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
200 | 204 | ||
201 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
202 | "field_read Node=%p source_desc=%p Type=%X\n", | 206 | "FieldRead Node=%p SourceDesc=%p Type=%X\n", |
203 | node, source_desc, entry_type)); | 207 | node, source_desc, entry_type)); |
204 | 208 | ||
205 | status = | 209 | status = |
@@ -213,7 +217,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
213 | case ACPI_TYPE_METHOD: | 217 | case ACPI_TYPE_METHOD: |
214 | case ACPI_TYPE_POWER: | 218 | case ACPI_TYPE_POWER: |
215 | case ACPI_TYPE_PROCESSOR: | 219 | case ACPI_TYPE_PROCESSOR: |
216 | case ACPI_TYPE_THERMAL: | ||
217 | case ACPI_TYPE_EVENT: | 220 | case ACPI_TYPE_EVENT: |
218 | case ACPI_TYPE_REGION: | 221 | case ACPI_TYPE_REGION: |
219 | 222 | ||
@@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
240 | /* This is a ddb_handle */ | 243 | /* This is a ddb_handle */ |
241 | /* Return an additional reference to the object */ | 244 | /* Return an additional reference to the object */ |
242 | 245 | ||
246 | case AML_REF_OF_OP: | ||
247 | |||
243 | obj_desc = source_desc; | 248 | obj_desc = source_desc; |
244 | acpi_ut_add_reference(obj_desc); | 249 | acpi_ut_add_reference(obj_desc); |
245 | break; | 250 | break; |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 1deed492fe88..6499de878017 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -78,7 +78,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, | |||
78 | { | 78 | { |
79 | acpi_status status; | 79 | acpi_status status; |
80 | 80 | ||
81 | ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); | 81 | ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr); |
82 | 82 | ||
83 | if (!stack_ptr || !*stack_ptr) { | 83 | if (!stack_ptr || !*stack_ptr) { |
84 | ACPI_ERROR((AE_INFO, "Internal - null pointer")); | 84 | ACPI_ERROR((AE_INFO, "Internal - null pointer")); |
@@ -144,7 +144,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
144 | union acpi_operand_object *obj_desc; | 144 | union acpi_operand_object *obj_desc; |
145 | u16 opcode; | 145 | u16 opcode; |
146 | 146 | ||
147 | ACPI_FUNCTION_TRACE("ex_resolve_object_to_value"); | 147 | ACPI_FUNCTION_TRACE(ex_resolve_object_to_value); |
148 | 148 | ||
149 | stack_desc = *stack_ptr; | 149 | stack_desc = *stack_ptr; |
150 | 150 | ||
@@ -190,7 +190,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
190 | } | 190 | } |
191 | 191 | ||
192 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 192 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
193 | "[Arg/Local %X] value_obj is %p\n", | 193 | "[Arg/Local %X] ValueObj is %p\n", |
194 | stack_desc->reference.offset, | 194 | stack_desc->reference.offset, |
195 | obj_desc)); | 195 | obj_desc)); |
196 | 196 | ||
@@ -239,7 +239,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
239 | /* Invalid reference object */ | 239 | /* Invalid reference object */ |
240 | 240 | ||
241 | ACPI_ERROR((AE_INFO, | 241 | ACPI_ERROR((AE_INFO, |
242 | "Unknown target_type %X in Index/Reference obj %p", | 242 | "Unknown TargetType %X in Index/Reference obj %p", |
243 | stack_desc->reference.target_type, | 243 | stack_desc->reference.target_type, |
244 | stack_desc)); | 244 | stack_desc)); |
245 | status = AE_AML_INTERNAL; | 245 | status = AE_AML_INTERNAL; |
@@ -257,10 +257,24 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
257 | 257 | ||
258 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | 258 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ |
259 | 259 | ||
260 | /* Get the object pointed to by the namespace node */ | 260 | /* Dereference the name */ |
261 | |||
262 | if ((stack_desc->reference.node->type == | ||
263 | ACPI_TYPE_DEVICE) | ||
264 | || (stack_desc->reference.node->type == | ||
265 | ACPI_TYPE_THERMAL)) { | ||
266 | |||
267 | /* These node types do not have 'real' subobjects */ | ||
268 | |||
269 | *stack_ptr = (void *)stack_desc->reference.node; | ||
270 | } else { | ||
271 | /* Get the object pointed to by the namespace node */ | ||
272 | |||
273 | *stack_ptr = | ||
274 | (stack_desc->reference.node)->object; | ||
275 | acpi_ut_add_reference(*stack_ptr); | ||
276 | } | ||
261 | 277 | ||
262 | *stack_ptr = (stack_desc->reference.node)->object; | ||
263 | acpi_ut_add_reference(*stack_ptr); | ||
264 | acpi_ut_remove_reference(stack_desc); | 278 | acpi_ut_remove_reference(stack_desc); |
265 | break; | 279 | break; |
266 | 280 | ||
@@ -293,7 +307,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
293 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 307 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
294 | 308 | ||
295 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 309 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
296 | "field_read source_desc=%p Type=%X\n", | 310 | "FieldRead SourceDesc=%p Type=%X\n", |
297 | stack_desc, | 311 | stack_desc, |
298 | ACPI_GET_OBJECT_TYPE(stack_desc))); | 312 | ACPI_GET_OBJECT_TYPE(stack_desc))); |
299 | 313 | ||
@@ -337,7 +351,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
337 | acpi_object_type type; | 351 | acpi_object_type type; |
338 | acpi_status status; | 352 | acpi_status status; |
339 | 353 | ||
340 | ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple"); | 354 | ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple); |
341 | 355 | ||
342 | /* Operand can be either a namespace node or an operand descriptor */ | 356 | /* Operand can be either a namespace node or an operand descriptor */ |
343 | 357 | ||
@@ -382,10 +396,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
382 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { | 396 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { |
383 | switch (obj_desc->reference.opcode) { | 397 | switch (obj_desc->reference.opcode) { |
384 | case AML_REF_OF_OP: | 398 | case AML_REF_OF_OP: |
399 | case AML_INT_NAMEPATH_OP: | ||
385 | 400 | ||
386 | /* Dereference the reference pointer */ | 401 | /* Dereference the reference pointer */ |
387 | 402 | ||
388 | node = obj_desc->reference.object; | 403 | if (obj_desc->reference.opcode == AML_REF_OF_OP) { |
404 | node = obj_desc->reference.object; | ||
405 | } else { /* AML_INT_NAMEPATH_OP */ | ||
406 | |||
407 | node = obj_desc->reference.node; | ||
408 | } | ||
389 | 409 | ||
390 | /* All "References" point to a NS node */ | 410 | /* All "References" point to a NS node */ |
391 | 411 | ||
@@ -401,6 +421,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
401 | 421 | ||
402 | obj_desc = acpi_ns_get_attached_object(node); | 422 | obj_desc = acpi_ns_get_attached_object(node); |
403 | if (!obj_desc) { | 423 | if (!obj_desc) { |
424 | |||
404 | /* No object, use the NS node type */ | 425 | /* No object, use the NS node type */ |
405 | 426 | ||
406 | type = acpi_ns_get_type(node); | 427 | type = acpi_ns_get_type(node); |
@@ -432,6 +453,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
432 | */ | 453 | */ |
433 | obj_desc = *(obj_desc->reference.where); | 454 | obj_desc = *(obj_desc->reference.where); |
434 | if (!obj_desc) { | 455 | if (!obj_desc) { |
456 | |||
435 | /* NULL package elements are allowed */ | 457 | /* NULL package elements are allowed */ |
436 | 458 | ||
437 | type = 0; /* Uninitialized */ | 459 | type = 0; /* Uninitialized */ |
@@ -439,39 +461,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
439 | } | 461 | } |
440 | break; | 462 | break; |
441 | 463 | ||
442 | case AML_INT_NAMEPATH_OP: | ||
443 | |||
444 | /* Dereference the reference pointer */ | ||
445 | |||
446 | node = obj_desc->reference.node; | ||
447 | |||
448 | /* All "References" point to a NS node */ | ||
449 | |||
450 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != | ||
451 | ACPI_DESC_TYPE_NAMED) { | ||
452 | ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]", | ||
453 | node, | ||
454 | acpi_ut_get_descriptor_name(node))); | ||
455 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
456 | } | ||
457 | |||
458 | /* Get the attached object */ | ||
459 | |||
460 | obj_desc = acpi_ns_get_attached_object(node); | ||
461 | if (!obj_desc) { | ||
462 | /* No object, use the NS node type */ | ||
463 | |||
464 | type = acpi_ns_get_type(node); | ||
465 | goto exit; | ||
466 | } | ||
467 | |||
468 | /* Check for circular references */ | ||
469 | |||
470 | if (obj_desc == operand) { | ||
471 | return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); | ||
472 | } | ||
473 | break; | ||
474 | |||
475 | case AML_LOCAL_OP: | 464 | case AML_LOCAL_OP: |
476 | case AML_ARG_OP: | 465 | case AML_ARG_OP: |
477 | 466 | ||
@@ -513,7 +502,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
513 | 502 | ||
514 | case AML_DEBUG_OP: | 503 | case AML_DEBUG_OP: |
515 | 504 | ||
516 | /* The Debug Object is of type "debug_object" */ | 505 | /* The Debug Object is of type "DebugObject" */ |
517 | 506 | ||
518 | type = ACPI_TYPE_DEBUG_OBJECT; | 507 | type = ACPI_TYPE_DEBUG_OBJECT; |
519 | goto exit; | 508 | goto exit; |
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index a1c000f5a415..4c93d0972333 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed, | |||
77 | ACPI_FUNCTION_ENTRY(); | 77 | ACPI_FUNCTION_ENTRY(); |
78 | 78 | ||
79 | if (type_needed == ACPI_TYPE_ANY) { | 79 | if (type_needed == ACPI_TYPE_ANY) { |
80 | |||
80 | /* All types OK, so we don't perform any typechecks */ | 81 | /* All types OK, so we don't perform any typechecks */ |
81 | 82 | ||
82 | return (AE_OK); | 83 | return (AE_OK); |
@@ -143,7 +144,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
143 | acpi_object_type type_needed; | 144 | acpi_object_type type_needed; |
144 | u16 target_op = 0; | 145 | u16 target_op = 0; |
145 | 146 | ||
146 | ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); | 147 | ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode); |
147 | 148 | ||
148 | op_info = acpi_ps_get_opcode_info(opcode); | 149 | op_info = acpi_ps_get_opcode_info(opcode); |
149 | if (op_info->class == AML_CLASS_UNKNOWN) { | 150 | if (op_info->class == AML_CLASS_UNKNOWN) { |
@@ -158,7 +159,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
158 | } | 159 | } |
159 | 160 | ||
160 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
161 | "Opcode %X [%s] required_operand_types=%8.8X\n", | 162 | "Opcode %X [%s] RequiredOperandTypes=%8.8X\n", |
162 | opcode, op_info->name, arg_types)); | 163 | opcode, op_info->name, arg_types)); |
163 | 164 | ||
164 | /* | 165 | /* |
@@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
224 | } | 225 | } |
225 | 226 | ||
226 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 227 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
228 | |||
227 | /* Decode the Reference */ | 229 | /* Decode the Reference */ |
228 | 230 | ||
229 | op_info = acpi_ps_get_opcode_info(opcode); | 231 | op_info = acpi_ps_get_opcode_info(opcode); |
@@ -247,7 +249,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
247 | 249 | ||
248 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT | 250 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT |
249 | ((ACPI_DB_EXEC, | 251 | ((ACPI_DB_EXEC, |
250 | "Operand is a Reference, ref_opcode [%s]\n", | 252 | "Operand is a Reference, RefOpcode [%s]\n", |
251 | (acpi_ps_get_opcode_info | 253 | (acpi_ps_get_opcode_info |
252 | (obj_desc-> | 254 | (obj_desc-> |
253 | reference. | 255 | reference. |
@@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
332 | } | 334 | } |
333 | 335 | ||
334 | if (obj_desc->reference.opcode == AML_NAME_OP) { | 336 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
337 | |||
335 | /* Convert a named reference to the actual named object */ | 338 | /* Convert a named reference to the actual named object */ |
336 | 339 | ||
337 | temp_node = obj_desc->reference.object; | 340 | temp_node = obj_desc->reference.object; |
@@ -623,7 +626,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
623 | 626 | ||
624 | default: | 627 | default: |
625 | ACPI_ERROR((AE_INFO, | 628 | ACPI_ERROR((AE_INFO, |
626 | "Needed [Region/region_field], found [%s] %p", | 629 | "Needed [Region/RegionField], found [%s] %p", |
627 | acpi_ut_get_object_type_name | 630 | acpi_ut_get_object_type_name |
628 | (obj_desc), obj_desc)); | 631 | (obj_desc), obj_desc)); |
629 | 632 | ||
@@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
662 | } | 665 | } |
663 | 666 | ||
664 | if (target_op == AML_DEBUG_OP) { | 667 | if (target_op == AML_DEBUG_OP) { |
668 | |||
665 | /* Allow store of any object to the Debug object */ | 669 | /* Allow store of any object to the Debug object */ |
666 | 670 | ||
667 | break; | 671 | break; |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 3f020c0e2b95..0456405ba019 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -82,7 +82,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
82 | { | 82 | { |
83 | u32 i; | 83 | u32 i; |
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc); | 85 | ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); |
86 | 86 | ||
87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | 87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", |
88 | level, " ")); | 88 | level, " ")); |
@@ -245,7 +245,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
245 | acpi_status status = AE_OK; | 245 | acpi_status status = AE_OK; |
246 | union acpi_operand_object *ref_desc = dest_desc; | 246 | union acpi_operand_object *ref_desc = dest_desc; |
247 | 247 | ||
248 | ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc); | 248 | ACPI_FUNCTION_TRACE_PTR(ex_store, dest_desc); |
249 | 249 | ||
250 | /* Validate parameters */ | 250 | /* Validate parameters */ |
251 | 251 | ||
@@ -297,7 +297,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
297 | 297 | ||
298 | ACPI_DUMP_STACK_ENTRY(source_desc); | 298 | ACPI_DUMP_STACK_ENTRY(source_desc); |
299 | ACPI_DUMP_STACK_ENTRY(dest_desc); | 299 | ACPI_DUMP_STACK_ENTRY(dest_desc); |
300 | ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", | 300 | ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ExStore", |
301 | 2, | 301 | 2, |
302 | "Target is not a Reference or Constant object"); | 302 | "Target is not a Reference or Constant object"); |
303 | 303 | ||
@@ -396,7 +396,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
396 | u8 value = 0; | 396 | u8 value = 0; |
397 | u32 i; | 397 | u32 i; |
398 | 398 | ||
399 | ACPI_FUNCTION_TRACE("ex_store_object_to_index"); | 399 | ACPI_FUNCTION_TRACE(ex_store_object_to_index); |
400 | 400 | ||
401 | /* | 401 | /* |
402 | * Destination must be a reference pointer, and | 402 | * Destination must be a reference pointer, and |
@@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
423 | } | 423 | } |
424 | 424 | ||
425 | if (obj_desc) { | 425 | if (obj_desc) { |
426 | |||
426 | /* Decrement reference count by the ref count of the parent package */ | 427 | /* Decrement reference count by the ref count of the parent package */ |
427 | 428 | ||
428 | for (i = 0; i < ((union acpi_operand_object *) | 429 | for (i = 0; i < ((union acpi_operand_object *) |
@@ -502,8 +503,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
502 | break; | 503 | break; |
503 | 504 | ||
504 | default: | 505 | default: |
505 | ACPI_ERROR((AE_INFO, | 506 | ACPI_ERROR((AE_INFO, "Target is not a Package or BufferField")); |
506 | "Target is not a Package or buffer_field")); | ||
507 | status = AE_AML_OPERAND_TYPE; | 507 | status = AE_AML_OPERAND_TYPE; |
508 | break; | 508 | break; |
509 | } | 509 | } |
@@ -548,7 +548,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
548 | union acpi_operand_object *new_desc; | 548 | union acpi_operand_object *new_desc; |
549 | acpi_object_type target_type; | 549 | acpi_object_type target_type; |
550 | 550 | ||
551 | ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc); | 551 | ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_node, source_desc); |
552 | 552 | ||
553 | /* Get current type of the node, and object attached to Node */ | 553 | /* Get current type of the node, and object attached to Node */ |
554 | 554 | ||
@@ -572,6 +572,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
572 | /* If no implicit conversion, drop into the default case below */ | 572 | /* If no implicit conversion, drop into the default case below */ |
573 | 573 | ||
574 | if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { | 574 | if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { |
575 | |||
575 | /* Force execution of default (no implicit conversion) */ | 576 | /* Force execution of default (no implicit conversion) */ |
576 | 577 | ||
577 | target_type = ACPI_TYPE_ANY; | 578 | target_type = ACPI_TYPE_ANY; |
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 42967baf760d..591aaf0e18b3 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -72,7 +72,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
72 | union acpi_operand_object *source_desc = *source_desc_ptr; | 72 | union acpi_operand_object *source_desc = *source_desc_ptr; |
73 | acpi_status status = AE_OK; | 73 | acpi_status status = AE_OK; |
74 | 74 | ||
75 | ACPI_FUNCTION_TRACE("ex_resolve_object"); | 75 | ACPI_FUNCTION_TRACE(ex_resolve_object); |
76 | 76 | ||
77 | /* Ensure we have a Target that can be stored to */ | 77 | /* Ensure we have a Target that can be stored to */ |
78 | 78 | ||
@@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
97 | */ | 97 | */ |
98 | if (ACPI_GET_OBJECT_TYPE(source_desc) == | 98 | if (ACPI_GET_OBJECT_TYPE(source_desc) == |
99 | ACPI_TYPE_LOCAL_REFERENCE) { | 99 | ACPI_TYPE_LOCAL_REFERENCE) { |
100 | |||
100 | /* Resolve a reference object first */ | 101 | /* Resolve a reference object first */ |
101 | 102 | ||
102 | status = | 103 | status = |
@@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
121 | !((ACPI_GET_OBJECT_TYPE(source_desc) == | 122 | !((ACPI_GET_OBJECT_TYPE(source_desc) == |
122 | ACPI_TYPE_LOCAL_REFERENCE) | 123 | ACPI_TYPE_LOCAL_REFERENCE) |
123 | && (source_desc->reference.opcode == AML_LOAD_OP))) { | 124 | && (source_desc->reference.opcode == AML_LOAD_OP))) { |
125 | |||
124 | /* Conversion successful but still not a valid type */ | 126 | /* Conversion successful but still not a valid type */ |
125 | 127 | ||
126 | ACPI_ERROR((AE_INFO, | 128 | ACPI_ERROR((AE_INFO, |
@@ -199,7 +201,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | |||
199 | union acpi_operand_object *actual_src_desc; | 201 | union acpi_operand_object *actual_src_desc; |
200 | acpi_status status = AE_OK; | 202 | acpi_status status = AE_OK; |
201 | 203 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc); | 204 | ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_object, source_desc); |
203 | 205 | ||
204 | actual_src_desc = source_desc; | 206 | actual_src_desc = source_desc; |
205 | if (!dest_desc) { | 207 | if (!dest_desc) { |
@@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | |||
289 | } | 291 | } |
290 | 292 | ||
291 | if (actual_src_desc != source_desc) { | 293 | if (actual_src_desc != source_desc) { |
294 | |||
292 | /* Delete the intermediate (temporary) source object */ | 295 | /* Delete the intermediate (temporary) source object */ |
293 | 296 | ||
294 | acpi_ut_remove_reference(actual_src_desc); | 297 | acpi_ut_remove_reference(actual_src_desc); |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 6ab707087750..99ebe5adfcda 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -67,7 +67,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
67 | u32 length; | 67 | u32 length; |
68 | u8 *buffer; | 68 | u8 *buffer; |
69 | 69 | ||
70 | ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc); | 70 | ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc); |
71 | 71 | ||
72 | /* We know that source_desc is a buffer by now */ | 72 | /* We know that source_desc is a buffer by now */ |
73 | 73 | ||
@@ -80,7 +80,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
80 | */ | 80 | */ |
81 | if ((target_desc->buffer.length == 0) || | 81 | if ((target_desc->buffer.length == 0) || |
82 | (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { | 82 | (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { |
83 | target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); | 83 | target_desc->buffer.pointer = ACPI_ALLOCATE(length); |
84 | if (!target_desc->buffer.pointer) { | 84 | if (!target_desc->buffer.pointer) { |
85 | return_ACPI_STATUS(AE_NO_MEMORY); | 85 | return_ACPI_STATUS(AE_NO_MEMORY); |
86 | } | 86 | } |
@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
91 | /* Copy source buffer to target buffer */ | 91 | /* Copy source buffer to target buffer */ |
92 | 92 | ||
93 | if (length <= target_desc->buffer.length) { | 93 | if (length <= target_desc->buffer.length) { |
94 | |||
94 | /* Clear existing buffer and copy in the new one */ | 95 | /* Clear existing buffer and copy in the new one */ |
95 | 96 | ||
96 | ACPI_MEMSET(target_desc->buffer.pointer, 0, | 97 | ACPI_MEMSET(target_desc->buffer.pointer, 0, |
@@ -102,7 +103,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
102 | * NOTE: ACPI versions up to 3.0 specified that the buffer must be | 103 | * NOTE: ACPI versions up to 3.0 specified that the buffer must be |
103 | * truncated if the string is smaller than the buffer. However, "other" | 104 | * truncated if the string is smaller than the buffer. However, "other" |
104 | * implementations of ACPI never did this and thus became the defacto | 105 | * implementations of ACPI never did this and thus became the defacto |
105 | * standard. ACPi 3.0_a changes this behavior such that the buffer | 106 | * standard. ACPI 3.0_a changes this behavior such that the buffer |
106 | * is no longer truncated. | 107 | * is no longer truncated. |
107 | */ | 108 | */ |
108 | 109 | ||
@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
113 | * copy must not truncate the original buffer. | 114 | * copy must not truncate the original buffer. |
114 | */ | 115 | */ |
115 | if (original_src_type == ACPI_TYPE_STRING) { | 116 | if (original_src_type == ACPI_TYPE_STRING) { |
117 | |||
116 | /* Set the new length of the target */ | 118 | /* Set the new length of the target */ |
117 | 119 | ||
118 | target_desc->buffer.length = length; | 120 | target_desc->buffer.length = length; |
@@ -156,7 +158,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
156 | u32 length; | 158 | u32 length; |
157 | u8 *buffer; | 159 | u8 *buffer; |
158 | 160 | ||
159 | ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc); | 161 | ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc); |
160 | 162 | ||
161 | /* We know that source_desc is a string by now */ | 163 | /* We know that source_desc is a string by now */ |
162 | 164 | ||
@@ -183,13 +185,14 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
183 | */ | 185 | */ |
184 | if (target_desc->string.pointer && | 186 | if (target_desc->string.pointer && |
185 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { | 187 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { |
188 | |||
186 | /* Only free if not a pointer into the DSDT */ | 189 | /* Only free if not a pointer into the DSDT */ |
187 | 190 | ||
188 | ACPI_MEM_FREE(target_desc->string.pointer); | 191 | ACPI_FREE(target_desc->string.pointer); |
189 | } | 192 | } |
190 | 193 | ||
191 | target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) | 194 | target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size) |
192 | length + 1); | 195 | length + 1); |
193 | if (!target_desc->string.pointer) { | 196 | if (!target_desc->string.pointer) { |
194 | return_ACPI_STATUS(AE_NO_MEMORY); | 197 | return_ACPI_STATUS(AE_NO_MEMORY); |
195 | } | 198 | } |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index ea9144f42e1f..52beee3674a0 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -68,7 +68,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
68 | acpi_status status; | 68 | acpi_status status; |
69 | acpi_status status2; | 69 | acpi_status status2; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ex_system_wait_semaphore"); | 71 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); |
72 | 72 | ||
73 | status = acpi_os_wait_semaphore(semaphore, 1, 0); | 73 | status = acpi_os_wait_semaphore(semaphore, 1, 0); |
74 | if (ACPI_SUCCESS(status)) { | 74 | if (ACPI_SUCCESS(status)) { |
@@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | if (status == AE_TIME) { | 78 | if (status == AE_TIME) { |
79 | |||
79 | /* We must wait, so unlock the interpreter */ | 80 | /* We must wait, so unlock the interpreter */ |
80 | 81 | ||
81 | acpi_ex_exit_interpreter(); | 82 | acpi_ex_exit_interpreter(); |
@@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
90 | 91 | ||
91 | status2 = acpi_ex_enter_interpreter(); | 92 | status2 = acpi_ex_enter_interpreter(); |
92 | if (ACPI_FAILURE(status2)) { | 93 | if (ACPI_FAILURE(status2)) { |
94 | |||
93 | /* Report fatal error, could not acquire interpreter */ | 95 | /* Report fatal error, could not acquire interpreter */ |
94 | 96 | ||
95 | return_ACPI_STATUS(status2); | 97 | return_ACPI_STATUS(status2); |
@@ -191,7 +193,7 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, | |||
191 | { | 193 | { |
192 | acpi_status status = AE_OK; | 194 | acpi_status status = AE_OK; |
193 | 195 | ||
194 | ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc); | 196 | ACPI_FUNCTION_TRACE_PTR(ex_system_acquire_mutex, obj_desc); |
195 | 197 | ||
196 | if (!obj_desc) { | 198 | if (!obj_desc) { |
197 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 199 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -229,7 +231,7 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) | |||
229 | { | 231 | { |
230 | acpi_status status = AE_OK; | 232 | acpi_status status = AE_OK; |
231 | 233 | ||
232 | ACPI_FUNCTION_TRACE("ex_system_release_mutex"); | 234 | ACPI_FUNCTION_TRACE(ex_system_release_mutex); |
233 | 235 | ||
234 | if (!obj_desc) { | 236 | if (!obj_desc) { |
235 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 237 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -263,7 +265,7 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) | |||
263 | { | 265 | { |
264 | acpi_status status = AE_OK; | 266 | acpi_status status = AE_OK; |
265 | 267 | ||
266 | ACPI_FUNCTION_TRACE("ex_system_signal_event"); | 268 | ACPI_FUNCTION_TRACE(ex_system_signal_event); |
267 | 269 | ||
268 | if (obj_desc) { | 270 | if (obj_desc) { |
269 | status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); | 271 | status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); |
@@ -293,7 +295,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, | |||
293 | { | 295 | { |
294 | acpi_status status = AE_OK; | 296 | acpi_status status = AE_OK; |
295 | 297 | ||
296 | ACPI_FUNCTION_TRACE("ex_system_wait_event"); | 298 | ACPI_FUNCTION_TRACE(ex_system_wait_event); |
297 | 299 | ||
298 | if (obj_desc) { | 300 | if (obj_desc) { |
299 | status = | 301 | status = |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index f73a61aeb7ec..982c8b65876f 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -87,9 +87,9 @@ acpi_status acpi_ex_enter_interpreter(void) | |||
87 | { | 87 | { |
88 | acpi_status status; | 88 | acpi_status status; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ex_enter_interpreter"); | 90 | ACPI_FUNCTION_TRACE(ex_enter_interpreter); |
91 | 91 | ||
92 | status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); | 92 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); |
93 | if (ACPI_FAILURE(status)) { | 93 | if (ACPI_FAILURE(status)) { |
94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); | 94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); |
95 | } | 95 | } |
@@ -123,9 +123,9 @@ void acpi_ex_exit_interpreter(void) | |||
123 | { | 123 | { |
124 | acpi_status status; | 124 | acpi_status status; |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ex_exit_interpreter"); | 126 | ACPI_FUNCTION_TRACE(ex_exit_interpreter); |
127 | 127 | ||
128 | status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); | 128 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); |
129 | if (ACPI_FAILURE(status)) { | 129 | if (ACPI_FAILURE(status)) { |
130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); | 130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); |
131 | } | 131 | } |
@@ -189,11 +189,12 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) | |||
189 | u8 locked = FALSE; | 189 | u8 locked = FALSE; |
190 | acpi_status status; | 190 | acpi_status status; |
191 | 191 | ||
192 | ACPI_FUNCTION_TRACE("ex_acquire_global_lock"); | 192 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); |
193 | 193 | ||
194 | /* Only attempt lock if the always_lock bit is set */ | 194 | /* Only attempt lock if the always_lock bit is set */ |
195 | 195 | ||
196 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { | 196 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { |
197 | |||
197 | /* We should attempt to get the lock, wait forever */ | 198 | /* We should attempt to get the lock, wait forever */ |
198 | 199 | ||
199 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); | 200 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); |
@@ -225,15 +226,17 @@ void acpi_ex_release_global_lock(u8 locked_by_me) | |||
225 | { | 226 | { |
226 | acpi_status status; | 227 | acpi_status status; |
227 | 228 | ||
228 | ACPI_FUNCTION_TRACE("ex_release_global_lock"); | 229 | ACPI_FUNCTION_TRACE(ex_release_global_lock); |
229 | 230 | ||
230 | /* Only attempt unlock if the caller locked it */ | 231 | /* Only attempt unlock if the caller locked it */ |
231 | 232 | ||
232 | if (locked_by_me) { | 233 | if (locked_by_me) { |
234 | |||
233 | /* OK, now release the lock */ | 235 | /* OK, now release the lock */ |
234 | 236 | ||
235 | status = acpi_ev_release_global_lock(); | 237 | status = acpi_ev_release_global_lock(); |
236 | if (ACPI_FAILURE(status)) { | 238 | if (ACPI_FAILURE(status)) { |
239 | |||
237 | /* Report the error, but there isn't much else we can do */ | 240 | /* Report the error, but there isn't much else we can do */ |
238 | 241 | ||
239 | ACPI_EXCEPTION((AE_INFO, status, | 242 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -263,7 +266,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
263 | u32 num_digits; | 266 | u32 num_digits; |
264 | acpi_integer current_value; | 267 | acpi_integer current_value; |
265 | 268 | ||
266 | ACPI_FUNCTION_TRACE("ex_digits_needed"); | 269 | ACPI_FUNCTION_TRACE(ex_digits_needed); |
267 | 270 | ||
268 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ | 271 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ |
269 | 272 | ||
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index ea2f13271ff1..de50fab2a910 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -63,7 +63,7 @@ acpi_status acpi_hw_initialize(void) | |||
63 | { | 63 | { |
64 | acpi_status status; | 64 | acpi_status status; |
65 | 65 | ||
66 | ACPI_FUNCTION_TRACE("hw_initialize"); | 66 | ACPI_FUNCTION_TRACE(hw_initialize); |
67 | 67 | ||
68 | /* We must have the ACPI tables by the time we get here */ | 68 | /* We must have the ACPI tables by the time we get here */ |
69 | 69 | ||
@@ -100,7 +100,7 @@ acpi_status acpi_hw_set_mode(u32 mode) | |||
100 | acpi_status status; | 100 | acpi_status status; |
101 | u32 retry; | 101 | u32 retry; |
102 | 102 | ||
103 | ACPI_FUNCTION_TRACE("hw_set_mode"); | 103 | ACPI_FUNCTION_TRACE(hw_set_mode); |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 106 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
@@ -198,7 +198,7 @@ u32 acpi_hw_get_mode(void) | |||
198 | acpi_status status; | 198 | acpi_status status; |
199 | u32 value; | 199 | u32 value; |
200 | 200 | ||
201 | ACPI_FUNCTION_TRACE("hw_get_mode"); | 201 | ACPI_FUNCTION_TRACE(hw_get_mode); |
202 | 202 | ||
203 | /* | 203 | /* |
204 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 204 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index d84942d22dd5..608a3a60ee11 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c | |||
@@ -214,6 +214,7 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
214 | /* Examine each GPE Register within the block */ | 214 | /* Examine each GPE Register within the block */ |
215 | 215 | ||
216 | for (i = 0; i < gpe_block->register_count; i++) { | 216 | for (i = 0; i < gpe_block->register_count; i++) { |
217 | |||
217 | /* Disable all GPEs in this register */ | 218 | /* Disable all GPEs in this register */ |
218 | 219 | ||
219 | status = acpi_hw_low_level_write(8, 0x00, | 220 | status = acpi_hw_low_level_write(8, 0x00, |
@@ -250,6 +251,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
250 | /* Examine each GPE Register within the block */ | 251 | /* Examine each GPE Register within the block */ |
251 | 252 | ||
252 | for (i = 0; i < gpe_block->register_count; i++) { | 253 | for (i = 0; i < gpe_block->register_count; i++) { |
254 | |||
253 | /* Clear status on all GPEs in this register */ | 255 | /* Clear status on all GPEs in this register */ |
254 | 256 | ||
255 | status = acpi_hw_low_level_write(8, 0xFF, | 257 | status = acpi_hw_low_level_write(8, 0xFF, |
@@ -368,7 +370,7 @@ acpi_status acpi_hw_disable_all_gpes(void) | |||
368 | { | 370 | { |
369 | acpi_status status; | 371 | acpi_status status; |
370 | 372 | ||
371 | ACPI_FUNCTION_TRACE("hw_disable_all_gpes"); | 373 | ACPI_FUNCTION_TRACE(hw_disable_all_gpes); |
372 | 374 | ||
373 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); | 375 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); |
374 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 376 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); |
@@ -391,7 +393,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void) | |||
391 | { | 393 | { |
392 | acpi_status status; | 394 | acpi_status status; |
393 | 395 | ||
394 | ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes"); | 396 | ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); |
395 | 397 | ||
396 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); | 398 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); |
397 | return_ACPI_STATUS(status); | 399 | return_ACPI_STATUS(status); |
@@ -413,7 +415,7 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void) | |||
413 | { | 415 | { |
414 | acpi_status status; | 416 | acpi_status status; |
415 | 417 | ||
416 | ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes"); | 418 | ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); |
417 | 419 | ||
418 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); | 420 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); |
419 | return_ACPI_STATUS(status); | 421 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index e1fe75498415..ae142de19507 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -43,8 +43,6 @@ | |||
43 | * POSSIBILITY OF SUCH DAMAGES. | 43 | * POSSIBILITY OF SUCH DAMAGES. |
44 | */ | 44 | */ |
45 | 45 | ||
46 | #include <linux/module.h> | ||
47 | |||
48 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
49 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
50 | #include <acpi/acevents.h> | 48 | #include <acpi/acevents.h> |
@@ -63,23 +61,21 @@ ACPI_MODULE_NAME("hwregs") | |||
63 | * DESCRIPTION: Clears all fixed and general purpose status bits | 61 | * DESCRIPTION: Clears all fixed and general purpose status bits |
64 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 62 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
65 | * | 63 | * |
64 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
65 | * | ||
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | acpi_status acpi_hw_clear_acpi_status(u32 flags) | 67 | acpi_status acpi_hw_clear_acpi_status(u32 flags) |
68 | { | 68 | { |
69 | acpi_status status; | 69 | acpi_status status; |
70 | acpi_cpu_flags lock_flags = 0; | ||
70 | 71 | ||
71 | ACPI_FUNCTION_TRACE("hw_clear_acpi_status"); | 72 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); |
72 | 73 | ||
73 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", | 74 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", |
74 | ACPI_BITMASK_ALL_FIXED_STATUS, | 75 | ACPI_BITMASK_ALL_FIXED_STATUS, |
75 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); | 76 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); |
76 | 77 | ||
77 | if (flags & ACPI_MTX_LOCK) { | 78 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
78 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
79 | if (ACPI_FAILURE(status)) { | ||
80 | return_ACPI_STATUS(status); | ||
81 | } | ||
82 | } | ||
83 | 79 | ||
84 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, | 80 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, |
85 | ACPI_REGISTER_PM1_STATUS, | 81 | ACPI_REGISTER_PM1_STATUS, |
@@ -104,9 +100,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags) | |||
104 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 100 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); |
105 | 101 | ||
106 | unlock_and_exit: | 102 | unlock_and_exit: |
107 | if (flags & ACPI_MTX_LOCK) { | 103 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
108 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
109 | } | ||
110 | return_ACPI_STATUS(status); | 104 | return_ACPI_STATUS(status); |
111 | } | 105 | } |
112 | 106 | ||
@@ -129,10 +123,9 @@ acpi_status | |||
129 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | 123 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) |
130 | { | 124 | { |
131 | acpi_status status = AE_OK; | 125 | acpi_status status = AE_OK; |
132 | struct acpi_parameter_info info; | 126 | struct acpi_evaluate_info *info; |
133 | char *sleep_state_name; | ||
134 | 127 | ||
135 | ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data"); | 128 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); |
136 | 129 | ||
137 | /* Validate parameters */ | 130 | /* Validate parameters */ |
138 | 131 | ||
@@ -140,34 +133,39 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
140 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 133 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
141 | } | 134 | } |
142 | 135 | ||
143 | /* Evaluate the namespace object containing the values for this state */ | 136 | /* Allocate the evaluation information block */ |
137 | |||
138 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
139 | if (!info) { | ||
140 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
141 | } | ||
144 | 142 | ||
145 | info.parameters = NULL; | 143 | info->pathname = |
146 | info.return_object = NULL; | ||
147 | sleep_state_name = | ||
148 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | 144 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); |
149 | 145 | ||
150 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); | 146 | /* Evaluate the namespace object containing the values for this state */ |
147 | |||
148 | status = acpi_ns_evaluate(info); | ||
151 | if (ACPI_FAILURE(status)) { | 149 | if (ACPI_FAILURE(status)) { |
152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 150 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
153 | "%s while evaluating sleep_state [%s]\n", | 151 | "%s while evaluating SleepState [%s]\n", |
154 | acpi_format_exception(status), | 152 | acpi_format_exception(status), |
155 | sleep_state_name)); | 153 | info->pathname)); |
156 | 154 | ||
157 | return_ACPI_STATUS(status); | 155 | goto cleanup; |
158 | } | 156 | } |
159 | 157 | ||
160 | /* Must have a return object */ | 158 | /* Must have a return object */ |
161 | 159 | ||
162 | if (!info.return_object) { | 160 | if (!info->return_object) { |
163 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", | 161 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", |
164 | sleep_state_name)); | 162 | info->pathname)); |
165 | status = AE_NOT_EXIST; | 163 | status = AE_NOT_EXIST; |
166 | } | 164 | } |
167 | 165 | ||
168 | /* It must be of type Package */ | 166 | /* It must be of type Package */ |
169 | 167 | ||
170 | else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) { | 168 | else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { |
171 | ACPI_ERROR((AE_INFO, | 169 | ACPI_ERROR((AE_INFO, |
172 | "Sleep State return object is not a Package")); | 170 | "Sleep State return object is not a Package")); |
173 | status = AE_AML_OPERAND_TYPE; | 171 | status = AE_AML_OPERAND_TYPE; |
@@ -180,7 +178,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
180 | * by BIOS vendors seems to be to have 2 or more elements, at least | 178 | * by BIOS vendors seems to be to have 2 or more elements, at least |
181 | * one per sleep type (A/B). | 179 | * one per sleep type (A/B). |
182 | */ | 180 | */ |
183 | else if (info.return_object->package.count < 2) { | 181 | else if (info->return_object->package.count < 2) { |
184 | ACPI_ERROR((AE_INFO, | 182 | ACPI_ERROR((AE_INFO, |
185 | "Sleep State return package does not have at least two elements")); | 183 | "Sleep State return package does not have at least two elements")); |
186 | status = AE_AML_NO_OPERAND; | 184 | status = AE_AML_NO_OPERAND; |
@@ -188,39 +186,42 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
188 | 186 | ||
189 | /* The first two elements must both be of type Integer */ | 187 | /* The first two elements must both be of type Integer */ |
190 | 188 | ||
191 | else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0]) | 189 | else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) |
192 | != ACPI_TYPE_INTEGER) || | 190 | != ACPI_TYPE_INTEGER) || |
193 | (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) | 191 | (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) |
194 | != ACPI_TYPE_INTEGER)) { | 192 | != ACPI_TYPE_INTEGER)) { |
195 | ACPI_ERROR((AE_INFO, | 193 | ACPI_ERROR((AE_INFO, |
196 | "Sleep State return package elements are not both Integers (%s, %s)", | 194 | "Sleep State return package elements are not both Integers (%s, %s)", |
197 | acpi_ut_get_object_type_name(info.return_object-> | 195 | acpi_ut_get_object_type_name(info->return_object-> |
198 | package.elements[0]), | 196 | package.elements[0]), |
199 | acpi_ut_get_object_type_name(info.return_object-> | 197 | acpi_ut_get_object_type_name(info->return_object-> |
200 | package.elements[1]))); | 198 | package.elements[1]))); |
201 | status = AE_AML_OPERAND_TYPE; | 199 | status = AE_AML_OPERAND_TYPE; |
202 | } else { | 200 | } else { |
203 | /* Valid _Sx_ package size, type, and value */ | 201 | /* Valid _Sx_ package size, type, and value */ |
204 | 202 | ||
205 | *sleep_type_a = (u8) | 203 | *sleep_type_a = (u8) |
206 | (info.return_object->package.elements[0])->integer.value; | 204 | (info->return_object->package.elements[0])->integer.value; |
207 | *sleep_type_b = (u8) | 205 | *sleep_type_b = (u8) |
208 | (info.return_object->package.elements[1])->integer.value; | 206 | (info->return_object->package.elements[1])->integer.value; |
209 | } | 207 | } |
210 | 208 | ||
211 | if (ACPI_FAILURE(status)) { | 209 | if (ACPI_FAILURE(status)) { |
212 | ACPI_EXCEPTION((AE_INFO, status, | 210 | ACPI_EXCEPTION((AE_INFO, status, |
213 | "While evaluating sleep_state [%s], bad Sleep object %p type %s", | 211 | "While evaluating SleepState [%s], bad Sleep object %p type %s", |
214 | sleep_state_name, info.return_object, | 212 | info->pathname, info->return_object, |
215 | acpi_ut_get_object_type_name(info. | 213 | acpi_ut_get_object_type_name(info-> |
216 | return_object))); | 214 | return_object))); |
217 | } | 215 | } |
218 | 216 | ||
219 | acpi_ut_remove_reference(info.return_object); | 217 | acpi_ut_remove_reference(info->return_object); |
218 | |||
219 | cleanup: | ||
220 | ACPI_FREE(info); | ||
220 | return_ACPI_STATUS(status); | 221 | return_ACPI_STATUS(status); |
221 | } | 222 | } |
222 | 223 | ||
223 | EXPORT_SYMBOL(acpi_get_sleep_type_data); | 224 | ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) |
224 | 225 | ||
225 | /******************************************************************************* | 226 | /******************************************************************************* |
226 | * | 227 | * |
@@ -233,13 +234,12 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); | |||
233 | * DESCRIPTION: Map register_id into a register bitmask. | 234 | * DESCRIPTION: Map register_id into a register bitmask. |
234 | * | 235 | * |
235 | ******************************************************************************/ | 236 | ******************************************************************************/ |
236 | |||
237 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | 237 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) |
238 | { | 238 | { |
239 | ACPI_FUNCTION_ENTRY(); | 239 | ACPI_FUNCTION_ENTRY(); |
240 | 240 | ||
241 | if (register_id > ACPI_BITREG_MAX) { | 241 | if (register_id > ACPI_BITREG_MAX) { |
242 | ACPI_ERROR((AE_INFO, "Invalid bit_register ID: %X", | 242 | ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X", |
243 | register_id)); | 243 | register_id)); |
244 | return (NULL); | 244 | return (NULL); |
245 | } | 245 | } |
@@ -260,6 +260,8 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | |||
260 | * | 260 | * |
261 | * DESCRIPTION: ACPI bit_register read function. | 261 | * DESCRIPTION: ACPI bit_register read function. |
262 | * | 262 | * |
263 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
264 | * | ||
263 | ******************************************************************************/ | 265 | ******************************************************************************/ |
264 | 266 | ||
265 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | 267 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) |
@@ -268,7 +270,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
268 | struct acpi_bit_register_info *bit_reg_info; | 270 | struct acpi_bit_register_info *bit_reg_info; |
269 | acpi_status status; | 271 | acpi_status status; |
270 | 272 | ||
271 | ACPI_FUNCTION_TRACE("acpi_get_register"); | 273 | ACPI_FUNCTION_TRACE(acpi_get_register); |
272 | 274 | ||
273 | /* Get the info structure corresponding to the requested ACPI Register */ | 275 | /* Get the info structure corresponding to the requested ACPI Register */ |
274 | 276 | ||
@@ -277,24 +279,14 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
277 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 279 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
278 | } | 280 | } |
279 | 281 | ||
280 | if (flags & ACPI_MTX_LOCK) { | ||
281 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
282 | if (ACPI_FAILURE(status)) { | ||
283 | return_ACPI_STATUS(status); | ||
284 | } | ||
285 | } | ||
286 | |||
287 | /* Read from the register */ | 282 | /* Read from the register */ |
288 | 283 | ||
289 | status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, | 284 | status = acpi_hw_register_read(ACPI_MTX_LOCK, |
290 | bit_reg_info->parent_register, | 285 | bit_reg_info->parent_register, |
291 | ®ister_value); | 286 | ®ister_value); |
292 | 287 | ||
293 | if (flags & ACPI_MTX_LOCK) { | ||
294 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
295 | } | ||
296 | |||
297 | if (ACPI_SUCCESS(status)) { | 288 | if (ACPI_SUCCESS(status)) { |
289 | |||
298 | /* Normalize the value that was read */ | 290 | /* Normalize the value that was read */ |
299 | 291 | ||
300 | register_value = | 292 | register_value = |
@@ -311,7 +303,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
311 | return_ACPI_STATUS(status); | 303 | return_ACPI_STATUS(status); |
312 | } | 304 | } |
313 | 305 | ||
314 | EXPORT_SYMBOL(acpi_get_register); | 306 | ACPI_EXPORT_SYMBOL(acpi_get_register) |
315 | 307 | ||
316 | /******************************************************************************* | 308 | /******************************************************************************* |
317 | * | 309 | * |
@@ -326,31 +318,28 @@ EXPORT_SYMBOL(acpi_get_register); | |||
326 | * | 318 | * |
327 | * DESCRIPTION: ACPI Bit Register write function. | 319 | * DESCRIPTION: ACPI Bit Register write function. |
328 | * | 320 | * |
321 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
322 | * | ||
329 | ******************************************************************************/ | 323 | ******************************************************************************/ |
330 | |||
331 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | 324 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) |
332 | { | 325 | { |
333 | u32 register_value = 0; | 326 | u32 register_value = 0; |
334 | struct acpi_bit_register_info *bit_reg_info; | 327 | struct acpi_bit_register_info *bit_reg_info; |
335 | acpi_status status; | 328 | acpi_status status; |
329 | acpi_cpu_flags lock_flags; | ||
336 | 330 | ||
337 | ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id); | 331 | ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); |
338 | 332 | ||
339 | /* Get the info structure corresponding to the requested ACPI Register */ | 333 | /* Get the info structure corresponding to the requested ACPI Register */ |
340 | 334 | ||
341 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); | 335 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); |
342 | if (!bit_reg_info) { | 336 | if (!bit_reg_info) { |
343 | ACPI_ERROR((AE_INFO, "Bad ACPI HW register_id: %X", | 337 | ACPI_ERROR((AE_INFO, "Bad ACPI HW RegisterId: %X", |
344 | register_id)); | 338 | register_id)); |
345 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 339 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
346 | } | 340 | } |
347 | 341 | ||
348 | if (flags & ACPI_MTX_LOCK) { | 342 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
349 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
350 | if (ACPI_FAILURE(status)) { | ||
351 | return_ACPI_STATUS(status); | ||
352 | } | ||
353 | } | ||
354 | 343 | ||
355 | /* Always do a register read first so we can insert the new bits */ | 344 | /* Always do a register read first so we can insert the new bits */ |
356 | 345 | ||
@@ -458,9 +447,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | |||
458 | 447 | ||
459 | unlock_and_exit: | 448 | unlock_and_exit: |
460 | 449 | ||
461 | if (flags & ACPI_MTX_LOCK) { | 450 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
462 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
463 | } | ||
464 | 451 | ||
465 | /* Normalize the value that was read */ | 452 | /* Normalize the value that was read */ |
466 | 453 | ||
@@ -474,7 +461,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | |||
474 | return_ACPI_STATUS(status); | 461 | return_ACPI_STATUS(status); |
475 | } | 462 | } |
476 | 463 | ||
477 | EXPORT_SYMBOL(acpi_set_register); | 464 | ACPI_EXPORT_SYMBOL(acpi_set_register) |
478 | 465 | ||
479 | /****************************************************************************** | 466 | /****************************************************************************** |
480 | * | 467 | * |
@@ -490,21 +477,18 @@ EXPORT_SYMBOL(acpi_set_register); | |||
490 | * given offset. | 477 | * given offset. |
491 | * | 478 | * |
492 | ******************************************************************************/ | 479 | ******************************************************************************/ |
493 | |||
494 | acpi_status | 480 | acpi_status |
495 | acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | 481 | acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) |
496 | { | 482 | { |
497 | u32 value1 = 0; | 483 | u32 value1 = 0; |
498 | u32 value2 = 0; | 484 | u32 value2 = 0; |
499 | acpi_status status; | 485 | acpi_status status; |
486 | acpi_cpu_flags lock_flags = 0; | ||
500 | 487 | ||
501 | ACPI_FUNCTION_TRACE("hw_register_read"); | 488 | ACPI_FUNCTION_TRACE(hw_register_read); |
502 | 489 | ||
503 | if (ACPI_MTX_LOCK == use_lock) { | 490 | if (ACPI_MTX_LOCK == use_lock) { |
504 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | 491 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
505 | if (ACPI_FAILURE(status)) { | ||
506 | return_ACPI_STATUS(status); | ||
507 | } | ||
508 | } | 492 | } |
509 | 493 | ||
510 | switch (register_id) { | 494 | switch (register_id) { |
@@ -582,7 +566,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
582 | 566 | ||
583 | unlock_and_exit: | 567 | unlock_and_exit: |
584 | if (ACPI_MTX_LOCK == use_lock) { | 568 | if (ACPI_MTX_LOCK == use_lock) { |
585 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | 569 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
586 | } | 570 | } |
587 | 571 | ||
588 | if (ACPI_SUCCESS(status)) { | 572 | if (ACPI_SUCCESS(status)) { |
@@ -610,14 +594,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
610 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) | 594 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) |
611 | { | 595 | { |
612 | acpi_status status; | 596 | acpi_status status; |
597 | acpi_cpu_flags lock_flags = 0; | ||
613 | 598 | ||
614 | ACPI_FUNCTION_TRACE("hw_register_write"); | 599 | ACPI_FUNCTION_TRACE(hw_register_write); |
615 | 600 | ||
616 | if (ACPI_MTX_LOCK == use_lock) { | 601 | if (ACPI_MTX_LOCK == use_lock) { |
617 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | 602 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
618 | if (ACPI_FAILURE(status)) { | ||
619 | return_ACPI_STATUS(status); | ||
620 | } | ||
621 | } | 603 | } |
622 | 604 | ||
623 | switch (register_id) { | 605 | switch (register_id) { |
@@ -707,7 +689,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) | |||
707 | 689 | ||
708 | unlock_and_exit: | 690 | unlock_and_exit: |
709 | if (ACPI_MTX_LOCK == use_lock) { | 691 | if (ACPI_MTX_LOCK == use_lock) { |
710 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | 692 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
711 | } | 693 | } |
712 | 694 | ||
713 | return_ACPI_STATUS(status); | 695 | return_ACPI_STATUS(status); |
@@ -733,7 +715,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) | |||
733 | u64 address; | 715 | u64 address; |
734 | acpi_status status; | 716 | acpi_status status; |
735 | 717 | ||
736 | ACPI_FUNCTION_NAME("hw_low_level_read"); | 718 | ACPI_FUNCTION_NAME(hw_low_level_read); |
737 | 719 | ||
738 | /* | 720 | /* |
739 | * Must have a valid pointer to a GAS structure, and | 721 | * Must have a valid pointer to a GAS structure, and |
@@ -805,7 +787,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) | |||
805 | u64 address; | 787 | u64 address; |
806 | acpi_status status; | 788 | acpi_status status; |
807 | 789 | ||
808 | ACPI_FUNCTION_NAME("hw_low_level_write"); | 790 | ACPI_FUNCTION_NAME(hw_low_level_write); |
809 | 791 | ||
810 | /* | 792 | /* |
811 | * Must have a valid pointer to a GAS structure, and | 793 | * Must have a valid pointer to a GAS structure, and |
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 89269272fd62..8bb43cae60c2 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | 46 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 47 | #define _COMPONENT ACPI_HARDWARE |
@@ -64,7 +63,7 @@ acpi_status | |||
64 | acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | 63 | acpi_set_firmware_waking_vector(acpi_physical_address physical_address) |
65 | { | 64 | { |
66 | 65 | ||
67 | ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector"); | 66 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); |
68 | 67 | ||
69 | /* Set the vector */ | 68 | /* Set the vector */ |
70 | 69 | ||
@@ -79,6 +78,8 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | |||
79 | return_ACPI_STATUS(AE_OK); | 78 | return_ACPI_STATUS(AE_OK); |
80 | } | 79 | } |
81 | 80 | ||
81 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) | ||
82 | |||
82 | /******************************************************************************* | 83 | /******************************************************************************* |
83 | * | 84 | * |
84 | * FUNCTION: acpi_get_firmware_waking_vector | 85 | * FUNCTION: acpi_get_firmware_waking_vector |
@@ -92,13 +93,12 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | |||
92 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS | 93 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS |
93 | * | 94 | * |
94 | ******************************************************************************/ | 95 | ******************************************************************************/ |
95 | |||
96 | #ifdef ACPI_FUTURE_USAGE | 96 | #ifdef ACPI_FUTURE_USAGE |
97 | acpi_status | 97 | acpi_status |
98 | acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | 98 | acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) |
99 | { | 99 | { |
100 | 100 | ||
101 | ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector"); | 101 | ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector); |
102 | 102 | ||
103 | if (!physical_address) { | 103 | if (!physical_address) { |
104 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 104 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -118,6 +118,8 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | |||
118 | 118 | ||
119 | return_ACPI_STATUS(AE_OK); | 119 | return_ACPI_STATUS(AE_OK); |
120 | } | 120 | } |
121 | |||
122 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) | ||
121 | #endif | 123 | #endif |
122 | 124 | ||
123 | /******************************************************************************* | 125 | /******************************************************************************* |
@@ -134,14 +136,13 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | |||
134 | * various OS-specific tasks between the two steps. | 136 | * various OS-specific tasks between the two steps. |
135 | * | 137 | * |
136 | ******************************************************************************/ | 138 | ******************************************************************************/ |
137 | |||
138 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | 139 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) |
139 | { | 140 | { |
140 | acpi_status status; | 141 | acpi_status status; |
141 | struct acpi_object_list arg_list; | 142 | struct acpi_object_list arg_list; |
142 | union acpi_object arg; | 143 | union acpi_object arg; |
143 | 144 | ||
144 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep"); | 145 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep); |
145 | 146 | ||
146 | /* | 147 | /* |
147 | * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. | 148 | * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. |
@@ -206,6 +207,8 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
206 | return_ACPI_STATUS(AE_OK); | 207 | return_ACPI_STATUS(AE_OK); |
207 | } | 208 | } |
208 | 209 | ||
210 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) | ||
211 | |||
209 | /******************************************************************************* | 212 | /******************************************************************************* |
210 | * | 213 | * |
211 | * FUNCTION: acpi_enter_sleep_state | 214 | * FUNCTION: acpi_enter_sleep_state |
@@ -218,7 +221,6 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
218 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 221 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
219 | * | 222 | * |
220 | ******************************************************************************/ | 223 | ******************************************************************************/ |
221 | |||
222 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | 224 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) |
223 | { | 225 | { |
224 | u32 PM1Acontrol; | 226 | u32 PM1Acontrol; |
@@ -228,7 +230,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
228 | u32 in_value; | 230 | u32 in_value; |
229 | acpi_status status; | 231 | acpi_status status; |
230 | 232 | ||
231 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state"); | 233 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); |
232 | 234 | ||
233 | if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || | 235 | if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || |
234 | (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { | 236 | (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { |
@@ -378,7 +380,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
378 | return_ACPI_STATUS(AE_OK); | 380 | return_ACPI_STATUS(AE_OK); |
379 | } | 381 | } |
380 | 382 | ||
381 | EXPORT_SYMBOL(acpi_enter_sleep_state); | 383 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) |
382 | 384 | ||
383 | /******************************************************************************* | 385 | /******************************************************************************* |
384 | * | 386 | * |
@@ -392,13 +394,12 @@ EXPORT_SYMBOL(acpi_enter_sleep_state); | |||
392 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 394 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
393 | * | 395 | * |
394 | ******************************************************************************/ | 396 | ******************************************************************************/ |
395 | |||
396 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) | 397 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) |
397 | { | 398 | { |
398 | u32 in_value; | 399 | u32 in_value; |
399 | acpi_status status; | 400 | acpi_status status; |
400 | 401 | ||
401 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios"); | 402 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios); |
402 | 403 | ||
403 | status = | 404 | status = |
404 | acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); | 405 | acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); |
@@ -443,7 +444,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) | |||
443 | return_ACPI_STATUS(AE_OK); | 444 | return_ACPI_STATUS(AE_OK); |
444 | } | 445 | } |
445 | 446 | ||
446 | EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); | 447 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) |
447 | 448 | ||
448 | /******************************************************************************* | 449 | /******************************************************************************* |
449 | * | 450 | * |
@@ -457,7 +458,6 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); | |||
457 | * Called with interrupts ENABLED. | 458 | * Called with interrupts ENABLED. |
458 | * | 459 | * |
459 | ******************************************************************************/ | 460 | ******************************************************************************/ |
460 | |||
461 | acpi_status acpi_leave_sleep_state(u8 sleep_state) | 461 | acpi_status acpi_leave_sleep_state(u8 sleep_state) |
462 | { | 462 | { |
463 | struct acpi_object_list arg_list; | 463 | struct acpi_object_list arg_list; |
@@ -468,7 +468,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
468 | u32 PM1Acontrol; | 468 | u32 PM1Acontrol; |
469 | u32 PM1Bcontrol; | 469 | u32 PM1Bcontrol; |
470 | 470 | ||
471 | ACPI_FUNCTION_TRACE("acpi_leave_sleep_state"); | 471 | ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); |
472 | 472 | ||
473 | /* | 473 | /* |
474 | * Set SLP_TYPE and SLP_EN to state S0. | 474 | * Set SLP_TYPE and SLP_EN to state S0. |
@@ -490,6 +490,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
490 | ACPI_REGISTER_PM1_CONTROL, | 490 | ACPI_REGISTER_PM1_CONTROL, |
491 | &PM1Acontrol); | 491 | &PM1Acontrol); |
492 | if (ACPI_SUCCESS(status)) { | 492 | if (ACPI_SUCCESS(status)) { |
493 | |||
493 | /* Clear SLP_EN and SLP_TYP fields */ | 494 | /* Clear SLP_EN and SLP_TYP fields */ |
494 | 495 | ||
495 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | | 496 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | |
@@ -583,3 +584,5 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
583 | 584 | ||
584 | return_ACPI_STATUS(status); | 585 | return_ACPI_STATUS(status); |
585 | } | 586 | } |
587 | |||
588 | ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state) | ||
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index fc10b7cb456f..c4ec47c939fd 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | 46 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 47 | #define _COMPONENT ACPI_HARDWARE |
@@ -61,13 +60,13 @@ ACPI_MODULE_NAME("hwtimer") | |||
61 | ******************************************************************************/ | 60 | ******************************************************************************/ |
62 | acpi_status acpi_get_timer_resolution(u32 * resolution) | 61 | acpi_status acpi_get_timer_resolution(u32 * resolution) |
63 | { | 62 | { |
64 | ACPI_FUNCTION_TRACE("acpi_get_timer_resolution"); | 63 | ACPI_FUNCTION_TRACE(acpi_get_timer_resolution); |
65 | 64 | ||
66 | if (!resolution) { | 65 | if (!resolution) { |
67 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 66 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
68 | } | 67 | } |
69 | 68 | ||
70 | if (0 == acpi_gbl_FADT->tmr_val_ext) { | 69 | if (acpi_gbl_FADT->tmr_val_ext == 0) { |
71 | *resolution = 24; | 70 | *resolution = 24; |
72 | } else { | 71 | } else { |
73 | *resolution = 32; | 72 | *resolution = 32; |
@@ -76,6 +75,8 @@ acpi_status acpi_get_timer_resolution(u32 * resolution) | |||
76 | return_ACPI_STATUS(AE_OK); | 75 | return_ACPI_STATUS(AE_OK); |
77 | } | 76 | } |
78 | 77 | ||
78 | ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution) | ||
79 | |||
79 | /****************************************************************************** | 80 | /****************************************************************************** |
80 | * | 81 | * |
81 | * FUNCTION: acpi_get_timer | 82 | * FUNCTION: acpi_get_timer |
@@ -87,12 +88,11 @@ acpi_status acpi_get_timer_resolution(u32 * resolution) | |||
87 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). | 88 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). |
88 | * | 89 | * |
89 | ******************************************************************************/ | 90 | ******************************************************************************/ |
90 | |||
91 | acpi_status acpi_get_timer(u32 * ticks) | 91 | acpi_status acpi_get_timer(u32 * ticks) |
92 | { | 92 | { |
93 | acpi_status status; | 93 | acpi_status status; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE("acpi_get_timer"); | 95 | ACPI_FUNCTION_TRACE(acpi_get_timer); |
96 | 96 | ||
97 | if (!ticks) { | 97 | if (!ticks) { |
98 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 98 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -103,7 +103,7 @@ acpi_status acpi_get_timer(u32 * ticks) | |||
103 | return_ACPI_STATUS(status); | 103 | return_ACPI_STATUS(status); |
104 | } | 104 | } |
105 | 105 | ||
106 | EXPORT_SYMBOL(acpi_get_timer); | 106 | ACPI_EXPORT_SYMBOL(acpi_get_timer) |
107 | 107 | ||
108 | /****************************************************************************** | 108 | /****************************************************************************** |
109 | * | 109 | * |
@@ -133,7 +133,6 @@ EXPORT_SYMBOL(acpi_get_timer); | |||
133 | * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes | 133 | * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes |
134 | * | 134 | * |
135 | ******************************************************************************/ | 135 | ******************************************************************************/ |
136 | |||
137 | acpi_status | 136 | acpi_status |
138 | acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | 137 | acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) |
139 | { | 138 | { |
@@ -141,7 +140,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
141 | u32 delta_ticks; | 140 | u32 delta_ticks; |
142 | acpi_integer quotient; | 141 | acpi_integer quotient; |
143 | 142 | ||
144 | ACPI_FUNCTION_TRACE("acpi_get_timer_duration"); | 143 | ACPI_FUNCTION_TRACE(acpi_get_timer_duration); |
145 | 144 | ||
146 | if (!time_elapsed) { | 145 | if (!time_elapsed) { |
147 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 146 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -154,7 +153,8 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
154 | if (start_ticks < end_ticks) { | 153 | if (start_ticks < end_ticks) { |
155 | delta_ticks = end_ticks - start_ticks; | 154 | delta_ticks = end_ticks - start_ticks; |
156 | } else if (start_ticks > end_ticks) { | 155 | } else if (start_ticks > end_ticks) { |
157 | if (0 == acpi_gbl_FADT->tmr_val_ext) { | 156 | if (acpi_gbl_FADT->tmr_val_ext == 0) { |
157 | |||
158 | /* 24-bit Timer */ | 158 | /* 24-bit Timer */ |
159 | 159 | ||
160 | delta_ticks = | 160 | delta_ticks = |
@@ -183,4 +183,4 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
183 | return_ACPI_STATUS(status); | 183 | return_ACPI_STATUS(status); |
184 | } | 184 | } |
185 | 185 | ||
186 | EXPORT_SYMBOL(acpi_get_timer_duration); | 186 | ACPI_EXPORT_SYMBOL(acpi_get_timer_duration) |
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index 2e2e4051dfa7..c25b2b92edcf 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c | |||
@@ -723,6 +723,8 @@ get_parms(char *config_record, | |||
723 | goto do_fail; | 723 | goto do_fail; |
724 | count = tmp1 - tmp; | 724 | count = tmp1 - tmp; |
725 | *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); | 725 | *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); |
726 | if (!*action_handle) | ||
727 | goto do_fail; | ||
726 | strncpy(*action_handle, tmp, count); | 728 | strncpy(*action_handle, tmp, count); |
727 | *(*action_handle + count) = 0; | 729 | *(*action_handle + count) = 0; |
728 | 730 | ||
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index 468244147ec1..d51d68f5dd8d 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c | |||
@@ -37,7 +37,7 @@ ACPI_MODULE_NAME("acpi_motherboard") | |||
37 | #define ACPI_MB_HID2 "PNP0C02" | 37 | #define ACPI_MB_HID2 "PNP0C02" |
38 | /** | 38 | /** |
39 | * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved | 39 | * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved |
40 | * Doesn't care about the failure of 'request_region', since other may reserve | 40 | * Doesn't care about the failure of 'request_region', since other may reserve |
41 | * the io ports as well | 41 | * the io ports as well |
42 | */ | 42 | */ |
43 | #define IS_RESERVED_ADDR(base, len) \ | 43 | #define IS_RESERVED_ADDR(base, len) \ |
@@ -46,7 +46,7 @@ ACPI_MODULE_NAME("acpi_motherboard") | |||
46 | /* | 46 | /* |
47 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use | 47 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use |
48 | * the io ports if they really know they can use it, while | 48 | * the io ports if they really know they can use it, while |
49 | * still preventing hotplug PCI devices from using it. | 49 | * still preventing hotplug PCI devices from using it. |
50 | */ | 50 | */ |
51 | static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) | 51 | static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) |
52 | { | 52 | { |
@@ -123,49 +123,54 @@ static struct acpi_driver acpi_motherboard_driver2 = { | |||
123 | }, | 123 | }, |
124 | }; | 124 | }; |
125 | 125 | ||
126 | static void __init acpi_request_region (struct acpi_generic_address *addr, | ||
127 | unsigned int length, char *desc) | ||
128 | { | ||
129 | if (!addr->address || !length) | ||
130 | return; | ||
131 | |||
132 | if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO) | ||
133 | request_region(addr->address, length, desc); | ||
134 | else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) | ||
135 | request_mem_region(addr->address, length, desc); | ||
136 | } | ||
137 | |||
126 | static void __init acpi_reserve_resources(void) | 138 | static void __init acpi_reserve_resources(void) |
127 | { | 139 | { |
128 | if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) | 140 | acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk, |
129 | request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, | 141 | acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK"); |
130 | acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); | ||
131 | 142 | ||
132 | if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) | 143 | acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk, |
133 | request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, | 144 | acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK"); |
134 | acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); | ||
135 | 145 | ||
136 | if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) | 146 | acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk, |
137 | request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, | 147 | acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK"); |
138 | acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); | ||
139 | 148 | ||
140 | if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) | 149 | acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk, |
141 | request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, | 150 | acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK"); |
142 | acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); | ||
143 | 151 | ||
144 | if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) | 152 | if (acpi_gbl_FADT->pm_tm_len == 4) |
145 | request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR"); | 153 | acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR"); |
146 | 154 | ||
147 | if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) | 155 | acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk, |
148 | request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, | 156 | acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK"); |
149 | acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); | ||
150 | 157 | ||
151 | /* Length of GPE blocks must be a non-negative multiple of 2 */ | 158 | /* Length of GPE blocks must be a non-negative multiple of 2 */ |
152 | 159 | ||
153 | if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && | 160 | if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1)) |
154 | !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) | 161 | acpi_request_region(&acpi_gbl_FADT->xgpe0_blk, |
155 | request_region(acpi_gbl_FADT->xgpe0_blk.address, | 162 | acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK"); |
156 | acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); | ||
157 | 163 | ||
158 | if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && | 164 | if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1)) |
159 | !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) | 165 | acpi_request_region(&acpi_gbl_FADT->xgpe1_blk, |
160 | request_region(acpi_gbl_FADT->xgpe1_blk.address, | 166 | acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK"); |
161 | acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); | ||
162 | } | 167 | } |
163 | 168 | ||
164 | static int __init acpi_motherboard_init(void) | 169 | static int __init acpi_motherboard_init(void) |
165 | { | 170 | { |
166 | acpi_bus_register_driver(&acpi_motherboard_driver1); | 171 | acpi_bus_register_driver(&acpi_motherboard_driver1); |
167 | acpi_bus_register_driver(&acpi_motherboard_driver2); | 172 | acpi_bus_register_driver(&acpi_motherboard_driver2); |
168 | /* | 173 | /* |
169 | * Guarantee motherboard IO reservation first | 174 | * Guarantee motherboard IO reservation first |
170 | * This module must run after scan.c | 175 | * This module must run after scan.c |
171 | */ | 176 | */ |
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 1149bc18fb35..48fadade52e2 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -70,7 +70,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
70 | union acpi_operand_object *obj_desc; | 70 | union acpi_operand_object *obj_desc; |
71 | acpi_string val = NULL; | 71 | acpi_string val = NULL; |
72 | 72 | ||
73 | ACPI_FUNCTION_TRACE("ns_root_initialize"); | 73 | ACPI_FUNCTION_TRACE(ns_root_initialize); |
74 | 74 | ||
75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
76 | if (ACPI_FAILURE(status)) { | 76 | if (ACPI_FAILURE(status)) { |
@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
98 | "Entering predefined entries into namespace\n")); | 98 | "Entering predefined entries into namespace\n")); |
99 | 99 | ||
100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { | 100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { |
101 | |||
101 | /* _OSI is optional for now, will be permanent later */ | 102 | /* _OSI is optional for now, will be permanent later */ |
102 | 103 | ||
103 | if (!ACPI_STRCMP(init_val->name, "_OSI") | 104 | if (!ACPI_STRCMP(init_val->name, "_OSI") |
@@ -156,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
156 | 157 | ||
157 | #if defined (ACPI_ASL_COMPILER) | 158 | #if defined (ACPI_ASL_COMPILER) |
158 | 159 | ||
159 | /* save the parameter count for the i_aSL compiler */ | 160 | /* Save the parameter count for the i_aSL compiler */ |
160 | 161 | ||
161 | new_node->value = obj_desc->method.param_count; | 162 | new_node->value = obj_desc->method.param_count; |
162 | #else | 163 | #else |
@@ -258,10 +259,8 @@ acpi_status acpi_ns_root_initialize(void) | |||
258 | /* Save a handle to "_GPE", it is always present */ | 259 | /* Save a handle to "_GPE", it is always present */ |
259 | 260 | ||
260 | if (ACPI_SUCCESS(status)) { | 261 | if (ACPI_SUCCESS(status)) { |
261 | status = | 262 | status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, |
262 | acpi_ns_get_node_by_path("\\_GPE", NULL, | 263 | &acpi_gbl_fadt_gpe_device); |
263 | ACPI_NS_NO_UPSEARCH, | ||
264 | &acpi_gbl_fadt_gpe_device); | ||
265 | } | 264 | } |
266 | 265 | ||
267 | return_ACPI_STATUS(status); | 266 | return_ACPI_STATUS(status); |
@@ -310,17 +309,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
310 | acpi_object_type type_to_check_for; | 309 | acpi_object_type type_to_check_for; |
311 | acpi_object_type this_search_type; | 310 | acpi_object_type this_search_type; |
312 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; | 311 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; |
313 | u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | | 312 | u32 local_flags; |
314 | ACPI_NS_SEARCH_PARENT); | ||
315 | 313 | ||
316 | ACPI_FUNCTION_TRACE("ns_lookup"); | 314 | ACPI_FUNCTION_TRACE(ns_lookup); |
317 | 315 | ||
318 | if (!return_node) { | 316 | if (!return_node) { |
319 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 317 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
320 | } | 318 | } |
321 | 319 | ||
322 | acpi_gbl_ns_lookup_count++; | 320 | local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); |
323 | *return_node = ACPI_ENTRY_NOT_FOUND; | 321 | *return_node = ACPI_ENTRY_NOT_FOUND; |
322 | acpi_gbl_ns_lookup_count++; | ||
324 | 323 | ||
325 | if (!acpi_gbl_root_node) { | 324 | if (!acpi_gbl_root_node) { |
326 | return_ACPI_STATUS(AE_NO_NAMESPACE); | 325 | return_ACPI_STATUS(AE_NO_NAMESPACE); |
@@ -346,14 +345,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
346 | return_ACPI_STATUS(AE_AML_INTERNAL); | 345 | return_ACPI_STATUS(AE_AML_INTERNAL); |
347 | } | 346 | } |
348 | 347 | ||
349 | /* | 348 | if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) { |
350 | * This node might not be a actual "scope" node (such as a | 349 | /* |
351 | * Device/Method, etc.) It could be a Package or other object node. | 350 | * This node might not be a actual "scope" node (such as a |
352 | * Backup up the tree to find the containing scope node. | 351 | * Device/Method, etc.) It could be a Package or other object node. |
353 | */ | 352 | * Backup up the tree to find the containing scope node. |
354 | while (!acpi_ns_opens_scope(prefix_node->type) && | 353 | */ |
355 | prefix_node->type != ACPI_TYPE_ANY) { | 354 | while (!acpi_ns_opens_scope(prefix_node->type) && |
356 | prefix_node = acpi_ns_get_parent_node(prefix_node); | 355 | prefix_node->type != ACPI_TYPE_ANY) { |
356 | prefix_node = | ||
357 | acpi_ns_get_parent_node(prefix_node); | ||
358 | } | ||
357 | } | 359 | } |
358 | } | 360 | } |
359 | 361 | ||
@@ -365,6 +367,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
365 | * Begin examination of the actual pathname | 367 | * Begin examination of the actual pathname |
366 | */ | 368 | */ |
367 | if (!pathname) { | 369 | if (!pathname) { |
370 | |||
368 | /* A Null name_path is allowed and refers to the root */ | 371 | /* A Null name_path is allowed and refers to the root */ |
369 | 372 | ||
370 | num_segments = 0; | 373 | num_segments = 0; |
@@ -389,6 +392,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
389 | * to the current scope). | 392 | * to the current scope). |
390 | */ | 393 | */ |
391 | if (*path == (u8) AML_ROOT_PREFIX) { | 394 | if (*path == (u8) AML_ROOT_PREFIX) { |
395 | |||
392 | /* Pathname is fully qualified, start from the root */ | 396 | /* Pathname is fully qualified, start from the root */ |
393 | 397 | ||
394 | this_node = acpi_gbl_root_node; | 398 | this_node = acpi_gbl_root_node; |
@@ -416,6 +420,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
416 | this_node = prefix_node; | 420 | this_node = prefix_node; |
417 | num_carats = 0; | 421 | num_carats = 0; |
418 | while (*path == (u8) AML_PARENT_PREFIX) { | 422 | while (*path == (u8) AML_PARENT_PREFIX) { |
423 | |||
419 | /* Name is fully qualified, no search rules apply */ | 424 | /* Name is fully qualified, no search rules apply */ |
420 | 425 | ||
421 | search_parent_flag = ACPI_NS_NO_UPSEARCH; | 426 | search_parent_flag = ACPI_NS_NO_UPSEARCH; |
@@ -430,6 +435,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
430 | num_carats++; | 435 | num_carats++; |
431 | this_node = acpi_ns_get_parent_node(this_node); | 436 | this_node = acpi_ns_get_parent_node(this_node); |
432 | if (!this_node) { | 437 | if (!this_node) { |
438 | |||
433 | /* Current scope has no parent scope */ | 439 | /* Current scope has no parent scope */ |
434 | 440 | ||
435 | ACPI_ERROR((AE_INFO, | 441 | ACPI_ERROR((AE_INFO, |
@@ -569,6 +575,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
569 | &this_node); | 575 | &this_node); |
570 | if (ACPI_FAILURE(status)) { | 576 | if (ACPI_FAILURE(status)) { |
571 | if (status == AE_NOT_FOUND) { | 577 | if (status == AE_NOT_FOUND) { |
578 | |||
572 | /* Name not found in ACPI namespace */ | 579 | /* Name not found in ACPI namespace */ |
573 | 580 | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 581 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
@@ -602,10 +609,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
602 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && | 609 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && |
603 | (this_node->type != ACPI_TYPE_ANY) && | 610 | (this_node->type != ACPI_TYPE_ANY) && |
604 | (this_node->type != type_to_check_for)) { | 611 | (this_node->type != type_to_check_for)) { |
612 | |||
605 | /* Complain about a type mismatch */ | 613 | /* Complain about a type mismatch */ |
606 | 614 | ||
607 | ACPI_WARNING((AE_INFO, | 615 | ACPI_WARNING((AE_INFO, |
608 | "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)", | 616 | "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", |
609 | ACPI_CAST_PTR(char, &simple_name), | 617 | ACPI_CAST_PTR(char, &simple_name), |
610 | acpi_ut_get_type_name(this_node->type), | 618 | acpi_ut_get_type_name(this_node->type), |
611 | acpi_ut_get_type_name | 619 | acpi_ut_get_type_name |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 9b871f38b61b..dc3f0739a46b 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -47,9 +47,6 @@ | |||
47 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
48 | ACPI_MODULE_NAME("nsalloc") | 48 | ACPI_MODULE_NAME("nsalloc") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
51 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | ||
52 | |||
53 | /******************************************************************************* | 50 | /******************************************************************************* |
54 | * | 51 | * |
55 | * FUNCTION: acpi_ns_create_node | 52 | * FUNCTION: acpi_ns_create_node |
@@ -61,14 +58,13 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | |||
61 | * DESCRIPTION: Create a namespace node | 58 | * DESCRIPTION: Create a namespace node |
62 | * | 59 | * |
63 | ******************************************************************************/ | 60 | ******************************************************************************/ |
64 | |||
65 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) | 61 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) |
66 | { | 62 | { |
67 | struct acpi_namespace_node *node; | 63 | struct acpi_namespace_node *node; |
68 | 64 | ||
69 | ACPI_FUNCTION_TRACE("ns_create_node"); | 65 | ACPI_FUNCTION_TRACE(ns_create_node); |
70 | 66 | ||
71 | node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node)); | 67 | node = acpi_os_acquire_object(acpi_gbl_namespace_cache); |
72 | if (!node) { | 68 | if (!node) { |
73 | return_PTR(NULL); | 69 | return_PTR(NULL); |
74 | } | 70 | } |
@@ -76,9 +72,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name) | |||
76 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); | 72 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); |
77 | 73 | ||
78 | node->name.integer = name; | 74 | node->name.integer = name; |
79 | node->reference_count = 1; | ||
80 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); | 75 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); |
81 | |||
82 | return_PTR(node); | 76 | return_PTR(node); |
83 | } | 77 | } |
84 | 78 | ||
@@ -100,7 +94,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
100 | struct acpi_namespace_node *prev_node; | 94 | struct acpi_namespace_node *prev_node; |
101 | struct acpi_namespace_node *next_node; | 95 | struct acpi_namespace_node *next_node; |
102 | 96 | ||
103 | ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node); | 97 | ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node); |
104 | 98 | ||
105 | parent_node = acpi_ns_get_parent_node(node); | 99 | parent_node = acpi_ns_get_parent_node(node); |
106 | 100 | ||
@@ -115,6 +109,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
115 | } | 109 | } |
116 | 110 | ||
117 | if (prev_node) { | 111 | if (prev_node) { |
112 | |||
118 | /* Node is not first child, unlink it */ | 113 | /* Node is not first child, unlink it */ |
119 | 114 | ||
120 | prev_node->peer = next_node->peer; | 115 | prev_node->peer = next_node->peer; |
@@ -125,6 +120,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
125 | /* Node is first child (has no previous peer) */ | 120 | /* Node is first child (has no previous peer) */ |
126 | 121 | ||
127 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 122 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { |
123 | |||
128 | /* No peers at all */ | 124 | /* No peers at all */ |
129 | 125 | ||
130 | parent_node->child = NULL; | 126 | parent_node->child = NULL; |
@@ -137,10 +133,10 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
137 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); | 133 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); |
138 | 134 | ||
139 | /* | 135 | /* |
140 | * Detach an object if there is one then delete the node | 136 | * Detach an object if there is one, then delete the node |
141 | */ | 137 | */ |
142 | acpi_ns_detach_object(node); | 138 | acpi_ns_detach_object(node); |
143 | ACPI_MEM_FREE(node); | 139 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); |
144 | return_VOID; | 140 | return_VOID; |
145 | } | 141 | } |
146 | 142 | ||
@@ -171,7 +167,7 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
171 | acpi_owner_id owner_id = 0; | 167 | acpi_owner_id owner_id = 0; |
172 | struct acpi_namespace_node *child_node; | 168 | struct acpi_namespace_node *child_node; |
173 | 169 | ||
174 | ACPI_FUNCTION_TRACE("ns_install_node"); | 170 | ACPI_FUNCTION_TRACE(ns_install_node); |
175 | 171 | ||
176 | /* | 172 | /* |
177 | * Get the owner ID from the Walk state | 173 | * Get the owner ID from the Walk state |
@@ -216,14 +212,6 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
216 | acpi_ut_get_type_name(parent_node->type), | 212 | acpi_ut_get_type_name(parent_node->type), |
217 | parent_node)); | 213 | parent_node)); |
218 | 214 | ||
219 | /* | ||
220 | * Increment the reference count(s) of all parents up to | ||
221 | * the root! | ||
222 | */ | ||
223 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
224 | node->reference_count++; | ||
225 | } | ||
226 | |||
227 | return_VOID; | 215 | return_VOID; |
228 | } | 216 | } |
229 | 217 | ||
@@ -244,10 +232,9 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
244 | { | 232 | { |
245 | struct acpi_namespace_node *child_node; | 233 | struct acpi_namespace_node *child_node; |
246 | struct acpi_namespace_node *next_node; | 234 | struct acpi_namespace_node *next_node; |
247 | struct acpi_namespace_node *node; | ||
248 | u8 flags; | 235 | u8 flags; |
249 | 236 | ||
250 | ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); | 237 | ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node); |
251 | 238 | ||
252 | if (!parent_node) { | 239 | if (!parent_node) { |
253 | return_VOID; | 240 | return_VOID; |
@@ -264,6 +251,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
264 | * Deallocate all children at this level | 251 | * Deallocate all children at this level |
265 | */ | 252 | */ |
266 | do { | 253 | do { |
254 | |||
267 | /* Get the things we need */ | 255 | /* Get the things we need */ |
268 | 256 | ||
269 | next_node = child_node->peer; | 257 | next_node = child_node->peer; |
@@ -289,26 +277,10 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
289 | */ | 277 | */ |
290 | acpi_ns_detach_object(child_node); | 278 | acpi_ns_detach_object(child_node); |
291 | 279 | ||
292 | /* | ||
293 | * Decrement the reference count(s) of all parents up to | ||
294 | * the root! (counts were incremented when the node was created) | ||
295 | */ | ||
296 | node = child_node; | ||
297 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
298 | node->reference_count--; | ||
299 | } | ||
300 | |||
301 | /* There should be only one reference remaining on this node */ | ||
302 | |||
303 | if (child_node->reference_count != 1) { | ||
304 | ACPI_WARNING((AE_INFO, | ||
305 | "Existing references (%d) on node being deleted (%p)", | ||
306 | child_node->reference_count, child_node)); | ||
307 | } | ||
308 | |||
309 | /* Now we can delete the node */ | 280 | /* Now we can delete the node */ |
310 | 281 | ||
311 | ACPI_MEM_FREE(child_node); | 282 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, |
283 | child_node); | ||
312 | 284 | ||
313 | /* And move on to the next child in the list */ | 285 | /* And move on to the next child in the list */ |
314 | 286 | ||
@@ -341,7 +313,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
341 | struct acpi_namespace_node *child_node = NULL; | 313 | struct acpi_namespace_node *child_node = NULL; |
342 | u32 level = 1; | 314 | u32 level = 1; |
343 | 315 | ||
344 | ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree"); | 316 | ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree); |
345 | 317 | ||
346 | if (!parent_node) { | 318 | if (!parent_node) { |
347 | return_VOID; | 319 | return_VOID; |
@@ -352,11 +324,14 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
352 | * to where we started. | 324 | * to where we started. |
353 | */ | 325 | */ |
354 | while (level > 0) { | 326 | while (level > 0) { |
327 | |||
355 | /* Get the next node in this scope (NULL if none) */ | 328 | /* Get the next node in this scope (NULL if none) */ |
356 | 329 | ||
357 | child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | 330 | child_node = |
358 | child_node); | 331 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, |
332 | child_node); | ||
359 | if (child_node) { | 333 | if (child_node) { |
334 | |||
360 | /* Found a child node - detach any attached object */ | 335 | /* Found a child node - detach any attached object */ |
361 | 336 | ||
362 | acpi_ns_detach_object(child_node); | 337 | acpi_ns_detach_object(child_node); |
@@ -401,55 +376,6 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
401 | 376 | ||
402 | /******************************************************************************* | 377 | /******************************************************************************* |
403 | * | 378 | * |
404 | * FUNCTION: acpi_ns_remove_reference | ||
405 | * | ||
406 | * PARAMETERS: Node - Named node whose reference count is to be | ||
407 | * decremented | ||
408 | * | ||
409 | * RETURN: None. | ||
410 | * | ||
411 | * DESCRIPTION: Remove a Node reference. Decrements the reference count | ||
412 | * of all parent Nodes up to the root. Any node along | ||
413 | * the way that reaches zero references is freed. | ||
414 | * | ||
415 | ******************************************************************************/ | ||
416 | |||
417 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node) | ||
418 | { | ||
419 | struct acpi_namespace_node *parent_node; | ||
420 | struct acpi_namespace_node *this_node; | ||
421 | |||
422 | ACPI_FUNCTION_ENTRY(); | ||
423 | |||
424 | /* | ||
425 | * Decrement the reference count(s) of this node and all | ||
426 | * nodes up to the root, Delete anything with zero remaining references. | ||
427 | */ | ||
428 | this_node = node; | ||
429 | while (this_node) { | ||
430 | /* Prepare to move up to parent */ | ||
431 | |||
432 | parent_node = acpi_ns_get_parent_node(this_node); | ||
433 | |||
434 | /* Decrement the reference count on this node */ | ||
435 | |||
436 | this_node->reference_count--; | ||
437 | |||
438 | /* Delete the node if no more references */ | ||
439 | |||
440 | if (!this_node->reference_count) { | ||
441 | /* Delete all children and delete the node */ | ||
442 | |||
443 | acpi_ns_delete_children(this_node); | ||
444 | acpi_ns_delete_node(this_node); | ||
445 | } | ||
446 | |||
447 | this_node = parent_node; | ||
448 | } | ||
449 | } | ||
450 | |||
451 | /******************************************************************************* | ||
452 | * | ||
453 | * FUNCTION: acpi_ns_delete_namespace_by_owner | 379 | * FUNCTION: acpi_ns_delete_namespace_by_owner |
454 | * | 380 | * |
455 | * PARAMETERS: owner_id - All nodes with this owner will be deleted | 381 | * PARAMETERS: owner_id - All nodes with this owner will be deleted |
@@ -469,15 +395,15 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
469 | u32 level; | 395 | u32 level; |
470 | struct acpi_namespace_node *parent_node; | 396 | struct acpi_namespace_node *parent_node; |
471 | 397 | ||
472 | ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id); | 398 | ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); |
473 | 399 | ||
474 | if (owner_id == 0) { | 400 | if (owner_id == 0) { |
475 | return_VOID; | 401 | return_VOID; |
476 | } | 402 | } |
477 | 403 | ||
404 | deletion_node = NULL; | ||
478 | parent_node = acpi_gbl_root_node; | 405 | parent_node = acpi_gbl_root_node; |
479 | child_node = NULL; | 406 | child_node = NULL; |
480 | deletion_node = NULL; | ||
481 | level = 1; | 407 | level = 1; |
482 | 408 | ||
483 | /* | 409 | /* |
@@ -494,12 +420,14 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
494 | child_node); | 420 | child_node); |
495 | 421 | ||
496 | if (deletion_node) { | 422 | if (deletion_node) { |
497 | acpi_ns_remove_reference(deletion_node); | 423 | acpi_ns_delete_children(deletion_node); |
424 | acpi_ns_delete_node(deletion_node); | ||
498 | deletion_node = NULL; | 425 | deletion_node = NULL; |
499 | } | 426 | } |
500 | 427 | ||
501 | if (child_node) { | 428 | if (child_node) { |
502 | if (child_node->owner_id == owner_id) { | 429 | if (child_node->owner_id == owner_id) { |
430 | |||
503 | /* Found a matching child node - detach any attached object */ | 431 | /* Found a matching child node - detach any attached object */ |
504 | 432 | ||
505 | acpi_ns_detach_object(child_node); | 433 | acpi_ns_detach_object(child_node); |
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index a2807317a84b..d72df66aa965 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -75,7 +75,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname) | |||
75 | { | 75 | { |
76 | acpi_native_uint i; | 76 | acpi_native_uint i; |
77 | 77 | ||
78 | ACPI_FUNCTION_NAME("ns_print_pathname"); | 78 | ACPI_FUNCTION_NAME(ns_print_pathname); |
79 | 79 | ||
80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) | 80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) |
81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { | 81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { |
@@ -123,7 +123,7 @@ void | |||
123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) | 123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) |
124 | { | 124 | { |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ns_dump_pathname"); | 126 | ACPI_FUNCTION_TRACE(ns_dump_pathname); |
127 | 127 | ||
128 | /* Do this only if the requested debug level and component are enabled */ | 128 | /* Do this only if the requested debug level and component are enabled */ |
129 | 129 | ||
@@ -167,7 +167,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
167 | u32 dbg_level; | 167 | u32 dbg_level; |
168 | u32 i; | 168 | u32 i; |
169 | 169 | ||
170 | ACPI_FUNCTION_NAME("ns_dump_one_object"); | 170 | ACPI_FUNCTION_NAME(ns_dump_one_object); |
171 | 171 | ||
172 | /* Is output enabled? */ | 172 | /* Is output enabled? */ |
173 | 173 | ||
@@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
191 | } | 191 | } |
192 | 192 | ||
193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { | 193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { |
194 | |||
194 | /* Indent the object according to the level */ | 195 | /* Indent the object according to the level */ |
195 | 196 | ||
196 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); | 197 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); |
@@ -203,6 +204,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
203 | } | 204 | } |
204 | 205 | ||
205 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { | 206 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { |
207 | this_node->name.integer = | ||
208 | acpi_ut_repair_name(this_node->name.integer); | ||
209 | |||
206 | ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", | 210 | ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", |
207 | this_node->name.integer)); | 211 | this_node->name.integer)); |
208 | } | 212 | } |
@@ -226,6 +230,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
226 | case ACPI_DISPLAY_SUMMARY: | 230 | case ACPI_DISPLAY_SUMMARY: |
227 | 231 | ||
228 | if (!obj_desc) { | 232 | if (!obj_desc) { |
233 | |||
229 | /* No attached object, we are done */ | 234 | /* No attached object, we are done */ |
230 | 235 | ||
231 | acpi_os_printf("\n"); | 236 | acpi_os_printf("\n"); |
@@ -419,6 +424,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
419 | 424 | ||
420 | acpi_os_printf("O:%p", obj_desc); | 425 | acpi_os_printf("O:%p", obj_desc); |
421 | if (!obj_desc) { | 426 | if (!obj_desc) { |
427 | |||
422 | /* No attached object, we are done */ | 428 | /* No attached object, we are done */ |
423 | 429 | ||
424 | acpi_os_printf("\n"); | 430 | acpi_os_printf("\n"); |
@@ -669,7 +675,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
669 | { | 675 | { |
670 | acpi_handle search_handle = search_base; | 676 | acpi_handle search_handle = search_base; |
671 | 677 | ||
672 | ACPI_FUNCTION_TRACE("ns_dump_tables"); | 678 | ACPI_FUNCTION_TRACE(ns_dump_tables); |
673 | 679 | ||
674 | if (!acpi_gbl_root_node) { | 680 | if (!acpi_gbl_root_node) { |
675 | /* | 681 | /* |
@@ -682,6 +688,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
682 | } | 688 | } |
683 | 689 | ||
684 | if (ACPI_NS_ALL == search_base) { | 690 | if (ACPI_NS_ALL == search_base) { |
691 | |||
685 | /* Entire namespace */ | 692 | /* Entire namespace */ |
686 | 693 | ||
687 | search_handle = acpi_gbl_root_node; | 694 | search_handle = acpi_gbl_root_node; |
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index aff899a935e3..c6bf5d30fca3 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c | |||
@@ -74,7 +74,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
74 | acpi_status status; | 74 | acpi_status status; |
75 | u32 i; | 75 | u32 i; |
76 | 76 | ||
77 | ACPI_FUNCTION_NAME("ns_dump_one_device"); | 77 | ACPI_FUNCTION_NAME(ns_dump_one_device); |
78 | 78 | ||
79 | status = | 79 | status = |
80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); | 80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); |
@@ -92,7 +92,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
92 | info->hardware_id.value, | 92 | info->hardware_id.value, |
93 | ACPI_FORMAT_UINT64(info->address), | 93 | ACPI_FORMAT_UINT64(info->address), |
94 | info->current_status)); | 94 | info->current_status)); |
95 | ACPI_MEM_FREE(info); | 95 | ACPI_FREE(info); |
96 | } | 96 | } |
97 | 97 | ||
98 | return (status); | 98 | return (status); |
@@ -115,7 +115,7 @@ void acpi_ns_dump_root_devices(void) | |||
115 | acpi_handle sys_bus_handle; | 115 | acpi_handle sys_bus_handle; |
116 | acpi_status status; | 116 | acpi_status status; |
117 | 117 | ||
118 | ACPI_FUNCTION_NAME("ns_dump_root_devices"); | 118 | ACPI_FUNCTION_NAME(ns_dump_root_devices); |
119 | 119 | ||
120 | /* Only dump the table if tracing is enabled */ | 120 | /* Only dump the table if tracing is enabled */ |
121 | 121 | ||
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 19d7b94d40c3..4b0a4a8c9843 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | * | 2 | * |
3 | * Module Name: nseval - Object evaluation interfaces -- includes control | 3 | * Module Name: nseval - Object evaluation, includes control method execution |
4 | * method lookup and execution. | ||
5 | * | 4 | * |
6 | ******************************************************************************/ | 5 | ******************************************************************************/ |
7 | 6 | ||
@@ -50,196 +49,14 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nseval") | 50 | ACPI_MODULE_NAME("nseval") |
52 | 51 | ||
53 | /* Local prototypes */ | ||
54 | static acpi_status | ||
55 | acpi_ns_execute_control_method(struct acpi_parameter_info *info); | ||
56 | |||
57 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info); | ||
58 | |||
59 | /******************************************************************************* | ||
60 | * | ||
61 | * FUNCTION: acpi_ns_evaluate_relative | ||
62 | * | ||
63 | * PARAMETERS: Pathname - Name of method to execute, If NULL, the | ||
64 | * handle is the object to execute | ||
65 | * Info - Method info block, contains: | ||
66 | * return_object - Where to put method's return value (if | ||
67 | * any). If NULL, no value is returned. | ||
68 | * Params - List of parameters to pass to the method, | ||
69 | * terminated by NULL. Params itself may be | ||
70 | * NULL if no parameters are being passed. | ||
71 | * | ||
72 | * RETURN: Status | ||
73 | * | ||
74 | * DESCRIPTION: Evaluate the object or find and execute the requested method | ||
75 | * | ||
76 | * MUTEX: Locks Namespace | ||
77 | * | ||
78 | ******************************************************************************/ | ||
79 | |||
80 | acpi_status | ||
81 | acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info) | ||
82 | { | ||
83 | acpi_status status; | ||
84 | struct acpi_namespace_node *node = NULL; | ||
85 | union acpi_generic_state *scope_info; | ||
86 | char *internal_path = NULL; | ||
87 | |||
88 | ACPI_FUNCTION_TRACE("ns_evaluate_relative"); | ||
89 | |||
90 | /* | ||
91 | * Must have a valid object handle | ||
92 | */ | ||
93 | if (!info || !info->node) { | ||
94 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
95 | } | ||
96 | |||
97 | /* Build an internal name string for the method */ | ||
98 | |||
99 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
100 | if (ACPI_FAILURE(status)) { | ||
101 | return_ACPI_STATUS(status); | ||
102 | } | ||
103 | |||
104 | scope_info = acpi_ut_create_generic_state(); | ||
105 | if (!scope_info) { | ||
106 | goto cleanup1; | ||
107 | } | ||
108 | |||
109 | /* Get the prefix handle and Node */ | ||
110 | |||
111 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
112 | if (ACPI_FAILURE(status)) { | ||
113 | goto cleanup; | ||
114 | } | ||
115 | |||
116 | info->node = acpi_ns_map_handle_to_node(info->node); | ||
117 | if (!info->node) { | ||
118 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
119 | status = AE_BAD_PARAMETER; | ||
120 | goto cleanup; | ||
121 | } | ||
122 | |||
123 | /* Lookup the name in the namespace */ | ||
124 | |||
125 | scope_info->scope.node = info->node; | ||
126 | status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY, | ||
127 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | ||
128 | &node); | ||
129 | |||
130 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
131 | |||
132 | if (ACPI_FAILURE(status)) { | ||
133 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", | ||
134 | pathname, acpi_format_exception(status))); | ||
135 | goto cleanup; | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * Now that we have a handle to the object, we can attempt to evaluate it. | ||
140 | */ | ||
141 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", | ||
142 | pathname, node, acpi_ns_get_attached_object(node))); | ||
143 | |||
144 | info->node = node; | ||
145 | status = acpi_ns_evaluate_by_handle(info); | ||
146 | |||
147 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
148 | "*** Completed eval of object %s ***\n", pathname)); | ||
149 | |||
150 | cleanup: | ||
151 | acpi_ut_delete_generic_state(scope_info); | ||
152 | |||
153 | cleanup1: | ||
154 | ACPI_MEM_FREE(internal_path); | ||
155 | return_ACPI_STATUS(status); | ||
156 | } | ||
157 | |||
158 | /******************************************************************************* | 52 | /******************************************************************************* |
159 | * | 53 | * |
160 | * FUNCTION: acpi_ns_evaluate_by_name | 54 | * FUNCTION: acpi_ns_evaluate |
161 | * | 55 | * |
162 | * PARAMETERS: Pathname - Fully qualified pathname to the object | 56 | * PARAMETERS: Info - Evaluation info block, contains: |
163 | * Info - Method info block, contains: | 57 | * prefix_node - Prefix or Method/Object Node to execute |
164 | * return_object - Where to put method's return value (if | 58 | * Pathname - Name of method to execute, If NULL, the |
165 | * any). If NULL, no value is returned. | 59 | * Node is the object to execute |
166 | * Params - List of parameters to pass to the method, | ||
167 | * terminated by NULL. Params itself may be | ||
168 | * NULL if no parameters are being passed. | ||
169 | * | ||
170 | * RETURN: Status | ||
171 | * | ||
172 | * DESCRIPTION: Evaluate the object or rind and execute the requested method | ||
173 | * passing the given parameters | ||
174 | * | ||
175 | * MUTEX: Locks Namespace | ||
176 | * | ||
177 | ******************************************************************************/ | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) | ||
181 | { | ||
182 | acpi_status status; | ||
183 | char *internal_path = NULL; | ||
184 | |||
185 | ACPI_FUNCTION_TRACE("ns_evaluate_by_name"); | ||
186 | |||
187 | /* Build an internal name string for the method */ | ||
188 | |||
189 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
190 | if (ACPI_FAILURE(status)) { | ||
191 | return_ACPI_STATUS(status); | ||
192 | } | ||
193 | |||
194 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
195 | if (ACPI_FAILURE(status)) { | ||
196 | goto cleanup; | ||
197 | } | ||
198 | |||
199 | /* Lookup the name in the namespace */ | ||
200 | |||
201 | status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, | ||
202 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | ||
203 | &info->node); | ||
204 | |||
205 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
206 | |||
207 | if (ACPI_FAILURE(status)) { | ||
208 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
209 | "Object at [%s] was not found, status=%.4X\n", | ||
210 | pathname, status)); | ||
211 | goto cleanup; | ||
212 | } | ||
213 | |||
214 | /* | ||
215 | * Now that we have a handle to the object, we can attempt to evaluate it. | ||
216 | */ | ||
217 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", | ||
218 | pathname, info->node, | ||
219 | acpi_ns_get_attached_object(info->node))); | ||
220 | |||
221 | status = acpi_ns_evaluate_by_handle(info); | ||
222 | |||
223 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
224 | "*** Completed eval of object %s ***\n", pathname)); | ||
225 | |||
226 | cleanup: | ||
227 | |||
228 | /* Cleanup */ | ||
229 | |||
230 | if (internal_path) { | ||
231 | ACPI_MEM_FREE(internal_path); | ||
232 | } | ||
233 | |||
234 | return_ACPI_STATUS(status); | ||
235 | } | ||
236 | |||
237 | /******************************************************************************* | ||
238 | * | ||
239 | * FUNCTION: acpi_ns_evaluate_by_handle | ||
240 | * | ||
241 | * PARAMETERS: Info - Method info block, contains: | ||
242 | * Node - Method/Object Node to execute | ||
243 | * Parameters - List of parameters to pass to the method, | 60 | * Parameters - List of parameters to pass to the method, |
244 | * terminated by NULL. Params itself may be | 61 | * terminated by NULL. Params itself may be |
245 | * NULL if no parameters are being passed. | 62 | * NULL if no parameters are being passed. |
@@ -248,29 +65,21 @@ acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) | |||
248 | * parameter_type - Type of Parameter list | 65 | * parameter_type - Type of Parameter list |
249 | * return_object - Where to put method's return value (if | 66 | * return_object - Where to put method's return value (if |
250 | * any). If NULL, no value is returned. | 67 | * any). If NULL, no value is returned. |
68 | * Flags - ACPI_IGNORE_RETURN_VALUE to delete return | ||
251 | * | 69 | * |
252 | * RETURN: Status | 70 | * RETURN: Status |
253 | * | 71 | * |
254 | * DESCRIPTION: Evaluate object or execute the requested method passing the | 72 | * DESCRIPTION: Execute a control method or return the current value of an |
255 | * given parameters | 73 | * ACPI namespace object. |
256 | * | 74 | * |
257 | * MUTEX: Locks Namespace | 75 | * MUTEX: Locks interpreter |
258 | * | 76 | * |
259 | ******************************************************************************/ | 77 | ******************************************************************************/ |
260 | 78 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |
261 | acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) | ||
262 | { | 79 | { |
263 | acpi_status status; | 80 | acpi_status status; |
264 | 81 | ||
265 | ACPI_FUNCTION_TRACE("ns_evaluate_by_handle"); | 82 | ACPI_FUNCTION_TRACE(ns_evaluate); |
266 | |||
267 | /* Check if namespace has been initialized */ | ||
268 | |||
269 | if (!acpi_gbl_root_node) { | ||
270 | return_ACPI_STATUS(AE_NO_NAMESPACE); | ||
271 | } | ||
272 | |||
273 | /* Parameter Validation */ | ||
274 | 83 | ||
275 | if (!info) { | 84 | if (!info) { |
276 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 85 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -280,202 +89,120 @@ acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) | |||
280 | 89 | ||
281 | info->return_object = NULL; | 90 | info->return_object = NULL; |
282 | 91 | ||
283 | /* Get the prefix handle and Node */ | 92 | /* |
284 | 93 | * Get the actual namespace node for the target object. Handles these cases: | |
285 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 94 | * |
95 | * 1) Null node, Pathname (absolute path) | ||
96 | * 2) Node, Pathname (path relative to Node) | ||
97 | * 3) Node, Null Pathname | ||
98 | */ | ||
99 | status = acpi_ns_get_node(info->prefix_node, info->pathname, | ||
100 | ACPI_NS_NO_UPSEARCH, &info->resolved_node); | ||
286 | if (ACPI_FAILURE(status)) { | 101 | if (ACPI_FAILURE(status)) { |
287 | return_ACPI_STATUS(status); | 102 | return_ACPI_STATUS(status); |
288 | } | 103 | } |
289 | 104 | ||
290 | info->node = acpi_ns_map_handle_to_node(info->node); | ||
291 | if (!info->node) { | ||
292 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
293 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
294 | } | ||
295 | |||
296 | /* | 105 | /* |
297 | * For a method alias, we must grab the actual method node so that proper | 106 | * For a method alias, we must grab the actual method node so that proper |
298 | * scoping context will be established before execution. | 107 | * scoping context will be established before execution. |
299 | */ | 108 | */ |
300 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 109 | if (acpi_ns_get_type(info->resolved_node) == |
301 | info->node = | 110 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
111 | info->resolved_node = | ||
302 | ACPI_CAST_PTR(struct acpi_namespace_node, | 112 | ACPI_CAST_PTR(struct acpi_namespace_node, |
303 | info->node->object); | 113 | info->resolved_node->object); |
304 | } | 114 | } |
305 | 115 | ||
116 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname, | ||
117 | info->resolved_node, | ||
118 | acpi_ns_get_attached_object(info->resolved_node))); | ||
119 | |||
306 | /* | 120 | /* |
307 | * Two major cases here: | 121 | * Two major cases here: |
308 | * 1) The object is an actual control method -- execute it. | ||
309 | * 2) The object is not a method -- just return it's current value | ||
310 | * | 122 | * |
311 | * In both cases, the namespace is unlocked by the acpi_ns* procedure | 123 | * 1) The object is a control method -- execute it |
124 | * 2) The object is not a method -- just return it's current value | ||
312 | */ | 125 | */ |
313 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) { | 126 | if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) { |
314 | /* | ||
315 | * Case 1) We have an actual control method to execute | ||
316 | */ | ||
317 | status = acpi_ns_execute_control_method(info); | ||
318 | } else { | ||
319 | /* | 127 | /* |
320 | * Case 2) Object is NOT a method, just return its current value | 128 | * 1) Object is a control method - execute it |
321 | */ | 129 | */ |
322 | status = acpi_ns_get_object_value(info); | ||
323 | } | ||
324 | |||
325 | /* | ||
326 | * Check if there is a return value on the stack that must be dealt with | ||
327 | */ | ||
328 | if (status == AE_CTRL_RETURN_VALUE) { | ||
329 | /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ | ||
330 | |||
331 | status = AE_OK; | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * Namespace was unlocked by the handling acpi_ns* function, so we | ||
336 | * just return | ||
337 | */ | ||
338 | return_ACPI_STATUS(status); | ||
339 | } | ||
340 | |||
341 | /******************************************************************************* | ||
342 | * | ||
343 | * FUNCTION: acpi_ns_execute_control_method | ||
344 | * | ||
345 | * PARAMETERS: Info - Method info block, contains: | ||
346 | * Node - Method Node to execute | ||
347 | * obj_desc - Method object | ||
348 | * Parameters - List of parameters to pass to the method, | ||
349 | * terminated by NULL. Params itself may be | ||
350 | * NULL if no parameters are being passed. | ||
351 | * return_object - Where to put method's return value (if | ||
352 | * any). If NULL, no value is returned. | ||
353 | * parameter_type - Type of Parameter list | ||
354 | * return_object - Where to put method's return value (if | ||
355 | * any). If NULL, no value is returned. | ||
356 | * | ||
357 | * RETURN: Status | ||
358 | * | ||
359 | * DESCRIPTION: Execute the requested method passing the given parameters | ||
360 | * | ||
361 | * MUTEX: Assumes namespace is locked | ||
362 | * | ||
363 | ******************************************************************************/ | ||
364 | |||
365 | static acpi_status | ||
366 | acpi_ns_execute_control_method(struct acpi_parameter_info *info) | ||
367 | { | ||
368 | acpi_status status; | ||
369 | |||
370 | ACPI_FUNCTION_TRACE("ns_execute_control_method"); | ||
371 | |||
372 | /* Verify that there is a method associated with this object */ | ||
373 | |||
374 | info->obj_desc = acpi_ns_get_attached_object(info->node); | ||
375 | if (!info->obj_desc) { | ||
376 | ACPI_ERROR((AE_INFO, "No attached method object")); | ||
377 | 130 | ||
378 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 131 | /* Verify that there is a method object associated with this node */ |
379 | return_ACPI_STATUS(AE_NULL_OBJECT); | ||
380 | } | ||
381 | |||
382 | ACPI_DUMP_PATHNAME(info->node, "Execute Method:", | ||
383 | ACPI_LV_INFO, _COMPONENT); | ||
384 | |||
385 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", | ||
386 | info->obj_desc->method.aml_start + 1, | ||
387 | info->obj_desc->method.aml_length - 1)); | ||
388 | |||
389 | /* | ||
390 | * Unlock the namespace before execution. This allows namespace access | ||
391 | * via the external Acpi* interfaces while a method is being executed. | ||
392 | * However, any namespace deletion must acquire both the namespace and | ||
393 | * interpreter locks to ensure that no thread is using the portion of the | ||
394 | * namespace that is being deleted. | ||
395 | */ | ||
396 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
397 | if (ACPI_FAILURE(status)) { | ||
398 | return_ACPI_STATUS(status); | ||
399 | } | ||
400 | 132 | ||
401 | /* | 133 | info->obj_desc = |
402 | * Execute the method via the interpreter. The interpreter is locked | 134 | acpi_ns_get_attached_object(info->resolved_node); |
403 | * here before calling into the AML parser | 135 | if (!info->obj_desc) { |
404 | */ | 136 | ACPI_ERROR((AE_INFO, |
405 | status = acpi_ex_enter_interpreter(); | 137 | "Control method has no attached sub-object")); |
406 | if (ACPI_FAILURE(status)) { | 138 | return_ACPI_STATUS(AE_NULL_OBJECT); |
407 | return_ACPI_STATUS(status); | 139 | } |
408 | } | ||
409 | 140 | ||
410 | status = acpi_ps_execute_method(info); | 141 | ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", |
411 | acpi_ex_exit_interpreter(); | 142 | ACPI_LV_INFO, _COMPONENT); |
412 | 143 | ||
413 | return_ACPI_STATUS(status); | 144 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
414 | } | 145 | "Method at AML address %p Length %X\n", |
146 | info->obj_desc->method.aml_start + 1, | ||
147 | info->obj_desc->method.aml_length - 1)); | ||
415 | 148 | ||
416 | /******************************************************************************* | 149 | /* |
417 | * | 150 | * Any namespace deletion must acquire both the namespace and |
418 | * FUNCTION: acpi_ns_get_object_value | 151 | * interpreter locks to ensure that no thread is using the portion of |
419 | * | 152 | * the namespace that is being deleted. |
420 | * PARAMETERS: Info - Method info block, contains: | 153 | * |
421 | * Node - Object's NS node | 154 | * Execute the method via the interpreter. The interpreter is locked |
422 | * return_object - Where to put object value (if | 155 | * here before calling into the AML parser |
423 | * any). If NULL, no value is returned. | 156 | */ |
424 | * | 157 | status = acpi_ex_enter_interpreter(); |
425 | * RETURN: Status | 158 | if (ACPI_FAILURE(status)) { |
426 | * | 159 | return_ACPI_STATUS(status); |
427 | * DESCRIPTION: Return the current value of the object | 160 | } |
428 | * | ||
429 | * MUTEX: Assumes namespace is locked, leaves namespace unlocked | ||
430 | * | ||
431 | ******************************************************************************/ | ||
432 | 161 | ||
433 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) | 162 | status = acpi_ps_execute_method(info); |
434 | { | 163 | acpi_ex_exit_interpreter(); |
435 | acpi_status status = AE_OK; | 164 | } else { |
436 | struct acpi_namespace_node *resolved_node = info->node; | 165 | /* |
166 | * 2) Object is not a method, return its current value | ||
167 | */ | ||
437 | 168 | ||
438 | ACPI_FUNCTION_TRACE("ns_get_object_value"); | 169 | /* |
170 | * Objects require additional resolution steps (e.g., the Node may be | ||
171 | * a field that must be read, etc.) -- we can't just grab the object | ||
172 | * out of the node. | ||
173 | * | ||
174 | * Use resolve_node_to_value() to get the associated value. | ||
175 | * | ||
176 | * NOTE: we can get away with passing in NULL for a walk state because | ||
177 | * resolved_node is guaranteed to not be a reference to either a method | ||
178 | * local or a method argument (because this interface is never called | ||
179 | * from a running method.) | ||
180 | * | ||
181 | * Even though we do not directly invoke the interpreter for object | ||
182 | * resolution, we must lock it because we could access an opregion. | ||
183 | * The opregion access code assumes that the interpreter is locked. | ||
184 | */ | ||
185 | status = acpi_ex_enter_interpreter(); | ||
186 | if (ACPI_FAILURE(status)) { | ||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
439 | 189 | ||
440 | /* | 190 | /* Function has a strange interface */ |
441 | * Objects require additional resolution steps (e.g., the Node may be a | ||
442 | * field that must be read, etc.) -- we can't just grab the object out of | ||
443 | * the node. | ||
444 | */ | ||
445 | 191 | ||
446 | /* | 192 | status = |
447 | * Use resolve_node_to_value() to get the associated value. This call always | 193 | acpi_ex_resolve_node_to_value(&info->resolved_node, NULL); |
448 | * deletes obj_desc (allocated above). | 194 | acpi_ex_exit_interpreter(); |
449 | * | ||
450 | * NOTE: we can get away with passing in NULL for a walk state because | ||
451 | * obj_desc is guaranteed to not be a reference to either a method local or | ||
452 | * a method argument (because this interface can only be called from the | ||
453 | * acpi_evaluate external interface, never called from a running method.) | ||
454 | * | ||
455 | * Even though we do not directly invoke the interpreter for this, we must | ||
456 | * enter it because we could access an opregion. The opregion access code | ||
457 | * assumes that the interpreter is locked. | ||
458 | * | ||
459 | * We must release the namespace lock before entering the intepreter. | ||
460 | */ | ||
461 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
462 | if (ACPI_FAILURE(status)) { | ||
463 | return_ACPI_STATUS(status); | ||
464 | } | ||
465 | 195 | ||
466 | status = acpi_ex_enter_interpreter(); | ||
467 | if (ACPI_SUCCESS(status)) { | ||
468 | status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); | ||
469 | /* | 196 | /* |
470 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed | 197 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed |
471 | * in resolved_node. | 198 | * in resolved_node. |
472 | */ | 199 | */ |
473 | acpi_ex_exit_interpreter(); | ||
474 | |||
475 | if (ACPI_SUCCESS(status)) { | 200 | if (ACPI_SUCCESS(status)) { |
476 | status = AE_CTRL_RETURN_VALUE; | 201 | status = AE_CTRL_RETURN_VALUE; |
477 | info->return_object = ACPI_CAST_PTR | 202 | info->return_object = |
478 | (union acpi_operand_object, resolved_node); | 203 | ACPI_CAST_PTR(union acpi_operand_object, |
204 | info->resolved_node); | ||
205 | |||
479 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
480 | "Returning object %p [%s]\n", | 207 | "Returning object %p [%s]\n", |
481 | info->return_object, | 208 | info->return_object, |
@@ -484,7 +211,30 @@ static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) | |||
484 | } | 211 | } |
485 | } | 212 | } |
486 | 213 | ||
487 | /* Namespace is unlocked */ | 214 | /* |
215 | * Check if there is a return value that must be dealt with | ||
216 | */ | ||
217 | if (status == AE_CTRL_RETURN_VALUE) { | ||
218 | |||
219 | /* If caller does not want the return value, delete it */ | ||
488 | 220 | ||
221 | if (info->flags & ACPI_IGNORE_RETURN_VALUE) { | ||
222 | acpi_ut_remove_reference(info->return_object); | ||
223 | info->return_object = NULL; | ||
224 | } | ||
225 | |||
226 | /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ | ||
227 | |||
228 | status = AE_OK; | ||
229 | } | ||
230 | |||
231 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
232 | "*** Completed evaluation of object %s ***\n", | ||
233 | info->pathname)); | ||
234 | |||
235 | /* | ||
236 | * Namespace was unlocked by the handling acpi_ns* function, so we | ||
237 | * just return | ||
238 | */ | ||
489 | return_ACPI_STATUS(status); | 239 | return_ACPI_STATUS(status); |
490 | } | 240 | } |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 9f929e479fd8..aec8488c0019 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -58,6 +58,10 @@ static acpi_status | |||
58 | acpi_ns_init_one_device(acpi_handle obj_handle, | 58 | acpi_ns_init_one_device(acpi_handle obj_handle, |
59 | u32 nesting_level, void *context, void **return_value); | 59 | u32 nesting_level, void *context, void **return_value); |
60 | 60 | ||
61 | static acpi_status | ||
62 | acpi_ns_find_ini_methods(acpi_handle obj_handle, | ||
63 | u32 nesting_level, void *context, void **return_value); | ||
64 | |||
61 | /******************************************************************************* | 65 | /******************************************************************************* |
62 | * | 66 | * |
63 | * FUNCTION: acpi_ns_initialize_objects | 67 | * FUNCTION: acpi_ns_initialize_objects |
@@ -76,7 +80,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
76 | acpi_status status; | 80 | acpi_status status; |
77 | struct acpi_init_walk_info info; | 81 | struct acpi_init_walk_info info; |
78 | 82 | ||
79 | ACPI_FUNCTION_TRACE("ns_initialize_objects"); | 83 | ACPI_FUNCTION_TRACE(ns_initialize_objects); |
80 | 84 | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 85 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
82 | "**** Starting initialization of namespace objects ****\n")); | 86 | "**** Starting initialization of namespace objects ****\n")); |
@@ -93,7 +97,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
93 | ACPI_UINT32_MAX, acpi_ns_init_one_object, | 97 | ACPI_UINT32_MAX, acpi_ns_init_one_object, |
94 | &info, NULL); | 98 | &info, NULL); |
95 | if (ACPI_FAILURE(status)) { | 99 | if (ACPI_FAILURE(status)) { |
96 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 100 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); |
97 | } | 101 | } |
98 | 102 | ||
99 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 103 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
@@ -133,7 +137,7 @@ acpi_status acpi_ns_initialize_devices(void) | |||
133 | acpi_status status; | 137 | acpi_status status; |
134 | struct acpi_device_walk_info info; | 138 | struct acpi_device_walk_info info; |
135 | 139 | ||
136 | ACPI_FUNCTION_TRACE("ns_initialize_devices"); | 140 | ACPI_FUNCTION_TRACE(ns_initialize_devices); |
137 | 141 | ||
138 | /* Init counters */ | 142 | /* Init counters */ |
139 | 143 | ||
@@ -142,30 +146,46 @@ acpi_status acpi_ns_initialize_devices(void) | |||
142 | info.num_INI = 0; | 146 | info.num_INI = 0; |
143 | 147 | ||
144 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 148 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
145 | "Executing all Device _STA and_INI methods:")); | 149 | "Initializing Device/Processor/Thermal objects by executing _INI methods:")); |
150 | |||
151 | /* Tree analysis: find all subtrees that contain _INI methods */ | ||
146 | 152 | ||
147 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 153 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
154 | ACPI_UINT32_MAX, FALSE, | ||
155 | acpi_ns_find_ini_methods, &info, NULL); | ||
148 | if (ACPI_FAILURE(status)) { | 156 | if (ACPI_FAILURE(status)) { |
149 | return_ACPI_STATUS(status); | 157 | goto error_exit; |
150 | } | 158 | } |
151 | 159 | ||
152 | /* Walk namespace for all objects */ | 160 | /* Allocate the evaluation information block */ |
161 | |||
162 | info.evaluate_info = | ||
163 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
164 | if (!info.evaluate_info) { | ||
165 | status = AE_NO_MEMORY; | ||
166 | goto error_exit; | ||
167 | } | ||
168 | |||
169 | /* Walk namespace to execute all _INIs on present devices */ | ||
153 | 170 | ||
154 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, | 171 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
155 | ACPI_UINT32_MAX, TRUE, | 172 | ACPI_UINT32_MAX, FALSE, |
156 | acpi_ns_init_one_device, &info, NULL); | 173 | acpi_ns_init_one_device, &info, NULL); |
157 | 174 | ||
158 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 175 | ACPI_FREE(info.evaluate_info); |
159 | |||
160 | if (ACPI_FAILURE(status)) { | 176 | if (ACPI_FAILURE(status)) { |
161 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 177 | goto error_exit; |
162 | } | 178 | } |
163 | 179 | ||
164 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 180 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
165 | "\n%hd Devices found - executed %hd _STA, %hd _INI methods\n", | 181 | "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n", |
166 | info.device_count, info.num_STA, info.num_INI)); | 182 | info.num_INI, info.num_STA, info.device_count)); |
167 | 183 | ||
168 | return_ACPI_STATUS(status); | 184 | return_ACPI_STATUS(status); |
185 | |||
186 | error_exit: | ||
187 | ACPI_EXCEPTION((AE_INFO, status, "During device initialization")); | ||
188 | return_ACPI_STATUS(status); | ||
169 | } | 189 | } |
170 | 190 | ||
171 | /******************************************************************************* | 191 | /******************************************************************************* |
@@ -200,7 +220,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
200 | (struct acpi_namespace_node *)obj_handle; | 220 | (struct acpi_namespace_node *)obj_handle; |
201 | union acpi_operand_object *obj_desc; | 221 | union acpi_operand_object *obj_desc; |
202 | 222 | ||
203 | ACPI_FUNCTION_NAME("ns_init_one_object"); | 223 | ACPI_FUNCTION_NAME(ns_init_one_object); |
204 | 224 | ||
205 | info->object_count++; | 225 | info->object_count++; |
206 | 226 | ||
@@ -311,6 +331,72 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
311 | 331 | ||
312 | /******************************************************************************* | 332 | /******************************************************************************* |
313 | * | 333 | * |
334 | * FUNCTION: acpi_ns_find_ini_methods | ||
335 | * | ||
336 | * PARAMETERS: acpi_walk_callback | ||
337 | * | ||
338 | * RETURN: acpi_status | ||
339 | * | ||
340 | * DESCRIPTION: Called during namespace walk. Finds objects named _INI under | ||
341 | * device/processor/thermal objects, and marks the entire subtree | ||
342 | * with a SUBTREE_HAS_INI flag. This flag is used during the | ||
343 | * subsequent device initialization walk to avoid entire subtrees | ||
344 | * that do not contain an _INI. | ||
345 | * | ||
346 | ******************************************************************************/ | ||
347 | |||
348 | static acpi_status | ||
349 | acpi_ns_find_ini_methods(acpi_handle obj_handle, | ||
350 | u32 nesting_level, void *context, void **return_value) | ||
351 | { | ||
352 | struct acpi_device_walk_info *info = | ||
353 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); | ||
354 | struct acpi_namespace_node *node; | ||
355 | struct acpi_namespace_node *parent_node; | ||
356 | |||
357 | /* Keep count of device/processor/thermal objects */ | ||
358 | |||
359 | node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); | ||
360 | if ((node->type == ACPI_TYPE_DEVICE) || | ||
361 | (node->type == ACPI_TYPE_PROCESSOR) || | ||
362 | (node->type == ACPI_TYPE_THERMAL)) { | ||
363 | info->device_count++; | ||
364 | return (AE_OK); | ||
365 | } | ||
366 | |||
367 | /* We are only looking for methods named _INI */ | ||
368 | |||
369 | if (!ACPI_COMPARE_NAME(node->name.ascii, METHOD_NAME__INI)) { | ||
370 | return (AE_OK); | ||
371 | } | ||
372 | |||
373 | /* | ||
374 | * The only _INI methods that we care about are those that are | ||
375 | * present under Device, Processor, and Thermal objects. | ||
376 | */ | ||
377 | parent_node = acpi_ns_get_parent_node(node); | ||
378 | switch (parent_node->type) { | ||
379 | case ACPI_TYPE_DEVICE: | ||
380 | case ACPI_TYPE_PROCESSOR: | ||
381 | case ACPI_TYPE_THERMAL: | ||
382 | |||
383 | /* Mark parent and bubble up the INI present flag to the root */ | ||
384 | |||
385 | while (parent_node) { | ||
386 | parent_node->flags |= ANOBJ_SUBTREE_HAS_INI; | ||
387 | parent_node = acpi_ns_get_parent_node(parent_node); | ||
388 | } | ||
389 | break; | ||
390 | |||
391 | default: | ||
392 | break; | ||
393 | } | ||
394 | |||
395 | return (AE_OK); | ||
396 | } | ||
397 | |||
398 | /******************************************************************************* | ||
399 | * | ||
314 | * FUNCTION: acpi_ns_init_one_device | 400 | * FUNCTION: acpi_ns_init_one_device |
315 | * | 401 | * |
316 | * PARAMETERS: acpi_walk_callback | 402 | * PARAMETERS: acpi_walk_callback |
@@ -327,119 +413,165 @@ static acpi_status | |||
327 | acpi_ns_init_one_device(acpi_handle obj_handle, | 413 | acpi_ns_init_one_device(acpi_handle obj_handle, |
328 | u32 nesting_level, void *context, void **return_value) | 414 | u32 nesting_level, void *context, void **return_value) |
329 | { | 415 | { |
330 | struct acpi_device_walk_info *info = | 416 | struct acpi_device_walk_info *walk_info = |
331 | (struct acpi_device_walk_info *)context; | 417 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); |
332 | struct acpi_parameter_info pinfo; | 418 | struct acpi_evaluate_info *info = walk_info->evaluate_info; |
333 | u32 flags; | 419 | u32 flags; |
334 | acpi_status status; | 420 | acpi_status status; |
335 | struct acpi_namespace_node *ini_node; | ||
336 | struct acpi_namespace_node *device_node; | 421 | struct acpi_namespace_node *device_node; |
337 | 422 | ||
338 | ACPI_FUNCTION_TRACE("ns_init_one_device"); | 423 | ACPI_FUNCTION_TRACE(ns_init_one_device); |
339 | 424 | ||
340 | device_node = acpi_ns_map_handle_to_node(obj_handle); | 425 | /* We are interested in Devices, Processors and thermal_zones only */ |
341 | if (!device_node) { | ||
342 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
343 | } | ||
344 | 426 | ||
345 | /* | 427 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); |
346 | * We will run _STA/_INI on Devices, Processors and thermal_zones only | ||
347 | */ | ||
348 | if ((device_node->type != ACPI_TYPE_DEVICE) && | 428 | if ((device_node->type != ACPI_TYPE_DEVICE) && |
349 | (device_node->type != ACPI_TYPE_PROCESSOR) && | 429 | (device_node->type != ACPI_TYPE_PROCESSOR) && |
350 | (device_node->type != ACPI_TYPE_THERMAL)) { | 430 | (device_node->type != ACPI_TYPE_THERMAL)) { |
351 | return_ACPI_STATUS(AE_OK); | 431 | return_ACPI_STATUS(AE_OK); |
352 | } | 432 | } |
353 | 433 | ||
354 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
355 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
356 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
357 | } | ||
358 | |||
359 | info->device_count++; | ||
360 | |||
361 | /* | 434 | /* |
362 | * Check if the _INI method exists for this device - | 435 | * Because of an earlier namespace analysis, all subtrees that contain an |
363 | * if _INI does not exist, there is no need to run _STA | 436 | * _INI method are tagged. |
364 | * No _INI means device requires no initialization | 437 | * |
438 | * If this device subtree does not contain any _INI methods, we | ||
439 | * can exit now and stop traversing this entire subtree. | ||
365 | */ | 440 | */ |
366 | status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), | 441 | if (!(device_node->flags & ANOBJ_SUBTREE_HAS_INI)) { |
367 | device_node, ACPI_TYPE_METHOD, &ini_node); | 442 | return_ACPI_STATUS(AE_CTRL_DEPTH); |
368 | if (ACPI_FAILURE(status)) { | ||
369 | /* No _INI method found - move on to next device */ | ||
370 | |||
371 | return_ACPI_STATUS(AE_OK); | ||
372 | } | 443 | } |
373 | 444 | ||
374 | /* | 445 | /* |
375 | * Run _STA to determine if we can run _INI on the device - | 446 | * Run _STA to determine if this device is present and functioning. We |
376 | * the device must be present before _INI can be run. | 447 | * must know this information for two important reasons (from ACPI spec): |
377 | * However, _STA is not required - assume device present if no _STA | 448 | * |
449 | * 1) We can only run _INI if the device is present. | ||
450 | * 2) We must abort the device tree walk on this subtree if the device is | ||
451 | * not present and is not functional (we will not examine the children) | ||
452 | * | ||
453 | * The _STA method is not required to be present under the device, we | ||
454 | * assume the device is present if _STA does not exist. | ||
378 | */ | 455 | */ |
379 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 456 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
380 | device_node, | 457 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__STA)); |
381 | METHOD_NAME__STA)); | ||
382 | |||
383 | pinfo.node = device_node; | ||
384 | pinfo.parameters = NULL; | ||
385 | pinfo.parameter_type = ACPI_PARAM_ARGS; | ||
386 | 458 | ||
387 | status = acpi_ut_execute_STA(pinfo.node, &flags); | 459 | status = acpi_ut_execute_STA(device_node, &flags); |
388 | if (ACPI_FAILURE(status)) { | 460 | if (ACPI_FAILURE(status)) { |
461 | |||
389 | /* Ignore error and move on to next device */ | 462 | /* Ignore error and move on to next device */ |
390 | 463 | ||
391 | return_ACPI_STATUS(AE_OK); | 464 | return_ACPI_STATUS(AE_OK); |
392 | } | 465 | } |
393 | 466 | ||
467 | /* | ||
468 | * Flags == -1 means that _STA was not found. In this case, we assume that | ||
469 | * the device is both present and functional. | ||
470 | * | ||
471 | * From the ACPI spec, description of _STA: | ||
472 | * | ||
473 | * "If a device object (including the processor object) does not have an | ||
474 | * _STA object, then OSPM assumes that all of the above bits are set (in | ||
475 | * other words, the device is present, ..., and functioning)" | ||
476 | */ | ||
394 | if (flags != ACPI_UINT32_MAX) { | 477 | if (flags != ACPI_UINT32_MAX) { |
395 | info->num_STA++; | 478 | walk_info->num_STA++; |
396 | } | 479 | } |
397 | 480 | ||
481 | /* | ||
482 | * Examine the PRESENT and FUNCTIONING status bits | ||
483 | * | ||
484 | * Note: ACPI spec does not seem to specify behavior for the present but | ||
485 | * not functioning case, so we assume functioning if present. | ||
486 | */ | ||
398 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 487 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
399 | /* Don't look at children of a not present device */ | ||
400 | 488 | ||
401 | return_ACPI_STATUS(AE_CTRL_DEPTH); | 489 | /* Device is not present, we must examine the Functioning bit */ |
490 | |||
491 | if (flags & ACPI_STA_DEVICE_FUNCTIONING) { | ||
492 | /* | ||
493 | * Device is not present but is "functioning". In this case, | ||
494 | * we will not run _INI, but we continue to examine the children | ||
495 | * of this device. | ||
496 | * | ||
497 | * From the ACPI spec, description of _STA: (Note - no mention | ||
498 | * of whether to run _INI or not on the device in question) | ||
499 | * | ||
500 | * "_STA may return bit 0 clear (not present) with bit 3 set | ||
501 | * (device is functional). This case is used to indicate a valid | ||
502 | * device for which no device driver should be loaded (for example, | ||
503 | * a bridge device.) Children of this device may be present and | ||
504 | * valid. OSPM should continue enumeration below a device whose | ||
505 | * _STA returns this bit combination" | ||
506 | */ | ||
507 | return_ACPI_STATUS(AE_OK); | ||
508 | } else { | ||
509 | /* | ||
510 | * Device is not present and is not functioning. We must abort the | ||
511 | * walk of this subtree immediately -- don't look at the children | ||
512 | * of such a device. | ||
513 | * | ||
514 | * From the ACPI spec, description of _INI: | ||
515 | * | ||
516 | * "If the _STA method indicates that the device is not present, | ||
517 | * OSPM will not run the _INI and will not examine the children | ||
518 | * of the device for _INI methods" | ||
519 | */ | ||
520 | return_ACPI_STATUS(AE_CTRL_DEPTH); | ||
521 | } | ||
402 | } | 522 | } |
403 | 523 | ||
404 | /* | 524 | /* |
405 | * The device is present and _INI exists. Run the _INI method. | 525 | * The device is present or is assumed present if no _STA exists. |
406 | * (We already have the _INI node from above) | 526 | * Run the _INI if it exists (not required to exist) |
527 | * | ||
528 | * Note: We know there is an _INI within this subtree, but it may not be | ||
529 | * under this particular device, it may be lower in the branch. | ||
407 | */ | 530 | */ |
408 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 531 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
409 | pinfo.node, | 532 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); |
410 | METHOD_NAME__INI)); | 533 | |
534 | info->prefix_node = device_node; | ||
535 | info->pathname = METHOD_NAME__INI; | ||
536 | info->parameters = NULL; | ||
537 | info->parameter_type = ACPI_PARAM_ARGS; | ||
538 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
539 | |||
540 | status = acpi_ns_evaluate(info); | ||
541 | if (ACPI_SUCCESS(status)) { | ||
542 | walk_info->num_INI++; | ||
543 | |||
544 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
545 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
546 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
547 | } | ||
548 | } | ||
549 | #ifdef ACPI_DEBUG_OUTPUT | ||
550 | else if (status != AE_NOT_FOUND) { | ||
411 | 551 | ||
412 | pinfo.node = ini_node; | ||
413 | status = acpi_ns_evaluate_by_handle(&pinfo); | ||
414 | if (ACPI_FAILURE(status)) { | ||
415 | /* Ignore error and move on to next device */ | 552 | /* Ignore error and move on to next device */ |
416 | 553 | ||
417 | #ifdef ACPI_DEBUG_OUTPUT | 554 | char *scope_name = |
418 | char *scope_name = acpi_ns_get_external_pathname(ini_node); | 555 | acpi_ns_get_external_pathname(info->resolved_node); |
419 | |||
420 | ACPI_WARNING((AE_INFO, "%s._INI failed: %s", | ||
421 | scope_name, acpi_format_exception(status))); | ||
422 | 556 | ||
423 | ACPI_MEM_FREE(scope_name); | 557 | ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", |
558 | scope_name)); | ||
559 | ACPI_FREE(scope_name); | ||
560 | } | ||
424 | #endif | 561 | #endif |
425 | } else { | ||
426 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
427 | 562 | ||
428 | if (pinfo.return_object) { | 563 | /* Ignore errors from above */ |
429 | acpi_ut_remove_reference(pinfo.return_object); | ||
430 | } | ||
431 | 564 | ||
432 | /* Count of successful INIs */ | 565 | status = AE_OK; |
433 | |||
434 | info->num_INI++; | ||
435 | } | ||
436 | 566 | ||
567 | /* | ||
568 | * The _INI method has been run if present; call the Global Initialization | ||
569 | * Handler for this device. | ||
570 | */ | ||
437 | if (acpi_gbl_init_handler) { | 571 | if (acpi_gbl_init_handler) { |
438 | /* External initialization handler is present, call it */ | ||
439 | |||
440 | status = | 572 | status = |
441 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | 573 | acpi_gbl_init_handler(device_node, ACPI_INIT_DEVICE_INI); |
442 | } | 574 | } |
443 | 575 | ||
444 | return_ACPI_STATUS(AE_OK); | 576 | return_ACPI_STATUS(status); |
445 | } | 577 | } |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 4e0b0524c188..fe75d888e183 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -77,13 +77,14 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, | |||
77 | { | 77 | { |
78 | acpi_status status; | 78 | acpi_status status; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ns_load_table"); | 80 | ACPI_FUNCTION_TRACE(ns_load_table); |
81 | 81 | ||
82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ | 82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ |
83 | 83 | ||
84 | if (! | 84 | if (! |
85 | (acpi_gbl_table_data[table_desc->type]. | 85 | (acpi_gbl_table_data[table_desc->type]. |
86 | flags & ACPI_TABLE_EXECUTABLE)) { | 86 | flags & ACPI_TABLE_EXECUTABLE)) { |
87 | |||
87 | /* Just ignore this table */ | 88 | /* Just ignore this table */ |
88 | 89 | ||
89 | return_ACPI_STATUS(AE_OK); | 90 | return_ACPI_STATUS(AE_OK); |
@@ -168,7 +169,7 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
168 | acpi_status status; | 169 | acpi_status status; |
169 | struct acpi_table_desc *table_desc; | 170 | struct acpi_table_desc *table_desc; |
170 | 171 | ||
171 | ACPI_FUNCTION_TRACE("ns_load_table_by_type"); | 172 | ACPI_FUNCTION_TRACE(ns_load_table_by_type); |
172 | 173 | ||
173 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | 174 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
174 | if (ACPI_FAILURE(status)) { | 175 | if (ACPI_FAILURE(status)) { |
@@ -180,11 +181,11 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
180 | * DSDT (one), SSDT/PSDT (multiple) | 181 | * DSDT (one), SSDT/PSDT (multiple) |
181 | */ | 182 | */ |
182 | switch (table_type) { | 183 | switch (table_type) { |
183 | case ACPI_TABLE_DSDT: | 184 | case ACPI_TABLE_ID_DSDT: |
184 | 185 | ||
185 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); | 186 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); |
186 | 187 | ||
187 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; | 188 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_DSDT].next; |
188 | 189 | ||
189 | /* If table already loaded into namespace, just return */ | 190 | /* If table already loaded into namespace, just return */ |
190 | 191 | ||
@@ -200,8 +201,8 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
200 | } | 201 | } |
201 | break; | 202 | break; |
202 | 203 | ||
203 | case ACPI_TABLE_SSDT: | 204 | case ACPI_TABLE_ID_SSDT: |
204 | case ACPI_TABLE_PSDT: | 205 | case ACPI_TABLE_ID_PSDT: |
205 | 206 | ||
206 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 207 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
207 | "Namespace load: %d SSDT or PSDTs\n", | 208 | "Namespace load: %d SSDT or PSDTs\n", |
@@ -258,7 +259,7 @@ acpi_status acpi_ns_load_namespace(void) | |||
258 | { | 259 | { |
259 | acpi_status status; | 260 | acpi_status status; |
260 | 261 | ||
261 | ACPI_FUNCTION_TRACE("acpi_load_name_space"); | 262 | ACPI_FUNCTION_TRACE(acpi_load_name_space); |
262 | 263 | ||
263 | /* There must be at least a DSDT installed */ | 264 | /* There must be at least a DSDT installed */ |
264 | 265 | ||
@@ -271,15 +272,15 @@ acpi_status acpi_ns_load_namespace(void) | |||
271 | * Load the namespace. The DSDT is required, | 272 | * Load the namespace. The DSDT is required, |
272 | * but the SSDT and PSDT tables are optional. | 273 | * but the SSDT and PSDT tables are optional. |
273 | */ | 274 | */ |
274 | status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT); | 275 | status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT); |
275 | if (ACPI_FAILURE(status)) { | 276 | if (ACPI_FAILURE(status)) { |
276 | return_ACPI_STATUS(status); | 277 | return_ACPI_STATUS(status); |
277 | } | 278 | } |
278 | 279 | ||
279 | /* Ignore exceptions from these */ | 280 | /* Ignore exceptions from these */ |
280 | 281 | ||
281 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT); | 282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_SSDT); |
282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT); | 283 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_PSDT); |
283 | 284 | ||
284 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 285 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
285 | "ACPI Namespace successfully loaded at root %p\n", | 286 | "ACPI Namespace successfully loaded at root %p\n", |
@@ -314,7 +315,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
314 | acpi_handle dummy; | 315 | acpi_handle dummy; |
315 | u32 level; | 316 | u32 level; |
316 | 317 | ||
317 | ACPI_FUNCTION_TRACE("ns_delete_subtree"); | 318 | ACPI_FUNCTION_TRACE(ns_delete_subtree); |
318 | 319 | ||
319 | parent_handle = start_handle; | 320 | parent_handle = start_handle; |
320 | child_handle = NULL; | 321 | child_handle = NULL; |
@@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
325 | * to where we started. | 326 | * to where we started. |
326 | */ | 327 | */ |
327 | while (level > 0) { | 328 | while (level > 0) { |
329 | |||
328 | /* Attempt to get the next object in this scope */ | 330 | /* Attempt to get the next object in this scope */ |
329 | 331 | ||
330 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, | 332 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, |
@@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
335 | /* Did we get a new object? */ | 337 | /* Did we get a new object? */ |
336 | 338 | ||
337 | if (ACPI_SUCCESS(status)) { | 339 | if (ACPI_SUCCESS(status)) { |
340 | |||
338 | /* Check if this object has any children */ | 341 | /* Check if this object has any children */ |
339 | 342 | ||
340 | if (ACPI_SUCCESS | 343 | if (ACPI_SUCCESS |
@@ -392,7 +395,7 @@ acpi_status acpi_ns_unload_namespace(acpi_handle handle) | |||
392 | { | 395 | { |
393 | acpi_status status; | 396 | acpi_status status; |
394 | 397 | ||
395 | ACPI_FUNCTION_TRACE("ns_unload_name_space"); | 398 | ACPI_FUNCTION_TRACE(ns_unload_name_space); |
396 | 399 | ||
397 | /* Parameter validation */ | 400 | /* Parameter validation */ |
398 | 401 | ||
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 639f653b4b6b..97b8332c9746 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -48,11 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsnames") | 49 | ACPI_MODULE_NAME("nsnames") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | static void | ||
53 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | ||
54 | acpi_size size, char *name_buffer); | ||
55 | |||
56 | /******************************************************************************* | 51 | /******************************************************************************* |
57 | * | 52 | * |
58 | * FUNCTION: acpi_ns_build_external_path | 53 | * FUNCTION: acpi_ns_build_external_path |
@@ -67,8 +62,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
67 | * DESCRIPTION: Generate a full pathaname | 62 | * DESCRIPTION: Generate a full pathaname |
68 | * | 63 | * |
69 | ******************************************************************************/ | 64 | ******************************************************************************/ |
70 | 65 | void | |
71 | static void | ||
72 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | 66 | acpi_ns_build_external_path(struct acpi_namespace_node *node, |
73 | acpi_size size, char *name_buffer) | 67 | acpi_size size, char *name_buffer) |
74 | { | 68 | { |
@@ -138,7 +132,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
138 | char *name_buffer; | 132 | char *name_buffer; |
139 | acpi_size size; | 133 | acpi_size size; |
140 | 134 | ||
141 | ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node); | 135 | ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node); |
142 | 136 | ||
143 | /* Calculate required buffer size based on depth below root */ | 137 | /* Calculate required buffer size based on depth below root */ |
144 | 138 | ||
@@ -146,7 +140,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
146 | 140 | ||
147 | /* Allocate a buffer to be returned to caller */ | 141 | /* Allocate a buffer to be returned to caller */ |
148 | 142 | ||
149 | name_buffer = ACPI_MEM_CALLOCATE(size); | 143 | name_buffer = ACPI_ALLOCATE_ZEROED(size); |
150 | if (!name_buffer) { | 144 | if (!name_buffer) { |
151 | ACPI_ERROR((AE_INFO, "Allocation failure")); | 145 | ACPI_ERROR((AE_INFO, "Allocation failure")); |
152 | return_PTR(NULL); | 146 | return_PTR(NULL); |
@@ -219,7 +213,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
219 | struct acpi_namespace_node *node; | 213 | struct acpi_namespace_node *node; |
220 | acpi_size required_size; | 214 | acpi_size required_size; |
221 | 215 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle); | 216 | ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle); |
223 | 217 | ||
224 | node = acpi_ns_map_handle_to_node(target_handle); | 218 | node = acpi_ns_map_handle_to_node(target_handle); |
225 | if (!node) { | 219 | if (!node) { |
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 10ae6292bca4..aabe8794b908 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c | |||
@@ -76,19 +76,21 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
76 | union acpi_operand_object *last_obj_desc; | 76 | union acpi_operand_object *last_obj_desc; |
77 | acpi_object_type object_type = ACPI_TYPE_ANY; | 77 | acpi_object_type object_type = ACPI_TYPE_ANY; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE("ns_attach_object"); | 79 | ACPI_FUNCTION_TRACE(ns_attach_object); |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Parameter validation | 82 | * Parameter validation |
83 | */ | 83 | */ |
84 | if (!node) { | 84 | if (!node) { |
85 | |||
85 | /* Invalid handle */ | 86 | /* Invalid handle */ |
86 | 87 | ||
87 | ACPI_ERROR((AE_INFO, "Null named_obj handle")); | 88 | ACPI_ERROR((AE_INFO, "Null NamedObj handle")); |
88 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 89 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
89 | } | 90 | } |
90 | 91 | ||
91 | if (!object && (ACPI_TYPE_ANY != type)) { | 92 | if (!object && (ACPI_TYPE_ANY != type)) { |
93 | |||
92 | /* Null object */ | 94 | /* Null object */ |
93 | 95 | ||
94 | ACPI_ERROR((AE_INFO, | 96 | ACPI_ERROR((AE_INFO, |
@@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
97 | } | 99 | } |
98 | 100 | ||
99 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { | 101 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
102 | |||
100 | /* Not a name handle */ | 103 | /* Not a name handle */ |
101 | 104 | ||
102 | ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", | 105 | ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", |
@@ -108,7 +111,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
108 | 111 | ||
109 | if (node->object == object) { | 112 | if (node->object == object) { |
110 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
111 | "Obj %p already installed in name_obj %p\n", | 114 | "Obj %p already installed in NameObj %p\n", |
112 | object, node)); | 115 | object, node)); |
113 | 116 | ||
114 | return_ACPI_STATUS(AE_OK); | 117 | return_ACPI_STATUS(AE_OK); |
@@ -201,7 +204,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) | |||
201 | { | 204 | { |
202 | union acpi_operand_object *obj_desc; | 205 | union acpi_operand_object *obj_desc; |
203 | 206 | ||
204 | ACPI_FUNCTION_TRACE("ns_detach_object"); | 207 | ACPI_FUNCTION_TRACE(ns_detach_object); |
205 | 208 | ||
206 | obj_desc = node->object; | 209 | obj_desc = node->object; |
207 | 210 | ||
@@ -252,7 +255,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct | |||
252 | acpi_namespace_node | 255 | acpi_namespace_node |
253 | *node) | 256 | *node) |
254 | { | 257 | { |
255 | ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); | 258 | ACPI_FUNCTION_TRACE_PTR(ns_get_attached_object, node); |
256 | 259 | ||
257 | if (!node) { | 260 | if (!node) { |
258 | ACPI_WARNING((AE_INFO, "Null Node ptr")); | 261 | ACPI_WARNING((AE_INFO, "Null Node ptr")); |
@@ -287,7 +290,7 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union | |||
287 | acpi_operand_object | 290 | acpi_operand_object |
288 | *obj_desc) | 291 | *obj_desc) |
289 | { | 292 | { |
290 | ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc); | 293 | ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc); |
291 | 294 | ||
292 | if ((!obj_desc) || | 295 | if ((!obj_desc) || |
293 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || | 296 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || |
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 232be4303653..155505a4ef69 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -62,13 +62,13 @@ ACPI_MODULE_NAME("nsparse") | |||
62 | * | 62 | * |
63 | ******************************************************************************/ | 63 | ******************************************************************************/ |
64 | acpi_status | 64 | acpi_status |
65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc) | 65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) |
66 | { | 66 | { |
67 | union acpi_parse_object *parse_root; | 67 | union acpi_parse_object *parse_root; |
68 | acpi_status status; | 68 | acpi_status status; |
69 | struct acpi_walk_state *walk_state; | 69 | struct acpi_walk_state *walk_state; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ns_one_complete_parse"); | 71 | ACPI_FUNCTION_TRACE(ns_one_complete_parse); |
72 | 72 | ||
73 | /* Create and init a Root Node */ | 73 | /* Create and init a Root Node */ |
74 | 74 | ||
@@ -124,7 +124,7 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc, | |||
124 | { | 124 | { |
125 | acpi_status status; | 125 | acpi_status status; |
126 | 126 | ||
127 | ACPI_FUNCTION_TRACE("ns_parse_table"); | 127 | ACPI_FUNCTION_TRACE(ns_parse_table); |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * AML Parse, pass 1 | 130 | * AML Parse, pass 1 |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index d64b78952f24..500e2bbcfaf7 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -56,16 +56,16 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
56 | 56 | ||
57 | /******************************************************************************* | 57 | /******************************************************************************* |
58 | * | 58 | * |
59 | * FUNCTION: acpi_ns_search_node | 59 | * FUNCTION: acpi_ns_search_one_scope |
60 | * | 60 | * |
61 | * PARAMETERS: target_name - Ascii ACPI name to search for | 61 | * PARAMETERS: target_name - Ascii ACPI name to search for |
62 | * Node - Starting node where search will begin | 62 | * parent_node - Starting node where search will begin |
63 | * Type - Object type to match | 63 | * Type - Object type to match |
64 | * return_node - Where the matched Named obj is returned | 64 | * return_node - Where the matched Named obj is returned |
65 | * | 65 | * |
66 | * RETURN: Status | 66 | * RETURN: Status |
67 | * | 67 | * |
68 | * DESCRIPTION: Search a single level of the namespace. Performs a | 68 | * DESCRIPTION: Search a single level of the namespace. Performs a |
69 | * simple search of the specified level, and does not add | 69 | * simple search of the specified level, and does not add |
70 | * entries or search parents. | 70 | * entries or search parents. |
71 | * | 71 | * |
@@ -75,35 +75,40 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
75 | * | 75 | * |
76 | * All namespace searching is linear in this implementation, but | 76 | * All namespace searching is linear in this implementation, but |
77 | * could be easily modified to support any improved search | 77 | * could be easily modified to support any improved search |
78 | * algorithm. However, the linear search was chosen for simplicity | 78 | * algorithm. However, the linear search was chosen for simplicity |
79 | * and because the trees are small and the other interpreter | 79 | * and because the trees are small and the other interpreter |
80 | * execution overhead is relatively high. | 80 | * execution overhead is relatively high. |
81 | * | 81 | * |
82 | * Note: CPU execution analysis has shown that the AML interpreter spends | ||
83 | * a very small percentage of its time searching the namespace. Therefore, | ||
84 | * the linear search seems to be sufficient, as there would seem to be | ||
85 | * little value in improving the search. | ||
86 | * | ||
82 | ******************************************************************************/ | 87 | ******************************************************************************/ |
83 | 88 | ||
84 | acpi_status | 89 | acpi_status |
85 | acpi_ns_search_node(u32 target_name, | 90 | acpi_ns_search_one_scope(u32 target_name, |
86 | struct acpi_namespace_node *node, | 91 | struct acpi_namespace_node *parent_node, |
87 | acpi_object_type type, | 92 | acpi_object_type type, |
88 | struct acpi_namespace_node **return_node) | 93 | struct acpi_namespace_node **return_node) |
89 | { | 94 | { |
90 | struct acpi_namespace_node *next_node; | 95 | struct acpi_namespace_node *node; |
91 | 96 | ||
92 | ACPI_FUNCTION_TRACE("ns_search_node"); | 97 | ACPI_FUNCTION_TRACE(ns_search_one_scope); |
93 | 98 | ||
94 | #ifdef ACPI_DEBUG_OUTPUT | 99 | #ifdef ACPI_DEBUG_OUTPUT |
95 | if (ACPI_LV_NAMES & acpi_dbg_level) { | 100 | if (ACPI_LV_NAMES & acpi_dbg_level) { |
96 | char *scope_name; | 101 | char *scope_name; |
97 | 102 | ||
98 | scope_name = acpi_ns_get_external_pathname(node); | 103 | scope_name = acpi_ns_get_external_pathname(parent_node); |
99 | if (scope_name) { | 104 | if (scope_name) { |
100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 105 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
101 | "Searching %s (%p) For [%4.4s] (%s)\n", | 106 | "Searching %s (%p) For [%4.4s] (%s)\n", |
102 | scope_name, node, ACPI_CAST_PTR(char, | 107 | scope_name, parent_node, |
103 | &target_name), | 108 | ACPI_CAST_PTR(char, &target_name), |
104 | acpi_ut_get_type_name(type))); | 109 | acpi_ut_get_type_name(type))); |
105 | 110 | ||
106 | ACPI_MEM_FREE(scope_name); | 111 | ACPI_FREE(scope_name); |
107 | } | 112 | } |
108 | } | 113 | } |
109 | #endif | 114 | #endif |
@@ -112,32 +117,33 @@ acpi_ns_search_node(u32 target_name, | |||
112 | * Search for name at this namespace level, which is to say that we | 117 | * Search for name at this namespace level, which is to say that we |
113 | * must search for the name among the children of this object | 118 | * must search for the name among the children of this object |
114 | */ | 119 | */ |
115 | next_node = node->child; | 120 | node = parent_node->child; |
116 | while (next_node) { | 121 | while (node) { |
122 | |||
117 | /* Check for match against the name */ | 123 | /* Check for match against the name */ |
118 | 124 | ||
119 | if (next_node->name.integer == target_name) { | 125 | if (node->name.integer == target_name) { |
126 | |||
120 | /* Resolve a control method alias if any */ | 127 | /* Resolve a control method alias if any */ |
121 | 128 | ||
122 | if (acpi_ns_get_type(next_node) == | 129 | if (acpi_ns_get_type(node) == |
123 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 130 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
124 | next_node = | 131 | node = |
125 | ACPI_CAST_PTR(struct acpi_namespace_node, | 132 | ACPI_CAST_PTR(struct acpi_namespace_node, |
126 | next_node->object); | 133 | node->object); |
127 | } | 134 | } |
128 | 135 | ||
129 | /* | 136 | /* Found matching entry */ |
130 | * Found matching entry. | 137 | |
131 | */ | ||
132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 138 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", | 139 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", |
134 | ACPI_CAST_PTR(char, &target_name), | 140 | ACPI_CAST_PTR(char, &target_name), |
135 | acpi_ut_get_type_name(next_node-> | 141 | acpi_ut_get_type_name(node->type), |
136 | type), | 142 | node, |
137 | next_node, | 143 | acpi_ut_get_node_name(parent_node), |
138 | acpi_ut_get_node_name(node), node)); | 144 | parent_node)); |
139 | 145 | ||
140 | *return_node = next_node; | 146 | *return_node = node; |
141 | return_ACPI_STATUS(AE_OK); | 147 | return_ACPI_STATUS(AE_OK); |
142 | } | 148 | } |
143 | 149 | ||
@@ -145,7 +151,8 @@ acpi_ns_search_node(u32 target_name, | |||
145 | * The last entry in the list points back to the parent, | 151 | * The last entry in the list points back to the parent, |
146 | * so a flag is used to indicate the end-of-list | 152 | * so a flag is used to indicate the end-of-list |
147 | */ | 153 | */ |
148 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 154 | if (node->flags & ANOBJ_END_OF_PEER_LIST) { |
155 | |||
149 | /* Searched entire list, we are done */ | 156 | /* Searched entire list, we are done */ |
150 | 157 | ||
151 | break; | 158 | break; |
@@ -153,7 +160,7 @@ acpi_ns_search_node(u32 target_name, | |||
153 | 160 | ||
154 | /* Didn't match name, move on to the next peer object */ | 161 | /* Didn't match name, move on to the next peer object */ |
155 | 162 | ||
156 | next_node = next_node->peer; | 163 | node = node->peer; |
157 | } | 164 | } |
158 | 165 | ||
159 | /* Searched entire namespace level, not found */ | 166 | /* Searched entire namespace level, not found */ |
@@ -162,7 +169,8 @@ acpi_ns_search_node(u32 target_name, | |||
162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", | 169 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", |
163 | ACPI_CAST_PTR(char, &target_name), | 170 | ACPI_CAST_PTR(char, &target_name), |
164 | acpi_ut_get_type_name(type), | 171 | acpi_ut_get_type_name(type), |
165 | acpi_ut_get_node_name(node), node, node->child)); | 172 | acpi_ut_get_node_name(parent_node), parent_node, |
173 | parent_node->child)); | ||
166 | 174 | ||
167 | return_ACPI_STATUS(AE_NOT_FOUND); | 175 | return_ACPI_STATUS(AE_NOT_FOUND); |
168 | } | 176 | } |
@@ -179,14 +187,14 @@ acpi_ns_search_node(u32 target_name, | |||
179 | * RETURN: Status | 187 | * RETURN: Status |
180 | * | 188 | * |
181 | * DESCRIPTION: Called when a name has not been found in the current namespace | 189 | * DESCRIPTION: Called when a name has not been found in the current namespace |
182 | * level. Before adding it or giving up, ACPI scope rules require | 190 | * level. Before adding it or giving up, ACPI scope rules require |
183 | * searching enclosing scopes in cases identified by acpi_ns_local(). | 191 | * searching enclosing scopes in cases identified by acpi_ns_local(). |
184 | * | 192 | * |
185 | * "A name is located by finding the matching name in the current | 193 | * "A name is located by finding the matching name in the current |
186 | * name space, and then in the parent name space. If the parent | 194 | * name space, and then in the parent name space. If the parent |
187 | * name space does not contain the name, the search continues | 195 | * name space does not contain the name, the search continues |
188 | * recursively until either the name is found or the name space | 196 | * recursively until either the name is found or the name space |
189 | * does not have a parent (the root of the name space). This | 197 | * does not have a parent (the root of the name space). This |
190 | * indicates that the name is not found" (From ACPI Specification, | 198 | * indicates that the name is not found" (From ACPI Specification, |
191 | * section 5.3) | 199 | * section 5.3) |
192 | * | 200 | * |
@@ -201,7 +209,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
201 | acpi_status status; | 209 | acpi_status status; |
202 | struct acpi_namespace_node *parent_node; | 210 | struct acpi_namespace_node *parent_node; |
203 | 211 | ||
204 | ACPI_FUNCTION_TRACE("ns_search_parent_tree"); | 212 | ACPI_FUNCTION_TRACE(ns_search_parent_tree); |
205 | 213 | ||
206 | parent_node = acpi_ns_get_parent_node(node); | 214 | parent_node = acpi_ns_get_parent_node(node); |
207 | 215 | ||
@@ -235,20 +243,19 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
235 | */ | 243 | */ |
236 | while (parent_node) { | 244 | while (parent_node) { |
237 | /* | 245 | /* |
238 | * Search parent scope. Use TYPE_ANY because we don't care about the | 246 | * Search parent scope. Use TYPE_ANY because we don't care about the |
239 | * object type at this point, we only care about the existence of | 247 | * object type at this point, we only care about the existence of |
240 | * the actual name we are searching for. Typechecking comes later. | 248 | * the actual name we are searching for. Typechecking comes later. |
241 | */ | 249 | */ |
242 | status = acpi_ns_search_node(target_name, parent_node, | 250 | status = |
251 | acpi_ns_search_one_scope(target_name, parent_node, | ||
243 | ACPI_TYPE_ANY, return_node); | 252 | ACPI_TYPE_ANY, return_node); |
244 | if (ACPI_SUCCESS(status)) { | 253 | if (ACPI_SUCCESS(status)) { |
245 | return_ACPI_STATUS(status); | 254 | return_ACPI_STATUS(status); |
246 | } | 255 | } |
247 | 256 | ||
248 | /* | 257 | /* Not found here, go up another level (until we reach the root) */ |
249 | * Not found here, go up another level | 258 | |
250 | * (until we reach the root) | ||
251 | */ | ||
252 | parent_node = acpi_ns_get_parent_node(parent_node); | 259 | parent_node = acpi_ns_get_parent_node(parent_node); |
253 | } | 260 | } |
254 | 261 | ||
@@ -273,7 +280,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
273 | * RETURN: Status | 280 | * RETURN: Status |
274 | * | 281 | * |
275 | * DESCRIPTION: Search for a name segment in a single namespace level, | 282 | * DESCRIPTION: Search for a name segment in a single namespace level, |
276 | * optionally adding it if it is not found. If the passed | 283 | * optionally adding it if it is not found. If the passed |
277 | * Type is not Any and the type previously stored in the | 284 | * Type is not Any and the type previously stored in the |
278 | * entry was Any (i.e. unknown), update the stored type. | 285 | * entry was Any (i.e. unknown), update the stored type. |
279 | * | 286 | * |
@@ -293,29 +300,46 @@ acpi_ns_search_and_enter(u32 target_name, | |||
293 | acpi_status status; | 300 | acpi_status status; |
294 | struct acpi_namespace_node *new_node; | 301 | struct acpi_namespace_node *new_node; |
295 | 302 | ||
296 | ACPI_FUNCTION_TRACE("ns_search_and_enter"); | 303 | ACPI_FUNCTION_TRACE(ns_search_and_enter); |
297 | 304 | ||
298 | /* Parameter validation */ | 305 | /* Parameter validation */ |
299 | 306 | ||
300 | if (!node || !target_name || !return_node) { | 307 | if (!node || !target_name || !return_node) { |
301 | ACPI_ERROR((AE_INFO, | 308 | ACPI_ERROR((AE_INFO, |
302 | "Null param: Node %p Name %X return_node %p", | 309 | "Null parameter: Node %p Name %X ReturnNode %p", |
303 | node, target_name, return_node)); | 310 | node, target_name, return_node)); |
304 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 311 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
305 | } | 312 | } |
306 | 313 | ||
307 | /* Name must consist of printable characters */ | 314 | /* |
308 | 315 | * Name must consist of valid ACPI characters. We will repair the name if | |
316 | * necessary because we don't want to abort because of this, but we want | ||
317 | * all namespace names to be printable. A warning message is appropriate. | ||
318 | * | ||
319 | * This issue came up because there are in fact machines that exhibit | ||
320 | * this problem, and we want to be able to enable ACPI support for them, | ||
321 | * even though there are a few bad names. | ||
322 | */ | ||
309 | if (!acpi_ut_valid_acpi_name(target_name)) { | 323 | if (!acpi_ut_valid_acpi_name(target_name)) { |
310 | ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X", | 324 | target_name = acpi_ut_repair_name(target_name); |
311 | target_name)); | 325 | |
312 | return_ACPI_STATUS(AE_BAD_CHARACTER); | 326 | /* Report warning only if in strict mode or debug mode */ |
327 | |||
328 | if (!acpi_gbl_enable_interpreter_slack) { | ||
329 | ACPI_WARNING((AE_INFO, | ||
330 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
331 | ACPI_CAST_PTR(char, &target_name))); | ||
332 | } else { | ||
333 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | ||
334 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
335 | ACPI_CAST_PTR(char, &target_name))); | ||
336 | } | ||
313 | } | 337 | } |
314 | 338 | ||
315 | /* Try to find the name in the namespace level specified by the caller */ | 339 | /* Try to find the name in the namespace level specified by the caller */ |
316 | 340 | ||
317 | *return_node = ACPI_ENTRY_NOT_FOUND; | 341 | *return_node = ACPI_ENTRY_NOT_FOUND; |
318 | status = acpi_ns_search_node(target_name, node, type, return_node); | 342 | status = acpi_ns_search_one_scope(target_name, node, type, return_node); |
319 | if (status != AE_NOT_FOUND) { | 343 | if (status != AE_NOT_FOUND) { |
320 | /* | 344 | /* |
321 | * If we found it AND the request specifies that a find is an error, | 345 | * If we found it AND the request specifies that a find is an error, |
@@ -325,18 +349,16 @@ acpi_ns_search_and_enter(u32 target_name, | |||
325 | status = AE_ALREADY_EXISTS; | 349 | status = AE_ALREADY_EXISTS; |
326 | } | 350 | } |
327 | 351 | ||
328 | /* | 352 | /* Either found it or there was an error: finished either way */ |
329 | * Either found it or there was an error | 353 | |
330 | * -- finished either way | ||
331 | */ | ||
332 | return_ACPI_STATUS(status); | 354 | return_ACPI_STATUS(status); |
333 | } | 355 | } |
334 | 356 | ||
335 | /* | 357 | /* |
336 | * The name was not found. If we are NOT performing the first pass | 358 | * The name was not found. If we are NOT performing the first pass |
337 | * (name entry) of loading the namespace, search the parent tree (all the | 359 | * (name entry) of loading the namespace, search the parent tree (all the |
338 | * way to the root if necessary.) We don't want to perform the parent | 360 | * way to the root if necessary.) We don't want to perform the parent |
339 | * search when the namespace is actually being loaded. We want to perform | 361 | * search when the namespace is actually being loaded. We want to perform |
340 | * the search when namespace references are being resolved (load pass 2) | 362 | * the search when namespace references are being resolved (load pass 2) |
341 | * and during the execution phase. | 363 | * and during the execution phase. |
342 | */ | 364 | */ |
@@ -354,9 +376,8 @@ acpi_ns_search_and_enter(u32 target_name, | |||
354 | } | 376 | } |
355 | } | 377 | } |
356 | 378 | ||
357 | /* | 379 | /* In execute mode, just search, never add names. Exit now */ |
358 | * In execute mode, just search, never add names. Exit now. | 380 | |
359 | */ | ||
360 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { | 381 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { |
361 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 382 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
362 | "%4.4s Not found in %p [Not adding]\n", | 383 | "%4.4s Not found in %p [Not adding]\n", |
@@ -371,11 +392,18 @@ acpi_ns_search_and_enter(u32 target_name, | |||
371 | if (!new_node) { | 392 | if (!new_node) { |
372 | return_ACPI_STATUS(AE_NO_MEMORY); | 393 | return_ACPI_STATUS(AE_NO_MEMORY); |
373 | } | 394 | } |
395 | #ifdef ACPI_ASL_COMPILER | ||
396 | /* | ||
397 | * Node is an object defined by an External() statement | ||
398 | */ | ||
399 | if (flags & ACPI_NS_EXTERNAL) { | ||
400 | new_node->flags |= ANOBJ_IS_EXTERNAL; | ||
401 | } | ||
402 | #endif | ||
374 | 403 | ||
375 | /* Install the new object into the parent's list of children */ | 404 | /* Install the new object into the parent's list of children */ |
376 | 405 | ||
377 | acpi_ns_install_node(walk_state, node, new_node, type); | 406 | acpi_ns_install_node(walk_state, node, new_node, type); |
378 | *return_node = new_node; | 407 | *return_node = new_node; |
379 | |||
380 | return_ACPI_STATUS(AE_OK); | 408 | return_ACPI_STATUS(AE_OK); |
381 | } | 409 | } |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 3e7cad549a38..aa4e799d9a8c 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -78,15 +78,17 @@ acpi_ns_report_error(char *module_name, | |||
78 | char *internal_name, acpi_status lookup_status) | 78 | char *internal_name, acpi_status lookup_status) |
79 | { | 79 | { |
80 | acpi_status status; | 80 | acpi_status status; |
81 | u32 bad_name; | ||
81 | char *name = NULL; | 82 | char *name = NULL; |
82 | 83 | ||
83 | acpi_ut_report_error(module_name, line_number); | 84 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
84 | 85 | ||
85 | if (lookup_status == AE_BAD_CHARACTER) { | 86 | if (lookup_status == AE_BAD_CHARACTER) { |
87 | |||
86 | /* There is a non-ascii character in the name */ | 88 | /* There is a non-ascii character in the name */ |
87 | 89 | ||
88 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", | 90 | ACPI_MOVE_32_TO_32(&bad_name, internal_name); |
89 | *(ACPI_CAST_PTR(u32, internal_name))); | 91 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); |
90 | } else { | 92 | } else { |
91 | /* Convert path to external format */ | 93 | /* Convert path to external format */ |
92 | 94 | ||
@@ -102,7 +104,7 @@ acpi_ns_report_error(char *module_name, | |||
102 | } | 104 | } |
103 | 105 | ||
104 | if (name) { | 106 | if (name) { |
105 | ACPI_MEM_FREE(name); | 107 | ACPI_FREE(name); |
106 | } | 108 | } |
107 | } | 109 | } |
108 | 110 | ||
@@ -137,11 +139,12 @@ acpi_ns_report_method_error(char *module_name, | |||
137 | acpi_status status; | 139 | acpi_status status; |
138 | struct acpi_namespace_node *node = prefix_node; | 140 | struct acpi_namespace_node *node = prefix_node; |
139 | 141 | ||
140 | acpi_ut_report_error(module_name, line_number); | 142 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
141 | 143 | ||
142 | if (path) { | 144 | if (path) { |
143 | status = acpi_ns_get_node_by_path(path, prefix_node, | 145 | status = |
144 | ACPI_NS_NO_UPSEARCH, &node); | 146 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, |
147 | &node); | ||
145 | if (ACPI_FAILURE(status)) { | 148 | if (ACPI_FAILURE(status)) { |
146 | acpi_os_printf("[Could not get node by pathname]"); | 149 | acpi_os_printf("[Could not get node by pathname]"); |
147 | } | 150 | } |
@@ -185,7 +188,7 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) | |||
185 | } | 188 | } |
186 | 189 | ||
187 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); | 190 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); |
188 | ACPI_MEM_FREE(buffer.pointer); | 191 | ACPI_FREE(buffer.pointer); |
189 | } | 192 | } |
190 | } | 193 | } |
191 | 194 | ||
@@ -239,7 +242,7 @@ static u8 acpi_ns_valid_path_separator(char sep) | |||
239 | 242 | ||
240 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | 243 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) |
241 | { | 244 | { |
242 | ACPI_FUNCTION_TRACE("ns_get_type"); | 245 | ACPI_FUNCTION_TRACE(ns_get_type); |
243 | 246 | ||
244 | if (!node) { | 247 | if (!node) { |
245 | ACPI_WARNING((AE_INFO, "Null Node parameter")); | 248 | ACPI_WARNING((AE_INFO, "Null Node parameter")); |
@@ -264,9 +267,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | |||
264 | 267 | ||
265 | u32 acpi_ns_local(acpi_object_type type) | 268 | u32 acpi_ns_local(acpi_object_type type) |
266 | { | 269 | { |
267 | ACPI_FUNCTION_TRACE("ns_local"); | 270 | ACPI_FUNCTION_TRACE(ns_local); |
268 | 271 | ||
269 | if (!acpi_ut_valid_object_type(type)) { | 272 | if (!acpi_ut_valid_object_type(type)) { |
273 | |||
270 | /* Type code out of range */ | 274 | /* Type code out of range */ |
271 | 275 | ||
272 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); | 276 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); |
@@ -363,7 +367,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
363 | char *result = NULL; | 367 | char *result = NULL; |
364 | acpi_native_uint i; | 368 | acpi_native_uint i; |
365 | 369 | ||
366 | ACPI_FUNCTION_TRACE("ns_build_internal_name"); | 370 | ACPI_FUNCTION_TRACE(ns_build_internal_name); |
367 | 371 | ||
368 | /* Setup the correct prefixes, counts, and pointers */ | 372 | /* Setup the correct prefixes, counts, and pointers */ |
369 | 373 | ||
@@ -411,6 +415,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
411 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 415 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
412 | if (acpi_ns_valid_path_separator(*external_name) || | 416 | if (acpi_ns_valid_path_separator(*external_name) || |
413 | (*external_name == 0)) { | 417 | (*external_name == 0)) { |
418 | |||
414 | /* Pad the segment with underscore(s) if segment is short */ | 419 | /* Pad the segment with underscore(s) if segment is short */ |
415 | 420 | ||
416 | result[i] = '_'; | 421 | result[i] = '_'; |
@@ -473,7 +478,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
473 | struct acpi_namestring_info info; | 478 | struct acpi_namestring_info info; |
474 | acpi_status status; | 479 | acpi_status status; |
475 | 480 | ||
476 | ACPI_FUNCTION_TRACE("ns_internalize_name"); | 481 | ACPI_FUNCTION_TRACE(ns_internalize_name); |
477 | 482 | ||
478 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { | 483 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { |
479 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 484 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -486,7 +491,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
486 | 491 | ||
487 | /* We need a segment to store the internal name */ | 492 | /* We need a segment to store the internal name */ |
488 | 493 | ||
489 | internal_name = ACPI_MEM_CALLOCATE(info.length); | 494 | internal_name = ACPI_ALLOCATE_ZEROED(info.length); |
490 | if (!internal_name) { | 495 | if (!internal_name) { |
491 | return_ACPI_STATUS(AE_NO_MEMORY); | 496 | return_ACPI_STATUS(AE_NO_MEMORY); |
492 | } | 497 | } |
@@ -496,7 +501,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
496 | info.internal_name = internal_name; | 501 | info.internal_name = internal_name; |
497 | status = acpi_ns_build_internal_name(&info); | 502 | status = acpi_ns_build_internal_name(&info); |
498 | if (ACPI_FAILURE(status)) { | 503 | if (ACPI_FAILURE(status)) { |
499 | ACPI_MEM_FREE(internal_name); | 504 | ACPI_FREE(internal_name); |
500 | return_ACPI_STATUS(status); | 505 | return_ACPI_STATUS(status); |
501 | } | 506 | } |
502 | 507 | ||
@@ -533,7 +538,7 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
533 | acpi_native_uint i = 0; | 538 | acpi_native_uint i = 0; |
534 | acpi_native_uint j = 0; | 539 | acpi_native_uint j = 0; |
535 | 540 | ||
536 | ACPI_FUNCTION_TRACE("ns_externalize_name"); | 541 | ACPI_FUNCTION_TRACE(ns_externalize_name); |
537 | 542 | ||
538 | if (!internal_name_length || !internal_name || !converted_name) { | 543 | if (!internal_name_length || !internal_name || !converted_name) { |
539 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 544 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -628,7 +633,7 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
628 | /* | 633 | /* |
629 | * Build converted_name | 634 | * Build converted_name |
630 | */ | 635 | */ |
631 | *converted_name = ACPI_MEM_CALLOCATE(required_length); | 636 | *converted_name = ACPI_ALLOCATE_ZEROED(required_length); |
632 | if (!(*converted_name)) { | 637 | if (!(*converted_name)) { |
633 | return_ACPI_STATUS(AE_NO_MEMORY); | 638 | return_ACPI_STATUS(AE_NO_MEMORY); |
634 | } | 639 | } |
@@ -681,13 +686,9 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
681 | ACPI_FUNCTION_ENTRY(); | 686 | ACPI_FUNCTION_ENTRY(); |
682 | 687 | ||
683 | /* | 688 | /* |
684 | * Simple implementation. | 689 | * Simple implementation |
685 | */ | 690 | */ |
686 | if (!handle) { | 691 | if ((!handle) || (handle == ACPI_ROOT_OBJECT)) { |
687 | return (NULL); | ||
688 | } | ||
689 | |||
690 | if (handle == ACPI_ROOT_OBJECT) { | ||
691 | return (acpi_gbl_root_node); | 692 | return (acpi_gbl_root_node); |
692 | } | 693 | } |
693 | 694 | ||
@@ -697,7 +698,7 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
697 | return (NULL); | 698 | return (NULL); |
698 | } | 699 | } |
699 | 700 | ||
700 | return ((struct acpi_namespace_node *)handle); | 701 | return (ACPI_CAST_PTR(struct acpi_namespace_node, handle)); |
701 | } | 702 | } |
702 | 703 | ||
703 | /******************************************************************************* | 704 | /******************************************************************************* |
@@ -752,7 +753,7 @@ void acpi_ns_terminate(void) | |||
752 | { | 753 | { |
753 | union acpi_operand_object *obj_desc; | 754 | union acpi_operand_object *obj_desc; |
754 | 755 | ||
755 | ACPI_FUNCTION_TRACE("ns_terminate"); | 756 | ACPI_FUNCTION_TRACE(ns_terminate); |
756 | 757 | ||
757 | /* | 758 | /* |
758 | * 1) Free the entire namespace -- all nodes and objects | 759 | * 1) Free the entire namespace -- all nodes and objects |
@@ -792,9 +793,10 @@ void acpi_ns_terminate(void) | |||
792 | 793 | ||
793 | u32 acpi_ns_opens_scope(acpi_object_type type) | 794 | u32 acpi_ns_opens_scope(acpi_object_type type) |
794 | { | 795 | { |
795 | ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); | 796 | ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type)); |
796 | 797 | ||
797 | if (!acpi_ut_valid_object_type(type)) { | 798 | if (!acpi_ut_valid_object_type(type)) { |
799 | |||
798 | /* type code out of range */ | 800 | /* type code out of range */ |
799 | 801 | ||
800 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); | 802 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); |
@@ -806,12 +808,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
806 | 808 | ||
807 | /******************************************************************************* | 809 | /******************************************************************************* |
808 | * | 810 | * |
809 | * FUNCTION: acpi_ns_get_node_by_path | 811 | * FUNCTION: acpi_ns_get_node |
810 | * | 812 | * |
811 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The | 813 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The |
812 | * \ (backslash) and ^ (carat) prefixes, and the | 814 | * \ (backslash) and ^ (carat) prefixes, and the |
813 | * . (period) to separate segments are supported. | 815 | * . (period) to separate segments are supported. |
814 | * start_node - Root of subtree to be searched, or NS_ALL for the | 816 | * prefix_node - Root of subtree to be searched, or NS_ALL for the |
815 | * root of the name space. If Name is fully | 817 | * root of the name space. If Name is fully |
816 | * qualified (first s8 is '\'), the passed value | 818 | * qualified (first s8 is '\'), the passed value |
817 | * of Scope will not be accessed. | 819 | * of Scope will not be accessed. |
@@ -827,23 +829,29 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
827 | ******************************************************************************/ | 829 | ******************************************************************************/ |
828 | 830 | ||
829 | acpi_status | 831 | acpi_status |
830 | acpi_ns_get_node_by_path(char *pathname, | 832 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
831 | struct acpi_namespace_node *start_node, | 833 | char *pathname, |
832 | u32 flags, struct acpi_namespace_node **return_node) | 834 | u32 flags, struct acpi_namespace_node **return_node) |
833 | { | 835 | { |
834 | union acpi_generic_state scope_info; | 836 | union acpi_generic_state scope_info; |
835 | acpi_status status; | 837 | acpi_status status; |
836 | char *internal_path = NULL; | 838 | char *internal_path; |
837 | |||
838 | ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); | ||
839 | 839 | ||
840 | if (pathname) { | 840 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname); |
841 | /* Convert path to internal representation */ | ||
842 | 841 | ||
843 | status = acpi_ns_internalize_name(pathname, &internal_path); | 842 | if (!pathname) { |
844 | if (ACPI_FAILURE(status)) { | 843 | *return_node = prefix_node; |
845 | return_ACPI_STATUS(status); | 844 | if (!prefix_node) { |
845 | *return_node = acpi_gbl_root_node; | ||
846 | } | 846 | } |
847 | return_ACPI_STATUS(AE_OK); | ||
848 | } | ||
849 | |||
850 | /* Convert path to internal representation */ | ||
851 | |||
852 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
853 | if (ACPI_FAILURE(status)) { | ||
854 | return_ACPI_STATUS(status); | ||
847 | } | 855 | } |
848 | 856 | ||
849 | /* Must lock namespace during lookup */ | 857 | /* Must lock namespace during lookup */ |
@@ -855,26 +863,23 @@ acpi_ns_get_node_by_path(char *pathname, | |||
855 | 863 | ||
856 | /* Setup lookup scope (search starting point) */ | 864 | /* Setup lookup scope (search starting point) */ |
857 | 865 | ||
858 | scope_info.scope.node = start_node; | 866 | scope_info.scope.node = prefix_node; |
859 | 867 | ||
860 | /* Lookup the name in the namespace */ | 868 | /* Lookup the name in the namespace */ |
861 | 869 | ||
862 | status = acpi_ns_lookup(&scope_info, internal_path, | 870 | status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY, |
863 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 871 | ACPI_IMODE_EXECUTE, |
864 | (flags | ACPI_NS_DONT_OPEN_SCOPE), | 872 | (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, |
865 | NULL, return_node); | 873 | return_node); |
866 | if (ACPI_FAILURE(status)) { | 874 | if (ACPI_FAILURE(status)) { |
867 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", | 875 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", |
868 | internal_path, | 876 | pathname, acpi_format_exception(status))); |
869 | acpi_format_exception(status))); | ||
870 | } | 877 | } |
871 | 878 | ||
872 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 879 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
873 | 880 | ||
874 | cleanup: | 881 | cleanup: |
875 | if (internal_path) { | 882 | ACPI_FREE(internal_path); |
876 | ACPI_MEM_FREE(internal_path); | ||
877 | } | ||
878 | return_ACPI_STATUS(status); | 883 | return_ACPI_STATUS(status); |
879 | } | 884 | } |
880 | 885 | ||
@@ -960,9 +965,10 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) | |||
960 | { | 965 | { |
961 | struct acpi_namespace_node *parent_node; | 966 | struct acpi_namespace_node *parent_node; |
962 | 967 | ||
963 | ACPI_FUNCTION_TRACE("ns_find_parent_name"); | 968 | ACPI_FUNCTION_TRACE(ns_find_parent_name); |
964 | 969 | ||
965 | if (child_node) { | 970 | if (child_node) { |
971 | |||
966 | /* Valid entry. Get the parent Node */ | 972 | /* Valid entry. Get the parent Node */ |
967 | 973 | ||
968 | parent_node = acpi_ns_get_parent_node(child_node); | 974 | parent_node = acpi_ns_get_parent_node(child_node); |
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index fcab1e784b81..c8f6bef16ed0 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
76 | ACPI_FUNCTION_ENTRY(); | 76 | ACPI_FUNCTION_ENTRY(); |
77 | 77 | ||
78 | if (!child_node) { | 78 | if (!child_node) { |
79 | |||
79 | /* It's really the parent's _scope_ that we want */ | 80 | /* It's really the parent's _scope_ that we want */ |
80 | 81 | ||
81 | if (parent_node->child) { | 82 | if (parent_node->child) { |
@@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
92 | /* If any type is OK, we are done */ | 93 | /* If any type is OK, we are done */ |
93 | 94 | ||
94 | if (type == ACPI_TYPE_ANY) { | 95 | if (type == ACPI_TYPE_ANY) { |
96 | |||
95 | /* next_node is NULL if we are at the end-of-list */ | 97 | /* next_node is NULL if we are at the end-of-list */ |
96 | 98 | ||
97 | return (next_node); | 99 | return (next_node); |
@@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
100 | /* Must search for the node -- but within this scope only */ | 102 | /* Must search for the node -- but within this scope only */ |
101 | 103 | ||
102 | while (next_node) { | 104 | while (next_node) { |
105 | |||
103 | /* If type matches, we are done */ | 106 | /* If type matches, we are done */ |
104 | 107 | ||
105 | if (next_node->type == type) { | 108 | if (next_node->type == type) { |
@@ -161,7 +164,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
161 | acpi_object_type child_type; | 164 | acpi_object_type child_type; |
162 | u32 level; | 165 | u32 level; |
163 | 166 | ||
164 | ACPI_FUNCTION_TRACE("ns_walk_namespace"); | 167 | ACPI_FUNCTION_TRACE(ns_walk_namespace); |
165 | 168 | ||
166 | /* Special case for the namespace Root Node */ | 169 | /* Special case for the namespace Root Node */ |
167 | 170 | ||
@@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
182 | * bubbled up to (and passed) the original parent handle (start_entry) | 185 | * bubbled up to (and passed) the original parent handle (start_entry) |
183 | */ | 186 | */ |
184 | while (level > 0) { | 187 | while (level > 0) { |
188 | |||
185 | /* Get the next node in this scope. Null if not found */ | 189 | /* Get the next node in this scope. Null if not found */ |
186 | 190 | ||
187 | status = AE_OK; | 191 | status = AE_OK; |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index a95f636dc35d..6d9bd45af30a 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
@@ -51,6 +49,7 @@ | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME("nsxfeval") | 50 | ACPI_MODULE_NAME("nsxfeval") |
53 | 51 | ||
52 | #ifdef ACPI_FUTURE_USAGE | ||
54 | /******************************************************************************* | 53 | /******************************************************************************* |
55 | * | 54 | * |
56 | * FUNCTION: acpi_evaluate_object_typed | 55 | * FUNCTION: acpi_evaluate_object_typed |
@@ -71,18 +70,17 @@ ACPI_MODULE_NAME("nsxfeval") | |||
71 | * be valid (non-null) | 70 | * be valid (non-null) |
72 | * | 71 | * |
73 | ******************************************************************************/ | 72 | ******************************************************************************/ |
74 | #ifdef ACPI_FUTURE_USAGE | ||
75 | acpi_status | 73 | acpi_status |
76 | acpi_evaluate_object_typed(acpi_handle handle, | 74 | acpi_evaluate_object_typed(acpi_handle handle, |
77 | acpi_string pathname, | 75 | acpi_string pathname, |
78 | struct acpi_object_list *external_params, | 76 | struct acpi_object_list * external_params, |
79 | struct acpi_buffer *return_buffer, | 77 | struct acpi_buffer * return_buffer, |
80 | acpi_object_type return_type) | 78 | acpi_object_type return_type) |
81 | { | 79 | { |
82 | acpi_status status; | 80 | acpi_status status; |
83 | u8 must_free = FALSE; | 81 | u8 must_free = FALSE; |
84 | 82 | ||
85 | ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed"); | 83 | ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); |
86 | 84 | ||
87 | /* Return buffer must be valid */ | 85 | /* Return buffer must be valid */ |
88 | 86 | ||
@@ -110,6 +108,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
110 | } | 108 | } |
111 | 109 | ||
112 | if (return_buffer->length == 0) { | 110 | if (return_buffer->length == 0) { |
111 | |||
113 | /* Error because caller specifically asked for a return value */ | 112 | /* Error because caller specifically asked for a return value */ |
114 | 113 | ||
115 | ACPI_ERROR((AE_INFO, "No return value")); | 114 | ACPI_ERROR((AE_INFO, "No return value")); |
@@ -131,6 +130,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
131 | acpi_ut_get_type_name(return_type))); | 130 | acpi_ut_get_type_name(return_type))); |
132 | 131 | ||
133 | if (must_free) { | 132 | if (must_free) { |
133 | |||
134 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ | 134 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ |
135 | 135 | ||
136 | acpi_os_free(return_buffer->pointer); | 136 | acpi_os_free(return_buffer->pointer); |
@@ -140,6 +140,8 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
140 | return_buffer->length = 0; | 140 | return_buffer->length = 0; |
141 | return_ACPI_STATUS(AE_TYPE); | 141 | return_ACPI_STATUS(AE_TYPE); |
142 | } | 142 | } |
143 | |||
144 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) | ||
143 | #endif /* ACPI_FUTURE_USAGE */ | 145 | #endif /* ACPI_FUTURE_USAGE */ |
144 | 146 | ||
145 | /******************************************************************************* | 147 | /******************************************************************************* |
@@ -161,7 +163,6 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
161 | * be valid (non-null) | 163 | * be valid (non-null) |
162 | * | 164 | * |
163 | ******************************************************************************/ | 165 | ******************************************************************************/ |
164 | |||
165 | acpi_status | 166 | acpi_status |
166 | acpi_evaluate_object(acpi_handle handle, | 167 | acpi_evaluate_object(acpi_handle handle, |
167 | acpi_string pathname, | 168 | acpi_string pathname, |
@@ -170,51 +171,61 @@ acpi_evaluate_object(acpi_handle handle, | |||
170 | { | 171 | { |
171 | acpi_status status; | 172 | acpi_status status; |
172 | acpi_status status2; | 173 | acpi_status status2; |
173 | struct acpi_parameter_info info; | 174 | struct acpi_evaluate_info *info; |
174 | acpi_size buffer_space_needed; | 175 | acpi_size buffer_space_needed; |
175 | u32 i; | 176 | u32 i; |
176 | 177 | ||
177 | ACPI_FUNCTION_TRACE("acpi_evaluate_object"); | 178 | ACPI_FUNCTION_TRACE(acpi_evaluate_object); |
178 | 179 | ||
179 | info.node = handle; | 180 | /* Allocate and initialize the evaluation information block */ |
180 | info.parameters = NULL; | 181 | |
181 | info.return_object = NULL; | 182 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
182 | info.parameter_type = ACPI_PARAM_ARGS; | 183 | if (!info) { |
184 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
185 | } | ||
186 | |||
187 | info->pathname = pathname; | ||
188 | info->parameter_type = ACPI_PARAM_ARGS; | ||
189 | |||
190 | /* Convert and validate the device handle */ | ||
191 | |||
192 | info->prefix_node = acpi_ns_map_handle_to_node(handle); | ||
193 | if (!info->prefix_node) { | ||
194 | status = AE_BAD_PARAMETER; | ||
195 | goto cleanup; | ||
196 | } | ||
183 | 197 | ||
184 | /* | 198 | /* |
185 | * If there are parameters to be passed to the object | 199 | * If there are parameters to be passed to a control method, the external |
186 | * (which must be a control method), the external objects | 200 | * objects must all be converted to internal objects |
187 | * must be converted to internal objects | ||
188 | */ | 201 | */ |
189 | if (external_params && external_params->count) { | 202 | if (external_params && external_params->count) { |
190 | /* | 203 | /* |
191 | * Allocate a new parameter block for the internal objects | 204 | * Allocate a new parameter block for the internal objects |
192 | * Add 1 to count to allow for null terminated internal list | 205 | * Add 1 to count to allow for null terminated internal list |
193 | */ | 206 | */ |
194 | info.parameters = ACPI_MEM_CALLOCATE(((acpi_size) | 207 | info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) |
195 | external_params->count + | 208 | external_params-> |
196 | 1) * sizeof(void *)); | 209 | count + |
197 | if (!info.parameters) { | 210 | 1) * sizeof(void *)); |
198 | return_ACPI_STATUS(AE_NO_MEMORY); | 211 | if (!info->parameters) { |
212 | status = AE_NO_MEMORY; | ||
213 | goto cleanup; | ||
199 | } | 214 | } |
200 | 215 | ||
201 | /* | 216 | /* Convert each external object in the list to an internal object */ |
202 | * Convert each external object in the list to an | 217 | |
203 | * internal object | ||
204 | */ | ||
205 | for (i = 0; i < external_params->count; i++) { | 218 | for (i = 0; i < external_params->count; i++) { |
206 | status = | 219 | status = |
207 | acpi_ut_copy_eobject_to_iobject(&external_params-> | 220 | acpi_ut_copy_eobject_to_iobject(&external_params-> |
208 | pointer[i], | 221 | pointer[i], |
209 | &info. | 222 | &info-> |
210 | parameters[i]); | 223 | parameters[i]); |
211 | if (ACPI_FAILURE(status)) { | 224 | if (ACPI_FAILURE(status)) { |
212 | acpi_ut_delete_internal_object_list(info. | 225 | goto cleanup; |
213 | parameters); | ||
214 | return_ACPI_STATUS(status); | ||
215 | } | 226 | } |
216 | } | 227 | } |
217 | info.parameters[external_params->count] = NULL; | 228 | info->parameters[external_params->count] = NULL; |
218 | } | 229 | } |
219 | 230 | ||
220 | /* | 231 | /* |
@@ -224,43 +235,31 @@ acpi_evaluate_object(acpi_handle handle, | |||
224 | * 3) Valid handle | 235 | * 3) Valid handle |
225 | */ | 236 | */ |
226 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { | 237 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { |
227 | /* | 238 | |
228 | * The path is fully qualified, just evaluate by name | 239 | /* The path is fully qualified, just evaluate by name */ |
229 | */ | 240 | |
230 | status = acpi_ns_evaluate_by_name(pathname, &info); | 241 | info->prefix_node = NULL; |
242 | status = acpi_ns_evaluate(info); | ||
231 | } else if (!handle) { | 243 | } else if (!handle) { |
232 | /* | 244 | /* |
233 | * A handle is optional iff a fully qualified pathname | 245 | * A handle is optional iff a fully qualified pathname is specified. |
234 | * is specified. Since we've already handled fully | 246 | * Since we've already handled fully qualified names above, this is |
235 | * qualified names above, this is an error | 247 | * an error |
236 | */ | 248 | */ |
237 | if (!pathname) { | 249 | if (!pathname) { |
238 | ACPI_ERROR((AE_INFO, | 250 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
239 | "Both Handle and Pathname are NULL")); | 251 | "Both Handle and Pathname are NULL")); |
240 | } else { | 252 | } else { |
241 | ACPI_ERROR((AE_INFO, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
242 | "Handle is NULL and Pathname is relative")); | 254 | "Null Handle with relative pathname [%s]", |
255 | pathname)); | ||
243 | } | 256 | } |
244 | 257 | ||
245 | status = AE_BAD_PARAMETER; | 258 | status = AE_BAD_PARAMETER; |
246 | } else { | 259 | } else { |
247 | /* | 260 | /* We have a namespace a node and a possible relative path */ |
248 | * We get here if we have a handle -- and if we have a | 261 | |
249 | * pathname it is relative. The handle will be validated | 262 | status = acpi_ns_evaluate(info); |
250 | * in the lower procedures | ||
251 | */ | ||
252 | if (!pathname) { | ||
253 | /* | ||
254 | * The null pathname case means the handle is for | ||
255 | * the actual object to be evaluated | ||
256 | */ | ||
257 | status = acpi_ns_evaluate_by_handle(&info); | ||
258 | } else { | ||
259 | /* | ||
260 | * Both a Handle and a relative Pathname | ||
261 | */ | ||
262 | status = acpi_ns_evaluate_relative(pathname, &info); | ||
263 | } | ||
264 | } | 263 | } |
265 | 264 | ||
266 | /* | 265 | /* |
@@ -268,10 +267,10 @@ acpi_evaluate_object(acpi_handle handle, | |||
268 | * copy the return value to an external object. | 267 | * copy the return value to an external object. |
269 | */ | 268 | */ |
270 | if (return_buffer) { | 269 | if (return_buffer) { |
271 | if (!info.return_object) { | 270 | if (!info->return_object) { |
272 | return_buffer->length = 0; | 271 | return_buffer->length = 0; |
273 | } else { | 272 | } else { |
274 | if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) == | 273 | if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) == |
275 | ACPI_DESC_TYPE_NAMED) { | 274 | ACPI_DESC_TYPE_NAMED) { |
276 | /* | 275 | /* |
277 | * If we received a NS Node as a return object, this means that | 276 | * If we received a NS Node as a return object, this means that |
@@ -282,19 +281,19 @@ acpi_evaluate_object(acpi_handle handle, | |||
282 | * support for various types at a later date if necessary. | 281 | * support for various types at a later date if necessary. |
283 | */ | 282 | */ |
284 | status = AE_TYPE; | 283 | status = AE_TYPE; |
285 | info.return_object = NULL; /* No need to delete a NS Node */ | 284 | info->return_object = NULL; /* No need to delete a NS Node */ |
286 | return_buffer->length = 0; | 285 | return_buffer->length = 0; |
287 | } | 286 | } |
288 | 287 | ||
289 | if (ACPI_SUCCESS(status)) { | 288 | if (ACPI_SUCCESS(status)) { |
290 | /* | 289 | |
291 | * Find out how large a buffer is needed | 290 | /* Get the size of the returned object */ |
292 | * to contain the returned object | 291 | |
293 | */ | ||
294 | status = | 292 | status = |
295 | acpi_ut_get_object_size(info.return_object, | 293 | acpi_ut_get_object_size(info->return_object, |
296 | &buffer_space_needed); | 294 | &buffer_space_needed); |
297 | if (ACPI_SUCCESS(status)) { | 295 | if (ACPI_SUCCESS(status)) { |
296 | |||
298 | /* Validate/Allocate/Clear caller buffer */ | 297 | /* Validate/Allocate/Clear caller buffer */ |
299 | 298 | ||
300 | status = | 299 | status = |
@@ -303,7 +302,8 @@ acpi_evaluate_object(acpi_handle handle, | |||
303 | buffer_space_needed); | 302 | buffer_space_needed); |
304 | if (ACPI_FAILURE(status)) { | 303 | if (ACPI_FAILURE(status)) { |
305 | /* | 304 | /* |
306 | * Caller's buffer is too small or a new one can't be allocated | 305 | * Caller's buffer is too small or a new one can't |
306 | * be allocated | ||
307 | */ | 307 | */ |
308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
309 | "Needed buffer size %X, %s\n", | 309 | "Needed buffer size %X, %s\n", |
@@ -312,12 +312,11 @@ acpi_evaluate_object(acpi_handle handle, | |||
312 | acpi_format_exception | 312 | acpi_format_exception |
313 | (status))); | 313 | (status))); |
314 | } else { | 314 | } else { |
315 | /* | 315 | /* We have enough space for the object, build it */ |
316 | * We have enough space for the object, build it | 316 | |
317 | */ | ||
318 | status = | 317 | status = |
319 | acpi_ut_copy_iobject_to_eobject | 318 | acpi_ut_copy_iobject_to_eobject |
320 | (info.return_object, | 319 | (info->return_object, |
321 | return_buffer); | 320 | return_buffer); |
322 | } | 321 | } |
323 | } | 322 | } |
@@ -325,35 +324,37 @@ acpi_evaluate_object(acpi_handle handle, | |||
325 | } | 324 | } |
326 | } | 325 | } |
327 | 326 | ||
328 | if (info.return_object) { | 327 | if (info->return_object) { |
329 | /* | 328 | /* |
330 | * Delete the internal return object. NOTE: Interpreter | 329 | * Delete the internal return object. NOTE: Interpreter must be |
331 | * must be locked to avoid race condition. | 330 | * locked to avoid race condition. |
332 | */ | 331 | */ |
333 | status2 = acpi_ex_enter_interpreter(); | 332 | status2 = acpi_ex_enter_interpreter(); |
334 | if (ACPI_SUCCESS(status2)) { | 333 | if (ACPI_SUCCESS(status2)) { |
335 | /* | 334 | |
336 | * Delete the internal return object. (Or at least | 335 | /* Remove one reference on the return object (should delete it) */ |
337 | * decrement the reference count by one) | 336 | |
338 | */ | 337 | acpi_ut_remove_reference(info->return_object); |
339 | acpi_ut_remove_reference(info.return_object); | ||
340 | acpi_ex_exit_interpreter(); | 338 | acpi_ex_exit_interpreter(); |
341 | } | 339 | } |
342 | } | 340 | } |
343 | 341 | ||
344 | /* | 342 | cleanup: |
345 | * Free the input parameter list (if we created one), | 343 | |
346 | */ | 344 | /* Free the input parameter list (if we created one) */ |
347 | if (info.parameters) { | 345 | |
346 | if (info->parameters) { | ||
347 | |||
348 | /* Free the allocated parameter block */ | 348 | /* Free the allocated parameter block */ |
349 | 349 | ||
350 | acpi_ut_delete_internal_object_list(info.parameters); | 350 | acpi_ut_delete_internal_object_list(info->parameters); |
351 | } | 351 | } |
352 | 352 | ||
353 | ACPI_FREE(info); | ||
353 | return_ACPI_STATUS(status); | 354 | return_ACPI_STATUS(status); |
354 | } | 355 | } |
355 | 356 | ||
356 | EXPORT_SYMBOL(acpi_evaluate_object); | 357 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object) |
357 | 358 | ||
358 | /******************************************************************************* | 359 | /******************************************************************************* |
359 | * | 360 | * |
@@ -384,7 +385,6 @@ EXPORT_SYMBOL(acpi_evaluate_object); | |||
384 | * function, etc. | 385 | * function, etc. |
385 | * | 386 | * |
386 | ******************************************************************************/ | 387 | ******************************************************************************/ |
387 | |||
388 | acpi_status | 388 | acpi_status |
389 | acpi_walk_namespace(acpi_object_type type, | 389 | acpi_walk_namespace(acpi_object_type type, |
390 | acpi_handle start_object, | 390 | acpi_handle start_object, |
@@ -394,7 +394,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
394 | { | 394 | { |
395 | acpi_status status; | 395 | acpi_status status; |
396 | 396 | ||
397 | ACPI_FUNCTION_TRACE("acpi_walk_namespace"); | 397 | ACPI_FUNCTION_TRACE(acpi_walk_namespace); |
398 | 398 | ||
399 | /* Parameter validation */ | 399 | /* Parameter validation */ |
400 | 400 | ||
@@ -421,7 +421,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
421 | return_ACPI_STATUS(status); | 421 | return_ACPI_STATUS(status); |
422 | } | 422 | } |
423 | 423 | ||
424 | EXPORT_SYMBOL(acpi_walk_namespace); | 424 | ACPI_EXPORT_SYMBOL(acpi_walk_namespace) |
425 | 425 | ||
426 | /******************************************************************************* | 426 | /******************************************************************************* |
427 | * | 427 | * |
@@ -436,7 +436,6 @@ EXPORT_SYMBOL(acpi_walk_namespace); | |||
436 | * on that. | 436 | * on that. |
437 | * | 437 | * |
438 | ******************************************************************************/ | 438 | ******************************************************************************/ |
439 | |||
440 | static acpi_status | 439 | static acpi_status |
441 | acpi_ns_get_device_callback(acpi_handle obj_handle, | 440 | acpi_ns_get_device_callback(acpi_handle obj_handle, |
442 | u32 nesting_level, | 441 | u32 nesting_level, |
@@ -473,6 +472,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
473 | } | 472 | } |
474 | 473 | ||
475 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 474 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
475 | |||
476 | /* Don't examine children of the device if not present */ | 476 | /* Don't examine children of the device if not present */ |
477 | 477 | ||
478 | return (AE_CTRL_DEPTH); | 478 | return (AE_CTRL_DEPTH); |
@@ -489,6 +489,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
489 | } | 489 | } |
490 | 490 | ||
491 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { | 491 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { |
492 | |||
492 | /* Get the list of Compatible IDs */ | 493 | /* Get the list of Compatible IDs */ |
493 | 494 | ||
494 | status = acpi_ut_execute_CID(node, &cid); | 495 | status = acpi_ut_execute_CID(node, &cid); |
@@ -505,11 +506,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
505 | sizeof(struct | 506 | sizeof(struct |
506 | acpi_compatible_id)) != | 507 | acpi_compatible_id)) != |
507 | 0) { | 508 | 0) { |
508 | ACPI_MEM_FREE(cid); | 509 | ACPI_FREE(cid); |
509 | return (AE_OK); | 510 | return (AE_OK); |
510 | } | 511 | } |
511 | } | 512 | } |
512 | ACPI_MEM_FREE(cid); | 513 | ACPI_FREE(cid); |
513 | } | 514 | } |
514 | } | 515 | } |
515 | 516 | ||
@@ -551,7 +552,7 @@ acpi_get_devices(char *HID, | |||
551 | acpi_status status; | 552 | acpi_status status; |
552 | struct acpi_get_devices_info info; | 553 | struct acpi_get_devices_info info; |
553 | 554 | ||
554 | ACPI_FUNCTION_TRACE("acpi_get_devices"); | 555 | ACPI_FUNCTION_TRACE(acpi_get_devices); |
555 | 556 | ||
556 | /* Parameter validation */ | 557 | /* Parameter validation */ |
557 | 558 | ||
@@ -563,9 +564,9 @@ acpi_get_devices(char *HID, | |||
563 | * We're going to call their callback from OUR callback, so we need | 564 | * We're going to call their callback from OUR callback, so we need |
564 | * to know what it is, and their context parameter. | 565 | * to know what it is, and their context parameter. |
565 | */ | 566 | */ |
567 | info.hid = HID; | ||
566 | info.context = context; | 568 | info.context = context; |
567 | info.user_function = user_function; | 569 | info.user_function = user_function; |
568 | info.hid = HID; | ||
569 | 570 | ||
570 | /* | 571 | /* |
571 | * Lock the namespace around the walk. | 572 | * Lock the namespace around the walk. |
@@ -578,9 +579,8 @@ acpi_get_devices(char *HID, | |||
578 | return_ACPI_STATUS(status); | 579 | return_ACPI_STATUS(status); |
579 | } | 580 | } |
580 | 581 | ||
581 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, | 582 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
582 | ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, | 583 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, |
583 | ACPI_NS_WALK_UNLOCK, | ||
584 | acpi_ns_get_device_callback, &info, | 584 | acpi_ns_get_device_callback, &info, |
585 | return_value); | 585 | return_value); |
586 | 586 | ||
@@ -588,7 +588,7 @@ acpi_get_devices(char *HID, | |||
588 | return_ACPI_STATUS(status); | 588 | return_ACPI_STATUS(status); |
589 | } | 589 | } |
590 | 590 | ||
591 | EXPORT_SYMBOL(acpi_get_devices); | 591 | ACPI_EXPORT_SYMBOL(acpi_get_devices) |
592 | 592 | ||
593 | /******************************************************************************* | 593 | /******************************************************************************* |
594 | * | 594 | * |
@@ -603,7 +603,6 @@ EXPORT_SYMBOL(acpi_get_devices); | |||
603 | * DESCRIPTION: Attach arbitrary data and handler to a namespace node. | 603 | * DESCRIPTION: Attach arbitrary data and handler to a namespace node. |
604 | * | 604 | * |
605 | ******************************************************************************/ | 605 | ******************************************************************************/ |
606 | |||
607 | acpi_status | 606 | acpi_status |
608 | acpi_attach_data(acpi_handle obj_handle, | 607 | acpi_attach_data(acpi_handle obj_handle, |
609 | acpi_object_handler handler, void *data) | 608 | acpi_object_handler handler, void *data) |
@@ -637,6 +636,8 @@ acpi_attach_data(acpi_handle obj_handle, | |||
637 | return (status); | 636 | return (status); |
638 | } | 637 | } |
639 | 638 | ||
639 | ACPI_EXPORT_SYMBOL(acpi_attach_data) | ||
640 | |||
640 | /******************************************************************************* | 641 | /******************************************************************************* |
641 | * | 642 | * |
642 | * FUNCTION: acpi_detach_data | 643 | * FUNCTION: acpi_detach_data |
@@ -649,7 +650,6 @@ acpi_attach_data(acpi_handle obj_handle, | |||
649 | * DESCRIPTION: Remove data that was previously attached to a node. | 650 | * DESCRIPTION: Remove data that was previously attached to a node. |
650 | * | 651 | * |
651 | ******************************************************************************/ | 652 | ******************************************************************************/ |
652 | |||
653 | acpi_status | 653 | acpi_status |
654 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | 654 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) |
655 | { | 655 | { |
@@ -682,6 +682,8 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | |||
682 | return (status); | 682 | return (status); |
683 | } | 683 | } |
684 | 684 | ||
685 | ACPI_EXPORT_SYMBOL(acpi_detach_data) | ||
686 | |||
685 | /******************************************************************************* | 687 | /******************************************************************************* |
686 | * | 688 | * |
687 | * FUNCTION: acpi_get_data | 689 | * FUNCTION: acpi_get_data |
@@ -695,7 +697,6 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | |||
695 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. | 697 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. |
696 | * | 698 | * |
697 | ******************************************************************************/ | 699 | ******************************************************************************/ |
698 | |||
699 | acpi_status | 700 | acpi_status |
700 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | 701 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) |
701 | { | 702 | { |
@@ -727,3 +728,5 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | |||
727 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 728 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
728 | return (status); | 729 | return (status); |
729 | } | 730 | } |
731 | |||
732 | ACPI_EXPORT_SYMBOL(acpi_get_data) | ||
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 8cd8675a47c0..978213a6c19f 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | 47 | ||
@@ -114,9 +112,8 @@ acpi_get_handle(acpi_handle parent, | |||
114 | /* | 112 | /* |
115 | * Find the Node and convert to a handle | 113 | * Find the Node and convert to a handle |
116 | */ | 114 | */ |
117 | status = | 115 | status = acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, |
118 | acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH, | 116 | &node); |
119 | &node); | ||
120 | 117 | ||
121 | *ret_handle = NULL; | 118 | *ret_handle = NULL; |
122 | if (ACPI_SUCCESS(status)) { | 119 | if (ACPI_SUCCESS(status)) { |
@@ -126,7 +123,7 @@ acpi_get_handle(acpi_handle parent, | |||
126 | return (status); | 123 | return (status); |
127 | } | 124 | } |
128 | 125 | ||
129 | EXPORT_SYMBOL(acpi_get_handle); | 126 | ACPI_EXPORT_SYMBOL(acpi_get_handle) |
130 | 127 | ||
131 | /****************************************************************************** | 128 | /****************************************************************************** |
132 | * | 129 | * |
@@ -143,7 +140,6 @@ EXPORT_SYMBOL(acpi_get_handle); | |||
143 | * complementary functions. | 140 | * complementary functions. |
144 | * | 141 | * |
145 | ******************************************************************************/ | 142 | ******************************************************************************/ |
146 | |||
147 | acpi_status | 143 | acpi_status |
148 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | 144 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) |
149 | { | 145 | { |
@@ -162,6 +158,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
162 | } | 158 | } |
163 | 159 | ||
164 | if (name_type == ACPI_FULL_PATHNAME) { | 160 | if (name_type == ACPI_FULL_PATHNAME) { |
161 | |||
165 | /* Get the full pathname (From the namespace root) */ | 162 | /* Get the full pathname (From the namespace root) */ |
166 | 163 | ||
167 | status = acpi_ns_handle_to_pathname(handle, buffer); | 164 | status = acpi_ns_handle_to_pathname(handle, buffer); |
@@ -203,7 +200,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
203 | return (status); | 200 | return (status); |
204 | } | 201 | } |
205 | 202 | ||
206 | EXPORT_SYMBOL(acpi_get_name); | 203 | ACPI_EXPORT_SYMBOL(acpi_get_name) |
207 | 204 | ||
208 | /****************************************************************************** | 205 | /****************************************************************************** |
209 | * | 206 | * |
@@ -219,7 +216,6 @@ EXPORT_SYMBOL(acpi_get_name); | |||
219 | * control methods (Such as in the case of a device.) | 216 | * control methods (Such as in the case of a device.) |
220 | * | 217 | * |
221 | ******************************************************************************/ | 218 | ******************************************************************************/ |
222 | |||
223 | acpi_status | 219 | acpi_status |
224 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | 220 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) |
225 | { | 221 | { |
@@ -241,7 +237,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
241 | return (status); | 237 | return (status); |
242 | } | 238 | } |
243 | 239 | ||
244 | info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); | 240 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); |
245 | if (!info) { | 241 | if (!info) { |
246 | return (AE_NO_MEMORY); | 242 | return (AE_NO_MEMORY); |
247 | } | 243 | } |
@@ -345,11 +341,11 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
345 | } | 341 | } |
346 | 342 | ||
347 | cleanup: | 343 | cleanup: |
348 | ACPI_MEM_FREE(info); | 344 | ACPI_FREE(info); |
349 | if (cid_list) { | 345 | if (cid_list) { |
350 | ACPI_MEM_FREE(cid_list); | 346 | ACPI_FREE(cid_list); |
351 | } | 347 | } |
352 | return (status); | 348 | return (status); |
353 | } | 349 | } |
354 | 350 | ||
355 | EXPORT_SYMBOL(acpi_get_object_info); | 351 | ACPI_EXPORT_SYMBOL(acpi_get_object_info) |
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index a0332595677a..a163e1d3708d 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | 47 | ||
@@ -101,7 +99,7 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) | |||
101 | return (status); | 99 | return (status); |
102 | } | 100 | } |
103 | 101 | ||
104 | EXPORT_SYMBOL(acpi_get_type); | 102 | ACPI_EXPORT_SYMBOL(acpi_get_type) |
105 | 103 | ||
106 | /******************************************************************************* | 104 | /******************************************************************************* |
107 | * | 105 | * |
@@ -116,7 +114,6 @@ EXPORT_SYMBOL(acpi_get_type); | |||
116 | * Handle. | 114 | * Handle. |
117 | * | 115 | * |
118 | ******************************************************************************/ | 116 | ******************************************************************************/ |
119 | |||
120 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | 117 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) |
121 | { | 118 | { |
122 | struct acpi_namespace_node *node; | 119 | struct acpi_namespace_node *node; |
@@ -162,7 +159,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | |||
162 | return (status); | 159 | return (status); |
163 | } | 160 | } |
164 | 161 | ||
165 | EXPORT_SYMBOL(acpi_get_parent); | 162 | ACPI_EXPORT_SYMBOL(acpi_get_parent) |
166 | 163 | ||
167 | /******************************************************************************* | 164 | /******************************************************************************* |
168 | * | 165 | * |
@@ -181,7 +178,6 @@ EXPORT_SYMBOL(acpi_get_parent); | |||
181 | * Scope is returned. | 178 | * Scope is returned. |
182 | * | 179 | * |
183 | ******************************************************************************/ | 180 | ******************************************************************************/ |
184 | |||
185 | acpi_status | 181 | acpi_status |
186 | acpi_get_next_object(acpi_object_type type, | 182 | acpi_get_next_object(acpi_object_type type, |
187 | acpi_handle parent, | 183 | acpi_handle parent, |
@@ -206,6 +202,7 @@ acpi_get_next_object(acpi_object_type type, | |||
206 | /* If null handle, use the parent */ | 202 | /* If null handle, use the parent */ |
207 | 203 | ||
208 | if (!child) { | 204 | if (!child) { |
205 | |||
209 | /* Start search at the beginning of the specified scope */ | 206 | /* Start search at the beginning of the specified scope */ |
210 | 207 | ||
211 | parent_node = acpi_ns_map_handle_to_node(parent); | 208 | parent_node = acpi_ns_map_handle_to_node(parent); |
@@ -242,4 +239,4 @@ acpi_get_next_object(acpi_object_type type, | |||
242 | return (status); | 239 | return (status); |
243 | } | 240 | } |
244 | 241 | ||
245 | EXPORT_SYMBOL(acpi_get_next_object); | 242 | ACPI_EXPORT_SYMBOL(acpi_get_next_object) |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 13b5fd5854a8..1bb558adee66 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
39 | #include <linux/nmi.h> | 39 | #include <linux/nmi.h> |
40 | #include <linux/kthread.h> | ||
40 | #include <acpi/acpi.h> | 41 | #include <acpi/acpi.h> |
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
42 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
@@ -600,23 +601,41 @@ static void acpi_os_execute_deferred(void *context) | |||
600 | return_VOID; | 601 | return_VOID; |
601 | } | 602 | } |
602 | 603 | ||
603 | acpi_status | 604 | static int acpi_os_execute_thread(void *context) |
604 | acpi_os_queue_for_execution(u32 priority, | 605 | { |
606 | struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context; | ||
607 | if (dpc) { | ||
608 | dpc->function(dpc->context); | ||
609 | kfree(dpc); | ||
610 | } | ||
611 | do_exit(0); | ||
612 | } | ||
613 | |||
614 | /******************************************************************************* | ||
615 | * | ||
616 | * FUNCTION: acpi_os_execute | ||
617 | * | ||
618 | * PARAMETERS: Type - Type of the callback | ||
619 | * Function - Function to be executed | ||
620 | * Context - Function parameters | ||
621 | * | ||
622 | * RETURN: Status | ||
623 | * | ||
624 | * DESCRIPTION: Depending on type, either queues function for deferred execution or | ||
625 | * immediately executes function on a separate thread. | ||
626 | * | ||
627 | ******************************************************************************/ | ||
628 | |||
629 | acpi_status acpi_os_execute(acpi_execute_type type, | ||
605 | acpi_osd_exec_callback function, void *context) | 630 | acpi_osd_exec_callback function, void *context) |
606 | { | 631 | { |
607 | acpi_status status = AE_OK; | 632 | acpi_status status = AE_OK; |
608 | struct acpi_os_dpc *dpc; | 633 | struct acpi_os_dpc *dpc; |
609 | struct work_struct *task; | 634 | struct work_struct *task; |
610 | 635 | struct task_struct *p; | |
611 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); | ||
612 | |||
613 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
614 | "Scheduling function [%p(%p)] for deferred execution.\n", | ||
615 | function, context)); | ||
616 | 636 | ||
617 | if (!function) | 637 | if (!function) |
618 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 638 | return AE_BAD_PARAMETER; |
619 | |||
620 | /* | 639 | /* |
621 | * Allocate/initialize DPC structure. Note that this memory will be | 640 | * Allocate/initialize DPC structure. Note that this memory will be |
622 | * freed by the callee. The kernel handles the tq_struct list in a | 641 | * freed by the callee. The kernel handles the tq_struct list in a |
@@ -627,30 +646,37 @@ acpi_os_queue_for_execution(u32 priority, | |||
627 | * We can save time and code by allocating the DPC and tq_structs | 646 | * We can save time and code by allocating the DPC and tq_structs |
628 | * from the same memory. | 647 | * from the same memory. |
629 | */ | 648 | */ |
630 | 649 | if (type == OSL_NOTIFY_HANDLER) { | |
631 | dpc = | 650 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL); |
632 | kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), | 651 | } else { |
633 | GFP_ATOMIC); | 652 | dpc = kmalloc(sizeof(struct acpi_os_dpc) + |
653 | sizeof(struct work_struct), GFP_ATOMIC); | ||
654 | } | ||
634 | if (!dpc) | 655 | if (!dpc) |
635 | return_ACPI_STATUS(AE_NO_MEMORY); | 656 | return AE_NO_MEMORY; |
636 | |||
637 | dpc->function = function; | 657 | dpc->function = function; |
638 | dpc->context = context; | 658 | dpc->context = context; |
639 | 659 | ||
640 | task = (void *)(dpc + 1); | 660 | if (type == OSL_NOTIFY_HANDLER) { |
641 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | 661 | p = kthread_create(acpi_os_execute_thread, dpc, "kacpid_notify"); |
642 | 662 | if (!IS_ERR(p)) { | |
643 | if (!queue_work(kacpid_wq, task)) { | 663 | wake_up_process(p); |
644 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 664 | } else { |
645 | "Call to queue_work() failed.\n")); | 665 | status = AE_NO_MEMORY; |
646 | kfree(dpc); | 666 | kfree(dpc); |
647 | status = AE_ERROR; | 667 | } |
668 | } else { | ||
669 | task = (void *)(dpc + 1); | ||
670 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | ||
671 | if (!queue_work(kacpid_wq, task)) { | ||
672 | status = AE_ERROR; | ||
673 | kfree(dpc); | ||
674 | } | ||
648 | } | 675 | } |
649 | 676 | return status; | |
650 | return_ACPI_STATUS(status); | ||
651 | } | 677 | } |
652 | 678 | ||
653 | EXPORT_SYMBOL(acpi_os_queue_for_execution); | 679 | EXPORT_SYMBOL(acpi_os_execute); |
654 | 680 | ||
655 | void acpi_os_wait_events_complete(void *context) | 681 | void acpi_os_wait_events_complete(void *context) |
656 | { | 682 | { |
@@ -769,9 +795,6 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
769 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", | 795 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", |
770 | handle, units, timeout)); | 796 | handle, units, timeout)); |
771 | 797 | ||
772 | if (in_atomic()) | ||
773 | timeout = 0; | ||
774 | |||
775 | switch (timeout) { | 798 | switch (timeout) { |
776 | /* | 799 | /* |
777 | * No Wait: | 800 | * No Wait: |
@@ -896,14 +919,6 @@ u8 acpi_os_writable(void *ptr, acpi_size len) | |||
896 | } | 919 | } |
897 | #endif | 920 | #endif |
898 | 921 | ||
899 | u32 acpi_os_get_thread_id(void) | ||
900 | { | ||
901 | if (!in_atomic()) | ||
902 | return current->pid; | ||
903 | |||
904 | return 0; | ||
905 | } | ||
906 | |||
907 | acpi_status acpi_os_signal(u32 function, void *info) | 922 | acpi_status acpi_os_signal(u32 function, void *info) |
908 | { | 923 | { |
909 | switch (function) { | 924 | switch (function) { |
@@ -1050,12 +1065,12 @@ void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) | |||
1050 | * | 1065 | * |
1051 | * FUNCTION: acpi_os_create_cache | 1066 | * FUNCTION: acpi_os_create_cache |
1052 | * | 1067 | * |
1053 | * PARAMETERS: CacheName - Ascii name for the cache | 1068 | * PARAMETERS: name - Ascii name for the cache |
1054 | * ObjectSize - Size of each cached object | 1069 | * size - Size of each cached object |
1055 | * MaxDepth - Maximum depth of the cache (in objects) | 1070 | * depth - Maximum depth of the cache (in objects) <ignored> |
1056 | * ReturnCache - Where the new cache object is returned | 1071 | * cache - Where the new cache object is returned |
1057 | * | 1072 | * |
1058 | * RETURN: Status | 1073 | * RETURN: status |
1059 | * | 1074 | * |
1060 | * DESCRIPTION: Create a cache object | 1075 | * DESCRIPTION: Create a cache object |
1061 | * | 1076 | * |
@@ -1065,7 +1080,10 @@ acpi_status | |||
1065 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) | 1080 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) |
1066 | { | 1081 | { |
1067 | *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); | 1082 | *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); |
1068 | return AE_OK; | 1083 | if (cache == NULL) |
1084 | return AE_ERROR; | ||
1085 | else | ||
1086 | return AE_OK; | ||
1069 | } | 1087 | } |
1070 | 1088 | ||
1071 | /******************************************************************************* | 1089 | /******************************************************************************* |
@@ -1134,16 +1152,63 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) | |||
1134 | * | 1152 | * |
1135 | * RETURN: Status | 1153 | * RETURN: Status |
1136 | * | 1154 | * |
1137 | * DESCRIPTION: Get an object from the specified cache. If cache is empty, | 1155 | * DESCRIPTION: Return a zero-filled object. |
1138 | * the object is allocated. | ||
1139 | * | 1156 | * |
1140 | ******************************************************************************/ | 1157 | ******************************************************************************/ |
1141 | 1158 | ||
1142 | void *acpi_os_acquire_object(acpi_cache_t * cache) | 1159 | void *acpi_os_acquire_object(acpi_cache_t * cache) |
1143 | { | 1160 | { |
1144 | void *object = kmem_cache_alloc(cache, GFP_KERNEL); | 1161 | void *object = kmem_cache_zalloc(cache, GFP_KERNEL); |
1145 | WARN_ON(!object); | 1162 | WARN_ON(!object); |
1146 | return object; | 1163 | return object; |
1147 | } | 1164 | } |
1148 | 1165 | ||
1166 | /****************************************************************************** | ||
1167 | * | ||
1168 | * FUNCTION: acpi_os_validate_interface | ||
1169 | * | ||
1170 | * PARAMETERS: interface - Requested interface to be validated | ||
1171 | * | ||
1172 | * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise | ||
1173 | * | ||
1174 | * DESCRIPTION: Match an interface string to the interfaces supported by the | ||
1175 | * host. Strings originate from an AML call to the _OSI method. | ||
1176 | * | ||
1177 | *****************************************************************************/ | ||
1178 | |||
1179 | acpi_status | ||
1180 | acpi_os_validate_interface (char *interface) | ||
1181 | { | ||
1182 | |||
1183 | return AE_SUPPORT; | ||
1184 | } | ||
1185 | |||
1186 | |||
1187 | /****************************************************************************** | ||
1188 | * | ||
1189 | * FUNCTION: acpi_os_validate_address | ||
1190 | * | ||
1191 | * PARAMETERS: space_id - ACPI space ID | ||
1192 | * address - Physical address | ||
1193 | * length - Address length | ||
1194 | * | ||
1195 | * RETURN: AE_OK if address/length is valid for the space_id. Otherwise, | ||
1196 | * should return AE_AML_ILLEGAL_ADDRESS. | ||
1197 | * | ||
1198 | * DESCRIPTION: Validate a system address via the host OS. Used to validate | ||
1199 | * the addresses accessed by AML operation regions. | ||
1200 | * | ||
1201 | *****************************************************************************/ | ||
1202 | |||
1203 | acpi_status | ||
1204 | acpi_os_validate_address ( | ||
1205 | u8 space_id, | ||
1206 | acpi_physical_address address, | ||
1207 | acpi_size length) | ||
1208 | { | ||
1209 | |||
1210 | return AE_OK; | ||
1211 | } | ||
1212 | |||
1213 | |||
1149 | #endif | 1214 | #endif |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index de573be52718..bf88e076c3e9 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -79,7 +79,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) | |||
79 | acpi_native_uint byte_count; | 79 | acpi_native_uint byte_count; |
80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ | 80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ |
81 | 81 | ||
82 | ACPI_FUNCTION_TRACE("ps_get_next_package_length"); | 82 | ACPI_FUNCTION_TRACE(ps_get_next_package_length); |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * Byte 0 bits [6:7] contain the number of additional bytes | 85 | * Byte 0 bits [6:7] contain the number of additional bytes |
@@ -128,7 +128,7 @@ u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) | |||
128 | u8 *start = parser_state->aml; | 128 | u8 *start = parser_state->aml; |
129 | u32 package_length; | 129 | u32 package_length; |
130 | 130 | ||
131 | ACPI_FUNCTION_TRACE("ps_get_next_package_end"); | 131 | ACPI_FUNCTION_TRACE(ps_get_next_package_end); |
132 | 132 | ||
133 | /* Function below updates parser_state->Aml */ | 133 | /* Function below updates parser_state->Aml */ |
134 | 134 | ||
@@ -157,7 +157,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
157 | u8 *start = parser_state->aml; | 157 | u8 *start = parser_state->aml; |
158 | u8 *end = parser_state->aml; | 158 | u8 *end = parser_state->aml; |
159 | 159 | ||
160 | ACPI_FUNCTION_TRACE("ps_get_next_namestring"); | 160 | ACPI_FUNCTION_TRACE(ps_get_next_namestring); |
161 | 161 | ||
162 | /* Point past any namestring prefix characters (backslash or carat) */ | 162 | /* Point past any namestring prefix characters (backslash or carat) */ |
163 | 163 | ||
@@ -237,7 +237,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
237 | struct acpi_namespace_node *node; | 237 | struct acpi_namespace_node *node; |
238 | union acpi_generic_state scope_info; | 238 | union acpi_generic_state scope_info; |
239 | 239 | ||
240 | ACPI_FUNCTION_TRACE("ps_get_next_namepath"); | 240 | ACPI_FUNCTION_TRACE(ps_get_next_namepath); |
241 | 241 | ||
242 | path = acpi_ps_get_next_namestring(parser_state); | 242 | path = acpi_ps_get_next_namestring(parser_state); |
243 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); | 243 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); |
@@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
275 | */ | 275 | */ |
276 | if (ACPI_SUCCESS(status) && | 276 | if (ACPI_SUCCESS(status) && |
277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { | 277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { |
278 | |||
278 | /* This name is actually a control method invocation */ | 279 | /* This name is actually a control method invocation */ |
279 | 280 | ||
280 | method_desc = acpi_ns_get_attached_object(node); | 281 | method_desc = acpi_ns_get_attached_object(node); |
@@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
319 | * some not_found cases are allowed | 320 | * some not_found cases are allowed |
320 | */ | 321 | */ |
321 | if (status == AE_NOT_FOUND) { | 322 | if (status == AE_NOT_FOUND) { |
323 | |||
322 | /* 1) not_found is ok during load pass 1/2 (allow forward references) */ | 324 | /* 1) not_found is ok during load pass 1/2 (allow forward references) */ |
323 | 325 | ||
324 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != | 326 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != |
@@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
354 | 356 | ||
355 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 357 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
356 | ACPI_PARSE_EXECUTE) { | 358 | ACPI_PARSE_EXECUTE) { |
359 | |||
357 | /* Report a control method execution error */ | 360 | /* Report a control method execution error */ |
358 | 361 | ||
359 | status = acpi_ds_method_error(status, walk_state); | 362 | status = acpi_ds_method_error(status, walk_state); |
@@ -388,7 +391,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
388 | u16 opcode; | 391 | u16 opcode; |
389 | u8 *aml = parser_state->aml; | 392 | u8 *aml = parser_state->aml; |
390 | 393 | ||
391 | ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); | 394 | ACPI_FUNCTION_TRACE_U32(ps_get_next_simple_arg, arg_type); |
392 | 395 | ||
393 | switch (arg_type) { | 396 | switch (arg_type) { |
394 | case ARGP_BYTEDATA: | 397 | case ARGP_BYTEDATA: |
@@ -453,7 +456,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
453 | 456 | ||
454 | default: | 457 | default: |
455 | 458 | ||
456 | ACPI_ERROR((AE_INFO, "Invalid arg_type %X", arg_type)); | 459 | ACPI_ERROR((AE_INFO, "Invalid ArgType %X", arg_type)); |
457 | return_VOID; | 460 | return_VOID; |
458 | } | 461 | } |
459 | 462 | ||
@@ -484,7 +487,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state | |||
484 | u16 opcode; | 487 | u16 opcode; |
485 | u32 name; | 488 | u32 name; |
486 | 489 | ||
487 | ACPI_FUNCTION_TRACE("ps_get_next_field"); | 490 | ACPI_FUNCTION_TRACE(ps_get_next_field); |
488 | 491 | ||
489 | /* Determine field type */ | 492 | /* Determine field type */ |
490 | 493 | ||
@@ -590,7 +593,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
590 | u32 subop; | 593 | u32 subop; |
591 | acpi_status status = AE_OK; | 594 | acpi_status status = AE_OK; |
592 | 595 | ||
593 | ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state); | 596 | ACPI_FUNCTION_TRACE_PTR(ps_get_next_arg, parser_state); |
594 | 597 | ||
595 | switch (arg_type) { | 598 | switch (arg_type) { |
596 | case ARGP_BYTEDATA: | 599 | case ARGP_BYTEDATA: |
@@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
620 | case ARGP_FIELDLIST: | 623 | case ARGP_FIELDLIST: |
621 | 624 | ||
622 | if (parser_state->aml < parser_state->pkg_end) { | 625 | if (parser_state->aml < parser_state->pkg_end) { |
626 | |||
623 | /* Non-empty list */ | 627 | /* Non-empty list */ |
624 | 628 | ||
625 | while (parser_state->aml < parser_state->pkg_end) { | 629 | while (parser_state->aml < parser_state->pkg_end) { |
@@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
645 | case ARGP_BYTELIST: | 649 | case ARGP_BYTELIST: |
646 | 650 | ||
647 | if (parser_state->aml < parser_state->pkg_end) { | 651 | if (parser_state->aml < parser_state->pkg_end) { |
652 | |||
648 | /* Non-empty list */ | 653 | /* Non-empty list */ |
649 | 654 | ||
650 | arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); | 655 | arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); |
@@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
673 | if (subop == 0 || | 678 | if (subop == 0 || |
674 | acpi_ps_is_leading_char(subop) || | 679 | acpi_ps_is_leading_char(subop) || |
675 | acpi_ps_is_prefix_char(subop)) { | 680 | acpi_ps_is_prefix_char(subop)) { |
681 | |||
676 | /* null_name or name_string */ | 682 | /* null_name or name_string */ |
677 | 683 | ||
678 | arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); | 684 | arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); |
@@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
703 | case ARGP_OBJLIST: | 709 | case ARGP_OBJLIST: |
704 | 710 | ||
705 | if (parser_state->aml < parser_state->pkg_end) { | 711 | if (parser_state->aml < parser_state->pkg_end) { |
712 | |||
706 | /* Non-empty list of variable arguments, nothing returned */ | 713 | /* Non-empty list of variable arguments, nothing returned */ |
707 | 714 | ||
708 | walk_state->arg_count = ACPI_VAR_ARGS; | 715 | walk_state->arg_count = ACPI_VAR_ARGS; |
@@ -711,7 +718,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
711 | 718 | ||
712 | default: | 719 | default: |
713 | 720 | ||
714 | ACPI_ERROR((AE_INFO, "Invalid arg_type: %X", arg_type)); | 721 | ACPI_ERROR((AE_INFO, "Invalid ArgType: %X", arg_type)); |
715 | status = AE_AML_OPERAND_TYPE; | 722 | status = AE_AML_OPERAND_TYPE; |
716 | break; | 723 | break; |
717 | } | 724 | } |
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 00b072e15d19..e1541db3753a 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -83,7 +83,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
83 | struct acpi_parse_state *parser_state; | 83 | struct acpi_parse_state *parser_state; |
84 | u8 *aml_op_start = NULL; | 84 | u8 *aml_op_start = NULL; |
85 | 85 | ||
86 | ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state); | 86 | ACPI_FUNCTION_TRACE_PTR(ps_parse_loop, walk_state); |
87 | 87 | ||
88 | if (walk_state->descending_callback == NULL) { | 88 | if (walk_state->descending_callback == NULL) { |
89 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 89 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
95 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) | 95 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) |
96 | 96 | ||
97 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { | 97 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { |
98 | |||
98 | /* We are restarting a preempted control method */ | 99 | /* We are restarting a preempted control method */ |
99 | 100 | ||
100 | if (acpi_ps_has_completed_scope(parser_state)) { | 101 | if (acpi_ps_has_completed_scope(parser_state)) { |
@@ -128,7 +129,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
128 | 129 | ||
129 | } | 130 | } |
130 | ACPI_EXCEPTION((AE_INFO, status, | 131 | ACPI_EXCEPTION((AE_INFO, status, |
131 | "get_predicate Failed")); | 132 | "GetPredicate Failed")); |
132 | return_ACPI_STATUS(status); | 133 | return_ACPI_STATUS(status); |
133 | } | 134 | } |
134 | 135 | ||
@@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
143 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 144 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
144 | "Popped scope, Op=%p\n", op)); | 145 | "Popped scope, Op=%p\n", op)); |
145 | } else if (walk_state->prev_op) { | 146 | } else if (walk_state->prev_op) { |
147 | |||
146 | /* We were in the middle of an op */ | 148 | /* We were in the middle of an op */ |
147 | 149 | ||
148 | op = walk_state->prev_op; | 150 | op = walk_state->prev_op; |
@@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
156 | while ((parser_state->aml < parser_state->aml_end) || (op)) { | 158 | while ((parser_state->aml < parser_state->aml_end) || (op)) { |
157 | aml_op_start = parser_state->aml; | 159 | aml_op_start = parser_state->aml; |
158 | if (!op) { | 160 | if (!op) { |
161 | |||
159 | /* Get the next opcode from the AML stream */ | 162 | /* Get the next opcode from the AML stream */ |
160 | 163 | ||
161 | walk_state->aml_offset = | 164 | walk_state->aml_offset = |
@@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
213 | /* Create Op structure and append to parent's argument list */ | 216 | /* Create Op structure and append to parent's argument list */ |
214 | 217 | ||
215 | if (walk_state->op_info->flags & AML_NAMED) { | 218 | if (walk_state->op_info->flags & AML_NAMED) { |
219 | |||
216 | /* Allocate a new pre_op if necessary */ | 220 | /* Allocate a new pre_op if necessary */ |
217 | 221 | ||
218 | if (!pre_op) { | 222 | if (!pre_op) { |
@@ -371,7 +375,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
371 | 375 | ||
372 | if (walk_state->op_info) { | 376 | if (walk_state->op_info) { |
373 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
374 | "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", | 378 | "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", |
375 | (u32) op->common.aml_opcode, | 379 | (u32) op->common.aml_opcode, |
376 | walk_state->op_info->name, op, | 380 | walk_state->op_info->name, op, |
377 | parser_state->aml, | 381 | parser_state->aml, |
@@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
388 | /* Are there any arguments that must be processed? */ | 392 | /* Are there any arguments that must be processed? */ |
389 | 393 | ||
390 | if (walk_state->arg_types) { | 394 | if (walk_state->arg_types) { |
395 | |||
391 | /* Get arguments */ | 396 | /* Get arguments */ |
392 | 397 | ||
393 | switch (op->common.aml_opcode) { | 398 | switch (op->common.aml_opcode) { |
@@ -742,7 +747,19 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
742 | if (ACPI_FAILURE(status2)) { | 747 | if (ACPI_FAILURE(status2)) { |
743 | return_ACPI_STATUS(status2); | 748 | return_ACPI_STATUS(status2); |
744 | } | 749 | } |
750 | |||
751 | status2 = | ||
752 | acpi_ds_result_stack_pop | ||
753 | (walk_state); | ||
754 | if (ACPI_FAILURE(status2)) { | ||
755 | return_ACPI_STATUS(status2); | ||
756 | } | ||
757 | |||
758 | acpi_ut_delete_generic_state | ||
759 | (acpi_ut_pop_generic_state | ||
760 | (&walk_state->control_state)); | ||
745 | } | 761 | } |
762 | |||
746 | acpi_ps_pop_scope(parser_state, &op, | 763 | acpi_ps_pop_scope(parser_state, &op, |
747 | &walk_state->arg_types, | 764 | &walk_state->arg_types, |
748 | &walk_state->arg_count); | 765 | &walk_state->arg_count); |
@@ -762,6 +779,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
762 | return_ACPI_STATUS(status2); | 779 | return_ACPI_STATUS(status2); |
763 | } | 780 | } |
764 | } | 781 | } |
782 | |||
765 | acpi_ps_pop_scope(parser_state, &op, | 783 | acpi_ps_pop_scope(parser_state, &op, |
766 | &walk_state->arg_types, | 784 | &walk_state->arg_types, |
767 | &walk_state->arg_count); | 785 | &walk_state->arg_count); |
@@ -853,6 +871,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
853 | } | 871 | } |
854 | 872 | ||
855 | else if (ACPI_FAILURE(status)) { | 873 | else if (ACPI_FAILURE(status)) { |
874 | |||
856 | /* First error is most important */ | 875 | /* First error is most important */ |
857 | 876 | ||
858 | (void) | 877 | (void) |
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 11d6351ab8b2..4bd25e32769f 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c | |||
@@ -725,12 +725,13 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { | |||
725 | 725 | ||
726 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | 726 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) |
727 | { | 727 | { |
728 | ACPI_FUNCTION_NAME("ps_get_opcode_info"); | 728 | ACPI_FUNCTION_NAME(ps_get_opcode_info); |
729 | 729 | ||
730 | /* | 730 | /* |
731 | * Detect normal 8-bit opcode or extended 16-bit opcode | 731 | * Detect normal 8-bit opcode or extended 16-bit opcode |
732 | */ | 732 | */ |
733 | if (!(opcode & 0xFF00)) { | 733 | if (!(opcode & 0xFF00)) { |
734 | |||
734 | /* Simple (8-bit) opcode: 0-255, can't index beyond table */ | 735 | /* Simple (8-bit) opcode: 0-255, can't index beyond table */ |
735 | 736 | ||
736 | return (&acpi_gbl_aml_op_info | 737 | return (&acpi_gbl_aml_op_info |
@@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | |||
739 | 740 | ||
740 | if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && | 741 | if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && |
741 | (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { | 742 | (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { |
743 | |||
742 | /* Valid extended (16-bit) opcode */ | 744 | /* Valid extended (16-bit) opcode */ |
743 | 745 | ||
744 | return (&acpi_gbl_aml_op_info | 746 | return (&acpi_gbl_aml_op_info |
@@ -779,7 +781,7 @@ char *acpi_ps_get_opcode_name(u16 opcode) | |||
779 | return (op->name); | 781 | return (op->name); |
780 | 782 | ||
781 | #else | 783 | #else |
782 | return ("AE_NOT_CONFIGURED"); | 784 | return ("OpcodeName unavailable"); |
783 | 785 | ||
784 | #endif | 786 | #endif |
785 | } | 787 | } |
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index a9f3229f4106..7ee2f2e77525 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state) | |||
106 | opcode = (u16) ACPI_GET8(aml); | 106 | opcode = (u16) ACPI_GET8(aml); |
107 | 107 | ||
108 | if (opcode == AML_EXTENDED_OP_PREFIX) { | 108 | if (opcode == AML_EXTENDED_OP_PREFIX) { |
109 | |||
109 | /* Extended opcode, get the second opcode byte */ | 110 | /* Extended opcode, get the second opcode byte */ |
110 | 111 | ||
111 | aml++; | 112 | aml++; |
@@ -137,7 +138,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
137 | const struct acpi_opcode_info *parent_info; | 138 | const struct acpi_opcode_info *parent_info; |
138 | union acpi_parse_object *replacement_op = NULL; | 139 | union acpi_parse_object *replacement_op = NULL; |
139 | 140 | ||
140 | ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op); | 141 | ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op); |
141 | 142 | ||
142 | /* Check for null Op, can happen if AML code is corrupt */ | 143 | /* Check for null Op, can happen if AML code is corrupt */ |
143 | 144 | ||
@@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
158 | if (op->common.parent) { | 159 | if (op->common.parent) { |
159 | prev = op->common.parent->common.value.arg; | 160 | prev = op->common.parent->common.value.arg; |
160 | if (!prev) { | 161 | if (!prev) { |
162 | |||
161 | /* Nothing more to do */ | 163 | /* Nothing more to do */ |
162 | 164 | ||
163 | goto cleanup; | 165 | goto cleanup; |
@@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
245 | /* We must unlink this op from the parent tree */ | 247 | /* We must unlink this op from the parent tree */ |
246 | 248 | ||
247 | if (prev == op) { | 249 | if (prev == op) { |
250 | |||
248 | /* This op is the first in the list */ | 251 | /* This op is the first in the list */ |
249 | 252 | ||
250 | if (replacement_op) { | 253 | if (replacement_op) { |
@@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
265 | 268 | ||
266 | else | 269 | else |
267 | while (prev) { | 270 | while (prev) { |
271 | |||
268 | /* Traverse all siblings in the parent's argument list */ | 272 | /* Traverse all siblings in the parent's argument list */ |
269 | 273 | ||
270 | next = prev->common.next; | 274 | next = prev->common.next; |
@@ -329,7 +333,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
329 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 333 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
330 | acpi_status status = AE_CTRL_PENDING; | 334 | acpi_status status = AE_CTRL_PENDING; |
331 | 335 | ||
332 | ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op); | 336 | ACPI_FUNCTION_TRACE_PTR(ps_next_parse_state, op); |
333 | 337 | ||
334 | switch (callback_status) { | 338 | switch (callback_status) { |
335 | case AE_CTRL_TERMINATE: | 339 | case AE_CTRL_TERMINATE: |
@@ -449,10 +453,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
449 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; | 453 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; |
450 | struct acpi_walk_state *previous_walk_state; | 454 | struct acpi_walk_state *previous_walk_state; |
451 | 455 | ||
452 | ACPI_FUNCTION_TRACE("ps_parse_aml"); | 456 | ACPI_FUNCTION_TRACE(ps_parse_aml); |
453 | 457 | ||
454 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 458 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
455 | "Entered with walk_state=%p Aml=%p size=%X\n", | 459 | "Entered with WalkState=%p Aml=%p size=%X\n", |
456 | walk_state, walk_state->parser_state.aml, | 460 | walk_state, walk_state->parser_state.aml, |
457 | walk_state->parser_state.aml_size)); | 461 | walk_state->parser_state.aml_size)); |
458 | 462 | ||
@@ -460,6 +464,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
460 | 464 | ||
461 | thread = acpi_ut_create_thread_state(); | 465 | thread = acpi_ut_create_thread_state(); |
462 | if (!thread) { | 466 | if (!thread) { |
467 | acpi_ds_delete_walk_state(walk_state); | ||
463 | return_ACPI_STATUS(AE_NO_MEMORY); | 468 | return_ACPI_STATUS(AE_NO_MEMORY); |
464 | } | 469 | } |
465 | 470 | ||
@@ -510,6 +515,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
510 | } else if (status == AE_CTRL_TERMINATE) { | 515 | } else if (status == AE_CTRL_TERMINATE) { |
511 | status = AE_OK; | 516 | status = AE_OK; |
512 | } else if ((status != AE_OK) && (walk_state->method_desc)) { | 517 | } else if ((status != AE_OK) && (walk_state->method_desc)) { |
518 | |||
513 | /* Either the method parse or actual execution failed */ | 519 | /* Either the method parse or actual execution failed */ |
514 | 520 | ||
515 | ACPI_ERROR_METHOD("Method parse/execution failed", | 521 | ACPI_ERROR_METHOD("Method parse/execution failed", |
@@ -550,20 +556,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
550 | */ | 556 | */ |
551 | if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 557 | if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
552 | ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { | 558 | ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { |
553 | if (walk_state->method_desc) { | 559 | acpi_ds_terminate_control_method(walk_state-> |
554 | /* Decrement the thread count on the method parse tree */ | 560 | method_desc, |
555 | 561 | walk_state); | |
556 | if (walk_state->method_desc->method. | ||
557 | thread_count) { | ||
558 | walk_state->method_desc->method. | ||
559 | thread_count--; | ||
560 | } else { | ||
561 | ACPI_ERROR((AE_INFO, | ||
562 | "Invalid zero thread count in method")); | ||
563 | } | ||
564 | } | ||
565 | |||
566 | acpi_ds_terminate_control_method(walk_state); | ||
567 | } | 562 | } |
568 | 563 | ||
569 | /* Delete this walk state and all linked control states */ | 564 | /* Delete this walk state and all linked control states */ |
@@ -572,7 +567,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
572 | previous_walk_state = walk_state; | 567 | previous_walk_state = walk_state; |
573 | 568 | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 569 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
575 | "return_value=%p, implicit_value=%p State=%p\n", | 570 | "ReturnValue=%p, ImplicitValue=%p State=%p\n", |
576 | walk_state->return_desc, | 571 | walk_state->return_desc, |
577 | walk_state->implicit_return_obj, walk_state)); | 572 | walk_state->implicit_return_obj, walk_state)); |
578 | 573 | ||
@@ -633,12 +628,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
633 | } | 628 | } |
634 | } else { | 629 | } else { |
635 | if (previous_walk_state->return_desc) { | 630 | if (previous_walk_state->return_desc) { |
631 | |||
636 | /* Caller doesn't want it, must delete it */ | 632 | /* Caller doesn't want it, must delete it */ |
637 | 633 | ||
638 | acpi_ut_remove_reference(previous_walk_state-> | 634 | acpi_ut_remove_reference(previous_walk_state-> |
639 | return_desc); | 635 | return_desc); |
640 | } | 636 | } |
641 | if (previous_walk_state->implicit_return_obj) { | 637 | if (previous_walk_state->implicit_return_obj) { |
638 | |||
642 | /* Caller doesn't want it, must delete it */ | 639 | /* Caller doesn't want it, must delete it */ |
643 | 640 | ||
644 | acpi_ut_remove_reference(previous_walk_state-> | 641 | acpi_ut_remove_reference(previous_walk_state-> |
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index bc6047caccd9..a3e0314de24d 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c | |||
@@ -106,14 +106,14 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state, | |||
106 | { | 106 | { |
107 | union acpi_generic_state *scope; | 107 | union acpi_generic_state *scope; |
108 | 108 | ||
109 | ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op); | 109 | ACPI_FUNCTION_TRACE_PTR(ps_init_scope, root_op); |
110 | 110 | ||
111 | scope = acpi_ut_create_generic_state(); | 111 | scope = acpi_ut_create_generic_state(); |
112 | if (!scope) { | 112 | if (!scope) { |
113 | return_ACPI_STATUS(AE_NO_MEMORY); | 113 | return_ACPI_STATUS(AE_NO_MEMORY); |
114 | } | 114 | } |
115 | 115 | ||
116 | scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE; | 116 | scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_RPSCOPE; |
117 | scope->parse_scope.op = root_op; | 117 | scope->parse_scope.op = root_op; |
118 | scope->parse_scope.arg_count = ACPI_VAR_ARGS; | 118 | scope->parse_scope.arg_count = ACPI_VAR_ARGS; |
119 | scope->parse_scope.arg_end = parser_state->aml_end; | 119 | scope->parse_scope.arg_end = parser_state->aml_end; |
@@ -147,14 +147,14 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, | |||
147 | { | 147 | { |
148 | union acpi_generic_state *scope; | 148 | union acpi_generic_state *scope; |
149 | 149 | ||
150 | ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op); | 150 | ACPI_FUNCTION_TRACE_PTR(ps_push_scope, op); |
151 | 151 | ||
152 | scope = acpi_ut_create_generic_state(); | 152 | scope = acpi_ut_create_generic_state(); |
153 | if (!scope) { | 153 | if (!scope) { |
154 | return_ACPI_STATUS(AE_NO_MEMORY); | 154 | return_ACPI_STATUS(AE_NO_MEMORY); |
155 | } | 155 | } |
156 | 156 | ||
157 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; | 157 | scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_PSCOPE; |
158 | scope->parse_scope.op = op; | 158 | scope->parse_scope.op = op; |
159 | scope->parse_scope.arg_list = remaining_args; | 159 | scope->parse_scope.arg_list = remaining_args; |
160 | scope->parse_scope.arg_count = arg_count; | 160 | scope->parse_scope.arg_count = arg_count; |
@@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, | |||
165 | acpi_ut_push_generic_state(&parser_state->scope, scope); | 165 | acpi_ut_push_generic_state(&parser_state->scope, scope); |
166 | 166 | ||
167 | if (arg_count == ACPI_VAR_ARGS) { | 167 | if (arg_count == ACPI_VAR_ARGS) { |
168 | |||
168 | /* Multiple arguments */ | 169 | /* Multiple arguments */ |
169 | 170 | ||
170 | scope->parse_scope.arg_end = parser_state->pkg_end; | 171 | scope->parse_scope.arg_end = parser_state->pkg_end; |
@@ -199,14 +200,14 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | |||
199 | { | 200 | { |
200 | union acpi_generic_state *scope = parser_state->scope; | 201 | union acpi_generic_state *scope = parser_state->scope; |
201 | 202 | ||
202 | ACPI_FUNCTION_TRACE("ps_pop_scope"); | 203 | ACPI_FUNCTION_TRACE(ps_pop_scope); |
203 | 204 | ||
204 | /* Only pop the scope if there is in fact a next scope */ | 205 | /* Only pop the scope if there is in fact a next scope */ |
205 | 206 | ||
206 | if (scope->common.next) { | 207 | if (scope->common.next) { |
207 | scope = acpi_ut_pop_generic_state(&parser_state->scope); | 208 | scope = acpi_ut_pop_generic_state(&parser_state->scope); |
208 | 209 | ||
209 | /* return to parsing previous op */ | 210 | /* Return to parsing previous op */ |
210 | 211 | ||
211 | *op = scope->parse_scope.op; | 212 | *op = scope->parse_scope.op; |
212 | *arg_list = scope->parse_scope.arg_list; | 213 | *arg_list = scope->parse_scope.arg_list; |
@@ -217,7 +218,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | |||
217 | 218 | ||
218 | acpi_ut_delete_generic_state(scope); | 219 | acpi_ut_delete_generic_state(scope); |
219 | } else { | 220 | } else { |
220 | /* empty parse stack, prepare to fetch next opcode */ | 221 | /* Empty parse stack, prepare to fetch next opcode */ |
221 | 222 | ||
222 | *op = NULL; | 223 | *op = NULL; |
223 | *arg_list = 0; | 224 | *arg_list = 0; |
@@ -246,7 +247,7 @@ void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state) | |||
246 | { | 247 | { |
247 | union acpi_generic_state *scope; | 248 | union acpi_generic_state *scope; |
248 | 249 | ||
249 | ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state); | 250 | ACPI_FUNCTION_TRACE_PTR(ps_cleanup_scope, parser_state); |
250 | 251 | ||
251 | if (!parser_state) { | 252 | if (!parser_state) { |
252 | return_VOID; | 253 | return_VOID; |
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index dd6f16726fc4..0015717ef096 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c | |||
@@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) | |||
77 | 77 | ||
78 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); | 78 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); |
79 | if (op_info->class == AML_CLASS_UNKNOWN) { | 79 | if (op_info->class == AML_CLASS_UNKNOWN) { |
80 | |||
80 | /* Invalid opcode or ASCII character */ | 81 | /* Invalid opcode or ASCII character */ |
81 | 82 | ||
82 | return (NULL); | 83 | return (NULL); |
@@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) | |||
85 | /* Check if this opcode requires argument sub-objects */ | 86 | /* Check if this opcode requires argument sub-objects */ |
86 | 87 | ||
87 | if (!(op_info->flags & AML_HAS_ARGS)) { | 88 | if (!(op_info->flags & AML_HAS_ARGS)) { |
89 | |||
88 | /* Has no linked argument objects */ | 90 | /* Has no linked argument objects */ |
89 | 91 | ||
90 | return (NULL); | 92 | return (NULL); |
@@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
130 | 132 | ||
131 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); | 133 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); |
132 | if (op_info->class == AML_CLASS_UNKNOWN) { | 134 | if (op_info->class == AML_CLASS_UNKNOWN) { |
135 | |||
133 | /* Invalid opcode */ | 136 | /* Invalid opcode */ |
134 | 137 | ||
135 | ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", | 138 | ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", |
@@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
140 | /* Check if this opcode requires argument sub-objects */ | 143 | /* Check if this opcode requires argument sub-objects */ |
141 | 144 | ||
142 | if (!(op_info->flags & AML_HAS_ARGS)) { | 145 | if (!(op_info->flags & AML_HAS_ARGS)) { |
146 | |||
143 | /* Has no linked argument objects */ | 147 | /* Has no linked argument objects */ |
144 | 148 | ||
145 | return; | 149 | return; |
@@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
148 | /* Append the argument to the linked argument list */ | 152 | /* Append the argument to the linked argument list */ |
149 | 153 | ||
150 | if (op->common.value.arg) { | 154 | if (op->common.value.arg) { |
155 | |||
151 | /* Append to existing argument list */ | 156 | /* Append to existing argument list */ |
152 | 157 | ||
153 | prev_arg = op->common.value.arg; | 158 | prev_arg = op->common.value.arg; |
@@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, | |||
222 | } | 227 | } |
223 | 228 | ||
224 | if (arg == origin) { | 229 | if (arg == origin) { |
230 | |||
225 | /* Reached parent of origin, end search */ | 231 | /* Reached parent of origin, end search */ |
226 | 232 | ||
227 | return (NULL); | 233 | return (NULL); |
228 | } | 234 | } |
229 | 235 | ||
230 | if (parent->common.next) { | 236 | if (parent->common.next) { |
237 | |||
231 | /* Found sibling of parent */ | 238 | /* Found sibling of parent */ |
232 | 239 | ||
233 | return (parent->common.next); | 240 | return (parent->common.next); |
@@ -299,5 +306,4 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op) | |||
299 | return (child); | 306 | return (child); |
300 | } | 307 | } |
301 | #endif | 308 | #endif |
302 | |||
303 | #endif /* ACPI_FUTURE_USAGE */ | 309 | #endif /* ACPI_FUTURE_USAGE */ |
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 3e07cb9cb748..182474ae8ce9 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c | |||
@@ -89,7 +89,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode) | |||
89 | { | 89 | { |
90 | ACPI_FUNCTION_ENTRY(); | 90 | ACPI_FUNCTION_ENTRY(); |
91 | 91 | ||
92 | op->common.data_type = ACPI_DESC_TYPE_PARSER; | 92 | op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; |
93 | op->common.aml_opcode = opcode; | 93 | op->common.aml_opcode = opcode; |
94 | 94 | ||
95 | ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, | 95 | ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, |
@@ -135,6 +135,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) | |||
135 | /* Allocate the minimum required size object */ | 135 | /* Allocate the minimum required size object */ |
136 | 136 | ||
137 | if (flags == ACPI_PARSEOP_GENERIC) { | 137 | if (flags == ACPI_PARSEOP_GENERIC) { |
138 | |||
138 | /* The generic op (default) is by far the most common (16 to 1) */ | 139 | /* The generic op (default) is by far the most common (16 to 1) */ |
139 | 140 | ||
140 | op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); | 141 | op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); |
@@ -171,7 +172,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) | |||
171 | 172 | ||
172 | void acpi_ps_free_op(union acpi_parse_object *op) | 173 | void acpi_ps_free_op(union acpi_parse_object *op) |
173 | { | 174 | { |
174 | ACPI_FUNCTION_NAME("ps_free_op"); | 175 | ACPI_FUNCTION_NAME(ps_free_op); |
175 | 176 | ||
176 | if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 177 | if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
177 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", | 178 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", |
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 06f05bfd7612..a84a547a0f1b 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c | |||
@@ -64,18 +64,21 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) | |||
64 | union acpi_parse_object *next = NULL; | 64 | union acpi_parse_object *next = NULL; |
65 | union acpi_parse_object *parent = NULL; | 65 | union acpi_parse_object *parent = NULL; |
66 | 66 | ||
67 | ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root); | 67 | ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root); |
68 | 68 | ||
69 | /* Visit all nodes in the subtree */ | 69 | /* Visit all nodes in the subtree */ |
70 | 70 | ||
71 | while (op) { | 71 | while (op) { |
72 | |||
72 | /* Check if we are not ascending */ | 73 | /* Check if we are not ascending */ |
73 | 74 | ||
74 | if (op != parent) { | 75 | if (op != parent) { |
76 | |||
75 | /* Look for an argument or child of the current op */ | 77 | /* Look for an argument or child of the current op */ |
76 | 78 | ||
77 | next = acpi_ps_get_arg(op, 0); | 79 | next = acpi_ps_get_arg(op, 0); |
78 | if (next) { | 80 | if (next) { |
81 | |||
79 | /* Still going downward in tree (Op is not completed yet) */ | 82 | /* Still going downward in tree (Op is not completed yet) */ |
80 | 83 | ||
81 | op = next; | 84 | op = next; |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 2dd48cbb7c02..5d996c1140af 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -50,14 +50,14 @@ | |||
50 | ACPI_MODULE_NAME("psxface") | 50 | ACPI_MODULE_NAME("psxface") |
51 | 51 | ||
52 | /* Local Prototypes */ | 52 | /* Local Prototypes */ |
53 | static void acpi_ps_start_trace(struct acpi_parameter_info *info); | 53 | static void acpi_ps_start_trace(struct acpi_evaluate_info *info); |
54 | 54 | ||
55 | static void acpi_ps_stop_trace(struct acpi_parameter_info *info); | 55 | static void acpi_ps_stop_trace(struct acpi_evaluate_info *info); |
56 | 56 | ||
57 | static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); | 57 | static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info); |
58 | 58 | ||
59 | static void | 59 | static void |
60 | acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); | 60 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action); |
61 | 61 | ||
62 | /******************************************************************************* | 62 | /******************************************************************************* |
63 | * | 63 | * |
@@ -113,7 +113,7 @@ acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags) | |||
113 | * | 113 | * |
114 | ******************************************************************************/ | 114 | ******************************************************************************/ |
115 | 115 | ||
116 | static void acpi_ps_start_trace(struct acpi_parameter_info *info) | 116 | static void acpi_ps_start_trace(struct acpi_evaluate_info *info) |
117 | { | 117 | { |
118 | acpi_status status; | 118 | acpi_status status; |
119 | 119 | ||
@@ -125,7 +125,7 @@ static void acpi_ps_start_trace(struct acpi_parameter_info *info) | |||
125 | } | 125 | } |
126 | 126 | ||
127 | if ((!acpi_gbl_trace_method_name) || | 127 | if ((!acpi_gbl_trace_method_name) || |
128 | (acpi_gbl_trace_method_name != info->node->name.integer)) { | 128 | (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { |
129 | goto exit; | 129 | goto exit; |
130 | } | 130 | } |
131 | 131 | ||
@@ -158,7 +158,7 @@ static void acpi_ps_start_trace(struct acpi_parameter_info *info) | |||
158 | * | 158 | * |
159 | ******************************************************************************/ | 159 | ******************************************************************************/ |
160 | 160 | ||
161 | static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | 161 | static void acpi_ps_stop_trace(struct acpi_evaluate_info *info) |
162 | { | 162 | { |
163 | acpi_status status; | 163 | acpi_status status; |
164 | 164 | ||
@@ -170,7 +170,7 @@ static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | |||
170 | } | 170 | } |
171 | 171 | ||
172 | if ((!acpi_gbl_trace_method_name) || | 172 | if ((!acpi_gbl_trace_method_name) || |
173 | (acpi_gbl_trace_method_name != info->node->name.integer)) { | 173 | (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { |
174 | goto exit; | 174 | goto exit; |
175 | } | 175 | } |
176 | 176 | ||
@@ -212,22 +212,23 @@ static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | |||
212 | * | 212 | * |
213 | ******************************************************************************/ | 213 | ******************************************************************************/ |
214 | 214 | ||
215 | acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | 215 | acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) |
216 | { | 216 | { |
217 | acpi_status status; | 217 | acpi_status status; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE("ps_execute_method"); | 219 | ACPI_FUNCTION_TRACE(ps_execute_method); |
220 | 220 | ||
221 | /* Validate the Info and method Node */ | 221 | /* Validate the Info and method Node */ |
222 | 222 | ||
223 | if (!info || !info->node) { | 223 | if (!info || !info->resolved_node) { |
224 | return_ACPI_STATUS(AE_NULL_ENTRY); | 224 | return_ACPI_STATUS(AE_NULL_ENTRY); |
225 | } | 225 | } |
226 | 226 | ||
227 | /* Init for new method, wait on concurrency semaphore */ | 227 | /* Init for new method, wait on concurrency semaphore */ |
228 | 228 | ||
229 | status = | 229 | status = |
230 | acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL); | 230 | acpi_ds_begin_method_execution(info->resolved_node, info->obj_desc, |
231 | NULL); | ||
231 | if (ACPI_FAILURE(status)) { | 232 | if (ACPI_FAILURE(status)) { |
232 | return_ACPI_STATUS(status); | 233 | return_ACPI_STATUS(status); |
233 | } | 234 | } |
@@ -248,7 +249,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
248 | */ | 249 | */ |
249 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 250 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
250 | "**** Begin Method Parse **** Entry=%p obj=%p\n", | 251 | "**** Begin Method Parse **** Entry=%p obj=%p\n", |
251 | info->node, info->obj_desc)); | 252 | info->resolved_node, info->obj_desc)); |
252 | 253 | ||
253 | info->pass_number = 1; | 254 | info->pass_number = 1; |
254 | status = acpi_ps_execute_pass(info); | 255 | status = acpi_ps_execute_pass(info); |
@@ -261,7 +262,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
261 | */ | 262 | */ |
262 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 263 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
263 | "**** Begin Method Execution **** Entry=%p obj=%p\n", | 264 | "**** Begin Method Execution **** Entry=%p obj=%p\n", |
264 | info->node, info->obj_desc)); | 265 | info->resolved_node, info->obj_desc)); |
265 | 266 | ||
266 | info->pass_number = 3; | 267 | info->pass_number = 3; |
267 | status = acpi_ps_execute_pass(info); | 268 | status = acpi_ps_execute_pass(info); |
@@ -286,8 +287,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
286 | * a control exception code | 287 | * a control exception code |
287 | */ | 288 | */ |
288 | if (info->return_object) { | 289 | if (info->return_object) { |
289 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 290 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n", |
290 | "Method returned obj_desc=%p\n", | ||
291 | info->return_object)); | 291 | info->return_object)); |
292 | ACPI_DUMP_STACK_ENTRY(info->return_object); | 292 | ACPI_DUMP_STACK_ENTRY(info->return_object); |
293 | 293 | ||
@@ -301,7 +301,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
301 | * | 301 | * |
302 | * FUNCTION: acpi_ps_update_parameter_list | 302 | * FUNCTION: acpi_ps_update_parameter_list |
303 | * | 303 | * |
304 | * PARAMETERS: Info - See struct acpi_parameter_info | 304 | * PARAMETERS: Info - See struct acpi_evaluate_info |
305 | * (Used: parameter_type and Parameters) | 305 | * (Used: parameter_type and Parameters) |
306 | * Action - Add or Remove reference | 306 | * Action - Add or Remove reference |
307 | * | 307 | * |
@@ -312,14 +312,16 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
312 | ******************************************************************************/ | 312 | ******************************************************************************/ |
313 | 313 | ||
314 | static void | 314 | static void |
315 | acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | 315 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) |
316 | { | 316 | { |
317 | acpi_native_uint i; | 317 | acpi_native_uint i; |
318 | 318 | ||
319 | if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { | 319 | if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { |
320 | |||
320 | /* Update reference count for each parameter */ | 321 | /* Update reference count for each parameter */ |
321 | 322 | ||
322 | for (i = 0; info->parameters[i]; i++) { | 323 | for (i = 0; info->parameters[i]; i++) { |
324 | |||
323 | /* Ignore errors, just do them all */ | 325 | /* Ignore errors, just do them all */ |
324 | 326 | ||
325 | (void)acpi_ut_update_object_reference(info-> | 327 | (void)acpi_ut_update_object_reference(info-> |
@@ -333,7 +335,7 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | |||
333 | * | 335 | * |
334 | * FUNCTION: acpi_ps_execute_pass | 336 | * FUNCTION: acpi_ps_execute_pass |
335 | * | 337 | * |
336 | * PARAMETERS: Info - See struct acpi_parameter_info | 338 | * PARAMETERS: Info - See struct acpi_evaluate_info |
337 | * (Used: pass_number, Node, and obj_desc) | 339 | * (Used: pass_number, Node, and obj_desc) |
338 | * | 340 | * |
339 | * RETURN: Status | 341 | * RETURN: Status |
@@ -342,13 +344,13 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | |||
342 | * | 344 | * |
343 | ******************************************************************************/ | 345 | ******************************************************************************/ |
344 | 346 | ||
345 | static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info) | 347 | static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info) |
346 | { | 348 | { |
347 | acpi_status status; | 349 | acpi_status status; |
348 | union acpi_parse_object *op; | 350 | union acpi_parse_object *op; |
349 | struct acpi_walk_state *walk_state; | 351 | struct acpi_walk_state *walk_state; |
350 | 352 | ||
351 | ACPI_FUNCTION_TRACE("ps_execute_pass"); | 353 | ACPI_FUNCTION_TRACE(ps_execute_pass); |
352 | 354 | ||
353 | /* Create and init a Root Node */ | 355 | /* Create and init a Root Node */ |
354 | 356 | ||
@@ -367,7 +369,7 @@ static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info) | |||
367 | goto cleanup; | 369 | goto cleanup; |
368 | } | 370 | } |
369 | 371 | ||
370 | status = acpi_ds_init_aml_walk(walk_state, op, info->node, | 372 | status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node, |
371 | info->obj_desc->method.aml_start, | 373 | info->obj_desc->method.aml_start, |
372 | info->obj_desc->method.aml_length, | 374 | info->obj_desc->method.aml_length, |
373 | info->pass_number == 1 ? NULL : info, | 375 | info->pass_number == 1 ? NULL : info, |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 713b763884a9..a1b46fb41c80 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -388,7 +388,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
388 | 388 | ||
389 | /* Use the acpiid in MADT to map cpus in case of SMP */ | 389 | /* Use the acpiid in MADT to map cpus in case of SMP */ |
390 | #ifndef CONFIG_SMP | 390 | #ifndef CONFIG_SMP |
391 | #define convert_acpiid_to_cpu(acpi_id) (0xff) | 391 | #define convert_acpiid_to_cpu(acpi_id) (-1) |
392 | #else | 392 | #else |
393 | 393 | ||
394 | #ifdef CONFIG_IA64 | 394 | #ifdef CONFIG_IA64 |
@@ -401,7 +401,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
401 | #define ARCH_BAD_APICID (0xff) | 401 | #define ARCH_BAD_APICID (0xff) |
402 | #endif | 402 | #endif |
403 | 403 | ||
404 | static u8 convert_acpiid_to_cpu(u8 acpi_id) | 404 | static int convert_acpiid_to_cpu(u8 acpi_id) |
405 | { | 405 | { |
406 | u16 apic_id; | 406 | u16 apic_id; |
407 | int i; | 407 | int i; |
@@ -427,7 +427,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
427 | acpi_status status = 0; | 427 | acpi_status status = 0; |
428 | union acpi_object object = { 0 }; | 428 | union acpi_object object = { 0 }; |
429 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 429 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
430 | u8 cpu_index; | 430 | int cpu_index; |
431 | static int cpu0_initialized; | 431 | static int cpu0_initialized; |
432 | 432 | ||
433 | ACPI_FUNCTION_TRACE("acpi_processor_get_info"); | 433 | ACPI_FUNCTION_TRACE("acpi_processor_get_info"); |
@@ -473,7 +473,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
473 | cpu_index = convert_acpiid_to_cpu(pr->acpi_id); | 473 | cpu_index = convert_acpiid_to_cpu(pr->acpi_id); |
474 | 474 | ||
475 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | 475 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ |
476 | if (!cpu0_initialized && (cpu_index == 0xff) && | 476 | if (!cpu0_initialized && (cpu_index == -1) && |
477 | (num_online_cpus() == 1)) { | 477 | (num_online_cpus() == 1)) { |
478 | cpu_index = 0; | 478 | cpu_index = 0; |
479 | } | 479 | } |
@@ -487,7 +487,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
487 | * less than the max # of CPUs. They should be ignored _iff | 487 | * less than the max # of CPUs. They should be ignored _iff |
488 | * they are physically not present. | 488 | * they are physically not present. |
489 | */ | 489 | */ |
490 | if (cpu_index >= NR_CPUS) { | 490 | if (cpu_index == -1) { |
491 | if (ACPI_FAILURE | 491 | if (ACPI_FAILURE |
492 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { | 492 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { |
493 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 493 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -558,8 +558,8 @@ static int acpi_processor_start(struct acpi_device *device) | |||
558 | */ | 558 | */ |
559 | if (processor_device_array[pr->id] != NULL && | 559 | if (processor_device_array[pr->id] != NULL && |
560 | processor_device_array[pr->id] != (void *)device) { | 560 | processor_device_array[pr->id] != (void *)device) { |
561 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "BIOS reporting wrong ACPI id" | 561 | printk(KERN_WARNING "BIOS reported wrong ACPI id" |
562 | "for the processor\n")); | 562 | "for the processor\n"); |
563 | return_VALUE(-ENODEV); | 563 | return_VALUE(-ENODEV); |
564 | } | 564 | } |
565 | processor_device_array[pr->id] = (void *)device; | 565 | processor_device_array[pr->id] = (void *)device; |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index abbdb37a7f5f..f36db22ce1ae 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -577,6 +577,8 @@ acpi_processor_register_performance(struct acpi_processor_performance | |||
577 | return_VALUE(-EBUSY); | 577 | return_VALUE(-EBUSY); |
578 | } | 578 | } |
579 | 579 | ||
580 | WARN_ON(!performance); | ||
581 | |||
580 | pr->performance = performance; | 582 | pr->performance = performance; |
581 | 583 | ||
582 | if (acpi_processor_get_performance_info(pr)) { | 584 | if (acpi_processor_get_performance_info(pr)) { |
@@ -609,7 +611,8 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
609 | return_VOID; | 611 | return_VOID; |
610 | } | 612 | } |
611 | 613 | ||
612 | kfree(pr->performance->states); | 614 | if (pr->performance) |
615 | kfree(pr->performance->states); | ||
613 | pr->performance = NULL; | 616 | pr->performance = NULL; |
614 | 617 | ||
615 | acpi_cpufreq_remove_file(pr); | 618 | acpi_cpufreq_remove_file(pr); |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 4038dbfa63a0..cf87b0230026 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) | |||
78 | ACPI_FUNCTION_ENTRY(); | 78 | ACPI_FUNCTION_ENTRY(); |
79 | 79 | ||
80 | for (bits_set = 0; bit_field; bits_set++) { | 80 | for (bits_set = 0; bit_field; bits_set++) { |
81 | |||
81 | /* Zero the least significant bit that is set */ | 82 | /* Zero the least significant bit that is set */ |
82 | 83 | ||
83 | bit_field &= (bit_field - 1); | 84 | bit_field &= (bit_field - 1); |
@@ -154,15 +155,18 @@ acpi_rs_stream_option_length(u32 resource_length, | |||
154 | * length, minus one byte for the resource_source_index itself. | 155 | * length, minus one byte for the resource_source_index itself. |
155 | */ | 156 | */ |
156 | if (resource_length > minimum_aml_resource_length) { | 157 | if (resource_length > minimum_aml_resource_length) { |
158 | |||
157 | /* Compute the length of the optional string */ | 159 | /* Compute the length of the optional string */ |
158 | 160 | ||
159 | string_length = | 161 | string_length = |
160 | resource_length - minimum_aml_resource_length - 1; | 162 | resource_length - minimum_aml_resource_length - 1; |
161 | } | 163 | } |
162 | 164 | ||
163 | /* Round up length to 32 bits for internal structure alignment */ | 165 | /* |
164 | 166 | * Round the length up to a multiple of the native word in order to | |
165 | return (ACPI_ROUND_UP_to_32_bITS(string_length)); | 167 | * guarantee that the entire resource descriptor is native word aligned |
168 | */ | ||
169 | return ((u32) ACPI_ROUND_UP_TO_NATIVE_WORD(string_length)); | ||
166 | } | 170 | } |
167 | 171 | ||
168 | /******************************************************************************* | 172 | /******************************************************************************* |
@@ -186,11 +190,12 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) | |||
186 | acpi_size aml_size_needed = 0; | 190 | acpi_size aml_size_needed = 0; |
187 | acpi_rs_length total_size; | 191 | acpi_rs_length total_size; |
188 | 192 | ||
189 | ACPI_FUNCTION_TRACE("rs_get_aml_length"); | 193 | ACPI_FUNCTION_TRACE(rs_get_aml_length); |
190 | 194 | ||
191 | /* Traverse entire list of internal resource descriptors */ | 195 | /* Traverse entire list of internal resource descriptors */ |
192 | 196 | ||
193 | while (resource) { | 197 | while (resource) { |
198 | |||
194 | /* Validate the descriptor type */ | 199 | /* Validate the descriptor type */ |
195 | 200 | ||
196 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 201 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
@@ -214,6 +219,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) | |||
214 | * is a Large Resource data type. | 219 | * is a Large Resource data type. |
215 | */ | 220 | */ |
216 | if (resource->data.vendor.byte_length > 7) { | 221 | if (resource->data.vendor.byte_length > 7) { |
222 | |||
217 | /* Base size of a Large resource descriptor */ | 223 | /* Base size of a Large resource descriptor */ |
218 | 224 | ||
219 | total_size = | 225 | total_size = |
@@ -332,20 +338,22 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
332 | acpi_status status; | 338 | acpi_status status; |
333 | u8 *end_aml; | 339 | u8 *end_aml; |
334 | u8 *buffer; | 340 | u8 *buffer; |
335 | u32 buffer_size = 0; | 341 | u32 buffer_size; |
336 | u16 temp16; | 342 | u16 temp16; |
337 | u16 resource_length; | 343 | u16 resource_length; |
338 | u32 extra_struct_bytes; | 344 | u32 extra_struct_bytes; |
339 | u8 resource_index; | 345 | u8 resource_index; |
340 | u8 minimum_aml_resource_length; | 346 | u8 minimum_aml_resource_length; |
341 | 347 | ||
342 | ACPI_FUNCTION_TRACE("rs_get_list_length"); | 348 | ACPI_FUNCTION_TRACE(rs_get_list_length); |
343 | 349 | ||
350 | *size_needed = 0; | ||
344 | end_aml = aml_buffer + aml_buffer_length; | 351 | end_aml = aml_buffer + aml_buffer_length; |
345 | 352 | ||
346 | /* Walk the list of AML resource descriptors */ | 353 | /* Walk the list of AML resource descriptors */ |
347 | 354 | ||
348 | while (aml_buffer < end_aml) { | 355 | while (aml_buffer < end_aml) { |
356 | |||
349 | /* Validate the Resource Type and Resource Length */ | 357 | /* Validate the Resource Type and Resource Length */ |
350 | 358 | ||
351 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); | 359 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); |
@@ -386,35 +394,28 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
386 | break; | 394 | break; |
387 | 395 | ||
388 | case ACPI_RESOURCE_NAME_VENDOR_SMALL: | 396 | case ACPI_RESOURCE_NAME_VENDOR_SMALL: |
397 | case ACPI_RESOURCE_NAME_VENDOR_LARGE: | ||
389 | /* | 398 | /* |
390 | * Vendor Resource: | 399 | * Vendor Resource: |
391 | * Ensure a 32-bit boundary for the structure | 400 | * Get the number of vendor data bytes |
392 | */ | 401 | */ |
393 | extra_struct_bytes = | 402 | extra_struct_bytes = resource_length; |
394 | ACPI_ROUND_UP_to_32_bITS(resource_length); | ||
395 | break; | 403 | break; |
396 | 404 | ||
397 | case ACPI_RESOURCE_NAME_END_TAG: | 405 | case ACPI_RESOURCE_NAME_END_TAG: |
398 | /* | 406 | /* |
399 | * End Tag: This is the normal exit, add size of end_tag | 407 | * End Tag: |
408 | * This is the normal exit, add size of end_tag | ||
400 | */ | 409 | */ |
401 | *size_needed = buffer_size + ACPI_RS_SIZE_MIN; | 410 | *size_needed += ACPI_RS_SIZE_MIN; |
402 | return_ACPI_STATUS(AE_OK); | 411 | return_ACPI_STATUS(AE_OK); |
403 | 412 | ||
404 | case ACPI_RESOURCE_NAME_VENDOR_LARGE: | ||
405 | /* | ||
406 | * Vendor Resource: | ||
407 | * Add vendor data and ensure a 32-bit boundary for the structure | ||
408 | */ | ||
409 | extra_struct_bytes = | ||
410 | ACPI_ROUND_UP_to_32_bITS(resource_length); | ||
411 | break; | ||
412 | |||
413 | case ACPI_RESOURCE_NAME_ADDRESS32: | 413 | case ACPI_RESOURCE_NAME_ADDRESS32: |
414 | case ACPI_RESOURCE_NAME_ADDRESS16: | 414 | case ACPI_RESOURCE_NAME_ADDRESS16: |
415 | case ACPI_RESOURCE_NAME_ADDRESS64: | ||
415 | /* | 416 | /* |
416 | * 32-Bit or 16-bit Address Resource: | 417 | * Address Resource: |
417 | * Add the size of any optional data (resource_source) | 418 | * Add the size of the optional resource_source |
418 | */ | 419 | */ |
419 | extra_struct_bytes = | 420 | extra_struct_bytes = |
420 | acpi_rs_stream_option_length(resource_length, | 421 | acpi_rs_stream_option_length(resource_length, |
@@ -423,50 +424,46 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
423 | 424 | ||
424 | case ACPI_RESOURCE_NAME_EXTENDED_IRQ: | 425 | case ACPI_RESOURCE_NAME_EXTENDED_IRQ: |
425 | /* | 426 | /* |
426 | * Extended IRQ: | 427 | * Extended IRQ Resource: |
427 | * Point past the interrupt_vector_flags to get the | 428 | * Using the interrupt_table_length, add 4 bytes for each additional |
428 | * interrupt_table_length. | 429 | * interrupt. Note: at least one interrupt is required and is |
430 | * included in the minimum descriptor size (reason for the -1) | ||
429 | */ | 431 | */ |
430 | buffer++; | 432 | extra_struct_bytes = (buffer[1] - 1) * sizeof(u32); |
431 | 433 | ||
432 | extra_struct_bytes = | 434 | /* Add the size of the optional resource_source */ |
433 | /* | 435 | |
434 | * Add 4 bytes for each additional interrupt. Note: at | 436 | extra_struct_bytes += |
435 | * least one interrupt is required and is included in | ||
436 | * the minimum descriptor size | ||
437 | */ | ||
438 | ((*buffer - 1) * sizeof(u32)) + | ||
439 | /* Add the size of any optional data (resource_source) */ | ||
440 | acpi_rs_stream_option_length(resource_length - | 437 | acpi_rs_stream_option_length(resource_length - |
441 | extra_struct_bytes, | 438 | extra_struct_bytes, |
442 | minimum_aml_resource_length); | 439 | minimum_aml_resource_length); |
443 | break; | 440 | break; |
444 | 441 | ||
445 | case ACPI_RESOURCE_NAME_ADDRESS64: | ||
446 | /* | ||
447 | * 64-Bit Address Resource: | ||
448 | * Add the size of any optional data (resource_source) | ||
449 | * Ensure a 64-bit boundary for the structure | ||
450 | */ | ||
451 | extra_struct_bytes = | ||
452 | ACPI_ROUND_UP_to_64_bITS | ||
453 | (acpi_rs_stream_option_length | ||
454 | (resource_length, minimum_aml_resource_length)); | ||
455 | break; | ||
456 | |||
457 | default: | 442 | default: |
458 | break; | 443 | break; |
459 | } | 444 | } |
460 | 445 | ||
461 | /* Update the required buffer size for the internal descriptor structs */ | 446 | /* |
447 | * Update the required buffer size for the internal descriptor structs | ||
448 | * | ||
449 | * Important: Round the size up for the appropriate alignment. This | ||
450 | * is a requirement on IA64. | ||
451 | */ | ||
452 | buffer_size = acpi_gbl_resource_struct_sizes[resource_index] + | ||
453 | extra_struct_bytes; | ||
454 | buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); | ||
462 | 455 | ||
463 | temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + | 456 | *size_needed += buffer_size; |
464 | extra_struct_bytes); | 457 | |
465 | buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); | 458 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
459 | "Type %.2X, AmlLength %.2X InternalLength %.2X\n", | ||
460 | acpi_ut_get_resource_type(aml_buffer), | ||
461 | acpi_ut_get_descriptor_length(aml_buffer), | ||
462 | buffer_size)); | ||
466 | 463 | ||
467 | /* | 464 | /* |
468 | * Point to the next resource within the stream | 465 | * Point to the next resource within the AML stream using the length |
469 | * using the size of the header plus the length contained in the header | 466 | * contained in the resource descriptor header |
470 | */ | 467 | */ |
471 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); | 468 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); |
472 | } | 469 | } |
@@ -506,7 +503,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
506 | u8 name_found; | 503 | u8 name_found; |
507 | u32 table_index; | 504 | u32 table_index; |
508 | 505 | ||
509 | ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length"); | 506 | ACPI_FUNCTION_TRACE(rs_get_pci_routing_table_length); |
510 | 507 | ||
511 | number_of_elements = package_object->package.count; | 508 | number_of_elements = package_object->package.count; |
512 | 509 | ||
@@ -523,6 +520,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
523 | top_object_list = package_object->package.elements; | 520 | top_object_list = package_object->package.elements; |
524 | 521 | ||
525 | for (index = 0; index < number_of_elements; index++) { | 522 | for (index = 0; index < number_of_elements; index++) { |
523 | |||
526 | /* Dereference the sub-package */ | 524 | /* Dereference the sub-package */ |
527 | 525 | ||
528 | package_element = *top_object_list; | 526 | package_element = *top_object_list; |
@@ -581,7 +579,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
581 | 579 | ||
582 | /* Round up the size since each element must be aligned */ | 580 | /* Round up the size since each element must be aligned */ |
583 | 581 | ||
584 | temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed); | 582 | temp_size_needed = ACPI_ROUND_UP_TO_64BIT(temp_size_needed); |
585 | 583 | ||
586 | /* Point to the next union acpi_operand_object */ | 584 | /* Point to the next union acpi_operand_object */ |
587 | 585 | ||
@@ -589,7 +587,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
589 | } | 587 | } |
590 | 588 | ||
591 | /* | 589 | /* |
592 | * Adding an extra element to the end of the list, essentially a | 590 | * Add an extra element to the end of the list, essentially a |
593 | * NULL terminator | 591 | * NULL terminator |
594 | */ | 592 | */ |
595 | *buffer_size_needed = | 593 | *buffer_size_needed = |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 8c128dea3252..008058acdd39 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -75,10 +75,11 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
75 | u8 *aml_start; | 75 | u8 *aml_start; |
76 | acpi_size list_size_needed = 0; | 76 | acpi_size list_size_needed = 0; |
77 | u32 aml_buffer_length; | 77 | u32 aml_buffer_length; |
78 | void *resource; | ||
78 | 79 | ||
79 | ACPI_FUNCTION_TRACE("rs_create_resource_list"); | 80 | ACPI_FUNCTION_TRACE(rs_create_resource_list); |
80 | 81 | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer)); | 82 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlBuffer = %p\n", aml_buffer)); |
82 | 83 | ||
83 | /* Params already validated, so we don't re-validate here */ | 84 | /* Params already validated, so we don't re-validate here */ |
84 | 85 | ||
@@ -92,7 +93,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
92 | status = acpi_rs_get_list_length(aml_start, aml_buffer_length, | 93 | status = acpi_rs_get_list_length(aml_start, aml_buffer_length, |
93 | &list_size_needed); | 94 | &list_size_needed); |
94 | 95 | ||
95 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", | 96 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", |
96 | status, (u32) list_size_needed)); | 97 | status, (u32) list_size_needed)); |
97 | if (ACPI_FAILURE(status)) { | 98 | if (ACPI_FAILURE(status)) { |
98 | return_ACPI_STATUS(status); | 99 | return_ACPI_STATUS(status); |
@@ -107,13 +108,15 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
107 | 108 | ||
108 | /* Do the conversion */ | 109 | /* Do the conversion */ |
109 | 110 | ||
110 | status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, | 111 | resource = output_buffer->pointer; |
111 | output_buffer->pointer); | 112 | status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length, |
113 | acpi_rs_convert_aml_to_resources, | ||
114 | &resource); | ||
112 | if (ACPI_FAILURE(status)) { | 115 | if (ACPI_FAILURE(status)) { |
113 | return_ACPI_STATUS(status); | 116 | return_ACPI_STATUS(status); |
114 | } | 117 | } |
115 | 118 | ||
116 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 119 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
117 | output_buffer->pointer, (u32) output_buffer->length)); | 120 | output_buffer->pointer, (u32) output_buffer->length)); |
118 | return_ACPI_STATUS(AE_OK); | 121 | return_ACPI_STATUS(AE_OK); |
119 | } | 122 | } |
@@ -155,7 +158,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
155 | acpi_status status; | 158 | acpi_status status; |
156 | struct acpi_buffer path_buffer; | 159 | struct acpi_buffer path_buffer; |
157 | 160 | ||
158 | ACPI_FUNCTION_TRACE("rs_create_pci_routing_table"); | 161 | ACPI_FUNCTION_TRACE(rs_create_pci_routing_table); |
159 | 162 | ||
160 | /* Params already validated, so we don't re-validate here */ | 163 | /* Params already validated, so we don't re-validate here */ |
161 | 164 | ||
@@ -167,7 +170,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
167 | return_ACPI_STATUS(status); | 170 | return_ACPI_STATUS(status); |
168 | } | 171 | } |
169 | 172 | ||
170 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n", | 173 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", |
171 | (u32) buffer_size_needed)); | 174 | (u32) buffer_size_needed)); |
172 | 175 | ||
173 | /* Validate/Allocate/Clear caller buffer */ | 176 | /* Validate/Allocate/Clear caller buffer */ |
@@ -332,7 +335,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
332 | /* Now align the current length */ | 335 | /* Now align the current length */ |
333 | 336 | ||
334 | user_prt->length = | 337 | user_prt->length = |
335 | (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length); | 338 | (u32) ACPI_ROUND_UP_TO_64BIT(user_prt->length); |
336 | 339 | ||
337 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 340 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
338 | 341 | ||
@@ -341,7 +344,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
341 | user_prt->source_index = (u32) obj_desc->integer.value; | 344 | user_prt->source_index = (u32) obj_desc->integer.value; |
342 | } else { | 345 | } else { |
343 | ACPI_ERROR((AE_INFO, | 346 | ACPI_ERROR((AE_INFO, |
344 | "(PRT[%X].source_index) Need Integer, found %s", | 347 | "(PRT[%X].SourceIndex) Need Integer, found %s", |
345 | index, | 348 | index, |
346 | acpi_ut_get_object_type_name(obj_desc))); | 349 | acpi_ut_get_object_type_name(obj_desc))); |
347 | return_ACPI_STATUS(AE_BAD_DATA); | 350 | return_ACPI_STATUS(AE_BAD_DATA); |
@@ -352,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
352 | top_object_list++; | 355 | top_object_list++; |
353 | } | 356 | } |
354 | 357 | ||
355 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 358 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
356 | output_buffer->pointer, (u32) output_buffer->length)); | 359 | output_buffer->pointer, (u32) output_buffer->length)); |
357 | return_ACPI_STATUS(AE_OK); | 360 | return_ACPI_STATUS(AE_OK); |
358 | } | 361 | } |
@@ -382,9 +385,9 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
382 | acpi_status status; | 385 | acpi_status status; |
383 | acpi_size aml_size_needed = 0; | 386 | acpi_size aml_size_needed = 0; |
384 | 387 | ||
385 | ACPI_FUNCTION_TRACE("rs_create_aml_resources"); | 388 | ACPI_FUNCTION_TRACE(rs_create_aml_resources); |
386 | 389 | ||
387 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", | 390 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "LinkedListBuffer = %p\n", |
388 | linked_list_buffer)); | 391 | linked_list_buffer)); |
389 | 392 | ||
390 | /* | 393 | /* |
@@ -395,7 +398,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
395 | */ | 398 | */ |
396 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); | 399 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); |
397 | 400 | ||
398 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n", | 401 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", |
399 | (u32) aml_size_needed, | 402 | (u32) aml_size_needed, |
400 | acpi_format_exception(status))); | 403 | acpi_format_exception(status))); |
401 | if (ACPI_FAILURE(status)) { | 404 | if (ACPI_FAILURE(status)) { |
@@ -419,7 +422,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
419 | return_ACPI_STATUS(status); | 422 | return_ACPI_STATUS(status); |
420 | } | 423 | } |
421 | 424 | ||
422 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 425 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
423 | output_buffer->pointer, (u32) output_buffer->length)); | 426 | output_buffer->pointer, (u32) output_buffer->length)); |
424 | return_ACPI_STATUS(AE_OK); | 427 | return_ACPI_STATUS(AE_OK); |
425 | } | 428 | } |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index e7de061cf883..9c99a723a860 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -91,11 +91,11 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); | |||
91 | struct acpi_rsdump_info acpi_rs_dump_irq[6] = { | 91 | struct acpi_rsdump_info acpi_rs_dump_irq[6] = { |
92 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, | 92 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, |
93 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", | 93 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", |
94 | acpi_gbl_HEdecode}, | 94 | acpi_gbl_he_decode}, |
95 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", | 95 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", |
96 | acpi_gbl_LLdecode}, | 96 | acpi_gbl_ll_decode}, |
97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", | 97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", |
98 | acpi_gbl_SHRdecode}, | 98 | acpi_gbl_shr_decode}, |
99 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), | 99 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), |
100 | "Interrupt Count", NULL}, | 100 | "Interrupt Count", NULL}, |
101 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), | 101 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), |
@@ -105,11 +105,11 @@ struct acpi_rsdump_info acpi_rs_dump_irq[6] = { | |||
105 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { | 105 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { |
106 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, | 106 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, |
107 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", | 107 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", |
108 | acpi_gbl_TYPdecode}, | 108 | acpi_gbl_typ_decode}, |
109 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", | 109 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", |
110 | acpi_gbl_BMdecode}, | 110 | acpi_gbl_bm_decode}, |
111 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", | 111 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", |
112 | acpi_gbl_SIZdecode}, | 112 | acpi_gbl_siz_decode}, |
113 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", | 113 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", |
114 | NULL}, | 114 | NULL}, |
115 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", | 115 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", |
@@ -158,7 +158,7 @@ struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { | 160 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { |
161 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag", | 161 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag", |
162 | NULL} | 162 | NULL} |
163 | }; | 163 | }; |
164 | 164 | ||
@@ -166,7 +166,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { | |||
166 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), | 166 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), |
167 | "24-Bit Memory Range", NULL}, | 167 | "24-Bit Memory Range", NULL}, |
168 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), | 168 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), |
169 | "Write Protect", acpi_gbl_RWdecode}, | 169 | "Write Protect", acpi_gbl_rw_decode}, |
170 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", | 170 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", |
171 | NULL}, | 171 | NULL}, |
172 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", | 172 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", |
@@ -181,7 +181,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { | |||
181 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), | 181 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), |
182 | "32-Bit Memory Range", NULL}, | 182 | "32-Bit Memory Range", NULL}, |
183 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), | 183 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), |
184 | "Write Protect", acpi_gbl_RWdecode}, | 184 | "Write Protect", acpi_gbl_rw_decode}, |
185 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", | 185 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", |
186 | NULL}, | 186 | NULL}, |
187 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", | 187 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", |
@@ -196,7 +196,7 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { | |||
196 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), | 196 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), |
197 | "32-Bit Fixed Memory Range", NULL}, | 197 | "32-Bit Fixed Memory Range", NULL}, |
198 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), | 198 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), |
199 | "Write Protect", acpi_gbl_RWdecode}, | 199 | "Write Protect", acpi_gbl_rw_decode}, |
200 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", | 200 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", |
201 | NULL}, | 201 | NULL}, |
202 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), | 202 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), |
@@ -278,11 +278,11 @@ struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { | |||
278 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), | 278 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), |
279 | "Type", acpi_gbl_consume_decode}, | 279 | "Type", acpi_gbl_consume_decode}, |
280 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), | 280 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), |
281 | "Triggering", acpi_gbl_HEdecode}, | 281 | "Triggering", acpi_gbl_he_decode}, |
282 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", | 282 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", |
283 | acpi_gbl_LLdecode}, | 283 | acpi_gbl_ll_decode}, |
284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", | 284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", |
285 | acpi_gbl_SHRdecode}, | 285 | acpi_gbl_shr_decode}, |
286 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, | 286 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, |
287 | NULL}, | 287 | NULL}, |
288 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), | 288 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), |
@@ -314,7 +314,7 @@ static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { | |||
314 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), | 314 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), |
315 | "Consumer/Producer", acpi_gbl_consume_decode}, | 315 | "Consumer/Producer", acpi_gbl_consume_decode}, |
316 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", | 316 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", |
317 | acpi_gbl_DECdecode}, | 317 | acpi_gbl_dec_decode}, |
318 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), | 318 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), |
319 | "Min Relocatability", acpi_gbl_min_decode}, | 319 | "Min Relocatability", acpi_gbl_min_decode}, |
320 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), | 320 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), |
@@ -325,24 +325,24 @@ static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { | |||
325 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), | 325 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), |
326 | "Resource Type", (void *)"Memory Range"}, | 326 | "Resource Type", (void *)"Memory Range"}, |
327 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), | 327 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), |
328 | "Write Protect", acpi_gbl_RWdecode}, | 328 | "Write Protect", acpi_gbl_rw_decode}, |
329 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), | 329 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), |
330 | "Caching", acpi_gbl_MEMdecode}, | 330 | "Caching", acpi_gbl_mem_decode}, |
331 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), | 331 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), |
332 | "Range Type", acpi_gbl_MTPdecode}, | 332 | "Range Type", acpi_gbl_mtp_decode}, |
333 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), | 333 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), |
334 | "Translation", acpi_gbl_TTPdecode} | 334 | "Translation", acpi_gbl_ttp_decode} |
335 | }; | 335 | }; |
336 | 336 | ||
337 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { | 337 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { |
338 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), | 338 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), |
339 | "Resource Type", (void *)"I/O Range"}, | 339 | "Resource Type", (void *)"I/O Range"}, |
340 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), | 340 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), |
341 | "Range Type", acpi_gbl_RNGdecode}, | 341 | "Range Type", acpi_gbl_rng_decode}, |
342 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), | 342 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), |
343 | "Translation", acpi_gbl_TTPdecode}, | 343 | "Translation", acpi_gbl_ttp_decode}, |
344 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), | 344 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), |
345 | "Translation Type", acpi_gbl_TRSdecode} | 345 | "Translation Type", acpi_gbl_trs_decode} |
346 | }; | 346 | }; |
347 | 347 | ||
348 | /* | 348 | /* |
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index d9ae64b77bd9..9e7ae2f8a1d3 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c | |||
@@ -141,6 +141,7 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { | |||
141 | acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | 141 | acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ |
142 | }; | 142 | }; |
143 | #endif | 143 | #endif |
144 | |||
144 | #endif /* ACPI_FUTURE_USAGE */ | 145 | #endif /* ACPI_FUTURE_USAGE */ |
145 | /* | 146 | /* |
146 | * Base sizes for external AML resource descriptors, indexed by internal type. | 147 | * Base sizes for external AML resource descriptors, indexed by internal type. |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 1434e786477e..29423ce030ca 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -51,76 +51,62 @@ ACPI_MODULE_NAME("rslist") | |||
51 | * | 51 | * |
52 | * FUNCTION: acpi_rs_convert_aml_to_resources | 52 | * FUNCTION: acpi_rs_convert_aml_to_resources |
53 | * | 53 | * |
54 | * PARAMETERS: Aml - Pointer to the resource byte stream | 54 | * PARAMETERS: acpi_walk_aml_callback |
55 | * aml_length - Length of Aml | 55 | * resource_ptr - Pointer to the buffer that will |
56 | * output_buffer - Pointer to the buffer that will | 56 | * contain the output structures |
57 | * contain the output structures | ||
58 | * | 57 | * |
59 | * RETURN: Status | 58 | * RETURN: Status |
60 | * | 59 | * |
61 | * DESCRIPTION: Takes the resource byte stream and parses it, creating a | 60 | * DESCRIPTION: Convert an AML resource to an internal representation of the |
62 | * linked list of resources in the caller's output buffer | 61 | * resource that is aligned and easier to access. |
63 | * | 62 | * |
64 | ******************************************************************************/ | 63 | ******************************************************************************/ |
65 | acpi_status | 64 | acpi_status |
66 | acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) | 65 | acpi_rs_convert_aml_to_resources(u8 * aml, |
66 | u32 length, | ||
67 | u32 offset, u8 resource_index, void **context) | ||
67 | { | 68 | { |
68 | struct acpi_resource *resource = (void *)output_buffer; | 69 | struct acpi_resource **resource_ptr = |
70 | ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context); | ||
71 | struct acpi_resource *resource; | ||
69 | acpi_status status; | 72 | acpi_status status; |
70 | u8 resource_index; | ||
71 | u8 *end_aml; | ||
72 | |||
73 | ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); | ||
74 | |||
75 | end_aml = aml + aml_length; | ||
76 | |||
77 | /* Loop until end-of-buffer or an end_tag is found */ | ||
78 | |||
79 | while (aml < end_aml) { | ||
80 | /* Validate the Resource Type and Resource Length */ | ||
81 | |||
82 | status = acpi_ut_validate_resource(aml, &resource_index); | ||
83 | if (ACPI_FAILURE(status)) { | ||
84 | return_ACPI_STATUS(status); | ||
85 | } | ||
86 | 73 | ||
87 | /* Convert the AML byte stream resource to a local resource struct */ | 74 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources); |
88 | |||
89 | status = | ||
90 | acpi_rs_convert_aml_to_resource(resource, | ||
91 | ACPI_CAST_PTR(union | ||
92 | aml_resource, | ||
93 | aml), | ||
94 | acpi_gbl_get_resource_dispatch | ||
95 | [resource_index]); | ||
96 | if (ACPI_FAILURE(status)) { | ||
97 | ACPI_EXCEPTION((AE_INFO, status, | ||
98 | "Could not convert AML resource (Type %X)", | ||
99 | *aml)); | ||
100 | return_ACPI_STATUS(status); | ||
101 | } | ||
102 | 75 | ||
103 | /* Normal exit on completion of an end_tag resource descriptor */ | 76 | /* |
104 | 77 | * Check that the input buffer and all subsequent pointers into it | |
105 | if (acpi_ut_get_resource_type(aml) == | 78 | * are aligned on a native word boundary. Most important on IA64 |
106 | ACPI_RESOURCE_NAME_END_TAG) { | 79 | */ |
107 | return_ACPI_STATUS(AE_OK); | 80 | resource = *resource_ptr; |
108 | } | 81 | if (ACPI_IS_MISALIGNED(resource)) { |
109 | 82 | ACPI_WARNING((AE_INFO, | |
110 | /* Point to the next input AML resource */ | 83 | "Misaligned resource pointer %p", resource)); |
111 | 84 | } | |
112 | aml += acpi_ut_get_descriptor_length(aml); | ||
113 | |||
114 | /* Point to the next structure in the output buffer */ | ||
115 | 85 | ||
116 | resource = | 86 | /* Convert the AML byte stream resource to a local resource struct */ |
117 | ACPI_ADD_PTR(struct acpi_resource, resource, | 87 | |
118 | resource->length); | 88 | status = |
89 | acpi_rs_convert_aml_to_resource(resource, | ||
90 | ACPI_CAST_PTR(union aml_resource, | ||
91 | aml), | ||
92 | acpi_gbl_get_resource_dispatch | ||
93 | [resource_index]); | ||
94 | if (ACPI_FAILURE(status)) { | ||
95 | ACPI_EXCEPTION((AE_INFO, status, | ||
96 | "Could not convert AML resource (Type %X)", | ||
97 | *aml)); | ||
98 | return_ACPI_STATUS(status); | ||
119 | } | 99 | } |
120 | 100 | ||
121 | /* Did not find an end_tag resource descriptor */ | 101 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
102 | "Type %.2X, AmlLength %.2X InternalLength %.2X\n", | ||
103 | acpi_ut_get_resource_type(aml), length, | ||
104 | resource->length)); | ||
122 | 105 | ||
123 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 106 | /* Point to the next structure in the output buffer */ |
107 | |||
108 | *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); | ||
109 | return_ACPI_STATUS(AE_OK); | ||
124 | } | 110 | } |
125 | 111 | ||
126 | /******************************************************************************* | 112 | /******************************************************************************* |
@@ -150,11 +136,12 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
150 | u8 *end_aml = output_buffer + aml_size_needed; | 136 | u8 *end_aml = output_buffer + aml_size_needed; |
151 | acpi_status status; | 137 | acpi_status status; |
152 | 138 | ||
153 | ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); | 139 | ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml); |
154 | 140 | ||
155 | /* Walk the resource descriptor list, convert each descriptor */ | 141 | /* Walk the resource descriptor list, convert each descriptor */ |
156 | 142 | ||
157 | while (aml < end_aml) { | 143 | while (aml < end_aml) { |
144 | |||
158 | /* Validate the (internal) Resource Type */ | 145 | /* Validate the (internal) Resource Type */ |
159 | 146 | ||
160 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 147 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
@@ -191,6 +178,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
191 | /* Check for end-of-list, normal exit */ | 178 | /* Check for end-of-list, normal exit */ |
192 | 179 | ||
193 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | 180 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { |
181 | |||
194 | /* An End Tag indicates the end of the input Resource Template */ | 182 | /* An End Tag indicates the end of the input Resource Template */ |
195 | 183 | ||
196 | return_ACPI_STATUS(AE_OK); | 184 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index ed866cf1c6d2..faf6e106b785 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -81,9 +81,10 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
81 | u16 item_count = 0; | 81 | u16 item_count = 0; |
82 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("rs_get_resource"); | 84 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); |
85 | 85 | ||
86 | if (((acpi_native_uint) resource) & 0x3) { | 86 | if (((acpi_native_uint) resource) & 0x3) { |
87 | |||
87 | /* Each internal resource struct is expected to be 32-bit aligned */ | 88 | /* Each internal resource struct is expected to be 32-bit aligned */ |
88 | 89 | ||
89 | ACPI_WARNING((AE_INFO, | 90 | ACPI_WARNING((AE_INFO, |
@@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
295 | 296 | ||
296 | exit: | 297 | exit: |
297 | if (!flags_mode) { | 298 | if (!flags_mode) { |
298 | /* Round the resource struct length up to the next 32-bit boundary */ | ||
299 | 299 | ||
300 | resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); | 300 | /* Round the resource struct length up to the next boundary (32 or 64) */ |
301 | |||
302 | resource->length = | ||
303 | (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); | ||
301 | } | 304 | } |
302 | return_ACPI_STATUS(AE_OK); | 305 | return_ACPI_STATUS(AE_OK); |
303 | } | 306 | } |
@@ -329,7 +332,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
329 | u16 temp16 = 0; | 332 | u16 temp16 = 0; |
330 | u16 item_count = 0; | 333 | u16 item_count = 0; |
331 | 334 | ||
332 | ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); | 335 | ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml); |
333 | 336 | ||
334 | /* | 337 | /* |
335 | * First table entry must be ACPI_RSC_INITxxx and must contain the | 338 | * First table entry must be ACPI_RSC_INITxxx and must contain the |
@@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { | |||
535 | 538 | ||
536 | resource->data.extended_irq.interrupt_count = temp8; | 539 | resource->data.extended_irq.interrupt_count = temp8; |
537 | if (temp8 < 1) { | 540 | if (temp8 < 1) { |
541 | |||
538 | /* Must have at least one IRQ */ | 542 | /* Must have at least one IRQ */ |
539 | 543 | ||
540 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | 544 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); |
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 25b5aedd6612..a9cbee8e8b44 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, | |||
205 | /* Length is stored differently for large and small descriptors */ | 205 | /* Length is stored differently for large and small descriptors */ |
206 | 206 | ||
207 | if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { | 207 | if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { |
208 | |||
208 | /* Large descriptor -- bytes 1-2 contain the 16-bit length */ | 209 | /* Large descriptor -- bytes 1-2 contain the 16-bit length */ |
209 | 210 | ||
210 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, | 211 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, |
@@ -298,7 +299,8 @@ static u16 acpi_rs_strcpy(char *destination, char *source) | |||
298 | * string_ptr - (optional) where to store the actual | 299 | * string_ptr - (optional) where to store the actual |
299 | * resource_source string | 300 | * resource_source string |
300 | * | 301 | * |
301 | * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit | 302 | * RETURN: Length of the string plus NULL terminator, rounded up to native |
303 | * word boundary | ||
302 | * | 304 | * |
303 | * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor | 305 | * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor |
304 | * to an internal resource descriptor | 306 | * to an internal resource descriptor |
@@ -328,6 +330,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
328 | * we add 1 to the minimum length. | 330 | * we add 1 to the minimum length. |
329 | */ | 331 | */ |
330 | if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { | 332 | if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { |
333 | |||
331 | /* Get the resource_source_index */ | 334 | /* Get the resource_source_index */ |
332 | 335 | ||
333 | resource_source->index = aml_resource_source[0]; | 336 | resource_source->index = aml_resource_source[0]; |
@@ -344,23 +347,26 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
344 | } | 347 | } |
345 | 348 | ||
346 | /* | 349 | /* |
347 | * In order for the struct_size to fall on a 32-bit boundary, calculate | 350 | * In order for the Resource length to be a multiple of the native |
348 | * the length of the string (+1 for the NULL terminator) and expand the | 351 | * word, calculate the length of the string (+1 for NULL terminator) |
349 | * struct_size to the next 32-bit boundary. | 352 | * and expand to the next word multiple. |
350 | * | 353 | * |
351 | * Zero the entire area of the buffer. | 354 | * Zero the entire area of the buffer. |
352 | */ | 355 | */ |
353 | total_length = | 356 | total_length = |
354 | ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN | 357 | (u32) |
355 | ((char *)&aml_resource_source[1]) + | 358 | ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + |
356 | 1); | 359 | 1; |
360 | total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); | ||
361 | |||
357 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); | 362 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); |
358 | 363 | ||
359 | /* Copy the resource_source string to the destination */ | 364 | /* Copy the resource_source string to the destination */ |
360 | 365 | ||
361 | resource_source->string_length = | 366 | resource_source->string_length = |
362 | acpi_rs_strcpy(resource_source->string_ptr, | 367 | acpi_rs_strcpy(resource_source->string_ptr, |
363 | (char *)&aml_resource_source[1]); | 368 | ACPI_CAST_PTR(char, |
369 | &aml_resource_source[1])); | ||
364 | 370 | ||
365 | return ((acpi_rs_length) total_length); | 371 | return ((acpi_rs_length) total_length); |
366 | } | 372 | } |
@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
405 | /* Non-zero string length indicates presence of a resource_source */ | 411 | /* Non-zero string length indicates presence of a resource_source */ |
406 | 412 | ||
407 | if (resource_source->string_length) { | 413 | if (resource_source->string_length) { |
414 | |||
408 | /* Point to the end of the AML descriptor */ | 415 | /* Point to the end of the AML descriptor */ |
409 | 416 | ||
410 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); | 417 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); |
@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
415 | 422 | ||
416 | /* Copy the resource_source string */ | 423 | /* Copy the resource_source string */ |
417 | 424 | ||
418 | ACPI_STRCPY((char *)&aml_resource_source[1], | 425 | ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]), |
419 | resource_source->string_ptr); | 426 | resource_source->string_ptr); |
420 | 427 | ||
421 | /* | 428 | /* |
@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
435 | * | 442 | * |
436 | * FUNCTION: acpi_rs_get_prt_method_data | 443 | * FUNCTION: acpi_rs_get_prt_method_data |
437 | * | 444 | * |
438 | * PARAMETERS: Handle - a handle to the containing object | 445 | * PARAMETERS: Node - Device node |
439 | * ret_buffer - a pointer to a buffer structure for the | 446 | * ret_buffer - Pointer to a buffer structure for the |
440 | * results | 447 | * results |
441 | * | 448 | * |
442 | * RETURN: Status | 449 | * RETURN: Status |
443 | * | 450 | * |
@@ -450,18 +457,19 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
450 | ******************************************************************************/ | 457 | ******************************************************************************/ |
451 | 458 | ||
452 | acpi_status | 459 | acpi_status |
453 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | 460 | acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, |
461 | struct acpi_buffer * ret_buffer) | ||
454 | { | 462 | { |
455 | union acpi_operand_object *obj_desc; | 463 | union acpi_operand_object *obj_desc; |
456 | acpi_status status; | 464 | acpi_status status; |
457 | 465 | ||
458 | ACPI_FUNCTION_TRACE("rs_get_prt_method_data"); | 466 | ACPI_FUNCTION_TRACE(rs_get_prt_method_data); |
459 | 467 | ||
460 | /* Parameters guaranteed valid by caller */ | 468 | /* Parameters guaranteed valid by caller */ |
461 | 469 | ||
462 | /* Execute the method, no parameters */ | 470 | /* Execute the method, no parameters */ |
463 | 471 | ||
464 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT, | 472 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT, |
465 | ACPI_BTYPE_PACKAGE, &obj_desc); | 473 | ACPI_BTYPE_PACKAGE, &obj_desc); |
466 | if (ACPI_FAILURE(status)) { | 474 | if (ACPI_FAILURE(status)) { |
467 | return_ACPI_STATUS(status); | 475 | return_ACPI_STATUS(status); |
@@ -483,9 +491,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
483 | * | 491 | * |
484 | * FUNCTION: acpi_rs_get_crs_method_data | 492 | * FUNCTION: acpi_rs_get_crs_method_data |
485 | * | 493 | * |
486 | * PARAMETERS: Handle - a handle to the containing object | 494 | * PARAMETERS: Node - Device node |
487 | * ret_buffer - a pointer to a buffer structure for the | 495 | * ret_buffer - Pointer to a buffer structure for the |
488 | * results | 496 | * results |
489 | * | 497 | * |
490 | * RETURN: Status | 498 | * RETURN: Status |
491 | * | 499 | * |
@@ -498,18 +506,19 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
498 | ******************************************************************************/ | 506 | ******************************************************************************/ |
499 | 507 | ||
500 | acpi_status | 508 | acpi_status |
501 | acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 509 | acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, |
510 | struct acpi_buffer *ret_buffer) | ||
502 | { | 511 | { |
503 | union acpi_operand_object *obj_desc; | 512 | union acpi_operand_object *obj_desc; |
504 | acpi_status status; | 513 | acpi_status status; |
505 | 514 | ||
506 | ACPI_FUNCTION_TRACE("rs_get_crs_method_data"); | 515 | ACPI_FUNCTION_TRACE(rs_get_crs_method_data); |
507 | 516 | ||
508 | /* Parameters guaranteed valid by caller */ | 517 | /* Parameters guaranteed valid by caller */ |
509 | 518 | ||
510 | /* Execute the method, no parameters */ | 519 | /* Execute the method, no parameters */ |
511 | 520 | ||
512 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS, | 521 | status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS, |
513 | ACPI_BTYPE_BUFFER, &obj_desc); | 522 | ACPI_BTYPE_BUFFER, &obj_desc); |
514 | if (ACPI_FAILURE(status)) { | 523 | if (ACPI_FAILURE(status)) { |
515 | return_ACPI_STATUS(status); | 524 | return_ACPI_STATUS(status); |
@@ -522,7 +531,7 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
522 | */ | 531 | */ |
523 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); | 532 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); |
524 | 533 | ||
525 | /* on exit, we must delete the object returned by evaluate_object */ | 534 | /* On exit, we must delete the object returned by evaluate_object */ |
526 | 535 | ||
527 | acpi_ut_remove_reference(obj_desc); | 536 | acpi_ut_remove_reference(obj_desc); |
528 | return_ACPI_STATUS(status); | 537 | return_ACPI_STATUS(status); |
@@ -532,9 +541,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
532 | * | 541 | * |
533 | * FUNCTION: acpi_rs_get_prs_method_data | 542 | * FUNCTION: acpi_rs_get_prs_method_data |
534 | * | 543 | * |
535 | * PARAMETERS: Handle - a handle to the containing object | 544 | * PARAMETERS: Node - Device node |
536 | * ret_buffer - a pointer to a buffer structure for the | 545 | * ret_buffer - Pointer to a buffer structure for the |
537 | * results | 546 | * results |
538 | * | 547 | * |
539 | * RETURN: Status | 548 | * RETURN: Status |
540 | * | 549 | * |
@@ -548,18 +557,19 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
548 | 557 | ||
549 | #ifdef ACPI_FUTURE_USAGE | 558 | #ifdef ACPI_FUTURE_USAGE |
550 | acpi_status | 559 | acpi_status |
551 | acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 560 | acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, |
561 | struct acpi_buffer *ret_buffer) | ||
552 | { | 562 | { |
553 | union acpi_operand_object *obj_desc; | 563 | union acpi_operand_object *obj_desc; |
554 | acpi_status status; | 564 | acpi_status status; |
555 | 565 | ||
556 | ACPI_FUNCTION_TRACE("rs_get_prs_method_data"); | 566 | ACPI_FUNCTION_TRACE(rs_get_prs_method_data); |
557 | 567 | ||
558 | /* Parameters guaranteed valid by caller */ | 568 | /* Parameters guaranteed valid by caller */ |
559 | 569 | ||
560 | /* Execute the method, no parameters */ | 570 | /* Execute the method, no parameters */ |
561 | 571 | ||
562 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS, | 572 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS, |
563 | ACPI_BTYPE_BUFFER, &obj_desc); | 573 | ACPI_BTYPE_BUFFER, &obj_desc); |
564 | if (ACPI_FAILURE(status)) { | 574 | if (ACPI_FAILURE(status)) { |
565 | return_ACPI_STATUS(status); | 575 | return_ACPI_STATUS(status); |
@@ -572,7 +582,7 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
572 | */ | 582 | */ |
573 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); | 583 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); |
574 | 584 | ||
575 | /* on exit, we must delete the object returned by evaluate_object */ | 585 | /* On exit, we must delete the object returned by evaluate_object */ |
576 | 586 | ||
577 | acpi_ut_remove_reference(obj_desc); | 587 | acpi_ut_remove_reference(obj_desc); |
578 | return_ACPI_STATUS(status); | 588 | return_ACPI_STATUS(status); |
@@ -583,10 +593,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
583 | * | 593 | * |
584 | * FUNCTION: acpi_rs_get_method_data | 594 | * FUNCTION: acpi_rs_get_method_data |
585 | * | 595 | * |
586 | * PARAMETERS: Handle - a handle to the containing object | 596 | * PARAMETERS: Handle - Handle to the containing object |
587 | * Path - Path to method, relative to Handle | 597 | * Path - Path to method, relative to Handle |
588 | * ret_buffer - a pointer to a buffer structure for the | 598 | * ret_buffer - Pointer to a buffer structure for the |
589 | * results | 599 | * results |
590 | * | 600 | * |
591 | * RETURN: Status | 601 | * RETURN: Status |
592 | * | 602 | * |
@@ -605,7 +615,7 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
605 | union acpi_operand_object *obj_desc; | 615 | union acpi_operand_object *obj_desc; |
606 | acpi_status status; | 616 | acpi_status status; |
607 | 617 | ||
608 | ACPI_FUNCTION_TRACE("rs_get_method_data"); | 618 | ACPI_FUNCTION_TRACE(rs_get_method_data); |
609 | 619 | ||
610 | /* Parameters guaranteed valid by caller */ | 620 | /* Parameters guaranteed valid by caller */ |
611 | 621 | ||
@@ -634,9 +644,9 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
634 | * | 644 | * |
635 | * FUNCTION: acpi_rs_set_srs_method_data | 645 | * FUNCTION: acpi_rs_set_srs_method_data |
636 | * | 646 | * |
637 | * PARAMETERS: Handle - a handle to the containing object | 647 | * PARAMETERS: Node - Device node |
638 | * in_buffer - a pointer to a buffer structure of the | 648 | * in_buffer - Pointer to a buffer structure of the |
639 | * parameter | 649 | * parameter |
640 | * | 650 | * |
641 | * RETURN: Status | 651 | * RETURN: Status |
642 | * | 652 | * |
@@ -646,23 +656,37 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
646 | * If the function fails an appropriate status will be returned | 656 | * If the function fails an appropriate status will be returned |
647 | * and the contents of the callers buffer is undefined. | 657 | * and the contents of the callers buffer is undefined. |
648 | * | 658 | * |
659 | * Note: Parameters guaranteed valid by caller | ||
660 | * | ||
649 | ******************************************************************************/ | 661 | ******************************************************************************/ |
650 | 662 | ||
651 | acpi_status | 663 | acpi_status |
652 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | 664 | acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, |
665 | struct acpi_buffer *in_buffer) | ||
653 | { | 666 | { |
654 | struct acpi_parameter_info info; | 667 | struct acpi_evaluate_info *info; |
655 | union acpi_operand_object *params[2]; | 668 | union acpi_operand_object *args[2]; |
656 | acpi_status status; | 669 | acpi_status status; |
657 | struct acpi_buffer buffer; | 670 | struct acpi_buffer buffer; |
658 | 671 | ||
659 | ACPI_FUNCTION_TRACE("rs_set_srs_method_data"); | 672 | ACPI_FUNCTION_TRACE(rs_set_srs_method_data); |
660 | 673 | ||
661 | /* Parameters guaranteed valid by caller */ | 674 | /* Allocate and initialize the evaluation information block */ |
675 | |||
676 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
677 | if (!info) { | ||
678 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
679 | } | ||
680 | |||
681 | info->prefix_node = node; | ||
682 | info->pathname = METHOD_NAME__SRS; | ||
683 | info->parameters = args; | ||
684 | info->parameter_type = ACPI_PARAM_ARGS; | ||
685 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
662 | 686 | ||
663 | /* | 687 | /* |
664 | * The in_buffer parameter will point to a linked list of | 688 | * The in_buffer parameter will point to a linked list of |
665 | * resource parameters. It needs to be formatted into a | 689 | * resource parameters. It needs to be formatted into a |
666 | * byte stream to be sent in as an input parameter to _SRS | 690 | * byte stream to be sent in as an input parameter to _SRS |
667 | * | 691 | * |
668 | * Convert the linked list into a byte stream | 692 | * Convert the linked list into a byte stream |
@@ -670,41 +694,36 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | |||
670 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 694 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
671 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); | 695 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); |
672 | if (ACPI_FAILURE(status)) { | 696 | if (ACPI_FAILURE(status)) { |
673 | return_ACPI_STATUS(status); | 697 | goto cleanup; |
674 | } | 698 | } |
675 | 699 | ||
676 | /* Init the param object */ | 700 | /* Create and initialize the method parameter object */ |
677 | 701 | ||
678 | params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 702 | args[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
679 | if (!params[0]) { | 703 | if (!args[0]) { |
680 | acpi_os_free(buffer.pointer); | 704 | /* |
681 | return_ACPI_STATUS(AE_NO_MEMORY); | 705 | * Must free the buffer allocated above (otherwise it is freed |
706 | * later) | ||
707 | */ | ||
708 | ACPI_FREE(buffer.pointer); | ||
709 | status = AE_NO_MEMORY; | ||
710 | goto cleanup; | ||
682 | } | 711 | } |
683 | 712 | ||
684 | /* Set up the parameter object */ | 713 | args[0]->buffer.length = (u32) buffer.length; |
685 | 714 | args[0]->buffer.pointer = buffer.pointer; | |
686 | params[0]->buffer.length = (u32) buffer.length; | 715 | args[0]->common.flags = AOPOBJ_DATA_VALID; |
687 | params[0]->buffer.pointer = buffer.pointer; | 716 | args[1] = NULL; |
688 | params[0]->common.flags = AOPOBJ_DATA_VALID; | ||
689 | params[1] = NULL; | ||
690 | |||
691 | info.node = handle; | ||
692 | info.parameters = params; | ||
693 | info.parameter_type = ACPI_PARAM_ARGS; | ||
694 | 717 | ||
695 | /* Execute the method, no return value */ | 718 | /* Execute the method, no return value is expected */ |
696 | 719 | ||
697 | status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); | 720 | status = acpi_ns_evaluate(info); |
698 | if (ACPI_SUCCESS(status)) { | ||
699 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
700 | 721 | ||
701 | if (info.return_object) { | 722 | /* Clean up and return the status from acpi_ns_evaluate */ |
702 | acpi_ut_remove_reference(info.return_object); | ||
703 | } | ||
704 | } | ||
705 | 723 | ||
706 | /* Clean up and return the status from acpi_ns_evaluate_relative */ | 724 | acpi_ut_remove_reference(args[0]); |
707 | 725 | ||
708 | acpi_ut_remove_reference(params[0]); | 726 | cleanup: |
727 | ACPI_FREE(info); | ||
709 | return_ACPI_STATUS(status); | 728 | return_ACPI_STATUS(status); |
710 | } | 729 | } |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 88b67077aeeb..1999e2ab7daa 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -41,10 +41,9 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acresrc.h> | 45 | #include <acpi/acresrc.h> |
46 | #include <acpi/acnamesp.h> | ||
48 | 47 | ||
49 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
50 | ACPI_MODULE_NAME("rsxface") | 49 | ACPI_MODULE_NAME("rsxface") |
@@ -68,312 +67,262 @@ ACPI_MODULE_NAME("rsxface") | |||
68 | static acpi_status | 67 | static acpi_status |
69 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); | 68 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); |
70 | 69 | ||
70 | static acpi_status | ||
71 | acpi_rs_validate_parameters(acpi_handle device_handle, | ||
72 | struct acpi_buffer *buffer, | ||
73 | struct acpi_namespace_node **return_node); | ||
74 | |||
71 | /******************************************************************************* | 75 | /******************************************************************************* |
72 | * | 76 | * |
73 | * FUNCTION: acpi_get_irq_routing_table | 77 | * FUNCTION: acpi_rs_validate_parameters |
74 | * | 78 | * |
75 | * PARAMETERS: device_handle - a handle to the Bus device we are querying | 79 | * PARAMETERS: device_handle - Handle to a device |
76 | * ret_buffer - a pointer to a buffer to receive the | 80 | * Buffer - Pointer to a data buffer |
77 | * current resources for the device | 81 | * return_node - Pointer to where the device node is returned |
78 | * | 82 | * |
79 | * RETURN: Status | 83 | * RETURN: Status |
80 | * | 84 | * |
81 | * DESCRIPTION: This function is called to get the IRQ routing table for a | 85 | * DESCRIPTION: Common parameter validation for resource interfaces |
82 | * specific bus. The caller must first acquire a handle for the | ||
83 | * desired bus. The routine table is placed in the buffer pointed | ||
84 | * to by the ret_buffer variable parameter. | ||
85 | * | ||
86 | * If the function fails an appropriate status will be returned | ||
87 | * and the value of ret_buffer is undefined. | ||
88 | * | ||
89 | * This function attempts to execute the _PRT method contained in | ||
90 | * the object indicated by the passed device_handle. | ||
91 | * | 86 | * |
92 | ******************************************************************************/ | 87 | ******************************************************************************/ |
93 | 88 | ||
94 | acpi_status | 89 | static acpi_status |
95 | acpi_get_irq_routing_table(acpi_handle device_handle, | 90 | acpi_rs_validate_parameters(acpi_handle device_handle, |
96 | struct acpi_buffer *ret_buffer) | 91 | struct acpi_buffer *buffer, |
92 | struct acpi_namespace_node **return_node) | ||
97 | { | 93 | { |
98 | acpi_status status; | 94 | acpi_status status; |
95 | struct acpi_namespace_node *node; | ||
99 | 96 | ||
100 | ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table "); | 97 | ACPI_FUNCTION_TRACE(rs_validate_parameters); |
101 | 98 | ||
102 | /* | 99 | /* |
103 | * Must have a valid handle and buffer, So we have to have a handle | 100 | * Must have a valid handle to an ACPI device |
104 | * and a return buffer structure, and if there is a non-zero buffer length | ||
105 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
106 | * we'll be returning the needed buffer size, so keep going. | ||
107 | */ | 101 | */ |
108 | if (!device_handle) { | 102 | if (!device_handle) { |
109 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 103 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
110 | } | 104 | } |
111 | 105 | ||
112 | status = acpi_ut_validate_buffer(ret_buffer); | 106 | node = acpi_ns_map_handle_to_node(device_handle); |
107 | if (!node) { | ||
108 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
109 | } | ||
110 | |||
111 | if (node->type != ACPI_TYPE_DEVICE) { | ||
112 | return_ACPI_STATUS(AE_TYPE); | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * Validate the user buffer object | ||
117 | * | ||
118 | * if there is a non-zero buffer length we also need a valid pointer in | ||
119 | * the buffer. If it's a zero buffer length, we'll be returning the | ||
120 | * needed buffer size (later), so keep going. | ||
121 | */ | ||
122 | status = acpi_ut_validate_buffer(buffer); | ||
113 | if (ACPI_FAILURE(status)) { | 123 | if (ACPI_FAILURE(status)) { |
114 | return_ACPI_STATUS(status); | 124 | return_ACPI_STATUS(status); |
115 | } | 125 | } |
116 | 126 | ||
117 | status = acpi_rs_get_prt_method_data(device_handle, ret_buffer); | 127 | *return_node = node; |
118 | return_ACPI_STATUS(status); | 128 | return_ACPI_STATUS(AE_OK); |
119 | } | 129 | } |
120 | 130 | ||
121 | /******************************************************************************* | 131 | /******************************************************************************* |
122 | * | 132 | * |
123 | * FUNCTION: acpi_get_current_resources | 133 | * FUNCTION: acpi_get_irq_routing_table |
124 | * | 134 | * |
125 | * PARAMETERS: device_handle - a handle to the device object for the | 135 | * PARAMETERS: device_handle - Handle to the Bus device we are querying |
126 | * device we are querying | 136 | * ret_buffer - Pointer to a buffer to receive the |
127 | * ret_buffer - a pointer to a buffer to receive the | ||
128 | * current resources for the device | 137 | * current resources for the device |
129 | * | 138 | * |
130 | * RETURN: Status | 139 | * RETURN: Status |
131 | * | 140 | * |
132 | * DESCRIPTION: This function is called to get the current resources for a | 141 | * DESCRIPTION: This function is called to get the IRQ routing table for a |
133 | * specific device. The caller must first acquire a handle for | 142 | * specific bus. The caller must first acquire a handle for the |
134 | * the desired device. The resource data is placed in the buffer | 143 | * desired bus. The routine table is placed in the buffer pointed |
135 | * pointed to by the ret_buffer variable parameter. | 144 | * to by the ret_buffer variable parameter. |
136 | * | 145 | * |
137 | * If the function fails an appropriate status will be returned | 146 | * If the function fails an appropriate status will be returned |
138 | * and the value of ret_buffer is undefined. | 147 | * and the value of ret_buffer is undefined. |
139 | * | 148 | * |
140 | * This function attempts to execute the _CRS method contained in | 149 | * This function attempts to execute the _PRT method contained in |
141 | * the object indicated by the passed device_handle. | 150 | * the object indicated by the passed device_handle. |
142 | * | 151 | * |
143 | ******************************************************************************/ | 152 | ******************************************************************************/ |
144 | 153 | ||
145 | acpi_status | 154 | acpi_status |
146 | acpi_get_current_resources(acpi_handle device_handle, | 155 | acpi_get_irq_routing_table(acpi_handle device_handle, |
147 | struct acpi_buffer *ret_buffer) | 156 | struct acpi_buffer *ret_buffer) |
148 | { | 157 | { |
149 | acpi_status status; | 158 | acpi_status status; |
159 | struct acpi_namespace_node *node; | ||
150 | 160 | ||
151 | ACPI_FUNCTION_TRACE("acpi_get_current_resources"); | 161 | ACPI_FUNCTION_TRACE(acpi_get_irq_routing_table); |
152 | 162 | ||
153 | /* | 163 | /* Validate parameters then dispatch to internal routine */ |
154 | * Must have a valid handle and buffer, So we have to have a handle | ||
155 | * and a return buffer structure, and if there is a non-zero buffer length | ||
156 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
157 | * we'll be returning the needed buffer size, so keep going. | ||
158 | */ | ||
159 | if (!device_handle) { | ||
160 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
161 | } | ||
162 | 164 | ||
163 | status = acpi_ut_validate_buffer(ret_buffer); | 165 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
164 | if (ACPI_FAILURE(status)) { | 166 | if (ACPI_FAILURE(status)) { |
165 | return_ACPI_STATUS(status); | 167 | return_ACPI_STATUS(status); |
166 | } | 168 | } |
167 | 169 | ||
168 | status = acpi_rs_get_crs_method_data(device_handle, ret_buffer); | 170 | status = acpi_rs_get_prt_method_data(node, ret_buffer); |
169 | return_ACPI_STATUS(status); | 171 | return_ACPI_STATUS(status); |
170 | } | 172 | } |
171 | 173 | ||
172 | EXPORT_SYMBOL(acpi_get_current_resources); | 174 | ACPI_EXPORT_SYMBOL(acpi_get_irq_routing_table) |
173 | 175 | ||
174 | /******************************************************************************* | 176 | /******************************************************************************* |
175 | * | 177 | * |
176 | * FUNCTION: acpi_get_possible_resources | 178 | * FUNCTION: acpi_get_current_resources |
177 | * | 179 | * |
178 | * PARAMETERS: device_handle - a handle to the device object for the | 180 | * PARAMETERS: device_handle - Handle to the device object for the |
179 | * device we are querying | 181 | * device we are querying |
180 | * ret_buffer - a pointer to a buffer to receive the | 182 | * ret_buffer - Pointer to a buffer to receive the |
181 | * resources for the device | 183 | * current resources for the device |
182 | * | 184 | * |
183 | * RETURN: Status | 185 | * RETURN: Status |
184 | * | 186 | * |
185 | * DESCRIPTION: This function is called to get a list of the possible resources | 187 | * DESCRIPTION: This function is called to get the current resources for a |
186 | * for a specific device. The caller must first acquire a handle | 188 | * specific device. The caller must first acquire a handle for |
187 | * for the desired device. The resource data is placed in the | 189 | * the desired device. The resource data is placed in the buffer |
188 | * buffer pointed to by the ret_buffer variable. | 190 | * pointed to by the ret_buffer variable parameter. |
189 | * | 191 | * |
190 | * If the function fails an appropriate status will be returned | 192 | * If the function fails an appropriate status will be returned |
191 | * and the value of ret_buffer is undefined. | 193 | * and the value of ret_buffer is undefined. |
192 | * | 194 | * |
195 | * This function attempts to execute the _CRS method contained in | ||
196 | * the object indicated by the passed device_handle. | ||
197 | * | ||
193 | ******************************************************************************/ | 198 | ******************************************************************************/ |
194 | |||
195 | #ifdef ACPI_FUTURE_USAGE | ||
196 | acpi_status | 199 | acpi_status |
197 | acpi_get_possible_resources(acpi_handle device_handle, | 200 | acpi_get_current_resources(acpi_handle device_handle, |
198 | struct acpi_buffer *ret_buffer) | 201 | struct acpi_buffer *ret_buffer) |
199 | { | 202 | { |
200 | acpi_status status; | 203 | acpi_status status; |
204 | struct acpi_namespace_node *node; | ||
201 | 205 | ||
202 | ACPI_FUNCTION_TRACE("acpi_get_possible_resources"); | 206 | ACPI_FUNCTION_TRACE(acpi_get_current_resources); |
203 | 207 | ||
204 | /* | 208 | /* Validate parameters then dispatch to internal routine */ |
205 | * Must have a valid handle and buffer, So we have to have a handle | ||
206 | * and a return buffer structure, and if there is a non-zero buffer length | ||
207 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
208 | * we'll be returning the needed buffer size, so keep going. | ||
209 | */ | ||
210 | if (!device_handle) { | ||
211 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
212 | } | ||
213 | 209 | ||
214 | status = acpi_ut_validate_buffer(ret_buffer); | 210 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
215 | if (ACPI_FAILURE(status)) { | 211 | if (ACPI_FAILURE(status)) { |
216 | return_ACPI_STATUS(status); | 212 | return_ACPI_STATUS(status); |
217 | } | 213 | } |
218 | 214 | ||
219 | status = acpi_rs_get_prs_method_data(device_handle, ret_buffer); | 215 | status = acpi_rs_get_crs_method_data(node, ret_buffer); |
220 | return_ACPI_STATUS(status); | 216 | return_ACPI_STATUS(status); |
221 | } | 217 | } |
222 | 218 | ||
223 | EXPORT_SYMBOL(acpi_get_possible_resources); | 219 | ACPI_EXPORT_SYMBOL(acpi_get_current_resources) |
224 | #endif /* ACPI_FUTURE_USAGE */ | ||
225 | 220 | ||
221 | #ifdef ACPI_FUTURE_USAGE | ||
226 | /******************************************************************************* | 222 | /******************************************************************************* |
227 | * | 223 | * |
228 | * FUNCTION: acpi_walk_resources | 224 | * FUNCTION: acpi_get_possible_resources |
229 | * | 225 | * |
230 | * PARAMETERS: device_handle - Handle to the device object for the | 226 | * PARAMETERS: device_handle - Handle to the device object for the |
231 | * device we are querying | 227 | * device we are querying |
232 | * Name - Method name of the resources we want | 228 | * ret_buffer - Pointer to a buffer to receive the |
233 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | 229 | * resources for the device |
234 | * user_function - Called for each resource | ||
235 | * Context - Passed to user_function | ||
236 | * | 230 | * |
237 | * RETURN: Status | 231 | * RETURN: Status |
238 | * | 232 | * |
239 | * DESCRIPTION: Retrieves the current or possible resource list for the | 233 | * DESCRIPTION: This function is called to get a list of the possible resources |
240 | * specified device. The user_function is called once for | 234 | * for a specific device. The caller must first acquire a handle |
241 | * each resource in the list. | 235 | * for the desired device. The resource data is placed in the |
236 | * buffer pointed to by the ret_buffer variable. | ||
237 | * | ||
238 | * If the function fails an appropriate status will be returned | ||
239 | * and the value of ret_buffer is undefined. | ||
242 | * | 240 | * |
243 | ******************************************************************************/ | 241 | ******************************************************************************/ |
244 | |||
245 | acpi_status | 242 | acpi_status |
246 | acpi_walk_resources(acpi_handle device_handle, | 243 | acpi_get_possible_resources(acpi_handle device_handle, |
247 | char *name, | 244 | struct acpi_buffer *ret_buffer) |
248 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) | ||
249 | { | 245 | { |
250 | acpi_status status; | 246 | acpi_status status; |
251 | struct acpi_buffer buffer; | 247 | struct acpi_namespace_node *node; |
252 | struct acpi_resource *resource; | ||
253 | struct acpi_resource *resource_end; | ||
254 | |||
255 | ACPI_FUNCTION_TRACE("acpi_walk_resources"); | ||
256 | |||
257 | /* Parameter validation */ | ||
258 | 248 | ||
259 | if (!device_handle || !user_function || !name || | 249 | ACPI_FUNCTION_TRACE(acpi_get_possible_resources); |
260 | (ACPI_STRNCMP(name, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && | ||
261 | ACPI_STRNCMP(name, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { | ||
262 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
263 | } | ||
264 | 250 | ||
265 | /* Get the _CRS or _PRS resource list */ | 251 | /* Validate parameters then dispatch to internal routine */ |
266 | 252 | ||
267 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 253 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
268 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
269 | if (ACPI_FAILURE(status)) { | 254 | if (ACPI_FAILURE(status)) { |
270 | return_ACPI_STATUS(status); | 255 | return_ACPI_STATUS(status); |
271 | } | 256 | } |
272 | 257 | ||
273 | /* Buffer now contains the resource list */ | 258 | status = acpi_rs_get_prs_method_data(node, ret_buffer); |
274 | |||
275 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); | ||
276 | resource_end = | ||
277 | ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); | ||
278 | |||
279 | /* Walk the resource list until the end_tag is found (or buffer end) */ | ||
280 | |||
281 | while (resource < resource_end) { | ||
282 | /* Sanity check the resource */ | ||
283 | |||
284 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | ||
285 | status = AE_AML_INVALID_RESOURCE_TYPE; | ||
286 | break; | ||
287 | } | ||
288 | |||
289 | /* Invoke the user function, abort on any error returned */ | ||
290 | |||
291 | status = user_function(resource, context); | ||
292 | if (ACPI_FAILURE(status)) { | ||
293 | if (status == AE_CTRL_TERMINATE) { | ||
294 | /* This is an OK termination by the user function */ | ||
295 | |||
296 | status = AE_OK; | ||
297 | } | ||
298 | break; | ||
299 | } | ||
300 | |||
301 | /* end_tag indicates end-of-list */ | ||
302 | |||
303 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | ||
304 | break; | ||
305 | } | ||
306 | |||
307 | /* Get the next resource descriptor */ | ||
308 | |||
309 | resource = | ||
310 | ACPI_ADD_PTR(struct acpi_resource, resource, | ||
311 | resource->length); | ||
312 | } | ||
313 | |||
314 | ACPI_MEM_FREE(buffer.pointer); | ||
315 | return_ACPI_STATUS(status); | 259 | return_ACPI_STATUS(status); |
316 | } | 260 | } |
317 | 261 | ||
318 | EXPORT_SYMBOL(acpi_walk_resources); | 262 | ACPI_EXPORT_SYMBOL(acpi_get_possible_resources) |
263 | #endif /* ACPI_FUTURE_USAGE */ | ||
319 | 264 | ||
320 | /******************************************************************************* | 265 | /******************************************************************************* |
321 | * | 266 | * |
322 | * FUNCTION: acpi_set_current_resources | 267 | * FUNCTION: acpi_set_current_resources |
323 | * | 268 | * |
324 | * PARAMETERS: device_handle - a handle to the device object for the | 269 | * PARAMETERS: device_handle - Handle to the device object for the |
325 | * device we are changing the resources of | 270 | * device we are setting resources |
326 | * in_buffer - a pointer to a buffer containing the | 271 | * in_buffer - Pointer to a buffer containing the |
327 | * resources to be set for the device | 272 | * resources to be set for the device |
328 | * | 273 | * |
329 | * RETURN: Status | 274 | * RETURN: Status |
330 | * | 275 | * |
331 | * DESCRIPTION: This function is called to set the current resources for a | 276 | * DESCRIPTION: This function is called to set the current resources for a |
332 | * specific device. The caller must first acquire a handle for | 277 | * specific device. The caller must first acquire a handle for |
333 | * the desired device. The resource data is passed to the routine | 278 | * the desired device. The resource data is passed to the routine |
334 | * the buffer pointed to by the in_buffer variable. | 279 | * the buffer pointed to by the in_buffer variable. |
335 | * | 280 | * |
336 | ******************************************************************************/ | 281 | ******************************************************************************/ |
337 | |||
338 | acpi_status | 282 | acpi_status |
339 | acpi_set_current_resources(acpi_handle device_handle, | 283 | acpi_set_current_resources(acpi_handle device_handle, |
340 | struct acpi_buffer *in_buffer) | 284 | struct acpi_buffer *in_buffer) |
341 | { | 285 | { |
342 | acpi_status status; | 286 | acpi_status status; |
287 | struct acpi_namespace_node *node; | ||
343 | 288 | ||
344 | ACPI_FUNCTION_TRACE("acpi_set_current_resources"); | 289 | ACPI_FUNCTION_TRACE(acpi_set_current_resources); |
345 | 290 | ||
346 | /* Must have a valid handle and buffer */ | 291 | /* Validate the buffer, don't allow zero length */ |
347 | 292 | ||
348 | if ((!device_handle) || | 293 | if ((!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { |
349 | (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { | ||
350 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 294 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
351 | } | 295 | } |
352 | 296 | ||
353 | status = acpi_rs_set_srs_method_data(device_handle, in_buffer); | 297 | /* Validate parameters then dispatch to internal routine */ |
298 | |||
299 | status = acpi_rs_validate_parameters(device_handle, in_buffer, &node); | ||
300 | if (ACPI_FAILURE(status)) { | ||
301 | return_ACPI_STATUS(status); | ||
302 | } | ||
303 | |||
304 | status = acpi_rs_set_srs_method_data(node, in_buffer); | ||
354 | return_ACPI_STATUS(status); | 305 | return_ACPI_STATUS(status); |
355 | } | 306 | } |
356 | 307 | ||
357 | EXPORT_SYMBOL(acpi_set_current_resources); | 308 | ACPI_EXPORT_SYMBOL(acpi_set_current_resources) |
358 | 309 | ||
359 | /****************************************************************************** | 310 | /****************************************************************************** |
360 | * | 311 | * |
361 | * FUNCTION: acpi_resource_to_address64 | 312 | * FUNCTION: acpi_resource_to_address64 |
362 | * | 313 | * |
363 | * PARAMETERS: Resource - Pointer to a resource | 314 | * PARAMETERS: Resource - Pointer to a resource |
364 | * Out - Pointer to the users's return | 315 | * Out - Pointer to the users's return buffer |
365 | * buffer (a struct | 316 | * (a struct acpi_resource_address64) |
366 | * struct acpi_resource_address64) | ||
367 | * | 317 | * |
368 | * RETURN: Status | 318 | * RETURN: Status |
369 | * | 319 | * |
370 | * DESCRIPTION: If the resource is an address16, address32, or address64, | 320 | * DESCRIPTION: If the resource is an address16, address32, or address64, |
371 | * copy it to the address64 return buffer. This saves the | 321 | * copy it to the address64 return buffer. This saves the |
372 | * caller from having to duplicate code for different-sized | 322 | * caller from having to duplicate code for different-sized |
373 | * addresses. | 323 | * addresses. |
374 | * | 324 | * |
375 | ******************************************************************************/ | 325 | ******************************************************************************/ |
376 | |||
377 | acpi_status | 326 | acpi_status |
378 | acpi_resource_to_address64(struct acpi_resource *resource, | 327 | acpi_resource_to_address64(struct acpi_resource *resource, |
379 | struct acpi_resource_address64 *out) | 328 | struct acpi_resource_address64 *out) |
@@ -415,18 +364,18 @@ acpi_resource_to_address64(struct acpi_resource *resource, | |||
415 | return (AE_OK); | 364 | return (AE_OK); |
416 | } | 365 | } |
417 | 366 | ||
418 | EXPORT_SYMBOL(acpi_resource_to_address64); | 367 | ACPI_EXPORT_SYMBOL(acpi_resource_to_address64) |
419 | 368 | ||
420 | /******************************************************************************* | 369 | /******************************************************************************* |
421 | * | 370 | * |
422 | * FUNCTION: acpi_get_vendor_resource | 371 | * FUNCTION: acpi_get_vendor_resource |
423 | * | 372 | * |
424 | * PARAMETERS: device_handle - Handle for the parent device object | 373 | * PARAMETERS: device_handle - Handle for the parent device object |
425 | * Name - Method name for the parent resource | 374 | * Name - Method name for the parent resource |
426 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | 375 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) |
427 | * Uuid - Pointer to the UUID to be matched. | 376 | * Uuid - Pointer to the UUID to be matched. |
428 | * includes both subtype and 16-byte UUID | 377 | * includes both subtype and 16-byte UUID |
429 | * ret_buffer - Where the vendor resource is returned | 378 | * ret_buffer - Where the vendor resource is returned |
430 | * | 379 | * |
431 | * RETURN: Status | 380 | * RETURN: Status |
432 | * | 381 | * |
@@ -435,7 +384,6 @@ EXPORT_SYMBOL(acpi_resource_to_address64); | |||
435 | * UUID subtype. Returns a struct acpi_resource of type Vendor. | 384 | * UUID subtype. Returns a struct acpi_resource of type Vendor. |
436 | * | 385 | * |
437 | ******************************************************************************/ | 386 | ******************************************************************************/ |
438 | |||
439 | acpi_status | 387 | acpi_status |
440 | acpi_get_vendor_resource(acpi_handle device_handle, | 388 | acpi_get_vendor_resource(acpi_handle device_handle, |
441 | char *name, | 389 | char *name, |
@@ -467,18 +415,19 @@ acpi_get_vendor_resource(acpi_handle device_handle, | |||
467 | return (info.status); | 415 | return (info.status); |
468 | } | 416 | } |
469 | 417 | ||
418 | ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource) | ||
419 | |||
470 | /******************************************************************************* | 420 | /******************************************************************************* |
471 | * | 421 | * |
472 | * FUNCTION: acpi_rs_match_vendor_resource | 422 | * FUNCTION: acpi_rs_match_vendor_resource |
473 | * | 423 | * |
474 | * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK | 424 | * PARAMETERS: acpi_walk_resource_callback |
475 | * | 425 | * |
476 | * RETURN: Status | 426 | * RETURN: Status |
477 | * | 427 | * |
478 | * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID | 428 | * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID |
479 | * | 429 | * |
480 | ******************************************************************************/ | 430 | ******************************************************************************/ |
481 | |||
482 | static acpi_status | 431 | static acpi_status |
483 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | 432 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) |
484 | { | 433 | { |
@@ -526,3 +475,101 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | |||
526 | info->status = AE_OK; | 475 | info->status = AE_OK; |
527 | return (AE_CTRL_TERMINATE); | 476 | return (AE_CTRL_TERMINATE); |
528 | } | 477 | } |
478 | |||
479 | ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource) | ||
480 | |||
481 | /******************************************************************************* | ||
482 | * | ||
483 | * FUNCTION: acpi_walk_resources | ||
484 | * | ||
485 | * PARAMETERS: device_handle - Handle to the device object for the | ||
486 | * device we are querying | ||
487 | * Name - Method name of the resources we want | ||
488 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | ||
489 | * user_function - Called for each resource | ||
490 | * Context - Passed to user_function | ||
491 | * | ||
492 | * RETURN: Status | ||
493 | * | ||
494 | * DESCRIPTION: Retrieves the current or possible resource list for the | ||
495 | * specified device. The user_function is called once for | ||
496 | * each resource in the list. | ||
497 | * | ||
498 | ******************************************************************************/ | ||
499 | |||
500 | acpi_status | ||
501 | acpi_walk_resources(acpi_handle device_handle, | ||
502 | char *name, | ||
503 | acpi_walk_resource_callback user_function, void *context) | ||
504 | { | ||
505 | acpi_status status; | ||
506 | struct acpi_buffer buffer; | ||
507 | struct acpi_resource *resource; | ||
508 | struct acpi_resource *resource_end; | ||
509 | |||
510 | ACPI_FUNCTION_TRACE(acpi_walk_resources); | ||
511 | |||
512 | /* Parameter validation */ | ||
513 | |||
514 | if (!device_handle || !user_function || !name || | ||
515 | (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) && | ||
516 | !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS))) { | ||
517 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
518 | } | ||
519 | |||
520 | /* Get the _CRS or _PRS resource list */ | ||
521 | |||
522 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
523 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
524 | if (ACPI_FAILURE(status)) { | ||
525 | return_ACPI_STATUS(status); | ||
526 | } | ||
527 | |||
528 | /* Buffer now contains the resource list */ | ||
529 | |||
530 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); | ||
531 | resource_end = | ||
532 | ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); | ||
533 | |||
534 | /* Walk the resource list until the end_tag is found (or buffer end) */ | ||
535 | |||
536 | while (resource < resource_end) { | ||
537 | |||
538 | /* Sanity check the resource */ | ||
539 | |||
540 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | ||
541 | status = AE_AML_INVALID_RESOURCE_TYPE; | ||
542 | break; | ||
543 | } | ||
544 | |||
545 | /* Invoke the user function, abort on any error returned */ | ||
546 | |||
547 | status = user_function(resource, context); | ||
548 | if (ACPI_FAILURE(status)) { | ||
549 | if (status == AE_CTRL_TERMINATE) { | ||
550 | |||
551 | /* This is an OK termination by the user function */ | ||
552 | |||
553 | status = AE_OK; | ||
554 | } | ||
555 | break; | ||
556 | } | ||
557 | |||
558 | /* end_tag indicates end-of-list */ | ||
559 | |||
560 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | ||
561 | break; | ||
562 | } | ||
563 | |||
564 | /* Get the next resource descriptor */ | ||
565 | |||
566 | resource = | ||
567 | ACPI_ADD_PTR(struct acpi_resource, resource, | ||
568 | resource->length); | ||
569 | } | ||
570 | |||
571 | ACPI_FREE(buffer.pointer); | ||
572 | return_ACPI_STATUS(status); | ||
573 | } | ||
574 | |||
575 | ACPI_EXPORT_SYMBOL(acpi_walk_resources) | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index a0ab828b2cc5..fc676ac0e3ed 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -142,7 +142,7 @@ static void acpi_device_register(struct acpi_device *device, | |||
142 | create_sysfs_device_files(device); | 142 | create_sysfs_device_files(device); |
143 | } | 143 | } |
144 | 144 | ||
145 | static int acpi_device_unregister(struct acpi_device *device, int type) | 145 | static void acpi_device_unregister(struct acpi_device *device, int type) |
146 | { | 146 | { |
147 | spin_lock(&acpi_device_lock); | 147 | spin_lock(&acpi_device_lock); |
148 | if (device->parent) { | 148 | if (device->parent) { |
@@ -158,7 +158,6 @@ static int acpi_device_unregister(struct acpi_device *device, int type) | |||
158 | acpi_detach_data(device->handle, acpi_bus_data_handler); | 158 | acpi_detach_data(device->handle, acpi_bus_data_handler); |
159 | remove_sysfs_device_files(device); | 159 | remove_sysfs_device_files(device); |
160 | kobject_unregister(&device->kobj); | 160 | kobject_unregister(&device->kobj); |
161 | return 0; | ||
162 | } | 161 | } |
163 | 162 | ||
164 | void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) | 163 | void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) |
@@ -234,12 +233,9 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
234 | 233 | ||
235 | int acpi_match_ids(struct acpi_device *device, char *ids) | 234 | int acpi_match_ids(struct acpi_device *device, char *ids) |
236 | { | 235 | { |
237 | int error = 0; | ||
238 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
239 | |||
240 | if (device->flags.hardware_id) | 236 | if (device->flags.hardware_id) |
241 | if (strstr(ids, device->pnp.hardware_id)) | 237 | if (strstr(ids, device->pnp.hardware_id)) |
242 | goto Done; | 238 | return 0; |
243 | 239 | ||
244 | if (device->flags.compatible_ids) { | 240 | if (device->flags.compatible_ids) { |
245 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; | 241 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; |
@@ -248,15 +244,10 @@ int acpi_match_ids(struct acpi_device *device, char *ids) | |||
248 | /* compare multiple _CID entries against driver ids */ | 244 | /* compare multiple _CID entries against driver ids */ |
249 | for (i = 0; i < cid_list->count; i++) { | 245 | for (i = 0; i < cid_list->count; i++) { |
250 | if (strstr(ids, cid_list->id[i].value)) | 246 | if (strstr(ids, cid_list->id[i].value)) |
251 | goto Done; | 247 | return 0; |
252 | } | 248 | } |
253 | } | 249 | } |
254 | error = -ENOENT; | 250 | return -ENOENT; |
255 | |||
256 | Done: | ||
257 | if (buffer.pointer) | ||
258 | acpi_os_free(buffer.pointer); | ||
259 | return error; | ||
260 | } | 251 | } |
261 | 252 | ||
262 | static acpi_status | 253 | static acpi_status |
@@ -441,10 +432,7 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) | |||
441 | islockable = device->flags.lockable; | 432 | islockable = device->flags.lockable; |
442 | handle = device->handle; | 433 | handle = device->handle; |
443 | 434 | ||
444 | if (type == ACPI_TYPE_PROCESSOR) | 435 | result = acpi_bus_trim(device, 1); |
445 | result = acpi_bus_trim(device, 0); | ||
446 | else | ||
447 | result = acpi_bus_trim(device, 1); | ||
448 | 436 | ||
449 | if (!result) | 437 | if (!result) |
450 | result = acpi_eject_operation(handle, islockable); | 438 | result = acpi_eject_operation(handle, islockable); |
@@ -548,10 +536,9 @@ static int acpi_start_single_object(struct acpi_device *device) | |||
548 | return_VALUE(result); | 536 | return_VALUE(result); |
549 | } | 537 | } |
550 | 538 | ||
551 | static int acpi_driver_attach(struct acpi_driver *drv) | 539 | static void acpi_driver_attach(struct acpi_driver *drv) |
552 | { | 540 | { |
553 | struct list_head *node, *next; | 541 | struct list_head *node, *next; |
554 | int count = 0; | ||
555 | 542 | ||
556 | ACPI_FUNCTION_TRACE("acpi_driver_attach"); | 543 | ACPI_FUNCTION_TRACE("acpi_driver_attach"); |
557 | 544 | ||
@@ -568,7 +555,6 @@ static int acpi_driver_attach(struct acpi_driver *drv) | |||
568 | if (!acpi_bus_driver_init(dev, drv)) { | 555 | if (!acpi_bus_driver_init(dev, drv)) { |
569 | acpi_start_single_object(dev); | 556 | acpi_start_single_object(dev); |
570 | atomic_inc(&drv->references); | 557 | atomic_inc(&drv->references); |
571 | count++; | ||
572 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 558 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
573 | "Found driver [%s] for device [%s]\n", | 559 | "Found driver [%s] for device [%s]\n", |
574 | drv->name, dev->pnp.bus_id)); | 560 | drv->name, dev->pnp.bus_id)); |
@@ -577,10 +563,9 @@ static int acpi_driver_attach(struct acpi_driver *drv) | |||
577 | spin_lock(&acpi_device_lock); | 563 | spin_lock(&acpi_device_lock); |
578 | } | 564 | } |
579 | spin_unlock(&acpi_device_lock); | 565 | spin_unlock(&acpi_device_lock); |
580 | return_VALUE(count); | ||
581 | } | 566 | } |
582 | 567 | ||
583 | static int acpi_driver_detach(struct acpi_driver *drv) | 568 | static void acpi_driver_detach(struct acpi_driver *drv) |
584 | { | 569 | { |
585 | struct list_head *node, *next; | 570 | struct list_head *node, *next; |
586 | 571 | ||
@@ -602,7 +587,6 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
602 | } | 587 | } |
603 | } | 588 | } |
604 | spin_unlock(&acpi_device_lock); | 589 | spin_unlock(&acpi_device_lock); |
605 | return_VALUE(0); | ||
606 | } | 590 | } |
607 | 591 | ||
608 | /** | 592 | /** |
@@ -610,28 +594,22 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
610 | * @driver: driver being registered | 594 | * @driver: driver being registered |
611 | * | 595 | * |
612 | * Registers a driver with the ACPI bus. Searches the namespace for all | 596 | * Registers a driver with the ACPI bus. Searches the namespace for all |
613 | * devices that match the driver's criteria and binds. Returns the | 597 | * devices that match the driver's criteria and binds. Returns zero for |
614 | * number of devices that were claimed by the driver, or a negative | 598 | * success or a negative error status for failure. |
615 | * error status for failure. | ||
616 | */ | 599 | */ |
617 | int acpi_bus_register_driver(struct acpi_driver *driver) | 600 | int acpi_bus_register_driver(struct acpi_driver *driver) |
618 | { | 601 | { |
619 | int count; | ||
620 | |||
621 | ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); | 602 | ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); |
622 | 603 | ||
623 | if (acpi_disabled) | 604 | if (acpi_disabled) |
624 | return_VALUE(-ENODEV); | 605 | return_VALUE(-ENODEV); |
625 | 606 | ||
626 | if (!driver) | ||
627 | return_VALUE(-EINVAL); | ||
628 | |||
629 | spin_lock(&acpi_device_lock); | 607 | spin_lock(&acpi_device_lock); |
630 | list_add_tail(&driver->node, &acpi_bus_drivers); | 608 | list_add_tail(&driver->node, &acpi_bus_drivers); |
631 | spin_unlock(&acpi_device_lock); | 609 | spin_unlock(&acpi_device_lock); |
632 | count = acpi_driver_attach(driver); | 610 | acpi_driver_attach(driver); |
633 | 611 | ||
634 | return_VALUE(count); | 612 | return_VALUE(0); |
635 | } | 613 | } |
636 | 614 | ||
637 | EXPORT_SYMBOL(acpi_bus_register_driver); | 615 | EXPORT_SYMBOL(acpi_bus_register_driver); |
@@ -643,23 +621,16 @@ EXPORT_SYMBOL(acpi_bus_register_driver); | |||
643 | * Unregisters a driver with the ACPI bus. Searches the namespace for all | 621 | * Unregisters a driver with the ACPI bus. Searches the namespace for all |
644 | * devices that match the driver's criteria and unbinds. | 622 | * devices that match the driver's criteria and unbinds. |
645 | */ | 623 | */ |
646 | int acpi_bus_unregister_driver(struct acpi_driver *driver) | 624 | void acpi_bus_unregister_driver(struct acpi_driver *driver) |
647 | { | 625 | { |
648 | int error = 0; | 626 | acpi_driver_detach(driver); |
649 | |||
650 | ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver"); | ||
651 | |||
652 | if (driver) { | ||
653 | acpi_driver_detach(driver); | ||
654 | 627 | ||
655 | if (!atomic_read(&driver->references)) { | 628 | if (!atomic_read(&driver->references)) { |
656 | spin_lock(&acpi_device_lock); | 629 | spin_lock(&acpi_device_lock); |
657 | list_del_init(&driver->node); | 630 | list_del_init(&driver->node); |
658 | spin_unlock(&acpi_device_lock); | 631 | spin_unlock(&acpi_device_lock); |
659 | } | 632 | } |
660 | } else | 633 | return; |
661 | error = -EINVAL; | ||
662 | return_VALUE(error); | ||
663 | } | 634 | } |
664 | 635 | ||
665 | EXPORT_SYMBOL(acpi_bus_unregister_driver); | 636 | EXPORT_SYMBOL(acpi_bus_unregister_driver); |
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index 85df0ceda2a9..af1dbabaf0b1 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
@@ -155,7 +155,6 @@ static int __init acpi_wakeup_device_init(void) | |||
155 | 155 | ||
156 | if (acpi_disabled) | 156 | if (acpi_disabled) |
157 | return 0; | 157 | return 0; |
158 | printk("ACPI wakeup devices: \n"); | ||
159 | 158 | ||
160 | spin_lock(&acpi_device_lock); | 159 | spin_lock(&acpi_device_lock); |
161 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 160 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
@@ -174,10 +173,8 @@ static int __init acpi_wakeup_device_init(void) | |||
174 | dev->wakeup.state.enabled = 1; | 173 | dev->wakeup.state.enabled = 1; |
175 | spin_lock(&acpi_device_lock); | 174 | spin_lock(&acpi_device_lock); |
176 | } | 175 | } |
177 | printk("%4s ", dev->pnp.bus_id); | ||
178 | } | 176 | } |
179 | spin_unlock(&acpi_device_lock); | 177 | spin_unlock(&acpi_device_lock); |
180 | printk("\n"); | ||
181 | 178 | ||
182 | return 0; | 179 | return 0; |
183 | } | 180 | } |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index e4308c7a6743..a934ac42178d 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -39,7 +39,7 @@ ACPI_MODULE_NAME("acpi_system") | |||
39 | #define ACPI_SYSTEM_FILE_EVENT "event" | 39 | #define ACPI_SYSTEM_FILE_EVENT "event" |
40 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" | 40 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" |
41 | #define ACPI_SYSTEM_FILE_FADT "fadt" | 41 | #define ACPI_SYSTEM_FILE_FADT "fadt" |
42 | extern FADT_DESCRIPTOR acpi_fadt; | 42 | extern struct fadt_descriptor acpi_fadt; |
43 | 43 | ||
44 | /* -------------------------------------------------------------------------- | 44 | /* -------------------------------------------------------------------------- |
45 | FS Interface (/proc) | 45 | FS Interface (/proc) |
@@ -82,7 +82,7 @@ acpi_system_read_dsdt(struct file *file, | |||
82 | 82 | ||
83 | ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); | 83 | ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); |
84 | 84 | ||
85 | status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); | 85 | status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); |
86 | if (ACPI_FAILURE(status)) | 86 | if (ACPI_FAILURE(status)) |
87 | return_VALUE(-ENODEV); | 87 | return_VALUE(-ENODEV); |
88 | 88 | ||
@@ -110,7 +110,7 @@ acpi_system_read_fadt(struct file *file, | |||
110 | 110 | ||
111 | ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); | 111 | ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); |
112 | 112 | ||
113 | status = acpi_get_table(ACPI_TABLE_FADT, 1, &fadt); | 113 | status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt); |
114 | if (ACPI_FAILURE(status)) | 114 | if (ACPI_FAILURE(status)) |
115 | return_VALUE(-ENODEV); | 115 | return_VALUE(-ENODEV); |
116 | 116 | ||
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 7f37c7cc5ef1..ed5e8816d83d 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -282,8 +282,8 @@ acpi_get_table_header_early(enum acpi_table_id id, | |||
282 | 282 | ||
283 | /* Map the DSDT header via the pointer in the FADT */ | 283 | /* Map the DSDT header via the pointer in the FADT */ |
284 | if (id == ACPI_DSDT) { | 284 | if (id == ACPI_DSDT) { |
285 | struct fadt_descriptor_rev2 *fadt = | 285 | struct fadt_descriptor *fadt = |
286 | (struct fadt_descriptor_rev2 *)*header; | 286 | (struct fadt_descriptor *)*header; |
287 | 287 | ||
288 | if (fadt->revision == 3 && fadt->Xdsdt) { | 288 | if (fadt->revision == 3 && fadt->Xdsdt) { |
289 | *header = (void *)__acpi_map_table(fadt->Xdsdt, | 289 | *header = (void *)__acpi_map_table(fadt->Xdsdt, |
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 03b37d2223bc..d697fcb35d52 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/actables.h> | 45 | #include <acpi/actables.h> |
48 | 46 | ||
@@ -56,15 +54,15 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, | |||
56 | acpi_physical_address address); | 54 | acpi_physical_address address); |
57 | 55 | ||
58 | static void | 56 | static void |
59 | acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | 57 | acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, |
60 | struct fadt_descriptor_rev1 *original_fadt); | 58 | struct fadt_descriptor_rev1 *original_fadt); |
61 | 59 | ||
62 | static void | 60 | static void |
63 | acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | 61 | acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, |
64 | struct fadt_descriptor_rev2 *original_fadt); | 62 | struct fadt_descriptor *original_fadt); |
65 | 63 | ||
66 | u8 acpi_fadt_is_v1; | 64 | u8 acpi_fadt_is_v1; |
67 | EXPORT_SYMBOL(acpi_fadt_is_v1); | 65 | ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1) |
68 | 66 | ||
69 | /******************************************************************************* | 67 | /******************************************************************************* |
70 | * | 68 | * |
@@ -122,7 +120,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
122 | { | 120 | { |
123 | acpi_size table_size; | 121 | acpi_size table_size; |
124 | u32 i; | 122 | u32 i; |
125 | XSDT_DESCRIPTOR *new_table; | 123 | struct xsdt_descriptor *new_table; |
126 | 124 | ||
127 | ACPI_FUNCTION_ENTRY(); | 125 | ACPI_FUNCTION_ENTRY(); |
128 | 126 | ||
@@ -133,7 +131,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
133 | 131 | ||
134 | /* Allocate an XSDT */ | 132 | /* Allocate an XSDT */ |
135 | 133 | ||
136 | new_table = ACPI_MEM_CALLOCATE(table_size); | 134 | new_table = ACPI_ALLOCATE_ZEROED(table_size); |
137 | if (!new_table) { | 135 | if (!new_table) { |
138 | return (AE_NO_MEMORY); | 136 | return (AE_NO_MEMORY); |
139 | } | 137 | } |
@@ -147,17 +145,18 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
147 | /* Copy the table pointers */ | 145 | /* Copy the table pointers */ |
148 | 146 | ||
149 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 147 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
148 | |||
150 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ | 149 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ |
151 | 150 | ||
152 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 151 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
153 | ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], | 152 | ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], |
154 | (ACPI_CAST_PTR | 153 | (ACPI_CAST_PTR |
155 | (struct rsdt_descriptor_rev1, | 154 | (struct rsdt_descriptor, |
156 | table_info->pointer))-> | 155 | table_info->pointer))-> |
157 | table_offset_entry[i]); | 156 | table_offset_entry[i]); |
158 | } else { | 157 | } else { |
159 | new_table->table_offset_entry[i] = | 158 | new_table->table_offset_entry[i] = |
160 | (ACPI_CAST_PTR(XSDT_DESCRIPTOR, | 159 | (ACPI_CAST_PTR(struct xsdt_descriptor, |
161 | table_info->pointer))-> | 160 | table_info->pointer))-> |
162 | table_offset_entry[i]; | 161 | table_offset_entry[i]; |
163 | } | 162 | } |
@@ -219,7 +218,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, | |||
219 | ******************************************************************************/ | 218 | ******************************************************************************/ |
220 | 219 | ||
221 | static void | 220 | static void |
222 | acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | 221 | acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, |
223 | struct fadt_descriptor_rev1 *original_fadt) | 222 | struct fadt_descriptor_rev1 *original_fadt) |
224 | { | 223 | { |
225 | 224 | ||
@@ -365,14 +364,13 @@ acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | |||
365 | ******************************************************************************/ | 364 | ******************************************************************************/ |
366 | 365 | ||
367 | static void | 366 | static void |
368 | acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | 367 | acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, |
369 | struct fadt_descriptor_rev2 *original_fadt) | 368 | struct fadt_descriptor *original_fadt) |
370 | { | 369 | { |
371 | 370 | ||
372 | /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ | 371 | /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ |
373 | 372 | ||
374 | ACPI_MEMCPY(local_fadt, original_fadt, | 373 | ACPI_MEMCPY(local_fadt, original_fadt, sizeof(struct fadt_descriptor)); |
375 | sizeof(struct fadt_descriptor_rev2)); | ||
376 | 374 | ||
377 | /* | 375 | /* |
378 | * "X" fields are optional extensions to the original V1.0 fields, so | 376 | * "X" fields are optional extensions to the original V1.0 fields, so |
@@ -491,10 +489,10 @@ acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | |||
491 | 489 | ||
492 | acpi_status acpi_tb_convert_table_fadt(void) | 490 | acpi_status acpi_tb_convert_table_fadt(void) |
493 | { | 491 | { |
494 | struct fadt_descriptor_rev2 *local_fadt; | 492 | struct fadt_descriptor *local_fadt; |
495 | struct acpi_table_desc *table_desc; | 493 | struct acpi_table_desc *table_desc; |
496 | 494 | ||
497 | ACPI_FUNCTION_TRACE("tb_convert_table_fadt"); | 495 | ACPI_FUNCTION_TRACE(tb_convert_table_fadt); |
498 | 496 | ||
499 | /* | 497 | /* |
500 | * acpi_gbl_FADT is valid. Validate the FADT length. The table must be | 498 | * acpi_gbl_FADT is valid. Validate the FADT length. The table must be |
@@ -508,13 +506,14 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
508 | 506 | ||
509 | /* Allocate buffer for the ACPI 2.0(+) FADT */ | 507 | /* Allocate buffer for the ACPI 2.0(+) FADT */ |
510 | 508 | ||
511 | local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2)); | 509 | local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor)); |
512 | if (!local_fadt) { | 510 | if (!local_fadt) { |
513 | return_ACPI_STATUS(AE_NO_MEMORY); | 511 | return_ACPI_STATUS(AE_NO_MEMORY); |
514 | } | 512 | } |
515 | 513 | ||
516 | if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { | 514 | if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { |
517 | if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { | 515 | if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor)) { |
516 | |||
518 | /* Length is too short to be a V2.0 table */ | 517 | /* Length is too short to be a V2.0 table */ |
519 | 518 | ||
520 | ACPI_WARNING((AE_INFO, | 519 | ACPI_WARNING((AE_INFO, |
@@ -538,11 +537,11 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
538 | /* Global FADT pointer will point to the new common V2.0 FADT */ | 537 | /* Global FADT pointer will point to the new common V2.0 FADT */ |
539 | 538 | ||
540 | acpi_gbl_FADT = local_fadt; | 539 | acpi_gbl_FADT = local_fadt; |
541 | acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR); | 540 | acpi_gbl_FADT->length = sizeof(struct fadt_descriptor); |
542 | 541 | ||
543 | /* Free the original table */ | 542 | /* Free the original table */ |
544 | 543 | ||
545 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next; | 544 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_FADT].next; |
546 | acpi_tb_delete_single_table(table_desc); | 545 | acpi_tb_delete_single_table(table_desc); |
547 | 546 | ||
548 | /* Install the new table */ | 547 | /* Install the new table */ |
@@ -550,7 +549,7 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
550 | table_desc->pointer = | 549 | table_desc->pointer = |
551 | ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); | 550 | ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); |
552 | table_desc->allocation = ACPI_MEM_ALLOCATED; | 551 | table_desc->allocation = ACPI_MEM_ALLOCATED; |
553 | table_desc->length = sizeof(struct fadt_descriptor_rev2); | 552 | table_desc->length = sizeof(struct fadt_descriptor); |
554 | 553 | ||
555 | /* Dump the entire FADT */ | 554 | /* Dump the entire FADT */ |
556 | 555 | ||
@@ -580,7 +579,7 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
580 | acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) | 579 | acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) |
581 | { | 580 | { |
582 | 581 | ||
583 | ACPI_FUNCTION_TRACE("tb_build_common_facs"); | 582 | ACPI_FUNCTION_TRACE(tb_build_common_facs); |
584 | 583 | ||
585 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ | 584 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ |
586 | 585 | ||
@@ -603,6 +602,7 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) | |||
603 | if ((acpi_gbl_RSDP->revision < 2) || | 602 | if ((acpi_gbl_RSDP->revision < 2) || |
604 | (acpi_gbl_FACS->length < 32) || | 603 | (acpi_gbl_FACS->length < 32) || |
605 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { | 604 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { |
605 | |||
606 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ | 606 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ |
607 | 607 | ||
608 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, | 608 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, |
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 09b4ee6dfd60..99eacceff563 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c | |||
@@ -78,7 +78,7 @@ acpi_tb_get_table(struct acpi_pointer *address, | |||
78 | acpi_status status; | 78 | acpi_status status; |
79 | struct acpi_table_header header; | 79 | struct acpi_table_header header; |
80 | 80 | ||
81 | ACPI_FUNCTION_TRACE("tb_get_table"); | 81 | ACPI_FUNCTION_TRACE(tb_get_table); |
82 | 82 | ||
83 | /* Get the header in order to get signature and table size */ | 83 | /* Get the header in order to get signature and table size */ |
84 | 84 | ||
@@ -124,7 +124,7 @@ acpi_tb_get_table_header(struct acpi_pointer *address, | |||
124 | acpi_status status = AE_OK; | 124 | acpi_status status = AE_OK; |
125 | struct acpi_table_header *header = NULL; | 125 | struct acpi_table_header *header = NULL; |
126 | 126 | ||
127 | ACPI_FUNCTION_TRACE("tb_get_table_header"); | 127 | ACPI_FUNCTION_TRACE(tb_get_table_header); |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Flags contains the current processor mode (Virtual or Physical | 130 | * Flags contains the current processor mode (Virtual or Physical |
@@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_pointer *address, | |||
148 | sizeof(struct acpi_table_header), | 148 | sizeof(struct acpi_table_header), |
149 | (void *)&header); | 149 | (void *)&header); |
150 | if (ACPI_FAILURE(status)) { | 150 | if (ACPI_FAILURE(status)) { |
151 | ACPI_ERROR((AE_INFO, | ||
152 | "Could not map memory at %8.8X%8.8X for table header", | ||
153 | ACPI_FORMAT_UINT64(address->pointer. | ||
154 | physical))); | ||
151 | return_ACPI_STATUS(status); | 155 | return_ACPI_STATUS(status); |
152 | } | 156 | } |
153 | 157 | ||
@@ -198,7 +202,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, | |||
198 | { | 202 | { |
199 | acpi_status status; | 203 | acpi_status status; |
200 | 204 | ||
201 | ACPI_FUNCTION_TRACE("tb_get_table_body"); | 205 | ACPI_FUNCTION_TRACE(tb_get_table_body); |
202 | 206 | ||
203 | if (!table_info || !address) { | 207 | if (!table_info || !address) { |
204 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 208 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, | |||
208 | 212 | ||
209 | status = acpi_tb_table_override(header, table_info); | 213 | status = acpi_tb_table_override(header, table_info); |
210 | if (ACPI_SUCCESS(status)) { | 214 | if (ACPI_SUCCESS(status)) { |
215 | |||
211 | /* Table was overridden by the host OS */ | 216 | /* Table was overridden by the host OS */ |
212 | 217 | ||
213 | return_ACPI_STATUS(status); | 218 | return_ACPI_STATUS(status); |
@@ -241,7 +246,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
241 | acpi_status status; | 246 | acpi_status status; |
242 | struct acpi_pointer address; | 247 | struct acpi_pointer address; |
243 | 248 | ||
244 | ACPI_FUNCTION_TRACE("tb_table_override"); | 249 | ACPI_FUNCTION_TRACE(tb_table_override); |
245 | 250 | ||
246 | /* | 251 | /* |
247 | * The OSL will examine the header and decide whether to override this | 252 | * The OSL will examine the header and decide whether to override this |
@@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
250 | */ | 255 | */ |
251 | status = acpi_os_table_override(header, &new_table); | 256 | status = acpi_os_table_override(header, &new_table); |
252 | if (ACPI_FAILURE(status)) { | 257 | if (ACPI_FAILURE(status)) { |
258 | |||
253 | /* Some severe error from the OSL, but we basically ignore it */ | 259 | /* Some severe error from the OSL, but we basically ignore it */ |
254 | 260 | ||
255 | ACPI_EXCEPTION((AE_INFO, status, | 261 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
258 | } | 264 | } |
259 | 265 | ||
260 | if (!new_table) { | 266 | if (!new_table) { |
267 | |||
261 | /* No table override */ | 268 | /* No table override */ |
262 | 269 | ||
263 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | 270 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
@@ -311,7 +318,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
311 | u8 allocation; | 318 | u8 allocation; |
312 | acpi_status status = AE_OK; | 319 | acpi_status status = AE_OK; |
313 | 320 | ||
314 | ACPI_FUNCTION_TRACE("tb_get_this_table"); | 321 | ACPI_FUNCTION_TRACE(tb_get_this_table); |
315 | 322 | ||
316 | /* | 323 | /* |
317 | * Flags contains the current processor mode (Virtual or Physical | 324 | * Flags contains the current processor mode (Virtual or Physical |
@@ -323,7 +330,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
323 | 330 | ||
324 | /* Pointer matches processor mode, copy the table to a new buffer */ | 331 | /* Pointer matches processor mode, copy the table to a new buffer */ |
325 | 332 | ||
326 | full_table = ACPI_MEM_ALLOCATE(header->length); | 333 | full_table = ACPI_ALLOCATE(header->length); |
327 | if (!full_table) { | 334 | if (!full_table) { |
328 | ACPI_ERROR((AE_INFO, | 335 | ACPI_ERROR((AE_INFO, |
329 | "Could not allocate table memory for [%4.4s] length %X", | 336 | "Could not allocate table memory for [%4.4s] length %X", |
@@ -376,11 +383,12 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
376 | * Validate checksum for _most_ tables, | 383 | * Validate checksum for _most_ tables, |
377 | * even the ones whose signature we don't recognize | 384 | * even the ones whose signature we don't recognize |
378 | */ | 385 | */ |
379 | if (table_info->type != ACPI_TABLE_FACS) { | 386 | if (table_info->type != ACPI_TABLE_ID_FACS) { |
380 | status = acpi_tb_verify_table_checksum(full_table); | 387 | status = acpi_tb_verify_table_checksum(full_table); |
381 | 388 | ||
382 | #if (!ACPI_CHECKSUM_ABORT) | 389 | #if (!ACPI_CHECKSUM_ABORT) |
383 | if (ACPI_FAILURE(status)) { | 390 | if (ACPI_FAILURE(status)) { |
391 | |||
384 | /* Ignore the error if configuration says so */ | 392 | /* Ignore the error if configuration says so */ |
385 | 393 | ||
386 | status = AE_OK; | 394 | status = AE_OK; |
@@ -409,7 +417,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
409 | * | 417 | * |
410 | * PARAMETERS: table_type - one of the defined table types | 418 | * PARAMETERS: table_type - one of the defined table types |
411 | * Instance - Which table of this type | 419 | * Instance - Which table of this type |
412 | * table_ptr_loc - pointer to location to place the pointer for | 420 | * return_table - pointer to location to place the pointer for |
413 | * return | 421 | * return |
414 | * | 422 | * |
415 | * RETURN: Status | 423 | * RETURN: Status |
@@ -420,57 +428,34 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
420 | 428 | ||
421 | acpi_status | 429 | acpi_status |
422 | acpi_tb_get_table_ptr(acpi_table_type table_type, | 430 | acpi_tb_get_table_ptr(acpi_table_type table_type, |
423 | u32 instance, struct acpi_table_header **table_ptr_loc) | 431 | u32 instance, struct acpi_table_header **return_table) |
424 | { | 432 | { |
425 | struct acpi_table_desc *table_desc; | 433 | struct acpi_table_desc *table_desc; |
426 | u32 i; | 434 | u32 i; |
427 | 435 | ||
428 | ACPI_FUNCTION_TRACE("tb_get_table_ptr"); | 436 | ACPI_FUNCTION_TRACE(tb_get_table_ptr); |
429 | |||
430 | if (!acpi_gbl_DSDT) { | ||
431 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
432 | } | ||
433 | 437 | ||
434 | if (table_type > ACPI_TABLE_MAX) { | 438 | if (table_type > ACPI_TABLE_ID_MAX) { |
435 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 439 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
436 | } | 440 | } |
437 | 441 | ||
438 | /* | 442 | /* Check for instance out of range of the current table count */ |
439 | * For all table types (Single/Multiple), the first | ||
440 | * instance is always in the list head. | ||
441 | */ | ||
442 | if (instance == 1) { | ||
443 | /* Get the first */ | ||
444 | |||
445 | *table_ptr_loc = NULL; | ||
446 | if (acpi_gbl_table_lists[table_type].next) { | ||
447 | *table_ptr_loc = | ||
448 | acpi_gbl_table_lists[table_type].next->pointer; | ||
449 | } | ||
450 | return_ACPI_STATUS(AE_OK); | ||
451 | } | ||
452 | |||
453 | /* Check for instance out of range */ | ||
454 | 443 | ||
455 | if (instance > acpi_gbl_table_lists[table_type].count) { | 444 | if (instance > acpi_gbl_table_lists[table_type].count) { |
456 | return_ACPI_STATUS(AE_NOT_EXIST); | 445 | return_ACPI_STATUS(AE_NOT_EXIST); |
457 | } | 446 | } |
458 | 447 | ||
459 | /* Walk the list to get the desired table | 448 | /* |
460 | * Since the if (Instance == 1) check above checked for the | 449 | * Walk the list to get the desired table |
461 | * first table, setting table_desc equal to the .Next member | 450 | * Note: Instance is one-based |
462 | * is actually pointing to the second table. Therefore, we | ||
463 | * need to walk from the 2nd table until we reach the Instance | ||
464 | * that the user is looking for and return its table pointer. | ||
465 | */ | 451 | */ |
466 | table_desc = acpi_gbl_table_lists[table_type].next; | 452 | table_desc = acpi_gbl_table_lists[table_type].next; |
467 | for (i = 2; i < instance; i++) { | 453 | for (i = 1; i < instance; i++) { |
468 | table_desc = table_desc->next; | 454 | table_desc = table_desc->next; |
469 | } | 455 | } |
470 | 456 | ||
471 | /* We are now pointing to the requested table's descriptor */ | 457 | /* We are now pointing to the requested table's descriptor */ |
472 | 458 | ||
473 | *table_ptr_loc = table_desc->pointer; | 459 | *return_table = table_desc->pointer; |
474 | |||
475 | return_ACPI_STATUS(AE_OK); | 460 | return_ACPI_STATUS(AE_OK); |
476 | } | 461 | } |
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index 134e5dce0bc1..ad982112e4c6 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c | |||
@@ -77,7 +77,7 @@ acpi_tb_get_primary_table(struct acpi_pointer *address, | |||
77 | acpi_status status; | 77 | acpi_status status; |
78 | struct acpi_table_header header; | 78 | struct acpi_table_header header; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("tb_get_primary_table"); | 80 | ACPI_FUNCTION_TRACE(tb_get_primary_table); |
81 | 81 | ||
82 | /* Ignore a NULL address in the RSDT */ | 82 | /* Ignore a NULL address in the RSDT */ |
83 | 83 | ||
@@ -140,7 +140,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, | |||
140 | acpi_status status; | 140 | acpi_status status; |
141 | struct acpi_table_header header; | 141 | struct acpi_table_header header; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE_STR("tb_get_secondary_table", signature); | 143 | ACPI_FUNCTION_TRACE_STR(tb_get_secondary_table, signature); |
144 | 144 | ||
145 | /* Get the header in order to match the signature */ | 145 | /* Get the header in order to match the signature */ |
146 | 146 | ||
@@ -151,7 +151,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, | |||
151 | 151 | ||
152 | /* Signature must match request */ | 152 | /* Signature must match request */ |
153 | 153 | ||
154 | if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) { | 154 | if (!ACPI_COMPARE_NAME(header.signature, signature)) { |
155 | ACPI_ERROR((AE_INFO, | 155 | ACPI_ERROR((AE_INFO, |
156 | "Incorrect table signature - wanted [%s] found [%4.4s]", | 156 | "Incorrect table signature - wanted [%s] found [%4.4s]", |
157 | signature, header.signature)); | 157 | signature, header.signature)); |
@@ -207,7 +207,7 @@ acpi_status acpi_tb_get_required_tables(void) | |||
207 | struct acpi_table_desc table_info; | 207 | struct acpi_table_desc table_info; |
208 | struct acpi_pointer address; | 208 | struct acpi_pointer address; |
209 | 209 | ||
210 | ACPI_FUNCTION_TRACE("tb_get_required_tables"); | 210 | ACPI_FUNCTION_TRACE(tb_get_required_tables); |
211 | 211 | ||
212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", | 212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", |
213 | acpi_gbl_rsdt_table_count)); | 213 | acpi_gbl_rsdt_table_count)); |
@@ -223,6 +223,7 @@ acpi_status acpi_tb_get_required_tables(void) | |||
223 | * any SSDTs. | 223 | * any SSDTs. |
224 | */ | 224 | */ |
225 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 225 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
226 | |||
226 | /* Get the table address from the common internal XSDT */ | 227 | /* Get the table address from the common internal XSDT */ |
227 | 228 | ||
228 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; | 229 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; |
@@ -305,6 +306,6 @@ acpi_status acpi_tb_get_required_tables(void) | |||
305 | 306 | ||
306 | /* Always delete the RSDP mapping, we are done with it */ | 307 | /* Always delete the RSDP mapping, we are done with it */ |
307 | 308 | ||
308 | acpi_tb_delete_tables_by_type(ACPI_TABLE_RSDP); | 309 | acpi_tb_delete_tables_by_type(ACPI_TABLE_ID_RSDP); |
309 | return_ACPI_STATUS(status); | 310 | return_ACPI_STATUS(status); |
310 | } | 311 | } |
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 7ffd0fddb4e5..7ca2df75bb11 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -73,17 +73,18 @@ acpi_tb_match_signature(char *signature, | |||
73 | { | 73 | { |
74 | acpi_native_uint i; | 74 | acpi_native_uint i; |
75 | 75 | ||
76 | ACPI_FUNCTION_TRACE("tb_match_signature"); | 76 | ACPI_FUNCTION_TRACE(tb_match_signature); |
77 | 77 | ||
78 | /* Search for a signature match among the known table types */ | 78 | /* Search for a signature match among the known table types */ |
79 | 79 | ||
80 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 80 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
81 | if (!(acpi_gbl_table_data[i].flags & search_type)) { | 81 | if (!(acpi_gbl_table_data[i].flags & search_type)) { |
82 | continue; | 82 | continue; |
83 | } | 83 | } |
84 | 84 | ||
85 | if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, | 85 | if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, |
86 | acpi_gbl_table_data[i].sig_length)) { | 86 | acpi_gbl_table_data[i].sig_length)) { |
87 | |||
87 | /* Found a signature match, return index if requested */ | 88 | /* Found a signature match, return index if requested */ |
88 | 89 | ||
89 | if (table_info) { | 90 | if (table_info) { |
@@ -122,7 +123,7 @@ acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info) | |||
122 | { | 123 | { |
123 | acpi_status status; | 124 | acpi_status status; |
124 | 125 | ||
125 | ACPI_FUNCTION_TRACE("tb_install_table"); | 126 | ACPI_FUNCTION_TRACE(tb_install_table); |
126 | 127 | ||
127 | /* Lock tables while installing */ | 128 | /* Lock tables while installing */ |
128 | 129 | ||
@@ -187,7 +188,7 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) | |||
187 | struct acpi_table_header *table_header; | 188 | struct acpi_table_header *table_header; |
188 | acpi_status status; | 189 | acpi_status status; |
189 | 190 | ||
190 | ACPI_FUNCTION_TRACE("tb_recognize_table"); | 191 | ACPI_FUNCTION_TRACE(tb_recognize_table); |
191 | 192 | ||
192 | /* Ensure that we have a valid table pointer */ | 193 | /* Ensure that we have a valid table pointer */ |
193 | 194 | ||
@@ -218,7 +219,6 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) | |||
218 | /* Return the table type and length via the info struct */ | 219 | /* Return the table type and length via the info struct */ |
219 | 220 | ||
220 | table_info->length = (acpi_size) table_header->length; | 221 | table_info->length = (acpi_size) table_header->length; |
221 | |||
222 | return_ACPI_STATUS(status); | 222 | return_ACPI_STATUS(status); |
223 | } | 223 | } |
224 | 224 | ||
@@ -243,11 +243,11 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
243 | struct acpi_table_desc *table_desc; | 243 | struct acpi_table_desc *table_desc; |
244 | acpi_status status; | 244 | acpi_status status; |
245 | 245 | ||
246 | ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type); | 246 | ACPI_FUNCTION_TRACE_U32(tb_init_table_descriptor, table_type); |
247 | 247 | ||
248 | /* Allocate a descriptor for this table */ | 248 | /* Allocate a descriptor for this table */ |
249 | 249 | ||
250 | table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); | 250 | table_desc = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); |
251 | if (!table_desc) { | 251 | if (!table_desc) { |
252 | return_ACPI_STATUS(AE_NO_MEMORY); | 252 | return_ACPI_STATUS(AE_NO_MEMORY); |
253 | } | 253 | } |
@@ -274,7 +274,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
274 | * at this location, so return an error. | 274 | * at this location, so return an error. |
275 | */ | 275 | */ |
276 | if (list_head->next) { | 276 | if (list_head->next) { |
277 | ACPI_MEM_FREE(table_desc); | 277 | ACPI_FREE(table_desc); |
278 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 278 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
279 | } | 279 | } |
280 | 280 | ||
@@ -312,15 +312,14 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
312 | 312 | ||
313 | /* Finish initialization of the table descriptor */ | 313 | /* Finish initialization of the table descriptor */ |
314 | 314 | ||
315 | table_desc->loaded_into_namespace = FALSE; | ||
315 | table_desc->type = (u8) table_type; | 316 | table_desc->type = (u8) table_type; |
316 | table_desc->pointer = table_info->pointer; | 317 | table_desc->pointer = table_info->pointer; |
317 | table_desc->length = table_info->length; | 318 | table_desc->length = table_info->length; |
318 | table_desc->allocation = table_info->allocation; | 319 | table_desc->allocation = table_info->allocation; |
319 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), | 320 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), |
320 | table_desc->aml_length = (u32) (table_desc->length - | 321 | table_desc->aml_length = (u32) |
321 | (u32) sizeof(struct | 322 | (table_desc->length - (u32) sizeof(struct acpi_table_header)); |
322 | acpi_table_header)); | ||
323 | table_desc->loaded_into_namespace = FALSE; | ||
324 | 323 | ||
325 | /* | 324 | /* |
326 | * Set the appropriate global pointer (if there is one) to point to the | 325 | * Set the appropriate global pointer (if there is one) to point to the |
@@ -335,7 +334,6 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
335 | 334 | ||
336 | table_info->owner_id = table_desc->owner_id; | 335 | table_info->owner_id = table_desc->owner_id; |
337 | table_info->installed_desc = table_desc; | 336 | table_info->installed_desc = table_desc; |
338 | |||
339 | return_ACPI_STATUS(AE_OK); | 337 | return_ACPI_STATUS(AE_OK); |
340 | } | 338 | } |
341 | 339 | ||
@@ -359,7 +357,7 @@ void acpi_tb_delete_all_tables(void) | |||
359 | * Free memory allocated for ACPI tables | 357 | * Free memory allocated for ACPI tables |
360 | * Memory can either be mapped or allocated | 358 | * Memory can either be mapped or allocated |
361 | */ | 359 | */ |
362 | for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) { | 360 | for (type = 0; type < (ACPI_TABLE_ID_MAX + 1); type++) { |
363 | acpi_tb_delete_tables_by_type(type); | 361 | acpi_tb_delete_tables_by_type(type); |
364 | } | 362 | } |
365 | } | 363 | } |
@@ -383,9 +381,9 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type) | |||
383 | u32 count; | 381 | u32 count; |
384 | u32 i; | 382 | u32 i; |
385 | 383 | ||
386 | ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type); | 384 | ACPI_FUNCTION_TRACE_U32(tb_delete_tables_by_type, type); |
387 | 385 | ||
388 | if (type > ACPI_TABLE_MAX) { | 386 | if (type > ACPI_TABLE_ID_MAX) { |
389 | return_VOID; | 387 | return_VOID; |
390 | } | 388 | } |
391 | 389 | ||
@@ -396,28 +394,28 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type) | |||
396 | /* Clear the appropriate "typed" global table pointer */ | 394 | /* Clear the appropriate "typed" global table pointer */ |
397 | 395 | ||
398 | switch (type) { | 396 | switch (type) { |
399 | case ACPI_TABLE_RSDP: | 397 | case ACPI_TABLE_ID_RSDP: |
400 | acpi_gbl_RSDP = NULL; | 398 | acpi_gbl_RSDP = NULL; |
401 | break; | 399 | break; |
402 | 400 | ||
403 | case ACPI_TABLE_DSDT: | 401 | case ACPI_TABLE_ID_DSDT: |
404 | acpi_gbl_DSDT = NULL; | 402 | acpi_gbl_DSDT = NULL; |
405 | break; | 403 | break; |
406 | 404 | ||
407 | case ACPI_TABLE_FADT: | 405 | case ACPI_TABLE_ID_FADT: |
408 | acpi_gbl_FADT = NULL; | 406 | acpi_gbl_FADT = NULL; |
409 | break; | 407 | break; |
410 | 408 | ||
411 | case ACPI_TABLE_FACS: | 409 | case ACPI_TABLE_ID_FACS: |
412 | acpi_gbl_FACS = NULL; | 410 | acpi_gbl_FACS = NULL; |
413 | break; | 411 | break; |
414 | 412 | ||
415 | case ACPI_TABLE_XSDT: | 413 | case ACPI_TABLE_ID_XSDT: |
416 | acpi_gbl_XSDT = NULL; | 414 | acpi_gbl_XSDT = NULL; |
417 | break; | 415 | break; |
418 | 416 | ||
419 | case ACPI_TABLE_SSDT: | 417 | case ACPI_TABLE_ID_SSDT: |
420 | case ACPI_TABLE_PSDT: | 418 | case ACPI_TABLE_ID_PSDT: |
421 | default: | 419 | default: |
422 | break; | 420 | break; |
423 | } | 421 | } |
@@ -471,7 +469,7 @@ void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc) | |||
471 | 469 | ||
472 | case ACPI_MEM_ALLOCATED: | 470 | case ACPI_MEM_ALLOCATED: |
473 | 471 | ||
474 | ACPI_MEM_FREE(table_desc->pointer); | 472 | ACPI_FREE(table_desc->pointer); |
475 | break; | 473 | break; |
476 | 474 | ||
477 | case ACPI_MEM_MAPPED: | 475 | case ACPI_MEM_MAPPED: |
@@ -503,7 +501,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc | |||
503 | { | 501 | { |
504 | struct acpi_table_desc *next_desc; | 502 | struct acpi_table_desc *next_desc; |
505 | 503 | ||
506 | ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc); | 504 | ACPI_FUNCTION_TRACE_PTR(tb_uninstall_table, table_desc); |
507 | 505 | ||
508 | if (!table_desc) { | 506 | if (!table_desc) { |
509 | return_PTR(NULL); | 507 | return_PTR(NULL); |
@@ -530,7 +528,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc | |||
530 | /* Free the table descriptor */ | 528 | /* Free the table descriptor */ |
531 | 529 | ||
532 | next_desc = table_desc->next; | 530 | next_desc = table_desc->next; |
533 | ACPI_MEM_FREE(table_desc); | 531 | ACPI_FREE(table_desc); |
534 | 532 | ||
535 | /* Return pointer to the next descriptor */ | 533 | /* Return pointer to the next descriptor */ |
536 | 534 | ||
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 4d308220225d..abcb08c2592a 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -64,7 +64,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
64 | acpi_status status; | 64 | acpi_status status; |
65 | struct rsdp_descriptor *rsdp; | 65 | struct rsdp_descriptor *rsdp; |
66 | 66 | ||
67 | ACPI_FUNCTION_TRACE("tb_verify_rsdp"); | 67 | ACPI_FUNCTION_TRACE(tb_verify_rsdp); |
68 | 68 | ||
69 | switch (address->pointer_type) { | 69 | switch (address->pointer_type) { |
70 | case ACPI_LOGICAL_POINTER: | 70 | case ACPI_LOGICAL_POINTER: |
@@ -78,7 +78,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
78 | */ | 78 | */ |
79 | status = acpi_os_map_memory(address->pointer.physical, | 79 | status = acpi_os_map_memory(address->pointer.physical, |
80 | sizeof(struct rsdp_descriptor), | 80 | sizeof(struct rsdp_descriptor), |
81 | (void *)&rsdp); | 81 | ACPI_CAST_PTR(void, &rsdp)); |
82 | if (ACPI_FAILURE(status)) { | 82 | if (ACPI_FAILURE(status)) { |
83 | return_ACPI_STATUS(status); | 83 | return_ACPI_STATUS(status); |
84 | } | 84 | } |
@@ -95,15 +95,20 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
95 | goto cleanup; | 95 | goto cleanup; |
96 | } | 96 | } |
97 | 97 | ||
98 | /* The RSDP supplied is OK */ | 98 | /* RSDP is ok. Init the table info */ |
99 | 99 | ||
100 | table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); | 100 | table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); |
101 | table_info.length = sizeof(struct rsdp_descriptor); | 101 | table_info.length = sizeof(struct rsdp_descriptor); |
102 | table_info.allocation = ACPI_MEM_MAPPED; | 102 | |
103 | if (address->pointer_type == ACPI_PHYSICAL_POINTER) { | ||
104 | table_info.allocation = ACPI_MEM_MAPPED; | ||
105 | } else { | ||
106 | table_info.allocation = ACPI_MEM_NOT_ALLOCATED; | ||
107 | } | ||
103 | 108 | ||
104 | /* Save the table pointers and allocation info */ | 109 | /* Save the table pointers and allocation info */ |
105 | 110 | ||
106 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_RSDP, &table_info); | 111 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_RSDP, &table_info); |
107 | if (ACPI_FAILURE(status)) { | 112 | if (ACPI_FAILURE(status)) { |
108 | goto cleanup; | 113 | goto cleanup; |
109 | } | 114 | } |
@@ -174,22 +179,20 @@ void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address) | |||
174 | 179 | ||
175 | acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) | 180 | acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) |
176 | { | 181 | { |
177 | int no_match; | 182 | char *signature; |
178 | 183 | ||
179 | ACPI_FUNCTION_ENTRY(); | 184 | ACPI_FUNCTION_ENTRY(); |
180 | 185 | ||
181 | /* | 186 | /* Search for appropriate signature, RSDT or XSDT */ |
182 | * Search for appropriate signature, RSDT or XSDT | 187 | |
183 | */ | ||
184 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 188 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
185 | no_match = ACPI_STRNCMP((char *)table_ptr, RSDT_SIG, | 189 | signature = RSDT_SIG; |
186 | sizeof(RSDT_SIG) - 1); | ||
187 | } else { | 190 | } else { |
188 | no_match = ACPI_STRNCMP((char *)table_ptr, XSDT_SIG, | 191 | signature = XSDT_SIG; |
189 | sizeof(XSDT_SIG) - 1); | ||
190 | } | 192 | } |
191 | 193 | ||
192 | if (no_match) { | 194 | if (!ACPI_COMPARE_NAME(table_ptr->signature, signature)) { |
195 | |||
193 | /* Invalid RSDT or XSDT signature */ | 196 | /* Invalid RSDT or XSDT signature */ |
194 | 197 | ||
195 | ACPI_ERROR((AE_INFO, | 198 | ACPI_ERROR((AE_INFO, |
@@ -198,10 +201,8 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) | |||
198 | ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); | 201 | ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); |
199 | 202 | ||
200 | ACPI_ERROR((AE_INFO, | 203 | ACPI_ERROR((AE_INFO, |
201 | "RSDT/XSDT signature at %X (%p) is invalid", | 204 | "RSDT/XSDT signature at %X is invalid", |
202 | acpi_gbl_RSDP->rsdt_physical_address, | 205 | acpi_gbl_RSDP->rsdt_physical_address)); |
203 | (void *)(acpi_native_uint) acpi_gbl_RSDP-> | ||
204 | rsdt_physical_address)); | ||
205 | 206 | ||
206 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 207 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
207 | ACPI_ERROR((AE_INFO, "Looking for RSDT")); | 208 | ACPI_ERROR((AE_INFO, "Looking for RSDT")); |
@@ -234,13 +235,13 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
234 | acpi_status status; | 235 | acpi_status status; |
235 | struct acpi_pointer address; | 236 | struct acpi_pointer address; |
236 | 237 | ||
237 | ACPI_FUNCTION_TRACE("tb_get_table_rsdt"); | 238 | ACPI_FUNCTION_TRACE(tb_get_table_rsdt); |
238 | 239 | ||
239 | /* Get the RSDT/XSDT via the RSDP */ | 240 | /* Get the RSDT/XSDT via the RSDP */ |
240 | 241 | ||
241 | acpi_tb_get_rsdt_address(&address); | 242 | acpi_tb_get_rsdt_address(&address); |
242 | 243 | ||
243 | table_info.type = ACPI_TABLE_XSDT; | 244 | table_info.type = ACPI_TABLE_ID_XSDT; |
244 | status = acpi_tb_get_table(&address, &table_info); | 245 | status = acpi_tb_get_table(&address, &table_info); |
245 | if (ACPI_FAILURE(status)) { | 246 | if (ACPI_FAILURE(status)) { |
246 | ACPI_EXCEPTION((AE_INFO, status, | 247 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -274,12 +275,13 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
274 | 275 | ||
275 | /* Save the table pointers and allocation info */ | 276 | /* Save the table pointers and allocation info */ |
276 | 277 | ||
277 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_XSDT, &table_info); | 278 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info); |
278 | if (ACPI_FAILURE(status)) { | 279 | if (ACPI_FAILURE(status)) { |
279 | return_ACPI_STATUS(status); | 280 | return_ACPI_STATUS(status); |
280 | } | 281 | } |
281 | 282 | ||
282 | acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer); | 283 | acpi_gbl_XSDT = |
284 | ACPI_CAST_PTR(struct xsdt_descriptor, table_info.pointer); | ||
283 | 285 | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); | 286 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); |
285 | return_ACPI_STATUS(status); | 287 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index bc571592f087..209a401801e3 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -71,7 +71,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) | |||
71 | { | 71 | { |
72 | struct acpi_table_desc *table_desc; | 72 | struct acpi_table_desc *table_desc; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE("tb_is_table_installed"); | 74 | ACPI_FUNCTION_TRACE(tb_is_table_installed); |
75 | 75 | ||
76 | /* Get the list descriptor and first table descriptor */ | 76 | /* Get the list descriptor and first table descriptor */ |
77 | 77 | ||
@@ -96,10 +96,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) | |||
96 | (!ACPI_MEMCMP | 96 | (!ACPI_MEMCMP |
97 | (table_desc->pointer, new_table_desc->pointer, | 97 | (table_desc->pointer, new_table_desc->pointer, |
98 | new_table_desc->pointer->length))) { | 98 | new_table_desc->pointer->length))) { |
99 | |||
99 | /* Match: this table is already installed */ | 100 | /* Match: this table is already installed */ |
100 | 101 | ||
101 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, | 102 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
102 | "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", | 103 | "Table [%4.4s] already installed: Rev %X OemTableId [%8.8s]\n", |
103 | new_table_desc->pointer->signature, | 104 | new_table_desc->pointer->signature, |
104 | new_table_desc->pointer->revision, | 105 | new_table_desc->pointer->revision, |
105 | new_table_desc->pointer-> | 106 | new_table_desc->pointer-> |
@@ -159,12 +160,8 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
159 | 160 | ||
160 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); | 161 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); |
161 | if (!acpi_ut_valid_acpi_name(signature)) { | 162 | if (!acpi_ut_valid_acpi_name(signature)) { |
162 | ACPI_ERROR((AE_INFO, | 163 | ACPI_ERROR((AE_INFO, "Invalid table signature 0x%8.8X", |
163 | "Table signature at %p [%p] has invalid characters", | 164 | signature)); |
164 | table_header, &signature)); | ||
165 | |||
166 | ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]", | ||
167 | ACPI_CAST_PTR(char, &signature))); | ||
168 | 165 | ||
169 | ACPI_DUMP_BUFFER(table_header, | 166 | ACPI_DUMP_BUFFER(table_header, |
170 | sizeof(struct acpi_table_header)); | 167 | sizeof(struct acpi_table_header)); |
@@ -175,12 +172,9 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
175 | 172 | ||
176 | if (table_header->length < sizeof(struct acpi_table_header)) { | 173 | if (table_header->length < sizeof(struct acpi_table_header)) { |
177 | ACPI_ERROR((AE_INFO, | 174 | ACPI_ERROR((AE_INFO, |
178 | "Invalid length in table header %p name %4.4s", | 175 | "Invalid length 0x%X in table with signature %4.4s", |
179 | table_header, (char *)&signature)); | 176 | (u32) table_header->length, |
180 | 177 | ACPI_CAST_PTR(char, &signature))); | |
181 | ACPI_WARNING((AE_INFO, | ||
182 | "Invalid table header length (0x%X) found", | ||
183 | (u32) table_header->length)); | ||
184 | 178 | ||
185 | ACPI_DUMP_BUFFER(table_header, | 179 | ACPI_DUMP_BUFFER(table_header, |
186 | sizeof(struct acpi_table_header)); | 180 | sizeof(struct acpi_table_header)); |
@@ -192,72 +186,119 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
192 | 186 | ||
193 | /******************************************************************************* | 187 | /******************************************************************************* |
194 | * | 188 | * |
195 | * FUNCTION: acpi_tb_verify_table_checksum | 189 | * FUNCTION: acpi_tb_sum_table |
196 | * | 190 | * |
197 | * PARAMETERS: *table_header - ACPI table to verify | 191 | * PARAMETERS: Buffer - Buffer to sum |
192 | * Length - Size of the buffer | ||
198 | * | 193 | * |
199 | * RETURN: 8 bit checksum of table | 194 | * RETURN: 8 bit sum of buffer |
200 | * | 195 | * |
201 | * DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct | 196 | * DESCRIPTION: Computes an 8 bit sum of the buffer(length) and returns it. |
202 | * table should have a checksum of 0. | ||
203 | * | 197 | * |
204 | ******************************************************************************/ | 198 | ******************************************************************************/ |
205 | 199 | ||
206 | acpi_status | 200 | u8 acpi_tb_sum_table(void *buffer, u32 length) |
207 | acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) | 201 | { |
202 | acpi_native_uint i; | ||
203 | u8 sum = 0; | ||
204 | |||
205 | if (!buffer || !length) { | ||
206 | return (0); | ||
207 | } | ||
208 | |||
209 | for (i = 0; i < length; i++) { | ||
210 | sum = (u8) (sum + ((u8 *) buffer)[i]); | ||
211 | } | ||
212 | return (sum); | ||
213 | } | ||
214 | |||
215 | /******************************************************************************* | ||
216 | * | ||
217 | * FUNCTION: acpi_tb_generate_checksum | ||
218 | * | ||
219 | * PARAMETERS: Table - Pointer to a valid ACPI table (with a | ||
220 | * standard ACPI header) | ||
221 | * | ||
222 | * RETURN: 8 bit checksum of buffer | ||
223 | * | ||
224 | * DESCRIPTION: Computes an 8 bit checksum of the table. | ||
225 | * | ||
226 | ******************************************************************************/ | ||
227 | |||
228 | u8 acpi_tb_generate_checksum(struct acpi_table_header * table) | ||
208 | { | 229 | { |
209 | u8 checksum; | 230 | u8 checksum; |
210 | acpi_status status = AE_OK; | ||
211 | 231 | ||
212 | ACPI_FUNCTION_TRACE("tb_verify_table_checksum"); | 232 | /* Sum the entire table as-is */ |
213 | 233 | ||
214 | /* Compute the checksum on the table */ | 234 | checksum = acpi_tb_sum_table(table, table->length); |
215 | 235 | ||
216 | checksum = | 236 | /* Subtract off the existing checksum value in the table */ |
217 | acpi_tb_generate_checksum(table_header, table_header->length); | ||
218 | 237 | ||
219 | /* Return the appropriate exception */ | 238 | checksum = (u8) (checksum - table->checksum); |
220 | 239 | ||
221 | if (checksum) { | 240 | /* Compute the final checksum */ |
222 | ACPI_WARNING((AE_INFO, | ||
223 | "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)", | ||
224 | table_header->signature, | ||
225 | (u32) table_header->checksum, (u32) checksum)); | ||
226 | 241 | ||
227 | status = AE_BAD_CHECKSUM; | 242 | checksum = (u8) (0 - checksum); |
228 | } | 243 | return (checksum); |
229 | return_ACPI_STATUS(status); | ||
230 | } | 244 | } |
231 | 245 | ||
232 | /******************************************************************************* | 246 | /******************************************************************************* |
233 | * | 247 | * |
234 | * FUNCTION: acpi_tb_generate_checksum | 248 | * FUNCTION: acpi_tb_set_checksum |
235 | * | 249 | * |
236 | * PARAMETERS: Buffer - Buffer to checksum | 250 | * PARAMETERS: Table - Pointer to a valid ACPI table (with a |
237 | * Length - Size of the buffer | 251 | * standard ACPI header) |
238 | * | 252 | * |
239 | * RETURN: 8 bit checksum of buffer | 253 | * RETURN: None. Sets the table checksum field |
240 | * | 254 | * |
241 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. | 255 | * DESCRIPTION: Computes an 8 bit checksum of the table and inserts the |
256 | * checksum into the table header. | ||
242 | * | 257 | * |
243 | ******************************************************************************/ | 258 | ******************************************************************************/ |
244 | 259 | ||
245 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) | 260 | void acpi_tb_set_checksum(struct acpi_table_header *table) |
246 | { | 261 | { |
247 | u8 *end_buffer; | ||
248 | u8 *rover; | ||
249 | u8 sum = 0; | ||
250 | 262 | ||
251 | if (buffer && length) { | 263 | table->checksum = acpi_tb_generate_checksum(table); |
252 | /* Buffer and Length are valid */ | 264 | } |
253 | 265 | ||
254 | end_buffer = ACPI_ADD_PTR(u8, buffer, length); | 266 | /******************************************************************************* |
267 | * | ||
268 | * FUNCTION: acpi_tb_verify_table_checksum | ||
269 | * | ||
270 | * PARAMETERS: *table_header - ACPI table to verify | ||
271 | * | ||
272 | * RETURN: 8 bit checksum of table | ||
273 | * | ||
274 | * DESCRIPTION: Generates an 8 bit checksum of table and returns and compares | ||
275 | * it to the existing checksum value. | ||
276 | * | ||
277 | ******************************************************************************/ | ||
255 | 278 | ||
256 | for (rover = buffer; rover < end_buffer; rover++) { | 279 | acpi_status |
257 | sum = (u8) (sum + *rover); | 280 | acpi_tb_verify_table_checksum(struct acpi_table_header *table_header) |
258 | } | 281 | { |
282 | u8 checksum; | ||
283 | |||
284 | ACPI_FUNCTION_TRACE(tb_verify_table_checksum); | ||
285 | |||
286 | /* Compute the checksum on the table */ | ||
287 | |||
288 | checksum = acpi_tb_generate_checksum(table_header); | ||
289 | |||
290 | /* Checksum ok? */ | ||
291 | |||
292 | if (checksum == table_header->checksum) { | ||
293 | return_ACPI_STATUS(AE_OK); | ||
259 | } | 294 | } |
260 | return (sum); | 295 | |
296 | ACPI_WARNING((AE_INFO, | ||
297 | "Incorrect checksum in table [%4.4s] - is %2.2X, should be %2.2X", | ||
298 | table_header->signature, table_header->checksum, | ||
299 | checksum)); | ||
300 | |||
301 | return_ACPI_STATUS(AE_BAD_CHECKSUM); | ||
261 | } | 302 | } |
262 | 303 | ||
263 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 304 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
@@ -276,12 +317,12 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length) | |||
276 | 317 | ||
277 | acpi_status | 318 | acpi_status |
278 | acpi_tb_handle_to_object(u16 table_id, | 319 | acpi_tb_handle_to_object(u16 table_id, |
279 | struct acpi_table_desc ** return_table_desc) | 320 | struct acpi_table_desc **return_table_desc) |
280 | { | 321 | { |
281 | u32 i; | 322 | u32 i; |
282 | struct acpi_table_desc *table_desc; | 323 | struct acpi_table_desc *table_desc; |
283 | 324 | ||
284 | ACPI_FUNCTION_NAME("tb_handle_to_object"); | 325 | ACPI_FUNCTION_NAME(tb_handle_to_object); |
285 | 326 | ||
286 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | 327 | for (i = 0; i < ACPI_TABLE_MAX; i++) { |
287 | table_desc = acpi_gbl_table_lists[i].next; | 328 | table_desc = acpi_gbl_table_lists[i].next; |
@@ -295,7 +336,7 @@ acpi_tb_handle_to_object(u16 table_id, | |||
295 | } | 336 | } |
296 | } | 337 | } |
297 | 338 | ||
298 | ACPI_ERROR((AE_INFO, "table_id=%X does not exist", table_id)); | 339 | ACPI_ERROR((AE_INFO, "TableId=%X does not exist", table_id)); |
299 | return (AE_BAD_PARAMETER); | 340 | return (AE_BAD_PARAMETER); |
300 | } | 341 | } |
301 | #endif | 342 | #endif |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 9fe53c9d5b9a..4e91f2984815 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/actables.h> | 47 | #include <acpi/actables.h> |
@@ -68,7 +66,7 @@ acpi_status acpi_load_tables(void) | |||
68 | struct acpi_pointer rsdp_address; | 66 | struct acpi_pointer rsdp_address; |
69 | acpi_status status; | 67 | acpi_status status; |
70 | 68 | ||
71 | ACPI_FUNCTION_TRACE("acpi_load_tables"); | 69 | ACPI_FUNCTION_TRACE(acpi_load_tables); |
72 | 70 | ||
73 | /* Get the RSDP */ | 71 | /* Get the RSDP */ |
74 | 72 | ||
@@ -123,6 +121,8 @@ acpi_status acpi_load_tables(void) | |||
123 | return_ACPI_STATUS(status); | 121 | return_ACPI_STATUS(status); |
124 | } | 122 | } |
125 | 123 | ||
124 | ACPI_EXPORT_SYMBOL(acpi_load_tables) | ||
125 | |||
126 | #ifdef ACPI_FUTURE_USAGE | 126 | #ifdef ACPI_FUTURE_USAGE |
127 | /******************************************************************************* | 127 | /******************************************************************************* |
128 | * | 128 | * |
@@ -139,14 +139,13 @@ acpi_status acpi_load_tables(void) | |||
139 | * is determined that the table is invalid, the call will fail. | 139 | * is determined that the table is invalid, the call will fail. |
140 | * | 140 | * |
141 | ******************************************************************************/ | 141 | ******************************************************************************/ |
142 | |||
143 | acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | 142 | acpi_status acpi_load_table(struct acpi_table_header *table_ptr) |
144 | { | 143 | { |
145 | acpi_status status; | 144 | acpi_status status; |
146 | struct acpi_table_desc table_info; | 145 | struct acpi_table_desc table_info; |
147 | struct acpi_pointer address; | 146 | struct acpi_pointer address; |
148 | 147 | ||
149 | ACPI_FUNCTION_TRACE("acpi_load_table"); | 148 | ACPI_FUNCTION_TRACE(acpi_load_table); |
150 | 149 | ||
151 | if (!table_ptr) { | 150 | if (!table_ptr) { |
152 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 151 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -174,6 +173,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
174 | status = acpi_tb_install_table(&table_info); | 173 | status = acpi_tb_install_table(&table_info); |
175 | if (ACPI_FAILURE(status)) { | 174 | if (ACPI_FAILURE(status)) { |
176 | if (status == AE_ALREADY_EXISTS) { | 175 | if (status == AE_ALREADY_EXISTS) { |
176 | |||
177 | /* Table already exists, no error */ | 177 | /* Table already exists, no error */ |
178 | 178 | ||
179 | status = AE_OK; | 179 | status = AE_OK; |
@@ -188,12 +188,12 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
188 | /* Convert the table to common format if necessary */ | 188 | /* Convert the table to common format if necessary */ |
189 | 189 | ||
190 | switch (table_info.type) { | 190 | switch (table_info.type) { |
191 | case ACPI_TABLE_FADT: | 191 | case ACPI_TABLE_ID_FADT: |
192 | 192 | ||
193 | status = acpi_tb_convert_table_fadt(); | 193 | status = acpi_tb_convert_table_fadt(); |
194 | break; | 194 | break; |
195 | 195 | ||
196 | case ACPI_TABLE_FACS: | 196 | case ACPI_TABLE_ID_FACS: |
197 | 197 | ||
198 | status = acpi_tb_build_common_facs(&table_info); | 198 | status = acpi_tb_build_common_facs(&table_info); |
199 | break; | 199 | break; |
@@ -208,6 +208,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | if (ACPI_FAILURE(status)) { | 210 | if (ACPI_FAILURE(status)) { |
211 | |||
211 | /* Uninstall table and free the buffer */ | 212 | /* Uninstall table and free the buffer */ |
212 | 213 | ||
213 | (void)acpi_tb_uninstall_table(table_info.installed_desc); | 214 | (void)acpi_tb_uninstall_table(table_info.installed_desc); |
@@ -216,6 +217,8 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
216 | return_ACPI_STATUS(status); | 217 | return_ACPI_STATUS(status); |
217 | } | 218 | } |
218 | 219 | ||
220 | ACPI_EXPORT_SYMBOL(acpi_load_table) | ||
221 | |||
219 | /******************************************************************************* | 222 | /******************************************************************************* |
220 | * | 223 | * |
221 | * FUNCTION: acpi_unload_table | 224 | * FUNCTION: acpi_unload_table |
@@ -227,16 +230,15 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
227 | * DESCRIPTION: This routine is used to force the unload of a table | 230 | * DESCRIPTION: This routine is used to force the unload of a table |
228 | * | 231 | * |
229 | ******************************************************************************/ | 232 | ******************************************************************************/ |
230 | |||
231 | acpi_status acpi_unload_table(acpi_table_type table_type) | 233 | acpi_status acpi_unload_table(acpi_table_type table_type) |
232 | { | 234 | { |
233 | struct acpi_table_desc *table_desc; | 235 | struct acpi_table_desc *table_desc; |
234 | 236 | ||
235 | ACPI_FUNCTION_TRACE("acpi_unload_table"); | 237 | ACPI_FUNCTION_TRACE(acpi_unload_table); |
236 | 238 | ||
237 | /* Parameter validation */ | 239 | /* Parameter validation */ |
238 | 240 | ||
239 | if (table_type > ACPI_TABLE_MAX) { | 241 | if (table_type > ACPI_TABLE_ID_MAX) { |
240 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 242 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
241 | } | 243 | } |
242 | 244 | ||
@@ -261,6 +263,8 @@ acpi_status acpi_unload_table(acpi_table_type table_type) | |||
261 | return_ACPI_STATUS(AE_OK); | 263 | return_ACPI_STATUS(AE_OK); |
262 | } | 264 | } |
263 | 265 | ||
266 | ACPI_EXPORT_SYMBOL(acpi_unload_table) | ||
267 | |||
264 | /******************************************************************************* | 268 | /******************************************************************************* |
265 | * | 269 | * |
266 | * FUNCTION: acpi_get_table_header | 270 | * FUNCTION: acpi_get_table_header |
@@ -281,7 +285,6 @@ acpi_status acpi_unload_table(acpi_table_type table_type) | |||
281 | * have a standard header and is fixed length. | 285 | * have a standard header and is fixed length. |
282 | * | 286 | * |
283 | ******************************************************************************/ | 287 | ******************************************************************************/ |
284 | |||
285 | acpi_status | 288 | acpi_status |
286 | acpi_get_table_header(acpi_table_type table_type, | 289 | acpi_get_table_header(acpi_table_type table_type, |
287 | u32 instance, struct acpi_table_header *out_table_header) | 290 | u32 instance, struct acpi_table_header *out_table_header) |
@@ -289,16 +292,16 @@ acpi_get_table_header(acpi_table_type table_type, | |||
289 | struct acpi_table_header *tbl_ptr; | 292 | struct acpi_table_header *tbl_ptr; |
290 | acpi_status status; | 293 | acpi_status status; |
291 | 294 | ||
292 | ACPI_FUNCTION_TRACE("acpi_get_table_header"); | 295 | ACPI_FUNCTION_TRACE(acpi_get_table_header); |
293 | 296 | ||
294 | if ((instance == 0) || | 297 | if ((instance == 0) || |
295 | (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) { | 298 | (table_type == ACPI_TABLE_ID_RSDP) || (!out_table_header)) { |
296 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 299 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
297 | } | 300 | } |
298 | 301 | ||
299 | /* Check the table type and instance */ | 302 | /* Check the table type and instance */ |
300 | 303 | ||
301 | if ((table_type > ACPI_TABLE_MAX) || | 304 | if ((table_type > ACPI_TABLE_ID_MAX) || |
302 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && | 305 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && |
303 | instance > 1)) { | 306 | instance > 1)) { |
304 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 307 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -325,6 +328,7 @@ acpi_get_table_header(acpi_table_type table_type, | |||
325 | return_ACPI_STATUS(status); | 328 | return_ACPI_STATUS(status); |
326 | } | 329 | } |
327 | 330 | ||
331 | ACPI_EXPORT_SYMBOL(acpi_get_table_header) | ||
328 | #endif /* ACPI_FUTURE_USAGE */ | 332 | #endif /* ACPI_FUTURE_USAGE */ |
329 | 333 | ||
330 | /******************************************************************************* | 334 | /******************************************************************************* |
@@ -349,7 +353,6 @@ acpi_get_table_header(acpi_table_type table_type, | |||
349 | * a complete table including the header. | 353 | * a complete table including the header. |
350 | * | 354 | * |
351 | ******************************************************************************/ | 355 | ******************************************************************************/ |
352 | |||
353 | acpi_status | 356 | acpi_status |
354 | acpi_get_table(acpi_table_type table_type, | 357 | acpi_get_table(acpi_table_type table_type, |
355 | u32 instance, struct acpi_buffer *ret_buffer) | 358 | u32 instance, struct acpi_buffer *ret_buffer) |
@@ -358,7 +361,7 @@ acpi_get_table(acpi_table_type table_type, | |||
358 | acpi_status status; | 361 | acpi_status status; |
359 | acpi_size table_length; | 362 | acpi_size table_length; |
360 | 363 | ||
361 | ACPI_FUNCTION_TRACE("acpi_get_table"); | 364 | ACPI_FUNCTION_TRACE(acpi_get_table); |
362 | 365 | ||
363 | /* Parameter validation */ | 366 | /* Parameter validation */ |
364 | 367 | ||
@@ -373,7 +376,7 @@ acpi_get_table(acpi_table_type table_type, | |||
373 | 376 | ||
374 | /* Check the table type and instance */ | 377 | /* Check the table type and instance */ |
375 | 378 | ||
376 | if ((table_type > ACPI_TABLE_MAX) || | 379 | if ((table_type > ACPI_TABLE_ID_MAX) || |
377 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && | 380 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && |
378 | instance > 1)) { | 381 | instance > 1)) { |
379 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 382 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -396,7 +399,8 @@ acpi_get_table(acpi_table_type table_type, | |||
396 | 399 | ||
397 | /* Get the table length */ | 400 | /* Get the table length */ |
398 | 401 | ||
399 | if (table_type == ACPI_TABLE_RSDP) { | 402 | if (table_type == ACPI_TABLE_ID_RSDP) { |
403 | |||
400 | /* RSD PTR is the only "table" without a header */ | 404 | /* RSD PTR is the only "table" without a header */ |
401 | 405 | ||
402 | table_length = sizeof(struct rsdp_descriptor); | 406 | table_length = sizeof(struct rsdp_descriptor); |
@@ -417,4 +421,4 @@ acpi_get_table(acpi_table_type table_type, | |||
417 | return_ACPI_STATUS(AE_OK); | 421 | return_ACPI_STATUS(AE_OK); |
418 | } | 422 | } |
419 | 423 | ||
420 | EXPORT_SYMBOL(acpi_get_table); | 424 | ACPI_EXPORT_SYMBOL(acpi_get_table) |
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index a62db6af83c9..da2648bbdbc0 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/actables.h> | 45 | #include <acpi/actables.h> |
48 | 46 | ||
@@ -75,6 +73,7 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) | |||
75 | * The signature and checksum must both be correct | 73 | * The signature and checksum must both be correct |
76 | */ | 74 | */ |
77 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { | 75 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { |
76 | |||
78 | /* Nope, BAD Signature */ | 77 | /* Nope, BAD Signature */ |
79 | 78 | ||
80 | return (AE_BAD_SIGNATURE); | 79 | return (AE_BAD_SIGNATURE); |
@@ -82,15 +81,14 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) | |||
82 | 81 | ||
83 | /* Check the standard checksum */ | 82 | /* Check the standard checksum */ |
84 | 83 | ||
85 | if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { | 84 | if (acpi_tb_sum_table(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { |
86 | return (AE_BAD_CHECKSUM); | 85 | return (AE_BAD_CHECKSUM); |
87 | } | 86 | } |
88 | 87 | ||
89 | /* Check extended checksum if table version >= 2 */ | 88 | /* Check extended checksum if table version >= 2 */ |
90 | 89 | ||
91 | if ((rsdp->revision >= 2) && | 90 | if ((rsdp->revision >= 2) && |
92 | (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != | 91 | (acpi_tb_sum_table(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { |
93 | 0)) { | ||
94 | return (AE_BAD_CHECKSUM); | 92 | return (AE_BAD_CHECKSUM); |
95 | } | 93 | } |
96 | 94 | ||
@@ -121,7 +119,7 @@ acpi_tb_find_table(char *signature, | |||
121 | acpi_status status; | 119 | acpi_status status; |
122 | struct acpi_table_header *table; | 120 | struct acpi_table_header *table; |
123 | 121 | ||
124 | ACPI_FUNCTION_TRACE("tb_find_table"); | 122 | ACPI_FUNCTION_TRACE(tb_find_table); |
125 | 123 | ||
126 | /* Validate string lengths */ | 124 | /* Validate string lengths */ |
127 | 125 | ||
@@ -131,7 +129,7 @@ acpi_tb_find_table(char *signature, | |||
131 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); | 129 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); |
132 | } | 130 | } |
133 | 131 | ||
134 | if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) { | 132 | if (ACPI_COMPARE_NAME(signature, DSDT_SIG)) { |
135 | /* | 133 | /* |
136 | * The DSDT pointer is contained in the FADT, not the RSDT. | 134 | * The DSDT pointer is contained in the FADT, not the RSDT. |
137 | * This code should suffice, because the only code that would perform | 135 | * This code should suffice, because the only code that would perform |
@@ -156,10 +154,12 @@ acpi_tb_find_table(char *signature, | |||
156 | 154 | ||
157 | /* Check oem_id and oem_table_id */ | 155 | /* Check oem_id and oem_table_id */ |
158 | 156 | ||
159 | if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id, | 157 | if ((oem_id[0] && |
160 | sizeof(table->oem_id))) || | 158 | ACPI_STRNCMP(oem_id, table->oem_id, |
161 | (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id, | 159 | sizeof(table->oem_id))) || |
162 | sizeof(table->oem_table_id)))) { | 160 | (oem_table_id[0] && |
161 | ACPI_STRNCMP(oem_table_id, table->oem_table_id, | ||
162 | sizeof(table->oem_table_id)))) { | ||
163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); | 163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); |
164 | } | 164 | } |
165 | 165 | ||
@@ -203,7 +203,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
203 | u32 i; | 203 | u32 i; |
204 | u32 j; | 204 | u32 j; |
205 | 205 | ||
206 | ACPI_FUNCTION_TRACE("acpi_get_firmware_table"); | 206 | ACPI_FUNCTION_TRACE(acpi_get_firmware_table); |
207 | 207 | ||
208 | /* | 208 | /* |
209 | * Ensure that at least the table manager is initialized. We don't | 209 | * Ensure that at least the table manager is initialized. We don't |
@@ -217,6 +217,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
217 | /* Ensure that we have a RSDP */ | 217 | /* Ensure that we have a RSDP */ |
218 | 218 | ||
219 | if (!acpi_gbl_RSDP) { | 219 | if (!acpi_gbl_RSDP) { |
220 | |||
220 | /* Get the RSDP */ | 221 | /* Get the RSDP */ |
221 | 222 | ||
222 | status = acpi_os_get_root_pointer(flags, &address); | 223 | status = acpi_os_get_root_pointer(flags, &address); |
@@ -261,7 +262,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
261 | 262 | ||
262 | /* Get and validate the RSDT */ | 263 | /* Get and validate the RSDT */ |
263 | 264 | ||
264 | rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); | 265 | rsdt_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); |
265 | if (!rsdt_info) { | 266 | if (!rsdt_info) { |
266 | return_ACPI_STATUS(AE_NO_MEMORY); | 267 | return_ACPI_STATUS(AE_NO_MEMORY); |
267 | } | 268 | } |
@@ -278,13 +279,13 @@ acpi_get_firmware_table(acpi_string signature, | |||
278 | 279 | ||
279 | /* Allocate a scratch table header and table descriptor */ | 280 | /* Allocate a scratch table header and table descriptor */ |
280 | 281 | ||
281 | header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header)); | 282 | header = ACPI_ALLOCATE(sizeof(struct acpi_table_header)); |
282 | if (!header) { | 283 | if (!header) { |
283 | status = AE_NO_MEMORY; | 284 | status = AE_NO_MEMORY; |
284 | goto cleanup; | 285 | goto cleanup; |
285 | } | 286 | } |
286 | 287 | ||
287 | table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc)); | 288 | table_info = ACPI_ALLOCATE(sizeof(struct acpi_table_desc)); |
288 | if (!table_info) { | 289 | if (!table_info) { |
289 | status = AE_NO_MEMORY; | 290 | status = AE_NO_MEMORY; |
290 | goto cleanup; | 291 | goto cleanup; |
@@ -308,12 +309,12 @@ acpi_get_firmware_table(acpi_string signature, | |||
308 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 309 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
309 | address.pointer.value = | 310 | address.pointer.value = |
310 | (ACPI_CAST_PTR | 311 | (ACPI_CAST_PTR |
311 | (RSDT_DESCRIPTOR, | 312 | (struct rsdt_descriptor, |
312 | rsdt_info->pointer))->table_offset_entry[i]; | 313 | rsdt_info->pointer))->table_offset_entry[i]; |
313 | } else { | 314 | } else { |
314 | address.pointer.value = | 315 | address.pointer.value = |
315 | (ACPI_CAST_PTR | 316 | (ACPI_CAST_PTR |
316 | (XSDT_DESCRIPTOR, | 317 | (struct xsdt_descriptor, |
317 | rsdt_info->pointer))->table_offset_entry[i]; | 318 | rsdt_info->pointer))->table_offset_entry[i]; |
318 | } | 319 | } |
319 | 320 | ||
@@ -326,11 +327,13 @@ acpi_get_firmware_table(acpi_string signature, | |||
326 | 327 | ||
327 | /* Compare table signatures and table instance */ | 328 | /* Compare table signatures and table instance */ |
328 | 329 | ||
329 | if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { | 330 | if (ACPI_COMPARE_NAME(header->signature, signature)) { |
331 | |||
330 | /* An instance of the table was found */ | 332 | /* An instance of the table was found */ |
331 | 333 | ||
332 | j++; | 334 | j++; |
333 | if (j >= instance) { | 335 | if (j >= instance) { |
336 | |||
334 | /* Found the correct instance, get the entire table */ | 337 | /* Found the correct instance, get the entire table */ |
335 | 338 | ||
336 | status = | 339 | status = |
@@ -355,23 +358,21 @@ acpi_get_firmware_table(acpi_string signature, | |||
355 | acpi_os_unmap_memory(rsdt_info->pointer, | 358 | acpi_os_unmap_memory(rsdt_info->pointer, |
356 | (acpi_size) rsdt_info->pointer->length); | 359 | (acpi_size) rsdt_info->pointer->length); |
357 | } | 360 | } |
358 | ACPI_MEM_FREE(rsdt_info); | 361 | ACPI_FREE(rsdt_info); |
359 | 362 | ||
360 | if (header) { | 363 | if (header) { |
361 | ACPI_MEM_FREE(header); | 364 | ACPI_FREE(header); |
362 | } | 365 | } |
363 | if (table_info) { | 366 | if (table_info) { |
364 | ACPI_MEM_FREE(table_info); | 367 | ACPI_FREE(table_info); |
365 | } | 368 | } |
366 | return_ACPI_STATUS(status); | 369 | return_ACPI_STATUS(status); |
367 | } | 370 | } |
368 | 371 | ||
369 | EXPORT_SYMBOL(acpi_get_firmware_table); | 372 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_table) |
370 | 373 | ||
371 | /* TBD: Move to a new file */ | 374 | /* TBD: Move to a new file */ |
372 | |||
373 | #if ACPI_MACHINE_WIDTH != 16 | 375 | #if ACPI_MACHINE_WIDTH != 16 |
374 | |||
375 | /******************************************************************************* | 376 | /******************************************************************************* |
376 | * | 377 | * |
377 | * FUNCTION: acpi_find_root_pointer | 378 | * FUNCTION: acpi_find_root_pointer |
@@ -384,13 +385,12 @@ EXPORT_SYMBOL(acpi_get_firmware_table); | |||
384 | * DESCRIPTION: Find the RSDP | 385 | * DESCRIPTION: Find the RSDP |
385 | * | 386 | * |
386 | ******************************************************************************/ | 387 | ******************************************************************************/ |
387 | |||
388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | 388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) |
389 | { | 389 | { |
390 | struct acpi_table_desc table_info; | 390 | struct acpi_table_desc table_info; |
391 | acpi_status status; | 391 | acpi_status status; |
392 | 392 | ||
393 | ACPI_FUNCTION_TRACE("acpi_find_root_pointer"); | 393 | ACPI_FUNCTION_TRACE(acpi_find_root_pointer); |
394 | 394 | ||
395 | /* Get the RSDP */ | 395 | /* Get the RSDP */ |
396 | 396 | ||
@@ -407,6 +407,8 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | |||
407 | return_ACPI_STATUS(AE_OK); | 407 | return_ACPI_STATUS(AE_OK); |
408 | } | 408 | } |
409 | 409 | ||
410 | ACPI_EXPORT_SYMBOL(acpi_find_root_pointer) | ||
411 | |||
410 | /******************************************************************************* | 412 | /******************************************************************************* |
411 | * | 413 | * |
412 | * FUNCTION: acpi_tb_scan_memory_for_rsdp | 414 | * FUNCTION: acpi_tb_scan_memory_for_rsdp |
@@ -419,14 +421,13 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | |||
419 | * DESCRIPTION: Search a block of memory for the RSDP signature | 421 | * DESCRIPTION: Search a block of memory for the RSDP signature |
420 | * | 422 | * |
421 | ******************************************************************************/ | 423 | ******************************************************************************/ |
422 | |||
423 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | 424 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) |
424 | { | 425 | { |
425 | acpi_status status; | 426 | acpi_status status; |
426 | u8 *mem_rover; | 427 | u8 *mem_rover; |
427 | u8 *end_address; | 428 | u8 *end_address; |
428 | 429 | ||
429 | ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp"); | 430 | ACPI_FUNCTION_TRACE(tb_scan_memory_for_rsdp); |
430 | 431 | ||
431 | end_address = start_address + length; | 432 | end_address = start_address + length; |
432 | 433 | ||
@@ -434,12 +435,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | |||
434 | 435 | ||
435 | for (mem_rover = start_address; mem_rover < end_address; | 436 | for (mem_rover = start_address; mem_rover < end_address; |
436 | mem_rover += ACPI_RSDP_SCAN_STEP) { | 437 | mem_rover += ACPI_RSDP_SCAN_STEP) { |
438 | |||
437 | /* The RSDP signature and checksum must both be correct */ | 439 | /* The RSDP signature and checksum must both be correct */ |
438 | 440 | ||
439 | status = | 441 | status = |
440 | acpi_tb_validate_rsdp(ACPI_CAST_PTR | 442 | acpi_tb_validate_rsdp(ACPI_CAST_PTR |
441 | (struct rsdp_descriptor, mem_rover)); | 443 | (struct rsdp_descriptor, mem_rover)); |
442 | if (ACPI_SUCCESS(status)) { | 444 | if (ACPI_SUCCESS(status)) { |
445 | |||
443 | /* Sig and checksum valid, we have found a real RSDP */ | 446 | /* Sig and checksum valid, we have found a real RSDP */ |
444 | 447 | ||
445 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 448 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -469,10 +472,10 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | |||
469 | * | 472 | * |
470 | * RETURN: Status, RSDP physical address | 473 | * RETURN: Status, RSDP physical address |
471 | * | 474 | * |
472 | * DESCRIPTION: search lower 1_mbyte of memory for the root system descriptor | 475 | * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor |
473 | * pointer structure. If it is found, set *RSDP to point to it. | 476 | * pointer structure. If it is found, set *RSDP to point to it. |
474 | * | 477 | * |
475 | * NOTE1: The RSDp must be either in the first 1_k of the Extended | 478 | * NOTE1: The RSDP must be either in the first 1_k of the Extended |
476 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) | 479 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) |
477 | * Only a 32-bit physical address is necessary. | 480 | * Only a 32-bit physical address is necessary. |
478 | * | 481 | * |
@@ -489,12 +492,13 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
489 | u32 physical_address; | 492 | u32 physical_address; |
490 | acpi_status status; | 493 | acpi_status status; |
491 | 494 | ||
492 | ACPI_FUNCTION_TRACE("tb_find_rsdp"); | 495 | ACPI_FUNCTION_TRACE(tb_find_rsdp); |
493 | 496 | ||
494 | /* | 497 | /* |
495 | * Scan supports either logical addressing or physical addressing | 498 | * Scan supports either logical addressing or physical addressing |
496 | */ | 499 | */ |
497 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 500 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
501 | |||
498 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ | 502 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ |
499 | 503 | ||
500 | status = acpi_os_map_memory((acpi_physical_address) | 504 | status = acpi_os_map_memory((acpi_physical_address) |
@@ -521,7 +525,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
521 | 525 | ||
522 | if (physical_address > 0x400) { | 526 | if (physical_address > 0x400) { |
523 | /* | 527 | /* |
524 | * 1b) Search EBDA paragraphs (EBDa is required to be a | 528 | * 1b) Search EBDA paragraphs (EBDA is required to be a |
525 | * minimum of 1_k length) | 529 | * minimum of 1_k length) |
526 | */ | 530 | */ |
527 | status = acpi_os_map_memory((acpi_physical_address) | 531 | status = acpi_os_map_memory((acpi_physical_address) |
@@ -542,10 +546,11 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
542 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); | 546 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); |
543 | 547 | ||
544 | if (mem_rover) { | 548 | if (mem_rover) { |
549 | |||
545 | /* Return the physical address */ | 550 | /* Return the physical address */ |
546 | 551 | ||
547 | physical_address += | 552 | physical_address += |
548 | ACPI_PTR_DIFF(mem_rover, table_ptr); | 553 | (u32) ACPI_PTR_DIFF(mem_rover, table_ptr); |
549 | 554 | ||
550 | table_info->physical_address = | 555 | table_info->physical_address = |
551 | (acpi_physical_address) physical_address; | 556 | (acpi_physical_address) physical_address; |
@@ -576,11 +581,12 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
576 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | 581 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); |
577 | 582 | ||
578 | if (mem_rover) { | 583 | if (mem_rover) { |
584 | |||
579 | /* Return the physical address */ | 585 | /* Return the physical address */ |
580 | 586 | ||
581 | physical_address = | 587 | physical_address = (u32) |
582 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, | 588 | (ACPI_HI_RSDP_WINDOW_BASE + |
583 | table_ptr); | 589 | ACPI_PTR_DIFF(mem_rover, table_ptr)); |
584 | 590 | ||
585 | table_info->physical_address = | 591 | table_info->physical_address = |
586 | (acpi_physical_address) physical_address; | 592 | (acpi_physical_address) physical_address; |
@@ -601,7 +607,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
601 | 607 | ||
602 | if (physical_address > 0x400) { | 608 | if (physical_address > 0x400) { |
603 | /* | 609 | /* |
604 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of | 610 | * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of |
605 | * 1_k length) | 611 | * 1_k length) |
606 | */ | 612 | */ |
607 | mem_rover = | 613 | mem_rover = |
@@ -609,6 +615,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
609 | (physical_address), | 615 | (physical_address), |
610 | ACPI_EBDA_WINDOW_SIZE); | 616 | ACPI_EBDA_WINDOW_SIZE); |
611 | if (mem_rover) { | 617 | if (mem_rover) { |
618 | |||
612 | /* Return the physical address */ | 619 | /* Return the physical address */ |
613 | 620 | ||
614 | table_info->physical_address = | 621 | table_info->physical_address = |
@@ -624,6 +631,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
624 | (ACPI_HI_RSDP_WINDOW_BASE), | 631 | (ACPI_HI_RSDP_WINDOW_BASE), |
625 | ACPI_HI_RSDP_WINDOW_SIZE); | 632 | ACPI_HI_RSDP_WINDOW_SIZE); |
626 | if (mem_rover) { | 633 | if (mem_rover) { |
634 | |||
627 | /* Found it, return the physical address */ | 635 | /* Found it, return the physical address */ |
628 | 636 | ||
629 | table_info->physical_address = | 637 | table_info->physical_address = |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 19f3ea48475e..a29af58cb4cd 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -684,8 +684,7 @@ static void acpi_thermal_run(unsigned long data) | |||
684 | { | 684 | { |
685 | struct acpi_thermal *tz = (struct acpi_thermal *)data; | 685 | struct acpi_thermal *tz = (struct acpi_thermal *)data; |
686 | if (!tz->zombie) | 686 | if (!tz->zombie) |
687 | acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 687 | acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data); |
688 | acpi_thermal_check, (void *)data); | ||
689 | } | 688 | } |
690 | 689 | ||
691 | static void acpi_thermal_check(void *data) | 690 | static void acpi_thermal_check(void *data) |
@@ -942,8 +941,10 @@ acpi_thermal_write_trip_points(struct file *file, | |||
942 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); | 941 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); |
943 | 942 | ||
944 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | 943 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); |
945 | if (!active) | 944 | if (!active) { |
945 | kfree(limit_string); | ||
946 | return_VALUE(-ENOMEM); | 946 | return_VALUE(-ENOMEM); |
947 | } | ||
947 | 948 | ||
948 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { | 949 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { |
949 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); | 950 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 03b0044974c2..7940fc1bd69e 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -46,24 +46,6 @@ | |||
46 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utalloc") | 47 | ACPI_MODULE_NAME("utalloc") |
48 | 48 | ||
49 | /* Local prototypes */ | ||
50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); | ||
52 | |||
53 | static acpi_status | ||
54 | acpi_ut_track_allocation(struct acpi_debug_mem_block *address, | ||
55 | acpi_size size, | ||
56 | u8 alloc_type, u32 component, char *module, u32 line); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, | ||
60 | u32 component, char *module, u32 line); | ||
61 | |||
62 | static acpi_status | ||
63 | acpi_ut_create_list(char *list_name, | ||
64 | u16 object_size, struct acpi_memory_list **return_cache); | ||
65 | #endif | ||
66 | |||
67 | /******************************************************************************* | 49 | /******************************************************************************* |
68 | * | 50 | * |
69 | * FUNCTION: acpi_ut_create_caches | 51 | * FUNCTION: acpi_ut_create_caches |
@@ -75,33 +57,23 @@ acpi_ut_create_list(char *list_name, | |||
75 | * DESCRIPTION: Create all local caches | 57 | * DESCRIPTION: Create all local caches |
76 | * | 58 | * |
77 | ******************************************************************************/ | 59 | ******************************************************************************/ |
78 | |||
79 | acpi_status acpi_ut_create_caches(void) | 60 | acpi_status acpi_ut_create_caches(void) |
80 | { | 61 | { |
81 | acpi_status status; | 62 | acpi_status status; |
82 | 63 | ||
83 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 64 | /* Object Caches, for frequently used objects */ |
84 | |||
85 | /* Memory allocation lists */ | ||
86 | |||
87 | status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); | ||
88 | if (ACPI_FAILURE(status)) { | ||
89 | return (status); | ||
90 | } | ||
91 | 65 | ||
92 | status = | 66 | status = |
93 | acpi_ut_create_list("Acpi-Namespace", | 67 | acpi_os_create_cache("Acpi-Namespace", |
94 | sizeof(struct acpi_namespace_node), | 68 | sizeof(struct acpi_namespace_node), |
95 | &acpi_gbl_ns_node_list); | 69 | ACPI_MAX_NAMESPACE_CACHE_DEPTH, |
70 | &acpi_gbl_namespace_cache); | ||
96 | if (ACPI_FAILURE(status)) { | 71 | if (ACPI_FAILURE(status)) { |
97 | return (status); | 72 | return (status); |
98 | } | 73 | } |
99 | #endif | ||
100 | |||
101 | /* Object Caches, for frequently used objects */ | ||
102 | 74 | ||
103 | status = | 75 | status = |
104 | acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state), | 76 | acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state), |
105 | ACPI_MAX_STATE_CACHE_DEPTH, | 77 | ACPI_MAX_STATE_CACHE_DEPTH, |
106 | &acpi_gbl_state_cache); | 78 | &acpi_gbl_state_cache); |
107 | if (ACPI_FAILURE(status)) { | 79 | if (ACPI_FAILURE(status)) { |
@@ -109,7 +81,7 @@ acpi_status acpi_ut_create_caches(void) | |||
109 | } | 81 | } |
110 | 82 | ||
111 | status = | 83 | status = |
112 | acpi_os_create_cache("acpi_parse", | 84 | acpi_os_create_cache("Acpi-Parse", |
113 | sizeof(struct acpi_parse_obj_common), | 85 | sizeof(struct acpi_parse_obj_common), |
114 | ACPI_MAX_PARSE_CACHE_DEPTH, | 86 | ACPI_MAX_PARSE_CACHE_DEPTH, |
115 | &acpi_gbl_ps_node_cache); | 87 | &acpi_gbl_ps_node_cache); |
@@ -118,7 +90,7 @@ acpi_status acpi_ut_create_caches(void) | |||
118 | } | 90 | } |
119 | 91 | ||
120 | status = | 92 | status = |
121 | acpi_os_create_cache("acpi_parse_ext", | 93 | acpi_os_create_cache("Acpi-ParseExt", |
122 | sizeof(struct acpi_parse_obj_named), | 94 | sizeof(struct acpi_parse_obj_named), |
123 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, | 95 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, |
124 | &acpi_gbl_ps_node_ext_cache); | 96 | &acpi_gbl_ps_node_ext_cache); |
@@ -127,7 +99,7 @@ acpi_status acpi_ut_create_caches(void) | |||
127 | } | 99 | } |
128 | 100 | ||
129 | status = | 101 | status = |
130 | acpi_os_create_cache("acpi_operand", | 102 | acpi_os_create_cache("Acpi-Operand", |
131 | sizeof(union acpi_operand_object), | 103 | sizeof(union acpi_operand_object), |
132 | ACPI_MAX_OBJECT_CACHE_DEPTH, | 104 | ACPI_MAX_OBJECT_CACHE_DEPTH, |
133 | &acpi_gbl_operand_cache); | 105 | &acpi_gbl_operand_cache); |
@@ -135,6 +107,24 @@ acpi_status acpi_ut_create_caches(void) | |||
135 | return (status); | 107 | return (status); |
136 | } | 108 | } |
137 | 109 | ||
110 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
111 | |||
112 | /* Memory allocation lists */ | ||
113 | |||
114 | status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); | ||
115 | if (ACPI_FAILURE(status)) { | ||
116 | return (status); | ||
117 | } | ||
118 | |||
119 | status = | ||
120 | acpi_ut_create_list("Acpi-Namespace", | ||
121 | sizeof(struct acpi_namespace_node), | ||
122 | &acpi_gbl_ns_node_list); | ||
123 | if (ACPI_FAILURE(status)) { | ||
124 | return (status); | ||
125 | } | ||
126 | #endif | ||
127 | |||
138 | return (AE_OK); | 128 | return (AE_OK); |
139 | } | 129 | } |
140 | 130 | ||
@@ -153,6 +143,9 @@ acpi_status acpi_ut_create_caches(void) | |||
153 | acpi_status acpi_ut_delete_caches(void) | 143 | acpi_status acpi_ut_delete_caches(void) |
154 | { | 144 | { |
155 | 145 | ||
146 | (void)acpi_os_delete_cache(acpi_gbl_namespace_cache); | ||
147 | acpi_gbl_namespace_cache = NULL; | ||
148 | |||
156 | (void)acpi_os_delete_cache(acpi_gbl_state_cache); | 149 | (void)acpi_os_delete_cache(acpi_gbl_state_cache); |
157 | acpi_gbl_state_cache = NULL; | 150 | acpi_gbl_state_cache = NULL; |
158 | 151 | ||
@@ -165,6 +158,21 @@ acpi_status acpi_ut_delete_caches(void) | |||
165 | (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); | 158 | (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); |
166 | acpi_gbl_ps_node_ext_cache = NULL; | 159 | acpi_gbl_ps_node_ext_cache = NULL; |
167 | 160 | ||
161 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
162 | |||
163 | /* Debug only - display leftover memory allocation, if any */ | ||
164 | |||
165 | acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); | ||
166 | |||
167 | /* Free memory lists */ | ||
168 | |||
169 | acpi_os_free(acpi_gbl_global_list); | ||
170 | acpi_gbl_global_list = NULL; | ||
171 | |||
172 | acpi_os_free(acpi_gbl_ns_node_list); | ||
173 | acpi_gbl_ns_node_list = NULL; | ||
174 | #endif | ||
175 | |||
168 | return (AE_OK); | 176 | return (AE_OK); |
169 | } | 177 | } |
170 | 178 | ||
@@ -252,7 +260,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
252 | 260 | ||
253 | /* Allocate a new buffer with local interface to allow tracking */ | 261 | /* Allocate a new buffer with local interface to allow tracking */ |
254 | 262 | ||
255 | buffer->pointer = ACPI_MEM_CALLOCATE(required_length); | 263 | buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length); |
256 | if (!buffer->pointer) { | 264 | if (!buffer->pointer) { |
257 | return (AE_NO_MEMORY); | 265 | return (AE_NO_MEMORY); |
258 | } | 266 | } |
@@ -288,7 +296,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
288 | * | 296 | * |
289 | * RETURN: Address of the allocated memory on success, NULL on failure. | 297 | * RETURN: Address of the allocated memory on success, NULL on failure. |
290 | * | 298 | * |
291 | * DESCRIPTION: The subsystem's equivalent of malloc. | 299 | * DESCRIPTION: Subsystem equivalent of malloc. |
292 | * | 300 | * |
293 | ******************************************************************************/ | 301 | ******************************************************************************/ |
294 | 302 | ||
@@ -296,23 +304,23 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
296 | { | 304 | { |
297 | void *allocation; | 305 | void *allocation; |
298 | 306 | ||
299 | ACPI_FUNCTION_TRACE_U32("ut_allocate", size); | 307 | ACPI_FUNCTION_TRACE_U32(ut_allocate, size); |
300 | 308 | ||
301 | /* Check for an inadvertent size of zero bytes */ | 309 | /* Check for an inadvertent size of zero bytes */ |
302 | 310 | ||
303 | if (!size) { | 311 | if (!size) { |
304 | ACPI_ERROR((module, line, | 312 | ACPI_WARNING((module, line, |
305 | "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); | 313 | "Attempt to allocate zero bytes, allocating 1 byte")); |
306 | size = 1; | 314 | size = 1; |
307 | } | 315 | } |
308 | 316 | ||
309 | allocation = acpi_os_allocate(size); | 317 | allocation = acpi_os_allocate(size); |
310 | if (!allocation) { | 318 | if (!allocation) { |
319 | |||
311 | /* Report allocation error */ | 320 | /* Report allocation error */ |
312 | 321 | ||
313 | ACPI_ERROR((module, line, | 322 | ACPI_WARNING((module, line, |
314 | "ut_allocate: Could not allocate size %X", | 323 | "Could not allocate size %X", (u32) size)); |
315 | (u32) size)); | ||
316 | 324 | ||
317 | return_PTR(NULL); | 325 | return_PTR(NULL); |
318 | } | 326 | } |
@@ -322,7 +330,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
322 | 330 | ||
323 | /******************************************************************************* | 331 | /******************************************************************************* |
324 | * | 332 | * |
325 | * FUNCTION: acpi_ut_callocate | 333 | * FUNCTION: acpi_ut_allocate_zeroed |
326 | * | 334 | * |
327 | * PARAMETERS: Size - Size of the allocation | 335 | * PARAMETERS: Size - Size of the allocation |
328 | * Component - Component type of caller | 336 | * Component - Component type of caller |
@@ -331,542 +339,24 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
331 | * | 339 | * |
332 | * RETURN: Address of the allocated memory on success, NULL on failure. | 340 | * RETURN: Address of the allocated memory on success, NULL on failure. |
333 | * | 341 | * |
334 | * DESCRIPTION: Subsystem equivalent of calloc. | 342 | * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. |
335 | * | 343 | * |
336 | ******************************************************************************/ | 344 | ******************************************************************************/ |
337 | 345 | ||
338 | void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) | 346 | void *acpi_ut_allocate_zeroed(acpi_size size, |
347 | u32 component, char *module, u32 line) | ||
339 | { | 348 | { |
340 | void *allocation; | 349 | void *allocation; |
341 | 350 | ||
342 | ACPI_FUNCTION_TRACE_U32("ut_callocate", size); | ||
343 | |||
344 | /* Check for an inadvertent size of zero bytes */ | ||
345 | |||
346 | if (!size) { | ||
347 | ACPI_ERROR((module, line, | ||
348 | "Attempt to allocate zero bytes, allocating 1 byte")); | ||
349 | size = 1; | ||
350 | } | ||
351 | |||
352 | allocation = acpi_os_allocate(size); | ||
353 | if (!allocation) { | ||
354 | /* Report allocation error */ | ||
355 | |||
356 | ACPI_ERROR((module, line, | ||
357 | "Could not allocate size %X", (u32) size)); | ||
358 | return_PTR(NULL); | ||
359 | } | ||
360 | |||
361 | /* Clear the memory block */ | ||
362 | |||
363 | ACPI_MEMSET(allocation, 0, size); | ||
364 | return_PTR(allocation); | ||
365 | } | ||
366 | |||
367 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
368 | /* | ||
369 | * These procedures are used for tracking memory leaks in the subsystem, and | ||
370 | * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set. | ||
371 | * | ||
372 | * Each memory allocation is tracked via a doubly linked list. Each | ||
373 | * element contains the caller's component, module name, function name, and | ||
374 | * line number. acpi_ut_allocate and acpi_ut_callocate call | ||
375 | * acpi_ut_track_allocation to add an element to the list; deletion | ||
376 | * occurs in the body of acpi_ut_free. | ||
377 | */ | ||
378 | |||
379 | /******************************************************************************* | ||
380 | * | ||
381 | * FUNCTION: acpi_ut_create_list | ||
382 | * | ||
383 | * PARAMETERS: cache_name - Ascii name for the cache | ||
384 | * object_size - Size of each cached object | ||
385 | * return_cache - Where the new cache object is returned | ||
386 | * | ||
387 | * RETURN: Status | ||
388 | * | ||
389 | * DESCRIPTION: Create a local memory list for tracking purposed | ||
390 | * | ||
391 | ******************************************************************************/ | ||
392 | |||
393 | static acpi_status | ||
394 | acpi_ut_create_list(char *list_name, | ||
395 | u16 object_size, struct acpi_memory_list **return_cache) | ||
396 | { | ||
397 | struct acpi_memory_list *cache; | ||
398 | |||
399 | cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); | ||
400 | if (!cache) { | ||
401 | return (AE_NO_MEMORY); | ||
402 | } | ||
403 | |||
404 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); | ||
405 | |||
406 | cache->list_name = list_name; | ||
407 | cache->object_size = object_size; | ||
408 | |||
409 | *return_cache = cache; | ||
410 | return (AE_OK); | ||
411 | } | ||
412 | |||
413 | /******************************************************************************* | ||
414 | * | ||
415 | * FUNCTION: acpi_ut_allocate_and_track | ||
416 | * | ||
417 | * PARAMETERS: Size - Size of the allocation | ||
418 | * Component - Component type of caller | ||
419 | * Module - Source file name of caller | ||
420 | * Line - Line number of caller | ||
421 | * | ||
422 | * RETURN: Address of the allocated memory on success, NULL on failure. | ||
423 | * | ||
424 | * DESCRIPTION: The subsystem's equivalent of malloc. | ||
425 | * | ||
426 | ******************************************************************************/ | ||
427 | |||
428 | void *acpi_ut_allocate_and_track(acpi_size size, | ||
429 | u32 component, char *module, u32 line) | ||
430 | { | ||
431 | struct acpi_debug_mem_block *allocation; | ||
432 | acpi_status status; | ||
433 | |||
434 | allocation = | ||
435 | acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), | ||
436 | component, module, line); | ||
437 | if (!allocation) { | ||
438 | return (NULL); | ||
439 | } | ||
440 | |||
441 | status = acpi_ut_track_allocation(allocation, size, | ||
442 | ACPI_MEM_MALLOC, component, module, | ||
443 | line); | ||
444 | if (ACPI_FAILURE(status)) { | ||
445 | acpi_os_free(allocation); | ||
446 | return (NULL); | ||
447 | } | ||
448 | |||
449 | acpi_gbl_global_list->total_allocated++; | ||
450 | acpi_gbl_global_list->current_total_size += (u32) size; | ||
451 | |||
452 | return ((void *)&allocation->user_space); | ||
453 | } | ||
454 | |||
455 | /******************************************************************************* | ||
456 | * | ||
457 | * FUNCTION: acpi_ut_callocate_and_track | ||
458 | * | ||
459 | * PARAMETERS: Size - Size of the allocation | ||
460 | * Component - Component type of caller | ||
461 | * Module - Source file name of caller | ||
462 | * Line - Line number of caller | ||
463 | * | ||
464 | * RETURN: Address of the allocated memory on success, NULL on failure. | ||
465 | * | ||
466 | * DESCRIPTION: Subsystem equivalent of calloc. | ||
467 | * | ||
468 | ******************************************************************************/ | ||
469 | |||
470 | void *acpi_ut_callocate_and_track(acpi_size size, | ||
471 | u32 component, char *module, u32 line) | ||
472 | { | ||
473 | struct acpi_debug_mem_block *allocation; | ||
474 | acpi_status status; | ||
475 | |||
476 | allocation = | ||
477 | acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), | ||
478 | component, module, line); | ||
479 | if (!allocation) { | ||
480 | /* Report allocation error */ | ||
481 | |||
482 | ACPI_ERROR((module, line, | ||
483 | "Could not allocate size %X", (u32) size)); | ||
484 | return (NULL); | ||
485 | } | ||
486 | |||
487 | status = acpi_ut_track_allocation(allocation, size, | ||
488 | ACPI_MEM_CALLOC, component, module, | ||
489 | line); | ||
490 | if (ACPI_FAILURE(status)) { | ||
491 | acpi_os_free(allocation); | ||
492 | return (NULL); | ||
493 | } | ||
494 | |||
495 | acpi_gbl_global_list->total_allocated++; | ||
496 | acpi_gbl_global_list->current_total_size += (u32) size; | ||
497 | |||
498 | return ((void *)&allocation->user_space); | ||
499 | } | ||
500 | |||
501 | /******************************************************************************* | ||
502 | * | ||
503 | * FUNCTION: acpi_ut_free_and_track | ||
504 | * | ||
505 | * PARAMETERS: Allocation - Address of the memory to deallocate | ||
506 | * Component - Component type of caller | ||
507 | * Module - Source file name of caller | ||
508 | * Line - Line number of caller | ||
509 | * | ||
510 | * RETURN: None | ||
511 | * | ||
512 | * DESCRIPTION: Frees the memory at Allocation | ||
513 | * | ||
514 | ******************************************************************************/ | ||
515 | |||
516 | void | ||
517 | acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) | ||
518 | { | ||
519 | struct acpi_debug_mem_block *debug_block; | ||
520 | acpi_status status; | ||
521 | |||
522 | ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); | ||
523 | |||
524 | if (NULL == allocation) { | ||
525 | ACPI_ERROR((module, line, "Attempt to delete a NULL address")); | ||
526 | |||
527 | return_VOID; | ||
528 | } | ||
529 | |||
530 | debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block, | ||
531 | (((char *)allocation) - | ||
532 | sizeof(struct acpi_debug_mem_header))); | ||
533 | |||
534 | acpi_gbl_global_list->total_freed++; | ||
535 | acpi_gbl_global_list->current_total_size -= debug_block->size; | ||
536 | |||
537 | status = acpi_ut_remove_allocation(debug_block, | ||
538 | component, module, line); | ||
539 | if (ACPI_FAILURE(status)) { | ||
540 | ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); | ||
541 | } | ||
542 | |||
543 | acpi_os_free(debug_block); | ||
544 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); | ||
545 | return_VOID; | ||
546 | } | ||
547 | |||
548 | /******************************************************************************* | ||
549 | * | ||
550 | * FUNCTION: acpi_ut_find_allocation | ||
551 | * | ||
552 | * PARAMETERS: Allocation - Address of allocated memory | ||
553 | * | ||
554 | * RETURN: A list element if found; NULL otherwise. | ||
555 | * | ||
556 | * DESCRIPTION: Searches for an element in the global allocation tracking list. | ||
557 | * | ||
558 | ******************************************************************************/ | ||
559 | |||
560 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation) | ||
561 | { | ||
562 | struct acpi_debug_mem_block *element; | ||
563 | |||
564 | ACPI_FUNCTION_ENTRY(); | 351 | ACPI_FUNCTION_ENTRY(); |
565 | 352 | ||
566 | element = acpi_gbl_global_list->list_head; | 353 | allocation = acpi_ut_allocate(size, component, module, line); |
567 | 354 | if (allocation) { | |
568 | /* Search for the address. */ | ||
569 | |||
570 | while (element) { | ||
571 | if (element == allocation) { | ||
572 | return (element); | ||
573 | } | ||
574 | |||
575 | element = element->next; | ||
576 | } | ||
577 | |||
578 | return (NULL); | ||
579 | } | ||
580 | |||
581 | /******************************************************************************* | ||
582 | * | ||
583 | * FUNCTION: acpi_ut_track_allocation | ||
584 | * | ||
585 | * PARAMETERS: Allocation - Address of allocated memory | ||
586 | * Size - Size of the allocation | ||
587 | * alloc_type - MEM_MALLOC or MEM_CALLOC | ||
588 | * Component - Component type of caller | ||
589 | * Module - Source file name of caller | ||
590 | * Line - Line number of caller | ||
591 | * | ||
592 | * RETURN: None. | ||
593 | * | ||
594 | * DESCRIPTION: Inserts an element into the global allocation tracking list. | ||
595 | * | ||
596 | ******************************************************************************/ | ||
597 | |||
598 | static acpi_status | ||
599 | acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, | ||
600 | acpi_size size, | ||
601 | u8 alloc_type, u32 component, char *module, u32 line) | ||
602 | { | ||
603 | struct acpi_memory_list *mem_list; | ||
604 | struct acpi_debug_mem_block *element; | ||
605 | acpi_status status = AE_OK; | ||
606 | |||
607 | ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation); | ||
608 | |||
609 | mem_list = acpi_gbl_global_list; | ||
610 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | ||
611 | if (ACPI_FAILURE(status)) { | ||
612 | return_ACPI_STATUS(status); | ||
613 | } | ||
614 | |||
615 | /* | ||
616 | * Search list for this address to make sure it is not already on the list. | ||
617 | * This will catch several kinds of problems. | ||
618 | */ | ||
619 | element = acpi_ut_find_allocation(allocation); | ||
620 | if (element) { | ||
621 | ACPI_ERROR((AE_INFO, | ||
622 | "ut_track_allocation: Allocation already present in list! (%p)", | ||
623 | allocation)); | ||
624 | |||
625 | ACPI_ERROR((AE_INFO, "Element %p Address %p", | ||
626 | element, allocation)); | ||
627 | |||
628 | goto unlock_and_exit; | ||
629 | } | ||
630 | |||
631 | /* Fill in the instance data. */ | ||
632 | |||
633 | allocation->size = (u32) size; | ||
634 | allocation->alloc_type = alloc_type; | ||
635 | allocation->component = component; | ||
636 | allocation->line = line; | ||
637 | |||
638 | ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); | ||
639 | allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; | ||
640 | |||
641 | /* Insert at list head */ | ||
642 | |||
643 | if (mem_list->list_head) { | ||
644 | ((struct acpi_debug_mem_block *)(mem_list->list_head))-> | ||
645 | previous = allocation; | ||
646 | } | ||
647 | |||
648 | allocation->next = mem_list->list_head; | ||
649 | allocation->previous = NULL; | ||
650 | |||
651 | mem_list->list_head = allocation; | ||
652 | |||
653 | unlock_and_exit: | ||
654 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
655 | return_ACPI_STATUS(status); | ||
656 | } | ||
657 | |||
658 | /******************************************************************************* | ||
659 | * | ||
660 | * FUNCTION: acpi_ut_remove_allocation | ||
661 | * | ||
662 | * PARAMETERS: Allocation - Address of allocated memory | ||
663 | * Component - Component type of caller | ||
664 | * Module - Source file name of caller | ||
665 | * Line - Line number of caller | ||
666 | * | ||
667 | * RETURN: | ||
668 | * | ||
669 | * DESCRIPTION: Deletes an element from the global allocation tracking list. | ||
670 | * | ||
671 | ******************************************************************************/ | ||
672 | |||
673 | static acpi_status | ||
674 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, | ||
675 | u32 component, char *module, u32 line) | ||
676 | { | ||
677 | struct acpi_memory_list *mem_list; | ||
678 | acpi_status status; | ||
679 | |||
680 | ACPI_FUNCTION_TRACE("ut_remove_allocation"); | ||
681 | |||
682 | mem_list = acpi_gbl_global_list; | ||
683 | if (NULL == mem_list->list_head) { | ||
684 | /* No allocations! */ | ||
685 | |||
686 | ACPI_ERROR((module, line, | ||
687 | "Empty allocation list, nothing to free!")); | ||
688 | |||
689 | return_ACPI_STATUS(AE_OK); | ||
690 | } | ||
691 | |||
692 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | ||
693 | if (ACPI_FAILURE(status)) { | ||
694 | return_ACPI_STATUS(status); | ||
695 | } | ||
696 | |||
697 | /* Unlink */ | ||
698 | |||
699 | if (allocation->previous) { | ||
700 | (allocation->previous)->next = allocation->next; | ||
701 | } else { | ||
702 | mem_list->list_head = allocation->next; | ||
703 | } | ||
704 | |||
705 | if (allocation->next) { | ||
706 | (allocation->next)->previous = allocation->previous; | ||
707 | } | ||
708 | |||
709 | /* Mark the segment as deleted */ | ||
710 | |||
711 | ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); | ||
712 | |||
713 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", | ||
714 | allocation->size)); | ||
715 | 355 | ||
716 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | 356 | /* Clear the memory block */ |
717 | return_ACPI_STATUS(status); | ||
718 | } | ||
719 | |||
720 | /******************************************************************************* | ||
721 | * | ||
722 | * FUNCTION: acpi_ut_dump_allocation_info | ||
723 | * | ||
724 | * PARAMETERS: | ||
725 | * | ||
726 | * RETURN: None | ||
727 | * | ||
728 | * DESCRIPTION: Print some info about the outstanding allocations. | ||
729 | * | ||
730 | ******************************************************************************/ | ||
731 | 357 | ||
732 | #ifdef ACPI_FUTURE_USAGE | 358 | ACPI_MEMSET(allocation, 0, size); |
733 | void acpi_ut_dump_allocation_info(void) | ||
734 | { | ||
735 | /* | ||
736 | struct acpi_memory_list *mem_list; | ||
737 | */ | ||
738 | |||
739 | ACPI_FUNCTION_TRACE("ut_dump_allocation_info"); | ||
740 | |||
741 | /* | ||
742 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
743 | ("%30s: %4d (%3d Kb)\n", "Current allocations", | ||
744 | mem_list->current_count, | ||
745 | ROUND_UP_TO_1K (mem_list->current_size))); | ||
746 | |||
747 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
748 | ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", | ||
749 | mem_list->max_concurrent_count, | ||
750 | ROUND_UP_TO_1K (mem_list->max_concurrent_size))); | ||
751 | |||
752 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
753 | ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", | ||
754 | running_object_count, | ||
755 | ROUND_UP_TO_1K (running_object_size))); | ||
756 | |||
757 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
758 | ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", | ||
759 | running_alloc_count, | ||
760 | ROUND_UP_TO_1K (running_alloc_size))); | ||
761 | |||
762 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
763 | ("%30s: %4d (%3d Kb)\n", "Current Nodes", | ||
764 | acpi_gbl_current_node_count, | ||
765 | ROUND_UP_TO_1K (acpi_gbl_current_node_size))); | ||
766 | |||
767 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
768 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", | ||
769 | acpi_gbl_max_concurrent_node_count, | ||
770 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * | ||
771 | sizeof (struct acpi_namespace_node))))); | ||
772 | */ | ||
773 | return_VOID; | ||
774 | } | ||
775 | #endif /* ACPI_FUTURE_USAGE */ | ||
776 | |||
777 | /******************************************************************************* | ||
778 | * | ||
779 | * FUNCTION: acpi_ut_dump_allocations | ||
780 | * | ||
781 | * PARAMETERS: Component - Component(s) to dump info for. | ||
782 | * Module - Module to dump info for. NULL means all. | ||
783 | * | ||
784 | * RETURN: None | ||
785 | * | ||
786 | * DESCRIPTION: Print a list of all outstanding allocations. | ||
787 | * | ||
788 | ******************************************************************************/ | ||
789 | |||
790 | void acpi_ut_dump_allocations(u32 component, char *module) | ||
791 | { | ||
792 | struct acpi_debug_mem_block *element; | ||
793 | union acpi_descriptor *descriptor; | ||
794 | u32 num_outstanding = 0; | ||
795 | |||
796 | ACPI_FUNCTION_TRACE("ut_dump_allocations"); | ||
797 | |||
798 | /* | ||
799 | * Walk the allocation list. | ||
800 | */ | ||
801 | if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) { | ||
802 | return; | ||
803 | } | 359 | } |
804 | 360 | ||
805 | element = acpi_gbl_global_list->list_head; | 361 | return (allocation); |
806 | while (element) { | ||
807 | if ((element->component & component) && | ||
808 | ((module == NULL) | ||
809 | || (0 == ACPI_STRCMP(module, element->module)))) { | ||
810 | /* Ignore allocated objects that are in a cache */ | ||
811 | |||
812 | descriptor = | ||
813 | ACPI_CAST_PTR(union acpi_descriptor, | ||
814 | &element->user_space); | ||
815 | if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { | ||
816 | acpi_os_printf("%p Len %04X %9.9s-%d [%s] ", | ||
817 | descriptor, element->size, | ||
818 | element->module, element->line, | ||
819 | acpi_ut_get_descriptor_name | ||
820 | (descriptor)); | ||
821 | |||
822 | /* Most of the elements will be Operand objects. */ | ||
823 | |||
824 | switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) { | ||
825 | case ACPI_DESC_TYPE_OPERAND: | ||
826 | acpi_os_printf("%12.12s R%hd", | ||
827 | acpi_ut_get_type_name | ||
828 | (descriptor->object. | ||
829 | common.type), | ||
830 | descriptor->object. | ||
831 | common.reference_count); | ||
832 | break; | ||
833 | |||
834 | case ACPI_DESC_TYPE_PARSER: | ||
835 | acpi_os_printf("aml_opcode %04hX", | ||
836 | descriptor->op.asl. | ||
837 | aml_opcode); | ||
838 | break; | ||
839 | |||
840 | case ACPI_DESC_TYPE_NAMED: | ||
841 | acpi_os_printf("%4.4s", | ||
842 | acpi_ut_get_node_name | ||
843 | (&descriptor->node)); | ||
844 | break; | ||
845 | |||
846 | default: | ||
847 | break; | ||
848 | } | ||
849 | |||
850 | acpi_os_printf("\n"); | ||
851 | num_outstanding++; | ||
852 | } | ||
853 | } | ||
854 | element = element->next; | ||
855 | } | ||
856 | |||
857 | (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
858 | |||
859 | /* Print summary */ | ||
860 | |||
861 | if (!num_outstanding) { | ||
862 | ACPI_INFO((AE_INFO, "No outstanding allocations")); | ||
863 | } else { | ||
864 | ACPI_ERROR((AE_INFO, | ||
865 | "%d(%X) Outstanding allocations", | ||
866 | num_outstanding, num_outstanding)); | ||
867 | } | ||
868 | |||
869 | return_VOID; | ||
870 | } | 362 | } |
871 | |||
872 | #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ | ||
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 2177cb1ef2c4..56270a30718a 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c | |||
@@ -118,13 +118,14 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) | |||
118 | /* Walk the list of objects in this cache */ | 118 | /* Walk the list of objects in this cache */ |
119 | 119 | ||
120 | while (cache->list_head) { | 120 | while (cache->list_head) { |
121 | |||
121 | /* Delete and unlink one cached state object */ | 122 | /* Delete and unlink one cached state object */ |
122 | 123 | ||
123 | next = *(ACPI_CAST_INDIRECT_PTR(char, | 124 | next = *(ACPI_CAST_INDIRECT_PTR(char, |
124 | &(((char *)cache-> | 125 | &(((char *)cache-> |
125 | list_head)[cache-> | 126 | list_head)[cache-> |
126 | link_offset]))); | 127 | link_offset]))); |
127 | ACPI_MEM_FREE(cache->list_head); | 128 | ACPI_FREE(cache->list_head); |
128 | 129 | ||
129 | cache->list_head = next; | 130 | cache->list_head = next; |
130 | cache->current_depth--; | 131 | cache->current_depth--; |
@@ -193,7 +194,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object) | |||
193 | /* If cache is full, just free this object */ | 194 | /* If cache is full, just free this object */ |
194 | 195 | ||
195 | if (cache->current_depth >= cache->max_depth) { | 196 | if (cache->current_depth >= cache->max_depth) { |
196 | ACPI_MEM_FREE(object); | 197 | ACPI_FREE(object); |
197 | ACPI_MEM_TRACKING(cache->total_freed++); | 198 | ACPI_MEM_TRACKING(cache->total_freed++); |
198 | } | 199 | } |
199 | 200 | ||
@@ -243,7 +244,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
243 | acpi_status status; | 244 | acpi_status status; |
244 | void *object; | 245 | void *object; |
245 | 246 | ||
246 | ACPI_FUNCTION_NAME("os_acquire_object"); | 247 | ACPI_FUNCTION_NAME(os_acquire_object); |
247 | 248 | ||
248 | if (!cache) { | 249 | if (!cache) { |
249 | return (NULL); | 250 | return (NULL); |
@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
259 | /* Check the cache first */ | 260 | /* Check the cache first */ |
260 | 261 | ||
261 | if (cache->list_head) { | 262 | if (cache->list_head) { |
263 | |||
262 | /* There is an object available, use it */ | 264 | /* There is an object available, use it */ |
263 | 265 | ||
264 | object = cache->list_head; | 266 | object = cache->list_head; |
@@ -270,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
270 | cache->current_depth--; | 272 | cache->current_depth--; |
271 | 273 | ||
272 | ACPI_MEM_TRACKING(cache->hits++); | 274 | ACPI_MEM_TRACKING(cache->hits++); |
273 | ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 275 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
274 | "Object %p from %s cache\n", | 276 | "Object %p from %s cache\n", object, |
275 | object, cache->list_name))); | 277 | cache->list_name)); |
276 | 278 | ||
277 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 279 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
278 | if (ACPI_FAILURE(status)) { | 280 | if (ACPI_FAILURE(status)) { |
@@ -287,14 +289,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
287 | 289 | ||
288 | ACPI_MEM_TRACKING(cache->total_allocated++); | 290 | ACPI_MEM_TRACKING(cache->total_allocated++); |
289 | 291 | ||
290 | /* Avoid deadlock with ACPI_MEM_CALLOCATE */ | 292 | /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ |
291 | 293 | ||
292 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 294 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
293 | if (ACPI_FAILURE(status)) { | 295 | if (ACPI_FAILURE(status)) { |
294 | return (NULL); | 296 | return (NULL); |
295 | } | 297 | } |
296 | 298 | ||
297 | object = ACPI_MEM_CALLOCATE(cache->object_size); | 299 | object = ACPI_ALLOCATE_ZEROED(cache->object_size); |
298 | if (!object) { | 300 | if (!object) { |
299 | return (NULL); | 301 | return (NULL); |
300 | } | 302 | } |
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index df2d32096b72..5e1a80d1bc36 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -109,7 +109,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, | |||
109 | { | 109 | { |
110 | acpi_status status = AE_OK; | 110 | acpi_status status = AE_OK; |
111 | 111 | ||
112 | ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple"); | 112 | ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple); |
113 | 113 | ||
114 | *buffer_space_used = 0; | 114 | *buffer_space_used = 0; |
115 | 115 | ||
@@ -325,7 +325,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, | |||
325 | acpi_status status; | 325 | acpi_status status; |
326 | struct acpi_pkg_info info; | 326 | struct acpi_pkg_info info; |
327 | 327 | ||
328 | ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage"); | 328 | ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage); |
329 | 329 | ||
330 | /* | 330 | /* |
331 | * First package at head of the buffer | 331 | * First package at head of the buffer |
@@ -383,7 +383,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, | |||
383 | { | 383 | { |
384 | acpi_status status; | 384 | acpi_status status; |
385 | 385 | ||
386 | ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject"); | 386 | ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject); |
387 | 387 | ||
388 | if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { | 388 | if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { |
389 | /* | 389 | /* |
@@ -442,7 +442,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
442 | { | 442 | { |
443 | union acpi_operand_object *internal_object; | 443 | union acpi_operand_object *internal_object; |
444 | 444 | ||
445 | ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple"); | 445 | ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple); |
446 | 446 | ||
447 | /* | 447 | /* |
448 | * Simple types supported are: String, Buffer, Integer | 448 | * Simple types supported are: String, Buffer, Integer |
@@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
472 | case ACPI_TYPE_STRING: | 472 | case ACPI_TYPE_STRING: |
473 | 473 | ||
474 | internal_object->string.pointer = | 474 | internal_object->string.pointer = |
475 | ACPI_MEM_CALLOCATE((acpi_size) external_object->string. | 475 | ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string. |
476 | length + 1); | 476 | length + 1); |
477 | if (!internal_object->string.pointer) { | 477 | if (!internal_object->string.pointer) { |
478 | goto error_exit; | 478 | goto error_exit; |
479 | } | 479 | } |
@@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
488 | case ACPI_TYPE_BUFFER: | 488 | case ACPI_TYPE_BUFFER: |
489 | 489 | ||
490 | internal_object->buffer.pointer = | 490 | internal_object->buffer.pointer = |
491 | ACPI_MEM_CALLOCATE(external_object->buffer.length); | 491 | ACPI_ALLOCATE_ZEROED(external_object->buffer.length); |
492 | if (!internal_object->buffer.pointer) { | 492 | if (!internal_object->buffer.pointer) { |
493 | goto error_exit; | 493 | goto error_exit; |
494 | } | 494 | } |
@@ -552,7 +552,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, | |||
552 | union acpi_operand_object *this_internal_obj; | 552 | union acpi_operand_object *this_internal_obj; |
553 | union acpi_object *this_external_obj; | 553 | union acpi_object *this_external_obj; |
554 | 554 | ||
555 | ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage"); | 555 | ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); |
556 | 556 | ||
557 | /* | 557 | /* |
558 | * First package at head of the buffer | 558 | * First package at head of the buffer |
@@ -600,7 +600,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, | |||
600 | { | 600 | { |
601 | acpi_status status; | 601 | acpi_status status; |
602 | 602 | ||
603 | ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject"); | 603 | ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); |
604 | 604 | ||
605 | if (external_object->type == ACPI_TYPE_PACKAGE) { | 605 | if (external_object->type == ACPI_TYPE_PACKAGE) { |
606 | /* | 606 | /* |
@@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
676 | if ((source_desc->buffer.pointer) && | 676 | if ((source_desc->buffer.pointer) && |
677 | (source_desc->buffer.length)) { | 677 | (source_desc->buffer.length)) { |
678 | dest_desc->buffer.pointer = | 678 | dest_desc->buffer.pointer = |
679 | ACPI_MEM_ALLOCATE(source_desc->buffer.length); | 679 | ACPI_ALLOCATE(source_desc->buffer.length); |
680 | if (!dest_desc->buffer.pointer) { | 680 | if (!dest_desc->buffer.pointer) { |
681 | return (AE_NO_MEMORY); | 681 | return (AE_NO_MEMORY); |
682 | } | 682 | } |
@@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
697 | */ | 697 | */ |
698 | if (source_desc->string.pointer) { | 698 | if (source_desc->string.pointer) { |
699 | dest_desc->string.pointer = | 699 | dest_desc->string.pointer = |
700 | ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. | 700 | ACPI_ALLOCATE((acpi_size) source_desc->string. |
701 | length + 1); | 701 | length + 1); |
702 | if (!dest_desc->string.pointer) { | 702 | if (!dest_desc->string.pointer) { |
703 | return (AE_NO_MEMORY); | 703 | return (AE_NO_MEMORY); |
704 | } | 704 | } |
@@ -805,9 +805,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type, | |||
805 | /* | 805 | /* |
806 | * Create the object array | 806 | * Create the object array |
807 | */ | 807 | */ |
808 | target_object->package.elements = | 808 | target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *)); |
809 | ACPI_MEM_CALLOCATE(((acpi_size) source_object->package. | ||
810 | count + 1) * sizeof(void *)); | ||
811 | if (!target_object->package.elements) { | 809 | if (!target_object->package.elements) { |
812 | status = AE_NO_MEMORY; | 810 | status = AE_NO_MEMORY; |
813 | goto error_exit; | 811 | goto error_exit; |
@@ -856,7 +854,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
856 | { | 854 | { |
857 | acpi_status status = AE_OK; | 855 | acpi_status status = AE_OK; |
858 | 856 | ||
859 | ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage"); | 857 | ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage); |
860 | 858 | ||
861 | dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); | 859 | dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); |
862 | dest_obj->common.flags = source_obj->common.flags; | 860 | dest_obj->common.flags = source_obj->common.flags; |
@@ -865,10 +863,10 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
865 | /* | 863 | /* |
866 | * Create the object array and walk the source package tree | 864 | * Create the object array and walk the source package tree |
867 | */ | 865 | */ |
868 | dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) | 866 | dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) |
869 | source_obj->package. | 867 | source_obj->package. |
870 | count + | 868 | count + |
871 | 1) * sizeof(void *)); | 869 | 1) * sizeof(void *)); |
872 | if (!dest_obj->package.elements) { | 870 | if (!dest_obj->package.elements) { |
873 | ACPI_ERROR((AE_INFO, "Package allocation failure")); | 871 | ACPI_ERROR((AE_INFO, "Package allocation failure")); |
874 | return_ACPI_STATUS(AE_NO_MEMORY); | 872 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -882,6 +880,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
882 | acpi_ut_copy_ielement_to_ielement, | 880 | acpi_ut_copy_ielement_to_ielement, |
883 | walk_state); | 881 | walk_state); |
884 | if (ACPI_FAILURE(status)) { | 882 | if (ACPI_FAILURE(status)) { |
883 | |||
885 | /* On failure, delete the destination package object */ | 884 | /* On failure, delete the destination package object */ |
886 | 885 | ||
887 | acpi_ut_remove_reference(dest_obj); | 886 | acpi_ut_remove_reference(dest_obj); |
@@ -911,7 +910,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, | |||
911 | { | 910 | { |
912 | acpi_status status = AE_OK; | 911 | acpi_status status = AE_OK; |
913 | 912 | ||
914 | ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject"); | 913 | ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject); |
915 | 914 | ||
916 | /* Create the top level object */ | 915 | /* Create the top level object */ |
917 | 916 | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 35f3d581e034..5ec1cfcc611d 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | 45 | ||
48 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
@@ -123,12 +121,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name) | |||
123 | /* All Function names are longer than 4 chars, check is safe */ | 121 | /* All Function names are longer than 4 chars, check is safe */ |
124 | 122 | ||
125 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { | 123 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { |
124 | |||
126 | /* This is the case where the original source has not been modified */ | 125 | /* This is the case where the original source has not been modified */ |
127 | 126 | ||
128 | return (function_name + 4); | 127 | return (function_name + 4); |
129 | } | 128 | } |
130 | 129 | ||
131 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { | 130 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { |
131 | |||
132 | /* This is the case where the source has been 'linuxized' */ | 132 | /* This is the case where the source has been 'linuxized' */ |
133 | 133 | ||
134 | return (function_name + 5); | 134 | return (function_name + 5); |
@@ -162,7 +162,7 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
162 | const char *function_name, | 162 | const char *function_name, |
163 | char *module_name, u32 component_id, char *format, ...) | 163 | char *module_name, u32 component_id, char *format, ...) |
164 | { | 164 | { |
165 | u32 thread_id; | 165 | acpi_thread_id thread_id; |
166 | va_list args; | 166 | va_list args; |
167 | 167 | ||
168 | /* | 168 | /* |
@@ -177,7 +177,6 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
177 | * Thread tracking and context switch notification | 177 | * Thread tracking and context switch notification |
178 | */ | 178 | */ |
179 | thread_id = acpi_os_get_thread_id(); | 179 | thread_id = acpi_os_get_thread_id(); |
180 | |||
181 | if (thread_id != acpi_gbl_prev_thread_id) { | 180 | if (thread_id != acpi_gbl_prev_thread_id) { |
182 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 181 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
183 | acpi_os_printf | 182 | acpi_os_printf |
@@ -206,7 +205,7 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
206 | acpi_os_vprintf(format, args); | 205 | acpi_os_vprintf(format, args); |
207 | } | 206 | } |
208 | 207 | ||
209 | EXPORT_SYMBOL(acpi_ut_debug_print); | 208 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) |
210 | 209 | ||
211 | /******************************************************************************* | 210 | /******************************************************************************* |
212 | * | 211 | * |
@@ -226,7 +225,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print); | |||
226 | * debug_print so that the same macros can be used. | 225 | * debug_print so that the same macros can be used. |
227 | * | 226 | * |
228 | ******************************************************************************/ | 227 | ******************************************************************************/ |
229 | |||
230 | void ACPI_INTERNAL_VAR_XFACE | 228 | void ACPI_INTERNAL_VAR_XFACE |
231 | acpi_ut_debug_print_raw(u32 requested_debug_level, | 229 | acpi_ut_debug_print_raw(u32 requested_debug_level, |
232 | u32 line_number, | 230 | u32 line_number, |
@@ -244,7 +242,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, | |||
244 | acpi_os_vprintf(format, args); | 242 | acpi_os_vprintf(format, args); |
245 | } | 243 | } |
246 | 244 | ||
247 | EXPORT_SYMBOL(acpi_ut_debug_print_raw); | 245 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) |
248 | 246 | ||
249 | /******************************************************************************* | 247 | /******************************************************************************* |
250 | * | 248 | * |
@@ -261,7 +259,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); | |||
261 | * set in debug_level | 259 | * set in debug_level |
262 | * | 260 | * |
263 | ******************************************************************************/ | 261 | ******************************************************************************/ |
264 | |||
265 | void | 262 | void |
266 | acpi_ut_trace(u32 line_number, | 263 | acpi_ut_trace(u32 line_number, |
267 | const char *function_name, char *module_name, u32 component_id) | 264 | const char *function_name, char *module_name, u32 component_id) |
@@ -275,7 +272,7 @@ acpi_ut_trace(u32 line_number, | |||
275 | component_id, "%s\n", acpi_gbl_fn_entry_str); | 272 | component_id, "%s\n", acpi_gbl_fn_entry_str); |
276 | } | 273 | } |
277 | 274 | ||
278 | EXPORT_SYMBOL(acpi_ut_trace); | 275 | ACPI_EXPORT_SYMBOL(acpi_ut_trace) |
279 | 276 | ||
280 | /******************************************************************************* | 277 | /******************************************************************************* |
281 | * | 278 | * |
@@ -293,7 +290,6 @@ EXPORT_SYMBOL(acpi_ut_trace); | |||
293 | * set in debug_level | 290 | * set in debug_level |
294 | * | 291 | * |
295 | ******************************************************************************/ | 292 | ******************************************************************************/ |
296 | |||
297 | void | 293 | void |
298 | acpi_ut_trace_ptr(u32 line_number, | 294 | acpi_ut_trace_ptr(u32 line_number, |
299 | const char *function_name, | 295 | const char *function_name, |
@@ -400,7 +396,7 @@ acpi_ut_exit(u32 line_number, | |||
400 | acpi_gbl_nesting_level--; | 396 | acpi_gbl_nesting_level--; |
401 | } | 397 | } |
402 | 398 | ||
403 | EXPORT_SYMBOL(acpi_ut_exit); | 399 | ACPI_EXPORT_SYMBOL(acpi_ut_exit) |
404 | 400 | ||
405 | /******************************************************************************* | 401 | /******************************************************************************* |
406 | * | 402 | * |
@@ -418,7 +414,6 @@ EXPORT_SYMBOL(acpi_ut_exit); | |||
418 | * set in debug_level. Prints exit status also. | 414 | * set in debug_level. Prints exit status also. |
419 | * | 415 | * |
420 | ******************************************************************************/ | 416 | ******************************************************************************/ |
421 | |||
422 | void | 417 | void |
423 | acpi_ut_status_exit(u32 line_number, | 418 | acpi_ut_status_exit(u32 line_number, |
424 | const char *function_name, | 419 | const char *function_name, |
@@ -442,7 +437,7 @@ acpi_ut_status_exit(u32 line_number, | |||
442 | acpi_gbl_nesting_level--; | 437 | acpi_gbl_nesting_level--; |
443 | } | 438 | } |
444 | 439 | ||
445 | EXPORT_SYMBOL(acpi_ut_status_exit); | 440 | ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) |
446 | 441 | ||
447 | /******************************************************************************* | 442 | /******************************************************************************* |
448 | * | 443 | * |
@@ -460,7 +455,6 @@ EXPORT_SYMBOL(acpi_ut_status_exit); | |||
460 | * set in debug_level. Prints exit value also. | 455 | * set in debug_level. Prints exit value also. |
461 | * | 456 | * |
462 | ******************************************************************************/ | 457 | ******************************************************************************/ |
463 | |||
464 | void | 458 | void |
465 | acpi_ut_value_exit(u32 line_number, | 459 | acpi_ut_value_exit(u32 line_number, |
466 | const char *function_name, | 460 | const char *function_name, |
@@ -475,7 +469,7 @@ acpi_ut_value_exit(u32 line_number, | |||
475 | acpi_gbl_nesting_level--; | 469 | acpi_gbl_nesting_level--; |
476 | } | 470 | } |
477 | 471 | ||
478 | EXPORT_SYMBOL(acpi_ut_value_exit); | 472 | ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) |
479 | 473 | ||
480 | /******************************************************************************* | 474 | /******************************************************************************* |
481 | * | 475 | * |
@@ -493,7 +487,6 @@ EXPORT_SYMBOL(acpi_ut_value_exit); | |||
493 | * set in debug_level. Prints exit value also. | 487 | * set in debug_level. Prints exit value also. |
494 | * | 488 | * |
495 | ******************************************************************************/ | 489 | ******************************************************************************/ |
496 | |||
497 | void | 490 | void |
498 | acpi_ut_ptr_exit(u32 line_number, | 491 | acpi_ut_ptr_exit(u32 line_number, |
499 | const char *function_name, | 492 | const char *function_name, |
@@ -524,20 +517,13 @@ acpi_ut_ptr_exit(u32 line_number, | |||
524 | * | 517 | * |
525 | ******************************************************************************/ | 518 | ******************************************************************************/ |
526 | 519 | ||
527 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | 520 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) |
528 | { | 521 | { |
529 | acpi_native_uint i = 0; | 522 | acpi_native_uint i = 0; |
530 | acpi_native_uint j; | 523 | acpi_native_uint j; |
531 | u32 temp32; | 524 | u32 temp32; |
532 | u8 buf_char; | 525 | u8 buf_char; |
533 | 526 | ||
534 | /* Only dump the buffer if tracing is enabled */ | ||
535 | |||
536 | if (!((ACPI_LV_TABLES & acpi_dbg_level) && | ||
537 | (component_id & acpi_dbg_layer))) { | ||
538 | return; | ||
539 | } | ||
540 | |||
541 | if ((count < 4) || (count & 0x01)) { | 527 | if ((count < 4) || (count & 0x01)) { |
542 | display = DB_BYTE_DISPLAY; | 528 | display = DB_BYTE_DISPLAY; |
543 | } | 529 | } |
@@ -545,6 +531,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
545 | /* Nasty little dump buffer routine! */ | 531 | /* Nasty little dump buffer routine! */ |
546 | 532 | ||
547 | while (i < count) { | 533 | while (i < count) { |
534 | |||
548 | /* Print current offset */ | 535 | /* Print current offset */ |
549 | 536 | ||
550 | acpi_os_printf("%6.4X: ", (u32) i); | 537 | acpi_os_printf("%6.4X: ", (u32) i); |
@@ -553,6 +540,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
553 | 540 | ||
554 | for (j = 0; j < 16;) { | 541 | for (j = 0; j < 16;) { |
555 | if (i + j >= count) { | 542 | if (i + j >= count) { |
543 | |||
556 | /* Dump fill spaces */ | 544 | /* Dump fill spaces */ |
557 | 545 | ||
558 | acpi_os_printf("%*s", ((display * 2) + 1), " "); | 546 | acpi_os_printf("%*s", ((display * 2) + 1), " "); |
@@ -561,6 +549,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
561 | } | 549 | } |
562 | 550 | ||
563 | switch (display) { | 551 | switch (display) { |
552 | case DB_BYTE_DISPLAY: | ||
564 | default: /* Default is BYTE display */ | 553 | default: /* Default is BYTE display */ |
565 | 554 | ||
566 | acpi_os_printf("%02X ", buffer[i + j]); | 555 | acpi_os_printf("%02X ", buffer[i + j]); |
@@ -618,3 +607,31 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
618 | 607 | ||
619 | return; | 608 | return; |
620 | } | 609 | } |
610 | |||
611 | /******************************************************************************* | ||
612 | * | ||
613 | * FUNCTION: acpi_ut_dump_buffer | ||
614 | * | ||
615 | * PARAMETERS: Buffer - Buffer to dump | ||
616 | * Count - Amount to dump, in bytes | ||
617 | * Display - BYTE, WORD, DWORD, or QWORD display | ||
618 | * component_iD - Caller's component ID | ||
619 | * | ||
620 | * RETURN: None | ||
621 | * | ||
622 | * DESCRIPTION: Generic dump buffer in both hex and ascii. | ||
623 | * | ||
624 | ******************************************************************************/ | ||
625 | |||
626 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | ||
627 | { | ||
628 | |||
629 | /* Only dump the buffer if tracing is enabled */ | ||
630 | |||
631 | if (!((ACPI_LV_TABLES & acpi_dbg_level) && | ||
632 | (component_id & acpi_dbg_layer))) { | ||
633 | return; | ||
634 | } | ||
635 | |||
636 | acpi_ut_dump_buffer2(buffer, count, display); | ||
637 | } | ||
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 1db9695b0029..67b9f325c6fa 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
76 | union acpi_operand_object *second_desc; | 76 | union acpi_operand_object *second_desc; |
77 | union acpi_operand_object *next_desc; | 77 | union acpi_operand_object *next_desc; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); | 79 | ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); |
80 | 80 | ||
81 | if (!object) { | 81 | if (!object) { |
82 | return_VOID; | 82 | return_VOID; |
@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
96 | /* Free the actual string buffer */ | 96 | /* Free the actual string buffer */ |
97 | 97 | ||
98 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { | 98 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { |
99 | |||
99 | /* But only if it is NOT a pointer into an ACPI table */ | 100 | /* But only if it is NOT a pointer into an ACPI table */ |
100 | 101 | ||
101 | obj_pointer = object->string.pointer; | 102 | obj_pointer = object->string.pointer; |
@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
111 | /* Free the actual buffer */ | 112 | /* Free the actual buffer */ |
112 | 113 | ||
113 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { | 114 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { |
115 | |||
114 | /* But only if it is NOT a pointer into an ACPI table */ | 116 | /* But only if it is NOT a pointer into an ACPI table */ |
115 | 117 | ||
116 | obj_pointer = object->buffer.pointer; | 118 | obj_pointer = object->buffer.pointer; |
@@ -198,11 +200,22 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
198 | */ | 200 | */ |
199 | handler_desc = object->region.handler; | 201 | handler_desc = object->region.handler; |
200 | if (handler_desc) { | 202 | if (handler_desc) { |
201 | if (handler_desc->address_space. | 203 | if (handler_desc->address_space.handler_flags & |
202 | hflags & | ||
203 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | 204 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { |
204 | obj_pointer = | 205 | |
205 | second_desc->extra.region_context; | 206 | /* Deactivate region and free region context */ |
207 | |||
208 | if (handler_desc->address_space.setup) { | ||
209 | (void)handler_desc-> | ||
210 | address_space.setup(object, | ||
211 | ACPI_REGION_DEACTIVATE, | ||
212 | handler_desc-> | ||
213 | address_space. | ||
214 | context, | ||
215 | &second_desc-> | ||
216 | extra. | ||
217 | region_context); | ||
218 | } | ||
206 | } | 219 | } |
207 | 220 | ||
208 | acpi_ut_remove_reference(handler_desc); | 221 | acpi_ut_remove_reference(handler_desc); |
@@ -234,7 +247,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
234 | if (obj_pointer) { | 247 | if (obj_pointer) { |
235 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 248 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
236 | "Deleting Object Subptr %p\n", obj_pointer)); | 249 | "Deleting Object Subptr %p\n", obj_pointer)); |
237 | ACPI_MEM_FREE(obj_pointer); | 250 | ACPI_FREE(obj_pointer); |
238 | } | 251 | } |
239 | 252 | ||
240 | /* Now the object can be safely deleted */ | 253 | /* Now the object can be safely deleted */ |
@@ -263,7 +276,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
263 | { | 276 | { |
264 | union acpi_operand_object **internal_obj; | 277 | union acpi_operand_object **internal_obj; |
265 | 278 | ||
266 | ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); | 279 | ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); |
267 | 280 | ||
268 | /* Walk the null-terminated internal list */ | 281 | /* Walk the null-terminated internal list */ |
269 | 282 | ||
@@ -273,7 +286,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
273 | 286 | ||
274 | /* Free the combined parameter pointer list and object array */ | 287 | /* Free the combined parameter pointer list and object array */ |
275 | 288 | ||
276 | ACPI_MEM_FREE(obj_list); | 289 | ACPI_FREE(obj_list); |
277 | return_VOID; | 290 | return_VOID; |
278 | } | 291 | } |
279 | 292 | ||
@@ -296,7 +309,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
296 | u16 count; | 309 | u16 count; |
297 | u16 new_count; | 310 | u16 new_count; |
298 | 311 | ||
299 | ACPI_FUNCTION_NAME("ut_update_ref_count"); | 312 | ACPI_FUNCTION_NAME(ut_update_ref_count); |
300 | 313 | ||
301 | if (!object) { | 314 | if (!object) { |
302 | return; | 315 | return; |
@@ -306,11 +319,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
306 | new_count = count; | 319 | new_count = count; |
307 | 320 | ||
308 | /* | 321 | /* |
309 | * Perform the reference count action | 322 | * Perform the reference count action (increment, decrement, force delete) |
310 | * (increment, decrement, or force delete) | ||
311 | */ | 323 | */ |
312 | switch (action) { | 324 | switch (action) { |
313 | |||
314 | case REF_INCREMENT: | 325 | case REF_INCREMENT: |
315 | 326 | ||
316 | new_count++; | 327 | new_count++; |
@@ -347,7 +358,6 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
347 | if (new_count == 0) { | 358 | if (new_count == 0) { |
348 | acpi_ut_delete_internal_obj(object); | 359 | acpi_ut_delete_internal_obj(object); |
349 | } | 360 | } |
350 | |||
351 | break; | 361 | break; |
352 | 362 | ||
353 | case REF_FORCE_DELETE: | 363 | case REF_FORCE_DELETE: |
@@ -372,13 +382,10 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
372 | * (A deleted object will have a huge reference count) | 382 | * (A deleted object will have a huge reference count) |
373 | */ | 383 | */ |
374 | if (count > ACPI_MAX_REFERENCE_COUNT) { | 384 | if (count > ACPI_MAX_REFERENCE_COUNT) { |
375 | |||
376 | ACPI_WARNING((AE_INFO, | 385 | ACPI_WARNING((AE_INFO, |
377 | "Large Reference Count (%X) in object %p", | 386 | "Large Reference Count (%X) in object %p", count, |
378 | count, object)); | 387 | object)); |
379 | } | 388 | } |
380 | |||
381 | return; | ||
382 | } | 389 | } |
383 | 390 | ||
384 | /******************************************************************************* | 391 | /******************************************************************************* |
@@ -404,7 +411,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
404 | ******************************************************************************/ | 411 | ******************************************************************************/ |
405 | 412 | ||
406 | acpi_status | 413 | acpi_status |
407 | acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | 414 | acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
408 | { | 415 | { |
409 | acpi_status status = AE_OK; | 416 | acpi_status status = AE_OK; |
410 | union acpi_generic_state *state_list = NULL; | 417 | union acpi_generic_state *state_list = NULL; |
@@ -412,9 +419,10 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
412 | union acpi_generic_state *state; | 419 | union acpi_generic_state *state; |
413 | acpi_native_uint i; | 420 | acpi_native_uint i; |
414 | 421 | ||
415 | ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); | 422 | ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); |
416 | 423 | ||
417 | while (object) { | 424 | while (object) { |
425 | |||
418 | /* Make sure that this isn't a namespace handle */ | 426 | /* Make sure that this isn't a namespace handle */ |
419 | 427 | ||
420 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { | 428 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { |
@@ -507,11 +515,11 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
507 | 515 | ||
508 | case ACPI_TYPE_REGION: | 516 | case ACPI_TYPE_REGION: |
509 | default: | 517 | default: |
510 | break; /* No subobjects */ | 518 | break; /* No subobjects for all other types */ |
511 | } | 519 | } |
512 | 520 | ||
513 | /* | 521 | /* |
514 | * Now we can update the count in the main object. This can only | 522 | * Now we can update the count in the main object. This can only |
515 | * happen after we update the sub-objects in case this causes the | 523 | * happen after we update the sub-objects in case this causes the |
516 | * main object to be deleted. | 524 | * main object to be deleted. |
517 | */ | 525 | */ |
@@ -556,7 +564,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
556 | void acpi_ut_add_reference(union acpi_operand_object *object) | 564 | void acpi_ut_add_reference(union acpi_operand_object *object) |
557 | { | 565 | { |
558 | 566 | ||
559 | ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); | 567 | ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); |
560 | 568 | ||
561 | /* Ensure that we have a valid object */ | 569 | /* Ensure that we have a valid object */ |
562 | 570 | ||
@@ -589,11 +597,11 @@ void acpi_ut_add_reference(union acpi_operand_object *object) | |||
589 | void acpi_ut_remove_reference(union acpi_operand_object *object) | 597 | void acpi_ut_remove_reference(union acpi_operand_object *object) |
590 | { | 598 | { |
591 | 599 | ||
592 | ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); | 600 | ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); |
593 | 601 | ||
594 | /* | 602 | /* |
595 | * Allow a NULL pointer to be passed in, just ignore it. This saves | 603 | * Allow a NULL pointer to be passed in, just ignore it. This saves |
596 | * each caller from having to check. Also, ignore NS nodes. | 604 | * each caller from having to check. Also, ignore NS nodes. |
597 | * | 605 | * |
598 | */ | 606 | */ |
599 | if (!object || | 607 | if (!object || |
@@ -613,7 +621,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) | |||
613 | 621 | ||
614 | /* | 622 | /* |
615 | * Decrement the reference count, and only actually delete the object | 623 | * Decrement the reference count, and only actually delete the object |
616 | * if the reference count becomes 0. (Must also decrement the ref count | 624 | * if the reference count becomes 0. (Must also decrement the ref count |
617 | * of all subobjects!) | 625 | * of all subobjects!) |
618 | */ | 626 | */ |
619 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); | 627 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 106cc97cb4af..d6d7121583c0 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -56,6 +56,34 @@ static acpi_status | |||
56 | acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | 56 | acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, |
57 | struct acpi_compatible_id *one_cid); | 57 | struct acpi_compatible_id *one_cid); |
58 | 58 | ||
59 | /* | ||
60 | * Strings supported by the _OSI predefined (internal) method. | ||
61 | */ | ||
62 | static const char *acpi_interfaces_supported[] = { | ||
63 | /* Operating System Vendor Strings */ | ||
64 | |||
65 | "Linux", | ||
66 | "Windows 2000", | ||
67 | "Windows 2001", | ||
68 | "Windows 2001 SP0", | ||
69 | "Windows 2001 SP1", | ||
70 | "Windows 2001 SP2", | ||
71 | "Windows 2001 SP3", | ||
72 | "Windows 2001 SP4", | ||
73 | "Windows 2001.1", | ||
74 | "Windows 2001.1 SP1", /* Added 03/2006 */ | ||
75 | "Windows 2006", /* Added 03/2006 */ | ||
76 | |||
77 | /* Feature Group Strings */ | ||
78 | |||
79 | "Extended Address Space Descriptor" | ||
80 | /* | ||
81 | * All "optional" feature group strings (features that are implemented | ||
82 | * by the host) should be implemented in the host version of | ||
83 | * acpi_os_validate_interface and should not be added here. | ||
84 | */ | ||
85 | }; | ||
86 | |||
59 | /******************************************************************************* | 87 | /******************************************************************************* |
60 | * | 88 | * |
61 | * FUNCTION: acpi_ut_osi_implementation | 89 | * FUNCTION: acpi_ut_osi_implementation |
@@ -64,18 +92,18 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | |||
64 | * | 92 | * |
65 | * RETURN: Status | 93 | * RETURN: Status |
66 | * | 94 | * |
67 | * DESCRIPTION: Implementation of _OSI predefined control method | 95 | * DESCRIPTION: Implementation of the _OSI predefined control method |
68 | * Supported = _OSI (String) | ||
69 | * | 96 | * |
70 | ******************************************************************************/ | 97 | ******************************************************************************/ |
71 | 98 | ||
72 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | 99 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) |
73 | { | 100 | { |
101 | acpi_status status; | ||
74 | union acpi_operand_object *string_desc; | 102 | union acpi_operand_object *string_desc; |
75 | union acpi_operand_object *return_desc; | 103 | union acpi_operand_object *return_desc; |
76 | acpi_native_uint i; | 104 | acpi_native_uint i; |
77 | 105 | ||
78 | ACPI_FUNCTION_TRACE("ut_osi_implementation"); | 106 | ACPI_FUNCTION_TRACE(ut_osi_implementation); |
79 | 107 | ||
80 | /* Validate the string input argument */ | 108 | /* Validate the string input argument */ |
81 | 109 | ||
@@ -84,28 +112,47 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
84 | return_ACPI_STATUS(AE_TYPE); | 112 | return_ACPI_STATUS(AE_TYPE); |
85 | } | 113 | } |
86 | 114 | ||
87 | /* Create a return object (Default value = 0) */ | 115 | /* Create a return object */ |
88 | 116 | ||
89 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 117 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
90 | if (!return_desc) { | 118 | if (!return_desc) { |
91 | return_ACPI_STATUS(AE_NO_MEMORY); | 119 | return_ACPI_STATUS(AE_NO_MEMORY); |
92 | } | 120 | } |
93 | 121 | ||
94 | /* Compare input string to table of supported strings */ | 122 | /* Default return value is SUPPORTED */ |
123 | |||
124 | return_desc->integer.value = ACPI_UINT32_MAX; | ||
125 | walk_state->return_desc = return_desc; | ||
126 | |||
127 | /* Compare input string to static table of supported interfaces */ | ||
95 | 128 | ||
96 | for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { | 129 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { |
97 | if (!ACPI_STRCMP(string_desc->string.pointer, | 130 | if (!ACPI_STRCMP |
98 | ACPI_CAST_PTR(char, | 131 | (string_desc->string.pointer, |
99 | acpi_gbl_valid_osi_strings[i]))) | 132 | acpi_interfaces_supported[i])) { |
100 | { | ||
101 | /* This string is supported */ | ||
102 | 133 | ||
103 | return_desc->integer.value = 0xFFFFFFFF; | 134 | /* The interface is supported */ |
104 | break; | 135 | |
136 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | ||
105 | } | 137 | } |
106 | } | 138 | } |
107 | 139 | ||
108 | walk_state->return_desc = return_desc; | 140 | /* |
141 | * Did not match the string in the static table, call the host OSL to | ||
142 | * check for a match with one of the optional strings (such as | ||
143 | * "Module Device", "3.0 Thermal Model", etc.) | ||
144 | */ | ||
145 | status = acpi_os_validate_interface(string_desc->string.pointer); | ||
146 | if (ACPI_SUCCESS(status)) { | ||
147 | |||
148 | /* The interface is supported */ | ||
149 | |||
150 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | ||
151 | } | ||
152 | |||
153 | /* The interface is not supported */ | ||
154 | |||
155 | return_desc->integer.value = 0; | ||
109 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 156 | return_ACPI_STATUS(AE_CTRL_TERMINATE); |
110 | } | 157 | } |
111 | 158 | ||
@@ -134,19 +181,26 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
134 | u32 expected_return_btypes, | 181 | u32 expected_return_btypes, |
135 | union acpi_operand_object **return_desc) | 182 | union acpi_operand_object **return_desc) |
136 | { | 183 | { |
137 | struct acpi_parameter_info info; | 184 | struct acpi_evaluate_info *info; |
138 | acpi_status status; | 185 | acpi_status status; |
139 | u32 return_btype; | 186 | u32 return_btype; |
140 | 187 | ||
141 | ACPI_FUNCTION_TRACE("ut_evaluate_object"); | 188 | ACPI_FUNCTION_TRACE(ut_evaluate_object); |
142 | 189 | ||
143 | info.node = prefix_node; | 190 | /* Allocate the evaluation information block */ |
144 | info.parameters = NULL; | 191 | |
145 | info.parameter_type = ACPI_PARAM_ARGS; | 192 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
193 | if (!info) { | ||
194 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
195 | } | ||
196 | |||
197 | info->prefix_node = prefix_node; | ||
198 | info->pathname = path; | ||
199 | info->parameter_type = ACPI_PARAM_ARGS; | ||
146 | 200 | ||
147 | /* Evaluate the object/method */ | 201 | /* Evaluate the object/method */ |
148 | 202 | ||
149 | status = acpi_ns_evaluate_relative(path, &info); | 203 | status = acpi_ns_evaluate(info); |
150 | if (ACPI_FAILURE(status)) { | 204 | if (ACPI_FAILURE(status)) { |
151 | if (status == AE_NOT_FOUND) { | 205 | if (status == AE_NOT_FOUND) { |
152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -158,25 +212,25 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
158 | prefix_node, path, status); | 212 | prefix_node, path, status); |
159 | } | 213 | } |
160 | 214 | ||
161 | return_ACPI_STATUS(status); | 215 | goto cleanup; |
162 | } | 216 | } |
163 | 217 | ||
164 | /* Did we get a return object? */ | 218 | /* Did we get a return object? */ |
165 | 219 | ||
166 | if (!info.return_object) { | 220 | if (!info->return_object) { |
167 | if (expected_return_btypes) { | 221 | if (expected_return_btypes) { |
168 | ACPI_ERROR_METHOD("No object was returned from", | 222 | ACPI_ERROR_METHOD("No object was returned from", |
169 | prefix_node, path, AE_NOT_EXIST); | 223 | prefix_node, path, AE_NOT_EXIST); |
170 | 224 | ||
171 | return_ACPI_STATUS(AE_NOT_EXIST); | 225 | status = AE_NOT_EXIST; |
172 | } | 226 | } |
173 | 227 | ||
174 | return_ACPI_STATUS(AE_OK); | 228 | goto cleanup; |
175 | } | 229 | } |
176 | 230 | ||
177 | /* Map the return object type to the bitmapped type */ | 231 | /* Map the return object type to the bitmapped type */ |
178 | 232 | ||
179 | switch (ACPI_GET_OBJECT_TYPE(info.return_object)) { | 233 | switch (ACPI_GET_OBJECT_TYPE(info->return_object)) { |
180 | case ACPI_TYPE_INTEGER: | 234 | case ACPI_TYPE_INTEGER: |
181 | return_btype = ACPI_BTYPE_INTEGER; | 235 | return_btype = ACPI_BTYPE_INTEGER; |
182 | break; | 236 | break; |
@@ -204,8 +258,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
204 | * happen frequently if the "implicit return" feature is enabled. | 258 | * happen frequently if the "implicit return" feature is enabled. |
205 | * Just delete the return object and return AE_OK. | 259 | * Just delete the return object and return AE_OK. |
206 | */ | 260 | */ |
207 | acpi_ut_remove_reference(info.return_object); | 261 | acpi_ut_remove_reference(info->return_object); |
208 | return_ACPI_STATUS(AE_OK); | 262 | goto cleanup; |
209 | } | 263 | } |
210 | 264 | ||
211 | /* Is the return object one of the expected types? */ | 265 | /* Is the return object one of the expected types? */ |
@@ -217,19 +271,23 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
217 | ACPI_ERROR((AE_INFO, | 271 | ACPI_ERROR((AE_INFO, |
218 | "Type returned from %s was incorrect: %s, expected Btypes: %X", | 272 | "Type returned from %s was incorrect: %s, expected Btypes: %X", |
219 | path, | 273 | path, |
220 | acpi_ut_get_object_type_name(info.return_object), | 274 | acpi_ut_get_object_type_name(info->return_object), |
221 | expected_return_btypes)); | 275 | expected_return_btypes)); |
222 | 276 | ||
223 | /* On error exit, we must delete the return object */ | 277 | /* On error exit, we must delete the return object */ |
224 | 278 | ||
225 | acpi_ut_remove_reference(info.return_object); | 279 | acpi_ut_remove_reference(info->return_object); |
226 | return_ACPI_STATUS(AE_TYPE); | 280 | status = AE_TYPE; |
281 | goto cleanup; | ||
227 | } | 282 | } |
228 | 283 | ||
229 | /* Object type is OK, return it */ | 284 | /* Object type is OK, return it */ |
230 | 285 | ||
231 | *return_desc = info.return_object; | 286 | *return_desc = info->return_object; |
232 | return_ACPI_STATUS(AE_OK); | 287 | |
288 | cleanup: | ||
289 | ACPI_FREE(info); | ||
290 | return_ACPI_STATUS(status); | ||
233 | } | 291 | } |
234 | 292 | ||
235 | /******************************************************************************* | 293 | /******************************************************************************* |
@@ -257,7 +315,7 @@ acpi_ut_evaluate_numeric_object(char *object_name, | |||
257 | union acpi_operand_object *obj_desc; | 315 | union acpi_operand_object *obj_desc; |
258 | acpi_status status; | 316 | acpi_status status; |
259 | 317 | ||
260 | ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object"); | 318 | ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object); |
261 | 319 | ||
262 | status = acpi_ut_evaluate_object(device_node, object_name, | 320 | status = acpi_ut_evaluate_object(device_node, object_name, |
263 | ACPI_BTYPE_INTEGER, &obj_desc); | 321 | ACPI_BTYPE_INTEGER, &obj_desc); |
@@ -333,7 +391,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
333 | union acpi_operand_object *obj_desc; | 391 | union acpi_operand_object *obj_desc; |
334 | acpi_status status; | 392 | acpi_status status; |
335 | 393 | ||
336 | ACPI_FUNCTION_TRACE("ut_execute_HID"); | 394 | ACPI_FUNCTION_TRACE(ut_execute_HID); |
337 | 395 | ||
338 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, | 396 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, |
339 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | 397 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, |
@@ -343,6 +401,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
343 | } | 401 | } |
344 | 402 | ||
345 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 403 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
404 | |||
346 | /* Convert the Numeric HID to string */ | 405 | /* Convert the Numeric HID to string */ |
347 | 406 | ||
348 | acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, | 407 | acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, |
@@ -436,7 +495,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
436 | struct acpi_compatible_id_list *cid_list; | 495 | struct acpi_compatible_id_list *cid_list; |
437 | acpi_native_uint i; | 496 | acpi_native_uint i; |
438 | 497 | ||
439 | ACPI_FUNCTION_TRACE("ut_execute_CID"); | 498 | ACPI_FUNCTION_TRACE(ut_execute_CID); |
440 | 499 | ||
441 | /* Evaluate the _CID method for this device */ | 500 | /* Evaluate the _CID method for this device */ |
442 | 501 | ||
@@ -459,7 +518,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
459 | size = (((count - 1) * sizeof(struct acpi_compatible_id)) + | 518 | size = (((count - 1) * sizeof(struct acpi_compatible_id)) + |
460 | sizeof(struct acpi_compatible_id_list)); | 519 | sizeof(struct acpi_compatible_id_list)); |
461 | 520 | ||
462 | cid_list = ACPI_MEM_CALLOCATE((acpi_size) size); | 521 | cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); |
463 | if (!cid_list) { | 522 | if (!cid_list) { |
464 | return_ACPI_STATUS(AE_NO_MEMORY); | 523 | return_ACPI_STATUS(AE_NO_MEMORY); |
465 | } | 524 | } |
@@ -479,6 +538,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
479 | /* The _CID object can be either a single CID or a package (list) of CIDs */ | 538 | /* The _CID object can be either a single CID or a package (list) of CIDs */ |
480 | 539 | ||
481 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { | 540 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { |
541 | |||
482 | /* Translate each package element */ | 542 | /* Translate each package element */ |
483 | 543 | ||
484 | for (i = 0; i < count; i++) { | 544 | for (i = 0; i < count; i++) { |
@@ -499,7 +559,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
499 | /* Cleanup on error */ | 559 | /* Cleanup on error */ |
500 | 560 | ||
501 | if (ACPI_FAILURE(status)) { | 561 | if (ACPI_FAILURE(status)) { |
502 | ACPI_MEM_FREE(cid_list); | 562 | ACPI_FREE(cid_list); |
503 | } else { | 563 | } else { |
504 | *return_cid_list = cid_list; | 564 | *return_cid_list = cid_list; |
505 | } | 565 | } |
@@ -533,7 +593,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
533 | union acpi_operand_object *obj_desc; | 593 | union acpi_operand_object *obj_desc; |
534 | acpi_status status; | 594 | acpi_status status; |
535 | 595 | ||
536 | ACPI_FUNCTION_TRACE("ut_execute_UID"); | 596 | ACPI_FUNCTION_TRACE(ut_execute_UID); |
537 | 597 | ||
538 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, | 598 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, |
539 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | 599 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, |
@@ -543,6 +603,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
543 | } | 603 | } |
544 | 604 | ||
545 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 605 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
606 | |||
546 | /* Convert the Numeric UID to string */ | 607 | /* Convert the Numeric UID to string */ |
547 | 608 | ||
548 | acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, | 609 | acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, |
@@ -582,7 +643,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) | |||
582 | union acpi_operand_object *obj_desc; | 643 | union acpi_operand_object *obj_desc; |
583 | acpi_status status; | 644 | acpi_status status; |
584 | 645 | ||
585 | ACPI_FUNCTION_TRACE("ut_execute_STA"); | 646 | ACPI_FUNCTION_TRACE(ut_execute_STA); |
586 | 647 | ||
587 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, | 648 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, |
588 | ACPI_BTYPE_INTEGER, &obj_desc); | 649 | ACPI_BTYPE_INTEGER, &obj_desc); |
@@ -632,7 +693,7 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) | |||
632 | acpi_status status; | 693 | acpi_status status; |
633 | u32 i; | 694 | u32 i; |
634 | 695 | ||
635 | ACPI_FUNCTION_TRACE("ut_execute_Sxds"); | 696 | ACPI_FUNCTION_TRACE(ut_execute_sxds); |
636 | 697 | ||
637 | for (i = 0; i < 4; i++) { | 698 | for (i = 0; i < 4; i++) { |
638 | highest[i] = 0xFF; | 699 | highest[i] = 0xFF; |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index ffd13383a325..e5999c65c0b8 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #define DEFINE_ACPI_GLOBALS | 44 | #define DEFINE_ACPI_GLOBALS |
45 | 45 | ||
46 | #include <linux/module.h> | ||
47 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
49 | 48 | ||
@@ -119,6 +118,7 @@ const char *acpi_format_exception(acpi_status status) | |||
119 | } | 118 | } |
120 | 119 | ||
121 | if (!exception) { | 120 | if (!exception) { |
121 | |||
122 | /* Exception code was not recognized */ | 122 | /* Exception code was not recognized */ |
123 | 123 | ||
124 | ACPI_ERROR((AE_INFO, | 124 | ACPI_ERROR((AE_INFO, |
@@ -143,12 +143,10 @@ const char *acpi_format_exception(acpi_status status) | |||
143 | 143 | ||
144 | /* Debug switch - level and trace mask */ | 144 | /* Debug switch - level and trace mask */ |
145 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; | 145 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; |
146 | EXPORT_SYMBOL(acpi_dbg_level); | ||
147 | 146 | ||
148 | /* Debug switch - layer (component) mask */ | 147 | /* Debug switch - layer (component) mask */ |
149 | 148 | ||
150 | u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; | 149 | u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; |
151 | EXPORT_SYMBOL(acpi_dbg_layer); | ||
152 | u32 acpi_gbl_nesting_level = 0; | 150 | u32 acpi_gbl_nesting_level = 0; |
153 | 151 | ||
154 | /* Debugger globals */ | 152 | /* Debugger globals */ |
@@ -183,28 +181,6 @@ const char *acpi_gbl_highest_dstate_names[4] = { | |||
183 | "_S4D" | 181 | "_S4D" |
184 | }; | 182 | }; |
185 | 183 | ||
186 | /* | ||
187 | * Strings supported by the _OSI predefined (internal) method. | ||
188 | * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS. | ||
189 | */ | ||
190 | const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { | ||
191 | /* Operating System Vendor Strings */ | ||
192 | |||
193 | "Linux", | ||
194 | "Windows 2000", | ||
195 | "Windows 2001", | ||
196 | "Windows 2001.1", | ||
197 | "Windows 2001 SP0", | ||
198 | "Windows 2001 SP1", | ||
199 | "Windows 2001 SP2", | ||
200 | "Windows 2001 SP3", | ||
201 | "Windows 2001 SP4", | ||
202 | |||
203 | /* Feature Group Strings */ | ||
204 | |||
205 | "Extended Address Space Descriptor" | ||
206 | }; | ||
207 | |||
208 | /******************************************************************************* | 184 | /******************************************************************************* |
209 | * | 185 | * |
210 | * Namespace globals | 186 | * Namespace globals |
@@ -317,9 +293,9 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) | |||
317 | * | 293 | * |
318 | ******************************************************************************/ | 294 | ******************************************************************************/ |
319 | 295 | ||
320 | struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; | 296 | struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; |
321 | 297 | ||
322 | struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = { | 298 | struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = { |
323 | /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ | 299 | /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ |
324 | 300 | ||
325 | /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, | 301 | /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, |
@@ -467,7 +443,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = | |||
467 | /* Region type decoding */ | 443 | /* Region type decoding */ |
468 | 444 | ||
469 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | 445 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { |
470 | /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ | ||
471 | "SystemMemory", | 446 | "SystemMemory", |
472 | "SystemIO", | 447 | "SystemIO", |
473 | "PCI_Config", | 448 | "PCI_Config", |
@@ -476,16 +451,15 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | |||
476 | "CMOS", | 451 | "CMOS", |
477 | "PCIBARTarget", | 452 | "PCIBARTarget", |
478 | "DataTable" | 453 | "DataTable" |
479 | /*! [End] no source code translation !*/ | ||
480 | }; | 454 | }; |
481 | 455 | ||
482 | char *acpi_ut_get_region_name(u8 space_id) | 456 | char *acpi_ut_get_region_name(u8 space_id) |
483 | { | 457 | { |
484 | 458 | ||
485 | if (space_id >= ACPI_USER_REGION_BEGIN) { | 459 | if (space_id >= ACPI_USER_REGION_BEGIN) { |
486 | return ("user_defined_region"); | 460 | return ("UserDefinedRegion"); |
487 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { | 461 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { |
488 | return ("invalid_space_id"); | 462 | return ("InvalidSpaceId"); |
489 | } | 463 | } |
490 | 464 | ||
491 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); | 465 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); |
@@ -506,20 +480,18 @@ char *acpi_ut_get_region_name(u8 space_id) | |||
506 | /* Event type decoding */ | 480 | /* Event type decoding */ |
507 | 481 | ||
508 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { | 482 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { |
509 | /*! [Begin] no source code translation (keep these strings as-is) */ | ||
510 | "PM_Timer", | 483 | "PM_Timer", |
511 | "GlobalLock", | 484 | "GlobalLock", |
512 | "PowerButton", | 485 | "PowerButton", |
513 | "SleepButton", | 486 | "SleepButton", |
514 | "RealTimeClock", | 487 | "RealTimeClock", |
515 | /*! [End] no source code translation !*/ | ||
516 | }; | 488 | }; |
517 | 489 | ||
518 | char *acpi_ut_get_event_name(u32 event_id) | 490 | char *acpi_ut_get_event_name(u32 event_id) |
519 | { | 491 | { |
520 | 492 | ||
521 | if (event_id > ACPI_EVENT_MAX) { | 493 | if (event_id > ACPI_EVENT_MAX) { |
522 | return ("invalid_event_iD"); | 494 | return ("InvalidEventID"); |
523 | } | 495 | } |
524 | 496 | ||
525 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); | 497 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); |
@@ -550,7 +522,6 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED"; | |||
550 | /* Printable names of the ACPI object types */ | 522 | /* Printable names of the ACPI object types */ |
551 | 523 | ||
552 | static const char *acpi_gbl_ns_type_names[] = { | 524 | static const char *acpi_gbl_ns_type_names[] = { |
553 | /*! [Begin] no source code translation (keep these strings as-is) */ | ||
554 | /* 00 */ "Untyped", | 525 | /* 00 */ "Untyped", |
555 | /* 01 */ "Integer", | 526 | /* 01 */ "Integer", |
556 | /* 02 */ "String", | 527 | /* 02 */ "String", |
@@ -582,7 +553,6 @@ static const char *acpi_gbl_ns_type_names[] = { | |||
582 | /* 28 */ "Extra", | 553 | /* 28 */ "Extra", |
583 | /* 29 */ "Data", | 554 | /* 29 */ "Data", |
584 | /* 30 */ "Invalid" | 555 | /* 30 */ "Invalid" |
585 | /*! [End] no source code translation !*/ | ||
586 | }; | 556 | }; |
587 | 557 | ||
588 | char *acpi_ut_get_type_name(acpi_object_type type) | 558 | char *acpi_ut_get_type_name(acpi_object_type type) |
@@ -635,14 +605,14 @@ char *acpi_ut_get_node_name(void *object) | |||
635 | 605 | ||
636 | /* Descriptor must be a namespace node */ | 606 | /* Descriptor must be a namespace node */ |
637 | 607 | ||
638 | if (node->descriptor != ACPI_DESC_TYPE_NAMED) { | 608 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
639 | return ("####"); | 609 | return ("####"); |
640 | } | 610 | } |
641 | 611 | ||
642 | /* Name must be a valid ACPI name */ | 612 | /* Name must be a valid ACPI name */ |
643 | 613 | ||
644 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { | 614 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { |
645 | return ("????"); | 615 | node->name.integer = acpi_ut_repair_name(node->name.integer); |
646 | } | 616 | } |
647 | 617 | ||
648 | /* Return the name */ | 618 | /* Return the name */ |
@@ -665,7 +635,6 @@ char *acpi_ut_get_node_name(void *object) | |||
665 | /* Printable names of object descriptor types */ | 635 | /* Printable names of object descriptor types */ |
666 | 636 | ||
667 | static const char *acpi_gbl_desc_type_names[] = { | 637 | static const char *acpi_gbl_desc_type_names[] = { |
668 | /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ | ||
669 | /* 00 */ "Invalid", | 638 | /* 00 */ "Invalid", |
670 | /* 01 */ "Cached", | 639 | /* 01 */ "Cached", |
671 | /* 02 */ "State-Generic", | 640 | /* 02 */ "State-Generic", |
@@ -682,7 +651,6 @@ static const char *acpi_gbl_desc_type_names[] = { | |||
682 | /* 13 */ "Parser", | 651 | /* 13 */ "Parser", |
683 | /* 14 */ "Operand", | 652 | /* 14 */ "Operand", |
684 | /* 15 */ "Node" | 653 | /* 15 */ "Node" |
685 | /*! [End] no source code translation !*/ | ||
686 | }; | 654 | }; |
687 | 655 | ||
688 | char *acpi_ut_get_descriptor_name(void *object) | 656 | char *acpi_ut_get_descriptor_name(void *object) |
@@ -723,7 +691,7 @@ char *acpi_ut_get_descriptor_name(void *object) | |||
723 | char *acpi_ut_get_mutex_name(u32 mutex_id) | 691 | char *acpi_ut_get_mutex_name(u32 mutex_id) |
724 | { | 692 | { |
725 | 693 | ||
726 | if (mutex_id > MAX_MUTEX) { | 694 | if (mutex_id > ACPI_MAX_MUTEX) { |
727 | return ("Invalid Mutex ID"); | 695 | return ("Invalid Mutex ID"); |
728 | } | 696 | } |
729 | 697 | ||
@@ -747,6 +715,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type) | |||
747 | { | 715 | { |
748 | 716 | ||
749 | if (type > ACPI_TYPE_LOCAL_MAX) { | 717 | if (type > ACPI_TYPE_LOCAL_MAX) { |
718 | |||
750 | /* Note: Assumes all TYPEs are contiguous (external/local) */ | 719 | /* Note: Assumes all TYPEs are contiguous (external/local) */ |
751 | 720 | ||
752 | return (FALSE); | 721 | return (FALSE); |
@@ -773,7 +742,7 @@ void acpi_ut_init_globals(void) | |||
773 | acpi_status status; | 742 | acpi_status status; |
774 | u32 i; | 743 | u32 i; |
775 | 744 | ||
776 | ACPI_FUNCTION_TRACE("ut_init_globals"); | 745 | ACPI_FUNCTION_TRACE(ut_init_globals); |
777 | 746 | ||
778 | /* Create all memory caches */ | 747 | /* Create all memory caches */ |
779 | 748 | ||
@@ -784,14 +753,14 @@ void acpi_ut_init_globals(void) | |||
784 | 753 | ||
785 | /* ACPI table structure */ | 754 | /* ACPI table structure */ |
786 | 755 | ||
787 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 756 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
788 | acpi_gbl_table_lists[i].next = NULL; | 757 | acpi_gbl_table_lists[i].next = NULL; |
789 | acpi_gbl_table_lists[i].count = 0; | 758 | acpi_gbl_table_lists[i].count = 0; |
790 | } | 759 | } |
791 | 760 | ||
792 | /* Mutex locked flags */ | 761 | /* Mutex locked flags */ |
793 | 762 | ||
794 | for (i = 0; i < NUM_MUTEX; i++) { | 763 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
795 | acpi_gbl_mutex_info[i].mutex = NULL; | 764 | acpi_gbl_mutex_info[i].mutex = NULL; |
796 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 765 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
797 | acpi_gbl_mutex_info[i].use_count = 0; | 766 | acpi_gbl_mutex_info[i].use_count = 0; |
@@ -856,7 +825,7 @@ void acpi_ut_init_globals(void) | |||
856 | 825 | ||
857 | acpi_gbl_root_node = NULL; | 826 | acpi_gbl_root_node = NULL; |
858 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; | 827 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
859 | acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; | 828 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; |
860 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; | 829 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
861 | acpi_gbl_root_node_struct.child = NULL; | 830 | acpi_gbl_root_node_struct.child = NULL; |
862 | acpi_gbl_root_node_struct.peer = NULL; | 831 | acpi_gbl_root_node_struct.peer = NULL; |
@@ -869,3 +838,6 @@ void acpi_ut_init_globals(void) | |||
869 | 838 | ||
870 | return_VOID; | 839 | return_VOID; |
871 | } | 840 | } |
841 | |||
842 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | ||
843 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | ||
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index ba771b4f39bc..ff76055eb7d6 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c | |||
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit") | |||
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static void | 52 | static void |
53 | acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); | 53 | acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset); |
54 | 54 | ||
55 | static void acpi_ut_terminate(void); | 55 | static void acpi_ut_terminate(void); |
56 | 56 | ||
@@ -69,12 +69,12 @@ static void acpi_ut_terminate(void); | |||
69 | ******************************************************************************/ | 69 | ******************************************************************************/ |
70 | 70 | ||
71 | static void | 71 | static void |
72 | acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) | 72 | acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset) |
73 | { | 73 | { |
74 | 74 | ||
75 | ACPI_WARNING((AE_INFO, | 75 | ACPI_WARNING((AE_INFO, |
76 | "Invalid FADT value %s=%X at offset %X FADT=%p", | 76 | "Invalid FADT value %s=%X at offset %X FADT=%p", |
77 | register_name, value, (u32) offset, acpi_gbl_FADT)); | 77 | register_name, value, offset, acpi_gbl_FADT)); |
78 | } | 78 | } |
79 | 79 | ||
80 | /****************************************************************************** | 80 | /****************************************************************************** |
@@ -176,7 +176,7 @@ static void acpi_ut_terminate(void) | |||
176 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 176 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
177 | struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; | 177 | struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; |
178 | 178 | ||
179 | ACPI_FUNCTION_TRACE("ut_terminate"); | 179 | ACPI_FUNCTION_TRACE(ut_terminate); |
180 | 180 | ||
181 | /* Free global tables, etc. */ | 181 | /* Free global tables, etc. */ |
182 | /* Free global GPE blocks and related info structures */ | 182 | /* Free global GPE blocks and related info structures */ |
@@ -186,14 +186,14 @@ static void acpi_ut_terminate(void) | |||
186 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | 186 | gpe_block = gpe_xrupt_info->gpe_block_list_head; |
187 | while (gpe_block) { | 187 | while (gpe_block) { |
188 | next_gpe_block = gpe_block->next; | 188 | next_gpe_block = gpe_block->next; |
189 | ACPI_MEM_FREE(gpe_block->event_info); | 189 | ACPI_FREE(gpe_block->event_info); |
190 | ACPI_MEM_FREE(gpe_block->register_info); | 190 | ACPI_FREE(gpe_block->register_info); |
191 | ACPI_MEM_FREE(gpe_block); | 191 | ACPI_FREE(gpe_block); |
192 | 192 | ||
193 | gpe_block = next_gpe_block; | 193 | gpe_block = next_gpe_block; |
194 | } | 194 | } |
195 | next_gpe_xrupt_info = gpe_xrupt_info->next; | 195 | next_gpe_xrupt_info = gpe_xrupt_info->next; |
196 | ACPI_MEM_FREE(gpe_xrupt_info); | 196 | ACPI_FREE(gpe_xrupt_info); |
197 | gpe_xrupt_info = next_gpe_xrupt_info; | 197 | gpe_xrupt_info = next_gpe_xrupt_info; |
198 | } | 198 | } |
199 | 199 | ||
@@ -216,7 +216,7 @@ static void acpi_ut_terminate(void) | |||
216 | void acpi_ut_subsystem_shutdown(void) | 216 | void acpi_ut_subsystem_shutdown(void) |
217 | { | 217 | { |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE("ut_subsystem_shutdown"); | 219 | ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); |
220 | 220 | ||
221 | /* Just exit if subsystem is already shutdown */ | 221 | /* Just exit if subsystem is already shutdown */ |
222 | 222 | ||
@@ -228,6 +228,7 @@ void acpi_ut_subsystem_shutdown(void) | |||
228 | /* Subsystem appears active, go ahead and shut it down */ | 228 | /* Subsystem appears active, go ahead and shut it down */ |
229 | 229 | ||
230 | acpi_gbl_shutdown = TRUE; | 230 | acpi_gbl_shutdown = TRUE; |
231 | acpi_gbl_startup_flags = 0; | ||
231 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); | 232 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); |
232 | 233 | ||
233 | /* Close the acpi_event Handling */ | 234 | /* Close the acpi_event Handling */ |
@@ -245,12 +246,5 @@ void acpi_ut_subsystem_shutdown(void) | |||
245 | /* Purge the local caches */ | 246 | /* Purge the local caches */ |
246 | 247 | ||
247 | (void)acpi_ut_delete_caches(); | 248 | (void)acpi_ut_delete_caches(); |
248 | |||
249 | /* Debug only - display leftover memory allocation, if any */ | ||
250 | |||
251 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
252 | acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); | ||
253 | #endif | ||
254 | |||
255 | return_VOID; | 249 | return_VOID; |
256 | } | 250 | } |
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 4a3360484e72..19d74bedce27 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c | |||
@@ -77,7 +77,7 @@ acpi_ut_short_divide(acpi_integer dividend, | |||
77 | union uint64_overlay quotient; | 77 | union uint64_overlay quotient; |
78 | u32 remainder32; | 78 | u32 remainder32; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ut_short_divide"); | 80 | ACPI_FUNCTION_TRACE(ut_short_divide); |
81 | 81 | ||
82 | /* Always check for a zero divisor */ | 82 | /* Always check for a zero divisor */ |
83 | 83 | ||
@@ -139,7 +139,7 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
139 | union uint64_overlay partial2; | 139 | union uint64_overlay partial2; |
140 | union uint64_overlay partial3; | 140 | union uint64_overlay partial3; |
141 | 141 | ||
142 | ACPI_FUNCTION_TRACE("ut_divide"); | 142 | ACPI_FUNCTION_TRACE(ut_divide); |
143 | 143 | ||
144 | /* Always check for a zero divisor */ | 144 | /* Always check for a zero divisor */ |
145 | 145 | ||
@@ -261,7 +261,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
261 | acpi_integer * out_quotient, u32 * out_remainder) | 261 | acpi_integer * out_quotient, u32 * out_remainder) |
262 | { | 262 | { |
263 | 263 | ||
264 | ACPI_FUNCTION_TRACE("ut_short_divide"); | 264 | ACPI_FUNCTION_TRACE(ut_short_divide); |
265 | 265 | ||
266 | /* Always check for a zero divisor */ | 266 | /* Always check for a zero divisor */ |
267 | 267 | ||
@@ -287,7 +287,7 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
287 | acpi_integer in_divisor, | 287 | acpi_integer in_divisor, |
288 | acpi_integer * out_quotient, acpi_integer * out_remainder) | 288 | acpi_integer * out_quotient, acpi_integer * out_remainder) |
289 | { | 289 | { |
290 | ACPI_FUNCTION_TRACE("ut_divide"); | 290 | ACPI_FUNCTION_TRACE(ut_divide); |
291 | 291 | ||
292 | /* Always check for a zero divisor */ | 292 | /* Always check for a zero divisor */ |
293 | 293 | ||
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 7364f5f8c9cd..5c75d35ad1cd 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -49,6 +49,33 @@ ACPI_MODULE_NAME("utmisc") | |||
49 | 49 | ||
50 | /******************************************************************************* | 50 | /******************************************************************************* |
51 | * | 51 | * |
52 | * FUNCTION: acpi_ut_is_aml_table | ||
53 | * | ||
54 | * PARAMETERS: Table - An ACPI table | ||
55 | * | ||
56 | * RETURN: TRUE if table contains executable AML; FALSE otherwise | ||
57 | * | ||
58 | * DESCRIPTION: Check ACPI Signature for a table that contains AML code. | ||
59 | * Currently, these are DSDT,SSDT,PSDT. All other table types are | ||
60 | * data tables that do not contain AML code. | ||
61 | * | ||
62 | ******************************************************************************/ | ||
63 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table) | ||
64 | { | ||
65 | |||
66 | /* Ignore tables that contain AML */ | ||
67 | |||
68 | if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || | ||
69 | ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || | ||
70 | ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) { | ||
71 | return (TRUE); | ||
72 | } | ||
73 | |||
74 | return (FALSE); | ||
75 | } | ||
76 | |||
77 | /******************************************************************************* | ||
78 | * | ||
52 | * FUNCTION: acpi_ut_allocate_owner_id | 79 | * FUNCTION: acpi_ut_allocate_owner_id |
53 | * | 80 | * |
54 | * PARAMETERS: owner_id - Where the new owner ID is returned | 81 | * PARAMETERS: owner_id - Where the new owner ID is returned |
@@ -60,6 +87,7 @@ ACPI_MODULE_NAME("utmisc") | |||
60 | * when the method exits or the table is unloaded. | 87 | * when the method exits or the table is unloaded. |
61 | * | 88 | * |
62 | ******************************************************************************/ | 89 | ******************************************************************************/ |
90 | |||
63 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | 91 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) |
64 | { | 92 | { |
65 | acpi_native_uint i; | 93 | acpi_native_uint i; |
@@ -67,7 +95,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
67 | acpi_native_uint k; | 95 | acpi_native_uint k; |
68 | acpi_status status; | 96 | acpi_status status; |
69 | 97 | ||
70 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); | 98 | ACPI_FUNCTION_TRACE(ut_allocate_owner_id); |
71 | 99 | ||
72 | /* Guard against multiple allocations of ID to the same location */ | 100 | /* Guard against multiple allocations of ID to the same location */ |
73 | 101 | ||
@@ -97,6 +125,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
97 | 125 | ||
98 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { | 126 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { |
99 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { | 127 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { |
128 | |||
100 | /* There are no free IDs in this mask */ | 129 | /* There are no free IDs in this mask */ |
101 | 130 | ||
102 | break; | 131 | break; |
@@ -123,7 +152,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
123 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); | 152 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); |
124 | 153 | ||
125 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, | 154 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, |
126 | "Allocated owner_id: %2.2X\n", | 155 | "Allocated OwnerId: %2.2X\n", |
127 | (unsigned int)*owner_id)); | 156 | (unsigned int)*owner_id)); |
128 | goto exit; | 157 | goto exit; |
129 | } | 158 | } |
@@ -144,7 +173,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
144 | */ | 173 | */ |
145 | status = AE_OWNER_ID_LIMIT; | 174 | status = AE_OWNER_ID_LIMIT; |
146 | ACPI_ERROR((AE_INFO, | 175 | ACPI_ERROR((AE_INFO, |
147 | "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT")); | 176 | "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); |
148 | 177 | ||
149 | exit: | 178 | exit: |
150 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | 179 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); |
@@ -172,7 +201,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
172 | acpi_native_uint index; | 201 | acpi_native_uint index; |
173 | u32 bit; | 202 | u32 bit; |
174 | 203 | ||
175 | ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); | 204 | ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); |
176 | 205 | ||
177 | /* Always clear the input owner_id (zero is an invalid ID) */ | 206 | /* Always clear the input owner_id (zero is an invalid ID) */ |
178 | 207 | ||
@@ -181,7 +210,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
181 | /* Zero is not a valid owner_iD */ | 210 | /* Zero is not a valid owner_iD */ |
182 | 211 | ||
183 | if (owner_id == 0) { | 212 | if (owner_id == 0) { |
184 | ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id)); | 213 | ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id)); |
185 | return_VOID; | 214 | return_VOID; |
186 | } | 215 | } |
187 | 216 | ||
@@ -207,7 +236,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
207 | acpi_gbl_owner_id_mask[index] ^= bit; | 236 | acpi_gbl_owner_id_mask[index] ^= bit; |
208 | } else { | 237 | } else { |
209 | ACPI_ERROR((AE_INFO, | 238 | ACPI_ERROR((AE_INFO, |
210 | "Release of non-allocated owner_id: %2.2X", | 239 | "Release of non-allocated OwnerId: %2.2X", |
211 | owner_id + 1)); | 240 | owner_id + 1)); |
212 | } | 241 | } |
213 | 242 | ||
@@ -273,6 +302,7 @@ void acpi_ut_print_string(char *string, u8 max_length) | |||
273 | 302 | ||
274 | acpi_os_printf("\""); | 303 | acpi_os_printf("\""); |
275 | for (i = 0; string[i] && (i < max_length); i++) { | 304 | for (i = 0; string[i] && (i < max_length); i++) { |
305 | |||
276 | /* Escape sequences */ | 306 | /* Escape sequences */ |
277 | 307 | ||
278 | switch (string[i]) { | 308 | switch (string[i]) { |
@@ -461,12 +491,47 @@ acpi_ut_display_init_pathname(u8 type, | |||
461 | } | 491 | } |
462 | acpi_os_printf("\n"); | 492 | acpi_os_printf("\n"); |
463 | 493 | ||
464 | ACPI_MEM_FREE(buffer.pointer); | 494 | ACPI_FREE(buffer.pointer); |
465 | } | 495 | } |
466 | #endif | 496 | #endif |
467 | 497 | ||
468 | /******************************************************************************* | 498 | /******************************************************************************* |
469 | * | 499 | * |
500 | * FUNCTION: acpi_ut_valid_acpi_char | ||
501 | * | ||
502 | * PARAMETERS: Char - The character to be examined | ||
503 | * | ||
504 | * RETURN: TRUE if the character is valid, FALSE otherwise | ||
505 | * | ||
506 | * DESCRIPTION: Check for a valid ACPI character. Must be one of: | ||
507 | * 1) Upper case alpha | ||
508 | * 2) numeric | ||
509 | * 3) underscore | ||
510 | * | ||
511 | * We allow a '!' as the last character because of the ASF! table | ||
512 | * | ||
513 | ******************************************************************************/ | ||
514 | |||
515 | u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) | ||
516 | { | ||
517 | |||
518 | if (!((character >= 'A' && character <= 'Z') || | ||
519 | (character >= '0' && character <= '9') || (character == '_'))) { | ||
520 | |||
521 | /* Allow a '!' in the last position */ | ||
522 | |||
523 | if (character == '!' && position == 3) { | ||
524 | return (TRUE); | ||
525 | } | ||
526 | |||
527 | return (FALSE); | ||
528 | } | ||
529 | |||
530 | return (TRUE); | ||
531 | } | ||
532 | |||
533 | /******************************************************************************* | ||
534 | * | ||
470 | * FUNCTION: acpi_ut_valid_acpi_name | 535 | * FUNCTION: acpi_ut_valid_acpi_name |
471 | * | 536 | * |
472 | * PARAMETERS: Name - The name to be examined | 537 | * PARAMETERS: Name - The name to be examined |
@@ -482,19 +547,13 @@ acpi_ut_display_init_pathname(u8 type, | |||
482 | 547 | ||
483 | u8 acpi_ut_valid_acpi_name(u32 name) | 548 | u8 acpi_ut_valid_acpi_name(u32 name) |
484 | { | 549 | { |
485 | char *name_ptr = (char *)&name; | ||
486 | char character; | ||
487 | acpi_native_uint i; | 550 | acpi_native_uint i; |
488 | 551 | ||
489 | ACPI_FUNCTION_ENTRY(); | 552 | ACPI_FUNCTION_ENTRY(); |
490 | 553 | ||
491 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 554 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
492 | character = *name_ptr; | 555 | if (!acpi_ut_valid_acpi_char |
493 | name_ptr++; | 556 | ((ACPI_CAST_PTR(char, &name))[i], i)) { |
494 | |||
495 | if (!((character == '_') || | ||
496 | (character >= 'A' && character <= 'Z') || | ||
497 | (character >= '0' && character <= '9'))) { | ||
498 | return (FALSE); | 557 | return (FALSE); |
499 | } | 558 | } |
500 | } | 559 | } |
@@ -504,24 +563,37 @@ u8 acpi_ut_valid_acpi_name(u32 name) | |||
504 | 563 | ||
505 | /******************************************************************************* | 564 | /******************************************************************************* |
506 | * | 565 | * |
507 | * FUNCTION: acpi_ut_valid_acpi_character | 566 | * FUNCTION: acpi_ut_repair_name |
508 | * | 567 | * |
509 | * PARAMETERS: Character - The character to be examined | 568 | * PARAMETERS: Name - The ACPI name to be repaired |
510 | * | 569 | * |
511 | * RETURN: 1 if Character may appear in a name, else 0 | 570 | * RETURN: Repaired version of the name |
512 | * | 571 | * |
513 | * DESCRIPTION: Check for a printable character | 572 | * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and |
573 | * return the new name. | ||
514 | * | 574 | * |
515 | ******************************************************************************/ | 575 | ******************************************************************************/ |
516 | 576 | ||
517 | u8 acpi_ut_valid_acpi_character(char character) | 577 | acpi_name acpi_ut_repair_name(acpi_name name) |
518 | { | 578 | { |
579 | char *name_ptr = ACPI_CAST_PTR(char, &name); | ||
580 | char new_name[ACPI_NAME_SIZE]; | ||
581 | acpi_native_uint i; | ||
519 | 582 | ||
520 | ACPI_FUNCTION_ENTRY(); | 583 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
584 | new_name[i] = name_ptr[i]; | ||
521 | 585 | ||
522 | return ((u8) ((character == '_') || | 586 | /* |
523 | (character >= 'A' && character <= 'Z') || | 587 | * Replace a bad character with something printable, yet technically |
524 | (character >= '0' && character <= '9'))); | 588 | * still invalid. This prevents any collisions with existing "good" |
589 | * names in the namespace. | ||
590 | */ | ||
591 | if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) { | ||
592 | new_name[i] = '*'; | ||
593 | } | ||
594 | } | ||
595 | |||
596 | return (*ACPI_CAST_PTR(u32, new_name)); | ||
525 | } | 597 | } |
526 | 598 | ||
527 | /******************************************************************************* | 599 | /******************************************************************************* |
@@ -529,7 +601,8 @@ u8 acpi_ut_valid_acpi_character(char character) | |||
529 | * FUNCTION: acpi_ut_strtoul64 | 601 | * FUNCTION: acpi_ut_strtoul64 |
530 | * | 602 | * |
531 | * PARAMETERS: String - Null terminated string | 603 | * PARAMETERS: String - Null terminated string |
532 | * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE | 604 | * Base - Radix of the string: 16 or ACPI_ANY_BASE; |
605 | * ACPI_ANY_BASE means 'in behalf of to_integer' | ||
533 | * ret_integer - Where the converted integer is returned | 606 | * ret_integer - Where the converted integer is returned |
534 | * | 607 | * |
535 | * RETURN: Status and Converted value | 608 | * RETURN: Status and Converted value |
@@ -545,16 +618,17 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
545 | u32 this_digit = 0; | 618 | u32 this_digit = 0; |
546 | acpi_integer return_value = 0; | 619 | acpi_integer return_value = 0; |
547 | acpi_integer quotient; | 620 | acpi_integer quotient; |
621 | acpi_integer dividend; | ||
622 | u32 to_integer_op = (base == ACPI_ANY_BASE); | ||
623 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); | ||
624 | u8 valid_digits = 0; | ||
625 | u8 sign_of0x = 0; | ||
626 | u8 term = 0; | ||
548 | 627 | ||
549 | ACPI_FUNCTION_TRACE("ut_stroul64"); | 628 | ACPI_FUNCTION_TRACE(ut_stroul64); |
550 | |||
551 | if ((!string) || !(*string)) { | ||
552 | goto error_exit; | ||
553 | } | ||
554 | 629 | ||
555 | switch (base) { | 630 | switch (base) { |
556 | case ACPI_ANY_BASE: | 631 | case ACPI_ANY_BASE: |
557 | case 10: | ||
558 | case 16: | 632 | case 16: |
559 | break; | 633 | break; |
560 | 634 | ||
@@ -563,76 +637,110 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
563 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 637 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
564 | } | 638 | } |
565 | 639 | ||
640 | if (!string) { | ||
641 | goto error_exit; | ||
642 | } | ||
643 | |||
566 | /* Skip over any white space in the buffer */ | 644 | /* Skip over any white space in the buffer */ |
567 | 645 | ||
568 | while (ACPI_IS_SPACE(*string) || *string == '\t') { | 646 | while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { |
569 | string++; | 647 | string++; |
570 | } | 648 | } |
571 | 649 | ||
572 | /* | 650 | if (to_integer_op) { |
573 | * If the input parameter Base is zero, then we need to | 651 | /* |
574 | * determine if it is decimal or hexadecimal: | 652 | * Base equal to ACPI_ANY_BASE means 'to_integer operation case'. |
575 | */ | 653 | * We need to determine if it is decimal or hexadecimal. |
576 | if (base == 0) { | 654 | */ |
577 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { | 655 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { |
656 | sign_of0x = 1; | ||
578 | base = 16; | 657 | base = 16; |
658 | |||
659 | /* Skip over the leading '0x' */ | ||
579 | string += 2; | 660 | string += 2; |
580 | } else { | 661 | } else { |
581 | base = 10; | 662 | base = 10; |
582 | } | 663 | } |
583 | } | 664 | } |
584 | 665 | ||
585 | /* | 666 | /* Any string left? Check that '0x' is not followed by white space. */ |
586 | * For hexadecimal base, skip over the leading | 667 | |
587 | * 0 or 0x, if they are present. | 668 | if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { |
588 | */ | 669 | if (to_integer_op) { |
589 | if ((base == 16) && | 670 | goto error_exit; |
590 | (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { | 671 | } else { |
591 | string += 2; | 672 | goto all_done; |
673 | } | ||
592 | } | 674 | } |
593 | 675 | ||
594 | /* Any string left? */ | 676 | dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; |
595 | 677 | ||
596 | if (!(*string)) { | 678 | /* At least one character in the string here */ |
597 | goto error_exit; | ||
598 | } | ||
599 | 679 | ||
600 | /* Main loop: convert the string to a 64-bit integer */ | 680 | /* Main loop: convert the string to a 64-bit integer */ |
601 | 681 | ||
602 | while (*string) { | 682 | while (*string) { |
603 | if (ACPI_IS_DIGIT(*string)) { | 683 | if (ACPI_IS_DIGIT(*string)) { |
684 | |||
604 | /* Convert ASCII 0-9 to Decimal value */ | 685 | /* Convert ASCII 0-9 to Decimal value */ |
605 | 686 | ||
606 | this_digit = ((u8) * string) - '0'; | 687 | this_digit = ((u8) * string) - '0'; |
607 | } else { | 688 | } else if (base == 10) { |
608 | if (base == 10) { | ||
609 | /* Digit is out of range */ | ||
610 | 689 | ||
611 | goto error_exit; | 690 | /* Digit is out of range; possible in to_integer case only */ |
612 | } | ||
613 | 691 | ||
692 | term = 1; | ||
693 | } else { | ||
614 | this_digit = (u8) ACPI_TOUPPER(*string); | 694 | this_digit = (u8) ACPI_TOUPPER(*string); |
615 | if (ACPI_IS_XDIGIT((char)this_digit)) { | 695 | if (ACPI_IS_XDIGIT((char)this_digit)) { |
696 | |||
616 | /* Convert ASCII Hex char to value */ | 697 | /* Convert ASCII Hex char to value */ |
617 | 698 | ||
618 | this_digit = this_digit - 'A' + 10; | 699 | this_digit = this_digit - 'A' + 10; |
619 | } else { | 700 | } else { |
620 | /* | 701 | term = 1; |
621 | * We allow non-hex chars, just stop now, same as end-of-string. | 702 | } |
622 | * See ACPI spec, string-to-integer conversion. | 703 | } |
623 | */ | 704 | |
705 | if (term) { | ||
706 | if (to_integer_op) { | ||
707 | goto error_exit; | ||
708 | } else { | ||
624 | break; | 709 | break; |
625 | } | 710 | } |
711 | } else if ((valid_digits == 0) && (this_digit == 0) | ||
712 | && !sign_of0x) { | ||
713 | |||
714 | /* Skip zeros */ | ||
715 | string++; | ||
716 | continue; | ||
717 | } | ||
718 | |||
719 | valid_digits++; | ||
720 | |||
721 | if (sign_of0x | ||
722 | && ((valid_digits > 16) | ||
723 | || ((valid_digits > 8) && mode32))) { | ||
724 | /* | ||
725 | * This is to_integer operation case. | ||
726 | * No any restrictions for string-to-integer conversion, | ||
727 | * see ACPI spec. | ||
728 | */ | ||
729 | goto error_exit; | ||
626 | } | 730 | } |
627 | 731 | ||
628 | /* Divide the digit into the correct position */ | 732 | /* Divide the digit into the correct position */ |
629 | 733 | ||
630 | (void) | 734 | (void) |
631 | acpi_ut_short_divide((ACPI_INTEGER_MAX - | 735 | acpi_ut_short_divide((dividend - (acpi_integer) this_digit), |
632 | (acpi_integer) this_digit), base, | 736 | base, "ient, NULL); |
633 | "ient, NULL); | 737 | |
634 | if (return_value > quotient) { | 738 | if (return_value > quotient) { |
635 | goto error_exit; | 739 | if (to_integer_op) { |
740 | goto error_exit; | ||
741 | } else { | ||
742 | break; | ||
743 | } | ||
636 | } | 744 | } |
637 | 745 | ||
638 | return_value *= base; | 746 | return_value *= base; |
@@ -642,6 +750,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
642 | 750 | ||
643 | /* All done, normal exit */ | 751 | /* All done, normal exit */ |
644 | 752 | ||
753 | all_done: | ||
754 | |||
645 | *ret_integer = return_value; | 755 | *ret_integer = return_value; |
646 | return_ACPI_STATUS(AE_OK); | 756 | return_ACPI_STATUS(AE_OK); |
647 | 757 | ||
@@ -719,7 +829,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
719 | u32 this_index; | 829 | u32 this_index; |
720 | union acpi_operand_object *this_source_obj; | 830 | union acpi_operand_object *this_source_obj; |
721 | 831 | ||
722 | ACPI_FUNCTION_TRACE("ut_walk_package_tree"); | 832 | ACPI_FUNCTION_TRACE(ut_walk_package_tree); |
723 | 833 | ||
724 | state = acpi_ut_create_pkg_state(source_object, target_object, 0); | 834 | state = acpi_ut_create_pkg_state(source_object, target_object, 0); |
725 | if (!state) { | 835 | if (!state) { |
@@ -727,6 +837,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
727 | } | 837 | } |
728 | 838 | ||
729 | while (state) { | 839 | while (state) { |
840 | |||
730 | /* Get one element of the package */ | 841 | /* Get one element of the package */ |
731 | 842 | ||
732 | this_index = state->pkg.index; | 843 | this_index = state->pkg.index; |
@@ -814,31 +925,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
814 | 925 | ||
815 | /******************************************************************************* | 926 | /******************************************************************************* |
816 | * | 927 | * |
817 | * FUNCTION: acpi_ut_generate_checksum | ||
818 | * | ||
819 | * PARAMETERS: Buffer - Buffer to be scanned | ||
820 | * Length - number of bytes to examine | ||
821 | * | ||
822 | * RETURN: The generated checksum | ||
823 | * | ||
824 | * DESCRIPTION: Generate a checksum on a raw buffer | ||
825 | * | ||
826 | ******************************************************************************/ | ||
827 | |||
828 | u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) | ||
829 | { | ||
830 | u32 i; | ||
831 | signed char sum = 0; | ||
832 | |||
833 | for (i = 0; i < length; i++) { | ||
834 | sum = (signed char)(sum + buffer[i]); | ||
835 | } | ||
836 | |||
837 | return ((u8) (0 - sum)); | ||
838 | } | ||
839 | |||
840 | /******************************************************************************* | ||
841 | * | ||
842 | * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info | 928 | * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info |
843 | * | 929 | * |
844 | * PARAMETERS: module_name - Caller's module name (for error output) | 930 | * PARAMETERS: module_name - Caller's module name (for error output) |
@@ -900,36 +986,3 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) | |||
900 | acpi_os_vprintf(format, args); | 986 | acpi_os_vprintf(format, args); |
901 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 987 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
902 | } | 988 | } |
903 | |||
904 | /******************************************************************************* | ||
905 | * | ||
906 | * FUNCTION: acpi_ut_report_error, Warning, Info | ||
907 | * | ||
908 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
909 | * line_number - Caller's line number (for error output) | ||
910 | * | ||
911 | * RETURN: None | ||
912 | * | ||
913 | * DESCRIPTION: Print error message | ||
914 | * | ||
915 | * Note: Legacy only, should be removed when no longer used by drivers. | ||
916 | * | ||
917 | ******************************************************************************/ | ||
918 | |||
919 | void acpi_ut_report_error(char *module_name, u32 line_number) | ||
920 | { | ||
921 | |||
922 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
923 | } | ||
924 | |||
925 | void acpi_ut_report_warning(char *module_name, u32 line_number) | ||
926 | { | ||
927 | |||
928 | acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); | ||
929 | } | ||
930 | |||
931 | void acpi_ut_report_info(char *module_name, u32 line_number) | ||
932 | { | ||
933 | |||
934 | acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); | ||
935 | } | ||
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 45a7244df924..25eb34369afa 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c | |||
@@ -68,19 +68,26 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
68 | u32 i; | 68 | u32 i; |
69 | acpi_status status; | 69 | acpi_status status; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ut_mutex_initialize"); | 71 | ACPI_FUNCTION_TRACE(ut_mutex_initialize); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Create each of the predefined mutex objects | 74 | * Create each of the predefined mutex objects |
75 | */ | 75 | */ |
76 | for (i = 0; i < NUM_MUTEX; i++) { | 76 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
77 | status = acpi_ut_create_mutex(i); | 77 | status = acpi_ut_create_mutex(i); |
78 | if (ACPI_FAILURE(status)) { | 78 | if (ACPI_FAILURE(status)) { |
79 | return_ACPI_STATUS(status); | 79 | return_ACPI_STATUS(status); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | /* Create the spinlocks for use at interrupt level */ | ||
84 | |||
83 | status = acpi_os_create_lock(&acpi_gbl_gpe_lock); | 85 | status = acpi_os_create_lock(&acpi_gbl_gpe_lock); |
86 | if (ACPI_FAILURE(status)) { | ||
87 | return_ACPI_STATUS(status); | ||
88 | } | ||
89 | |||
90 | status = acpi_os_create_lock(&acpi_gbl_hardware_lock); | ||
84 | return_ACPI_STATUS(status); | 91 | return_ACPI_STATUS(status); |
85 | } | 92 | } |
86 | 93 | ||
@@ -100,16 +107,19 @@ void acpi_ut_mutex_terminate(void) | |||
100 | { | 107 | { |
101 | u32 i; | 108 | u32 i; |
102 | 109 | ||
103 | ACPI_FUNCTION_TRACE("ut_mutex_terminate"); | 110 | ACPI_FUNCTION_TRACE(ut_mutex_terminate); |
104 | 111 | ||
105 | /* | 112 | /* |
106 | * Delete each predefined mutex object | 113 | * Delete each predefined mutex object |
107 | */ | 114 | */ |
108 | for (i = 0; i < NUM_MUTEX; i++) { | 115 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
109 | (void)acpi_ut_delete_mutex(i); | 116 | (void)acpi_ut_delete_mutex(i); |
110 | } | 117 | } |
111 | 118 | ||
119 | /* Delete the spinlocks */ | ||
120 | |||
112 | acpi_os_delete_lock(acpi_gbl_gpe_lock); | 121 | acpi_os_delete_lock(acpi_gbl_gpe_lock); |
122 | acpi_os_delete_lock(acpi_gbl_hardware_lock); | ||
113 | return_VOID; | 123 | return_VOID; |
114 | } | 124 | } |
115 | 125 | ||
@@ -129,9 +139,9 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
129 | { | 139 | { |
130 | acpi_status status = AE_OK; | 140 | acpi_status status = AE_OK; |
131 | 141 | ||
132 | ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id); | 142 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); |
133 | 143 | ||
134 | if (mutex_id > MAX_MUTEX) { | 144 | if (mutex_id > ACPI_MAX_MUTEX) { |
135 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 145 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
136 | } | 146 | } |
137 | 147 | ||
@@ -163,9 +173,9 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | |||
163 | { | 173 | { |
164 | acpi_status status; | 174 | acpi_status status; |
165 | 175 | ||
166 | ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id); | 176 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); |
167 | 177 | ||
168 | if (mutex_id > MAX_MUTEX) { | 178 | if (mutex_id > ACPI_MAX_MUTEX) { |
169 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 179 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
170 | } | 180 | } |
171 | 181 | ||
@@ -192,11 +202,11 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | |||
192 | acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | 202 | acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) |
193 | { | 203 | { |
194 | acpi_status status; | 204 | acpi_status status; |
195 | u32 this_thread_id; | 205 | acpi_thread_id this_thread_id; |
196 | 206 | ||
197 | ACPI_FUNCTION_NAME("ut_acquire_mutex"); | 207 | ACPI_FUNCTION_NAME(ut_acquire_mutex); |
198 | 208 | ||
199 | if (mutex_id > MAX_MUTEX) { | 209 | if (mutex_id > ACPI_MAX_MUTEX) { |
200 | return (AE_BAD_PARAMETER); | 210 | return (AE_BAD_PARAMETER); |
201 | } | 211 | } |
202 | 212 | ||
@@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
213 | * the mutex ordering rule. This indicates a coding error somewhere in | 223 | * the mutex ordering rule. This indicates a coding error somewhere in |
214 | * the ACPI subsystem code. | 224 | * the ACPI subsystem code. |
215 | */ | 225 | */ |
216 | for (i = mutex_id; i < MAX_MUTEX; i++) { | 226 | for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { |
217 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 227 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
218 | if (i == mutex_id) { | 228 | if (i == mutex_id) { |
219 | ACPI_ERROR((AE_INFO, | 229 | ACPI_ERROR((AE_INFO, |
@@ -275,16 +285,16 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
275 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | 285 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) |
276 | { | 286 | { |
277 | acpi_status status; | 287 | acpi_status status; |
278 | u32 this_thread_id; | 288 | acpi_thread_id this_thread_id; |
279 | 289 | ||
280 | ACPI_FUNCTION_NAME("ut_release_mutex"); | 290 | ACPI_FUNCTION_NAME(ut_release_mutex); |
281 | 291 | ||
282 | this_thread_id = acpi_os_get_thread_id(); | 292 | this_thread_id = acpi_os_get_thread_id(); |
283 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 293 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
284 | "Thread %X releasing Mutex [%s]\n", this_thread_id, | 294 | "Thread %X releasing Mutex [%s]\n", this_thread_id, |
285 | acpi_ut_get_mutex_name(mutex_id))); | 295 | acpi_ut_get_mutex_name(mutex_id))); |
286 | 296 | ||
287 | if (mutex_id > MAX_MUTEX) { | 297 | if (mutex_id > ACPI_MAX_MUTEX) { |
288 | return (AE_BAD_PARAMETER); | 298 | return (AE_BAD_PARAMETER); |
289 | } | 299 | } |
290 | 300 | ||
@@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | |||
309 | * ordering rule. This indicates a coding error somewhere in | 319 | * ordering rule. This indicates a coding error somewhere in |
310 | * the ACPI subsystem code. | 320 | * the ACPI subsystem code. |
311 | */ | 321 | */ |
312 | for (i = mutex_id; i < MAX_MUTEX; i++) { | 322 | for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { |
313 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 323 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
314 | if (i == mutex_id) { | 324 | if (i == mutex_id) { |
315 | continue; | 325 | continue; |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 7ee2d1d98071..ba7d8ac702df 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -92,7 +92,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, | |||
92 | union acpi_operand_object *object; | 92 | union acpi_operand_object *object; |
93 | union acpi_operand_object *second_object; | 93 | union acpi_operand_object *second_object; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg", | 95 | ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg, |
96 | acpi_ut_get_type_name(type)); | 96 | acpi_ut_get_type_name(type)); |
97 | 97 | ||
98 | /* Allocate the raw object descriptor */ | 98 | /* Allocate the raw object descriptor */ |
@@ -161,7 +161,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) | |||
161 | union acpi_operand_object *buffer_desc; | 161 | union acpi_operand_object *buffer_desc; |
162 | u8 *buffer = NULL; | 162 | u8 *buffer = NULL; |
163 | 163 | ||
164 | ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size); | 164 | ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size); |
165 | 165 | ||
166 | /* Create a new Buffer object */ | 166 | /* Create a new Buffer object */ |
167 | 167 | ||
@@ -173,9 +173,10 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) | |||
173 | /* Create an actual buffer only if size > 0 */ | 173 | /* Create an actual buffer only if size > 0 */ |
174 | 174 | ||
175 | if (buffer_size > 0) { | 175 | if (buffer_size > 0) { |
176 | |||
176 | /* Allocate the actual buffer */ | 177 | /* Allocate the actual buffer */ |
177 | 178 | ||
178 | buffer = ACPI_MEM_CALLOCATE(buffer_size); | 179 | buffer = ACPI_ALLOCATE_ZEROED(buffer_size); |
179 | if (!buffer) { | 180 | if (!buffer) { |
180 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", | 181 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", |
181 | (u32) buffer_size)); | 182 | (u32) buffer_size)); |
@@ -214,7 +215,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
214 | union acpi_operand_object *string_desc; | 215 | union acpi_operand_object *string_desc; |
215 | char *string; | 216 | char *string; |
216 | 217 | ||
217 | ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size); | 218 | ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size); |
218 | 219 | ||
219 | /* Create a new String object */ | 220 | /* Create a new String object */ |
220 | 221 | ||
@@ -227,7 +228,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
227 | * Allocate the actual string buffer -- (Size + 1) for NULL terminator. | 228 | * Allocate the actual string buffer -- (Size + 1) for NULL terminator. |
228 | * NOTE: Zero-length strings are NULL terminated | 229 | * NOTE: Zero-length strings are NULL terminated |
229 | */ | 230 | */ |
230 | string = ACPI_MEM_CALLOCATE(string_size + 1); | 231 | string = ACPI_ALLOCATE_ZEROED(string_size + 1); |
231 | if (!string) { | 232 | if (!string) { |
232 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", | 233 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", |
233 | (u32) string_size)); | 234 | (u32) string_size)); |
@@ -260,7 +261,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
260 | u8 acpi_ut_valid_internal_object(void *object) | 261 | u8 acpi_ut_valid_internal_object(void *object) |
261 | { | 262 | { |
262 | 263 | ||
263 | ACPI_FUNCTION_NAME("ut_valid_internal_object"); | 264 | ACPI_FUNCTION_NAME(ut_valid_internal_object); |
264 | 265 | ||
265 | /* Check for a null pointer */ | 266 | /* Check for a null pointer */ |
266 | 267 | ||
@@ -308,7 +309,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
308 | { | 309 | { |
309 | union acpi_operand_object *object; | 310 | union acpi_operand_object *object; |
310 | 311 | ||
311 | ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg"); | 312 | ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg); |
312 | 313 | ||
313 | object = acpi_os_acquire_object(acpi_gbl_operand_cache); | 314 | object = acpi_os_acquire_object(acpi_gbl_operand_cache); |
314 | if (!object) { | 315 | if (!object) { |
@@ -319,6 +320,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
319 | } | 320 | } |
320 | 321 | ||
321 | /* Mark the descriptor type */ | 322 | /* Mark the descriptor type */ |
323 | |||
322 | memset(object, 0, sizeof(union acpi_operand_object)); | 324 | memset(object, 0, sizeof(union acpi_operand_object)); |
323 | ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); | 325 | ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); |
324 | 326 | ||
@@ -342,7 +344,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
342 | 344 | ||
343 | void acpi_ut_delete_object_desc(union acpi_operand_object *object) | 345 | void acpi_ut_delete_object_desc(union acpi_operand_object *object) |
344 | { | 346 | { |
345 | ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object); | 347 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); |
346 | 348 | ||
347 | /* Object must be an union acpi_operand_object */ | 349 | /* Object must be an union acpi_operand_object */ |
348 | 350 | ||
@@ -381,7 +383,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
381 | acpi_size length; | 383 | acpi_size length; |
382 | acpi_status status = AE_OK; | 384 | acpi_status status = AE_OK; |
383 | 385 | ||
384 | ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object); | 386 | ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); |
385 | 387 | ||
386 | /* | 388 | /* |
387 | * Handle a null object (Could be a uninitialized package | 389 | * Handle a null object (Could be a uninitialized package |
@@ -397,6 +399,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
397 | length = sizeof(union acpi_object); | 399 | length = sizeof(union acpi_object); |
398 | 400 | ||
399 | if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { | 401 | if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { |
402 | |||
400 | /* Object is a named object (reference), just return the length */ | 403 | /* Object is a named object (reference), just return the length */ |
401 | 404 | ||
402 | *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); | 405 | *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); |
@@ -559,7 +562,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, | |||
559 | acpi_status status; | 562 | acpi_status status; |
560 | struct acpi_pkg_info info; | 563 | struct acpi_pkg_info info; |
561 | 564 | ||
562 | ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object); | 565 | ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object); |
563 | 566 | ||
564 | info.length = 0; | 567 | info.length = 0; |
565 | info.object_space = 0; | 568 | info.object_space = 0; |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 16461317113f..5a2de92831d3 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -45,113 +45,113 @@ | |||
45 | #include <acpi/amlresrc.h> | 45 | #include <acpi/amlresrc.h> |
46 | 46 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utmisc") | 48 | ACPI_MODULE_NAME("utresrc") |
49 | 49 | ||
50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | 50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) |
51 | /* | 51 | /* |
52 | * Strings used to decode resource descriptors. | 52 | * Strings used to decode resource descriptors. |
53 | * Used by both the disasssembler and the debugger resource dump routines | 53 | * Used by both the disasssembler and the debugger resource dump routines |
54 | */ | 54 | */ |
55 | const char *acpi_gbl_BMdecode[2] = { | 55 | const char *acpi_gbl_bm_decode[] = { |
56 | "not_bus_master", | 56 | "NotBusMaster", |
57 | "bus_master" | 57 | "BusMaster" |
58 | }; | 58 | }; |
59 | 59 | ||
60 | const char *acpi_gbl_config_decode[4] = { | 60 | const char *acpi_gbl_config_decode[] = { |
61 | "0 - Good Configuration", | 61 | "0 - Good Configuration", |
62 | "1 - Acceptable Configuration", | 62 | "1 - Acceptable Configuration", |
63 | "2 - Suboptimal Configuration", | 63 | "2 - Suboptimal Configuration", |
64 | "3 - ***Invalid Configuration***", | 64 | "3 - ***Invalid Configuration***", |
65 | }; | 65 | }; |
66 | 66 | ||
67 | const char *acpi_gbl_consume_decode[2] = { | 67 | const char *acpi_gbl_consume_decode[] = { |
68 | "resource_producer", | 68 | "ResourceProducer", |
69 | "resource_consumer" | 69 | "ResourceConsumer" |
70 | }; | 70 | }; |
71 | 71 | ||
72 | const char *acpi_gbl_DECdecode[2] = { | 72 | const char *acpi_gbl_dec_decode[] = { |
73 | "pos_decode", | 73 | "PosDecode", |
74 | "sub_decode" | 74 | "SubDecode" |
75 | }; | 75 | }; |
76 | 76 | ||
77 | const char *acpi_gbl_HEdecode[2] = { | 77 | const char *acpi_gbl_he_decode[] = { |
78 | "Level", | 78 | "Level", |
79 | "Edge" | 79 | "Edge" |
80 | }; | 80 | }; |
81 | 81 | ||
82 | const char *acpi_gbl_io_decode[2] = { | 82 | const char *acpi_gbl_io_decode[] = { |
83 | "Decode10", | 83 | "Decode10", |
84 | "Decode16" | 84 | "Decode16" |
85 | }; | 85 | }; |
86 | 86 | ||
87 | const char *acpi_gbl_LLdecode[2] = { | 87 | const char *acpi_gbl_ll_decode[] = { |
88 | "active_high", | 88 | "ActiveHigh", |
89 | "active_low" | 89 | "ActiveLow" |
90 | }; | 90 | }; |
91 | 91 | ||
92 | const char *acpi_gbl_max_decode[2] = { | 92 | const char *acpi_gbl_max_decode[] = { |
93 | "max_not_fixed", | 93 | "MaxNotFixed", |
94 | "max_fixed" | 94 | "MaxFixed" |
95 | }; | 95 | }; |
96 | 96 | ||
97 | const char *acpi_gbl_MEMdecode[4] = { | 97 | const char *acpi_gbl_mem_decode[] = { |
98 | "non_cacheable", | 98 | "NonCacheable", |
99 | "Cacheable", | 99 | "Cacheable", |
100 | "write_combining", | 100 | "WriteCombining", |
101 | "Prefetchable" | 101 | "Prefetchable" |
102 | }; | 102 | }; |
103 | 103 | ||
104 | const char *acpi_gbl_min_decode[2] = { | 104 | const char *acpi_gbl_min_decode[] = { |
105 | "min_not_fixed", | 105 | "MinNotFixed", |
106 | "min_fixed" | 106 | "MinFixed" |
107 | }; | 107 | }; |
108 | 108 | ||
109 | const char *acpi_gbl_MTPdecode[4] = { | 109 | const char *acpi_gbl_mtp_decode[] = { |
110 | "address_range_memory", | 110 | "AddressRangeMemory", |
111 | "address_range_reserved", | 111 | "AddressRangeReserved", |
112 | "address_range_aCPI", | 112 | "AddressRangeACPI", |
113 | "address_range_nVS" | 113 | "AddressRangeNVS" |
114 | }; | 114 | }; |
115 | 115 | ||
116 | const char *acpi_gbl_RNGdecode[4] = { | 116 | const char *acpi_gbl_rng_decode[] = { |
117 | "invalid_ranges", | 117 | "InvalidRanges", |
118 | "non_iSAonly_ranges", | 118 | "NonISAOnlyRanges", |
119 | "ISAonly_ranges", | 119 | "ISAOnlyRanges", |
120 | "entire_range" | 120 | "EntireRange" |
121 | }; | 121 | }; |
122 | 122 | ||
123 | const char *acpi_gbl_RWdecode[2] = { | 123 | const char *acpi_gbl_rw_decode[] = { |
124 | "read_only", | 124 | "ReadOnly", |
125 | "read_write" | 125 | "ReadWrite" |
126 | }; | 126 | }; |
127 | 127 | ||
128 | const char *acpi_gbl_SHRdecode[2] = { | 128 | const char *acpi_gbl_shr_decode[] = { |
129 | "Exclusive", | 129 | "Exclusive", |
130 | "Shared" | 130 | "Shared" |
131 | }; | 131 | }; |
132 | 132 | ||
133 | const char *acpi_gbl_SIZdecode[4] = { | 133 | const char *acpi_gbl_siz_decode[] = { |
134 | "Transfer8", | 134 | "Transfer8", |
135 | "Transfer8_16", | 135 | "Transfer8_16", |
136 | "Transfer16", | 136 | "Transfer16", |
137 | "invalid_size" | 137 | "InvalidSize" |
138 | }; | 138 | }; |
139 | 139 | ||
140 | const char *acpi_gbl_TRSdecode[2] = { | 140 | const char *acpi_gbl_trs_decode[] = { |
141 | "dense_translation", | 141 | "DenseTranslation", |
142 | "sparse_translation" | 142 | "SparseTranslation" |
143 | }; | 143 | }; |
144 | 144 | ||
145 | const char *acpi_gbl_TTPdecode[2] = { | 145 | const char *acpi_gbl_ttp_decode[] = { |
146 | "type_static", | 146 | "TypeStatic", |
147 | "type_translation" | 147 | "TypeTranslation" |
148 | }; | 148 | }; |
149 | 149 | ||
150 | const char *acpi_gbl_TYPdecode[4] = { | 150 | const char *acpi_gbl_typ_decode[] = { |
151 | "Compatibility", | 151 | "Compatibility", |
152 | "type_a", | 152 | "TypeA", |
153 | "type_b", | 153 | "TypeB", |
154 | "type_f" | 154 | "TypeF" |
155 | }; | 155 | }; |
156 | 156 | ||
157 | #endif | 157 | #endif |
@@ -240,6 +240,104 @@ static const u8 acpi_gbl_resource_types[] = { | |||
240 | 240 | ||
241 | /******************************************************************************* | 241 | /******************************************************************************* |
242 | * | 242 | * |
243 | * FUNCTION: acpi_ut_walk_aml_resources | ||
244 | * | ||
245 | * PARAMETERS: Aml - Pointer to the raw AML resource template | ||
246 | * aml_length - Length of the entire template | ||
247 | * user_function - Called once for each descriptor found. If | ||
248 | * NULL, a pointer to the end_tag is returned | ||
249 | * Context - Passed to user_function | ||
250 | * | ||
251 | * RETURN: Status | ||
252 | * | ||
253 | * DESCRIPTION: Walk a raw AML resource list(buffer). User function called | ||
254 | * once for each resource found. | ||
255 | * | ||
256 | ******************************************************************************/ | ||
257 | |||
258 | acpi_status | ||
259 | acpi_ut_walk_aml_resources(u8 * aml, | ||
260 | acpi_size aml_length, | ||
261 | acpi_walk_aml_callback user_function, void **context) | ||
262 | { | ||
263 | acpi_status status; | ||
264 | u8 *end_aml; | ||
265 | u8 resource_index; | ||
266 | u32 length; | ||
267 | u32 offset = 0; | ||
268 | |||
269 | ACPI_FUNCTION_TRACE(ut_walk_aml_resources); | ||
270 | |||
271 | /* The absolute minimum resource template is one end_tag descriptor */ | ||
272 | |||
273 | if (aml_length < sizeof(struct aml_resource_end_tag)) { | ||
274 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
275 | } | ||
276 | |||
277 | /* Point to the end of the resource template buffer */ | ||
278 | |||
279 | end_aml = aml + aml_length; | ||
280 | |||
281 | /* Walk the byte list, abort on any invalid descriptor type or length */ | ||
282 | |||
283 | while (aml < end_aml) { | ||
284 | |||
285 | /* Validate the Resource Type and Resource Length */ | ||
286 | |||
287 | status = acpi_ut_validate_resource(aml, &resource_index); | ||
288 | if (ACPI_FAILURE(status)) { | ||
289 | return_ACPI_STATUS(status); | ||
290 | } | ||
291 | |||
292 | /* Get the length of this descriptor */ | ||
293 | |||
294 | length = acpi_ut_get_descriptor_length(aml); | ||
295 | |||
296 | /* Invoke the user function */ | ||
297 | |||
298 | if (user_function) { | ||
299 | status = | ||
300 | user_function(aml, length, offset, resource_index, | ||
301 | context); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | return (status); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /* An end_tag descriptor terminates this resource template */ | ||
308 | |||
309 | if (acpi_ut_get_resource_type(aml) == | ||
310 | ACPI_RESOURCE_NAME_END_TAG) { | ||
311 | /* | ||
312 | * There must be at least one more byte in the buffer for | ||
313 | * the 2nd byte of the end_tag | ||
314 | */ | ||
315 | if ((aml + 1) >= end_aml) { | ||
316 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
317 | } | ||
318 | |||
319 | /* Return the pointer to the end_tag if requested */ | ||
320 | |||
321 | if (!user_function) { | ||
322 | *context = aml; | ||
323 | } | ||
324 | |||
325 | /* Normal exit */ | ||
326 | |||
327 | return_ACPI_STATUS(AE_OK); | ||
328 | } | ||
329 | |||
330 | aml += length; | ||
331 | offset += length; | ||
332 | } | ||
333 | |||
334 | /* Did not find an end_tag descriptor */ | ||
335 | |||
336 | return (AE_AML_NO_RESOURCE_END_TAG); | ||
337 | } | ||
338 | |||
339 | /******************************************************************************* | ||
340 | * | ||
243 | * FUNCTION: acpi_ut_validate_resource | 341 | * FUNCTION: acpi_ut_validate_resource |
244 | * | 342 | * |
245 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor | 343 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor |
@@ -273,6 +371,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) | |||
273 | * Examine the large/small bit in the resource header | 371 | * Examine the large/small bit in the resource header |
274 | */ | 372 | */ |
275 | if (resource_type & ACPI_RESOURCE_NAME_LARGE) { | 373 | if (resource_type & ACPI_RESOURCE_NAME_LARGE) { |
374 | |||
276 | /* Verify the large resource type (name) against the max */ | 375 | /* Verify the large resource type (name) against the max */ |
277 | 376 | ||
278 | if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { | 377 | if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { |
@@ -376,6 +475,7 @@ u8 acpi_ut_get_resource_type(void *aml) | |||
376 | * Examine the large/small bit in the resource header | 475 | * Examine the large/small bit in the resource header |
377 | */ | 476 | */ |
378 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | 477 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { |
478 | |||
379 | /* Large Resource Type -- bits 6:0 contain the name */ | 479 | /* Large Resource Type -- bits 6:0 contain the name */ |
380 | 480 | ||
381 | return (ACPI_GET8(aml)); | 481 | return (ACPI_GET8(aml)); |
@@ -411,6 +511,7 @@ u16 acpi_ut_get_resource_length(void *aml) | |||
411 | * Examine the large/small bit in the resource header | 511 | * Examine the large/small bit in the resource header |
412 | */ | 512 | */ |
413 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | 513 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { |
514 | |||
414 | /* Large Resource type -- bytes 1-2 contain the 16-bit length */ | 515 | /* Large Resource type -- bytes 1-2 contain the 16-bit length */ |
415 | 516 | ||
416 | ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); | 517 | ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); |
@@ -495,60 +596,21 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, | |||
495 | u8 ** end_tag) | 596 | u8 ** end_tag) |
496 | { | 597 | { |
497 | acpi_status status; | 598 | acpi_status status; |
498 | u8 *aml; | ||
499 | u8 *end_aml; | ||
500 | |||
501 | ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); | ||
502 | 599 | ||
503 | /* Get start and end pointers */ | 600 | ACPI_FUNCTION_TRACE(ut_get_resource_end_tag); |
504 | |||
505 | aml = obj_desc->buffer.pointer; | ||
506 | end_aml = aml + obj_desc->buffer.length; | ||
507 | 601 | ||
508 | /* Allow a buffer length of zero */ | 602 | /* Allow a buffer length of zero */ |
509 | 603 | ||
510 | if (!obj_desc->buffer.length) { | 604 | if (!obj_desc->buffer.length) { |
511 | *end_tag = aml; | 605 | *end_tag = obj_desc->buffer.pointer; |
512 | return_ACPI_STATUS(AE_OK); | 606 | return_ACPI_STATUS(AE_OK); |
513 | } | 607 | } |
514 | 608 | ||
515 | /* Walk the resource template, one descriptor per iteration */ | 609 | /* Validate the template and get a pointer to the end_tag */ |
516 | |||
517 | while (aml < end_aml) { | ||
518 | /* Validate the Resource Type and Resource Length */ | ||
519 | |||
520 | status = acpi_ut_validate_resource(aml, NULL); | ||
521 | if (ACPI_FAILURE(status)) { | ||
522 | return_ACPI_STATUS(status); | ||
523 | } | ||
524 | |||
525 | /* end_tag resource indicates the end of the resource template */ | ||
526 | |||
527 | if (acpi_ut_get_resource_type(aml) == | ||
528 | ACPI_RESOURCE_NAME_END_TAG) { | ||
529 | /* | ||
530 | * There must be at least one more byte in the buffer for | ||
531 | * the 2nd byte of the end_tag | ||
532 | */ | ||
533 | if ((aml + 1) >= end_aml) { | ||
534 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
535 | } | ||
536 | |||
537 | /* Return the pointer to the end_tag */ | ||
538 | |||
539 | *end_tag = aml; | ||
540 | return_ACPI_STATUS(AE_OK); | ||
541 | } | ||
542 | |||
543 | /* | ||
544 | * Point to the next resource descriptor in the AML buffer. The | ||
545 | * descriptor length is guaranteed to be non-zero by resource | ||
546 | * validation above. | ||
547 | */ | ||
548 | aml += acpi_ut_get_descriptor_length(aml); | ||
549 | } | ||
550 | 610 | ||
551 | /* Did not find an end_tag resource descriptor */ | 611 | status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, |
612 | obj_desc->buffer.length, NULL, | ||
613 | (void **)end_tag); | ||
552 | 614 | ||
553 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 615 | return_ACPI_STATUS(status); |
554 | } | 616 | } |
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 4b134a722907..0f5c5bb5deff 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c | |||
@@ -96,7 +96,7 @@ void | |||
96 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, | 96 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, |
97 | union acpi_generic_state *state) | 97 | union acpi_generic_state *state) |
98 | { | 98 | { |
99 | ACPI_FUNCTION_TRACE("ut_push_generic_state"); | 99 | ACPI_FUNCTION_TRACE(ut_push_generic_state); |
100 | 100 | ||
101 | /* Push the state object onto the front of the list (stack) */ | 101 | /* Push the state object onto the front of the list (stack) */ |
102 | 102 | ||
@@ -123,12 +123,13 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state | |||
123 | { | 123 | { |
124 | union acpi_generic_state *state; | 124 | union acpi_generic_state *state; |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ut_pop_generic_state"); | 126 | ACPI_FUNCTION_TRACE(ut_pop_generic_state); |
127 | 127 | ||
128 | /* Remove the state object at the head of the list (stack) */ | 128 | /* Remove the state object at the head of the list (stack) */ |
129 | 129 | ||
130 | state = *list_head; | 130 | state = *list_head; |
131 | if (state) { | 131 | if (state) { |
132 | |||
132 | /* Update the list head */ | 133 | /* Update the list head */ |
133 | 134 | ||
134 | *list_head = state->common.next; | 135 | *list_head = state->common.next; |
@@ -158,9 +159,10 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) | |||
158 | 159 | ||
159 | state = acpi_os_acquire_object(acpi_gbl_state_cache); | 160 | state = acpi_os_acquire_object(acpi_gbl_state_cache); |
160 | if (state) { | 161 | if (state) { |
162 | |||
161 | /* Initialize */ | 163 | /* Initialize */ |
162 | memset(state, 0, sizeof(union acpi_generic_state)); | 164 | memset(state, 0, sizeof(union acpi_generic_state)); |
163 | state->common.data_type = ACPI_DESC_TYPE_STATE; | 165 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE; |
164 | } | 166 | } |
165 | 167 | ||
166 | return (state); | 168 | return (state); |
@@ -183,7 +185,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
183 | { | 185 | { |
184 | union acpi_generic_state *state; | 186 | union acpi_generic_state *state; |
185 | 187 | ||
186 | ACPI_FUNCTION_TRACE("ut_create_thread_state"); | 188 | ACPI_FUNCTION_TRACE(ut_create_thread_state); |
187 | 189 | ||
188 | /* Create the generic state object */ | 190 | /* Create the generic state object */ |
189 | 191 | ||
@@ -194,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
194 | 196 | ||
195 | /* Init fields specific to the update struct */ | 197 | /* Init fields specific to the update struct */ |
196 | 198 | ||
197 | state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; | 199 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; |
198 | state->thread.thread_id = acpi_os_get_thread_id(); | 200 | state->thread.thread_id = acpi_os_get_thread_id(); |
199 | 201 | ||
200 | return_PTR((struct acpi_thread_state *)state); | 202 | return_PTR((struct acpi_thread_state *)state); |
@@ -220,7 +222,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
220 | { | 222 | { |
221 | union acpi_generic_state *state; | 223 | union acpi_generic_state *state; |
222 | 224 | ||
223 | ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); | 225 | ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object); |
224 | 226 | ||
225 | /* Create the generic state object */ | 227 | /* Create the generic state object */ |
226 | 228 | ||
@@ -231,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
231 | 233 | ||
232 | /* Init fields specific to the update struct */ | 234 | /* Init fields specific to the update struct */ |
233 | 235 | ||
234 | state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; | 236 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; |
235 | state->update.object = object; | 237 | state->update.object = object; |
236 | state->update.value = action; | 238 | state->update.value = action; |
237 | 239 | ||
@@ -257,7 +259,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
257 | { | 259 | { |
258 | union acpi_generic_state *state; | 260 | union acpi_generic_state *state; |
259 | 261 | ||
260 | ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); | 262 | ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object); |
261 | 263 | ||
262 | /* Create the generic state object */ | 264 | /* Create the generic state object */ |
263 | 265 | ||
@@ -268,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
268 | 270 | ||
269 | /* Init fields specific to the update struct */ | 271 | /* Init fields specific to the update struct */ |
270 | 272 | ||
271 | state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; | 273 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE; |
272 | state->pkg.source_object = (union acpi_operand_object *)internal_object; | 274 | state->pkg.source_object = (union acpi_operand_object *)internal_object; |
273 | state->pkg.dest_object = external_object; | 275 | state->pkg.dest_object = external_object; |
274 | state->pkg.index = index; | 276 | state->pkg.index = index; |
@@ -294,7 +296,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
294 | { | 296 | { |
295 | union acpi_generic_state *state; | 297 | union acpi_generic_state *state; |
296 | 298 | ||
297 | ACPI_FUNCTION_TRACE("ut_create_control_state"); | 299 | ACPI_FUNCTION_TRACE(ut_create_control_state); |
298 | 300 | ||
299 | /* Create the generic state object */ | 301 | /* Create the generic state object */ |
300 | 302 | ||
@@ -305,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
305 | 307 | ||
306 | /* Init fields specific to the control struct */ | 308 | /* Init fields specific to the control struct */ |
307 | 309 | ||
308 | state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; | 310 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; |
309 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; | 311 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; |
310 | 312 | ||
311 | return_PTR(state); | 313 | return_PTR(state); |
@@ -319,15 +321,19 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
319 | * | 321 | * |
320 | * RETURN: None | 322 | * RETURN: None |
321 | * | 323 | * |
322 | * DESCRIPTION: Put a state object back into the global state cache. The object | 324 | * DESCRIPTION: Release a state object to the state cache. NULL state objects |
323 | * is not actually freed at this time. | 325 | * are ignored. |
324 | * | 326 | * |
325 | ******************************************************************************/ | 327 | ******************************************************************************/ |
326 | 328 | ||
327 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) | 329 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) |
328 | { | 330 | { |
329 | ACPI_FUNCTION_TRACE("ut_delete_generic_state"); | 331 | ACPI_FUNCTION_TRACE(ut_delete_generic_state); |
332 | |||
333 | /* Ignore null state */ | ||
330 | 334 | ||
331 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | 335 | if (state) { |
336 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | ||
337 | } | ||
332 | return_VOID; | 338 | return_VOID; |
333 | } | 339 | } |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 308a960871be..3538f69c82a1 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acevents.h> | 45 | #include <acpi/acevents.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
@@ -67,7 +65,7 @@ acpi_status acpi_initialize_subsystem(void) | |||
67 | { | 65 | { |
68 | acpi_status status; | 66 | acpi_status status; |
69 | 67 | ||
70 | ACPI_FUNCTION_TRACE("acpi_initialize_subsystem"); | 68 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); |
71 | 69 | ||
72 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | 70 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); |
73 | 71 | ||
@@ -109,6 +107,8 @@ acpi_status acpi_initialize_subsystem(void) | |||
109 | return_ACPI_STATUS(status); | 107 | return_ACPI_STATUS(status); |
110 | } | 108 | } |
111 | 109 | ||
110 | ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) | ||
111 | |||
112 | /******************************************************************************* | 112 | /******************************************************************************* |
113 | * | 113 | * |
114 | * FUNCTION: acpi_enable_subsystem | 114 | * FUNCTION: acpi_enable_subsystem |
@@ -121,12 +121,11 @@ acpi_status acpi_initialize_subsystem(void) | |||
121 | * Puts system into ACPI mode if it isn't already. | 121 | * Puts system into ACPI mode if it isn't already. |
122 | * | 122 | * |
123 | ******************************************************************************/ | 123 | ******************************************************************************/ |
124 | |||
125 | acpi_status acpi_enable_subsystem(u32 flags) | 124 | acpi_status acpi_enable_subsystem(u32 flags) |
126 | { | 125 | { |
127 | acpi_status status = AE_OK; | 126 | acpi_status status = AE_OK; |
128 | 127 | ||
129 | ACPI_FUNCTION_TRACE("acpi_enable_subsystem"); | 128 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); |
130 | 129 | ||
131 | /* | 130 | /* |
132 | * We must initialize the hardware before we can enable ACPI. | 131 | * We must initialize the hardware before we can enable ACPI. |
@@ -152,7 +151,7 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
152 | 151 | ||
153 | status = acpi_enable(); | 152 | status = acpi_enable(); |
154 | if (ACPI_FAILURE(status)) { | 153 | if (ACPI_FAILURE(status)) { |
155 | ACPI_WARNING((AE_INFO, "acpi_enable failed")); | 154 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); |
156 | return_ACPI_STATUS(status); | 155 | return_ACPI_STATUS(status); |
157 | } | 156 | } |
158 | } | 157 | } |
@@ -229,6 +228,8 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
229 | return_ACPI_STATUS(status); | 228 | return_ACPI_STATUS(status); |
230 | } | 229 | } |
231 | 230 | ||
231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
232 | |||
232 | /******************************************************************************* | 233 | /******************************************************************************* |
233 | * | 234 | * |
234 | * FUNCTION: acpi_initialize_objects | 235 | * FUNCTION: acpi_initialize_objects |
@@ -241,12 +242,11 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
241 | * objects and executing AML code for Regions, buffers, etc. | 242 | * objects and executing AML code for Regions, buffers, etc. |
242 | * | 243 | * |
243 | ******************************************************************************/ | 244 | ******************************************************************************/ |
244 | |||
245 | acpi_status acpi_initialize_objects(u32 flags) | 245 | acpi_status acpi_initialize_objects(u32 flags) |
246 | { | 246 | { |
247 | acpi_status status = AE_OK; | 247 | acpi_status status = AE_OK; |
248 | 248 | ||
249 | ACPI_FUNCTION_TRACE("acpi_initialize_objects"); | 249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); |
250 | 250 | ||
251 | /* | 251 | /* |
252 | * Run all _REG methods | 252 | * Run all _REG methods |
@@ -257,7 +257,7 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
257 | */ | 257 | */ |
258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
260 | "[Init] Executing _REG op_region methods\n")); | 260 | "[Init] Executing _REG OpRegion methods\n")); |
261 | 261 | ||
262 | status = acpi_ev_initialize_op_regions(); | 262 | status = acpi_ev_initialize_op_regions(); |
263 | if (ACPI_FAILURE(status)) { | 263 | if (ACPI_FAILURE(status)) { |
@@ -305,6 +305,8 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
305 | return_ACPI_STATUS(status); | 305 | return_ACPI_STATUS(status); |
306 | } | 306 | } |
307 | 307 | ||
308 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||
309 | |||
308 | /******************************************************************************* | 310 | /******************************************************************************* |
309 | * | 311 | * |
310 | * FUNCTION: acpi_terminate | 312 | * FUNCTION: acpi_terminate |
@@ -316,12 +318,11 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
316 | * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. | 318 | * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. |
317 | * | 319 | * |
318 | ******************************************************************************/ | 320 | ******************************************************************************/ |
319 | |||
320 | acpi_status acpi_terminate(void) | 321 | acpi_status acpi_terminate(void) |
321 | { | 322 | { |
322 | acpi_status status; | 323 | acpi_status status; |
323 | 324 | ||
324 | ACPI_FUNCTION_TRACE("acpi_terminate"); | 325 | ACPI_FUNCTION_TRACE(acpi_terminate); |
325 | 326 | ||
326 | /* Terminate the AML Debugger if present */ | 327 | /* Terminate the AML Debugger if present */ |
327 | 328 | ||
@@ -348,6 +349,8 @@ acpi_status acpi_terminate(void) | |||
348 | return_ACPI_STATUS(status); | 349 | return_ACPI_STATUS(status); |
349 | } | 350 | } |
350 | 351 | ||
352 | ACPI_EXPORT_SYMBOL(acpi_terminate) | ||
353 | |||
351 | #ifdef ACPI_FUTURE_USAGE | 354 | #ifdef ACPI_FUTURE_USAGE |
352 | /******************************************************************************* | 355 | /******************************************************************************* |
353 | * | 356 | * |
@@ -362,7 +365,6 @@ acpi_status acpi_terminate(void) | |||
362 | * initialized successfully. | 365 | * initialized successfully. |
363 | * | 366 | * |
364 | ******************************************************************************/ | 367 | ******************************************************************************/ |
365 | |||
366 | acpi_status acpi_subsystem_status(void) | 368 | acpi_status acpi_subsystem_status(void) |
367 | { | 369 | { |
368 | 370 | ||
@@ -373,6 +375,8 @@ acpi_status acpi_subsystem_status(void) | |||
373 | } | 375 | } |
374 | } | 376 | } |
375 | 377 | ||
378 | ACPI_EXPORT_SYMBOL(acpi_subsystem_status) | ||
379 | |||
376 | /******************************************************************************* | 380 | /******************************************************************************* |
377 | * | 381 | * |
378 | * FUNCTION: acpi_get_system_info | 382 | * FUNCTION: acpi_get_system_info |
@@ -390,14 +394,13 @@ acpi_status acpi_subsystem_status(void) | |||
390 | * and the value of out_buffer is undefined. | 394 | * and the value of out_buffer is undefined. |
391 | * | 395 | * |
392 | ******************************************************************************/ | 396 | ******************************************************************************/ |
393 | |||
394 | acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) | 397 | acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) |
395 | { | 398 | { |
396 | struct acpi_system_info *info_ptr; | 399 | struct acpi_system_info *info_ptr; |
397 | acpi_status status; | 400 | acpi_status status; |
398 | u32 i; | 401 | u32 i; |
399 | 402 | ||
400 | ACPI_FUNCTION_TRACE("acpi_get_system_info"); | 403 | ACPI_FUNCTION_TRACE(acpi_get_system_info); |
401 | 404 | ||
402 | /* Parameter validation */ | 405 | /* Parameter validation */ |
403 | 406 | ||
@@ -448,15 +451,15 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) | |||
448 | 451 | ||
449 | /* Current status of the ACPI tables, per table type */ | 452 | /* Current status of the ACPI tables, per table type */ |
450 | 453 | ||
451 | info_ptr->num_table_types = NUM_ACPI_TABLE_TYPES; | 454 | info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1; |
452 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 455 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
453 | info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; | 456 | info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; |
454 | } | 457 | } |
455 | 458 | ||
456 | return_ACPI_STATUS(AE_OK); | 459 | return_ACPI_STATUS(AE_OK); |
457 | } | 460 | } |
458 | 461 | ||
459 | EXPORT_SYMBOL(acpi_get_system_info); | 462 | ACPI_EXPORT_SYMBOL(acpi_get_system_info) |
460 | 463 | ||
461 | /***************************************************************************** | 464 | /***************************************************************************** |
462 | * | 465 | * |
@@ -472,7 +475,6 @@ EXPORT_SYMBOL(acpi_get_system_info); | |||
472 | * TBD: When a second function is added, must save the Function also. | 475 | * TBD: When a second function is added, must save the Function also. |
473 | * | 476 | * |
474 | ****************************************************************************/ | 477 | ****************************************************************************/ |
475 | |||
476 | acpi_status | 478 | acpi_status |
477 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | 479 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function) |
478 | { | 480 | { |
@@ -489,6 +491,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
489 | return AE_OK; | 491 | return AE_OK; |
490 | } | 492 | } |
491 | 493 | ||
494 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) | ||
492 | #endif /* ACPI_FUTURE_USAGE */ | 495 | #endif /* ACPI_FUTURE_USAGE */ |
493 | 496 | ||
494 | /***************************************************************************** | 497 | /***************************************************************************** |
@@ -502,10 +505,9 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
502 | * DESCRIPTION: Empty all caches (delete the cached objects) | 505 | * DESCRIPTION: Empty all caches (delete the cached objects) |
503 | * | 506 | * |
504 | ****************************************************************************/ | 507 | ****************************************************************************/ |
505 | |||
506 | acpi_status acpi_purge_cached_objects(void) | 508 | acpi_status acpi_purge_cached_objects(void) |
507 | { | 509 | { |
508 | ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); | 510 | ACPI_FUNCTION_TRACE(acpi_purge_cached_objects); |
509 | 511 | ||
510 | (void)acpi_os_purge_cache(acpi_gbl_state_cache); | 512 | (void)acpi_os_purge_cache(acpi_gbl_state_cache); |
511 | (void)acpi_os_purge_cache(acpi_gbl_operand_cache); | 513 | (void)acpi_os_purge_cache(acpi_gbl_operand_cache); |
@@ -513,3 +515,5 @@ acpi_status acpi_purge_cached_objects(void) | |||
513 | (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); | 515 | (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); |
514 | return_ACPI_STATUS(AE_OK); | 516 | return_ACPI_STATUS(AE_OK); |
515 | } | 517 | } |
518 | |||
519 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index fcefcb104b31..86531ab4ee55 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -323,7 +323,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, | |||
323 | if (!ACPI_SUCCESS(status)) | 323 | if (!ACPI_SUCCESS(status)) |
324 | return_VALUE(status); | 324 | return_VALUE(status); |
325 | obj = (union acpi_object *)buffer.pointer; | 325 | obj = (union acpi_object *)buffer.pointer; |
326 | if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { | 326 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { |
327 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); | 327 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); |
328 | status = -EFAULT; | 328 | status = -EFAULT; |
329 | goto err; | 329 | goto err; |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 472318205236..0c99ae6a3407 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -86,18 +86,9 @@ firmware_timeout_store(struct class *class, const char *buf, size_t count) | |||
86 | static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); | 86 | static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); |
87 | 87 | ||
88 | static void fw_class_dev_release(struct class_device *class_dev); | 88 | static void fw_class_dev_release(struct class_device *class_dev); |
89 | int firmware_class_uevent(struct class_device *dev, char **envp, | ||
90 | int num_envp, char *buffer, int buffer_size); | ||
91 | 89 | ||
92 | static struct class firmware_class = { | 90 | static int firmware_class_uevent(struct class_device *class_dev, char **envp, |
93 | .name = "firmware", | 91 | int num_envp, char *buffer, int buffer_size) |
94 | .uevent = firmware_class_uevent, | ||
95 | .release = fw_class_dev_release, | ||
96 | }; | ||
97 | |||
98 | int | ||
99 | firmware_class_uevent(struct class_device *class_dev, char **envp, | ||
100 | int num_envp, char *buffer, int buffer_size) | ||
101 | { | 92 | { |
102 | struct firmware_priv *fw_priv = class_get_devdata(class_dev); | 93 | struct firmware_priv *fw_priv = class_get_devdata(class_dev); |
103 | int i = 0, len = 0; | 94 | int i = 0, len = 0; |
@@ -116,6 +107,12 @@ firmware_class_uevent(struct class_device *class_dev, char **envp, | |||
116 | return 0; | 107 | return 0; |
117 | } | 108 | } |
118 | 109 | ||
110 | static struct class firmware_class = { | ||
111 | .name = "firmware", | ||
112 | .uevent = firmware_class_uevent, | ||
113 | .release = fw_class_dev_release, | ||
114 | }; | ||
115 | |||
119 | static ssize_t | 116 | static ssize_t |
120 | firmware_loading_show(struct class_device *class_dev, char *buf) | 117 | firmware_loading_show(struct class_device *class_dev, char *buf) |
121 | { | 118 | { |
@@ -493,25 +490,6 @@ release_firmware(const struct firmware *fw) | |||
493 | } | 490 | } |
494 | } | 491 | } |
495 | 492 | ||
496 | /** | ||
497 | * register_firmware: - provide a firmware image for later usage | ||
498 | * @name: name of firmware image file | ||
499 | * @data: buffer pointer for the firmware image | ||
500 | * @size: size of the data buffer area | ||
501 | * | ||
502 | * Make sure that @data will be available by requesting firmware @name. | ||
503 | * | ||
504 | * Note: This will not be possible until some kind of persistence | ||
505 | * is available. | ||
506 | **/ | ||
507 | void | ||
508 | register_firmware(const char *name, const u8 *data, size_t size) | ||
509 | { | ||
510 | /* This is meaningless without firmware caching, so until we | ||
511 | * decide if firmware caching is reasonable just leave it as a | ||
512 | * noop */ | ||
513 | } | ||
514 | |||
515 | /* Async support */ | 493 | /* Async support */ |
516 | struct firmware_work { | 494 | struct firmware_work { |
517 | struct work_struct work; | 495 | struct work_struct work; |
@@ -630,4 +608,3 @@ module_exit(firmware_class_exit); | |||
630 | EXPORT_SYMBOL(release_firmware); | 608 | EXPORT_SYMBOL(release_firmware); |
631 | EXPORT_SYMBOL(request_firmware); | 609 | EXPORT_SYMBOL(request_firmware); |
632 | EXPORT_SYMBOL(request_firmware_nowait); | 610 | EXPORT_SYMBOL(request_firmware_nowait); |
633 | EXPORT_SYMBOL(register_firmware); | ||
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index 662209d3f42d..2a769cc6f5f9 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/vt_kern.h> | ||
12 | #include <linux/device.h> | 11 | #include <linux/device.h> |
13 | #include <linux/kallsyms.h> | 12 | #include <linux/kallsyms.h> |
14 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
@@ -66,6 +65,7 @@ int suspend_device(struct device * dev, pm_message_t state) | |||
66 | return error; | 65 | return error; |
67 | } | 66 | } |
68 | 67 | ||
68 | |||
69 | /** | 69 | /** |
70 | * device_suspend - Save state and stop all devices in system. | 70 | * device_suspend - Save state and stop all devices in system. |
71 | * @state: Power state to put each device in. | 71 | * @state: Power state to put each device in. |
@@ -85,9 +85,6 @@ int device_suspend(pm_message_t state) | |||
85 | { | 85 | { |
86 | int error = 0; | 86 | int error = 0; |
87 | 87 | ||
88 | if (!is_console_suspend_safe()) | ||
89 | return -EINVAL; | ||
90 | |||
91 | down(&dpm_sem); | 88 | down(&dpm_sem); |
92 | down(&dpm_list_sem); | 89 | down(&dpm_list_sem); |
93 | while (!list_empty(&dpm_active) && error == 0) { | 90 | while (!list_empty(&dpm_active) && error == 0) { |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index f73446f580df..c688c25992e4 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -536,6 +536,9 @@ static void ub_cleanup(struct ub_dev *sc) | |||
536 | kfree(lun); | 536 | kfree(lun); |
537 | } | 537 | } |
538 | 538 | ||
539 | usb_set_intfdata(sc->intf, NULL); | ||
540 | usb_put_intf(sc->intf); | ||
541 | usb_put_dev(sc->dev); | ||
539 | kfree(sc); | 542 | kfree(sc); |
540 | } | 543 | } |
541 | 544 | ||
@@ -2221,7 +2224,12 @@ static int ub_probe(struct usb_interface *intf, | |||
2221 | // sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; | 2224 | // sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; |
2222 | usb_set_intfdata(intf, sc); | 2225 | usb_set_intfdata(intf, sc); |
2223 | usb_get_dev(sc->dev); | 2226 | usb_get_dev(sc->dev); |
2224 | // usb_get_intf(sc->intf); /* Do we need this? */ | 2227 | /* |
2228 | * Since we give the interface struct to the block level through | ||
2229 | * disk->driverfs_dev, we have to pin it. Otherwise, block_uevent | ||
2230 | * oopses on close after a disconnect (kernels 2.6.16 and up). | ||
2231 | */ | ||
2232 | usb_get_intf(sc->intf); | ||
2225 | 2233 | ||
2226 | snprintf(sc->name, 12, DRV_NAME "(%d.%d)", | 2234 | snprintf(sc->name, 12, DRV_NAME "(%d.%d)", |
2227 | sc->dev->bus->busnum, sc->dev->devnum); | 2235 | sc->dev->bus->busnum, sc->dev->devnum); |
@@ -2286,7 +2294,7 @@ static int ub_probe(struct usb_interface *intf, | |||
2286 | 2294 | ||
2287 | err_dev_desc: | 2295 | err_dev_desc: |
2288 | usb_set_intfdata(intf, NULL); | 2296 | usb_set_intfdata(intf, NULL); |
2289 | // usb_put_intf(sc->intf); | 2297 | usb_put_intf(sc->intf); |
2290 | usb_put_dev(sc->dev); | 2298 | usb_put_dev(sc->dev); |
2291 | kfree(sc); | 2299 | kfree(sc); |
2292 | err_core: | 2300 | err_core: |
@@ -2461,12 +2469,6 @@ static void ub_disconnect(struct usb_interface *intf) | |||
2461 | * and no URBs left in transit. | 2469 | * and no URBs left in transit. |
2462 | */ | 2470 | */ |
2463 | 2471 | ||
2464 | usb_set_intfdata(intf, NULL); | ||
2465 | // usb_put_intf(sc->intf); | ||
2466 | sc->intf = NULL; | ||
2467 | usb_put_dev(sc->dev); | ||
2468 | sc->dev = NULL; | ||
2469 | |||
2470 | ub_put(sc); | 2472 | ub_put(sc); |
2471 | } | 2473 | } |
2472 | 2474 | ||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 402296670d3a..78d928f9d9f1 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -291,7 +291,7 @@ config SX | |||
291 | 291 | ||
292 | config RIO | 292 | config RIO |
293 | tristate "Specialix RIO system support" | 293 | tristate "Specialix RIO system support" |
294 | depends on SERIAL_NONSTANDARD && !64BIT | 294 | depends on SERIAL_NONSTANDARD |
295 | help | 295 | help |
296 | This is a driver for the Specialix RIO, a smart serial card which | 296 | This is a driver for the Specialix RIO, a smart serial card which |
297 | drives an outboard box that can support up to 128 ports. Product | 297 | drives an outboard box that can support up to 128 ports. Product |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index f5b01c6d498e..fb919bfb2824 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -41,9 +41,9 @@ obj-$(CONFIG_N_HDLC) += n_hdlc.o | |||
41 | obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o | 41 | obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o |
42 | obj-$(CONFIG_SX) += sx.o generic_serial.o | 42 | obj-$(CONFIG_SX) += sx.o generic_serial.o |
43 | obj-$(CONFIG_RIO) += rio/ generic_serial.o | 43 | obj-$(CONFIG_RIO) += rio/ generic_serial.o |
44 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o | ||
45 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o | 44 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o |
46 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o | 45 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o |
46 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o | ||
47 | obj-$(CONFIG_RAW_DRIVER) += raw.o | 47 | obj-$(CONFIG_RAW_DRIVER) += raw.o |
48 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o | 48 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o |
49 | obj-$(CONFIG_MMTIMER) += mmtimer.o | 49 | obj-$(CONFIG_MMTIMER) += mmtimer.o |
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index 0b9cf9c59a21..7c88c060a9e6 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -86,7 +86,7 @@ config AGP_NVIDIA | |||
86 | 86 | ||
87 | config AGP_SIS | 87 | config AGP_SIS |
88 | tristate "SiS chipset support" | 88 | tristate "SiS chipset support" |
89 | depends on AGP && X86_32 | 89 | depends on AGP |
90 | help | 90 | help |
91 | This option gives you AGP support for the GLX component of | 91 | This option gives you AGP support for the GLX component of |
92 | X on Silicon Integrated Systems [SiS] chipsets. | 92 | X on Silicon Integrated Systems [SiS] chipsets. |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 36517d4d1ad9..ac3c33a2e37d 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -617,6 +617,9 @@ static int agp_amd64_resume(struct pci_dev *pdev) | |||
617 | pci_set_power_state(pdev, PCI_D0); | 617 | pci_set_power_state(pdev, PCI_D0); |
618 | pci_restore_state(pdev); | 618 | pci_restore_state(pdev); |
619 | 619 | ||
620 | if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) | ||
621 | nforce3_agp_init(pdev); | ||
622 | |||
620 | return amd_8151_configure(); | 623 | return amd_8151_configure(); |
621 | } | 624 | } |
622 | 625 | ||
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 8c4c6ef748ec..907fb66ec4a9 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c | |||
@@ -497,7 +497,7 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) | |||
497 | info = buffer.pointer; | 497 | info = buffer.pointer; |
498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; | 498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; |
499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); | 499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); |
500 | ACPI_MEM_FREE(info); | 500 | kfree(info); |
501 | if (match) { | 501 | if (match) { |
502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); | 502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); |
503 | if (ACPI_SUCCESS(status)) | 503 | if (ACPI_SUCCESS(status)) |
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c index 97b0a890ba7f..b8ec25d17478 100644 --- a/drivers/char/agp/via-agp.c +++ b/drivers/char/agp/via-agp.c | |||
@@ -345,6 +345,12 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata = | |||
345 | .chipset_name = "PT880", | 345 | .chipset_name = "PT880", |
346 | }, | 346 | }, |
347 | 347 | ||
348 | /* PT880 Ultra */ | ||
349 | { | ||
350 | .device_id = PCI_DEVICE_ID_VIA_PT880ULTRA, | ||
351 | .chipset_name = "PT880 Ultra", | ||
352 | }, | ||
353 | |||
348 | /* PT890 */ | 354 | /* PT890 */ |
349 | { | 355 | { |
350 | .device_id = PCI_DEVICE_ID_VIA_8783_0, | 356 | .device_id = PCI_DEVICE_ID_VIA_8783_0, |
@@ -511,6 +517,7 @@ static struct pci_device_id agp_via_pci_table[] = { | |||
511 | ID(PCI_DEVICE_ID_VIA_8763_0), | 517 | ID(PCI_DEVICE_ID_VIA_8763_0), |
512 | ID(PCI_DEVICE_ID_VIA_8378_0), | 518 | ID(PCI_DEVICE_ID_VIA_8378_0), |
513 | ID(PCI_DEVICE_ID_VIA_PT880), | 519 | ID(PCI_DEVICE_ID_VIA_PT880), |
520 | ID(PCI_DEVICE_ID_VIA_PT880ULTRA), | ||
514 | ID(PCI_DEVICE_ID_VIA_8783_0), | 521 | ID(PCI_DEVICE_ID_VIA_8783_0), |
515 | ID(PCI_DEVICE_ID_VIA_PX8X0_0), | 522 | ID(PCI_DEVICE_ID_VIA_PX8X0_0), |
516 | ID(PCI_DEVICE_ID_VIA_3269_0), | 523 | ID(PCI_DEVICE_ID_VIA_3269_0), |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index ef140ebde117..07473cd84121 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -925,11 +925,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
925 | status = acpi_resource_to_address64(res, &addr); | 925 | status = acpi_resource_to_address64(res, &addr); |
926 | 926 | ||
927 | if (ACPI_SUCCESS(status)) { | 927 | if (ACPI_SUCCESS(status)) { |
928 | unsigned long size; | ||
929 | |||
930 | size = addr.maximum - addr.minimum + 1; | ||
931 | hdp->hd_phys_address = addr.minimum; | 928 | hdp->hd_phys_address = addr.minimum; |
932 | hdp->hd_address = ioremap(addr.minimum, size); | 929 | hdp->hd_address = ioremap(addr.minimum, addr.address_length); |
933 | 930 | ||
934 | if (hpet_is_known(hdp)) { | 931 | if (hpet_is_known(hdp)) { |
935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | 932 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index b36eef0e9d19..02a7dd7a8a55 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1184,20 +1184,20 @@ static void port_outl(struct si_sm_io *io, unsigned int offset, | |||
1184 | static void port_cleanup(struct smi_info *info) | 1184 | static void port_cleanup(struct smi_info *info) |
1185 | { | 1185 | { |
1186 | unsigned int addr = info->io.addr_data; | 1186 | unsigned int addr = info->io.addr_data; |
1187 | int mapsize; | 1187 | int idx; |
1188 | 1188 | ||
1189 | if (addr) { | 1189 | if (addr) { |
1190 | mapsize = ((info->io_size * info->io.regspacing) | 1190 | for (idx = 0; idx < info->io_size; idx++) { |
1191 | - (info->io.regspacing - info->io.regsize)); | 1191 | release_region(addr + idx * info->io.regspacing, |
1192 | 1192 | info->io.regsize); | |
1193 | release_region (addr, mapsize); | 1193 | } |
1194 | } | 1194 | } |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | static int port_setup(struct smi_info *info) | 1197 | static int port_setup(struct smi_info *info) |
1198 | { | 1198 | { |
1199 | unsigned int addr = info->io.addr_data; | 1199 | unsigned int addr = info->io.addr_data; |
1200 | int mapsize; | 1200 | int idx; |
1201 | 1201 | ||
1202 | if (!addr) | 1202 | if (!addr) |
1203 | return -ENODEV; | 1203 | return -ENODEV; |
@@ -1225,16 +1225,22 @@ static int port_setup(struct smi_info *info) | |||
1225 | return -EINVAL; | 1225 | return -EINVAL; |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | /* Calculate the total amount of memory to claim. This is an | 1228 | /* Some BIOSes reserve disjoint I/O regions in their ACPI |
1229 | * unusual looking calculation, but it avoids claiming any | 1229 | * tables. This causes problems when trying to register the |
1230 | * more memory than it has to. It will claim everything | 1230 | * entire I/O region. Therefore we must register each I/O |
1231 | * between the first address to the end of the last full | 1231 | * port separately. |
1232 | * register. */ | 1232 | */ |
1233 | mapsize = ((info->io_size * info->io.regspacing) | 1233 | for (idx = 0; idx < info->io_size; idx++) { |
1234 | - (info->io.regspacing - info->io.regsize)); | 1234 | if (request_region(addr + idx * info->io.regspacing, |
1235 | 1235 | info->io.regsize, DEVICE_NAME) == NULL) { | |
1236 | if (request_region(addr, mapsize, DEVICE_NAME) == NULL) | 1236 | /* Undo allocations */ |
1237 | return -EIO; | 1237 | while (idx--) { |
1238 | release_region(addr + idx * info->io.regspacing, | ||
1239 | info->io.regsize); | ||
1240 | } | ||
1241 | return -EIO; | ||
1242 | } | ||
1243 | } | ||
1238 | return 0; | 1244 | return 0; |
1239 | } | 1245 | } |
1240 | 1246 | ||
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index ede365d05387..b9371d5bf790 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -1384,8 +1384,10 @@ do_it_again: | |||
1384 | * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, | 1384 | * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, |
1385 | * we won't get any more characters. | 1385 | * we won't get any more characters. |
1386 | */ | 1386 | */ |
1387 | if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) | 1387 | if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) { |
1388 | n_tty_set_room(tty); | ||
1388 | check_unthrottle(tty); | 1389 | check_unthrottle(tty); |
1390 | } | ||
1389 | 1391 | ||
1390 | if (b - buf >= minimum) | 1392 | if (b - buf >= minimum) |
1391 | break; | 1393 | break; |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 128b2632512d..eab5394da666 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -149,7 +149,7 @@ struct cm4000_dev { | |||
149 | #define ZERO_DEV(dev) \ | 149 | #define ZERO_DEV(dev) \ |
150 | memset(&dev->atr_csum,0, \ | 150 | memset(&dev->atr_csum,0, \ |
151 | sizeof(struct cm4000_dev) - \ | 151 | sizeof(struct cm4000_dev) - \ |
152 | /*link*/ sizeof(struct pcmcia_device) - \ | 152 | /*link*/ sizeof(struct pcmcia_device *) - \ |
153 | /*node*/ sizeof(dev_node_t) - \ | 153 | /*node*/ sizeof(dev_node_t) - \ |
154 | /*atr*/ MAX_ATR*sizeof(char) - \ | 154 | /*atr*/ MAX_ATR*sizeof(char) - \ |
155 | /*rbuf*/ 512*sizeof(char) - \ | 155 | /*rbuf*/ 512*sizeof(char) - \ |
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h index 3ec73d1a279a..179cdbea712b 100644 --- a/drivers/char/rio/host.h +++ b/drivers/char/rio/host.h | |||
@@ -33,12 +33,6 @@ | |||
33 | #ifndef __rio_host_h__ | 33 | #ifndef __rio_host_h__ |
34 | #define __rio_host_h__ | 34 | #define __rio_host_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | #ifndef lint | ||
38 | static char *_host_h_sccs_ = "@(#)host.h 1.2"; | ||
39 | #endif | ||
40 | #endif | ||
41 | |||
42 | /* | 36 | /* |
43 | ** the host structure - one per host card in the system. | 37 | ** the host structure - one per host card in the system. |
44 | */ | 38 | */ |
@@ -77,9 +71,6 @@ struct Host { | |||
77 | #define RC_STARTUP 1 | 71 | #define RC_STARTUP 1 |
78 | #define RC_RUNNING 2 | 72 | #define RC_RUNNING 2 |
79 | #define RC_STUFFED 3 | 73 | #define RC_STUFFED 3 |
80 | #define RC_SOMETHING 4 | ||
81 | #define RC_SOMETHING_NEW 5 | ||
82 | #define RC_SOMETHING_ELSE 6 | ||
83 | #define RC_READY 7 | 74 | #define RC_READY 7 |
84 | #define RUN_STATE 7 | 75 | #define RUN_STATE 7 |
85 | /* | 76 | /* |
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c index acda9326c2ef..290143addd34 100644 --- a/drivers/char/rio/rioboot.c +++ b/drivers/char/rio/rioboot.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/termios.h> | 35 | #include <linux/termios.h> |
36 | #include <linux/serial.h> | 36 | #include <linux/serial.h> |
37 | #include <linux/vmalloc.h> | ||
37 | #include <asm/semaphore.h> | 38 | #include <asm/semaphore.h> |
38 | #include <linux/generic_serial.h> | 39 | #include <linux/generic_serial.h> |
39 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index d31aba62bb7f..75b2557c37ec 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c | |||
@@ -1394,14 +1394,17 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd) | |||
1394 | return RIO_FAIL; | 1394 | return RIO_FAIL; |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) { | 1397 | if ((PortP->InUse == (typeof(PortP->InUse))-1) || |
1398 | rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum); | 1398 | !(CmdBlkP = RIOGetCmdBlk())) { |
1399 | rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block " | ||
1400 | "for command %d on port %d\n", Cmd, PortP->PortNum); | ||
1399 | return RIO_FAIL; | 1401 | return RIO_FAIL; |
1400 | } | 1402 | } |
1401 | 1403 | ||
1402 | rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", CmdBlkP, PortP->InUse); | 1404 | rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", |
1405 | CmdBlkP, PortP->InUse); | ||
1403 | 1406 | ||
1404 | PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0]; | 1407 | PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0]; |
1405 | 1408 | ||
1406 | CmdBlkP->Packet.src_unit = 0; | 1409 | CmdBlkP->Packet.src_unit = 0; |
1407 | if (PortP->SecondBlock) | 1410 | if (PortP->SecondBlock) |
@@ -1425,38 +1428,46 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd) | |||
1425 | 1428 | ||
1426 | switch (Cmd) { | 1429 | switch (Cmd) { |
1427 | case MEMDUMP: | 1430 | case MEMDUMP: |
1428 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p (addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr); | 1431 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p " |
1432 | "(addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr); | ||
1429 | PktCmdP->SubCommand = MEMDUMP; | 1433 | PktCmdP->SubCommand = MEMDUMP; |
1430 | PktCmdP->SubAddr = SubCmd.Addr; | 1434 | PktCmdP->SubAddr = SubCmd.Addr; |
1431 | break; | 1435 | break; |
1432 | case FCLOSE: | 1436 | case FCLOSE: |
1433 | rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", CmdBlkP); | 1437 | rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", |
1438 | CmdBlkP); | ||
1434 | break; | 1439 | break; |
1435 | case READ_REGISTER: | 1440 | case READ_REGISTER: |
1436 | rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk %p\n", (int) SubCmd.Addr, CmdBlkP); | 1441 | rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) " |
1442 | "command blk %p\n", (int) SubCmd.Addr, CmdBlkP); | ||
1437 | PktCmdP->SubCommand = READ_REGISTER; | 1443 | PktCmdP->SubCommand = READ_REGISTER; |
1438 | PktCmdP->SubAddr = SubCmd.Addr; | 1444 | PktCmdP->SubAddr = SubCmd.Addr; |
1439 | break; | 1445 | break; |
1440 | case RESUME: | 1446 | case RESUME: |
1441 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", CmdBlkP); | 1447 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", |
1448 | CmdBlkP); | ||
1442 | break; | 1449 | break; |
1443 | case RFLUSH: | 1450 | case RFLUSH: |
1444 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", CmdBlkP); | 1451 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", |
1452 | CmdBlkP); | ||
1445 | CmdBlkP->PostFuncP = RIORFlushEnable; | 1453 | CmdBlkP->PostFuncP = RIORFlushEnable; |
1446 | break; | 1454 | break; |
1447 | case SUSPEND: | 1455 | case SUSPEND: |
1448 | rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", CmdBlkP); | 1456 | rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", |
1457 | CmdBlkP); | ||
1449 | break; | 1458 | break; |
1450 | 1459 | ||
1451 | case MGET: | 1460 | case MGET: |
1452 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", CmdBlkP); | 1461 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", |
1462 | CmdBlkP); | ||
1453 | break; | 1463 | break; |
1454 | 1464 | ||
1455 | case MSET: | 1465 | case MSET: |
1456 | case MBIC: | 1466 | case MBIC: |
1457 | case MBIS: | 1467 | case MBIS: |
1458 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; | 1468 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; |
1459 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk %p\n", CmdBlkP); | 1469 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command " |
1470 | "blk %p\n", CmdBlkP); | ||
1460 | break; | 1471 | break; |
1461 | 1472 | ||
1462 | case WFLUSH: | 1473 | case WFLUSH: |
@@ -1465,12 +1476,14 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd) | |||
1465 | ** allowed then we should not bother sending any more to the | 1476 | ** allowed then we should not bother sending any more to the |
1466 | ** RTA. | 1477 | ** RTA. |
1467 | */ | 1478 | */ |
1468 | if ((int) ((char) PortP->WflushFlag) == (int) -1) { | 1479 | if (PortP->WflushFlag == (typeof(PortP->WflushFlag))-1) { |
1469 | rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); | 1480 | rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, " |
1481 | "WflushFlag about to wrap!"); | ||
1470 | RIOFreeCmdBlk(CmdBlkP); | 1482 | RIOFreeCmdBlk(CmdBlkP); |
1471 | return (RIO_FAIL); | 1483 | return (RIO_FAIL); |
1472 | } else { | 1484 | } else { |
1473 | rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk %p\n", CmdBlkP); | 1485 | rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command " |
1486 | "blk %p\n", CmdBlkP); | ||
1474 | CmdBlkP->PostFuncP = RIOWFlushMark; | 1487 | CmdBlkP->PostFuncP = RIOWFlushMark; |
1475 | } | 1488 | } |
1476 | break; | 1489 | break; |
diff --git a/drivers/char/rio/rioioctl.h b/drivers/char/rio/rioioctl.h index 14b83fae75c8..e8af5b30519e 100644 --- a/drivers/char/rio/rioioctl.h +++ b/drivers/char/rio/rioioctl.h | |||
@@ -33,10 +33,6 @@ | |||
33 | #ifndef __rioioctl_h__ | 33 | #ifndef __rioioctl_h__ |
34 | #define __rioioctl_h__ | 34 | #define __rioioctl_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2"; | ||
38 | #endif | ||
39 | |||
40 | /* | 36 | /* |
41 | ** RIO device driver - user ioctls and associated structures. | 37 | ** RIO device driver - user ioctls and associated structures. |
42 | */ | 38 | */ |
@@ -44,55 +40,13 @@ static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2"; | |||
44 | struct portStats { | 40 | struct portStats { |
45 | int port; | 41 | int port; |
46 | int gather; | 42 | int gather; |
47 | ulong txchars; | 43 | unsigned long txchars; |
48 | ulong rxchars; | 44 | unsigned long rxchars; |
49 | ulong opens; | 45 | unsigned long opens; |
50 | ulong closes; | 46 | unsigned long closes; |
51 | ulong ioctls; | 47 | unsigned long ioctls; |
52 | }; | 48 | }; |
53 | 49 | ||
54 | |||
55 | #define rIOC ('r'<<8) | ||
56 | #define TCRIOSTATE (rIOC | 1) | ||
57 | #define TCRIOXPON (rIOC | 2) | ||
58 | #define TCRIOXPOFF (rIOC | 3) | ||
59 | #define TCRIOXPCPS (rIOC | 4) | ||
60 | #define TCRIOXPRINT (rIOC | 5) | ||
61 | #define TCRIOIXANYON (rIOC | 6) | ||
62 | #define TCRIOIXANYOFF (rIOC | 7) | ||
63 | #define TCRIOIXONON (rIOC | 8) | ||
64 | #define TCRIOIXONOFF (rIOC | 9) | ||
65 | #define TCRIOMBIS (rIOC | 10) | ||
66 | #define TCRIOMBIC (rIOC | 11) | ||
67 | #define TCRIOTRIAD (rIOC | 12) | ||
68 | #define TCRIOTSTATE (rIOC | 13) | ||
69 | |||
70 | /* | ||
71 | ** 15.10.1998 ARG - ESIL 0761 part fix | ||
72 | ** Add RIO ioctls for manipulating RTS and CTS flow control, (as LynxOS | ||
73 | ** appears to not support hardware flow control). | ||
74 | */ | ||
75 | #define TCRIOCTSFLOWEN (rIOC | 14) /* enable CTS flow control */ | ||
76 | #define TCRIOCTSFLOWDIS (rIOC | 15) /* disable CTS flow control */ | ||
77 | #define TCRIORTSFLOWEN (rIOC | 16) /* enable RTS flow control */ | ||
78 | #define TCRIORTSFLOWDIS (rIOC | 17) /* disable RTS flow control */ | ||
79 | |||
80 | /* | ||
81 | ** 09.12.1998 ARG - ESIL 0776 part fix | ||
82 | ** Definition for 'RIOC' also appears in daemon.h, so we'd better do a | ||
83 | ** #ifndef here first. | ||
84 | ** 'RIO_QUICK_CHECK' also #define'd here as this ioctl is now | ||
85 | ** allowed to be used by customers. | ||
86 | ** | ||
87 | ** 05.02.1999 ARG - | ||
88 | ** This is what I've decied to do with ioctls etc., which are intended to be | ||
89 | ** invoked from users applications : | ||
90 | ** Anything that needs to be defined here will be removed from daemon.h, that | ||
91 | ** way it won't end up having to be defined/maintained in two places. The only | ||
92 | ** consequence of this is that this file should now be #include'd by daemon.h | ||
93 | ** | ||
94 | ** 'stats' ioctls now #define'd here as they are to be used by customers. | ||
95 | */ | ||
96 | #define RIOC ('R'<<8)|('i'<<16)|('o'<<24) | 50 | #define RIOC ('R'<<8)|('i'<<16)|('o'<<24) |
97 | 51 | ||
98 | #define RIO_QUICK_CHECK (RIOC | 105) | 52 | #define RIO_QUICK_CHECK (RIOC | 105) |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index a90f5d97df35..43dfd8689dce 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -512,7 +512,7 @@ static struct sonypi_device { | |||
512 | 512 | ||
513 | #ifdef CONFIG_ACPI | 513 | #ifdef CONFIG_ACPI |
514 | static struct acpi_device *sonypi_acpi_device; | 514 | static struct acpi_device *sonypi_acpi_device; |
515 | static int acpi_enabled; | 515 | static int acpi_driver_registered; |
516 | #endif | 516 | #endif |
517 | 517 | ||
518 | static int sonypi_ec_write(u8 addr, u8 value) | 518 | static int sonypi_ec_write(u8 addr, u8 value) |
@@ -869,7 +869,7 @@ found: | |||
869 | sonypi_report_input_event(event); | 869 | sonypi_report_input_event(event); |
870 | 870 | ||
871 | #ifdef CONFIG_ACPI | 871 | #ifdef CONFIG_ACPI |
872 | if (acpi_enabled) | 872 | if (sonypi_acpi_device) |
873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); | 873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); |
874 | #endif | 874 | #endif |
875 | 875 | ||
@@ -1551,8 +1551,8 @@ static int __init sonypi_init(void) | |||
1551 | goto err_free_device; | 1551 | goto err_free_device; |
1552 | 1552 | ||
1553 | #ifdef CONFIG_ACPI | 1553 | #ifdef CONFIG_ACPI |
1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) | 1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0) |
1555 | acpi_enabled = 1; | 1555 | acpi_driver_registered = 1; |
1556 | #endif | 1556 | #endif |
1557 | 1557 | ||
1558 | return 0; | 1558 | return 0; |
@@ -1567,7 +1567,7 @@ static int __init sonypi_init(void) | |||
1567 | static void __exit sonypi_exit(void) | 1567 | static void __exit sonypi_exit(void) |
1568 | { | 1568 | { |
1569 | #ifdef CONFIG_ACPI | 1569 | #ifdef CONFIG_ACPI |
1570 | if (acpi_enabled) | 1570 | if (acpi_driver_registered) |
1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); | 1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); |
1572 | #endif | 1572 | #endif |
1573 | platform_device_unregister(sonypi_platform_device); | 1573 | platform_device_unregister(sonypi_platform_device); |
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig index 1efde3b27619..fe00c7dfb649 100644 --- a/drivers/char/tpm/Kconfig +++ b/drivers/char/tpm/Kconfig | |||
@@ -22,7 +22,7 @@ config TCG_TPM | |||
22 | 22 | ||
23 | config TCG_TIS | 23 | config TCG_TIS |
24 | tristate "TPM Interface Specification 1.2 Interface" | 24 | tristate "TPM Interface Specification 1.2 Interface" |
25 | depends on TCG_TPM | 25 | depends on TCG_TPM && PNPACPI |
26 | ---help--- | 26 | ---help--- |
27 | If you have a TPM security chip that is compliant with the | 27 | If you have a TPM security chip that is compliant with the |
28 | TCG TIS 1.2 TPM specification say Yes and it will be accessible | 28 | TCG TIS 1.2 TPM specification say Yes and it will be accessible |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 54a4c804e25f..050ced247f68 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -140,7 +140,7 @@ extern int tpm_pm_resume(struct device *); | |||
140 | extern struct dentry ** tpm_bios_log_setup(char *); | 140 | extern struct dentry ** tpm_bios_log_setup(char *); |
141 | extern void tpm_bios_log_teardown(struct dentry **); | 141 | extern void tpm_bios_log_teardown(struct dentry **); |
142 | #else | 142 | #else |
143 | static inline struct dentry* tpm_bios_log_setup(char *name) | 143 | static inline struct dentry ** tpm_bios_log_setup(char *name) |
144 | { | 144 | { |
145 | return NULL; | 145 | return NULL; |
146 | } | 146 | } |
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index e45f0d3d12de..a611972024e6 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c | |||
@@ -105,6 +105,12 @@ static const char* tcpa_event_type_strings[] = { | |||
105 | "Non-Host Info" | 105 | "Non-Host Info" |
106 | }; | 106 | }; |
107 | 107 | ||
108 | struct tcpa_pc_event { | ||
109 | u32 event_id; | ||
110 | u32 event_size; | ||
111 | u8 event_data[0]; | ||
112 | }; | ||
113 | |||
108 | enum tcpa_pc_event_ids { | 114 | enum tcpa_pc_event_ids { |
109 | SMBIOS = 1, | 115 | SMBIOS = 1, |
110 | BIS_CERT, | 116 | BIS_CERT, |
@@ -114,14 +120,15 @@ enum tcpa_pc_event_ids { | |||
114 | NVRAM, | 120 | NVRAM, |
115 | OPTION_ROM_EXEC, | 121 | OPTION_ROM_EXEC, |
116 | OPTION_ROM_CONFIG, | 122 | OPTION_ROM_CONFIG, |
117 | OPTION_ROM_MICROCODE, | 123 | OPTION_ROM_MICROCODE = 10, |
118 | S_CRTM_VERSION, | 124 | S_CRTM_VERSION, |
119 | S_CRTM_CONTENTS, | 125 | S_CRTM_CONTENTS, |
120 | POST_CONTENTS, | 126 | POST_CONTENTS, |
127 | HOST_TABLE_OF_DEVICES, | ||
121 | }; | 128 | }; |
122 | 129 | ||
123 | static const char* tcpa_pc_event_id_strings[] = { | 130 | static const char* tcpa_pc_event_id_strings[] = { |
124 | "" | 131 | "", |
125 | "SMBIOS", | 132 | "SMBIOS", |
126 | "BIS Certificate", | 133 | "BIS Certificate", |
127 | "POST BIOS ", | 134 | "POST BIOS ", |
@@ -130,11 +137,12 @@ static const char* tcpa_pc_event_id_strings[] = { | |||
130 | "NVRAM", | 137 | "NVRAM", |
131 | "Option ROM", | 138 | "Option ROM", |
132 | "Option ROM config", | 139 | "Option ROM config", |
133 | "Option ROM microcode", | 140 | "", |
141 | "Option ROM microcode ", | ||
134 | "S-CRTM Version", | 142 | "S-CRTM Version", |
135 | "S-CRTM Contents", | 143 | "S-CRTM Contents ", |
136 | "S-CRTM POST Contents", | 144 | "POST Contents ", |
137 | "POST Contents", | 145 | "Table of Devices", |
138 | }; | 146 | }; |
139 | 147 | ||
140 | /* returns pointer to start of pos. entry of tcg log */ | 148 | /* returns pointer to start of pos. entry of tcg log */ |
@@ -206,7 +214,7 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
206 | const char *name = ""; | 214 | const char *name = ""; |
207 | char data[40] = ""; | 215 | char data[40] = ""; |
208 | int i, n_len = 0, d_len = 0; | 216 | int i, n_len = 0, d_len = 0; |
209 | u32 event_id; | 217 | struct tcpa_pc_event *pc_event; |
210 | 218 | ||
211 | switch(event->event_type) { | 219 | switch(event->event_type) { |
212 | case PREBOOT: | 220 | case PREBOOT: |
@@ -235,31 +243,32 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
235 | } | 243 | } |
236 | break; | 244 | break; |
237 | case EVENT_TAG: | 245 | case EVENT_TAG: |
238 | event_id = be32_to_cpu(*((u32 *)event_entry)); | 246 | pc_event = (struct tcpa_pc_event *)event_entry; |
239 | 247 | ||
240 | /* ToDo Row data -> Base64 */ | 248 | /* ToDo Row data -> Base64 */ |
241 | 249 | ||
242 | switch (event_id) { | 250 | switch (pc_event->event_id) { |
243 | case SMBIOS: | 251 | case SMBIOS: |
244 | case BIS_CERT: | 252 | case BIS_CERT: |
245 | case CMOS: | 253 | case CMOS: |
246 | case NVRAM: | 254 | case NVRAM: |
247 | case OPTION_ROM_EXEC: | 255 | case OPTION_ROM_EXEC: |
248 | case OPTION_ROM_CONFIG: | 256 | case OPTION_ROM_CONFIG: |
249 | case OPTION_ROM_MICROCODE: | ||
250 | case S_CRTM_VERSION: | 257 | case S_CRTM_VERSION: |
251 | case S_CRTM_CONTENTS: | 258 | name = tcpa_pc_event_id_strings[pc_event->event_id]; |
252 | case POST_CONTENTS: | ||
253 | name = tcpa_pc_event_id_strings[event_id]; | ||
254 | n_len = strlen(name); | 259 | n_len = strlen(name); |
255 | break; | 260 | break; |
261 | /* hash data */ | ||
256 | case POST_BIOS_ROM: | 262 | case POST_BIOS_ROM: |
257 | case ESCD: | 263 | case ESCD: |
258 | name = tcpa_pc_event_id_strings[event_id]; | 264 | case OPTION_ROM_MICROCODE: |
265 | case S_CRTM_CONTENTS: | ||
266 | case POST_CONTENTS: | ||
267 | name = tcpa_pc_event_id_strings[pc_event->event_id]; | ||
259 | n_len = strlen(name); | 268 | n_len = strlen(name); |
260 | for (i = 0; i < 20; i++) | 269 | for (i = 0; i < 20; i++) |
261 | d_len += sprintf(data, "%02x", | 270 | d_len += sprintf(&data[2*i], "%02x", |
262 | event_entry[8 + i]); | 271 | pc_event->event_data[i]); |
263 | break; | 272 | break; |
264 | default: | 273 | default: |
265 | break; | 274 | break; |
@@ -275,53 +284,13 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
275 | 284 | ||
276 | static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v) | 285 | static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v) |
277 | { | 286 | { |
287 | struct tcpa_event *event = v; | ||
288 | char *data = v; | ||
289 | int i; | ||
278 | 290 | ||
279 | char *eventname; | 291 | for (i = 0; i < sizeof(struct tcpa_event) + event->event_size; i++) |
280 | char data[4]; | ||
281 | u32 help; | ||
282 | int i, len; | ||
283 | struct tcpa_event *event = (struct tcpa_event *) v; | ||
284 | unsigned char *event_entry = | ||
285 | (unsigned char *) (v + sizeof(struct tcpa_event)); | ||
286 | |||
287 | eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL); | ||
288 | if (!eventname) { | ||
289 | printk(KERN_ERR "%s: ERROR - No Memory for event name\n ", | ||
290 | __func__); | ||
291 | return -ENOMEM; | ||
292 | } | ||
293 | |||
294 | /* 1st: PCR used is in little-endian format (4 bytes) */ | ||
295 | help = le32_to_cpu(event->pcr_index); | ||
296 | memcpy(data, &help, 4); | ||
297 | for (i = 0; i < 4; i++) | ||
298 | seq_putc(m, data[i]); | ||
299 | |||
300 | /* 2nd: SHA1 (20 bytes) */ | ||
301 | for (i = 0; i < 20; i++) | ||
302 | seq_putc(m, event->pcr_value[i]); | ||
303 | |||
304 | /* 3rd: event type identifier (4 bytes) */ | ||
305 | help = le32_to_cpu(event->event_type); | ||
306 | memcpy(data, &help, 4); | ||
307 | for (i = 0; i < 4; i++) | ||
308 | seq_putc(m, data[i]); | 292 | seq_putc(m, data[i]); |
309 | 293 | ||
310 | len = 0; | ||
311 | |||
312 | len += get_event_name(eventname, event, event_entry); | ||
313 | |||
314 | /* 4th: filename <= 255 + \'0' delimiter */ | ||
315 | if (len > TCG_EVENT_NAME_LEN_MAX) | ||
316 | len = TCG_EVENT_NAME_LEN_MAX; | ||
317 | |||
318 | for (i = 0; i < len; i++) | ||
319 | seq_putc(m, eventname[i]); | ||
320 | |||
321 | /* 5th: delimiter */ | ||
322 | seq_putc(m, '\0'); | ||
323 | |||
324 | kfree(eventname); | ||
325 | return 0; | 294 | return 0; |
326 | } | 295 | } |
327 | 296 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index b9cae9a238bb..8ea70625f7ea 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -55,7 +55,7 @@ enum tis_int_flags { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | enum tis_defaults { | 57 | enum tis_defaults { |
58 | TIS_MEM_BASE = 0xFED4000, | 58 | TIS_MEM_BASE = 0xFED40000, |
59 | TIS_MEM_LEN = 0x5000, | 59 | TIS_MEM_LEN = 0x5000, |
60 | TIS_SHORT_TIMEOUT = 750, /* ms */ | 60 | TIS_SHORT_TIMEOUT = 750, /* ms */ |
61 | TIS_LONG_TIMEOUT = 2000, /* 2 sec */ | 61 | TIS_LONG_TIMEOUT = 2000, /* 2 sec */ |
@@ -457,10 +457,6 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
457 | } | 457 | } |
458 | 458 | ||
459 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); | 459 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); |
460 | if ((vendor & 0xFFFF) == 0xFFFF) { | ||
461 | rc = -ENODEV; | ||
462 | goto out_err; | ||
463 | } | ||
464 | 460 | ||
465 | /* Default timeouts */ | 461 | /* Default timeouts */ |
466 | chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | 462 | chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index f07637a8f88f..a88b94a82b14 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -398,7 +398,7 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, | |||
398 | while (unlikely(size > copied)); | 398 | while (unlikely(size > copied)); |
399 | return copied; | 399 | return copied; |
400 | } | 400 | } |
401 | EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags); | 401 | EXPORT_SYMBOL(tty_insert_flip_string_flags); |
402 | 402 | ||
403 | void tty_schedule_flip(struct tty_struct *tty) | 403 | void tty_schedule_flip(struct tty_struct *tty) |
404 | { | 404 | { |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index acc5d47844eb..6c94879e0b99 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -3238,14 +3238,6 @@ void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org) | |||
3238 | } | 3238 | } |
3239 | } | 3239 | } |
3240 | 3240 | ||
3241 | int is_console_suspend_safe(void) | ||
3242 | { | ||
3243 | /* It is unsafe to suspend devices while X has control of the | ||
3244 | * hardware. Make sure we are running on a kernel-controlled console. | ||
3245 | */ | ||
3246 | return vc_cons[fg_console].d->vc_mode == KD_TEXT; | ||
3247 | } | ||
3248 | |||
3249 | /* | 3241 | /* |
3250 | * Visible symbols for modules | 3242 | * Visible symbols for modules |
3251 | */ | 3243 | */ |
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c index a13395e2c372..fa2ba9ebe42a 100644 --- a/drivers/char/watchdog/i8xx_tco.c +++ b/drivers/char/watchdog/i8xx_tco.c | |||
@@ -33,11 +33,6 @@ | |||
33 | * 82801E (C-ICH) : document number 273599-001, 273645-002, | 33 | * 82801E (C-ICH) : document number 273599-001, 273645-002, |
34 | * 82801EB (ICH5) : document number 252516-001, 252517-003, | 34 | * 82801EB (ICH5) : document number 252516-001, 252517-003, |
35 | * 82801ER (ICH5R) : document number 252516-001, 252517-003, | 35 | * 82801ER (ICH5R) : document number 252516-001, 252517-003, |
36 | * 82801FB (ICH6) : document number 301473-002, 301474-007, | ||
37 | * 82801FR (ICH6R) : document number 301473-002, 301474-007, | ||
38 | * 82801FBM (ICH6-M) : document number 301473-002, 301474-007, | ||
39 | * 82801FW (ICH6W) : document number 301473-001, 301474-007, | ||
40 | * 82801FRW (ICH6RW) : document number 301473-001, 301474-007 | ||
41 | * | 36 | * |
42 | * 20000710 Nils Faerber | 37 | * 20000710 Nils Faerber |
43 | * Initial Version 0.01 | 38 | * Initial Version 0.01 |
@@ -66,6 +61,10 @@ | |||
66 | * 20050807 Wim Van Sebroeck <wim@iguana.be> | 61 | * 20050807 Wim Van Sebroeck <wim@iguana.be> |
67 | * 0.08 Make sure that the watchdog is only "armed" when started. | 62 | * 0.08 Make sure that the watchdog is only "armed" when started. |
68 | * (Kernel Bug 4251) | 63 | * (Kernel Bug 4251) |
64 | * 20060416 Wim Van Sebroeck <wim@iguana.be> | ||
65 | * 0.09 Remove support for the ICH6, ICH6R, ICH6-M, ICH6W and ICH6RW and | ||
66 | * ICH7 chipsets. (See Kernel Bug 6031 - other code will support these | ||
67 | * chipsets) | ||
69 | */ | 68 | */ |
70 | 69 | ||
71 | /* | 70 | /* |
@@ -90,7 +89,7 @@ | |||
90 | #include "i8xx_tco.h" | 89 | #include "i8xx_tco.h" |
91 | 90 | ||
92 | /* Module and version information */ | 91 | /* Module and version information */ |
93 | #define TCO_VERSION "0.08" | 92 | #define TCO_VERSION "0.09" |
94 | #define TCO_MODULE_NAME "i8xx TCO timer" | 93 | #define TCO_MODULE_NAME "i8xx TCO timer" |
95 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION | 94 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION |
96 | #define PFX TCO_MODULE_NAME ": " | 95 | #define PFX TCO_MODULE_NAME ": " |
@@ -391,11 +390,6 @@ static struct pci_device_id i8xx_tco_pci_tbl[] = { | |||
391 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, }, | 390 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, }, |
392 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, }, | 391 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, }, |
393 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, }, | 392 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, }, |
394 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, PCI_ANY_ID, PCI_ANY_ID, }, | ||
395 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, PCI_ANY_ID, PCI_ANY_ID, }, | ||
396 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, }, | ||
397 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, }, | ||
398 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, }, | ||
399 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, }, | 393 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, }, |
400 | { 0, }, /* End of list */ | 394 | { 0, }, /* End of list */ |
401 | }; | 395 | }; |
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index 9dc54736e4eb..1ea04e9b2b0b 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -423,6 +423,12 @@ static int s3c2410wdt_probe(struct platform_device *pdev) | |||
423 | if (tmr_atboot && started == 0) { | 423 | if (tmr_atboot && started == 0) { |
424 | printk(KERN_INFO PFX "Starting Watchdog Timer\n"); | 424 | printk(KERN_INFO PFX "Starting Watchdog Timer\n"); |
425 | s3c2410wdt_start(); | 425 | s3c2410wdt_start(); |
426 | } else if (!tmr_atboot) { | ||
427 | /* if we're not enabling the watchdog, then ensure it is | ||
428 | * disabled if it has been left running from the bootloader | ||
429 | * or other source */ | ||
430 | |||
431 | s3c2410wdt_stop(); | ||
426 | } | 432 | } |
427 | 433 | ||
428 | return 0; | 434 | return 0; |
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c index 515ce7572049..20b88f9b7be2 100644 --- a/drivers/char/watchdog/sc1200wdt.c +++ b/drivers/char/watchdog/sc1200wdt.c | |||
@@ -377,7 +377,7 @@ static int __init sc1200wdt_init(void) | |||
377 | { | 377 | { |
378 | int ret; | 378 | int ret; |
379 | 379 | ||
380 | printk(banner); | 380 | printk("%s\n", banner); |
381 | 381 | ||
382 | spin_lock_init(&sc1200wdt_lock); | 382 | spin_lock_init(&sc1200wdt_lock); |
383 | sema_init(&open_sem, 1); | 383 | sema_init(&open_sem, 1); |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 8bd305e47f0d..766cc969c4d0 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -133,6 +133,9 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status) | |||
133 | 133 | ||
134 | outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1); | 134 | outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1); |
135 | outb(ACBST_STASTR | ACBST_NEGACK, ACBST); | 135 | outb(ACBST_STASTR | ACBST_NEGACK, ACBST); |
136 | |||
137 | /* Reset the status register */ | ||
138 | outb(0, ACBST); | ||
136 | return; | 139 | return; |
137 | } | 140 | } |
138 | 141 | ||
@@ -228,6 +231,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) | |||
228 | timeout = jiffies + POLL_TIMEOUT; | 231 | timeout = jiffies + POLL_TIMEOUT; |
229 | while (time_before(jiffies, timeout)) { | 232 | while (time_before(jiffies, timeout)) { |
230 | status = inb(ACBST); | 233 | status = inb(ACBST); |
234 | |||
235 | /* Reset the status register to avoid the hang */ | ||
236 | outb(0, ACBST); | ||
237 | |||
231 | if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) { | 238 | if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) { |
232 | scx200_acb_machine(iface, status); | 239 | scx200_acb_machine(iface, status); |
233 | return; | 240 | return; |
@@ -415,7 +422,6 @@ static int __init scx200_acb_create(const char *text, int base, int index) | |||
415 | struct scx200_acb_iface *iface; | 422 | struct scx200_acb_iface *iface; |
416 | struct i2c_adapter *adapter; | 423 | struct i2c_adapter *adapter; |
417 | int rc; | 424 | int rc; |
418 | char description[64]; | ||
419 | 425 | ||
420 | iface = kzalloc(sizeof(*iface), GFP_KERNEL); | 426 | iface = kzalloc(sizeof(*iface), GFP_KERNEL); |
421 | if (!iface) { | 427 | if (!iface) { |
@@ -434,10 +440,7 @@ static int __init scx200_acb_create(const char *text, int base, int index) | |||
434 | 440 | ||
435 | mutex_init(&iface->mutex); | 441 | mutex_init(&iface->mutex); |
436 | 442 | ||
437 | snprintf(description, sizeof(description), "%s ACCESS.bus [%s]", | 443 | if (!request_region(base, 8, adapter->name)) { |
438 | text, adapter->name); | ||
439 | |||
440 | if (request_region(base, 8, description) == 0) { | ||
441 | printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n", | 444 | printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n", |
442 | base, base + 8-1); | 445 | base, base + 8-1); |
443 | rc = -EBUSY; | 446 | rc = -EBUSY; |
@@ -488,7 +491,7 @@ static struct pci_device_id divil_pci[] = { | |||
488 | 491 | ||
489 | #define MSR_LBAR_SMB 0x5140000B | 492 | #define MSR_LBAR_SMB 0x5140000B |
490 | 493 | ||
491 | static int scx200_add_cs553x(void) | 494 | static __init int scx200_add_cs553x(void) |
492 | { | 495 | { |
493 | u32 low, hi; | 496 | u32 low, hi; |
494 | u32 smb_base; | 497 | u32 smb_base; |
@@ -524,6 +527,9 @@ static int __init scx200_acb_init(void) | |||
524 | } else if (pci_dev_present(divil_pci)) | 527 | } else if (pci_dev_present(divil_pci)) |
525 | rc = scx200_add_cs553x(); | 528 | rc = scx200_add_cs553x(); |
526 | 529 | ||
530 | /* If at least one bus was created, init must succeed */ | ||
531 | if (scx200_acb_list) | ||
532 | return 0; | ||
527 | return rc; | 533 | return rc; |
528 | } | 534 | } |
529 | 535 | ||
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 4961f1e764a7..602797a44208 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -392,6 +392,7 @@ static struct pcmcia_device_id ide_ids[] = { | |||
392 | PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), | 392 | PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), |
393 | PCMCIA_DEVICE_PROD_ID12("HITACHI", "FLASH", 0xf4f43949, 0x9eb86aae), | 393 | PCMCIA_DEVICE_PROD_ID12("HITACHI", "FLASH", 0xf4f43949, 0x9eb86aae), |
394 | PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), | 394 | PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), |
395 | PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), | ||
395 | PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), | 396 | PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), |
396 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), | 397 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), |
397 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), | 398 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 43b96e298363..27c9eb989a9a 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -345,17 +345,17 @@ sgiioc4_resetproc(ide_drive_t * drive) | |||
345 | static u8 | 345 | static u8 |
346 | sgiioc4_INB(unsigned long port) | 346 | sgiioc4_INB(unsigned long port) |
347 | { | 347 | { |
348 | u8 reg = (u8) inb(port); | 348 | u8 reg = (u8) readb((void __iomem *) port); |
349 | 349 | ||
350 | if ((port & 0xFFF) == 0x11C) { /* Status register of IOC4 */ | 350 | if ((port & 0xFFF) == 0x11C) { /* Status register of IOC4 */ |
351 | if (reg & 0x51) { /* Not busy...check for interrupt */ | 351 | if (reg & 0x51) { /* Not busy...check for interrupt */ |
352 | unsigned long other_ir = port - 0x110; | 352 | unsigned long other_ir = port - 0x110; |
353 | unsigned int intr_reg = (u32) inl(other_ir); | 353 | unsigned int intr_reg = (u32) readl((void __iomem *) other_ir); |
354 | 354 | ||
355 | /* Clear the Interrupt, Error bits on the IOC4 */ | 355 | /* Clear the Interrupt, Error bits on the IOC4 */ |
356 | if (intr_reg & 0x03) { | 356 | if (intr_reg & 0x03) { |
357 | outl(0x03, other_ir); | 357 | writel(0x03, (void __iomem *) other_ir); |
358 | intr_reg = (u32) inl(other_ir); | 358 | intr_reg = (u32) readl((void __iomem *) other_ir); |
359 | } | 359 | } |
360 | } | 360 | } |
361 | } | 361 | } |
@@ -606,6 +606,12 @@ ide_init_sgiioc4(ide_hwif_t * hwif) | |||
606 | hwif->ide_dma_host_off = &sgiioc4_ide_dma_host_off; | 606 | hwif->ide_dma_host_off = &sgiioc4_ide_dma_host_off; |
607 | hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq; | 607 | hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq; |
608 | hwif->ide_dma_timeout = &__ide_dma_timeout; | 608 | hwif->ide_dma_timeout = &__ide_dma_timeout; |
609 | |||
610 | /* | ||
611 | * The IOC4 uses MMIO rather than Port IO. | ||
612 | * It also needs special workarounds for INB. | ||
613 | */ | ||
614 | default_hwif_mmiops(hwif); | ||
609 | hwif->INB = &sgiioc4_INB; | 615 | hwif->INB = &sgiioc4_INB; |
610 | } | 616 | } |
611 | 617 | ||
@@ -743,6 +749,6 @@ ioc4_ide_exit(void) | |||
743 | module_init(ioc4_ide_init); | 749 | module_init(ioc4_ide_init); |
744 | module_exit(ioc4_ide_exit); | 750 | module_exit(ioc4_ide_exit); |
745 | 751 | ||
746 | MODULE_AUTHOR("Aniket Malatpure - Silicon Graphics Inc. (SGI)"); | 752 | MODULE_AUTHOR("Aniket Malatpure/Jeremy Higdon"); |
747 | MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card"); | 753 | MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card"); |
748 | MODULE_LICENSE("GPL"); | 754 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 78e30f803671..ffca8b63ee79 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -553,6 +553,8 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw, | |||
553 | 553 | ||
554 | if (irq != NULL) | 554 | if (irq != NULL) |
555 | *irq = pmac_ide[ix].irq; | 555 | *irq = pmac_ide[ix].irq; |
556 | |||
557 | hw->dev = &pmac_ide[ix].mdev->ofdev.dev; | ||
556 | } | 558 | } |
557 | 559 | ||
558 | #define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x))) | 560 | #define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x))) |
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 19222878aae9..11f13778f139 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -553,7 +553,7 @@ static void ohci_initialize(struct ti_ohci *ohci) | |||
553 | * register content. | 553 | * register content. |
554 | * To actually enable physical responses is the job of our interrupt | 554 | * To actually enable physical responses is the job of our interrupt |
555 | * handler which programs the physical request filter. */ | 555 | * handler which programs the physical request filter. */ |
556 | reg_write(ohci, OHCI1394_PhyUpperBound, 0xffff0000); | 556 | reg_write(ohci, OHCI1394_PhyUpperBound, 0x01000000); |
557 | 557 | ||
558 | DBGMSG("physUpperBoundOffset=%08x", | 558 | DBGMSG("physUpperBoundOffset=%08x", |
559 | reg_read(ohci, OHCI1394_PhyUpperBound)); | 559 | reg_read(ohci, OHCI1394_PhyUpperBound)); |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index f4206604db03..5413dc43b9f1 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
43 | #include <linux/list.h> | 43 | #include <linux/list.h> |
44 | #include <linux/string.h> | 44 | #include <linux/string.h> |
45 | #include <linux/stringify.h> | ||
45 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
46 | #include <linux/interrupt.h> | 47 | #include <linux/interrupt.h> |
47 | #include <linux/fs.h> | 48 | #include <linux/fs.h> |
@@ -117,7 +118,8 @@ MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers (default | |||
117 | */ | 118 | */ |
118 | static int max_sectors = SBP2_MAX_SECTORS; | 119 | static int max_sectors = SBP2_MAX_SECTORS; |
119 | module_param(max_sectors, int, 0444); | 120 | module_param(max_sectors, int, 0444); |
120 | MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = 255)"); | 121 | MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = " |
122 | __stringify(SBP2_MAX_SECTORS) ")"); | ||
121 | 123 | ||
122 | /* | 124 | /* |
123 | * Exclusive login to sbp2 device? In most cases, the sbp2 driver should | 125 | * Exclusive login to sbp2 device? In most cases, the sbp2 driver should |
@@ -135,18 +137,45 @@ module_param(exclusive_login, int, 0644); | |||
135 | MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)"); | 137 | MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)"); |
136 | 138 | ||
137 | /* | 139 | /* |
138 | * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on | 140 | * If any of the following workarounds is required for your device to work, |
139 | * if your sbp2 device is not properly handling the SCSI inquiry command. | 141 | * please submit the kernel messages logged by sbp2 to the linux1394-devel |
140 | * This hack makes the inquiry look more like a typical MS Windows inquiry | 142 | * mailing list. |
141 | * by enforcing 36 byte inquiry and avoiding access to mode_sense page 8. | ||
142 | * | 143 | * |
143 | * If force_inquiry_hack=1 is required for your device to work, | 144 | * - 128kB max transfer |
144 | * please submit the logged sbp2_firmware_revision value of this device to | 145 | * Limit transfer size. Necessary for some old bridges. |
145 | * the linux1394-devel mailing list. | 146 | * |
147 | * - 36 byte inquiry | ||
148 | * When scsi_mod probes the device, let the inquiry command look like that | ||
149 | * from MS Windows. | ||
150 | * | ||
151 | * - skip mode page 8 | ||
152 | * Suppress sending of mode_sense for mode page 8 if the device pretends to | ||
153 | * support the SCSI Primary Block commands instead of Reduced Block Commands. | ||
154 | * | ||
155 | * - fix capacity | ||
156 | * Tell sd_mod to correct the last sector number reported by read_capacity. | ||
157 | * Avoids access beyond actual disk limits on devices with an off-by-one bug. | ||
158 | * Don't use this with devices which don't have this bug. | ||
159 | * | ||
160 | * - override internal blacklist | ||
161 | * Instead of adding to the built-in blacklist, use only the workarounds | ||
162 | * specified in the module load parameter. | ||
163 | * Useful if a blacklist entry interfered with a non-broken device. | ||
146 | */ | 164 | */ |
165 | static int sbp2_default_workarounds; | ||
166 | module_param_named(workarounds, sbp2_default_workarounds, int, 0644); | ||
167 | MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0" | ||
168 | ", 128kB max transfer = " __stringify(SBP2_WORKAROUND_128K_MAX_TRANS) | ||
169 | ", 36 byte inquiry = " __stringify(SBP2_WORKAROUND_INQUIRY_36) | ||
170 | ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8) | ||
171 | ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY) | ||
172 | ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) | ||
173 | ", or a combination)"); | ||
174 | |||
175 | /* legacy parameter */ | ||
147 | static int force_inquiry_hack; | 176 | static int force_inquiry_hack; |
148 | module_param(force_inquiry_hack, int, 0644); | 177 | module_param(force_inquiry_hack, int, 0644); |
149 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); | 178 | MODULE_PARM_DESC(force_inquiry_hack, "Deprecated, use 'workarounds'"); |
150 | 179 | ||
151 | /* | 180 | /* |
152 | * Export information about protocols/devices supported by this driver. | 181 | * Export information about protocols/devices supported by this driver. |
@@ -266,14 +295,55 @@ static struct hpsb_protocol_driver sbp2_driver = { | |||
266 | }; | 295 | }; |
267 | 296 | ||
268 | /* | 297 | /* |
269 | * List of device firmwares that require the inquiry hack. | 298 | * List of devices with known bugs. |
270 | * Yields a few false positives but did not break other devices so far. | 299 | * |
300 | * The firmware_revision field, masked with 0xffff00, is the best indicator | ||
301 | * for the type of bridge chip of a device. It yields a few false positives | ||
302 | * but this did not break correctly behaving devices so far. | ||
271 | */ | 303 | */ |
272 | static u32 sbp2_broken_inquiry_list[] = { | 304 | static const struct { |
273 | 0x00002800, /* Stefan Richter <stefanr@s5r6.in-berlin.de> */ | 305 | u32 firmware_revision; |
274 | /* DViCO Momobay CX-1 */ | 306 | u32 model_id; |
275 | 0x00000200 /* Andreas Plesch <plesch@fas.harvard.edu> */ | 307 | unsigned workarounds; |
276 | /* QPS Fire DVDBurner */ | 308 | } sbp2_workarounds_table[] = { |
309 | /* TSB42AA9 */ { | ||
310 | .firmware_revision = 0x002800, | ||
311 | .workarounds = SBP2_WORKAROUND_INQUIRY_36 | | ||
312 | SBP2_WORKAROUND_MODE_SENSE_8, | ||
313 | }, | ||
314 | /* Initio bridges, actually only needed for some older ones */ { | ||
315 | .firmware_revision = 0x000200, | ||
316 | .workarounds = SBP2_WORKAROUND_INQUIRY_36, | ||
317 | }, | ||
318 | /* Symbios bridge */ { | ||
319 | .firmware_revision = 0xa0b800, | ||
320 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | ||
321 | }, | ||
322 | /* | ||
323 | * Note about the following Apple iPod blacklist entries: | ||
324 | * | ||
325 | * There are iPods (2nd gen, 3rd gen) with model_id==0. Since our | ||
326 | * matching logic treats 0 as a wildcard, we cannot match this ID | ||
327 | * without rewriting the matching routine. Fortunately these iPods | ||
328 | * do not feature the read_capacity bug according to one report. | ||
329 | * Read_capacity behaviour as well as model_id could change due to | ||
330 | * Apple-supplied firmware updates though. | ||
331 | */ | ||
332 | /* iPod 4th generation */ { | ||
333 | .firmware_revision = 0x0a2700, | ||
334 | .model_id = 0x000021, | ||
335 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, | ||
336 | }, | ||
337 | /* iPod mini */ { | ||
338 | .firmware_revision = 0x0a2700, | ||
339 | .model_id = 0x000023, | ||
340 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, | ||
341 | }, | ||
342 | /* iPod Photo */ { | ||
343 | .firmware_revision = 0x0a2700, | ||
344 | .model_id = 0x00007e, | ||
345 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, | ||
346 | } | ||
277 | }; | 347 | }; |
278 | 348 | ||
279 | /************************************** | 349 | /************************************** |
@@ -765,12 +835,17 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud | |||
765 | 835 | ||
766 | /* Register the status FIFO address range. We could use the same FIFO | 836 | /* Register the status FIFO address range. We could use the same FIFO |
767 | * for targets at different nodes. However we need different FIFOs per | 837 | * for targets at different nodes. However we need different FIFOs per |
768 | * target in order to support multi-unit devices. */ | 838 | * target in order to support multi-unit devices. |
839 | * The FIFO is located out of the local host controller's physical range | ||
840 | * but, if possible, within the posted write area. Status writes will | ||
841 | * then be performed as unified transactions. This slightly reduces | ||
842 | * bandwidth usage, and some Prolific based devices seem to require it. | ||
843 | */ | ||
769 | scsi_id->status_fifo_addr = hpsb_allocate_and_register_addrspace( | 844 | scsi_id->status_fifo_addr = hpsb_allocate_and_register_addrspace( |
770 | &sbp2_highlevel, ud->ne->host, &sbp2_ops, | 845 | &sbp2_highlevel, ud->ne->host, &sbp2_ops, |
771 | sizeof(struct sbp2_status_block), sizeof(quadlet_t), | 846 | sizeof(struct sbp2_status_block), sizeof(quadlet_t), |
772 | ~0ULL, ~0ULL); | 847 | 0x010000000000ULL, CSR1212_ALL_SPACE_END); |
773 | if (!scsi_id->status_fifo_addr) { | 848 | if (scsi_id->status_fifo_addr == ~0ULL) { |
774 | SBP2_ERR("failed to allocate status FIFO address range"); | 849 | SBP2_ERR("failed to allocate status FIFO address range"); |
775 | goto failed_alloc; | 850 | goto failed_alloc; |
776 | } | 851 | } |
@@ -1450,7 +1525,8 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1450 | struct csr1212_dentry *dentry; | 1525 | struct csr1212_dentry *dentry; |
1451 | u64 management_agent_addr; | 1526 | u64 management_agent_addr; |
1452 | u32 command_set_spec_id, command_set, unit_characteristics, | 1527 | u32 command_set_spec_id, command_set, unit_characteristics, |
1453 | firmware_revision, workarounds; | 1528 | firmware_revision; |
1529 | unsigned workarounds; | ||
1454 | int i; | 1530 | int i; |
1455 | 1531 | ||
1456 | SBP2_DEBUG_ENTER(); | 1532 | SBP2_DEBUG_ENTER(); |
@@ -1506,12 +1582,8 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1506 | case SBP2_FIRMWARE_REVISION_KEY: | 1582 | case SBP2_FIRMWARE_REVISION_KEY: |
1507 | /* Firmware revision */ | 1583 | /* Firmware revision */ |
1508 | firmware_revision = kv->value.immediate; | 1584 | firmware_revision = kv->value.immediate; |
1509 | if (force_inquiry_hack) | 1585 | SBP2_DEBUG("sbp2_firmware_revision = %x", |
1510 | SBP2_INFO("sbp2_firmware_revision = %x", | 1586 | (unsigned int)firmware_revision); |
1511 | (unsigned int)firmware_revision); | ||
1512 | else | ||
1513 | SBP2_DEBUG("sbp2_firmware_revision = %x", | ||
1514 | (unsigned int)firmware_revision); | ||
1515 | break; | 1587 | break; |
1516 | 1588 | ||
1517 | default: | 1589 | default: |
@@ -1519,41 +1591,44 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1519 | } | 1591 | } |
1520 | } | 1592 | } |
1521 | 1593 | ||
1522 | /* This is the start of our broken device checking. We try to hack | 1594 | workarounds = sbp2_default_workarounds; |
1523 | * around oddities and known defects. */ | 1595 | if (force_inquiry_hack) { |
1524 | workarounds = 0x0; | 1596 | SBP2_WARN("force_inquiry_hack is deprecated. " |
1597 | "Use parameter 'workarounds' instead."); | ||
1598 | workarounds |= SBP2_WORKAROUND_INQUIRY_36; | ||
1599 | } | ||
1525 | 1600 | ||
1526 | /* If the vendor id is 0xa0b8 (Symbios vendor id), then we have a | 1601 | if (!(workarounds & SBP2_WORKAROUND_OVERRIDE)) |
1527 | * bridge with 128KB max transfer size limitation. For sanity, we | 1602 | for (i = 0; i < ARRAY_SIZE(sbp2_workarounds_table); i++) { |
1528 | * only voice this when the current max_sectors setting | 1603 | if (sbp2_workarounds_table[i].firmware_revision && |
1529 | * exceeds the 128k limit. By default, that is not the case. | 1604 | sbp2_workarounds_table[i].firmware_revision != |
1530 | * | 1605 | (firmware_revision & 0xffff00)) |
1531 | * It would be really nice if we could detect this before the scsi | 1606 | continue; |
1532 | * host gets initialized. That way we can down-force the | 1607 | if (sbp2_workarounds_table[i].model_id && |
1533 | * max_sectors to account for it. That is not currently | 1608 | sbp2_workarounds_table[i].model_id != ud->model_id) |
1534 | * possible. */ | 1609 | continue; |
1535 | if ((firmware_revision & 0xffff00) == | 1610 | workarounds |= sbp2_workarounds_table[i].workarounds; |
1536 | SBP2_128KB_BROKEN_FIRMWARE && | 1611 | break; |
1537 | (max_sectors * 512) > (128*1024)) { | ||
1538 | SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB max transfer size.", | ||
1539 | NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid)); | ||
1540 | SBP2_WARN("WARNING: Current max_sectors setting is larger than 128KB (%d sectors)!", | ||
1541 | max_sectors); | ||
1542 | workarounds |= SBP2_BREAKAGE_128K_MAX_TRANSFER; | ||
1543 | } | ||
1544 | |||
1545 | /* Check for a blacklisted set of devices that require us to force | ||
1546 | * a 36 byte host inquiry. This can be overriden as a module param | ||
1547 | * (to force all hosts). */ | ||
1548 | for (i = 0; i < ARRAY_SIZE(sbp2_broken_inquiry_list); i++) { | ||
1549 | if ((firmware_revision & 0xffff00) == | ||
1550 | sbp2_broken_inquiry_list[i]) { | ||
1551 | SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround", | ||
1552 | NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid)); | ||
1553 | workarounds |= SBP2_BREAKAGE_INQUIRY_HACK; | ||
1554 | break; /* No need to continue. */ | ||
1555 | } | 1612 | } |
1556 | } | 1613 | |
1614 | if (workarounds) | ||
1615 | SBP2_INFO("Workarounds for node " NODE_BUS_FMT ": 0x%x " | ||
1616 | "(firmware_revision 0x%06x, vendor_id 0x%06x," | ||
1617 | " model_id 0x%06x)", | ||
1618 | NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid), | ||
1619 | workarounds, firmware_revision, | ||
1620 | ud->vendor_id ? ud->vendor_id : ud->ne->vendor_id, | ||
1621 | ud->model_id); | ||
1622 | |||
1623 | /* We would need one SCSI host template for each target to adjust | ||
1624 | * max_sectors on the fly, therefore warn only. */ | ||
1625 | if (workarounds & SBP2_WORKAROUND_128K_MAX_TRANS && | ||
1626 | (max_sectors * 512) > (128 * 1024)) | ||
1627 | SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB " | ||
1628 | "max transfer size. WARNING: Current max_sectors " | ||
1629 | "setting is larger than 128KB (%d sectors)", | ||
1630 | NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid), | ||
1631 | max_sectors); | ||
1557 | 1632 | ||
1558 | /* If this is a logical unit directory entry, process the parent | 1633 | /* If this is a logical unit directory entry, process the parent |
1559 | * to get the values. */ | 1634 | * to get the values. */ |
@@ -2447,19 +2522,25 @@ static int sbp2scsi_slave_alloc(struct scsi_device *sdev) | |||
2447 | 2522 | ||
2448 | scsi_id->sdev = sdev; | 2523 | scsi_id->sdev = sdev; |
2449 | 2524 | ||
2450 | if (force_inquiry_hack || | 2525 | if (scsi_id->workarounds & SBP2_WORKAROUND_INQUIRY_36) |
2451 | scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK) { | ||
2452 | sdev->inquiry_len = 36; | 2526 | sdev->inquiry_len = 36; |
2453 | sdev->skip_ms_page_8 = 1; | ||
2454 | } | ||
2455 | return 0; | 2527 | return 0; |
2456 | } | 2528 | } |
2457 | 2529 | ||
2458 | static int sbp2scsi_slave_configure(struct scsi_device *sdev) | 2530 | static int sbp2scsi_slave_configure(struct scsi_device *sdev) |
2459 | { | 2531 | { |
2532 | struct scsi_id_instance_data *scsi_id = | ||
2533 | (struct scsi_id_instance_data *)sdev->host->hostdata[0]; | ||
2534 | |||
2460 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); | 2535 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); |
2461 | sdev->use_10_for_rw = 1; | 2536 | sdev->use_10_for_rw = 1; |
2462 | sdev->use_10_for_ms = 1; | 2537 | sdev->use_10_for_ms = 1; |
2538 | |||
2539 | if (sdev->type == TYPE_DISK && | ||
2540 | scsi_id->workarounds & SBP2_WORKAROUND_MODE_SENSE_8) | ||
2541 | sdev->skip_ms_page_8 = 1; | ||
2542 | if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) | ||
2543 | sdev->fix_capacity = 1; | ||
2463 | return 0; | 2544 | return 0; |
2464 | } | 2545 | } |
2465 | 2546 | ||
@@ -2603,7 +2684,9 @@ static int sbp2_module_init(void) | |||
2603 | scsi_driver_template.cmd_per_lun = 1; | 2684 | scsi_driver_template.cmd_per_lun = 1; |
2604 | } | 2685 | } |
2605 | 2686 | ||
2606 | /* Set max sectors (module load option). Default is 255 sectors. */ | 2687 | if (sbp2_default_workarounds & SBP2_WORKAROUND_128K_MAX_TRANS && |
2688 | (max_sectors * 512) > (128 * 1024)) | ||
2689 | max_sectors = 128 * 1024 / 512; | ||
2607 | scsi_driver_template.max_sectors = max_sectors; | 2690 | scsi_driver_template.max_sectors = max_sectors; |
2608 | 2691 | ||
2609 | /* Register our high level driver with 1394 stack */ | 2692 | /* Register our high level driver with 1394 stack */ |
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h index e2d357a9ea3a..f4ccc9d0fba4 100644 --- a/drivers/ieee1394/sbp2.h +++ b/drivers/ieee1394/sbp2.h | |||
@@ -227,11 +227,6 @@ struct sbp2_status_block { | |||
227 | #define SBP2_SW_VERSION_ENTRY 0x00010483 | 227 | #define SBP2_SW_VERSION_ENTRY 0x00010483 |
228 | 228 | ||
229 | /* | 229 | /* |
230 | * Other misc defines | ||
231 | */ | ||
232 | #define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800 | ||
233 | |||
234 | /* | ||
235 | * SCSI specific stuff | 230 | * SCSI specific stuff |
236 | */ | 231 | */ |
237 | 232 | ||
@@ -239,6 +234,13 @@ struct sbp2_status_block { | |||
239 | #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ | 234 | #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ |
240 | #define SBP2_MAX_CMDS 8 /* This should be safe */ | 235 | #define SBP2_MAX_CMDS 8 /* This should be safe */ |
241 | 236 | ||
237 | /* Flags for detected oddities and brokeness */ | ||
238 | #define SBP2_WORKAROUND_128K_MAX_TRANS 0x1 | ||
239 | #define SBP2_WORKAROUND_INQUIRY_36 0x2 | ||
240 | #define SBP2_WORKAROUND_MODE_SENSE_8 0x4 | ||
241 | #define SBP2_WORKAROUND_FIX_CAPACITY 0x8 | ||
242 | #define SBP2_WORKAROUND_OVERRIDE 0x100 | ||
243 | |||
242 | /* This is the two dma types we use for cmd_dma below */ | 244 | /* This is the two dma types we use for cmd_dma below */ |
243 | enum cmd_dma_types { | 245 | enum cmd_dma_types { |
244 | CMD_DMA_NONE, | 246 | CMD_DMA_NONE, |
@@ -268,10 +270,6 @@ struct sbp2_command_info { | |||
268 | 270 | ||
269 | }; | 271 | }; |
270 | 272 | ||
271 | /* A list of flags for detected oddities and brokeness. */ | ||
272 | #define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1 | ||
273 | #define SBP2_BREAKAGE_INQUIRY_HACK 0x2 | ||
274 | |||
275 | struct sbp2scsi_host_info; | 273 | struct sbp2scsi_host_info; |
276 | 274 | ||
277 | /* | 275 | /* |
@@ -345,7 +343,7 @@ struct scsi_id_instance_data { | |||
345 | struct Scsi_Host *scsi_host; | 343 | struct Scsi_Host *scsi_host; |
346 | 344 | ||
347 | /* Device specific workarounds/brokeness */ | 345 | /* Device specific workarounds/brokeness */ |
348 | u32 workarounds; | 346 | unsigned workarounds; |
349 | }; | 347 | }; |
350 | 348 | ||
351 | /* Sbp2 host data structure (one per IEEE1394 host) */ | 349 | /* Sbp2 host data structure (one per IEEE1394 host) */ |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 7cfedb8d9bcd..86fee43502cd 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -34,6 +34,8 @@ | |||
34 | * | 34 | * |
35 | * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $ | 35 | * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $ |
36 | */ | 36 | */ |
37 | |||
38 | #include <linux/completion.h> | ||
37 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
38 | #include <linux/err.h> | 40 | #include <linux/err.h> |
39 | #include <linux/idr.h> | 41 | #include <linux/idr.h> |
@@ -122,7 +124,7 @@ struct cm_id_private { | |||
122 | struct rb_node service_node; | 124 | struct rb_node service_node; |
123 | struct rb_node sidr_id_node; | 125 | struct rb_node sidr_id_node; |
124 | spinlock_t lock; /* Do not acquire inside cm.lock */ | 126 | spinlock_t lock; /* Do not acquire inside cm.lock */ |
125 | wait_queue_head_t wait; | 127 | struct completion comp; |
126 | atomic_t refcount; | 128 | atomic_t refcount; |
127 | 129 | ||
128 | struct ib_mad_send_buf *msg; | 130 | struct ib_mad_send_buf *msg; |
@@ -159,7 +161,7 @@ static void cm_work_handler(void *data); | |||
159 | static inline void cm_deref_id(struct cm_id_private *cm_id_priv) | 161 | static inline void cm_deref_id(struct cm_id_private *cm_id_priv) |
160 | { | 162 | { |
161 | if (atomic_dec_and_test(&cm_id_priv->refcount)) | 163 | if (atomic_dec_and_test(&cm_id_priv->refcount)) |
162 | wake_up(&cm_id_priv->wait); | 164 | complete(&cm_id_priv->comp); |
163 | } | 165 | } |
164 | 166 | ||
165 | static int cm_alloc_msg(struct cm_id_private *cm_id_priv, | 167 | static int cm_alloc_msg(struct cm_id_private *cm_id_priv, |
@@ -559,7 +561,7 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device, | |||
559 | goto error; | 561 | goto error; |
560 | 562 | ||
561 | spin_lock_init(&cm_id_priv->lock); | 563 | spin_lock_init(&cm_id_priv->lock); |
562 | init_waitqueue_head(&cm_id_priv->wait); | 564 | init_completion(&cm_id_priv->comp); |
563 | INIT_LIST_HEAD(&cm_id_priv->work_list); | 565 | INIT_LIST_HEAD(&cm_id_priv->work_list); |
564 | atomic_set(&cm_id_priv->work_count, -1); | 566 | atomic_set(&cm_id_priv->work_count, -1); |
565 | atomic_set(&cm_id_priv->refcount, 1); | 567 | atomic_set(&cm_id_priv->refcount, 1); |
@@ -724,8 +726,8 @@ retest: | |||
724 | } | 726 | } |
725 | 727 | ||
726 | cm_free_id(cm_id->local_id); | 728 | cm_free_id(cm_id->local_id); |
727 | atomic_dec(&cm_id_priv->refcount); | 729 | cm_deref_id(cm_id_priv); |
728 | wait_event(cm_id_priv->wait, !atomic_read(&cm_id_priv->refcount)); | 730 | wait_for_completion(&cm_id_priv->comp); |
729 | while ((work = cm_dequeue_work(cm_id_priv)) != NULL) | 731 | while ((work = cm_dequeue_work(cm_id_priv)) != NULL) |
730 | cm_free_work(work); | 732 | cm_free_work(work); |
731 | if (cm_id_priv->private_data && cm_id_priv->private_data_len) | 733 | if (cm_id_priv->private_data && cm_id_priv->private_data_len) |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 469b6923a2e2..5ad41a64314c 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -352,7 +352,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, | |||
352 | INIT_WORK(&mad_agent_priv->local_work, local_completions, | 352 | INIT_WORK(&mad_agent_priv->local_work, local_completions, |
353 | mad_agent_priv); | 353 | mad_agent_priv); |
354 | atomic_set(&mad_agent_priv->refcount, 1); | 354 | atomic_set(&mad_agent_priv->refcount, 1); |
355 | init_waitqueue_head(&mad_agent_priv->wait); | 355 | init_completion(&mad_agent_priv->comp); |
356 | 356 | ||
357 | return &mad_agent_priv->agent; | 357 | return &mad_agent_priv->agent; |
358 | 358 | ||
@@ -467,7 +467,7 @@ struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device, | |||
467 | mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp; | 467 | mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp; |
468 | mad_snoop_priv->agent.port_num = port_num; | 468 | mad_snoop_priv->agent.port_num = port_num; |
469 | mad_snoop_priv->mad_snoop_flags = mad_snoop_flags; | 469 | mad_snoop_priv->mad_snoop_flags = mad_snoop_flags; |
470 | init_waitqueue_head(&mad_snoop_priv->wait); | 470 | init_completion(&mad_snoop_priv->comp); |
471 | mad_snoop_priv->snoop_index = register_snoop_agent( | 471 | mad_snoop_priv->snoop_index = register_snoop_agent( |
472 | &port_priv->qp_info[qpn], | 472 | &port_priv->qp_info[qpn], |
473 | mad_snoop_priv); | 473 | mad_snoop_priv); |
@@ -486,6 +486,18 @@ error1: | |||
486 | } | 486 | } |
487 | EXPORT_SYMBOL(ib_register_mad_snoop); | 487 | EXPORT_SYMBOL(ib_register_mad_snoop); |
488 | 488 | ||
489 | static inline void deref_mad_agent(struct ib_mad_agent_private *mad_agent_priv) | ||
490 | { | ||
491 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | ||
492 | complete(&mad_agent_priv->comp); | ||
493 | } | ||
494 | |||
495 | static inline void deref_snoop_agent(struct ib_mad_snoop_private *mad_snoop_priv) | ||
496 | { | ||
497 | if (atomic_dec_and_test(&mad_snoop_priv->refcount)) | ||
498 | complete(&mad_snoop_priv->comp); | ||
499 | } | ||
500 | |||
489 | static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) | 501 | static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) |
490 | { | 502 | { |
491 | struct ib_mad_port_private *port_priv; | 503 | struct ib_mad_port_private *port_priv; |
@@ -509,9 +521,8 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) | |||
509 | flush_workqueue(port_priv->wq); | 521 | flush_workqueue(port_priv->wq); |
510 | ib_cancel_rmpp_recvs(mad_agent_priv); | 522 | ib_cancel_rmpp_recvs(mad_agent_priv); |
511 | 523 | ||
512 | atomic_dec(&mad_agent_priv->refcount); | 524 | deref_mad_agent(mad_agent_priv); |
513 | wait_event(mad_agent_priv->wait, | 525 | wait_for_completion(&mad_agent_priv->comp); |
514 | !atomic_read(&mad_agent_priv->refcount)); | ||
515 | 526 | ||
516 | kfree(mad_agent_priv->reg_req); | 527 | kfree(mad_agent_priv->reg_req); |
517 | ib_dereg_mr(mad_agent_priv->agent.mr); | 528 | ib_dereg_mr(mad_agent_priv->agent.mr); |
@@ -529,9 +540,8 @@ static void unregister_mad_snoop(struct ib_mad_snoop_private *mad_snoop_priv) | |||
529 | atomic_dec(&qp_info->snoop_count); | 540 | atomic_dec(&qp_info->snoop_count); |
530 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 541 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
531 | 542 | ||
532 | atomic_dec(&mad_snoop_priv->refcount); | 543 | deref_snoop_agent(mad_snoop_priv); |
533 | wait_event(mad_snoop_priv->wait, | 544 | wait_for_completion(&mad_snoop_priv->comp); |
534 | !atomic_read(&mad_snoop_priv->refcount)); | ||
535 | 545 | ||
536 | kfree(mad_snoop_priv); | 546 | kfree(mad_snoop_priv); |
537 | } | 547 | } |
@@ -600,8 +610,7 @@ static void snoop_send(struct ib_mad_qp_info *qp_info, | |||
600 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 610 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
601 | mad_snoop_priv->agent.snoop_handler(&mad_snoop_priv->agent, | 611 | mad_snoop_priv->agent.snoop_handler(&mad_snoop_priv->agent, |
602 | send_buf, mad_send_wc); | 612 | send_buf, mad_send_wc); |
603 | if (atomic_dec_and_test(&mad_snoop_priv->refcount)) | 613 | deref_snoop_agent(mad_snoop_priv); |
604 | wake_up(&mad_snoop_priv->wait); | ||
605 | spin_lock_irqsave(&qp_info->snoop_lock, flags); | 614 | spin_lock_irqsave(&qp_info->snoop_lock, flags); |
606 | } | 615 | } |
607 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 616 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
@@ -626,8 +635,7 @@ static void snoop_recv(struct ib_mad_qp_info *qp_info, | |||
626 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 635 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
627 | mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent, | 636 | mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent, |
628 | mad_recv_wc); | 637 | mad_recv_wc); |
629 | if (atomic_dec_and_test(&mad_snoop_priv->refcount)) | 638 | deref_snoop_agent(mad_snoop_priv); |
630 | wake_up(&mad_snoop_priv->wait); | ||
631 | spin_lock_irqsave(&qp_info->snoop_lock, flags); | 639 | spin_lock_irqsave(&qp_info->snoop_lock, flags); |
632 | } | 640 | } |
633 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 641 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
@@ -968,8 +976,7 @@ void ib_free_send_mad(struct ib_mad_send_buf *send_buf) | |||
968 | 976 | ||
969 | free_send_rmpp_list(mad_send_wr); | 977 | free_send_rmpp_list(mad_send_wr); |
970 | kfree(send_buf->mad); | 978 | kfree(send_buf->mad); |
971 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 979 | deref_mad_agent(mad_agent_priv); |
972 | wake_up(&mad_agent_priv->wait); | ||
973 | } | 980 | } |
974 | EXPORT_SYMBOL(ib_free_send_mad); | 981 | EXPORT_SYMBOL(ib_free_send_mad); |
975 | 982 | ||
@@ -1757,8 +1764,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, | |||
1757 | mad_recv_wc = ib_process_rmpp_recv_wc(mad_agent_priv, | 1764 | mad_recv_wc = ib_process_rmpp_recv_wc(mad_agent_priv, |
1758 | mad_recv_wc); | 1765 | mad_recv_wc); |
1759 | if (!mad_recv_wc) { | 1766 | if (!mad_recv_wc) { |
1760 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 1767 | deref_mad_agent(mad_agent_priv); |
1761 | wake_up(&mad_agent_priv->wait); | ||
1762 | return; | 1768 | return; |
1763 | } | 1769 | } |
1764 | } | 1770 | } |
@@ -1770,8 +1776,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, | |||
1770 | if (!mad_send_wr) { | 1776 | if (!mad_send_wr) { |
1771 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); | 1777 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); |
1772 | ib_free_recv_mad(mad_recv_wc); | 1778 | ib_free_recv_mad(mad_recv_wc); |
1773 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 1779 | deref_mad_agent(mad_agent_priv); |
1774 | wake_up(&mad_agent_priv->wait); | ||
1775 | return; | 1780 | return; |
1776 | } | 1781 | } |
1777 | ib_mark_mad_done(mad_send_wr); | 1782 | ib_mark_mad_done(mad_send_wr); |
@@ -1790,8 +1795,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, | |||
1790 | } else { | 1795 | } else { |
1791 | mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, | 1796 | mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, |
1792 | mad_recv_wc); | 1797 | mad_recv_wc); |
1793 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 1798 | deref_mad_agent(mad_agent_priv); |
1794 | wake_up(&mad_agent_priv->wait); | ||
1795 | } | 1799 | } |
1796 | } | 1800 | } |
1797 | 1801 | ||
@@ -2021,8 +2025,7 @@ void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, | |||
2021 | mad_send_wc); | 2025 | mad_send_wc); |
2022 | 2026 | ||
2023 | /* Release reference on agent taken when sending */ | 2027 | /* Release reference on agent taken when sending */ |
2024 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 2028 | deref_mad_agent(mad_agent_priv); |
2025 | wake_up(&mad_agent_priv->wait); | ||
2026 | return; | 2029 | return; |
2027 | done: | 2030 | done: |
2028 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); | 2031 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); |
diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h index 6c9c133d71ef..b4fa28d3160f 100644 --- a/drivers/infiniband/core/mad_priv.h +++ b/drivers/infiniband/core/mad_priv.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #ifndef __IB_MAD_PRIV_H__ | 37 | #ifndef __IB_MAD_PRIV_H__ |
38 | #define __IB_MAD_PRIV_H__ | 38 | #define __IB_MAD_PRIV_H__ |
39 | 39 | ||
40 | #include <linux/completion.h> | ||
40 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
41 | #include <linux/kthread.h> | 42 | #include <linux/kthread.h> |
42 | #include <linux/workqueue.h> | 43 | #include <linux/workqueue.h> |
@@ -108,7 +109,7 @@ struct ib_mad_agent_private { | |||
108 | struct list_head rmpp_list; | 109 | struct list_head rmpp_list; |
109 | 110 | ||
110 | atomic_t refcount; | 111 | atomic_t refcount; |
111 | wait_queue_head_t wait; | 112 | struct completion comp; |
112 | }; | 113 | }; |
113 | 114 | ||
114 | struct ib_mad_snoop_private { | 115 | struct ib_mad_snoop_private { |
@@ -117,7 +118,7 @@ struct ib_mad_snoop_private { | |||
117 | int snoop_index; | 118 | int snoop_index; |
118 | int mad_snoop_flags; | 119 | int mad_snoop_flags; |
119 | atomic_t refcount; | 120 | atomic_t refcount; |
120 | wait_queue_head_t wait; | 121 | struct completion comp; |
121 | }; | 122 | }; |
122 | 123 | ||
123 | struct ib_mad_send_wr_private { | 124 | struct ib_mad_send_wr_private { |
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c index dfd4e588ce03..d4704e054e30 100644 --- a/drivers/infiniband/core/mad_rmpp.c +++ b/drivers/infiniband/core/mad_rmpp.c | |||
@@ -49,7 +49,7 @@ struct mad_rmpp_recv { | |||
49 | struct list_head list; | 49 | struct list_head list; |
50 | struct work_struct timeout_work; | 50 | struct work_struct timeout_work; |
51 | struct work_struct cleanup_work; | 51 | struct work_struct cleanup_work; |
52 | wait_queue_head_t wait; | 52 | struct completion comp; |
53 | enum rmpp_state state; | 53 | enum rmpp_state state; |
54 | spinlock_t lock; | 54 | spinlock_t lock; |
55 | atomic_t refcount; | 55 | atomic_t refcount; |
@@ -69,10 +69,16 @@ struct mad_rmpp_recv { | |||
69 | u8 method; | 69 | u8 method; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) | ||
73 | { | ||
74 | if (atomic_dec_and_test(&rmpp_recv->refcount)) | ||
75 | complete(&rmpp_recv->comp); | ||
76 | } | ||
77 | |||
72 | static void destroy_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) | 78 | static void destroy_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) |
73 | { | 79 | { |
74 | atomic_dec(&rmpp_recv->refcount); | 80 | deref_rmpp_recv(rmpp_recv); |
75 | wait_event(rmpp_recv->wait, !atomic_read(&rmpp_recv->refcount)); | 81 | wait_for_completion(&rmpp_recv->comp); |
76 | ib_destroy_ah(rmpp_recv->ah); | 82 | ib_destroy_ah(rmpp_recv->ah); |
77 | kfree(rmpp_recv); | 83 | kfree(rmpp_recv); |
78 | } | 84 | } |
@@ -253,7 +259,7 @@ create_rmpp_recv(struct ib_mad_agent_private *agent, | |||
253 | goto error; | 259 | goto error; |
254 | 260 | ||
255 | rmpp_recv->agent = agent; | 261 | rmpp_recv->agent = agent; |
256 | init_waitqueue_head(&rmpp_recv->wait); | 262 | init_completion(&rmpp_recv->comp); |
257 | INIT_WORK(&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv); | 263 | INIT_WORK(&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv); |
258 | INIT_WORK(&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv); | 264 | INIT_WORK(&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv); |
259 | spin_lock_init(&rmpp_recv->lock); | 265 | spin_lock_init(&rmpp_recv->lock); |
@@ -279,12 +285,6 @@ error: kfree(rmpp_recv); | |||
279 | return NULL; | 285 | return NULL; |
280 | } | 286 | } |
281 | 287 | ||
282 | static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) | ||
283 | { | ||
284 | if (atomic_dec_and_test(&rmpp_recv->refcount)) | ||
285 | wake_up(&rmpp_recv->wait); | ||
286 | } | ||
287 | |||
288 | static struct mad_rmpp_recv * | 288 | static struct mad_rmpp_recv * |
289 | find_rmpp_recv(struct ib_mad_agent_private *agent, | 289 | find_rmpp_recv(struct ib_mad_agent_private *agent, |
290 | struct ib_mad_recv_wc *mad_recv_wc) | 290 | struct ib_mad_recv_wc *mad_recv_wc) |
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index f6a05965a4e8..9164a09b6ccd 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
@@ -32,6 +32,8 @@ | |||
32 | * | 32 | * |
33 | * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $ | 33 | * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $ |
34 | */ | 34 | */ |
35 | |||
36 | #include <linux/completion.h> | ||
35 | #include <linux/init.h> | 37 | #include <linux/init.h> |
36 | #include <linux/fs.h> | 38 | #include <linux/fs.h> |
37 | #include <linux/module.h> | 39 | #include <linux/module.h> |
@@ -72,7 +74,7 @@ struct ib_ucm_file { | |||
72 | 74 | ||
73 | struct ib_ucm_context { | 75 | struct ib_ucm_context { |
74 | int id; | 76 | int id; |
75 | wait_queue_head_t wait; | 77 | struct completion comp; |
76 | atomic_t ref; | 78 | atomic_t ref; |
77 | int events_reported; | 79 | int events_reported; |
78 | 80 | ||
@@ -138,7 +140,7 @@ static struct ib_ucm_context *ib_ucm_ctx_get(struct ib_ucm_file *file, int id) | |||
138 | static void ib_ucm_ctx_put(struct ib_ucm_context *ctx) | 140 | static void ib_ucm_ctx_put(struct ib_ucm_context *ctx) |
139 | { | 141 | { |
140 | if (atomic_dec_and_test(&ctx->ref)) | 142 | if (atomic_dec_and_test(&ctx->ref)) |
141 | wake_up(&ctx->wait); | 143 | complete(&ctx->comp); |
142 | } | 144 | } |
143 | 145 | ||
144 | static inline int ib_ucm_new_cm_id(int event) | 146 | static inline int ib_ucm_new_cm_id(int event) |
@@ -178,7 +180,7 @@ static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file) | |||
178 | return NULL; | 180 | return NULL; |
179 | 181 | ||
180 | atomic_set(&ctx->ref, 1); | 182 | atomic_set(&ctx->ref, 1); |
181 | init_waitqueue_head(&ctx->wait); | 183 | init_completion(&ctx->comp); |
182 | ctx->file = file; | 184 | ctx->file = file; |
183 | INIT_LIST_HEAD(&ctx->events); | 185 | INIT_LIST_HEAD(&ctx->events); |
184 | 186 | ||
@@ -586,8 +588,8 @@ static ssize_t ib_ucm_destroy_id(struct ib_ucm_file *file, | |||
586 | if (IS_ERR(ctx)) | 588 | if (IS_ERR(ctx)) |
587 | return PTR_ERR(ctx); | 589 | return PTR_ERR(ctx); |
588 | 590 | ||
589 | atomic_dec(&ctx->ref); | 591 | ib_ucm_ctx_put(ctx); |
590 | wait_event(ctx->wait, !atomic_read(&ctx->ref)); | 592 | wait_for_completion(&ctx->comp); |
591 | 593 | ||
592 | /* No new events will be generated after destroying the cm_id. */ | 594 | /* No new events will be generated after destroying the cm_id. */ |
593 | ib_destroy_cm_id(ctx->cm_id); | 595 | ib_destroy_cm_id(ctx->cm_id); |
diff --git a/drivers/infiniband/core/uverbs_mem.c b/drivers/infiniband/core/uverbs_mem.c index 36a32c315668..efe147dbeb42 100644 --- a/drivers/infiniband/core/uverbs_mem.c +++ b/drivers/infiniband/core/uverbs_mem.c | |||
@@ -211,8 +211,10 @@ void ib_umem_release_on_close(struct ib_device *dev, struct ib_umem *umem) | |||
211 | */ | 211 | */ |
212 | 212 | ||
213 | work = kmalloc(sizeof *work, GFP_KERNEL); | 213 | work = kmalloc(sizeof *work, GFP_KERNEL); |
214 | if (!work) | 214 | if (!work) { |
215 | mmput(mm); | ||
215 | return; | 216 | return; |
217 | } | ||
216 | 218 | ||
217 | INIT_WORK(&work->work, ib_umem_account, work); | 219 | INIT_WORK(&work->work, ib_umem_account, work); |
218 | work->mm = mm; | 220 | work->mm = mm; |
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 398add4d4cb1..dddcdae736ac 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -116,10 +116,9 @@ static int __devinit ipath_init_one(struct pci_dev *, | |||
116 | #define PCI_DEVICE_ID_INFINIPATH_PE800 0x10 | 116 | #define PCI_DEVICE_ID_INFINIPATH_PE800 0x10 |
117 | 117 | ||
118 | static const struct pci_device_id ipath_pci_tbl[] = { | 118 | static const struct pci_device_id ipath_pci_tbl[] = { |
119 | {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, | 119 | { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) }, |
120 | PCI_DEVICE_ID_INFINIPATH_HT)}, | 120 | { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) }, |
121 | {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, | 121 | { 0, } |
122 | PCI_DEVICE_ID_INFINIPATH_PE800)}, | ||
123 | }; | 122 | }; |
124 | 123 | ||
125 | MODULE_DEVICE_TABLE(pci, ipath_pci_tbl); | 124 | MODULE_DEVICE_TABLE(pci, ipath_pci_tbl); |
@@ -1906,19 +1905,19 @@ static void __exit infinipath_cleanup(void) | |||
1906 | } else | 1905 | } else |
1907 | ipath_dbg("irq is 0, not doing free_irq " | 1906 | ipath_dbg("irq is 0, not doing free_irq " |
1908 | "for unit %u\n", dd->ipath_unit); | 1907 | "for unit %u\n", dd->ipath_unit); |
1909 | dd->pcidev = NULL; | ||
1910 | } | ||
1911 | 1908 | ||
1912 | /* | 1909 | /* |
1913 | * we check for NULL here, because it's outside the kregbase | 1910 | * we check for NULL here, because it's outside |
1914 | * check, and we need to call it after the free_irq. Thus | 1911 | * the kregbase check, and we need to call it |
1915 | * it's possible that the function pointers were never | 1912 | * after the free_irq. Thus it's possible that |
1916 | * initialized. | 1913 | * the function pointers were never initialized. |
1917 | */ | 1914 | */ |
1918 | if (dd->ipath_f_cleanup) | 1915 | if (dd->ipath_f_cleanup) |
1919 | /* clean up chip-specific stuff */ | 1916 | /* clean up chip-specific stuff */ |
1920 | dd->ipath_f_cleanup(dd); | 1917 | dd->ipath_f_cleanup(dd); |
1921 | 1918 | ||
1919 | dd->pcidev = NULL; | ||
1920 | } | ||
1922 | spin_lock_irqsave(&ipath_devs_lock, flags); | 1921 | spin_lock_irqsave(&ipath_devs_lock, flags); |
1923 | } | 1922 | } |
1924 | 1923 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c index f11a900e8cd7..a2f1ceafcca9 100644 --- a/drivers/infiniband/hw/ipath/ipath_eeprom.c +++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c | |||
@@ -505,11 +505,10 @@ static u8 flash_csum(struct ipath_flash *ifp, int adjust) | |||
505 | * ipath_get_guid - get the GUID from the i2c device | 505 | * ipath_get_guid - get the GUID from the i2c device |
506 | * @dd: the infinipath device | 506 | * @dd: the infinipath device |
507 | * | 507 | * |
508 | * When we add the multi-chip support, we will probably have to add | 508 | * We have the capability to use the ipath_nguid field, and get |
509 | * the ability to use the number of guids field, and get the guid from | 509 | * the guid from the first chip's flash, to use for all of them. |
510 | * the first chip's flash, to use for all of them. | ||
511 | */ | 510 | */ |
512 | void ipath_get_guid(struct ipath_devdata *dd) | 511 | void ipath_get_eeprom_info(struct ipath_devdata *dd) |
513 | { | 512 | { |
514 | void *buf; | 513 | void *buf; |
515 | struct ipath_flash *ifp; | 514 | struct ipath_flash *ifp; |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index c347191f02bf..ada267e41f6c 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -139,7 +139,7 @@ static int ipath_get_base_info(struct ipath_portdata *pd, | |||
139 | kinfo->spi_piosize = dd->ipath_ibmaxlen; | 139 | kinfo->spi_piosize = dd->ipath_ibmaxlen; |
140 | kinfo->spi_mtu = dd->ipath_ibmaxlen; /* maxlen, not ibmtu */ | 140 | kinfo->spi_mtu = dd->ipath_ibmaxlen; /* maxlen, not ibmtu */ |
141 | kinfo->spi_port = pd->port_port; | 141 | kinfo->spi_port = pd->port_port; |
142 | kinfo->spi_sw_version = IPATH_USER_SWVERSION; | 142 | kinfo->spi_sw_version = IPATH_KERN_SWVERSION; |
143 | kinfo->spi_hw_version = dd->ipath_revision; | 143 | kinfo->spi_hw_version = dd->ipath_revision; |
144 | 144 | ||
145 | if (copy_to_user(ubase, kinfo, sizeof(*kinfo))) | 145 | if (copy_to_user(ubase, kinfo, sizeof(*kinfo))) |
@@ -1224,6 +1224,10 @@ static unsigned int ipath_poll(struct file *fp, | |||
1224 | 1224 | ||
1225 | if (tail == head) { | 1225 | if (tail == head) { |
1226 | set_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag); | 1226 | set_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag); |
1227 | if(dd->ipath_rhdrhead_intr_off) /* arm rcv interrupt */ | ||
1228 | (void)ipath_write_ureg(dd, ur_rcvhdrhead, | ||
1229 | dd->ipath_rhdrhead_intr_off | ||
1230 | | head, pd->port_port); | ||
1227 | poll_wait(fp, &pd->port_wait, pt); | 1231 | poll_wait(fp, &pd->port_wait, pt); |
1228 | 1232 | ||
1229 | if (test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) { | 1233 | if (test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) { |
diff --git a/drivers/infiniband/hw/ipath/ipath_ht400.c b/drivers/infiniband/hw/ipath/ipath_ht400.c index 4652435998f3..fac0a2b74de2 100644 --- a/drivers/infiniband/hw/ipath/ipath_ht400.c +++ b/drivers/infiniband/hw/ipath/ipath_ht400.c | |||
@@ -607,7 +607,12 @@ static int ipath_ht_boardname(struct ipath_devdata *dd, char *name, | |||
607 | case 4: /* Ponderosa is one of the bringup boards */ | 607 | case 4: /* Ponderosa is one of the bringup boards */ |
608 | n = "Ponderosa"; | 608 | n = "Ponderosa"; |
609 | break; | 609 | break; |
610 | case 5: /* HT-460 original production board */ | 610 | case 5: |
611 | /* | ||
612 | * HT-460 original production board; two production levels, with | ||
613 | * different serial number ranges. See ipath_ht_early_init() for | ||
614 | * case where we enable IPATH_GPIO_INTR for later serial # range. | ||
615 | */ | ||
611 | n = "InfiniPath_HT-460"; | 616 | n = "InfiniPath_HT-460"; |
612 | break; | 617 | break; |
613 | case 6: | 618 | case 6: |
@@ -642,7 +647,7 @@ static int ipath_ht_boardname(struct ipath_devdata *dd, char *name, | |||
642 | if (n) | 647 | if (n) |
643 | snprintf(name, namelen, "%s", n); | 648 | snprintf(name, namelen, "%s", n); |
644 | 649 | ||
645 | if (dd->ipath_majrev != 3 || dd->ipath_minrev != 2) { | 650 | if (dd->ipath_majrev != 3 || (dd->ipath_minrev < 2 || dd->ipath_minrev > 3)) { |
646 | /* | 651 | /* |
647 | * This version of the driver only supports the HT-400 | 652 | * This version of the driver only supports the HT-400 |
648 | * Rev 3.2 | 653 | * Rev 3.2 |
@@ -1520,6 +1525,18 @@ static int ipath_ht_early_init(struct ipath_devdata *dd) | |||
1520 | */ | 1525 | */ |
1521 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | 1526 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, |
1522 | INFINIPATH_S_ABORT); | 1527 | INFINIPATH_S_ABORT); |
1528 | |||
1529 | ipath_get_eeprom_info(dd); | ||
1530 | if(dd->ipath_boardrev == 5 && dd->ipath_serial[0] == '1' && | ||
1531 | dd->ipath_serial[1] == '2' && dd->ipath_serial[2] == '8') { | ||
1532 | /* | ||
1533 | * Later production HT-460 has same changes as HT-465, so | ||
1534 | * can use GPIO interrupts. They have serial #'s starting | ||
1535 | * with 128, rather than 112. | ||
1536 | */ | ||
1537 | dd->ipath_flags |= IPATH_GPIO_INTR; | ||
1538 | dd->ipath_flags &= ~IPATH_POLL_RX_INTR; | ||
1539 | } | ||
1523 | return 0; | 1540 | return 0; |
1524 | } | 1541 | } |
1525 | 1542 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index 16f640e1c16e..dc83250d26a6 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c | |||
@@ -879,7 +879,6 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
879 | 879 | ||
880 | done: | 880 | done: |
881 | if (!ret) { | 881 | if (!ret) { |
882 | ipath_get_guid(dd); | ||
883 | *dd->ipath_statusp |= IPATH_STATUS_CHIP_PRESENT; | 882 | *dd->ipath_statusp |= IPATH_STATUS_CHIP_PRESENT; |
884 | if (!dd->ipath_f_intrsetup(dd)) { | 883 | if (!dd->ipath_f_intrsetup(dd)) { |
885 | /* now we can enable all interrupts from the chip */ | 884 | /* now we can enable all interrupts from the chip */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index e6507f8115bc..5d92d57b6f54 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -650,7 +650,7 @@ u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32 *); | |||
650 | void ipath_init_pe800_funcs(struct ipath_devdata *); | 650 | void ipath_init_pe800_funcs(struct ipath_devdata *); |
651 | /* init HT-400-specific func */ | 651 | /* init HT-400-specific func */ |
652 | void ipath_init_ht400_funcs(struct ipath_devdata *); | 652 | void ipath_init_ht400_funcs(struct ipath_devdata *); |
653 | void ipath_get_guid(struct ipath_devdata *); | 653 | void ipath_get_eeprom_info(struct ipath_devdata *); |
654 | u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg); | 654 | u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg); |
655 | 655 | ||
656 | /* | 656 | /* |
diff --git a/drivers/infiniband/hw/ipath/ipath_keys.c b/drivers/infiniband/hw/ipath/ipath_keys.c index aa33b0e9f2f6..5ae8761f9dd2 100644 --- a/drivers/infiniband/hw/ipath/ipath_keys.c +++ b/drivers/infiniband/hw/ipath/ipath_keys.c | |||
@@ -136,9 +136,7 @@ int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge, | |||
136 | ret = 1; | 136 | ret = 1; |
137 | goto bail; | 137 | goto bail; |
138 | } | 138 | } |
139 | spin_lock(&rkt->lock); | ||
140 | mr = rkt->table[(sge->lkey >> (32 - ib_ipath_lkey_table_size))]; | 139 | mr = rkt->table[(sge->lkey >> (32 - ib_ipath_lkey_table_size))]; |
141 | spin_unlock(&rkt->lock); | ||
142 | if (unlikely(mr == NULL || mr->lkey != sge->lkey)) { | 140 | if (unlikely(mr == NULL || mr->lkey != sge->lkey)) { |
143 | ret = 0; | 141 | ret = 0; |
144 | goto bail; | 142 | goto bail; |
@@ -184,8 +182,6 @@ bail: | |||
184 | * @acc: access flags | 182 | * @acc: access flags |
185 | * | 183 | * |
186 | * Return 1 if successful, otherwise 0. | 184 | * Return 1 if successful, otherwise 0. |
187 | * | ||
188 | * The QP r_rq.lock should be held. | ||
189 | */ | 185 | */ |
190 | int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, | 186 | int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, |
191 | u32 len, u64 vaddr, u32 rkey, int acc) | 187 | u32 len, u64 vaddr, u32 rkey, int acc) |
@@ -196,9 +192,7 @@ int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, | |||
196 | size_t off; | 192 | size_t off; |
197 | int ret; | 193 | int ret; |
198 | 194 | ||
199 | spin_lock(&rkt->lock); | ||
200 | mr = rkt->table[(rkey >> (32 - ib_ipath_lkey_table_size))]; | 195 | mr = rkt->table[(rkey >> (32 - ib_ipath_lkey_table_size))]; |
201 | spin_unlock(&rkt->lock); | ||
202 | if (unlikely(mr == NULL || mr->lkey != rkey)) { | 196 | if (unlikely(mr == NULL || mr->lkey != rkey)) { |
203 | ret = 0; | 197 | ret = 0; |
204 | goto bail; | 198 | goto bail; |
diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c index 9cb5258ffed9..9ec4ac77b87f 100644 --- a/drivers/infiniband/hw/ipath/ipath_layer.c +++ b/drivers/infiniband/hw/ipath/ipath_layer.c | |||
@@ -872,12 +872,13 @@ static void copy_io(u32 __iomem *piobuf, struct ipath_sge_state *ss, | |||
872 | update_sge(ss, len); | 872 | update_sge(ss, len); |
873 | length -= len; | 873 | length -= len; |
874 | } | 874 | } |
875 | /* Update address before sending packet. */ | ||
876 | update_sge(ss, length); | ||
875 | /* must flush early everything before trigger word */ | 877 | /* must flush early everything before trigger word */ |
876 | ipath_flush_wc(); | 878 | ipath_flush_wc(); |
877 | __raw_writel(last, piobuf); | 879 | __raw_writel(last, piobuf); |
878 | /* be sure trigger word is written */ | 880 | /* be sure trigger word is written */ |
879 | ipath_flush_wc(); | 881 | ipath_flush_wc(); |
880 | update_sge(ss, length); | ||
881 | } | 882 | } |
882 | 883 | ||
883 | /** | 884 | /** |
@@ -943,17 +944,18 @@ int ipath_verbs_send(struct ipath_devdata *dd, u32 hdrwords, | |||
943 | if (likely(ss->num_sge == 1 && len <= ss->sge.length && | 944 | if (likely(ss->num_sge == 1 && len <= ss->sge.length && |
944 | !((unsigned long)ss->sge.vaddr & (sizeof(u32) - 1)))) { | 945 | !((unsigned long)ss->sge.vaddr & (sizeof(u32) - 1)))) { |
945 | u32 w; | 946 | u32 w; |
947 | u32 *addr = (u32 *) ss->sge.vaddr; | ||
946 | 948 | ||
949 | /* Update address before sending packet. */ | ||
950 | update_sge(ss, len); | ||
947 | /* Need to round up for the last dword in the packet. */ | 951 | /* Need to round up for the last dword in the packet. */ |
948 | w = (len + 3) >> 2; | 952 | w = (len + 3) >> 2; |
949 | __iowrite32_copy(piobuf, ss->sge.vaddr, w - 1); | 953 | __iowrite32_copy(piobuf, addr, w - 1); |
950 | /* must flush early everything before trigger word */ | 954 | /* must flush early everything before trigger word */ |
951 | ipath_flush_wc(); | 955 | ipath_flush_wc(); |
952 | __raw_writel(((u32 *) ss->sge.vaddr)[w - 1], | 956 | __raw_writel(addr[w - 1], piobuf + w - 1); |
953 | piobuf + w - 1); | ||
954 | /* be sure trigger word is written */ | 957 | /* be sure trigger word is written */ |
955 | ipath_flush_wc(); | 958 | ipath_flush_wc(); |
956 | update_sge(ss, len); | ||
957 | ret = 0; | 959 | ret = 0; |
958 | goto bail; | 960 | goto bail; |
959 | } | 961 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_pe800.c b/drivers/infiniband/hw/ipath/ipath_pe800.c index 6318067ab5ec..02e8c75b24f6 100644 --- a/drivers/infiniband/hw/ipath/ipath_pe800.c +++ b/drivers/infiniband/hw/ipath/ipath_pe800.c | |||
@@ -1180,6 +1180,8 @@ static int ipath_pe_early_init(struct ipath_devdata *dd) | |||
1180 | */ | 1180 | */ |
1181 | dd->ipath_rhdrhead_intr_off = 1ULL<<32; | 1181 | dd->ipath_rhdrhead_intr_off = 1ULL<<32; |
1182 | 1182 | ||
1183 | ipath_get_eeprom_info(dd); | ||
1184 | |||
1183 | return 0; | 1185 | return 0; |
1184 | } | 1186 | } |
1185 | 1187 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 18890716db1e..9f8855d970c8 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -375,10 +375,10 @@ static void ipath_error_qp(struct ipath_qp *qp) | |||
375 | 375 | ||
376 | spin_lock(&dev->pending_lock); | 376 | spin_lock(&dev->pending_lock); |
377 | /* XXX What if its already removed by the timeout code? */ | 377 | /* XXX What if its already removed by the timeout code? */ |
378 | if (qp->timerwait.next != LIST_POISON1) | 378 | if (!list_empty(&qp->timerwait)) |
379 | list_del(&qp->timerwait); | 379 | list_del_init(&qp->timerwait); |
380 | if (qp->piowait.next != LIST_POISON1) | 380 | if (!list_empty(&qp->piowait)) |
381 | list_del(&qp->piowait); | 381 | list_del_init(&qp->piowait); |
382 | spin_unlock(&dev->pending_lock); | 382 | spin_unlock(&dev->pending_lock); |
383 | 383 | ||
384 | wc.status = IB_WC_WR_FLUSH_ERR; | 384 | wc.status = IB_WC_WR_FLUSH_ERR; |
@@ -427,6 +427,7 @@ static void ipath_error_qp(struct ipath_qp *qp) | |||
427 | int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | 427 | int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
428 | int attr_mask) | 428 | int attr_mask) |
429 | { | 429 | { |
430 | struct ipath_ibdev *dev = to_idev(ibqp->device); | ||
430 | struct ipath_qp *qp = to_iqp(ibqp); | 431 | struct ipath_qp *qp = to_iqp(ibqp); |
431 | enum ib_qp_state cur_state, new_state; | 432 | enum ib_qp_state cur_state, new_state; |
432 | unsigned long flags; | 433 | unsigned long flags; |
@@ -443,6 +444,19 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
443 | attr_mask)) | 444 | attr_mask)) |
444 | goto inval; | 445 | goto inval; |
445 | 446 | ||
447 | if (attr_mask & IB_QP_AV) | ||
448 | if (attr->ah_attr.dlid == 0 || | ||
449 | attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE) | ||
450 | goto inval; | ||
451 | |||
452 | if (attr_mask & IB_QP_PKEY_INDEX) | ||
453 | if (attr->pkey_index >= ipath_layer_get_npkeys(dev->dd)) | ||
454 | goto inval; | ||
455 | |||
456 | if (attr_mask & IB_QP_MIN_RNR_TIMER) | ||
457 | if (attr->min_rnr_timer > 31) | ||
458 | goto inval; | ||
459 | |||
446 | switch (new_state) { | 460 | switch (new_state) { |
447 | case IB_QPS_RESET: | 461 | case IB_QPS_RESET: |
448 | ipath_reset_qp(qp); | 462 | ipath_reset_qp(qp); |
@@ -457,13 +471,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
457 | 471 | ||
458 | } | 472 | } |
459 | 473 | ||
460 | if (attr_mask & IB_QP_PKEY_INDEX) { | 474 | if (attr_mask & IB_QP_PKEY_INDEX) |
461 | struct ipath_ibdev *dev = to_idev(ibqp->device); | ||
462 | |||
463 | if (attr->pkey_index >= ipath_layer_get_npkeys(dev->dd)) | ||
464 | goto inval; | ||
465 | qp->s_pkey_index = attr->pkey_index; | 475 | qp->s_pkey_index = attr->pkey_index; |
466 | } | ||
467 | 476 | ||
468 | if (attr_mask & IB_QP_DEST_QPN) | 477 | if (attr_mask & IB_QP_DEST_QPN) |
469 | qp->remote_qpn = attr->dest_qp_num; | 478 | qp->remote_qpn = attr->dest_qp_num; |
@@ -479,12 +488,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
479 | if (attr_mask & IB_QP_ACCESS_FLAGS) | 488 | if (attr_mask & IB_QP_ACCESS_FLAGS) |
480 | qp->qp_access_flags = attr->qp_access_flags; | 489 | qp->qp_access_flags = attr->qp_access_flags; |
481 | 490 | ||
482 | if (attr_mask & IB_QP_AV) { | 491 | if (attr_mask & IB_QP_AV) |
483 | if (attr->ah_attr.dlid == 0 || | ||
484 | attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE) | ||
485 | goto inval; | ||
486 | qp->remote_ah_attr = attr->ah_attr; | 492 | qp->remote_ah_attr = attr->ah_attr; |
487 | } | ||
488 | 493 | ||
489 | if (attr_mask & IB_QP_PATH_MTU) | 494 | if (attr_mask & IB_QP_PATH_MTU) |
490 | qp->path_mtu = attr->path_mtu; | 495 | qp->path_mtu = attr->path_mtu; |
@@ -499,11 +504,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
499 | qp->s_rnr_retry_cnt = qp->s_rnr_retry; | 504 | qp->s_rnr_retry_cnt = qp->s_rnr_retry; |
500 | } | 505 | } |
501 | 506 | ||
502 | if (attr_mask & IB_QP_MIN_RNR_TIMER) { | 507 | if (attr_mask & IB_QP_MIN_RNR_TIMER) |
503 | if (attr->min_rnr_timer > 31) | ||
504 | goto inval; | ||
505 | qp->s_min_rnr_timer = attr->min_rnr_timer; | 508 | qp->s_min_rnr_timer = attr->min_rnr_timer; |
506 | } | ||
507 | 509 | ||
508 | if (attr_mask & IB_QP_QKEY) | 510 | if (attr_mask & IB_QP_QKEY) |
509 | qp->qkey = attr->qkey; | 511 | qp->qkey = attr->qkey; |
@@ -710,10 +712,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
710 | init_attr->qp_type == IB_QPT_RC ? | 712 | init_attr->qp_type == IB_QPT_RC ? |
711 | ipath_do_rc_send : ipath_do_uc_send, | 713 | ipath_do_rc_send : ipath_do_uc_send, |
712 | (unsigned long)qp); | 714 | (unsigned long)qp); |
713 | qp->piowait.next = LIST_POISON1; | 715 | INIT_LIST_HEAD(&qp->piowait); |
714 | qp->piowait.prev = LIST_POISON2; | 716 | INIT_LIST_HEAD(&qp->timerwait); |
715 | qp->timerwait.next = LIST_POISON1; | ||
716 | qp->timerwait.prev = LIST_POISON2; | ||
717 | qp->state = IB_QPS_RESET; | 717 | qp->state = IB_QPS_RESET; |
718 | qp->s_wq = swq; | 718 | qp->s_wq = swq; |
719 | qp->s_size = init_attr->cap.max_send_wr + 1; | 719 | qp->s_size = init_attr->cap.max_send_wr + 1; |
@@ -734,7 +734,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
734 | ipath_reset_qp(qp); | 734 | ipath_reset_qp(qp); |
735 | 735 | ||
736 | /* Tell the core driver that the kernel SMA is present. */ | 736 | /* Tell the core driver that the kernel SMA is present. */ |
737 | if (qp->ibqp.qp_type == IB_QPT_SMI) | 737 | if (init_attr->qp_type == IB_QPT_SMI) |
738 | ipath_layer_set_verbs_flags(dev->dd, | 738 | ipath_layer_set_verbs_flags(dev->dd, |
739 | IPATH_VERBS_KERNEL_SMA); | 739 | IPATH_VERBS_KERNEL_SMA); |
740 | break; | 740 | break; |
@@ -783,10 +783,10 @@ int ipath_destroy_qp(struct ib_qp *ibqp) | |||
783 | 783 | ||
784 | /* Make sure the QP isn't on the timeout list. */ | 784 | /* Make sure the QP isn't on the timeout list. */ |
785 | spin_lock_irqsave(&dev->pending_lock, flags); | 785 | spin_lock_irqsave(&dev->pending_lock, flags); |
786 | if (qp->timerwait.next != LIST_POISON1) | 786 | if (!list_empty(&qp->timerwait)) |
787 | list_del(&qp->timerwait); | 787 | list_del_init(&qp->timerwait); |
788 | if (qp->piowait.next != LIST_POISON1) | 788 | if (!list_empty(&qp->piowait)) |
789 | list_del(&qp->piowait); | 789 | list_del_init(&qp->piowait); |
790 | spin_unlock_irqrestore(&dev->pending_lock, flags); | 790 | spin_unlock_irqrestore(&dev->pending_lock, flags); |
791 | 791 | ||
792 | /* | 792 | /* |
@@ -855,10 +855,10 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc) | |||
855 | 855 | ||
856 | spin_lock(&dev->pending_lock); | 856 | spin_lock(&dev->pending_lock); |
857 | /* XXX What if its already removed by the timeout code? */ | 857 | /* XXX What if its already removed by the timeout code? */ |
858 | if (qp->timerwait.next != LIST_POISON1) | 858 | if (!list_empty(&qp->timerwait)) |
859 | list_del(&qp->timerwait); | 859 | list_del_init(&qp->timerwait); |
860 | if (qp->piowait.next != LIST_POISON1) | 860 | if (!list_empty(&qp->piowait)) |
861 | list_del(&qp->piowait); | 861 | list_del_init(&qp->piowait); |
862 | spin_unlock(&dev->pending_lock); | 862 | spin_unlock(&dev->pending_lock); |
863 | 863 | ||
864 | ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1); | 864 | ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1); |
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c index a4055ca00614..493b1821a934 100644 --- a/drivers/infiniband/hw/ipath/ipath_rc.c +++ b/drivers/infiniband/hw/ipath/ipath_rc.c | |||
@@ -57,7 +57,7 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe) | |||
57 | qp->s_len = wqe->length - len; | 57 | qp->s_len = wqe->length - len; |
58 | dev = to_idev(qp->ibqp.device); | 58 | dev = to_idev(qp->ibqp.device); |
59 | spin_lock(&dev->pending_lock); | 59 | spin_lock(&dev->pending_lock); |
60 | if (qp->timerwait.next == LIST_POISON1) | 60 | if (list_empty(&qp->timerwait)) |
61 | list_add_tail(&qp->timerwait, | 61 | list_add_tail(&qp->timerwait, |
62 | &dev->pending[dev->pending_index]); | 62 | &dev->pending[dev->pending_index]); |
63 | spin_unlock(&dev->pending_lock); | 63 | spin_unlock(&dev->pending_lock); |
@@ -356,7 +356,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, | |||
356 | if ((int)(qp->s_psn - qp->s_next_psn) > 0) | 356 | if ((int)(qp->s_psn - qp->s_next_psn) > 0) |
357 | qp->s_next_psn = qp->s_psn; | 357 | qp->s_next_psn = qp->s_psn; |
358 | spin_lock(&dev->pending_lock); | 358 | spin_lock(&dev->pending_lock); |
359 | if (qp->timerwait.next == LIST_POISON1) | 359 | if (list_empty(&qp->timerwait)) |
360 | list_add_tail(&qp->timerwait, | 360 | list_add_tail(&qp->timerwait, |
361 | &dev->pending[dev->pending_index]); | 361 | &dev->pending[dev->pending_index]); |
362 | spin_unlock(&dev->pending_lock); | 362 | spin_unlock(&dev->pending_lock); |
@@ -726,8 +726,8 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc) | |||
726 | */ | 726 | */ |
727 | dev = to_idev(qp->ibqp.device); | 727 | dev = to_idev(qp->ibqp.device); |
728 | spin_lock(&dev->pending_lock); | 728 | spin_lock(&dev->pending_lock); |
729 | if (qp->timerwait.next != LIST_POISON1) | 729 | if (!list_empty(&qp->timerwait)) |
730 | list_del(&qp->timerwait); | 730 | list_del_init(&qp->timerwait); |
731 | spin_unlock(&dev->pending_lock); | 731 | spin_unlock(&dev->pending_lock); |
732 | 732 | ||
733 | if (wqe->wr.opcode == IB_WR_RDMA_READ) | 733 | if (wqe->wr.opcode == IB_WR_RDMA_READ) |
@@ -886,8 +886,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode) | |||
886 | * just won't find anything to restart if we ACK everything. | 886 | * just won't find anything to restart if we ACK everything. |
887 | */ | 887 | */ |
888 | spin_lock(&dev->pending_lock); | 888 | spin_lock(&dev->pending_lock); |
889 | if (qp->timerwait.next != LIST_POISON1) | 889 | if (!list_empty(&qp->timerwait)) |
890 | list_del(&qp->timerwait); | 890 | list_del_init(&qp->timerwait); |
891 | spin_unlock(&dev->pending_lock); | 891 | spin_unlock(&dev->pending_lock); |
892 | 892 | ||
893 | /* | 893 | /* |
@@ -1194,8 +1194,7 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev, | |||
1194 | IB_WR_RDMA_READ)) | 1194 | IB_WR_RDMA_READ)) |
1195 | goto ack_done; | 1195 | goto ack_done; |
1196 | spin_lock(&dev->pending_lock); | 1196 | spin_lock(&dev->pending_lock); |
1197 | if (qp->s_rnr_timeout == 0 && | 1197 | if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait)) |
1198 | qp->timerwait.next != LIST_POISON1) | ||
1199 | list_move_tail(&qp->timerwait, | 1198 | list_move_tail(&qp->timerwait, |
1200 | &dev->pending[dev->pending_index]); | 1199 | &dev->pending[dev->pending_index]); |
1201 | spin_unlock(&dev->pending_lock); | 1200 | spin_unlock(&dev->pending_lock); |
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c index eb81424b3c5b..d38f4f3cfd1d 100644 --- a/drivers/infiniband/hw/ipath/ipath_ruc.c +++ b/drivers/infiniband/hw/ipath/ipath_ruc.c | |||
@@ -435,7 +435,7 @@ void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev) | |||
435 | unsigned long flags; | 435 | unsigned long flags; |
436 | 436 | ||
437 | spin_lock_irqsave(&dev->pending_lock, flags); | 437 | spin_lock_irqsave(&dev->pending_lock, flags); |
438 | if (qp->piowait.next == LIST_POISON1) | 438 | if (list_empty(&qp->piowait)) |
439 | list_add_tail(&qp->piowait, &dev->piowait); | 439 | list_add_tail(&qp->piowait, &dev->piowait); |
440 | spin_unlock_irqrestore(&dev->pending_lock, flags); | 440 | spin_unlock_irqrestore(&dev->pending_lock, flags); |
441 | /* | 441 | /* |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index cb9e387c301f..28fdbdaa789d 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -464,7 +464,7 @@ static void ipath_ib_timer(void *arg) | |||
464 | last = &dev->pending[dev->pending_index]; | 464 | last = &dev->pending[dev->pending_index]; |
465 | while (!list_empty(last)) { | 465 | while (!list_empty(last)) { |
466 | qp = list_entry(last->next, struct ipath_qp, timerwait); | 466 | qp = list_entry(last->next, struct ipath_qp, timerwait); |
467 | list_del(&qp->timerwait); | 467 | list_del_init(&qp->timerwait); |
468 | qp->timer_next = resend; | 468 | qp->timer_next = resend; |
469 | resend = qp; | 469 | resend = qp; |
470 | atomic_inc(&qp->refcount); | 470 | atomic_inc(&qp->refcount); |
@@ -474,7 +474,7 @@ static void ipath_ib_timer(void *arg) | |||
474 | qp = list_entry(last->next, struct ipath_qp, timerwait); | 474 | qp = list_entry(last->next, struct ipath_qp, timerwait); |
475 | if (--qp->s_rnr_timeout == 0) { | 475 | if (--qp->s_rnr_timeout == 0) { |
476 | do { | 476 | do { |
477 | list_del(&qp->timerwait); | 477 | list_del_init(&qp->timerwait); |
478 | tasklet_hi_schedule(&qp->s_task); | 478 | tasklet_hi_schedule(&qp->s_task); |
479 | if (list_empty(last)) | 479 | if (list_empty(last)) |
480 | break; | 480 | break; |
@@ -554,7 +554,7 @@ static int ipath_ib_piobufavail(void *arg) | |||
554 | while (!list_empty(&dev->piowait)) { | 554 | while (!list_empty(&dev->piowait)) { |
555 | qp = list_entry(dev->piowait.next, struct ipath_qp, | 555 | qp = list_entry(dev->piowait.next, struct ipath_qp, |
556 | piowait); | 556 | piowait); |
557 | list_del(&qp->piowait); | 557 | list_del_init(&qp->piowait); |
558 | tasklet_hi_schedule(&qp->s_task); | 558 | tasklet_hi_schedule(&qp->s_task); |
559 | } | 559 | } |
560 | spin_unlock_irqrestore(&dev->pending_lock, flags); | 560 | spin_unlock_irqrestore(&dev->pending_lock, flags); |
@@ -951,6 +951,7 @@ static void *ipath_register_ib_device(int unit, struct ipath_devdata *dd) | |||
951 | idev->dd = dd; | 951 | idev->dd = dd; |
952 | 952 | ||
953 | strlcpy(dev->name, "ipath%d", IB_DEVICE_NAME_MAX); | 953 | strlcpy(dev->name, "ipath%d", IB_DEVICE_NAME_MAX); |
954 | dev->owner = THIS_MODULE; | ||
954 | dev->node_guid = ipath_layer_get_guid(dd); | 955 | dev->node_guid = ipath_layer_get_guid(dd); |
955 | dev->uverbs_abi_ver = IPATH_UVERBS_ABI_VERSION; | 956 | dev->uverbs_abi_ver = IPATH_UVERBS_ABI_VERSION; |
956 | dev->uverbs_cmd_mask = | 957 | dev->uverbs_cmd_mask = |
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index 1985b5dfa481..798e13e14faf 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -182,7 +182,7 @@ struct mthca_cmd_context { | |||
182 | u8 status; | 182 | u8 status; |
183 | }; | 183 | }; |
184 | 184 | ||
185 | static int fw_cmd_doorbell = 1; | 185 | static int fw_cmd_doorbell = 0; |
186 | module_param(fw_cmd_doorbell, int, 0644); | 186 | module_param(fw_cmd_doorbell, int, 0644); |
187 | MODULE_PARM_DESC(fw_cmd_doorbell, "post FW commands through doorbell page if nonzero " | 187 | MODULE_PARM_DESC(fw_cmd_doorbell, "post FW commands through doorbell page if nonzero " |
188 | "(and supported by FW)"); | 188 | "(and supported by FW)"); |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 19765f6f8d58..07c13be07a4a 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -1727,23 +1727,7 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
1727 | 1727 | ||
1728 | ind = qp->rq.next_ind; | 1728 | ind = qp->rq.next_ind; |
1729 | 1729 | ||
1730 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 1730 | for (nreq = 0; wr; wr = wr->next) { |
1731 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
1732 | nreq = 0; | ||
1733 | |||
1734 | doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0); | ||
1735 | doorbell[1] = cpu_to_be32(qp->qpn << 8); | ||
1736 | |||
1737 | wmb(); | ||
1738 | |||
1739 | mthca_write64(doorbell, | ||
1740 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
1741 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
1742 | |||
1743 | qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB; | ||
1744 | size0 = 0; | ||
1745 | } | ||
1746 | |||
1747 | if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) { | 1731 | if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) { |
1748 | mthca_err(dev, "RQ %06x full (%u head, %u tail," | 1732 | mthca_err(dev, "RQ %06x full (%u head, %u tail," |
1749 | " %d max, %d nreq)\n", qp->qpn, | 1733 | " %d max, %d nreq)\n", qp->qpn, |
@@ -1797,6 +1781,23 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
1797 | ++ind; | 1781 | ++ind; |
1798 | if (unlikely(ind >= qp->rq.max)) | 1782 | if (unlikely(ind >= qp->rq.max)) |
1799 | ind -= qp->rq.max; | 1783 | ind -= qp->rq.max; |
1784 | |||
1785 | ++nreq; | ||
1786 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
1787 | nreq = 0; | ||
1788 | |||
1789 | doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0); | ||
1790 | doorbell[1] = cpu_to_be32(qp->qpn << 8); | ||
1791 | |||
1792 | wmb(); | ||
1793 | |||
1794 | mthca_write64(doorbell, | ||
1795 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
1796 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
1797 | |||
1798 | qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB; | ||
1799 | size0 = 0; | ||
1800 | } | ||
1800 | } | 1801 | } |
1801 | 1802 | ||
1802 | out: | 1803 | out: |
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index 1ea433291fa7..b292fefa3b41 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -490,26 +490,7 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
490 | 490 | ||
491 | first_ind = srq->first_free; | 491 | first_ind = srq->first_free; |
492 | 492 | ||
493 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 493 | for (nreq = 0; wr; wr = wr->next) { |
494 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
495 | nreq = 0; | ||
496 | |||
497 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); | ||
498 | doorbell[1] = cpu_to_be32(srq->srqn << 8); | ||
499 | |||
500 | /* | ||
501 | * Make sure that descriptors are written | ||
502 | * before doorbell is rung. | ||
503 | */ | ||
504 | wmb(); | ||
505 | |||
506 | mthca_write64(doorbell, | ||
507 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
508 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
509 | |||
510 | first_ind = srq->first_free; | ||
511 | } | ||
512 | |||
513 | ind = srq->first_free; | 494 | ind = srq->first_free; |
514 | 495 | ||
515 | if (ind < 0) { | 496 | if (ind < 0) { |
@@ -569,6 +550,26 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
569 | 550 | ||
570 | srq->wrid[ind] = wr->wr_id; | 551 | srq->wrid[ind] = wr->wr_id; |
571 | srq->first_free = next_ind; | 552 | srq->first_free = next_ind; |
553 | |||
554 | ++nreq; | ||
555 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
556 | nreq = 0; | ||
557 | |||
558 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); | ||
559 | doorbell[1] = cpu_to_be32(srq->srqn << 8); | ||
560 | |||
561 | /* | ||
562 | * Make sure that descriptors are written | ||
563 | * before doorbell is rung. | ||
564 | */ | ||
565 | wmb(); | ||
566 | |||
567 | mthca_write64(doorbell, | ||
568 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
569 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
570 | |||
571 | first_ind = srq->first_free; | ||
572 | } | ||
572 | } | 573 | } |
573 | 574 | ||
574 | if (likely(nreq)) { | 575 | if (likely(nreq)) { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index a54da42849ae..8406839b91cf 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -275,6 +275,7 @@ static void ipoib_ib_handle_wc(struct net_device *dev, | |||
275 | spin_lock_irqsave(&priv->tx_lock, flags); | 275 | spin_lock_irqsave(&priv->tx_lock, flags); |
276 | ++priv->tx_tail; | 276 | ++priv->tx_tail; |
277 | if (netif_queue_stopped(dev) && | 277 | if (netif_queue_stopped(dev) && |
278 | test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags) && | ||
278 | priv->tx_head - priv->tx_tail <= ipoib_sendq_size >> 1) | 279 | priv->tx_head - priv->tx_tail <= ipoib_sendq_size >> 1) |
279 | netif_wake_queue(dev); | 280 | netif_wake_queue(dev); |
280 | spin_unlock_irqrestore(&priv->tx_lock, flags); | 281 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index c32ce4348e1b..9cbdffa08dc2 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -340,7 +340,10 @@ static void srp_disconnect_target(struct srp_target_port *target) | |||
340 | /* XXX should send SRP_I_LOGOUT request */ | 340 | /* XXX should send SRP_I_LOGOUT request */ |
341 | 341 | ||
342 | init_completion(&target->done); | 342 | init_completion(&target->done); |
343 | ib_send_cm_dreq(target->cm_id, NULL, 0); | 343 | if (ib_send_cm_dreq(target->cm_id, NULL, 0)) { |
344 | printk(KERN_DEBUG PFX "Sending CM DREQ failed\n"); | ||
345 | return; | ||
346 | } | ||
344 | wait_for_completion(&target->done); | 347 | wait_for_completion(&target->done); |
345 | } | 348 | } |
346 | 349 | ||
@@ -351,7 +354,6 @@ static void srp_remove_work(void *target_ptr) | |||
351 | spin_lock_irq(target->scsi_host->host_lock); | 354 | spin_lock_irq(target->scsi_host->host_lock); |
352 | if (target->state != SRP_TARGET_DEAD) { | 355 | if (target->state != SRP_TARGET_DEAD) { |
353 | spin_unlock_irq(target->scsi_host->host_lock); | 356 | spin_unlock_irq(target->scsi_host->host_lock); |
354 | scsi_host_put(target->scsi_host); | ||
355 | return; | 357 | return; |
356 | } | 358 | } |
357 | target->state = SRP_TARGET_REMOVED; | 359 | target->state = SRP_TARGET_REMOVED; |
@@ -365,8 +367,6 @@ static void srp_remove_work(void *target_ptr) | |||
365 | ib_destroy_cm_id(target->cm_id); | 367 | ib_destroy_cm_id(target->cm_id); |
366 | srp_free_target_ib(target); | 368 | srp_free_target_ib(target); |
367 | scsi_host_put(target->scsi_host); | 369 | scsi_host_put(target->scsi_host); |
368 | /* And another put to really free the target port... */ | ||
369 | scsi_host_put(target->scsi_host); | ||
370 | } | 370 | } |
371 | 371 | ||
372 | static int srp_connect_target(struct srp_target_port *target) | 372 | static int srp_connect_target(struct srp_target_port *target) |
@@ -1241,7 +1241,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) | |||
1241 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) | 1241 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) |
1242 | if (req->scmnd->device == scmnd->device) { | 1242 | if (req->scmnd->device == scmnd->device) { |
1243 | req->scmnd->result = DID_RESET << 16; | 1243 | req->scmnd->result = DID_RESET << 16; |
1244 | scmnd->scsi_done(scmnd); | 1244 | req->scmnd->scsi_done(req->scmnd); |
1245 | srp_remove_req(target, req); | 1245 | srp_remove_req(target, req); |
1246 | } | 1246 | } |
1247 | 1247 | ||
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c index 2b2ec1057dee..95c0de7964a0 100644 --- a/drivers/input/joystick/sidewinder.c +++ b/drivers/input/joystick/sidewinder.c | |||
@@ -589,7 +589,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
589 | struct sw *sw; | 589 | struct sw *sw; |
590 | struct input_dev *input_dev; | 590 | struct input_dev *input_dev; |
591 | int i, j, k, l; | 591 | int i, j, k, l; |
592 | int err; | 592 | int err = 0; |
593 | unsigned char *buf = NULL; /* [SW_LENGTH] */ | 593 | unsigned char *buf = NULL; /* [SW_LENGTH] */ |
594 | unsigned char *idbuf = NULL; /* [SW_LENGTH] */ | 594 | unsigned char *idbuf = NULL; /* [SW_LENGTH] */ |
595 | unsigned char m = 1; | 595 | unsigned char m = 1; |
@@ -776,7 +776,10 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
776 | goto fail4; | 776 | goto fail4; |
777 | } | 777 | } |
778 | 778 | ||
779 | return 0; | 779 | out: kfree(buf); |
780 | kfree(idbuf); | ||
781 | |||
782 | return err; | ||
780 | 783 | ||
781 | fail4: input_free_device(sw->dev[i]); | 784 | fail4: input_free_device(sw->dev[i]); |
782 | fail3: while (--i >= 0) | 785 | fail3: while (--i >= 0) |
@@ -784,9 +787,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
784 | fail2: gameport_close(gameport); | 787 | fail2: gameport_close(gameport); |
785 | fail1: gameport_set_drvdata(gameport, NULL); | 788 | fail1: gameport_set_drvdata(gameport, NULL); |
786 | kfree(sw); | 789 | kfree(sw); |
787 | kfree(buf); | 790 | goto out; |
788 | kfree(idbuf); | ||
789 | return err; | ||
790 | } | 791 | } |
791 | 792 | ||
792 | static void sw_disconnect(struct gameport *gameport) | 793 | static void sw_disconnect(struct gameport *gameport) |
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index 96c6bf77248a..1f0e720267d7 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -245,9 +245,9 @@ static void corgikbd_hinge_timer(unsigned long data) | |||
245 | if (hinge_count >= HINGE_STABLE_COUNT) { | 245 | if (hinge_count >= HINGE_STABLE_COUNT) { |
246 | spin_lock_irqsave(&corgikbd_data->lock, flags); | 246 | spin_lock_irqsave(&corgikbd_data->lock, flags); |
247 | 247 | ||
248 | input_report_switch(corgikbd_data->input, SW_0, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0)); | 248 | input_report_switch(corgikbd_data->input, SW_LID, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0)); |
249 | input_report_switch(corgikbd_data->input, SW_1, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0)); | 249 | input_report_switch(corgikbd_data->input, SW_TABLET_MODE, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0)); |
250 | input_report_switch(corgikbd_data->input, SW_2, (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0)); | 250 | input_report_switch(corgikbd_data->input, SW_HEADPHONE_INSERT, (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0)); |
251 | input_sync(corgikbd_data->input); | 251 | input_sync(corgikbd_data->input); |
252 | 252 | ||
253 | spin_unlock_irqrestore(&corgikbd_data->lock, flags); | 253 | spin_unlock_irqrestore(&corgikbd_data->lock, flags); |
@@ -340,9 +340,9 @@ static int __init corgikbd_probe(struct platform_device *pdev) | |||
340 | for (i = 0; i < ARRAY_SIZE(corgikbd_keycode); i++) | 340 | for (i = 0; i < ARRAY_SIZE(corgikbd_keycode); i++) |
341 | set_bit(corgikbd->keycode[i], input_dev->keybit); | 341 | set_bit(corgikbd->keycode[i], input_dev->keybit); |
342 | clear_bit(0, input_dev->keybit); | 342 | clear_bit(0, input_dev->keybit); |
343 | set_bit(SW_0, input_dev->swbit); | 343 | set_bit(SW_LID, input_dev->swbit); |
344 | set_bit(SW_1, input_dev->swbit); | 344 | set_bit(SW_TABLET_MODE, input_dev->swbit); |
345 | set_bit(SW_2, input_dev->swbit); | 345 | set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); |
346 | 346 | ||
347 | input_register_device(corgikbd->input); | 347 | input_register_device(corgikbd->input); |
348 | 348 | ||
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 1d238a9d52d6..c5d03fb77bcb 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -299,9 +299,9 @@ static void spitzkbd_hinge_timer(unsigned long data) | |||
299 | if (hinge_count >= HINGE_STABLE_COUNT) { | 299 | if (hinge_count >= HINGE_STABLE_COUNT) { |
300 | spin_lock_irqsave(&spitzkbd_data->lock, flags); | 300 | spin_lock_irqsave(&spitzkbd_data->lock, flags); |
301 | 301 | ||
302 | input_report_switch(spitzkbd_data->input, SW_0, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0)); | 302 | input_report_switch(spitzkbd_data->input, SW_LID, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0)); |
303 | input_report_switch(spitzkbd_data->input, SW_1, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0)); | 303 | input_report_switch(spitzkbd_data->input, SW_TABLET_MODE, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0)); |
304 | input_report_switch(spitzkbd_data->input, SW_2, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0)); | 304 | input_report_switch(spitzkbd_data->input, SW_HEADPHONE_INSERT, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0)); |
305 | input_sync(spitzkbd_data->input); | 305 | input_sync(spitzkbd_data->input); |
306 | 306 | ||
307 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); | 307 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); |
@@ -398,9 +398,9 @@ static int __init spitzkbd_probe(struct platform_device *dev) | |||
398 | for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++) | 398 | for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++) |
399 | set_bit(spitzkbd->keycode[i], input_dev->keybit); | 399 | set_bit(spitzkbd->keycode[i], input_dev->keybit); |
400 | clear_bit(0, input_dev->keybit); | 400 | clear_bit(0, input_dev->keybit); |
401 | set_bit(SW_0, input_dev->swbit); | 401 | set_bit(SW_LID, input_dev->swbit); |
402 | set_bit(SW_1, input_dev->swbit); | 402 | set_bit(SW_TABLET_MODE, input_dev->swbit); |
403 | set_bit(SW_2, input_dev->swbit); | 403 | set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); |
404 | 404 | ||
405 | input_register_device(input_dev); | 405 | input_register_device(input_dev); |
406 | 406 | ||
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 36cd2e07fce8..e4e5be111c96 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -318,6 +318,16 @@ static struct key_entry keymap_acer_travelmate_240[] = { | |||
318 | { KE_END, 0 } | 318 | { KE_END, 0 } |
319 | }; | 319 | }; |
320 | 320 | ||
321 | static struct key_entry keymap_aopen_1559as[] = { | ||
322 | { KE_KEY, 0x01, KEY_HELP }, | ||
323 | { KE_KEY, 0x06, KEY_PROG3 }, | ||
324 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
325 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
326 | { KE_WIFI, 0x30, 0 }, | ||
327 | { KE_KEY, 0x31, KEY_MAIL }, | ||
328 | { KE_KEY, 0x36, KEY_WWW }, | ||
329 | }; | ||
330 | |||
321 | /* | 331 | /* |
322 | * If your machine is not here (which is currently rather likely), please send | 332 | * If your machine is not here (which is currently rather likely), please send |
323 | * a list of buttons and their key codes (reported when loading this module | 333 | * a list of buttons and their key codes (reported when loading this module |
@@ -369,6 +379,15 @@ static struct dmi_system_id dmi_ids[] = { | |||
369 | }, | 379 | }, |
370 | .driver_data = keymap_acer_travelmate_240 | 380 | .driver_data = keymap_acer_travelmate_240 |
371 | }, | 381 | }, |
382 | { | ||
383 | .callback = dmi_matched, | ||
384 | .ident = "AOpen 1559AS", | ||
385 | .matches = { | ||
386 | DMI_MATCH(DMI_PRODUCT_NAME, "E2U"), | ||
387 | DMI_MATCH(DMI_BOARD_NAME, "E2U"), | ||
388 | }, | ||
389 | .driver_data = keymap_aopen_1559as | ||
390 | }, | ||
372 | { NULL, } | 391 | { NULL, } |
373 | }; | 392 | }; |
374 | 393 | ||
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 2141501e9f2e..a0e2e797c6d5 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -100,8 +100,8 @@ static void alps_process_packet(struct psmouse *psmouse, struct pt_regs *regs) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | if (priv->i->flags & ALPS_OLDPROTO) { | 102 | if (priv->i->flags & ALPS_OLDPROTO) { |
103 | left = packet[2] & 0x08; | 103 | left = packet[2] & 0x10; |
104 | right = packet[2] & 0x10; | 104 | right = packet[2] & 0x08; |
105 | middle = 0; | 105 | middle = 0; |
106 | x = packet[1] | ((packet[0] & 0x07) << 7); | 106 | x = packet[1] | ((packet[0] & 0x07) << 7); |
107 | y = packet[4] | ((packet[3] & 0x07) << 7); | 107 | y = packet[4] | ((packet[3] & 0x07) << 7); |
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 5ccc3ef3b89e..c14395ba7980 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -22,12 +22,36 @@ | |||
22 | 22 | ||
23 | static struct dmi_system_id lifebook_dmi_table[] = { | 23 | static struct dmi_system_id lifebook_dmi_table[] = { |
24 | { | 24 | { |
25 | .ident = "LifeBook B", | ||
26 | .matches = { | ||
27 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), | ||
28 | }, | ||
29 | }, | ||
30 | { | ||
25 | .ident = "Lifebook B", | 31 | .ident = "Lifebook B", |
26 | .matches = { | 32 | .matches = { |
27 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), | 33 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), |
28 | }, | 34 | }, |
29 | }, | 35 | }, |
30 | { | 36 | { |
37 | .ident = "Lifebook B213x/B2150", | ||
38 | .matches = { | ||
39 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), | ||
40 | }, | ||
41 | }, | ||
42 | { | ||
43 | .ident = "Zephyr", | ||
44 | .matches = { | ||
45 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), | ||
46 | }, | ||
47 | }, | ||
48 | { | ||
49 | .ident = "CF-18", | ||
50 | .matches = { | ||
51 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), | ||
52 | }, | ||
53 | }, | ||
54 | { | ||
31 | .ident = "Lifebook B142", | 55 | .ident = "Lifebook B142", |
32 | .matches = { | 56 | .matches = { |
33 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), | 57 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 40333d61093c..2f0d28840810 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #define PS2PP_KIND_WHEEL 1 | 19 | #define PS2PP_KIND_WHEEL 1 |
20 | #define PS2PP_KIND_MX 2 | 20 | #define PS2PP_KIND_MX 2 |
21 | #define PS2PP_KIND_TP3 3 | 21 | #define PS2PP_KIND_TP3 3 |
22 | #define PS2PP_KIND_TRACKMAN 4 | ||
22 | 23 | ||
23 | /* Logitech mouse features */ | 24 | /* Logitech mouse features */ |
24 | #define PS2PP_WHEEL 0x01 | 25 | #define PS2PP_WHEEL 0x01 |
@@ -223,6 +224,7 @@ static struct ps2pp_info *get_model_info(unsigned char model) | |||
223 | { 73, 0, PS2PP_SIDE_BTN }, | 224 | { 73, 0, PS2PP_SIDE_BTN }, |
224 | { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 225 | { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
225 | { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 226 | { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
227 | { 79, PS2PP_KIND_TRACKMAN, PS2PP_WHEEL }, /* TrackMan with wheel */ | ||
226 | { 80, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, | 228 | { 80, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, |
227 | { 81, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 229 | { 81, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
228 | { 83, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 230 | { 83, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
@@ -298,6 +300,10 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse, struct ps2pp_inf | |||
298 | psmouse->name = "TouchPad 3"; | 300 | psmouse->name = "TouchPad 3"; |
299 | break; | 301 | break; |
300 | 302 | ||
303 | case PS2PP_KIND_TRACKMAN: | ||
304 | psmouse->name = "TrackMan"; | ||
305 | break; | ||
306 | |||
301 | default: | 307 | default: |
302 | /* | 308 | /* |
303 | * Set name to "Mouse" only when using PS2++, | 309 | * Set name to "Mouse" only when using PS2++, |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 1494175ac6fe..161afddd0f44 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -36,13 +36,10 @@ | |||
36 | 36 | ||
37 | 37 | ||
38 | /* | 38 | /* |
39 | * This code has been tested on an ads7846 / N770 device. | 39 | * This code has been heavily tested on a Nokia 770, and lightly |
40 | * tested on other ads7846 devices (OSK/Mistral, Lubbock). | ||
40 | * Support for ads7843 and ads7845 has only been stubbed in. | 41 | * Support for ads7843 and ads7845 has only been stubbed in. |
41 | * | 42 | * |
42 | * Not yet done: How accurate are the temperature and voltage | ||
43 | * readings? (System-specific calibration should support | ||
44 | * accuracy of 0.3 degrees C; otherwise it's 2.0 degrees.) | ||
45 | * | ||
46 | * IRQ handling needs a workaround because of a shortcoming in handling | 43 | * IRQ handling needs a workaround because of a shortcoming in handling |
47 | * edge triggered IRQs on some platforms like the OMAP1/2. These | 44 | * edge triggered IRQs on some platforms like the OMAP1/2. These |
48 | * platforms don't handle the ARM lazy IRQ disabling properly, thus we | 45 | * platforms don't handle the ARM lazy IRQ disabling properly, thus we |
@@ -248,10 +245,13 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
248 | 245 | ||
249 | if (req->msg.status) | 246 | if (req->msg.status) |
250 | status = req->msg.status; | 247 | status = req->msg.status; |
248 | |||
249 | /* on-wire is a must-ignore bit, a BE12 value, then padding */ | ||
251 | sample = be16_to_cpu(req->sample); | 250 | sample = be16_to_cpu(req->sample); |
252 | sample = sample >> 4; | 251 | sample = sample >> 3; |
253 | kfree(req); | 252 | sample &= 0x0fff; |
254 | 253 | ||
254 | kfree(req); | ||
255 | return status ? status : sample; | 255 | return status ? status : sample; |
256 | } | 256 | } |
257 | 257 | ||
@@ -336,13 +336,13 @@ static void ads7846_rx(void *ads) | |||
336 | u16 x, y, z1, z2; | 336 | u16 x, y, z1, z2; |
337 | unsigned long flags; | 337 | unsigned long flags; |
338 | 338 | ||
339 | /* adjust: 12 bit samples (left aligned), built from | 339 | /* adjust: on-wire is a must-ignore bit, a BE12 value, then padding; |
340 | * two 8 bit values writen msb-first. | 340 | * built from two 8 bit values written msb-first. |
341 | */ | 341 | */ |
342 | x = be16_to_cpu(ts->tc.x) >> 4; | 342 | x = (be16_to_cpu(ts->tc.x) >> 3) & 0x0fff; |
343 | y = be16_to_cpu(ts->tc.y) >> 4; | 343 | y = (be16_to_cpu(ts->tc.y) >> 3) & 0x0fff; |
344 | z1 = be16_to_cpu(ts->tc.z1) >> 4; | 344 | z1 = (be16_to_cpu(ts->tc.z1) >> 3) & 0x0fff; |
345 | z2 = be16_to_cpu(ts->tc.z2) >> 4; | 345 | z2 = (be16_to_cpu(ts->tc.z2) >> 3) & 0x0fff; |
346 | 346 | ||
347 | /* range filtering */ | 347 | /* range filtering */ |
348 | if (x == MAX_12BIT) | 348 | if (x == MAX_12BIT) |
@@ -420,7 +420,7 @@ static void ads7846_debounce(void *ads) | |||
420 | 420 | ||
421 | m = &ts->msg[ts->msg_idx]; | 421 | m = &ts->msg[ts->msg_idx]; |
422 | t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list); | 422 | t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list); |
423 | val = (*(u16 *)t->rx_buf) >> 3; | 423 | val = (be16_to_cpu(*(__be16 *)t->rx_buf) >> 3) & 0x0fff; |
424 | if (!ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol)) { | 424 | if (!ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol)) { |
425 | /* Repeat it, if this was the first read or the read | 425 | /* Repeat it, if this was the first read or the read |
426 | * wasn't consistent enough. */ | 426 | * wasn't consistent enough. */ |
@@ -469,7 +469,7 @@ static void ads7846_timer(unsigned long handle) | |||
469 | spin_lock_irq(&ts->lock); | 469 | spin_lock_irq(&ts->lock); |
470 | 470 | ||
471 | if (unlikely(ts->msg_idx && !ts->pendown)) { | 471 | if (unlikely(ts->msg_idx && !ts->pendown)) { |
472 | /* measurment cycle ended */ | 472 | /* measurement cycle ended */ |
473 | if (!device_suspended(&ts->spi->dev)) { | 473 | if (!device_suspended(&ts->spi->dev)) { |
474 | ts->irq_disabled = 0; | 474 | ts->irq_disabled = 0; |
475 | enable_irq(ts->spi->irq); | 475 | enable_irq(ts->spi->irq); |
@@ -495,11 +495,10 @@ static irqreturn_t ads7846_irq(int irq, void *handle, struct pt_regs *regs) | |||
495 | spin_lock_irqsave(&ts->lock, flags); | 495 | spin_lock_irqsave(&ts->lock, flags); |
496 | if (likely(ts->get_pendown_state())) { | 496 | if (likely(ts->get_pendown_state())) { |
497 | if (!ts->irq_disabled) { | 497 | if (!ts->irq_disabled) { |
498 | /* REVISIT irq logic for many ARM chips has cloned a | 498 | /* The ARM do_simple_IRQ() dispatcher doesn't act |
499 | * bug wherein disabling an irq in its handler won't | 499 | * like the other dispatchers: it will report IRQs |
500 | * work;(it's disabled lazily, and too late to work. | 500 | * even after they've been disabled. We work around |
501 | * until all their irq logic is fixed, we must shadow | 501 | * that here. (The "generic irq" framework may help...) |
502 | * that state here. | ||
503 | */ | 502 | */ |
504 | ts->irq_disabled = 1; | 503 | ts->irq_disabled = 1; |
505 | disable_irq(ts->spi->irq); | 504 | disable_irq(ts->spi->irq); |
@@ -609,16 +608,20 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
609 | return -EINVAL; | 608 | return -EINVAL; |
610 | } | 609 | } |
611 | 610 | ||
611 | /* REVISIT when the irq can be triggered active-low, or if for some | ||
612 | * reason the touchscreen isn't hooked up, we don't need to access | ||
613 | * the pendown state. | ||
614 | */ | ||
612 | if (pdata->get_pendown_state == NULL) { | 615 | if (pdata->get_pendown_state == NULL) { |
613 | dev_dbg(&spi->dev, "no get_pendown_state function?\n"); | 616 | dev_dbg(&spi->dev, "no get_pendown_state function?\n"); |
614 | return -EINVAL; | 617 | return -EINVAL; |
615 | } | 618 | } |
616 | 619 | ||
617 | /* We'd set the wordsize to 12 bits ... except that some controllers | 620 | /* We'd set TX wordsize 8 bits and RX wordsize to 13 bits ... except |
618 | * will then treat the 8 bit command words as 12 bits (and drop the | 621 | * that even if the hardware can do that, the SPI controller driver |
619 | * four MSBs of the 12 bit result). Result: inputs must be shifted | 622 | * may not. So we stick to very-portable 8 bit words, both RX and TX. |
620 | * to discard the four garbage LSBs. | ||
621 | */ | 623 | */ |
624 | spi->bits_per_word = 8; | ||
622 | 625 | ||
623 | ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL); | 626 | ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL); |
624 | input_dev = input_allocate_device(); | 627 | input_dev = input_allocate_device(); |
@@ -772,7 +775,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
772 | 775 | ||
773 | if (request_irq(spi->irq, ads7846_irq, | 776 | if (request_irq(spi->irq, ads7846_irq, |
774 | SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, | 777 | SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, |
775 | spi->dev.bus_id, ts)) { | 778 | spi->dev.driver->name, ts)) { |
776 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); | 779 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); |
777 | err = -EBUSY; | 780 | err = -EBUSY; |
778 | goto err_free_mem; | 781 | goto err_free_mem; |
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 9b493f0becc4..173c899a1fb4 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -1499,7 +1499,6 @@ static int __init capi_init(void) | |||
1499 | printk(KERN_ERR "capi20: unable to get major %d\n", capi_major); | 1499 | printk(KERN_ERR "capi20: unable to get major %d\n", capi_major); |
1500 | return major_ret; | 1500 | return major_ret; |
1501 | } | 1501 | } |
1502 | capi_major = major_ret; | ||
1503 | capi_class = class_create(THIS_MODULE, "capi"); | 1502 | capi_class = class_create(THIS_MODULE, "capi"); |
1504 | if (IS_ERR(capi_class)) { | 1503 | if (IS_ERR(capi_class)) { |
1505 | unregister_chrdev(capi_major, "capi20"); | 1504 | unregister_chrdev(capi_major, "capi20"); |
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index bfb73fd5077e..d86ab68114b0 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -710,8 +710,8 @@ static int gigaset_probe(struct usb_interface *interface, | |||
710 | retval = -ENODEV; //FIXME | 710 | retval = -ENODEV; //FIXME |
711 | 711 | ||
712 | /* See if the device offered us matches what we can accept */ | 712 | /* See if the device offered us matches what we can accept */ |
713 | if ((le16_to_cpu(udev->descriptor.idVendor != USB_M105_VENDOR_ID)) || | 713 | if ((le16_to_cpu(udev->descriptor.idVendor) != USB_M105_VENDOR_ID) || |
714 | (le16_to_cpu(udev->descriptor.idProduct != USB_M105_PRODUCT_ID))) | 714 | (le16_to_cpu(udev->descriptor.idProduct) != USB_M105_PRODUCT_ID)) |
715 | return -ENODEV; | 715 | return -ENODEV; |
716 | 716 | ||
717 | /* this starts to become ascii art... */ | 717 | /* this starts to become ascii art... */ |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 3585fb1f3344..2ac90242d263 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -2880,7 +2880,7 @@ isdn_tty_cmd_ATand(char **p, modem_info * info) | |||
2880 | p[0]++; | 2880 | p[0]++; |
2881 | i = 0; | 2881 | i = 0; |
2882 | while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) && | 2882 | while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) && |
2883 | (i < ISDN_LMSNLEN)) | 2883 | (i < ISDN_LMSNLEN - 1)) |
2884 | m->lmsn[i++] = *p[0]++; | 2884 | m->lmsn[i++] = *p[0]++; |
2885 | m->lmsn[i] = '\0'; | 2885 | m->lmsn[i] = '\0'; |
2886 | break; | 2886 | break; |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 3f5b64794542..626506234b76 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -4,8 +4,11 @@ menu "LED devices" | |||
4 | config NEW_LEDS | 4 | config NEW_LEDS |
5 | bool "LED Support" | 5 | bool "LED Support" |
6 | help | 6 | help |
7 | Say Y to enable Linux LED support. This is not related to standard | 7 | Say Y to enable Linux LED support. This allows control of supported |
8 | keyboard LEDs which are controlled via the input system. | 8 | LEDs from both userspace and optionally, by kernel events (triggers). |
9 | |||
10 | This is not related to standard keyboard LEDs which are controlled | ||
11 | via the input system. | ||
9 | 12 | ||
10 | config LEDS_CLASS | 13 | config LEDS_CLASS |
11 | tristate "LED Class Support" | 14 | tristate "LED Class Support" |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index b0b5d05fadd6..c75d0ef1609c 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/sysdev.h> | 19 | #include <linux/sysdev.h> |
20 | #include <linux/timer.h> | 20 | #include <linux/timer.h> |
21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
22 | #include <linux/ctype.h> | ||
22 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
23 | #include "leds.h" | 24 | #include "leds.h" |
24 | 25 | ||
@@ -43,9 +44,13 @@ static ssize_t led_brightness_store(struct class_device *dev, | |||
43 | ssize_t ret = -EINVAL; | 44 | ssize_t ret = -EINVAL; |
44 | char *after; | 45 | char *after; |
45 | unsigned long state = simple_strtoul(buf, &after, 10); | 46 | unsigned long state = simple_strtoul(buf, &after, 10); |
47 | size_t count = after - buf; | ||
46 | 48 | ||
47 | if (after - buf > 0) { | 49 | if (*after && isspace(*after)) |
48 | ret = after - buf; | 50 | count++; |
51 | |||
52 | if (count == size) { | ||
53 | ret = count; | ||
49 | led_set_brightness(led_cdev, state); | 54 | led_set_brightness(led_cdev, state); |
50 | } | 55 | } |
51 | 56 | ||
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index f484b5d6dbf8..fbf141ef46ec 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/sysdev.h> | 21 | #include <linux/sysdev.h> |
22 | #include <linux/timer.h> | 22 | #include <linux/timer.h> |
23 | #include <linux/ctype.h> | ||
23 | #include <linux/leds.h> | 24 | #include <linux/leds.h> |
24 | #include "leds.h" | 25 | #include "leds.h" |
25 | 26 | ||
@@ -69,11 +70,15 @@ static ssize_t led_delay_on_store(struct class_device *dev, const char *buf, | |||
69 | int ret = -EINVAL; | 70 | int ret = -EINVAL; |
70 | char *after; | 71 | char *after; |
71 | unsigned long state = simple_strtoul(buf, &after, 10); | 72 | unsigned long state = simple_strtoul(buf, &after, 10); |
73 | size_t count = after - buf; | ||
72 | 74 | ||
73 | if (after - buf > 0) { | 75 | if (*after && isspace(*after)) |
76 | count++; | ||
77 | |||
78 | if (count == size) { | ||
74 | timer_data->delay_on = state; | 79 | timer_data->delay_on = state; |
75 | mod_timer(&timer_data->timer, jiffies + 1); | 80 | mod_timer(&timer_data->timer, jiffies + 1); |
76 | ret = after - buf; | 81 | ret = count; |
77 | } | 82 | } |
78 | 83 | ||
79 | return ret; | 84 | return ret; |
@@ -97,11 +102,15 @@ static ssize_t led_delay_off_store(struct class_device *dev, const char *buf, | |||
97 | int ret = -EINVAL; | 102 | int ret = -EINVAL; |
98 | char *after; | 103 | char *after; |
99 | unsigned long state = simple_strtoul(buf, &after, 10); | 104 | unsigned long state = simple_strtoul(buf, &after, 10); |
105 | size_t count = after - buf; | ||
106 | |||
107 | if (*after && isspace(*after)) | ||
108 | count++; | ||
100 | 109 | ||
101 | if (after - buf > 0) { | 110 | if (count == size) { |
102 | timer_data->delay_off = state; | 111 | timer_data->delay_off = state; |
103 | mod_timer(&timer_data->timer, jiffies + 1); | 112 | mod_timer(&timer_data->timer, jiffies + 1); |
104 | ret = after - buf; | 113 | ret = count; |
105 | } | 114 | } |
106 | 115 | ||
107 | return ret; | 116 | return ret; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index d7316b829a62..f19b874753a9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -167,6 +167,15 @@ void md_new_event(mddev_t *mddev) | |||
167 | } | 167 | } |
168 | EXPORT_SYMBOL_GPL(md_new_event); | 168 | EXPORT_SYMBOL_GPL(md_new_event); |
169 | 169 | ||
170 | /* Alternate version that can be called from interrupts | ||
171 | * when calling sysfs_notify isn't needed. | ||
172 | */ | ||
173 | void md_new_event_inintr(mddev_t *mddev) | ||
174 | { | ||
175 | atomic_inc(&md_event_count); | ||
176 | wake_up(&md_event_waiters); | ||
177 | } | ||
178 | |||
170 | /* | 179 | /* |
171 | * Enables to iterate over all existing md arrays | 180 | * Enables to iterate over all existing md arrays |
172 | * all_mddevs_lock protects this list. | 181 | * all_mddevs_lock protects this list. |
@@ -2252,7 +2261,7 @@ action_store(mddev_t *mddev, const char *page, size_t len) | |||
2252 | } else { | 2261 | } else { |
2253 | if (cmd_match(page, "check")) | 2262 | if (cmd_match(page, "check")) |
2254 | set_bit(MD_RECOVERY_CHECK, &mddev->recovery); | 2263 | set_bit(MD_RECOVERY_CHECK, &mddev->recovery); |
2255 | else if (cmd_match(page, "repair")) | 2264 | else if (!cmd_match(page, "repair")) |
2256 | return -EINVAL; | 2265 | return -EINVAL; |
2257 | set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); | 2266 | set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); |
2258 | set_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 2267 | set_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
@@ -4149,7 +4158,7 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
4149 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 4158 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
4150 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 4159 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
4151 | md_wakeup_thread(mddev->thread); | 4160 | md_wakeup_thread(mddev->thread); |
4152 | md_new_event(mddev); | 4161 | md_new_event_inintr(mddev); |
4153 | } | 4162 | } |
4154 | 4163 | ||
4155 | /* seq_file implementation /proc/mdstat */ | 4164 | /* seq_file implementation /proc/mdstat */ |
@@ -5028,8 +5037,10 @@ static int md_notify_reboot(struct notifier_block *this, | |||
5028 | printk(KERN_INFO "md: stopping all md devices.\n"); | 5037 | printk(KERN_INFO "md: stopping all md devices.\n"); |
5029 | 5038 | ||
5030 | ITERATE_MDDEV(mddev,tmp) | 5039 | ITERATE_MDDEV(mddev,tmp) |
5031 | if (mddev_trylock(mddev)) | 5040 | if (mddev_trylock(mddev)) { |
5032 | do_md_stop (mddev, 1); | 5041 | do_md_stop (mddev, 1); |
5042 | mddev_unlock(mddev); | ||
5043 | } | ||
5033 | /* | 5044 | /* |
5034 | * certain more exotic SCSI devices are known to be | 5045 | * certain more exotic SCSI devices are known to be |
5035 | * volatile wrt too early system reboots. While the | 5046 | * volatile wrt too early system reboots. While the |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 678f4dbbea1d..cb8c6317e4e5 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -331,13 +331,14 @@ static int raid0_run (mddev_t *mddev) | |||
331 | goto out_free_conf; | 331 | goto out_free_conf; |
332 | size = conf->strip_zone[cur].size; | 332 | size = conf->strip_zone[cur].size; |
333 | 333 | ||
334 | for (i=0; i< nb_zone; i++) { | 334 | conf->hash_table[0] = conf->strip_zone + cur; |
335 | conf->hash_table[i] = conf->strip_zone + cur; | 335 | for (i=1; i< nb_zone; i++) { |
336 | while (size <= conf->hash_spacing) { | 336 | while (size <= conf->hash_spacing) { |
337 | cur++; | 337 | cur++; |
338 | size += conf->strip_zone[cur].size; | 338 | size += conf->strip_zone[cur].size; |
339 | } | 339 | } |
340 | size -= conf->hash_spacing; | 340 | size -= conf->hash_spacing; |
341 | conf->hash_table[i] = conf->strip_zone + cur; | ||
341 | } | 342 | } |
342 | if (conf->preshift) { | 343 | if (conf->preshift) { |
343 | conf->hash_spacing >>= conf->preshift; | 344 | conf->hash_spacing >>= conf->preshift; |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index fffc711c260c..344d83aae3ec 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -8,22 +8,54 @@ config VIDEO_DEV | |||
8 | tristate "Video For Linux" | 8 | tristate "Video For Linux" |
9 | ---help--- | 9 | ---help--- |
10 | Support for audio/video capture and overlay devices and FM radio | 10 | Support for audio/video capture and overlay devices and FM radio |
11 | cards. The exact capabilities of each device vary. User tools for | 11 | cards. The exact capabilities of each device vary. |
12 | this are available from | ||
13 | <ftp://ftp.uk.linux.org/pub/linux/video4linux/>. | ||
14 | 12 | ||
15 | This kernel includes support for the new Video for Linux Two API, | 13 | This kernel includes support for the new Video for Linux Two API, |
16 | (V4L2) as well as the original system. Drivers and applications | 14 | (V4L2) as well as the original system. Drivers and applications |
17 | need to be rewritten to use V4L2, but drivers for popular cards | 15 | need to be rewritten to use V4L2, but drivers for popular cards |
18 | and applications for most video capture functions already exist. | 16 | and applications for most video capture functions already exist. |
19 | 17 | ||
20 | Documentation for the original API is included in the file | 18 | Additional info and docs are available on the web at |
21 | <file:Documentation/video4linux/API.html>. Documentation for V4L2 is | 19 | <http://linuxtv.org> |
22 | available on the web at <http://bytesex.org/v4l/>. | 20 | |
21 | Documentation for V4L2 is also available on the web at | ||
22 | <http://bytesex.org/v4l/>. | ||
23 | 23 | ||
24 | To compile this driver as a module, choose M here: the | 24 | To compile this driver as a module, choose M here: the |
25 | module will be called videodev. | 25 | module will be called videodev. |
26 | 26 | ||
27 | config VIDEO_V4L1 | ||
28 | boolean "Enable Video For Linux API 1 (DEPRECATED)" | ||
29 | depends on VIDEO_DEV | ||
30 | select VIDEO_V4L1_COMPAT | ||
31 | default y | ||
32 | ---help--- | ||
33 | Enables a compatibility API used by most V4L2 devices to allow | ||
34 | its usage with legacy applications that supports only V4L1 api. | ||
35 | |||
36 | If you are unsure as to whether this is required, answer Y. | ||
37 | |||
38 | config VIDEO_V4L1_COMPAT | ||
39 | boolean "Enable Video For Linux API 1 compatible Layer" | ||
40 | depends on VIDEO_DEV | ||
41 | default y | ||
42 | ---help--- | ||
43 | This api were developed to be used at Kernel 2.2 and 2.4, but | ||
44 | lacks support for several video standards. There are several | ||
45 | drivers at kernel that still depends on it. | ||
46 | |||
47 | Documentation for the original API is included in the file | ||
48 | <Documentation/video4linux/API.html>. | ||
49 | |||
50 | User tools for this are available from | ||
51 | <ftp://ftp.uk.linux.org/pub/linux/video4linux/>. | ||
52 | |||
53 | If you are unsure as to whether this is required, answer Y. | ||
54 | |||
55 | config VIDEO_V4L2 | ||
56 | tristate | ||
57 | default y | ||
58 | |||
27 | source "drivers/media/video/Kconfig" | 59 | source "drivers/media/video/Kconfig" |
28 | 60 | ||
29 | source "drivers/media/radio/Kconfig" | 61 | source "drivers/media/radio/Kconfig" |
@@ -65,4 +97,3 @@ config USB_DABUSB | |||
65 | module will be called dabusb. | 97 | module will be called dabusb. |
66 | 98 | ||
67 | endmenu | 99 | endmenu |
68 | |||
diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index 6a901a0268e1..1a04db4552da 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig | |||
@@ -1,9 +1,10 @@ | |||
1 | config VIDEO_SAA7146 | 1 | config VIDEO_SAA7146 |
2 | tristate | 2 | tristate |
3 | select I2C | 3 | depends on I2C |
4 | 4 | ||
5 | config VIDEO_SAA7146_VV | 5 | config VIDEO_SAA7146_VV |
6 | tristate | 6 | tristate |
7 | select VIDEO_V4L2 | ||
7 | select VIDEO_BUF | 8 | select VIDEO_BUF |
8 | select VIDEO_VIDEOBUF | 9 | select VIDEO_VIDEOBUF |
9 | select VIDEO_SAA7146 | 10 | select VIDEO_SAA7146 |
diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig index 3f0ec6be03ae..a97c8f5e9a5d 100644 --- a/drivers/media/dvb/Kconfig +++ b/drivers/media/dvb/Kconfig | |||
@@ -22,26 +22,26 @@ config DVB | |||
22 | source "drivers/media/dvb/dvb-core/Kconfig" | 22 | source "drivers/media/dvb/dvb-core/Kconfig" |
23 | 23 | ||
24 | comment "Supported SAA7146 based PCI Adapters" | 24 | comment "Supported SAA7146 based PCI Adapters" |
25 | depends on DVB_CORE && PCI | 25 | depends on DVB_CORE && PCI && I2C |
26 | source "drivers/media/dvb/ttpci/Kconfig" | 26 | source "drivers/media/dvb/ttpci/Kconfig" |
27 | 27 | ||
28 | comment "Supported USB Adapters" | 28 | comment "Supported USB Adapters" |
29 | depends on DVB_CORE && USB | 29 | depends on DVB_CORE && USB && I2C |
30 | source "drivers/media/dvb/dvb-usb/Kconfig" | 30 | source "drivers/media/dvb/dvb-usb/Kconfig" |
31 | source "drivers/media/dvb/ttusb-budget/Kconfig" | 31 | source "drivers/media/dvb/ttusb-budget/Kconfig" |
32 | source "drivers/media/dvb/ttusb-dec/Kconfig" | 32 | source "drivers/media/dvb/ttusb-dec/Kconfig" |
33 | source "drivers/media/dvb/cinergyT2/Kconfig" | 33 | source "drivers/media/dvb/cinergyT2/Kconfig" |
34 | 34 | ||
35 | comment "Supported FlexCopII (B2C2) Adapters" | 35 | comment "Supported FlexCopII (B2C2) Adapters" |
36 | depends on DVB_CORE && (PCI || USB) | 36 | depends on DVB_CORE && (PCI || USB) && I2C |
37 | source "drivers/media/dvb/b2c2/Kconfig" | 37 | source "drivers/media/dvb/b2c2/Kconfig" |
38 | 38 | ||
39 | comment "Supported BT878 Adapters" | 39 | comment "Supported BT878 Adapters" |
40 | depends on DVB_CORE && PCI | 40 | depends on DVB_CORE && PCI && I2C |
41 | source "drivers/media/dvb/bt8xx/Kconfig" | 41 | source "drivers/media/dvb/bt8xx/Kconfig" |
42 | 42 | ||
43 | comment "Supported Pluto2 Adapters" | 43 | comment "Supported Pluto2 Adapters" |
44 | depends on DVB_CORE && PCI | 44 | depends on DVB_CORE && PCI && I2C |
45 | source "drivers/media/dvb/pluto2/Kconfig" | 45 | source "drivers/media/dvb/pluto2/Kconfig" |
46 | 46 | ||
47 | comment "Supported DVB Frontends" | 47 | comment "Supported DVB Frontends" |
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig index 2963605c0ecc..d7f1fd5b7b02 100644 --- a/drivers/media/dvb/b2c2/Kconfig +++ b/drivers/media/dvb/b2c2/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DVB_B2C2_FLEXCOP | 1 | config DVB_B2C2_FLEXCOP |
2 | tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters" | 2 | tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters" |
3 | depends on DVB_CORE | 3 | depends on DVB_CORE && I2C |
4 | select DVB_STV0299 | 4 | select DVB_STV0299 |
5 | select DVB_MT352 | 5 | select DVB_MT352 |
6 | select DVB_MT312 | 6 | select DVB_MT312 |
@@ -16,7 +16,7 @@ config DVB_B2C2_FLEXCOP | |||
16 | 16 | ||
17 | config DVB_B2C2_FLEXCOP_PCI | 17 | config DVB_B2C2_FLEXCOP_PCI |
18 | tristate "Technisat/B2C2 Air/Sky/Cable2PC PCI" | 18 | tristate "Technisat/B2C2 Air/Sky/Cable2PC PCI" |
19 | depends on DVB_B2C2_FLEXCOP && PCI | 19 | depends on DVB_B2C2_FLEXCOP && PCI && I2C |
20 | help | 20 | help |
21 | Support for the Air/Sky/CableStar2 PCI card (DVB/ATSC) by Technisat/B2C2. | 21 | Support for the Air/Sky/CableStar2 PCI card (DVB/ATSC) by Technisat/B2C2. |
22 | 22 | ||
@@ -24,7 +24,7 @@ config DVB_B2C2_FLEXCOP_PCI | |||
24 | 24 | ||
25 | config DVB_B2C2_FLEXCOP_USB | 25 | config DVB_B2C2_FLEXCOP_USB |
26 | tristate "Technisat/B2C2 Air/Sky/Cable2PC USB" | 26 | tristate "Technisat/B2C2 Air/Sky/Cable2PC USB" |
27 | depends on DVB_B2C2_FLEXCOP && USB | 27 | depends on DVB_B2C2_FLEXCOP && USB && I2C |
28 | help | 28 | help |
29 | Support for the Air/Sky/Cable2PC USB1.1 box (DVB/ATSC) by Technisat/B2C2, | 29 | Support for the Air/Sky/Cable2PC USB1.1 box (DVB/ATSC) by Technisat/B2C2, |
30 | 30 | ||
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig index 376ca48f1d1d..f394002118f8 100644 --- a/drivers/media/dvb/bt8xx/Kconfig +++ b/drivers/media/dvb/bt8xx/Kconfig | |||
@@ -1,12 +1,13 @@ | |||
1 | config DVB_BT8XX | 1 | config DVB_BT8XX |
2 | tristate "BT8xx based PCI cards" | 2 | tristate "BT8xx based PCI cards" |
3 | depends on DVB_CORE && PCI && VIDEO_BT848 | 3 | depends on DVB_CORE && PCI && I2C && VIDEO_BT848 |
4 | select DVB_MT352 | 4 | select DVB_MT352 |
5 | select DVB_SP887X | 5 | select DVB_SP887X |
6 | select DVB_NXT6000 | 6 | select DVB_NXT6000 |
7 | select DVB_CX24110 | 7 | select DVB_CX24110 |
8 | select DVB_OR51211 | 8 | select DVB_OR51211 |
9 | select DVB_LGDT330X | 9 | select DVB_LGDT330X |
10 | select DVB_ZL10353 | ||
10 | select FW_LOADER | 11 | select FW_LOADER |
11 | help | 12 | help |
12 | Support for PCI cards based on the Bt8xx PCI bridge. Examples are | 13 | Support for PCI cards based on the Bt8xx PCI bridge. Examples are |
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index baa8227ef87c..ccc7b2eb4a2d 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c | |||
@@ -115,7 +115,7 @@ static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev) | |||
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev) | 118 | static struct bt878 __devinit *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev) |
119 | { | 119 | { |
120 | unsigned int card_nr; | 120 | unsigned int card_nr; |
121 | 121 | ||
@@ -709,7 +709,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
709 | } | 709 | } |
710 | } | 710 | } |
711 | 711 | ||
712 | static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | 712 | static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) |
713 | { | 713 | { |
714 | int result; | 714 | int result; |
715 | 715 | ||
@@ -794,7 +794,7 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | |||
794 | return 0; | 794 | return 0; |
795 | } | 795 | } |
796 | 796 | ||
797 | static int dvb_bt8xx_probe(struct bttv_sub_device *sub) | 797 | static int __devinit dvb_bt8xx_probe(struct bttv_sub_device *sub) |
798 | { | 798 | { |
799 | struct dvb_bt8xx_card *card; | 799 | struct dvb_bt8xx_card *card; |
800 | struct pci_dev* bttv_pci_dev; | 800 | struct pci_dev* bttv_pci_dev; |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 71b575dc22bd..9325d039ea65 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -902,7 +902,10 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
902 | return -ENOMEM; | 902 | return -ENOMEM; |
903 | } | 903 | } |
904 | 904 | ||
905 | dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE); | 905 | if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE)) < 0) { |
906 | kfree(cinergyt2); | ||
907 | return err; | ||
908 | } | ||
906 | 909 | ||
907 | cinergyt2->demux.priv = cinergyt2; | 910 | cinergyt2->demux.priv = cinergyt2; |
908 | cinergyt2->demux.filternum = 256; | 911 | cinergyt2->demux.filternum = 256; |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4f8f257e6795..a051790161b0 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -106,6 +106,8 @@ struct dvb_frontend_private { | |||
106 | unsigned long tune_mode_flags; | 106 | unsigned long tune_mode_flags; |
107 | unsigned int delay; | 107 | unsigned int delay; |
108 | unsigned int reinitialise; | 108 | unsigned int reinitialise; |
109 | int tone; | ||
110 | int voltage; | ||
109 | 111 | ||
110 | /* swzigzag values */ | 112 | /* swzigzag values */ |
111 | unsigned int state; | 113 | unsigned int state; |
@@ -537,6 +539,12 @@ static int dvb_frontend_thread(void *data) | |||
537 | 539 | ||
538 | if (fepriv->reinitialise) { | 540 | if (fepriv->reinitialise) { |
539 | dvb_frontend_init(fe); | 541 | dvb_frontend_init(fe); |
542 | if (fepriv->tone != -1) { | ||
543 | fe->ops->set_tone(fe, fepriv->tone); | ||
544 | } | ||
545 | if (fepriv->voltage != -1) { | ||
546 | fe->ops->set_voltage(fe, fepriv->voltage); | ||
547 | } | ||
540 | fepriv->reinitialise = 0; | 548 | fepriv->reinitialise = 0; |
541 | } | 549 | } |
542 | 550 | ||
@@ -788,6 +796,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
788 | case FE_SET_TONE: | 796 | case FE_SET_TONE: |
789 | if (fe->ops->set_tone) { | 797 | if (fe->ops->set_tone) { |
790 | err = fe->ops->set_tone(fe, (fe_sec_tone_mode_t) parg); | 798 | err = fe->ops->set_tone(fe, (fe_sec_tone_mode_t) parg); |
799 | fepriv->tone = (fe_sec_tone_mode_t) parg; | ||
791 | fepriv->state = FESTATE_DISEQC; | 800 | fepriv->state = FESTATE_DISEQC; |
792 | fepriv->status = 0; | 801 | fepriv->status = 0; |
793 | } | 802 | } |
@@ -796,6 +805,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
796 | case FE_SET_VOLTAGE: | 805 | case FE_SET_VOLTAGE: |
797 | if (fe->ops->set_voltage) { | 806 | if (fe->ops->set_voltage) { |
798 | err = fe->ops->set_voltage(fe, (fe_sec_voltage_t) parg); | 807 | err = fe->ops->set_voltage(fe, (fe_sec_voltage_t) parg); |
808 | fepriv->voltage = (fe_sec_voltage_t) parg; | ||
799 | fepriv->state = FESTATE_DISEQC; | 809 | fepriv->state = FESTATE_DISEQC; |
800 | fepriv->status = 0; | 810 | fepriv->status = 0; |
801 | } | 811 | } |
@@ -995,6 +1005,8 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) | |||
995 | 1005 | ||
996 | /* normal tune mode when opened R/W */ | 1006 | /* normal tune mode when opened R/W */ |
997 | fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; | 1007 | fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; |
1008 | fepriv->tone = -1; | ||
1009 | fepriv->voltage = -1; | ||
998 | } | 1010 | } |
999 | 1011 | ||
1000 | return ret; | 1012 | return ret; |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 96fe0ecae250..3852430d0260 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
@@ -219,8 +219,6 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
219 | return -ENOMEM; | 219 | return -ENOMEM; |
220 | } | 220 | } |
221 | 221 | ||
222 | mutex_unlock(&dvbdev_register_lock); | ||
223 | |||
224 | memcpy(dvbdev, template, sizeof(struct dvb_device)); | 222 | memcpy(dvbdev, template, sizeof(struct dvb_device)); |
225 | dvbdev->type = type; | 223 | dvbdev->type = type; |
226 | dvbdev->id = id; | 224 | dvbdev->id = id; |
@@ -231,6 +229,8 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
231 | 229 | ||
232 | list_add_tail (&dvbdev->list_head, &adap->device_list); | 230 | list_add_tail (&dvbdev->list_head, &adap->device_list); |
233 | 231 | ||
232 | mutex_unlock(&dvbdev_register_lock); | ||
233 | |||
234 | devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), | 234 | devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), |
235 | S_IFCHR | S_IRUSR | S_IWUSR, | 235 | S_IFCHR | S_IRUSR | S_IWUSR, |
236 | "dvb/adapter%d/%s%d", adap->num, dnames[type], id); | 236 | "dvb/adapter%d/%s%d", adap->num, dnames[type], id); |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index d3df12039b06..e388fb1567d6 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DVB_USB | 1 | config DVB_USB |
2 | tristate "Support for various USB DVB devices" | 2 | tristate "Support for various USB DVB devices" |
3 | depends on DVB_CORE && USB | 3 | depends on DVB_CORE && USB && I2C |
4 | select FW_LOADER | 4 | select FW_LOADER |
5 | help | 5 | help |
6 | By enabling this you will be able to choose the various supported | 6 | By enabling this you will be able to choose the various supported |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 7edd6362b9cc..1f0d3e995c8d 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -150,6 +150,15 @@ static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
150 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); | 150 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); |
151 | } | 151 | } |
152 | 152 | ||
153 | static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
154 | { | ||
155 | u8 b = 0; | ||
156 | if (onoff) | ||
157 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); | ||
158 | else | ||
159 | return 0; | ||
160 | } | ||
161 | |||
153 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) | 162 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) |
154 | { | 163 | { |
155 | u8 buf[2] = { 0x03, 0x00 }; | 164 | u8 buf[2] = { 0x03, 0x00 }; |
@@ -544,7 +553,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = { | |||
544 | .size_of_priv = sizeof(struct cxusb_state), | 553 | .size_of_priv = sizeof(struct cxusb_state), |
545 | 554 | ||
546 | .streaming_ctrl = cxusb_streaming_ctrl, | 555 | .streaming_ctrl = cxusb_streaming_ctrl, |
547 | .power_ctrl = cxusb_power_ctrl, | 556 | .power_ctrl = cxusb_bluebird_power_ctrl, |
548 | .frontend_attach = cxusb_lgdt3303_frontend_attach, | 557 | .frontend_attach = cxusb_lgdt3303_frontend_attach, |
549 | .tuner_attach = cxusb_lgh064f_tuner_attach, | 558 | .tuner_attach = cxusb_lgh064f_tuner_attach, |
550 | 559 | ||
@@ -589,7 +598,7 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = { | |||
589 | .size_of_priv = sizeof(struct cxusb_state), | 598 | .size_of_priv = sizeof(struct cxusb_state), |
590 | 599 | ||
591 | .streaming_ctrl = cxusb_streaming_ctrl, | 600 | .streaming_ctrl = cxusb_streaming_ctrl, |
592 | .power_ctrl = cxusb_power_ctrl, | 601 | .power_ctrl = cxusb_bluebird_power_ctrl, |
593 | .frontend_attach = cxusb_dee1601_frontend_attach, | 602 | .frontend_attach = cxusb_dee1601_frontend_attach, |
594 | .tuner_attach = cxusb_dee1601_tuner_attach, | 603 | .tuner_attach = cxusb_dee1601_tuner_attach, |
595 | 604 | ||
@@ -638,7 +647,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = { | |||
638 | .size_of_priv = sizeof(struct cxusb_state), | 647 | .size_of_priv = sizeof(struct cxusb_state), |
639 | 648 | ||
640 | .streaming_ctrl = cxusb_streaming_ctrl, | 649 | .streaming_ctrl = cxusb_streaming_ctrl, |
641 | .power_ctrl = cxusb_power_ctrl, | 650 | .power_ctrl = cxusb_bluebird_power_ctrl, |
642 | .frontend_attach = cxusb_mt352_frontend_attach, | 651 | .frontend_attach = cxusb_mt352_frontend_attach, |
643 | .tuner_attach = cxusb_lgz201_tuner_attach, | 652 | .tuner_attach = cxusb_lgz201_tuner_attach, |
644 | 653 | ||
@@ -683,7 +692,7 @@ static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = { | |||
683 | .size_of_priv = sizeof(struct cxusb_state), | 692 | .size_of_priv = sizeof(struct cxusb_state), |
684 | 693 | ||
685 | .streaming_ctrl = cxusb_streaming_ctrl, | 694 | .streaming_ctrl = cxusb_streaming_ctrl, |
686 | .power_ctrl = cxusb_power_ctrl, | 695 | .power_ctrl = cxusb_bluebird_power_ctrl, |
687 | .frontend_attach = cxusb_mt352_frontend_attach, | 696 | .frontend_attach = cxusb_mt352_frontend_attach, |
688 | .tuner_attach = cxusb_dtt7579_tuner_attach, | 697 | .tuner_attach = cxusb_dtt7579_tuner_attach, |
689 | 698 | ||
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c index d661c6f9cbe5..691dc840dcc0 100644 --- a/drivers/media/dvb/frontends/cx24123.c +++ b/drivers/media/dvb/frontends/cx24123.c | |||
@@ -29,6 +29,9 @@ | |||
29 | #include "dvb_frontend.h" | 29 | #include "dvb_frontend.h" |
30 | #include "cx24123.h" | 30 | #include "cx24123.h" |
31 | 31 | ||
32 | #define XTAL 10111000 | ||
33 | |||
34 | static int force_band; | ||
32 | static int debug; | 35 | static int debug; |
33 | #define dprintk(args...) \ | 36 | #define dprintk(args...) \ |
34 | do { \ | 37 | do { \ |
@@ -52,6 +55,7 @@ struct cx24123_state | |||
52 | u32 VGAarg; | 55 | u32 VGAarg; |
53 | u32 bandselectarg; | 56 | u32 bandselectarg; |
54 | u32 pllarg; | 57 | u32 pllarg; |
58 | u32 FILTune; | ||
55 | 59 | ||
56 | /* The Demod/Tuner can't easily provide these, we cache them */ | 60 | /* The Demod/Tuner can't easily provide these, we cache them */ |
57 | u32 currentfreq; | 61 | u32 currentfreq; |
@@ -63,43 +67,33 @@ static struct | |||
63 | { | 67 | { |
64 | u32 symbolrate_low; | 68 | u32 symbolrate_low; |
65 | u32 symbolrate_high; | 69 | u32 symbolrate_high; |
66 | u32 VCAslope; | ||
67 | u32 VCAoffset; | ||
68 | u32 VGA1offset; | ||
69 | u32 VGA2offset; | ||
70 | u32 VCAprogdata; | 70 | u32 VCAprogdata; |
71 | u32 VGAprogdata; | 71 | u32 VGAprogdata; |
72 | u32 FILTune; | ||
72 | } cx24123_AGC_vals[] = | 73 | } cx24123_AGC_vals[] = |
73 | { | 74 | { |
74 | { | 75 | { |
75 | .symbolrate_low = 1000000, | 76 | .symbolrate_low = 1000000, |
76 | .symbolrate_high = 4999999, | 77 | .symbolrate_high = 4999999, |
77 | .VCAslope = 0x07, | 78 | /* the specs recommend other values for VGA offsets, |
78 | .VCAoffset = 0x0f, | 79 | but tests show they are wrong */ |
79 | .VGA1offset = 0x1f8, | 80 | .VGAprogdata = (1 << 19) | (0x180 << 9) | 0x1e0, |
80 | .VGA2offset = 0x1f8, | 81 | .VCAprogdata = (2 << 19) | (0x07 << 9) | 0x07, |
81 | .VGAprogdata = (2 << 18) | (0x1f8 << 9) | 0x1f8, | 82 | .FILTune = 0x27f /* 0.41 V */ |
82 | .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x07, | ||
83 | }, | 83 | }, |
84 | { | 84 | { |
85 | .symbolrate_low = 5000000, | 85 | .symbolrate_low = 5000000, |
86 | .symbolrate_high = 14999999, | 86 | .symbolrate_high = 14999999, |
87 | .VCAslope = 0x1f, | 87 | .VGAprogdata = (1 << 19) | (0x180 << 9) | 0x1e0, |
88 | .VCAoffset = 0x1f, | 88 | .VCAprogdata = (2 << 19) | (0x07 << 9) | 0x1f, |
89 | .VGA1offset = 0x1e0, | 89 | .FILTune = 0x317 /* 0.90 V */ |
90 | .VGA2offset = 0x180, | ||
91 | .VGAprogdata = (2 << 18) | (0x180 << 9) | 0x1e0, | ||
92 | .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x1f, | ||
93 | }, | 90 | }, |
94 | { | 91 | { |
95 | .symbolrate_low = 15000000, | 92 | .symbolrate_low = 15000000, |
96 | .symbolrate_high = 45000000, | 93 | .symbolrate_high = 45000000, |
97 | .VCAslope = 0x3f, | 94 | .VGAprogdata = (1 << 19) | (0x100 << 9) | 0x180, |
98 | .VCAoffset = 0x3f, | 95 | .VCAprogdata = (2 << 19) | (0x07 << 9) | 0x3f, |
99 | .VGA1offset = 0x180, | 96 | .FILTune = 0x145 /* 2.70 V */ |
100 | .VGA2offset = 0x100, | ||
101 | .VGAprogdata = (2 << 18) | (0x100 << 9) | 0x180, | ||
102 | .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x3f, | ||
103 | }, | 97 | }, |
104 | }; | 98 | }; |
105 | 99 | ||
@@ -112,91 +106,80 @@ static struct | |||
112 | { | 106 | { |
113 | u32 freq_low; | 107 | u32 freq_low; |
114 | u32 freq_high; | 108 | u32 freq_high; |
115 | u32 bandselect; | ||
116 | u32 VCOdivider; | 109 | u32 VCOdivider; |
117 | u32 VCOnumber; | ||
118 | u32 progdata; | 110 | u32 progdata; |
119 | } cx24123_bandselect_vals[] = | 111 | } cx24123_bandselect_vals[] = |
120 | { | 112 | { |
113 | /* band 1 */ | ||
121 | { | 114 | { |
122 | .freq_low = 950000, | 115 | .freq_low = 950000, |
123 | .freq_high = 1018999, | ||
124 | .bandselect = 0x40, | ||
125 | .VCOdivider = 4, | ||
126 | .VCOnumber = 7, | ||
127 | .progdata = (0 << 18) | (0 << 9) | 0x40, | ||
128 | }, | ||
129 | { | ||
130 | .freq_low = 1019000, | ||
131 | .freq_high = 1074999, | 116 | .freq_high = 1074999, |
132 | .bandselect = 0x80, | ||
133 | .VCOdivider = 4, | 117 | .VCOdivider = 4, |
134 | .VCOnumber = 8, | 118 | .progdata = (0 << 19) | (0 << 9) | 0x40, |
135 | .progdata = (0 << 18) | (0 << 9) | 0x80, | ||
136 | }, | 119 | }, |
120 | |||
121 | /* band 2 */ | ||
137 | { | 122 | { |
138 | .freq_low = 1075000, | 123 | .freq_low = 1075000, |
139 | .freq_high = 1227999, | 124 | .freq_high = 1177999, |
140 | .bandselect = 0x01, | 125 | .VCOdivider = 4, |
141 | .VCOdivider = 2, | 126 | .progdata = (0 << 19) | (0 << 9) | 0x80, |
142 | .VCOnumber = 1, | ||
143 | .progdata = (0 << 18) | (1 << 9) | 0x01, | ||
144 | }, | 127 | }, |
128 | |||
129 | /* band 3 */ | ||
145 | { | 130 | { |
146 | .freq_low = 1228000, | 131 | .freq_low = 1178000, |
147 | .freq_high = 1349999, | 132 | .freq_high = 1295999, |
148 | .bandselect = 0x02, | ||
149 | .VCOdivider = 2, | 133 | .VCOdivider = 2, |
150 | .VCOnumber = 2, | 134 | .progdata = (0 << 19) | (1 << 9) | 0x01, |
151 | .progdata = (0 << 18) | (1 << 9) | 0x02, | ||
152 | }, | 135 | }, |
136 | |||
137 | /* band 4 */ | ||
153 | { | 138 | { |
154 | .freq_low = 1350000, | 139 | .freq_low = 1296000, |
155 | .freq_high = 1481999, | 140 | .freq_high = 1431999, |
156 | .bandselect = 0x04, | ||
157 | .VCOdivider = 2, | 141 | .VCOdivider = 2, |
158 | .VCOnumber = 3, | 142 | .progdata = (0 << 19) | (1 << 9) | 0x02, |
159 | .progdata = (0 << 18) | (1 << 9) | 0x04, | ||
160 | }, | 143 | }, |
144 | |||
145 | /* band 5 */ | ||
161 | { | 146 | { |
162 | .freq_low = 1482000, | 147 | .freq_low = 1432000, |
163 | .freq_high = 1595999, | 148 | .freq_high = 1575999, |
164 | .bandselect = 0x08, | ||
165 | .VCOdivider = 2, | 149 | .VCOdivider = 2, |
166 | .VCOnumber = 4, | 150 | .progdata = (0 << 19) | (1 << 9) | 0x04, |
167 | .progdata = (0 << 18) | (1 << 9) | 0x08, | ||
168 | }, | 151 | }, |
152 | |||
153 | /* band 6 */ | ||
169 | { | 154 | { |
170 | .freq_low = 1596000, | 155 | .freq_low = 1576000, |
171 | .freq_high = 1717999, | 156 | .freq_high = 1717999, |
172 | .bandselect = 0x10, | ||
173 | .VCOdivider = 2, | 157 | .VCOdivider = 2, |
174 | .VCOnumber = 5, | 158 | .progdata = (0 << 19) | (1 << 9) | 0x08, |
175 | .progdata = (0 << 18) | (1 << 9) | 0x10, | ||
176 | }, | 159 | }, |
160 | |||
161 | /* band 7 */ | ||
177 | { | 162 | { |
178 | .freq_low = 1718000, | 163 | .freq_low = 1718000, |
179 | .freq_high = 1855999, | 164 | .freq_high = 1855999, |
180 | .bandselect = 0x20, | ||
181 | .VCOdivider = 2, | 165 | .VCOdivider = 2, |
182 | .VCOnumber = 6, | 166 | .progdata = (0 << 19) | (1 << 9) | 0x10, |
183 | .progdata = (0 << 18) | (1 << 9) | 0x20, | ||
184 | }, | 167 | }, |
168 | |||
169 | /* band 8 */ | ||
185 | { | 170 | { |
186 | .freq_low = 1856000, | 171 | .freq_low = 1856000, |
187 | .freq_high = 2035999, | 172 | .freq_high = 2035999, |
188 | .bandselect = 0x40, | ||
189 | .VCOdivider = 2, | 173 | .VCOdivider = 2, |
190 | .VCOnumber = 7, | 174 | .progdata = (0 << 19) | (1 << 9) | 0x20, |
191 | .progdata = (0 << 18) | (1 << 9) | 0x40, | ||
192 | }, | 175 | }, |
176 | |||
177 | /* band 9 */ | ||
193 | { | 178 | { |
194 | .freq_low = 2036000, | 179 | .freq_low = 2036000, |
195 | .freq_high = 2149999, | 180 | .freq_high = 2150000, |
196 | .bandselect = 0x80, | ||
197 | .VCOdivider = 2, | 181 | .VCOdivider = 2, |
198 | .VCOnumber = 8, | 182 | .progdata = (0 << 19) | (1 << 9) | 0x40, |
199 | .progdata = (0 << 18) | (1 << 9) | 0x80, | ||
200 | }, | 183 | }, |
201 | }; | 184 | }; |
202 | 185 | ||
@@ -207,49 +190,44 @@ static struct { | |||
207 | { | 190 | { |
208 | {0x00, 0x03}, /* Reset system */ | 191 | {0x00, 0x03}, /* Reset system */ |
209 | {0x00, 0x00}, /* Clear reset */ | 192 | {0x00, 0x00}, /* Clear reset */ |
210 | {0x01, 0x3b}, /* Apply sensible defaults, from an i2c sniffer */ | 193 | {0x03, 0x07}, /* QPSK, DVB, Auto Acquisition (default) */ |
211 | {0x03, 0x07}, | 194 | {0x04, 0x10}, /* MPEG */ |
212 | {0x04, 0x10}, | 195 | {0x05, 0x04}, /* MPEG */ |
213 | {0x05, 0x04}, | 196 | {0x06, 0x31}, /* MPEG (default) */ |
214 | {0x06, 0x31}, | 197 | {0x0b, 0x00}, /* Freq search start point (default) */ |
215 | {0x0d, 0x02}, | 198 | {0x0c, 0x00}, /* Demodulator sample gain (default) */ |
216 | {0x0e, 0x03}, | 199 | {0x0d, 0x02}, /* Frequency search range = Fsymbol / 4 (default) */ |
217 | {0x0f, 0xfe}, | 200 | {0x0e, 0x03}, /* Default non-inverted, FEC 3/4 (default) */ |
218 | {0x10, 0x01}, | 201 | {0x0f, 0xfe}, /* FEC search mask (all supported codes) */ |
219 | {0x14, 0x01}, | 202 | {0x10, 0x01}, /* Default search inversion, no repeat (default) */ |
220 | {0x15, 0x98}, | 203 | {0x16, 0x00}, /* Enable reading of frequency */ |
221 | {0x16, 0x00}, | 204 | {0x17, 0x01}, /* Enable EsNO Ready Counter */ |
222 | {0x17, 0x01}, | 205 | {0x1c, 0x80}, /* Enable error counter */ |
223 | {0x1b, 0x05}, | 206 | {0x20, 0x00}, /* Tuner burst clock rate = 500KHz */ |
224 | {0x1c, 0x80}, | 207 | {0x21, 0x15}, /* Tuner burst mode, word length = 0x15 */ |
225 | {0x1d, 0x00}, | 208 | {0x28, 0x00}, /* Enable FILTERV with positive pol., DiSEqC 2.x off */ |
226 | {0x1e, 0x00}, | 209 | {0x29, 0x00}, /* DiSEqC LNB_DC off */ |
227 | {0x20, 0x41}, | 210 | {0x2a, 0xb0}, /* DiSEqC Parameters (default) */ |
228 | {0x21, 0x15}, | 211 | {0x2b, 0x73}, /* DiSEqC Tone Frequency (default) */ |
229 | {0x27, 0x14}, | 212 | {0x2c, 0x00}, /* DiSEqC Message (0x2c - 0x31) */ |
230 | {0x28, 0x46}, | ||
231 | {0x29, 0x00}, | ||
232 | {0x2a, 0xb0}, | ||
233 | {0x2b, 0x73}, | ||
234 | {0x2c, 0x00}, | ||
235 | {0x2d, 0x00}, | 213 | {0x2d, 0x00}, |
236 | {0x2e, 0x00}, | 214 | {0x2e, 0x00}, |
237 | {0x2f, 0x00}, | 215 | {0x2f, 0x00}, |
238 | {0x30, 0x00}, | 216 | {0x30, 0x00}, |
239 | {0x31, 0x00}, | 217 | {0x31, 0x00}, |
240 | {0x32, 0x8c}, | 218 | {0x32, 0x8c}, /* DiSEqC Parameters (default) */ |
241 | {0x33, 0x00}, | 219 | {0x33, 0x00}, /* Interrupts off (0x33 - 0x34) */ |
242 | {0x34, 0x00}, | 220 | {0x34, 0x00}, |
243 | {0x35, 0x03}, | 221 | {0x35, 0x03}, /* DiSEqC Tone Amplitude (default) */ |
244 | {0x36, 0x02}, | 222 | {0x36, 0x02}, /* DiSEqC Parameters (default) */ |
245 | {0x37, 0x3a}, | 223 | {0x37, 0x3a}, /* DiSEqC Parameters (default) */ |
246 | {0x3a, 0x00}, /* Enable AGC accumulator */ | 224 | {0x3a, 0x00}, /* Enable AGC accumulator (for signal strength) */ |
247 | {0x44, 0x00}, | 225 | {0x44, 0x00}, /* Constellation (default) */ |
248 | {0x45, 0x00}, | 226 | {0x45, 0x00}, /* Symbol count (default) */ |
249 | {0x46, 0x05}, | 227 | {0x46, 0x0d}, /* Symbol rate estimator on (default) */ |
250 | {0x56, 0x41}, | 228 | {0x56, 0x41}, /* Various (default) */ |
251 | {0x57, 0xff}, | 229 | {0x57, 0xff}, /* Error Counter Window (default) */ |
252 | {0x67, 0x83}, | 230 | {0x67, 0x83}, /* Non-DCII symbol clock */ |
253 | }; | 231 | }; |
254 | 232 | ||
255 | static int cx24123_writereg(struct cx24123_state* state, int reg, int data) | 233 | static int cx24123_writereg(struct cx24123_state* state, int reg, int data) |
@@ -258,6 +236,10 @@ static int cx24123_writereg(struct cx24123_state* state, int reg, int data) | |||
258 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; | 236 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; |
259 | int err; | 237 | int err; |
260 | 238 | ||
239 | if (debug>1) | ||
240 | printk("cx24123: %s: write reg 0x%02x, value 0x%02x\n", | ||
241 | __FUNCTION__,reg, data); | ||
242 | |||
261 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 243 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
262 | printk("%s: writereg error(err == %i, reg == 0x%02x," | 244 | printk("%s: writereg error(err == %i, reg == 0x%02x," |
263 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 245 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); |
@@ -274,6 +256,10 @@ static int cx24123_writelnbreg(struct cx24123_state* state, int reg, int data) | |||
274 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 }; | 256 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 }; |
275 | int err; | 257 | int err; |
276 | 258 | ||
259 | if (debug>1) | ||
260 | printk("cx24123: %s: writeln addr=0x08, reg 0x%02x, value 0x%02x\n", | ||
261 | __FUNCTION__,reg, data); | ||
262 | |||
277 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 263 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
278 | printk("%s: writelnbreg error (err == %i, reg == 0x%02x," | 264 | printk("%s: writelnbreg error (err == %i, reg == 0x%02x," |
279 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 265 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); |
@@ -303,6 +289,9 @@ static int cx24123_readreg(struct cx24123_state* state, u8 reg) | |||
303 | return ret; | 289 | return ret; |
304 | } | 290 | } |
305 | 291 | ||
292 | if (debug>1) | ||
293 | printk("cx24123: read reg 0x%02x, value 0x%02x\n",reg, ret); | ||
294 | |||
306 | return b1[0]; | 295 | return b1[0]; |
307 | } | 296 | } |
308 | 297 | ||
@@ -313,17 +302,23 @@ static int cx24123_readlnbreg(struct cx24123_state* state, u8 reg) | |||
313 | 302 | ||
314 | static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion) | 303 | static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion) |
315 | { | 304 | { |
305 | u8 nom_reg = cx24123_readreg(state, 0x0e); | ||
306 | u8 auto_reg = cx24123_readreg(state, 0x10); | ||
307 | |||
316 | switch (inversion) { | 308 | switch (inversion) { |
317 | case INVERSION_OFF: | 309 | case INVERSION_OFF: |
318 | cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) & 0x7f); | 310 | dprintk("%s: inversion off\n",__FUNCTION__); |
319 | cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80); | 311 | cx24123_writereg(state, 0x0e, nom_reg & ~0x80); |
312 | cx24123_writereg(state, 0x10, auto_reg | 0x80); | ||
320 | break; | 313 | break; |
321 | case INVERSION_ON: | 314 | case INVERSION_ON: |
322 | cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) | 0x80); | 315 | dprintk("%s: inversion on\n",__FUNCTION__); |
323 | cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80); | 316 | cx24123_writereg(state, 0x0e, nom_reg | 0x80); |
317 | cx24123_writereg(state, 0x10, auto_reg | 0x80); | ||
324 | break; | 318 | break; |
325 | case INVERSION_AUTO: | 319 | case INVERSION_AUTO: |
326 | cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) & 0x7f); | 320 | dprintk("%s: inversion auto\n",__FUNCTION__); |
321 | cx24123_writereg(state, 0x10, auto_reg & ~0x80); | ||
327 | break; | 322 | break; |
328 | default: | 323 | default: |
329 | return -EINVAL; | 324 | return -EINVAL; |
@@ -338,92 +333,191 @@ static int cx24123_get_inversion(struct cx24123_state* state, fe_spectral_invers | |||
338 | 333 | ||
339 | val = cx24123_readreg(state, 0x1b) >> 7; | 334 | val = cx24123_readreg(state, 0x1b) >> 7; |
340 | 335 | ||
341 | if (val == 0) | 336 | if (val == 0) { |
337 | dprintk("%s: read inversion off\n",__FUNCTION__); | ||
342 | *inversion = INVERSION_OFF; | 338 | *inversion = INVERSION_OFF; |
343 | else | 339 | } else { |
340 | dprintk("%s: read inversion on\n",__FUNCTION__); | ||
344 | *inversion = INVERSION_ON; | 341 | *inversion = INVERSION_ON; |
342 | } | ||
345 | 343 | ||
346 | return 0; | 344 | return 0; |
347 | } | 345 | } |
348 | 346 | ||
349 | static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec) | 347 | static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec) |
350 | { | 348 | { |
349 | u8 nom_reg = cx24123_readreg(state, 0x0e) & ~0x07; | ||
350 | |||
351 | if ( (fec < FEC_NONE) || (fec > FEC_AUTO) ) | 351 | if ( (fec < FEC_NONE) || (fec > FEC_AUTO) ) |
352 | fec = FEC_AUTO; | 352 | fec = FEC_AUTO; |
353 | 353 | ||
354 | /* Hardware has 5/11 and 3/5 but are never unused */ | ||
355 | switch (fec) { | 354 | switch (fec) { |
356 | case FEC_NONE: | ||
357 | return cx24123_writereg(state, 0x0f, 0x01); | ||
358 | case FEC_1_2: | 355 | case FEC_1_2: |
359 | return cx24123_writereg(state, 0x0f, 0x02); | 356 | dprintk("%s: set FEC to 1/2\n",__FUNCTION__); |
357 | cx24123_writereg(state, 0x0e, nom_reg | 0x01); | ||
358 | cx24123_writereg(state, 0x0f, 0x02); | ||
359 | break; | ||
360 | case FEC_2_3: | 360 | case FEC_2_3: |
361 | return cx24123_writereg(state, 0x0f, 0x04); | 361 | dprintk("%s: set FEC to 2/3\n",__FUNCTION__); |
362 | cx24123_writereg(state, 0x0e, nom_reg | 0x02); | ||
363 | cx24123_writereg(state, 0x0f, 0x04); | ||
364 | break; | ||
362 | case FEC_3_4: | 365 | case FEC_3_4: |
363 | return cx24123_writereg(state, 0x0f, 0x08); | 366 | dprintk("%s: set FEC to 3/4\n",__FUNCTION__); |
367 | cx24123_writereg(state, 0x0e, nom_reg | 0x03); | ||
368 | cx24123_writereg(state, 0x0f, 0x08); | ||
369 | break; | ||
370 | case FEC_4_5: | ||
371 | dprintk("%s: set FEC to 4/5\n",__FUNCTION__); | ||
372 | cx24123_writereg(state, 0x0e, nom_reg | 0x04); | ||
373 | cx24123_writereg(state, 0x0f, 0x10); | ||
374 | break; | ||
364 | case FEC_5_6: | 375 | case FEC_5_6: |
365 | return cx24123_writereg(state, 0x0f, 0x20); | 376 | dprintk("%s: set FEC to 5/6\n",__FUNCTION__); |
377 | cx24123_writereg(state, 0x0e, nom_reg | 0x05); | ||
378 | cx24123_writereg(state, 0x0f, 0x20); | ||
379 | break; | ||
380 | case FEC_6_7: | ||
381 | dprintk("%s: set FEC to 6/7\n",__FUNCTION__); | ||
382 | cx24123_writereg(state, 0x0e, nom_reg | 0x06); | ||
383 | cx24123_writereg(state, 0x0f, 0x40); | ||
384 | break; | ||
366 | case FEC_7_8: | 385 | case FEC_7_8: |
367 | return cx24123_writereg(state, 0x0f, 0x80); | 386 | dprintk("%s: set FEC to 7/8\n",__FUNCTION__); |
387 | cx24123_writereg(state, 0x0e, nom_reg | 0x07); | ||
388 | cx24123_writereg(state, 0x0f, 0x80); | ||
389 | break; | ||
368 | case FEC_AUTO: | 390 | case FEC_AUTO: |
369 | return cx24123_writereg(state, 0x0f, 0xae); | 391 | dprintk("%s: set FEC to auto\n",__FUNCTION__); |
392 | cx24123_writereg(state, 0x0f, 0xfe); | ||
393 | break; | ||
370 | default: | 394 | default: |
371 | return -EOPNOTSUPP; | 395 | return -EOPNOTSUPP; |
372 | } | 396 | } |
397 | |||
398 | return 0; | ||
373 | } | 399 | } |
374 | 400 | ||
375 | static int cx24123_get_fec(struct cx24123_state* state, fe_code_rate_t *fec) | 401 | static int cx24123_get_fec(struct cx24123_state* state, fe_code_rate_t *fec) |
376 | { | 402 | { |
377 | int ret; | 403 | int ret; |
378 | u8 val; | ||
379 | 404 | ||
380 | ret = cx24123_readreg (state, 0x1b); | 405 | ret = cx24123_readreg (state, 0x1b); |
381 | if (ret < 0) | 406 | if (ret < 0) |
382 | return ret; | 407 | return ret; |
383 | val = ret & 0x07; | 408 | ret = ret & 0x07; |
384 | switch (val) { | 409 | |
410 | switch (ret) { | ||
385 | case 1: | 411 | case 1: |
386 | *fec = FEC_1_2; | 412 | *fec = FEC_1_2; |
387 | break; | 413 | break; |
388 | case 3: | 414 | case 2: |
389 | *fec = FEC_2_3; | 415 | *fec = FEC_2_3; |
390 | break; | 416 | break; |
391 | case 4: | 417 | case 3: |
392 | *fec = FEC_3_4; | 418 | *fec = FEC_3_4; |
393 | break; | 419 | break; |
394 | case 5: | 420 | case 4: |
395 | *fec = FEC_4_5; | 421 | *fec = FEC_4_5; |
396 | break; | 422 | break; |
397 | case 6: | 423 | case 5: |
398 | *fec = FEC_5_6; | 424 | *fec = FEC_5_6; |
399 | break; | 425 | break; |
426 | case 6: | ||
427 | *fec = FEC_6_7; | ||
428 | break; | ||
400 | case 7: | 429 | case 7: |
401 | *fec = FEC_7_8; | 430 | *fec = FEC_7_8; |
402 | break; | 431 | break; |
403 | case 2: /* *fec = FEC_3_5; break; */ | ||
404 | case 0: /* *fec = FEC_5_11; break; */ | ||
405 | *fec = FEC_AUTO; | ||
406 | break; | ||
407 | default: | 432 | default: |
408 | *fec = FEC_NONE; // can't happen | 433 | /* this can happen when there's no lock */ |
434 | *fec = FEC_NONE; | ||
409 | } | 435 | } |
410 | 436 | ||
411 | return 0; | 437 | return 0; |
412 | } | 438 | } |
413 | 439 | ||
414 | /* fixme: Symbol rates < 3MSps may not work because of precision loss */ | 440 | /* Approximation of closest integer of log2(a/b). It actually gives the |
441 | lowest integer i such that 2^i >= round(a/b) */ | ||
442 | static u32 cx24123_int_log2(u32 a, u32 b) | ||
443 | { | ||
444 | u32 exp, nearest = 0; | ||
445 | u32 div = a / b; | ||
446 | if(a % b >= b / 2) ++div; | ||
447 | if(div < (1 << 31)) | ||
448 | { | ||
449 | for(exp = 1; div > exp; nearest++) | ||
450 | exp += exp; | ||
451 | } | ||
452 | return nearest; | ||
453 | } | ||
454 | |||
415 | static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) | 455 | static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) |
416 | { | 456 | { |
417 | u32 val; | 457 | u32 tmp, sample_rate, ratio, sample_gain; |
458 | u8 pll_mult; | ||
459 | |||
460 | /* check if symbol rate is within limits */ | ||
461 | if ((srate > state->ops.info.symbol_rate_max) || | ||
462 | (srate < state->ops.info.symbol_rate_min)) | ||
463 | return -EOPNOTSUPP;; | ||
464 | |||
465 | /* choose the sampling rate high enough for the required operation, | ||
466 | while optimizing the power consumed by the demodulator */ | ||
467 | if (srate < (XTAL*2)/2) | ||
468 | pll_mult = 2; | ||
469 | else if (srate < (XTAL*3)/2) | ||
470 | pll_mult = 3; | ||
471 | else if (srate < (XTAL*4)/2) | ||
472 | pll_mult = 4; | ||
473 | else if (srate < (XTAL*5)/2) | ||
474 | pll_mult = 5; | ||
475 | else if (srate < (XTAL*6)/2) | ||
476 | pll_mult = 6; | ||
477 | else if (srate < (XTAL*7)/2) | ||
478 | pll_mult = 7; | ||
479 | else if (srate < (XTAL*8)/2) | ||
480 | pll_mult = 8; | ||
481 | else | ||
482 | pll_mult = 9; | ||
483 | |||
484 | |||
485 | sample_rate = pll_mult * XTAL; | ||
486 | |||
487 | /* | ||
488 | SYSSymbolRate[21:0] = (srate << 23) / sample_rate | ||
489 | |||
490 | We have to use 32 bit unsigned arithmetic without precision loss. | ||
491 | The maximum srate is 45000000 or 0x02AEA540. This number has | ||
492 | only 6 clear bits on top, hence we can shift it left only 6 bits | ||
493 | at a time. Borrowed from cx24110.c | ||
494 | */ | ||
495 | |||
496 | tmp = srate << 6; | ||
497 | ratio = tmp / sample_rate; | ||
498 | |||
499 | tmp = (tmp % sample_rate) << 6; | ||
500 | ratio = (ratio << 6) + (tmp / sample_rate); | ||
501 | |||
502 | tmp = (tmp % sample_rate) << 6; | ||
503 | ratio = (ratio << 6) + (tmp / sample_rate); | ||
504 | |||
505 | tmp = (tmp % sample_rate) << 5; | ||
506 | ratio = (ratio << 5) + (tmp / sample_rate); | ||
507 | |||
508 | |||
509 | cx24123_writereg(state, 0x01, pll_mult * 6); | ||
418 | 510 | ||
419 | val = (srate / 1185) * 100; | 511 | cx24123_writereg(state, 0x08, (ratio >> 16) & 0x3f ); |
512 | cx24123_writereg(state, 0x09, (ratio >> 8) & 0xff ); | ||
513 | cx24123_writereg(state, 0x0a, (ratio ) & 0xff ); | ||
420 | 514 | ||
421 | /* Compensate for scaling up, by removing 17 symbols per 1Msps */ | 515 | /* also set the demodulator sample gain */ |
422 | val = val - (17 * (srate / 1000000)); | 516 | sample_gain = cx24123_int_log2(sample_rate, srate); |
517 | tmp = cx24123_readreg(state, 0x0c) & ~0xe0; | ||
518 | cx24123_writereg(state, 0x0c, tmp | sample_gain << 5); | ||
423 | 519 | ||
424 | cx24123_writereg(state, 0x08, (val >> 16) & 0xff ); | 520 | dprintk("%s: srate=%d, ratio=0x%08x, sample_rate=%i sample_gain=%d\n", __FUNCTION__, srate, ratio, sample_rate, sample_gain); |
425 | cx24123_writereg(state, 0x09, (val >> 8) & 0xff ); | ||
426 | cx24123_writereg(state, 0x0a, (val ) & 0xff ); | ||
427 | 521 | ||
428 | return 0; | 522 | return 0; |
429 | } | 523 | } |
@@ -437,6 +531,9 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
437 | struct cx24123_state *state = fe->demodulator_priv; | 531 | struct cx24123_state *state = fe->demodulator_priv; |
438 | u32 ndiv = 0, adiv = 0, vco_div = 0; | 532 | u32 ndiv = 0, adiv = 0, vco_div = 0; |
439 | int i = 0; | 533 | int i = 0; |
534 | int pump = 2; | ||
535 | int band = 0; | ||
536 | int num_bands = sizeof(cx24123_bandselect_vals) / sizeof(cx24123_bandselect_vals[0]); | ||
440 | 537 | ||
441 | /* Defaults for low freq, low rate */ | 538 | /* Defaults for low freq, low rate */ |
442 | state->VCAarg = cx24123_AGC_vals[0].VCAprogdata; | 539 | state->VCAarg = cx24123_AGC_vals[0].VCAprogdata; |
@@ -444,38 +541,49 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
444 | state->bandselectarg = cx24123_bandselect_vals[0].progdata; | 541 | state->bandselectarg = cx24123_bandselect_vals[0].progdata; |
445 | vco_div = cx24123_bandselect_vals[0].VCOdivider; | 542 | vco_div = cx24123_bandselect_vals[0].VCOdivider; |
446 | 543 | ||
447 | /* For the given symbolerate, determine the VCA and VGA programming bits */ | 544 | /* For the given symbol rate, determine the VCA, VGA and FILTUNE programming bits */ |
448 | for (i = 0; i < sizeof(cx24123_AGC_vals) / sizeof(cx24123_AGC_vals[0]); i++) | 545 | for (i = 0; i < sizeof(cx24123_AGC_vals) / sizeof(cx24123_AGC_vals[0]); i++) |
449 | { | 546 | { |
450 | if ((cx24123_AGC_vals[i].symbolrate_low <= p->u.qpsk.symbol_rate) && | 547 | if ((cx24123_AGC_vals[i].symbolrate_low <= p->u.qpsk.symbol_rate) && |
451 | (cx24123_AGC_vals[i].symbolrate_high >= p->u.qpsk.symbol_rate) ) { | 548 | (cx24123_AGC_vals[i].symbolrate_high >= p->u.qpsk.symbol_rate) ) { |
452 | state->VCAarg = cx24123_AGC_vals[i].VCAprogdata; | 549 | state->VCAarg = cx24123_AGC_vals[i].VCAprogdata; |
453 | state->VGAarg = cx24123_AGC_vals[i].VGAprogdata; | 550 | state->VGAarg = cx24123_AGC_vals[i].VGAprogdata; |
551 | state->FILTune = cx24123_AGC_vals[i].FILTune; | ||
454 | } | 552 | } |
455 | } | 553 | } |
456 | 554 | ||
457 | /* For the given frequency, determine the bandselect programming bits */ | 555 | /* determine the band to use */ |
458 | for (i = 0; i < sizeof(cx24123_bandselect_vals) / sizeof(cx24123_bandselect_vals[0]); i++) | 556 | if(force_band < 1 || force_band > num_bands) |
459 | { | 557 | { |
460 | if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) && | 558 | for (i = 0; i < num_bands; i++) |
461 | (cx24123_bandselect_vals[i].freq_high >= p->frequency) ) { | 559 | { |
462 | state->bandselectarg = cx24123_bandselect_vals[i].progdata; | 560 | if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) && |
463 | vco_div = cx24123_bandselect_vals[i].VCOdivider; | 561 | (cx24123_bandselect_vals[i].freq_high >= p->frequency) ) |
562 | band = i; | ||
464 | } | 563 | } |
465 | } | 564 | } |
565 | else | ||
566 | band = force_band - 1; | ||
567 | |||
568 | state->bandselectarg = cx24123_bandselect_vals[band].progdata; | ||
569 | vco_div = cx24123_bandselect_vals[band].VCOdivider; | ||
570 | |||
571 | /* determine the charge pump current */ | ||
572 | if ( p->frequency < (cx24123_bandselect_vals[band].freq_low + cx24123_bandselect_vals[band].freq_high)/2 ) | ||
573 | pump = 0x01; | ||
574 | else | ||
575 | pump = 0x02; | ||
466 | 576 | ||
467 | /* Determine the N/A dividers for the requested lband freq (in kHz). */ | 577 | /* Determine the N/A dividers for the requested lband freq (in kHz). */ |
468 | /* Note: 10111 (kHz) is the Crystal Freq and divider of 10. */ | 578 | /* Note: the reference divider R=10, frequency is in KHz, XTAL is in Hz */ |
469 | ndiv = ( ((p->frequency * vco_div) / (10111 / 10) / 2) / 32) & 0x1ff; | 579 | ndiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) / 32) & 0x1ff; |
470 | adiv = ( ((p->frequency * vco_div) / (10111 / 10) / 2) % 32) & 0x1f; | 580 | adiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) % 32) & 0x1f; |
471 | 581 | ||
472 | if (adiv == 0) | 582 | if (adiv == 0) |
473 | adiv++; | 583 | ndiv++; |
474 | 584 | ||
475 | /* determine the correct pll frequency values. */ | 585 | /* control bits 11, refdiv 11, charge pump polarity 1, charge pump current, ndiv, adiv */ |
476 | /* Command 11, refdiv 11, cpump polarity 1, cpump current 3mA 10. */ | 586 | state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (pump << 14) | (ndiv << 5) | adiv; |
477 | state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (2 << 14); | ||
478 | state->pllarg |= (ndiv << 5) | adiv; | ||
479 | 587 | ||
480 | return 0; | 588 | return 0; |
481 | } | 589 | } |
@@ -489,6 +597,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par | |||
489 | struct cx24123_state *state = fe->demodulator_priv; | 597 | struct cx24123_state *state = fe->demodulator_priv; |
490 | unsigned long timeout; | 598 | unsigned long timeout; |
491 | 599 | ||
600 | dprintk("%s: pll writereg called, data=0x%08x\n",__FUNCTION__,data); | ||
601 | |||
492 | /* align the 21 bytes into to bit23 boundary */ | 602 | /* align the 21 bytes into to bit23 boundary */ |
493 | data = data << 3; | 603 | data = data << 3; |
494 | 604 | ||
@@ -538,6 +648,9 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par | |||
538 | static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 648 | static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
539 | { | 649 | { |
540 | struct cx24123_state *state = fe->demodulator_priv; | 650 | struct cx24123_state *state = fe->demodulator_priv; |
651 | u8 val; | ||
652 | |||
653 | dprintk("frequency=%i\n", p->frequency); | ||
541 | 654 | ||
542 | if (cx24123_pll_calculate(fe, p) != 0) { | 655 | if (cx24123_pll_calculate(fe, p) != 0) { |
543 | printk("%s: cx24123_pll_calcutate failed\n",__FUNCTION__); | 656 | printk("%s: cx24123_pll_calcutate failed\n",__FUNCTION__); |
@@ -552,6 +665,14 @@ static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
552 | cx24123_pll_writereg(fe, p, state->bandselectarg); | 665 | cx24123_pll_writereg(fe, p, state->bandselectarg); |
553 | cx24123_pll_writereg(fe, p, state->pllarg); | 666 | cx24123_pll_writereg(fe, p, state->pllarg); |
554 | 667 | ||
668 | /* set the FILTUNE voltage */ | ||
669 | val = cx24123_readreg(state, 0x28) & ~0x3; | ||
670 | cx24123_writereg(state, 0x27, state->FILTune >> 2); | ||
671 | cx24123_writereg(state, 0x28, val | (state->FILTune & 0x3)); | ||
672 | |||
673 | dprintk("%s: pll tune VCA=%d, band=%d, pll=%d\n",__FUNCTION__,state->VCAarg, | ||
674 | state->bandselectarg,state->pllarg); | ||
675 | |||
555 | return 0; | 676 | return 0; |
556 | } | 677 | } |
557 | 678 | ||
@@ -560,6 +681,8 @@ static int cx24123_initfe(struct dvb_frontend* fe) | |||
560 | struct cx24123_state *state = fe->demodulator_priv; | 681 | struct cx24123_state *state = fe->demodulator_priv; |
561 | int i; | 682 | int i; |
562 | 683 | ||
684 | dprintk("%s: init frontend\n",__FUNCTION__); | ||
685 | |||
563 | /* Configure the demod to a good set of defaults */ | 686 | /* Configure the demod to a good set of defaults */ |
564 | for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++) | 687 | for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++) |
565 | cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data); | 688 | cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data); |
@@ -587,10 +710,13 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage | |||
587 | 710 | ||
588 | switch (voltage) { | 711 | switch (voltage) { |
589 | case SEC_VOLTAGE_13: | 712 | case SEC_VOLTAGE_13: |
713 | dprintk("%s: isl6421 voltage = 13V\n",__FUNCTION__); | ||
590 | return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */ | 714 | return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */ |
591 | case SEC_VOLTAGE_18: | 715 | case SEC_VOLTAGE_18: |
716 | dprintk("%s: isl6421 voltage = 18V\n",__FUNCTION__); | ||
592 | return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */ | 717 | return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */ |
593 | case SEC_VOLTAGE_OFF: | 718 | case SEC_VOLTAGE_OFF: |
719 | dprintk("%s: isl5421 voltage off\n",__FUNCTION__); | ||
594 | return cx24123_writelnbreg(state, 0x0, val & 0x30); | 720 | return cx24123_writelnbreg(state, 0x0, val & 0x30); |
595 | default: | 721 | default: |
596 | return -EINVAL; | 722 | return -EINVAL; |
@@ -624,13 +750,93 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage | |||
624 | return 0; | 750 | return 0; |
625 | } | 751 | } |
626 | 752 | ||
627 | static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, | 753 | /* wait for diseqc queue to become ready (or timeout) */ |
628 | struct dvb_diseqc_master_cmd *cmd) | 754 | static void cx24123_wait_for_diseqc(struct cx24123_state *state) |
755 | { | ||
756 | unsigned long timeout = jiffies + msecs_to_jiffies(200); | ||
757 | while (!(cx24123_readreg(state, 0x29) & 0x40)) { | ||
758 | if(time_after(jiffies, timeout)) { | ||
759 | printk("%s: diseqc queue not ready, command may be lost.\n", __FUNCTION__); | ||
760 | break; | ||
761 | } | ||
762 | msleep(10); | ||
763 | } | ||
764 | } | ||
765 | |||
766 | static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) | ||
629 | { | 767 | { |
630 | /* fixme: Implement diseqc */ | 768 | struct cx24123_state *state = fe->demodulator_priv; |
631 | printk("%s: No support yet\n",__FUNCTION__); | 769 | int i, val; |
770 | |||
771 | dprintk("%s:\n",__FUNCTION__); | ||
772 | |||
773 | /* check if continuous tone has been stopped */ | ||
774 | if (state->config->use_isl6421) | ||
775 | val = cx24123_readlnbreg(state, 0x00) & 0x10; | ||
776 | else | ||
777 | val = cx24123_readreg(state, 0x29) & 0x10; | ||
632 | 778 | ||
633 | return -ENOTSUPP; | 779 | |
780 | if (val) { | ||
781 | printk("%s: ERROR: attempt to send diseqc command before tone is off\n", __FUNCTION__); | ||
782 | return -ENOTSUPP; | ||
783 | } | ||
784 | |||
785 | /* wait for diseqc queue ready */ | ||
786 | cx24123_wait_for_diseqc(state); | ||
787 | |||
788 | /* select tone mode */ | ||
789 | cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xf8); | ||
790 | |||
791 | for (i = 0; i < cmd->msg_len; i++) | ||
792 | cx24123_writereg(state, 0x2C + i, cmd->msg[i]); | ||
793 | |||
794 | val = cx24123_readreg(state, 0x29); | ||
795 | cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | ((cmd->msg_len-3) & 3)); | ||
796 | |||
797 | /* wait for diseqc message to finish sending */ | ||
798 | cx24123_wait_for_diseqc(state); | ||
799 | |||
800 | return 0; | ||
801 | } | ||
802 | |||
803 | static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) | ||
804 | { | ||
805 | struct cx24123_state *state = fe->demodulator_priv; | ||
806 | int val; | ||
807 | |||
808 | dprintk("%s:\n", __FUNCTION__); | ||
809 | |||
810 | /* check if continuous tone has been stoped */ | ||
811 | if (state->config->use_isl6421) | ||
812 | val = cx24123_readlnbreg(state, 0x00) & 0x10; | ||
813 | else | ||
814 | val = cx24123_readreg(state, 0x29) & 0x10; | ||
815 | |||
816 | |||
817 | if (val) { | ||
818 | printk("%s: ERROR: attempt to send diseqc command before tone is off\n", __FUNCTION__); | ||
819 | return -ENOTSUPP; | ||
820 | } | ||
821 | |||
822 | cx24123_wait_for_diseqc(state); | ||
823 | |||
824 | /* select tone mode */ | ||
825 | val = cx24123_readreg(state, 0x2a) & 0xf8; | ||
826 | cx24123_writereg(state, 0x2a, val | 0x04); | ||
827 | |||
828 | val = cx24123_readreg(state, 0x29); | ||
829 | |||
830 | if (burst == SEC_MINI_A) | ||
831 | cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40 | 0x00)); | ||
832 | else if (burst == SEC_MINI_B) | ||
833 | cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40 | 0x08)); | ||
834 | else | ||
835 | return -EINVAL; | ||
836 | |||
837 | cx24123_wait_for_diseqc(state); | ||
838 | |||
839 | return 0; | ||
634 | } | 840 | } |
635 | 841 | ||
636 | static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) | 842 | static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) |
@@ -642,13 +848,15 @@ static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
642 | 848 | ||
643 | *status = 0; | 849 | *status = 0; |
644 | if (lock & 0x01) | 850 | if (lock & 0x01) |
645 | *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL; | 851 | *status |= FE_HAS_SIGNAL; |
852 | if (sync & 0x02) | ||
853 | *status |= FE_HAS_CARRIER; | ||
646 | if (sync & 0x04) | 854 | if (sync & 0x04) |
647 | *status |= FE_HAS_VITERBI; | 855 | *status |= FE_HAS_VITERBI; |
648 | if (sync & 0x08) | 856 | if (sync & 0x08) |
649 | *status |= FE_HAS_CARRIER; | 857 | *status |= FE_HAS_SYNC; |
650 | if (sync & 0x80) | 858 | if (sync & 0x80) |
651 | *status |= FE_HAS_SYNC | FE_HAS_LOCK; | 859 | *status |= FE_HAS_LOCK; |
652 | 860 | ||
653 | return 0; | 861 | return 0; |
654 | } | 862 | } |
@@ -681,6 +889,8 @@ static int cx24123_read_ber(struct dvb_frontend* fe, u32* ber) | |||
681 | else | 889 | else |
682 | state->snr = 0; | 890 | state->snr = 0; |
683 | 891 | ||
892 | dprintk("%s: BER = %d, S/N index = %d\n",__FUNCTION__,state->lastber, state->snr); | ||
893 | |||
684 | *ber = state->lastber; | 894 | *ber = state->lastber; |
685 | 895 | ||
686 | return 0; | 896 | return 0; |
@@ -691,6 +901,8 @@ static int cx24123_read_signal_strength(struct dvb_frontend* fe, u16* signal_str | |||
691 | struct cx24123_state *state = fe->demodulator_priv; | 901 | struct cx24123_state *state = fe->demodulator_priv; |
692 | *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ | 902 | *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ |
693 | 903 | ||
904 | dprintk("%s: Signal strength = %d\n",__FUNCTION__,*signal_strength); | ||
905 | |||
694 | return 0; | 906 | return 0; |
695 | } | 907 | } |
696 | 908 | ||
@@ -699,6 +911,8 @@ static int cx24123_read_snr(struct dvb_frontend* fe, u16* snr) | |||
699 | struct cx24123_state *state = fe->demodulator_priv; | 911 | struct cx24123_state *state = fe->demodulator_priv; |
700 | *snr = state->snr; | 912 | *snr = state->snr; |
701 | 913 | ||
914 | dprintk("%s: read S/N index = %d\n",__FUNCTION__,*snr); | ||
915 | |||
702 | return 0; | 916 | return 0; |
703 | } | 917 | } |
704 | 918 | ||
@@ -707,6 +921,8 @@ static int cx24123_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
707 | struct cx24123_state *state = fe->demodulator_priv; | 921 | struct cx24123_state *state = fe->demodulator_priv; |
708 | *ucblocks = state->lastber; | 922 | *ucblocks = state->lastber; |
709 | 923 | ||
924 | dprintk("%s: ucblocks (ber) = %d\n",__FUNCTION__,*ucblocks); | ||
925 | |||
710 | return 0; | 926 | return 0; |
711 | } | 927 | } |
712 | 928 | ||
@@ -714,6 +930,8 @@ static int cx24123_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
714 | { | 930 | { |
715 | struct cx24123_state *state = fe->demodulator_priv; | 931 | struct cx24123_state *state = fe->demodulator_priv; |
716 | 932 | ||
933 | dprintk("%s: set_frontend\n",__FUNCTION__); | ||
934 | |||
717 | if (state->config->set_ts_params) | 935 | if (state->config->set_ts_params) |
718 | state->config->set_ts_params(fe, 0); | 936 | state->config->set_ts_params(fe, 0); |
719 | 937 | ||
@@ -737,6 +955,8 @@ static int cx24123_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
737 | { | 955 | { |
738 | struct cx24123_state *state = fe->demodulator_priv; | 956 | struct cx24123_state *state = fe->demodulator_priv; |
739 | 957 | ||
958 | dprintk("%s: get_frontend\n",__FUNCTION__); | ||
959 | |||
740 | if (cx24123_get_inversion(state, &p->inversion) != 0) { | 960 | if (cx24123_get_inversion(state, &p->inversion) != 0) { |
741 | printk("%s: Failed to get inversion status\n",__FUNCTION__); | 961 | printk("%s: Failed to get inversion status\n",__FUNCTION__); |
742 | return -EREMOTEIO; | 962 | return -EREMOTEIO; |
@@ -763,8 +983,10 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
763 | 983 | ||
764 | switch (tone) { | 984 | switch (tone) { |
765 | case SEC_TONE_ON: | 985 | case SEC_TONE_ON: |
986 | dprintk("%s: isl6421 sec tone on\n",__FUNCTION__); | ||
766 | return cx24123_writelnbreg(state, 0x0, val | 0x10); | 987 | return cx24123_writelnbreg(state, 0x0, val | 0x10); |
767 | case SEC_TONE_OFF: | 988 | case SEC_TONE_OFF: |
989 | dprintk("%s: isl6421 sec tone off\n",__FUNCTION__); | ||
768 | return cx24123_writelnbreg(state, 0x0, val & 0x2f); | 990 | return cx24123_writelnbreg(state, 0x0, val & 0x2f); |
769 | default: | 991 | default: |
770 | printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); | 992 | printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); |
@@ -855,12 +1077,13 @@ static struct dvb_frontend_ops cx24123_ops = { | |||
855 | .frequency_min = 950000, | 1077 | .frequency_min = 950000, |
856 | .frequency_max = 2150000, | 1078 | .frequency_max = 2150000, |
857 | .frequency_stepsize = 1011, /* kHz for QPSK frontends */ | 1079 | .frequency_stepsize = 1011, /* kHz for QPSK frontends */ |
858 | .frequency_tolerance = 29500, | 1080 | .frequency_tolerance = 5000, |
859 | .symbol_rate_min = 1000000, | 1081 | .symbol_rate_min = 1000000, |
860 | .symbol_rate_max = 45000000, | 1082 | .symbol_rate_max = 45000000, |
861 | .caps = FE_CAN_INVERSION_AUTO | | 1083 | .caps = FE_CAN_INVERSION_AUTO | |
862 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | 1084 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | |
863 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | 1085 | FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | |
1086 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
864 | FE_CAN_QPSK | FE_CAN_RECOVER | 1087 | FE_CAN_QPSK | FE_CAN_RECOVER |
865 | }, | 1088 | }, |
866 | 1089 | ||
@@ -875,12 +1098,16 @@ static struct dvb_frontend_ops cx24123_ops = { | |||
875 | .read_snr = cx24123_read_snr, | 1098 | .read_snr = cx24123_read_snr, |
876 | .read_ucblocks = cx24123_read_ucblocks, | 1099 | .read_ucblocks = cx24123_read_ucblocks, |
877 | .diseqc_send_master_cmd = cx24123_send_diseqc_msg, | 1100 | .diseqc_send_master_cmd = cx24123_send_diseqc_msg, |
1101 | .diseqc_send_burst = cx24123_diseqc_send_burst, | ||
878 | .set_tone = cx24123_set_tone, | 1102 | .set_tone = cx24123_set_tone, |
879 | .set_voltage = cx24123_set_voltage, | 1103 | .set_voltage = cx24123_set_voltage, |
880 | }; | 1104 | }; |
881 | 1105 | ||
882 | module_param(debug, int, 0644); | 1106 | module_param(debug, int, 0644); |
883 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | 1107 | MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); |
1108 | |||
1109 | module_param(force_band, int, 0644); | ||
1110 | MODULE_PARM_DESC(force_band, "Force a specific band select (1-9, default:off)."); | ||
884 | 1111 | ||
885 | MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware"); | 1112 | MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware"); |
886 | MODULE_AUTHOR("Steven Toth"); | 1113 | MODULE_AUTHOR("Steven Toth"); |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index b6e2c387a04c..791706ec1da3 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -235,8 +235,8 @@ struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { | |||
235 | .max = 863000000, | 235 | .max = 863000000, |
236 | .count = 3, | 236 | .count = 3, |
237 | .entries = { | 237 | .entries = { |
238 | { 160000000, 44000000, 62500, 0xce, 0x01 }, | 238 | { 165000000, 44000000, 62500, 0xce, 0x01 }, |
239 | { 455000000, 44000000, 62500, 0xce, 0x02 }, | 239 | { 450000000, 44000000, 62500, 0xce, 0x02 }, |
240 | { 999999999, 44000000, 62500, 0xce, 0x04 }, | 240 | { 999999999, 44000000, 62500, 0xce, 0x04 }, |
241 | }, | 241 | }, |
242 | }; | 242 | }; |
diff --git a/drivers/media/dvb/pluto2/Kconfig b/drivers/media/dvb/pluto2/Kconfig index 84f8f9f52869..7d8e6e87bdbb 100644 --- a/drivers/media/dvb/pluto2/Kconfig +++ b/drivers/media/dvb/pluto2/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | config DVB_PLUTO2 | 1 | config DVB_PLUTO2 |
2 | tristate "Pluto2 cards" | 2 | tristate "Pluto2 cards" |
3 | depends on DVB_CORE && PCI | 3 | depends on DVB_CORE && PCI && I2C |
4 | select I2C | ||
5 | select I2C_ALGOBIT | 4 | select I2C_ALGOBIT |
6 | select DVB_TDA1004X | 5 | select DVB_TDA1004X |
7 | help | 6 | help |
diff --git a/drivers/media/dvb/pluto2/Makefile b/drivers/media/dvb/pluto2/Makefile index 86ca84b2be6e..ce6a9aaf937e 100644 --- a/drivers/media/dvb/pluto2/Makefile +++ b/drivers/media/dvb/pluto2/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | obj-$(CONFIG_DVB_PLUTO2) = pluto2.o | 1 | obj-$(CONFIG_DVB_PLUTO2) += pluto2.o |
2 | 2 | ||
3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index 5b2aadb8385c..b5ac7dfde52f 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig | |||
@@ -1,8 +1,7 @@ | |||
1 | config DVB_AV7110 | 1 | config DVB_AV7110 |
2 | tristate "AV7110 cards" | 2 | tristate "AV7110 cards" |
3 | depends on DVB_CORE && PCI | 3 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 |
4 | select FW_LOADER | 4 | select FW_LOADER |
5 | select VIDEO_DEV | ||
6 | select VIDEO_SAA7146_VV | 5 | select VIDEO_SAA7146_VV |
7 | select DVB_VES1820 | 6 | select DVB_VES1820 |
8 | select DVB_VES1X93 | 7 | select DVB_VES1X93 |
@@ -59,7 +58,7 @@ config DVB_AV7110_OSD | |||
59 | 58 | ||
60 | config DVB_BUDGET | 59 | config DVB_BUDGET |
61 | tristate "Budget cards" | 60 | tristate "Budget cards" |
62 | depends on DVB_CORE && PCI | 61 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 |
63 | select VIDEO_SAA7146 | 62 | select VIDEO_SAA7146 |
64 | select DVB_STV0299 | 63 | select DVB_STV0299 |
65 | select DVB_VES1X93 | 64 | select DVB_VES1X93 |
@@ -80,7 +79,7 @@ config DVB_BUDGET | |||
80 | 79 | ||
81 | config DVB_BUDGET_CI | 80 | config DVB_BUDGET_CI |
82 | tristate "Budget cards with onboard CI connector" | 81 | tristate "Budget cards with onboard CI connector" |
83 | depends on DVB_CORE && PCI | 82 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 |
84 | select VIDEO_SAA7146 | 83 | select VIDEO_SAA7146 |
85 | select DVB_STV0297 | 84 | select DVB_STV0297 |
86 | select DVB_STV0299 | 85 | select DVB_STV0299 |
@@ -100,8 +99,7 @@ config DVB_BUDGET_CI | |||
100 | 99 | ||
101 | config DVB_BUDGET_AV | 100 | config DVB_BUDGET_AV |
102 | tristate "Budget cards with analog video inputs" | 101 | tristate "Budget cards with analog video inputs" |
103 | depends on DVB_CORE && PCI | 102 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 |
104 | select VIDEO_DEV | ||
105 | select VIDEO_SAA7146_VV | 103 | select VIDEO_SAA7146_VV |
106 | select DVB_STV0299 | 104 | select DVB_STV0299 |
107 | select DVB_TDA1004X | 105 | select DVB_TDA1004X |
@@ -119,7 +117,7 @@ config DVB_BUDGET_AV | |||
119 | 117 | ||
120 | config DVB_BUDGET_PATCH | 118 | config DVB_BUDGET_PATCH |
121 | tristate "AV7110 cards with Budget Patch" | 119 | tristate "AV7110 cards with Budget Patch" |
122 | depends on DVB_CORE && DVB_BUDGET | 120 | depends on DVB_CORE && DVB_BUDGET && VIDEO_V4L1 |
123 | select DVB_AV7110 | 121 | select DVB_AV7110 |
124 | select DVB_STV0299 | 122 | select DVB_STV0299 |
125 | select DVB_VES1X93 | 123 | select DVB_VES1X93 |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 8efe3ce5f66c..8a7cd7d505cf 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -1190,8 +1190,6 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1190 | SAA7146_HPS_SYNC_PORT_A); | 1190 | SAA7146_HPS_SYNC_PORT_A); |
1191 | 1191 | ||
1192 | saa7113_setinput(budget_av, 0); | 1192 | saa7113_setinput(budget_av, 0); |
1193 | } else { | ||
1194 | ciintf_init(budget_av); | ||
1195 | } | 1193 | } |
1196 | 1194 | ||
1197 | /* fixme: find some sane values here... */ | 1195 | /* fixme: find some sane values here... */ |
@@ -1211,6 +1209,10 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1211 | budget_av->budget.dvb_adapter.priv = budget_av; | 1209 | budget_av->budget.dvb_adapter.priv = budget_av; |
1212 | frontend_init(budget_av); | 1210 | frontend_init(budget_av); |
1213 | 1211 | ||
1212 | if (!budget_av->has_saa7113) { | ||
1213 | ciintf_init(budget_av); | ||
1214 | } | ||
1215 | |||
1214 | return 0; | 1216 | return 0; |
1215 | } | 1217 | } |
1216 | 1218 | ||
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 5f91036f5b87..e64a609cf4ff 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -71,6 +71,7 @@ struct budget_ci { | |||
71 | struct tasklet_struct msp430_irq_tasklet; | 71 | struct tasklet_struct msp430_irq_tasklet; |
72 | struct tasklet_struct ciintf_irq_tasklet; | 72 | struct tasklet_struct ciintf_irq_tasklet; |
73 | int slot_status; | 73 | int slot_status; |
74 | int ci_irq; | ||
74 | struct dvb_ca_en50221 ca; | 75 | struct dvb_ca_en50221 ca; |
75 | char ir_dev_name[50]; | 76 | char ir_dev_name[50]; |
76 | u8 tuner_pll_address; /* used for philips_tdm1316l configs */ | 77 | u8 tuner_pll_address; /* used for philips_tdm1316l configs */ |
@@ -276,8 +277,10 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot) | |||
276 | if (slot != 0) | 277 | if (slot != 0) |
277 | return -EINVAL; | 278 | return -EINVAL; |
278 | 279 | ||
279 | // trigger on RISING edge during reset so we know when READY is re-asserted | 280 | if (budget_ci->ci_irq) { |
280 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); | 281 | // trigger on RISING edge during reset so we know when READY is re-asserted |
282 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); | ||
283 | } | ||
281 | budget_ci->slot_status = SLOTSTATUS_RESET; | 284 | budget_ci->slot_status = SLOTSTATUS_RESET; |
282 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); | 285 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); |
283 | msleep(1); | 286 | msleep(1); |
@@ -370,11 +373,50 @@ static void ciintf_interrupt(unsigned long data) | |||
370 | } | 373 | } |
371 | } | 374 | } |
372 | 375 | ||
376 | static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open) | ||
377 | { | ||
378 | struct budget_ci *budget_ci = (struct budget_ci *) ca->data; | ||
379 | unsigned int flags; | ||
380 | |||
381 | // ensure we don't get spurious IRQs during initialisation | ||
382 | if (!budget_ci->budget.ci_present) | ||
383 | return -EINVAL; | ||
384 | |||
385 | // read the CAM status | ||
386 | flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); | ||
387 | if (flags & CICONTROL_CAMDETECT) { | ||
388 | // mark it as present if it wasn't before | ||
389 | if (budget_ci->slot_status & SLOTSTATUS_NONE) { | ||
390 | budget_ci->slot_status = SLOTSTATUS_PRESENT; | ||
391 | } | ||
392 | |||
393 | // during a RESET, we check if we can read from IO memory to see when CAM is ready | ||
394 | if (budget_ci->slot_status & SLOTSTATUS_RESET) { | ||
395 | if (ciintf_read_attribute_mem(ca, slot, 0) == 0x1d) { | ||
396 | budget_ci->slot_status = SLOTSTATUS_READY; | ||
397 | } | ||
398 | } | ||
399 | } else { | ||
400 | budget_ci->slot_status = SLOTSTATUS_NONE; | ||
401 | } | ||
402 | |||
403 | if (budget_ci->slot_status != SLOTSTATUS_NONE) { | ||
404 | if (budget_ci->slot_status & SLOTSTATUS_READY) { | ||
405 | return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY; | ||
406 | } | ||
407 | return DVB_CA_EN50221_POLL_CAM_PRESENT; | ||
408 | } | ||
409 | |||
410 | return 0; | ||
411 | } | ||
412 | |||
373 | static int ciintf_init(struct budget_ci *budget_ci) | 413 | static int ciintf_init(struct budget_ci *budget_ci) |
374 | { | 414 | { |
375 | struct saa7146_dev *saa = budget_ci->budget.dev; | 415 | struct saa7146_dev *saa = budget_ci->budget.dev; |
376 | int flags; | 416 | int flags; |
377 | int result; | 417 | int result; |
418 | int ci_version; | ||
419 | int ca_flags; | ||
378 | 420 | ||
379 | memset(&budget_ci->ca, 0, sizeof(struct dvb_ca_en50221)); | 421 | memset(&budget_ci->ca, 0, sizeof(struct dvb_ca_en50221)); |
380 | 422 | ||
@@ -382,16 +424,29 @@ static int ciintf_init(struct budget_ci *budget_ci) | |||
382 | saa7146_write(saa, MC1, saa7146_read(saa, MC1) | (0x800 << 16) | 0x800); | 424 | saa7146_write(saa, MC1, saa7146_read(saa, MC1) | (0x800 << 16) | 0x800); |
383 | 425 | ||
384 | // test if it is there | 426 | // test if it is there |
385 | if ((ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CIVERSION, 1, 1, 0) & 0xa0) != 0xa0) { | 427 | ci_version = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CIVERSION, 1, 1, 0); |
428 | if ((ci_version & 0xa0) != 0xa0) { | ||
386 | result = -ENODEV; | 429 | result = -ENODEV; |
387 | goto error; | 430 | goto error; |
388 | } | 431 | } |
432 | |||
389 | // determine whether a CAM is present or not | 433 | // determine whether a CAM is present or not |
390 | flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); | 434 | flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); |
391 | budget_ci->slot_status = SLOTSTATUS_NONE; | 435 | budget_ci->slot_status = SLOTSTATUS_NONE; |
392 | if (flags & CICONTROL_CAMDETECT) | 436 | if (flags & CICONTROL_CAMDETECT) |
393 | budget_ci->slot_status = SLOTSTATUS_PRESENT; | 437 | budget_ci->slot_status = SLOTSTATUS_PRESENT; |
394 | 438 | ||
439 | // version 0xa2 of the CI firmware doesn't generate interrupts | ||
440 | if (ci_version == 0xa2) { | ||
441 | ca_flags = 0; | ||
442 | budget_ci->ci_irq = 0; | ||
443 | } else { | ||
444 | ca_flags = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE | | ||
445 | DVB_CA_EN50221_FLAG_IRQ_FR | | ||
446 | DVB_CA_EN50221_FLAG_IRQ_DA; | ||
447 | budget_ci->ci_irq = 1; | ||
448 | } | ||
449 | |||
395 | // register CI interface | 450 | // register CI interface |
396 | budget_ci->ca.owner = THIS_MODULE; | 451 | budget_ci->ca.owner = THIS_MODULE; |
397 | budget_ci->ca.read_attribute_mem = ciintf_read_attribute_mem; | 452 | budget_ci->ca.read_attribute_mem = ciintf_read_attribute_mem; |
@@ -401,23 +456,27 @@ static int ciintf_init(struct budget_ci *budget_ci) | |||
401 | budget_ci->ca.slot_reset = ciintf_slot_reset; | 456 | budget_ci->ca.slot_reset = ciintf_slot_reset; |
402 | budget_ci->ca.slot_shutdown = ciintf_slot_shutdown; | 457 | budget_ci->ca.slot_shutdown = ciintf_slot_shutdown; |
403 | budget_ci->ca.slot_ts_enable = ciintf_slot_ts_enable; | 458 | budget_ci->ca.slot_ts_enable = ciintf_slot_ts_enable; |
459 | budget_ci->ca.poll_slot_status = ciintf_poll_slot_status; | ||
404 | budget_ci->ca.data = budget_ci; | 460 | budget_ci->ca.data = budget_ci; |
405 | if ((result = dvb_ca_en50221_init(&budget_ci->budget.dvb_adapter, | 461 | if ((result = dvb_ca_en50221_init(&budget_ci->budget.dvb_adapter, |
406 | &budget_ci->ca, | 462 | &budget_ci->ca, |
407 | DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE | | 463 | ca_flags, 1)) != 0) { |
408 | DVB_CA_EN50221_FLAG_IRQ_FR | | ||
409 | DVB_CA_EN50221_FLAG_IRQ_DA, 1)) != 0) { | ||
410 | printk("budget_ci: CI interface detected, but initialisation failed.\n"); | 464 | printk("budget_ci: CI interface detected, but initialisation failed.\n"); |
411 | goto error; | 465 | goto error; |
412 | } | 466 | } |
467 | |||
413 | // Setup CI slot IRQ | 468 | // Setup CI slot IRQ |
414 | tasklet_init(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci); | 469 | if (budget_ci->ci_irq) { |
415 | if (budget_ci->slot_status != SLOTSTATUS_NONE) { | 470 | tasklet_init(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci); |
416 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO); | 471 | if (budget_ci->slot_status != SLOTSTATUS_NONE) { |
417 | } else { | 472 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO); |
418 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); | 473 | } else { |
474 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); | ||
475 | } | ||
476 | saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_03); | ||
419 | } | 477 | } |
420 | saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_03); | 478 | |
479 | // enable interface | ||
421 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, | 480 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, |
422 | CICONTROL_RESET, 1, 0); | 481 | CICONTROL_RESET, 1, 0); |
423 | 482 | ||
@@ -426,10 +485,12 @@ static int ciintf_init(struct budget_ci *budget_ci) | |||
426 | budget_ci->budget.ci_present = 1; | 485 | budget_ci->budget.ci_present = 1; |
427 | 486 | ||
428 | // forge a fake CI IRQ so the CAM state is setup correctly | 487 | // forge a fake CI IRQ so the CAM state is setup correctly |
429 | flags = DVB_CA_EN50221_CAMCHANGE_REMOVED; | 488 | if (budget_ci->ci_irq) { |
430 | if (budget_ci->slot_status != SLOTSTATUS_NONE) | 489 | flags = DVB_CA_EN50221_CAMCHANGE_REMOVED; |
431 | flags = DVB_CA_EN50221_CAMCHANGE_INSERTED; | 490 | if (budget_ci->slot_status != SLOTSTATUS_NONE) |
432 | dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, flags); | 491 | flags = DVB_CA_EN50221_CAMCHANGE_INSERTED; |
492 | dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, flags); | ||
493 | } | ||
433 | 494 | ||
434 | return 0; | 495 | return 0; |
435 | 496 | ||
@@ -443,9 +504,13 @@ static void ciintf_deinit(struct budget_ci *budget_ci) | |||
443 | struct saa7146_dev *saa = budget_ci->budget.dev; | 504 | struct saa7146_dev *saa = budget_ci->budget.dev; |
444 | 505 | ||
445 | // disable CI interrupts | 506 | // disable CI interrupts |
446 | saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_03); | 507 | if (budget_ci->ci_irq) { |
447 | saa7146_setgpio(saa, 0, SAA7146_GPIO_INPUT); | 508 | saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_03); |
448 | tasklet_kill(&budget_ci->ciintf_irq_tasklet); | 509 | saa7146_setgpio(saa, 0, SAA7146_GPIO_INPUT); |
510 | tasklet_kill(&budget_ci->ciintf_irq_tasklet); | ||
511 | } | ||
512 | |||
513 | // reset interface | ||
449 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); | 514 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); |
450 | msleep(1); | 515 | msleep(1); |
451 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, | 516 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, |
@@ -473,7 +538,7 @@ static void budget_ci_irq(struct saa7146_dev *dev, u32 * isr) | |||
473 | if (*isr & MASK_10) | 538 | if (*isr & MASK_10) |
474 | ttpci_budget_irq10_handler(dev, isr); | 539 | ttpci_budget_irq10_handler(dev, isr); |
475 | 540 | ||
476 | if ((*isr & MASK_03) && (budget_ci->budget.ci_present)) | 541 | if ((*isr & MASK_03) && (budget_ci->budget.ci_present) && (budget_ci->ci_irq)) |
477 | tasklet_schedule(&budget_ci->ciintf_irq_tasklet); | 542 | tasklet_schedule(&budget_ci->ciintf_irq_tasklet); |
478 | } | 543 | } |
479 | 544 | ||
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 248fdc7accfb..6ceae38125c7 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -1507,7 +1507,11 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1507 | 1507 | ||
1508 | mutex_unlock(&ttusb->semi2c); | 1508 | mutex_unlock(&ttusb->semi2c); |
1509 | 1509 | ||
1510 | dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE); | 1510 | if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE)) < 0) { |
1511 | ttusb_free_iso_urbs(ttusb); | ||
1512 | kfree(ttusb); | ||
1513 | return result; | ||
1514 | } | ||
1511 | ttusb->adapter.priv = ttusb; | 1515 | ttusb->adapter.priv = ttusb; |
1512 | 1516 | ||
1513 | /* i2c */ | 1517 | /* i2c */ |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index d318be383de6..3fff75763693 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -7,7 +7,7 @@ menu "Radio Adapters" | |||
7 | 7 | ||
8 | config RADIO_CADET | 8 | config RADIO_CADET |
9 | tristate "ADS Cadet AM/FM Tuner" | 9 | tristate "ADS Cadet AM/FM Tuner" |
10 | depends on ISA && VIDEO_DEV | 10 | depends on ISA && VIDEO_V4L1 |
11 | ---help--- | 11 | ---help--- |
12 | Choose Y here if you have one of these AM/FM radio cards, and then | 12 | Choose Y here if you have one of these AM/FM radio cards, and then |
13 | fill in the port address below. | 13 | fill in the port address below. |
@@ -25,7 +25,7 @@ config RADIO_CADET | |||
25 | 25 | ||
26 | config RADIO_RTRACK | 26 | config RADIO_RTRACK |
27 | tristate "AIMSlab RadioTrack (aka RadioReveal) support" | 27 | tristate "AIMSlab RadioTrack (aka RadioReveal) support" |
28 | depends on ISA && VIDEO_DEV | 28 | depends on ISA && VIDEO_V4L1 |
29 | ---help--- | 29 | ---help--- |
30 | Choose Y here if you have one of these FM radio cards, and then fill | 30 | Choose Y here if you have one of these FM radio cards, and then fill |
31 | in the port address below. | 31 | in the port address below. |
@@ -59,7 +59,7 @@ config RADIO_RTRACK_PORT | |||
59 | 59 | ||
60 | config RADIO_RTRACK2 | 60 | config RADIO_RTRACK2 |
61 | tristate "AIMSlab RadioTrack II support" | 61 | tristate "AIMSlab RadioTrack II support" |
62 | depends on ISA && VIDEO_DEV | 62 | depends on ISA && VIDEO_V4L1 |
63 | ---help--- | 63 | ---help--- |
64 | Choose Y here if you have this FM radio card, and then fill in the | 64 | Choose Y here if you have this FM radio card, and then fill in the |
65 | port address below. | 65 | port address below. |
@@ -82,7 +82,7 @@ config RADIO_RTRACK2_PORT | |||
82 | 82 | ||
83 | config RADIO_AZTECH | 83 | config RADIO_AZTECH |
84 | tristate "Aztech/Packard Bell Radio" | 84 | tristate "Aztech/Packard Bell Radio" |
85 | depends on ISA && VIDEO_DEV | 85 | depends on ISA && VIDEO_V4L1 |
86 | ---help--- | 86 | ---help--- |
87 | Choose Y here if you have one of these FM radio cards, and then fill | 87 | Choose Y here if you have one of these FM radio cards, and then fill |
88 | in the port address below. | 88 | in the port address below. |
@@ -106,7 +106,7 @@ config RADIO_AZTECH_PORT | |||
106 | 106 | ||
107 | config RADIO_GEMTEK | 107 | config RADIO_GEMTEK |
108 | tristate "GemTek Radio Card support" | 108 | tristate "GemTek Radio Card support" |
109 | depends on ISA && VIDEO_DEV | 109 | depends on ISA && VIDEO_V4L1 |
110 | ---help--- | 110 | ---help--- |
111 | Choose Y here if you have this FM radio card, and then fill in the | 111 | Choose Y here if you have this FM radio card, and then fill in the |
112 | port address below. | 112 | port address below. |
@@ -131,7 +131,7 @@ config RADIO_GEMTEK_PORT | |||
131 | 131 | ||
132 | config RADIO_GEMTEK_PCI | 132 | config RADIO_GEMTEK_PCI |
133 | tristate "GemTek PCI Radio Card support" | 133 | tristate "GemTek PCI Radio Card support" |
134 | depends on VIDEO_DEV && PCI | 134 | depends on VIDEO_V4L1 && PCI |
135 | ---help--- | 135 | ---help--- |
136 | Choose Y here if you have this PCI FM radio card. | 136 | Choose Y here if you have this PCI FM radio card. |
137 | 137 | ||
@@ -145,7 +145,7 @@ config RADIO_GEMTEK_PCI | |||
145 | 145 | ||
146 | config RADIO_MAXIRADIO | 146 | config RADIO_MAXIRADIO |
147 | tristate "Guillemot MAXI Radio FM 2000 radio" | 147 | tristate "Guillemot MAXI Radio FM 2000 radio" |
148 | depends on VIDEO_DEV && PCI | 148 | depends on VIDEO_V4L1 && PCI |
149 | ---help--- | 149 | ---help--- |
150 | Choose Y here if you have this radio card. This card may also be | 150 | Choose Y here if you have this radio card. This card may also be |
151 | found as Gemtek PCI FM. | 151 | found as Gemtek PCI FM. |
@@ -160,7 +160,7 @@ config RADIO_MAXIRADIO | |||
160 | 160 | ||
161 | config RADIO_MAESTRO | 161 | config RADIO_MAESTRO |
162 | tristate "Maestro on board radio" | 162 | tristate "Maestro on board radio" |
163 | depends on VIDEO_DEV | 163 | depends on VIDEO_V4L1 |
164 | ---help--- | 164 | ---help--- |
165 | Say Y here to directly support the on-board radio tuner on the | 165 | Say Y here to directly support the on-board radio tuner on the |
166 | Maestro 2 or 2E sound card. | 166 | Maestro 2 or 2E sound card. |
@@ -175,7 +175,7 @@ config RADIO_MAESTRO | |||
175 | 175 | ||
176 | config RADIO_MIROPCM20 | 176 | config RADIO_MIROPCM20 |
177 | tristate "miroSOUND PCM20 radio" | 177 | tristate "miroSOUND PCM20 radio" |
178 | depends on ISA && VIDEO_DEV && SOUND_ACI_MIXER | 178 | depends on ISA && VIDEO_V4L1 && SOUND_ACI_MIXER |
179 | ---help--- | 179 | ---help--- |
180 | Choose Y here if you have this FM radio card. You also need to say Y | 180 | Choose Y here if you have this FM radio card. You also need to say Y |
181 | to "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20 radio)" (in "Sound") | 181 | to "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20 radio)" (in "Sound") |
@@ -208,7 +208,7 @@ config RADIO_MIROPCM20_RDS | |||
208 | 208 | ||
209 | config RADIO_SF16FMI | 209 | config RADIO_SF16FMI |
210 | tristate "SF16FMI Radio" | 210 | tristate "SF16FMI Radio" |
211 | depends on ISA && VIDEO_DEV | 211 | depends on ISA && VIDEO_V4L1 |
212 | ---help--- | 212 | ---help--- |
213 | Choose Y here if you have one of these FM radio cards. If you | 213 | Choose Y here if you have one of these FM radio cards. If you |
214 | compile the driver into the kernel and your card is not PnP one, you | 214 | compile the driver into the kernel and your card is not PnP one, you |
@@ -225,7 +225,7 @@ config RADIO_SF16FMI | |||
225 | 225 | ||
226 | config RADIO_SF16FMR2 | 226 | config RADIO_SF16FMR2 |
227 | tristate "SF16FMR2 Radio" | 227 | tristate "SF16FMR2 Radio" |
228 | depends on ISA && VIDEO_DEV | 228 | depends on ISA && VIDEO_V4L1 |
229 | ---help--- | 229 | ---help--- |
230 | Choose Y here if you have one of these FM radio cards. | 230 | Choose Y here if you have one of these FM radio cards. |
231 | 231 | ||
@@ -239,7 +239,7 @@ config RADIO_SF16FMR2 | |||
239 | 239 | ||
240 | config RADIO_TERRATEC | 240 | config RADIO_TERRATEC |
241 | tristate "TerraTec ActiveRadio ISA Standalone" | 241 | tristate "TerraTec ActiveRadio ISA Standalone" |
242 | depends on ISA && VIDEO_DEV | 242 | depends on ISA && VIDEO_V4L1 |
243 | ---help--- | 243 | ---help--- |
244 | Choose Y here if you have this FM radio card, and then fill in the | 244 | Choose Y here if you have this FM radio card, and then fill in the |
245 | port address below. (TODO) | 245 | port address below. (TODO) |
@@ -268,7 +268,7 @@ config RADIO_TERRATEC_PORT | |||
268 | 268 | ||
269 | config RADIO_TRUST | 269 | config RADIO_TRUST |
270 | tristate "Trust FM radio card" | 270 | tristate "Trust FM radio card" |
271 | depends on ISA && VIDEO_DEV | 271 | depends on ISA && VIDEO_V4L1 |
272 | help | 272 | help |
273 | This is a driver for the Trust FM radio cards. Say Y if you have | 273 | This is a driver for the Trust FM radio cards. Say Y if you have |
274 | such a card and want to use it under Linux. | 274 | such a card and want to use it under Linux. |
@@ -286,7 +286,7 @@ config RADIO_TRUST_PORT | |||
286 | 286 | ||
287 | config RADIO_TYPHOON | 287 | config RADIO_TYPHOON |
288 | tristate "Typhoon Radio (a.k.a. EcoRadio)" | 288 | tristate "Typhoon Radio (a.k.a. EcoRadio)" |
289 | depends on ISA && VIDEO_DEV | 289 | depends on ISA && VIDEO_V4L1 |
290 | ---help--- | 290 | ---help--- |
291 | Choose Y here if you have one of these FM radio cards, and then fill | 291 | Choose Y here if you have one of these FM radio cards, and then fill |
292 | in the port address and the frequency used for muting below. | 292 | in the port address and the frequency used for muting below. |
@@ -330,7 +330,7 @@ config RADIO_TYPHOON_MUTEFREQ | |||
330 | 330 | ||
331 | config RADIO_ZOLTRIX | 331 | config RADIO_ZOLTRIX |
332 | tristate "Zoltrix Radio" | 332 | tristate "Zoltrix Radio" |
333 | depends on ISA && VIDEO_DEV | 333 | depends on ISA && VIDEO_V4L1 |
334 | ---help--- | 334 | ---help--- |
335 | Choose Y here if you have one of these FM radio cards, and then fill | 335 | Choose Y here if you have one of these FM radio cards, and then fill |
336 | in the port address below. | 336 | in the port address below. |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 85888a8a93c9..6b4197018561 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -2,10 +2,10 @@ | |||
2 | # Multimedia Video device configuration | 2 | # Multimedia Video device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menu "Video For Linux" | 5 | menu "Video Capture Adapters" |
6 | depends on VIDEO_DEV | 6 | depends on VIDEO_DEV |
7 | 7 | ||
8 | comment "Video Adapters" | 8 | comment "Video Capture Adapters" |
9 | 9 | ||
10 | config VIDEO_ADV_DEBUG | 10 | config VIDEO_ADV_DEBUG |
11 | bool "Enable advanced debug functionality" | 11 | bool "Enable advanced debug functionality" |
@@ -16,11 +16,23 @@ config VIDEO_ADV_DEBUG | |||
16 | V4L devices. | 16 | V4L devices. |
17 | In doubt, say N. | 17 | In doubt, say N. |
18 | 18 | ||
19 | config VIDEO_VIVI | ||
20 | tristate "Virtual Video Driver" | ||
21 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 | ||
22 | select VIDEO_BUF | ||
23 | default n | ||
24 | ---help--- | ||
25 | Enables a virtual video driver. This device shows a color bar | ||
26 | and a timestamp, as a real device would generate by using V4L2 | ||
27 | api. | ||
28 | Say Y here if you want to test video apps or debug V4L devices. | ||
29 | In doubt, say N. | ||
30 | |||
19 | source "drivers/media/video/bt8xx/Kconfig" | 31 | source "drivers/media/video/bt8xx/Kconfig" |
20 | 32 | ||
21 | config VIDEO_SAA6588 | 33 | config VIDEO_SAA6588 |
22 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" | 34 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" |
23 | depends on VIDEO_DEV && I2C && VIDEO_BT848 | 35 | depends on I2C && VIDEO_BT848 |
24 | 36 | ||
25 | help | 37 | help |
26 | Support for Radio Data System (RDS) decoder. This allows seeing | 38 | Support for Radio Data System (RDS) decoder. This allows seeing |
@@ -32,7 +44,7 @@ config VIDEO_SAA6588 | |||
32 | 44 | ||
33 | config VIDEO_PMS | 45 | config VIDEO_PMS |
34 | tristate "Mediavision Pro Movie Studio Video For Linux" | 46 | tristate "Mediavision Pro Movie Studio Video For Linux" |
35 | depends on VIDEO_DEV && ISA | 47 | depends on ISA && VIDEO_V4L1 |
36 | help | 48 | help |
37 | Say Y if you have such a thing. | 49 | Say Y if you have such a thing. |
38 | 50 | ||
@@ -41,7 +53,7 @@ config VIDEO_PMS | |||
41 | 53 | ||
42 | config VIDEO_PLANB | 54 | config VIDEO_PLANB |
43 | tristate "PlanB Video-In on PowerMac" | 55 | tristate "PlanB Video-In on PowerMac" |
44 | depends on PPC_PMAC && VIDEO_DEV && BROKEN | 56 | depends on PPC_PMAC && VIDEO_V4L1 && BROKEN |
45 | help | 57 | help |
46 | PlanB is the V4L driver for the PowerMac 7x00/8x00 series video | 58 | PlanB is the V4L driver for the PowerMac 7x00/8x00 series video |
47 | input hardware. If you want to experiment with this, say Y. | 59 | input hardware. If you want to experiment with this, say Y. |
@@ -52,7 +64,7 @@ config VIDEO_PLANB | |||
52 | 64 | ||
53 | config VIDEO_BWQCAM | 65 | config VIDEO_BWQCAM |
54 | tristate "Quickcam BW Video For Linux" | 66 | tristate "Quickcam BW Video For Linux" |
55 | depends on VIDEO_DEV && PARPORT | 67 | depends on PARPORT && VIDEO_V4L1 |
56 | help | 68 | help |
57 | Say Y have if you the black and white version of the QuickCam | 69 | Say Y have if you the black and white version of the QuickCam |
58 | camera. See the next option for the color version. | 70 | camera. See the next option for the color version. |
@@ -62,7 +74,7 @@ config VIDEO_BWQCAM | |||
62 | 74 | ||
63 | config VIDEO_CQCAM | 75 | config VIDEO_CQCAM |
64 | tristate "QuickCam Colour Video For Linux (EXPERIMENTAL)" | 76 | tristate "QuickCam Colour Video For Linux (EXPERIMENTAL)" |
65 | depends on EXPERIMENTAL && VIDEO_DEV && PARPORT | 77 | depends on EXPERIMENTAL && PARPORT && VIDEO_V4L1 |
66 | help | 78 | help |
67 | This is the video4linux driver for the colour version of the | 79 | This is the video4linux driver for the colour version of the |
68 | Connectix QuickCam. If you have one of these cameras, say Y here, | 80 | Connectix QuickCam. If you have one of these cameras, say Y here, |
@@ -73,7 +85,7 @@ config VIDEO_CQCAM | |||
73 | 85 | ||
74 | config VIDEO_W9966 | 86 | config VIDEO_W9966 |
75 | tristate "W9966CF Webcam (FlyCam Supra and others) Video For Linux" | 87 | tristate "W9966CF Webcam (FlyCam Supra and others) Video For Linux" |
76 | depends on PARPORT_1284 && VIDEO_DEV && PARPORT | 88 | depends on PARPORT_1284 && PARPORT && VIDEO_V4L1 |
77 | help | 89 | help |
78 | Video4linux driver for Winbond's w9966 based Webcams. | 90 | Video4linux driver for Winbond's w9966 based Webcams. |
79 | Currently tested with the LifeView FlyCam Supra. | 91 | Currently tested with the LifeView FlyCam Supra. |
@@ -86,7 +98,7 @@ config VIDEO_W9966 | |||
86 | 98 | ||
87 | config VIDEO_CPIA | 99 | config VIDEO_CPIA |
88 | tristate "CPiA Video For Linux" | 100 | tristate "CPiA Video For Linux" |
89 | depends on VIDEO_DEV | 101 | depends on VIDEO_V4L1 |
90 | ---help--- | 102 | ---help--- |
91 | This is the video4linux driver for cameras based on Vision's CPiA | 103 | This is the video4linux driver for cameras based on Vision's CPiA |
92 | (Colour Processor Interface ASIC), such as the Creative Labs Video | 104 | (Colour Processor Interface ASIC), such as the Creative Labs Video |
@@ -123,7 +135,7 @@ source "drivers/media/video/cpia2/Kconfig" | |||
123 | 135 | ||
124 | config VIDEO_SAA5246A | 136 | config VIDEO_SAA5246A |
125 | tristate "SAA5246A, SAA5281 Teletext processor" | 137 | tristate "SAA5246A, SAA5281 Teletext processor" |
126 | depends on VIDEO_DEV && I2C | 138 | depends on I2C && VIDEO_V4L1 |
127 | help | 139 | help |
128 | Support for I2C bus based teletext using the SAA5246A or SAA5281 | 140 | Support for I2C bus based teletext using the SAA5246A or SAA5281 |
129 | chip. Useful only if you live in Europe. | 141 | chip. Useful only if you live in Europe. |
@@ -150,7 +162,7 @@ config TUNER_3036 | |||
150 | 162 | ||
151 | config VIDEO_VINO | 163 | config VIDEO_VINO |
152 | tristate "SGI Vino Video For Linux (EXPERIMENTAL)" | 164 | tristate "SGI Vino Video For Linux (EXPERIMENTAL)" |
153 | depends on VIDEO_DEV && I2C && SGI_IP22 && EXPERIMENTAL | 165 | depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L1 |
154 | select I2C_ALGO_SGI | 166 | select I2C_ALGO_SGI |
155 | help | 167 | help |
156 | Say Y here to build in support for the Vino video input system found | 168 | Say Y here to build in support for the Vino video input system found |
@@ -158,7 +170,7 @@ config VIDEO_VINO | |||
158 | 170 | ||
159 | config VIDEO_STRADIS | 171 | config VIDEO_STRADIS |
160 | tristate "Stradis 4:2:2 MPEG-2 video driver (EXPERIMENTAL)" | 172 | tristate "Stradis 4:2:2 MPEG-2 video driver (EXPERIMENTAL)" |
161 | depends on EXPERIMENTAL && VIDEO_DEV && PCI | 173 | depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && !PPC64 |
162 | help | 174 | help |
163 | Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video | 175 | Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video |
164 | driver for PCI. There is a product page at | 176 | driver for PCI. There is a product page at |
@@ -166,7 +178,7 @@ config VIDEO_STRADIS | |||
166 | 178 | ||
167 | config VIDEO_ZORAN | 179 | config VIDEO_ZORAN |
168 | tristate "Zoran ZR36057/36067 Video For Linux" | 180 | tristate "Zoran ZR36057/36067 Video For Linux" |
169 | depends on VIDEO_DEV && PCI && I2C_ALGOBIT | 181 | depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64 |
170 | help | 182 | help |
171 | Say Y for support for MJPEG capture cards based on the Zoran | 183 | Say Y for support for MJPEG capture cards based on the Zoran |
172 | 36057/36067 PCI controller chipset. This includes the Iomega | 184 | 36057/36067 PCI controller chipset. This includes the Iomega |
@@ -214,7 +226,7 @@ config VIDEO_ZORAN_LML33R10 | |||
214 | 226 | ||
215 | config VIDEO_ZR36120 | 227 | config VIDEO_ZR36120 |
216 | tristate "Zoran ZR36120/36125 Video For Linux" | 228 | tristate "Zoran ZR36120/36125 Video For Linux" |
217 | depends on VIDEO_DEV && PCI && I2C && BROKEN | 229 | depends on PCI && I2C && VIDEO_V4L1 && BROKEN |
218 | help | 230 | help |
219 | Support for ZR36120/ZR36125 based frame grabber/overlay boards. | 231 | Support for ZR36120/ZR36125 based frame grabber/overlay boards. |
220 | This includes the Victor II, WaveWatcher, Video Wonder, Maxi-TV, | 232 | This includes the Victor II, WaveWatcher, Video Wonder, Maxi-TV, |
@@ -226,7 +238,7 @@ config VIDEO_ZR36120 | |||
226 | 238 | ||
227 | config VIDEO_MEYE | 239 | config VIDEO_MEYE |
228 | tristate "Sony Vaio Picturebook Motion Eye Video For Linux" | 240 | tristate "Sony Vaio Picturebook Motion Eye Video For Linux" |
229 | depends on VIDEO_DEV && PCI && SONYPI | 241 | depends on PCI && SONYPI && VIDEO_V4L1 |
230 | ---help--- | 242 | ---help--- |
231 | This is the video4linux driver for the Motion Eye camera found | 243 | This is the video4linux driver for the Motion Eye camera found |
232 | in the Vaio Picturebook laptops. Please read the material in | 244 | in the Vaio Picturebook laptops. Please read the material in |
@@ -242,7 +254,7 @@ source "drivers/media/video/saa7134/Kconfig" | |||
242 | 254 | ||
243 | config VIDEO_MXB | 255 | config VIDEO_MXB |
244 | tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" | 256 | tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" |
245 | depends on VIDEO_DEV && PCI | 257 | depends on PCI && VIDEO_V4L1 |
246 | select VIDEO_SAA7146_VV | 258 | select VIDEO_SAA7146_VV |
247 | select VIDEO_TUNER | 259 | select VIDEO_TUNER |
248 | ---help--- | 260 | ---help--- |
@@ -254,8 +266,9 @@ config VIDEO_MXB | |||
254 | 266 | ||
255 | config VIDEO_DPC | 267 | config VIDEO_DPC |
256 | tristate "Philips-Semiconductors 'dpc7146 demonstration board'" | 268 | tristate "Philips-Semiconductors 'dpc7146 demonstration board'" |
257 | depends on VIDEO_DEV && PCI | 269 | depends on PCI && VIDEO_V4L1 |
258 | select VIDEO_SAA7146_VV | 270 | select VIDEO_SAA7146_VV |
271 | select VIDEO_V4L2 | ||
259 | ---help--- | 272 | ---help--- |
260 | This is a video4linux driver for the 'dpc7146 demonstration | 273 | This is a video4linux driver for the 'dpc7146 demonstration |
261 | board' by Philips-Semiconductors. It's the reference design | 274 | board' by Philips-Semiconductors. It's the reference design |
@@ -268,8 +281,9 @@ config VIDEO_DPC | |||
268 | 281 | ||
269 | config VIDEO_HEXIUM_ORION | 282 | config VIDEO_HEXIUM_ORION |
270 | tristate "Hexium HV-PCI6 and Orion frame grabber" | 283 | tristate "Hexium HV-PCI6 and Orion frame grabber" |
271 | depends on VIDEO_DEV && PCI | 284 | depends on PCI && VIDEO_V4L1 |
272 | select VIDEO_SAA7146_VV | 285 | select VIDEO_SAA7146_VV |
286 | select VIDEO_V4L2 | ||
273 | ---help--- | 287 | ---help--- |
274 | This is a video4linux driver for the Hexium HV-PCI6 and | 288 | This is a video4linux driver for the Hexium HV-PCI6 and |
275 | Orion frame grabber cards by Hexium. | 289 | Orion frame grabber cards by Hexium. |
@@ -279,8 +293,9 @@ config VIDEO_HEXIUM_ORION | |||
279 | 293 | ||
280 | config VIDEO_HEXIUM_GEMINI | 294 | config VIDEO_HEXIUM_GEMINI |
281 | tristate "Hexium Gemini frame grabber" | 295 | tristate "Hexium Gemini frame grabber" |
282 | depends on VIDEO_DEV && PCI | 296 | depends on PCI && VIDEO_V4L1 |
283 | select VIDEO_SAA7146_VV | 297 | select VIDEO_SAA7146_VV |
298 | select VIDEO_V4L2 | ||
284 | ---help--- | 299 | ---help--- |
285 | This is a video4linux driver for the Hexium Gemini frame | 300 | This is a video4linux driver for the Hexium Gemini frame |
286 | grabber card by Hexium. Please note that the Gemini Dual | 301 | grabber card by Hexium. Please note that the Gemini Dual |
@@ -293,7 +308,7 @@ source "drivers/media/video/cx88/Kconfig" | |||
293 | 308 | ||
294 | config VIDEO_OVCAMCHIP | 309 | config VIDEO_OVCAMCHIP |
295 | tristate "OmniVision Camera Chip support" | 310 | tristate "OmniVision Camera Chip support" |
296 | depends on VIDEO_DEV && I2C | 311 | depends on I2C && VIDEO_V4L1 |
297 | ---help--- | 312 | ---help--- |
298 | Support for the OmniVision OV6xxx and OV7xxx series of camera chips. | 313 | Support for the OmniVision OV6xxx and OV7xxx series of camera chips. |
299 | This driver is intended to be used with the ov511 and w9968cf USB | 314 | This driver is intended to be used with the ov511 and w9968cf USB |
@@ -304,7 +319,7 @@ config VIDEO_OVCAMCHIP | |||
304 | 319 | ||
305 | config VIDEO_M32R_AR | 320 | config VIDEO_M32R_AR |
306 | tristate "AR devices" | 321 | tristate "AR devices" |
307 | depends on M32R | 322 | depends on M32R && VIDEO_V4L1 |
308 | ---help--- | 323 | ---help--- |
309 | This is a video4linux driver for the Renesas AR (Artificial Retina) | 324 | This is a video4linux driver for the Renesas AR (Artificial Retina) |
310 | camera module. | 325 | camera module. |
@@ -365,17 +380,17 @@ config VIDEO_WM8739 | |||
365 | source "drivers/media/video/cx25840/Kconfig" | 380 | source "drivers/media/video/cx25840/Kconfig" |
366 | 381 | ||
367 | config VIDEO_SAA711X | 382 | config VIDEO_SAA711X |
368 | tristate "Philips SAA7113/4/5 video decoders" | 383 | tristate "Philips SAA7113/4/5 video decoders (OBSOLETED)" |
369 | depends on VIDEO_DEV && I2C && EXPERIMENTAL | 384 | depends on VIDEO_V4L1 && I2C && EXPERIMENTAL |
370 | ---help--- | 385 | ---help--- |
371 | Support for the Philips SAA7113/4/5 video decoders. | 386 | Old support for the Philips SAA7113/4 video decoders. |
372 | 387 | ||
373 | To compile this driver as a module, choose M here: the | 388 | To compile this driver as a module, choose M here: the |
374 | module will be called saa7115. | 389 | module will be called saa7115. |
375 | 390 | ||
376 | config VIDEO_SAA7127 | 391 | config VIDEO_SAA7127 |
377 | tristate "Philips SAA7127/9 digital video encoders" | 392 | tristate "Philips SAA7127/9 digital video encoders" |
378 | depends on VIDEO_DEV && I2C && EXPERIMENTAL | 393 | depends on VIDEO_V4L2 && I2C && EXPERIMENTAL |
379 | ---help--- | 394 | ---help--- |
380 | Support for the Philips SAA7127/9 digital video encoders. | 395 | Support for the Philips SAA7127/9 digital video encoders. |
381 | 396 | ||
@@ -384,7 +399,7 @@ config VIDEO_SAA7127 | |||
384 | 399 | ||
385 | config VIDEO_UPD64031A | 400 | config VIDEO_UPD64031A |
386 | tristate "NEC Electronics uPD64031A Ghost Reduction" | 401 | tristate "NEC Electronics uPD64031A Ghost Reduction" |
387 | depends on VIDEO_DEV && I2C && EXPERIMENTAL | 402 | depends on VIDEO_V4L2 && I2C && EXPERIMENTAL |
388 | ---help--- | 403 | ---help--- |
389 | Support for the NEC Electronics uPD64031A Ghost Reduction | 404 | Support for the NEC Electronics uPD64031A Ghost Reduction |
390 | video chip. It is most often found in NTSC TV cards made for | 405 | video chip. It is most often found in NTSC TV cards made for |
@@ -396,7 +411,7 @@ config VIDEO_UPD64031A | |||
396 | 411 | ||
397 | config VIDEO_UPD64083 | 412 | config VIDEO_UPD64083 |
398 | tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation" | 413 | tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation" |
399 | depends on VIDEO_DEV && I2C && EXPERIMENTAL | 414 | depends on VIDEO_V4L2 && I2C && EXPERIMENTAL |
400 | ---help--- | 415 | ---help--- |
401 | Support for the NEC Electronics uPD64083 3-Dimensional Y/C | 416 | Support for the NEC Electronics uPD64083 3-Dimensional Y/C |
402 | separation video chip. It is used to improve the quality of | 417 | separation video chip. It is used to improve the quality of |
@@ -418,7 +433,7 @@ source "drivers/media/video/em28xx/Kconfig" | |||
418 | 433 | ||
419 | config USB_DSBR | 434 | config USB_DSBR |
420 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" | 435 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" |
421 | depends on USB && VIDEO_DEV && EXPERIMENTAL | 436 | depends on USB && VIDEO_V4L1 && EXPERIMENTAL |
422 | ---help--- | 437 | ---help--- |
423 | Say Y here if you want to connect this type of radio to your | 438 | Say Y here if you want to connect this type of radio to your |
424 | computer's USB port. Note that the audio is not digital, and | 439 | computer's USB port. Note that the audio is not digital, and |
@@ -434,7 +449,7 @@ source "drivers/media/video/et61x251/Kconfig" | |||
434 | 449 | ||
435 | config USB_OV511 | 450 | config USB_OV511 |
436 | tristate "USB OV511 Camera support" | 451 | tristate "USB OV511 Camera support" |
437 | depends on USB && VIDEO_DEV | 452 | depends on USB && VIDEO_V4L1 |
438 | ---help--- | 453 | ---help--- |
439 | Say Y here if you want to connect this type of camera to your | 454 | Say Y here if you want to connect this type of camera to your |
440 | computer's USB port. See <file:Documentation/video4linux/ov511.txt> | 455 | computer's USB port. See <file:Documentation/video4linux/ov511.txt> |
@@ -445,7 +460,7 @@ config USB_OV511 | |||
445 | 460 | ||
446 | config USB_SE401 | 461 | config USB_SE401 |
447 | tristate "USB SE401 Camera support" | 462 | tristate "USB SE401 Camera support" |
448 | depends on USB && VIDEO_DEV | 463 | depends on USB && VIDEO_V4L1 |
449 | ---help--- | 464 | ---help--- |
450 | Say Y here if you want to connect this type of camera to your | 465 | Say Y here if you want to connect this type of camera to your |
451 | computer's USB port. See <file:Documentation/video4linux/se401.txt> | 466 | computer's USB port. See <file:Documentation/video4linux/se401.txt> |
@@ -458,7 +473,7 @@ source "drivers/media/video/sn9c102/Kconfig" | |||
458 | 473 | ||
459 | config USB_STV680 | 474 | config USB_STV680 |
460 | tristate "USB STV680 (Pencam) Camera support" | 475 | tristate "USB STV680 (Pencam) Camera support" |
461 | depends on USB && VIDEO_DEV | 476 | depends on USB && VIDEO_V4L1 |
462 | ---help--- | 477 | ---help--- |
463 | Say Y here if you want to connect this type of camera to your | 478 | Say Y here if you want to connect this type of camera to your |
464 | computer's USB port. This includes the Pencam line of cameras. | 479 | computer's USB port. This includes the Pencam line of cameras. |
@@ -470,7 +485,7 @@ config USB_STV680 | |||
470 | 485 | ||
471 | config USB_W9968CF | 486 | config USB_W9968CF |
472 | tristate "USB W996[87]CF JPEG Dual Mode Camera support" | 487 | tristate "USB W996[87]CF JPEG Dual Mode Camera support" |
473 | depends on USB && VIDEO_DEV && I2C | 488 | depends on USB && VIDEO_V4L1 && I2C |
474 | select VIDEO_OVCAMCHIP | 489 | select VIDEO_OVCAMCHIP |
475 | ---help--- | 490 | ---help--- |
476 | Say Y here if you want support for cameras based on OV681 or | 491 | Say Y here if you want support for cameras based on OV681 or |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index b3ea2d63db9b..e5bf2687b76d 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -10,7 +10,11 @@ tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \ | |||
10 | 10 | ||
11 | msp3400-objs := msp3400-driver.o msp3400-kthreads.o | 11 | msp3400-objs := msp3400-driver.o msp3400-kthreads.o |
12 | 12 | ||
13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o | 13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o compat_ioctl32.o |
14 | |||
15 | ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) | ||
16 | obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o | ||
17 | endif | ||
14 | 18 | ||
15 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ | 19 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ |
16 | obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o | 20 | obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o |
@@ -84,4 +88,8 @@ obj-$(CONFIG_USB_IBMCAM) += usbvideo/ | |||
84 | obj-$(CONFIG_USB_KONICAWC) += usbvideo/ | 88 | obj-$(CONFIG_USB_KONICAWC) += usbvideo/ |
85 | obj-$(CONFIG_USB_VICAM) += usbvideo/ | 89 | obj-$(CONFIG_USB_VICAM) += usbvideo/ |
86 | 90 | ||
91 | obj-$(CONFIG_VIDEO_VIVI) += vivi.o | ||
92 | |||
87 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | 93 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
94 | extra-cflags-$(CONFIG_VIDEO_V4L1_COMPAT) += -DCONFIG_VIDEO_V4L1_COMPAT | ||
95 | |||
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig index 085477c12612..153f6a4a96c9 100644 --- a/drivers/media/video/bt8xx/Kconfig +++ b/drivers/media/video/bt8xx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_BT848 | 1 | config VIDEO_BT848 |
2 | tristate "BT848 Video For Linux" | 2 | tristate "BT848 Video For Linux" |
3 | depends on VIDEO_DEV && PCI && I2C | 3 | depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 |
4 | select I2C_ALGOBIT | 4 | select I2C_ALGOBIT |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select VIDEO_BTCX | 6 | select VIDEO_BTCX |
diff --git a/drivers/media/video/bt8xx/Makefile b/drivers/media/video/bt8xx/Makefile index db641a36b197..a096a03418aa 100644 --- a/drivers/media/video/bt8xx/Makefile +++ b/drivers/media/video/bt8xx/Makefile | |||
@@ -8,5 +8,5 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | |||
8 | 8 | ||
9 | obj-$(CONFIG_VIDEO_BT848) += bttv.o | 9 | obj-$(CONFIG_VIDEO_BT848) += bttv.o |
10 | 10 | ||
11 | EXTRA_CFLAGS += -I$(src)/.. | 11 | EXTRA_CFLAGS += -Idrivers/media/video |
12 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | 12 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index f209a7492051..2b64aa835b42 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -2991,13 +2991,13 @@ void __devinit bttv_idcard(struct bttv *btv) | |||
2991 | 2991 | ||
2992 | if (UNSET != audiomux[0]) { | 2992 | if (UNSET != audiomux[0]) { |
2993 | gpiobits = 0; | 2993 | gpiobits = 0; |
2994 | for (i = 0; i < 5; i++) { | 2994 | for (i = 0; i < 4; i++) { |
2995 | bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; | 2995 | bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; |
2996 | gpiobits |= audiomux[i]; | 2996 | gpiobits |= audiomux[i]; |
2997 | } | 2997 | } |
2998 | } else { | 2998 | } else { |
2999 | gpiobits = audioall; | 2999 | gpiobits = audioall; |
3000 | for (i = 0; i < 5; i++) { | 3000 | for (i = 0; i < 4; i++) { |
3001 | bttv_tvcards[btv->c.type].gpiomux[i] = audioall; | 3001 | bttv_tvcards[btv->c.type].gpiomux[i] = audioall; |
3002 | } | 3002 | } |
3003 | } | 3003 | } |
diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c index 16323a5d68ac..afcfe71e3792 100644 --- a/drivers/media/video/bt8xx/bttv-risc.c +++ b/drivers/media/video/bt8xx/bttv-risc.c | |||
@@ -233,7 +233,7 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc, | |||
233 | const struct bttv_format *fmt, struct bttv_overlay *ov, | 233 | const struct bttv_format *fmt, struct bttv_overlay *ov, |
234 | int skip_even, int skip_odd) | 234 | int skip_even, int skip_odd) |
235 | { | 235 | { |
236 | int instructions,rc,line,maxy,start,end,skip,nskips; | 236 | int dwords,rc,line,maxy,start,end,skip,nskips; |
237 | struct btcx_skiplist *skips; | 237 | struct btcx_skiplist *skips; |
238 | u32 *rp,ri,ra; | 238 | u32 *rp,ri,ra; |
239 | u32 addr; | 239 | u32 addr; |
@@ -242,12 +242,12 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc, | |||
242 | if (NULL == (skips = kmalloc(sizeof(*skips) * ov->nclips,GFP_KERNEL))) | 242 | if (NULL == (skips = kmalloc(sizeof(*skips) * ov->nclips,GFP_KERNEL))) |
243 | return -ENOMEM; | 243 | return -ENOMEM; |
244 | 244 | ||
245 | /* estimate risc mem: worst case is (clip+1) * lines instructions | 245 | /* estimate risc mem: worst case is (1.5*clip+1) * lines instructions |
246 | + sync + jump (all 2 dwords) */ | 246 | + sync + jump (all 2 dwords) */ |
247 | instructions = (ov->nclips + 1) * | 247 | dwords = (3 * ov->nclips + 2) * |
248 | ((skip_even || skip_odd) ? ov->w.height>>1 : ov->w.height); | 248 | ((skip_even || skip_odd) ? (ov->w.height+1)>>1 : ov->w.height); |
249 | instructions += 2; | 249 | dwords += 4; |
250 | if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0) { | 250 | if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,dwords*4)) < 0) { |
251 | kfree(skips); | 251 | kfree(skips); |
252 | return rc; | 252 | return rc; |
253 | } | 253 | } |
@@ -276,8 +276,6 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc, | |||
276 | if (line > maxy) | 276 | if (line > maxy) |
277 | btcx_calc_skips(line, ov->w.width, &maxy, | 277 | btcx_calc_skips(line, ov->w.width, &maxy, |
278 | skips, &nskips, ov->clips, ov->nclips); | 278 | skips, &nskips, ov->clips, ov->nclips); |
279 | else | ||
280 | nskips = 0; | ||
281 | 279 | ||
282 | /* write out risc code */ | 280 | /* write out risc code */ |
283 | for (start = 0, skip = 0; start < ov->w.width; start = end) { | 281 | for (start = 0, skip = 0; start < ov->w.width; start = end) { |
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c index f59ced181c55..1958d4016ea1 100644 --- a/drivers/media/video/cx25840/cx25840-firmware.c +++ b/drivers/media/video/cx25840/cx25840-firmware.c | |||
@@ -39,29 +39,12 @@ | |||
39 | 39 | ||
40 | #define FWDEV(x) &((x)->adapter->dev) | 40 | #define FWDEV(x) &((x)->adapter->dev) |
41 | 41 | ||
42 | static int fastfw = 1; | ||
43 | static char *firmware = FWFILE; | 42 | static char *firmware = FWFILE; |
44 | 43 | ||
45 | module_param(fastfw, bool, 0444); | ||
46 | module_param(firmware, charp, 0444); | 44 | module_param(firmware, charp, 0444); |
47 | 45 | ||
48 | MODULE_PARM_DESC(fastfw, "Load firmware fast [0=100MHz 1=333MHz (default)]"); | ||
49 | MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]"); | 46 | MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]"); |
50 | 47 | ||
51 | static void set_i2c_delay(struct i2c_client *client, int delay) | ||
52 | { | ||
53 | struct i2c_algo_bit_data *algod = client->adapter->algo_data; | ||
54 | |||
55 | /* We aren't guaranteed to be using algo_bit, | ||
56 | * so avoid the null pointer dereference | ||
57 | * and disable the 'fast firmware load' */ | ||
58 | if (algod) { | ||
59 | algod->udelay = delay; | ||
60 | } else { | ||
61 | fastfw = 0; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static void start_fw_load(struct i2c_client *client) | 48 | static void start_fw_load(struct i2c_client *client) |
66 | { | 49 | { |
67 | /* DL_ADDR_LB=0 DL_ADDR_HB=0 */ | 50 | /* DL_ADDR_LB=0 DL_ADDR_HB=0 */ |
@@ -71,16 +54,10 @@ static void start_fw_load(struct i2c_client *client) | |||
71 | cx25840_write(client, 0x803, 0x0b); | 54 | cx25840_write(client, 0x803, 0x0b); |
72 | /* AUTO_INC_DIS=1 */ | 55 | /* AUTO_INC_DIS=1 */ |
73 | cx25840_write(client, 0x000, 0x20); | 56 | cx25840_write(client, 0x000, 0x20); |
74 | |||
75 | if (fastfw) | ||
76 | set_i2c_delay(client, 3); | ||
77 | } | 57 | } |
78 | 58 | ||
79 | static void end_fw_load(struct i2c_client *client) | 59 | static void end_fw_load(struct i2c_client *client) |
80 | { | 60 | { |
81 | if (fastfw) | ||
82 | set_i2c_delay(client, 10); | ||
83 | |||
84 | /* AUTO_INC_DIS=0 */ | 61 | /* AUTO_INC_DIS=0 */ |
85 | cx25840_write(client, 0x000, 0x00); | 62 | cx25840_write(client, 0x000, 0x00); |
86 | /* DL_ENABLE=0 */ | 63 | /* DL_ENABLE=0 */ |
@@ -107,30 +84,8 @@ static int fw_write(struct i2c_client *client, u8 * data, int size) | |||
107 | int sent; | 84 | int sent; |
108 | 85 | ||
109 | if ((sent = i2c_master_send(client, data, size)) < size) { | 86 | if ((sent = i2c_master_send(client, data, size)) < size) { |
110 | 87 | v4l_err(client, "firmware load i2c failure\n"); | |
111 | if (fastfw) { | 88 | return -ENOSYS; |
112 | v4l_err(client, "333MHz i2c firmware load failed\n"); | ||
113 | fastfw = 0; | ||
114 | set_i2c_delay(client, 10); | ||
115 | |||
116 | if (sent > 2) { | ||
117 | u16 dl_addr = cx25840_read(client, 0x801) << 8; | ||
118 | dl_addr |= cx25840_read(client, 0x800); | ||
119 | dl_addr -= sent - 2; | ||
120 | cx25840_write(client, 0x801, dl_addr >> 8); | ||
121 | cx25840_write(client, 0x800, dl_addr & 0xff); | ||
122 | } | ||
123 | |||
124 | if (i2c_master_send(client, data, size) < size) { | ||
125 | v4l_err(client, "100MHz i2c firmware load failed\n"); | ||
126 | return -ENOSYS; | ||
127 | } | ||
128 | |||
129 | } else { | ||
130 | v4l_err(client, "firmware load i2c failure\n"); | ||
131 | return -ENOSYS; | ||
132 | } | ||
133 | |||
134 | } | 89 | } |
135 | 90 | ||
136 | return 0; | 91 | return 0; |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index c7042cf41231..f80154b87d22 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -564,7 +564,7 @@ struct cx88_board cx88_boards[] = { | |||
564 | }, | 564 | }, |
565 | [CX88_BOARD_PCHDTV_HD3000] = { | 565 | [CX88_BOARD_PCHDTV_HD3000] = { |
566 | .name = "pcHDTV HD3000 HDTV", | 566 | .name = "pcHDTV HD3000 HDTV", |
567 | .tuner_type = TUNER_THOMSON_DTT7610, | 567 | .tuner_type = TUNER_THOMSON_DTT761X, |
568 | .radio_type = UNSET, | 568 | .radio_type = UNSET, |
569 | .tuner_addr = ADDR_UNSET, | 569 | .tuner_addr = ADDR_UNSET, |
570 | .radio_addr = ADDR_UNSET, | 570 | .radio_addr = ADDR_UNSET, |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 2c3d9f1999be..e1092d5d4628 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -146,9 +146,11 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
146 | fields++; | 146 | fields++; |
147 | 147 | ||
148 | /* estimate risc mem: worst case is one write per page border + | 148 | /* estimate risc mem: worst case is one write per page border + |
149 | one write per scan line + syncs + jump (all 2 dwords) */ | 149 | one write per scan line + syncs + jump (all 2 dwords). Padding |
150 | instructions = (bpl * lines * fields) / PAGE_SIZE + lines * fields; | 150 | can cause next bpl to start close to a page border. First DMA |
151 | instructions += 3 + 4; | 151 | region may be smaller than PAGE_SIZE */ |
152 | instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines); | ||
153 | instructions += 2; | ||
152 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) | 154 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) |
153 | return rc; | 155 | return rc; |
154 | 156 | ||
@@ -176,9 +178,11 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
176 | int rc; | 178 | int rc; |
177 | 179 | ||
178 | /* estimate risc mem: worst case is one write per page border + | 180 | /* estimate risc mem: worst case is one write per page border + |
179 | one write per scan line + syncs + jump (all 2 dwords) */ | 181 | one write per scan line + syncs + jump (all 2 dwords). Here |
180 | instructions = (bpl * lines) / PAGE_SIZE + lines; | 182 | there is no padding and no sync. First DMA region may be smaller |
181 | instructions += 3 + 4; | 183 | than PAGE_SIZE */ |
184 | instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; | ||
185 | instructions += 1; | ||
182 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) | 186 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) |
183 | return rc; | 187 | return rc; |
184 | 188 | ||
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index f0ea9b5cdbc2..3619a449aefd 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -372,7 +372,7 @@ static int or51132_set_ts_param(struct dvb_frontend* fe, | |||
372 | static struct or51132_config pchdtv_hd3000 = { | 372 | static struct or51132_config pchdtv_hd3000 = { |
373 | .demod_address = 0x15, | 373 | .demod_address = 0x15, |
374 | .pll_address = 0x61, | 374 | .pll_address = 0x61, |
375 | .pll_desc = &dvb_pll_thomson_dtt7610, | 375 | .pll_desc = &dvb_pll_thomson_dtt761x, |
376 | .set_ts_params = or51132_set_ts_param, | 376 | .set_ts_params = or51132_set_ts_param, |
377 | }; | 377 | }; |
378 | #endif | 378 | #endif |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 72a417b31745..694d1d80ff3f 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -35,8 +35,10 @@ | |||
35 | #include "cx88.h" | 35 | #include "cx88.h" |
36 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
37 | 37 | ||
38 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
38 | /* Include V4L1 specific functions. Should be removed soon */ | 39 | /* Include V4L1 specific functions. Should be removed soon */ |
39 | #include <linux/videodev.h> | 40 | #include <linux/videodev.h> |
41 | #endif | ||
40 | 42 | ||
41 | MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); | 43 | MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); |
42 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 44 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 5a793ae7cc23..dfb15bfb83dc 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_EM28XX | 1 | config VIDEO_EM28XX |
2 | tristate "Empia EM2800/2820/2840 USB video capture support" | 2 | tristate "Empia EM2800/2820/2840 USB video capture support" |
3 | depends on VIDEO_DEV && USB && I2C | 3 | depends on VIDEO_V4L1 && USB && I2C |
4 | select VIDEO_BUF | 4 | select VIDEO_BUF |
5 | select VIDEO_TUNER | 5 | select VIDEO_TUNER |
6 | select VIDEO_TVEEPROM | 6 | select VIDEO_TVEEPROM |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index ddc92cbb5276..cf7cdf9ef617 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -1576,8 +1576,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1576 | errCode = em28xx_config(dev); | 1576 | errCode = em28xx_config(dev); |
1577 | if (errCode) { | 1577 | if (errCode) { |
1578 | em28xx_errdev("error configuring device\n"); | 1578 | em28xx_errdev("error configuring device\n"); |
1579 | kfree(dev); | ||
1580 | em28xx_devused&=~(1<<dev->devno); | 1579 | em28xx_devused&=~(1<<dev->devno); |
1580 | kfree(dev); | ||
1581 | return -ENOMEM; | 1581 | return -ENOMEM; |
1582 | } | 1582 | } |
1583 | 1583 | ||
@@ -1603,8 +1603,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1603 | dev->vdev = video_device_alloc(); | 1603 | dev->vdev = video_device_alloc(); |
1604 | if (NULL == dev->vdev) { | 1604 | if (NULL == dev->vdev) { |
1605 | em28xx_errdev("cannot allocate video_device.\n"); | 1605 | em28xx_errdev("cannot allocate video_device.\n"); |
1606 | kfree(dev); | ||
1607 | em28xx_devused&=~(1<<dev->devno); | 1606 | em28xx_devused&=~(1<<dev->devno); |
1607 | kfree(dev); | ||
1608 | return -ENOMEM; | 1608 | return -ENOMEM; |
1609 | } | 1609 | } |
1610 | 1610 | ||
@@ -1612,8 +1612,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1612 | if (NULL == dev->vbi_dev) { | 1612 | if (NULL == dev->vbi_dev) { |
1613 | em28xx_errdev("cannot allocate video_device.\n"); | 1613 | em28xx_errdev("cannot allocate video_device.\n"); |
1614 | kfree(dev->vdev); | 1614 | kfree(dev->vdev); |
1615 | kfree(dev); | ||
1616 | em28xx_devused&=~(1<<dev->devno); | 1615 | em28xx_devused&=~(1<<dev->devno); |
1616 | kfree(dev); | ||
1617 | return -ENOMEM; | 1617 | return -ENOMEM; |
1618 | } | 1618 | } |
1619 | 1619 | ||
@@ -1650,8 +1650,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1650 | mutex_unlock(&dev->lock); | 1650 | mutex_unlock(&dev->lock); |
1651 | list_del(&dev->devlist); | 1651 | list_del(&dev->devlist); |
1652 | video_device_release(dev->vdev); | 1652 | video_device_release(dev->vdev); |
1653 | kfree(dev); | ||
1654 | em28xx_devused&=~(1<<dev->devno); | 1653 | em28xx_devused&=~(1<<dev->devno); |
1654 | kfree(dev); | ||
1655 | return -ENODEV; | 1655 | return -ENODEV; |
1656 | } | 1656 | } |
1657 | 1657 | ||
@@ -1662,8 +1662,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1662 | list_del(&dev->devlist); | 1662 | list_del(&dev->devlist); |
1663 | video_device_release(dev->vbi_dev); | 1663 | video_device_release(dev->vbi_dev); |
1664 | video_device_release(dev->vdev); | 1664 | video_device_release(dev->vdev); |
1665 | kfree(dev); | ||
1666 | em28xx_devused&=~(1<<dev->devno); | 1665 | em28xx_devused&=~(1<<dev->devno); |
1666 | kfree(dev); | ||
1667 | return -ENODEV; | 1667 | return -ENODEV; |
1668 | } else { | 1668 | } else { |
1669 | printk("registered VBI\n"); | 1669 | printk("registered VBI\n"); |
diff --git a/drivers/media/video/et61x251/Kconfig b/drivers/media/video/et61x251/Kconfig index 6c43a90c6569..c6bff705688d 100644 --- a/drivers/media/video/et61x251/Kconfig +++ b/drivers/media/video/et61x251/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_ET61X251 | 1 | config USB_ET61X251 |
2 | tristate "USB ET61X[12]51 PC Camera Controller support" | 2 | tristate "USB ET61X[12]51 PC Camera Controller support" |
3 | depends on USB && VIDEO_DEV | 3 | depends on USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y here if you want support for cameras based on Etoms ET61X151 | 5 | Say Y here if you want support for cameras based on Etoms ET61X151 |
6 | or ET61X251 PC Camera Controllers. | 6 | or ET61X251 PC Camera Controllers. |
diff --git a/drivers/media/video/pwc/Kconfig b/drivers/media/video/pwc/Kconfig index 86376556f108..53cbc950f95c 100644 --- a/drivers/media/video/pwc/Kconfig +++ b/drivers/media/video/pwc/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_PWC | 1 | config USB_PWC |
2 | tristate "USB Philips Cameras" | 2 | tristate "USB Philips Cameras" |
3 | depends on USB && VIDEO_DEV | 3 | depends on USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y or M here if you want to use one of these Philips & OEM | 5 | Say Y or M here if you want to use one of these Philips & OEM |
6 | webcams: | 6 | webcams: |
diff --git a/drivers/media/video/pwc/Makefile b/drivers/media/video/pwc/Makefile index 8326684f49f3..33d60126c024 100644 --- a/drivers/media/video/pwc/Makefile +++ b/drivers/media/video/pwc/Makefile | |||
@@ -1,20 +1,3 @@ | |||
1 | ifneq ($(KERNELRELEASE),) | ||
2 | |||
3 | pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o pwc-timon.o pwc-kiara.o | 1 | pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o pwc-timon.o pwc-kiara.o |
4 | 2 | ||
5 | obj-$(CONFIG_USB_PWC) += pwc.o | 3 | obj-$(CONFIG_USB_PWC) += pwc.o |
6 | |||
7 | else | ||
8 | |||
9 | KDIR := /lib/modules/$(shell uname -r)/build | ||
10 | PWD := $(shell pwd) | ||
11 | |||
12 | default: | ||
13 | $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules | ||
14 | |||
15 | endif | ||
16 | |||
17 | clean: | ||
18 | rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c | ||
19 | rm -rf .tmp_versions | ||
20 | |||
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index 133f9e5252fe..c271e2e14105 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
@@ -142,6 +142,7 @@ struct i2c_reg_value { | |||
142 | static const struct i2c_reg_value saa7129_init_config_extra[] = { | 142 | static const struct i2c_reg_value saa7129_init_config_extra[] = { |
143 | { SAA7127_REG_OUTPUT_PORT_CONTROL, 0x38 }, | 143 | { SAA7127_REG_OUTPUT_PORT_CONTROL, 0x38 }, |
144 | { SAA7127_REG_VTRIG, 0xfa }, | 144 | { SAA7127_REG_VTRIG, 0xfa }, |
145 | { 0, 0 } | ||
145 | }; | 146 | }; |
146 | 147 | ||
147 | static const struct i2c_reg_value saa7127_init_config_common[] = { | 148 | static const struct i2c_reg_value saa7127_init_config_common[] = { |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index e666a4465ca4..86eae3528330 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -3504,6 +3504,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
3504 | /* power-up tuner chip */ | 3504 | /* power-up tuner chip */ |
3505 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); | 3505 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); |
3506 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); | 3506 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); |
3507 | break; | ||
3507 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 3508 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
3508 | /* this turns the remote control chip off to work around a bug in it */ | 3509 | /* this turns the remote control chip off to work around a bug in it */ |
3509 | saa_writeb(SAA7134_GPIO_GPMODE1, 0x80); | 3510 | saa_writeb(SAA7134_GPIO_GPMODE1, 0x80); |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 13de05532e0a..f0c2111f14ad 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -548,6 +548,8 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
548 | if (report & SAA7134_IRQ_REPORT_GPIO16) { | 548 | if (report & SAA7134_IRQ_REPORT_GPIO16) { |
549 | switch (dev->has_remote) { | 549 | switch (dev->has_remote) { |
550 | case SAA7134_REMOTE_GPIO: | 550 | case SAA7134_REMOTE_GPIO: |
551 | if (!dev->remote) | ||
552 | break; | ||
551 | if (dev->remote->mask_keydown & 0x10000) { | 553 | if (dev->remote->mask_keydown & 0x10000) { |
552 | saa7134_input_irq(dev); | 554 | saa7134_input_irq(dev); |
553 | } | 555 | } |
@@ -564,6 +566,8 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
564 | if (report & SAA7134_IRQ_REPORT_GPIO18) { | 566 | if (report & SAA7134_IRQ_REPORT_GPIO18) { |
565 | switch (dev->has_remote) { | 567 | switch (dev->has_remote) { |
566 | case SAA7134_REMOTE_GPIO: | 568 | case SAA7134_REMOTE_GPIO: |
569 | if (!dev->remote) | ||
570 | break; | ||
567 | if ((dev->remote->mask_keydown & 0x40000) || | 571 | if ((dev->remote->mask_keydown & 0x40000) || |
568 | (dev->remote->mask_keyup & 0x40000)) { | 572 | (dev->remote->mask_keyup & 0x40000)) { |
569 | saa7134_input_irq(dev); | 573 | saa7134_input_irq(dev); |
@@ -676,7 +680,7 @@ static int saa7134_hwinit2(struct saa7134_dev *dev) | |||
676 | SAA7134_IRQ2_INTE_PE | | 680 | SAA7134_IRQ2_INTE_PE | |
677 | SAA7134_IRQ2_INTE_AR; | 681 | SAA7134_IRQ2_INTE_AR; |
678 | 682 | ||
679 | if (dev->has_remote == SAA7134_REMOTE_GPIO) { | 683 | if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) { |
680 | if (dev->remote->mask_keydown & 0x10000) | 684 | if (dev->remote->mask_keydown & 0x10000) |
681 | irq2_mask |= SAA7134_IRQ2_INTE_GPIO16; | 685 | irq2_mask |= SAA7134_IRQ2_INTE_GPIO16; |
682 | else if (dev->remote->mask_keydown & 0x40000) | 686 | else if (dev->remote->mask_keydown & 0x40000) |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index aeef80f88a6b..e4156ec9c6d7 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -31,8 +31,10 @@ | |||
31 | #include "saa7134.h" | 31 | #include "saa7134.h" |
32 | #include <media/v4l2-common.h> | 32 | #include <media/v4l2-common.h> |
33 | 33 | ||
34 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
34 | /* Include V4L1 specific functions. Should be removed soon */ | 35 | /* Include V4L1 specific functions. Should be removed soon */ |
35 | #include <linux/videodev.h> | 36 | #include <linux/videodev.h> |
37 | #endif | ||
36 | 38 | ||
37 | /* ------------------------------------------------------------------ */ | 39 | /* ------------------------------------------------------------------ */ |
38 | 40 | ||
diff --git a/drivers/media/video/sn9c102/Kconfig b/drivers/media/video/sn9c102/Kconfig index 55f2bc11964b..cf552e6b8ecf 100644 --- a/drivers/media/video/sn9c102/Kconfig +++ b/drivers/media/video/sn9c102/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_SN9C102 | 1 | config USB_SN9C102 |
2 | tristate "USB SN9C10x PC Camera Controller support" | 2 | tristate "USB SN9C10x PC Camera Controller support" |
3 | depends on USB && VIDEO_DEV | 3 | depends on USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y here if you want support for cameras based on SONiX SN9C101, | 5 | Say Y here if you want support for cameras based on SONiX SN9C101, |
6 | SN9C102 or SN9C103 PC Camera Controllers. | 6 | SN9C102 or SN9C103 PC Camera Controllers. |
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c index 72e0f01db563..a1ae036b44ec 100644 --- a/drivers/media/video/tuner-types.c +++ b/drivers/media/video/tuner-types.c | |||
@@ -877,8 +877,8 @@ static struct tuner_params tuner_philips_fmd1216me_mk3_params[] = { | |||
877 | /* ------------ TUNER_LG_TDVS_H062F - INFINEON ATSC ------------ */ | 877 | /* ------------ TUNER_LG_TDVS_H062F - INFINEON ATSC ------------ */ |
878 | 878 | ||
879 | static struct tuner_range tuner_tua6034_ntsc_ranges[] = { | 879 | static struct tuner_range tuner_tua6034_ntsc_ranges[] = { |
880 | { 16 * 160.00 /*MHz*/, 0x8e, 0x01 }, | 880 | { 16 * 165.00 /*MHz*/, 0x8e, 0x01 }, |
881 | { 16 * 455.00 /*MHz*/, 0x8e, 0x02 }, | 881 | { 16 * 450.00 /*MHz*/, 0x8e, 0x02 }, |
882 | { 16 * 999.99 , 0x8e, 0x04 }, | 882 | { 16 * 999.99 , 0x8e, 0x04 }, |
883 | }; | 883 | }; |
884 | 884 | ||
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 431c3e2f6c42..b463e996961a 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -218,7 +218,7 @@ hauppauge_tuner[] = | |||
218 | /* 110-119 */ | 218 | /* 110-119 */ |
219 | { TUNER_ABSENT, "Thompson DTT75105"}, | 219 | { TUNER_ABSENT, "Thompson DTT75105"}, |
220 | { TUNER_ABSENT, "Conexant_CX24109"}, | 220 | { TUNER_ABSENT, "Conexant_CX24109"}, |
221 | { TUNER_ABSENT, "TCL M2523_5N_E"}, | 221 | { TUNER_TCL_2002N, "TCL M2523_5N_E"}, |
222 | { TUNER_ABSENT, "TCL M2523_3DB_E"}, | 222 | { TUNER_ABSENT, "TCL M2523_3DB_E"}, |
223 | { TUNER_ABSENT, "Philips 8275A"}, | 223 | { TUNER_ABSENT, "Philips 8275A"}, |
224 | { TUNER_ABSENT, "Microtune MT2060"}, | 224 | { TUNER_ABSENT, "Microtune MT2060"}, |
diff --git a/drivers/media/video/usbvideo/Kconfig b/drivers/media/video/usbvideo/Kconfig index 08a5d20bb2c0..39269a2c5635 100644 --- a/drivers/media/video/usbvideo/Kconfig +++ b/drivers/media/video/usbvideo/Kconfig | |||
@@ -3,7 +3,7 @@ config VIDEO_USBVIDEO | |||
3 | 3 | ||
4 | config USB_VICAM | 4 | config USB_VICAM |
5 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" | 5 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" |
6 | depends on USB && VIDEO_DEV && EXPERIMENTAL | 6 | depends on USB && VIDEO_V4L1 && EXPERIMENTAL |
7 | select VIDEO_USBVIDEO | 7 | select VIDEO_USBVIDEO |
8 | ---help--- | 8 | ---help--- |
9 | Say Y here if you have 3com homeconnect camera (vicam). | 9 | Say Y here if you have 3com homeconnect camera (vicam). |
@@ -13,7 +13,7 @@ config USB_VICAM | |||
13 | 13 | ||
14 | config USB_IBMCAM | 14 | config USB_IBMCAM |
15 | tristate "USB IBM (Xirlink) C-it Camera support" | 15 | tristate "USB IBM (Xirlink) C-it Camera support" |
16 | depends on USB && VIDEO_DEV | 16 | depends on USB && VIDEO_V4L1 |
17 | select VIDEO_USBVIDEO | 17 | select VIDEO_USBVIDEO |
18 | ---help--- | 18 | ---help--- |
19 | Say Y here if you want to connect a IBM "C-It" camera, also known as | 19 | Say Y here if you want to connect a IBM "C-It" camera, also known as |
@@ -28,7 +28,7 @@ config USB_IBMCAM | |||
28 | 28 | ||
29 | config USB_KONICAWC | 29 | config USB_KONICAWC |
30 | tristate "USB Konica Webcam support" | 30 | tristate "USB Konica Webcam support" |
31 | depends on USB && VIDEO_DEV | 31 | depends on USB && VIDEO_V4L1 |
32 | select VIDEO_USBVIDEO | 32 | select VIDEO_USBVIDEO |
33 | ---help--- | 33 | ---help--- |
34 | Say Y here if you want support for webcams based on a Konica | 34 | Say Y here if you want support for webcams based on a Konica |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 5e813404d068..779db26771c0 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -26,6 +26,11 @@ | |||
26 | #include <linux/random.h> | 26 | #include <linux/random.h> |
27 | #include <linux/version.h> | 27 | #include <linux/version.h> |
28 | #include <linux/videodev2.h> | 28 | #include <linux/videodev2.h> |
29 | #include <linux/dma-mapping.h> | ||
30 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
31 | /* Include V4L1 specific functions. Should be removed soon */ | ||
32 | #include <linux/videodev.h> | ||
33 | #endif | ||
29 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
30 | #include <media/video-buf.h> | 35 | #include <media/video-buf.h> |
31 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
diff --git a/drivers/media/video/zc0301/Kconfig b/drivers/media/video/zc0301/Kconfig index c3bf886b80cd..115833e4f4dd 100644 --- a/drivers/media/video/zc0301/Kconfig +++ b/drivers/media/video/zc0301/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_ZC0301 | 1 | config USB_ZC0301 |
2 | tristate "USB ZC0301 Image Processor and Control Chip support" | 2 | tristate "USB ZC0301 Image Processor and Control Chip support" |
3 | depends on USB && VIDEO_DEV | 3 | depends on USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y here if you want support for cameras based on the ZC0301 | 5 | Say Y here if you want support for cameras based on the ZC0301 |
6 | Image Processor and Control Chip. | 6 | Image Processor and Control Chip. |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 9080853fe283..a30084076ac8 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -1605,6 +1605,21 @@ mpt_resume(struct pci_dev *pdev) | |||
1605 | } | 1605 | } |
1606 | #endif | 1606 | #endif |
1607 | 1607 | ||
1608 | static int | ||
1609 | mpt_signal_reset(int index, MPT_ADAPTER *ioc, int reset_phase) | ||
1610 | { | ||
1611 | if ((MptDriverClass[index] == MPTSPI_DRIVER && | ||
1612 | ioc->bus_type != SPI) || | ||
1613 | (MptDriverClass[index] == MPTFC_DRIVER && | ||
1614 | ioc->bus_type != FC) || | ||
1615 | (MptDriverClass[index] == MPTSAS_DRIVER && | ||
1616 | ioc->bus_type != SAS)) | ||
1617 | /* make sure we only call the relevant reset handler | ||
1618 | * for the bus */ | ||
1619 | return 0; | ||
1620 | return (MptResetHandlers[index])(ioc, reset_phase); | ||
1621 | } | ||
1622 | |||
1608 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1623 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1609 | /* | 1624 | /* |
1610 | * mpt_do_ioc_recovery - Initialize or recover MPT adapter. | 1625 | * mpt_do_ioc_recovery - Initialize or recover MPT adapter. |
@@ -1885,14 +1900,14 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1885 | if ((ret == 0) && MptResetHandlers[ii]) { | 1900 | if ((ret == 0) && MptResetHandlers[ii]) { |
1886 | dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n", | 1901 | dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n", |
1887 | ioc->name, ii)); | 1902 | ioc->name, ii)); |
1888 | rc += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_POST_RESET); | 1903 | rc += mpt_signal_reset(ii, ioc, MPT_IOC_POST_RESET); |
1889 | handlers++; | 1904 | handlers++; |
1890 | } | 1905 | } |
1891 | 1906 | ||
1892 | if (alt_ioc_ready && MptResetHandlers[ii]) { | 1907 | if (alt_ioc_ready && MptResetHandlers[ii]) { |
1893 | drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", | 1908 | drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", |
1894 | ioc->name, ioc->alt_ioc->name, ii)); | 1909 | ioc->name, ioc->alt_ioc->name, ii)); |
1895 | rc += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_POST_RESET); | 1910 | rc += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_POST_RESET); |
1896 | handlers++; | 1911 | handlers++; |
1897 | } | 1912 | } |
1898 | } | 1913 | } |
@@ -3267,11 +3282,11 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag) | |||
3267 | if (MptResetHandlers[ii]) { | 3282 | if (MptResetHandlers[ii]) { |
3268 | dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n", | 3283 | dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n", |
3269 | ioc->name, ii)); | 3284 | ioc->name, ii)); |
3270 | r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_PRE_RESET); | 3285 | r += mpt_signal_reset(ii, ioc, MPT_IOC_PRE_RESET); |
3271 | if (ioc->alt_ioc) { | 3286 | if (ioc->alt_ioc) { |
3272 | dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n", | 3287 | dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n", |
3273 | ioc->name, ioc->alt_ioc->name, ii)); | 3288 | ioc->name, ioc->alt_ioc->name, ii)); |
3274 | r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_PRE_RESET); | 3289 | r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_PRE_RESET); |
3275 | } | 3290 | } |
3276 | } | 3291 | } |
3277 | } | 3292 | } |
@@ -5706,11 +5721,11 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag) | |||
5706 | if (MptResetHandlers[ii]) { | 5721 | if (MptResetHandlers[ii]) { |
5707 | dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n", | 5722 | dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n", |
5708 | ioc->name, ii)); | 5723 | ioc->name, ii)); |
5709 | r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_SETUP_RESET); | 5724 | r += mpt_signal_reset(ii, ioc, MPT_IOC_SETUP_RESET); |
5710 | if (ioc->alt_ioc) { | 5725 | if (ioc->alt_ioc) { |
5711 | dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n", | 5726 | dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n", |
5712 | ioc->name, ioc->alt_ioc->name, ii)); | 5727 | ioc->name, ioc->alt_ioc->name, ii)); |
5713 | r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_SETUP_RESET); | 5728 | r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_SETUP_RESET); |
5714 | } | 5729 | } |
5715 | } | 5730 | } |
5716 | } | 5731 | } |
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index f2a4d382ea19..3201de053943 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -831,6 +831,7 @@ mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
831 | return rc; | 831 | return rc; |
832 | } | 832 | } |
833 | 833 | ||
834 | #ifdef CONFIG_PM | ||
834 | /* | 835 | /* |
835 | * spi module resume handler | 836 | * spi module resume handler |
836 | */ | 837 | */ |
@@ -846,6 +847,7 @@ mptspi_resume(struct pci_dev *pdev) | |||
846 | 847 | ||
847 | return rc; | 848 | return rc; |
848 | } | 849 | } |
850 | #endif | ||
849 | 851 | ||
850 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 852 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
851 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 853 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c index 5ea133c59afb..7bd4d85d0b42 100644 --- a/drivers/message/i2o/exec-osm.c +++ b/drivers/message/i2o/exec-osm.c | |||
@@ -55,6 +55,7 @@ struct i2o_exec_wait { | |||
55 | u32 m; /* message id */ | 55 | u32 m; /* message id */ |
56 | struct i2o_message *msg; /* pointer to the reply message */ | 56 | struct i2o_message *msg; /* pointer to the reply message */ |
57 | struct list_head list; /* node in global wait list */ | 57 | struct list_head list; /* node in global wait list */ |
58 | spinlock_t lock; /* lock before modifying */ | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | /* Work struct needed to handle LCT NOTIFY replies */ | 61 | /* Work struct needed to handle LCT NOTIFY replies */ |
@@ -87,6 +88,7 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void) | |||
87 | return NULL; | 88 | return NULL; |
88 | 89 | ||
89 | INIT_LIST_HEAD(&wait->list); | 90 | INIT_LIST_HEAD(&wait->list); |
91 | spin_lock_init(&wait->lock); | ||
90 | 92 | ||
91 | return wait; | 93 | return wait; |
92 | }; | 94 | }; |
@@ -125,6 +127,7 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, | |||
125 | DECLARE_WAIT_QUEUE_HEAD(wq); | 127 | DECLARE_WAIT_QUEUE_HEAD(wq); |
126 | struct i2o_exec_wait *wait; | 128 | struct i2o_exec_wait *wait; |
127 | static u32 tcntxt = 0x80000000; | 129 | static u32 tcntxt = 0x80000000; |
130 | long flags; | ||
128 | int rc = 0; | 131 | int rc = 0; |
129 | 132 | ||
130 | wait = i2o_exec_wait_alloc(); | 133 | wait = i2o_exec_wait_alloc(); |
@@ -146,33 +149,28 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, | |||
146 | wait->tcntxt = tcntxt++; | 149 | wait->tcntxt = tcntxt++; |
147 | msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt); | 150 | msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt); |
148 | 151 | ||
152 | wait->wq = &wq; | ||
153 | /* | ||
154 | * we add elements to the head, because if a entry in the list will | ||
155 | * never be removed, we have to iterate over it every time | ||
156 | */ | ||
157 | list_add(&wait->list, &i2o_exec_wait_list); | ||
158 | |||
149 | /* | 159 | /* |
150 | * Post the message to the controller. At some point later it will | 160 | * Post the message to the controller. At some point later it will |
151 | * return. If we time out before it returns then complete will be zero. | 161 | * return. If we time out before it returns then complete will be zero. |
152 | */ | 162 | */ |
153 | i2o_msg_post(c, msg); | 163 | i2o_msg_post(c, msg); |
154 | 164 | ||
155 | if (!wait->complete) { | 165 | wait_event_interruptible_timeout(wq, wait->complete, timeout * HZ); |
156 | wait->wq = &wq; | ||
157 | /* | ||
158 | * we add elements add the head, because if a entry in the list | ||
159 | * will never be removed, we have to iterate over it every time | ||
160 | */ | ||
161 | list_add(&wait->list, &i2o_exec_wait_list); | ||
162 | |||
163 | wait_event_interruptible_timeout(wq, wait->complete, | ||
164 | timeout * HZ); | ||
165 | 166 | ||
166 | wait->wq = NULL; | 167 | spin_lock_irqsave(&wait->lock, flags); |
167 | } | ||
168 | 168 | ||
169 | barrier(); | 169 | wait->wq = NULL; |
170 | 170 | ||
171 | if (wait->complete) { | 171 | if (wait->complete) |
172 | rc = le32_to_cpu(wait->msg->body[0]) >> 24; | 172 | rc = le32_to_cpu(wait->msg->body[0]) >> 24; |
173 | i2o_flush_reply(c, wait->m); | 173 | else { |
174 | i2o_exec_wait_free(wait); | ||
175 | } else { | ||
176 | /* | 174 | /* |
177 | * We cannot remove it now. This is important. When it does | 175 | * We cannot remove it now. This is important. When it does |
178 | * terminate (which it must do if the controller has not | 176 | * terminate (which it must do if the controller has not |
@@ -186,6 +184,13 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, | |||
186 | rc = -ETIMEDOUT; | 184 | rc = -ETIMEDOUT; |
187 | } | 185 | } |
188 | 186 | ||
187 | spin_unlock_irqrestore(&wait->lock, flags); | ||
188 | |||
189 | if (rc != -ETIMEDOUT) { | ||
190 | i2o_flush_reply(c, wait->m); | ||
191 | i2o_exec_wait_free(wait); | ||
192 | } | ||
193 | |||
189 | return rc; | 194 | return rc; |
190 | }; | 195 | }; |
191 | 196 | ||
@@ -213,7 +218,6 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, | |||
213 | { | 218 | { |
214 | struct i2o_exec_wait *wait, *tmp; | 219 | struct i2o_exec_wait *wait, *tmp; |
215 | unsigned long flags; | 220 | unsigned long flags; |
216 | static spinlock_t lock = SPIN_LOCK_UNLOCKED; | ||
217 | int rc = 1; | 221 | int rc = 1; |
218 | 222 | ||
219 | /* | 223 | /* |
@@ -223,23 +227,24 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, | |||
223 | * already expired. Not much we can do about that except log it for | 227 | * already expired. Not much we can do about that except log it for |
224 | * debug purposes, increase timeout, and recompile. | 228 | * debug purposes, increase timeout, and recompile. |
225 | */ | 229 | */ |
226 | spin_lock_irqsave(&lock, flags); | ||
227 | list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) { | 230 | list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) { |
228 | if (wait->tcntxt == context) { | 231 | if (wait->tcntxt == context) { |
229 | list_del(&wait->list); | 232 | spin_lock_irqsave(&wait->lock, flags); |
230 | 233 | ||
231 | spin_unlock_irqrestore(&lock, flags); | 234 | list_del(&wait->list); |
232 | 235 | ||
233 | wait->m = m; | 236 | wait->m = m; |
234 | wait->msg = msg; | 237 | wait->msg = msg; |
235 | wait->complete = 1; | 238 | wait->complete = 1; |
236 | 239 | ||
237 | barrier(); | 240 | if (wait->wq) |
238 | |||
239 | if (wait->wq) { | ||
240 | wake_up_interruptible(wait->wq); | ||
241 | rc = 0; | 241 | rc = 0; |
242 | } else { | 242 | else |
243 | rc = -1; | ||
244 | |||
245 | spin_unlock_irqrestore(&wait->lock, flags); | ||
246 | |||
247 | if (rc) { | ||
243 | struct device *dev; | 248 | struct device *dev; |
244 | 249 | ||
245 | dev = &c->pdev->dev; | 250 | dev = &c->pdev->dev; |
@@ -248,15 +253,13 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, | |||
248 | c->name); | 253 | c->name); |
249 | i2o_dma_free(dev, &wait->dma); | 254 | i2o_dma_free(dev, &wait->dma); |
250 | i2o_exec_wait_free(wait); | 255 | i2o_exec_wait_free(wait); |
251 | rc = -1; | 256 | } else |
252 | } | 257 | wake_up_interruptible(wait->wq); |
253 | 258 | ||
254 | return rc; | 259 | return rc; |
255 | } | 260 | } |
256 | } | 261 | } |
257 | 262 | ||
258 | spin_unlock_irqrestore(&lock, flags); | ||
259 | |||
260 | osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name, | 263 | osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name, |
261 | context); | 264 | context); |
262 | 265 | ||
@@ -322,14 +325,9 @@ static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL); | |||
322 | static int i2o_exec_probe(struct device *dev) | 325 | static int i2o_exec_probe(struct device *dev) |
323 | { | 326 | { |
324 | struct i2o_device *i2o_dev = to_i2o_device(dev); | 327 | struct i2o_device *i2o_dev = to_i2o_device(dev); |
325 | struct i2o_controller *c = i2o_dev->iop; | ||
326 | 328 | ||
327 | i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); | 329 | i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); |
328 | 330 | ||
329 | c->exec = i2o_dev; | ||
330 | |||
331 | i2o_exec_lct_notify(c, c->lct->change_ind + 1); | ||
332 | |||
333 | device_create_file(dev, &dev_attr_vendor_id); | 331 | device_create_file(dev, &dev_attr_vendor_id); |
334 | device_create_file(dev, &dev_attr_product_id); | 332 | device_create_file(dev, &dev_attr_product_id); |
335 | 333 | ||
@@ -523,6 +521,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) | |||
523 | struct device *dev; | 521 | struct device *dev; |
524 | struct i2o_message *msg; | 522 | struct i2o_message *msg; |
525 | 523 | ||
524 | down(&c->lct_lock); | ||
525 | |||
526 | dev = &c->pdev->dev; | 526 | dev = &c->pdev->dev; |
527 | 527 | ||
528 | if (i2o_dma_realloc | 528 | if (i2o_dma_realloc |
@@ -545,6 +545,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) | |||
545 | 545 | ||
546 | i2o_msg_post(c, msg); | 546 | i2o_msg_post(c, msg); |
547 | 547 | ||
548 | up(&c->lct_lock); | ||
549 | |||
548 | return 0; | 550 | return 0; |
549 | }; | 551 | }; |
550 | 552 | ||
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index 492167446936..febbdd4e0605 100644 --- a/drivers/message/i2o/iop.c +++ b/drivers/message/i2o/iop.c | |||
@@ -804,8 +804,6 @@ void i2o_iop_remove(struct i2o_controller *c) | |||
804 | 804 | ||
805 | /* Ask the IOP to switch to RESET state */ | 805 | /* Ask the IOP to switch to RESET state */ |
806 | i2o_iop_reset(c); | 806 | i2o_iop_reset(c); |
807 | |||
808 | put_device(&c->device); | ||
809 | } | 807 | } |
810 | 808 | ||
811 | /** | 809 | /** |
@@ -1059,7 +1057,7 @@ struct i2o_controller *i2o_iop_alloc(void) | |||
1059 | 1057 | ||
1060 | snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name); | 1058 | snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name); |
1061 | if (i2o_pool_alloc | 1059 | if (i2o_pool_alloc |
1062 | (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4, | 1060 | (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4 + sizeof(u32), |
1063 | I2O_MSG_INPOOL_MIN)) { | 1061 | I2O_MSG_INPOOL_MIN)) { |
1064 | kfree(c); | 1062 | kfree(c); |
1065 | return ERR_PTR(-ENOMEM); | 1063 | return ERR_PTR(-ENOMEM); |
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 003b077c2324..45bcf098e762 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig | |||
@@ -84,7 +84,7 @@ config MMC_WBSD | |||
84 | 84 | ||
85 | config MMC_AU1X | 85 | config MMC_AU1X |
86 | tristate "Alchemy AU1XX0 MMC Card Interface support" | 86 | tristate "Alchemy AU1XX0 MMC Card Interface support" |
87 | depends on SOC_AU1X00 && MMC | 87 | depends on MMC && SOC_AU1200 |
88 | help | 88 | help |
89 | This selects the AMD Alchemy(R) Multimedia card interface. | 89 | This selects the AMD Alchemy(R) Multimedia card interface. |
90 | If you have a Alchemy platform with a MMC slot, say Y or M here. | 90 | If you have a Alchemy platform with a MMC slot, say Y or M here. |
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c index 914d62b24064..5dc4bee7abeb 100644 --- a/drivers/mmc/au1xmmc.c +++ b/drivers/mmc/au1xmmc.c | |||
@@ -310,7 +310,7 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) | |||
310 | } | 310 | } |
311 | else | 311 | else |
312 | data->bytes_xfered = | 312 | data->bytes_xfered = |
313 | (data->blocks * (1 << data->blksz_bits)) - | 313 | (data->blocks * data->blksz) - |
314 | host->pio.len; | 314 | host->pio.len; |
315 | } | 315 | } |
316 | 316 | ||
@@ -575,7 +575,7 @@ static int | |||
575 | au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data) | 575 | au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data) |
576 | { | 576 | { |
577 | 577 | ||
578 | int datalen = data->blocks * (1 << data->blksz_bits); | 578 | int datalen = data->blocks * data->blksz; |
579 | 579 | ||
580 | if (dma != 0) | 580 | if (dma != 0) |
581 | host->flags |= HOST_F_DMA; | 581 | host->flags |= HOST_F_DMA; |
@@ -596,7 +596,7 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data) | |||
596 | if (host->dma.len == 0) | 596 | if (host->dma.len == 0) |
597 | return MMC_ERR_TIMEOUT; | 597 | return MMC_ERR_TIMEOUT; |
598 | 598 | ||
599 | au_writel((1 << data->blksz_bits) - 1, HOST_BLKSIZE(host)); | 599 | au_writel(data->blksz - 1, HOST_BLKSIZE(host)); |
600 | 600 | ||
601 | if (host->flags & HOST_F_DMA) { | 601 | if (host->flags & HOST_F_DMA) { |
602 | int i; | 602 | int i; |
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c index 79358e223f57..a4eb1d0e7a71 100644 --- a/drivers/mmc/imxmmc.c +++ b/drivers/mmc/imxmmc.c | |||
@@ -218,8 +218,10 @@ static int imxmci_busy_wait_for_status(struct imxmci_host *host, | |||
218 | if(!loops) | 218 | if(!loops) |
219 | return 0; | 219 | return 0; |
220 | 220 | ||
221 | dev_info(mmc_dev(host->mmc), "busy wait for %d usec in %s, STATUS = 0x%x (0x%x)\n", | 221 | /* The busy-wait is expected there for clock <8MHz due to SDHC hardware flaws */ |
222 | loops, where, *pstat, stat_mask); | 222 | if(!(stat_mask & STATUS_END_CMD_RESP) || (host->mmc->ios.clock>=8000000)) |
223 | dev_info(mmc_dev(host->mmc), "busy wait for %d usec in %s, STATUS = 0x%x (0x%x)\n", | ||
224 | loops, where, *pstat, stat_mask); | ||
223 | return loops; | 225 | return loops; |
224 | } | 226 | } |
225 | 227 | ||
@@ -333,6 +335,9 @@ static void imxmci_start_cmd(struct imxmci_host *host, struct mmc_command *cmd, | |||
333 | WARN_ON(host->cmd != NULL); | 335 | WARN_ON(host->cmd != NULL); |
334 | host->cmd = cmd; | 336 | host->cmd = cmd; |
335 | 337 | ||
338 | /* Ensure, that clock are stopped else command programming and start fails */ | ||
339 | imxmci_stop_clock(host); | ||
340 | |||
336 | if (cmd->flags & MMC_RSP_BUSY) | 341 | if (cmd->flags & MMC_RSP_BUSY) |
337 | cmdat |= CMD_DAT_CONT_BUSY; | 342 | cmdat |= CMD_DAT_CONT_BUSY; |
338 | 343 | ||
@@ -553,7 +558,7 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
553 | int trans_done = 0; | 558 | int trans_done = 0; |
554 | unsigned int stat = *pstat; | 559 | unsigned int stat = *pstat; |
555 | 560 | ||
556 | if(host->actual_bus_width == MMC_BUS_WIDTH_4) | 561 | if(host->actual_bus_width != MMC_BUS_WIDTH_4) |
557 | burst_len = 16; | 562 | burst_len = 16; |
558 | else | 563 | else |
559 | burst_len = 64; | 564 | burst_len = 64; |
@@ -591,8 +596,7 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
591 | stat = MMC_STATUS; | 596 | stat = MMC_STATUS; |
592 | 597 | ||
593 | /* Flush extra bytes from FIFO */ | 598 | /* Flush extra bytes from FIFO */ |
594 | while(flush_len >= 2){ | 599 | while(flush_len && !(stat & STATUS_DATA_TRANS_DONE)){ |
595 | flush_len -= 2; | ||
596 | i = MMC_BUFFER_ACCESS; | 600 | i = MMC_BUFFER_ACCESS; |
597 | stat = MMC_STATUS; | 601 | stat = MMC_STATUS; |
598 | stat &= ~STATUS_CRC_READ_ERR; /* Stupid but required there */ | 602 | stat &= ~STATUS_CRC_READ_ERR; /* Stupid but required there */ |
@@ -746,10 +750,6 @@ static void imxmci_tasklet_fnc(unsigned long data) | |||
746 | data_dir_mask = STATUS_DATA_TRANS_DONE; | 750 | data_dir_mask = STATUS_DATA_TRANS_DONE; |
747 | } | 751 | } |
748 | 752 | ||
749 | imxmci_busy_wait_for_status(host, &stat, | ||
750 | data_dir_mask, | ||
751 | 50, "imxmci_tasklet_fnc data"); | ||
752 | |||
753 | if(stat & data_dir_mask) { | 753 | if(stat & data_dir_mask) { |
754 | clear_bit(IMXMCI_PEND_DMA_END_b, &host->pending_events); | 754 | clear_bit(IMXMCI_PEND_DMA_END_b, &host->pending_events); |
755 | imxmci_data_done(host, stat); | 755 | imxmci_data_done(host, stat); |
@@ -865,7 +865,11 @@ static void imxmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
865 | 865 | ||
866 | imxmci_stop_clock(host); | 866 | imxmci_stop_clock(host); |
867 | MMC_CLK_RATE = (prescaler<<3) | clk; | 867 | MMC_CLK_RATE = (prescaler<<3) | clk; |
868 | imxmci_start_clock(host); | 868 | /* |
869 | * Under my understanding, clock should not be started there, because it would | ||
870 | * initiate SDHC sequencer and send last or random command into card | ||
871 | */ | ||
872 | /*imxmci_start_clock(host);*/ | ||
869 | 873 | ||
870 | dev_dbg(mmc_dev(host->mmc), "MMC_CLK_RATE: 0x%08x\n", MMC_CLK_RATE); | 874 | dev_dbg(mmc_dev(host->mmc), "MMC_CLK_RATE: 0x%08x\n", MMC_CLK_RATE); |
871 | } else { | 875 | } else { |
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 1ca2c8b9c9b5..6201f3086a02 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c | |||
@@ -951,6 +951,7 @@ static void mmc_read_scrs(struct mmc_host *host) | |||
951 | data.timeout_ns = card->csd.tacc_ns * 10; | 951 | data.timeout_ns = card->csd.tacc_ns * 10; |
952 | data.timeout_clks = card->csd.tacc_clks * 10; | 952 | data.timeout_clks = card->csd.tacc_clks * 10; |
953 | data.blksz_bits = 3; | 953 | data.blksz_bits = 3; |
954 | data.blksz = 1 << 3; | ||
954 | data.blocks = 1; | 955 | data.blocks = 1; |
955 | data.flags = MMC_DATA_READ; | 956 | data.flags = MMC_DATA_READ; |
956 | data.sg = &sg; | 957 | data.sg = &sg; |
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index 06bd1f4cb9b1..587458b370b9 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -175,6 +175,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
175 | brq.data.timeout_ns = card->csd.tacc_ns * 10; | 175 | brq.data.timeout_ns = card->csd.tacc_ns * 10; |
176 | brq.data.timeout_clks = card->csd.tacc_clks * 10; | 176 | brq.data.timeout_clks = card->csd.tacc_clks * 10; |
177 | brq.data.blksz_bits = md->block_bits; | 177 | brq.data.blksz_bits = md->block_bits; |
178 | brq.data.blksz = 1 << md->block_bits; | ||
178 | brq.data.blocks = req->nr_sectors >> (md->block_bits - 9); | 179 | brq.data.blocks = req->nr_sectors >> (md->block_bits - 9); |
179 | brq.stop.opcode = MMC_STOP_TRANSMISSION; | 180 | brq.stop.opcode = MMC_STOP_TRANSMISSION; |
180 | brq.stop.arg = 0; | 181 | brq.stop.arg = 0; |
@@ -352,7 +353,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) | |||
352 | */ | 353 | */ |
353 | printk(KERN_ERR "%s: unable to select block size for " | 354 | printk(KERN_ERR "%s: unable to select block size for " |
354 | "writing (rb%u wb%u rp%u wp%u)\n", | 355 | "writing (rb%u wb%u rp%u wp%u)\n", |
355 | md->disk->disk_name, | 356 | mmc_card_id(card), |
356 | 1 << card->csd.read_blkbits, | 357 | 1 << card->csd.read_blkbits, |
357 | 1 << card->csd.write_blkbits, | 358 | 1 << card->csd.write_blkbits, |
358 | card->csd.read_partial, | 359 | card->csd.read_partial, |
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c index f97b472085cb..b49368fd96b8 100644 --- a/drivers/mmc/pxamci.c +++ b/drivers/mmc/pxamci.c | |||
@@ -119,7 +119,7 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data) | |||
119 | nob = 0xffff; | 119 | nob = 0xffff; |
120 | 120 | ||
121 | writel(nob, host->base + MMC_NOB); | 121 | writel(nob, host->base + MMC_NOB); |
122 | writel(1 << data->blksz_bits, host->base + MMC_BLKLEN); | 122 | writel(data->blksz, host->base + MMC_BLKLEN); |
123 | 123 | ||
124 | clks = (unsigned long long)data->timeout_ns * CLOCKRATE; | 124 | clks = (unsigned long long)data->timeout_ns * CLOCKRATE; |
125 | do_div(clks, 1000000000UL); | 125 | do_div(clks, 1000000000UL); |
@@ -283,7 +283,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat) | |||
283 | * data blocks as being in error. | 283 | * data blocks as being in error. |
284 | */ | 284 | */ |
285 | if (data->error == MMC_ERR_NONE) | 285 | if (data->error == MMC_ERR_NONE) |
286 | data->bytes_xfered = data->blocks << data->blksz_bits; | 286 | data->bytes_xfered = data->blocks * data->blksz; |
287 | else | 287 | else |
288 | data->bytes_xfered = 0; | 288 | data->bytes_xfered = 0; |
289 | 289 | ||
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index 39b3d97f891e..8167332d4013 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -662,14 +662,14 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) | |||
662 | unsigned long dmaflags; | 662 | unsigned long dmaflags; |
663 | 663 | ||
664 | DBGF("blksz %04x blks %04x flags %08x\n", | 664 | DBGF("blksz %04x blks %04x flags %08x\n", |
665 | 1 << data->blksz_bits, data->blocks, data->flags); | 665 | data->blksz, data->blocks, data->flags); |
666 | DBGF("tsac %d ms nsac %d clk\n", | 666 | DBGF("tsac %d ms nsac %d clk\n", |
667 | data->timeout_ns / 1000000, data->timeout_clks); | 667 | data->timeout_ns / 1000000, data->timeout_clks); |
668 | 668 | ||
669 | /* | 669 | /* |
670 | * Calculate size. | 670 | * Calculate size. |
671 | */ | 671 | */ |
672 | host->size = data->blocks << data->blksz_bits; | 672 | host->size = data->blocks * data->blksz; |
673 | 673 | ||
674 | /* | 674 | /* |
675 | * Check timeout values for overflow. | 675 | * Check timeout values for overflow. |
@@ -696,12 +696,12 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) | |||
696 | * Two bytes are needed for each data line. | 696 | * Two bytes are needed for each data line. |
697 | */ | 697 | */ |
698 | if (host->bus_width == MMC_BUS_WIDTH_1) { | 698 | if (host->bus_width == MMC_BUS_WIDTH_1) { |
699 | blksize = (1 << data->blksz_bits) + 2; | 699 | blksize = data->blksz + 2; |
700 | 700 | ||
701 | wbsd_write_index(host, WBSD_IDX_PBSMSB, (blksize >> 4) & 0xF0); | 701 | wbsd_write_index(host, WBSD_IDX_PBSMSB, (blksize >> 4) & 0xF0); |
702 | wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); | 702 | wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); |
703 | } else if (host->bus_width == MMC_BUS_WIDTH_4) { | 703 | } else if (host->bus_width == MMC_BUS_WIDTH_4) { |
704 | blksize = (1 << data->blksz_bits) + 2 * 4; | 704 | blksize = data->blksz + 2 * 4; |
705 | 705 | ||
706 | wbsd_write_index(host, WBSD_IDX_PBSMSB, | 706 | wbsd_write_index(host, WBSD_IDX_PBSMSB, |
707 | ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); | 707 | ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 3d306681919e..d8233e0b7899 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -650,9 +650,11 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
650 | 650 | ||
651 | /* Hardware bug work-around, the chip is unable to do PCI DMA | 651 | /* Hardware bug work-around, the chip is unable to do PCI DMA |
652 | to/from anything above 1GB :-( */ | 652 | to/from anything above 1GB :-( */ |
653 | if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { | 653 | if (dma_mapping_error(mapping) || |
654 | mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { | ||
654 | /* Sigh... */ | 655 | /* Sigh... */ |
655 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | 656 | if (!dma_mapping_error(mapping)) |
657 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | ||
656 | dev_kfree_skb_any(skb); | 658 | dev_kfree_skb_any(skb); |
657 | skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA); | 659 | skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA); |
658 | if (skb == NULL) | 660 | if (skb == NULL) |
@@ -660,8 +662,10 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
660 | mapping = pci_map_single(bp->pdev, skb->data, | 662 | mapping = pci_map_single(bp->pdev, skb->data, |
661 | RX_PKT_BUF_SZ, | 663 | RX_PKT_BUF_SZ, |
662 | PCI_DMA_FROMDEVICE); | 664 | PCI_DMA_FROMDEVICE); |
663 | if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { | 665 | if (dma_mapping_error(mapping) || |
664 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | 666 | mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { |
667 | if (!dma_mapping_error(mapping)) | ||
668 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | ||
665 | dev_kfree_skb_any(skb); | 669 | dev_kfree_skb_any(skb); |
666 | return -ENOMEM; | 670 | return -ENOMEM; |
667 | } | 671 | } |
@@ -967,9 +971,10 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
967 | } | 971 | } |
968 | 972 | ||
969 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); | 973 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); |
970 | if (mapping + len > B44_DMA_MASK) { | 974 | if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) { |
971 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ | 975 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ |
972 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); | 976 | if (!dma_mapping_error(mapping)) |
977 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); | ||
973 | 978 | ||
974 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, | 979 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, |
975 | GFP_ATOMIC|GFP_DMA); | 980 | GFP_ATOMIC|GFP_DMA); |
@@ -978,8 +983,9 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
978 | 983 | ||
979 | mapping = pci_map_single(bp->pdev, bounce_skb->data, | 984 | mapping = pci_map_single(bp->pdev, bounce_skb->data, |
980 | len, PCI_DMA_TODEVICE); | 985 | len, PCI_DMA_TODEVICE); |
981 | if (mapping + len > B44_DMA_MASK) { | 986 | if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) { |
982 | pci_unmap_single(bp->pdev, mapping, | 987 | if (!dma_mapping_error(mapping)) |
988 | pci_unmap_single(bp->pdev, mapping, | ||
983 | len, PCI_DMA_TODEVICE); | 989 | len, PCI_DMA_TODEVICE); |
984 | dev_kfree_skb_any(bounce_skb); | 990 | dev_kfree_skb_any(bounce_skb); |
985 | goto err_out; | 991 | goto err_out; |
@@ -1203,7 +1209,8 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1203 | DMA_TABLE_BYTES, | 1209 | DMA_TABLE_BYTES, |
1204 | DMA_BIDIRECTIONAL); | 1210 | DMA_BIDIRECTIONAL); |
1205 | 1211 | ||
1206 | if (rx_ring_dma + size > B44_DMA_MASK) { | 1212 | if (dma_mapping_error(rx_ring_dma) || |
1213 | rx_ring_dma + size > B44_DMA_MASK) { | ||
1207 | kfree(rx_ring); | 1214 | kfree(rx_ring); |
1208 | goto out_err; | 1215 | goto out_err; |
1209 | } | 1216 | } |
@@ -1229,7 +1236,8 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1229 | DMA_TABLE_BYTES, | 1236 | DMA_TABLE_BYTES, |
1230 | DMA_TO_DEVICE); | 1237 | DMA_TO_DEVICE); |
1231 | 1238 | ||
1232 | if (tx_ring_dma + size > B44_DMA_MASK) { | 1239 | if (dma_mapping_error(tx_ring_dma) || |
1240 | tx_ring_dma + size > B44_DMA_MASK) { | ||
1233 | kfree(tx_ring); | 1241 | kfree(tx_ring); |
1234 | goto out_err; | 1242 | goto out_err; |
1235 | } | 1243 | } |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 5ca99e26660a..54161aef3cac 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -55,8 +55,8 @@ | |||
55 | 55 | ||
56 | #define DRV_MODULE_NAME "bnx2" | 56 | #define DRV_MODULE_NAME "bnx2" |
57 | #define PFX DRV_MODULE_NAME ": " | 57 | #define PFX DRV_MODULE_NAME ": " |
58 | #define DRV_MODULE_VERSION "1.4.39" | 58 | #define DRV_MODULE_VERSION "1.4.40" |
59 | #define DRV_MODULE_RELDATE "March 22, 2006" | 59 | #define DRV_MODULE_RELDATE "May 22, 2006" |
60 | 60 | ||
61 | #define RUN_AT(x) (jiffies + (x)) | 61 | #define RUN_AT(x) (jiffies + (x)) |
62 | 62 | ||
@@ -2945,7 +2945,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
2945 | int buf_size) | 2945 | int buf_size) |
2946 | { | 2946 | { |
2947 | u32 written, offset32, len32; | 2947 | u32 written, offset32, len32; |
2948 | u8 *buf, start[4], end[4]; | 2948 | u8 *buf, start[4], end[4], *flash_buffer = NULL; |
2949 | int rc = 0; | 2949 | int rc = 0; |
2950 | int align_start, align_end; | 2950 | int align_start, align_end; |
2951 | 2951 | ||
@@ -2985,12 +2985,19 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
2985 | memcpy(buf + align_start, data_buf, buf_size); | 2985 | memcpy(buf + align_start, data_buf, buf_size); |
2986 | } | 2986 | } |
2987 | 2987 | ||
2988 | if (bp->flash_info->buffered == 0) { | ||
2989 | flash_buffer = kmalloc(264, GFP_KERNEL); | ||
2990 | if (flash_buffer == NULL) { | ||
2991 | rc = -ENOMEM; | ||
2992 | goto nvram_write_end; | ||
2993 | } | ||
2994 | } | ||
2995 | |||
2988 | written = 0; | 2996 | written = 0; |
2989 | while ((written < len32) && (rc == 0)) { | 2997 | while ((written < len32) && (rc == 0)) { |
2990 | u32 page_start, page_end, data_start, data_end; | 2998 | u32 page_start, page_end, data_start, data_end; |
2991 | u32 addr, cmd_flags; | 2999 | u32 addr, cmd_flags; |
2992 | int i; | 3000 | int i; |
2993 | u8 flash_buffer[264]; | ||
2994 | 3001 | ||
2995 | /* Find the page_start addr */ | 3002 | /* Find the page_start addr */ |
2996 | page_start = offset32 + written; | 3003 | page_start = offset32 + written; |
@@ -3061,7 +3068,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3061 | } | 3068 | } |
3062 | 3069 | ||
3063 | /* Loop to write the new data from data_start to data_end */ | 3070 | /* Loop to write the new data from data_start to data_end */ |
3064 | for (addr = data_start; addr < data_end; addr += 4, i++) { | 3071 | for (addr = data_start; addr < data_end; addr += 4, i += 4) { |
3065 | if ((addr == page_end - 4) || | 3072 | if ((addr == page_end - 4) || |
3066 | ((bp->flash_info->buffered) && | 3073 | ((bp->flash_info->buffered) && |
3067 | (addr == data_end - 4))) { | 3074 | (addr == data_end - 4))) { |
@@ -3109,6 +3116,9 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3109 | } | 3116 | } |
3110 | 3117 | ||
3111 | nvram_write_end: | 3118 | nvram_write_end: |
3119 | if (bp->flash_info->buffered == 0) | ||
3120 | kfree(flash_buffer); | ||
3121 | |||
3112 | if (align_start || align_end) | 3122 | if (align_start || align_end) |
3113 | kfree(buf); | 3123 | kfree(buf); |
3114 | return rc; | 3124 | return rc; |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 1ddefd281213..038447fb5c5e 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #define DRV_VERSION "v1.17b" | 53 | #define DRV_VERSION "v1.17b" |
54 | #define DRV_RELDATE "2006/03/10" | 54 | #define DRV_RELDATE "2006/03/10" |
55 | #include "dl2k.h" | 55 | #include "dl2k.h" |
56 | #include <linux/dma-mapping.h> | ||
56 | 57 | ||
57 | static char version[] __devinitdata = | 58 | static char version[] __devinitdata = |
58 | KERN_INFO DRV_NAME " " DRV_VERSION " " DRV_RELDATE "\n"; | 59 | KERN_INFO DRV_NAME " " DRV_VERSION " " DRV_RELDATE "\n"; |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index ecccca35c6f4..d1c705b412c2 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -870,13 +870,16 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) | |||
870 | *data = 0; | 870 | *data = 0; |
871 | 871 | ||
872 | /* Hook up test interrupt handler just for this test */ | 872 | /* Hook up test interrupt handler just for this test */ |
873 | if (!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) { | 873 | if (!request_irq(irq, &e1000_test_intr, SA_PROBEIRQ, netdev->name, |
874 | netdev)) { | ||
874 | shared_int = FALSE; | 875 | shared_int = FALSE; |
875 | } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ, | 876 | } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ, |
876 | netdev->name, netdev)){ | 877 | netdev->name, netdev)){ |
877 | *data = 1; | 878 | *data = 1; |
878 | return -1; | 879 | return -1; |
879 | } | 880 | } |
881 | DPRINTK(PROBE,INFO, "testing %s interrupt\n", | ||
882 | (shared_int ? "shared" : "unshared")); | ||
880 | 883 | ||
881 | /* Disable all the interrupts */ | 884 | /* Disable all the interrupts */ |
882 | E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); | 885 | E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index c99e87838f92..97e71a4fe8eb 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -220,6 +220,7 @@ static void e1000_restore_vlan(struct e1000_adapter *adapter); | |||
220 | static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); | 220 | static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); |
221 | static int e1000_resume(struct pci_dev *pdev); | 221 | static int e1000_resume(struct pci_dev *pdev); |
222 | #endif | 222 | #endif |
223 | static void e1000_shutdown(struct pci_dev *pdev); | ||
223 | 224 | ||
224 | #ifdef CONFIG_NET_POLL_CONTROLLER | 225 | #ifdef CONFIG_NET_POLL_CONTROLLER |
225 | /* for netdump / net console */ | 226 | /* for netdump / net console */ |
@@ -235,8 +236,9 @@ static struct pci_driver e1000_driver = { | |||
235 | /* Power Managment Hooks */ | 236 | /* Power Managment Hooks */ |
236 | #ifdef CONFIG_PM | 237 | #ifdef CONFIG_PM |
237 | .suspend = e1000_suspend, | 238 | .suspend = e1000_suspend, |
238 | .resume = e1000_resume | 239 | .resume = e1000_resume, |
239 | #endif | 240 | #endif |
241 | .shutdown = e1000_shutdown | ||
240 | }; | 242 | }; |
241 | 243 | ||
242 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); | 244 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); |
@@ -3517,7 +3519,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3517 | buffer_info = &rx_ring->buffer_info[i]; | 3519 | buffer_info = &rx_ring->buffer_info[i]; |
3518 | 3520 | ||
3519 | while (rx_desc->status & E1000_RXD_STAT_DD) { | 3521 | while (rx_desc->status & E1000_RXD_STAT_DD) { |
3520 | struct sk_buff *skb, *next_skb; | 3522 | struct sk_buff *skb; |
3521 | u8 status; | 3523 | u8 status; |
3522 | #ifdef CONFIG_E1000_NAPI | 3524 | #ifdef CONFIG_E1000_NAPI |
3523 | if (*work_done >= work_to_do) | 3525 | if (*work_done >= work_to_do) |
@@ -3535,8 +3537,6 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3535 | prefetch(next_rxd); | 3537 | prefetch(next_rxd); |
3536 | 3538 | ||
3537 | next_buffer = &rx_ring->buffer_info[i]; | 3539 | next_buffer = &rx_ring->buffer_info[i]; |
3538 | next_skb = next_buffer->skb; | ||
3539 | prefetch(next_skb->data - NET_IP_ALIGN); | ||
3540 | 3540 | ||
3541 | cleaned = TRUE; | 3541 | cleaned = TRUE; |
3542 | cleaned_count++; | 3542 | cleaned_count++; |
@@ -3666,7 +3666,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
3666 | struct e1000_buffer *buffer_info, *next_buffer; | 3666 | struct e1000_buffer *buffer_info, *next_buffer; |
3667 | struct e1000_ps_page *ps_page; | 3667 | struct e1000_ps_page *ps_page; |
3668 | struct e1000_ps_page_dma *ps_page_dma; | 3668 | struct e1000_ps_page_dma *ps_page_dma; |
3669 | struct sk_buff *skb, *next_skb; | 3669 | struct sk_buff *skb; |
3670 | unsigned int i, j; | 3670 | unsigned int i, j; |
3671 | uint32_t length, staterr; | 3671 | uint32_t length, staterr; |
3672 | int cleaned_count = 0; | 3672 | int cleaned_count = 0; |
@@ -3695,8 +3695,6 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
3695 | prefetch(next_rxd); | 3695 | prefetch(next_rxd); |
3696 | 3696 | ||
3697 | next_buffer = &rx_ring->buffer_info[i]; | 3697 | next_buffer = &rx_ring->buffer_info[i]; |
3698 | next_skb = next_buffer->skb; | ||
3699 | prefetch(next_skb->data - NET_IP_ALIGN); | ||
3700 | 3698 | ||
3701 | cleaned = TRUE; | 3699 | cleaned = TRUE; |
3702 | cleaned_count++; | 3700 | cleaned_count++; |
@@ -4611,6 +4609,12 @@ e1000_resume(struct pci_dev *pdev) | |||
4611 | return 0; | 4609 | return 0; |
4612 | } | 4610 | } |
4613 | #endif | 4611 | #endif |
4612 | |||
4613 | static void e1000_shutdown(struct pci_dev *pdev) | ||
4614 | { | ||
4615 | e1000_suspend(pdev, PMSG_SUSPEND); | ||
4616 | } | ||
4617 | |||
4614 | #ifdef CONFIG_NET_POLL_CONTROLLER | 4618 | #ifdef CONFIG_NET_POLL_CONTROLLER |
4615 | /* | 4619 | /* |
4616 | * Polling 'interrupt' - used by things like netconsole to send skbs | 4620 | * Polling 'interrupt' - used by things like netconsole to send skbs |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index f7235c9bc421..feb5b223cd60 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -2615,6 +2615,18 @@ static int nv_nway_reset(struct net_device *dev) | |||
2615 | return ret; | 2615 | return ret; |
2616 | } | 2616 | } |
2617 | 2617 | ||
2618 | #ifdef NETIF_F_TSO | ||
2619 | static int nv_set_tso(struct net_device *dev, u32 value) | ||
2620 | { | ||
2621 | struct fe_priv *np = netdev_priv(dev); | ||
2622 | |||
2623 | if ((np->driver_data & DEV_HAS_CHECKSUM)) | ||
2624 | return ethtool_op_set_tso(dev, value); | ||
2625 | else | ||
2626 | return value ? -EOPNOTSUPP : 0; | ||
2627 | } | ||
2628 | #endif | ||
2629 | |||
2618 | static struct ethtool_ops ops = { | 2630 | static struct ethtool_ops ops = { |
2619 | .get_drvinfo = nv_get_drvinfo, | 2631 | .get_drvinfo = nv_get_drvinfo, |
2620 | .get_link = ethtool_op_get_link, | 2632 | .get_link = ethtool_op_get_link, |
@@ -2626,6 +2638,10 @@ static struct ethtool_ops ops = { | |||
2626 | .get_regs = nv_get_regs, | 2638 | .get_regs = nv_get_regs, |
2627 | .nway_reset = nv_nway_reset, | 2639 | .nway_reset = nv_nway_reset, |
2628 | .get_perm_addr = ethtool_op_get_perm_addr, | 2640 | .get_perm_addr = ethtool_op_get_perm_addr, |
2641 | #ifdef NETIF_F_TSO | ||
2642 | .get_tso = ethtool_op_get_tso, | ||
2643 | .set_tso = nv_set_tso | ||
2644 | #endif | ||
2629 | }; | 2645 | }; |
2630 | 2646 | ||
2631 | static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | 2647 | static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) |
@@ -2891,78 +2907,6 @@ static int nv_open(struct net_device *dev) | |||
2891 | goto out_drain; | 2907 | goto out_drain; |
2892 | } | 2908 | } |
2893 | 2909 | ||
2894 | if (np->msi_flags & NV_MSI_X_CAPABLE) { | ||
2895 | for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { | ||
2896 | np->msi_x_entry[i].entry = i; | ||
2897 | } | ||
2898 | if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) { | ||
2899 | np->msi_flags |= NV_MSI_X_ENABLED; | ||
2900 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { | ||
2901 | /* Request irq for rx handling */ | ||
2902 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) { | ||
2903 | printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret); | ||
2904 | pci_disable_msix(np->pci_dev); | ||
2905 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2906 | goto out_drain; | ||
2907 | } | ||
2908 | /* Request irq for tx handling */ | ||
2909 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) { | ||
2910 | printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret); | ||
2911 | pci_disable_msix(np->pci_dev); | ||
2912 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2913 | goto out_drain; | ||
2914 | } | ||
2915 | /* Request irq for link and timer handling */ | ||
2916 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) { | ||
2917 | printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret); | ||
2918 | pci_disable_msix(np->pci_dev); | ||
2919 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2920 | goto out_drain; | ||
2921 | } | ||
2922 | |||
2923 | /* map interrupts to their respective vector */ | ||
2924 | writel(0, base + NvRegMSIXMap0); | ||
2925 | writel(0, base + NvRegMSIXMap1); | ||
2926 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL); | ||
2927 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL); | ||
2928 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER); | ||
2929 | } else { | ||
2930 | /* Request irq for all interrupts */ | ||
2931 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { | ||
2932 | printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); | ||
2933 | pci_disable_msix(np->pci_dev); | ||
2934 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2935 | goto out_drain; | ||
2936 | } | ||
2937 | |||
2938 | /* map interrupts to vector 0 */ | ||
2939 | writel(0, base + NvRegMSIXMap0); | ||
2940 | writel(0, base + NvRegMSIXMap1); | ||
2941 | } | ||
2942 | } | ||
2943 | } | ||
2944 | if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { | ||
2945 | if ((ret = pci_enable_msi(np->pci_dev)) == 0) { | ||
2946 | np->msi_flags |= NV_MSI_ENABLED; | ||
2947 | if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { | ||
2948 | printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); | ||
2949 | pci_disable_msi(np->pci_dev); | ||
2950 | np->msi_flags &= ~NV_MSI_ENABLED; | ||
2951 | goto out_drain; | ||
2952 | } | ||
2953 | |||
2954 | /* map interrupts to vector 0 */ | ||
2955 | writel(0, base + NvRegMSIMap0); | ||
2956 | writel(0, base + NvRegMSIMap1); | ||
2957 | /* enable msi vector 0 */ | ||
2958 | writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask); | ||
2959 | } | ||
2960 | } | ||
2961 | if (ret != 0) { | ||
2962 | if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) | ||
2963 | goto out_drain; | ||
2964 | } | ||
2965 | |||
2966 | /* ask for interrupts */ | 2910 | /* ask for interrupts */ |
2967 | nv_enable_hw_interrupts(dev, np->irqmask); | 2911 | nv_enable_hw_interrupts(dev, np->irqmask); |
2968 | 2912 | ||
diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index 5e6d00752990..cff8598aa800 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig | |||
@@ -33,7 +33,7 @@ config DONGLE | |||
33 | 33 | ||
34 | config ESI_DONGLE | 34 | config ESI_DONGLE |
35 | tristate "ESI JetEye PC dongle" | 35 | tristate "ESI JetEye PC dongle" |
36 | depends on DONGLE && IRDA | 36 | depends on IRTTY_SIR && DONGLE && IRDA |
37 | help | 37 | help |
38 | Say Y here if you want to build support for the Extended Systems | 38 | Say Y here if you want to build support for the Extended Systems |
39 | JetEye PC dongle. To compile it as a module, choose M here. The ESI | 39 | JetEye PC dongle. To compile it as a module, choose M here. The ESI |
@@ -44,7 +44,7 @@ config ESI_DONGLE | |||
44 | 44 | ||
45 | config ACTISYS_DONGLE | 45 | config ACTISYS_DONGLE |
46 | tristate "ACTiSYS IR-220L and IR220L+ dongle" | 46 | tristate "ACTiSYS IR-220L and IR220L+ dongle" |
47 | depends on DONGLE && IRDA | 47 | depends on IRTTY_SIR && DONGLE && IRDA |
48 | help | 48 | help |
49 | Say Y here if you want to build support for the ACTiSYS IR-220L and | 49 | Say Y here if you want to build support for the ACTiSYS IR-220L and |
50 | IR220L+ dongles. To compile it as a module, choose M here. The | 50 | IR220L+ dongles. To compile it as a module, choose M here. The |
@@ -55,7 +55,7 @@ config ACTISYS_DONGLE | |||
55 | 55 | ||
56 | config TEKRAM_DONGLE | 56 | config TEKRAM_DONGLE |
57 | tristate "Tekram IrMate 210B dongle" | 57 | tristate "Tekram IrMate 210B dongle" |
58 | depends on DONGLE && IRDA | 58 | depends on IRTTY_SIR && DONGLE && IRDA |
59 | help | 59 | help |
60 | Say Y here if you want to build support for the Tekram IrMate 210B | 60 | Say Y here if you want to build support for the Tekram IrMate 210B |
61 | dongle. To compile it as a module, choose M here. The Tekram dongle | 61 | dongle. To compile it as a module, choose M here. The Tekram dongle |
@@ -66,7 +66,7 @@ config TEKRAM_DONGLE | |||
66 | 66 | ||
67 | config TOIM3232_DONGLE | 67 | config TOIM3232_DONGLE |
68 | tristate "TOIM3232 IrDa dongle" | 68 | tristate "TOIM3232 IrDa dongle" |
69 | depends on DONGLE && IRDA | 69 | depends on IRTTY_SIR && DONGLE && IRDA |
70 | help | 70 | help |
71 | Say Y here if you want to build support for the Vishay/Temic | 71 | Say Y here if you want to build support for the Vishay/Temic |
72 | TOIM3232 and TOIM4232 based dongles. | 72 | TOIM3232 and TOIM4232 based dongles. |
@@ -74,7 +74,7 @@ config TOIM3232_DONGLE | |||
74 | 74 | ||
75 | config LITELINK_DONGLE | 75 | config LITELINK_DONGLE |
76 | tristate "Parallax LiteLink dongle" | 76 | tristate "Parallax LiteLink dongle" |
77 | depends on DONGLE && IRDA | 77 | depends on IRTTY_SIR && DONGLE && IRDA |
78 | help | 78 | help |
79 | Say Y here if you want to build support for the Parallax Litelink | 79 | Say Y here if you want to build support for the Parallax Litelink |
80 | dongle. To compile it as a module, choose M here. The Parallax | 80 | dongle. To compile it as a module, choose M here. The Parallax |
@@ -85,7 +85,7 @@ config LITELINK_DONGLE | |||
85 | 85 | ||
86 | config MA600_DONGLE | 86 | config MA600_DONGLE |
87 | tristate "Mobile Action MA600 dongle" | 87 | tristate "Mobile Action MA600 dongle" |
88 | depends on DONGLE && IRDA && EXPERIMENTAL | 88 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
89 | help | 89 | help |
90 | Say Y here if you want to build support for the Mobile Action MA600 | 90 | Say Y here if you want to build support for the Mobile Action MA600 |
91 | dongle. To compile it as a module, choose M here. The MA600 dongle | 91 | dongle. To compile it as a module, choose M here. The MA600 dongle |
@@ -98,7 +98,7 @@ config MA600_DONGLE | |||
98 | 98 | ||
99 | config GIRBIL_DONGLE | 99 | config GIRBIL_DONGLE |
100 | tristate "Greenwich GIrBIL dongle" | 100 | tristate "Greenwich GIrBIL dongle" |
101 | depends on DONGLE && IRDA && EXPERIMENTAL | 101 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
102 | help | 102 | help |
103 | Say Y here if you want to build support for the Greenwich GIrBIL | 103 | Say Y here if you want to build support for the Greenwich GIrBIL |
104 | dongle. If you want to compile it as a module, choose M here. | 104 | dongle. If you want to compile it as a module, choose M here. |
@@ -109,7 +109,7 @@ config GIRBIL_DONGLE | |||
109 | 109 | ||
110 | config MCP2120_DONGLE | 110 | config MCP2120_DONGLE |
111 | tristate "Microchip MCP2120" | 111 | tristate "Microchip MCP2120" |
112 | depends on DONGLE && IRDA && EXPERIMENTAL | 112 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
113 | help | 113 | help |
114 | Say Y here if you want to build support for the Microchip MCP2120 | 114 | Say Y here if you want to build support for the Microchip MCP2120 |
115 | dongle. If you want to compile it as a module, choose M here. | 115 | dongle. If you want to compile it as a module, choose M here. |
@@ -123,7 +123,7 @@ config MCP2120_DONGLE | |||
123 | 123 | ||
124 | config OLD_BELKIN_DONGLE | 124 | config OLD_BELKIN_DONGLE |
125 | tristate "Old Belkin dongle" | 125 | tristate "Old Belkin dongle" |
126 | depends on DONGLE && IRDA && EXPERIMENTAL | 126 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
127 | help | 127 | help |
128 | Say Y here if you want to build support for the Adaptec Airport 1000 | 128 | Say Y here if you want to build support for the Adaptec Airport 1000 |
129 | and 2000 dongles. If you want to compile it as a module, choose | 129 | and 2000 dongles. If you want to compile it as a module, choose |
@@ -132,7 +132,7 @@ config OLD_BELKIN_DONGLE | |||
132 | 132 | ||
133 | config ACT200L_DONGLE | 133 | config ACT200L_DONGLE |
134 | tristate "ACTiSYS IR-200L dongle" | 134 | tristate "ACTiSYS IR-200L dongle" |
135 | depends on DONGLE && IRDA && EXPERIMENTAL | 135 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
136 | help | 136 | help |
137 | Say Y here if you want to build support for the ACTiSYS IR-200L | 137 | Say Y here if you want to build support for the ACTiSYS IR-200L |
138 | dongle. If you want to compile it as a module, choose M here. | 138 | dongle. If you want to compile it as a module, choose M here. |
diff --git a/drivers/net/ixp2000/enp2611.c b/drivers/net/ixp2000/enp2611.c index 6f7dce8eba51..b67f586d7392 100644 --- a/drivers/net/ixp2000/enp2611.c +++ b/drivers/net/ixp2000/enp2611.c | |||
@@ -149,6 +149,8 @@ static void enp2611_check_link_status(unsigned long __dummy) | |||
149 | int status; | 149 | int status; |
150 | 150 | ||
151 | dev = nds[i]; | 151 | dev = nds[i]; |
152 | if (dev == NULL) | ||
153 | continue; | ||
152 | 154 | ||
153 | status = pm3386_is_link_up(i); | 155 | status = pm3386_is_link_up(i); |
154 | if (status && !netif_carrier_ok(dev)) { | 156 | if (status && !netif_carrier_ok(dev)) { |
@@ -191,6 +193,7 @@ static void enp2611_set_port_admin_status(int port, int up) | |||
191 | 193 | ||
192 | static int __init enp2611_init_module(void) | 194 | static int __init enp2611_init_module(void) |
193 | { | 195 | { |
196 | int ports; | ||
194 | int i; | 197 | int i; |
195 | 198 | ||
196 | if (!machine_is_enp2611()) | 199 | if (!machine_is_enp2611()) |
@@ -199,7 +202,8 @@ static int __init enp2611_init_module(void) | |||
199 | caleb_reset(); | 202 | caleb_reset(); |
200 | pm3386_reset(); | 203 | pm3386_reset(); |
201 | 204 | ||
202 | for (i = 0; i < 3; i++) { | 205 | ports = pm3386_port_count(); |
206 | for (i = 0; i < ports; i++) { | ||
203 | nds[i] = ixpdev_alloc(i, sizeof(struct enp2611_ixpdev_priv)); | 207 | nds[i] = ixpdev_alloc(i, sizeof(struct enp2611_ixpdev_priv)); |
204 | if (nds[i] == NULL) { | 208 | if (nds[i] == NULL) { |
205 | while (--i >= 0) | 209 | while (--i >= 0) |
@@ -215,9 +219,10 @@ static int __init enp2611_init_module(void) | |||
215 | 219 | ||
216 | ixp2400_msf_init(&enp2611_msf_parameters); | 220 | ixp2400_msf_init(&enp2611_msf_parameters); |
217 | 221 | ||
218 | if (ixpdev_init(3, nds, enp2611_set_port_admin_status)) { | 222 | if (ixpdev_init(ports, nds, enp2611_set_port_admin_status)) { |
219 | for (i = 0; i < 3; i++) | 223 | for (i = 0; i < ports; i++) |
220 | free_netdev(nds[i]); | 224 | if (nds[i]) |
225 | free_netdev(nds[i]); | ||
221 | return -EINVAL; | 226 | return -EINVAL; |
222 | } | 227 | } |
223 | 228 | ||
diff --git a/drivers/net/ixp2000/pm3386.c b/drivers/net/ixp2000/pm3386.c index 5c7ab7564053..5224651c9aac 100644 --- a/drivers/net/ixp2000/pm3386.c +++ b/drivers/net/ixp2000/pm3386.c | |||
@@ -86,40 +86,53 @@ static void pm3386_port_reg_write(int port, int _reg, int spacing, u16 value) | |||
86 | pm3386_reg_write(port >> 1, reg, value); | 86 | pm3386_reg_write(port >> 1, reg, value); |
87 | } | 87 | } |
88 | 88 | ||
89 | int pm3386_secondary_present(void) | ||
90 | { | ||
91 | return pm3386_reg_read(1, 0) == 0x3386; | ||
92 | } | ||
89 | 93 | ||
90 | void pm3386_reset(void) | 94 | void pm3386_reset(void) |
91 | { | 95 | { |
92 | u8 mac[3][6]; | 96 | u8 mac[3][6]; |
97 | int secondary; | ||
98 | |||
99 | secondary = pm3386_secondary_present(); | ||
93 | 100 | ||
94 | /* Save programmed MAC addresses. */ | 101 | /* Save programmed MAC addresses. */ |
95 | pm3386_get_mac(0, mac[0]); | 102 | pm3386_get_mac(0, mac[0]); |
96 | pm3386_get_mac(1, mac[1]); | 103 | pm3386_get_mac(1, mac[1]); |
97 | pm3386_get_mac(2, mac[2]); | 104 | if (secondary) |
105 | pm3386_get_mac(2, mac[2]); | ||
98 | 106 | ||
99 | /* Assert analog and digital reset. */ | 107 | /* Assert analog and digital reset. */ |
100 | pm3386_reg_write(0, 0x002, 0x0060); | 108 | pm3386_reg_write(0, 0x002, 0x0060); |
101 | pm3386_reg_write(1, 0x002, 0x0060); | 109 | if (secondary) |
110 | pm3386_reg_write(1, 0x002, 0x0060); | ||
102 | mdelay(1); | 111 | mdelay(1); |
103 | 112 | ||
104 | /* Deassert analog reset. */ | 113 | /* Deassert analog reset. */ |
105 | pm3386_reg_write(0, 0x002, 0x0062); | 114 | pm3386_reg_write(0, 0x002, 0x0062); |
106 | pm3386_reg_write(1, 0x002, 0x0062); | 115 | if (secondary) |
116 | pm3386_reg_write(1, 0x002, 0x0062); | ||
107 | mdelay(10); | 117 | mdelay(10); |
108 | 118 | ||
109 | /* Deassert digital reset. */ | 119 | /* Deassert digital reset. */ |
110 | pm3386_reg_write(0, 0x002, 0x0063); | 120 | pm3386_reg_write(0, 0x002, 0x0063); |
111 | pm3386_reg_write(1, 0x002, 0x0063); | 121 | if (secondary) |
122 | pm3386_reg_write(1, 0x002, 0x0063); | ||
112 | mdelay(10); | 123 | mdelay(10); |
113 | 124 | ||
114 | /* Restore programmed MAC addresses. */ | 125 | /* Restore programmed MAC addresses. */ |
115 | pm3386_set_mac(0, mac[0]); | 126 | pm3386_set_mac(0, mac[0]); |
116 | pm3386_set_mac(1, mac[1]); | 127 | pm3386_set_mac(1, mac[1]); |
117 | pm3386_set_mac(2, mac[2]); | 128 | if (secondary) |
129 | pm3386_set_mac(2, mac[2]); | ||
118 | 130 | ||
119 | /* Disable carrier on all ports. */ | 131 | /* Disable carrier on all ports. */ |
120 | pm3386_set_carrier(0, 0); | 132 | pm3386_set_carrier(0, 0); |
121 | pm3386_set_carrier(1, 0); | 133 | pm3386_set_carrier(1, 0); |
122 | pm3386_set_carrier(2, 0); | 134 | if (secondary) |
135 | pm3386_set_carrier(2, 0); | ||
123 | } | 136 | } |
124 | 137 | ||
125 | static u16 swaph(u16 x) | 138 | static u16 swaph(u16 x) |
@@ -127,6 +140,11 @@ static u16 swaph(u16 x) | |||
127 | return ((x << 8) | (x >> 8)) & 0xffff; | 140 | return ((x << 8) | (x >> 8)) & 0xffff; |
128 | } | 141 | } |
129 | 142 | ||
143 | int pm3386_port_count(void) | ||
144 | { | ||
145 | return 2 + pm3386_secondary_present(); | ||
146 | } | ||
147 | |||
130 | void pm3386_init_port(int port) | 148 | void pm3386_init_port(int port) |
131 | { | 149 | { |
132 | int pm = port >> 1; | 150 | int pm = port >> 1; |
diff --git a/drivers/net/ixp2000/pm3386.h b/drivers/net/ixp2000/pm3386.h index fe92bb056ac4..cc4183dca911 100644 --- a/drivers/net/ixp2000/pm3386.h +++ b/drivers/net/ixp2000/pm3386.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define __PM3386_H | 13 | #define __PM3386_H |
14 | 14 | ||
15 | void pm3386_reset(void); | 15 | void pm3386_reset(void); |
16 | int pm3386_port_count(void); | ||
16 | void pm3386_init_port(int port); | 17 | void pm3386_init_port(int port); |
17 | void pm3386_get_mac(int port, u8 *mac); | 18 | void pm3386_get_mac(int port, u8 *mac); |
18 | void pm3386_set_mac(int port, u8 *mac); | 19 | void pm3386_set_mac(int port, u8 *mac); |
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 66e74f740261..bf58db29e2ed 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -107,7 +107,7 @@ static int init_netconsole(void) | |||
107 | 107 | ||
108 | if(!configured) { | 108 | if(!configured) { |
109 | printk("netconsole: not configured, aborting\n"); | 109 | printk("netconsole: not configured, aborting\n"); |
110 | return -EINVAL; | 110 | return 0; |
111 | } | 111 | } |
112 | 112 | ||
113 | if(netpoll_setup(&np)) | 113 | if(netpoll_setup(&np)) |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 448a09488529..2ea66aca648b 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -1691,17 +1691,6 @@ static void do_set_multicast_list(struct net_device *dev) | |||
1691 | memset(ei_local->mcfilter, 0xFF, 8); | 1691 | memset(ei_local->mcfilter, 0xFF, 8); |
1692 | } | 1692 | } |
1693 | 1693 | ||
1694 | /* | ||
1695 | * DP8390 manuals don't specify any magic sequence for altering | ||
1696 | * the multicast regs on an already running card. To be safe, we | ||
1697 | * ensure multicast mode is off prior to loading up the new hash | ||
1698 | * table. If this proves to be not enough, we can always resort | ||
1699 | * to stopping the NIC, loading the table and then restarting. | ||
1700 | */ | ||
1701 | |||
1702 | if (netif_running(dev)) | ||
1703 | outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR); | ||
1704 | |||
1705 | outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD); | 1694 | outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD); |
1706 | for(i = 0; i < 8; i++) | 1695 | for(i = 0; i < 8; i++) |
1707 | { | 1696 | { |
@@ -1715,6 +1704,8 @@ static void do_set_multicast_list(struct net_device *dev) | |||
1715 | outb_p(E8390_RXCONFIG | 0x48, e8390_base + EN0_RXCR); | 1704 | outb_p(E8390_RXCONFIG | 0x48, e8390_base + EN0_RXCR); |
1716 | else | 1705 | else |
1717 | outb_p(E8390_RXCONFIG | 0x40, e8390_base + EN0_RXCR); | 1706 | outb_p(E8390_RXCONFIG | 0x40, e8390_base + EN0_RXCR); |
1707 | |||
1708 | outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD); | ||
1718 | } | 1709 | } |
1719 | 1710 | ||
1720 | /* | 1711 | /* |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 4260c2128f47..a8f6bfc96fd2 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1204,7 +1204,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
1204 | 1204 | ||
1205 | dev->last_rx = jiffies; | 1205 | dev->last_rx = jiffies; |
1206 | lp->linux_stats.rx_packets++; | 1206 | lp->linux_stats.rx_packets++; |
1207 | lp->linux_stats.rx_bytes += skb->len; | 1207 | lp->linux_stats.rx_bytes += pkt_len; |
1208 | outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ | 1208 | outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ |
1209 | continue; | 1209 | continue; |
1210 | } else { | 1210 | } else { |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 07c31f19c6ba..fc08c4af506c 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -1774,8 +1774,6 @@ static int pcnet32_open(struct net_device *dev) | |||
1774 | lp->rx_dma_addr[i] = 0; | 1774 | lp->rx_dma_addr[i] = 0; |
1775 | } | 1775 | } |
1776 | 1776 | ||
1777 | pcnet32_free_ring(dev); | ||
1778 | |||
1779 | /* | 1777 | /* |
1780 | * Switch back to 16bit mode to avoid problems with dumb | 1778 | * Switch back to 16bit mode to avoid problems with dumb |
1781 | * DOS packet driver after a warm reboot | 1779 | * DOS packet driver after a warm reboot |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 475dc930380f..0d101a18026a 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -861,6 +861,9 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
861 | * give dev_queue_xmit something it can free. | 861 | * give dev_queue_xmit something it can free. |
862 | */ | 862 | */ |
863 | skb2 = skb_clone(skb, GFP_ATOMIC); | 863 | skb2 = skb_clone(skb, GFP_ATOMIC); |
864 | |||
865 | if (skb2 == NULL) | ||
866 | goto abort; | ||
864 | } | 867 | } |
865 | 868 | ||
866 | ph = (struct pppoe_hdr *) skb_push(skb2, sizeof(struct pppoe_hdr)); | 869 | ph = (struct pppoe_hdr *) skb_push(skb2, sizeof(struct pppoe_hdr)); |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index a70c2b0cc104..5ca5a1b546a1 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -78,8 +78,7 @@ static const struct pci_device_id skge_id_table[] = { | |||
78 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, | 78 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, |
79 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, | 79 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, |
80 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, | 80 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, |
81 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, | 81 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) }, /* DGE-530T */ |
82 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) }, | ||
83 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, | 82 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, |
84 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ | 83 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ |
85 | { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) }, | 84 | { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) }, |
@@ -402,7 +401,7 @@ static int skge_set_ring_param(struct net_device *dev, | |||
402 | int err; | 401 | int err; |
403 | 402 | ||
404 | if (p->rx_pending == 0 || p->rx_pending > MAX_RX_RING_SIZE || | 403 | if (p->rx_pending == 0 || p->rx_pending > MAX_RX_RING_SIZE || |
405 | p->tx_pending == 0 || p->tx_pending > MAX_TX_RING_SIZE) | 404 | p->tx_pending < MAX_SKB_FRAGS+1 || p->tx_pending > MAX_TX_RING_SIZE) |
406 | return -EINVAL; | 405 | return -EINVAL; |
407 | 406 | ||
408 | skge->rx_ring.count = p->rx_pending; | 407 | skge->rx_ring.count = p->rx_pending; |
@@ -2717,8 +2716,7 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2717 | if (control & BMU_OWN) | 2716 | if (control & BMU_OWN) |
2718 | break; | 2717 | break; |
2719 | 2718 | ||
2720 | skb = skge_rx_get(skge, e, control, rd->status, | 2719 | skb = skge_rx_get(skge, e, control, rd->status, rd->csum2); |
2721 | le16_to_cpu(rd->csum2)); | ||
2722 | if (likely(skb)) { | 2720 | if (likely(skb)) { |
2723 | dev->last_rx = jiffies; | 2721 | dev->last_rx = jiffies; |
2724 | netif_receive_skb(skb); | 2722 | netif_receive_skb(skb); |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index ffd267fab21d..97fe95666f3b 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #include "sky2.h" | 51 | #include "sky2.h" |
52 | 52 | ||
53 | #define DRV_NAME "sky2" | 53 | #define DRV_NAME "sky2" |
54 | #define DRV_VERSION "1.3" | 54 | #define DRV_VERSION "1.4" |
55 | #define PFX DRV_NAME " " | 55 | #define PFX DRV_NAME " " |
56 | 56 | ||
57 | /* | 57 | /* |
@@ -105,6 +105,7 @@ MODULE_PARM_DESC(idle_timeout, "Idle timeout workaround for lost interrupts (ms) | |||
105 | static const struct pci_device_id sky2_id_table[] = { | 105 | static const struct pci_device_id sky2_id_table[] = { |
106 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, | 106 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, |
107 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, | 107 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, |
108 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, /* DGE-560T */ | ||
108 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, | 109 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, |
109 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, | 110 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, |
110 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, | 111 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, |
@@ -186,12 +187,11 @@ static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) | |||
186 | return v; | 187 | return v; |
187 | } | 188 | } |
188 | 189 | ||
189 | static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | 190 | static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) |
190 | { | 191 | { |
191 | u16 power_control; | 192 | u16 power_control; |
192 | u32 reg1; | 193 | u32 reg1; |
193 | int vaux; | 194 | int vaux; |
194 | int ret = 0; | ||
195 | 195 | ||
196 | pr_debug("sky2_set_power_state %d\n", state); | 196 | pr_debug("sky2_set_power_state %d\n", state); |
197 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 197 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
@@ -235,6 +235,7 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
235 | } | 235 | } |
236 | 236 | ||
237 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { | 237 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { |
238 | sky2_write16(hw, B0_CTST, Y2_HW_WOL_ON); | ||
238 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); | 239 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
239 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); | 240 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); |
240 | reg1 &= P_ASPM_CONTROL_MSK; | 241 | reg1 &= P_ASPM_CONTROL_MSK; |
@@ -273,12 +274,10 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
273 | break; | 274 | break; |
274 | default: | 275 | default: |
275 | printk(KERN_ERR PFX "Unknown power state %d\n", state); | 276 | printk(KERN_ERR PFX "Unknown power state %d\n", state); |
276 | ret = -1; | ||
277 | } | 277 | } |
278 | 278 | ||
279 | sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control); | 279 | sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control); |
280 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 280 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
281 | return ret; | ||
282 | } | 281 | } |
283 | 282 | ||
284 | static void sky2_phy_reset(struct sky2_hw *hw, unsigned port) | 283 | static void sky2_phy_reset(struct sky2_hw *hw, unsigned port) |
@@ -306,7 +305,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
306 | u16 ctrl, ct1000, adv, pg, ledctrl, ledover; | 305 | u16 ctrl, ct1000, adv, pg, ledctrl, ledover; |
307 | 306 | ||
308 | if (sky2->autoneg == AUTONEG_ENABLE && | 307 | if (sky2->autoneg == AUTONEG_ENABLE && |
309 | (hw->chip_id != CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) { | 308 | !(hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) { |
310 | u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); | 309 | u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); |
311 | 310 | ||
312 | ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | | 311 | ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | |
@@ -977,6 +976,7 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
977 | struct sky2_hw *hw = sky2->hw; | 976 | struct sky2_hw *hw = sky2->hw; |
978 | unsigned rxq = rxqaddr[sky2->port]; | 977 | unsigned rxq = rxqaddr[sky2->port]; |
979 | int i; | 978 | int i; |
979 | unsigned thresh; | ||
980 | 980 | ||
981 | sky2->rx_put = sky2->rx_next = 0; | 981 | sky2->rx_put = sky2->rx_next = 0; |
982 | sky2_qset(hw, rxq); | 982 | sky2_qset(hw, rxq); |
@@ -1001,9 +1001,21 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
1001 | sky2_rx_add(sky2, re->mapaddr); | 1001 | sky2_rx_add(sky2, re->mapaddr); |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* Truncate oversize frames */ | 1004 | |
1005 | sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), sky2->rx_bufsize - 8); | 1005 | /* |
1006 | sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON); | 1006 | * The receiver hangs if it receives frames larger than the |
1007 | * packet buffer. As a workaround, truncate oversize frames, but | ||
1008 | * the register is limited to 9 bits, so if you do frames > 2052 | ||
1009 | * you better get the MTU right! | ||
1010 | */ | ||
1011 | thresh = (sky2->rx_bufsize - 8) / sizeof(u32); | ||
1012 | if (thresh > 0x1ff) | ||
1013 | sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_OFF); | ||
1014 | else { | ||
1015 | sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), thresh); | ||
1016 | sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON); | ||
1017 | } | ||
1018 | |||
1007 | 1019 | ||
1008 | /* Tell chip about available buffers */ | 1020 | /* Tell chip about available buffers */ |
1009 | sky2_write16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX), sky2->rx_put); | 1021 | sky2_write16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX), sky2->rx_put); |
@@ -1020,7 +1032,25 @@ static int sky2_up(struct net_device *dev) | |||
1020 | struct sky2_hw *hw = sky2->hw; | 1032 | struct sky2_hw *hw = sky2->hw; |
1021 | unsigned port = sky2->port; | 1033 | unsigned port = sky2->port; |
1022 | u32 ramsize, rxspace, imask; | 1034 | u32 ramsize, rxspace, imask; |
1023 | int err = -ENOMEM; | 1035 | int cap, err = -ENOMEM; |
1036 | struct net_device *otherdev = hw->dev[sky2->port^1]; | ||
1037 | |||
1038 | /* | ||
1039 | * On dual port PCI-X card, there is an problem where status | ||
1040 | * can be received out of order due to split transactions | ||
1041 | */ | ||
1042 | if (otherdev && netif_running(otherdev) && | ||
1043 | (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) { | ||
1044 | struct sky2_port *osky2 = netdev_priv(otherdev); | ||
1045 | u16 cmd; | ||
1046 | |||
1047 | cmd = sky2_pci_read16(hw, cap + PCI_X_CMD); | ||
1048 | cmd &= ~PCI_X_CMD_MAX_SPLIT; | ||
1049 | sky2_pci_write16(hw, cap + PCI_X_CMD, cmd); | ||
1050 | |||
1051 | sky2->rx_csum = 0; | ||
1052 | osky2->rx_csum = 0; | ||
1053 | } | ||
1024 | 1054 | ||
1025 | if (netif_msg_ifup(sky2)) | 1055 | if (netif_msg_ifup(sky2)) |
1026 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); | 1056 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); |
@@ -1899,6 +1929,12 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
1899 | } | 1929 | } |
1900 | } | 1930 | } |
1901 | 1931 | ||
1932 | /* Is status ring empty or is there more to do? */ | ||
1933 | static inline int sky2_more_work(const struct sky2_hw *hw) | ||
1934 | { | ||
1935 | return (hw->st_idx != sky2_read16(hw, STAT_PUT_IDX)); | ||
1936 | } | ||
1937 | |||
1902 | /* Process status response ring */ | 1938 | /* Process status response ring */ |
1903 | static int sky2_status_intr(struct sky2_hw *hw, int to_do) | 1939 | static int sky2_status_intr(struct sky2_hw *hw, int to_do) |
1904 | { | 1940 | { |
@@ -2125,6 +2161,13 @@ static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port, | |||
2125 | /* If idle then force a fake soft NAPI poll once a second | 2161 | /* If idle then force a fake soft NAPI poll once a second |
2126 | * to work around cases where sharing an edge triggered interrupt. | 2162 | * to work around cases where sharing an edge triggered interrupt. |
2127 | */ | 2163 | */ |
2164 | static inline void sky2_idle_start(struct sky2_hw *hw) | ||
2165 | { | ||
2166 | if (idle_timeout > 0) | ||
2167 | mod_timer(&hw->idle_timer, | ||
2168 | jiffies + msecs_to_jiffies(idle_timeout)); | ||
2169 | } | ||
2170 | |||
2128 | static void sky2_idle(unsigned long arg) | 2171 | static void sky2_idle(unsigned long arg) |
2129 | { | 2172 | { |
2130 | struct sky2_hw *hw = (struct sky2_hw *) arg; | 2173 | struct sky2_hw *hw = (struct sky2_hw *) arg; |
@@ -2144,6 +2187,9 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
2144 | int work_done = 0; | 2187 | int work_done = 0; |
2145 | u32 status = sky2_read32(hw, B0_Y2_SP_EISR); | 2188 | u32 status = sky2_read32(hw, B0_Y2_SP_EISR); |
2146 | 2189 | ||
2190 | if (!~status) | ||
2191 | goto out; | ||
2192 | |||
2147 | if (status & Y2_IS_HW_ERR) | 2193 | if (status & Y2_IS_HW_ERR) |
2148 | sky2_hw_intr(hw); | 2194 | sky2_hw_intr(hw); |
2149 | 2195 | ||
@@ -2171,19 +2217,19 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
2171 | if (status & Y2_IS_CHK_TXA2) | 2217 | if (status & Y2_IS_CHK_TXA2) |
2172 | sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); | 2218 | sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); |
2173 | 2219 | ||
2174 | if (status & Y2_IS_STAT_BMU) | ||
2175 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); | ||
2176 | |||
2177 | work_done = sky2_status_intr(hw, work_limit); | 2220 | work_done = sky2_status_intr(hw, work_limit); |
2178 | *budget -= work_done; | 2221 | *budget -= work_done; |
2179 | dev0->quota -= work_done; | 2222 | dev0->quota -= work_done; |
2180 | 2223 | ||
2181 | if (work_done >= work_limit) | 2224 | if (status & Y2_IS_STAT_BMU) |
2182 | return 1; | 2225 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); |
2183 | 2226 | ||
2227 | if (sky2_more_work(hw)) | ||
2228 | return 1; | ||
2229 | out: | ||
2184 | netif_rx_complete(dev0); | 2230 | netif_rx_complete(dev0); |
2185 | 2231 | ||
2186 | status = sky2_read32(hw, B0_Y2_SP_LISR); | 2232 | sky2_read32(hw, B0_Y2_SP_LISR); |
2187 | return 0; | 2233 | return 0; |
2188 | } | 2234 | } |
2189 | 2235 | ||
@@ -3067,12 +3113,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
3067 | sky2->duplex = -1; | 3113 | sky2->duplex = -1; |
3068 | sky2->speed = -1; | 3114 | sky2->speed = -1; |
3069 | sky2->advertising = sky2_supported_modes(hw); | 3115 | sky2->advertising = sky2_supported_modes(hw); |
3070 | 3116 | sky2->rx_csum = 1; | |
3071 | /* Receive checksum disabled for Yukon XL | ||
3072 | * because of observed problems with incorrect | ||
3073 | * values when multiple packets are received in one interrupt | ||
3074 | */ | ||
3075 | sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); | ||
3076 | 3117 | ||
3077 | spin_lock_init(&sky2->phy_lock); | 3118 | spin_lock_init(&sky2->phy_lock); |
3078 | sky2->tx_pending = TX_DEF_PENDING; | 3119 | sky2->tx_pending = TX_DEF_PENDING; |
@@ -3316,9 +3357,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3316 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); | 3357 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
3317 | 3358 | ||
3318 | setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); | 3359 | setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); |
3319 | if (idle_timeout > 0) | 3360 | sky2_idle_start(hw); |
3320 | mod_timer(&hw->idle_timer, | ||
3321 | jiffies + msecs_to_jiffies(idle_timeout)); | ||
3322 | 3361 | ||
3323 | pci_set_drvdata(pdev, hw); | 3362 | pci_set_drvdata(pdev, hw); |
3324 | 3363 | ||
@@ -3391,8 +3430,14 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3391 | { | 3430 | { |
3392 | struct sky2_hw *hw = pci_get_drvdata(pdev); | 3431 | struct sky2_hw *hw = pci_get_drvdata(pdev); |
3393 | int i; | 3432 | int i; |
3433 | pci_power_t pstate = pci_choose_state(pdev, state); | ||
3434 | |||
3435 | if (!(pstate == PCI_D3hot || pstate == PCI_D3cold)) | ||
3436 | return -EINVAL; | ||
3437 | |||
3438 | del_timer_sync(&hw->idle_timer); | ||
3394 | 3439 | ||
3395 | for (i = 0; i < 2; i++) { | 3440 | for (i = 0; i < hw->ports; i++) { |
3396 | struct net_device *dev = hw->dev[i]; | 3441 | struct net_device *dev = hw->dev[i]; |
3397 | 3442 | ||
3398 | if (dev) { | 3443 | if (dev) { |
@@ -3404,7 +3449,10 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3404 | } | 3449 | } |
3405 | } | 3450 | } |
3406 | 3451 | ||
3407 | return sky2_set_power_state(hw, pci_choose_state(pdev, state)); | 3452 | sky2_write32(hw, B0_IMSK, 0); |
3453 | pci_save_state(pdev); | ||
3454 | sky2_set_power_state(hw, pstate); | ||
3455 | return 0; | ||
3408 | } | 3456 | } |
3409 | 3457 | ||
3410 | static int sky2_resume(struct pci_dev *pdev) | 3458 | static int sky2_resume(struct pci_dev *pdev) |
@@ -3414,15 +3462,15 @@ static int sky2_resume(struct pci_dev *pdev) | |||
3414 | 3462 | ||
3415 | pci_restore_state(pdev); | 3463 | pci_restore_state(pdev); |
3416 | pci_enable_wake(pdev, PCI_D0, 0); | 3464 | pci_enable_wake(pdev, PCI_D0, 0); |
3417 | err = sky2_set_power_state(hw, PCI_D0); | 3465 | sky2_set_power_state(hw, PCI_D0); |
3418 | if (err) | ||
3419 | goto out; | ||
3420 | 3466 | ||
3421 | err = sky2_reset(hw); | 3467 | err = sky2_reset(hw); |
3422 | if (err) | 3468 | if (err) |
3423 | goto out; | 3469 | goto out; |
3424 | 3470 | ||
3425 | for (i = 0; i < 2; i++) { | 3471 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
3472 | |||
3473 | for (i = 0; i < hw->ports; i++) { | ||
3426 | struct net_device *dev = hw->dev[i]; | 3474 | struct net_device *dev = hw->dev[i]; |
3427 | if (dev && netif_running(dev)) { | 3475 | if (dev && netif_running(dev)) { |
3428 | netif_device_attach(dev); | 3476 | netif_device_attach(dev); |
@@ -3431,10 +3479,12 @@ static int sky2_resume(struct pci_dev *pdev) | |||
3431 | printk(KERN_ERR PFX "%s: could not up: %d\n", | 3479 | printk(KERN_ERR PFX "%s: could not up: %d\n", |
3432 | dev->name, err); | 3480 | dev->name, err); |
3433 | dev_close(dev); | 3481 | dev_close(dev); |
3434 | break; | 3482 | goto out; |
3435 | } | 3483 | } |
3436 | } | 3484 | } |
3437 | } | 3485 | } |
3486 | |||
3487 | sky2_idle_start(hw); | ||
3438 | out: | 3488 | out: |
3439 | return err; | 3489 | return err; |
3440 | } | 3490 | } |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 8012994c9b93..8a0bc5525f0a 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -214,6 +214,8 @@ enum csr_regs { | |||
214 | enum { | 214 | enum { |
215 | Y2_VMAIN_AVAIL = 1<<17,/* VMAIN available (YUKON-2 only) */ | 215 | Y2_VMAIN_AVAIL = 1<<17,/* VMAIN available (YUKON-2 only) */ |
216 | Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */ | 216 | Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */ |
217 | Y2_HW_WOL_ON = 1<<15,/* HW WOL On (Yukon-EC Ultra A1 only) */ | ||
218 | Y2_HW_WOL_OFF = 1<<14,/* HW WOL On (Yukon-EC Ultra A1 only) */ | ||
217 | Y2_ASF_ENABLE = 1<<13,/* ASF Unit Enable (YUKON-2 only) */ | 219 | Y2_ASF_ENABLE = 1<<13,/* ASF Unit Enable (YUKON-2 only) */ |
218 | Y2_ASF_DISABLE = 1<<12,/* ASF Unit Disable (YUKON-2 only) */ | 220 | Y2_ASF_DISABLE = 1<<12,/* ASF Unit Disable (YUKON-2 only) */ |
219 | Y2_CLK_RUN_ENA = 1<<11,/* CLK_RUN Enable (YUKON-2 only) */ | 221 | Y2_CLK_RUN_ENA = 1<<11,/* CLK_RUN Enable (YUKON-2 only) */ |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 2bd9592b75cd..862c226dbbe2 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -69,8 +69,8 @@ | |||
69 | 69 | ||
70 | #define DRV_MODULE_NAME "tg3" | 70 | #define DRV_MODULE_NAME "tg3" |
71 | #define PFX DRV_MODULE_NAME ": " | 71 | #define PFX DRV_MODULE_NAME ": " |
72 | #define DRV_MODULE_VERSION "3.57" | 72 | #define DRV_MODULE_VERSION "3.59" |
73 | #define DRV_MODULE_RELDATE "Apr 28, 2006" | 73 | #define DRV_MODULE_RELDATE "June 8, 2006" |
74 | 74 | ||
75 | #define TG3_DEF_MAC_MODE 0 | 75 | #define TG3_DEF_MAC_MODE 0 |
76 | #define TG3_DEF_RX_MODE 0 | 76 | #define TG3_DEF_RX_MODE 0 |
@@ -4485,9 +4485,8 @@ static void tg3_disable_nvram_access(struct tg3 *tp) | |||
4485 | /* tp->lock is held. */ | 4485 | /* tp->lock is held. */ |
4486 | static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind) | 4486 | static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind) |
4487 | { | 4487 | { |
4488 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) | 4488 | tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX, |
4489 | tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX, | 4489 | NIC_SRAM_FIRMWARE_MBOX_MAGIC1); |
4490 | NIC_SRAM_FIRMWARE_MBOX_MAGIC1); | ||
4491 | 4490 | ||
4492 | if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) { | 4491 | if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) { |
4493 | switch (kind) { | 4492 | switch (kind) { |
@@ -4568,13 +4567,12 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4568 | void (*write_op)(struct tg3 *, u32, u32); | 4567 | void (*write_op)(struct tg3 *, u32, u32); |
4569 | int i; | 4568 | int i; |
4570 | 4569 | ||
4571 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { | 4570 | tg3_nvram_lock(tp); |
4572 | tg3_nvram_lock(tp); | 4571 | |
4573 | /* No matching tg3_nvram_unlock() after this because | 4572 | /* No matching tg3_nvram_unlock() after this because |
4574 | * chip reset below will undo the nvram lock. | 4573 | * chip reset below will undo the nvram lock. |
4575 | */ | 4574 | */ |
4576 | tp->nvram_lock_cnt = 0; | 4575 | tp->nvram_lock_cnt = 0; |
4577 | } | ||
4578 | 4576 | ||
4579 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || | 4577 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || |
4580 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 4578 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
@@ -4727,20 +4725,25 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4727 | tw32_f(MAC_MODE, 0); | 4725 | tw32_f(MAC_MODE, 0); |
4728 | udelay(40); | 4726 | udelay(40); |
4729 | 4727 | ||
4730 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { | 4728 | /* Wait for firmware initialization to complete. */ |
4731 | /* Wait for firmware initialization to complete. */ | 4729 | for (i = 0; i < 100000; i++) { |
4732 | for (i = 0; i < 100000; i++) { | 4730 | tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); |
4733 | tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); | 4731 | if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) |
4734 | if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) | 4732 | break; |
4735 | break; | 4733 | udelay(10); |
4736 | udelay(10); | 4734 | } |
4737 | } | 4735 | |
4738 | if (i >= 100000) { | 4736 | /* Chip might not be fitted with firmare. Some Sun onboard |
4739 | printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, " | 4737 | * parts are configured like that. So don't signal the timeout |
4740 | "firmware will not restart magic=%08x\n", | 4738 | * of the above loop as an error, but do report the lack of |
4741 | tp->dev->name, val); | 4739 | * running firmware once. |
4742 | return -ENODEV; | 4740 | */ |
4743 | } | 4741 | if (i >= 100000 && |
4742 | !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) { | ||
4743 | tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED; | ||
4744 | |||
4745 | printk(KERN_INFO PFX "%s: No firmware running.\n", | ||
4746 | tp->dev->name); | ||
4744 | } | 4747 | } |
4745 | 4748 | ||
4746 | if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && | 4749 | if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && |
@@ -6488,6 +6491,10 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp) | |||
6488 | TG3_STAT_ADD32(&sp->rx_frame_too_long_errors, MAC_RX_STATS_FRAME_TOO_LONG); | 6491 | TG3_STAT_ADD32(&sp->rx_frame_too_long_errors, MAC_RX_STATS_FRAME_TOO_LONG); |
6489 | TG3_STAT_ADD32(&sp->rx_jabbers, MAC_RX_STATS_JABBERS); | 6492 | TG3_STAT_ADD32(&sp->rx_jabbers, MAC_RX_STATS_JABBERS); |
6490 | TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE); | 6493 | TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE); |
6494 | |||
6495 | TG3_STAT_ADD32(&sp->rxbds_empty, RCVLPC_NO_RCV_BD_CNT); | ||
6496 | TG3_STAT_ADD32(&sp->rx_discards, RCVLPC_IN_DISCARDS_CNT); | ||
6497 | TG3_STAT_ADD32(&sp->rx_errors, RCVLPC_IN_ERRORS_CNT); | ||
6491 | } | 6498 | } |
6492 | 6499 | ||
6493 | static void tg3_timer(unsigned long __opaque) | 6500 | static void tg3_timer(unsigned long __opaque) |
@@ -7653,21 +7660,23 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
7653 | cmd->supported |= (SUPPORTED_1000baseT_Half | | 7660 | cmd->supported |= (SUPPORTED_1000baseT_Half | |
7654 | SUPPORTED_1000baseT_Full); | 7661 | SUPPORTED_1000baseT_Full); |
7655 | 7662 | ||
7656 | if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) | 7663 | if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) { |
7657 | cmd->supported |= (SUPPORTED_100baseT_Half | | 7664 | cmd->supported |= (SUPPORTED_100baseT_Half | |
7658 | SUPPORTED_100baseT_Full | | 7665 | SUPPORTED_100baseT_Full | |
7659 | SUPPORTED_10baseT_Half | | 7666 | SUPPORTED_10baseT_Half | |
7660 | SUPPORTED_10baseT_Full | | 7667 | SUPPORTED_10baseT_Full | |
7661 | SUPPORTED_MII); | 7668 | SUPPORTED_MII); |
7662 | else | 7669 | cmd->port = PORT_TP; |
7670 | } else { | ||
7663 | cmd->supported |= SUPPORTED_FIBRE; | 7671 | cmd->supported |= SUPPORTED_FIBRE; |
7672 | cmd->port = PORT_FIBRE; | ||
7673 | } | ||
7664 | 7674 | ||
7665 | cmd->advertising = tp->link_config.advertising; | 7675 | cmd->advertising = tp->link_config.advertising; |
7666 | if (netif_running(dev)) { | 7676 | if (netif_running(dev)) { |
7667 | cmd->speed = tp->link_config.active_speed; | 7677 | cmd->speed = tp->link_config.active_speed; |
7668 | cmd->duplex = tp->link_config.active_duplex; | 7678 | cmd->duplex = tp->link_config.active_duplex; |
7669 | } | 7679 | } |
7670 | cmd->port = 0; | ||
7671 | cmd->phy_address = PHY_ADDR; | 7680 | cmd->phy_address = PHY_ADDR; |
7672 | cmd->transceiver = 0; | 7681 | cmd->transceiver = 0; |
7673 | cmd->autoneg = tp->link_config.autoneg; | 7682 | cmd->autoneg = tp->link_config.autoneg; |
@@ -9069,9 +9078,6 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) | |||
9069 | { | 9078 | { |
9070 | int j; | 9079 | int j; |
9071 | 9080 | ||
9072 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) | ||
9073 | return; | ||
9074 | |||
9075 | tw32_f(GRC_EEPROM_ADDR, | 9081 | tw32_f(GRC_EEPROM_ADDR, |
9076 | (EEPROM_ADDR_FSM_RESET | | 9082 | (EEPROM_ADDR_FSM_RESET | |
9077 | (EEPROM_DEFAULT_CLOCK_PERIOD << | 9083 | (EEPROM_DEFAULT_CLOCK_PERIOD << |
@@ -9204,11 +9210,6 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val) | |||
9204 | { | 9210 | { |
9205 | int ret; | 9211 | int ret; |
9206 | 9212 | ||
9207 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { | ||
9208 | printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 570X\n"); | ||
9209 | return -EINVAL; | ||
9210 | } | ||
9211 | |||
9212 | if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) | 9213 | if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) |
9213 | return tg3_nvram_read_using_eeprom(tp, offset, val); | 9214 | return tg3_nvram_read_using_eeprom(tp, offset, val); |
9214 | 9215 | ||
@@ -9441,11 +9442,6 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf) | |||
9441 | { | 9442 | { |
9442 | int ret; | 9443 | int ret; |
9443 | 9444 | ||
9444 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { | ||
9445 | printk(KERN_ERR PFX "Attempt to do nvram_write on Sun 570X\n"); | ||
9446 | return -EINVAL; | ||
9447 | } | ||
9448 | |||
9449 | if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) { | 9445 | if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) { |
9450 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl & | 9446 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl & |
9451 | ~GRC_LCLCTRL_GPIO_OUTPUT1); | 9447 | ~GRC_LCLCTRL_GPIO_OUTPUT1); |
@@ -9572,15 +9568,19 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
9572 | pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, | 9568 | pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, |
9573 | tp->misc_host_ctrl); | 9569 | tp->misc_host_ctrl); |
9574 | 9570 | ||
9571 | /* The memory arbiter has to be enabled in order for SRAM accesses | ||
9572 | * to succeed. Normally on powerup the tg3 chip firmware will make | ||
9573 | * sure it is enabled, but other entities such as system netboot | ||
9574 | * code might disable it. | ||
9575 | */ | ||
9576 | val = tr32(MEMARB_MODE); | ||
9577 | tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); | ||
9578 | |||
9575 | tp->phy_id = PHY_ID_INVALID; | 9579 | tp->phy_id = PHY_ID_INVALID; |
9576 | tp->led_ctrl = LED_CTRL_MODE_PHY_1; | 9580 | tp->led_ctrl = LED_CTRL_MODE_PHY_1; |
9577 | 9581 | ||
9578 | /* Do not even try poking around in here on Sun parts. */ | 9582 | /* Assume an onboard device by default. */ |
9579 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { | 9583 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
9580 | /* All SUN chips are built-in LOMs. */ | ||
9581 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | ||
9582 | return; | ||
9583 | } | ||
9584 | 9584 | ||
9585 | tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); | 9585 | tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); |
9586 | if (val == NIC_SRAM_DATA_SIG_MAGIC) { | 9586 | if (val == NIC_SRAM_DATA_SIG_MAGIC) { |
@@ -9680,6 +9680,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
9680 | 9680 | ||
9681 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) | 9681 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) |
9682 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 9682 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
9683 | else | ||
9684 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | ||
9683 | 9685 | ||
9684 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { | 9686 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { |
9685 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; | 9687 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; |
@@ -9828,16 +9830,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
9828 | int i; | 9830 | int i; |
9829 | u32 magic; | 9831 | u32 magic; |
9830 | 9832 | ||
9831 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { | ||
9832 | /* Sun decided not to put the necessary bits in the | ||
9833 | * NVRAM of their onboard tg3 parts :( | ||
9834 | */ | ||
9835 | strcpy(tp->board_part_number, "Sun 570X"); | ||
9836 | return; | ||
9837 | } | ||
9838 | |||
9839 | if (tg3_nvram_read_swab(tp, 0x0, &magic)) | 9833 | if (tg3_nvram_read_swab(tp, 0x0, &magic)) |
9840 | return; | 9834 | goto out_not_found; |
9841 | 9835 | ||
9842 | if (magic == TG3_EEPROM_MAGIC) { | 9836 | if (magic == TG3_EEPROM_MAGIC) { |
9843 | for (i = 0; i < 256; i += 4) { | 9837 | for (i = 0; i < 256; i += 4) { |
@@ -9868,6 +9862,9 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
9868 | break; | 9862 | break; |
9869 | msleep(1); | 9863 | msleep(1); |
9870 | } | 9864 | } |
9865 | if (!(tmp16 & 0x8000)) | ||
9866 | goto out_not_found; | ||
9867 | |||
9871 | pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, | 9868 | pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, |
9872 | &tmp); | 9869 | &tmp); |
9873 | tmp = cpu_to_le32(tmp); | 9870 | tmp = cpu_to_le32(tmp); |
@@ -9959,37 +9956,6 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
9959 | } | 9956 | } |
9960 | } | 9957 | } |
9961 | 9958 | ||
9962 | #ifdef CONFIG_SPARC64 | ||
9963 | static int __devinit tg3_is_sun_570X(struct tg3 *tp) | ||
9964 | { | ||
9965 | struct pci_dev *pdev = tp->pdev; | ||
9966 | struct pcidev_cookie *pcp = pdev->sysdata; | ||
9967 | |||
9968 | if (pcp != NULL) { | ||
9969 | int node = pcp->prom_node; | ||
9970 | u32 venid; | ||
9971 | int err; | ||
9972 | |||
9973 | err = prom_getproperty(node, "subsystem-vendor-id", | ||
9974 | (char *) &venid, sizeof(venid)); | ||
9975 | if (err == 0 || err == -1) | ||
9976 | return 0; | ||
9977 | if (venid == PCI_VENDOR_ID_SUN) | ||
9978 | return 1; | ||
9979 | |||
9980 | /* TG3 chips onboard the SunBlade-2500 don't have the | ||
9981 | * subsystem-vendor-id set to PCI_VENDOR_ID_SUN but they | ||
9982 | * are distinguishable from non-Sun variants by being | ||
9983 | * named "network" by the firmware. Non-Sun cards will | ||
9984 | * show up as being named "ethernet". | ||
9985 | */ | ||
9986 | if (!strcmp(pcp->prom_name, "network")) | ||
9987 | return 1; | ||
9988 | } | ||
9989 | return 0; | ||
9990 | } | ||
9991 | #endif | ||
9992 | |||
9993 | static int __devinit tg3_get_invariants(struct tg3 *tp) | 9959 | static int __devinit tg3_get_invariants(struct tg3 *tp) |
9994 | { | 9960 | { |
9995 | static struct pci_device_id write_reorder_chipsets[] = { | 9961 | static struct pci_device_id write_reorder_chipsets[] = { |
@@ -10006,11 +9972,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10006 | u16 pci_cmd; | 9972 | u16 pci_cmd; |
10007 | int err; | 9973 | int err; |
10008 | 9974 | ||
10009 | #ifdef CONFIG_SPARC64 | ||
10010 | if (tg3_is_sun_570X(tp)) | ||
10011 | tp->tg3_flags2 |= TG3_FLG2_SUN_570X; | ||
10012 | #endif | ||
10013 | |||
10014 | /* Force memory write invalidate off. If we leave it on, | 9975 | /* Force memory write invalidate off. If we leave it on, |
10015 | * then on 5700_BX chips we have to enable a workaround. | 9976 | * then on 5700_BX chips we have to enable a workaround. |
10016 | * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary | 9977 | * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary |
@@ -10306,8 +10267,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10306 | if (tp->write32 == tg3_write_indirect_reg32 || | 10267 | if (tp->write32 == tg3_write_indirect_reg32 || |
10307 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && | 10268 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && |
10308 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || | 10269 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || |
10309 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) || | 10270 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701))) |
10310 | (tp->tg3_flags2 & TG3_FLG2_SUN_570X)) | ||
10311 | tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; | 10271 | tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; |
10312 | 10272 | ||
10313 | /* Get eeprom hw config before calling tg3_set_power_state(). | 10273 | /* Get eeprom hw config before calling tg3_set_power_state(). |
@@ -10588,8 +10548,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
10588 | #endif | 10548 | #endif |
10589 | 10549 | ||
10590 | mac_offset = 0x7c; | 10550 | mac_offset = 0x7c; |
10591 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && | 10551 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || |
10592 | !(tp->tg3_flags & TG3_FLG2_SUN_570X)) || | ||
10593 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { | 10552 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { |
10594 | if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) | 10553 | if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) |
10595 | mac_offset = 0xcc; | 10554 | mac_offset = 0xcc; |
@@ -10616,8 +10575,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
10616 | } | 10575 | } |
10617 | if (!addr_ok) { | 10576 | if (!addr_ok) { |
10618 | /* Next, try NVRAM. */ | 10577 | /* Next, try NVRAM. */ |
10619 | if (!(tp->tg3_flags & TG3_FLG2_SUN_570X) && | 10578 | if (!tg3_nvram_read(tp, mac_offset + 0, &hi) && |
10620 | !tg3_nvram_read(tp, mac_offset + 0, &hi) && | ||
10621 | !tg3_nvram_read(tp, mac_offset + 4, &lo)) { | 10579 | !tg3_nvram_read(tp, mac_offset + 4, &lo)) { |
10622 | dev->dev_addr[0] = ((hi >> 16) & 0xff); | 10580 | dev->dev_addr[0] = ((hi >> 16) & 0xff); |
10623 | dev->dev_addr[1] = ((hi >> 24) & 0xff); | 10581 | dev->dev_addr[1] = ((hi >> 24) & 0xff); |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 0e29b885d449..ff0faab94bd5 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2184,7 +2184,7 @@ struct tg3 { | |||
2184 | #define TG3_FLAG_INIT_COMPLETE 0x80000000 | 2184 | #define TG3_FLAG_INIT_COMPLETE 0x80000000 |
2185 | u32 tg3_flags2; | 2185 | u32 tg3_flags2; |
2186 | #define TG3_FLG2_RESTART_TIMER 0x00000001 | 2186 | #define TG3_FLG2_RESTART_TIMER 0x00000001 |
2187 | #define TG3_FLG2_SUN_570X 0x00000002 | 2187 | /* 0x00000002 available */ |
2188 | #define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 | 2188 | #define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 |
2189 | #define TG3_FLG2_IS_5788 0x00000008 | 2189 | #define TG3_FLG2_IS_5788 0x00000008 |
2190 | #define TG3_FLG2_MAX_RXPEND_64 0x00000010 | 2190 | #define TG3_FLG2_MAX_RXPEND_64 0x00000010 |
@@ -2216,6 +2216,7 @@ struct tg3 { | |||
2216 | #define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2) | 2216 | #define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2) |
2217 | #define TG3_FLG2_1SHOT_MSI 0x10000000 | 2217 | #define TG3_FLG2_1SHOT_MSI 0x10000000 |
2218 | #define TG3_FLG2_PHY_JITTER_BUG 0x20000000 | 2218 | #define TG3_FLG2_PHY_JITTER_BUG 0x20000000 |
2219 | #define TG3_FLG2_NO_FWARE_REPORTED 0x40000000 | ||
2219 | 2220 | ||
2220 | u32 split_mode_max_reqs; | 2221 | u32 split_mode_max_reqs; |
2221 | #define SPLIT_MODE_5704_MAX_REQ 3 | 2222 | #define SPLIT_MODE_5704_MAX_REQ 3 |
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index ba05dedf29d3..136a70c4d5e4 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -850,7 +850,7 @@ static void init_rxtx_rings(struct net_device *dev) | |||
850 | break; | 850 | break; |
851 | skb->dev = dev; /* Mark as being used by this device. */ | 851 | skb->dev = dev; /* Mark as being used by this device. */ |
852 | np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data, | 852 | np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data, |
853 | skb->len,PCI_DMA_FROMDEVICE); | 853 | np->rx_buf_sz,PCI_DMA_FROMDEVICE); |
854 | 854 | ||
855 | np->rx_ring[i].buffer1 = np->rx_addr[i]; | 855 | np->rx_ring[i].buffer1 = np->rx_addr[i]; |
856 | np->rx_ring[i].status = DescOwn; | 856 | np->rx_ring[i].status = DescOwn; |
@@ -1316,7 +1316,7 @@ static int netdev_rx(struct net_device *dev) | |||
1316 | skb->dev = dev; /* Mark as being used by this device. */ | 1316 | skb->dev = dev; /* Mark as being used by this device. */ |
1317 | np->rx_addr[entry] = pci_map_single(np->pci_dev, | 1317 | np->rx_addr[entry] = pci_map_single(np->pci_dev, |
1318 | skb->data, | 1318 | skb->data, |
1319 | skb->len, PCI_DMA_FROMDEVICE); | 1319 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1320 | np->rx_ring[entry].buffer1 = np->rx_addr[entry]; | 1320 | np->rx_ring[entry].buffer1 = np->rx_addr[entry]; |
1321 | } | 1321 | } |
1322 | wmb(); | 1322 | wmb(); |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index a6dc53b4250d..fdc21037f6dc 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -491,8 +491,6 @@ struct rhine_private { | |||
491 | u8 tx_thresh, rx_thresh; | 491 | u8 tx_thresh, rx_thresh; |
492 | 492 | ||
493 | struct mii_if_info mii_if; | 493 | struct mii_if_info mii_if; |
494 | struct work_struct tx_timeout_task; | ||
495 | struct work_struct check_media_task; | ||
496 | void __iomem *base; | 494 | void __iomem *base; |
497 | }; | 495 | }; |
498 | 496 | ||
@@ -500,8 +498,6 @@ static int mdio_read(struct net_device *dev, int phy_id, int location); | |||
500 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); | 498 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); |
501 | static int rhine_open(struct net_device *dev); | 499 | static int rhine_open(struct net_device *dev); |
502 | static void rhine_tx_timeout(struct net_device *dev); | 500 | static void rhine_tx_timeout(struct net_device *dev); |
503 | static void rhine_tx_timeout_task(struct net_device *dev); | ||
504 | static void rhine_check_media_task(struct net_device *dev); | ||
505 | static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); | 501 | static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); |
506 | static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); | 502 | static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); |
507 | static void rhine_tx(struct net_device *dev); | 503 | static void rhine_tx(struct net_device *dev); |
@@ -856,12 +852,6 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
856 | if (rp->quirks & rqRhineI) | 852 | if (rp->quirks & rqRhineI) |
857 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; | 853 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; |
858 | 854 | ||
859 | INIT_WORK(&rp->tx_timeout_task, | ||
860 | (void (*)(void *))rhine_tx_timeout_task, dev); | ||
861 | |||
862 | INIT_WORK(&rp->check_media_task, | ||
863 | (void (*)(void *))rhine_check_media_task, dev); | ||
864 | |||
865 | /* dev->name not defined before register_netdev()! */ | 855 | /* dev->name not defined before register_netdev()! */ |
866 | rc = register_netdev(dev); | 856 | rc = register_netdev(dev); |
867 | if (rc) | 857 | if (rc) |
@@ -1108,11 +1098,6 @@ static void rhine_set_carrier(struct mii_if_info *mii) | |||
1108 | netif_carrier_ok(mii->dev)); | 1098 | netif_carrier_ok(mii->dev)); |
1109 | } | 1099 | } |
1110 | 1100 | ||
1111 | static void rhine_check_media_task(struct net_device *dev) | ||
1112 | { | ||
1113 | rhine_check_media(dev, 0); | ||
1114 | } | ||
1115 | |||
1116 | static void init_registers(struct net_device *dev) | 1101 | static void init_registers(struct net_device *dev) |
1117 | { | 1102 | { |
1118 | struct rhine_private *rp = netdev_priv(dev); | 1103 | struct rhine_private *rp = netdev_priv(dev); |
@@ -1166,8 +1151,8 @@ static void rhine_disable_linkmon(void __iomem *ioaddr, u32 quirks) | |||
1166 | if (quirks & rqRhineI) { | 1151 | if (quirks & rqRhineI) { |
1167 | iowrite8(0x01, ioaddr + MIIRegAddr); // MII_BMSR | 1152 | iowrite8(0x01, ioaddr + MIIRegAddr); // MII_BMSR |
1168 | 1153 | ||
1169 | /* Do not call from ISR! */ | 1154 | /* Can be called from ISR. Evil. */ |
1170 | msleep(1); | 1155 | mdelay(1); |
1171 | 1156 | ||
1172 | /* 0x80 must be set immediately before turning it off */ | 1157 | /* 0x80 must be set immediately before turning it off */ |
1173 | iowrite8(0x80, ioaddr + MIICmd); | 1158 | iowrite8(0x80, ioaddr + MIICmd); |
@@ -1257,16 +1242,6 @@ static int rhine_open(struct net_device *dev) | |||
1257 | static void rhine_tx_timeout(struct net_device *dev) | 1242 | static void rhine_tx_timeout(struct net_device *dev) |
1258 | { | 1243 | { |
1259 | struct rhine_private *rp = netdev_priv(dev); | 1244 | struct rhine_private *rp = netdev_priv(dev); |
1260 | |||
1261 | /* | ||
1262 | * Move bulk of work outside of interrupt context | ||
1263 | */ | ||
1264 | schedule_work(&rp->tx_timeout_task); | ||
1265 | } | ||
1266 | |||
1267 | static void rhine_tx_timeout_task(struct net_device *dev) | ||
1268 | { | ||
1269 | struct rhine_private *rp = netdev_priv(dev); | ||
1270 | void __iomem *ioaddr = rp->base; | 1245 | void __iomem *ioaddr = rp->base; |
1271 | 1246 | ||
1272 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | 1247 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " |
@@ -1677,7 +1652,7 @@ static void rhine_error(struct net_device *dev, int intr_status) | |||
1677 | spin_lock(&rp->lock); | 1652 | spin_lock(&rp->lock); |
1678 | 1653 | ||
1679 | if (intr_status & IntrLinkChange) | 1654 | if (intr_status & IntrLinkChange) |
1680 | schedule_work(&rp->check_media_task); | 1655 | rhine_check_media(dev, 0); |
1681 | if (intr_status & IntrStatsMax) { | 1656 | if (intr_status & IntrStatsMax) { |
1682 | rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs); | 1657 | rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs); |
1683 | rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed); | 1658 | rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed); |
@@ -1927,9 +1902,6 @@ static int rhine_close(struct net_device *dev) | |||
1927 | spin_unlock_irq(&rp->lock); | 1902 | spin_unlock_irq(&rp->lock); |
1928 | 1903 | ||
1929 | free_irq(rp->pdev->irq, dev); | 1904 | free_irq(rp->pdev->irq, dev); |
1930 | |||
1931 | flush_scheduled_work(); | ||
1932 | |||
1933 | free_rbufs(dev); | 1905 | free_rbufs(dev); |
1934 | free_tbufs(dev); | 1906 | free_tbufs(dev); |
1935 | free_ring(dev); | 1907 | free_ring(dev); |
diff --git a/drivers/net/wireless/arlan-main.c b/drivers/net/wireless/arlan-main.c index 0e1ac338cac1..bed6823d9809 100644 --- a/drivers/net/wireless/arlan-main.c +++ b/drivers/net/wireless/arlan-main.c | |||
@@ -1838,7 +1838,7 @@ struct net_device * __init arlan_probe(int unit) | |||
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | #ifdef MODULE | 1840 | #ifdef MODULE |
1841 | int init_module(void) | 1841 | int __init init_module(void) |
1842 | { | 1842 | { |
1843 | int i = 0; | 1843 | int i = 0; |
1844 | 1844 | ||
@@ -1860,7 +1860,7 @@ int init_module(void) | |||
1860 | } | 1860 | } |
1861 | 1861 | ||
1862 | 1862 | ||
1863 | void cleanup_module(void) | 1863 | void __exit cleanup_module(void) |
1864 | { | 1864 | { |
1865 | int i = 0; | 1865 | int i = 0; |
1866 | struct net_device *dev; | 1866 | struct net_device *dev; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c index bbecba02e697..d0318e525ba7 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c | |||
@@ -624,25 +624,28 @@ err_destroy_tx0: | |||
624 | static u16 generate_cookie(struct bcm43xx_dmaring *ring, | 624 | static u16 generate_cookie(struct bcm43xx_dmaring *ring, |
625 | int slot) | 625 | int slot) |
626 | { | 626 | { |
627 | u16 cookie = 0x0000; | 627 | u16 cookie = 0xF000; |
628 | 628 | ||
629 | /* Use the upper 4 bits of the cookie as | 629 | /* Use the upper 4 bits of the cookie as |
630 | * DMA controller ID and store the slot number | 630 | * DMA controller ID and store the slot number |
631 | * in the lower 12 bits | 631 | * in the lower 12 bits. |
632 | * Note that the cookie must never be 0, as this | ||
633 | * is a special value used in RX path. | ||
632 | */ | 634 | */ |
633 | switch (ring->mmio_base) { | 635 | switch (ring->mmio_base) { |
634 | default: | 636 | default: |
635 | assert(0); | 637 | assert(0); |
636 | case BCM43xx_MMIO_DMA1_BASE: | 638 | case BCM43xx_MMIO_DMA1_BASE: |
639 | cookie = 0xA000; | ||
637 | break; | 640 | break; |
638 | case BCM43xx_MMIO_DMA2_BASE: | 641 | case BCM43xx_MMIO_DMA2_BASE: |
639 | cookie = 0x1000; | 642 | cookie = 0xB000; |
640 | break; | 643 | break; |
641 | case BCM43xx_MMIO_DMA3_BASE: | 644 | case BCM43xx_MMIO_DMA3_BASE: |
642 | cookie = 0x2000; | 645 | cookie = 0xC000; |
643 | break; | 646 | break; |
644 | case BCM43xx_MMIO_DMA4_BASE: | 647 | case BCM43xx_MMIO_DMA4_BASE: |
645 | cookie = 0x3000; | 648 | cookie = 0xD000; |
646 | break; | 649 | break; |
647 | } | 650 | } |
648 | assert(((u16)slot & 0xF000) == 0x0000); | 651 | assert(((u16)slot & 0xF000) == 0x0000); |
@@ -660,16 +663,16 @@ struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm, | |||
660 | struct bcm43xx_dmaring *ring = NULL; | 663 | struct bcm43xx_dmaring *ring = NULL; |
661 | 664 | ||
662 | switch (cookie & 0xF000) { | 665 | switch (cookie & 0xF000) { |
663 | case 0x0000: | 666 | case 0xA000: |
664 | ring = dma->tx_ring0; | 667 | ring = dma->tx_ring0; |
665 | break; | 668 | break; |
666 | case 0x1000: | 669 | case 0xB000: |
667 | ring = dma->tx_ring1; | 670 | ring = dma->tx_ring1; |
668 | break; | 671 | break; |
669 | case 0x2000: | 672 | case 0xC000: |
670 | ring = dma->tx_ring2; | 673 | ring = dma->tx_ring2; |
671 | break; | 674 | break; |
672 | case 0x3000: | 675 | case 0xD000: |
673 | ring = dma->tx_ring3; | 676 | ring = dma->tx_ring3; |
674 | break; | 677 | break; |
675 | default: | 678 | default: |
@@ -839,8 +842,18 @@ static void dma_rx(struct bcm43xx_dmaring *ring, | |||
839 | /* We received an xmit status. */ | 842 | /* We received an xmit status. */ |
840 | struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data; | 843 | struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data; |
841 | struct bcm43xx_xmitstatus stat; | 844 | struct bcm43xx_xmitstatus stat; |
845 | int i = 0; | ||
842 | 846 | ||
843 | stat.cookie = le16_to_cpu(hw->cookie); | 847 | stat.cookie = le16_to_cpu(hw->cookie); |
848 | while (stat.cookie == 0) { | ||
849 | if (unlikely(++i >= 10000)) { | ||
850 | assert(0); | ||
851 | break; | ||
852 | } | ||
853 | udelay(2); | ||
854 | barrier(); | ||
855 | stat.cookie = le16_to_cpu(hw->cookie); | ||
856 | } | ||
844 | stat.flags = hw->flags; | 857 | stat.flags = hw->flags; |
845 | stat.cnt1 = hw->cnt1; | 858 | stat.cnt1 = hw->cnt1; |
846 | stat.cnt2 = hw->cnt2; | 859 | stat.cnt2 = hw->cnt2; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index e2982a83ae42..7ed18cad29f7 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -3271,6 +3271,9 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm) | |||
3271 | bcm43xx_sysfs_register(bcm); | 3271 | bcm43xx_sysfs_register(bcm); |
3272 | //FIXME: check for bcm43xx_sysfs_register failure. This function is a bit messy regarding unwinding, though... | 3272 | //FIXME: check for bcm43xx_sysfs_register failure. This function is a bit messy regarding unwinding, though... |
3273 | 3273 | ||
3274 | /*FIXME: This should be handled by softmac instead. */ | ||
3275 | schedule_work(&bcm->softmac->associnfo.work); | ||
3276 | |||
3274 | assert(err == 0); | 3277 | assert(err == 0); |
3275 | out: | 3278 | out: |
3276 | return err; | 3279 | return err; |
@@ -3946,9 +3949,6 @@ static int bcm43xx_resume(struct pci_dev *pdev) | |||
3946 | 3949 | ||
3947 | netif_device_attach(net_dev); | 3950 | netif_device_attach(net_dev); |
3948 | 3951 | ||
3949 | /*FIXME: This should be handled by softmac instead. */ | ||
3950 | schedule_work(&bcm->softmac->associnfo.work); | ||
3951 | |||
3952 | dprintk(KERN_INFO PFX "Device resumed.\n"); | 3952 | dprintk(KERN_INFO PFX "Device resumed.\n"); |
3953 | 3953 | ||
3954 | return 0; | 3954 | return 0; |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 06523e2a8471..c2d0b09e0418 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -812,7 +812,6 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, | |||
812 | if (datalen > IEEE80211_DATA_LEN + 12) { | 812 | if (datalen > IEEE80211_DATA_LEN + 12) { |
813 | printk(KERN_DEBUG "%s: oversized monitor frame, " | 813 | printk(KERN_DEBUG "%s: oversized monitor frame, " |
814 | "data length = %d\n", dev->name, datalen); | 814 | "data length = %d\n", dev->name, datalen); |
815 | err = -EIO; | ||
816 | stats->rx_length_errors++; | 815 | stats->rx_length_errors++; |
817 | goto update_stats; | 816 | goto update_stats; |
818 | } | 817 | } |
@@ -821,8 +820,7 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, | |||
821 | if (!skb) { | 820 | if (!skb) { |
822 | printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n", | 821 | printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n", |
823 | dev->name); | 822 | dev->name); |
824 | err = -ENOMEM; | 823 | goto update_stats; |
825 | goto drop; | ||
826 | } | 824 | } |
827 | 825 | ||
828 | /* Copy the 802.11 header to the skb */ | 826 | /* Copy the 802.11 header to the skb */ |
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index ff192e96268a..dade4b903579 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -4306,7 +4306,7 @@ out: | |||
4306 | * Insertion of the module | 4306 | * Insertion of the module |
4307 | * I'm now quite proud of the multi-device support. | 4307 | * I'm now quite proud of the multi-device support. |
4308 | */ | 4308 | */ |
4309 | int init_module(void) | 4309 | int __init init_module(void) |
4310 | { | 4310 | { |
4311 | int ret = -EIO; /* Return error if no cards found */ | 4311 | int ret = -EIO; /* Return error if no cards found */ |
4312 | int i; | 4312 | int i; |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 6917c6cb0912..c2ecae5ff0c1 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -33,13 +33,10 @@ acpi_query_osc ( | |||
33 | acpi_status status; | 33 | acpi_status status; |
34 | struct acpi_object_list input; | 34 | struct acpi_object_list input; |
35 | union acpi_object in_params[4]; | 35 | union acpi_object in_params[4]; |
36 | struct acpi_buffer output; | 36 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; |
37 | union acpi_object out_obj; | 37 | union acpi_object *out_obj; |
38 | u32 osc_dw0; | 38 | u32 osc_dw0; |
39 | 39 | ||
40 | /* Setting up output buffer */ | ||
41 | output.length = sizeof(out_obj) + 3*sizeof(u32); | ||
42 | output.pointer = &out_obj; | ||
43 | 40 | ||
44 | /* Setting up input parameters */ | 41 | /* Setting up input parameters */ |
45 | input.count = 4; | 42 | input.count = 4; |
@@ -61,12 +58,15 @@ acpi_query_osc ( | |||
61 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); | 58 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); |
62 | return status; | 59 | return status; |
63 | } | 60 | } |
64 | if (out_obj.type != ACPI_TYPE_BUFFER) { | 61 | out_obj = output.pointer; |
62 | |||
63 | if (out_obj->type != ACPI_TYPE_BUFFER) { | ||
65 | printk(KERN_DEBUG | 64 | printk(KERN_DEBUG |
66 | "Evaluate _OSC returns wrong type\n"); | 65 | "Evaluate _OSC returns wrong type\n"); |
67 | return AE_TYPE; | 66 | status = AE_TYPE; |
67 | goto query_osc_out; | ||
68 | } | 68 | } |
69 | osc_dw0 = *((u32 *) out_obj.buffer.pointer); | 69 | osc_dw0 = *((u32 *) out_obj->buffer.pointer); |
70 | if (osc_dw0) { | 70 | if (osc_dw0) { |
71 | if (osc_dw0 & OSC_REQUEST_ERROR) | 71 | if (osc_dw0 & OSC_REQUEST_ERROR) |
72 | printk(KERN_DEBUG "_OSC request fails\n"); | 72 | printk(KERN_DEBUG "_OSC request fails\n"); |
@@ -76,15 +76,21 @@ acpi_query_osc ( | |||
76 | printk(KERN_DEBUG "_OSC invalid revision\n"); | 76 | printk(KERN_DEBUG "_OSC invalid revision\n"); |
77 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { | 77 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { |
78 | /* Update Global Control Set */ | 78 | /* Update Global Control Set */ |
79 | global_ctrlsets = *((u32 *)(out_obj.buffer.pointer+8)); | 79 | global_ctrlsets = *((u32 *)(out_obj->buffer.pointer+8)); |
80 | return AE_OK; | 80 | status = AE_OK; |
81 | goto query_osc_out; | ||
81 | } | 82 | } |
82 | return AE_ERROR; | 83 | status = AE_ERROR; |
84 | goto query_osc_out; | ||
83 | } | 85 | } |
84 | 86 | ||
85 | /* Update Global Control Set */ | 87 | /* Update Global Control Set */ |
86 | global_ctrlsets = *((u32 *)(out_obj.buffer.pointer + 8)); | 88 | global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8)); |
87 | return AE_OK; | 89 | status = AE_OK; |
90 | |||
91 | query_osc_out: | ||
92 | kfree(output.pointer); | ||
93 | return status; | ||
88 | } | 94 | } |
89 | 95 | ||
90 | 96 | ||
@@ -96,14 +102,10 @@ acpi_run_osc ( | |||
96 | acpi_status status; | 102 | acpi_status status; |
97 | struct acpi_object_list input; | 103 | struct acpi_object_list input; |
98 | union acpi_object in_params[4]; | 104 | union acpi_object in_params[4]; |
99 | struct acpi_buffer output; | 105 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; |
100 | union acpi_object out_obj; | 106 | union acpi_object *out_obj; |
101 | u32 osc_dw0; | 107 | u32 osc_dw0; |
102 | 108 | ||
103 | /* Setting up output buffer */ | ||
104 | output.length = sizeof(out_obj) + 3*sizeof(u32); | ||
105 | output.pointer = &out_obj; | ||
106 | |||
107 | /* Setting up input parameters */ | 109 | /* Setting up input parameters */ |
108 | input.count = 4; | 110 | input.count = 4; |
109 | input.pointer = in_params; | 111 | input.pointer = in_params; |
@@ -124,12 +126,14 @@ acpi_run_osc ( | |||
124 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); | 126 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); |
125 | return status; | 127 | return status; |
126 | } | 128 | } |
127 | if (out_obj.type != ACPI_TYPE_BUFFER) { | 129 | out_obj = output.pointer; |
130 | if (out_obj->type != ACPI_TYPE_BUFFER) { | ||
128 | printk(KERN_DEBUG | 131 | printk(KERN_DEBUG |
129 | "Evaluate _OSC returns wrong type\n"); | 132 | "Evaluate _OSC returns wrong type\n"); |
130 | return AE_TYPE; | 133 | status = AE_TYPE; |
134 | goto run_osc_out; | ||
131 | } | 135 | } |
132 | osc_dw0 = *((u32 *) out_obj.buffer.pointer); | 136 | osc_dw0 = *((u32 *) out_obj->buffer.pointer); |
133 | if (osc_dw0) { | 137 | if (osc_dw0) { |
134 | if (osc_dw0 & OSC_REQUEST_ERROR) | 138 | if (osc_dw0 & OSC_REQUEST_ERROR) |
135 | printk(KERN_DEBUG "_OSC request fails\n"); | 139 | printk(KERN_DEBUG "_OSC request fails\n"); |
@@ -139,11 +143,17 @@ acpi_run_osc ( | |||
139 | printk(KERN_DEBUG "_OSC invalid revision\n"); | 143 | printk(KERN_DEBUG "_OSC invalid revision\n"); |
140 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { | 144 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { |
141 | printk(KERN_DEBUG "_OSC FW not grant req. control\n"); | 145 | printk(KERN_DEBUG "_OSC FW not grant req. control\n"); |
142 | return AE_SUPPORT; | 146 | status = AE_SUPPORT; |
147 | goto run_osc_out; | ||
143 | } | 148 | } |
144 | return AE_ERROR; | 149 | status = AE_ERROR; |
150 | goto run_osc_out; | ||
145 | } | 151 | } |
146 | return AE_OK; | 152 | status = AE_OK; |
153 | |||
154 | run_osc_out: | ||
155 | kfree(output.pointer); | ||
156 | return status; | ||
147 | } | 157 | } |
148 | 158 | ||
149 | /** | 159 | /** |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 1456759936c5..10e1a905c144 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -285,9 +285,9 @@ static int pci_device_suspend(struct device * dev, pm_message_t state) | |||
285 | * Default resume method for devices that have no driver provided resume, | 285 | * Default resume method for devices that have no driver provided resume, |
286 | * or not even a driver at all. | 286 | * or not even a driver at all. |
287 | */ | 287 | */ |
288 | static void pci_default_resume(struct pci_dev *pci_dev) | 288 | static int pci_default_resume(struct pci_dev *pci_dev) |
289 | { | 289 | { |
290 | int retval; | 290 | int retval = 0; |
291 | 291 | ||
292 | /* restore the PCI config space */ | 292 | /* restore the PCI config space */ |
293 | pci_restore_state(pci_dev); | 293 | pci_restore_state(pci_dev); |
@@ -297,18 +297,21 @@ static void pci_default_resume(struct pci_dev *pci_dev) | |||
297 | /* if the device was busmaster before the suspend, make it busmaster again */ | 297 | /* if the device was busmaster before the suspend, make it busmaster again */ |
298 | if (pci_dev->is_busmaster) | 298 | if (pci_dev->is_busmaster) |
299 | pci_set_master(pci_dev); | 299 | pci_set_master(pci_dev); |
300 | |||
301 | return retval; | ||
300 | } | 302 | } |
301 | 303 | ||
302 | static int pci_device_resume(struct device * dev) | 304 | static int pci_device_resume(struct device * dev) |
303 | { | 305 | { |
306 | int error; | ||
304 | struct pci_dev * pci_dev = to_pci_dev(dev); | 307 | struct pci_dev * pci_dev = to_pci_dev(dev); |
305 | struct pci_driver * drv = pci_dev->driver; | 308 | struct pci_driver * drv = pci_dev->driver; |
306 | 309 | ||
307 | if (drv && drv->resume) | 310 | if (drv && drv->resume) |
308 | drv->resume(pci_dev); | 311 | error = drv->resume(pci_dev); |
309 | else | 312 | else |
310 | pci_default_resume(pci_dev); | 313 | error = pci_default_resume(pci_dev); |
311 | return 0; | 314 | return error; |
312 | } | 315 | } |
313 | 316 | ||
314 | static void pci_device_shutdown(struct device *dev) | 317 | static void pci_device_shutdown(struct device *dev) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 2329f941a0dc..12286275b1c8 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -461,9 +461,23 @@ int | |||
461 | pci_restore_state(struct pci_dev *dev) | 461 | pci_restore_state(struct pci_dev *dev) |
462 | { | 462 | { |
463 | int i; | 463 | int i; |
464 | int val; | ||
464 | 465 | ||
465 | for (i = 0; i < 16; i++) | 466 | /* |
466 | pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); | 467 | * The Base Address register should be programmed before the command |
468 | * register(s) | ||
469 | */ | ||
470 | for (i = 15; i >= 0; i--) { | ||
471 | pci_read_config_dword(dev, i * 4, &val); | ||
472 | if (val != dev->saved_config_space[i]) { | ||
473 | printk(KERN_DEBUG "PM: Writing back config space on " | ||
474 | "device %s at offset %x (was %x, writing %x)\n", | ||
475 | pci_name(dev), i, | ||
476 | val, (int)dev->saved_config_space[i]); | ||
477 | pci_write_config_dword(dev,i * 4, | ||
478 | dev->saved_config_space[i]); | ||
479 | } | ||
480 | } | ||
467 | pci_restore_msi_state(dev); | 481 | pci_restore_msi_state(dev); |
468 | pci_restore_msix_state(dev); | 482 | pci_restore_msix_state(dev); |
469 | return 0; | 483 | return 0; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 19e2b174d33c..d378478612fb 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -634,6 +634,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vi | |||
634 | * non-x86 architectures (yes Via exists on PPC among other places), | 634 | * non-x86 architectures (yes Via exists on PPC among other places), |
635 | * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get | 635 | * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get |
636 | * interrupts delivered properly. | 636 | * interrupts delivered properly. |
637 | * | ||
638 | * Some of the on-chip devices are actually '586 devices' so they are | ||
639 | * listed here. | ||
637 | */ | 640 | */ |
638 | static void quirk_via_irq(struct pci_dev *dev) | 641 | static void quirk_via_irq(struct pci_dev *dev) |
639 | { | 642 | { |
@@ -648,6 +651,10 @@ static void quirk_via_irq(struct pci_dev *dev) | |||
648 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq); | 651 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq); |
649 | } | 652 | } |
650 | } | 653 | } |
654 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_via_irq); | ||
655 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq); | ||
656 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq); | ||
657 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq); | ||
651 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq); | 658 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq); |
652 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq); | 659 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq); |
653 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq); | 660 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq); |
@@ -895,6 +902,7 @@ static void __init k8t_sound_hostbridge(struct pci_dev *dev) | |||
895 | } | 902 | } |
896 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge); | 903 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge); |
897 | 904 | ||
905 | #ifndef CONFIG_ACPI_SLEEP | ||
898 | /* | 906 | /* |
899 | * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge | 907 | * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge |
900 | * is not activated. The myth is that Asus said that they do not want the | 908 | * is not activated. The myth is that Asus said that they do not want the |
@@ -906,8 +914,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho | |||
906 | * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it | 914 | * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it |
907 | * becomes necessary to do this tweak in two steps -- I've chosen the Host | 915 | * becomes necessary to do this tweak in two steps -- I've chosen the Host |
908 | * bridge as trigger. | 916 | * bridge as trigger. |
917 | * | ||
918 | * Actually, leaving it unhidden and not redoing the quirk over suspend2ram | ||
919 | * will cause thermal management to break down, and causing machine to | ||
920 | * overheat. | ||
909 | */ | 921 | */ |
910 | static int __initdata asus_hides_smbus = 0; | 922 | static int __initdata asus_hides_smbus; |
911 | 923 | ||
912 | static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) | 924 | static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) |
913 | { | 925 | { |
@@ -1050,6 +1062,8 @@ static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev) | |||
1050 | } | 1062 | } |
1051 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); | 1063 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); |
1052 | 1064 | ||
1065 | #endif | ||
1066 | |||
1053 | /* | 1067 | /* |
1054 | * SiS 96x south bridge: BIOS typically hides SMBus device... | 1068 | * SiS 96x south bridge: BIOS typically hides SMBus device... |
1055 | */ | 1069 | */ |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 48d3b3d30c21..74b3124e8247 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -1143,6 +1143,12 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
1143 | { | 1143 | { |
1144 | struct pcmcia_socket *s = pcmcia_get_socket(skt); | 1144 | struct pcmcia_socket *s = pcmcia_get_socket(skt); |
1145 | 1145 | ||
1146 | if (!s) { | ||
1147 | printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ | ||
1148 | "failed, event 0x%x lost!\n", skt, event); | ||
1149 | return -ENODEV; | ||
1150 | } | ||
1151 | |||
1146 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", | 1152 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", |
1147 | event, priority, skt); | 1153 | event, priority, skt); |
1148 | 1154 | ||
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index c53db7ceda5e..738b1ef595a3 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -426,7 +426,7 @@ static int ds_open(struct inode *inode, struct file *file) | |||
426 | 426 | ||
427 | if (!warning_printed) { | 427 | if (!warning_printed) { |
428 | printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " | 428 | printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " |
429 | "usage.\n"); | 429 | "usage from process: %s.\n", current->comm); |
430 | printk(KERN_INFO "pcmcia: This interface will soon be removed from " | 430 | printk(KERN_INFO "pcmcia: This interface will soon be removed from " |
431 | "the kernel; please expect breakage unless you upgrade " | 431 | "the kernel; please expect breakage unless you upgrade " |
432 | "to new tools.\n"); | 432 | "to new tools.\n"); |
@@ -601,8 +601,12 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
601 | ret = CS_BAD_ARGS; | 601 | ret = CS_BAD_ARGS; |
602 | else { | 602 | else { |
603 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); | 603 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); |
604 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); | 604 | if (p_dev == NULL) |
605 | pcmcia_put_dev(p_dev); | 605 | ret = CS_BAD_ARGS; |
606 | else { | ||
607 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); | ||
608 | pcmcia_put_dev(p_dev); | ||
609 | } | ||
606 | } | 610 | } |
607 | break; | 611 | break; |
608 | case DS_GET_FIRST_TUPLE: | 612 | case DS_GET_FIRST_TUPLE: |
@@ -632,8 +636,12 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
632 | ret = CS_BAD_ARGS; | 636 | ret = CS_BAD_ARGS; |
633 | else { | 637 | else { |
634 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); | 638 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); |
635 | ret = pccard_get_status(s, p_dev, &buf->status); | 639 | if (p_dev == NULL) |
636 | pcmcia_put_dev(p_dev); | 640 | ret = CS_BAD_ARGS; |
641 | else { | ||
642 | ret = pccard_get_status(s, p_dev, &buf->status); | ||
643 | pcmcia_put_dev(p_dev); | ||
644 | } | ||
637 | } | 645 | } |
638 | break; | 646 | break; |
639 | case DS_VALIDATE_CIS: | 647 | case DS_VALIDATE_CIS: |
@@ -665,9 +673,10 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
665 | if (!(buf->conf_reg.Function && | 673 | if (!(buf->conf_reg.Function && |
666 | (buf->conf_reg.Function >= s->functions))) { | 674 | (buf->conf_reg.Function >= s->functions))) { |
667 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); | 675 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); |
668 | if (p_dev) | 676 | if (p_dev) { |
669 | ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); | 677 | ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); |
670 | pcmcia_put_dev(p_dev); | 678 | pcmcia_put_dev(p_dev); |
679 | } | ||
671 | } | 680 | } |
672 | break; | 681 | break; |
673 | case DS_GET_FIRST_REGION: | 682 | case DS_GET_FIRST_REGION: |
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 16d1ea7b0a18..247ab837f841 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -589,7 +589,7 @@ static int pd6729_check_irq(int irq, int flags) | |||
589 | return 0; | 589 | return 0; |
590 | } | 590 | } |
591 | 591 | ||
592 | static u_int __init pd6729_isa_scan(void) | 592 | static u_int __devinit pd6729_isa_scan(void) |
593 | { | 593 | { |
594 | u_int mask0, mask = 0; | 594 | u_int mask0, mask = 0; |
595 | int i; | 595 | int i; |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 407b4eaddcbf..3a4a644c2686 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -36,13 +36,13 @@ static int irq_flags(int triggering, int polarity) | |||
36 | { | 36 | { |
37 | int flag; | 37 | int flag; |
38 | if (triggering == ACPI_LEVEL_SENSITIVE) { | 38 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
39 | if(polarity == ACPI_ACTIVE_LOW) | 39 | if (polarity == ACPI_ACTIVE_LOW) |
40 | flag = IORESOURCE_IRQ_LOWLEVEL; | 40 | flag = IORESOURCE_IRQ_LOWLEVEL; |
41 | else | 41 | else |
42 | flag = IORESOURCE_IRQ_HIGHLEVEL; | 42 | flag = IORESOURCE_IRQ_HIGHLEVEL; |
43 | } | 43 | } |
44 | else { | 44 | else { |
45 | if(polarity == ACPI_ACTIVE_LOW) | 45 | if (polarity == ACPI_ACTIVE_LOW) |
46 | flag = IORESOURCE_IRQ_LOWEDGE; | 46 | flag = IORESOURCE_IRQ_LOWEDGE; |
47 | else | 47 | else |
48 | flag = IORESOURCE_IRQ_HIGHEDGE; | 48 | flag = IORESOURCE_IRQ_HIGHEDGE; |
@@ -57,7 +57,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
57 | *triggering = ACPI_LEVEL_SENSITIVE; | 57 | *triggering = ACPI_LEVEL_SENSITIVE; |
58 | *polarity = ACPI_ACTIVE_LOW; | 58 | *polarity = ACPI_ACTIVE_LOW; |
59 | break; | 59 | break; |
60 | case IORESOURCE_IRQ_HIGHLEVEL: | 60 | case IORESOURCE_IRQ_HIGHLEVEL: |
61 | *triggering = ACPI_LEVEL_SENSITIVE; | 61 | *triggering = ACPI_LEVEL_SENSITIVE; |
62 | *polarity = ACPI_ACTIVE_HIGH; | 62 | *polarity = ACPI_ACTIVE_HIGH; |
63 | break; | 63 | break; |
@@ -73,7 +73,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | static void | 75 | static void |
76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | 76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, |
77 | int triggering, int polarity) | 77 | int triggering, int polarity) |
78 | { | 78 | { |
79 | int i = 0; | 79 | int i = 0; |
@@ -101,7 +101,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | |||
101 | } | 101 | } |
102 | 102 | ||
103 | static void | 103 | static void |
104 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | 104 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) |
105 | { | 105 | { |
106 | int i = 0; | 106 | int i = 0; |
107 | while (i < PNP_MAX_DMA && | 107 | while (i < PNP_MAX_DMA && |
@@ -119,8 +119,8 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | static void | 121 | static void |
122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | 122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, |
123 | u32 io, u32 len) | 123 | u64 io, u64 len) |
124 | { | 124 | { |
125 | int i = 0; | 125 | int i = 0; |
126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && | 126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && |
@@ -138,7 +138,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | |||
138 | } | 138 | } |
139 | 139 | ||
140 | static void | 140 | static void |
141 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | 141 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, |
142 | u64 mem, u64 len) | 142 | u64 mem, u64 len) |
143 | { | 143 | { |
144 | int i = 0; | 144 | int i = 0; |
@@ -156,11 +156,32 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | static void | ||
160 | pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | ||
161 | struct acpi_resource *res) | ||
162 | { | ||
163 | struct acpi_resource_address64 addr, *p = &addr; | ||
164 | acpi_status status; | ||
165 | |||
166 | status = acpi_resource_to_address64(res, p); | ||
167 | if (!ACPI_SUCCESS(status)) { | ||
168 | pnp_warn("PnPACPI: failed to convert resource type %d", | ||
169 | res->type); | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | if (p->resource_type == ACPI_MEMORY_RANGE) | ||
174 | pnpacpi_parse_allocated_memresource(res_table, | ||
175 | p->minimum, p->address_length); | ||
176 | else if (p->resource_type == ACPI_IO_RANGE) | ||
177 | pnpacpi_parse_allocated_ioresource(res_table, | ||
178 | p->minimum, p->address_length); | ||
179 | } | ||
159 | 180 | ||
160 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 181 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
161 | void *data) | 182 | void *data) |
162 | { | 183 | { |
163 | struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; | 184 | struct pnp_resource_table *res_table = (struct pnp_resource_table *)data; |
164 | int i; | 185 | int i; |
165 | 186 | ||
166 | switch (res->type) { | 187 | switch (res->type) { |
@@ -221,19 +242,9 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
221 | res->data.fixed_memory32.address_length); | 242 | res->data.fixed_memory32.address_length); |
222 | break; | 243 | break; |
223 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 244 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
224 | pnpacpi_parse_allocated_memresource(res_table, | ||
225 | res->data.address16.minimum, | ||
226 | res->data.address16.address_length); | ||
227 | break; | ||
228 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 245 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
229 | pnpacpi_parse_allocated_memresource(res_table, | ||
230 | res->data.address32.minimum, | ||
231 | res->data.address32.address_length); | ||
232 | break; | ||
233 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 246 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
234 | pnpacpi_parse_allocated_memresource(res_table, | 247 | pnpacpi_parse_allocated_address_space(res_table, res); |
235 | res->data.address64.minimum, | ||
236 | res->data.address64.address_length); | ||
237 | break; | 248 | break; |
238 | 249 | ||
239 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | 250 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: |
@@ -255,11 +266,11 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
255 | pnp_warn("PnPACPI: unknown resource type %d", res->type); | 266 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
256 | return AE_ERROR; | 267 | return AE_ERROR; |
257 | } | 268 | } |
258 | 269 | ||
259 | return AE_OK; | 270 | return AE_OK; |
260 | } | 271 | } |
261 | 272 | ||
262 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table * res) | 273 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table *res) |
263 | { | 274 | { |
264 | /* Blank the resource table values */ | 275 | /* Blank the resource table values */ |
265 | pnp_init_resource_table(res); | 276 | pnp_init_resource_table(res); |
@@ -317,17 +328,17 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
317 | pnp_err("Invalid DMA transfer type"); | 328 | pnp_err("Invalid DMA transfer type"); |
318 | } | 329 | } |
319 | 330 | ||
320 | pnp_register_dma_resource(option,dma); | 331 | pnp_register_dma_resource(option, dma); |
321 | return; | 332 | return; |
322 | } | 333 | } |
323 | 334 | ||
324 | 335 | ||
325 | static void pnpacpi_parse_irq_option(struct pnp_option *option, | 336 | static void pnpacpi_parse_irq_option(struct pnp_option *option, |
326 | struct acpi_resource_irq *p) | 337 | struct acpi_resource_irq *p) |
327 | { | 338 | { |
328 | int i; | 339 | int i; |
329 | struct pnp_irq * irq; | 340 | struct pnp_irq *irq; |
330 | 341 | ||
331 | if (p->interrupt_count == 0) | 342 | if (p->interrupt_count == 0) |
332 | return; | 343 | return; |
333 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 344 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); |
@@ -347,7 +358,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, | |||
347 | struct acpi_resource_extended_irq *p) | 358 | struct acpi_resource_extended_irq *p) |
348 | { | 359 | { |
349 | int i; | 360 | int i; |
350 | struct pnp_irq * irq; | 361 | struct pnp_irq *irq; |
351 | 362 | ||
352 | if (p->interrupt_count == 0) | 363 | if (p->interrupt_count == 0) |
353 | return; | 364 | return; |
@@ -368,7 +379,7 @@ static void | |||
368 | pnpacpi_parse_port_option(struct pnp_option *option, | 379 | pnpacpi_parse_port_option(struct pnp_option *option, |
369 | struct acpi_resource_io *io) | 380 | struct acpi_resource_io *io) |
370 | { | 381 | { |
371 | struct pnp_port * port; | 382 | struct pnp_port *port; |
372 | 383 | ||
373 | if (io->address_length == 0) | 384 | if (io->address_length == 0) |
374 | return; | 385 | return; |
@@ -381,7 +392,7 @@ pnpacpi_parse_port_option(struct pnp_option *option, | |||
381 | port->size = io->address_length; | 392 | port->size = io->address_length; |
382 | port->flags = ACPI_DECODE_16 == io->io_decode ? | 393 | port->flags = ACPI_DECODE_16 == io->io_decode ? |
383 | PNP_PORT_FLAG_16BITADDR : 0; | 394 | PNP_PORT_FLAG_16BITADDR : 0; |
384 | pnp_register_port_resource(option,port); | 395 | pnp_register_port_resource(option, port); |
385 | return; | 396 | return; |
386 | } | 397 | } |
387 | 398 | ||
@@ -389,7 +400,7 @@ static void | |||
389 | pnpacpi_parse_fixed_port_option(struct pnp_option *option, | 400 | pnpacpi_parse_fixed_port_option(struct pnp_option *option, |
390 | struct acpi_resource_fixed_io *io) | 401 | struct acpi_resource_fixed_io *io) |
391 | { | 402 | { |
392 | struct pnp_port * port; | 403 | struct pnp_port *port; |
393 | 404 | ||
394 | if (io->address_length == 0) | 405 | if (io->address_length == 0) |
395 | return; | 406 | return; |
@@ -400,7 +411,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
400 | port->size = io->address_length; | 411 | port->size = io->address_length; |
401 | port->align = 0; | 412 | port->align = 0; |
402 | port->flags = PNP_PORT_FLAG_FIXED; | 413 | port->flags = PNP_PORT_FLAG_FIXED; |
403 | pnp_register_port_resource(option,port); | 414 | pnp_register_port_resource(option, port); |
404 | return; | 415 | return; |
405 | } | 416 | } |
406 | 417 | ||
@@ -408,7 +419,7 @@ static void | |||
408 | pnpacpi_parse_mem24_option(struct pnp_option *option, | 419 | pnpacpi_parse_mem24_option(struct pnp_option *option, |
409 | struct acpi_resource_memory24 *p) | 420 | struct acpi_resource_memory24 *p) |
410 | { | 421 | { |
411 | struct pnp_mem * mem; | 422 | struct pnp_mem *mem; |
412 | 423 | ||
413 | if (p->address_length == 0) | 424 | if (p->address_length == 0) |
414 | return; | 425 | return; |
@@ -423,7 +434,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, | |||
423 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 434 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
424 | IORESOURCE_MEM_WRITEABLE : 0; | 435 | IORESOURCE_MEM_WRITEABLE : 0; |
425 | 436 | ||
426 | pnp_register_mem_resource(option,mem); | 437 | pnp_register_mem_resource(option, mem); |
427 | return; | 438 | return; |
428 | } | 439 | } |
429 | 440 | ||
@@ -431,7 +442,7 @@ static void | |||
431 | pnpacpi_parse_mem32_option(struct pnp_option *option, | 442 | pnpacpi_parse_mem32_option(struct pnp_option *option, |
432 | struct acpi_resource_memory32 *p) | 443 | struct acpi_resource_memory32 *p) |
433 | { | 444 | { |
434 | struct pnp_mem * mem; | 445 | struct pnp_mem *mem; |
435 | 446 | ||
436 | if (p->address_length == 0) | 447 | if (p->address_length == 0) |
437 | return; | 448 | return; |
@@ -446,7 +457,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, | |||
446 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 457 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
447 | IORESOURCE_MEM_WRITEABLE : 0; | 458 | IORESOURCE_MEM_WRITEABLE : 0; |
448 | 459 | ||
449 | pnp_register_mem_resource(option,mem); | 460 | pnp_register_mem_resource(option, mem); |
450 | return; | 461 | return; |
451 | } | 462 | } |
452 | 463 | ||
@@ -454,7 +465,7 @@ static void | |||
454 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | 465 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, |
455 | struct acpi_resource_fixed_memory32 *p) | 466 | struct acpi_resource_fixed_memory32 *p) |
456 | { | 467 | { |
457 | struct pnp_mem * mem; | 468 | struct pnp_mem *mem; |
458 | 469 | ||
459 | if (p->address_length == 0) | 470 | if (p->address_length == 0) |
460 | return; | 471 | return; |
@@ -468,7 +479,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | |||
468 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 479 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
469 | IORESOURCE_MEM_WRITEABLE : 0; | 480 | IORESOURCE_MEM_WRITEABLE : 0; |
470 | 481 | ||
471 | pnp_register_mem_resource(option,mem); | 482 | pnp_register_mem_resource(option, mem); |
472 | return; | 483 | return; |
473 | } | 484 | } |
474 | 485 | ||
@@ -477,8 +488,8 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
477 | { | 488 | { |
478 | struct acpi_resource_address64 addr, *p = &addr; | 489 | struct acpi_resource_address64 addr, *p = &addr; |
479 | acpi_status status; | 490 | acpi_status status; |
480 | struct pnp_mem * mem; | 491 | struct pnp_mem *mem; |
481 | struct pnp_port * port; | 492 | struct pnp_port *port; |
482 | 493 | ||
483 | status = acpi_resource_to_address64(r, p); | 494 | status = acpi_resource_to_address64(r, p); |
484 | if (!ACPI_SUCCESS(status)) { | 495 | if (!ACPI_SUCCESS(status)) { |
@@ -498,7 +509,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
498 | mem->align = 0; | 509 | mem->align = 0; |
499 | mem->flags = (p->info.mem.write_protect == | 510 | mem->flags = (p->info.mem.write_protect == |
500 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; | 511 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; |
501 | pnp_register_mem_resource(option,mem); | 512 | pnp_register_mem_resource(option, mem); |
502 | } else if (p->resource_type == ACPI_IO_RANGE) { | 513 | } else if (p->resource_type == ACPI_IO_RANGE) { |
503 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 514 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
504 | if (!port) | 515 | if (!port) |
@@ -507,7 +518,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
507 | port->size = p->address_length; | 518 | port->size = p->address_length; |
508 | port->align = 0; | 519 | port->align = 0; |
509 | port->flags = PNP_PORT_FLAG_FIXED; | 520 | port->flags = PNP_PORT_FLAG_FIXED; |
510 | pnp_register_port_resource(option,port); | 521 | pnp_register_port_resource(option, port); |
511 | } | 522 | } |
512 | } | 523 | } |
513 | 524 | ||
@@ -531,7 +542,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
531 | break; | 542 | break; |
532 | 543 | ||
533 | case ACPI_RESOURCE_TYPE_DMA: | 544 | case ACPI_RESOURCE_TYPE_DMA: |
534 | pnpacpi_parse_dma_option(option, &res->data.dma); | 545 | pnpacpi_parse_dma_option(option, &res->data.dma); |
535 | break; | 546 | break; |
536 | 547 | ||
537 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 548 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
@@ -539,7 +550,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
539 | case ACPI_GOOD_CONFIGURATION: | 550 | case ACPI_GOOD_CONFIGURATION: |
540 | priority = PNP_RES_PRIORITY_PREFERRED; | 551 | priority = PNP_RES_PRIORITY_PREFERRED; |
541 | break; | 552 | break; |
542 | 553 | ||
543 | case ACPI_ACCEPTABLE_CONFIGURATION: | 554 | case ACPI_ACCEPTABLE_CONFIGURATION: |
544 | priority = PNP_RES_PRIORITY_ACCEPTABLE; | 555 | priority = PNP_RES_PRIORITY_ACCEPTABLE; |
545 | break; | 556 | break; |
@@ -555,7 +566,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
555 | option = pnp_register_dependent_option(dev, priority); | 566 | option = pnp_register_dependent_option(dev, priority); |
556 | if (!option) | 567 | if (!option) |
557 | return AE_ERROR; | 568 | return AE_ERROR; |
558 | parse_data->option = option; | 569 | parse_data->option = option; |
559 | break; | 570 | break; |
560 | 571 | ||
561 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | 572 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: |
@@ -615,7 +626,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
615 | pnp_warn("PnPACPI: unknown resource type %d", res->type); | 626 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
616 | return AE_ERROR; | 627 | return AE_ERROR; |
617 | } | 628 | } |
618 | 629 | ||
619 | return AE_OK; | 630 | return AE_OK; |
620 | } | 631 | } |
621 | 632 | ||
@@ -636,13 +647,8 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | |||
636 | return status; | 647 | return status; |
637 | } | 648 | } |
638 | 649 | ||
639 | /* | 650 | static int pnpacpi_supported_resource(struct acpi_resource *res) |
640 | * Set resource | ||
641 | */ | ||
642 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | ||
643 | void *data) | ||
644 | { | 651 | { |
645 | int *res_cnt = (int *)data; | ||
646 | switch (res->type) { | 652 | switch (res->type) { |
647 | case ACPI_RESOURCE_TYPE_IRQ: | 653 | case ACPI_RESOURCE_TYPE_IRQ: |
648 | case ACPI_RESOURCE_TYPE_DMA: | 654 | case ACPI_RESOURCE_TYPE_DMA: |
@@ -655,43 +661,32 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | |||
655 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 661 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
656 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 662 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
657 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 663 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
658 | (*res_cnt) ++; | 664 | return 1; |
659 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
660 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
661 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
662 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
663 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
664 | default: | ||
665 | return AE_OK; | ||
666 | } | 665 | } |
667 | return AE_OK; | 666 | return 0; |
668 | } | 667 | } |
669 | 668 | ||
670 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | 669 | /* |
670 | * Set resource | ||
671 | */ | ||
672 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | ||
671 | void *data) | 673 | void *data) |
672 | { | 674 | { |
673 | struct acpi_resource **resource = (struct acpi_resource **)data; | 675 | int *res_cnt = (int *)data; |
674 | switch (res->type) { | 676 | |
675 | case ACPI_RESOURCE_TYPE_IRQ: | 677 | if (pnpacpi_supported_resource(res)) |
676 | case ACPI_RESOURCE_TYPE_DMA: | 678 | (*res_cnt)++; |
677 | case ACPI_RESOURCE_TYPE_IO: | 679 | return AE_OK; |
678 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 680 | } |
679 | case ACPI_RESOURCE_TYPE_MEMORY24: | 681 | |
680 | case ACPI_RESOURCE_TYPE_MEMORY32: | 682 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) |
681 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 683 | { |
682 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 684 | struct acpi_resource **resource = (struct acpi_resource **)data; |
683 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 685 | |
684 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 686 | if (pnpacpi_supported_resource(res)) { |
685 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | ||
686 | (*resource)->type = res->type; | 687 | (*resource)->type = res->type; |
688 | (*resource)->length = sizeof(struct acpi_resource); | ||
687 | (*resource)++; | 689 | (*resource)++; |
688 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
689 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
690 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
691 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
692 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
693 | default: | ||
694 | return AE_OK; | ||
695 | } | 690 | } |
696 | 691 | ||
697 | return AE_OK; | 692 | return AE_OK; |
@@ -735,11 +730,8 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource, | |||
735 | struct resource *p) | 730 | struct resource *p) |
736 | { | 731 | { |
737 | int triggering, polarity; | 732 | int triggering, polarity; |
738 | 733 | ||
739 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, | 734 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); |
740 | &polarity); | ||
741 | resource->type = ACPI_RESOURCE_TYPE_IRQ; | ||
742 | resource->length = sizeof(struct acpi_resource); | ||
743 | resource->data.irq.triggering = triggering; | 735 | resource->data.irq.triggering = triggering; |
744 | resource->data.irq.polarity = polarity; | 736 | resource->data.irq.polarity = polarity; |
745 | if (triggering == ACPI_EDGE_SENSITIVE) | 737 | if (triggering == ACPI_EDGE_SENSITIVE) |
@@ -754,11 +746,8 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
754 | struct resource *p) | 746 | struct resource *p) |
755 | { | 747 | { |
756 | int triggering, polarity; | 748 | int triggering, polarity; |
757 | 749 | ||
758 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, | 750 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); |
759 | &polarity); | ||
760 | resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; | ||
761 | resource->length = sizeof(struct acpi_resource); | ||
762 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; | 751 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; |
763 | resource->data.extended_irq.triggering = triggering; | 752 | resource->data.extended_irq.triggering = triggering; |
764 | resource->data.extended_irq.polarity = polarity; | 753 | resource->data.extended_irq.polarity = polarity; |
@@ -773,8 +762,6 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
773 | static void pnpacpi_encode_dma(struct acpi_resource *resource, | 762 | static void pnpacpi_encode_dma(struct acpi_resource *resource, |
774 | struct resource *p) | 763 | struct resource *p) |
775 | { | 764 | { |
776 | resource->type = ACPI_RESOURCE_TYPE_DMA; | ||
777 | resource->length = sizeof(struct acpi_resource); | ||
778 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ | 765 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ |
779 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) | 766 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) |
780 | resource->data.dma.type = ACPI_COMPATIBILITY; | 767 | resource->data.dma.type = ACPI_COMPATIBILITY; |
@@ -798,8 +785,6 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, | |||
798 | static void pnpacpi_encode_io(struct acpi_resource *resource, | 785 | static void pnpacpi_encode_io(struct acpi_resource *resource, |
799 | struct resource *p) | 786 | struct resource *p) |
800 | { | 787 | { |
801 | resource->type = ACPI_RESOURCE_TYPE_IO; | ||
802 | resource->length = sizeof(struct acpi_resource); | ||
803 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ | 788 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ |
804 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? | 789 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? |
805 | ACPI_DECODE_16 : ACPI_DECODE_10; | 790 | ACPI_DECODE_16 : ACPI_DECODE_10; |
@@ -812,8 +797,6 @@ static void pnpacpi_encode_io(struct acpi_resource *resource, | |||
812 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | 797 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, |
813 | struct resource *p) | 798 | struct resource *p) |
814 | { | 799 | { |
815 | resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; | ||
816 | resource->length = sizeof(struct acpi_resource); | ||
817 | resource->data.fixed_io.address = p->start; | 800 | resource->data.fixed_io.address = p->start; |
818 | resource->data.fixed_io.address_length = p->end - p->start + 1; | 801 | resource->data.fixed_io.address_length = p->end - p->start + 1; |
819 | } | 802 | } |
@@ -821,8 +804,6 @@ static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | |||
821 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, | 804 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, |
822 | struct resource *p) | 805 | struct resource *p) |
823 | { | 806 | { |
824 | resource->type = ACPI_RESOURCE_TYPE_MEMORY24; | ||
825 | resource->length = sizeof(struct acpi_resource); | ||
826 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ | 807 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ |
827 | resource->data.memory24.write_protect = | 808 | resource->data.memory24.write_protect = |
828 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 809 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
@@ -836,8 +817,6 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, | |||
836 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, | 817 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, |
837 | struct resource *p) | 818 | struct resource *p) |
838 | { | 819 | { |
839 | resource->type = ACPI_RESOURCE_TYPE_MEMORY32; | ||
840 | resource->length = sizeof(struct acpi_resource); | ||
841 | resource->data.memory32.write_protect = | 820 | resource->data.memory32.write_protect = |
842 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 821 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
843 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 822 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
@@ -850,8 +829,6 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, | |||
850 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | 829 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, |
851 | struct resource *p) | 830 | struct resource *p) |
852 | { | 831 | { |
853 | resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; | ||
854 | resource->length = sizeof(struct acpi_resource); | ||
855 | resource->data.fixed_memory32.write_protect = | 832 | resource->data.fixed_memory32.write_protect = |
856 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 833 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
857 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 834 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
@@ -882,37 +859,37 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
882 | pnp_dbg("Encode dma"); | 859 | pnp_dbg("Encode dma"); |
883 | pnpacpi_encode_dma(resource, | 860 | pnpacpi_encode_dma(resource, |
884 | &res_table->dma_resource[dma]); | 861 | &res_table->dma_resource[dma]); |
885 | dma ++; | 862 | dma++; |
886 | break; | 863 | break; |
887 | case ACPI_RESOURCE_TYPE_IO: | 864 | case ACPI_RESOURCE_TYPE_IO: |
888 | pnp_dbg("Encode io"); | 865 | pnp_dbg("Encode io"); |
889 | pnpacpi_encode_io(resource, | 866 | pnpacpi_encode_io(resource, |
890 | &res_table->port_resource[port]); | 867 | &res_table->port_resource[port]); |
891 | port ++; | 868 | port++; |
892 | break; | 869 | break; |
893 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 870 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
894 | pnp_dbg("Encode fixed io"); | 871 | pnp_dbg("Encode fixed io"); |
895 | pnpacpi_encode_fixed_io(resource, | 872 | pnpacpi_encode_fixed_io(resource, |
896 | &res_table->port_resource[port]); | 873 | &res_table->port_resource[port]); |
897 | port ++; | 874 | port++; |
898 | break; | 875 | break; |
899 | case ACPI_RESOURCE_TYPE_MEMORY24: | 876 | case ACPI_RESOURCE_TYPE_MEMORY24: |
900 | pnp_dbg("Encode mem24"); | 877 | pnp_dbg("Encode mem24"); |
901 | pnpacpi_encode_mem24(resource, | 878 | pnpacpi_encode_mem24(resource, |
902 | &res_table->mem_resource[mem]); | 879 | &res_table->mem_resource[mem]); |
903 | mem ++; | 880 | mem++; |
904 | break; | 881 | break; |
905 | case ACPI_RESOURCE_TYPE_MEMORY32: | 882 | case ACPI_RESOURCE_TYPE_MEMORY32: |
906 | pnp_dbg("Encode mem32"); | 883 | pnp_dbg("Encode mem32"); |
907 | pnpacpi_encode_mem32(resource, | 884 | pnpacpi_encode_mem32(resource, |
908 | &res_table->mem_resource[mem]); | 885 | &res_table->mem_resource[mem]); |
909 | mem ++; | 886 | mem++; |
910 | break; | 887 | break; |
911 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 888 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
912 | pnp_dbg("Encode fixed mem32"); | 889 | pnp_dbg("Encode fixed mem32"); |
913 | pnpacpi_encode_fixed_mem32(resource, | 890 | pnpacpi_encode_fixed_mem32(resource, |
914 | &res_table->mem_resource[mem]); | 891 | &res_table->mem_resource[mem]); |
915 | mem ++; | 892 | mem++; |
916 | break; | 893 | break; |
917 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 894 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
918 | pnp_dbg("Encode ext irq"); | 895 | pnp_dbg("Encode ext irq"); |
@@ -933,8 +910,8 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
933 | pnp_warn("unknown resource type %d", resource->type); | 910 | pnp_warn("unknown resource type %d", resource->type); |
934 | return -EINVAL; | 911 | return -EINVAL; |
935 | } | 912 | } |
936 | resource ++; | 913 | resource++; |
937 | i ++; | 914 | i++; |
938 | } | 915 | } |
939 | return 0; | 916 | return 0; |
940 | } | 917 | } |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 6c9ad92747fd..2011567005f9 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
141 | /* try the driver's ioctl interface */ | 141 | /* try the driver's ioctl interface */ |
142 | if (ops->ioctl) { | 142 | if (ops->ioctl) { |
143 | err = ops->ioctl(class_dev->dev, cmd, arg); | 143 | err = ops->ioctl(class_dev->dev, cmd, arg); |
144 | if (err != -EINVAL) | 144 | if (err != -ENOIOCTLCMD) |
145 | return err; | 145 | return err; |
146 | } | 146 | } |
147 | 147 | ||
148 | /* if the driver does not provide the ioctl interface | 148 | /* if the driver does not provide the ioctl interface |
149 | * or if that particular ioctl was not implemented | 149 | * or if that particular ioctl was not implemented |
150 | * (-EINVAL), we will try to emulate here. | 150 | * (-ENOIOCTLCMD), we will try to emulate here. |
151 | */ | 151 | */ |
152 | 152 | ||
153 | switch (cmd) { | 153 | switch (cmd) { |
@@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
233 | break; | 233 | break; |
234 | 234 | ||
235 | default: | 235 | default: |
236 | err = -EINVAL; | 236 | err = -ENOTTY; |
237 | break; | 237 | break; |
238 | } | 238 | } |
239 | 239 | ||
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c index f6e7ee04f3dc..8c0d1a6739ad 100644 --- a/drivers/rtc/rtc-m48t86.c +++ b/drivers/rtc/rtc-m48t86.c | |||
@@ -48,33 +48,33 @@ static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
48 | struct platform_device *pdev = to_platform_device(dev); | 48 | struct platform_device *pdev = to_platform_device(dev); |
49 | struct m48t86_ops *ops = pdev->dev.platform_data; | 49 | struct m48t86_ops *ops = pdev->dev.platform_data; |
50 | 50 | ||
51 | reg = ops->readb(M48T86_REG_B); | 51 | reg = ops->readbyte(M48T86_REG_B); |
52 | 52 | ||
53 | if (reg & M48T86_REG_B_DM) { | 53 | if (reg & M48T86_REG_B_DM) { |
54 | /* data (binary) mode */ | 54 | /* data (binary) mode */ |
55 | tm->tm_sec = ops->readb(M48T86_REG_SEC); | 55 | tm->tm_sec = ops->readbyte(M48T86_REG_SEC); |
56 | tm->tm_min = ops->readb(M48T86_REG_MIN); | 56 | tm->tm_min = ops->readbyte(M48T86_REG_MIN); |
57 | tm->tm_hour = ops->readb(M48T86_REG_HOUR) & 0x3F; | 57 | tm->tm_hour = ops->readbyte(M48T86_REG_HOUR) & 0x3F; |
58 | tm->tm_mday = ops->readb(M48T86_REG_DOM); | 58 | tm->tm_mday = ops->readbyte(M48T86_REG_DOM); |
59 | /* tm_mon is 0-11 */ | 59 | /* tm_mon is 0-11 */ |
60 | tm->tm_mon = ops->readb(M48T86_REG_MONTH) - 1; | 60 | tm->tm_mon = ops->readbyte(M48T86_REG_MONTH) - 1; |
61 | tm->tm_year = ops->readb(M48T86_REG_YEAR) + 100; | 61 | tm->tm_year = ops->readbyte(M48T86_REG_YEAR) + 100; |
62 | tm->tm_wday = ops->readb(M48T86_REG_DOW); | 62 | tm->tm_wday = ops->readbyte(M48T86_REG_DOW); |
63 | } else { | 63 | } else { |
64 | /* bcd mode */ | 64 | /* bcd mode */ |
65 | tm->tm_sec = BCD2BIN(ops->readb(M48T86_REG_SEC)); | 65 | tm->tm_sec = BCD2BIN(ops->readbyte(M48T86_REG_SEC)); |
66 | tm->tm_min = BCD2BIN(ops->readb(M48T86_REG_MIN)); | 66 | tm->tm_min = BCD2BIN(ops->readbyte(M48T86_REG_MIN)); |
67 | tm->tm_hour = BCD2BIN(ops->readb(M48T86_REG_HOUR) & 0x3F); | 67 | tm->tm_hour = BCD2BIN(ops->readbyte(M48T86_REG_HOUR) & 0x3F); |
68 | tm->tm_mday = BCD2BIN(ops->readb(M48T86_REG_DOM)); | 68 | tm->tm_mday = BCD2BIN(ops->readbyte(M48T86_REG_DOM)); |
69 | /* tm_mon is 0-11 */ | 69 | /* tm_mon is 0-11 */ |
70 | tm->tm_mon = BCD2BIN(ops->readb(M48T86_REG_MONTH)) - 1; | 70 | tm->tm_mon = BCD2BIN(ops->readbyte(M48T86_REG_MONTH)) - 1; |
71 | tm->tm_year = BCD2BIN(ops->readb(M48T86_REG_YEAR)) + 100; | 71 | tm->tm_year = BCD2BIN(ops->readbyte(M48T86_REG_YEAR)) + 100; |
72 | tm->tm_wday = BCD2BIN(ops->readb(M48T86_REG_DOW)); | 72 | tm->tm_wday = BCD2BIN(ops->readbyte(M48T86_REG_DOW)); |
73 | } | 73 | } |
74 | 74 | ||
75 | /* correct the hour if the clock is in 12h mode */ | 75 | /* correct the hour if the clock is in 12h mode */ |
76 | if (!(reg & M48T86_REG_B_H24)) | 76 | if (!(reg & M48T86_REG_B_H24)) |
77 | if (ops->readb(M48T86_REG_HOUR) & 0x80) | 77 | if (ops->readbyte(M48T86_REG_HOUR) & 0x80) |
78 | tm->tm_hour += 12; | 78 | tm->tm_hour += 12; |
79 | 79 | ||
80 | return 0; | 80 | return 0; |
@@ -86,35 +86,35 @@ static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
86 | struct platform_device *pdev = to_platform_device(dev); | 86 | struct platform_device *pdev = to_platform_device(dev); |
87 | struct m48t86_ops *ops = pdev->dev.platform_data; | 87 | struct m48t86_ops *ops = pdev->dev.platform_data; |
88 | 88 | ||
89 | reg = ops->readb(M48T86_REG_B); | 89 | reg = ops->readbyte(M48T86_REG_B); |
90 | 90 | ||
91 | /* update flag and 24h mode */ | 91 | /* update flag and 24h mode */ |
92 | reg |= M48T86_REG_B_SET | M48T86_REG_B_H24; | 92 | reg |= M48T86_REG_B_SET | M48T86_REG_B_H24; |
93 | ops->writeb(reg, M48T86_REG_B); | 93 | ops->writebyte(reg, M48T86_REG_B); |
94 | 94 | ||
95 | if (reg & M48T86_REG_B_DM) { | 95 | if (reg & M48T86_REG_B_DM) { |
96 | /* data (binary) mode */ | 96 | /* data (binary) mode */ |
97 | ops->writeb(tm->tm_sec, M48T86_REG_SEC); | 97 | ops->writebyte(tm->tm_sec, M48T86_REG_SEC); |
98 | ops->writeb(tm->tm_min, M48T86_REG_MIN); | 98 | ops->writebyte(tm->tm_min, M48T86_REG_MIN); |
99 | ops->writeb(tm->tm_hour, M48T86_REG_HOUR); | 99 | ops->writebyte(tm->tm_hour, M48T86_REG_HOUR); |
100 | ops->writeb(tm->tm_mday, M48T86_REG_DOM); | 100 | ops->writebyte(tm->tm_mday, M48T86_REG_DOM); |
101 | ops->writeb(tm->tm_mon + 1, M48T86_REG_MONTH); | 101 | ops->writebyte(tm->tm_mon + 1, M48T86_REG_MONTH); |
102 | ops->writeb(tm->tm_year % 100, M48T86_REG_YEAR); | 102 | ops->writebyte(tm->tm_year % 100, M48T86_REG_YEAR); |
103 | ops->writeb(tm->tm_wday, M48T86_REG_DOW); | 103 | ops->writebyte(tm->tm_wday, M48T86_REG_DOW); |
104 | } else { | 104 | } else { |
105 | /* bcd mode */ | 105 | /* bcd mode */ |
106 | ops->writeb(BIN2BCD(tm->tm_sec), M48T86_REG_SEC); | 106 | ops->writebyte(BIN2BCD(tm->tm_sec), M48T86_REG_SEC); |
107 | ops->writeb(BIN2BCD(tm->tm_min), M48T86_REG_MIN); | 107 | ops->writebyte(BIN2BCD(tm->tm_min), M48T86_REG_MIN); |
108 | ops->writeb(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR); | 108 | ops->writebyte(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR); |
109 | ops->writeb(BIN2BCD(tm->tm_mday), M48T86_REG_DOM); | 109 | ops->writebyte(BIN2BCD(tm->tm_mday), M48T86_REG_DOM); |
110 | ops->writeb(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH); | 110 | ops->writebyte(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH); |
111 | ops->writeb(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR); | 111 | ops->writebyte(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR); |
112 | ops->writeb(BIN2BCD(tm->tm_wday), M48T86_REG_DOW); | 112 | ops->writebyte(BIN2BCD(tm->tm_wday), M48T86_REG_DOW); |
113 | } | 113 | } |
114 | 114 | ||
115 | /* update ended */ | 115 | /* update ended */ |
116 | reg &= ~M48T86_REG_B_SET; | 116 | reg &= ~M48T86_REG_B_SET; |
117 | ops->writeb(reg, M48T86_REG_B); | 117 | ops->writebyte(reg, M48T86_REG_B); |
118 | 118 | ||
119 | return 0; | 119 | return 0; |
120 | } | 120 | } |
@@ -125,12 +125,12 @@ static int m48t86_rtc_proc(struct device *dev, struct seq_file *seq) | |||
125 | struct platform_device *pdev = to_platform_device(dev); | 125 | struct platform_device *pdev = to_platform_device(dev); |
126 | struct m48t86_ops *ops = pdev->dev.platform_data; | 126 | struct m48t86_ops *ops = pdev->dev.platform_data; |
127 | 127 | ||
128 | reg = ops->readb(M48T86_REG_B); | 128 | reg = ops->readbyte(M48T86_REG_B); |
129 | 129 | ||
130 | seq_printf(seq, "mode\t\t: %s\n", | 130 | seq_printf(seq, "mode\t\t: %s\n", |
131 | (reg & M48T86_REG_B_DM) ? "binary" : "bcd"); | 131 | (reg & M48T86_REG_B_DM) ? "binary" : "bcd"); |
132 | 132 | ||
133 | reg = ops->readb(M48T86_REG_D); | 133 | reg = ops->readbyte(M48T86_REG_D); |
134 | 134 | ||
135 | seq_printf(seq, "battery\t\t: %s\n", | 135 | seq_printf(seq, "battery\t\t: %s\n", |
136 | (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); | 136 | (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); |
@@ -157,7 +157,7 @@ static int __devinit m48t86_rtc_probe(struct platform_device *dev) | |||
157 | platform_set_drvdata(dev, rtc); | 157 | platform_set_drvdata(dev, rtc); |
158 | 158 | ||
159 | /* read battery status */ | 159 | /* read battery status */ |
160 | reg = ops->readb(M48T86_REG_D); | 160 | reg = ops->readbyte(M48T86_REG_D); |
161 | dev_info(&dev->dev, "battery %s\n", | 161 | dev_info(&dev->dev, "battery %s\n", |
162 | (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); | 162 | (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); |
163 | 163 | ||
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 2bc8aad47219..a997529f8926 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -247,7 +247,7 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
247 | rtc_freq = arg; | 247 | rtc_freq = arg; |
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | return -EINVAL; | 250 | return -ENOIOCTLCMD; |
251 | } | 251 | } |
252 | 252 | ||
253 | static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) | 253 | static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) |
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index e1f7e8e86daf..e1fa5fe7901f 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
@@ -71,7 +71,7 @@ static int test_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
71 | return 0; | 71 | return 0; |
72 | 72 | ||
73 | default: | 73 | default: |
74 | return -EINVAL; | 74 | return -ENOIOCTLCMD; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index 4d49fd501198..277596c302e3 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
@@ -270,7 +270,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long | |||
270 | epoch = arg; | 270 | epoch = arg; |
271 | break; | 271 | break; |
272 | default: | 272 | default: |
273 | return -EINVAL; | 273 | return -ENOIOCTLCMD; |
274 | } | 274 | } |
275 | 275 | ||
276 | return 0; | 276 | return 0; |
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index 74a257b23383..e210f89a2449 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h | |||
@@ -45,11 +45,11 @@ struct pgid { | |||
45 | union { | 45 | union { |
46 | __u8 fc; /* SPID function code */ | 46 | __u8 fc; /* SPID function code */ |
47 | struct path_state ps; /* SNID path state */ | 47 | struct path_state ps; /* SNID path state */ |
48 | } inf; | 48 | } __attribute__ ((packed)) inf; |
49 | union { | 49 | union { |
50 | __u32 cpu_addr : 16; /* CPU address */ | 50 | __u32 cpu_addr : 16; /* CPU address */ |
51 | struct extended_cssid ext_cssid; | 51 | struct extended_cssid ext_cssid; |
52 | } pgid_high; | 52 | } __attribute__ ((packed)) pgid_high; |
53 | __u32 cpu_id : 24; /* CPU identification */ | 53 | __u32 cpu_id : 24; /* CPU identification */ |
54 | __u32 cpu_model : 16; /* CPU model */ | 54 | __u32 cpu_model : 16; /* CPU model */ |
55 | __u32 tod_high; /* high word TOD clock */ | 55 | __u32 tod_high; /* high word TOD clock */ |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 180b3bf8b90d..49ec562d7f60 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -749,7 +749,7 @@ ccw_device_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
749 | /* Unit check but no sense data. Need basic sense. */ | 749 | /* Unit check but no sense data. Need basic sense. */ |
750 | if (ccw_device_do_sense(cdev, irb) != 0) | 750 | if (ccw_device_do_sense(cdev, irb) != 0) |
751 | goto call_handler_unsol; | 751 | goto call_handler_unsol; |
752 | memcpy(irb, &cdev->private->irb, sizeof(struct irb)); | 752 | memcpy(&cdev->private->irb, irb, sizeof(struct irb)); |
753 | cdev->private->state = DEV_STATE_W4SENSE; | 753 | cdev->private->state = DEV_STATE_W4SENSE; |
754 | cdev->private->intparm = 0; | 754 | cdev->private->intparm = 0; |
755 | return; | 755 | return; |
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c index af9f212314b3..fe986af884f8 100644 --- a/drivers/s390/net/ctcmain.c +++ b/drivers/s390/net/ctcmain.c | |||
@@ -1486,13 +1486,13 @@ ch_action_iofatal(fsm_instance * fi, int event, void *arg) | |||
1486 | } | 1486 | } |
1487 | } | 1487 | } |
1488 | 1488 | ||
1489 | static void | 1489 | static void |
1490 | ch_action_reinit(fsm_instance *fi, int event, void *arg) | 1490 | ch_action_reinit(fsm_instance *fi, int event, void *arg) |
1491 | { | 1491 | { |
1492 | struct channel *ch = (struct channel *)arg; | 1492 | struct channel *ch = (struct channel *)arg; |
1493 | struct net_device *dev = ch->netdev; | 1493 | struct net_device *dev = ch->netdev; |
1494 | struct ctc_priv *privptr = dev->priv; | 1494 | struct ctc_priv *privptr = dev->priv; |
1495 | 1495 | ||
1496 | DBF_TEXT(trace, 4, __FUNCTION__); | 1496 | DBF_TEXT(trace, 4, __FUNCTION__); |
1497 | ch_action_iofatal(fi, event, arg); | 1497 | ch_action_iofatal(fi, event, arg); |
1498 | fsm_addtimer(&privptr->restart_timer, 1000, DEV_EVENT_RESTART, dev); | 1498 | fsm_addtimer(&privptr->restart_timer, 1000, DEV_EVENT_RESTART, dev); |
@@ -1624,7 +1624,7 @@ less_than(char *id1, char *id2) | |||
1624 | } | 1624 | } |
1625 | dev1 = simple_strtoul(id1, &id1, 16); | 1625 | dev1 = simple_strtoul(id1, &id1, 16); |
1626 | dev2 = simple_strtoul(id2, &id2, 16); | 1626 | dev2 = simple_strtoul(id2, &id2, 16); |
1627 | 1627 | ||
1628 | return (dev1 < dev2); | 1628 | return (dev1 < dev2); |
1629 | } | 1629 | } |
1630 | 1630 | ||
@@ -1895,7 +1895,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1895 | irb->scsw.dstat); | 1895 | irb->scsw.dstat); |
1896 | return; | 1896 | return; |
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | priv = ((struct ccwgroup_device *)cdev->dev.driver_data) | 1899 | priv = ((struct ccwgroup_device *)cdev->dev.driver_data) |
1900 | ->dev.driver_data; | 1900 | ->dev.driver_data; |
1901 | 1901 | ||
@@ -1909,7 +1909,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1909 | "device %s\n", cdev->dev.bus_id); | 1909 | "device %s\n", cdev->dev.bus_id); |
1910 | return; | 1910 | return; |
1911 | } | 1911 | } |
1912 | 1912 | ||
1913 | dev = (struct net_device *) (ch->netdev); | 1913 | dev = (struct net_device *) (ch->netdev); |
1914 | if (dev == NULL) { | 1914 | if (dev == NULL) { |
1915 | ctc_pr_crit("ctc: ctc_irq_handler dev=NULL bus_id=%s, ch=0x%p\n", | 1915 | ctc_pr_crit("ctc: ctc_irq_handler dev=NULL bus_id=%s, ch=0x%p\n", |
@@ -2008,12 +2008,12 @@ dev_action_stop(fsm_instance * fi, int event, void *arg) | |||
2008 | fsm_event(ch->fsm, CH_EVENT_STOP, ch); | 2008 | fsm_event(ch->fsm, CH_EVENT_STOP, ch); |
2009 | } | 2009 | } |
2010 | } | 2010 | } |
2011 | static void | 2011 | static void |
2012 | dev_action_restart(fsm_instance *fi, int event, void *arg) | 2012 | dev_action_restart(fsm_instance *fi, int event, void *arg) |
2013 | { | 2013 | { |
2014 | struct net_device *dev = (struct net_device *)arg; | 2014 | struct net_device *dev = (struct net_device *)arg; |
2015 | struct ctc_priv *privptr = dev->priv; | 2015 | struct ctc_priv *privptr = dev->priv; |
2016 | 2016 | ||
2017 | DBF_TEXT(trace, 3, __FUNCTION__); | 2017 | DBF_TEXT(trace, 3, __FUNCTION__); |
2018 | ctc_pr_debug("%s: Restarting\n", dev->name); | 2018 | ctc_pr_debug("%s: Restarting\n", dev->name); |
2019 | dev_action_stop(fi, event, arg); | 2019 | dev_action_stop(fi, event, arg); |
@@ -2193,7 +2193,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
2193 | 2193 | ||
2194 | DBF_TEXT(trace, 5, __FUNCTION__); | 2194 | DBF_TEXT(trace, 5, __FUNCTION__); |
2195 | /* we need to acquire the lock for testing the state | 2195 | /* we need to acquire the lock for testing the state |
2196 | * otherwise we can have an IRQ changing the state to | 2196 | * otherwise we can have an IRQ changing the state to |
2197 | * TXIDLE after the test but before acquiring the lock. | 2197 | * TXIDLE after the test but before acquiring the lock. |
2198 | */ | 2198 | */ |
2199 | spin_lock_irqsave(&ch->collect_lock, saveflags); | 2199 | spin_lock_irqsave(&ch->collect_lock, saveflags); |
@@ -2393,7 +2393,7 @@ ctc_tx(struct sk_buff *skb, struct net_device * dev) | |||
2393 | 2393 | ||
2394 | /** | 2394 | /** |
2395 | * If channels are not running, try to restart them | 2395 | * If channels are not running, try to restart them |
2396 | * and throw away packet. | 2396 | * and throw away packet. |
2397 | */ | 2397 | */ |
2398 | if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { | 2398 | if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { |
2399 | fsm_event(privptr->fsm, DEV_EVENT_START, dev); | 2399 | fsm_event(privptr->fsm, DEV_EVENT_START, dev); |
@@ -2738,7 +2738,7 @@ ctc_remove_files(struct device *dev) | |||
2738 | /** | 2738 | /** |
2739 | * Add ctc specific attributes. | 2739 | * Add ctc specific attributes. |
2740 | * Add ctc private data. | 2740 | * Add ctc private data. |
2741 | * | 2741 | * |
2742 | * @param cgdev pointer to ccwgroup_device just added | 2742 | * @param cgdev pointer to ccwgroup_device just added |
2743 | * | 2743 | * |
2744 | * @returns 0 on success, !0 on failure. | 2744 | * @returns 0 on success, !0 on failure. |
@@ -2869,7 +2869,7 @@ ctc_new_device(struct ccwgroup_device *cgdev) | |||
2869 | DBF_TEXT(setup, 3, buffer); | 2869 | DBF_TEXT(setup, 3, buffer); |
2870 | 2870 | ||
2871 | type = get_channel_type(&cgdev->cdev[0]->id); | 2871 | type = get_channel_type(&cgdev->cdev[0]->id); |
2872 | 2872 | ||
2873 | snprintf(read_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id); | 2873 | snprintf(read_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id); |
2874 | snprintf(write_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id); | 2874 | snprintf(write_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id); |
2875 | 2875 | ||
@@ -2907,7 +2907,7 @@ ctc_new_device(struct ccwgroup_device *cgdev) | |||
2907 | channel_get(type, direction == READ ? read_id : write_id, | 2907 | channel_get(type, direction == READ ? read_id : write_id, |
2908 | direction); | 2908 | direction); |
2909 | if (privptr->channel[direction] == NULL) { | 2909 | if (privptr->channel[direction] == NULL) { |
2910 | if (direction == WRITE) | 2910 | if (direction == WRITE) |
2911 | channel_free(privptr->channel[READ]); | 2911 | channel_free(privptr->channel[READ]); |
2912 | 2912 | ||
2913 | ctc_free_netdevice(dev, 1); | 2913 | ctc_free_netdevice(dev, 1); |
@@ -2955,7 +2955,7 @@ ctc_shutdown_device(struct ccwgroup_device *cgdev) | |||
2955 | { | 2955 | { |
2956 | struct ctc_priv *priv; | 2956 | struct ctc_priv *priv; |
2957 | struct net_device *ndev; | 2957 | struct net_device *ndev; |
2958 | 2958 | ||
2959 | DBF_TEXT(setup, 3, __FUNCTION__); | 2959 | DBF_TEXT(setup, 3, __FUNCTION__); |
2960 | pr_debug("%s() called\n", __FUNCTION__); | 2960 | pr_debug("%s() called\n", __FUNCTION__); |
2961 | 2961 | ||
diff --git a/drivers/s390/net/ctctty.c b/drivers/s390/net/ctctty.c index 5cdcdbf92962..af54d1de07bf 100644 --- a/drivers/s390/net/ctctty.c +++ b/drivers/s390/net/ctctty.c | |||
@@ -130,7 +130,7 @@ ctc_tty_readmodem(ctc_tty_info *info) | |||
130 | if ((tty = info->tty)) { | 130 | if ((tty = info->tty)) { |
131 | if (info->mcr & UART_MCR_RTS) { | 131 | if (info->mcr & UART_MCR_RTS) { |
132 | struct sk_buff *skb; | 132 | struct sk_buff *skb; |
133 | 133 | ||
134 | if ((skb = skb_dequeue(&info->rx_queue))) { | 134 | if ((skb = skb_dequeue(&info->rx_queue))) { |
135 | int len = skb->len; | 135 | int len = skb->len; |
136 | tty_insert_flip_string(tty, skb->data, len); | 136 | tty_insert_flip_string(tty, skb->data, len); |
@@ -328,7 +328,7 @@ ctc_tty_inject(ctc_tty_info *info, char c) | |||
328 | { | 328 | { |
329 | int skb_res; | 329 | int skb_res; |
330 | struct sk_buff *skb; | 330 | struct sk_buff *skb; |
331 | 331 | ||
332 | DBF_TEXT(trace, 4, __FUNCTION__); | 332 | DBF_TEXT(trace, 4, __FUNCTION__); |
333 | if (ctc_tty_shuttingdown) | 333 | if (ctc_tty_shuttingdown) |
334 | return; | 334 | return; |
@@ -497,7 +497,7 @@ ctc_tty_write(struct tty_struct *tty, const u_char * buf, int count) | |||
497 | c = (count < CTC_TTY_XMIT_SIZE) ? count : CTC_TTY_XMIT_SIZE; | 497 | c = (count < CTC_TTY_XMIT_SIZE) ? count : CTC_TTY_XMIT_SIZE; |
498 | if (c <= 0) | 498 | if (c <= 0) |
499 | break; | 499 | break; |
500 | 500 | ||
501 | skb_res = info->netdev->hard_header_len + sizeof(info->mcr) + | 501 | skb_res = info->netdev->hard_header_len + sizeof(info->mcr) + |
502 | + sizeof(__u32); | 502 | + sizeof(__u32); |
503 | skb = dev_alloc_skb(skb_res + c); | 503 | skb = dev_alloc_skb(skb_res + c); |
@@ -828,7 +828,7 @@ ctc_tty_block_til_ready(struct tty_struct *tty, struct file *filp, ctc_tty_info | |||
828 | if (tty_hung_up_p(filp) || | 828 | if (tty_hung_up_p(filp) || |
829 | (info->flags & CTC_ASYNC_CLOSING)) { | 829 | (info->flags & CTC_ASYNC_CLOSING)) { |
830 | if (info->flags & CTC_ASYNC_CLOSING) | 830 | if (info->flags & CTC_ASYNC_CLOSING) |
831 | wait_event(info->close_wait, | 831 | wait_event(info->close_wait, |
832 | !(info->flags & CTC_ASYNC_CLOSING)); | 832 | !(info->flags & CTC_ASYNC_CLOSING)); |
833 | #ifdef MODEM_DO_RESTART | 833 | #ifdef MODEM_DO_RESTART |
834 | if (info->flags & CTC_ASYNC_HUP_NOTIFY) | 834 | if (info->flags & CTC_ASYNC_HUP_NOTIFY) |
@@ -1247,7 +1247,7 @@ ctc_tty_unregister_netdev(struct net_device *dev) { | |||
1247 | void | 1247 | void |
1248 | ctc_tty_cleanup(void) { | 1248 | ctc_tty_cleanup(void) { |
1249 | unsigned long saveflags; | 1249 | unsigned long saveflags; |
1250 | 1250 | ||
1251 | DBF_TEXT(trace, 2, __FUNCTION__); | 1251 | DBF_TEXT(trace, 2, __FUNCTION__); |
1252 | spin_lock_irqsave(&ctc_tty_lock, saveflags); | 1252 | spin_lock_irqsave(&ctc_tty_lock, saveflags); |
1253 | ctc_tty_shuttingdown = 1; | 1253 | ctc_tty_shuttingdown = 1; |
diff --git a/drivers/s390/net/cu3088.c b/drivers/s390/net/cu3088.c index b12533104c1f..e965f03a7291 100644 --- a/drivers/s390/net/cu3088.c +++ b/drivers/s390/net/cu3088.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
@@ -77,7 +77,7 @@ group_write(struct device_driver *drv, const char *buf, size_t count) | |||
77 | int len; | 77 | int len; |
78 | 78 | ||
79 | if (!(end = strchr(start, delim[i]))) | 79 | if (!(end = strchr(start, delim[i]))) |
80 | return count; | 80 | return -EINVAL; |
81 | len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start + 1); | 81 | len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start + 1); |
82 | strlcpy (bus_ids[i], start, len); | 82 | strlcpy (bus_ids[i], start, len); |
83 | argv[i] = bus_ids[i]; | 83 | argv[i] = bus_ids[i]; |
@@ -94,7 +94,7 @@ static DRIVER_ATTR(group, 0200, NULL, group_write); | |||
94 | 94 | ||
95 | /* Register-unregister for ctc&lcs */ | 95 | /* Register-unregister for ctc&lcs */ |
96 | int | 96 | int |
97 | register_cu3088_discipline(struct ccwgroup_driver *dcp) | 97 | register_cu3088_discipline(struct ccwgroup_driver *dcp) |
98 | { | 98 | { |
99 | int rc; | 99 | int rc; |
100 | 100 | ||
@@ -109,7 +109,7 @@ register_cu3088_discipline(struct ccwgroup_driver *dcp) | |||
109 | rc = driver_create_file(&dcp->driver, &driver_attr_group); | 109 | rc = driver_create_file(&dcp->driver, &driver_attr_group); |
110 | if (rc) | 110 | if (rc) |
111 | ccwgroup_driver_unregister(dcp); | 111 | ccwgroup_driver_unregister(dcp); |
112 | 112 | ||
113 | return rc; | 113 | return rc; |
114 | 114 | ||
115 | } | 115 | } |
@@ -137,7 +137,7 @@ static int __init | |||
137 | cu3088_init (void) | 137 | cu3088_init (void) |
138 | { | 138 | { |
139 | int rc; | 139 | int rc; |
140 | 140 | ||
141 | cu3088_root_dev = s390_root_dev_register("cu3088"); | 141 | cu3088_root_dev = s390_root_dev_register("cu3088"); |
142 | if (IS_ERR(cu3088_root_dev)) | 142 | if (IS_ERR(cu3088_root_dev)) |
143 | return PTR_ERR(cu3088_root_dev); | 143 | return PTR_ERR(cu3088_root_dev); |
diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index 6190be9dca99..e0c7deb98831 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * IUCV network driver | 2 | * IUCV network driver |
3 | * | 3 | * |
4 | * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation | 4 | * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation |
@@ -28,7 +28,7 @@ | |||
28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* #define DEBUG */ | 32 | /* #define DEBUG */ |
33 | 33 | ||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
@@ -81,7 +81,7 @@ iucv_bus_match (struct device *dev, struct device_driver *drv) | |||
81 | struct bus_type iucv_bus = { | 81 | struct bus_type iucv_bus = { |
82 | .name = "iucv", | 82 | .name = "iucv", |
83 | .match = iucv_bus_match, | 83 | .match = iucv_bus_match, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | struct device *iucv_root; | 86 | struct device *iucv_root; |
87 | 87 | ||
@@ -297,7 +297,7 @@ MODULE_LICENSE("GPL"); | |||
297 | /* | 297 | /* |
298 | * Debugging stuff | 298 | * Debugging stuff |
299 | *******************************************************************************/ | 299 | *******************************************************************************/ |
300 | 300 | ||
301 | 301 | ||
302 | #ifdef DEBUG | 302 | #ifdef DEBUG |
303 | static int debuglevel = 0; | 303 | static int debuglevel = 0; |
@@ -344,7 +344,7 @@ do { \ | |||
344 | /* | 344 | /* |
345 | * Internal functions | 345 | * Internal functions |
346 | *******************************************************************************/ | 346 | *******************************************************************************/ |
347 | 347 | ||
348 | /** | 348 | /** |
349 | * print start banner | 349 | * print start banner |
350 | */ | 350 | */ |
@@ -810,7 +810,7 @@ iucv_register_program (__u8 pgmname[16], | |||
810 | sizeof (new_handler->id.userid)); | 810 | sizeof (new_handler->id.userid)); |
811 | EBC_TOUPPER (new_handler->id.userid, | 811 | EBC_TOUPPER (new_handler->id.userid, |
812 | sizeof (new_handler->id.userid)); | 812 | sizeof (new_handler->id.userid)); |
813 | 813 | ||
814 | if (pgmmask) { | 814 | if (pgmmask) { |
815 | memcpy (new_handler->id.mask, pgmmask, | 815 | memcpy (new_handler->id.mask, pgmmask, |
816 | sizeof (new_handler->id.mask)); | 816 | sizeof (new_handler->id.mask)); |
@@ -1229,7 +1229,7 @@ iucv_purge (__u16 pathid, __u32 msgid, __u32 srccls, __u32 *audit) | |||
1229 | /* parm->ipaudit has only 3 bytes */ | 1229 | /* parm->ipaudit has only 3 bytes */ |
1230 | *audit >>= 8; | 1230 | *audit >>= 8; |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | release_param(parm); | 1233 | release_param(parm); |
1234 | 1234 | ||
1235 | iucv_debug(1, "b2f0_result = %ld", b2f0_result); | 1235 | iucv_debug(1, "b2f0_result = %ld", b2f0_result); |
@@ -2330,14 +2330,14 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2330 | temp_buff1[j] &= (h->id.mask)[j]; | 2330 | temp_buff1[j] &= (h->id.mask)[j]; |
2331 | temp_buff2[j] &= (h->id.mask)[j]; | 2331 | temp_buff2[j] &= (h->id.mask)[j]; |
2332 | } | 2332 | } |
2333 | 2333 | ||
2334 | iucv_dumpit("temp_buff1:", | 2334 | iucv_dumpit("temp_buff1:", |
2335 | temp_buff1, sizeof(temp_buff1)); | 2335 | temp_buff1, sizeof(temp_buff1)); |
2336 | iucv_dumpit("temp_buff2", | 2336 | iucv_dumpit("temp_buff2", |
2337 | temp_buff2, sizeof(temp_buff2)); | 2337 | temp_buff2, sizeof(temp_buff2)); |
2338 | 2338 | ||
2339 | if (!memcmp (temp_buff1, temp_buff2, 24)) { | 2339 | if (!memcmp (temp_buff1, temp_buff2, 24)) { |
2340 | 2340 | ||
2341 | iucv_debug(2, | 2341 | iucv_debug(2, |
2342 | "found a matching handler"); | 2342 | "found a matching handler"); |
2343 | break; | 2343 | break; |
@@ -2368,7 +2368,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2368 | } else | 2368 | } else |
2369 | iucv_sever(int_buf->ippathid, no_listener); | 2369 | iucv_sever(int_buf->ippathid, no_listener); |
2370 | break; | 2370 | break; |
2371 | 2371 | ||
2372 | case 0x02: /*connection complete */ | 2372 | case 0x02: /*connection complete */ |
2373 | if (messagesDisabled) { | 2373 | if (messagesDisabled) { |
2374 | iucv_setmask(~0); | 2374 | iucv_setmask(~0); |
@@ -2387,7 +2387,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2387 | } else | 2387 | } else |
2388 | iucv_sever(int_buf->ippathid, no_listener); | 2388 | iucv_sever(int_buf->ippathid, no_listener); |
2389 | break; | 2389 | break; |
2390 | 2390 | ||
2391 | case 0x03: /* connection severed */ | 2391 | case 0x03: /* connection severed */ |
2392 | if (messagesDisabled) { | 2392 | if (messagesDisabled) { |
2393 | iucv_setmask(~0); | 2393 | iucv_setmask(~0); |
@@ -2398,13 +2398,13 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2398 | interrupt->ConnectionSevered( | 2398 | interrupt->ConnectionSevered( |
2399 | (iucv_ConnectionSevered *)int_buf, | 2399 | (iucv_ConnectionSevered *)int_buf, |
2400 | h->pgm_data); | 2400 | h->pgm_data); |
2401 | 2401 | ||
2402 | else | 2402 | else |
2403 | iucv_sever (int_buf->ippathid, no_listener); | 2403 | iucv_sever (int_buf->ippathid, no_listener); |
2404 | } else | 2404 | } else |
2405 | iucv_sever(int_buf->ippathid, no_listener); | 2405 | iucv_sever(int_buf->ippathid, no_listener); |
2406 | break; | 2406 | break; |
2407 | 2407 | ||
2408 | case 0x04: /* connection quiesced */ | 2408 | case 0x04: /* connection quiesced */ |
2409 | if (messagesDisabled) { | 2409 | if (messagesDisabled) { |
2410 | iucv_setmask(~0); | 2410 | iucv_setmask(~0); |
@@ -2420,7 +2420,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2420 | "ConnectionQuiesced not called"); | 2420 | "ConnectionQuiesced not called"); |
2421 | } | 2421 | } |
2422 | break; | 2422 | break; |
2423 | 2423 | ||
2424 | case 0x05: /* connection resumed */ | 2424 | case 0x05: /* connection resumed */ |
2425 | if (messagesDisabled) { | 2425 | if (messagesDisabled) { |
2426 | iucv_setmask(~0); | 2426 | iucv_setmask(~0); |
@@ -2436,7 +2436,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2436 | "ConnectionResumed not called"); | 2436 | "ConnectionResumed not called"); |
2437 | } | 2437 | } |
2438 | break; | 2438 | break; |
2439 | 2439 | ||
2440 | case 0x06: /* priority message complete */ | 2440 | case 0x06: /* priority message complete */ |
2441 | case 0x07: /* nonpriority message complete */ | 2441 | case 0x07: /* nonpriority message complete */ |
2442 | if (h) { | 2442 | if (h) { |
@@ -2449,7 +2449,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2449 | "MessageComplete not called"); | 2449 | "MessageComplete not called"); |
2450 | } | 2450 | } |
2451 | break; | 2451 | break; |
2452 | 2452 | ||
2453 | case 0x08: /* priority message pending */ | 2453 | case 0x08: /* priority message pending */ |
2454 | case 0x09: /* nonpriority message pending */ | 2454 | case 0x09: /* nonpriority message pending */ |
2455 | if (h) { | 2455 | if (h) { |
@@ -2467,7 +2467,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2467 | __FUNCTION__); | 2467 | __FUNCTION__); |
2468 | break; | 2468 | break; |
2469 | } /* end switch */ | 2469 | } /* end switch */ |
2470 | 2470 | ||
2471 | iucv_debug(2, "exiting pathid %d, type %02X", | 2471 | iucv_debug(2, "exiting pathid %d, type %02X", |
2472 | int_buf->ippathid, int_buf->iptype); | 2472 | int_buf->ippathid, int_buf->iptype); |
2473 | 2473 | ||
diff --git a/drivers/s390/net/iucv.h b/drivers/s390/net/iucv.h index 0c4644d3d2f3..5b6b1b7241c9 100644 --- a/drivers/s390/net/iucv.h +++ b/drivers/s390/net/iucv.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * S390 version | 5 | * S390 version |
6 | * Copyright (C) 2000 IBM Corporation | 6 | * Copyright (C) 2000 IBM Corporation |
7 | * Author(s):Alan Altmark (Alan_Altmark@us.ibm.com) | 7 | * Author(s):Alan Altmark (Alan_Altmark@us.ibm.com) |
8 | * Xenia Tkatschow (xenia@us.ibm.com) | 8 | * Xenia Tkatschow (xenia@us.ibm.com) |
9 | * | 9 | * |
10 | * | 10 | * |
@@ -16,17 +16,17 @@ | |||
16 | * CP Programming Services book, also available on the web | 16 | * CP Programming Services book, also available on the web |
17 | * thru www.ibm.com/s390/vm/pubs, manual # SC24-5760 | 17 | * thru www.ibm.com/s390/vm/pubs, manual # SC24-5760 |
18 | * | 18 | * |
19 | * Definition of Return Codes | 19 | * Definition of Return Codes |
20 | * -All positive return codes including zero are reflected back | 20 | * -All positive return codes including zero are reflected back |
21 | * from CP except for iucv_register_program. The definition of each | 21 | * from CP except for iucv_register_program. The definition of each |
22 | * return code can be found in CP Programming Services book. | 22 | * return code can be found in CP Programming Services book. |
23 | * Also available on the web thru www.ibm.com/s390/vm/pubs, manual # SC24-5760 | 23 | * Also available on the web thru www.ibm.com/s390/vm/pubs, manual # SC24-5760 |
24 | * - Return Code of: | 24 | * - Return Code of: |
25 | * (-EINVAL) Invalid value | 25 | * (-EINVAL) Invalid value |
26 | * (-ENOMEM) storage allocation failed | 26 | * (-ENOMEM) storage allocation failed |
27 | * pgmask defined in iucv_register_program will be set depending on input | 27 | * pgmask defined in iucv_register_program will be set depending on input |
28 | * paramters. | 28 | * paramters. |
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
@@ -124,13 +124,13 @@ iucv_hex_dump(unsigned char *buf, size_t len) | |||
124 | #define iucv_handle_t void * | 124 | #define iucv_handle_t void * |
125 | 125 | ||
126 | /* flags1: | 126 | /* flags1: |
127 | * All flags are defined in the field IPFLAGS1 of each function | 127 | * All flags are defined in the field IPFLAGS1 of each function |
128 | * and can be found in CP Programming Services. | 128 | * and can be found in CP Programming Services. |
129 | * IPLOCAL - Indicates the connect can only be satisfied on the | 129 | * IPLOCAL - Indicates the connect can only be satisfied on the |
130 | * local system | 130 | * local system |
131 | * IPPRTY - Indicates a priority message | 131 | * IPPRTY - Indicates a priority message |
132 | * IPQUSCE - Indicates you do not want to receive messages on a | 132 | * IPQUSCE - Indicates you do not want to receive messages on a |
133 | * path until an iucv_resume is issued | 133 | * path until an iucv_resume is issued |
134 | * IPRMDATA - Indicates that the message is in the parameter list | 134 | * IPRMDATA - Indicates that the message is in the parameter list |
135 | */ | 135 | */ |
136 | #define IPLOCAL 0x01 | 136 | #define IPLOCAL 0x01 |
@@ -154,14 +154,14 @@ iucv_hex_dump(unsigned char *buf, size_t len) | |||
154 | #define AllInterrupts 0xf8 | 154 | #define AllInterrupts 0xf8 |
155 | /* | 155 | /* |
156 | * Mapping of external interrupt buffers should be used with the corresponding | 156 | * Mapping of external interrupt buffers should be used with the corresponding |
157 | * interrupt types. | 157 | * interrupt types. |
158 | * Names: iucv_ConnectionPending -> connection pending | 158 | * Names: iucv_ConnectionPending -> connection pending |
159 | * iucv_ConnectionComplete -> connection complete | 159 | * iucv_ConnectionComplete -> connection complete |
160 | * iucv_ConnectionSevered -> connection severed | 160 | * iucv_ConnectionSevered -> connection severed |
161 | * iucv_ConnectionQuiesced -> connection quiesced | 161 | * iucv_ConnectionQuiesced -> connection quiesced |
162 | * iucv_ConnectionResumed -> connection resumed | 162 | * iucv_ConnectionResumed -> connection resumed |
163 | * iucv_MessagePending -> message pending | 163 | * iucv_MessagePending -> message pending |
164 | * iucv_MessageComplete -> message complete | 164 | * iucv_MessageComplete -> message complete |
165 | */ | 165 | */ |
166 | typedef struct { | 166 | typedef struct { |
167 | u16 ippathid; | 167 | u16 ippathid; |
@@ -260,16 +260,16 @@ typedef struct { | |||
260 | uchar res2[3]; | 260 | uchar res2[3]; |
261 | } iucv_MessageComplete; | 261 | } iucv_MessageComplete; |
262 | 262 | ||
263 | /* | 263 | /* |
264 | * iucv_interrupt_ops_t: Is a vector of functions that handle | 264 | * iucv_interrupt_ops_t: Is a vector of functions that handle |
265 | * IUCV interrupts. | 265 | * IUCV interrupts. |
266 | * Parameter list: | 266 | * Parameter list: |
267 | * eib - is a pointer to a 40-byte area described | 267 | * eib - is a pointer to a 40-byte area described |
268 | * with one of the structures above. | 268 | * with one of the structures above. |
269 | * pgm_data - this data is strictly for the | 269 | * pgm_data - this data is strictly for the |
270 | * interrupt handler that is passed by | 270 | * interrupt handler that is passed by |
271 | * the application. This may be an address | 271 | * the application. This may be an address |
272 | * or token. | 272 | * or token. |
273 | */ | 273 | */ |
274 | typedef struct { | 274 | typedef struct { |
275 | void (*ConnectionPending) (iucv_ConnectionPending * eib, | 275 | void (*ConnectionPending) (iucv_ConnectionPending * eib, |
@@ -287,8 +287,8 @@ typedef struct { | |||
287 | } iucv_interrupt_ops_t; | 287 | } iucv_interrupt_ops_t; |
288 | 288 | ||
289 | /* | 289 | /* |
290 | *iucv_array_t : Defines buffer array. | 290 | *iucv_array_t : Defines buffer array. |
291 | * Inside the array may be 31- bit addresses and 31-bit lengths. | 291 | * Inside the array may be 31- bit addresses and 31-bit lengths. |
292 | */ | 292 | */ |
293 | typedef struct { | 293 | typedef struct { |
294 | u32 address; | 294 | u32 address; |
@@ -299,19 +299,19 @@ extern struct bus_type iucv_bus; | |||
299 | extern struct device *iucv_root; | 299 | extern struct device *iucv_root; |
300 | 300 | ||
301 | /* -prototypes- */ | 301 | /* -prototypes- */ |
302 | /* | 302 | /* |
303 | * Name: iucv_register_program | 303 | * Name: iucv_register_program |
304 | * Purpose: Registers an application with IUCV | 304 | * Purpose: Registers an application with IUCV |
305 | * Input: prmname - user identification | 305 | * Input: prmname - user identification |
306 | * userid - machine identification | 306 | * userid - machine identification |
307 | * pgmmask - indicates which bits in the prmname and userid combined will be | 307 | * pgmmask - indicates which bits in the prmname and userid combined will be |
308 | * used to determine who is given control | 308 | * used to determine who is given control |
309 | * ops - address of vector of interrupt handlers | 309 | * ops - address of vector of interrupt handlers |
310 | * pgm_data- application data passed to interrupt handlers | 310 | * pgm_data- application data passed to interrupt handlers |
311 | * Output: NA | 311 | * Output: NA |
312 | * Return: address of handler | 312 | * Return: address of handler |
313 | * (0) - Error occurred, registration not completed. | 313 | * (0) - Error occurred, registration not completed. |
314 | * NOTE: Exact cause of failure will be recorded in syslog. | 314 | * NOTE: Exact cause of failure will be recorded in syslog. |
315 | */ | 315 | */ |
316 | iucv_handle_t iucv_register_program (uchar pgmname[16], | 316 | iucv_handle_t iucv_register_program (uchar pgmname[16], |
317 | uchar userid[8], | 317 | uchar userid[8], |
@@ -319,13 +319,13 @@ iucv_handle_t iucv_register_program (uchar pgmname[16], | |||
319 | iucv_interrupt_ops_t * ops, | 319 | iucv_interrupt_ops_t * ops, |
320 | void *pgm_data); | 320 | void *pgm_data); |
321 | 321 | ||
322 | /* | 322 | /* |
323 | * Name: iucv_unregister_program | 323 | * Name: iucv_unregister_program |
324 | * Purpose: Unregister application with IUCV | 324 | * Purpose: Unregister application with IUCV |
325 | * Input: address of handler | 325 | * Input: address of handler |
326 | * Output: NA | 326 | * Output: NA |
327 | * Return: (0) - Normal return | 327 | * Return: (0) - Normal return |
328 | * (-EINVAL) - Internal error, wild pointer | 328 | * (-EINVAL) - Internal error, wild pointer |
329 | */ | 329 | */ |
330 | int iucv_unregister_program (iucv_handle_t handle); | 330 | int iucv_unregister_program (iucv_handle_t handle); |
331 | 331 | ||
@@ -333,7 +333,7 @@ int iucv_unregister_program (iucv_handle_t handle); | |||
333 | * Name: iucv_accept | 333 | * Name: iucv_accept |
334 | * Purpose: This function is issued after the user receives a Connection Pending external | 334 | * Purpose: This function is issued after the user receives a Connection Pending external |
335 | * interrupt and now wishes to complete the IUCV communication path. | 335 | * interrupt and now wishes to complete the IUCV communication path. |
336 | * Input: pathid - u16 , Path identification number | 336 | * Input: pathid - u16 , Path identification number |
337 | * msglim_reqstd - u16, The number of outstanding messages requested. | 337 | * msglim_reqstd - u16, The number of outstanding messages requested. |
338 | * user_data - uchar[16], Data specified by the iucv_connect function. | 338 | * user_data - uchar[16], Data specified by the iucv_connect function. |
339 | * flags1 - int, Contains options for this path. | 339 | * flags1 - int, Contains options for this path. |
@@ -358,34 +358,34 @@ int iucv_accept (u16 pathid, | |||
358 | void *pgm_data, int *flags1_out, u16 * msglim); | 358 | void *pgm_data, int *flags1_out, u16 * msglim); |
359 | 359 | ||
360 | /* | 360 | /* |
361 | * Name: iucv_connect | 361 | * Name: iucv_connect |
362 | * Purpose: This function establishes an IUCV path. Although the connect may complete | 362 | * Purpose: This function establishes an IUCV path. Although the connect may complete |
363 | * successfully, you are not able to use the path until you receive an IUCV | 363 | * successfully, you are not able to use the path until you receive an IUCV |
364 | * Connection Complete external interrupt. | 364 | * Connection Complete external interrupt. |
365 | * Input: pathid - u16 *, Path identification number | 365 | * Input: pathid - u16 *, Path identification number |
366 | * msglim_reqstd - u16, Number of outstanding messages requested | 366 | * msglim_reqstd - u16, Number of outstanding messages requested |
367 | * user_data - uchar[16], 16-byte user data | 367 | * user_data - uchar[16], 16-byte user data |
368 | * userid - uchar[8], User identification | 368 | * userid - uchar[8], User identification |
369 | * system_name - uchar[8], 8-byte identifying the system name | 369 | * system_name - uchar[8], 8-byte identifying the system name |
370 | * flags1 - int, Contains options for this path. | 370 | * flags1 - int, Contains options for this path. |
371 | * -IPPRTY - 0x20, Specifies if you want to send priority message. | 371 | * -IPPRTY - 0x20, Specifies if you want to send priority message. |
372 | * -IPRMDATA - 0x80, Specifies whether your program can handle a message | 372 | * -IPRMDATA - 0x80, Specifies whether your program can handle a message |
373 | * in the parameter list. | 373 | * in the parameter list. |
374 | * -IPQUSCE - 0x40, Specifies whether you want to quiesce the path being | 374 | * -IPQUSCE - 0x40, Specifies whether you want to quiesce the path being |
375 | * established. | 375 | * established. |
376 | * -IPLOCAL - 0X01, Allows an application to force the partner to be on | 376 | * -IPLOCAL - 0X01, Allows an application to force the partner to be on |
377 | * the local system. If local is specified then target class cannot be | 377 | * the local system. If local is specified then target class cannot be |
378 | * specified. | 378 | * specified. |
379 | * flags1_out - int * Contains information about the path | 379 | * flags1_out - int * Contains information about the path |
380 | * - IPPRTY - 0x20, Indicates you may send priority messages. | 380 | * - IPPRTY - 0x20, Indicates you may send priority messages. |
381 | * msglim - * u16, Number of outstanding messages | 381 | * msglim - * u16, Number of outstanding messages |
382 | * handle - iucv_handle_t, Address of handler | 382 | * handle - iucv_handle_t, Address of handler |
383 | * pgm_data - void *, Application data passed to interrupt handlers | 383 | * pgm_data - void *, Application data passed to interrupt handlers |
384 | * Output: return code from CP IUCV call | 384 | * Output: return code from CP IUCV call |
385 | * rc - return code from iucv_declare_buffer | 385 | * rc - return code from iucv_declare_buffer |
386 | * -EINVAL - Invalid handle passed by application | 386 | * -EINVAL - Invalid handle passed by application |
387 | * -EINVAL - Pathid address is NULL | 387 | * -EINVAL - Pathid address is NULL |
388 | * add_pathid_result - Return code from internal function add_pathid | 388 | * add_pathid_result - Return code from internal function add_pathid |
389 | */ | 389 | */ |
390 | int | 390 | int |
391 | iucv_connect (u16 * pathid, | 391 | iucv_connect (u16 * pathid, |
@@ -397,16 +397,16 @@ int | |||
397 | int *flags1_out, | 397 | int *flags1_out, |
398 | u16 * msglim, iucv_handle_t handle, void *pgm_data); | 398 | u16 * msglim, iucv_handle_t handle, void *pgm_data); |
399 | 399 | ||
400 | /* | 400 | /* |
401 | * Name: iucv_purge | 401 | * Name: iucv_purge |
402 | * Purpose: This function cancels a message that you have sent. | 402 | * Purpose: This function cancels a message that you have sent. |
403 | * Input: pathid - Path identification number. | 403 | * Input: pathid - Path identification number. |
404 | * msgid - Specifies the message ID of the message to be purged. | 404 | * msgid - Specifies the message ID of the message to be purged. |
405 | * srccls - Specifies the source message class. | 405 | * srccls - Specifies the source message class. |
406 | * Output: audit - Contains information about asynchronous error | 406 | * Output: audit - Contains information about asynchronous error |
407 | * that may have affected the normal completion | 407 | * that may have affected the normal completion |
408 | * of this message. | 408 | * of this message. |
409 | * Return: Return code from CP IUCV call. | 409 | * Return: Return code from CP IUCV call. |
410 | */ | 410 | */ |
411 | int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit); | 411 | int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit); |
412 | /* | 412 | /* |
@@ -426,38 +426,38 @@ ulong iucv_query_maxconn (void); | |||
426 | */ | 426 | */ |
427 | ulong iucv_query_bufsize (void); | 427 | ulong iucv_query_bufsize (void); |
428 | 428 | ||
429 | /* | 429 | /* |
430 | * Name: iucv_quiesce | 430 | * Name: iucv_quiesce |
431 | * Purpose: This function temporarily suspends incoming messages on an | 431 | * Purpose: This function temporarily suspends incoming messages on an |
432 | * IUCV path. You can later reactivate the path by invoking | 432 | * IUCV path. You can later reactivate the path by invoking |
433 | * the iucv_resume function. | 433 | * the iucv_resume function. |
434 | * Input: pathid - Path identification number | 434 | * Input: pathid - Path identification number |
435 | * user_data - 16-bytes of user data | 435 | * user_data - 16-bytes of user data |
436 | * Output: NA | 436 | * Output: NA |
437 | * Return: Return code from CP IUCV call. | 437 | * Return: Return code from CP IUCV call. |
438 | */ | 438 | */ |
439 | int iucv_quiesce (u16 pathid, uchar user_data[16]); | 439 | int iucv_quiesce (u16 pathid, uchar user_data[16]); |
440 | 440 | ||
441 | /* | 441 | /* |
442 | * Name: iucv_receive | 442 | * Name: iucv_receive |
443 | * Purpose: This function receives messages that are being sent to you | 443 | * Purpose: This function receives messages that are being sent to you |
444 | * over established paths. Data will be returned in buffer for length of | 444 | * over established paths. Data will be returned in buffer for length of |
445 | * buflen. | 445 | * buflen. |
446 | * Input: | 446 | * Input: |
447 | * pathid - Path identification number. | 447 | * pathid - Path identification number. |
448 | * buffer - Address of buffer to receive. | 448 | * buffer - Address of buffer to receive. |
449 | * buflen - Length of buffer to receive. | 449 | * buflen - Length of buffer to receive. |
450 | * msgid - Specifies the message ID. | 450 | * msgid - Specifies the message ID. |
451 | * trgcls - Specifies target class. | 451 | * trgcls - Specifies target class. |
452 | * Output: | 452 | * Output: |
453 | * flags1_out: int *, Contains information about this path. | 453 | * flags1_out: int *, Contains information about this path. |
454 | * IPNORPY - 0x10 Specifies this is a one-way message and no reply is | 454 | * IPNORPY - 0x10 Specifies this is a one-way message and no reply is |
455 | * expected. | 455 | * expected. |
456 | * IPPRTY - 0x20 Specifies if you want to send priority message. | 456 | * IPPRTY - 0x20 Specifies if you want to send priority message. |
457 | * IPRMDATA - 0x80 specifies the data is contained in the parameter list | 457 | * IPRMDATA - 0x80 specifies the data is contained in the parameter list |
458 | * residual_buffer - address of buffer updated by the number | 458 | * residual_buffer - address of buffer updated by the number |
459 | * of bytes you have received. | 459 | * of bytes you have received. |
460 | * residual_length - | 460 | * residual_length - |
461 | * Contains one of the following values, if the receive buffer is: | 461 | * Contains one of the following values, if the receive buffer is: |
462 | * The same length as the message, this field is zero. | 462 | * The same length as the message, this field is zero. |
463 | * Longer than the message, this field contains the number of | 463 | * Longer than the message, this field contains the number of |
@@ -466,8 +466,8 @@ int iucv_quiesce (u16 pathid, uchar user_data[16]); | |||
466 | * count (that is, the number of bytes remaining in the | 466 | * count (that is, the number of bytes remaining in the |
467 | * message that does not fit into the buffer. In this | 467 | * message that does not fit into the buffer. In this |
468 | * case b2f0_result = 5. | 468 | * case b2f0_result = 5. |
469 | * Return: Return code from CP IUCV call. | 469 | * Return: Return code from CP IUCV call. |
470 | * (-EINVAL) - buffer address is pointing to NULL | 470 | * (-EINVAL) - buffer address is pointing to NULL |
471 | */ | 471 | */ |
472 | int iucv_receive (u16 pathid, | 472 | int iucv_receive (u16 pathid, |
473 | u32 msgid, | 473 | u32 msgid, |
@@ -477,16 +477,16 @@ int iucv_receive (u16 pathid, | |||
477 | int *flags1_out, | 477 | int *flags1_out, |
478 | ulong * residual_buffer, ulong * residual_length); | 478 | ulong * residual_buffer, ulong * residual_length); |
479 | 479 | ||
480 | /* | 480 | /* |
481 | * Name: iucv_receive_array | 481 | * Name: iucv_receive_array |
482 | * Purpose: This function receives messages that are being sent to you | 482 | * Purpose: This function receives messages that are being sent to you |
483 | * over established paths. Data will be returned in first buffer for | 483 | * over established paths. Data will be returned in first buffer for |
484 | * length of first buffer. | 484 | * length of first buffer. |
485 | * Input: pathid - Path identification number. | 485 | * Input: pathid - Path identification number. |
486 | * msgid - specifies the message ID. | 486 | * msgid - specifies the message ID. |
487 | * trgcls - Specifies target class. | 487 | * trgcls - Specifies target class. |
488 | * buffer - Address of array of buffers. | 488 | * buffer - Address of array of buffers. |
489 | * buflen - Total length of buffers. | 489 | * buflen - Total length of buffers. |
490 | * Output: | 490 | * Output: |
491 | * flags1_out: int *, Contains information about this path. | 491 | * flags1_out: int *, Contains information about this path. |
492 | * IPNORPY - 0x10 Specifies this is a one-way message and no reply is | 492 | * IPNORPY - 0x10 Specifies this is a one-way message and no reply is |
@@ -504,8 +504,8 @@ int iucv_receive (u16 pathid, | |||
504 | * count (that is, the number of bytes remaining in the | 504 | * count (that is, the number of bytes remaining in the |
505 | * message that does not fit into the buffer. In this | 505 | * message that does not fit into the buffer. In this |
506 | * case b2f0_result = 5. | 506 | * case b2f0_result = 5. |
507 | * Return: Return code from CP IUCV call. | 507 | * Return: Return code from CP IUCV call. |
508 | * (-EINVAL) - Buffer address is NULL. | 508 | * (-EINVAL) - Buffer address is NULL. |
509 | */ | 509 | */ |
510 | int iucv_receive_array (u16 pathid, | 510 | int iucv_receive_array (u16 pathid, |
511 | u32 msgid, | 511 | u32 msgid, |
@@ -515,44 +515,44 @@ int iucv_receive_array (u16 pathid, | |||
515 | int *flags1_out, | 515 | int *flags1_out, |
516 | ulong * residual_buffer, ulong * residual_length); | 516 | ulong * residual_buffer, ulong * residual_length); |
517 | 517 | ||
518 | /* | 518 | /* |
519 | * Name: iucv_reject | 519 | * Name: iucv_reject |
520 | * Purpose: The reject function refuses a specified message. Between the | 520 | * Purpose: The reject function refuses a specified message. Between the |
521 | * time you are notified of a message and the time that you | 521 | * time you are notified of a message and the time that you |
522 | * complete the message, the message may be rejected. | 522 | * complete the message, the message may be rejected. |
523 | * Input: pathid - Path identification number. | 523 | * Input: pathid - Path identification number. |
524 | * msgid - Specifies the message ID. | 524 | * msgid - Specifies the message ID. |
525 | * trgcls - Specifies target class. | 525 | * trgcls - Specifies target class. |
526 | * Output: NA | 526 | * Output: NA |
527 | * Return: Return code from CP IUCV call. | 527 | * Return: Return code from CP IUCV call. |
528 | */ | 528 | */ |
529 | int iucv_reject (u16 pathid, u32 msgid, u32 trgcls); | 529 | int iucv_reject (u16 pathid, u32 msgid, u32 trgcls); |
530 | 530 | ||
531 | /* | 531 | /* |
532 | * Name: iucv_reply | 532 | * Name: iucv_reply |
533 | * Purpose: This function responds to the two-way messages that you | 533 | * Purpose: This function responds to the two-way messages that you |
534 | * receive. You must identify completely the message to | 534 | * receive. You must identify completely the message to |
535 | * which you wish to reply. ie, pathid, msgid, and trgcls. | 535 | * which you wish to reply. ie, pathid, msgid, and trgcls. |
536 | * Input: pathid - Path identification number. | 536 | * Input: pathid - Path identification number. |
537 | * msgid - Specifies the message ID. | 537 | * msgid - Specifies the message ID. |
538 | * trgcls - Specifies target class. | 538 | * trgcls - Specifies target class. |
539 | * flags1 - Option for path. | 539 | * flags1 - Option for path. |
540 | * IPPRTY- 0x20, Specifies if you want to send priority message. | 540 | * IPPRTY- 0x20, Specifies if you want to send priority message. |
541 | * buffer - Address of reply buffer. | 541 | * buffer - Address of reply buffer. |
542 | * buflen - Length of reply buffer. | 542 | * buflen - Length of reply buffer. |
543 | * Output: residual_buffer - Address of buffer updated by the number | 543 | * Output: residual_buffer - Address of buffer updated by the number |
544 | * of bytes you have moved. | 544 | * of bytes you have moved. |
545 | * residual_length - Contains one of the following values: | 545 | * residual_length - Contains one of the following values: |
546 | * If the answer buffer is the same length as the reply, this field | 546 | * If the answer buffer is the same length as the reply, this field |
547 | * contains zero. | 547 | * contains zero. |
548 | * If the answer buffer is longer than the reply, this field contains | 548 | * If the answer buffer is longer than the reply, this field contains |
549 | * the number of bytes remaining in the buffer. | 549 | * the number of bytes remaining in the buffer. |
550 | * If the answer buffer is shorter than the reply, this field contains | 550 | * If the answer buffer is shorter than the reply, this field contains |
551 | * a residual count (that is, the number of bytes remianing in the | 551 | * a residual count (that is, the number of bytes remianing in the |
552 | * reply that does not fit into the buffer. In this | 552 | * reply that does not fit into the buffer. In this |
553 | * case b2f0_result = 5. | 553 | * case b2f0_result = 5. |
554 | * Return: Return code from CP IUCV call. | 554 | * Return: Return code from CP IUCV call. |
555 | * (-EINVAL) - Buffer address is NULL. | 555 | * (-EINVAL) - Buffer address is NULL. |
556 | */ | 556 | */ |
557 | int iucv_reply (u16 pathid, | 557 | int iucv_reply (u16 pathid, |
558 | u32 msgid, | 558 | u32 msgid, |
@@ -561,20 +561,20 @@ int iucv_reply (u16 pathid, | |||
561 | void *buffer, ulong buflen, ulong * residual_buffer, | 561 | void *buffer, ulong buflen, ulong * residual_buffer, |
562 | ulong * residual_length); | 562 | ulong * residual_length); |
563 | 563 | ||
564 | /* | 564 | /* |
565 | * Name: iucv_reply_array | 565 | * Name: iucv_reply_array |
566 | * Purpose: This function responds to the two-way messages that you | 566 | * Purpose: This function responds to the two-way messages that you |
567 | * receive. You must identify completely the message to | 567 | * receive. You must identify completely the message to |
568 | * which you wish to reply. ie, pathid, msgid, and trgcls. | 568 | * which you wish to reply. ie, pathid, msgid, and trgcls. |
569 | * The array identifies a list of addresses and lengths of | 569 | * The array identifies a list of addresses and lengths of |
570 | * discontiguous buffers that contains the reply data. | 570 | * discontiguous buffers that contains the reply data. |
571 | * Input: pathid - Path identification number | 571 | * Input: pathid - Path identification number |
572 | * msgid - Specifies the message ID. | 572 | * msgid - Specifies the message ID. |
573 | * trgcls - Specifies target class. | 573 | * trgcls - Specifies target class. |
574 | * flags1 - Option for path. | 574 | * flags1 - Option for path. |
575 | * IPPRTY- 0x20, Specifies if you want to send priority message. | 575 | * IPPRTY- 0x20, Specifies if you want to send priority message. |
576 | * buffer - Address of array of reply buffers. | 576 | * buffer - Address of array of reply buffers. |
577 | * buflen - Total length of reply buffers. | 577 | * buflen - Total length of reply buffers. |
578 | * Output: residual_buffer - Address of buffer which IUCV is currently working on. | 578 | * Output: residual_buffer - Address of buffer which IUCV is currently working on. |
579 | * residual_length - Contains one of the following values: | 579 | * residual_length - Contains one of the following values: |
580 | * If the answer buffer is the same length as the reply, this field | 580 | * If the answer buffer is the same length as the reply, this field |
@@ -585,8 +585,8 @@ int iucv_reply (u16 pathid, | |||
585 | * a residual count (that is, the number of bytes remianing in the | 585 | * a residual count (that is, the number of bytes remianing in the |
586 | * reply that does not fit into the buffer. In this | 586 | * reply that does not fit into the buffer. In this |
587 | * case b2f0_result = 5. | 587 | * case b2f0_result = 5. |
588 | * Return: Return code from CP IUCV call. | 588 | * Return: Return code from CP IUCV call. |
589 | * (-EINVAL) - Buffer address is NULL. | 589 | * (-EINVAL) - Buffer address is NULL. |
590 | */ | 590 | */ |
591 | int iucv_reply_array (u16 pathid, | 591 | int iucv_reply_array (u16 pathid, |
592 | u32 msgid, | 592 | u32 msgid, |
@@ -596,77 +596,77 @@ int iucv_reply_array (u16 pathid, | |||
596 | ulong buflen, ulong * residual_address, | 596 | ulong buflen, ulong * residual_address, |
597 | ulong * residual_length); | 597 | ulong * residual_length); |
598 | 598 | ||
599 | /* | 599 | /* |
600 | * Name: iucv_reply_prmmsg | 600 | * Name: iucv_reply_prmmsg |
601 | * Purpose: This function responds to the two-way messages that you | 601 | * Purpose: This function responds to the two-way messages that you |
602 | * receive. You must identify completely the message to | 602 | * receive. You must identify completely the message to |
603 | * which you wish to reply. ie, pathid, msgid, and trgcls. | 603 | * which you wish to reply. ie, pathid, msgid, and trgcls. |
604 | * Prmmsg signifies the data is moved into the | 604 | * Prmmsg signifies the data is moved into the |
605 | * parameter list. | 605 | * parameter list. |
606 | * Input: pathid - Path identification number. | 606 | * Input: pathid - Path identification number. |
607 | * msgid - Specifies the message ID. | 607 | * msgid - Specifies the message ID. |
608 | * trgcls - Specifies target class. | 608 | * trgcls - Specifies target class. |
609 | * flags1 - Option for path. | 609 | * flags1 - Option for path. |
610 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 610 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
611 | * prmmsg - 8-bytes of data to be placed into the parameter. | 611 | * prmmsg - 8-bytes of data to be placed into the parameter. |
612 | * list. | 612 | * list. |
613 | * Output: NA | 613 | * Output: NA |
614 | * Return: Return code from CP IUCV call. | 614 | * Return: Return code from CP IUCV call. |
615 | */ | 615 | */ |
616 | int iucv_reply_prmmsg (u16 pathid, | 616 | int iucv_reply_prmmsg (u16 pathid, |
617 | u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]); | 617 | u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]); |
618 | 618 | ||
619 | /* | 619 | /* |
620 | * Name: iucv_resume | 620 | * Name: iucv_resume |
621 | * Purpose: This function restores communications over a quiesced path | 621 | * Purpose: This function restores communications over a quiesced path |
622 | * Input: pathid - Path identification number. | 622 | * Input: pathid - Path identification number. |
623 | * user_data - 16-bytes of user data. | 623 | * user_data - 16-bytes of user data. |
624 | * Output: NA | 624 | * Output: NA |
625 | * Return: Return code from CP IUCV call. | 625 | * Return: Return code from CP IUCV call. |
626 | */ | 626 | */ |
627 | int iucv_resume (u16 pathid, uchar user_data[16]); | 627 | int iucv_resume (u16 pathid, uchar user_data[16]); |
628 | 628 | ||
629 | /* | 629 | /* |
630 | * Name: iucv_send | 630 | * Name: iucv_send |
631 | * Purpose: This function transmits data to another application. | 631 | * Purpose: This function transmits data to another application. |
632 | * Data to be transmitted is in a buffer and this is a | 632 | * Data to be transmitted is in a buffer and this is a |
633 | * one-way message and the receiver will not reply to the | 633 | * one-way message and the receiver will not reply to the |
634 | * message. | 634 | * message. |
635 | * Input: pathid - Path identification number. | 635 | * Input: pathid - Path identification number. |
636 | * trgcls - Specifies target class. | 636 | * trgcls - Specifies target class. |
637 | * srccls - Specifies the source message class. | 637 | * srccls - Specifies the source message class. |
638 | * msgtag - Specifies a tag to be associated with the message. | 638 | * msgtag - Specifies a tag to be associated with the message. |
639 | * flags1 - Option for path. | 639 | * flags1 - Option for path. |
640 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 640 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
641 | * buffer - Address of send buffer. | 641 | * buffer - Address of send buffer. |
642 | * buflen - Length of send buffer. | 642 | * buflen - Length of send buffer. |
643 | * Output: msgid - Specifies the message ID. | 643 | * Output: msgid - Specifies the message ID. |
644 | * Return: Return code from CP IUCV call. | 644 | * Return: Return code from CP IUCV call. |
645 | * (-EINVAL) - Buffer address is NULL. | 645 | * (-EINVAL) - Buffer address is NULL. |
646 | */ | 646 | */ |
647 | int iucv_send (u16 pathid, | 647 | int iucv_send (u16 pathid, |
648 | u32 * msgid, | 648 | u32 * msgid, |
649 | u32 trgcls, | 649 | u32 trgcls, |
650 | u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen); | 650 | u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen); |
651 | 651 | ||
652 | /* | 652 | /* |
653 | * Name: iucv_send_array | 653 | * Name: iucv_send_array |
654 | * Purpose: This function transmits data to another application. | 654 | * Purpose: This function transmits data to another application. |
655 | * The contents of buffer is the address of the array of | 655 | * The contents of buffer is the address of the array of |
656 | * addresses and lengths of discontiguous buffers that hold | 656 | * addresses and lengths of discontiguous buffers that hold |
657 | * the message text. This is a one-way message and the | 657 | * the message text. This is a one-way message and the |
658 | * receiver will not reply to the message. | 658 | * receiver will not reply to the message. |
659 | * Input: pathid - Path identification number. | 659 | * Input: pathid - Path identification number. |
660 | * trgcls - Specifies target class. | 660 | * trgcls - Specifies target class. |
661 | * srccls - Specifies the source message class. | 661 | * srccls - Specifies the source message class. |
662 | * msgtag - Specifies a tag to be associated witht the message. | 662 | * msgtag - Specifies a tag to be associated witht the message. |
663 | * flags1 - Option for path. | 663 | * flags1 - Option for path. |
664 | * IPPRTY- specifies if you want to send priority message. | 664 | * IPPRTY- specifies if you want to send priority message. |
665 | * buffer - Address of array of send buffers. | 665 | * buffer - Address of array of send buffers. |
666 | * buflen - Total length of send buffers. | 666 | * buflen - Total length of send buffers. |
667 | * Output: msgid - Specifies the message ID. | 667 | * Output: msgid - Specifies the message ID. |
668 | * Return: Return code from CP IUCV call. | 668 | * Return: Return code from CP IUCV call. |
669 | * (-EINVAL) - Buffer address is NULL. | 669 | * (-EINVAL) - Buffer address is NULL. |
670 | */ | 670 | */ |
671 | int iucv_send_array (u16 pathid, | 671 | int iucv_send_array (u16 pathid, |
672 | u32 * msgid, | 672 | u32 * msgid, |
@@ -675,48 +675,48 @@ int iucv_send_array (u16 pathid, | |||
675 | u32 msgtag, | 675 | u32 msgtag, |
676 | int flags1, iucv_array_t * buffer, ulong buflen); | 676 | int flags1, iucv_array_t * buffer, ulong buflen); |
677 | 677 | ||
678 | /* | 678 | /* |
679 | * Name: iucv_send_prmmsg | 679 | * Name: iucv_send_prmmsg |
680 | * Purpose: This function transmits data to another application. | 680 | * Purpose: This function transmits data to another application. |
681 | * Prmmsg specifies that the 8-bytes of data are to be moved | 681 | * Prmmsg specifies that the 8-bytes of data are to be moved |
682 | * into the parameter list. This is a one-way message and the | 682 | * into the parameter list. This is a one-way message and the |
683 | * receiver will not reply to the message. | 683 | * receiver will not reply to the message. |
684 | * Input: pathid - Path identification number. | 684 | * Input: pathid - Path identification number. |
685 | * trgcls - Specifies target class. | 685 | * trgcls - Specifies target class. |
686 | * srccls - Specifies the source message class. | 686 | * srccls - Specifies the source message class. |
687 | * msgtag - Specifies a tag to be associated with the message. | 687 | * msgtag - Specifies a tag to be associated with the message. |
688 | * flags1 - Option for path. | 688 | * flags1 - Option for path. |
689 | * IPPRTY- 0x20 specifies if you want to send priority message. | 689 | * IPPRTY- 0x20 specifies if you want to send priority message. |
690 | * prmmsg - 8-bytes of data to be placed into parameter list. | 690 | * prmmsg - 8-bytes of data to be placed into parameter list. |
691 | * Output: msgid - Specifies the message ID. | 691 | * Output: msgid - Specifies the message ID. |
692 | * Return: Return code from CP IUCV call. | 692 | * Return: Return code from CP IUCV call. |
693 | */ | 693 | */ |
694 | int iucv_send_prmmsg (u16 pathid, | 694 | int iucv_send_prmmsg (u16 pathid, |
695 | u32 * msgid, | 695 | u32 * msgid, |
696 | u32 trgcls, | 696 | u32 trgcls, |
697 | u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]); | 697 | u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]); |
698 | 698 | ||
699 | /* | 699 | /* |
700 | * Name: iucv_send2way | 700 | * Name: iucv_send2way |
701 | * Purpose: This function transmits data to another application. | 701 | * Purpose: This function transmits data to another application. |
702 | * Data to be transmitted is in a buffer. The receiver | 702 | * Data to be transmitted is in a buffer. The receiver |
703 | * of the send is expected to reply to the message and | 703 | * of the send is expected to reply to the message and |
704 | * a buffer is provided into which IUCV moves the reply | 704 | * a buffer is provided into which IUCV moves the reply |
705 | * to this message. | 705 | * to this message. |
706 | * Input: pathid - Path identification number. | 706 | * Input: pathid - Path identification number. |
707 | * trgcls - Specifies target class. | 707 | * trgcls - Specifies target class. |
708 | * srccls - Specifies the source message class. | 708 | * srccls - Specifies the source message class. |
709 | * msgtag - Specifies a tag associated with the message. | 709 | * msgtag - Specifies a tag associated with the message. |
710 | * flags1 - Option for path. | 710 | * flags1 - Option for path. |
711 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 711 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
712 | * buffer - Address of send buffer. | 712 | * buffer - Address of send buffer. |
713 | * buflen - Length of send buffer. | 713 | * buflen - Length of send buffer. |
714 | * ansbuf - Address of buffer into which IUCV moves the reply of | 714 | * ansbuf - Address of buffer into which IUCV moves the reply of |
715 | * this message. | 715 | * this message. |
716 | * anslen - Address of length of buffer. | 716 | * anslen - Address of length of buffer. |
717 | * Output: msgid - Specifies the message ID. | 717 | * Output: msgid - Specifies the message ID. |
718 | * Return: Return code from CP IUCV call. | 718 | * Return: Return code from CP IUCV call. |
719 | * (-EINVAL) - Buffer or ansbuf address is NULL. | 719 | * (-EINVAL) - Buffer or ansbuf address is NULL. |
720 | */ | 720 | */ |
721 | int iucv_send2way (u16 pathid, | 721 | int iucv_send2way (u16 pathid, |
722 | u32 * msgid, | 722 | u32 * msgid, |
@@ -726,28 +726,28 @@ int iucv_send2way (u16 pathid, | |||
726 | int flags1, | 726 | int flags1, |
727 | void *buffer, ulong buflen, void *ansbuf, ulong anslen); | 727 | void *buffer, ulong buflen, void *ansbuf, ulong anslen); |
728 | 728 | ||
729 | /* | 729 | /* |
730 | * Name: iucv_send2way_array | 730 | * Name: iucv_send2way_array |
731 | * Purpose: This function transmits data to another application. | 731 | * Purpose: This function transmits data to another application. |
732 | * The contents of buffer is the address of the array of | 732 | * The contents of buffer is the address of the array of |
733 | * addresses and lengths of discontiguous buffers that hold | 733 | * addresses and lengths of discontiguous buffers that hold |
734 | * the message text. The receiver of the send is expected to | 734 | * the message text. The receiver of the send is expected to |
735 | * reply to the message and a buffer is provided into which | 735 | * reply to the message and a buffer is provided into which |
736 | * IUCV moves the reply to this message. | 736 | * IUCV moves the reply to this message. |
737 | * Input: pathid - Path identification number. | 737 | * Input: pathid - Path identification number. |
738 | * trgcls - Specifies target class. | 738 | * trgcls - Specifies target class. |
739 | * srccls - Specifies the source message class. | 739 | * srccls - Specifies the source message class. |
740 | * msgtag - Specifies a tag to be associated with the message. | 740 | * msgtag - Specifies a tag to be associated with the message. |
741 | * flags1 - Option for path. | 741 | * flags1 - Option for path. |
742 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 742 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
743 | * buffer - Sddress of array of send buffers. | 743 | * buffer - Sddress of array of send buffers. |
744 | * buflen - Total length of send buffers. | 744 | * buflen - Total length of send buffers. |
745 | * ansbuf - Address of array of buffer into which IUCV moves the reply | 745 | * ansbuf - Address of array of buffer into which IUCV moves the reply |
746 | * of this message. | 746 | * of this message. |
747 | * anslen - Address of length reply buffers. | 747 | * anslen - Address of length reply buffers. |
748 | * Output: msgid - Specifies the message ID. | 748 | * Output: msgid - Specifies the message ID. |
749 | * Return: Return code from CP IUCV call. | 749 | * Return: Return code from CP IUCV call. |
750 | * (-EINVAL) - Buffer address is NULL. | 750 | * (-EINVAL) - Buffer address is NULL. |
751 | */ | 751 | */ |
752 | int iucv_send2way_array (u16 pathid, | 752 | int iucv_send2way_array (u16 pathid, |
753 | u32 * msgid, | 753 | u32 * msgid, |
@@ -758,27 +758,27 @@ int iucv_send2way_array (u16 pathid, | |||
758 | iucv_array_t * buffer, | 758 | iucv_array_t * buffer, |
759 | ulong buflen, iucv_array_t * ansbuf, ulong anslen); | 759 | ulong buflen, iucv_array_t * ansbuf, ulong anslen); |
760 | 760 | ||
761 | /* | 761 | /* |
762 | * Name: iucv_send2way_prmmsg | 762 | * Name: iucv_send2way_prmmsg |
763 | * Purpose: This function transmits data to another application. | 763 | * Purpose: This function transmits data to another application. |
764 | * Prmmsg specifies that the 8-bytes of data are to be moved | 764 | * Prmmsg specifies that the 8-bytes of data are to be moved |
765 | * into the parameter list. This is a two-way message and the | 765 | * into the parameter list. This is a two-way message and the |
766 | * receiver of the message is expected to reply. A buffer | 766 | * receiver of the message is expected to reply. A buffer |
767 | * is provided into which IUCV moves the reply to this | 767 | * is provided into which IUCV moves the reply to this |
768 | * message. | 768 | * message. |
769 | * Input: pathid - Rath identification number. | 769 | * Input: pathid - Rath identification number. |
770 | * trgcls - Specifies target class. | 770 | * trgcls - Specifies target class. |
771 | * srccls - Specifies the source message class. | 771 | * srccls - Specifies the source message class. |
772 | * msgtag - Specifies a tag to be associated with the message. | 772 | * msgtag - Specifies a tag to be associated with the message. |
773 | * flags1 - Option for path. | 773 | * flags1 - Option for path. |
774 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 774 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
775 | * prmmsg - 8-bytes of data to be placed in parameter list. | 775 | * prmmsg - 8-bytes of data to be placed in parameter list. |
776 | * ansbuf - Address of buffer into which IUCV moves the reply of | 776 | * ansbuf - Address of buffer into which IUCV moves the reply of |
777 | * this message. | 777 | * this message. |
778 | * anslen - Address of length of buffer. | 778 | * anslen - Address of length of buffer. |
779 | * Output: msgid - Specifies the message ID. | 779 | * Output: msgid - Specifies the message ID. |
780 | * Return: Return code from CP IUCV call. | 780 | * Return: Return code from CP IUCV call. |
781 | * (-EINVAL) - Buffer address is NULL. | 781 | * (-EINVAL) - Buffer address is NULL. |
782 | */ | 782 | */ |
783 | int iucv_send2way_prmmsg (u16 pathid, | 783 | int iucv_send2way_prmmsg (u16 pathid, |
784 | u32 * msgid, | 784 | u32 * msgid, |
@@ -788,29 +788,29 @@ int iucv_send2way_prmmsg (u16 pathid, | |||
788 | ulong flags1, | 788 | ulong flags1, |
789 | uchar prmmsg[8], void *ansbuf, ulong anslen); | 789 | uchar prmmsg[8], void *ansbuf, ulong anslen); |
790 | 790 | ||
791 | /* | 791 | /* |
792 | * Name: iucv_send2way_prmmsg_array | 792 | * Name: iucv_send2way_prmmsg_array |
793 | * Purpose: This function transmits data to another application. | 793 | * Purpose: This function transmits data to another application. |
794 | * Prmmsg specifies that the 8-bytes of data are to be moved | 794 | * Prmmsg specifies that the 8-bytes of data are to be moved |
795 | * into the parameter list. This is a two-way message and the | 795 | * into the parameter list. This is a two-way message and the |
796 | * receiver of the message is expected to reply. A buffer | 796 | * receiver of the message is expected to reply. A buffer |
797 | * is provided into which IUCV moves the reply to this | 797 | * is provided into which IUCV moves the reply to this |
798 | * message. The contents of ansbuf is the address of the | 798 | * message. The contents of ansbuf is the address of the |
799 | * array of addresses and lengths of discontiguous buffers | 799 | * array of addresses and lengths of discontiguous buffers |
800 | * that contain the reply. | 800 | * that contain the reply. |
801 | * Input: pathid - Path identification number. | 801 | * Input: pathid - Path identification number. |
802 | * trgcls - Specifies target class. | 802 | * trgcls - Specifies target class. |
803 | * srccls - Specifies the source message class. | 803 | * srccls - Specifies the source message class. |
804 | * msgtag - Specifies a tag to be associated with the message. | 804 | * msgtag - Specifies a tag to be associated with the message. |
805 | * flags1 - Option for path. | 805 | * flags1 - Option for path. |
806 | * IPPRTY- 0x20 specifies if you want to send priority message. | 806 | * IPPRTY- 0x20 specifies if you want to send priority message. |
807 | * prmmsg - 8-bytes of data to be placed into the parameter list. | 807 | * prmmsg - 8-bytes of data to be placed into the parameter list. |
808 | * ansbuf - Address of array of buffer into which IUCV moves the reply | 808 | * ansbuf - Address of array of buffer into which IUCV moves the reply |
809 | * of this message. | 809 | * of this message. |
810 | * anslen - Address of length of reply buffers. | 810 | * anslen - Address of length of reply buffers. |
811 | * Output: msgid - Specifies the message ID. | 811 | * Output: msgid - Specifies the message ID. |
812 | * Return: Return code from CP IUCV call. | 812 | * Return: Return code from CP IUCV call. |
813 | * (-EINVAL) - Ansbuf address is NULL. | 813 | * (-EINVAL) - Ansbuf address is NULL. |
814 | */ | 814 | */ |
815 | int iucv_send2way_prmmsg_array (u16 pathid, | 815 | int iucv_send2way_prmmsg_array (u16 pathid, |
816 | u32 * msgid, | 816 | u32 * msgid, |
@@ -821,29 +821,29 @@ int iucv_send2way_prmmsg_array (u16 pathid, | |||
821 | uchar prmmsg[8], | 821 | uchar prmmsg[8], |
822 | iucv_array_t * ansbuf, ulong anslen); | 822 | iucv_array_t * ansbuf, ulong anslen); |
823 | 823 | ||
824 | /* | 824 | /* |
825 | * Name: iucv_setmask | 825 | * Name: iucv_setmask |
826 | * Purpose: This function enables or disables the following IUCV | 826 | * Purpose: This function enables or disables the following IUCV |
827 | * external interruptions: Nonpriority and priority message | 827 | * external interruptions: Nonpriority and priority message |
828 | * interrupts, nonpriority and priority reply interrupts. | 828 | * interrupts, nonpriority and priority reply interrupts. |
829 | * Input: SetMaskFlag - options for interrupts | 829 | * Input: SetMaskFlag - options for interrupts |
830 | * 0x80 - Nonpriority_MessagePendingInterruptsFlag | 830 | * 0x80 - Nonpriority_MessagePendingInterruptsFlag |
831 | * 0x40 - Priority_MessagePendingInterruptsFlag | 831 | * 0x40 - Priority_MessagePendingInterruptsFlag |
832 | * 0x20 - Nonpriority_MessageCompletionInterruptsFlag | 832 | * 0x20 - Nonpriority_MessageCompletionInterruptsFlag |
833 | * 0x10 - Priority_MessageCompletionInterruptsFlag | 833 | * 0x10 - Priority_MessageCompletionInterruptsFlag |
834 | * 0x08 - IUCVControlInterruptsFlag | 834 | * 0x08 - IUCVControlInterruptsFlag |
835 | * Output: NA | 835 | * Output: NA |
836 | * Return: Return code from CP IUCV call. | 836 | * Return: Return code from CP IUCV call. |
837 | */ | 837 | */ |
838 | int iucv_setmask (int SetMaskFlag); | 838 | int iucv_setmask (int SetMaskFlag); |
839 | 839 | ||
840 | /* | 840 | /* |
841 | * Name: iucv_sever | 841 | * Name: iucv_sever |
842 | * Purpose: This function terminates an IUCV path. | 842 | * Purpose: This function terminates an IUCV path. |
843 | * Input: pathid - Path identification number. | 843 | * Input: pathid - Path identification number. |
844 | * user_data - 16-bytes of user data. | 844 | * user_data - 16-bytes of user data. |
845 | * Output: NA | 845 | * Output: NA |
846 | * Return: Return code from CP IUCV call. | 846 | * Return: Return code from CP IUCV call. |
847 | * (-EINVAL) - Interal error, wild pointer. | 847 | * (-EINVAL) - Interal error, wild pointer. |
848 | */ | 848 | */ |
849 | int iucv_sever (u16 pathid, uchar user_data[16]); | 849 | int iucv_sever (u16 pathid, uchar user_data[16]); |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 5d6b7a57b02f..f94419b334f7 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -68,6 +68,7 @@ static void lcs_tasklet(unsigned long); | |||
68 | static void lcs_start_kernel_thread(struct lcs_card *card); | 68 | static void lcs_start_kernel_thread(struct lcs_card *card); |
69 | static void lcs_get_frames_cb(struct lcs_channel *, struct lcs_buffer *); | 69 | static void lcs_get_frames_cb(struct lcs_channel *, struct lcs_buffer *); |
70 | static int lcs_send_delipm(struct lcs_card *, struct lcs_ipm_list *); | 70 | static int lcs_send_delipm(struct lcs_card *, struct lcs_ipm_list *); |
71 | static int lcs_recovery(void *ptr); | ||
71 | 72 | ||
72 | /** | 73 | /** |
73 | * Debug Facility Stuff | 74 | * Debug Facility Stuff |
@@ -429,12 +430,6 @@ lcs_setup_card(struct lcs_card *card) | |||
429 | card->tx_buffer = NULL; | 430 | card->tx_buffer = NULL; |
430 | card->tx_emitted = 0; | 431 | card->tx_emitted = 0; |
431 | 432 | ||
432 | /* Initialize kernel thread task used for LGW commands. */ | ||
433 | INIT_WORK(&card->kernel_thread_starter, | ||
434 | (void *)lcs_start_kernel_thread,card); | ||
435 | card->thread_start_mask = 0; | ||
436 | card->thread_allowed_mask = 0; | ||
437 | card->thread_running_mask = 0; | ||
438 | init_waitqueue_head(&card->wait_q); | 433 | init_waitqueue_head(&card->wait_q); |
439 | spin_lock_init(&card->lock); | 434 | spin_lock_init(&card->lock); |
440 | spin_lock_init(&card->ipm_lock); | 435 | spin_lock_init(&card->ipm_lock); |
@@ -675,8 +670,9 @@ lcs_ready_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
675 | int index, rc; | 670 | int index, rc; |
676 | 671 | ||
677 | LCS_DBF_TEXT(5, trace, "rdybuff"); | 672 | LCS_DBF_TEXT(5, trace, "rdybuff"); |
678 | BUG_ON(buffer->state != BUF_STATE_LOCKED && | 673 | if (buffer->state != BUF_STATE_LOCKED && |
679 | buffer->state != BUF_STATE_PROCESSED); | 674 | buffer->state != BUF_STATE_PROCESSED) |
675 | BUG(); | ||
680 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 676 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
681 | buffer->state = BUF_STATE_READY; | 677 | buffer->state = BUF_STATE_READY; |
682 | index = buffer - channel->iob; | 678 | index = buffer - channel->iob; |
@@ -700,7 +696,8 @@ __lcs_processed_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
700 | int index, prev, next; | 696 | int index, prev, next; |
701 | 697 | ||
702 | LCS_DBF_TEXT(5, trace, "prcsbuff"); | 698 | LCS_DBF_TEXT(5, trace, "prcsbuff"); |
703 | BUG_ON(buffer->state != BUF_STATE_READY); | 699 | if (buffer->state != BUF_STATE_READY) |
700 | BUG(); | ||
704 | buffer->state = BUF_STATE_PROCESSED; | 701 | buffer->state = BUF_STATE_PROCESSED; |
705 | index = buffer - channel->iob; | 702 | index = buffer - channel->iob; |
706 | prev = (index - 1) & (LCS_NUM_BUFFS - 1); | 703 | prev = (index - 1) & (LCS_NUM_BUFFS - 1); |
@@ -732,8 +729,9 @@ lcs_release_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
732 | unsigned long flags; | 729 | unsigned long flags; |
733 | 730 | ||
734 | LCS_DBF_TEXT(5, trace, "relbuff"); | 731 | LCS_DBF_TEXT(5, trace, "relbuff"); |
735 | BUG_ON(buffer->state != BUF_STATE_LOCKED && | 732 | if (buffer->state != BUF_STATE_LOCKED && |
736 | buffer->state != BUF_STATE_PROCESSED); | 733 | buffer->state != BUF_STATE_PROCESSED) |
734 | BUG(); | ||
737 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 735 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
738 | buffer->state = BUF_STATE_EMPTY; | 736 | buffer->state = BUF_STATE_EMPTY; |
739 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); | 737 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); |
@@ -1147,8 +1145,6 @@ list_modified: | |||
1147 | list_add_tail(&ipm->list, &card->ipm_list); | 1145 | list_add_tail(&ipm->list, &card->ipm_list); |
1148 | } | 1146 | } |
1149 | spin_unlock_irqrestore(&card->ipm_lock, flags); | 1147 | spin_unlock_irqrestore(&card->ipm_lock, flags); |
1150 | if (card->state == DEV_STATE_UP) | ||
1151 | netif_wake_queue(card->dev); | ||
1152 | } | 1148 | } |
1153 | 1149 | ||
1154 | /** | 1150 | /** |
@@ -1231,17 +1227,17 @@ lcs_set_mc_addresses(struct lcs_card *card, struct in_device *in4_dev) | |||
1231 | if (ipm != NULL) | 1227 | if (ipm != NULL) |
1232 | continue; /* Address already in list. */ | 1228 | continue; /* Address already in list. */ |
1233 | ipm = (struct lcs_ipm_list *) | 1229 | ipm = (struct lcs_ipm_list *) |
1234 | kmalloc(sizeof(struct lcs_ipm_list), GFP_ATOMIC); | 1230 | kzalloc(sizeof(struct lcs_ipm_list), GFP_ATOMIC); |
1235 | if (ipm == NULL) { | 1231 | if (ipm == NULL) { |
1236 | PRINT_INFO("Not enough memory to add " | 1232 | PRINT_INFO("Not enough memory to add " |
1237 | "new multicast entry!\n"); | 1233 | "new multicast entry!\n"); |
1238 | break; | 1234 | break; |
1239 | } | 1235 | } |
1240 | memset(ipm, 0, sizeof(struct lcs_ipm_list)); | ||
1241 | memcpy(&ipm->ipm.mac_addr, buf, LCS_MAC_LENGTH); | 1236 | memcpy(&ipm->ipm.mac_addr, buf, LCS_MAC_LENGTH); |
1242 | ipm->ipm.ip_addr = im4->multiaddr; | 1237 | ipm->ipm.ip_addr = im4->multiaddr; |
1243 | ipm->ipm_state = LCS_IPM_STATE_SET_REQUIRED; | 1238 | ipm->ipm_state = LCS_IPM_STATE_SET_REQUIRED; |
1244 | spin_lock_irqsave(&card->ipm_lock, flags); | 1239 | spin_lock_irqsave(&card->ipm_lock, flags); |
1240 | LCS_DBF_HEX(2,trace,&ipm->ipm.ip_addr,4); | ||
1245 | list_add(&ipm->list, &card->ipm_list); | 1241 | list_add(&ipm->list, &card->ipm_list); |
1246 | spin_unlock_irqrestore(&card->ipm_lock, flags); | 1242 | spin_unlock_irqrestore(&card->ipm_lock, flags); |
1247 | } | 1243 | } |
@@ -1269,7 +1265,15 @@ lcs_register_mc_addresses(void *data) | |||
1269 | read_unlock(&in4_dev->mc_list_lock); | 1265 | read_unlock(&in4_dev->mc_list_lock); |
1270 | in_dev_put(in4_dev); | 1266 | in_dev_put(in4_dev); |
1271 | 1267 | ||
1268 | netif_carrier_off(card->dev); | ||
1269 | netif_tx_disable(card->dev); | ||
1270 | wait_event(card->write.wait_q, | ||
1271 | (card->write.state != CH_STATE_RUNNING)); | ||
1272 | lcs_fix_multicast_list(card); | 1272 | lcs_fix_multicast_list(card); |
1273 | if (card->state == DEV_STATE_UP) { | ||
1274 | netif_carrier_on(card->dev); | ||
1275 | netif_wake_queue(card->dev); | ||
1276 | } | ||
1273 | out: | 1277 | out: |
1274 | lcs_clear_thread_running_bit(card, LCS_SET_MC_THREAD); | 1278 | lcs_clear_thread_running_bit(card, LCS_SET_MC_THREAD); |
1275 | return 0; | 1279 | return 0; |
@@ -1286,7 +1290,7 @@ lcs_set_multicast_list(struct net_device *dev) | |||
1286 | LCS_DBF_TEXT(4, trace, "setmulti"); | 1290 | LCS_DBF_TEXT(4, trace, "setmulti"); |
1287 | card = (struct lcs_card *) dev->priv; | 1291 | card = (struct lcs_card *) dev->priv; |
1288 | 1292 | ||
1289 | if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD)) | 1293 | if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD)) |
1290 | schedule_work(&card->kernel_thread_starter); | 1294 | schedule_work(&card->kernel_thread_starter); |
1291 | } | 1295 | } |
1292 | 1296 | ||
@@ -1318,6 +1322,53 @@ lcs_check_irb_error(struct ccw_device *cdev, struct irb *irb) | |||
1318 | return PTR_ERR(irb); | 1322 | return PTR_ERR(irb); |
1319 | } | 1323 | } |
1320 | 1324 | ||
1325 | static int | ||
1326 | lcs_get_problem(struct ccw_device *cdev, struct irb *irb) | ||
1327 | { | ||
1328 | int dstat, cstat; | ||
1329 | char *sense; | ||
1330 | |||
1331 | sense = (char *) irb->ecw; | ||
1332 | cstat = irb->scsw.cstat; | ||
1333 | dstat = irb->scsw.dstat; | ||
1334 | |||
1335 | if (cstat & (SCHN_STAT_CHN_CTRL_CHK | SCHN_STAT_INTF_CTRL_CHK | | ||
1336 | SCHN_STAT_CHN_DATA_CHK | SCHN_STAT_CHAIN_CHECK | | ||
1337 | SCHN_STAT_PROT_CHECK | SCHN_STAT_PROG_CHECK)) { | ||
1338 | LCS_DBF_TEXT(2, trace, "CGENCHK"); | ||
1339 | return 1; | ||
1340 | } | ||
1341 | if (dstat & DEV_STAT_UNIT_CHECK) { | ||
1342 | if (sense[LCS_SENSE_BYTE_1] & | ||
1343 | LCS_SENSE_RESETTING_EVENT) { | ||
1344 | LCS_DBF_TEXT(2, trace, "REVIND"); | ||
1345 | return 1; | ||
1346 | } | ||
1347 | if (sense[LCS_SENSE_BYTE_0] & | ||
1348 | LCS_SENSE_CMD_REJECT) { | ||
1349 | LCS_DBF_TEXT(2, trace, "CMDREJ"); | ||
1350 | return 0; | ||
1351 | } | ||
1352 | if ((!sense[LCS_SENSE_BYTE_0]) && | ||
1353 | (!sense[LCS_SENSE_BYTE_1]) && | ||
1354 | (!sense[LCS_SENSE_BYTE_2]) && | ||
1355 | (!sense[LCS_SENSE_BYTE_3])) { | ||
1356 | LCS_DBF_TEXT(2, trace, "ZEROSEN"); | ||
1357 | return 0; | ||
1358 | } | ||
1359 | LCS_DBF_TEXT(2, trace, "DGENCHK"); | ||
1360 | return 1; | ||
1361 | } | ||
1362 | return 0; | ||
1363 | } | ||
1364 | |||
1365 | void | ||
1366 | lcs_schedule_recovery(struct lcs_card *card) | ||
1367 | { | ||
1368 | LCS_DBF_TEXT(2, trace, "startrec"); | ||
1369 | if (!lcs_set_thread_start_bit(card, LCS_RECOVERY_THREAD)) | ||
1370 | schedule_work(&card->kernel_thread_starter); | ||
1371 | } | ||
1321 | 1372 | ||
1322 | /** | 1373 | /** |
1323 | * IRQ Handler for LCS channels | 1374 | * IRQ Handler for LCS channels |
@@ -1327,7 +1378,8 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1327 | { | 1378 | { |
1328 | struct lcs_card *card; | 1379 | struct lcs_card *card; |
1329 | struct lcs_channel *channel; | 1380 | struct lcs_channel *channel; |
1330 | int index; | 1381 | int rc, index; |
1382 | int cstat, dstat; | ||
1331 | 1383 | ||
1332 | if (lcs_check_irb_error(cdev, irb)) | 1384 | if (lcs_check_irb_error(cdev, irb)) |
1333 | return; | 1385 | return; |
@@ -1338,17 +1390,30 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1338 | else | 1390 | else |
1339 | channel = &card->write; | 1391 | channel = &card->write; |
1340 | 1392 | ||
1393 | cstat = irb->scsw.cstat; | ||
1394 | dstat = irb->scsw.dstat; | ||
1341 | LCS_DBF_TEXT_(5, trace, "Rint%s",cdev->dev.bus_id); | 1395 | LCS_DBF_TEXT_(5, trace, "Rint%s",cdev->dev.bus_id); |
1342 | LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.cstat, irb->scsw.dstat); | 1396 | LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.cstat, irb->scsw.dstat); |
1343 | LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.fctl, irb->scsw.actl); | 1397 | LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.fctl, irb->scsw.actl); |
1344 | 1398 | ||
1399 | /* Check for channel and device errors presented */ | ||
1400 | rc = lcs_get_problem(cdev, irb); | ||
1401 | if (rc || (dstat & DEV_STAT_UNIT_EXCEP)) { | ||
1402 | PRINT_WARN("check on device %s, dstat=0x%X, cstat=0x%X \n", | ||
1403 | cdev->dev.bus_id, dstat, cstat); | ||
1404 | if (rc) { | ||
1405 | lcs_schedule_recovery(card); | ||
1406 | wake_up(&card->wait_q); | ||
1407 | return; | ||
1408 | } | ||
1409 | } | ||
1345 | /* How far in the ccw chain have we processed? */ | 1410 | /* How far in the ccw chain have we processed? */ |
1346 | if ((channel->state != CH_STATE_INIT) && | 1411 | if ((channel->state != CH_STATE_INIT) && |
1347 | (irb->scsw.fctl & SCSW_FCTL_START_FUNC)) { | 1412 | (irb->scsw.fctl & SCSW_FCTL_START_FUNC)) { |
1348 | index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa) | 1413 | index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa) |
1349 | - channel->ccws; | 1414 | - channel->ccws; |
1350 | if ((irb->scsw.actl & SCSW_ACTL_SUSPENDED) || | 1415 | if ((irb->scsw.actl & SCSW_ACTL_SUSPENDED) || |
1351 | (irb->scsw.cstat | SCHN_STAT_PCI)) | 1416 | (irb->scsw.cstat & SCHN_STAT_PCI)) |
1352 | /* Bloody io subsystem tells us lies about cpa... */ | 1417 | /* Bloody io subsystem tells us lies about cpa... */ |
1353 | index = (index - 1) & (LCS_NUM_BUFFS - 1); | 1418 | index = (index - 1) & (LCS_NUM_BUFFS - 1); |
1354 | while (channel->io_idx != index) { | 1419 | while (channel->io_idx != index) { |
@@ -1367,7 +1432,6 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1367 | else if (irb->scsw.actl & SCSW_ACTL_SUSPENDED) | 1432 | else if (irb->scsw.actl & SCSW_ACTL_SUSPENDED) |
1368 | /* CCW execution stopped on a suspend bit. */ | 1433 | /* CCW execution stopped on a suspend bit. */ |
1369 | channel->state = CH_STATE_SUSPENDED; | 1434 | channel->state = CH_STATE_SUSPENDED; |
1370 | |||
1371 | if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) { | 1435 | if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) { |
1372 | if (irb->scsw.cc != 0) { | 1436 | if (irb->scsw.cc != 0) { |
1373 | ccw_device_halt(channel->ccwdev, (addr_t) channel); | 1437 | ccw_device_halt(channel->ccwdev, (addr_t) channel); |
@@ -1376,7 +1440,6 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1376 | /* The channel has been stopped by halt_IO. */ | 1440 | /* The channel has been stopped by halt_IO. */ |
1377 | channel->state = CH_STATE_HALTED; | 1441 | channel->state = CH_STATE_HALTED; |
1378 | } | 1442 | } |
1379 | |||
1380 | if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) { | 1443 | if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) { |
1381 | channel->state = CH_STATE_CLEARED; | 1444 | channel->state = CH_STATE_CLEARED; |
1382 | } | 1445 | } |
@@ -1452,7 +1515,7 @@ lcs_txbuffer_cb(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
1452 | lcs_release_buffer(channel, buffer); | 1515 | lcs_release_buffer(channel, buffer); |
1453 | card = (struct lcs_card *) | 1516 | card = (struct lcs_card *) |
1454 | ((char *) channel - offsetof(struct lcs_card, write)); | 1517 | ((char *) channel - offsetof(struct lcs_card, write)); |
1455 | if (netif_queue_stopped(card->dev)) | 1518 | if (netif_queue_stopped(card->dev) && netif_carrier_ok(card->dev)) |
1456 | netif_wake_queue(card->dev); | 1519 | netif_wake_queue(card->dev); |
1457 | spin_lock(&card->lock); | 1520 | spin_lock(&card->lock); |
1458 | card->tx_emitted--; | 1521 | card->tx_emitted--; |
@@ -1488,6 +1551,10 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb, | |||
1488 | card->stats.tx_carrier_errors++; | 1551 | card->stats.tx_carrier_errors++; |
1489 | return 0; | 1552 | return 0; |
1490 | } | 1553 | } |
1554 | if (skb->protocol == htons(ETH_P_IPV6)) { | ||
1555 | dev_kfree_skb(skb); | ||
1556 | return 0; | ||
1557 | } | ||
1491 | netif_stop_queue(card->dev); | 1558 | netif_stop_queue(card->dev); |
1492 | spin_lock(&card->lock); | 1559 | spin_lock(&card->lock); |
1493 | if (card->tx_buffer != NULL && | 1560 | if (card->tx_buffer != NULL && |
@@ -1633,30 +1700,6 @@ lcs_detect(struct lcs_card *card) | |||
1633 | } | 1700 | } |
1634 | 1701 | ||
1635 | /** | 1702 | /** |
1636 | * reset card | ||
1637 | */ | ||
1638 | static int | ||
1639 | lcs_resetcard(struct lcs_card *card) | ||
1640 | { | ||
1641 | int retries; | ||
1642 | |||
1643 | LCS_DBF_TEXT(2, trace, "rescard"); | ||
1644 | for (retries = 0; retries < 10; retries++) { | ||
1645 | if (lcs_detect(card) == 0) { | ||
1646 | netif_wake_queue(card->dev); | ||
1647 | card->state = DEV_STATE_UP; | ||
1648 | PRINT_INFO("LCS device %s successfully restarted!\n", | ||
1649 | card->dev->name); | ||
1650 | return 0; | ||
1651 | } | ||
1652 | msleep(3000); | ||
1653 | } | ||
1654 | PRINT_ERR("Error in Reseting LCS card!\n"); | ||
1655 | return -EIO; | ||
1656 | } | ||
1657 | |||
1658 | |||
1659 | /** | ||
1660 | * LCS Stop card | 1703 | * LCS Stop card |
1661 | */ | 1704 | */ |
1662 | static int | 1705 | static int |
@@ -1680,126 +1723,18 @@ lcs_stopcard(struct lcs_card *card) | |||
1680 | } | 1723 | } |
1681 | 1724 | ||
1682 | /** | 1725 | /** |
1683 | * LGW initiated commands | ||
1684 | */ | ||
1685 | static int | ||
1686 | lcs_lgw_startlan_thread(void *data) | ||
1687 | { | ||
1688 | struct lcs_card *card; | ||
1689 | |||
1690 | card = (struct lcs_card *) data; | ||
1691 | daemonize("lgwstpln"); | ||
1692 | |||
1693 | if (!lcs_do_run_thread(card, LCS_STARTLAN_THREAD)) | ||
1694 | return 0; | ||
1695 | LCS_DBF_TEXT(4, trace, "lgwstpln"); | ||
1696 | if (card->dev) | ||
1697 | netif_stop_queue(card->dev); | ||
1698 | if (lcs_startlan(card) == 0) { | ||
1699 | netif_wake_queue(card->dev); | ||
1700 | card->state = DEV_STATE_UP; | ||
1701 | PRINT_INFO("LCS Startlan for device %s succeeded!\n", | ||
1702 | card->dev->name); | ||
1703 | |||
1704 | } else | ||
1705 | PRINT_ERR("LCS Startlan for device %s failed!\n", | ||
1706 | card->dev->name); | ||
1707 | lcs_clear_thread_running_bit(card, LCS_STARTLAN_THREAD); | ||
1708 | return 0; | ||
1709 | } | ||
1710 | |||
1711 | /** | ||
1712 | * Send startup command initiated by Lan Gateway | ||
1713 | */ | ||
1714 | static int | ||
1715 | lcs_lgw_startup_thread(void *data) | ||
1716 | { | ||
1717 | int rc; | ||
1718 | |||
1719 | struct lcs_card *card; | ||
1720 | |||
1721 | card = (struct lcs_card *) data; | ||
1722 | daemonize("lgwstaln"); | ||
1723 | |||
1724 | if (!lcs_do_run_thread(card, LCS_STARTUP_THREAD)) | ||
1725 | return 0; | ||
1726 | LCS_DBF_TEXT(4, trace, "lgwstaln"); | ||
1727 | if (card->dev) | ||
1728 | netif_stop_queue(card->dev); | ||
1729 | rc = lcs_send_startup(card, LCS_INITIATOR_LGW); | ||
1730 | if (rc != 0) { | ||
1731 | PRINT_ERR("Startup for LCS device %s initiated " \ | ||
1732 | "by LGW failed!\nReseting card ...\n", | ||
1733 | card->dev->name); | ||
1734 | /* do a card reset */ | ||
1735 | rc = lcs_resetcard(card); | ||
1736 | if (rc == 0) | ||
1737 | goto Done; | ||
1738 | } | ||
1739 | rc = lcs_startlan(card); | ||
1740 | if (rc == 0) { | ||
1741 | netif_wake_queue(card->dev); | ||
1742 | card->state = DEV_STATE_UP; | ||
1743 | } | ||
1744 | Done: | ||
1745 | if (rc == 0) | ||
1746 | PRINT_INFO("LCS Startup for device %s succeeded!\n", | ||
1747 | card->dev->name); | ||
1748 | else | ||
1749 | PRINT_ERR("LCS Startup for device %s failed!\n", | ||
1750 | card->dev->name); | ||
1751 | lcs_clear_thread_running_bit(card, LCS_STARTUP_THREAD); | ||
1752 | return 0; | ||
1753 | } | ||
1754 | |||
1755 | |||
1756 | /** | ||
1757 | * send stoplan command initiated by Lan Gateway | ||
1758 | */ | ||
1759 | static int | ||
1760 | lcs_lgw_stoplan_thread(void *data) | ||
1761 | { | ||
1762 | struct lcs_card *card; | ||
1763 | int rc; | ||
1764 | |||
1765 | card = (struct lcs_card *) data; | ||
1766 | daemonize("lgwstop"); | ||
1767 | |||
1768 | if (!lcs_do_run_thread(card, LCS_STOPLAN_THREAD)) | ||
1769 | return 0; | ||
1770 | LCS_DBF_TEXT(4, trace, "lgwstop"); | ||
1771 | if (card->dev) | ||
1772 | netif_stop_queue(card->dev); | ||
1773 | if (lcs_send_stoplan(card, LCS_INITIATOR_LGW) == 0) | ||
1774 | PRINT_INFO("Stoplan for %s initiated by LGW succeeded!\n", | ||
1775 | card->dev->name); | ||
1776 | else | ||
1777 | PRINT_ERR("Stoplan %s initiated by LGW failed!\n", | ||
1778 | card->dev->name); | ||
1779 | /*Try to reset the card, stop it on failure */ | ||
1780 | rc = lcs_resetcard(card); | ||
1781 | if (rc != 0) | ||
1782 | rc = lcs_stopcard(card); | ||
1783 | lcs_clear_thread_running_bit(card, LCS_STOPLAN_THREAD); | ||
1784 | return rc; | ||
1785 | } | ||
1786 | |||
1787 | /** | ||
1788 | * Kernel Thread helper functions for LGW initiated commands | 1726 | * Kernel Thread helper functions for LGW initiated commands |
1789 | */ | 1727 | */ |
1790 | static void | 1728 | static void |
1791 | lcs_start_kernel_thread(struct lcs_card *card) | 1729 | lcs_start_kernel_thread(struct lcs_card *card) |
1792 | { | 1730 | { |
1793 | LCS_DBF_TEXT(5, trace, "krnthrd"); | 1731 | LCS_DBF_TEXT(5, trace, "krnthrd"); |
1794 | if (lcs_do_start_thread(card, LCS_STARTUP_THREAD)) | 1732 | if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD)) |
1795 | kernel_thread(lcs_lgw_startup_thread, (void *) card, SIGCHLD); | 1733 | kernel_thread(lcs_recovery, (void *) card, SIGCHLD); |
1796 | if (lcs_do_start_thread(card, LCS_STARTLAN_THREAD)) | ||
1797 | kernel_thread(lcs_lgw_startlan_thread, (void *) card, SIGCHLD); | ||
1798 | if (lcs_do_start_thread(card, LCS_STOPLAN_THREAD)) | ||
1799 | kernel_thread(lcs_lgw_stoplan_thread, (void *) card, SIGCHLD); | ||
1800 | #ifdef CONFIG_IP_MULTICAST | 1734 | #ifdef CONFIG_IP_MULTICAST |
1801 | if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) | 1735 | if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) |
1802 | kernel_thread(lcs_register_mc_addresses, (void *) card, SIGCHLD); | 1736 | kernel_thread(lcs_register_mc_addresses, |
1737 | (void *) card, SIGCHLD); | ||
1803 | #endif | 1738 | #endif |
1804 | } | 1739 | } |
1805 | 1740 | ||
@@ -1813,19 +1748,14 @@ lcs_get_control(struct lcs_card *card, struct lcs_cmd *cmd) | |||
1813 | if (cmd->initiator == LCS_INITIATOR_LGW) { | 1748 | if (cmd->initiator == LCS_INITIATOR_LGW) { |
1814 | switch(cmd->cmd_code) { | 1749 | switch(cmd->cmd_code) { |
1815 | case LCS_CMD_STARTUP: | 1750 | case LCS_CMD_STARTUP: |
1816 | if (!lcs_set_thread_start_bit(card, | ||
1817 | LCS_STARTUP_THREAD)) | ||
1818 | schedule_work(&card->kernel_thread_starter); | ||
1819 | break; | ||
1820 | case LCS_CMD_STARTLAN: | 1751 | case LCS_CMD_STARTLAN: |
1821 | if (!lcs_set_thread_start_bit(card, | 1752 | lcs_schedule_recovery(card); |
1822 | LCS_STARTLAN_THREAD)) | ||
1823 | schedule_work(&card->kernel_thread_starter); | ||
1824 | break; | 1753 | break; |
1825 | case LCS_CMD_STOPLAN: | 1754 | case LCS_CMD_STOPLAN: |
1826 | if (!lcs_set_thread_start_bit(card, | 1755 | PRINT_WARN("Stoplan for %s initiated by LGW.\n", |
1827 | LCS_STOPLAN_THREAD)) | 1756 | card->dev->name); |
1828 | schedule_work(&card->kernel_thread_starter); | 1757 | if (card->dev) |
1758 | netif_carrier_off(card->dev); | ||
1829 | break; | 1759 | break; |
1830 | default: | 1760 | default: |
1831 | PRINT_INFO("UNRECOGNIZED LGW COMMAND\n"); | 1761 | PRINT_INFO("UNRECOGNIZED LGW COMMAND\n"); |
@@ -1941,8 +1871,11 @@ lcs_stop_device(struct net_device *dev) | |||
1941 | 1871 | ||
1942 | LCS_DBF_TEXT(2, trace, "stopdev"); | 1872 | LCS_DBF_TEXT(2, trace, "stopdev"); |
1943 | card = (struct lcs_card *) dev->priv; | 1873 | card = (struct lcs_card *) dev->priv; |
1944 | netif_stop_queue(dev); | 1874 | netif_carrier_off(dev); |
1875 | netif_tx_disable(dev); | ||
1945 | dev->flags &= ~IFF_UP; | 1876 | dev->flags &= ~IFF_UP; |
1877 | wait_event(card->write.wait_q, | ||
1878 | (card->write.state != CH_STATE_RUNNING)); | ||
1946 | rc = lcs_stopcard(card); | 1879 | rc = lcs_stopcard(card); |
1947 | if (rc) | 1880 | if (rc) |
1948 | PRINT_ERR("Try it again!\n "); | 1881 | PRINT_ERR("Try it again!\n "); |
@@ -1968,6 +1901,7 @@ lcs_open_device(struct net_device *dev) | |||
1968 | 1901 | ||
1969 | } else { | 1902 | } else { |
1970 | dev->flags |= IFF_UP; | 1903 | dev->flags |= IFF_UP; |
1904 | netif_carrier_on(dev); | ||
1971 | netif_wake_queue(dev); | 1905 | netif_wake_queue(dev); |
1972 | card->state = DEV_STATE_UP; | 1906 | card->state = DEV_STATE_UP; |
1973 | } | 1907 | } |
@@ -2059,10 +1993,31 @@ lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char | |||
2059 | 1993 | ||
2060 | DEVICE_ATTR(lancmd_timeout, 0644, lcs_timeout_show, lcs_timeout_store); | 1994 | DEVICE_ATTR(lancmd_timeout, 0644, lcs_timeout_show, lcs_timeout_store); |
2061 | 1995 | ||
1996 | static ssize_t | ||
1997 | lcs_dev_recover_store(struct device *dev, struct device_attribute *attr, | ||
1998 | const char *buf, size_t count) | ||
1999 | { | ||
2000 | struct lcs_card *card = dev->driver_data; | ||
2001 | char *tmp; | ||
2002 | int i; | ||
2003 | |||
2004 | if (!card) | ||
2005 | return -EINVAL; | ||
2006 | if (card->state != DEV_STATE_UP) | ||
2007 | return -EPERM; | ||
2008 | i = simple_strtoul(buf, &tmp, 16); | ||
2009 | if (i == 1) | ||
2010 | lcs_schedule_recovery(card); | ||
2011 | return count; | ||
2012 | } | ||
2013 | |||
2014 | static DEVICE_ATTR(recover, 0200, NULL, lcs_dev_recover_store); | ||
2015 | |||
2062 | static struct attribute * lcs_attrs[] = { | 2016 | static struct attribute * lcs_attrs[] = { |
2063 | &dev_attr_portno.attr, | 2017 | &dev_attr_portno.attr, |
2064 | &dev_attr_type.attr, | 2018 | &dev_attr_type.attr, |
2065 | &dev_attr_lancmd_timeout.attr, | 2019 | &dev_attr_lancmd_timeout.attr, |
2020 | &dev_attr_recover.attr, | ||
2066 | NULL, | 2021 | NULL, |
2067 | }; | 2022 | }; |
2068 | 2023 | ||
@@ -2099,6 +2054,12 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev) | |||
2099 | ccwgdev->dev.driver_data = card; | 2054 | ccwgdev->dev.driver_data = card; |
2100 | ccwgdev->cdev[0]->handler = lcs_irq; | 2055 | ccwgdev->cdev[0]->handler = lcs_irq; |
2101 | ccwgdev->cdev[1]->handler = lcs_irq; | 2056 | ccwgdev->cdev[1]->handler = lcs_irq; |
2057 | card->gdev = ccwgdev; | ||
2058 | INIT_WORK(&card->kernel_thread_starter, | ||
2059 | (void *) lcs_start_kernel_thread, card); | ||
2060 | card->thread_start_mask = 0; | ||
2061 | card->thread_allowed_mask = 0; | ||
2062 | card->thread_running_mask = 0; | ||
2102 | return 0; | 2063 | return 0; |
2103 | } | 2064 | } |
2104 | 2065 | ||
@@ -2200,6 +2161,7 @@ netdev_out: | |||
2200 | if (recover_state == DEV_STATE_RECOVER) { | 2161 | if (recover_state == DEV_STATE_RECOVER) { |
2201 | lcs_set_multicast_list(card->dev); | 2162 | lcs_set_multicast_list(card->dev); |
2202 | card->dev->flags |= IFF_UP; | 2163 | card->dev->flags |= IFF_UP; |
2164 | netif_carrier_on(card->dev); | ||
2203 | netif_wake_queue(card->dev); | 2165 | netif_wake_queue(card->dev); |
2204 | card->state = DEV_STATE_UP; | 2166 | card->state = DEV_STATE_UP; |
2205 | } else { | 2167 | } else { |
@@ -2229,7 +2191,7 @@ out: | |||
2229 | * lcs_shutdown_device, called when setting the group device offline. | 2191 | * lcs_shutdown_device, called when setting the group device offline. |
2230 | */ | 2192 | */ |
2231 | static int | 2193 | static int |
2232 | lcs_shutdown_device(struct ccwgroup_device *ccwgdev) | 2194 | __lcs_shutdown_device(struct ccwgroup_device *ccwgdev, int recovery_mode) |
2233 | { | 2195 | { |
2234 | struct lcs_card *card; | 2196 | struct lcs_card *card; |
2235 | enum lcs_dev_states recover_state; | 2197 | enum lcs_dev_states recover_state; |
@@ -2239,9 +2201,11 @@ lcs_shutdown_device(struct ccwgroup_device *ccwgdev) | |||
2239 | card = (struct lcs_card *)ccwgdev->dev.driver_data; | 2201 | card = (struct lcs_card *)ccwgdev->dev.driver_data; |
2240 | if (!card) | 2202 | if (!card) |
2241 | return -ENODEV; | 2203 | return -ENODEV; |
2242 | lcs_set_allowed_threads(card, 0); | 2204 | if (recovery_mode == 0) { |
2243 | if (lcs_wait_for_threads(card, LCS_SET_MC_THREAD)) | 2205 | lcs_set_allowed_threads(card, 0); |
2244 | return -ERESTARTSYS; | 2206 | if (lcs_wait_for_threads(card, LCS_SET_MC_THREAD)) |
2207 | return -ERESTARTSYS; | ||
2208 | } | ||
2245 | LCS_DBF_HEX(3, setup, &card, sizeof(void*)); | 2209 | LCS_DBF_HEX(3, setup, &card, sizeof(void*)); |
2246 | recover_state = card->state; | 2210 | recover_state = card->state; |
2247 | 2211 | ||
@@ -2256,6 +2220,43 @@ lcs_shutdown_device(struct ccwgroup_device *ccwgdev) | |||
2256 | return 0; | 2220 | return 0; |
2257 | } | 2221 | } |
2258 | 2222 | ||
2223 | static int | ||
2224 | lcs_shutdown_device(struct ccwgroup_device *ccwgdev) | ||
2225 | { | ||
2226 | return __lcs_shutdown_device(ccwgdev, 0); | ||
2227 | } | ||
2228 | |||
2229 | /** | ||
2230 | * drive lcs recovery after startup and startlan initiated by Lan Gateway | ||
2231 | */ | ||
2232 | static int | ||
2233 | lcs_recovery(void *ptr) | ||
2234 | { | ||
2235 | struct lcs_card *card; | ||
2236 | struct ccwgroup_device *gdev; | ||
2237 | int rc; | ||
2238 | |||
2239 | card = (struct lcs_card *) ptr; | ||
2240 | daemonize("lcs_recover"); | ||
2241 | |||
2242 | LCS_DBF_TEXT(4, trace, "recover1"); | ||
2243 | if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD)) | ||
2244 | return 0; | ||
2245 | LCS_DBF_TEXT(4, trace, "recover2"); | ||
2246 | gdev = card->gdev; | ||
2247 | PRINT_WARN("Recovery of device %s started...\n", gdev->dev.bus_id); | ||
2248 | rc = __lcs_shutdown_device(gdev, 1); | ||
2249 | rc = lcs_new_device(gdev); | ||
2250 | if (!rc) | ||
2251 | PRINT_INFO("Device %s successfully recovered!\n", | ||
2252 | card->dev->name); | ||
2253 | else | ||
2254 | PRINT_INFO("Device %s could not be recovered!\n", | ||
2255 | card->dev->name); | ||
2256 | lcs_clear_thread_running_bit(card, LCS_RECOVERY_THREAD); | ||
2257 | return 0; | ||
2258 | } | ||
2259 | |||
2259 | /** | 2260 | /** |
2260 | * lcs_remove_device, free buffers and card | 2261 | * lcs_remove_device, free buffers and card |
2261 | */ | 2262 | */ |
diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h index 2fad5e40c2e4..93143932983b 100644 --- a/drivers/s390/net/lcs.h +++ b/drivers/s390/net/lcs.h | |||
@@ -73,13 +73,17 @@ do { \ | |||
73 | /** | 73 | /** |
74 | * LCS sense byte definitions | 74 | * LCS sense byte definitions |
75 | */ | 75 | */ |
76 | #define LCS_SENSE_BYTE_0 0 | ||
77 | #define LCS_SENSE_BYTE_1 1 | ||
78 | #define LCS_SENSE_BYTE_2 2 | ||
79 | #define LCS_SENSE_BYTE_3 3 | ||
76 | #define LCS_SENSE_INTERFACE_DISCONNECT 0x01 | 80 | #define LCS_SENSE_INTERFACE_DISCONNECT 0x01 |
77 | #define LCS_SENSE_EQUIPMENT_CHECK 0x10 | 81 | #define LCS_SENSE_EQUIPMENT_CHECK 0x10 |
78 | #define LCS_SENSE_BUS_OUT_CHECK 0x20 | 82 | #define LCS_SENSE_BUS_OUT_CHECK 0x20 |
79 | #define LCS_SENSE_INTERVENTION_REQUIRED 0x40 | 83 | #define LCS_SENSE_INTERVENTION_REQUIRED 0x40 |
80 | #define LCS_SENSE_CMD_REJECT 0x80 | 84 | #define LCS_SENSE_CMD_REJECT 0x80 |
81 | #define LCS_SENSE_RESETTING_EVENT 0x0080 | 85 | #define LCS_SENSE_RESETTING_EVENT 0x80 |
82 | #define LCS_SENSE_DEVICE_ONLINE 0x0020 | 86 | #define LCS_SENSE_DEVICE_ONLINE 0x20 |
83 | 87 | ||
84 | /** | 88 | /** |
85 | * LCS packet type definitions | 89 | * LCS packet type definitions |
@@ -152,10 +156,9 @@ enum lcs_dev_states { | |||
152 | 156 | ||
153 | enum lcs_threads { | 157 | enum lcs_threads { |
154 | LCS_SET_MC_THREAD = 1, | 158 | LCS_SET_MC_THREAD = 1, |
155 | LCS_STARTLAN_THREAD = 2, | 159 | LCS_RECOVERY_THREAD = 2, |
156 | LCS_STOPLAN_THREAD = 4, | ||
157 | LCS_STARTUP_THREAD = 8, | ||
158 | }; | 160 | }; |
161 | |||
159 | /** | 162 | /** |
160 | * LCS struct declarations | 163 | * LCS struct declarations |
161 | */ | 164 | */ |
@@ -286,6 +289,7 @@ struct lcs_card { | |||
286 | struct net_device_stats stats; | 289 | struct net_device_stats stats; |
287 | unsigned short (*lan_type_trans)(struct sk_buff *skb, | 290 | unsigned short (*lan_type_trans)(struct sk_buff *skb, |
288 | struct net_device *dev); | 291 | struct net_device *dev); |
292 | struct ccwgroup_device *gdev; | ||
289 | struct lcs_channel read; | 293 | struct lcs_channel read; |
290 | struct lcs_channel write; | 294 | struct lcs_channel write; |
291 | struct lcs_buffer *tx_buffer; | 295 | struct lcs_buffer *tx_buffer; |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 260a93c8c442..b452cc1afd55 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -30,7 +30,7 @@ | |||
30 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 30 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #undef DEBUG | 34 | #undef DEBUG |
35 | 35 | ||
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
@@ -65,7 +65,7 @@ MODULE_AUTHOR | |||
65 | ("(C) 2001 IBM Corporation by Fritz Elfert (felfert@millenux.com)"); | 65 | ("(C) 2001 IBM Corporation by Fritz Elfert (felfert@millenux.com)"); |
66 | MODULE_DESCRIPTION ("Linux for S/390 IUCV network driver"); | 66 | MODULE_DESCRIPTION ("Linux for S/390 IUCV network driver"); |
67 | 67 | ||
68 | 68 | ||
69 | #define PRINTK_HEADER " iucv: " /* for debugging */ | 69 | #define PRINTK_HEADER " iucv: " /* for debugging */ |
70 | 70 | ||
71 | static struct device_driver netiucv_driver = { | 71 | static struct device_driver netiucv_driver = { |
@@ -202,7 +202,7 @@ netiucv_printname(char *name) | |||
202 | *p = '\0'; | 202 | *p = '\0'; |
203 | return tmp; | 203 | return tmp; |
204 | } | 204 | } |
205 | 205 | ||
206 | /** | 206 | /** |
207 | * States of the interface statemachine. | 207 | * States of the interface statemachine. |
208 | */ | 208 | */ |
@@ -244,7 +244,7 @@ static const char *dev_event_names[] = { | |||
244 | "Connection up", | 244 | "Connection up", |
245 | "Connection down", | 245 | "Connection down", |
246 | }; | 246 | }; |
247 | 247 | ||
248 | /** | 248 | /** |
249 | * Events of the connection statemachine | 249 | * Events of the connection statemachine |
250 | */ | 250 | */ |
@@ -364,7 +364,7 @@ static const char *conn_state_names[] = { | |||
364 | "Connect error", | 364 | "Connect error", |
365 | }; | 365 | }; |
366 | 366 | ||
367 | 367 | ||
368 | /** | 368 | /** |
369 | * Debug Facility Stuff | 369 | * Debug Facility Stuff |
370 | */ | 370 | */ |
@@ -516,7 +516,7 @@ static void | |||
516 | fsm_action_nop(fsm_instance *fi, int event, void *arg) | 516 | fsm_action_nop(fsm_instance *fi, int event, void *arg) |
517 | { | 517 | { |
518 | } | 518 | } |
519 | 519 | ||
520 | /** | 520 | /** |
521 | * Actions of the connection statemachine | 521 | * Actions of the connection statemachine |
522 | *****************************************************************************/ | 522 | *****************************************************************************/ |
@@ -993,7 +993,7 @@ static const fsm_node conn_fsm[] = { | |||
993 | 993 | ||
994 | static const int CONN_FSM_LEN = sizeof(conn_fsm) / sizeof(fsm_node); | 994 | static const int CONN_FSM_LEN = sizeof(conn_fsm) / sizeof(fsm_node); |
995 | 995 | ||
996 | 996 | ||
997 | /** | 997 | /** |
998 | * Actions for interface - statemachine. | 998 | * Actions for interface - statemachine. |
999 | *****************************************************************************/ | 999 | *****************************************************************************/ |
@@ -1182,7 +1182,7 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) { | |||
1182 | 1182 | ||
1183 | fsm_newstate(conn->fsm, CONN_STATE_TX); | 1183 | fsm_newstate(conn->fsm, CONN_STATE_TX); |
1184 | conn->prof.send_stamp = xtime; | 1184 | conn->prof.send_stamp = xtime; |
1185 | 1185 | ||
1186 | rc = iucv_send(conn->pathid, NULL, 0, 0, 1 /* single_flag */, | 1186 | rc = iucv_send(conn->pathid, NULL, 0, 0, 1 /* single_flag */, |
1187 | 0, nskb->data, nskb->len); | 1187 | 0, nskb->data, nskb->len); |
1188 | /* Shut up, gcc! nskb is always below 2G. */ | 1188 | /* Shut up, gcc! nskb is always below 2G. */ |
@@ -1220,7 +1220,7 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) { | |||
1220 | 1220 | ||
1221 | return rc; | 1221 | return rc; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | /** | 1224 | /** |
1225 | * Interface API for upper network layers | 1225 | * Interface API for upper network layers |
1226 | *****************************************************************************/ | 1226 | *****************************************************************************/ |
@@ -1291,7 +1291,7 @@ static int netiucv_tx(struct sk_buff *skb, struct net_device *dev) | |||
1291 | 1291 | ||
1292 | /** | 1292 | /** |
1293 | * If connection is not running, try to restart it | 1293 | * If connection is not running, try to restart it |
1294 | * and throw away packet. | 1294 | * and throw away packet. |
1295 | */ | 1295 | */ |
1296 | if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { | 1296 | if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { |
1297 | fsm_event(privptr->fsm, DEV_EVENT_START, dev); | 1297 | fsm_event(privptr->fsm, DEV_EVENT_START, dev); |
@@ -1538,7 +1538,7 @@ static ssize_t | |||
1538 | maxcq_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1538 | maxcq_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1539 | { | 1539 | { |
1540 | struct netiucv_priv *priv = dev->driver_data; | 1540 | struct netiucv_priv *priv = dev->driver_data; |
1541 | 1541 | ||
1542 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); | 1542 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); |
1543 | priv->conn->prof.maxcqueue = 0; | 1543 | priv->conn->prof.maxcqueue = 0; |
1544 | return count; | 1544 | return count; |
@@ -1559,7 +1559,7 @@ static ssize_t | |||
1559 | sdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1559 | sdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1560 | { | 1560 | { |
1561 | struct netiucv_priv *priv = dev->driver_data; | 1561 | struct netiucv_priv *priv = dev->driver_data; |
1562 | 1562 | ||
1563 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); | 1563 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); |
1564 | priv->conn->prof.doios_single = 0; | 1564 | priv->conn->prof.doios_single = 0; |
1565 | return count; | 1565 | return count; |
@@ -1580,7 +1580,7 @@ static ssize_t | |||
1580 | mdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1580 | mdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1581 | { | 1581 | { |
1582 | struct netiucv_priv *priv = dev->driver_data; | 1582 | struct netiucv_priv *priv = dev->driver_data; |
1583 | 1583 | ||
1584 | IUCV_DBF_TEXT(trace, 5, __FUNCTION__); | 1584 | IUCV_DBF_TEXT(trace, 5, __FUNCTION__); |
1585 | priv->conn->prof.doios_multi = 0; | 1585 | priv->conn->prof.doios_multi = 0; |
1586 | return count; | 1586 | return count; |
@@ -1601,7 +1601,7 @@ static ssize_t | |||
1601 | txlen_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1601 | txlen_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1602 | { | 1602 | { |
1603 | struct netiucv_priv *priv = dev->driver_data; | 1603 | struct netiucv_priv *priv = dev->driver_data; |
1604 | 1604 | ||
1605 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); | 1605 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); |
1606 | priv->conn->prof.txlen = 0; | 1606 | priv->conn->prof.txlen = 0; |
1607 | return count; | 1607 | return count; |
@@ -1622,7 +1622,7 @@ static ssize_t | |||
1622 | txtime_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1622 | txtime_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1623 | { | 1623 | { |
1624 | struct netiucv_priv *priv = dev->driver_data; | 1624 | struct netiucv_priv *priv = dev->driver_data; |
1625 | 1625 | ||
1626 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); | 1626 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); |
1627 | priv->conn->prof.tx_time = 0; | 1627 | priv->conn->prof.tx_time = 0; |
1628 | return count; | 1628 | return count; |
@@ -2000,7 +2000,7 @@ conn_write(struct device_driver *drv, const char *buf, size_t count) | |||
2000 | } | 2000 | } |
2001 | 2001 | ||
2002 | PRINT_INFO("%s: '%s'\n", dev->name, netiucv_printname(username)); | 2002 | PRINT_INFO("%s: '%s'\n", dev->name, netiucv_printname(username)); |
2003 | 2003 | ||
2004 | return count; | 2004 | return count; |
2005 | 2005 | ||
2006 | out_free_ndev: | 2006 | out_free_ndev: |
@@ -2099,7 +2099,7 @@ static int __init | |||
2099 | netiucv_init(void) | 2099 | netiucv_init(void) |
2100 | { | 2100 | { |
2101 | int ret; | 2101 | int ret; |
2102 | 2102 | ||
2103 | ret = iucv_register_dbf_views(); | 2103 | ret = iucv_register_dbf_views(); |
2104 | if (ret) { | 2104 | if (ret) { |
2105 | PRINT_WARN("netiucv_init failed, " | 2105 | PRINT_WARN("netiucv_init failed, " |
@@ -2128,7 +2128,7 @@ netiucv_init(void) | |||
2128 | } | 2128 | } |
2129 | return ret; | 2129 | return ret; |
2130 | } | 2130 | } |
2131 | 2131 | ||
2132 | module_init(netiucv_init); | 2132 | module_init(netiucv_init); |
2133 | module_exit(netiucv_exit); | 2133 | module_exit(netiucv_exit); |
2134 | MODULE_LICENSE("GPL"); | 2134 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index 4df0fcd7b10b..619f4a0c7160 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h | |||
@@ -376,7 +376,7 @@ struct qeth_hdr_osn { | |||
376 | __u8 reserved3[18]; | 376 | __u8 reserved3[18]; |
377 | __u32 ccid; | 377 | __u32 ccid; |
378 | } __attribute__ ((packed)); | 378 | } __attribute__ ((packed)); |
379 | 379 | ||
380 | struct qeth_hdr { | 380 | struct qeth_hdr { |
381 | union { | 381 | union { |
382 | struct qeth_hdr_layer2 l2; | 382 | struct qeth_hdr_layer2 l2; |
@@ -825,7 +825,7 @@ struct qeth_card { | |||
825 | int use_hard_stop; | 825 | int use_hard_stop; |
826 | int (*orig_hard_header)(struct sk_buff *,struct net_device *, | 826 | int (*orig_hard_header)(struct sk_buff *,struct net_device *, |
827 | unsigned short,void *,void *,unsigned); | 827 | unsigned short,void *,void *,unsigned); |
828 | struct qeth_osn_info osn_info; | 828 | struct qeth_osn_info osn_info; |
829 | }; | 829 | }; |
830 | 830 | ||
831 | struct qeth_card_list_struct { | 831 | struct qeth_card_list_struct { |
@@ -944,7 +944,7 @@ qeth_get_netdev_flags(struct qeth_card *card) | |||
944 | return 0; | 944 | return 0; |
945 | switch (card->info.type) { | 945 | switch (card->info.type) { |
946 | case QETH_CARD_TYPE_IQD: | 946 | case QETH_CARD_TYPE_IQD: |
947 | case QETH_CARD_TYPE_OSN: | 947 | case QETH_CARD_TYPE_OSN: |
948 | return IFF_NOARP; | 948 | return IFF_NOARP; |
949 | #ifdef CONFIG_QETH_IPV6 | 949 | #ifdef CONFIG_QETH_IPV6 |
950 | default: | 950 | default: |
@@ -981,7 +981,7 @@ static inline int | |||
981 | qeth_get_max_mtu_for_card(int cardtype) | 981 | qeth_get_max_mtu_for_card(int cardtype) |
982 | { | 982 | { |
983 | switch (cardtype) { | 983 | switch (cardtype) { |
984 | 984 | ||
985 | case QETH_CARD_TYPE_UNKNOWN: | 985 | case QETH_CARD_TYPE_UNKNOWN: |
986 | case QETH_CARD_TYPE_OSAE: | 986 | case QETH_CARD_TYPE_OSAE: |
987 | case QETH_CARD_TYPE_OSN: | 987 | case QETH_CARD_TYPE_OSN: |
@@ -1097,9 +1097,9 @@ qeth_string_to_ipaddr4(const char *buf, __u8 *addr) | |||
1097 | int count = 0, rc = 0; | 1097 | int count = 0, rc = 0; |
1098 | int in[4]; | 1098 | int in[4]; |
1099 | 1099 | ||
1100 | rc = sscanf(buf, "%d.%d.%d.%d%n", | 1100 | rc = sscanf(buf, "%d.%d.%d.%d%n", |
1101 | &in[0], &in[1], &in[2], &in[3], &count); | 1101 | &in[0], &in[1], &in[2], &in[3], &count); |
1102 | if (rc != 4 || count) | 1102 | if (rc != 4 || count<=0) |
1103 | return -EINVAL; | 1103 | return -EINVAL; |
1104 | for (count = 0; count < 4; count++) { | 1104 | for (count = 0; count < 4; count++) { |
1105 | if (in[count] > 255) | 1105 | if (in[count] > 255) |
@@ -1131,7 +1131,7 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr) | |||
1131 | 1131 | ||
1132 | cnt = out = found = save_cnt = num2 = 0; | 1132 | cnt = out = found = save_cnt = num2 = 0; |
1133 | end = start = (char *) buf; | 1133 | end = start = (char *) buf; |
1134 | in = (__u16 *) addr; | 1134 | in = (__u16 *) addr; |
1135 | memset(in, 0, 16); | 1135 | memset(in, 0, 16); |
1136 | while (end) { | 1136 | while (end) { |
1137 | end = strchr(end,':'); | 1137 | end = strchr(end,':'); |
@@ -1139,7 +1139,7 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr) | |||
1139 | end = (char *)buf + (strlen(buf)); | 1139 | end = (char *)buf + (strlen(buf)); |
1140 | out = 1; | 1140 | out = 1; |
1141 | } | 1141 | } |
1142 | if ((end - start)) { | 1142 | if ((end - start)) { |
1143 | memset(num, 0, 5); | 1143 | memset(num, 0, 5); |
1144 | memcpy(num, start, end - start); | 1144 | memcpy(num, start, end - start); |
1145 | if (!qeth_isxdigit(num)) | 1145 | if (!qeth_isxdigit(num)) |
@@ -1241,5 +1241,5 @@ qeth_osn_register(unsigned char *read_dev_no, | |||
1241 | 1241 | ||
1242 | extern void | 1242 | extern void |
1243 | qeth_osn_deregister(struct net_device *); | 1243 | qeth_osn_deregister(struct net_device *); |
1244 | 1244 | ||
1245 | #endif /* __QETH_H__ */ | 1245 | #endif /* __QETH_H__ */ |
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 44e226f211e7..0bab60a20309 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c | |||
@@ -81,7 +81,7 @@ void | |||
81 | qeth_eddp_buf_release_contexts(struct qeth_qdio_out_buffer *buf) | 81 | qeth_eddp_buf_release_contexts(struct qeth_qdio_out_buffer *buf) |
82 | { | 82 | { |
83 | struct qeth_eddp_context_reference *ref; | 83 | struct qeth_eddp_context_reference *ref; |
84 | 84 | ||
85 | QETH_DBF_TEXT(trace, 6, "eddprctx"); | 85 | QETH_DBF_TEXT(trace, 6, "eddprctx"); |
86 | while (!list_empty(&buf->ctx_list)){ | 86 | while (!list_empty(&buf->ctx_list)){ |
87 | ref = list_entry(buf->ctx_list.next, | 87 | ref = list_entry(buf->ctx_list.next, |
@@ -135,7 +135,7 @@ qeth_eddp_fill_buffer(struct qeth_qdio_out_q *queue, | |||
135 | "buffer!\n"); | 135 | "buffer!\n"); |
136 | goto out; | 136 | goto out; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | /* check if the whole next skb fits into current buffer */ | 139 | /* check if the whole next skb fits into current buffer */ |
140 | if ((QETH_MAX_BUFFER_ELEMENTS(queue->card) - | 140 | if ((QETH_MAX_BUFFER_ELEMENTS(queue->card) - |
141 | buf->next_element_to_fill) | 141 | buf->next_element_to_fill) |
@@ -148,7 +148,7 @@ qeth_eddp_fill_buffer(struct qeth_qdio_out_q *queue, | |||
148 | * and increment ctx's refcnt */ | 148 | * and increment ctx's refcnt */ |
149 | must_refcnt = 1; | 149 | must_refcnt = 1; |
150 | continue; | 150 | continue; |
151 | } | 151 | } |
152 | if (must_refcnt){ | 152 | if (must_refcnt){ |
153 | must_refcnt = 0; | 153 | must_refcnt = 0; |
154 | if (qeth_eddp_buf_ref_context(buf, ctx)){ | 154 | if (qeth_eddp_buf_ref_context(buf, ctx)){ |
@@ -266,7 +266,7 @@ qeth_eddp_copy_data_tcp(char *dst, struct qeth_eddp_data *eddp, int len, | |||
266 | int left_in_frag; | 266 | int left_in_frag; |
267 | int copy_len; | 267 | int copy_len; |
268 | u8 *src; | 268 | u8 *src; |
269 | 269 | ||
270 | QETH_DBF_TEXT(trace, 5, "eddpcdtc"); | 270 | QETH_DBF_TEXT(trace, 5, "eddpcdtc"); |
271 | if (skb_shinfo(eddp->skb)->nr_frags == 0) { | 271 | if (skb_shinfo(eddp->skb)->nr_frags == 0) { |
272 | memcpy(dst, eddp->skb->data + eddp->skb_offset, len); | 272 | memcpy(dst, eddp->skb->data + eddp->skb_offset, len); |
@@ -408,7 +408,7 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | |||
408 | struct tcphdr *tcph; | 408 | struct tcphdr *tcph; |
409 | int data_len; | 409 | int data_len; |
410 | u32 hcsum; | 410 | u32 hcsum; |
411 | 411 | ||
412 | QETH_DBF_TEXT(trace, 5, "eddpftcp"); | 412 | QETH_DBF_TEXT(trace, 5, "eddpftcp"); |
413 | eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl; | 413 | eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl; |
414 | if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2) { | 414 | if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2) { |
@@ -465,13 +465,13 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | |||
465 | eddp->th.tcp.h.seq += data_len; | 465 | eddp->th.tcp.h.seq += data_len; |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | static inline int | 469 | static inline int |
470 | qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | 470 | qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, |
471 | struct sk_buff *skb, struct qeth_hdr *qhdr) | 471 | struct sk_buff *skb, struct qeth_hdr *qhdr) |
472 | { | 472 | { |
473 | struct qeth_eddp_data *eddp = NULL; | 473 | struct qeth_eddp_data *eddp = NULL; |
474 | 474 | ||
475 | QETH_DBF_TEXT(trace, 5, "eddpficx"); | 475 | QETH_DBF_TEXT(trace, 5, "eddpficx"); |
476 | /* create our segmentation headers and copy original headers */ | 476 | /* create our segmentation headers and copy original headers */ |
477 | if (skb->protocol == ETH_P_IP) | 477 | if (skb->protocol == ETH_P_IP) |
@@ -512,7 +512,7 @@ qeth_eddp_calc_num_pages(struct qeth_eddp_context *ctx, struct sk_buff *skb, | |||
512 | int hdr_len) | 512 | int hdr_len) |
513 | { | 513 | { |
514 | int skbs_per_page; | 514 | int skbs_per_page; |
515 | 515 | ||
516 | QETH_DBF_TEXT(trace, 5, "eddpcanp"); | 516 | QETH_DBF_TEXT(trace, 5, "eddpcanp"); |
517 | /* can we put multiple skbs in one page? */ | 517 | /* can we put multiple skbs in one page? */ |
518 | skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->tso_size + hdr_len); | 518 | skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->tso_size + hdr_len); |
@@ -588,7 +588,7 @@ qeth_eddp_create_context_tcp(struct qeth_card *card, struct sk_buff *skb, | |||
588 | struct qeth_hdr *qhdr) | 588 | struct qeth_hdr *qhdr) |
589 | { | 589 | { |
590 | struct qeth_eddp_context *ctx = NULL; | 590 | struct qeth_eddp_context *ctx = NULL; |
591 | 591 | ||
592 | QETH_DBF_TEXT(trace, 5, "creddpct"); | 592 | QETH_DBF_TEXT(trace, 5, "creddpct"); |
593 | if (skb->protocol == ETH_P_IP) | 593 | if (skb->protocol == ETH_P_IP) |
594 | ctx = qeth_eddp_create_context_generic(card, skb, | 594 | ctx = qeth_eddp_create_context_generic(card, skb, |
diff --git a/drivers/s390/net/qeth_fs.h b/drivers/s390/net/qeth_fs.h index e422b41c656e..61faf05517d6 100644 --- a/drivers/s390/net/qeth_fs.h +++ b/drivers/s390/net/qeth_fs.h | |||
@@ -42,7 +42,7 @@ qeth_create_device_attributes_osn(struct device *dev); | |||
42 | 42 | ||
43 | extern void | 43 | extern void |
44 | qeth_remove_device_attributes_osn(struct device *dev); | 44 | qeth_remove_device_attributes_osn(struct device *dev); |
45 | 45 | ||
46 | extern int | 46 | extern int |
47 | qeth_create_driver_attributes(void); | 47 | qeth_create_driver_attributes(void); |
48 | 48 | ||
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index cb14642d97aa..9e671a48cd2f 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -513,7 +513,7 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) | |||
513 | 513 | ||
514 | QETH_DBF_TEXT(setup, 3, "setoffl"); | 514 | QETH_DBF_TEXT(setup, 3, "setoffl"); |
515 | QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); | 515 | QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); |
516 | 516 | ||
517 | if (card->dev && netif_carrier_ok(card->dev)) | 517 | if (card->dev && netif_carrier_ok(card->dev)) |
518 | netif_carrier_off(card->dev); | 518 | netif_carrier_off(card->dev); |
519 | recover_flag = card->state; | 519 | recover_flag = card->state; |
@@ -604,13 +604,13 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo, | |||
604 | list_for_each_entry(addr, &card->ip_list, entry) { | 604 | list_for_each_entry(addr, &card->ip_list, entry) { |
605 | if (card->options.layer2) { | 605 | if (card->options.layer2) { |
606 | if ((addr->type == todo->type) && | 606 | if ((addr->type == todo->type) && |
607 | (memcmp(&addr->mac, &todo->mac, | 607 | (memcmp(&addr->mac, &todo->mac, |
608 | OSA_ADDR_LEN) == 0)) { | 608 | OSA_ADDR_LEN) == 0)) { |
609 | found = 1; | 609 | found = 1; |
610 | break; | 610 | break; |
611 | } | 611 | } |
612 | continue; | 612 | continue; |
613 | } | 613 | } |
614 | if ((addr->proto == QETH_PROT_IPV4) && | 614 | if ((addr->proto == QETH_PROT_IPV4) && |
615 | (todo->proto == QETH_PROT_IPV4) && | 615 | (todo->proto == QETH_PROT_IPV4) && |
616 | (addr->type == todo->type) && | 616 | (addr->type == todo->type) && |
@@ -694,13 +694,13 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add) | |||
694 | if (card->options.layer2) { | 694 | if (card->options.layer2) { |
695 | if ((tmp->type == addr->type) && | 695 | if ((tmp->type == addr->type) && |
696 | (tmp->is_multicast == addr->is_multicast) && | 696 | (tmp->is_multicast == addr->is_multicast) && |
697 | (memcmp(&tmp->mac, &addr->mac, | 697 | (memcmp(&tmp->mac, &addr->mac, |
698 | OSA_ADDR_LEN) == 0)) { | 698 | OSA_ADDR_LEN) == 0)) { |
699 | found = 1; | 699 | found = 1; |
700 | break; | 700 | break; |
701 | } | 701 | } |
702 | continue; | 702 | continue; |
703 | } | 703 | } |
704 | if ((tmp->proto == QETH_PROT_IPV4) && | 704 | if ((tmp->proto == QETH_PROT_IPV4) && |
705 | (addr->proto == QETH_PROT_IPV4) && | 705 | (addr->proto == QETH_PROT_IPV4) && |
706 | (tmp->type == addr->type) && | 706 | (tmp->type == addr->type) && |
@@ -1173,7 +1173,7 @@ qeth_determine_card_type(struct qeth_card *card) | |||
1173 | "due to hardware limitations!\n"); | 1173 | "due to hardware limitations!\n"); |
1174 | card->qdio.no_out_queues = 1; | 1174 | card->qdio.no_out_queues = 1; |
1175 | card->qdio.default_out_queue = 0; | 1175 | card->qdio.default_out_queue = 0; |
1176 | } | 1176 | } |
1177 | return 0; | 1177 | return 0; |
1178 | } | 1178 | } |
1179 | i++; | 1179 | i++; |
@@ -1198,7 +1198,7 @@ qeth_probe_device(struct ccwgroup_device *gdev) | |||
1198 | return -ENODEV; | 1198 | return -ENODEV; |
1199 | 1199 | ||
1200 | QETH_DBF_TEXT_(setup, 2, "%s", gdev->dev.bus_id); | 1200 | QETH_DBF_TEXT_(setup, 2, "%s", gdev->dev.bus_id); |
1201 | 1201 | ||
1202 | card = qeth_alloc_card(); | 1202 | card = qeth_alloc_card(); |
1203 | if (!card) { | 1203 | if (!card) { |
1204 | put_device(dev); | 1204 | put_device(dev); |
@@ -1220,7 +1220,7 @@ qeth_probe_device(struct ccwgroup_device *gdev) | |||
1220 | put_device(dev); | 1220 | put_device(dev); |
1221 | qeth_free_card(card); | 1221 | qeth_free_card(card); |
1222 | return rc; | 1222 | return rc; |
1223 | } | 1223 | } |
1224 | if ((rc = qeth_setup_card(card))){ | 1224 | if ((rc = qeth_setup_card(card))){ |
1225 | QETH_DBF_TEXT_(setup, 2, "2err%d", rc); | 1225 | QETH_DBF_TEXT_(setup, 2, "2err%d", rc); |
1226 | put_device(dev); | 1226 | put_device(dev); |
@@ -1843,7 +1843,7 @@ struct qeth_cmd_buffer *iob) | |||
1843 | &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH); | 1843 | &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH); |
1844 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); | 1844 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | static int | 1847 | static int |
1848 | qeth_send_control_data(struct qeth_card *card, int len, | 1848 | qeth_send_control_data(struct qeth_card *card, int len, |
1849 | struct qeth_cmd_buffer *iob, | 1849 | struct qeth_cmd_buffer *iob, |
@@ -1937,7 +1937,7 @@ qeth_osn_send_control_data(struct qeth_card *card, int len, | |||
1937 | wake_up(&card->wait_q); | 1937 | wake_up(&card->wait_q); |
1938 | } | 1938 | } |
1939 | return rc; | 1939 | return rc; |
1940 | } | 1940 | } |
1941 | 1941 | ||
1942 | static inline void | 1942 | static inline void |
1943 | qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | 1943 | qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, |
@@ -1966,7 +1966,7 @@ qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | |||
1966 | memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2); | 1966 | memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2); |
1967 | return qeth_osn_send_control_data(card, s1, iob); | 1967 | return qeth_osn_send_control_data(card, s1, iob); |
1968 | } | 1968 | } |
1969 | 1969 | ||
1970 | static int | 1970 | static int |
1971 | qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | 1971 | qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, |
1972 | int (*reply_cb) | 1972 | int (*reply_cb) |
@@ -2579,7 +2579,7 @@ qeth_process_inbound_buffer(struct qeth_card *card, | |||
2579 | skb->dev = card->dev; | 2579 | skb->dev = card->dev; |
2580 | if (hdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) | 2580 | if (hdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) |
2581 | vlan_tag = qeth_layer2_rebuild_skb(card, skb, hdr); | 2581 | vlan_tag = qeth_layer2_rebuild_skb(card, skb, hdr); |
2582 | else if (hdr->hdr.l3.id == QETH_HEADER_TYPE_LAYER3) | 2582 | else if (hdr->hdr.l3.id == QETH_HEADER_TYPE_LAYER3) |
2583 | qeth_rebuild_skb(card, skb, hdr); | 2583 | qeth_rebuild_skb(card, skb, hdr); |
2584 | else { /*in case of OSN*/ | 2584 | else { /*in case of OSN*/ |
2585 | skb_push(skb, sizeof(struct qeth_hdr)); | 2585 | skb_push(skb, sizeof(struct qeth_hdr)); |
@@ -2763,7 +2763,7 @@ qeth_qdio_input_handler(struct ccw_device * ccwdev, unsigned int status, | |||
2763 | index = i % QDIO_MAX_BUFFERS_PER_Q; | 2763 | index = i % QDIO_MAX_BUFFERS_PER_Q; |
2764 | buffer = &card->qdio.in_q->bufs[index]; | 2764 | buffer = &card->qdio.in_q->bufs[index]; |
2765 | if (!((status & QDIO_STATUS_LOOK_FOR_ERROR) && | 2765 | if (!((status & QDIO_STATUS_LOOK_FOR_ERROR) && |
2766 | qeth_check_qdio_errors(buffer->buffer, | 2766 | qeth_check_qdio_errors(buffer->buffer, |
2767 | qdio_err, siga_err,"qinerr"))) | 2767 | qdio_err, siga_err,"qinerr"))) |
2768 | qeth_process_inbound_buffer(card, buffer, index); | 2768 | qeth_process_inbound_buffer(card, buffer, index); |
2769 | /* clear buffer and give back to hardware */ | 2769 | /* clear buffer and give back to hardware */ |
@@ -3187,7 +3187,7 @@ qeth_alloc_qdio_buffers(struct qeth_card *card) | |||
3187 | if (card->qdio.state == QETH_QDIO_ALLOCATED) | 3187 | if (card->qdio.state == QETH_QDIO_ALLOCATED) |
3188 | return 0; | 3188 | return 0; |
3189 | 3189 | ||
3190 | card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q), | 3190 | card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q), |
3191 | GFP_KERNEL|GFP_DMA); | 3191 | GFP_KERNEL|GFP_DMA); |
3192 | if (!card->qdio.in_q) | 3192 | if (!card->qdio.in_q) |
3193 | return - ENOMEM; | 3193 | return - ENOMEM; |
@@ -3476,7 +3476,7 @@ qeth_halt_channels(struct qeth_card *card) | |||
3476 | rc3 = qeth_halt_channel(&card->data); | 3476 | rc3 = qeth_halt_channel(&card->data); |
3477 | if (rc1) | 3477 | if (rc1) |
3478 | return rc1; | 3478 | return rc1; |
3479 | if (rc2) | 3479 | if (rc2) |
3480 | return rc2; | 3480 | return rc2; |
3481 | return rc3; | 3481 | return rc3; |
3482 | } | 3482 | } |
@@ -3491,7 +3491,7 @@ qeth_clear_channels(struct qeth_card *card) | |||
3491 | rc3 = qeth_clear_channel(&card->data); | 3491 | rc3 = qeth_clear_channel(&card->data); |
3492 | if (rc1) | 3492 | if (rc1) |
3493 | return rc1; | 3493 | return rc1; |
3494 | if (rc2) | 3494 | if (rc2) |
3495 | return rc2; | 3495 | return rc2; |
3496 | return rc3; | 3496 | return rc3; |
3497 | } | 3497 | } |
@@ -3798,10 +3798,10 @@ qeth_open(struct net_device *dev) | |||
3798 | QETH_DBF_TEXT(trace,4,"nomacadr"); | 3798 | QETH_DBF_TEXT(trace,4,"nomacadr"); |
3799 | return -EPERM; | 3799 | return -EPERM; |
3800 | } | 3800 | } |
3801 | card->dev->flags |= IFF_UP; | ||
3802 | netif_start_queue(dev); | ||
3803 | card->data.state = CH_STATE_UP; | 3801 | card->data.state = CH_STATE_UP; |
3804 | card->state = CARD_STATE_UP; | 3802 | card->state = CARD_STATE_UP; |
3803 | card->dev->flags |= IFF_UP; | ||
3804 | netif_start_queue(dev); | ||
3805 | 3805 | ||
3806 | if (!card->lan_online && netif_carrier_ok(dev)) | 3806 | if (!card->lan_online && netif_carrier_ok(dev)) |
3807 | netif_carrier_off(dev); | 3807 | netif_carrier_off(dev); |
@@ -3817,7 +3817,7 @@ qeth_stop(struct net_device *dev) | |||
3817 | 3817 | ||
3818 | card = (struct qeth_card *) dev->priv; | 3818 | card = (struct qeth_card *) dev->priv; |
3819 | 3819 | ||
3820 | netif_stop_queue(dev); | 3820 | netif_tx_disable(dev); |
3821 | card->dev->flags &= ~IFF_UP; | 3821 | card->dev->flags &= ~IFF_UP; |
3822 | if (card->state == CARD_STATE_UP) | 3822 | if (card->state == CARD_STATE_UP) |
3823 | card->state = CARD_STATE_SOFTSETUP; | 3823 | card->state = CARD_STATE_SOFTSETUP; |
@@ -3958,7 +3958,7 @@ qeth_prepare_skb(struct qeth_card *card, struct sk_buff **skb, | |||
3958 | #endif | 3958 | #endif |
3959 | *hdr = (struct qeth_hdr *) | 3959 | *hdr = (struct qeth_hdr *) |
3960 | qeth_push_skb(card, skb, sizeof(struct qeth_hdr)); | 3960 | qeth_push_skb(card, skb, sizeof(struct qeth_hdr)); |
3961 | if (hdr == NULL) | 3961 | if (*hdr == NULL) |
3962 | return -EINVAL; | 3962 | return -EINVAL; |
3963 | return 0; | 3963 | return 0; |
3964 | } | 3964 | } |
@@ -4098,7 +4098,7 @@ qeth_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
4098 | } | 4098 | } |
4099 | } else { /* passthrough */ | 4099 | } else { /* passthrough */ |
4100 | if((skb->dev->type == ARPHRD_IEEE802_TR) && | 4100 | if((skb->dev->type == ARPHRD_IEEE802_TR) && |
4101 | !memcmp(skb->data + sizeof(struct qeth_hdr) + | 4101 | !memcmp(skb->data + sizeof(struct qeth_hdr) + |
4102 | sizeof(__u16), skb->dev->broadcast, 6)) { | 4102 | sizeof(__u16), skb->dev->broadcast, 6)) { |
4103 | hdr->hdr.l3.flags = QETH_CAST_BROADCAST | | 4103 | hdr->hdr.l3.flags = QETH_CAST_BROADCAST | |
4104 | QETH_HDR_PASSTHRU; | 4104 | QETH_HDR_PASSTHRU; |
@@ -4385,7 +4385,7 @@ out: | |||
4385 | } | 4385 | } |
4386 | 4386 | ||
4387 | static inline int | 4387 | static inline int |
4388 | qeth_get_elements_no(struct qeth_card *card, void *hdr, | 4388 | qeth_get_elements_no(struct qeth_card *card, void *hdr, |
4389 | struct sk_buff *skb, int elems) | 4389 | struct sk_buff *skb, int elems) |
4390 | { | 4390 | { |
4391 | int elements_needed = 0; | 4391 | int elements_needed = 0; |
@@ -4416,6 +4416,8 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4416 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; | 4416 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; |
4417 | struct qeth_eddp_context *ctx = NULL; | 4417 | struct qeth_eddp_context *ctx = NULL; |
4418 | int tx_bytes = skb->len; | 4418 | int tx_bytes = skb->len; |
4419 | unsigned short nr_frags = skb_shinfo(skb)->nr_frags; | ||
4420 | unsigned short tso_size = skb_shinfo(skb)->tso_size; | ||
4419 | int rc; | 4421 | int rc; |
4420 | 4422 | ||
4421 | QETH_DBF_TEXT(trace, 6, "sendpkt"); | 4423 | QETH_DBF_TEXT(trace, 6, "sendpkt"); |
@@ -4441,7 +4443,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4441 | return 0; | 4443 | return 0; |
4442 | } | 4444 | } |
4443 | cast_type = qeth_get_cast_type(card, skb); | 4445 | cast_type = qeth_get_cast_type(card, skb); |
4444 | if ((cast_type == RTN_BROADCAST) && | 4446 | if ((cast_type == RTN_BROADCAST) && |
4445 | (card->info.broadcast_capable == 0)){ | 4447 | (card->info.broadcast_capable == 0)){ |
4446 | card->stats.tx_dropped++; | 4448 | card->stats.tx_dropped++; |
4447 | card->stats.tx_errors++; | 4449 | card->stats.tx_errors++; |
@@ -4463,7 +4465,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4463 | card->stats.tx_errors++; | 4465 | card->stats.tx_errors++; |
4464 | dev_kfree_skb_any(skb); | 4466 | dev_kfree_skb_any(skb); |
4465 | return NETDEV_TX_OK; | 4467 | return NETDEV_TX_OK; |
4466 | } | 4468 | } |
4467 | elements_needed++; | 4469 | elements_needed++; |
4468 | } else { | 4470 | } else { |
4469 | if ((rc = qeth_prepare_skb(card, &skb, &hdr, ipv))) { | 4471 | if ((rc = qeth_prepare_skb(card, &skb, &hdr, ipv))) { |
@@ -4498,16 +4500,16 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4498 | card->stats.tx_packets++; | 4500 | card->stats.tx_packets++; |
4499 | card->stats.tx_bytes += tx_bytes; | 4501 | card->stats.tx_bytes += tx_bytes; |
4500 | #ifdef CONFIG_QETH_PERF_STATS | 4502 | #ifdef CONFIG_QETH_PERF_STATS |
4501 | if (skb_shinfo(skb)->tso_size && | 4503 | if (tso_size && |
4502 | !(large_send == QETH_LARGE_SEND_NO)) { | 4504 | !(large_send == QETH_LARGE_SEND_NO)) { |
4503 | card->perf_stats.large_send_bytes += skb->len; | 4505 | card->perf_stats.large_send_bytes += tx_bytes; |
4504 | card->perf_stats.large_send_cnt++; | 4506 | card->perf_stats.large_send_cnt++; |
4505 | } | 4507 | } |
4506 | if (skb_shinfo(skb)->nr_frags > 0){ | 4508 | if (nr_frags > 0){ |
4507 | card->perf_stats.sg_skbs_sent++; | 4509 | card->perf_stats.sg_skbs_sent++; |
4508 | /* nr_frags + skb->data */ | 4510 | /* nr_frags + skb->data */ |
4509 | card->perf_stats.sg_frags_sent += | 4511 | card->perf_stats.sg_frags_sent += |
4510 | skb_shinfo(skb)->nr_frags + 1; | 4512 | nr_frags + 1; |
4511 | } | 4513 | } |
4512 | #endif /* CONFIG_QETH_PERF_STATS */ | 4514 | #endif /* CONFIG_QETH_PERF_STATS */ |
4513 | } | 4515 | } |
@@ -5373,7 +5375,7 @@ qeth_layer2_send_setdelvlan_cb(struct qeth_card *card, | |||
5373 | cmd = (struct qeth_ipa_cmd *) data; | 5375 | cmd = (struct qeth_ipa_cmd *) data; |
5374 | if (cmd->hdr.return_code) { | 5376 | if (cmd->hdr.return_code) { |
5375 | PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " | 5377 | PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " |
5376 | "Continuing\n",cmd->data.setdelvlan.vlan_id, | 5378 | "Continuing\n",cmd->data.setdelvlan.vlan_id, |
5377 | QETH_CARD_IFNAME(card), cmd->hdr.return_code); | 5379 | QETH_CARD_IFNAME(card), cmd->hdr.return_code); |
5378 | QETH_DBF_TEXT_(trace, 2, "L2VL%4x", cmd->hdr.command); | 5380 | QETH_DBF_TEXT_(trace, 2, "L2VL%4x", cmd->hdr.command); |
5379 | QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card)); | 5381 | QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card)); |
@@ -5393,7 +5395,7 @@ qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i, | |||
5393 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); | 5395 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); |
5394 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 5396 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
5395 | cmd->data.setdelvlan.vlan_id = i; | 5397 | cmd->data.setdelvlan.vlan_id = i; |
5396 | return qeth_send_ipa_cmd(card, iob, | 5398 | return qeth_send_ipa_cmd(card, iob, |
5397 | qeth_layer2_send_setdelvlan_cb, NULL); | 5399 | qeth_layer2_send_setdelvlan_cb, NULL); |
5398 | } | 5400 | } |
5399 | 5401 | ||
@@ -5457,7 +5459,7 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
5457 | * Examine hardware response to SET_PROMISC_MODE | 5459 | * Examine hardware response to SET_PROMISC_MODE |
5458 | */ | 5460 | */ |
5459 | static int | 5461 | static int |
5460 | qeth_setadp_promisc_mode_cb(struct qeth_card *card, | 5462 | qeth_setadp_promisc_mode_cb(struct qeth_card *card, |
5461 | struct qeth_reply *reply, | 5463 | struct qeth_reply *reply, |
5462 | unsigned long data) | 5464 | unsigned long data) |
5463 | { | 5465 | { |
@@ -5468,10 +5470,10 @@ qeth_setadp_promisc_mode_cb(struct qeth_card *card, | |||
5468 | 5470 | ||
5469 | cmd = (struct qeth_ipa_cmd *) data; | 5471 | cmd = (struct qeth_ipa_cmd *) data; |
5470 | setparms = &(cmd->data.setadapterparms); | 5472 | setparms = &(cmd->data.setadapterparms); |
5471 | 5473 | ||
5472 | qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd); | 5474 | qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd); |
5473 | if (cmd->hdr.return_code) { | 5475 | if (cmd->hdr.return_code) { |
5474 | QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code); | 5476 | QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code); |
5475 | setparms->data.mode = SET_PROMISC_MODE_OFF; | 5477 | setparms->data.mode = SET_PROMISC_MODE_OFF; |
5476 | } | 5478 | } |
5477 | card->info.promisc_mode = setparms->data.mode; | 5479 | card->info.promisc_mode = setparms->data.mode; |
@@ -5517,7 +5519,7 @@ qeth_set_multicast_list(struct net_device *dev) | |||
5517 | 5519 | ||
5518 | if (card->info.type == QETH_CARD_TYPE_OSN) | 5520 | if (card->info.type == QETH_CARD_TYPE_OSN) |
5519 | return ; | 5521 | return ; |
5520 | 5522 | ||
5521 | QETH_DBF_TEXT(trace, 3, "setmulti"); | 5523 | QETH_DBF_TEXT(trace, 3, "setmulti"); |
5522 | qeth_delete_mc_addresses(card); | 5524 | qeth_delete_mc_addresses(card); |
5523 | if (card->options.layer2) { | 5525 | if (card->options.layer2) { |
@@ -5575,7 +5577,7 @@ qeth_osn_assist(struct net_device *dev, | |||
5575 | struct qeth_cmd_buffer *iob; | 5577 | struct qeth_cmd_buffer *iob; |
5576 | struct qeth_card *card; | 5578 | struct qeth_card *card; |
5577 | int rc; | 5579 | int rc; |
5578 | 5580 | ||
5579 | QETH_DBF_TEXT(trace, 2, "osnsdmc"); | 5581 | QETH_DBF_TEXT(trace, 2, "osnsdmc"); |
5580 | if (!dev) | 5582 | if (!dev) |
5581 | return -ENODEV; | 5583 | return -ENODEV; |
@@ -5654,7 +5656,7 @@ qeth_osn_deregister(struct net_device * dev) | |||
5654 | card->osn_info.data_cb = NULL; | 5656 | card->osn_info.data_cb = NULL; |
5655 | return; | 5657 | return; |
5656 | } | 5658 | } |
5657 | 5659 | ||
5658 | static void | 5660 | static void |
5659 | qeth_delete_mc_addresses(struct qeth_card *card) | 5661 | qeth_delete_mc_addresses(struct qeth_card *card) |
5660 | { | 5662 | { |
@@ -5818,7 +5820,7 @@ qeth_add_multicast_ipv6(struct qeth_card *card) | |||
5818 | struct inet6_dev *in6_dev; | 5820 | struct inet6_dev *in6_dev; |
5819 | 5821 | ||
5820 | QETH_DBF_TEXT(trace,4,"chkmcv6"); | 5822 | QETH_DBF_TEXT(trace,4,"chkmcv6"); |
5821 | if (!qeth_is_supported(card, IPA_IPV6)) | 5823 | if (!qeth_is_supported(card, IPA_IPV6)) |
5822 | return ; | 5824 | return ; |
5823 | in6_dev = in6_dev_get(card->dev); | 5825 | in6_dev = in6_dev_get(card->dev); |
5824 | if (in6_dev == NULL) | 5826 | if (in6_dev == NULL) |
@@ -6359,12 +6361,9 @@ qeth_netdev_init(struct net_device *dev) | |||
6359 | dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; | 6361 | dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; |
6360 | dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; | 6362 | dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; |
6361 | #endif | 6363 | #endif |
6362 | dev->hard_header = card->orig_hard_header; | ||
6363 | if (qeth_get_netdev_flags(card) & IFF_NOARP) { | 6364 | if (qeth_get_netdev_flags(card) & IFF_NOARP) { |
6364 | dev->rebuild_header = NULL; | 6365 | dev->rebuild_header = NULL; |
6365 | dev->hard_header = NULL; | 6366 | dev->hard_header = NULL; |
6366 | if (card->options.fake_ll) | ||
6367 | dev->hard_header = qeth_fake_header; | ||
6368 | dev->header_cache_update = NULL; | 6367 | dev->header_cache_update = NULL; |
6369 | dev->hard_header_cache = NULL; | 6368 | dev->hard_header_cache = NULL; |
6370 | } | 6369 | } |
@@ -6373,6 +6372,9 @@ qeth_netdev_init(struct net_device *dev) | |||
6373 | if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD)) | 6372 | if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD)) |
6374 | card->dev->dev_id = card->info.unique_id & 0xffff; | 6373 | card->dev->dev_id = card->info.unique_id & 0xffff; |
6375 | #endif | 6374 | #endif |
6375 | if (card->options.fake_ll && | ||
6376 | (qeth_get_netdev_flags(card) & IFF_NOARP)) | ||
6377 | dev->hard_header = qeth_fake_header; | ||
6376 | dev->hard_header_parse = NULL; | 6378 | dev->hard_header_parse = NULL; |
6377 | dev->set_mac_address = qeth_layer2_set_mac_address; | 6379 | dev->set_mac_address = qeth_layer2_set_mac_address; |
6378 | dev->flags |= qeth_get_netdev_flags(card); | 6380 | dev->flags |= qeth_get_netdev_flags(card); |
@@ -6477,6 +6479,9 @@ retry: | |||
6477 | /*network device will be recovered*/ | 6479 | /*network device will be recovered*/ |
6478 | if (card->dev) { | 6480 | if (card->dev) { |
6479 | card->dev->hard_header = card->orig_hard_header; | 6481 | card->dev->hard_header = card->orig_hard_header; |
6482 | if (card->options.fake_ll && | ||
6483 | (qeth_get_netdev_flags(card) & IFF_NOARP)) | ||
6484 | card->dev->hard_header = qeth_fake_header; | ||
6480 | return 0; | 6485 | return 0; |
6481 | } | 6486 | } |
6482 | /* at first set_online allocate netdev */ | 6487 | /* at first set_online allocate netdev */ |
@@ -6584,7 +6589,7 @@ qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, | |||
6584 | 6589 | ||
6585 | cmd = (struct qeth_ipa_cmd *) data; | 6590 | cmd = (struct qeth_ipa_cmd *) data; |
6586 | if (!card->options.layer2 || card->info.guestlan || | 6591 | if (!card->options.layer2 || card->info.guestlan || |
6587 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { | 6592 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { |
6588 | memcpy(card->dev->dev_addr, | 6593 | memcpy(card->dev->dev_addr, |
6589 | &cmd->data.setadapterparms.data.change_addr.addr, | 6594 | &cmd->data.setadapterparms.data.change_addr.addr, |
6590 | OSA_ADDR_LEN); | 6595 | OSA_ADDR_LEN); |
@@ -7031,14 +7036,12 @@ qeth_softsetup_ipv6(struct qeth_card *card) | |||
7031 | 7036 | ||
7032 | QETH_DBF_TEXT(trace,3,"softipv6"); | 7037 | QETH_DBF_TEXT(trace,3,"softipv6"); |
7033 | 7038 | ||
7034 | netif_stop_queue(card->dev); | ||
7035 | rc = qeth_send_startlan(card, QETH_PROT_IPV6); | 7039 | rc = qeth_send_startlan(card, QETH_PROT_IPV6); |
7036 | if (rc) { | 7040 | if (rc) { |
7037 | PRINT_ERR("IPv6 startlan failed on %s\n", | 7041 | PRINT_ERR("IPv6 startlan failed on %s\n", |
7038 | QETH_CARD_IFNAME(card)); | 7042 | QETH_CARD_IFNAME(card)); |
7039 | return rc; | 7043 | return rc; |
7040 | } | 7044 | } |
7041 | netif_wake_queue(card->dev); | ||
7042 | rc = qeth_query_ipassists(card,QETH_PROT_IPV6); | 7045 | rc = qeth_query_ipassists(card,QETH_PROT_IPV6); |
7043 | if (rc) { | 7046 | if (rc) { |
7044 | PRINT_ERR("IPv6 query ipassist failed on %s\n", | 7047 | PRINT_ERR("IPv6 query ipassist failed on %s\n", |
@@ -7352,7 +7355,8 @@ qeth_set_large_send(struct qeth_card *card, enum qeth_large_send_types type) | |||
7352 | card->options.large_send = type; | 7355 | card->options.large_send = type; |
7353 | return 0; | 7356 | return 0; |
7354 | } | 7357 | } |
7355 | netif_stop_queue(card->dev); | 7358 | if (card->state == CARD_STATE_UP) |
7359 | netif_tx_disable(card->dev); | ||
7356 | card->options.large_send = type; | 7360 | card->options.large_send = type; |
7357 | switch (card->options.large_send) { | 7361 | switch (card->options.large_send) { |
7358 | case QETH_LARGE_SEND_EDDP: | 7362 | case QETH_LARGE_SEND_EDDP: |
@@ -7374,7 +7378,8 @@ qeth_set_large_send(struct qeth_card *card, enum qeth_large_send_types type) | |||
7374 | card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG); | 7378 | card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG); |
7375 | break; | 7379 | break; |
7376 | } | 7380 | } |
7377 | netif_wake_queue(card->dev); | 7381 | if (card->state == CARD_STATE_UP) |
7382 | netif_wake_queue(card->dev); | ||
7378 | return rc; | 7383 | return rc; |
7379 | } | 7384 | } |
7380 | 7385 | ||
@@ -7427,7 +7432,7 @@ qeth_softsetup_card(struct qeth_card *card) | |||
7427 | if ((rc = qeth_setrouting_v6(card))) | 7432 | if ((rc = qeth_setrouting_v6(card))) |
7428 | QETH_DBF_TEXT_(setup, 2, "5err%d", rc); | 7433 | QETH_DBF_TEXT_(setup, 2, "5err%d", rc); |
7429 | out: | 7434 | out: |
7430 | netif_stop_queue(card->dev); | 7435 | netif_tx_disable(card->dev); |
7431 | return 0; | 7436 | return 0; |
7432 | } | 7437 | } |
7433 | 7438 | ||
@@ -7567,7 +7572,7 @@ qeth_stop_card(struct qeth_card *card, int recovery_mode) | |||
7567 | if (card->read.state == CH_STATE_UP && | 7572 | if (card->read.state == CH_STATE_UP && |
7568 | card->write.state == CH_STATE_UP && | 7573 | card->write.state == CH_STATE_UP && |
7569 | (card->state == CARD_STATE_UP)) { | 7574 | (card->state == CARD_STATE_UP)) { |
7570 | if (recovery_mode && | 7575 | if (recovery_mode && |
7571 | card->info.type != QETH_CARD_TYPE_OSN) { | 7576 | card->info.type != QETH_CARD_TYPE_OSN) { |
7572 | qeth_stop(card->dev); | 7577 | qeth_stop(card->dev); |
7573 | } else { | 7578 | } else { |
@@ -7736,10 +7741,8 @@ static int | |||
7736 | qeth_register_netdev(struct qeth_card *card) | 7741 | qeth_register_netdev(struct qeth_card *card) |
7737 | { | 7742 | { |
7738 | QETH_DBF_TEXT(setup, 3, "regnetd"); | 7743 | QETH_DBF_TEXT(setup, 3, "regnetd"); |
7739 | if (card->dev->reg_state != NETREG_UNINITIALIZED) { | 7744 | if (card->dev->reg_state != NETREG_UNINITIALIZED) |
7740 | qeth_netdev_init(card->dev); | ||
7741 | return 0; | 7745 | return 0; |
7742 | } | ||
7743 | /* sysfs magic */ | 7746 | /* sysfs magic */ |
7744 | SET_NETDEV_DEV(card->dev, &card->gdev->dev); | 7747 | SET_NETDEV_DEV(card->dev, &card->gdev->dev); |
7745 | return register_netdev(card->dev); | 7748 | return register_netdev(card->dev); |
@@ -7750,7 +7753,7 @@ qeth_start_again(struct qeth_card *card, int recovery_mode) | |||
7750 | { | 7753 | { |
7751 | QETH_DBF_TEXT(setup ,2, "startag"); | 7754 | QETH_DBF_TEXT(setup ,2, "startag"); |
7752 | 7755 | ||
7753 | if (recovery_mode && | 7756 | if (recovery_mode && |
7754 | card->info.type != QETH_CARD_TYPE_OSN) { | 7757 | card->info.type != QETH_CARD_TYPE_OSN) { |
7755 | qeth_open(card->dev); | 7758 | qeth_open(card->dev); |
7756 | } else { | 7759 | } else { |
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index 011c41041029..0477c47471c5 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h | |||
@@ -445,7 +445,7 @@ enum qeth_ipa_arp_return_codes { | |||
445 | /* Helper functions */ | 445 | /* Helper functions */ |
446 | #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \ | 446 | #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \ |
447 | (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY)) | 447 | (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY)) |
448 | 448 | ||
449 | /*****************************************************************************/ | 449 | /*****************************************************************************/ |
450 | /* END OF IP Assist related definitions */ | 450 | /* END OF IP Assist related definitions */ |
451 | /*****************************************************************************/ | 451 | /*****************************************************************************/ |
@@ -490,7 +490,7 @@ extern unsigned char ULP_ENABLE[]; | |||
490 | /* Layer 2 defintions */ | 490 | /* Layer 2 defintions */ |
491 | #define QETH_PROT_LAYER2 0x08 | 491 | #define QETH_PROT_LAYER2 0x08 |
492 | #define QETH_PROT_TCPIP 0x03 | 492 | #define QETH_PROT_TCPIP 0x03 |
493 | #define QETH_PROT_OSN2 0x0a | 493 | #define QETH_PROT_OSN2 0x0a |
494 | #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50) | 494 | #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50) |
495 | #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19) | 495 | #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19) |
496 | 496 | ||
diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c index 360d782c7ada..66f2da14e6e3 100644 --- a/drivers/s390/net/qeth_proc.c +++ b/drivers/s390/net/qeth_proc.c | |||
@@ -36,7 +36,7 @@ qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) | |||
36 | { | 36 | { |
37 | struct device *dev = NULL; | 37 | struct device *dev = NULL; |
38 | loff_t nr = 0; | 38 | loff_t nr = 0; |
39 | 39 | ||
40 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 40 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); |
41 | if (*offset == 0) | 41 | if (*offset == 0) |
42 | return SEQ_START_TOKEN; | 42 | return SEQ_START_TOKEN; |
@@ -60,8 +60,8 @@ static void * | |||
60 | qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | 60 | qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) |
61 | { | 61 | { |
62 | struct device *prev, *next; | 62 | struct device *prev, *next; |
63 | 63 | ||
64 | if (it == SEQ_START_TOKEN) | 64 | if (it == SEQ_START_TOKEN) |
65 | prev = NULL; | 65 | prev = NULL; |
66 | else | 66 | else |
67 | prev = (struct device *) it; | 67 | prev = (struct device *) it; |
@@ -180,7 +180,7 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) | |||
180 | struct device *device; | 180 | struct device *device; |
181 | struct qeth_card *card; | 181 | struct qeth_card *card; |
182 | 182 | ||
183 | 183 | ||
184 | if (it == SEQ_START_TOKEN) | 184 | if (it == SEQ_START_TOKEN) |
185 | return 0; | 185 | return 0; |
186 | 186 | ||
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index 882d419e4160..185a9cfbcbdc 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -785,7 +785,7 @@ qeth_dev_large_send_store(struct device *dev, struct device_attribute *attr, con | |||
785 | } | 785 | } |
786 | if (card->options.large_send == type) | 786 | if (card->options.large_send == type) |
787 | return count; | 787 | return count; |
788 | if ((rc = qeth_set_large_send(card, type))) | 788 | if ((rc = qeth_set_large_send(card, type))) |
789 | return rc; | 789 | return rc; |
790 | return count; | 790 | return count; |
791 | } | 791 | } |
@@ -1682,7 +1682,7 @@ qeth_create_device_attributes(struct device *dev) | |||
1682 | if (card->info.type == QETH_CARD_TYPE_OSN) | 1682 | if (card->info.type == QETH_CARD_TYPE_OSN) |
1683 | return sysfs_create_group(&dev->kobj, | 1683 | return sysfs_create_group(&dev->kobj, |
1684 | &qeth_osn_device_attr_group); | 1684 | &qeth_osn_device_attr_group); |
1685 | 1685 | ||
1686 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group))) | 1686 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group))) |
1687 | return ret; | 1687 | return ret; |
1688 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group))){ | 1688 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group))){ |
@@ -1713,7 +1713,7 @@ qeth_remove_device_attributes(struct device *dev) | |||
1713 | if (card->info.type == QETH_CARD_TYPE_OSN) | 1713 | if (card->info.type == QETH_CARD_TYPE_OSN) |
1714 | return sysfs_remove_group(&dev->kobj, | 1714 | return sysfs_remove_group(&dev->kobj, |
1715 | &qeth_osn_device_attr_group); | 1715 | &qeth_osn_device_attr_group); |
1716 | 1716 | ||
1717 | sysfs_remove_group(&dev->kobj, &qeth_device_attr_group); | 1717 | sysfs_remove_group(&dev->kobj, &qeth_device_attr_group); |
1718 | sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group); | 1718 | sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group); |
1719 | sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group); | 1719 | sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group); |
diff --git a/drivers/s390/net/qeth_tso.h b/drivers/s390/net/qeth_tso.h index 1286ddea450b..24ef40ca9562 100644 --- a/drivers/s390/net/qeth_tso.h +++ b/drivers/s390/net/qeth_tso.h | |||
@@ -117,11 +117,11 @@ __qeth_fill_buffer_frag(struct sk_buff *skb, struct qdio_buffer *buffer, | |||
117 | int fragno; | 117 | int fragno; |
118 | unsigned long addr; | 118 | unsigned long addr; |
119 | int element, cnt, dlen; | 119 | int element, cnt, dlen; |
120 | 120 | ||
121 | fragno = skb_shinfo(skb)->nr_frags; | 121 | fragno = skb_shinfo(skb)->nr_frags; |
122 | element = *next_element_to_fill; | 122 | element = *next_element_to_fill; |
123 | dlen = 0; | 123 | dlen = 0; |
124 | 124 | ||
125 | if (is_tso) | 125 | if (is_tso) |
126 | buffer->element[element].flags = | 126 | buffer->element[element].flags = |
127 | SBAL_FLAGS_MIDDLE_FRAG; | 127 | SBAL_FLAGS_MIDDLE_FRAG; |
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 383a95f34a0d..239e108b8ed1 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c | |||
@@ -392,13 +392,16 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, | |||
392 | return -ENOMEM; | 392 | return -ENOMEM; |
393 | } | 393 | } |
394 | 394 | ||
395 | prom_getproperty(op.op_nodeid, str, tmp, len); | 395 | cnt = prom_getproperty(op.op_nodeid, str, tmp, len); |
396 | 396 | if (cnt <= 0) { | |
397 | tmp[len] = '\0'; | 397 | error = -EINVAL; |
398 | } else { | ||
399 | tmp[len] = '\0'; | ||
398 | 400 | ||
399 | if (__copy_to_user(argp, &op, sizeof(op)) != 0 | 401 | if (__copy_to_user(argp, &op, sizeof(op)) != 0 || |
400 | || copy_to_user(op.op_buf, tmp, len) != 0) | 402 | copy_to_user(op.op_buf, tmp, len) != 0) |
401 | error = -EFAULT; | 403 | error = -EFAULT; |
404 | } | ||
402 | 405 | ||
403 | kfree(tmp); | 406 | kfree(tmp); |
404 | kfree(str); | 407 | kfree(str); |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index bd147207f25d..b046ffa22101 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -864,6 +864,9 @@ static unsigned int ata_id_xfermask(const u16 *id) | |||
864 | /** | 864 | /** |
865 | * ata_port_queue_task - Queue port_task | 865 | * ata_port_queue_task - Queue port_task |
866 | * @ap: The ata_port to queue port_task for | 866 | * @ap: The ata_port to queue port_task for |
867 | * @fn: workqueue function to be scheduled | ||
868 | * @data: data value to pass to workqueue function | ||
869 | * @delay: delay time for workqueue function | ||
867 | * | 870 | * |
868 | * Schedule @fn(@data) for execution after @delay jiffies using | 871 | * Schedule @fn(@data) for execution after @delay jiffies using |
869 | * port_task. There is one port_task per port and it's the | 872 | * port_task. There is one port_task per port and it's the |
@@ -2739,6 +2742,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_port *ap, | |||
2739 | * ata_dev_init_params - Issue INIT DEV PARAMS command | 2742 | * ata_dev_init_params - Issue INIT DEV PARAMS command |
2740 | * @ap: Port associated with device @dev | 2743 | * @ap: Port associated with device @dev |
2741 | * @dev: Device to which command will be sent | 2744 | * @dev: Device to which command will be sent |
2745 | * @heads: Number of heads (taskfile parameter) | ||
2746 | * @sectors: Number of sectors (taskfile parameter) | ||
2742 | * | 2747 | * |
2743 | * LOCKING: | 2748 | * LOCKING: |
2744 | * Kernel thread context (may sleep) | 2749 | * Kernel thread context (may sleep) |
@@ -3638,6 +3643,8 @@ static void ata_pio_block(struct ata_port *ap) | |||
3638 | 3643 | ||
3639 | ata_pio_sector(qc); | 3644 | ata_pio_sector(qc); |
3640 | } | 3645 | } |
3646 | |||
3647 | ata_altstatus(ap); /* flush */ | ||
3641 | } | 3648 | } |
3642 | 3649 | ||
3643 | static void ata_pio_error(struct ata_port *ap) | 3650 | static void ata_pio_error(struct ata_port *ap) |
@@ -3754,11 +3761,14 @@ static void atapi_packet_task(void *_data) | |||
3754 | spin_lock_irqsave(&ap->host_set->lock, flags); | 3761 | spin_lock_irqsave(&ap->host_set->lock, flags); |
3755 | ap->flags &= ~ATA_FLAG_NOINTR; | 3762 | ap->flags &= ~ATA_FLAG_NOINTR; |
3756 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); | 3763 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); |
3764 | ata_altstatus(ap); /* flush */ | ||
3765 | |||
3757 | if (qc->tf.protocol == ATA_PROT_ATAPI_DMA) | 3766 | if (qc->tf.protocol == ATA_PROT_ATAPI_DMA) |
3758 | ap->ops->bmdma_start(qc); /* initiate bmdma */ | 3767 | ap->ops->bmdma_start(qc); /* initiate bmdma */ |
3759 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 3768 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
3760 | } else { | 3769 | } else { |
3761 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); | 3770 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); |
3771 | ata_altstatus(ap); /* flush */ | ||
3762 | 3772 | ||
3763 | /* PIO commands are handled by polling */ | 3773 | /* PIO commands are handled by polling */ |
3764 | ap->hsm_task_state = HSM_ST; | 3774 | ap->hsm_task_state = HSM_ST; |
@@ -4287,6 +4297,7 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev) | |||
4287 | int ata_device_resume(struct ata_port *ap, struct ata_device *dev) | 4297 | int ata_device_resume(struct ata_port *ap, struct ata_device *dev) |
4288 | { | 4298 | { |
4289 | if (ap->flags & ATA_FLAG_SUSPENDED) { | 4299 | if (ap->flags & ATA_FLAG_SUSPENDED) { |
4300 | ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 200000); | ||
4290 | ap->flags &= ~ATA_FLAG_SUSPENDED; | 4301 | ap->flags &= ~ATA_FLAG_SUSPENDED; |
4291 | ata_set_mode(ap); | 4302 | ata_set_mode(ap); |
4292 | } | 4303 | } |
@@ -4302,6 +4313,7 @@ int ata_device_resume(struct ata_port *ap, struct ata_device *dev) | |||
4302 | * ata_device_suspend - prepare a device for suspend | 4313 | * ata_device_suspend - prepare a device for suspend |
4303 | * @ap: port the device is connected to | 4314 | * @ap: port the device is connected to |
4304 | * @dev: the device to suspend | 4315 | * @dev: the device to suspend |
4316 | * @state: target power management state | ||
4305 | * | 4317 | * |
4306 | * Flush the cache on the drive, if appropriate, then issue a | 4318 | * Flush the cache on the drive, if appropriate, then issue a |
4307 | * standbynow command. | 4319 | * standbynow command. |
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index fee843fab1c7..108910f512e4 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -982,6 +982,12 @@ static int device_check(ppa_struct *dev) | |||
982 | return -ENODEV; | 982 | return -ENODEV; |
983 | } | 983 | } |
984 | 984 | ||
985 | static int ppa_adjust_queue(struct scsi_device *device) | ||
986 | { | ||
987 | blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH); | ||
988 | return 0; | ||
989 | } | ||
990 | |||
985 | static struct scsi_host_template ppa_template = { | 991 | static struct scsi_host_template ppa_template = { |
986 | .module = THIS_MODULE, | 992 | .module = THIS_MODULE, |
987 | .proc_name = "ppa", | 993 | .proc_name = "ppa", |
@@ -997,6 +1003,7 @@ static struct scsi_host_template ppa_template = { | |||
997 | .cmd_per_lun = 1, | 1003 | .cmd_per_lun = 1, |
998 | .use_clustering = ENABLE_CLUSTERING, | 1004 | .use_clustering = ENABLE_CLUSTERING, |
999 | .can_queue = 1, | 1005 | .can_queue = 1, |
1006 | .slave_alloc = ppa_adjust_queue, | ||
1000 | }; | 1007 | }; |
1001 | 1008 | ||
1002 | /*************************************************************************** | 1009 | /*************************************************************************** |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index d5fdcb9a8842..f16f92a6ec0f 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <asm/io.h> | 37 | #include <asm/io.h> |
38 | 38 | ||
39 | #define DRV_NAME "sata_mv" | 39 | #define DRV_NAME "sata_mv" |
40 | #define DRV_VERSION "0.6" | 40 | #define DRV_VERSION "0.7" |
41 | 41 | ||
42 | enum { | 42 | enum { |
43 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 43 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
@@ -50,6 +50,12 @@ enum { | |||
50 | 50 | ||
51 | MV_PCI_REG_BASE = 0, | 51 | MV_PCI_REG_BASE = 0, |
52 | MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ | 52 | MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ |
53 | MV_IRQ_COAL_CAUSE = (MV_IRQ_COAL_REG_BASE + 0x08), | ||
54 | MV_IRQ_COAL_CAUSE_LO = (MV_IRQ_COAL_REG_BASE + 0x88), | ||
55 | MV_IRQ_COAL_CAUSE_HI = (MV_IRQ_COAL_REG_BASE + 0x8c), | ||
56 | MV_IRQ_COAL_THRESHOLD = (MV_IRQ_COAL_REG_BASE + 0xcc), | ||
57 | MV_IRQ_COAL_TIME_THRESHOLD = (MV_IRQ_COAL_REG_BASE + 0xd0), | ||
58 | |||
53 | MV_SATAHC0_REG_BASE = 0x20000, | 59 | MV_SATAHC0_REG_BASE = 0x20000, |
54 | MV_FLASH_CTL = 0x1046c, | 60 | MV_FLASH_CTL = 0x1046c, |
55 | MV_GPIO_PORT_CTL = 0x104f0, | 61 | MV_GPIO_PORT_CTL = 0x104f0, |
@@ -302,9 +308,6 @@ struct mv_port_priv { | |||
302 | dma_addr_t crpb_dma; | 308 | dma_addr_t crpb_dma; |
303 | struct mv_sg *sg_tbl; | 309 | struct mv_sg *sg_tbl; |
304 | dma_addr_t sg_tbl_dma; | 310 | dma_addr_t sg_tbl_dma; |
305 | |||
306 | unsigned req_producer; /* cp of req_in_ptr */ | ||
307 | unsigned rsp_consumer; /* cp of rsp_out_ptr */ | ||
308 | u32 pp_flags; | 311 | u32 pp_flags; |
309 | }; | 312 | }; |
310 | 313 | ||
@@ -937,8 +940,6 @@ static int mv_port_start(struct ata_port *ap) | |||
937 | writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, | 940 | writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, |
938 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 941 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
939 | 942 | ||
940 | pp->req_producer = pp->rsp_consumer = 0; | ||
941 | |||
942 | /* Don't turn on EDMA here...do it before DMA commands only. Else | 943 | /* Don't turn on EDMA here...do it before DMA commands only. Else |
943 | * we'll be unable to send non-data, PIO, etc due to restricted access | 944 | * we'll be unable to send non-data, PIO, etc due to restricted access |
944 | * to shadow regs. | 945 | * to shadow regs. |
@@ -1022,16 +1023,16 @@ static void mv_fill_sg(struct ata_queued_cmd *qc) | |||
1022 | } | 1023 | } |
1023 | } | 1024 | } |
1024 | 1025 | ||
1025 | static inline unsigned mv_inc_q_index(unsigned *index) | 1026 | static inline unsigned mv_inc_q_index(unsigned index) |
1026 | { | 1027 | { |
1027 | *index = (*index + 1) & MV_MAX_Q_DEPTH_MASK; | 1028 | return (index + 1) & MV_MAX_Q_DEPTH_MASK; |
1028 | return *index; | ||
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last) | 1031 | static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last) |
1032 | { | 1032 | { |
1033 | *cmdw = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | | 1033 | u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | |
1034 | (last ? CRQB_CMD_LAST : 0); | 1034 | (last ? CRQB_CMD_LAST : 0); |
1035 | *cmdw = cpu_to_le16(tmp); | ||
1035 | } | 1036 | } |
1036 | 1037 | ||
1037 | /** | 1038 | /** |
@@ -1053,15 +1054,11 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
1053 | u16 *cw; | 1054 | u16 *cw; |
1054 | struct ata_taskfile *tf; | 1055 | struct ata_taskfile *tf; |
1055 | u16 flags = 0; | 1056 | u16 flags = 0; |
1057 | unsigned in_index; | ||
1056 | 1058 | ||
1057 | if (ATA_PROT_DMA != qc->tf.protocol) | 1059 | if (ATA_PROT_DMA != qc->tf.protocol) |
1058 | return; | 1060 | return; |
1059 | 1061 | ||
1060 | /* the req producer index should be the same as we remember it */ | ||
1061 | WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> | ||
1062 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | ||
1063 | pp->req_producer); | ||
1064 | |||
1065 | /* Fill in command request block | 1062 | /* Fill in command request block |
1066 | */ | 1063 | */ |
1067 | if (!(qc->tf.flags & ATA_TFLAG_WRITE)) | 1064 | if (!(qc->tf.flags & ATA_TFLAG_WRITE)) |
@@ -1069,13 +1066,17 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
1069 | WARN_ON(MV_MAX_Q_DEPTH <= qc->tag); | 1066 | WARN_ON(MV_MAX_Q_DEPTH <= qc->tag); |
1070 | flags |= qc->tag << CRQB_TAG_SHIFT; | 1067 | flags |= qc->tag << CRQB_TAG_SHIFT; |
1071 | 1068 | ||
1072 | pp->crqb[pp->req_producer].sg_addr = | 1069 | /* get current queue index from hardware */ |
1070 | in_index = (readl(mv_ap_base(ap) + EDMA_REQ_Q_IN_PTR_OFS) | ||
1071 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1072 | |||
1073 | pp->crqb[in_index].sg_addr = | ||
1073 | cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); | 1074 | cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); |
1074 | pp->crqb[pp->req_producer].sg_addr_hi = | 1075 | pp->crqb[in_index].sg_addr_hi = |
1075 | cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); | 1076 | cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); |
1076 | pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); | 1077 | pp->crqb[in_index].ctrl_flags = cpu_to_le16(flags); |
1077 | 1078 | ||
1078 | cw = &pp->crqb[pp->req_producer].ata_cmd[0]; | 1079 | cw = &pp->crqb[in_index].ata_cmd[0]; |
1079 | tf = &qc->tf; | 1080 | tf = &qc->tf; |
1080 | 1081 | ||
1081 | /* Sadly, the CRQB cannot accomodate all registers--there are | 1082 | /* Sadly, the CRQB cannot accomodate all registers--there are |
@@ -1144,16 +1145,12 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc) | |||
1144 | struct mv_port_priv *pp = ap->private_data; | 1145 | struct mv_port_priv *pp = ap->private_data; |
1145 | struct mv_crqb_iie *crqb; | 1146 | struct mv_crqb_iie *crqb; |
1146 | struct ata_taskfile *tf; | 1147 | struct ata_taskfile *tf; |
1148 | unsigned in_index; | ||
1147 | u32 flags = 0; | 1149 | u32 flags = 0; |
1148 | 1150 | ||
1149 | if (ATA_PROT_DMA != qc->tf.protocol) | 1151 | if (ATA_PROT_DMA != qc->tf.protocol) |
1150 | return; | 1152 | return; |
1151 | 1153 | ||
1152 | /* the req producer index should be the same as we remember it */ | ||
1153 | WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> | ||
1154 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | ||
1155 | pp->req_producer); | ||
1156 | |||
1157 | /* Fill in Gen IIE command request block | 1154 | /* Fill in Gen IIE command request block |
1158 | */ | 1155 | */ |
1159 | if (!(qc->tf.flags & ATA_TFLAG_WRITE)) | 1156 | if (!(qc->tf.flags & ATA_TFLAG_WRITE)) |
@@ -1162,7 +1159,11 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc) | |||
1162 | WARN_ON(MV_MAX_Q_DEPTH <= qc->tag); | 1159 | WARN_ON(MV_MAX_Q_DEPTH <= qc->tag); |
1163 | flags |= qc->tag << CRQB_TAG_SHIFT; | 1160 | flags |= qc->tag << CRQB_TAG_SHIFT; |
1164 | 1161 | ||
1165 | crqb = (struct mv_crqb_iie *) &pp->crqb[pp->req_producer]; | 1162 | /* get current queue index from hardware */ |
1163 | in_index = (readl(mv_ap_base(ap) + EDMA_REQ_Q_IN_PTR_OFS) | ||
1164 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1165 | |||
1166 | crqb = (struct mv_crqb_iie *) &pp->crqb[in_index]; | ||
1166 | crqb->addr = cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); | 1167 | crqb->addr = cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); |
1167 | crqb->addr_hi = cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); | 1168 | crqb->addr_hi = cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); |
1168 | crqb->flags = cpu_to_le32(flags); | 1169 | crqb->flags = cpu_to_le32(flags); |
@@ -1210,6 +1211,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) | |||
1210 | { | 1211 | { |
1211 | void __iomem *port_mmio = mv_ap_base(qc->ap); | 1212 | void __iomem *port_mmio = mv_ap_base(qc->ap); |
1212 | struct mv_port_priv *pp = qc->ap->private_data; | 1213 | struct mv_port_priv *pp = qc->ap->private_data; |
1214 | unsigned in_index; | ||
1213 | u32 in_ptr; | 1215 | u32 in_ptr; |
1214 | 1216 | ||
1215 | if (ATA_PROT_DMA != qc->tf.protocol) { | 1217 | if (ATA_PROT_DMA != qc->tf.protocol) { |
@@ -1221,23 +1223,20 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) | |||
1221 | return ata_qc_issue_prot(qc); | 1223 | return ata_qc_issue_prot(qc); |
1222 | } | 1224 | } |
1223 | 1225 | ||
1224 | in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS); | 1226 | in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS); |
1227 | in_index = (in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1225 | 1228 | ||
1226 | /* the req producer index should be the same as we remember it */ | ||
1227 | WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | ||
1228 | pp->req_producer); | ||
1229 | /* until we do queuing, the queue should be empty at this point */ | 1229 | /* until we do queuing, the queue should be empty at this point */ |
1230 | WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | 1230 | WARN_ON(in_index != ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) |
1231 | ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> | 1231 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); |
1232 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); | ||
1233 | 1232 | ||
1234 | mv_inc_q_index(&pp->req_producer); /* now incr producer index */ | 1233 | in_index = mv_inc_q_index(in_index); /* now incr producer index */ |
1235 | 1234 | ||
1236 | mv_start_dma(port_mmio, pp); | 1235 | mv_start_dma(port_mmio, pp); |
1237 | 1236 | ||
1238 | /* and write the request in pointer to kick the EDMA to life */ | 1237 | /* and write the request in pointer to kick the EDMA to life */ |
1239 | in_ptr &= EDMA_REQ_Q_BASE_LO_MASK; | 1238 | in_ptr &= EDMA_REQ_Q_BASE_LO_MASK; |
1240 | in_ptr |= pp->req_producer << EDMA_REQ_Q_PTR_SHIFT; | 1239 | in_ptr |= in_index << EDMA_REQ_Q_PTR_SHIFT; |
1241 | writelfl(in_ptr, port_mmio + EDMA_REQ_Q_IN_PTR_OFS); | 1240 | writelfl(in_ptr, port_mmio + EDMA_REQ_Q_IN_PTR_OFS); |
1242 | 1241 | ||
1243 | return 0; | 1242 | return 0; |
@@ -1260,28 +1259,26 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1260 | { | 1259 | { |
1261 | void __iomem *port_mmio = mv_ap_base(ap); | 1260 | void __iomem *port_mmio = mv_ap_base(ap); |
1262 | struct mv_port_priv *pp = ap->private_data; | 1261 | struct mv_port_priv *pp = ap->private_data; |
1262 | unsigned out_index; | ||
1263 | u32 out_ptr; | 1263 | u32 out_ptr; |
1264 | u8 ata_status; | 1264 | u8 ata_status; |
1265 | 1265 | ||
1266 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1266 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1267 | 1267 | out_index = (out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | |
1268 | /* the response consumer index should be the same as we remember it */ | ||
1269 | WARN_ON(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | ||
1270 | pp->rsp_consumer); | ||
1271 | 1268 | ||
1272 | ata_status = pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT; | 1269 | ata_status = le16_to_cpu(pp->crpb[out_index].flags) |
1270 | >> CRPB_FLAG_STATUS_SHIFT; | ||
1273 | 1271 | ||
1274 | /* increment our consumer index... */ | 1272 | /* increment our consumer index... */ |
1275 | pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); | 1273 | out_index = mv_inc_q_index(out_index); |
1276 | 1274 | ||
1277 | /* and, until we do NCQ, there should only be 1 CRPB waiting */ | 1275 | /* and, until we do NCQ, there should only be 1 CRPB waiting */ |
1278 | WARN_ON(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> | 1276 | WARN_ON(out_index != ((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) |
1279 | EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | 1277 | >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); |
1280 | pp->rsp_consumer); | ||
1281 | 1278 | ||
1282 | /* write out our inc'd consumer index so EDMA knows we're caught up */ | 1279 | /* write out our inc'd consumer index so EDMA knows we're caught up */ |
1283 | out_ptr &= EDMA_RSP_Q_BASE_LO_MASK; | 1280 | out_ptr &= EDMA_RSP_Q_BASE_LO_MASK; |
1284 | out_ptr |= pp->rsp_consumer << EDMA_RSP_Q_PTR_SHIFT; | 1281 | out_ptr |= out_index << EDMA_RSP_Q_PTR_SHIFT; |
1285 | writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1282 | writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1286 | 1283 | ||
1287 | /* Return ATA status register for completed CRPB */ | 1284 | /* Return ATA status register for completed CRPB */ |
@@ -1291,6 +1288,7 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1291 | /** | 1288 | /** |
1292 | * mv_err_intr - Handle error interrupts on the port | 1289 | * mv_err_intr - Handle error interrupts on the port |
1293 | * @ap: ATA channel to manipulate | 1290 | * @ap: ATA channel to manipulate |
1291 | * @reset_allowed: bool: 0 == don't trigger from reset here | ||
1294 | * | 1292 | * |
1295 | * In most cases, just clear the interrupt and move on. However, | 1293 | * In most cases, just clear the interrupt and move on. However, |
1296 | * some cases require an eDMA reset, which is done right before | 1294 | * some cases require an eDMA reset, which is done right before |
@@ -1301,7 +1299,7 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1301 | * LOCKING: | 1299 | * LOCKING: |
1302 | * Inherited from caller. | 1300 | * Inherited from caller. |
1303 | */ | 1301 | */ |
1304 | static void mv_err_intr(struct ata_port *ap) | 1302 | static void mv_err_intr(struct ata_port *ap, int reset_allowed) |
1305 | { | 1303 | { |
1306 | void __iomem *port_mmio = mv_ap_base(ap); | 1304 | void __iomem *port_mmio = mv_ap_base(ap); |
1307 | u32 edma_err_cause, serr = 0; | 1305 | u32 edma_err_cause, serr = 0; |
@@ -1323,9 +1321,8 @@ static void mv_err_intr(struct ata_port *ap) | |||
1323 | writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1321 | writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1324 | 1322 | ||
1325 | /* check for fatal here and recover if needed */ | 1323 | /* check for fatal here and recover if needed */ |
1326 | if (EDMA_ERR_FATAL & edma_err_cause) { | 1324 | if (reset_allowed && (EDMA_ERR_FATAL & edma_err_cause)) |
1327 | mv_stop_and_reset(ap); | 1325 | mv_stop_and_reset(ap); |
1328 | } | ||
1329 | } | 1326 | } |
1330 | 1327 | ||
1331 | /** | 1328 | /** |
@@ -1374,12 +1371,12 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1374 | struct ata_port *ap = host_set->ports[port]; | 1371 | struct ata_port *ap = host_set->ports[port]; |
1375 | struct mv_port_priv *pp = ap->private_data; | 1372 | struct mv_port_priv *pp = ap->private_data; |
1376 | 1373 | ||
1377 | hard_port = port & MV_PORT_MASK; /* range 0-3 */ | 1374 | hard_port = mv_hardport_from_port(port); /* range 0..3 */ |
1378 | handled = 0; /* ensure ata_status is set if handled++ */ | 1375 | handled = 0; /* ensure ata_status is set if handled++ */ |
1379 | 1376 | ||
1380 | /* Note that DEV_IRQ might happen spuriously during EDMA, | 1377 | /* Note that DEV_IRQ might happen spuriously during EDMA, |
1381 | * and should be ignored in such cases. We could mask it, | 1378 | * and should be ignored in such cases. |
1382 | * but it's pretty rare and may not be worth the overhead. | 1379 | * The cause of this is still under investigation. |
1383 | */ | 1380 | */ |
1384 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { | 1381 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { |
1385 | /* EDMA: check for response queue interrupt */ | 1382 | /* EDMA: check for response queue interrupt */ |
@@ -1393,6 +1390,11 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1393 | ata_status = readb((void __iomem *) | 1390 | ata_status = readb((void __iomem *) |
1394 | ap->ioaddr.status_addr); | 1391 | ap->ioaddr.status_addr); |
1395 | handled = 1; | 1392 | handled = 1; |
1393 | /* ignore spurious intr if drive still BUSY */ | ||
1394 | if (ata_status & ATA_BUSY) { | ||
1395 | ata_status = 0; | ||
1396 | handled = 0; | ||
1397 | } | ||
1396 | } | 1398 | } |
1397 | } | 1399 | } |
1398 | 1400 | ||
@@ -1406,7 +1408,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1406 | shift++; /* skip bit 8 in the HC Main IRQ reg */ | 1408 | shift++; /* skip bit 8 in the HC Main IRQ reg */ |
1407 | } | 1409 | } |
1408 | if ((PORT0_ERR << shift) & relevant) { | 1410 | if ((PORT0_ERR << shift) & relevant) { |
1409 | mv_err_intr(ap); | 1411 | mv_err_intr(ap, 1); |
1410 | err_mask |= AC_ERR_OTHER; | 1412 | err_mask |= AC_ERR_OTHER; |
1411 | handled = 1; | 1413 | handled = 1; |
1412 | } | 1414 | } |
@@ -1448,6 +1450,7 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1448 | struct ata_host_set *host_set = dev_instance; | 1450 | struct ata_host_set *host_set = dev_instance; |
1449 | unsigned int hc, handled = 0, n_hcs; | 1451 | unsigned int hc, handled = 0, n_hcs; |
1450 | void __iomem *mmio = host_set->mmio_base; | 1452 | void __iomem *mmio = host_set->mmio_base; |
1453 | struct mv_host_priv *hpriv; | ||
1451 | u32 irq_stat; | 1454 | u32 irq_stat; |
1452 | 1455 | ||
1453 | irq_stat = readl(mmio + HC_MAIN_IRQ_CAUSE_OFS); | 1456 | irq_stat = readl(mmio + HC_MAIN_IRQ_CAUSE_OFS); |
@@ -1469,6 +1472,17 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1469 | handled++; | 1472 | handled++; |
1470 | } | 1473 | } |
1471 | } | 1474 | } |
1475 | |||
1476 | hpriv = host_set->private_data; | ||
1477 | if (IS_60XX(hpriv)) { | ||
1478 | /* deal with the interrupt coalescing bits */ | ||
1479 | if (irq_stat & (TRAN_LO_DONE | TRAN_HI_DONE | PORTS_0_7_COAL_DONE)) { | ||
1480 | writelfl(0, mmio + MV_IRQ_COAL_CAUSE_LO); | ||
1481 | writelfl(0, mmio + MV_IRQ_COAL_CAUSE_HI); | ||
1482 | writelfl(0, mmio + MV_IRQ_COAL_CAUSE); | ||
1483 | } | ||
1484 | } | ||
1485 | |||
1472 | if (PCI_ERR & irq_stat) { | 1486 | if (PCI_ERR & irq_stat) { |
1473 | printk(KERN_ERR DRV_NAME ": PCI ERROR; PCI IRQ cause=0x%08x\n", | 1487 | printk(KERN_ERR DRV_NAME ": PCI ERROR; PCI IRQ cause=0x%08x\n", |
1474 | readl(mmio + PCI_IRQ_CAUSE_OFS)); | 1488 | readl(mmio + PCI_IRQ_CAUSE_OFS)); |
@@ -1867,7 +1881,8 @@ static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
1867 | 1881 | ||
1868 | if (IS_60XX(hpriv)) { | 1882 | if (IS_60XX(hpriv)) { |
1869 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); | 1883 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); |
1870 | ifctl |= (1 << 12) | (1 << 7); | 1884 | ifctl |= (1 << 7); /* enable gen2i speed */ |
1885 | ifctl = (ifctl & 0xfff) | 0x9b1000; /* from chip spec */ | ||
1871 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); | 1886 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); |
1872 | } | 1887 | } |
1873 | 1888 | ||
@@ -2020,6 +2035,7 @@ static void mv_phy_reset(struct ata_port *ap) | |||
2020 | static void mv_eng_timeout(struct ata_port *ap) | 2035 | static void mv_eng_timeout(struct ata_port *ap) |
2021 | { | 2036 | { |
2022 | struct ata_queued_cmd *qc; | 2037 | struct ata_queued_cmd *qc; |
2038 | unsigned long flags; | ||
2023 | 2039 | ||
2024 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); | 2040 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); |
2025 | DPRINTK("All regs @ start of eng_timeout\n"); | 2041 | DPRINTK("All regs @ start of eng_timeout\n"); |
@@ -2031,11 +2047,16 @@ static void mv_eng_timeout(struct ata_port *ap) | |||
2031 | ap->host_set->mmio_base, ap, qc, qc->scsicmd, | 2047 | ap->host_set->mmio_base, ap, qc, qc->scsicmd, |
2032 | &qc->scsicmd->cmnd); | 2048 | &qc->scsicmd->cmnd); |
2033 | 2049 | ||
2034 | mv_err_intr(ap); | 2050 | spin_lock_irqsave(&ap->host_set->lock, flags); |
2051 | mv_err_intr(ap, 0); | ||
2035 | mv_stop_and_reset(ap); | 2052 | mv_stop_and_reset(ap); |
2053 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
2036 | 2054 | ||
2037 | qc->err_mask |= AC_ERR_TIMEOUT; | 2055 | WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE)); |
2038 | ata_eh_qc_complete(qc); | 2056 | if (qc->flags & ATA_QCFLAG_ACTIVE) { |
2057 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
2058 | ata_eh_qc_complete(qc); | ||
2059 | } | ||
2039 | } | 2060 | } |
2040 | 2061 | ||
2041 | /** | 2062 | /** |
@@ -2229,7 +2250,8 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, | |||
2229 | void __iomem *port_mmio = mv_port_base(mmio, port); | 2250 | void __iomem *port_mmio = mv_port_base(mmio, port); |
2230 | 2251 | ||
2231 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); | 2252 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); |
2232 | ifctl |= (1 << 12); | 2253 | ifctl |= (1 << 7); /* enable gen2i speed */ |
2254 | ifctl = (ifctl & 0xfff) | 0x9b1000; /* from chip spec */ | ||
2233 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); | 2255 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); |
2234 | } | 2256 | } |
2235 | 2257 | ||
@@ -2330,6 +2352,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2330 | if (rc) { | 2352 | if (rc) { |
2331 | return rc; | 2353 | return rc; |
2332 | } | 2354 | } |
2355 | pci_set_master(pdev); | ||
2333 | 2356 | ||
2334 | rc = pci_request_regions(pdev, DRV_NAME); | 2357 | rc = pci_request_regions(pdev, DRV_NAME); |
2335 | if (rc) { | 2358 | if (rc) { |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index f7264fd611c2..cb9082fd7e2f 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -454,7 +454,7 @@ static int sil24_softreset(struct ata_port *ap, int verbose, | |||
454 | */ | 454 | */ |
455 | msleep(10); | 455 | msleep(10); |
456 | 456 | ||
457 | prb->ctrl = PRB_CTRL_SRST; | 457 | prb->ctrl = cpu_to_le16(PRB_CTRL_SRST); |
458 | prb->fis[1] = 0; /* no PM yet */ | 458 | prb->fis[1] = 0; /* no PM yet */ |
459 | 459 | ||
460 | writel((u32)paddr, port + PORT_CMD_ACTIVATE); | 460 | writel((u32)paddr, port + PORT_CMD_ACTIVATE); |
@@ -551,9 +551,9 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) | |||
551 | 551 | ||
552 | if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { | 552 | if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { |
553 | if (qc->tf.flags & ATA_TFLAG_WRITE) | 553 | if (qc->tf.flags & ATA_TFLAG_WRITE) |
554 | prb->ctrl = PRB_CTRL_PACKET_WRITE; | 554 | prb->ctrl = cpu_to_le16(PRB_CTRL_PACKET_WRITE); |
555 | else | 555 | else |
556 | prb->ctrl = PRB_CTRL_PACKET_READ; | 556 | prb->ctrl = cpu_to_le16(PRB_CTRL_PACKET_READ); |
557 | } else | 557 | } else |
558 | prb->ctrl = 0; | 558 | prb->ctrl = 0; |
559 | 559 | ||
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 941c1e15c899..62f8cb7b3d2b 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -165,6 +165,7 @@ static struct { | |||
165 | {"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD}, | 165 | {"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD}, |
166 | {"HP", "C1557A", NULL, BLIST_FORCELUN}, | 166 | {"HP", "C1557A", NULL, BLIST_FORCELUN}, |
167 | {"HP", "C3323-300", "4269", BLIST_NOTQ}, | 167 | {"HP", "C3323-300", "4269", BLIST_NOTQ}, |
168 | {"HP", "C5713A", NULL, BLIST_NOREPORTLUN}, | ||
168 | {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN}, | 169 | {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN}, |
169 | {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, | 170 | {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, |
170 | {"IBM", "2105", NULL, BLIST_RETRY_HWERROR}, | 171 | {"IBM", "2105", NULL, BLIST_RETRY_HWERROR}, |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 764a8b375ead..faee4757c03a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -367,7 +367,7 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl, | |||
367 | int nsegs, unsigned bufflen, gfp_t gfp) | 367 | int nsegs, unsigned bufflen, gfp_t gfp) |
368 | { | 368 | { |
369 | struct request_queue *q = rq->q; | 369 | struct request_queue *q = rq->q; |
370 | int nr_pages = (bufflen + PAGE_SIZE - 1) >> PAGE_SHIFT; | 370 | int nr_pages = (bufflen + sgl[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; |
371 | unsigned int data_len = 0, len, bytes, off; | 371 | unsigned int data_len = 0, len, bytes, off; |
372 | struct page *page; | 372 | struct page *page; |
373 | struct bio *bio = NULL; | 373 | struct bio *bio = NULL; |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 8b6d65e21bae..f3b16066387c 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -955,7 +955,8 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, | |||
955 | list_for_each_entry(rphy, &sas_host->rphy_list, list) { | 955 | list_for_each_entry(rphy, &sas_host->rphy_list, list) { |
956 | struct sas_phy *parent = dev_to_phy(rphy->dev.parent); | 956 | struct sas_phy *parent = dev_to_phy(rphy->dev.parent); |
957 | 957 | ||
958 | if (rphy->scsi_target_id == -1) | 958 | if (rphy->identify.device_type != SAS_END_DEVICE || |
959 | rphy->scsi_target_id == -1) | ||
959 | continue; | 960 | continue; |
960 | 961 | ||
961 | if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) && | 962 | if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) && |
@@ -977,7 +978,6 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, | |||
977 | #define SETUP_TEMPLATE(attrb, field, perm, test) \ | 978 | #define SETUP_TEMPLATE(attrb, field, perm, test) \ |
978 | i->private_##attrb[count] = class_device_attr_##field; \ | 979 | i->private_##attrb[count] = class_device_attr_##field; \ |
979 | i->private_##attrb[count].attr.mode = perm; \ | 980 | i->private_##attrb[count].attr.mode = perm; \ |
980 | i->private_##attrb[count].store = NULL; \ | ||
981 | i->attrb[count] = &i->private_##attrb[count]; \ | 981 | i->attrb[count] = &i->private_##attrb[count]; \ |
982 | if (test) \ | 982 | if (test) \ |
983 | count++ | 983 | count++ |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index d40e7c871c36..56cb49006116 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4054,7 +4054,7 @@ static int st_probe(struct device *dev) | |||
4054 | } | 4054 | } |
4055 | 4055 | ||
4056 | sdev_printk(KERN_WARNING, SDp, | 4056 | sdev_printk(KERN_WARNING, SDp, |
4057 | "Attached scsi tape %s", tape_name(tpnt)); | 4057 | "Attached scsi tape %s\n", tape_name(tpnt)); |
4058 | printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B)\n", | 4058 | printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B)\n", |
4059 | tape_name(tpnt), tpnt->try_dio ? "yes" : "no", | 4059 | tape_name(tpnt), tpnt->try_dio ? "yes" : "no", |
4060 | queue_dma_alignment(SDp->request_queue) + 1); | 4060 | queue_dma_alignment(SDp->request_queue) + 1); |
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 969f94900431..5cba59ad7dc5 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
@@ -1164,14 +1164,16 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) | |||
1164 | struct fs_uart_platform_info *pdata; | 1164 | struct fs_uart_platform_info *pdata; |
1165 | struct platform_device* pdev = early_uart_get_pdev(co->index); | 1165 | struct platform_device* pdev = early_uart_get_pdev(co->index); |
1166 | 1166 | ||
1167 | port = | ||
1168 | (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; | ||
1169 | pinfo = (struct uart_cpm_port *)port; | ||
1170 | if (!pdev) { | 1167 | if (!pdev) { |
1171 | pr_info("cpm_uart: console: compat mode\n"); | 1168 | pr_info("cpm_uart: console: compat mode\n"); |
1172 | /* compatibility - will be cleaned up */ | 1169 | /* compatibility - will be cleaned up */ |
1173 | cpm_uart_init_portdesc(); | 1170 | cpm_uart_init_portdesc(); |
1171 | } | ||
1174 | 1172 | ||
1173 | port = | ||
1174 | (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; | ||
1175 | pinfo = (struct uart_cpm_port *)port; | ||
1176 | if (!pdev) { | ||
1175 | if (pinfo->set_lineif) | 1177 | if (pinfo->set_lineif) |
1176 | pinfo->set_lineif(pinfo); | 1178 | pinfo->set_lineif(pinfo); |
1177 | } else { | 1179 | } else { |
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c index 4b2de08f46d0..cdba128250a9 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c | |||
@@ -213,7 +213,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
213 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); | 213 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); |
214 | if (is_con) { | 214 | if (is_con) { |
215 | mem_addr = alloc_bootmem(memsz); | 215 | mem_addr = alloc_bootmem(memsz); |
216 | dma_addr = mem_addr; | 216 | dma_addr = virt_to_bus(mem_addr); |
217 | } | 217 | } |
218 | else | 218 | else |
219 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, | 219 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index aeb8153ccf24..17839e753e4c 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1907,9 +1907,12 @@ uart_set_options(struct uart_port *port, struct console *co, | |||
1907 | static void uart_change_pm(struct uart_state *state, int pm_state) | 1907 | static void uart_change_pm(struct uart_state *state, int pm_state) |
1908 | { | 1908 | { |
1909 | struct uart_port *port = state->port; | 1909 | struct uart_port *port = state->port; |
1910 | if (port->ops->pm) | 1910 | |
1911 | port->ops->pm(port, pm_state, state->pm_state); | 1911 | if (state->pm_state != pm_state) { |
1912 | state->pm_state = pm_state; | 1912 | if (port->ops->pm) |
1913 | port->ops->pm(port, pm_state, state->pm_state); | ||
1914 | state->pm_state = pm_state; | ||
1915 | } | ||
1913 | } | 1916 | } |
1914 | 1917 | ||
1915 | int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | 1918 | int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 1c4396c2962d..2b4f96541b8e 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1730,3 +1730,4 @@ static void __exit sunsu_exit(void) | |||
1730 | 1730 | ||
1731 | module_init(sunsu_probe); | 1731 | module_init(sunsu_probe); |
1732 | module_exit(sunsu_exit); | 1732 | module_exit(sunsu_exit); |
1733 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 7a75faeb0526..23334c8bc4c7 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -75,11 +75,45 @@ config SPI_BUTTERFLY | |||
75 | inexpensive battery powered microcontroller evaluation board. | 75 | inexpensive battery powered microcontroller evaluation board. |
76 | This same cable can be used to flash new firmware. | 76 | This same cable can be used to flash new firmware. |
77 | 77 | ||
78 | config SPI_MPC83xx | ||
79 | tristate "Freescale MPC83xx SPI controller" | ||
80 | depends on SPI_MASTER && PPC_83xx && EXPERIMENTAL | ||
81 | select SPI_BITBANG | ||
82 | help | ||
83 | This enables using the Freescale MPC83xx SPI controller in master | ||
84 | mode. | ||
85 | |||
86 | Note, this driver uniquely supports the SPI controller on the MPC83xx | ||
87 | family of PowerPC processors. The MPC83xx uses a simple set of shift | ||
88 | registers for data (opposed to the CPM based descriptor model). | ||
89 | |||
90 | config SPI_PXA2XX | ||
91 | tristate "PXA2xx SSP SPI master" | ||
92 | depends on SPI_MASTER && ARCH_PXA && EXPERIMENTAL | ||
93 | help | ||
94 | This enables using a PXA2xx SSP port as a SPI master controller. | ||
95 | The driver can be configured to use any SSP port and additional | ||
96 | documentation can be found a Documentation/spi/pxa2xx. | ||
97 | |||
98 | config SPI_S3C24XX_GPIO | ||
99 | tristate "Samsung S3C24XX series SPI by GPIO" | ||
100 | depends on SPI_MASTER && ARCH_S3C2410 && SPI_BITBANG && EXPERIMENTAL | ||
101 | help | ||
102 | SPI driver for Samsung S3C24XX series ARM SoCs using | ||
103 | GPIO lines to provide the SPI bus. This can be used where | ||
104 | the inbuilt hardware cannot provide the transfer mode, or | ||
105 | where the board is using non hardware connected pins. | ||
78 | # | 106 | # |
79 | # Add new SPI master controllers in alphabetical order above this line | 107 | # Add new SPI master controllers in alphabetical order above this line |
80 | # | 108 | # |
81 | 109 | ||
82 | 110 | ||
111 | config SPI_S3C24XX | ||
112 | tristate "Samsung S3C24XX series SPI" | ||
113 | depends on SPI_MASTER && ARCH_S3C2410 && EXPERIMENTAL | ||
114 | help | ||
115 | SPI driver for Samsung S3C24XX series ARM SoCs | ||
116 | |||
83 | # | 117 | # |
84 | # There are lots of SPI device types, with sensors and memory | 118 | # There are lots of SPI device types, with sensors and memory |
85 | # being probably the most widely used ones. | 119 | # being probably the most widely used ones. |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index c2c87e845abf..8f4cb67997b3 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -13,6 +13,10 @@ obj-$(CONFIG_SPI_MASTER) += spi.o | |||
13 | # SPI master controller drivers (bus) | 13 | # SPI master controller drivers (bus) |
14 | obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o | 14 | obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o |
15 | obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o | 15 | obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o |
16 | obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o | ||
17 | obj-$(CONFIG_SPI_MPC83xx) += spi_mpc83xx.o | ||
18 | obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o | ||
19 | obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24xx.o | ||
16 | # ... add above this line ... | 20 | # ... add above this line ... |
17 | 21 | ||
18 | # SPI protocol drivers (device/link on bus) | 22 | # SPI protocol drivers (device/link on bus) |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c new file mode 100644 index 000000000000..29aec77f98be --- /dev/null +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -0,0 +1,1486 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #include <linux/init.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/dma-mapping.h> | ||
27 | #include <linux/spi/spi.h> | ||
28 | #include <linux/workqueue.h> | ||
29 | #include <linux/errno.h> | ||
30 | #include <linux/delay.h> | ||
31 | |||
32 | #include <asm/io.h> | ||
33 | #include <asm/irq.h> | ||
34 | #include <asm/hardware.h> | ||
35 | #include <asm/delay.h> | ||
36 | #include <asm/dma.h> | ||
37 | |||
38 | #include <asm/arch/hardware.h> | ||
39 | #include <asm/arch/pxa-regs.h> | ||
40 | #include <asm/arch/pxa2xx_spi.h> | ||
41 | |||
42 | MODULE_AUTHOR("Stephen Street"); | ||
43 | MODULE_DESCRIPTION("PXA2xx SSP SPI Contoller"); | ||
44 | MODULE_LICENSE("GPL"); | ||
45 | |||
46 | #define MAX_BUSES 3 | ||
47 | |||
48 | #define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR) | ||
49 | #define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK) | ||
50 | #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) | ||
51 | |||
52 | #define DEFINE_SSP_REG(reg, off) \ | ||
53 | static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \ | ||
54 | static inline void write_##reg(u32 v, void *p) { __raw_writel(v, p + (off)); } | ||
55 | |||
56 | DEFINE_SSP_REG(SSCR0, 0x00) | ||
57 | DEFINE_SSP_REG(SSCR1, 0x04) | ||
58 | DEFINE_SSP_REG(SSSR, 0x08) | ||
59 | DEFINE_SSP_REG(SSITR, 0x0c) | ||
60 | DEFINE_SSP_REG(SSDR, 0x10) | ||
61 | DEFINE_SSP_REG(SSTO, 0x28) | ||
62 | DEFINE_SSP_REG(SSPSP, 0x2c) | ||
63 | |||
64 | #define START_STATE ((void*)0) | ||
65 | #define RUNNING_STATE ((void*)1) | ||
66 | #define DONE_STATE ((void*)2) | ||
67 | #define ERROR_STATE ((void*)-1) | ||
68 | |||
69 | #define QUEUE_RUNNING 0 | ||
70 | #define QUEUE_STOPPED 1 | ||
71 | |||
72 | struct driver_data { | ||
73 | /* Driver model hookup */ | ||
74 | struct platform_device *pdev; | ||
75 | |||
76 | /* SPI framework hookup */ | ||
77 | enum pxa_ssp_type ssp_type; | ||
78 | struct spi_master *master; | ||
79 | |||
80 | /* PXA hookup */ | ||
81 | struct pxa2xx_spi_master *master_info; | ||
82 | |||
83 | /* DMA setup stuff */ | ||
84 | int rx_channel; | ||
85 | int tx_channel; | ||
86 | u32 *null_dma_buf; | ||
87 | |||
88 | /* SSP register addresses */ | ||
89 | void *ioaddr; | ||
90 | u32 ssdr_physical; | ||
91 | |||
92 | /* SSP masks*/ | ||
93 | u32 dma_cr1; | ||
94 | u32 int_cr1; | ||
95 | u32 clear_sr; | ||
96 | u32 mask_sr; | ||
97 | |||
98 | /* Driver message queue */ | ||
99 | struct workqueue_struct *workqueue; | ||
100 | struct work_struct pump_messages; | ||
101 | spinlock_t lock; | ||
102 | struct list_head queue; | ||
103 | int busy; | ||
104 | int run; | ||
105 | |||
106 | /* Message Transfer pump */ | ||
107 | struct tasklet_struct pump_transfers; | ||
108 | |||
109 | /* Current message transfer state info */ | ||
110 | struct spi_message* cur_msg; | ||
111 | struct spi_transfer* cur_transfer; | ||
112 | struct chip_data *cur_chip; | ||
113 | size_t len; | ||
114 | void *tx; | ||
115 | void *tx_end; | ||
116 | void *rx; | ||
117 | void *rx_end; | ||
118 | int dma_mapped; | ||
119 | dma_addr_t rx_dma; | ||
120 | dma_addr_t tx_dma; | ||
121 | size_t rx_map_len; | ||
122 | size_t tx_map_len; | ||
123 | u8 n_bytes; | ||
124 | u32 dma_width; | ||
125 | int cs_change; | ||
126 | void (*write)(struct driver_data *drv_data); | ||
127 | void (*read)(struct driver_data *drv_data); | ||
128 | irqreturn_t (*transfer_handler)(struct driver_data *drv_data); | ||
129 | void (*cs_control)(u32 command); | ||
130 | }; | ||
131 | |||
132 | struct chip_data { | ||
133 | u32 cr0; | ||
134 | u32 cr1; | ||
135 | u32 to; | ||
136 | u32 psp; | ||
137 | u32 timeout; | ||
138 | u8 n_bytes; | ||
139 | u32 dma_width; | ||
140 | u32 dma_burst_size; | ||
141 | u32 threshold; | ||
142 | u32 dma_threshold; | ||
143 | u8 enable_dma; | ||
144 | u8 bits_per_word; | ||
145 | u32 speed_hz; | ||
146 | void (*write)(struct driver_data *drv_data); | ||
147 | void (*read)(struct driver_data *drv_data); | ||
148 | void (*cs_control)(u32 command); | ||
149 | }; | ||
150 | |||
151 | static void pump_messages(void *data); | ||
152 | |||
153 | static int flush(struct driver_data *drv_data) | ||
154 | { | ||
155 | unsigned long limit = loops_per_jiffy << 1; | ||
156 | |||
157 | void *reg = drv_data->ioaddr; | ||
158 | |||
159 | do { | ||
160 | while (read_SSSR(reg) & SSSR_RNE) { | ||
161 | read_SSDR(reg); | ||
162 | } | ||
163 | } while ((read_SSSR(reg) & SSSR_BSY) && limit--); | ||
164 | write_SSSR(SSSR_ROR, reg); | ||
165 | |||
166 | return limit; | ||
167 | } | ||
168 | |||
169 | static void restore_state(struct driver_data *drv_data) | ||
170 | { | ||
171 | void *reg = drv_data->ioaddr; | ||
172 | |||
173 | /* Clear status and disable clock */ | ||
174 | write_SSSR(drv_data->clear_sr, reg); | ||
175 | write_SSCR0(drv_data->cur_chip->cr0 & ~SSCR0_SSE, reg); | ||
176 | |||
177 | /* Load the registers */ | ||
178 | write_SSCR1(drv_data->cur_chip->cr1, reg); | ||
179 | write_SSCR0(drv_data->cur_chip->cr0, reg); | ||
180 | if (drv_data->ssp_type != PXA25x_SSP) { | ||
181 | write_SSTO(0, reg); | ||
182 | write_SSPSP(drv_data->cur_chip->psp, reg); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | static void null_cs_control(u32 command) | ||
187 | { | ||
188 | } | ||
189 | |||
190 | static void null_writer(struct driver_data *drv_data) | ||
191 | { | ||
192 | void *reg = drv_data->ioaddr; | ||
193 | u8 n_bytes = drv_data->n_bytes; | ||
194 | |||
195 | while ((read_SSSR(reg) & SSSR_TNF) | ||
196 | && (drv_data->tx < drv_data->tx_end)) { | ||
197 | write_SSDR(0, reg); | ||
198 | drv_data->tx += n_bytes; | ||
199 | } | ||
200 | } | ||
201 | |||
202 | static void null_reader(struct driver_data *drv_data) | ||
203 | { | ||
204 | void *reg = drv_data->ioaddr; | ||
205 | u8 n_bytes = drv_data->n_bytes; | ||
206 | |||
207 | while ((read_SSSR(reg) & SSSR_RNE) | ||
208 | && (drv_data->rx < drv_data->rx_end)) { | ||
209 | read_SSDR(reg); | ||
210 | drv_data->rx += n_bytes; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | static void u8_writer(struct driver_data *drv_data) | ||
215 | { | ||
216 | void *reg = drv_data->ioaddr; | ||
217 | |||
218 | while ((read_SSSR(reg) & SSSR_TNF) | ||
219 | && (drv_data->tx < drv_data->tx_end)) { | ||
220 | write_SSDR(*(u8 *)(drv_data->tx), reg); | ||
221 | ++drv_data->tx; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | static void u8_reader(struct driver_data *drv_data) | ||
226 | { | ||
227 | void *reg = drv_data->ioaddr; | ||
228 | |||
229 | while ((read_SSSR(reg) & SSSR_RNE) | ||
230 | && (drv_data->rx < drv_data->rx_end)) { | ||
231 | *(u8 *)(drv_data->rx) = read_SSDR(reg); | ||
232 | ++drv_data->rx; | ||
233 | } | ||
234 | } | ||
235 | |||
236 | static void u16_writer(struct driver_data *drv_data) | ||
237 | { | ||
238 | void *reg = drv_data->ioaddr; | ||
239 | |||
240 | while ((read_SSSR(reg) & SSSR_TNF) | ||
241 | && (drv_data->tx < drv_data->tx_end)) { | ||
242 | write_SSDR(*(u16 *)(drv_data->tx), reg); | ||
243 | drv_data->tx += 2; | ||
244 | } | ||
245 | } | ||
246 | |||
247 | static void u16_reader(struct driver_data *drv_data) | ||
248 | { | ||
249 | void *reg = drv_data->ioaddr; | ||
250 | |||
251 | while ((read_SSSR(reg) & SSSR_RNE) | ||
252 | && (drv_data->rx < drv_data->rx_end)) { | ||
253 | *(u16 *)(drv_data->rx) = read_SSDR(reg); | ||
254 | drv_data->rx += 2; | ||
255 | } | ||
256 | } | ||
257 | static void u32_writer(struct driver_data *drv_data) | ||
258 | { | ||
259 | void *reg = drv_data->ioaddr; | ||
260 | |||
261 | while ((read_SSSR(reg) & SSSR_TNF) | ||
262 | && (drv_data->tx < drv_data->tx_end)) { | ||
263 | write_SSDR(*(u32 *)(drv_data->tx), reg); | ||
264 | drv_data->tx += 4; | ||
265 | } | ||
266 | } | ||
267 | |||
268 | static void u32_reader(struct driver_data *drv_data) | ||
269 | { | ||
270 | void *reg = drv_data->ioaddr; | ||
271 | |||
272 | while ((read_SSSR(reg) & SSSR_RNE) | ||
273 | && (drv_data->rx < drv_data->rx_end)) { | ||
274 | *(u32 *)(drv_data->rx) = read_SSDR(reg); | ||
275 | drv_data->rx += 4; | ||
276 | } | ||
277 | } | ||
278 | |||
279 | static void *next_transfer(struct driver_data *drv_data) | ||
280 | { | ||
281 | struct spi_message *msg = drv_data->cur_msg; | ||
282 | struct spi_transfer *trans = drv_data->cur_transfer; | ||
283 | |||
284 | /* Move to next transfer */ | ||
285 | if (trans->transfer_list.next != &msg->transfers) { | ||
286 | drv_data->cur_transfer = | ||
287 | list_entry(trans->transfer_list.next, | ||
288 | struct spi_transfer, | ||
289 | transfer_list); | ||
290 | return RUNNING_STATE; | ||
291 | } else | ||
292 | return DONE_STATE; | ||
293 | } | ||
294 | |||
295 | static int map_dma_buffers(struct driver_data *drv_data) | ||
296 | { | ||
297 | struct spi_message *msg = drv_data->cur_msg; | ||
298 | struct device *dev = &msg->spi->dev; | ||
299 | |||
300 | if (!drv_data->cur_chip->enable_dma) | ||
301 | return 0; | ||
302 | |||
303 | if (msg->is_dma_mapped) | ||
304 | return drv_data->rx_dma && drv_data->tx_dma; | ||
305 | |||
306 | if (!IS_DMA_ALIGNED(drv_data->rx) || !IS_DMA_ALIGNED(drv_data->tx)) | ||
307 | return 0; | ||
308 | |||
309 | /* Modify setup if rx buffer is null */ | ||
310 | if (drv_data->rx == NULL) { | ||
311 | *drv_data->null_dma_buf = 0; | ||
312 | drv_data->rx = drv_data->null_dma_buf; | ||
313 | drv_data->rx_map_len = 4; | ||
314 | } else | ||
315 | drv_data->rx_map_len = drv_data->len; | ||
316 | |||
317 | |||
318 | /* Modify setup if tx buffer is null */ | ||
319 | if (drv_data->tx == NULL) { | ||
320 | *drv_data->null_dma_buf = 0; | ||
321 | drv_data->tx = drv_data->null_dma_buf; | ||
322 | drv_data->tx_map_len = 4; | ||
323 | } else | ||
324 | drv_data->tx_map_len = drv_data->len; | ||
325 | |||
326 | /* Stream map the rx buffer */ | ||
327 | drv_data->rx_dma = dma_map_single(dev, drv_data->rx, | ||
328 | drv_data->rx_map_len, | ||
329 | DMA_FROM_DEVICE); | ||
330 | if (dma_mapping_error(drv_data->rx_dma)) | ||
331 | return 0; | ||
332 | |||
333 | /* Stream map the tx buffer */ | ||
334 | drv_data->tx_dma = dma_map_single(dev, drv_data->tx, | ||
335 | drv_data->tx_map_len, | ||
336 | DMA_TO_DEVICE); | ||
337 | |||
338 | if (dma_mapping_error(drv_data->tx_dma)) { | ||
339 | dma_unmap_single(dev, drv_data->rx_dma, | ||
340 | drv_data->rx_map_len, DMA_FROM_DEVICE); | ||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | return 1; | ||
345 | } | ||
346 | |||
347 | static void unmap_dma_buffers(struct driver_data *drv_data) | ||
348 | { | ||
349 | struct device *dev; | ||
350 | |||
351 | if (!drv_data->dma_mapped) | ||
352 | return; | ||
353 | |||
354 | if (!drv_data->cur_msg->is_dma_mapped) { | ||
355 | dev = &drv_data->cur_msg->spi->dev; | ||
356 | dma_unmap_single(dev, drv_data->rx_dma, | ||
357 | drv_data->rx_map_len, DMA_FROM_DEVICE); | ||
358 | dma_unmap_single(dev, drv_data->tx_dma, | ||
359 | drv_data->tx_map_len, DMA_TO_DEVICE); | ||
360 | } | ||
361 | |||
362 | drv_data->dma_mapped = 0; | ||
363 | } | ||
364 | |||
365 | /* caller already set message->status; dma and pio irqs are blocked */ | ||
366 | static void giveback(struct driver_data *drv_data) | ||
367 | { | ||
368 | struct spi_transfer* last_transfer; | ||
369 | unsigned long flags; | ||
370 | struct spi_message *msg; | ||
371 | |||
372 | spin_lock_irqsave(&drv_data->lock, flags); | ||
373 | msg = drv_data->cur_msg; | ||
374 | drv_data->cur_msg = NULL; | ||
375 | drv_data->cur_transfer = NULL; | ||
376 | drv_data->cur_chip = NULL; | ||
377 | queue_work(drv_data->workqueue, &drv_data->pump_messages); | ||
378 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
379 | |||
380 | last_transfer = list_entry(msg->transfers.prev, | ||
381 | struct spi_transfer, | ||
382 | transfer_list); | ||
383 | |||
384 | if (!last_transfer->cs_change) | ||
385 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
386 | |||
387 | msg->state = NULL; | ||
388 | if (msg->complete) | ||
389 | msg->complete(msg->context); | ||
390 | } | ||
391 | |||
392 | static int wait_ssp_rx_stall(void *ioaddr) | ||
393 | { | ||
394 | unsigned long limit = loops_per_jiffy << 1; | ||
395 | |||
396 | while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--) | ||
397 | cpu_relax(); | ||
398 | |||
399 | return limit; | ||
400 | } | ||
401 | |||
402 | static int wait_dma_channel_stop(int channel) | ||
403 | { | ||
404 | unsigned long limit = loops_per_jiffy << 1; | ||
405 | |||
406 | while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--) | ||
407 | cpu_relax(); | ||
408 | |||
409 | return limit; | ||
410 | } | ||
411 | |||
412 | static void dma_handler(int channel, void *data, struct pt_regs *regs) | ||
413 | { | ||
414 | struct driver_data *drv_data = data; | ||
415 | struct spi_message *msg = drv_data->cur_msg; | ||
416 | void *reg = drv_data->ioaddr; | ||
417 | u32 irq_status = DCSR(channel) & DMA_INT_MASK; | ||
418 | u32 trailing_sssr = 0; | ||
419 | |||
420 | if (irq_status & DCSR_BUSERR) { | ||
421 | |||
422 | /* Disable interrupts, clear status and reset DMA */ | ||
423 | write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg); | ||
424 | write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg); | ||
425 | if (drv_data->ssp_type != PXA25x_SSP) | ||
426 | write_SSTO(0, reg); | ||
427 | write_SSSR(drv_data->clear_sr, reg); | ||
428 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
429 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
430 | |||
431 | if (flush(drv_data) == 0) | ||
432 | dev_err(&drv_data->pdev->dev, | ||
433 | "dma_handler: flush fail\n"); | ||
434 | |||
435 | unmap_dma_buffers(drv_data); | ||
436 | |||
437 | if (channel == drv_data->tx_channel) | ||
438 | dev_err(&drv_data->pdev->dev, | ||
439 | "dma_handler: bad bus address on " | ||
440 | "tx channel %d, source %x target = %x\n", | ||
441 | channel, DSADR(channel), DTADR(channel)); | ||
442 | else | ||
443 | dev_err(&drv_data->pdev->dev, | ||
444 | "dma_handler: bad bus address on " | ||
445 | "rx channel %d, source %x target = %x\n", | ||
446 | channel, DSADR(channel), DTADR(channel)); | ||
447 | |||
448 | msg->state = ERROR_STATE; | ||
449 | tasklet_schedule(&drv_data->pump_transfers); | ||
450 | } | ||
451 | |||
452 | /* PXA255x_SSP has no timeout interrupt, wait for tailing bytes */ | ||
453 | if ((drv_data->ssp_type == PXA25x_SSP) | ||
454 | && (channel == drv_data->tx_channel) | ||
455 | && (irq_status & DCSR_ENDINTR)) { | ||
456 | |||
457 | /* Wait for rx to stall */ | ||
458 | if (wait_ssp_rx_stall(drv_data->ioaddr) == 0) | ||
459 | dev_err(&drv_data->pdev->dev, | ||
460 | "dma_handler: ssp rx stall failed\n"); | ||
461 | |||
462 | /* Clear and disable interrupts on SSP and DMA channels*/ | ||
463 | write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg); | ||
464 | write_SSSR(drv_data->clear_sr, reg); | ||
465 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
466 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
467 | if (wait_dma_channel_stop(drv_data->rx_channel) == 0) | ||
468 | dev_err(&drv_data->pdev->dev, | ||
469 | "dma_handler: dma rx channel stop failed\n"); | ||
470 | |||
471 | unmap_dma_buffers(drv_data); | ||
472 | |||
473 | /* Read trailing bytes */ | ||
474 | /* Calculate number of trailing bytes, read them */ | ||
475 | trailing_sssr = read_SSSR(reg); | ||
476 | if ((trailing_sssr & 0xf008) != 0xf000) { | ||
477 | drv_data->rx = drv_data->rx_end - | ||
478 | (((trailing_sssr >> 12) & 0x0f) + 1); | ||
479 | drv_data->read(drv_data); | ||
480 | } | ||
481 | msg->actual_length += drv_data->len; | ||
482 | |||
483 | /* Release chip select if requested, transfer delays are | ||
484 | * handled in pump_transfers */ | ||
485 | if (drv_data->cs_change) | ||
486 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
487 | |||
488 | /* Move to next transfer */ | ||
489 | msg->state = next_transfer(drv_data); | ||
490 | |||
491 | /* Schedule transfer tasklet */ | ||
492 | tasklet_schedule(&drv_data->pump_transfers); | ||
493 | } | ||
494 | } | ||
495 | |||
496 | static irqreturn_t dma_transfer(struct driver_data *drv_data) | ||
497 | { | ||
498 | u32 irq_status; | ||
499 | u32 trailing_sssr = 0; | ||
500 | struct spi_message *msg = drv_data->cur_msg; | ||
501 | void *reg = drv_data->ioaddr; | ||
502 | |||
503 | irq_status = read_SSSR(reg) & drv_data->mask_sr; | ||
504 | if (irq_status & SSSR_ROR) { | ||
505 | /* Clear and disable interrupts on SSP and DMA channels*/ | ||
506 | write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg); | ||
507 | write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg); | ||
508 | if (drv_data->ssp_type != PXA25x_SSP) | ||
509 | write_SSTO(0, reg); | ||
510 | write_SSSR(drv_data->clear_sr, reg); | ||
511 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
512 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
513 | unmap_dma_buffers(drv_data); | ||
514 | |||
515 | if (flush(drv_data) == 0) | ||
516 | dev_err(&drv_data->pdev->dev, | ||
517 | "dma_transfer: flush fail\n"); | ||
518 | |||
519 | dev_warn(&drv_data->pdev->dev, "dma_transfer: fifo overun\n"); | ||
520 | |||
521 | drv_data->cur_msg->state = ERROR_STATE; | ||
522 | tasklet_schedule(&drv_data->pump_transfers); | ||
523 | |||
524 | return IRQ_HANDLED; | ||
525 | } | ||
526 | |||
527 | /* Check for false positive timeout */ | ||
528 | if ((irq_status & SSSR_TINT) && DCSR(drv_data->tx_channel) & DCSR_RUN) { | ||
529 | write_SSSR(SSSR_TINT, reg); | ||
530 | return IRQ_HANDLED; | ||
531 | } | ||
532 | |||
533 | if (irq_status & SSSR_TINT || drv_data->rx == drv_data->rx_end) { | ||
534 | |||
535 | /* Clear and disable interrupts on SSP and DMA channels*/ | ||
536 | write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg); | ||
537 | if (drv_data->ssp_type != PXA25x_SSP) | ||
538 | write_SSTO(0, reg); | ||
539 | write_SSSR(drv_data->clear_sr, reg); | ||
540 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
541 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
542 | |||
543 | if (wait_dma_channel_stop(drv_data->rx_channel) == 0) | ||
544 | dev_err(&drv_data->pdev->dev, | ||
545 | "dma_transfer: dma rx channel stop failed\n"); | ||
546 | |||
547 | if (wait_ssp_rx_stall(drv_data->ioaddr) == 0) | ||
548 | dev_err(&drv_data->pdev->dev, | ||
549 | "dma_transfer: ssp rx stall failed\n"); | ||
550 | |||
551 | unmap_dma_buffers(drv_data); | ||
552 | |||
553 | /* Calculate number of trailing bytes, read them */ | ||
554 | trailing_sssr = read_SSSR(reg); | ||
555 | if ((trailing_sssr & 0xf008) != 0xf000) { | ||
556 | drv_data->rx = drv_data->rx_end - | ||
557 | (((trailing_sssr >> 12) & 0x0f) + 1); | ||
558 | drv_data->read(drv_data); | ||
559 | } | ||
560 | msg->actual_length += drv_data->len; | ||
561 | |||
562 | /* Release chip select if requested, transfer delays are | ||
563 | * handled in pump_transfers */ | ||
564 | if (drv_data->cs_change) | ||
565 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
566 | |||
567 | /* Move to next transfer */ | ||
568 | msg->state = next_transfer(drv_data); | ||
569 | |||
570 | /* Schedule transfer tasklet */ | ||
571 | tasklet_schedule(&drv_data->pump_transfers); | ||
572 | |||
573 | return IRQ_HANDLED; | ||
574 | } | ||
575 | |||
576 | /* Opps problem detected */ | ||
577 | return IRQ_NONE; | ||
578 | } | ||
579 | |||
580 | static irqreturn_t interrupt_transfer(struct driver_data *drv_data) | ||
581 | { | ||
582 | struct spi_message *msg = drv_data->cur_msg; | ||
583 | void *reg = drv_data->ioaddr; | ||
584 | unsigned long limit = loops_per_jiffy << 1; | ||
585 | u32 irq_status; | ||
586 | u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ? | ||
587 | drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS; | ||
588 | |||
589 | while ((irq_status = read_SSSR(reg) & irq_mask)) { | ||
590 | |||
591 | if (irq_status & SSSR_ROR) { | ||
592 | |||
593 | /* Clear and disable interrupts */ | ||
594 | write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg); | ||
595 | write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg); | ||
596 | if (drv_data->ssp_type != PXA25x_SSP) | ||
597 | write_SSTO(0, reg); | ||
598 | write_SSSR(drv_data->clear_sr, reg); | ||
599 | |||
600 | if (flush(drv_data) == 0) | ||
601 | dev_err(&drv_data->pdev->dev, | ||
602 | "interrupt_transfer: flush fail\n"); | ||
603 | |||
604 | /* Stop the SSP */ | ||
605 | |||
606 | dev_warn(&drv_data->pdev->dev, | ||
607 | "interrupt_transfer: fifo overun\n"); | ||
608 | |||
609 | msg->state = ERROR_STATE; | ||
610 | tasklet_schedule(&drv_data->pump_transfers); | ||
611 | |||
612 | return IRQ_HANDLED; | ||
613 | } | ||
614 | |||
615 | /* Look for false positive timeout */ | ||
616 | if ((irq_status & SSSR_TINT) | ||
617 | && (drv_data->rx < drv_data->rx_end)) | ||
618 | write_SSSR(SSSR_TINT, reg); | ||
619 | |||
620 | /* Pump data */ | ||
621 | drv_data->read(drv_data); | ||
622 | drv_data->write(drv_data); | ||
623 | |||
624 | if (drv_data->tx == drv_data->tx_end) { | ||
625 | /* Disable tx interrupt */ | ||
626 | write_SSCR1(read_SSCR1(reg) & ~SSCR1_TIE, reg); | ||
627 | irq_mask = drv_data->mask_sr & ~SSSR_TFS; | ||
628 | |||
629 | /* PXA25x_SSP has no timeout, read trailing bytes */ | ||
630 | if (drv_data->ssp_type == PXA25x_SSP) { | ||
631 | while ((read_SSSR(reg) & SSSR_BSY) && limit--) | ||
632 | drv_data->read(drv_data); | ||
633 | |||
634 | if (limit == 0) | ||
635 | dev_err(&drv_data->pdev->dev, | ||
636 | "interrupt_transfer: " | ||
637 | "trailing byte read failed\n"); | ||
638 | } | ||
639 | } | ||
640 | |||
641 | if ((irq_status & SSSR_TINT) | ||
642 | || (drv_data->rx == drv_data->rx_end)) { | ||
643 | |||
644 | /* Clear timeout */ | ||
645 | write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg); | ||
646 | if (drv_data->ssp_type != PXA25x_SSP) | ||
647 | write_SSTO(0, reg); | ||
648 | write_SSSR(drv_data->clear_sr, reg); | ||
649 | |||
650 | /* Update total byte transfered */ | ||
651 | msg->actual_length += drv_data->len; | ||
652 | |||
653 | /* Release chip select if requested, transfer delays are | ||
654 | * handled in pump_transfers */ | ||
655 | if (drv_data->cs_change) | ||
656 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
657 | |||
658 | /* Move to next transfer */ | ||
659 | msg->state = next_transfer(drv_data); | ||
660 | |||
661 | /* Schedule transfer tasklet */ | ||
662 | tasklet_schedule(&drv_data->pump_transfers); | ||
663 | } | ||
664 | } | ||
665 | |||
666 | /* We did something */ | ||
667 | return IRQ_HANDLED; | ||
668 | } | ||
669 | |||
670 | static irqreturn_t ssp_int(int irq, void *dev_id, struct pt_regs *regs) | ||
671 | { | ||
672 | struct driver_data *drv_data = (struct driver_data *)dev_id; | ||
673 | void *reg = drv_data->ioaddr; | ||
674 | |||
675 | if (!drv_data->cur_msg) { | ||
676 | |||
677 | write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg); | ||
678 | write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg); | ||
679 | if (drv_data->ssp_type != PXA25x_SSP) | ||
680 | write_SSTO(0, reg); | ||
681 | write_SSSR(drv_data->clear_sr, reg); | ||
682 | |||
683 | dev_err(&drv_data->pdev->dev, "bad message state " | ||
684 | "in interrupt handler"); | ||
685 | |||
686 | /* Never fail */ | ||
687 | return IRQ_HANDLED; | ||
688 | } | ||
689 | |||
690 | return drv_data->transfer_handler(drv_data); | ||
691 | } | ||
692 | |||
693 | static void pump_transfers(unsigned long data) | ||
694 | { | ||
695 | struct driver_data *drv_data = (struct driver_data *)data; | ||
696 | struct spi_message *message = NULL; | ||
697 | struct spi_transfer *transfer = NULL; | ||
698 | struct spi_transfer *previous = NULL; | ||
699 | struct chip_data *chip = NULL; | ||
700 | void *reg = drv_data->ioaddr; | ||
701 | u32 clk_div = 0; | ||
702 | u8 bits = 0; | ||
703 | u32 speed = 0; | ||
704 | u32 cr0; | ||
705 | |||
706 | /* Get current state information */ | ||
707 | message = drv_data->cur_msg; | ||
708 | transfer = drv_data->cur_transfer; | ||
709 | chip = drv_data->cur_chip; | ||
710 | |||
711 | /* Handle for abort */ | ||
712 | if (message->state == ERROR_STATE) { | ||
713 | message->status = -EIO; | ||
714 | giveback(drv_data); | ||
715 | return; | ||
716 | } | ||
717 | |||
718 | /* Handle end of message */ | ||
719 | if (message->state == DONE_STATE) { | ||
720 | message->status = 0; | ||
721 | giveback(drv_data); | ||
722 | return; | ||
723 | } | ||
724 | |||
725 | /* Delay if requested at end of transfer*/ | ||
726 | if (message->state == RUNNING_STATE) { | ||
727 | previous = list_entry(transfer->transfer_list.prev, | ||
728 | struct spi_transfer, | ||
729 | transfer_list); | ||
730 | if (previous->delay_usecs) | ||
731 | udelay(previous->delay_usecs); | ||
732 | } | ||
733 | |||
734 | /* Setup the transfer state based on the type of transfer */ | ||
735 | if (flush(drv_data) == 0) { | ||
736 | dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n"); | ||
737 | message->status = -EIO; | ||
738 | giveback(drv_data); | ||
739 | return; | ||
740 | } | ||
741 | drv_data->n_bytes = chip->n_bytes; | ||
742 | drv_data->dma_width = chip->dma_width; | ||
743 | drv_data->cs_control = chip->cs_control; | ||
744 | drv_data->tx = (void *)transfer->tx_buf; | ||
745 | drv_data->tx_end = drv_data->tx + transfer->len; | ||
746 | drv_data->rx = transfer->rx_buf; | ||
747 | drv_data->rx_end = drv_data->rx + transfer->len; | ||
748 | drv_data->rx_dma = transfer->rx_dma; | ||
749 | drv_data->tx_dma = transfer->tx_dma; | ||
750 | drv_data->len = transfer->len; | ||
751 | drv_data->write = drv_data->tx ? chip->write : null_writer; | ||
752 | drv_data->read = drv_data->rx ? chip->read : null_reader; | ||
753 | drv_data->cs_change = transfer->cs_change; | ||
754 | |||
755 | /* Change speed and bit per word on a per transfer */ | ||
756 | if (transfer->speed_hz || transfer->bits_per_word) { | ||
757 | |||
758 | /* Disable clock */ | ||
759 | write_SSCR0(chip->cr0 & ~SSCR0_SSE, reg); | ||
760 | cr0 = chip->cr0; | ||
761 | bits = chip->bits_per_word; | ||
762 | speed = chip->speed_hz; | ||
763 | |||
764 | if (transfer->speed_hz) | ||
765 | speed = transfer->speed_hz; | ||
766 | |||
767 | if (transfer->bits_per_word) | ||
768 | bits = transfer->bits_per_word; | ||
769 | |||
770 | if (reg == SSP1_VIRT) | ||
771 | clk_div = SSP1_SerClkDiv(speed); | ||
772 | else if (reg == SSP2_VIRT) | ||
773 | clk_div = SSP2_SerClkDiv(speed); | ||
774 | else if (reg == SSP3_VIRT) | ||
775 | clk_div = SSP3_SerClkDiv(speed); | ||
776 | |||
777 | if (bits <= 8) { | ||
778 | drv_data->n_bytes = 1; | ||
779 | drv_data->dma_width = DCMD_WIDTH1; | ||
780 | drv_data->read = drv_data->read != null_reader ? | ||
781 | u8_reader : null_reader; | ||
782 | drv_data->write = drv_data->write != null_writer ? | ||
783 | u8_writer : null_writer; | ||
784 | } else if (bits <= 16) { | ||
785 | drv_data->n_bytes = 2; | ||
786 | drv_data->dma_width = DCMD_WIDTH2; | ||
787 | drv_data->read = drv_data->read != null_reader ? | ||
788 | u16_reader : null_reader; | ||
789 | drv_data->write = drv_data->write != null_writer ? | ||
790 | u16_writer : null_writer; | ||
791 | } else if (bits <= 32) { | ||
792 | drv_data->n_bytes = 4; | ||
793 | drv_data->dma_width = DCMD_WIDTH4; | ||
794 | drv_data->read = drv_data->read != null_reader ? | ||
795 | u32_reader : null_reader; | ||
796 | drv_data->write = drv_data->write != null_writer ? | ||
797 | u32_writer : null_writer; | ||
798 | } | ||
799 | |||
800 | cr0 = clk_div | ||
801 | | SSCR0_Motorola | ||
802 | | SSCR0_DataSize(bits > 16 ? bits - 16 : bits) | ||
803 | | SSCR0_SSE | ||
804 | | (bits > 16 ? SSCR0_EDSS : 0); | ||
805 | |||
806 | /* Start it back up */ | ||
807 | write_SSCR0(cr0, reg); | ||
808 | } | ||
809 | |||
810 | message->state = RUNNING_STATE; | ||
811 | |||
812 | /* Try to map dma buffer and do a dma transfer if successful */ | ||
813 | if ((drv_data->dma_mapped = map_dma_buffers(drv_data))) { | ||
814 | |||
815 | /* Ensure we have the correct interrupt handler */ | ||
816 | drv_data->transfer_handler = dma_transfer; | ||
817 | |||
818 | /* Setup rx DMA Channel */ | ||
819 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
820 | DSADR(drv_data->rx_channel) = drv_data->ssdr_physical; | ||
821 | DTADR(drv_data->rx_channel) = drv_data->rx_dma; | ||
822 | if (drv_data->rx == drv_data->null_dma_buf) | ||
823 | /* No target address increment */ | ||
824 | DCMD(drv_data->rx_channel) = DCMD_FLOWSRC | ||
825 | | drv_data->dma_width | ||
826 | | chip->dma_burst_size | ||
827 | | drv_data->len; | ||
828 | else | ||
829 | DCMD(drv_data->rx_channel) = DCMD_INCTRGADDR | ||
830 | | DCMD_FLOWSRC | ||
831 | | drv_data->dma_width | ||
832 | | chip->dma_burst_size | ||
833 | | drv_data->len; | ||
834 | |||
835 | /* Setup tx DMA Channel */ | ||
836 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
837 | DSADR(drv_data->tx_channel) = drv_data->tx_dma; | ||
838 | DTADR(drv_data->tx_channel) = drv_data->ssdr_physical; | ||
839 | if (drv_data->tx == drv_data->null_dma_buf) | ||
840 | /* No source address increment */ | ||
841 | DCMD(drv_data->tx_channel) = DCMD_FLOWTRG | ||
842 | | drv_data->dma_width | ||
843 | | chip->dma_burst_size | ||
844 | | drv_data->len; | ||
845 | else | ||
846 | DCMD(drv_data->tx_channel) = DCMD_INCSRCADDR | ||
847 | | DCMD_FLOWTRG | ||
848 | | drv_data->dma_width | ||
849 | | chip->dma_burst_size | ||
850 | | drv_data->len; | ||
851 | |||
852 | /* Enable dma end irqs on SSP to detect end of transfer */ | ||
853 | if (drv_data->ssp_type == PXA25x_SSP) | ||
854 | DCMD(drv_data->tx_channel) |= DCMD_ENDIRQEN; | ||
855 | |||
856 | /* Fix me, need to handle cs polarity */ | ||
857 | drv_data->cs_control(PXA2XX_CS_ASSERT); | ||
858 | |||
859 | /* Go baby, go */ | ||
860 | write_SSSR(drv_data->clear_sr, reg); | ||
861 | DCSR(drv_data->rx_channel) |= DCSR_RUN; | ||
862 | DCSR(drv_data->tx_channel) |= DCSR_RUN; | ||
863 | if (drv_data->ssp_type != PXA25x_SSP) | ||
864 | write_SSTO(chip->timeout, reg); | ||
865 | write_SSCR1(chip->cr1 | ||
866 | | chip->dma_threshold | ||
867 | | drv_data->dma_cr1, | ||
868 | reg); | ||
869 | } else { | ||
870 | /* Ensure we have the correct interrupt handler */ | ||
871 | drv_data->transfer_handler = interrupt_transfer; | ||
872 | |||
873 | /* Fix me, need to handle cs polarity */ | ||
874 | drv_data->cs_control(PXA2XX_CS_ASSERT); | ||
875 | |||
876 | /* Go baby, go */ | ||
877 | write_SSSR(drv_data->clear_sr, reg); | ||
878 | if (drv_data->ssp_type != PXA25x_SSP) | ||
879 | write_SSTO(chip->timeout, reg); | ||
880 | write_SSCR1(chip->cr1 | ||
881 | | chip->threshold | ||
882 | | drv_data->int_cr1, | ||
883 | reg); | ||
884 | } | ||
885 | } | ||
886 | |||
887 | static void pump_messages(void *data) | ||
888 | { | ||
889 | struct driver_data *drv_data = data; | ||
890 | unsigned long flags; | ||
891 | |||
892 | /* Lock queue and check for queue work */ | ||
893 | spin_lock_irqsave(&drv_data->lock, flags); | ||
894 | if (list_empty(&drv_data->queue) || drv_data->run == QUEUE_STOPPED) { | ||
895 | drv_data->busy = 0; | ||
896 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
897 | return; | ||
898 | } | ||
899 | |||
900 | /* Make sure we are not already running a message */ | ||
901 | if (drv_data->cur_msg) { | ||
902 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
903 | return; | ||
904 | } | ||
905 | |||
906 | /* Extract head of queue */ | ||
907 | drv_data->cur_msg = list_entry(drv_data->queue.next, | ||
908 | struct spi_message, queue); | ||
909 | list_del_init(&drv_data->cur_msg->queue); | ||
910 | |||
911 | /* Initial message state*/ | ||
912 | drv_data->cur_msg->state = START_STATE; | ||
913 | drv_data->cur_transfer = list_entry(drv_data->cur_msg->transfers.next, | ||
914 | struct spi_transfer, | ||
915 | transfer_list); | ||
916 | |||
917 | /* Setup the SSP using the per chip configuration */ | ||
918 | drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi); | ||
919 | restore_state(drv_data); | ||
920 | |||
921 | /* Mark as busy and launch transfers */ | ||
922 | tasklet_schedule(&drv_data->pump_transfers); | ||
923 | |||
924 | drv_data->busy = 1; | ||
925 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
926 | } | ||
927 | |||
928 | static int transfer(struct spi_device *spi, struct spi_message *msg) | ||
929 | { | ||
930 | struct driver_data *drv_data = spi_master_get_devdata(spi->master); | ||
931 | unsigned long flags; | ||
932 | |||
933 | spin_lock_irqsave(&drv_data->lock, flags); | ||
934 | |||
935 | if (drv_data->run == QUEUE_STOPPED) { | ||
936 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
937 | return -ESHUTDOWN; | ||
938 | } | ||
939 | |||
940 | msg->actual_length = 0; | ||
941 | msg->status = -EINPROGRESS; | ||
942 | msg->state = START_STATE; | ||
943 | |||
944 | list_add_tail(&msg->queue, &drv_data->queue); | ||
945 | |||
946 | if (drv_data->run == QUEUE_RUNNING && !drv_data->busy) | ||
947 | queue_work(drv_data->workqueue, &drv_data->pump_messages); | ||
948 | |||
949 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
950 | |||
951 | return 0; | ||
952 | } | ||
953 | |||
954 | static int setup(struct spi_device *spi) | ||
955 | { | ||
956 | struct pxa2xx_spi_chip *chip_info = NULL; | ||
957 | struct chip_data *chip; | ||
958 | struct driver_data *drv_data = spi_master_get_devdata(spi->master); | ||
959 | unsigned int clk_div; | ||
960 | |||
961 | if (!spi->bits_per_word) | ||
962 | spi->bits_per_word = 8; | ||
963 | |||
964 | if (drv_data->ssp_type != PXA25x_SSP | ||
965 | && (spi->bits_per_word < 4 || spi->bits_per_word > 32)) | ||
966 | return -EINVAL; | ||
967 | else if (spi->bits_per_word < 4 || spi->bits_per_word > 16) | ||
968 | return -EINVAL; | ||
969 | |||
970 | /* Only alloc (or use chip_info) on first setup */ | ||
971 | chip = spi_get_ctldata(spi); | ||
972 | if (chip == NULL) { | ||
973 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); | ||
974 | if (!chip) | ||
975 | return -ENOMEM; | ||
976 | |||
977 | chip->cs_control = null_cs_control; | ||
978 | chip->enable_dma = 0; | ||
979 | chip->timeout = SSP_TIMEOUT(1000); | ||
980 | chip->threshold = SSCR1_RxTresh(1) | SSCR1_TxTresh(1); | ||
981 | chip->dma_burst_size = drv_data->master_info->enable_dma ? | ||
982 | DCMD_BURST8 : 0; | ||
983 | |||
984 | chip_info = spi->controller_data; | ||
985 | } | ||
986 | |||
987 | /* chip_info isn't always needed */ | ||
988 | if (chip_info) { | ||
989 | if (chip_info->cs_control) | ||
990 | chip->cs_control = chip_info->cs_control; | ||
991 | |||
992 | chip->timeout = SSP_TIMEOUT(chip_info->timeout_microsecs); | ||
993 | |||
994 | chip->threshold = SSCR1_RxTresh(chip_info->rx_threshold) | ||
995 | | SSCR1_TxTresh(chip_info->tx_threshold); | ||
996 | |||
997 | chip->enable_dma = chip_info->dma_burst_size != 0 | ||
998 | && drv_data->master_info->enable_dma; | ||
999 | chip->dma_threshold = 0; | ||
1000 | |||
1001 | if (chip->enable_dma) { | ||
1002 | if (chip_info->dma_burst_size <= 8) { | ||
1003 | chip->dma_threshold = SSCR1_RxTresh(8) | ||
1004 | | SSCR1_TxTresh(8); | ||
1005 | chip->dma_burst_size = DCMD_BURST8; | ||
1006 | } else if (chip_info->dma_burst_size <= 16) { | ||
1007 | chip->dma_threshold = SSCR1_RxTresh(16) | ||
1008 | | SSCR1_TxTresh(16); | ||
1009 | chip->dma_burst_size = DCMD_BURST16; | ||
1010 | } else { | ||
1011 | chip->dma_threshold = SSCR1_RxTresh(32) | ||
1012 | | SSCR1_TxTresh(32); | ||
1013 | chip->dma_burst_size = DCMD_BURST32; | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | |||
1018 | if (chip_info->enable_loopback) | ||
1019 | chip->cr1 = SSCR1_LBM; | ||
1020 | } | ||
1021 | |||
1022 | if (drv_data->ioaddr == SSP1_VIRT) | ||
1023 | clk_div = SSP1_SerClkDiv(spi->max_speed_hz); | ||
1024 | else if (drv_data->ioaddr == SSP2_VIRT) | ||
1025 | clk_div = SSP2_SerClkDiv(spi->max_speed_hz); | ||
1026 | else if (drv_data->ioaddr == SSP3_VIRT) | ||
1027 | clk_div = SSP3_SerClkDiv(spi->max_speed_hz); | ||
1028 | else | ||
1029 | return -ENODEV; | ||
1030 | chip->speed_hz = spi->max_speed_hz; | ||
1031 | |||
1032 | chip->cr0 = clk_div | ||
1033 | | SSCR0_Motorola | ||
1034 | | SSCR0_DataSize(spi->bits_per_word > 16 ? | ||
1035 | spi->bits_per_word - 16 : spi->bits_per_word) | ||
1036 | | SSCR0_SSE | ||
1037 | | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0); | ||
1038 | chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) << 4) | ||
1039 | | (((spi->mode & SPI_CPOL) != 0) << 3); | ||
1040 | |||
1041 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ | ||
1042 | if (drv_data->ssp_type != PXA25x_SSP) | ||
1043 | dev_dbg(&spi->dev, "%d bits/word, %d Hz, mode %d\n", | ||
1044 | spi->bits_per_word, | ||
1045 | (CLOCK_SPEED_HZ) | ||
1046 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), | ||
1047 | spi->mode & 0x3); | ||
1048 | else | ||
1049 | dev_dbg(&spi->dev, "%d bits/word, %d Hz, mode %d\n", | ||
1050 | spi->bits_per_word, | ||
1051 | (CLOCK_SPEED_HZ/2) | ||
1052 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), | ||
1053 | spi->mode & 0x3); | ||
1054 | |||
1055 | if (spi->bits_per_word <= 8) { | ||
1056 | chip->n_bytes = 1; | ||
1057 | chip->dma_width = DCMD_WIDTH1; | ||
1058 | chip->read = u8_reader; | ||
1059 | chip->write = u8_writer; | ||
1060 | } else if (spi->bits_per_word <= 16) { | ||
1061 | chip->n_bytes = 2; | ||
1062 | chip->dma_width = DCMD_WIDTH2; | ||
1063 | chip->read = u16_reader; | ||
1064 | chip->write = u16_writer; | ||
1065 | } else if (spi->bits_per_word <= 32) { | ||
1066 | chip->cr0 |= SSCR0_EDSS; | ||
1067 | chip->n_bytes = 4; | ||
1068 | chip->dma_width = DCMD_WIDTH4; | ||
1069 | chip->read = u32_reader; | ||
1070 | chip->write = u32_writer; | ||
1071 | } else { | ||
1072 | dev_err(&spi->dev, "invalid wordsize\n"); | ||
1073 | kfree(chip); | ||
1074 | return -ENODEV; | ||
1075 | } | ||
1076 | chip->bits_per_word = spi->bits_per_word; | ||
1077 | |||
1078 | spi_set_ctldata(spi, chip); | ||
1079 | |||
1080 | return 0; | ||
1081 | } | ||
1082 | |||
1083 | static void cleanup(const struct spi_device *spi) | ||
1084 | { | ||
1085 | struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); | ||
1086 | |||
1087 | kfree(chip); | ||
1088 | } | ||
1089 | |||
1090 | static int init_queue(struct driver_data *drv_data) | ||
1091 | { | ||
1092 | INIT_LIST_HEAD(&drv_data->queue); | ||
1093 | spin_lock_init(&drv_data->lock); | ||
1094 | |||
1095 | drv_data->run = QUEUE_STOPPED; | ||
1096 | drv_data->busy = 0; | ||
1097 | |||
1098 | tasklet_init(&drv_data->pump_transfers, | ||
1099 | pump_transfers, (unsigned long)drv_data); | ||
1100 | |||
1101 | INIT_WORK(&drv_data->pump_messages, pump_messages, drv_data); | ||
1102 | drv_data->workqueue = create_singlethread_workqueue( | ||
1103 | drv_data->master->cdev.dev->bus_id); | ||
1104 | if (drv_data->workqueue == NULL) | ||
1105 | return -EBUSY; | ||
1106 | |||
1107 | return 0; | ||
1108 | } | ||
1109 | |||
1110 | static int start_queue(struct driver_data *drv_data) | ||
1111 | { | ||
1112 | unsigned long flags; | ||
1113 | |||
1114 | spin_lock_irqsave(&drv_data->lock, flags); | ||
1115 | |||
1116 | if (drv_data->run == QUEUE_RUNNING || drv_data->busy) { | ||
1117 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
1118 | return -EBUSY; | ||
1119 | } | ||
1120 | |||
1121 | drv_data->run = QUEUE_RUNNING; | ||
1122 | drv_data->cur_msg = NULL; | ||
1123 | drv_data->cur_transfer = NULL; | ||
1124 | drv_data->cur_chip = NULL; | ||
1125 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
1126 | |||
1127 | queue_work(drv_data->workqueue, &drv_data->pump_messages); | ||
1128 | |||
1129 | return 0; | ||
1130 | } | ||
1131 | |||
1132 | static int stop_queue(struct driver_data *drv_data) | ||
1133 | { | ||
1134 | unsigned long flags; | ||
1135 | unsigned limit = 500; | ||
1136 | int status = 0; | ||
1137 | |||
1138 | spin_lock_irqsave(&drv_data->lock, flags); | ||
1139 | |||
1140 | /* This is a bit lame, but is optimized for the common execution path. | ||
1141 | * A wait_queue on the drv_data->busy could be used, but then the common | ||
1142 | * execution path (pump_messages) would be required to call wake_up or | ||
1143 | * friends on every SPI message. Do this instead */ | ||
1144 | drv_data->run = QUEUE_STOPPED; | ||
1145 | while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) { | ||
1146 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
1147 | msleep(10); | ||
1148 | spin_lock_irqsave(&drv_data->lock, flags); | ||
1149 | } | ||
1150 | |||
1151 | if (!list_empty(&drv_data->queue) || drv_data->busy) | ||
1152 | status = -EBUSY; | ||
1153 | |||
1154 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
1155 | |||
1156 | return status; | ||
1157 | } | ||
1158 | |||
1159 | static int destroy_queue(struct driver_data *drv_data) | ||
1160 | { | ||
1161 | int status; | ||
1162 | |||
1163 | status = stop_queue(drv_data); | ||
1164 | if (status != 0) | ||
1165 | return status; | ||
1166 | |||
1167 | destroy_workqueue(drv_data->workqueue); | ||
1168 | |||
1169 | return 0; | ||
1170 | } | ||
1171 | |||
1172 | static int pxa2xx_spi_probe(struct platform_device *pdev) | ||
1173 | { | ||
1174 | struct device *dev = &pdev->dev; | ||
1175 | struct pxa2xx_spi_master *platform_info; | ||
1176 | struct spi_master *master; | ||
1177 | struct driver_data *drv_data = 0; | ||
1178 | struct resource *memory_resource; | ||
1179 | int irq; | ||
1180 | int status = 0; | ||
1181 | |||
1182 | platform_info = dev->platform_data; | ||
1183 | |||
1184 | if (platform_info->ssp_type == SSP_UNDEFINED) { | ||
1185 | dev_err(&pdev->dev, "undefined SSP\n"); | ||
1186 | return -ENODEV; | ||
1187 | } | ||
1188 | |||
1189 | /* Allocate master with space for drv_data and null dma buffer */ | ||
1190 | master = spi_alloc_master(dev, sizeof(struct driver_data) + 16); | ||
1191 | if (!master) { | ||
1192 | dev_err(&pdev->dev, "can not alloc spi_master\n"); | ||
1193 | return -ENOMEM; | ||
1194 | } | ||
1195 | drv_data = spi_master_get_devdata(master); | ||
1196 | drv_data->master = master; | ||
1197 | drv_data->master_info = platform_info; | ||
1198 | drv_data->pdev = pdev; | ||
1199 | |||
1200 | master->bus_num = pdev->id; | ||
1201 | master->num_chipselect = platform_info->num_chipselect; | ||
1202 | master->cleanup = cleanup; | ||
1203 | master->setup = setup; | ||
1204 | master->transfer = transfer; | ||
1205 | |||
1206 | drv_data->ssp_type = platform_info->ssp_type; | ||
1207 | drv_data->null_dma_buf = (u32 *)ALIGN((u32)(drv_data + | ||
1208 | sizeof(struct driver_data)), 8); | ||
1209 | |||
1210 | /* Setup register addresses */ | ||
1211 | memory_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1212 | if (!memory_resource) { | ||
1213 | dev_err(&pdev->dev, "memory resources not defined\n"); | ||
1214 | status = -ENODEV; | ||
1215 | goto out_error_master_alloc; | ||
1216 | } | ||
1217 | |||
1218 | drv_data->ioaddr = (void *)io_p2v((unsigned long)(memory_resource->start)); | ||
1219 | drv_data->ssdr_physical = memory_resource->start + 0x00000010; | ||
1220 | if (platform_info->ssp_type == PXA25x_SSP) { | ||
1221 | drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE; | ||
1222 | drv_data->dma_cr1 = 0; | ||
1223 | drv_data->clear_sr = SSSR_ROR; | ||
1224 | drv_data->mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR; | ||
1225 | } else { | ||
1226 | drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE; | ||
1227 | drv_data->dma_cr1 = SSCR1_TSRE | SSCR1_RSRE | SSCR1_TINTE; | ||
1228 | drv_data->clear_sr = SSSR_ROR | SSSR_TINT; | ||
1229 | drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR; | ||
1230 | } | ||
1231 | |||
1232 | /* Attach to IRQ */ | ||
1233 | irq = platform_get_irq(pdev, 0); | ||
1234 | if (irq < 0) { | ||
1235 | dev_err(&pdev->dev, "irq resource not defined\n"); | ||
1236 | status = -ENODEV; | ||
1237 | goto out_error_master_alloc; | ||
1238 | } | ||
1239 | |||
1240 | status = request_irq(irq, ssp_int, 0, dev->bus_id, drv_data); | ||
1241 | if (status < 0) { | ||
1242 | dev_err(&pdev->dev, "can not get IRQ\n"); | ||
1243 | goto out_error_master_alloc; | ||
1244 | } | ||
1245 | |||
1246 | /* Setup DMA if requested */ | ||
1247 | drv_data->tx_channel = -1; | ||
1248 | drv_data->rx_channel = -1; | ||
1249 | if (platform_info->enable_dma) { | ||
1250 | |||
1251 | /* Get two DMA channels (rx and tx) */ | ||
1252 | drv_data->rx_channel = pxa_request_dma("pxa2xx_spi_ssp_rx", | ||
1253 | DMA_PRIO_HIGH, | ||
1254 | dma_handler, | ||
1255 | drv_data); | ||
1256 | if (drv_data->rx_channel < 0) { | ||
1257 | dev_err(dev, "problem (%d) requesting rx channel\n", | ||
1258 | drv_data->rx_channel); | ||
1259 | status = -ENODEV; | ||
1260 | goto out_error_irq_alloc; | ||
1261 | } | ||
1262 | drv_data->tx_channel = pxa_request_dma("pxa2xx_spi_ssp_tx", | ||
1263 | DMA_PRIO_MEDIUM, | ||
1264 | dma_handler, | ||
1265 | drv_data); | ||
1266 | if (drv_data->tx_channel < 0) { | ||
1267 | dev_err(dev, "problem (%d) requesting tx channel\n", | ||
1268 | drv_data->tx_channel); | ||
1269 | status = -ENODEV; | ||
1270 | goto out_error_dma_alloc; | ||
1271 | } | ||
1272 | |||
1273 | if (drv_data->ioaddr == SSP1_VIRT) { | ||
1274 | DRCMRRXSSDR = DRCMR_MAPVLD | ||
1275 | | drv_data->rx_channel; | ||
1276 | DRCMRTXSSDR = DRCMR_MAPVLD | ||
1277 | | drv_data->tx_channel; | ||
1278 | } else if (drv_data->ioaddr == SSP2_VIRT) { | ||
1279 | DRCMRRXSS2DR = DRCMR_MAPVLD | ||
1280 | | drv_data->rx_channel; | ||
1281 | DRCMRTXSS2DR = DRCMR_MAPVLD | ||
1282 | | drv_data->tx_channel; | ||
1283 | } else if (drv_data->ioaddr == SSP3_VIRT) { | ||
1284 | DRCMRRXSS3DR = DRCMR_MAPVLD | ||
1285 | | drv_data->rx_channel; | ||
1286 | DRCMRTXSS3DR = DRCMR_MAPVLD | ||
1287 | | drv_data->tx_channel; | ||
1288 | } else { | ||
1289 | dev_err(dev, "bad SSP type\n"); | ||
1290 | goto out_error_dma_alloc; | ||
1291 | } | ||
1292 | } | ||
1293 | |||
1294 | /* Enable SOC clock */ | ||
1295 | pxa_set_cken(platform_info->clock_enable, 1); | ||
1296 | |||
1297 | /* Load default SSP configuration */ | ||
1298 | write_SSCR0(0, drv_data->ioaddr); | ||
1299 | write_SSCR1(SSCR1_RxTresh(4) | SSCR1_TxTresh(12), drv_data->ioaddr); | ||
1300 | write_SSCR0(SSCR0_SerClkDiv(2) | ||
1301 | | SSCR0_Motorola | ||
1302 | | SSCR0_DataSize(8), | ||
1303 | drv_data->ioaddr); | ||
1304 | if (drv_data->ssp_type != PXA25x_SSP) | ||
1305 | write_SSTO(0, drv_data->ioaddr); | ||
1306 | write_SSPSP(0, drv_data->ioaddr); | ||
1307 | |||
1308 | /* Initial and start queue */ | ||
1309 | status = init_queue(drv_data); | ||
1310 | if (status != 0) { | ||
1311 | dev_err(&pdev->dev, "problem initializing queue\n"); | ||
1312 | goto out_error_clock_enabled; | ||
1313 | } | ||
1314 | status = start_queue(drv_data); | ||
1315 | if (status != 0) { | ||
1316 | dev_err(&pdev->dev, "problem starting queue\n"); | ||
1317 | goto out_error_clock_enabled; | ||
1318 | } | ||
1319 | |||
1320 | /* Register with the SPI framework */ | ||
1321 | platform_set_drvdata(pdev, drv_data); | ||
1322 | status = spi_register_master(master); | ||
1323 | if (status != 0) { | ||
1324 | dev_err(&pdev->dev, "problem registering spi master\n"); | ||
1325 | goto out_error_queue_alloc; | ||
1326 | } | ||
1327 | |||
1328 | return status; | ||
1329 | |||
1330 | out_error_queue_alloc: | ||
1331 | destroy_queue(drv_data); | ||
1332 | |||
1333 | out_error_clock_enabled: | ||
1334 | pxa_set_cken(platform_info->clock_enable, 0); | ||
1335 | |||
1336 | out_error_dma_alloc: | ||
1337 | if (drv_data->tx_channel != -1) | ||
1338 | pxa_free_dma(drv_data->tx_channel); | ||
1339 | if (drv_data->rx_channel != -1) | ||
1340 | pxa_free_dma(drv_data->rx_channel); | ||
1341 | |||
1342 | out_error_irq_alloc: | ||
1343 | free_irq(irq, drv_data); | ||
1344 | |||
1345 | out_error_master_alloc: | ||
1346 | spi_master_put(master); | ||
1347 | return status; | ||
1348 | } | ||
1349 | |||
1350 | static int pxa2xx_spi_remove(struct platform_device *pdev) | ||
1351 | { | ||
1352 | struct driver_data *drv_data = platform_get_drvdata(pdev); | ||
1353 | int irq; | ||
1354 | int status = 0; | ||
1355 | |||
1356 | if (!drv_data) | ||
1357 | return 0; | ||
1358 | |||
1359 | /* Remove the queue */ | ||
1360 | status = destroy_queue(drv_data); | ||
1361 | if (status != 0) | ||
1362 | return status; | ||
1363 | |||
1364 | /* Disable the SSP at the peripheral and SOC level */ | ||
1365 | write_SSCR0(0, drv_data->ioaddr); | ||
1366 | pxa_set_cken(drv_data->master_info->clock_enable, 0); | ||
1367 | |||
1368 | /* Release DMA */ | ||
1369 | if (drv_data->master_info->enable_dma) { | ||
1370 | if (drv_data->ioaddr == SSP1_VIRT) { | ||
1371 | DRCMRRXSSDR = 0; | ||
1372 | DRCMRTXSSDR = 0; | ||
1373 | } else if (drv_data->ioaddr == SSP2_VIRT) { | ||
1374 | DRCMRRXSS2DR = 0; | ||
1375 | DRCMRTXSS2DR = 0; | ||
1376 | } else if (drv_data->ioaddr == SSP3_VIRT) { | ||
1377 | DRCMRRXSS3DR = 0; | ||
1378 | DRCMRTXSS3DR = 0; | ||
1379 | } | ||
1380 | pxa_free_dma(drv_data->tx_channel); | ||
1381 | pxa_free_dma(drv_data->rx_channel); | ||
1382 | } | ||
1383 | |||
1384 | /* Release IRQ */ | ||
1385 | irq = platform_get_irq(pdev, 0); | ||
1386 | if (irq >= 0) | ||
1387 | free_irq(irq, drv_data); | ||
1388 | |||
1389 | /* Disconnect from the SPI framework */ | ||
1390 | spi_unregister_master(drv_data->master); | ||
1391 | |||
1392 | /* Prevent double remove */ | ||
1393 | platform_set_drvdata(pdev, NULL); | ||
1394 | |||
1395 | return 0; | ||
1396 | } | ||
1397 | |||
1398 | static void pxa2xx_spi_shutdown(struct platform_device *pdev) | ||
1399 | { | ||
1400 | int status = 0; | ||
1401 | |||
1402 | if ((status = pxa2xx_spi_remove(pdev)) != 0) | ||
1403 | dev_err(&pdev->dev, "shutdown failed with %d\n", status); | ||
1404 | } | ||
1405 | |||
1406 | #ifdef CONFIG_PM | ||
1407 | static int suspend_devices(struct device *dev, void *pm_message) | ||
1408 | { | ||
1409 | pm_message_t *state = pm_message; | ||
1410 | |||
1411 | if (dev->power.power_state.event != state->event) { | ||
1412 | dev_warn(dev, "pm state does not match request\n"); | ||
1413 | return -1; | ||
1414 | } | ||
1415 | |||
1416 | return 0; | ||
1417 | } | ||
1418 | |||
1419 | static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state) | ||
1420 | { | ||
1421 | struct driver_data *drv_data = platform_get_drvdata(pdev); | ||
1422 | int status = 0; | ||
1423 | |||
1424 | /* Check all childern for current power state */ | ||
1425 | if (device_for_each_child(&pdev->dev, &state, suspend_devices) != 0) { | ||
1426 | dev_warn(&pdev->dev, "suspend aborted\n"); | ||
1427 | return -1; | ||
1428 | } | ||
1429 | |||
1430 | status = stop_queue(drv_data); | ||
1431 | if (status != 0) | ||
1432 | return status; | ||
1433 | write_SSCR0(0, drv_data->ioaddr); | ||
1434 | pxa_set_cken(drv_data->master_info->clock_enable, 0); | ||
1435 | |||
1436 | return 0; | ||
1437 | } | ||
1438 | |||
1439 | static int pxa2xx_spi_resume(struct platform_device *pdev) | ||
1440 | { | ||
1441 | struct driver_data *drv_data = platform_get_drvdata(pdev); | ||
1442 | int status = 0; | ||
1443 | |||
1444 | /* Enable the SSP clock */ | ||
1445 | pxa_set_cken(drv_data->master_info->clock_enable, 1); | ||
1446 | |||
1447 | /* Start the queue running */ | ||
1448 | status = start_queue(drv_data); | ||
1449 | if (status != 0) { | ||
1450 | dev_err(&pdev->dev, "problem starting queue (%d)\n", status); | ||
1451 | return status; | ||
1452 | } | ||
1453 | |||
1454 | return 0; | ||
1455 | } | ||
1456 | #else | ||
1457 | #define pxa2xx_spi_suspend NULL | ||
1458 | #define pxa2xx_spi_resume NULL | ||
1459 | #endif /* CONFIG_PM */ | ||
1460 | |||
1461 | static struct platform_driver driver = { | ||
1462 | .driver = { | ||
1463 | .name = "pxa2xx-spi", | ||
1464 | .bus = &platform_bus_type, | ||
1465 | .owner = THIS_MODULE, | ||
1466 | }, | ||
1467 | .probe = pxa2xx_spi_probe, | ||
1468 | .remove = __devexit_p(pxa2xx_spi_remove), | ||
1469 | .shutdown = pxa2xx_spi_shutdown, | ||
1470 | .suspend = pxa2xx_spi_suspend, | ||
1471 | .resume = pxa2xx_spi_resume, | ||
1472 | }; | ||
1473 | |||
1474 | static int __init pxa2xx_spi_init(void) | ||
1475 | { | ||
1476 | platform_driver_register(&driver); | ||
1477 | |||
1478 | return 0; | ||
1479 | } | ||
1480 | module_init(pxa2xx_spi_init); | ||
1481 | |||
1482 | static void __exit pxa2xx_spi_exit(void) | ||
1483 | { | ||
1484 | platform_driver_unregister(&driver); | ||
1485 | } | ||
1486 | module_exit(pxa2xx_spi_exit); | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 94f5e8ed83a7..1cea4a6799fe 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -338,18 +338,18 @@ static struct class spi_master_class = { | |||
338 | * spi_alloc_master - allocate SPI master controller | 338 | * spi_alloc_master - allocate SPI master controller |
339 | * @dev: the controller, possibly using the platform_bus | 339 | * @dev: the controller, possibly using the platform_bus |
340 | * @size: how much driver-private data to preallocate; the pointer to this | 340 | * @size: how much driver-private data to preallocate; the pointer to this |
341 | * memory is in the class_data field of the returned class_device, | 341 | * memory is in the class_data field of the returned class_device, |
342 | * accessible with spi_master_get_devdata(). | 342 | * accessible with spi_master_get_devdata(). |
343 | * | 343 | * |
344 | * This call is used only by SPI master controller drivers, which are the | 344 | * This call is used only by SPI master controller drivers, which are the |
345 | * only ones directly touching chip registers. It's how they allocate | 345 | * only ones directly touching chip registers. It's how they allocate |
346 | * an spi_master structure, prior to calling spi_add_master(). | 346 | * an spi_master structure, prior to calling spi_register_master(). |
347 | * | 347 | * |
348 | * This must be called from context that can sleep. It returns the SPI | 348 | * This must be called from context that can sleep. It returns the SPI |
349 | * master structure on success, else NULL. | 349 | * master structure on success, else NULL. |
350 | * | 350 | * |
351 | * The caller is responsible for assigning the bus number and initializing | 351 | * The caller is responsible for assigning the bus number and initializing |
352 | * the master's methods before calling spi_add_master(); and (after errors | 352 | * the master's methods before calling spi_register_master(); and (after errors |
353 | * adding the device) calling spi_master_put() to prevent a memory leak. | 353 | * adding the device) calling spi_master_put() to prevent a memory leak. |
354 | */ | 354 | */ |
355 | struct spi_master * __init_or_module | 355 | struct spi_master * __init_or_module |
@@ -395,7 +395,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master); | |||
395 | int __init_or_module | 395 | int __init_or_module |
396 | spi_register_master(struct spi_master *master) | 396 | spi_register_master(struct spi_master *master) |
397 | { | 397 | { |
398 | static atomic_t dyn_bus_id = ATOMIC_INIT(0); | 398 | static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); |
399 | struct device *dev = master->cdev.dev; | 399 | struct device *dev = master->cdev.dev; |
400 | int status = -ENODEV; | 400 | int status = -ENODEV; |
401 | int dynamic = 0; | 401 | int dynamic = 0; |
@@ -404,7 +404,7 @@ spi_register_master(struct spi_master *master) | |||
404 | return -ENODEV; | 404 | return -ENODEV; |
405 | 405 | ||
406 | /* convention: dynamically assigned bus IDs count down from the max */ | 406 | /* convention: dynamically assigned bus IDs count down from the max */ |
407 | if (master->bus_num == 0) { | 407 | if (master->bus_num < 0) { |
408 | master->bus_num = atomic_dec_return(&dyn_bus_id); | 408 | master->bus_num = atomic_dec_return(&dyn_bus_id); |
409 | dynamic = 1; | 409 | dynamic = 1; |
410 | } | 410 | } |
@@ -522,7 +522,8 @@ int spi_sync(struct spi_device *spi, struct spi_message *message) | |||
522 | } | 522 | } |
523 | EXPORT_SYMBOL_GPL(spi_sync); | 523 | EXPORT_SYMBOL_GPL(spi_sync); |
524 | 524 | ||
525 | #define SPI_BUFSIZ (SMP_CACHE_BYTES) | 525 | /* portable code must never pass more than 32 bytes */ |
526 | #define SPI_BUFSIZ max(32,SMP_CACHE_BYTES) | ||
526 | 527 | ||
527 | static u8 *buf; | 528 | static u8 *buf; |
528 | 529 | ||
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index f037e5593269..dd2f950b21a7 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -138,6 +138,45 @@ static unsigned bitbang_txrx_32( | |||
138 | return t->len - count; | 138 | return t->len - count; |
139 | } | 139 | } |
140 | 140 | ||
141 | int spi_bitbang_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | ||
142 | { | ||
143 | struct spi_bitbang_cs *cs = spi->controller_state; | ||
144 | u8 bits_per_word; | ||
145 | u32 hz; | ||
146 | |||
147 | if (t) { | ||
148 | bits_per_word = t->bits_per_word; | ||
149 | hz = t->speed_hz; | ||
150 | } else { | ||
151 | bits_per_word = 0; | ||
152 | hz = 0; | ||
153 | } | ||
154 | |||
155 | /* spi_transfer level calls that work per-word */ | ||
156 | if (!bits_per_word) | ||
157 | bits_per_word = spi->bits_per_word; | ||
158 | if (bits_per_word <= 8) | ||
159 | cs->txrx_bufs = bitbang_txrx_8; | ||
160 | else if (bits_per_word <= 16) | ||
161 | cs->txrx_bufs = bitbang_txrx_16; | ||
162 | else if (bits_per_word <= 32) | ||
163 | cs->txrx_bufs = bitbang_txrx_32; | ||
164 | else | ||
165 | return -EINVAL; | ||
166 | |||
167 | /* nsecs = (clock period)/2 */ | ||
168 | if (!hz) | ||
169 | hz = spi->max_speed_hz; | ||
170 | if (hz) { | ||
171 | cs->nsecs = (1000000000/2) / hz; | ||
172 | if (cs->nsecs > (MAX_UDELAY_MS * 1000 * 1000)) | ||
173 | return -EINVAL; | ||
174 | } | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | EXPORT_SYMBOL_GPL(spi_bitbang_setup_transfer); | ||
179 | |||
141 | /** | 180 | /** |
142 | * spi_bitbang_setup - default setup for per-word I/O loops | 181 | * spi_bitbang_setup - default setup for per-word I/O loops |
143 | */ | 182 | */ |
@@ -145,8 +184,16 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
145 | { | 184 | { |
146 | struct spi_bitbang_cs *cs = spi->controller_state; | 185 | struct spi_bitbang_cs *cs = spi->controller_state; |
147 | struct spi_bitbang *bitbang; | 186 | struct spi_bitbang *bitbang; |
187 | int retval; | ||
148 | 188 | ||
149 | if (!spi->max_speed_hz) | 189 | bitbang = spi_master_get_devdata(spi->master); |
190 | |||
191 | /* REVISIT: some systems will want to support devices using lsb-first | ||
192 | * bit encodings on the wire. In pure software that would be trivial, | ||
193 | * just bitbang_txrx_le_cphaX() routines shifting the other way, and | ||
194 | * some hardware controllers also have this support. | ||
195 | */ | ||
196 | if ((spi->mode & SPI_LSB_FIRST) != 0) | ||
150 | return -EINVAL; | 197 | return -EINVAL; |
151 | 198 | ||
152 | if (!cs) { | 199 | if (!cs) { |
@@ -155,32 +202,20 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
155 | return -ENOMEM; | 202 | return -ENOMEM; |
156 | spi->controller_state = cs; | 203 | spi->controller_state = cs; |
157 | } | 204 | } |
158 | bitbang = spi_master_get_devdata(spi->master); | ||
159 | 205 | ||
160 | if (!spi->bits_per_word) | 206 | if (!spi->bits_per_word) |
161 | spi->bits_per_word = 8; | 207 | spi->bits_per_word = 8; |
162 | 208 | ||
163 | /* spi_transfer level calls that work per-word */ | ||
164 | if (spi->bits_per_word <= 8) | ||
165 | cs->txrx_bufs = bitbang_txrx_8; | ||
166 | else if (spi->bits_per_word <= 16) | ||
167 | cs->txrx_bufs = bitbang_txrx_16; | ||
168 | else if (spi->bits_per_word <= 32) | ||
169 | cs->txrx_bufs = bitbang_txrx_32; | ||
170 | else | ||
171 | return -EINVAL; | ||
172 | |||
173 | /* per-word shift register access, in hardware or bitbanging */ | 209 | /* per-word shift register access, in hardware or bitbanging */ |
174 | cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; | 210 | cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; |
175 | if (!cs->txrx_word) | 211 | if (!cs->txrx_word) |
176 | return -EINVAL; | 212 | return -EINVAL; |
177 | 213 | ||
178 | /* nsecs = (clock period)/2 */ | 214 | retval = spi_bitbang_setup_transfer(spi, NULL); |
179 | cs->nsecs = (1000000000/2) / (spi->max_speed_hz); | 215 | if (retval < 0) |
180 | if (cs->nsecs > MAX_UDELAY_MS * 1000) | 216 | return retval; |
181 | return -EINVAL; | ||
182 | 217 | ||
183 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n", | 218 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n", |
184 | __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA), | 219 | __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA), |
185 | spi->bits_per_word, 2 * cs->nsecs); | 220 | spi->bits_per_word, 2 * cs->nsecs); |
186 | 221 | ||
@@ -246,6 +281,8 @@ static void bitbang_work(void *_bitbang) | |||
246 | unsigned tmp; | 281 | unsigned tmp; |
247 | unsigned cs_change; | 282 | unsigned cs_change; |
248 | int status; | 283 | int status; |
284 | int (*setup_transfer)(struct spi_device *, | ||
285 | struct spi_transfer *); | ||
249 | 286 | ||
250 | m = container_of(bitbang->queue.next, struct spi_message, | 287 | m = container_of(bitbang->queue.next, struct spi_message, |
251 | queue); | 288 | queue); |
@@ -262,6 +299,7 @@ static void bitbang_work(void *_bitbang) | |||
262 | tmp = 0; | 299 | tmp = 0; |
263 | cs_change = 1; | 300 | cs_change = 1; |
264 | status = 0; | 301 | status = 0; |
302 | setup_transfer = NULL; | ||
265 | 303 | ||
266 | list_for_each_entry (t, &m->transfers, transfer_list) { | 304 | list_for_each_entry (t, &m->transfers, transfer_list) { |
267 | if (bitbang->shutdown) { | 305 | if (bitbang->shutdown) { |
@@ -269,6 +307,20 @@ static void bitbang_work(void *_bitbang) | |||
269 | break; | 307 | break; |
270 | } | 308 | } |
271 | 309 | ||
310 | /* override or restore speed and wordsize */ | ||
311 | if (t->speed_hz || t->bits_per_word) { | ||
312 | setup_transfer = bitbang->setup_transfer; | ||
313 | if (!setup_transfer) { | ||
314 | status = -ENOPROTOOPT; | ||
315 | break; | ||
316 | } | ||
317 | } | ||
318 | if (setup_transfer) { | ||
319 | status = setup_transfer(spi, t); | ||
320 | if (status < 0) | ||
321 | break; | ||
322 | } | ||
323 | |||
272 | /* set up default clock polarity, and activate chip; | 324 | /* set up default clock polarity, and activate chip; |
273 | * this implicitly updates clock and spi modes as | 325 | * this implicitly updates clock and spi modes as |
274 | * previously recorded for this device via setup(). | 326 | * previously recorded for this device via setup(). |
@@ -325,6 +377,10 @@ static void bitbang_work(void *_bitbang) | |||
325 | m->status = status; | 377 | m->status = status; |
326 | m->complete(m->context); | 378 | m->complete(m->context); |
327 | 379 | ||
380 | /* restore speed and wordsize */ | ||
381 | if (setup_transfer) | ||
382 | setup_transfer(spi, NULL); | ||
383 | |||
328 | /* normally deactivate chipselect ... unless no error and | 384 | /* normally deactivate chipselect ... unless no error and |
329 | * cs_change has hinted that the next message will probably | 385 | * cs_change has hinted that the next message will probably |
330 | * be for this chip too. | 386 | * be for this chip too. |
@@ -348,6 +404,7 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m) | |||
348 | { | 404 | { |
349 | struct spi_bitbang *bitbang; | 405 | struct spi_bitbang *bitbang; |
350 | unsigned long flags; | 406 | unsigned long flags; |
407 | int status = 0; | ||
351 | 408 | ||
352 | m->actual_length = 0; | 409 | m->actual_length = 0; |
353 | m->status = -EINPROGRESS; | 410 | m->status = -EINPROGRESS; |
@@ -357,11 +414,15 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m) | |||
357 | return -ESHUTDOWN; | 414 | return -ESHUTDOWN; |
358 | 415 | ||
359 | spin_lock_irqsave(&bitbang->lock, flags); | 416 | spin_lock_irqsave(&bitbang->lock, flags); |
360 | list_add_tail(&m->queue, &bitbang->queue); | 417 | if (!spi->max_speed_hz) |
361 | queue_work(bitbang->workqueue, &bitbang->work); | 418 | status = -ENETDOWN; |
419 | else { | ||
420 | list_add_tail(&m->queue, &bitbang->queue); | ||
421 | queue_work(bitbang->workqueue, &bitbang->work); | ||
422 | } | ||
362 | spin_unlock_irqrestore(&bitbang->lock, flags); | 423 | spin_unlock_irqrestore(&bitbang->lock, flags); |
363 | 424 | ||
364 | return 0; | 425 | return status; |
365 | } | 426 | } |
366 | EXPORT_SYMBOL_GPL(spi_bitbang_transfer); | 427 | EXPORT_SYMBOL_GPL(spi_bitbang_transfer); |
367 | 428 | ||
@@ -406,6 +467,9 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) | |||
406 | bitbang->use_dma = 0; | 467 | bitbang->use_dma = 0; |
407 | bitbang->txrx_bufs = spi_bitbang_bufs; | 468 | bitbang->txrx_bufs = spi_bitbang_bufs; |
408 | if (!bitbang->master->setup) { | 469 | if (!bitbang->master->setup) { |
470 | if (!bitbang->setup_transfer) | ||
471 | bitbang->setup_transfer = | ||
472 | spi_bitbang_setup_transfer; | ||
409 | bitbang->master->setup = spi_bitbang_setup; | 473 | bitbang->master->setup = spi_bitbang_setup; |
410 | bitbang->master->cleanup = spi_bitbang_cleanup; | 474 | bitbang->master->cleanup = spi_bitbang_cleanup; |
411 | } | 475 | } |
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c index ff9e5faa4dc9..a006a1ee27ac 100644 --- a/drivers/spi/spi_butterfly.c +++ b/drivers/spi/spi_butterfly.c | |||
@@ -321,6 +321,7 @@ static void butterfly_attach(struct parport *p) | |||
321 | * (firmware resets at45, acts as spi slave) or neither (we ignore | 321 | * (firmware resets at45, acts as spi slave) or neither (we ignore |
322 | * both, AVR uses AT45). Here we expect firmware for the first option. | 322 | * both, AVR uses AT45). Here we expect firmware for the first option. |
323 | */ | 323 | */ |
324 | |||
324 | pp->info[0].max_speed_hz = 15 * 1000 * 1000; | 325 | pp->info[0].max_speed_hz = 15 * 1000 * 1000; |
325 | strcpy(pp->info[0].modalias, "mtd_dataflash"); | 326 | strcpy(pp->info[0].modalias, "mtd_dataflash"); |
326 | pp->info[0].platform_data = &flash; | 327 | pp->info[0].platform_data = &flash; |
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c new file mode 100644 index 000000000000..5d92a7e5cb41 --- /dev/null +++ b/drivers/spi/spi_mpc83xx.c | |||
@@ -0,0 +1,483 @@ | |||
1 | /* | ||
2 | * MPC83xx SPI controller driver. | ||
3 | * | ||
4 | * Maintainer: Kumar Gala | ||
5 | * | ||
6 | * Copyright (C) 2006 Polycom, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/completion.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/spi/spi.h> | ||
23 | #include <linux/spi/spi_bitbang.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/fsl_devices.h> | ||
26 | |||
27 | #include <asm/irq.h> | ||
28 | #include <asm/io.h> | ||
29 | |||
30 | /* SPI Controller registers */ | ||
31 | struct mpc83xx_spi_reg { | ||
32 | u8 res1[0x20]; | ||
33 | __be32 mode; | ||
34 | __be32 event; | ||
35 | __be32 mask; | ||
36 | __be32 command; | ||
37 | __be32 transmit; | ||
38 | __be32 receive; | ||
39 | }; | ||
40 | |||
41 | /* SPI Controller mode register definitions */ | ||
42 | #define SPMODE_CI_INACTIVEHIGH (1 << 29) | ||
43 | #define SPMODE_CP_BEGIN_EDGECLK (1 << 28) | ||
44 | #define SPMODE_DIV16 (1 << 27) | ||
45 | #define SPMODE_REV (1 << 26) | ||
46 | #define SPMODE_MS (1 << 25) | ||
47 | #define SPMODE_ENABLE (1 << 24) | ||
48 | #define SPMODE_LEN(x) ((x) << 20) | ||
49 | #define SPMODE_PM(x) ((x) << 16) | ||
50 | |||
51 | /* | ||
52 | * Default for SPI Mode: | ||
53 | * SPI MODE 0 (inactive low, phase middle, MSB, 8-bit length, slow clk | ||
54 | */ | ||
55 | #define SPMODE_INIT_VAL (SPMODE_CI_INACTIVEHIGH | SPMODE_DIV16 | SPMODE_REV | \ | ||
56 | SPMODE_MS | SPMODE_LEN(7) | SPMODE_PM(0xf)) | ||
57 | |||
58 | /* SPIE register values */ | ||
59 | #define SPIE_NE 0x00000200 /* Not empty */ | ||
60 | #define SPIE_NF 0x00000100 /* Not full */ | ||
61 | |||
62 | /* SPIM register values */ | ||
63 | #define SPIM_NE 0x00000200 /* Not empty */ | ||
64 | #define SPIM_NF 0x00000100 /* Not full */ | ||
65 | |||
66 | /* SPI Controller driver's private data. */ | ||
67 | struct mpc83xx_spi { | ||
68 | /* bitbang has to be first */ | ||
69 | struct spi_bitbang bitbang; | ||
70 | struct completion done; | ||
71 | |||
72 | struct mpc83xx_spi_reg __iomem *base; | ||
73 | |||
74 | /* rx & tx bufs from the spi_transfer */ | ||
75 | const void *tx; | ||
76 | void *rx; | ||
77 | |||
78 | /* functions to deal with different sized buffers */ | ||
79 | void (*get_rx) (u32 rx_data, struct mpc83xx_spi *); | ||
80 | u32(*get_tx) (struct mpc83xx_spi *); | ||
81 | |||
82 | unsigned int count; | ||
83 | u32 irq; | ||
84 | |||
85 | unsigned nsecs; /* (clock cycle time)/2 */ | ||
86 | |||
87 | u32 sysclk; | ||
88 | void (*activate_cs) (u8 cs, u8 polarity); | ||
89 | void (*deactivate_cs) (u8 cs, u8 polarity); | ||
90 | }; | ||
91 | |||
92 | static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val) | ||
93 | { | ||
94 | out_be32(reg, val); | ||
95 | } | ||
96 | |||
97 | static inline u32 mpc83xx_spi_read_reg(__be32 __iomem * reg) | ||
98 | { | ||
99 | return in_be32(reg); | ||
100 | } | ||
101 | |||
102 | #define MPC83XX_SPI_RX_BUF(type) \ | ||
103 | void mpc83xx_spi_rx_buf_##type(u32 data, struct mpc83xx_spi *mpc83xx_spi) \ | ||
104 | { \ | ||
105 | type * rx = mpc83xx_spi->rx; \ | ||
106 | *rx++ = (type)data; \ | ||
107 | mpc83xx_spi->rx = rx; \ | ||
108 | } | ||
109 | |||
110 | #define MPC83XX_SPI_TX_BUF(type) \ | ||
111 | u32 mpc83xx_spi_tx_buf_##type(struct mpc83xx_spi *mpc83xx_spi) \ | ||
112 | { \ | ||
113 | u32 data; \ | ||
114 | const type * tx = mpc83xx_spi->tx; \ | ||
115 | data = *tx++; \ | ||
116 | mpc83xx_spi->tx = tx; \ | ||
117 | return data; \ | ||
118 | } | ||
119 | |||
120 | MPC83XX_SPI_RX_BUF(u8) | ||
121 | MPC83XX_SPI_RX_BUF(u16) | ||
122 | MPC83XX_SPI_RX_BUF(u32) | ||
123 | MPC83XX_SPI_TX_BUF(u8) | ||
124 | MPC83XX_SPI_TX_BUF(u16) | ||
125 | MPC83XX_SPI_TX_BUF(u32) | ||
126 | |||
127 | static void mpc83xx_spi_chipselect(struct spi_device *spi, int value) | ||
128 | { | ||
129 | struct mpc83xx_spi *mpc83xx_spi; | ||
130 | u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0; | ||
131 | |||
132 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
133 | |||
134 | if (value == BITBANG_CS_INACTIVE) { | ||
135 | if (mpc83xx_spi->deactivate_cs) | ||
136 | mpc83xx_spi->deactivate_cs(spi->chip_select, pol); | ||
137 | } | ||
138 | |||
139 | if (value == BITBANG_CS_ACTIVE) { | ||
140 | u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); | ||
141 | u32 len = spi->bits_per_word; | ||
142 | if (len == 32) | ||
143 | len = 0; | ||
144 | else | ||
145 | len = len - 1; | ||
146 | |||
147 | /* mask out bits we are going to set */ | ||
148 | regval &= ~0x38ff0000; | ||
149 | |||
150 | if (spi->mode & SPI_CPHA) | ||
151 | regval |= SPMODE_CP_BEGIN_EDGECLK; | ||
152 | if (spi->mode & SPI_CPOL) | ||
153 | regval |= SPMODE_CI_INACTIVEHIGH; | ||
154 | |||
155 | regval |= SPMODE_LEN(len); | ||
156 | |||
157 | if ((mpc83xx_spi->sysclk / spi->max_speed_hz) >= 64) { | ||
158 | u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 64); | ||
159 | regval |= SPMODE_PM(pm) | SPMODE_DIV16; | ||
160 | } else { | ||
161 | u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 4); | ||
162 | regval |= SPMODE_PM(pm); | ||
163 | } | ||
164 | |||
165 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval); | ||
166 | if (mpc83xx_spi->activate_cs) | ||
167 | mpc83xx_spi->activate_cs(spi->chip_select, pol); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | static | ||
172 | int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | ||
173 | { | ||
174 | struct mpc83xx_spi *mpc83xx_spi; | ||
175 | u32 regval; | ||
176 | u8 bits_per_word; | ||
177 | u32 hz; | ||
178 | |||
179 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
180 | |||
181 | if (t) { | ||
182 | bits_per_word = t->bits_per_word; | ||
183 | hz = t->speed_hz; | ||
184 | } else { | ||
185 | bits_per_word = 0; | ||
186 | hz = 0; | ||
187 | } | ||
188 | |||
189 | /* spi_transfer level calls that work per-word */ | ||
190 | if (!bits_per_word) | ||
191 | bits_per_word = spi->bits_per_word; | ||
192 | |||
193 | /* Make sure its a bit width we support [4..16, 32] */ | ||
194 | if ((bits_per_word < 4) | ||
195 | || ((bits_per_word > 16) && (bits_per_word != 32))) | ||
196 | return -EINVAL; | ||
197 | |||
198 | if (bits_per_word <= 8) { | ||
199 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; | ||
200 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; | ||
201 | } else if (bits_per_word <= 16) { | ||
202 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u16; | ||
203 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u16; | ||
204 | } else if (bits_per_word <= 32) { | ||
205 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u32; | ||
206 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u32; | ||
207 | } else | ||
208 | return -EINVAL; | ||
209 | |||
210 | /* nsecs = (clock period)/2 */ | ||
211 | if (!hz) | ||
212 | hz = spi->max_speed_hz; | ||
213 | mpc83xx_spi->nsecs = (1000000000 / 2) / hz; | ||
214 | if (mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000) | ||
215 | return -EINVAL; | ||
216 | |||
217 | if (bits_per_word == 32) | ||
218 | bits_per_word = 0; | ||
219 | else | ||
220 | bits_per_word = bits_per_word - 1; | ||
221 | |||
222 | regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); | ||
223 | |||
224 | /* Mask out bits_per_wordgth */ | ||
225 | regval &= 0xff0fffff; | ||
226 | regval |= SPMODE_LEN(bits_per_word); | ||
227 | |||
228 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval); | ||
229 | |||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | static int mpc83xx_spi_setup(struct spi_device *spi) | ||
234 | { | ||
235 | struct spi_bitbang *bitbang; | ||
236 | struct mpc83xx_spi *mpc83xx_spi; | ||
237 | int retval; | ||
238 | |||
239 | if (!spi->max_speed_hz) | ||
240 | return -EINVAL; | ||
241 | |||
242 | bitbang = spi_master_get_devdata(spi->master); | ||
243 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
244 | |||
245 | if (!spi->bits_per_word) | ||
246 | spi->bits_per_word = 8; | ||
247 | |||
248 | retval = mpc83xx_spi_setup_transfer(spi, NULL); | ||
249 | if (retval < 0) | ||
250 | return retval; | ||
251 | |||
252 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n", | ||
253 | __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA), | ||
254 | spi->bits_per_word, 2 * mpc83xx_spi->nsecs); | ||
255 | |||
256 | /* NOTE we _need_ to call chipselect() early, ideally with adapter | ||
257 | * setup, unless the hardware defaults cooperate to avoid confusion | ||
258 | * between normal (active low) and inverted chipselects. | ||
259 | */ | ||
260 | |||
261 | /* deselect chip (low or high) */ | ||
262 | spin_lock(&bitbang->lock); | ||
263 | if (!bitbang->busy) { | ||
264 | bitbang->chipselect(spi, BITBANG_CS_INACTIVE); | ||
265 | ndelay(mpc83xx_spi->nsecs); | ||
266 | } | ||
267 | spin_unlock(&bitbang->lock); | ||
268 | |||
269 | return 0; | ||
270 | } | ||
271 | |||
272 | static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | ||
273 | { | ||
274 | struct mpc83xx_spi *mpc83xx_spi; | ||
275 | u32 word; | ||
276 | |||
277 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
278 | |||
279 | mpc83xx_spi->tx = t->tx_buf; | ||
280 | mpc83xx_spi->rx = t->rx_buf; | ||
281 | mpc83xx_spi->count = t->len; | ||
282 | INIT_COMPLETION(mpc83xx_spi->done); | ||
283 | |||
284 | /* enable rx ints */ | ||
285 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE); | ||
286 | |||
287 | /* transmit word */ | ||
288 | word = mpc83xx_spi->get_tx(mpc83xx_spi); | ||
289 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word); | ||
290 | |||
291 | wait_for_completion(&mpc83xx_spi->done); | ||
292 | |||
293 | /* disable rx ints */ | ||
294 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0); | ||
295 | |||
296 | return t->len - mpc83xx_spi->count; | ||
297 | } | ||
298 | |||
299 | irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data, | ||
300 | struct pt_regs * ptregs) | ||
301 | { | ||
302 | struct mpc83xx_spi *mpc83xx_spi = context_data; | ||
303 | u32 event; | ||
304 | irqreturn_t ret = IRQ_NONE; | ||
305 | |||
306 | /* Get interrupt events(tx/rx) */ | ||
307 | event = mpc83xx_spi_read_reg(&mpc83xx_spi->base->event); | ||
308 | |||
309 | /* We need handle RX first */ | ||
310 | if (event & SPIE_NE) { | ||
311 | u32 rx_data = mpc83xx_spi_read_reg(&mpc83xx_spi->base->receive); | ||
312 | |||
313 | if (mpc83xx_spi->rx) | ||
314 | mpc83xx_spi->get_rx(rx_data, mpc83xx_spi); | ||
315 | |||
316 | ret = IRQ_HANDLED; | ||
317 | } | ||
318 | |||
319 | if ((event & SPIE_NF) == 0) | ||
320 | /* spin until TX is done */ | ||
321 | while (((event = | ||
322 | mpc83xx_spi_read_reg(&mpc83xx_spi->base->event)) & | ||
323 | SPIE_NF) == 0) | ||
324 | cpu_relax(); | ||
325 | |||
326 | mpc83xx_spi->count -= 1; | ||
327 | if (mpc83xx_spi->count) { | ||
328 | if (mpc83xx_spi->tx) { | ||
329 | u32 word = mpc83xx_spi->get_tx(mpc83xx_spi); | ||
330 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, | ||
331 | word); | ||
332 | } | ||
333 | } else { | ||
334 | complete(&mpc83xx_spi->done); | ||
335 | } | ||
336 | |||
337 | /* Clear the events */ | ||
338 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, event); | ||
339 | |||
340 | return ret; | ||
341 | } | ||
342 | |||
343 | static int __init mpc83xx_spi_probe(struct platform_device *dev) | ||
344 | { | ||
345 | struct spi_master *master; | ||
346 | struct mpc83xx_spi *mpc83xx_spi; | ||
347 | struct fsl_spi_platform_data *pdata; | ||
348 | struct resource *r; | ||
349 | u32 regval; | ||
350 | int ret = 0; | ||
351 | |||
352 | /* Get resources(memory, IRQ) associated with the device */ | ||
353 | master = spi_alloc_master(&dev->dev, sizeof(struct mpc83xx_spi)); | ||
354 | |||
355 | if (master == NULL) { | ||
356 | ret = -ENOMEM; | ||
357 | goto err; | ||
358 | } | ||
359 | |||
360 | platform_set_drvdata(dev, master); | ||
361 | pdata = dev->dev.platform_data; | ||
362 | |||
363 | if (pdata == NULL) { | ||
364 | ret = -ENODEV; | ||
365 | goto free_master; | ||
366 | } | ||
367 | |||
368 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
369 | if (r == NULL) { | ||
370 | ret = -ENODEV; | ||
371 | goto free_master; | ||
372 | } | ||
373 | |||
374 | mpc83xx_spi = spi_master_get_devdata(master); | ||
375 | mpc83xx_spi->bitbang.master = spi_master_get(master); | ||
376 | mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect; | ||
377 | mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer; | ||
378 | mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs; | ||
379 | mpc83xx_spi->sysclk = pdata->sysclk; | ||
380 | mpc83xx_spi->activate_cs = pdata->activate_cs; | ||
381 | mpc83xx_spi->deactivate_cs = pdata->deactivate_cs; | ||
382 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; | ||
383 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; | ||
384 | |||
385 | mpc83xx_spi->bitbang.master->setup = mpc83xx_spi_setup; | ||
386 | init_completion(&mpc83xx_spi->done); | ||
387 | |||
388 | mpc83xx_spi->base = ioremap(r->start, r->end - r->start + 1); | ||
389 | if (mpc83xx_spi->base == NULL) { | ||
390 | ret = -ENOMEM; | ||
391 | goto put_master; | ||
392 | } | ||
393 | |||
394 | mpc83xx_spi->irq = platform_get_irq(dev, 0); | ||
395 | |||
396 | if (mpc83xx_spi->irq < 0) { | ||
397 | ret = -ENXIO; | ||
398 | goto unmap_io; | ||
399 | } | ||
400 | |||
401 | /* Register for SPI Interrupt */ | ||
402 | ret = request_irq(mpc83xx_spi->irq, mpc83xx_spi_irq, | ||
403 | 0, "mpc83xx_spi", mpc83xx_spi); | ||
404 | |||
405 | if (ret != 0) | ||
406 | goto unmap_io; | ||
407 | |||
408 | master->bus_num = pdata->bus_num; | ||
409 | master->num_chipselect = pdata->max_chipselect; | ||
410 | |||
411 | /* SPI controller initializations */ | ||
412 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0); | ||
413 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0); | ||
414 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->command, 0); | ||
415 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, 0xffffffff); | ||
416 | |||
417 | /* Enable SPI interface */ | ||
418 | regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE; | ||
419 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval); | ||
420 | |||
421 | ret = spi_bitbang_start(&mpc83xx_spi->bitbang); | ||
422 | |||
423 | if (ret != 0) | ||
424 | goto free_irq; | ||
425 | |||
426 | printk(KERN_INFO | ||
427 | "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n", | ||
428 | dev->dev.bus_id, mpc83xx_spi->base, mpc83xx_spi->irq); | ||
429 | |||
430 | return ret; | ||
431 | |||
432 | free_irq: | ||
433 | free_irq(mpc83xx_spi->irq, mpc83xx_spi); | ||
434 | unmap_io: | ||
435 | iounmap(mpc83xx_spi->base); | ||
436 | put_master: | ||
437 | spi_master_put(master); | ||
438 | free_master: | ||
439 | kfree(master); | ||
440 | err: | ||
441 | return ret; | ||
442 | } | ||
443 | |||
444 | static int __devexit mpc83xx_spi_remove(struct platform_device *dev) | ||
445 | { | ||
446 | struct mpc83xx_spi *mpc83xx_spi; | ||
447 | struct spi_master *master; | ||
448 | |||
449 | master = platform_get_drvdata(dev); | ||
450 | mpc83xx_spi = spi_master_get_devdata(master); | ||
451 | |||
452 | spi_bitbang_stop(&mpc83xx_spi->bitbang); | ||
453 | free_irq(mpc83xx_spi->irq, mpc83xx_spi); | ||
454 | iounmap(mpc83xx_spi->base); | ||
455 | spi_master_put(mpc83xx_spi->bitbang.master); | ||
456 | |||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | static struct platform_driver mpc83xx_spi_driver = { | ||
461 | .probe = mpc83xx_spi_probe, | ||
462 | .remove = __devexit_p(mpc83xx_spi_remove), | ||
463 | .driver = { | ||
464 | .name = "mpc83xx_spi", | ||
465 | }, | ||
466 | }; | ||
467 | |||
468 | static int __init mpc83xx_spi_init(void) | ||
469 | { | ||
470 | return platform_driver_register(&mpc83xx_spi_driver); | ||
471 | } | ||
472 | |||
473 | static void __exit mpc83xx_spi_exit(void) | ||
474 | { | ||
475 | platform_driver_unregister(&mpc83xx_spi_driver); | ||
476 | } | ||
477 | |||
478 | module_init(mpc83xx_spi_init); | ||
479 | module_exit(mpc83xx_spi_exit); | ||
480 | |||
481 | MODULE_AUTHOR("Kumar Gala"); | ||
482 | MODULE_DESCRIPTION("Simple MPC83xx SPI Driver"); | ||
483 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c new file mode 100644 index 000000000000..5fc14563ee3a --- /dev/null +++ b/drivers/spi/spi_s3c24xx.c | |||
@@ -0,0 +1,453 @@ | |||
1 | /* linux/drivers/spi/spi_s3c24xx.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Ben Dooks | ||
4 | * Copyright (c) 2006 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | |||
14 | //#define DEBUG | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | #include <linux/workqueue.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/err.h> | ||
24 | #include <linux/clk.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | |||
27 | #include <linux/spi/spi.h> | ||
28 | #include <linux/spi/spi_bitbang.h> | ||
29 | |||
30 | #include <asm/io.h> | ||
31 | #include <asm/dma.h> | ||
32 | #include <asm/hardware.h> | ||
33 | |||
34 | #include <asm/arch/regs-gpio.h> | ||
35 | #include <asm/arch/regs-spi.h> | ||
36 | #include <asm/arch/spi.h> | ||
37 | |||
38 | struct s3c24xx_spi { | ||
39 | /* bitbang has to be first */ | ||
40 | struct spi_bitbang bitbang; | ||
41 | struct completion done; | ||
42 | |||
43 | void __iomem *regs; | ||
44 | int irq; | ||
45 | int len; | ||
46 | int count; | ||
47 | |||
48 | /* data buffers */ | ||
49 | const unsigned char *tx; | ||
50 | unsigned char *rx; | ||
51 | |||
52 | struct clk *clk; | ||
53 | struct resource *ioarea; | ||
54 | struct spi_master *master; | ||
55 | struct spi_device *curdev; | ||
56 | struct device *dev; | ||
57 | struct s3c2410_spi_info *pdata; | ||
58 | }; | ||
59 | |||
60 | #define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT) | ||
61 | #define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP) | ||
62 | |||
63 | static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev) | ||
64 | { | ||
65 | return spi_master_get_devdata(sdev->master); | ||
66 | } | ||
67 | |||
68 | static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | ||
69 | { | ||
70 | struct s3c24xx_spi *hw = to_hw(spi); | ||
71 | unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0; | ||
72 | unsigned int spcon; | ||
73 | |||
74 | switch (value) { | ||
75 | case BITBANG_CS_INACTIVE: | ||
76 | if (hw->pdata->set_cs) | ||
77 | hw->pdata->set_cs(hw->pdata, value, cspol); | ||
78 | else | ||
79 | s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1); | ||
80 | break; | ||
81 | |||
82 | case BITBANG_CS_ACTIVE: | ||
83 | spcon = readb(hw->regs + S3C2410_SPCON); | ||
84 | |||
85 | if (spi->mode & SPI_CPHA) | ||
86 | spcon |= S3C2410_SPCON_CPHA_FMTB; | ||
87 | else | ||
88 | spcon &= ~S3C2410_SPCON_CPHA_FMTB; | ||
89 | |||
90 | if (spi->mode & SPI_CPOL) | ||
91 | spcon |= S3C2410_SPCON_CPOL_HIGH; | ||
92 | else | ||
93 | spcon &= ~S3C2410_SPCON_CPOL_HIGH; | ||
94 | |||
95 | spcon |= S3C2410_SPCON_ENSCK; | ||
96 | |||
97 | /* write new configration */ | ||
98 | |||
99 | writeb(spcon, hw->regs + S3C2410_SPCON); | ||
100 | |||
101 | if (hw->pdata->set_cs) | ||
102 | hw->pdata->set_cs(hw->pdata, value, cspol); | ||
103 | else | ||
104 | s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol); | ||
105 | |||
106 | break; | ||
107 | |||
108 | } | ||
109 | } | ||
110 | |||
111 | static int s3c24xx_spi_setupxfer(struct spi_device *spi, | ||
112 | struct spi_transfer *t) | ||
113 | { | ||
114 | struct s3c24xx_spi *hw = to_hw(spi); | ||
115 | unsigned int bpw; | ||
116 | unsigned int hz; | ||
117 | unsigned int div; | ||
118 | |||
119 | bpw = t ? t->bits_per_word : spi->bits_per_word; | ||
120 | hz = t ? t->speed_hz : spi->max_speed_hz; | ||
121 | |||
122 | if (bpw != 8) { | ||
123 | dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); | ||
124 | return -EINVAL; | ||
125 | } | ||
126 | |||
127 | div = clk_get_rate(hw->clk) / hz; | ||
128 | |||
129 | /* is clk = pclk / (2 * (pre+1)), or is it | ||
130 | * clk = (pclk * 2) / ( pre + 1) */ | ||
131 | |||
132 | div = (div / 2) - 1; | ||
133 | |||
134 | if (div < 0) | ||
135 | div = 1; | ||
136 | |||
137 | if (div > 255) | ||
138 | div = 255; | ||
139 | |||
140 | dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)\n", div, hz); | ||
141 | writeb(div, hw->regs + S3C2410_SPPRE); | ||
142 | |||
143 | spin_lock(&hw->bitbang.lock); | ||
144 | if (!hw->bitbang.busy) { | ||
145 | hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE); | ||
146 | /* need to ndelay for 0.5 clocktick ? */ | ||
147 | } | ||
148 | spin_unlock(&hw->bitbang.lock); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int s3c24xx_spi_setup(struct spi_device *spi) | ||
154 | { | ||
155 | int ret; | ||
156 | |||
157 | if (!spi->bits_per_word) | ||
158 | spi->bits_per_word = 8; | ||
159 | |||
160 | if ((spi->mode & SPI_LSB_FIRST) != 0) | ||
161 | return -EINVAL; | ||
162 | |||
163 | ret = s3c24xx_spi_setupxfer(spi, NULL); | ||
164 | if (ret < 0) { | ||
165 | dev_err(&spi->dev, "setupxfer returned %d\n", ret); | ||
166 | return ret; | ||
167 | } | ||
168 | |||
169 | dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", | ||
170 | __FUNCTION__, spi->mode, spi->bits_per_word, | ||
171 | spi->max_speed_hz); | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count) | ||
177 | { | ||
178 | return hw->tx ? hw->tx[count] : 0xff; | ||
179 | } | ||
180 | |||
181 | static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t) | ||
182 | { | ||
183 | struct s3c24xx_spi *hw = to_hw(spi); | ||
184 | |||
185 | dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n", | ||
186 | t->tx_buf, t->rx_buf, t->len); | ||
187 | |||
188 | hw->tx = t->tx_buf; | ||
189 | hw->rx = t->rx_buf; | ||
190 | hw->len = t->len; | ||
191 | hw->count = 0; | ||
192 | |||
193 | /* send the first byte */ | ||
194 | writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT); | ||
195 | wait_for_completion(&hw->done); | ||
196 | |||
197 | return hw->count; | ||
198 | } | ||
199 | |||
200 | static irqreturn_t s3c24xx_spi_irq(int irq, void *dev, struct pt_regs *regs) | ||
201 | { | ||
202 | struct s3c24xx_spi *hw = dev; | ||
203 | unsigned int spsta = readb(hw->regs + S3C2410_SPSTA); | ||
204 | unsigned int count = hw->count; | ||
205 | |||
206 | if (spsta & S3C2410_SPSTA_DCOL) { | ||
207 | dev_dbg(hw->dev, "data-collision\n"); | ||
208 | complete(&hw->done); | ||
209 | goto irq_done; | ||
210 | } | ||
211 | |||
212 | if (!(spsta & S3C2410_SPSTA_READY)) { | ||
213 | dev_dbg(hw->dev, "spi not ready for tx?\n"); | ||
214 | complete(&hw->done); | ||
215 | goto irq_done; | ||
216 | } | ||
217 | |||
218 | hw->count++; | ||
219 | |||
220 | if (hw->rx) | ||
221 | hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT); | ||
222 | |||
223 | count++; | ||
224 | |||
225 | if (count < hw->len) | ||
226 | writeb(hw_txbyte(hw, count), hw->regs + S3C2410_SPTDAT); | ||
227 | else | ||
228 | complete(&hw->done); | ||
229 | |||
230 | irq_done: | ||
231 | return IRQ_HANDLED; | ||
232 | } | ||
233 | |||
234 | static int s3c24xx_spi_probe(struct platform_device *pdev) | ||
235 | { | ||
236 | struct s3c24xx_spi *hw; | ||
237 | struct spi_master *master; | ||
238 | struct spi_board_info *bi; | ||
239 | struct resource *res; | ||
240 | int err = 0; | ||
241 | int i; | ||
242 | |||
243 | master = spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi)); | ||
244 | if (master == NULL) { | ||
245 | dev_err(&pdev->dev, "No memory for spi_master\n"); | ||
246 | err = -ENOMEM; | ||
247 | goto err_nomem; | ||
248 | } | ||
249 | |||
250 | hw = spi_master_get_devdata(master); | ||
251 | memset(hw, 0, sizeof(struct s3c24xx_spi)); | ||
252 | |||
253 | hw->master = spi_master_get(master); | ||
254 | hw->pdata = pdev->dev.platform_data; | ||
255 | hw->dev = &pdev->dev; | ||
256 | |||
257 | if (hw->pdata == NULL) { | ||
258 | dev_err(&pdev->dev, "No platform data supplied\n"); | ||
259 | err = -ENOENT; | ||
260 | goto err_no_pdata; | ||
261 | } | ||
262 | |||
263 | platform_set_drvdata(pdev, hw); | ||
264 | init_completion(&hw->done); | ||
265 | |||
266 | /* setup the state for the bitbang driver */ | ||
267 | |||
268 | hw->bitbang.master = hw->master; | ||
269 | hw->bitbang.setup_transfer = s3c24xx_spi_setupxfer; | ||
270 | hw->bitbang.chipselect = s3c24xx_spi_chipsel; | ||
271 | hw->bitbang.txrx_bufs = s3c24xx_spi_txrx; | ||
272 | hw->bitbang.master->setup = s3c24xx_spi_setup; | ||
273 | |||
274 | dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang); | ||
275 | |||
276 | /* find and map our resources */ | ||
277 | |||
278 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
279 | if (res == NULL) { | ||
280 | dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n"); | ||
281 | err = -ENOENT; | ||
282 | goto err_no_iores; | ||
283 | } | ||
284 | |||
285 | hw->ioarea = request_mem_region(res->start, (res->end - res->start)+1, | ||
286 | pdev->name); | ||
287 | |||
288 | if (hw->ioarea == NULL) { | ||
289 | dev_err(&pdev->dev, "Cannot reserve region\n"); | ||
290 | err = -ENXIO; | ||
291 | goto err_no_iores; | ||
292 | } | ||
293 | |||
294 | hw->regs = ioremap(res->start, (res->end - res->start)+1); | ||
295 | if (hw->regs == NULL) { | ||
296 | dev_err(&pdev->dev, "Cannot map IO\n"); | ||
297 | err = -ENXIO; | ||
298 | goto err_no_iomap; | ||
299 | } | ||
300 | |||
301 | hw->irq = platform_get_irq(pdev, 0); | ||
302 | if (hw->irq < 0) { | ||
303 | dev_err(&pdev->dev, "No IRQ specified\n"); | ||
304 | err = -ENOENT; | ||
305 | goto err_no_irq; | ||
306 | } | ||
307 | |||
308 | err = request_irq(hw->irq, s3c24xx_spi_irq, 0, pdev->name, hw); | ||
309 | if (err) { | ||
310 | dev_err(&pdev->dev, "Cannot claim IRQ\n"); | ||
311 | goto err_no_irq; | ||
312 | } | ||
313 | |||
314 | hw->clk = clk_get(&pdev->dev, "spi"); | ||
315 | if (IS_ERR(hw->clk)) { | ||
316 | dev_err(&pdev->dev, "No clock for device\n"); | ||
317 | err = PTR_ERR(hw->clk); | ||
318 | goto err_no_clk; | ||
319 | } | ||
320 | |||
321 | /* for the moment, permanently enable the clock */ | ||
322 | |||
323 | clk_enable(hw->clk); | ||
324 | |||
325 | /* program defaults into the registers */ | ||
326 | |||
327 | writeb(0xff, hw->regs + S3C2410_SPPRE); | ||
328 | writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN); | ||
329 | writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON); | ||
330 | |||
331 | /* setup any gpio we can */ | ||
332 | |||
333 | if (!hw->pdata->set_cs) { | ||
334 | s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); | ||
335 | s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); | ||
336 | } | ||
337 | |||
338 | /* register our spi controller */ | ||
339 | |||
340 | err = spi_bitbang_start(&hw->bitbang); | ||
341 | if (err) { | ||
342 | dev_err(&pdev->dev, "Failed to register SPI master\n"); | ||
343 | goto err_register; | ||
344 | } | ||
345 | |||
346 | dev_dbg(hw->dev, "shutdown=%d\n", hw->bitbang.shutdown); | ||
347 | |||
348 | /* register all the devices associated */ | ||
349 | |||
350 | bi = &hw->pdata->board_info[0]; | ||
351 | for (i = 0; i < hw->pdata->board_size; i++, bi++) { | ||
352 | dev_info(hw->dev, "registering %s\n", bi->modalias); | ||
353 | |||
354 | bi->controller_data = hw; | ||
355 | spi_new_device(master, bi); | ||
356 | } | ||
357 | |||
358 | return 0; | ||
359 | |||
360 | err_register: | ||
361 | clk_disable(hw->clk); | ||
362 | clk_put(hw->clk); | ||
363 | |||
364 | err_no_clk: | ||
365 | free_irq(hw->irq, hw); | ||
366 | |||
367 | err_no_irq: | ||
368 | iounmap(hw->regs); | ||
369 | |||
370 | err_no_iomap: | ||
371 | release_resource(hw->ioarea); | ||
372 | kfree(hw->ioarea); | ||
373 | |||
374 | err_no_iores: | ||
375 | err_no_pdata: | ||
376 | spi_master_put(hw->master);; | ||
377 | |||
378 | err_nomem: | ||
379 | return err; | ||
380 | } | ||
381 | |||
382 | static int s3c24xx_spi_remove(struct platform_device *dev) | ||
383 | { | ||
384 | struct s3c24xx_spi *hw = platform_get_drvdata(dev); | ||
385 | |||
386 | platform_set_drvdata(dev, NULL); | ||
387 | |||
388 | spi_unregister_master(hw->master); | ||
389 | |||
390 | clk_disable(hw->clk); | ||
391 | clk_put(hw->clk); | ||
392 | |||
393 | free_irq(hw->irq, hw); | ||
394 | iounmap(hw->regs); | ||
395 | |||
396 | release_resource(hw->ioarea); | ||
397 | kfree(hw->ioarea); | ||
398 | |||
399 | spi_master_put(hw->master); | ||
400 | return 0; | ||
401 | } | ||
402 | |||
403 | |||
404 | #ifdef CONFIG_PM | ||
405 | |||
406 | static int s3c24xx_spi_suspend(struct platform_device *pdev, pm_message_t msg) | ||
407 | { | ||
408 | struct s3c24xx_spi *hw = platform_get_drvdata(pdev); | ||
409 | |||
410 | clk_disable(hw->clk); | ||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static int s3c24xx_spi_resume(struct platform_device *pdev) | ||
415 | { | ||
416 | struct s3c24xx_spi *hw = platform_get_drvdata(pdev); | ||
417 | |||
418 | clk_enable(hw->clk); | ||
419 | return 0; | ||
420 | } | ||
421 | |||
422 | #else | ||
423 | #define s3c24xx_spi_suspend NULL | ||
424 | #define s3c24xx_spi_resume NULL | ||
425 | #endif | ||
426 | |||
427 | static struct platform_driver s3c24xx_spidrv = { | ||
428 | .probe = s3c24xx_spi_probe, | ||
429 | .remove = s3c24xx_spi_remove, | ||
430 | .suspend = s3c24xx_spi_suspend, | ||
431 | .resume = s3c24xx_spi_resume, | ||
432 | .driver = { | ||
433 | .name = "s3c2410-spi", | ||
434 | .owner = THIS_MODULE, | ||
435 | }, | ||
436 | }; | ||
437 | |||
438 | static int __init s3c24xx_spi_init(void) | ||
439 | { | ||
440 | return platform_driver_register(&s3c24xx_spidrv); | ||
441 | } | ||
442 | |||
443 | static void __exit s3c24xx_spi_exit(void) | ||
444 | { | ||
445 | platform_driver_unregister(&s3c24xx_spidrv); | ||
446 | } | ||
447 | |||
448 | module_init(s3c24xx_spi_init); | ||
449 | module_exit(s3c24xx_spi_exit); | ||
450 | |||
451 | MODULE_DESCRIPTION("S3C24XX SPI Driver"); | ||
452 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | ||
453 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c new file mode 100644 index 000000000000..aacdceb8f44b --- /dev/null +++ b/drivers/spi/spi_s3c24xx_gpio.c | |||
@@ -0,0 +1,188 @@ | |||
1 | /* linux/drivers/spi/spi_s3c24xx_gpio.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Ben Dooks | ||
4 | * Copyright (c) 2006 Simtec Electronics | ||
5 | * | ||
6 | * S3C24XX GPIO based SPI driver | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | |||
21 | #include <linux/spi/spi.h> | ||
22 | #include <linux/spi/spi_bitbang.h> | ||
23 | |||
24 | #include <asm/arch/regs-gpio.h> | ||
25 | #include <asm/arch/spi-gpio.h> | ||
26 | #include <asm/arch/hardware.h> | ||
27 | |||
28 | struct s3c2410_spigpio { | ||
29 | struct spi_bitbang bitbang; | ||
30 | |||
31 | struct s3c2410_spigpio_info *info; | ||
32 | struct platform_device *dev; | ||
33 | }; | ||
34 | |||
35 | static inline struct s3c2410_spigpio *spidev_to_sg(struct spi_device *spi) | ||
36 | { | ||
37 | return spi->controller_data; | ||
38 | } | ||
39 | |||
40 | static inline void setsck(struct spi_device *dev, int on) | ||
41 | { | ||
42 | struct s3c2410_spigpio *sg = spidev_to_sg(dev); | ||
43 | s3c2410_gpio_setpin(sg->info->pin_clk, on ? 1 : 0); | ||
44 | } | ||
45 | |||
46 | static inline void setmosi(struct spi_device *dev, int on) | ||
47 | { | ||
48 | struct s3c2410_spigpio *sg = spidev_to_sg(dev); | ||
49 | s3c2410_gpio_setpin(sg->info->pin_mosi, on ? 1 : 0); | ||
50 | } | ||
51 | |||
52 | static inline u32 getmiso(struct spi_device *dev) | ||
53 | { | ||
54 | struct s3c2410_spigpio *sg = spidev_to_sg(dev); | ||
55 | return s3c2410_gpio_getpin(sg->info->pin_miso) ? 1 : 0; | ||
56 | } | ||
57 | |||
58 | #define spidelay(x) ndelay(x) | ||
59 | |||
60 | #define EXPAND_BITBANG_TXRX | ||
61 | #include <linux/spi/spi_bitbang.h> | ||
62 | |||
63 | |||
64 | static u32 s3c2410_spigpio_txrx_mode0(struct spi_device *spi, | ||
65 | unsigned nsecs, u32 word, u8 bits) | ||
66 | { | ||
67 | return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits); | ||
68 | } | ||
69 | |||
70 | static u32 s3c2410_spigpio_txrx_mode1(struct spi_device *spi, | ||
71 | unsigned nsecs, u32 word, u8 bits) | ||
72 | { | ||
73 | return bitbang_txrx_be_cpha1(spi, nsecs, 0, word, bits); | ||
74 | } | ||
75 | |||
76 | static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value) | ||
77 | { | ||
78 | struct s3c2410_spigpio *sg = spidev_to_sg(dev); | ||
79 | |||
80 | if (sg->info && sg->info->chip_select) | ||
81 | (sg->info->chip_select)(sg->info, value); | ||
82 | } | ||
83 | |||
84 | static int s3c2410_spigpio_probe(struct platform_device *dev) | ||
85 | { | ||
86 | struct spi_master *master; | ||
87 | struct s3c2410_spigpio *sp; | ||
88 | int ret; | ||
89 | int i; | ||
90 | |||
91 | master = spi_alloc_master(&dev->dev, sizeof(struct s3c2410_spigpio)); | ||
92 | if (master == NULL) { | ||
93 | dev_err(&dev->dev, "failed to allocate spi master\n"); | ||
94 | ret = -ENOMEM; | ||
95 | goto err; | ||
96 | } | ||
97 | |||
98 | sp = spi_master_get_devdata(master); | ||
99 | |||
100 | platform_set_drvdata(dev, sp); | ||
101 | |||
102 | /* copy in the plkatform data */ | ||
103 | sp->info = dev->dev.platform_data; | ||
104 | |||
105 | /* setup spi bitbang adaptor */ | ||
106 | sp->bitbang.master = spi_master_get(master); | ||
107 | sp->bitbang.chipselect = s3c2410_spigpio_chipselect; | ||
108 | |||
109 | sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0; | ||
110 | sp->bitbang.txrx_word[SPI_MODE_1] = s3c2410_spigpio_txrx_mode1; | ||
111 | |||
112 | /* set state of spi pins */ | ||
113 | s3c2410_gpio_setpin(sp->info->pin_clk, 0); | ||
114 | s3c2410_gpio_setpin(sp->info->pin_mosi, 0); | ||
115 | |||
116 | s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT); | ||
117 | s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT); | ||
118 | s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT); | ||
119 | |||
120 | ret = spi_bitbang_start(&sp->bitbang); | ||
121 | if (ret) | ||
122 | goto err_no_bitbang; | ||
123 | |||
124 | /* register the chips to go with the board */ | ||
125 | |||
126 | for (i = 0; i < sp->info->board_size; i++) { | ||
127 | dev_info(&dev->dev, "registering %p: %s\n", | ||
128 | &sp->info->board_info[i], | ||
129 | sp->info->board_info[i].modalias); | ||
130 | |||
131 | sp->info->board_info[i].controller_data = sp; | ||
132 | spi_new_device(master, sp->info->board_info + i); | ||
133 | } | ||
134 | |||
135 | return 0; | ||
136 | |||
137 | err_no_bitbang: | ||
138 | spi_master_put(sp->bitbang.master); | ||
139 | err: | ||
140 | return ret; | ||
141 | |||
142 | } | ||
143 | |||
144 | static int s3c2410_spigpio_remove(struct platform_device *dev) | ||
145 | { | ||
146 | struct s3c2410_spigpio *sp = platform_get_drvdata(dev); | ||
147 | |||
148 | spi_bitbang_stop(&sp->bitbang); | ||
149 | spi_master_put(sp->bitbang.master); | ||
150 | |||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | /* all gpio should be held over suspend/resume, so we should | ||
155 | * not need to deal with this | ||
156 | */ | ||
157 | |||
158 | #define s3c2410_spigpio_suspend NULL | ||
159 | #define s3c2410_spigpio_resume NULL | ||
160 | |||
161 | |||
162 | static struct platform_driver s3c2410_spigpio_drv = { | ||
163 | .probe = s3c2410_spigpio_probe, | ||
164 | .remove = s3c2410_spigpio_remove, | ||
165 | .suspend = s3c2410_spigpio_suspend, | ||
166 | .resume = s3c2410_spigpio_resume, | ||
167 | .driver = { | ||
168 | .name = "s3c24xx-spi-gpio", | ||
169 | .owner = THIS_MODULE, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static int __init s3c2410_spigpio_init(void) | ||
174 | { | ||
175 | return platform_driver_register(&s3c2410_spigpio_drv); | ||
176 | } | ||
177 | |||
178 | static void __exit s3c2410_spigpio_exit(void) | ||
179 | { | ||
180 | platform_driver_unregister(&s3c2410_spigpio_drv); | ||
181 | } | ||
182 | |||
183 | module_init(s3c2410_spigpio_init); | ||
184 | module_exit(s3c2410_spigpio_exit); | ||
185 | |||
186 | MODULE_DESCRIPTION("S3C24XX SPI Driver"); | ||
187 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | ||
188 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 7860c8a5800d..956b7a1e8af9 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
@@ -69,7 +69,7 @@ static const char speedtch_driver_name[] = "speedtch"; | |||
69 | #define RESUBMIT_DELAY 1000 /* milliseconds */ | 69 | #define RESUBMIT_DELAY 1000 /* milliseconds */ |
70 | 70 | ||
71 | #define DEFAULT_BULK_ALTSETTING 1 | 71 | #define DEFAULT_BULK_ALTSETTING 1 |
72 | #define DEFAULT_ISOC_ALTSETTING 2 | 72 | #define DEFAULT_ISOC_ALTSETTING 3 |
73 | #define DEFAULT_DL_512_FIRST 0 | 73 | #define DEFAULT_DL_512_FIRST 0 |
74 | #define DEFAULT_ENABLE_ISOC 0 | 74 | #define DEFAULT_ENABLE_ISOC 0 |
75 | #define DEFAULT_SW_BUFFERING 0 | 75 | #define DEFAULT_SW_BUFFERING 0 |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index c1211fc037d9..546249843b8e 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -99,11 +99,11 @@ static const char usbatm_driver_name[] = "usbatm"; | |||
99 | 99 | ||
100 | #define UDSL_MAX_RCV_URBS 16 | 100 | #define UDSL_MAX_RCV_URBS 16 |
101 | #define UDSL_MAX_SND_URBS 16 | 101 | #define UDSL_MAX_SND_URBS 16 |
102 | #define UDSL_MAX_BUF_SIZE 64 * 1024 /* bytes */ | 102 | #define UDSL_MAX_BUF_SIZE 65536 |
103 | #define UDSL_DEFAULT_RCV_URBS 4 | 103 | #define UDSL_DEFAULT_RCV_URBS 4 |
104 | #define UDSL_DEFAULT_SND_URBS 4 | 104 | #define UDSL_DEFAULT_SND_URBS 4 |
105 | #define UDSL_DEFAULT_RCV_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ | 105 | #define UDSL_DEFAULT_RCV_BUF_SIZE 3392 /* 64 * ATM_CELL_SIZE */ |
106 | #define UDSL_DEFAULT_SND_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ | 106 | #define UDSL_DEFAULT_SND_BUF_SIZE 3392 /* 64 * ATM_CELL_SIZE */ |
107 | 107 | ||
108 | #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) | 108 | #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) |
109 | 109 | ||
@@ -135,7 +135,7 @@ MODULE_PARM_DESC(rcv_buf_bytes, | |||
135 | module_param(snd_buf_bytes, uint, S_IRUGO); | 135 | module_param(snd_buf_bytes, uint, S_IRUGO); |
136 | MODULE_PARM_DESC(snd_buf_bytes, | 136 | MODULE_PARM_DESC(snd_buf_bytes, |
137 | "Size of the buffers used for transmission, in bytes (range: 1-" | 137 | "Size of the buffers used for transmission, in bytes (range: 1-" |
138 | __MODULE_STRING(UDSL_MAX_SND_BUF_SIZE) ", default: " | 138 | __MODULE_STRING(UDSL_MAX_BUF_SIZE) ", default: " |
139 | __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); | 139 | __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); |
140 | 140 | ||
141 | 141 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index fbd938d4ea58..e2e00ba4e1e6 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1805,6 +1805,12 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
1805 | USB_SPEED_FULL; | 1805 | USB_SPEED_FULL; |
1806 | hcd->self.root_hub = rhdev; | 1806 | hcd->self.root_hub = rhdev; |
1807 | 1807 | ||
1808 | /* wakeup flag init defaults to "everything works" for root hubs, | ||
1809 | * but drivers can override it in reset() if needed, along with | ||
1810 | * recording the overall controller's system wakeup capability. | ||
1811 | */ | ||
1812 | device_init_wakeup(&rhdev->dev, 1); | ||
1813 | |||
1808 | /* "reset" is misnamed; its role is now one-time init. the controller | 1814 | /* "reset" is misnamed; its role is now one-time init. the controller |
1809 | * should already have been reset (and boot firmware kicked off etc). | 1815 | * should already have been reset (and boot firmware kicked off etc). |
1810 | */ | 1816 | */ |
@@ -1813,13 +1819,6 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
1813 | goto err_hcd_driver_setup; | 1819 | goto err_hcd_driver_setup; |
1814 | } | 1820 | } |
1815 | 1821 | ||
1816 | /* wakeup flag init is in transition; for now we can't rely on PCI to | ||
1817 | * initialize these bits properly, so we let reset() override it. | ||
1818 | * This init should _precede_ the reset() once PCI behaves. | ||
1819 | */ | ||
1820 | device_init_wakeup(&rhdev->dev, | ||
1821 | device_can_wakeup(hcd->self.controller)); | ||
1822 | |||
1823 | /* NOTE: root hub and controller capabilities may not be the same */ | 1822 | /* NOTE: root hub and controller capabilities may not be the same */ |
1824 | if (device_can_wakeup(hcd->self.controller) | 1823 | if (device_can_wakeup(hcd->self.controller) |
1825 | && device_can_wakeup(&hcd->self.root_hub->dev)) | 1824 | && device_can_wakeup(&hcd->self.root_hub->dev)) |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 0c87f73f2933..90b8d43c6b33 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1168,19 +1168,9 @@ static inline const char *plural(int n) | |||
1168 | static int choose_configuration(struct usb_device *udev) | 1168 | static int choose_configuration(struct usb_device *udev) |
1169 | { | 1169 | { |
1170 | int i; | 1170 | int i; |
1171 | u16 devstatus; | ||
1172 | int bus_powered; | ||
1173 | int num_configs; | 1171 | int num_configs; |
1174 | struct usb_host_config *c, *best; | 1172 | struct usb_host_config *c, *best; |
1175 | 1173 | ||
1176 | /* If this fails, assume the device is bus-powered */ | ||
1177 | devstatus = 0; | ||
1178 | usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); | ||
1179 | le16_to_cpus(&devstatus); | ||
1180 | bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0); | ||
1181 | dev_dbg(&udev->dev, "device is %s-powered\n", | ||
1182 | bus_powered ? "bus" : "self"); | ||
1183 | |||
1184 | best = NULL; | 1174 | best = NULL; |
1185 | c = udev->config; | 1175 | c = udev->config; |
1186 | num_configs = udev->descriptor.bNumConfigurations; | 1176 | num_configs = udev->descriptor.bNumConfigurations; |
@@ -1197,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev) | |||
1197 | * similar errors in their descriptors. If the next test | 1187 | * similar errors in their descriptors. If the next test |
1198 | * were allowed to execute, such configurations would always | 1188 | * were allowed to execute, such configurations would always |
1199 | * be rejected and the devices would not work as expected. | 1189 | * be rejected and the devices would not work as expected. |
1190 | * In the meantime, we run the risk of selecting a config | ||
1191 | * that requires external power at a time when that power | ||
1192 | * isn't available. It seems to be the lesser of two evils. | ||
1193 | * | ||
1194 | * Bugzilla #6448 reports a device that appears to crash | ||
1195 | * when it receives a GET_DEVICE_STATUS request! We don't | ||
1196 | * have any other way to tell whether a device is self-powered, | ||
1197 | * but since we don't use that information anywhere but here, | ||
1198 | * the call has been removed. | ||
1199 | * | ||
1200 | * Maybe the GET_DEVICE_STATUS call and the test below can | ||
1201 | * be reinstated when device firmwares become more reliable. | ||
1202 | * Don't hold your breath. | ||
1200 | */ | 1203 | */ |
1201 | #if 0 | 1204 | #if 0 |
1202 | /* Rule out self-powered configs for a bus-powered device */ | 1205 | /* Rule out self-powered configs for a bus-powered device */ |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 544f7589912f..73f5a379d9b3 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -863,7 +863,7 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
863 | i = ohci->num_ports; | 863 | i = ohci->num_ports; |
864 | while (i--) | 864 | while (i--) |
865 | ohci_writel (ohci, RH_PS_PSS, | 865 | ohci_writel (ohci, RH_PS_PSS, |
866 | &ohci->regs->roothub.portstatus [temp]); | 866 | &ohci->regs->roothub.portstatus [i]); |
867 | ohci_dbg (ohci, "restart complete\n"); | 867 | ohci_dbg (ohci, "restart complete\n"); |
868 | } | 868 | } |
869 | return 0; | 869 | return 0; |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index acde8868da21..fafe7c1265b3 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -185,6 +185,9 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
185 | /* Select Power Management Mode */ | 185 | /* Select Power Management Mode */ |
186 | pxa27x_ohci_select_pmm(inf->port_mode); | 186 | pxa27x_ohci_select_pmm(inf->port_mode); |
187 | 187 | ||
188 | if (inf->power_budget) | ||
189 | hcd->power_budget = inf->power_budget; | ||
190 | |||
188 | ohci_hcd_init(hcd_to_ohci(hcd)); | 191 | ohci_hcd_init(hcd_to_ohci(hcd)); |
189 | 192 | ||
190 | retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); | 193 | retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index f419bd82ab7f..435273e7c85c 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1557,6 +1557,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1557 | #define USB_VENDOR_ID_HP 0x03f0 | 1557 | #define USB_VENDOR_ID_HP 0x03f0 |
1558 | #define USB_DEVICE_ID_HP_USBHUB_KB 0x020c | 1558 | #define USB_DEVICE_ID_HP_USBHUB_KB 0x020c |
1559 | 1559 | ||
1560 | #define USB_VENDOR_ID_IBM 0x04b3 | ||
1561 | #define USB_DEVICE_ID_IBM_USBHUB_KB 0x3005 | ||
1562 | |||
1560 | #define USB_VENDOR_ID_CREATIVELABS 0x062a | 1563 | #define USB_VENDOR_ID_CREATIVELABS 0x062a |
1561 | #define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201 | 1564 | #define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201 |
1562 | 1565 | ||
@@ -1681,6 +1684,7 @@ static const struct hid_blacklist { | |||
1681 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, | 1684 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, |
1682 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET }, | 1685 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET }, |
1683 | { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, | 1686 | { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, |
1687 | { USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_USBHUB_KB, HID_QUIRK_NOGET }, | ||
1684 | { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, | 1688 | { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, |
1685 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 1689 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
1686 | { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET }, | 1690 | { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET }, |
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 6dd666696178..c4670e1d4654 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -317,6 +317,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun | |||
317 | } | 317 | } |
318 | 318 | ||
319 | schedule(); | 319 | schedule(); |
320 | set_current_state(TASK_INTERRUPTIBLE); | ||
320 | } | 321 | } |
321 | 322 | ||
322 | set_current_state(TASK_RUNNING); | 323 | set_current_state(TASK_RUNNING); |
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index 3824df33094e..1fd9cb85f4ca 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/delay.h> | ||
18 | 19 | ||
19 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 | 20 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 |
20 | typedef struct _INTEL_HEX_RECORD | 21 | typedef struct _INTEL_HEX_RECORD |
@@ -114,6 +115,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
114 | 115 | ||
115 | /* De-assert reset (let the CPU run) */ | 116 | /* De-assert reset (let the CPU run) */ |
116 | err = emi26_set_reset(dev,0); | 117 | err = emi26_set_reset(dev,0); |
118 | msleep(250); /* let device settle */ | ||
117 | 119 | ||
118 | /* 2. We upload the FPGA firmware into the EMI | 120 | /* 2. We upload the FPGA firmware into the EMI |
119 | * Note: collect up to 1023 (yes!) bytes and send them with | 121 | * Note: collect up to 1023 (yes!) bytes and send them with |
@@ -150,6 +152,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
150 | goto wraperr; | 152 | goto wraperr; |
151 | } | 153 | } |
152 | } | 154 | } |
155 | msleep(250); /* let device settle */ | ||
153 | 156 | ||
154 | /* De-assert reset (let the CPU run) */ | 157 | /* De-assert reset (let the CPU run) */ |
155 | err = emi26_set_reset(dev,0); | 158 | err = emi26_set_reset(dev,0); |
@@ -192,6 +195,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
192 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 195 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
193 | goto wraperr; | 196 | goto wraperr; |
194 | } | 197 | } |
198 | msleep(250); /* let device settle */ | ||
195 | 199 | ||
196 | /* return 1 to fail the driver inialization | 200 | /* return 1 to fail the driver inialization |
197 | * and give real driver change to load */ | 201 | * and give real driver change to load */ |
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index 52fea2e08db8..fe351371f274 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/delay.h> | ||
18 | 19 | ||
19 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 | 20 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 |
20 | typedef struct _INTEL_HEX_RECORD | 21 | typedef struct _INTEL_HEX_RECORD |
@@ -123,6 +124,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
123 | 124 | ||
124 | /* De-assert reset (let the CPU run) */ | 125 | /* De-assert reset (let the CPU run) */ |
125 | err = emi62_set_reset(dev,0); | 126 | err = emi62_set_reset(dev,0); |
127 | msleep(250); /* let device settle */ | ||
126 | 128 | ||
127 | /* 2. We upload the FPGA firmware into the EMI | 129 | /* 2. We upload the FPGA firmware into the EMI |
128 | * Note: collect up to 1023 (yes!) bytes and send them with | 130 | * Note: collect up to 1023 (yes!) bytes and send them with |
@@ -166,6 +168,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
166 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 168 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
167 | goto wraperr; | 169 | goto wraperr; |
168 | } | 170 | } |
171 | msleep(250); /* let device settle */ | ||
169 | 172 | ||
170 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ | 173 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ |
171 | 174 | ||
@@ -228,6 +231,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
228 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 231 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
229 | goto wraperr; | 232 | goto wraperr; |
230 | } | 233 | } |
234 | msleep(250); /* let device settle */ | ||
231 | 235 | ||
232 | kfree(buf); | 236 | kfree(buf); |
233 | 237 | ||
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 2deb4c01539e..7683926a1b6f 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -318,6 +318,8 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) | |||
318 | set_register(pegasus, PhyCtrl, (indx | PHY_READ)); | 318 | set_register(pegasus, PhyCtrl, (indx | PHY_READ)); |
319 | for (i = 0; i < REG_TIMEOUT; i++) { | 319 | for (i = 0; i < REG_TIMEOUT; i++) { |
320 | ret = get_registers(pegasus, PhyCtrl, 1, data); | 320 | ret = get_registers(pegasus, PhyCtrl, 1, data); |
321 | if (ret == -ESHUTDOWN) | ||
322 | goto fail; | ||
321 | if (data[0] & PHY_DONE) | 323 | if (data[0] & PHY_DONE) |
322 | break; | 324 | break; |
323 | } | 325 | } |
@@ -326,6 +328,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) | |||
326 | *regd = le16_to_cpu(regdi); | 328 | *regd = le16_to_cpu(regdi); |
327 | return ret; | 329 | return ret; |
328 | } | 330 | } |
331 | fail: | ||
329 | if (netif_msg_drv(pegasus)) | 332 | if (netif_msg_drv(pegasus)) |
330 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 333 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
331 | 334 | ||
@@ -354,12 +357,15 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd) | |||
354 | set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); | 357 | set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); |
355 | for (i = 0; i < REG_TIMEOUT; i++) { | 358 | for (i = 0; i < REG_TIMEOUT; i++) { |
356 | ret = get_registers(pegasus, PhyCtrl, 1, data); | 359 | ret = get_registers(pegasus, PhyCtrl, 1, data); |
360 | if (ret == -ESHUTDOWN) | ||
361 | goto fail; | ||
357 | if (data[0] & PHY_DONE) | 362 | if (data[0] & PHY_DONE) |
358 | break; | 363 | break; |
359 | } | 364 | } |
360 | if (i < REG_TIMEOUT) | 365 | if (i < REG_TIMEOUT) |
361 | return ret; | 366 | return ret; |
362 | 367 | ||
368 | fail: | ||
363 | if (netif_msg_drv(pegasus)) | 369 | if (netif_msg_drv(pegasus)) |
364 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 370 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
365 | return -ETIMEDOUT; | 371 | return -ETIMEDOUT; |
@@ -387,6 +393,8 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) | |||
387 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); | 393 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); |
388 | if (tmp & EPROM_DONE) | 394 | if (tmp & EPROM_DONE) |
389 | break; | 395 | break; |
396 | if (ret == -ESHUTDOWN) | ||
397 | goto fail; | ||
390 | } | 398 | } |
391 | if (i < REG_TIMEOUT) { | 399 | if (i < REG_TIMEOUT) { |
392 | ret = get_registers(pegasus, EpromData, 2, &retdatai); | 400 | ret = get_registers(pegasus, EpromData, 2, &retdatai); |
@@ -394,6 +402,7 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) | |||
394 | return ret; | 402 | return ret; |
395 | } | 403 | } |
396 | 404 | ||
405 | fail: | ||
397 | if (netif_msg_drv(pegasus)) | 406 | if (netif_msg_drv(pegasus)) |
398 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 407 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
399 | return -ETIMEDOUT; | 408 | return -ETIMEDOUT; |
@@ -433,12 +442,15 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data) | |||
433 | 442 | ||
434 | for (i = 0; i < REG_TIMEOUT; i++) { | 443 | for (i = 0; i < REG_TIMEOUT; i++) { |
435 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); | 444 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); |
445 | if (ret == -ESHUTDOWN) | ||
446 | goto fail; | ||
436 | if (tmp & EPROM_DONE) | 447 | if (tmp & EPROM_DONE) |
437 | break; | 448 | break; |
438 | } | 449 | } |
439 | disable_eprom_write(pegasus); | 450 | disable_eprom_write(pegasus); |
440 | if (i < REG_TIMEOUT) | 451 | if (i < REG_TIMEOUT) |
441 | return ret; | 452 | return ret; |
453 | fail: | ||
442 | if (netif_msg_drv(pegasus)) | 454 | if (netif_msg_drv(pegasus)) |
443 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 455 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
444 | return -ETIMEDOUT; | 456 | return -ETIMEDOUT; |
@@ -1378,9 +1390,8 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message) | |||
1378 | struct pegasus *pegasus = usb_get_intfdata(intf); | 1390 | struct pegasus *pegasus = usb_get_intfdata(intf); |
1379 | 1391 | ||
1380 | netif_device_detach (pegasus->net); | 1392 | netif_device_detach (pegasus->net); |
1393 | cancel_delayed_work(&pegasus->carrier_check); | ||
1381 | if (netif_running(pegasus->net)) { | 1394 | if (netif_running(pegasus->net)) { |
1382 | cancel_delayed_work(&pegasus->carrier_check); | ||
1383 | |||
1384 | usb_kill_urb(pegasus->rx_urb); | 1395 | usb_kill_urb(pegasus->rx_urb); |
1385 | usb_kill_urb(pegasus->intr_urb); | 1396 | usb_kill_urb(pegasus->intr_urb); |
1386 | } | 1397 | } |
@@ -1400,10 +1411,9 @@ static int pegasus_resume (struct usb_interface *intf) | |||
1400 | pegasus->intr_urb->status = 0; | 1411 | pegasus->intr_urb->status = 0; |
1401 | pegasus->intr_urb->actual_length = 0; | 1412 | pegasus->intr_urb->actual_length = 0; |
1402 | intr_callback(pegasus->intr_urb, NULL); | 1413 | intr_callback(pegasus->intr_urb, NULL); |
1403 | |||
1404 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, | ||
1405 | CARRIER_CHECK_DELAY); | ||
1406 | } | 1414 | } |
1415 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, | ||
1416 | CARRIER_CHECK_DELAY); | ||
1407 | return 0; | 1417 | return 0; |
1408 | } | 1418 | } |
1409 | 1419 | ||
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index f96b73f54bf1..5c60be521561 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -71,6 +71,16 @@ config USB_SERIAL_ANYDATA | |||
71 | To compile this driver as a module, choose M here: the | 71 | To compile this driver as a module, choose M here: the |
72 | module will be called anydata. | 72 | module will be called anydata. |
73 | 73 | ||
74 | config USB_SERIAL_ARK3116 | ||
75 | tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)" | ||
76 | depends on USB_SERIAL && EXPERIMENTAL | ||
77 | help | ||
78 | Say Y here if you want to use a ARK Micro 3116 USB to Serial | ||
79 | device. | ||
80 | |||
81 | To compile this driver as a module, choose M here: the | ||
82 | module will be called ark3116 | ||
83 | |||
74 | config USB_SERIAL_BELKIN | 84 | config USB_SERIAL_BELKIN |
75 | tristate "USB Belkin and Peracom Single Port Serial Driver" | 85 | tristate "USB Belkin and Peracom Single Port Serial Driver" |
76 | depends on USB_SERIAL | 86 | depends on USB_SERIAL |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 93c21245b1af..5a0960fc9d3e 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -13,6 +13,7 @@ usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) | |||
13 | 13 | ||
14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o | 14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o |
15 | obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o | 15 | obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o |
16 | obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o | ||
16 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o | 17 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o |
17 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o | 18 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o |
18 | obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o | 19 | obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index dbf1f063098c..694b205f9b73 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -18,6 +18,7 @@ | |||
18 | static struct usb_device_id id_table [] = { | 18 | static struct usb_device_id id_table [] = { |
19 | { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */ | 19 | { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */ |
20 | { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ | 20 | { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ |
21 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless Aircard 580 */ | ||
21 | { }, | 22 | { }, |
22 | }; | 23 | }; |
23 | MODULE_DEVICE_TABLE(usb, id_table); | 24 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c new file mode 100644 index 000000000000..8dec796222a0 --- /dev/null +++ b/drivers/usb/serial/ark3116.c | |||
@@ -0,0 +1,465 @@ | |||
1 | /* | ||
2 | * ark3116 | ||
3 | * - implements a driver for the arkmicro ark3116 chipset (vendor=0x6547, | ||
4 | * productid=0x0232) (used in a datacable called KQ-U8A) | ||
5 | * | ||
6 | * - based on code by krisfx -> thanks !! | ||
7 | * (see http://www.linuxquestions.org/questions/showthread.php?p=2184457#post2184457) | ||
8 | * | ||
9 | * - based on logs created by usbsnoopy | ||
10 | * | ||
11 | * Author : Simon Schulz [ark3116_driver<AT>auctionant.de] | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | */ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/tty.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/usb.h> | ||
24 | #include "usb-serial.h" | ||
25 | |||
26 | |||
27 | static int debug; | ||
28 | |||
29 | static struct usb_device_id id_table [] = { | ||
30 | { USB_DEVICE(0x6547, 0x0232) }, | ||
31 | { }, | ||
32 | }; | ||
33 | MODULE_DEVICE_TABLE(usb, id_table); | ||
34 | |||
35 | struct ark3116_private { | ||
36 | spinlock_t lock; | ||
37 | u8 termios_initialized; | ||
38 | }; | ||
39 | |||
40 | static inline void ARK3116_SND(struct usb_serial *serial, int seq, | ||
41 | __u8 request, __u8 requesttype, | ||
42 | __u16 value, __u16 index) | ||
43 | { | ||
44 | int result; | ||
45 | result = usb_control_msg(serial->dev, | ||
46 | usb_sndctrlpipe(serial->dev,0), | ||
47 | request, requesttype, value, index, | ||
48 | NULL,0x00, 1000); | ||
49 | dbg("%03d > ok",seq); | ||
50 | } | ||
51 | |||
52 | static inline void ARK3116_RCV(struct usb_serial *serial, int seq, | ||
53 | __u8 request, __u8 requesttype, | ||
54 | __u16 value, __u16 index, __u8 expected, | ||
55 | char *buf) | ||
56 | { | ||
57 | int result; | ||
58 | result = usb_control_msg(serial->dev, | ||
59 | usb_rcvctrlpipe(serial->dev,0), | ||
60 | request, requesttype, value, index, | ||
61 | buf, 0x0000001, 1000); | ||
62 | if (result) | ||
63 | dbg("%03d < %d bytes [0x%02X]",seq, result, buf[0]); | ||
64 | else | ||
65 | dbg("%03d < 0 bytes", seq); | ||
66 | } | ||
67 | |||
68 | |||
69 | static inline void ARK3116_RCV_QUIET(struct usb_serial *serial, | ||
70 | __u8 request, __u8 requesttype, | ||
71 | __u16 value, __u16 index, char *buf) | ||
72 | { | ||
73 | usb_control_msg(serial->dev, | ||
74 | usb_rcvctrlpipe(serial->dev,0), | ||
75 | request, requesttype, value, index, | ||
76 | buf, 0x0000001, 1000); | ||
77 | } | ||
78 | |||
79 | |||
80 | static int ark3116_attach(struct usb_serial *serial) | ||
81 | { | ||
82 | char *buf; | ||
83 | struct ark3116_private *priv; | ||
84 | int i; | ||
85 | |||
86 | for (i = 0; i < serial->num_ports; ++i) { | ||
87 | priv = kmalloc (sizeof (struct ark3116_private), GFP_KERNEL); | ||
88 | if (!priv) | ||
89 | goto cleanup; | ||
90 | memset (priv, 0x00, sizeof (struct ark3116_private)); | ||
91 | spin_lock_init(&priv->lock); | ||
92 | |||
93 | usb_set_serial_port_data(serial->port[i], priv); | ||
94 | } | ||
95 | |||
96 | buf = kmalloc(1, GFP_KERNEL); | ||
97 | if (!buf) { | ||
98 | dbg("error kmalloc -> out of mem ?"); | ||
99 | goto cleanup; | ||
100 | } | ||
101 | |||
102 | /* 3 */ | ||
103 | ARK3116_SND(serial, 3,0xFE,0x40,0x0008,0x0002); | ||
104 | ARK3116_SND(serial, 4,0xFE,0x40,0x0008,0x0001); | ||
105 | ARK3116_SND(serial, 5,0xFE,0x40,0x0000,0x0008); | ||
106 | ARK3116_SND(serial, 6,0xFE,0x40,0x0000,0x000B); | ||
107 | |||
108 | /* <-- seq7 */ | ||
109 | ARK3116_RCV(serial, 7,0xFE,0xC0,0x0000,0x0003, 0x00, buf); | ||
110 | ARK3116_SND(serial, 8,0xFE,0x40,0x0080,0x0003); | ||
111 | ARK3116_SND(serial, 9,0xFE,0x40,0x001A,0x0000); | ||
112 | ARK3116_SND(serial,10,0xFE,0x40,0x0000,0x0001); | ||
113 | ARK3116_SND(serial,11,0xFE,0x40,0x0000,0x0003); | ||
114 | |||
115 | /* <-- seq12 */ | ||
116 | ARK3116_RCV(serial,12,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
117 | ARK3116_SND(serial,13,0xFE,0x40,0x0000,0x0004); | ||
118 | |||
119 | /* 14 */ | ||
120 | ARK3116_RCV(serial,14,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
121 | ARK3116_SND(serial,15,0xFE,0x40,0x0000,0x0004); | ||
122 | |||
123 | /* 16 */ | ||
124 | ARK3116_RCV(serial,16,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
125 | /* --> seq17 */ | ||
126 | ARK3116_SND(serial,17,0xFE,0x40,0x0001,0x0004); | ||
127 | |||
128 | /* <-- seq18 */ | ||
129 | ARK3116_RCV(serial,18,0xFE,0xC0,0x0000,0x0004, 0x01, buf); | ||
130 | |||
131 | /* --> seq19 */ | ||
132 | ARK3116_SND(serial,19,0xFE,0x40,0x0003,0x0004); | ||
133 | |||
134 | |||
135 | /* <-- seq20 */ | ||
136 | /* seems like serial port status info (RTS, CTS,...) */ | ||
137 | /* returns modem control line status ?! */ | ||
138 | ARK3116_RCV(serial,20,0xFE,0xC0,0x0000,0x0006, 0xFF, buf); | ||
139 | |||
140 | /* set 9600 baud & do some init ?! */ | ||
141 | ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003); | ||
142 | ARK3116_SND(serial,148,0xFE,0x40,0x0038,0x0000); | ||
143 | ARK3116_SND(serial,149,0xFE,0x40,0x0001,0x0001); | ||
144 | ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003); | ||
145 | ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf); | ||
146 | ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003); | ||
147 | ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf); | ||
148 | ARK3116_SND(serial,154,0xFE,0x40,0x0003,0x0003); | ||
149 | |||
150 | kfree(buf); | ||
151 | return(0); | ||
152 | |||
153 | cleanup: | ||
154 | for (--i; i>=0; --i) | ||
155 | usb_set_serial_port_data(serial->port[i], NULL); | ||
156 | return -ENOMEM; | ||
157 | } | ||
158 | |||
159 | static void ark3116_set_termios(struct usb_serial_port *port, | ||
160 | struct termios *old_termios) | ||
161 | { | ||
162 | struct usb_serial *serial = port->serial; | ||
163 | struct ark3116_private *priv = usb_get_serial_port_data(port); | ||
164 | unsigned int cflag = port->tty->termios->c_cflag; | ||
165 | unsigned long flags; | ||
166 | int baud; | ||
167 | int ark3116_baud; | ||
168 | char *buf; | ||
169 | char config; | ||
170 | |||
171 | config = 0; | ||
172 | |||
173 | dbg("%s - port %d", __FUNCTION__, port->number); | ||
174 | |||
175 | if ((!port->tty) || (!port->tty->termios)) { | ||
176 | dbg("%s - no tty structures", __FUNCTION__); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | spin_lock_irqsave(&priv->lock, flags); | ||
181 | if (!priv->termios_initialized) { | ||
182 | *(port->tty->termios) = tty_std_termios; | ||
183 | port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | ||
184 | priv->termios_initialized = 1; | ||
185 | } | ||
186 | spin_unlock_irqrestore(&priv->lock, flags); | ||
187 | |||
188 | cflag = port->tty->termios->c_cflag; | ||
189 | |||
190 | /* check that they really want us to change something: */ | ||
191 | if (old_termios) { | ||
192 | if ((cflag == old_termios->c_cflag) && | ||
193 | (RELEVANT_IFLAG(port->tty->termios->c_iflag) == | ||
194 | RELEVANT_IFLAG(old_termios->c_iflag))) { | ||
195 | dbg("%s - nothing to change...", __FUNCTION__); | ||
196 | return; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | buf = kmalloc(1, GFP_KERNEL); | ||
201 | if (!buf) { | ||
202 | dbg("error kmalloc"); | ||
203 | return; | ||
204 | } | ||
205 | |||
206 | /* set data bit count (8/7/6/5) */ | ||
207 | if (cflag & CSIZE){ | ||
208 | switch (cflag & CSIZE){ | ||
209 | case CS5: | ||
210 | config |= 0x00; | ||
211 | dbg("setting CS5"); | ||
212 | break; | ||
213 | case CS6: | ||
214 | config |= 0x01; | ||
215 | dbg("setting CS6"); | ||
216 | break; | ||
217 | case CS7: | ||
218 | config |= 0x02; | ||
219 | dbg("setting CS7"); | ||
220 | break; | ||
221 | default: | ||
222 | err ("CSIZE was set but not CS5-CS8, using CS8!"); | ||
223 | case CS8: | ||
224 | config |= 0x03; | ||
225 | dbg("setting CS8"); | ||
226 | break; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /* set parity (NONE,EVEN,ODD) */ | ||
231 | if (cflag & PARENB){ | ||
232 | if (cflag & PARODD) { | ||
233 | config |= 0x08; | ||
234 | dbg("setting parity to ODD"); | ||
235 | } else { | ||
236 | config |= 0x18; | ||
237 | dbg("setting parity to EVEN"); | ||
238 | } | ||
239 | } else { | ||
240 | dbg("setting parity to NONE"); | ||
241 | } | ||
242 | |||
243 | /* SET STOPBIT (1/2) */ | ||
244 | if (cflag & CSTOPB) { | ||
245 | config |= 0x04; | ||
246 | dbg ("setting 2 stop bits"); | ||
247 | } else { | ||
248 | dbg ("setting 1 stop bit"); | ||
249 | } | ||
250 | |||
251 | |||
252 | /* set baudrate: */ | ||
253 | baud = 0; | ||
254 | switch (cflag & CBAUD){ | ||
255 | case B0: | ||
256 | err("can't set 0baud, using 9600 instead"); | ||
257 | break; | ||
258 | case B75: baud = 75; break; | ||
259 | case B150: baud = 150; break; | ||
260 | case B300: baud = 300; break; | ||
261 | case B600: baud = 600; break; | ||
262 | case B1200: baud = 1200; break; | ||
263 | case B1800: baud = 1800; break; | ||
264 | case B2400: baud = 2400; break; | ||
265 | case B4800: baud = 4800; break; | ||
266 | case B9600: baud = 9600; break; | ||
267 | case B19200: baud = 19200; break; | ||
268 | case B38400: baud = 38400; break; | ||
269 | case B57600: baud = 57600; break; | ||
270 | case B115200: baud = 115200; break; | ||
271 | case B230400: baud = 230400; break; | ||
272 | case B460800: baud = 460800; break; | ||
273 | default: | ||
274 | dbg("does not support the baudrate requested (fix it)"); | ||
275 | break; | ||
276 | } | ||
277 | |||
278 | /* set 9600 as default (if given baudrate is invalid for example) */ | ||
279 | if (baud == 0) | ||
280 | baud = 9600; | ||
281 | |||
282 | /* | ||
283 | * found by try'n'error, be careful, maybe there are other options | ||
284 | * for multiplicator etc! | ||
285 | */ | ||
286 | if (baud == 460800) | ||
287 | /* strange, for 460800 the formula is wrong | ||
288 | * (dont use round(), then 9600baud is wrong) */ | ||
289 | ark3116_baud = 7; | ||
290 | else | ||
291 | ark3116_baud = 3000000 / baud; | ||
292 | |||
293 | /* ? */ | ||
294 | ARK3116_RCV(serial,0,0xFE,0xC0,0x0000,0x0003, 0x03, buf); | ||
295 | /* offset = buf[0]; */ | ||
296 | /* offset = 0x03; */ | ||
297 | /* dbg("using 0x%04X as target for 0x0003:",0x0080+offset); */ | ||
298 | |||
299 | |||
300 | /* set baudrate */ | ||
301 | dbg("setting baudrate to %d (->reg=%d)",baud,ark3116_baud); | ||
302 | ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003); | ||
303 | ARK3116_SND(serial,148,0xFE,0x40,(ark3116_baud & 0x00FF) ,0x0000); | ||
304 | ARK3116_SND(serial,149,0xFE,0x40,(ark3116_baud & 0xFF00)>>8,0x0001); | ||
305 | ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003); | ||
306 | |||
307 | /* ? */ | ||
308 | ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf); | ||
309 | ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003); | ||
310 | |||
311 | /* set data bit count, stop bit count & parity: */ | ||
312 | dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config); | ||
313 | ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf); | ||
314 | ARK3116_SND(serial,154,0xFE,0x40,config,0x0003); | ||
315 | |||
316 | if (cflag & CRTSCTS) | ||
317 | dbg("CRTSCTS not supported by chipset ?!"); | ||
318 | |||
319 | /* TEST ARK3116_SND(154,0xFE,0x40,0xFFFF, 0x0006); */ | ||
320 | |||
321 | kfree(buf); | ||
322 | return; | ||
323 | } | ||
324 | |||
325 | static int ark3116_open(struct usb_serial_port *port, struct file *filp) | ||
326 | { | ||
327 | struct termios tmp_termios; | ||
328 | struct usb_serial *serial = port->serial; | ||
329 | char *buf; | ||
330 | int result = 0; | ||
331 | |||
332 | dbg("%s - port %d", __FUNCTION__, port->number); | ||
333 | |||
334 | buf = kmalloc(1, GFP_KERNEL); | ||
335 | if (!buf) { | ||
336 | dbg("error kmalloc -> out of mem ?"); | ||
337 | return -ENOMEM; | ||
338 | } | ||
339 | |||
340 | result = usb_serial_generic_open(port, filp); | ||
341 | if (result) | ||
342 | return result; | ||
343 | |||
344 | /* open */ | ||
345 | ARK3116_RCV(serial,111,0xFE,0xC0,0x0000,0x0003, 0x02, buf); | ||
346 | |||
347 | ARK3116_SND(serial,112,0xFE,0x40,0x0082,0x0003); | ||
348 | ARK3116_SND(serial,113,0xFE,0x40,0x001A,0x0000); | ||
349 | ARK3116_SND(serial,114,0xFE,0x40,0x0000,0x0001); | ||
350 | ARK3116_SND(serial,115,0xFE,0x40,0x0002,0x0003); | ||
351 | |||
352 | ARK3116_RCV(serial,116,0xFE,0xC0,0x0000,0x0004, 0x03, buf); | ||
353 | ARK3116_SND(serial,117,0xFE,0x40,0x0002,0x0004); | ||
354 | |||
355 | ARK3116_RCV(serial,118,0xFE,0xC0,0x0000,0x0004, 0x02, buf); | ||
356 | ARK3116_SND(serial,119,0xFE,0x40,0x0000,0x0004); | ||
357 | |||
358 | ARK3116_RCV(serial,120,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
359 | |||
360 | ARK3116_SND(serial,121,0xFE,0x40,0x0001,0x0004); | ||
361 | |||
362 | ARK3116_RCV(serial,122,0xFE,0xC0,0x0000,0x0004, 0x01, buf); | ||
363 | |||
364 | ARK3116_SND(serial,123,0xFE,0x40,0x0003,0x0004); | ||
365 | |||
366 | /* returns different values (control lines ?!) */ | ||
367 | ARK3116_RCV(serial,124,0xFE,0xC0,0x0000,0x0006, 0xFF, buf); | ||
368 | |||
369 | /* initialise termios: */ | ||
370 | if (port->tty) | ||
371 | ark3116_set_termios(port, &tmp_termios); | ||
372 | |||
373 | kfree(buf); | ||
374 | |||
375 | return result; | ||
376 | |||
377 | } | ||
378 | |||
379 | static int ark3116_ioctl(struct usb_serial_port *port, struct file *file, | ||
380 | unsigned int cmd, unsigned long arg) | ||
381 | { | ||
382 | dbg("ioctl not supported yet..."); | ||
383 | return -ENOIOCTLCMD; | ||
384 | } | ||
385 | |||
386 | static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file) | ||
387 | { | ||
388 | struct usb_serial *serial = port->serial; | ||
389 | char *buf; | ||
390 | char temp; | ||
391 | |||
392 | /* seems like serial port status info (RTS, CTS,...) is stored | ||
393 | * in reg(?) 0x0006 | ||
394 | * pcb connection point 11 = GND -> sets bit4 of response | ||
395 | * pcb connection point 7 = GND -> sets bit6 of response | ||
396 | */ | ||
397 | |||
398 | buf = kmalloc(1, GFP_KERNEL); | ||
399 | if (!buf) { | ||
400 | dbg("error kmalloc"); | ||
401 | return -ENOMEM; | ||
402 | } | ||
403 | |||
404 | /* read register: */ | ||
405 | ARK3116_RCV_QUIET(serial,0xFE,0xC0,0x0000,0x0006,buf); | ||
406 | temp = buf[0]; | ||
407 | kfree(buf); | ||
408 | |||
409 | /* i do not really know if bit4=CTS and bit6=DSR... was just a | ||
410 | * quick guess !! | ||
411 | */ | ||
412 | return (temp & (1<<4) ? TIOCM_CTS : 0) | | ||
413 | (temp & (1<<6) ? TIOCM_DSR : 0); | ||
414 | } | ||
415 | |||
416 | static struct usb_driver ark3116_driver = { | ||
417 | .name = "ark3116", | ||
418 | .probe = usb_serial_probe, | ||
419 | .disconnect = usb_serial_disconnect, | ||
420 | .id_table = id_table, | ||
421 | }; | ||
422 | |||
423 | static struct usb_serial_driver ark3116_device = { | ||
424 | .driver = { | ||
425 | .owner = THIS_MODULE, | ||
426 | .name = "ark3116", | ||
427 | }, | ||
428 | .id_table = id_table, | ||
429 | .num_interrupt_in = 1, | ||
430 | .num_bulk_in = 1, | ||
431 | .num_bulk_out = 1, | ||
432 | .num_ports = 1, | ||
433 | .attach = ark3116_attach, | ||
434 | .set_termios = ark3116_set_termios, | ||
435 | .ioctl = ark3116_ioctl, | ||
436 | .tiocmget = ark3116_tiocmget, | ||
437 | .open = ark3116_open, | ||
438 | }; | ||
439 | |||
440 | static int __init ark3116_init(void) | ||
441 | { | ||
442 | int retval; | ||
443 | |||
444 | retval = usb_serial_register(&ark3116_device); | ||
445 | if (retval) | ||
446 | return retval; | ||
447 | retval = usb_register(&ark3116_driver); | ||
448 | if (retval) | ||
449 | usb_serial_deregister(&ark3116_device); | ||
450 | return retval; | ||
451 | } | ||
452 | |||
453 | static void __exit ark3116_exit(void) | ||
454 | { | ||
455 | usb_deregister(&ark3116_driver); | ||
456 | usb_serial_deregister(&ark3116_device); | ||
457 | } | ||
458 | |||
459 | module_init(ark3116_init); | ||
460 | module_exit(ark3116_exit); | ||
461 | MODULE_LICENSE("GPL"); | ||
462 | |||
463 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
464 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
465 | |||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 82151207d814..986d7622273d 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -307,6 +307,7 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
307 | 307 | ||
308 | 308 | ||
309 | static struct usb_device_id id_table_combined [] = { | 309 | static struct usb_device_id id_table_combined [] = { |
310 | { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, | ||
310 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, | 311 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, |
311 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, | 312 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, |
312 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, | 313 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, |
@@ -498,6 +499,7 @@ static struct usb_device_id id_table_combined [] = { | |||
498 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, | 499 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, |
499 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, | 500 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, |
500 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, | 501 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, |
502 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | ||
501 | { }, /* Optional parameter entry */ | 503 | { }, /* Optional parameter entry */ |
502 | { } /* Terminating entry */ | 504 | { } /* Terminating entry */ |
503 | }; | 505 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 2c55a5ea9c99..d69a917e768f 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -32,6 +32,10 @@ | |||
32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ | 32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ |
33 | 33 | ||
34 | 34 | ||
35 | /* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */ | ||
36 | #define FTDI_ACTZWAVE_PID 0xF2D0 | ||
37 | |||
38 | |||
35 | /* www.irtrans.de device */ | 39 | /* www.irtrans.de device */ |
36 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ | 40 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ |
37 | 41 | ||
@@ -426,6 +430,11 @@ | |||
426 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ | 430 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ |
427 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ | 431 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ |
428 | 432 | ||
433 | /* | ||
434 | * ACG Identification Technologies GmbH products (http://www.acg.de/). | ||
435 | * Submitted by anton -at- goto10 -dot- org. | ||
436 | */ | ||
437 | #define FTDI_ACG_HFDUAL_PID 0xDD20 /* HF Dual ISO Reader (RFID) */ | ||
429 | 438 | ||
430 | /* Commands */ | 439 | /* Commands */ |
431 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 440 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 476cda107f4f..c62cc2876519 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -138,6 +138,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp) | |||
138 | 138 | ||
139 | return result; | 139 | return result; |
140 | } | 140 | } |
141 | EXPORT_SYMBOL_GPL(usb_serial_generic_open); | ||
141 | 142 | ||
142 | static void generic_cleanup (struct usb_serial_port *port) | 143 | static void generic_cleanup (struct usb_serial_port *port) |
143 | { | 144 | { |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 4d40704dea2c..238033a87092 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -257,14 +257,14 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf | |||
257 | return (0); | 257 | return (0); |
258 | } | 258 | } |
259 | 259 | ||
260 | spin_lock(&port->lock); | 260 | spin_lock(&wport->lock); |
261 | if (port->write_urb_busy) { | 261 | if (wport->write_urb_busy) { |
262 | spin_unlock(&port->lock); | 262 | spin_unlock(&wport->lock); |
263 | dbg("%s - already writing", __FUNCTION__); | 263 | dbg("%s - already writing", __FUNCTION__); |
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | port->write_urb_busy = 1; | 266 | wport->write_urb_busy = 1; |
267 | spin_unlock(&port->lock); | 267 | spin_unlock(&wport->lock); |
268 | 268 | ||
269 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; | 269 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; |
270 | 270 | ||
@@ -283,7 +283,7 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf | |||
283 | wport->write_urb->dev = serial->dev; | 283 | wport->write_urb->dev = serial->dev; |
284 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); | 284 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); |
285 | if (result) { | 285 | if (result) { |
286 | port->write_urb_busy = 0; | 286 | wport->write_urb_busy = 0; |
287 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); | 287 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); |
288 | } else | 288 | } else |
289 | result = count; | 289 | result = count; |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 071f86a59c08..9c36f0ece20f 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -189,11 +189,15 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
189 | 189 | ||
190 | portNumber = tty->index - serial->minor; | 190 | portNumber = tty->index - serial->minor; |
191 | port = serial->port[portNumber]; | 191 | port = serial->port[portNumber]; |
192 | if (!port) | 192 | if (!port) { |
193 | return -ENODEV; | 193 | retval = -ENODEV; |
194 | goto bailout_kref_put; | ||
195 | } | ||
194 | 196 | ||
195 | if (mutex_lock_interruptible(&port->mutex)) | 197 | if (mutex_lock_interruptible(&port->mutex)) { |
196 | return -ERESTARTSYS; | 198 | retval = -ERESTARTSYS; |
199 | goto bailout_kref_put; | ||
200 | } | ||
197 | 201 | ||
198 | ++port->open_count; | 202 | ++port->open_count; |
199 | 203 | ||
@@ -209,7 +213,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
209 | * safe because we are called with BKL held */ | 213 | * safe because we are called with BKL held */ |
210 | if (!try_module_get(serial->type->driver.owner)) { | 214 | if (!try_module_get(serial->type->driver.owner)) { |
211 | retval = -ENODEV; | 215 | retval = -ENODEV; |
212 | goto bailout_kref_put; | 216 | goto bailout_mutex_unlock; |
213 | } | 217 | } |
214 | 218 | ||
215 | /* only call the device specific open if this | 219 | /* only call the device specific open if this |
@@ -224,10 +228,11 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
224 | 228 | ||
225 | bailout_module_put: | 229 | bailout_module_put: |
226 | module_put(serial->type->driver.owner); | 230 | module_put(serial->type->driver.owner); |
227 | bailout_kref_put: | 231 | bailout_mutex_unlock: |
228 | kref_put(&serial->kref, destroy_serial); | ||
229 | port->open_count = 0; | 232 | port->open_count = 0; |
230 | mutex_unlock(&port->mutex); | 233 | mutex_unlock(&port->mutex); |
234 | bailout_kref_put: | ||
235 | kref_put(&serial->kref, destroy_serial); | ||
231 | return retval; | 236 | return retval; |
232 | } | 237 | } |
233 | 238 | ||
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 3d04b2def0f1..789450bb0bc9 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -214,10 +214,13 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) | |||
214 | */ | 214 | */ |
215 | int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi) | 215 | int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi) |
216 | { | 216 | { |
217 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | 217 | struct au1100fb_device *fbdev; |
218 | u32 *palette = fbdev->regs->lcd_pallettebase; | 218 | u32 *palette; |
219 | u32 value; | 219 | u32 value; |
220 | 220 | ||
221 | fbdev = to_au1100fb_device(fbi); | ||
222 | palette = fbdev->regs->lcd_pallettebase; | ||
223 | |||
221 | if (regno > (AU1100_LCD_NBR_PALETTE_ENTRIES - 1)) | 224 | if (regno > (AU1100_LCD_NBR_PALETTE_ENTRIES - 1)) |
222 | return -EINVAL; | 225 | return -EINVAL; |
223 | 226 | ||
@@ -316,9 +319,11 @@ int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi) | |||
316 | */ | 319 | */ |
317 | int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi) | 320 | int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi) |
318 | { | 321 | { |
319 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | 322 | struct au1100fb_device *fbdev; |
320 | int dy; | 323 | int dy; |
321 | 324 | ||
325 | fbdev = to_au1100fb_device(fbi); | ||
326 | |||
322 | print_dbg("fb_pan_display %p %p", var, fbi); | 327 | print_dbg("fb_pan_display %p %p", var, fbi); |
323 | 328 | ||
324 | if (!var || !fbdev) { | 329 | if (!var || !fbdev) { |
@@ -382,10 +387,12 @@ void au1100fb_fb_rotate(struct fb_info *fbi, int angle) | |||
382 | */ | 387 | */ |
383 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) | 388 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) |
384 | { | 389 | { |
385 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | 390 | struct au1100fb_device *fbdev; |
386 | unsigned int len; | 391 | unsigned int len; |
387 | unsigned long start=0, off; | 392 | unsigned long start=0, off; |
388 | 393 | ||
394 | fbdev = to_au1100fb_device(fbi); | ||
395 | |||
389 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { | 396 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { |
390 | return -EINVAL; | 397 | return -EINVAL; |
391 | } | 398 | } |
@@ -467,7 +474,7 @@ int au1100fb_drv_probe(struct device *dev) | |||
467 | 474 | ||
468 | if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len, | 475 | if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len, |
469 | DRIVER_NAME)) { | 476 | DRIVER_NAME)) { |
470 | print_err("fail to lock memory region at 0x%08x", | 477 | print_err("fail to lock memory region at 0x%08lx", |
471 | au1100fb_fix.mmio_start); | 478 | au1100fb_fix.mmio_start); |
472 | return -EBUSY; | 479 | return -EBUSY; |
473 | } | 480 | } |
@@ -595,13 +602,13 @@ int au1100fb_drv_remove(struct device *dev) | |||
595 | return 0; | 602 | return 0; |
596 | } | 603 | } |
597 | 604 | ||
598 | int au1100fb_drv_suspend(struct device *dev, u32 state, u32 level) | 605 | int au1100fb_drv_suspend(struct device *dev, pm_message_t state) |
599 | { | 606 | { |
600 | /* TODO */ | 607 | /* TODO */ |
601 | return 0; | 608 | return 0; |
602 | } | 609 | } |
603 | 610 | ||
604 | int au1100fb_drv_resume(struct device *dev, u32 level) | 611 | int au1100fb_drv_resume(struct device *dev) |
605 | { | 612 | { |
606 | /* TODO */ | 613 | /* TODO */ |
607 | return 0; | 614 | return 0; |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 334b1db1bd7c..27597c576eff 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -29,12 +29,15 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf) | |||
29 | 29 | ||
30 | static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) | 30 | static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) |
31 | { | 31 | { |
32 | int rc = -ENXIO, power; | 32 | int rc = -ENXIO; |
33 | char *endp; | 33 | char *endp; |
34 | struct backlight_device *bd = to_backlight_device(cdev); | 34 | struct backlight_device *bd = to_backlight_device(cdev); |
35 | int power = simple_strtoul(buf, &endp, 0); | ||
36 | size_t size = endp - buf; | ||
35 | 37 | ||
36 | power = simple_strtoul(buf, &endp, 0); | 38 | if (*endp && isspace(*endp)) |
37 | if (*endp && !isspace(*endp)) | 39 | size++; |
40 | if (size != count) | ||
38 | return -EINVAL; | 41 | return -EINVAL; |
39 | 42 | ||
40 | down(&bd->sem); | 43 | down(&bd->sem); |
@@ -65,12 +68,15 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf) | |||
65 | 68 | ||
66 | static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) | 69 | static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) |
67 | { | 70 | { |
68 | int rc = -ENXIO, brightness; | 71 | int rc = -ENXIO; |
69 | char *endp; | 72 | char *endp; |
70 | struct backlight_device *bd = to_backlight_device(cdev); | 73 | struct backlight_device *bd = to_backlight_device(cdev); |
74 | int brightness = simple_strtoul(buf, &endp, 0); | ||
75 | size_t size = endp - buf; | ||
71 | 76 | ||
72 | brightness = simple_strtoul(buf, &endp, 0); | 77 | if (*endp && isspace(*endp)) |
73 | if (*endp && !isspace(*endp)) | 78 | size++; |
79 | if (size != count) | ||
74 | return -EINVAL; | 80 | return -EINVAL; |
75 | 81 | ||
76 | down(&bd->sem); | 82 | down(&bd->sem); |
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 86908a60c630..bc8ab005a3fb 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -31,12 +31,15 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf) | |||
31 | 31 | ||
32 | static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count) | 32 | static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count) |
33 | { | 33 | { |
34 | int rc, power; | 34 | int rc = -ENXIO; |
35 | char *endp; | 35 | char *endp; |
36 | struct lcd_device *ld = to_lcd_device(cdev); | 36 | struct lcd_device *ld = to_lcd_device(cdev); |
37 | int power = simple_strtoul(buf, &endp, 0); | ||
38 | size_t size = endp - buf; | ||
37 | 39 | ||
38 | power = simple_strtoul(buf, &endp, 0); | 40 | if (*endp && isspace(*endp)) |
39 | if (*endp && !isspace(*endp)) | 41 | size++; |
42 | if (size != count) | ||
40 | return -EINVAL; | 43 | return -EINVAL; |
41 | 44 | ||
42 | down(&ld->sem); | 45 | down(&ld->sem); |
@@ -44,8 +47,7 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
44 | pr_debug("lcd: set power to %d\n", power); | 47 | pr_debug("lcd: set power to %d\n", power); |
45 | ld->props->set_power(ld, power); | 48 | ld->props->set_power(ld, power); |
46 | rc = count; | 49 | rc = count; |
47 | } else | 50 | } |
48 | rc = -ENXIO; | ||
49 | up(&ld->sem); | 51 | up(&ld->sem); |
50 | 52 | ||
51 | return rc; | 53 | return rc; |
@@ -53,14 +55,12 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
53 | 55 | ||
54 | static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | 56 | static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) |
55 | { | 57 | { |
56 | int rc; | 58 | int rc = -ENXIO; |
57 | struct lcd_device *ld = to_lcd_device(cdev); | 59 | struct lcd_device *ld = to_lcd_device(cdev); |
58 | 60 | ||
59 | down(&ld->sem); | 61 | down(&ld->sem); |
60 | if (likely(ld->props && ld->props->get_contrast)) | 62 | if (likely(ld->props && ld->props->get_contrast)) |
61 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); | 63 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); |
62 | else | ||
63 | rc = -ENXIO; | ||
64 | up(&ld->sem); | 64 | up(&ld->sem); |
65 | 65 | ||
66 | return rc; | 66 | return rc; |
@@ -68,12 +68,15 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | |||
68 | 68 | ||
69 | static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count) | 69 | static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count) |
70 | { | 70 | { |
71 | int rc, contrast; | 71 | int rc = -ENXIO; |
72 | char *endp; | 72 | char *endp; |
73 | struct lcd_device *ld = to_lcd_device(cdev); | 73 | struct lcd_device *ld = to_lcd_device(cdev); |
74 | int contrast = simple_strtoul(buf, &endp, 0); | ||
75 | size_t size = endp - buf; | ||
74 | 76 | ||
75 | contrast = simple_strtoul(buf, &endp, 0); | 77 | if (*endp && isspace(*endp)) |
76 | if (*endp && !isspace(*endp)) | 78 | size++; |
79 | if (size != count) | ||
77 | return -EINVAL; | 80 | return -EINVAL; |
78 | 81 | ||
79 | down(&ld->sem); | 82 | down(&ld->sem); |
@@ -81,8 +84,7 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
81 | pr_debug("lcd: set contrast to %d\n", contrast); | 84 | pr_debug("lcd: set contrast to %d\n", contrast); |
82 | ld->props->set_contrast(ld, contrast); | 85 | ld->props->set_contrast(ld, contrast); |
83 | rc = count; | 86 | rc = count; |
84 | } else | 87 | } |
85 | rc = -ENXIO; | ||
86 | up(&ld->sem); | 88 | up(&ld->sem); |
87 | 89 | ||
88 | return rc; | 90 | return rc; |
@@ -90,14 +92,12 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
90 | 92 | ||
91 | static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) | 93 | static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) |
92 | { | 94 | { |
93 | int rc; | 95 | int rc = -ENXIO; |
94 | struct lcd_device *ld = to_lcd_device(cdev); | 96 | struct lcd_device *ld = to_lcd_device(cdev); |
95 | 97 | ||
96 | down(&ld->sem); | 98 | down(&ld->sem); |
97 | if (likely(ld->props)) | 99 | if (likely(ld->props)) |
98 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); | 100 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); |
99 | else | ||
100 | rc = -ENXIO; | ||
101 | up(&ld->sem); | 101 | up(&ld->sem); |
102 | 102 | ||
103 | return rc; | 103 | return rc; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index ca020719d20b..47ba1a79adcd 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -1745,7 +1745,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, | |||
1745 | fbcon_redraw_move(vc, p, 0, t, count); | 1745 | fbcon_redraw_move(vc, p, 0, t, count); |
1746 | ypan_up_redraw(vc, t, count); | 1746 | ypan_up_redraw(vc, t, count); |
1747 | if (vc->vc_rows - b > 0) | 1747 | if (vc->vc_rows - b > 0) |
1748 | fbcon_redraw_move(vc, p, b - count, | 1748 | fbcon_redraw_move(vc, p, b, |
1749 | vc->vc_rows - b, b); | 1749 | vc->vc_rows - b, b); |
1750 | } else | 1750 | } else |
1751 | fbcon_redraw_move(vc, p, t + count, b - t - count, t); | 1751 | fbcon_redraw_move(vc, p, t + count, b - t - count, t); |
@@ -2631,7 +2631,7 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines) | |||
2631 | scr_memcpyw((u16 *) q, (u16 *) p, | 2631 | scr_memcpyw((u16 *) q, (u16 *) p, |
2632 | vc->vc_size_row); | 2632 | vc->vc_size_row); |
2633 | } | 2633 | } |
2634 | softback_in = p; | 2634 | softback_in = softback_curr = p; |
2635 | update_region(vc, vc->vc_origin, | 2635 | update_region(vc, vc->vc_origin, |
2636 | logo_lines * vc->vc_cols); | 2636 | logo_lines * vc->vc_cols); |
2637 | } | 2637 | } |
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 788297e9d59e..44aa2ffff973 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -76,8 +76,8 @@ | |||
76 | * | 76 | * |
77 | * Experiment with v_offset to find out which works best for you. | 77 | * Experiment with v_offset to find out which works best for you. |
78 | */ | 78 | */ |
79 | static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */ | 79 | static u32 v_offset_default __devinitdata; /* For 32 MiB Aper size, 8 should be the default */ |
80 | static u32 voffset __initdata = 0; | 80 | static u32 voffset __devinitdata; |
81 | 81 | ||
82 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); | 82 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); |
83 | static int __devinit i810fb_init_pci (struct pci_dev *dev, | 83 | static int __devinit i810fb_init_pci (struct pci_dev *dev, |
diff --git a/drivers/video/matrox/g450_pll.c b/drivers/video/matrox/g450_pll.c index 8073a73f6f35..440272ad10e7 100644 --- a/drivers/video/matrox/g450_pll.c +++ b/drivers/video/matrox/g450_pll.c | |||
@@ -316,14 +316,24 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, | |||
316 | case M_PIXEL_PLL_B: | 316 | case M_PIXEL_PLL_B: |
317 | case M_PIXEL_PLL_C: | 317 | case M_PIXEL_PLL_C: |
318 | { | 318 | { |
319 | u_int8_t tmp; | 319 | u_int8_t tmp, xpwrctrl; |
320 | unsigned long flags; | 320 | unsigned long flags; |
321 | 321 | ||
322 | matroxfb_DAC_lock_irqsave(flags); | 322 | matroxfb_DAC_lock_irqsave(flags); |
323 | |||
324 | xpwrctrl = matroxfb_DAC_in(PMINFO M1064_XPWRCTRL); | ||
325 | matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl & ~M1064_XPWRCTRL_PANELPDN); | ||
326 | mga_outb(M_SEQ_INDEX, M_SEQ1); | ||
327 | mga_outb(M_SEQ_DATA, mga_inb(M_SEQ_DATA) | M_SEQ1_SCROFF); | ||
323 | tmp = matroxfb_DAC_in(PMINFO M1064_XPIXCLKCTRL); | 328 | tmp = matroxfb_DAC_in(PMINFO M1064_XPIXCLKCTRL); |
329 | tmp |= M1064_XPIXCLKCTRL_DIS; | ||
324 | if (!(tmp & M1064_XPIXCLKCTRL_PLL_UP)) { | 330 | if (!(tmp & M1064_XPIXCLKCTRL_PLL_UP)) { |
325 | matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp | M1064_XPIXCLKCTRL_PLL_UP); | 331 | tmp |= M1064_XPIXCLKCTRL_PLL_UP; |
326 | } | 332 | } |
333 | matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp); | ||
334 | matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0); | ||
335 | matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl); | ||
336 | |||
327 | matroxfb_DAC_unlock_irqrestore(flags); | 337 | matroxfb_DAC_unlock_irqrestore(flags); |
328 | } | 338 | } |
329 | { | 339 | { |
@@ -418,6 +428,15 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, | |||
418 | frequency to higher - with <= lowest wins, while | 428 | frequency to higher - with <= lowest wins, while |
419 | with < highest one wins */ | 429 | with < highest one wins */ |
420 | if (delta <= deltaarray[idx-1]) { | 430 | if (delta <= deltaarray[idx-1]) { |
431 | /* all else being equal except VCO, | ||
432 | * choose VCO not near (within 1/16th or so) VCOmin | ||
433 | * (freqs near VCOmin aren't as stable) | ||
434 | */ | ||
435 | if (delta == deltaarray[idx-1] | ||
436 | && vco != g450_mnp2vco(PMINFO mnparray[idx-1]) | ||
437 | && vco < (pi->vcomin * 17 / 16)) { | ||
438 | break; | ||
439 | } | ||
421 | mnparray[idx] = mnparray[idx-1]; | 440 | mnparray[idx] = mnparray[idx-1]; |
422 | deltaarray[idx] = deltaarray[idx-1]; | 441 | deltaarray[idx] = deltaarray[idx-1]; |
423 | } else { | 442 | } else { |
diff --git a/drivers/video/matrox/matroxfb_DAC1064.h b/drivers/video/matrox/matroxfb_DAC1064.h index 2e7238aa2432..56513a5d220b 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.h +++ b/drivers/video/matrox/matroxfb_DAC1064.h | |||
@@ -40,6 +40,7 @@ void DAC1064_global_restore(WPMINFO2); | |||
40 | #define M1064_XCURCOL1RED 0x0C | 40 | #define M1064_XCURCOL1RED 0x0C |
41 | #define M1064_XCURCOL1GREEN 0x0D | 41 | #define M1064_XCURCOL1GREEN 0x0D |
42 | #define M1064_XCURCOL1BLUE 0x0E | 42 | #define M1064_XCURCOL1BLUE 0x0E |
43 | #define M1064_XDVICLKCTRL 0x0F | ||
43 | #define M1064_XCURCOL2RED 0x10 | 44 | #define M1064_XCURCOL2RED 0x10 |
44 | #define M1064_XCURCOL2GREEN 0x11 | 45 | #define M1064_XCURCOL2GREEN 0x11 |
45 | #define M1064_XCURCOL2BLUE 0x12 | 46 | #define M1064_XCURCOL2BLUE 0x12 |
@@ -144,6 +145,7 @@ void DAC1064_global_restore(WPMINFO2); | |||
144 | #define M1064_XVIDPLLN 0x8F | 145 | #define M1064_XVIDPLLN 0x8F |
145 | 146 | ||
146 | #define M1064_XPWRCTRL 0xA0 | 147 | #define M1064_XPWRCTRL 0xA0 |
148 | #define M1064_XPWRCTRL_PANELPDN 0x04 | ||
147 | 149 | ||
148 | #define M1064_XPANMODE 0xA2 | 150 | #define M1064_XPANMODE 0xA2 |
149 | 151 | ||
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index 3a3e1804c56a..b71737178d0d 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -672,6 +672,8 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv); | |||
672 | 672 | ||
673 | #define M_SEQ_INDEX 0x1FC4 | 673 | #define M_SEQ_INDEX 0x1FC4 |
674 | #define M_SEQ_DATA 0x1FC5 | 674 | #define M_SEQ_DATA 0x1FC5 |
675 | #define M_SEQ1 0x01 | ||
676 | #define M_SEQ1_SCROFF 0x20 | ||
675 | 677 | ||
676 | #define M_MISC_REG_READ 0x1FCC | 678 | #define M_MISC_REG_READ 0x1FCC |
677 | 679 | ||
diff --git a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c index 743e7ad26acc..f85421bf7cb5 100644 --- a/drivers/video/maxinefb.c +++ b/drivers/video/maxinefb.c | |||
@@ -55,7 +55,7 @@ static struct fb_var_screeninfo maxinefb_defined = { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | static struct fb_fix_screeninfo maxinefb_fix = { | 57 | static struct fb_fix_screeninfo maxinefb_fix = { |
58 | .id = "Maxine onboard graphics 1024x768x8", | 58 | .id = "Maxine", |
59 | .smem_len = (1024*768), | 59 | .smem_len = (1024*768), |
60 | .type = FB_TYPE_PACKED_PIXELS, | 60 | .type = FB_TYPE_PACKED_PIXELS, |
61 | .visual = FB_VISUAL_PSEUDOCOLOR, | 61 | .visual = FB_VISUAL_PSEUDOCOLOR, |
@@ -107,8 +107,6 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
107 | 107 | ||
108 | static struct fb_ops maxinefb_ops = { | 108 | static struct fb_ops maxinefb_ops = { |
109 | .owner = THIS_MODULE, | 109 | .owner = THIS_MODULE, |
110 | .fb_get_fix = gen_get_fix, | ||
111 | .fb_get_var = gen_get_var, | ||
112 | .fb_setcolreg = maxinefb_setcolreg, | 110 | .fb_setcolreg = maxinefb_setcolreg, |
113 | .fb_fillrect = cfb_fillrect, | 111 | .fb_fillrect = cfb_fillrect, |
114 | .fb_copyarea = cfb_copyarea, | 112 | .fb_copyarea = cfb_copyarea, |
diff --git a/fs/9p/fcall.c b/fs/9p/fcall.c index 71742ba150c4..6f2617820a4e 100644 --- a/fs/9p/fcall.c +++ b/fs/9p/fcall.c | |||
@@ -98,23 +98,20 @@ v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname, | |||
98 | static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc, | 98 | static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc, |
99 | struct v9fs_fcall *rc, int err) | 99 | struct v9fs_fcall *rc, int err) |
100 | { | 100 | { |
101 | int fid; | 101 | int fid, id; |
102 | struct v9fs_session_info *v9ses; | 102 | struct v9fs_session_info *v9ses; |
103 | 103 | ||
104 | if (err) | 104 | id = 0; |
105 | return; | ||
106 | |||
107 | fid = tc->params.tclunk.fid; | 105 | fid = tc->params.tclunk.fid; |
108 | kfree(tc); | 106 | if (rc) |
109 | 107 | id = rc->id; | |
110 | if (!rc) | ||
111 | return; | ||
112 | |||
113 | v9ses = a; | ||
114 | if (rc->id == RCLUNK) | ||
115 | v9fs_put_idpool(fid, &v9ses->fidpool); | ||
116 | 108 | ||
109 | kfree(tc); | ||
117 | kfree(rc); | 110 | kfree(rc); |
111 | if (id == RCLUNK) { | ||
112 | v9ses = a; | ||
113 | v9fs_put_idpool(fid, &v9ses->fidpool); | ||
114 | } | ||
118 | } | 115 | } |
119 | 116 | ||
120 | /** | 117 | /** |
diff --git a/fs/9p/mux.c b/fs/9p/mux.c index 3e5b124a7212..f4407eb276c7 100644 --- a/fs/9p/mux.c +++ b/fs/9p/mux.c | |||
@@ -50,15 +50,23 @@ enum { | |||
50 | Wpending = 8, /* can write */ | 50 | Wpending = 8, /* can write */ |
51 | }; | 51 | }; |
52 | 52 | ||
53 | enum { | ||
54 | None, | ||
55 | Flushing, | ||
56 | Flushed, | ||
57 | }; | ||
58 | |||
53 | struct v9fs_mux_poll_task; | 59 | struct v9fs_mux_poll_task; |
54 | 60 | ||
55 | struct v9fs_req { | 61 | struct v9fs_req { |
62 | spinlock_t lock; | ||
56 | int tag; | 63 | int tag; |
57 | struct v9fs_fcall *tcall; | 64 | struct v9fs_fcall *tcall; |
58 | struct v9fs_fcall *rcall; | 65 | struct v9fs_fcall *rcall; |
59 | int err; | 66 | int err; |
60 | v9fs_mux_req_callback cb; | 67 | v9fs_mux_req_callback cb; |
61 | void *cba; | 68 | void *cba; |
69 | int flush; | ||
62 | struct list_head req_list; | 70 | struct list_head req_list; |
63 | }; | 71 | }; |
64 | 72 | ||
@@ -96,8 +104,8 @@ struct v9fs_mux_poll_task { | |||
96 | 104 | ||
97 | struct v9fs_mux_rpc { | 105 | struct v9fs_mux_rpc { |
98 | struct v9fs_mux_data *m; | 106 | struct v9fs_mux_data *m; |
99 | struct v9fs_req *req; | ||
100 | int err; | 107 | int err; |
108 | struct v9fs_fcall *tcall; | ||
101 | struct v9fs_fcall *rcall; | 109 | struct v9fs_fcall *rcall; |
102 | wait_queue_head_t wqueue; | 110 | wait_queue_head_t wqueue; |
103 | }; | 111 | }; |
@@ -524,10 +532,9 @@ again: | |||
524 | 532 | ||
525 | static void process_request(struct v9fs_mux_data *m, struct v9fs_req *req) | 533 | static void process_request(struct v9fs_mux_data *m, struct v9fs_req *req) |
526 | { | 534 | { |
527 | int ecode, tag; | 535 | int ecode; |
528 | struct v9fs_str *ename; | 536 | struct v9fs_str *ename; |
529 | 537 | ||
530 | tag = req->tag; | ||
531 | if (!req->err && req->rcall->id == RERROR) { | 538 | if (!req->err && req->rcall->id == RERROR) { |
532 | ecode = req->rcall->params.rerror.errno; | 539 | ecode = req->rcall->params.rerror.errno; |
533 | ename = &req->rcall->params.rerror.error; | 540 | ename = &req->rcall->params.rerror.error; |
@@ -553,23 +560,6 @@ static void process_request(struct v9fs_mux_data *m, struct v9fs_req *req) | |||
553 | if (!req->err) | 560 | if (!req->err) |
554 | req->err = -EIO; | 561 | req->err = -EIO; |
555 | } | 562 | } |
556 | |||
557 | if (req->err == ERREQFLUSH) | ||
558 | return; | ||
559 | |||
560 | if (req->cb) { | ||
561 | dprintk(DEBUG_MUX, "calling callback tcall %p rcall %p\n", | ||
562 | req->tcall, req->rcall); | ||
563 | |||
564 | (*req->cb) (req->cba, req->tcall, req->rcall, req->err); | ||
565 | req->cb = NULL; | ||
566 | } else | ||
567 | kfree(req->rcall); | ||
568 | |||
569 | v9fs_mux_put_tag(m, tag); | ||
570 | |||
571 | wake_up(&m->equeue); | ||
572 | kfree(req); | ||
573 | } | 563 | } |
574 | 564 | ||
575 | /** | 565 | /** |
@@ -669,17 +659,26 @@ static void v9fs_read_work(void *a) | |||
669 | list_for_each_entry_safe(rreq, rptr, &m->req_list, req_list) { | 659 | list_for_each_entry_safe(rreq, rptr, &m->req_list, req_list) { |
670 | if (rreq->tag == rcall->tag) { | 660 | if (rreq->tag == rcall->tag) { |
671 | req = rreq; | 661 | req = rreq; |
672 | req->rcall = rcall; | 662 | if (req->flush != Flushing) |
673 | list_del(&req->req_list); | 663 | list_del(&req->req_list); |
674 | spin_unlock(&m->lock); | ||
675 | process_request(m, req); | ||
676 | break; | 664 | break; |
677 | } | 665 | } |
678 | |||
679 | } | 666 | } |
667 | spin_unlock(&m->lock); | ||
680 | 668 | ||
681 | if (!req) { | 669 | if (req) { |
682 | spin_unlock(&m->lock); | 670 | req->rcall = rcall; |
671 | process_request(m, req); | ||
672 | |||
673 | if (req->flush != Flushing) { | ||
674 | if (req->cb) | ||
675 | (*req->cb) (req, req->cba); | ||
676 | else | ||
677 | kfree(req->rcall); | ||
678 | |||
679 | wake_up(&m->equeue); | ||
680 | } | ||
681 | } else { | ||
683 | if (err >= 0 && rcall->id != RFLUSH) | 682 | if (err >= 0 && rcall->id != RFLUSH) |
684 | dprintk(DEBUG_ERROR, | 683 | dprintk(DEBUG_ERROR, |
685 | "unexpected response mux %p id %d tag %d\n", | 684 | "unexpected response mux %p id %d tag %d\n", |
@@ -746,7 +745,6 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m, | |||
746 | return ERR_PTR(-ENOMEM); | 745 | return ERR_PTR(-ENOMEM); |
747 | 746 | ||
748 | v9fs_set_tag(tc, n); | 747 | v9fs_set_tag(tc, n); |
749 | |||
750 | if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) { | 748 | if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) { |
751 | char buf[150]; | 749 | char buf[150]; |
752 | 750 | ||
@@ -754,12 +752,14 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m, | |||
754 | printk(KERN_NOTICE "<<< %p %s\n", m, buf); | 752 | printk(KERN_NOTICE "<<< %p %s\n", m, buf); |
755 | } | 753 | } |
756 | 754 | ||
755 | spin_lock_init(&req->lock); | ||
757 | req->tag = n; | 756 | req->tag = n; |
758 | req->tcall = tc; | 757 | req->tcall = tc; |
759 | req->rcall = NULL; | 758 | req->rcall = NULL; |
760 | req->err = 0; | 759 | req->err = 0; |
761 | req->cb = cb; | 760 | req->cb = cb; |
762 | req->cba = cba; | 761 | req->cba = cba; |
762 | req->flush = None; | ||
763 | 763 | ||
764 | spin_lock(&m->lock); | 764 | spin_lock(&m->lock); |
765 | list_add_tail(&req->req_list, &m->unsent_req_list); | 765 | list_add_tail(&req->req_list, &m->unsent_req_list); |
@@ -776,72 +776,108 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m, | |||
776 | return req; | 776 | return req; |
777 | } | 777 | } |
778 | 778 | ||
779 | static void v9fs_mux_flush_cb(void *a, struct v9fs_fcall *tc, | 779 | static void v9fs_mux_free_request(struct v9fs_mux_data *m, struct v9fs_req *req) |
780 | struct v9fs_fcall *rc, int err) | 780 | { |
781 | v9fs_mux_put_tag(m, req->tag); | ||
782 | kfree(req); | ||
783 | } | ||
784 | |||
785 | static void v9fs_mux_flush_cb(struct v9fs_req *freq, void *a) | ||
781 | { | 786 | { |
782 | v9fs_mux_req_callback cb; | 787 | v9fs_mux_req_callback cb; |
783 | int tag; | 788 | int tag; |
784 | struct v9fs_mux_data *m; | 789 | struct v9fs_mux_data *m; |
785 | struct v9fs_req *req, *rptr; | 790 | struct v9fs_req *req, *rreq, *rptr; |
786 | 791 | ||
787 | m = a; | 792 | m = a; |
788 | dprintk(DEBUG_MUX, "mux %p tc %p rc %p err %d oldtag %d\n", m, tc, | 793 | dprintk(DEBUG_MUX, "mux %p tc %p rc %p err %d oldtag %d\n", m, |
789 | rc, err, tc->params.tflush.oldtag); | 794 | freq->tcall, freq->rcall, freq->err, |
795 | freq->tcall->params.tflush.oldtag); | ||
790 | 796 | ||
791 | spin_lock(&m->lock); | 797 | spin_lock(&m->lock); |
792 | cb = NULL; | 798 | cb = NULL; |
793 | tag = tc->params.tflush.oldtag; | 799 | tag = freq->tcall->params.tflush.oldtag; |
794 | list_for_each_entry_safe(req, rptr, &m->req_list, req_list) { | 800 | req = NULL; |
795 | if (req->tag == tag) { | 801 | list_for_each_entry_safe(rreq, rptr, &m->req_list, req_list) { |
802 | if (rreq->tag == tag) { | ||
803 | req = rreq; | ||
796 | list_del(&req->req_list); | 804 | list_del(&req->req_list); |
797 | if (req->cb) { | ||
798 | cb = req->cb; | ||
799 | req->cb = NULL; | ||
800 | spin_unlock(&m->lock); | ||
801 | (*cb) (req->cba, req->tcall, req->rcall, | ||
802 | req->err); | ||
803 | } | ||
804 | kfree(req); | ||
805 | wake_up(&m->equeue); | ||
806 | break; | 805 | break; |
807 | } | 806 | } |
808 | } | 807 | } |
808 | spin_unlock(&m->lock); | ||
809 | 809 | ||
810 | if (!cb) | 810 | if (req) { |
811 | spin_unlock(&m->lock); | 811 | spin_lock(&req->lock); |
812 | req->flush = Flushed; | ||
813 | spin_unlock(&req->lock); | ||
814 | |||
815 | if (req->cb) | ||
816 | (*req->cb) (req, req->cba); | ||
817 | else | ||
818 | kfree(req->rcall); | ||
819 | |||
820 | wake_up(&m->equeue); | ||
821 | } | ||
812 | 822 | ||
813 | v9fs_mux_put_tag(m, tag); | 823 | kfree(freq->tcall); |
814 | kfree(tc); | 824 | kfree(freq->rcall); |
815 | kfree(rc); | 825 | v9fs_mux_free_request(m, freq); |
816 | } | 826 | } |
817 | 827 | ||
818 | static void | 828 | static int |
819 | v9fs_mux_flush_request(struct v9fs_mux_data *m, struct v9fs_req *req) | 829 | v9fs_mux_flush_request(struct v9fs_mux_data *m, struct v9fs_req *req) |
820 | { | 830 | { |
821 | struct v9fs_fcall *fc; | 831 | struct v9fs_fcall *fc; |
832 | struct v9fs_req *rreq, *rptr; | ||
822 | 833 | ||
823 | dprintk(DEBUG_MUX, "mux %p req %p tag %d\n", m, req, req->tag); | 834 | dprintk(DEBUG_MUX, "mux %p req %p tag %d\n", m, req, req->tag); |
824 | 835 | ||
836 | /* if a response was received for a request, do nothing */ | ||
837 | spin_lock(&req->lock); | ||
838 | if (req->rcall || req->err) { | ||
839 | spin_unlock(&req->lock); | ||
840 | dprintk(DEBUG_MUX, "mux %p req %p response already received\n", m, req); | ||
841 | return 0; | ||
842 | } | ||
843 | |||
844 | req->flush = Flushing; | ||
845 | spin_unlock(&req->lock); | ||
846 | |||
847 | spin_lock(&m->lock); | ||
848 | /* if the request is not sent yet, just remove it from the list */ | ||
849 | list_for_each_entry_safe(rreq, rptr, &m->unsent_req_list, req_list) { | ||
850 | if (rreq->tag == req->tag) { | ||
851 | dprintk(DEBUG_MUX, "mux %p req %p request is not sent yet\n", m, req); | ||
852 | list_del(&rreq->req_list); | ||
853 | req->flush = Flushed; | ||
854 | spin_unlock(&m->lock); | ||
855 | if (req->cb) | ||
856 | (*req->cb) (req, req->cba); | ||
857 | return 0; | ||
858 | } | ||
859 | } | ||
860 | spin_unlock(&m->lock); | ||
861 | |||
862 | clear_thread_flag(TIF_SIGPENDING); | ||
825 | fc = v9fs_create_tflush(req->tag); | 863 | fc = v9fs_create_tflush(req->tag); |
826 | v9fs_send_request(m, fc, v9fs_mux_flush_cb, m); | 864 | v9fs_send_request(m, fc, v9fs_mux_flush_cb, m); |
865 | return 1; | ||
827 | } | 866 | } |
828 | 867 | ||
829 | static void | 868 | static void |
830 | v9fs_mux_rpc_cb(void *a, struct v9fs_fcall *tc, struct v9fs_fcall *rc, int err) | 869 | v9fs_mux_rpc_cb(struct v9fs_req *req, void *a) |
831 | { | 870 | { |
832 | struct v9fs_mux_rpc *r; | 871 | struct v9fs_mux_rpc *r; |
833 | 872 | ||
834 | if (err == ERREQFLUSH) { | 873 | dprintk(DEBUG_MUX, "req %p r %p\n", req, a); |
835 | kfree(rc); | ||
836 | dprintk(DEBUG_MUX, "err req flush\n"); | ||
837 | return; | ||
838 | } | ||
839 | |||
840 | r = a; | 874 | r = a; |
841 | dprintk(DEBUG_MUX, "mux %p req %p tc %p rc %p err %d\n", r->m, r->req, | 875 | r->rcall = req->rcall; |
842 | tc, rc, err); | 876 | r->err = req->err; |
843 | r->rcall = rc; | 877 | |
844 | r->err = err; | 878 | if (req->flush!=None && !req->err) |
879 | r->err = -ERESTARTSYS; | ||
880 | |||
845 | wake_up(&r->wqueue); | 881 | wake_up(&r->wqueue); |
846 | } | 882 | } |
847 | 883 | ||
@@ -856,12 +892,13 @@ int | |||
856 | v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc, | 892 | v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc, |
857 | struct v9fs_fcall **rc) | 893 | struct v9fs_fcall **rc) |
858 | { | 894 | { |
859 | int err; | 895 | int err, sigpending; |
860 | unsigned long flags; | 896 | unsigned long flags; |
861 | struct v9fs_req *req; | 897 | struct v9fs_req *req; |
862 | struct v9fs_mux_rpc r; | 898 | struct v9fs_mux_rpc r; |
863 | 899 | ||
864 | r.err = 0; | 900 | r.err = 0; |
901 | r.tcall = tc; | ||
865 | r.rcall = NULL; | 902 | r.rcall = NULL; |
866 | r.m = m; | 903 | r.m = m; |
867 | init_waitqueue_head(&r.wqueue); | 904 | init_waitqueue_head(&r.wqueue); |
@@ -869,48 +906,50 @@ v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc, | |||
869 | if (rc) | 906 | if (rc) |
870 | *rc = NULL; | 907 | *rc = NULL; |
871 | 908 | ||
909 | sigpending = 0; | ||
910 | if (signal_pending(current)) { | ||
911 | sigpending = 1; | ||
912 | clear_thread_flag(TIF_SIGPENDING); | ||
913 | } | ||
914 | |||
872 | req = v9fs_send_request(m, tc, v9fs_mux_rpc_cb, &r); | 915 | req = v9fs_send_request(m, tc, v9fs_mux_rpc_cb, &r); |
873 | if (IS_ERR(req)) { | 916 | if (IS_ERR(req)) { |
874 | err = PTR_ERR(req); | 917 | err = PTR_ERR(req); |
875 | dprintk(DEBUG_MUX, "error %d\n", err); | 918 | dprintk(DEBUG_MUX, "error %d\n", err); |
876 | return PTR_ERR(req); | 919 | return err; |
877 | } | 920 | } |
878 | 921 | ||
879 | r.req = req; | ||
880 | dprintk(DEBUG_MUX, "mux %p tc %p tag %d rpc %p req %p\n", m, tc, | ||
881 | req->tag, &r, req); | ||
882 | err = wait_event_interruptible(r.wqueue, r.rcall != NULL || r.err < 0); | 922 | err = wait_event_interruptible(r.wqueue, r.rcall != NULL || r.err < 0); |
883 | if (r.err < 0) | 923 | if (r.err < 0) |
884 | err = r.err; | 924 | err = r.err; |
885 | 925 | ||
886 | if (err == -ERESTARTSYS && m->trans->status == Connected && m->err == 0) { | 926 | if (err == -ERESTARTSYS && m->trans->status == Connected && m->err == 0) { |
887 | spin_lock(&m->lock); | 927 | if (v9fs_mux_flush_request(m, req)) { |
888 | req->tcall = NULL; | 928 | /* wait until we get response of the flush message */ |
889 | req->err = ERREQFLUSH; | 929 | do { |
890 | spin_unlock(&m->lock); | 930 | clear_thread_flag(TIF_SIGPENDING); |
931 | err = wait_event_interruptible(r.wqueue, | ||
932 | r.rcall || r.err); | ||
933 | } while (!r.rcall && !r.err && err==-ERESTARTSYS && | ||
934 | m->trans->status==Connected && !m->err); | ||
935 | } | ||
936 | sigpending = 1; | ||
937 | } | ||
891 | 938 | ||
892 | clear_thread_flag(TIF_SIGPENDING); | 939 | if (sigpending) { |
893 | v9fs_mux_flush_request(m, req); | ||
894 | spin_lock_irqsave(¤t->sighand->siglock, flags); | 940 | spin_lock_irqsave(¤t->sighand->siglock, flags); |
895 | recalc_sigpending(); | 941 | recalc_sigpending(); |
896 | spin_unlock_irqrestore(¤t->sighand->siglock, flags); | 942 | spin_unlock_irqrestore(¤t->sighand->siglock, flags); |
897 | } | 943 | } |
898 | 944 | ||
899 | if (!err) { | 945 | if (rc) |
900 | if (r.rcall) | 946 | *rc = r.rcall; |
901 | dprintk(DEBUG_MUX, "got response id %d tag %d\n", | 947 | else |
902 | r.rcall->id, r.rcall->tag); | ||
903 | |||
904 | if (rc) | ||
905 | *rc = r.rcall; | ||
906 | else | ||
907 | kfree(r.rcall); | ||
908 | } else { | ||
909 | kfree(r.rcall); | 948 | kfree(r.rcall); |
910 | dprintk(DEBUG_MUX, "got error %d\n", err); | 949 | |
911 | if (err > 0) | 950 | v9fs_mux_free_request(m, req); |
912 | err = -EIO; | 951 | if (err > 0) |
913 | } | 952 | err = -EIO; |
914 | 953 | ||
915 | return err; | 954 | return err; |
916 | } | 955 | } |
@@ -951,12 +990,15 @@ void v9fs_mux_cancel(struct v9fs_mux_data *m, int err) | |||
951 | struct v9fs_req *req, *rtmp; | 990 | struct v9fs_req *req, *rtmp; |
952 | LIST_HEAD(cancel_list); | 991 | LIST_HEAD(cancel_list); |
953 | 992 | ||
954 | dprintk(DEBUG_MUX, "mux %p err %d\n", m, err); | 993 | dprintk(DEBUG_ERROR, "mux %p err %d\n", m, err); |
955 | m->err = err; | 994 | m->err = err; |
956 | spin_lock(&m->lock); | 995 | spin_lock(&m->lock); |
957 | list_for_each_entry_safe(req, rtmp, &m->req_list, req_list) { | 996 | list_for_each_entry_safe(req, rtmp, &m->req_list, req_list) { |
958 | list_move(&req->req_list, &cancel_list); | 997 | list_move(&req->req_list, &cancel_list); |
959 | } | 998 | } |
999 | list_for_each_entry_safe(req, rtmp, &m->unsent_req_list, req_list) { | ||
1000 | list_move(&req->req_list, &cancel_list); | ||
1001 | } | ||
960 | spin_unlock(&m->lock); | 1002 | spin_unlock(&m->lock); |
961 | 1003 | ||
962 | list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) { | 1004 | list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) { |
@@ -965,11 +1007,9 @@ void v9fs_mux_cancel(struct v9fs_mux_data *m, int err) | |||
965 | req->err = err; | 1007 | req->err = err; |
966 | 1008 | ||
967 | if (req->cb) | 1009 | if (req->cb) |
968 | (*req->cb) (req->cba, req->tcall, req->rcall, req->err); | 1010 | (*req->cb) (req, req->cba); |
969 | else | 1011 | else |
970 | kfree(req->rcall); | 1012 | kfree(req->rcall); |
971 | |||
972 | kfree(req); | ||
973 | } | 1013 | } |
974 | 1014 | ||
975 | wake_up(&m->equeue); | 1015 | wake_up(&m->equeue); |
diff --git a/fs/9p/mux.h b/fs/9p/mux.h index e90bfd32ea42..fb10c50186a1 100644 --- a/fs/9p/mux.h +++ b/fs/9p/mux.h | |||
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | struct v9fs_mux_data; | 26 | struct v9fs_mux_data; |
27 | struct v9fs_req; | ||
27 | 28 | ||
28 | /** | 29 | /** |
29 | * v9fs_mux_req_callback - callback function that is called when the | 30 | * v9fs_mux_req_callback - callback function that is called when the |
@@ -36,8 +37,7 @@ struct v9fs_mux_data; | |||
36 | * @rc - response call | 37 | * @rc - response call |
37 | * @err - error code (non-zero if error occured) | 38 | * @err - error code (non-zero if error occured) |
38 | */ | 39 | */ |
39 | typedef void (*v9fs_mux_req_callback)(void *a, struct v9fs_fcall *tc, | 40 | typedef void (*v9fs_mux_req_callback)(struct v9fs_req *req, void *a); |
40 | struct v9fs_fcall *rc, int err); | ||
41 | 41 | ||
42 | int v9fs_mux_global_init(void); | 42 | int v9fs_mux_global_init(void); |
43 | void v9fs_mux_global_exit(void); | 43 | void v9fs_mux_global_exit(void); |
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 083dcfcd158e..1a8e46084f0e 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -72,11 +72,17 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
72 | return -ENOSPC; | 72 | return -ENOSPC; |
73 | } | 73 | } |
74 | 74 | ||
75 | err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); | 75 | err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, &fcall); |
76 | if (err < 0) { | 76 | if (err < 0) { |
77 | dprintk(DEBUG_ERROR, "rewalk didn't work\n"); | 77 | dprintk(DEBUG_ERROR, "rewalk didn't work\n"); |
78 | goto put_fid; | 78 | if (fcall && fcall->id == RWALK) |
79 | goto clunk_fid; | ||
80 | else { | ||
81 | v9fs_put_idpool(fid, &v9ses->fidpool); | ||
82 | goto free_fcall; | ||
83 | } | ||
79 | } | 84 | } |
85 | kfree(fcall); | ||
80 | 86 | ||
81 | /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ | 87 | /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ |
82 | /* translate open mode appropriately */ | 88 | /* translate open mode appropriately */ |
@@ -109,8 +115,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
109 | clunk_fid: | 115 | clunk_fid: |
110 | v9fs_t_clunk(v9ses, fid); | 116 | v9fs_t_clunk(v9ses, fid); |
111 | 117 | ||
112 | put_fid: | 118 | free_fcall: |
113 | v9fs_put_idpool(fid, &v9ses->fidpool); | ||
114 | kfree(fcall); | 119 | kfree(fcall); |
115 | 120 | ||
116 | return err; | 121 | return err; |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 133db366d306..2cb87ba4b1c1 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -270,7 +270,10 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, u32 perm, | |||
270 | err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall); | 270 | err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall); |
271 | if (err < 0) { | 271 | if (err < 0) { |
272 | PRINT_FCALL_ERROR("clone error", fcall); | 272 | PRINT_FCALL_ERROR("clone error", fcall); |
273 | goto put_fid; | 273 | if (fcall && fcall->id == RWALK) |
274 | goto clunk_fid; | ||
275 | else | ||
276 | goto put_fid; | ||
274 | } | 277 | } |
275 | kfree(fcall); | 278 | kfree(fcall); |
276 | 279 | ||
@@ -322,6 +325,9 @@ v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry) | |||
322 | &fcall); | 325 | &fcall); |
323 | 326 | ||
324 | if (err < 0) { | 327 | if (err < 0) { |
328 | if (fcall && fcall->id == RWALK) | ||
329 | goto clunk_fid; | ||
330 | |||
325 | PRINT_FCALL_ERROR("walk error", fcall); | 331 | PRINT_FCALL_ERROR("walk error", fcall); |
326 | v9fs_put_idpool(nfid, &v9ses->fidpool); | 332 | v9fs_put_idpool(nfid, &v9ses->fidpool); |
327 | goto error; | 333 | goto error; |
@@ -640,19 +646,26 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, | |||
640 | } | 646 | } |
641 | 647 | ||
642 | result = v9fs_t_walk(v9ses, dirfidnum, newfid, | 648 | result = v9fs_t_walk(v9ses, dirfidnum, newfid, |
643 | (char *)dentry->d_name.name, NULL); | 649 | (char *)dentry->d_name.name, &fcall); |
650 | |||
644 | if (result < 0) { | 651 | if (result < 0) { |
645 | v9fs_put_idpool(newfid, &v9ses->fidpool); | 652 | if (fcall && fcall->id == RWALK) |
653 | v9fs_t_clunk(v9ses, newfid); | ||
654 | else | ||
655 | v9fs_put_idpool(newfid, &v9ses->fidpool); | ||
656 | |||
646 | if (result == -ENOENT) { | 657 | if (result == -ENOENT) { |
647 | d_add(dentry, NULL); | 658 | d_add(dentry, NULL); |
648 | dprintk(DEBUG_VFS, | 659 | dprintk(DEBUG_VFS, |
649 | "Return negative dentry %p count %d\n", | 660 | "Return negative dentry %p count %d\n", |
650 | dentry, atomic_read(&dentry->d_count)); | 661 | dentry, atomic_read(&dentry->d_count)); |
662 | kfree(fcall); | ||
651 | return NULL; | 663 | return NULL; |
652 | } | 664 | } |
653 | dprintk(DEBUG_ERROR, "walk error:%d\n", result); | 665 | dprintk(DEBUG_ERROR, "walk error:%d\n", result); |
654 | goto FreeFcall; | 666 | goto FreeFcall; |
655 | } | 667 | } |
668 | kfree(fcall); | ||
656 | 669 | ||
657 | result = v9fs_t_stat(v9ses, newfid, &fcall); | 670 | result = v9fs_t_stat(v9ses, newfid, &fcall); |
658 | if (result < 0) { | 671 | if (result < 0) { |
diff --git a/fs/Makefile b/fs/Makefile index 83bf478e786b..078d3d1191a5 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
@@ -45,6 +45,7 @@ obj-$(CONFIG_DNOTIFY) += dnotify.o | |||
45 | obj-$(CONFIG_PROC_FS) += proc/ | 45 | obj-$(CONFIG_PROC_FS) += proc/ |
46 | obj-y += partitions/ | 46 | obj-y += partitions/ |
47 | obj-$(CONFIG_SYSFS) += sysfs/ | 47 | obj-$(CONFIG_SYSFS) += sysfs/ |
48 | obj-$(CONFIG_CONFIGFS_FS) += configfs/ | ||
48 | obj-y += devpts/ | 49 | obj-y += devpts/ |
49 | 50 | ||
50 | obj-$(CONFIG_PROFILING) += dcookies.o | 51 | obj-$(CONFIG_PROFILING) += dcookies.o |
@@ -100,5 +101,4 @@ obj-$(CONFIG_BEFS_FS) += befs/ | |||
100 | obj-$(CONFIG_HOSTFS) += hostfs/ | 101 | obj-$(CONFIG_HOSTFS) += hostfs/ |
101 | obj-$(CONFIG_HPPFS) += hppfs/ | 102 | obj-$(CONFIG_HPPFS) += hppfs/ |
102 | obj-$(CONFIG_DEBUG_FS) += debugfs/ | 103 | obj-$(CONFIG_DEBUG_FS) += debugfs/ |
103 | obj-$(CONFIG_CONFIGFS_FS) += configfs/ | ||
104 | obj-$(CONFIG_OCFS2_FS) += ocfs2/ | 104 | obj-$(CONFIG_OCFS2_FS) += ocfs2/ |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index d4c2d636c479..a42143ca0169 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -416,10 +416,9 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
416 | return retval; | 416 | return retval; |
417 | } | 417 | } |
418 | 418 | ||
419 | retval = -EIO; | ||
420 | bh = affs_bread(sb, old_dentry->d_inode->i_ino); | 419 | bh = affs_bread(sb, old_dentry->d_inode->i_ino); |
421 | if (!bh) | 420 | if (!bh) |
422 | goto done; | 421 | return -EIO; |
423 | 422 | ||
424 | /* Remove header from its parent directory. */ | 423 | /* Remove header from its parent directory. */ |
425 | affs_lock_dir(old_dir); | 424 | affs_lock_dir(old_dir); |
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 57c4903614e5..d6603d02304c 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -74,8 +74,8 @@ struct autofs_wait_queue { | |||
74 | struct autofs_wait_queue *next; | 74 | struct autofs_wait_queue *next; |
75 | autofs_wqt_t wait_queue_token; | 75 | autofs_wqt_t wait_queue_token; |
76 | /* We use the following to see what we are waiting for */ | 76 | /* We use the following to see what we are waiting for */ |
77 | int hash; | 77 | unsigned int hash; |
78 | int len; | 78 | unsigned int len; |
79 | char *name; | 79 | char *name; |
80 | u32 dev; | 80 | u32 dev; |
81 | u64 ino; | 81 | u64 ino; |
@@ -85,7 +85,6 @@ struct autofs_wait_queue { | |||
85 | pid_t tgid; | 85 | pid_t tgid; |
86 | /* This is for status reporting upon return */ | 86 | /* This is for status reporting upon return */ |
87 | int status; | 87 | int status; |
88 | atomic_t notify; | ||
89 | atomic_t wait_ctr; | 88 | atomic_t wait_ctr; |
90 | }; | 89 | }; |
91 | 90 | ||
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 84e030c8ddd0..5100f984783f 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -327,6 +327,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) | |||
327 | static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) | 327 | static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) |
328 | { | 328 | { |
329 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 329 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
330 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | ||
330 | int oz_mode = autofs4_oz_mode(sbi); | 331 | int oz_mode = autofs4_oz_mode(sbi); |
331 | unsigned int lookup_type; | 332 | unsigned int lookup_type; |
332 | int status; | 333 | int status; |
@@ -340,13 +341,8 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
340 | if (oz_mode || !lookup_type) | 341 | if (oz_mode || !lookup_type) |
341 | goto done; | 342 | goto done; |
342 | 343 | ||
343 | /* | 344 | /* If an expire request is pending wait for it. */ |
344 | * If a request is pending wait for it. | 345 | if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) { |
345 | * If it's a mount then it won't be expired till at least | ||
346 | * a liitle later and if it's an expire then we might need | ||
347 | * to mount it again. | ||
348 | */ | ||
349 | if (autofs4_ispending(dentry)) { | ||
350 | DPRINTK("waiting for active request %p name=%.*s", | 346 | DPRINTK("waiting for active request %p name=%.*s", |
351 | dentry, dentry->d_name.len, dentry->d_name.name); | 347 | dentry, dentry->d_name.len, dentry->d_name.name); |
352 | 348 | ||
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 142ab6aa2aa1..ce103e7b0bc3 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -189,14 +189,30 @@ static int autofs4_getpath(struct autofs_sb_info *sbi, | |||
189 | return len; | 189 | return len; |
190 | } | 190 | } |
191 | 191 | ||
192 | static struct autofs_wait_queue * | ||
193 | autofs4_find_wait(struct autofs_sb_info *sbi, | ||
194 | char *name, unsigned int hash, unsigned int len) | ||
195 | { | ||
196 | struct autofs_wait_queue *wq; | ||
197 | |||
198 | for (wq = sbi->queues; wq; wq = wq->next) { | ||
199 | if (wq->hash == hash && | ||
200 | wq->len == len && | ||
201 | wq->name && !memcmp(wq->name, name, len)) | ||
202 | break; | ||
203 | } | ||
204 | return wq; | ||
205 | } | ||
206 | |||
192 | int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | 207 | int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, |
193 | enum autofs_notify notify) | 208 | enum autofs_notify notify) |
194 | { | 209 | { |
210 | struct autofs_info *ino; | ||
195 | struct autofs_wait_queue *wq; | 211 | struct autofs_wait_queue *wq; |
196 | char *name; | 212 | char *name; |
197 | unsigned int len = 0; | 213 | unsigned int len = 0; |
198 | unsigned int hash = 0; | 214 | unsigned int hash = 0; |
199 | int status; | 215 | int status, type; |
200 | 216 | ||
201 | /* In catatonic mode, we don't wait for nobody */ | 217 | /* In catatonic mode, we don't wait for nobody */ |
202 | if (sbi->catatonic) | 218 | if (sbi->catatonic) |
@@ -223,21 +239,41 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
223 | return -EINTR; | 239 | return -EINTR; |
224 | } | 240 | } |
225 | 241 | ||
226 | for (wq = sbi->queues ; wq ; wq = wq->next) { | 242 | wq = autofs4_find_wait(sbi, name, hash, len); |
227 | if (wq->hash == dentry->d_name.hash && | 243 | ino = autofs4_dentry_ino(dentry); |
228 | wq->len == len && | 244 | if (!wq && ino && notify == NFY_NONE) { |
229 | wq->name && !memcmp(wq->name, name, len)) | 245 | /* |
230 | break; | 246 | * Either we've betean the pending expire to post it's |
231 | } | 247 | * wait or it finished while we waited on the mutex. |
248 | * So we need to wait till either, the wait appears | ||
249 | * or the expire finishes. | ||
250 | */ | ||
251 | |||
252 | while (ino->flags & AUTOFS_INF_EXPIRING) { | ||
253 | mutex_unlock(&sbi->wq_mutex); | ||
254 | schedule_timeout_interruptible(HZ/10); | ||
255 | if (mutex_lock_interruptible(&sbi->wq_mutex)) { | ||
256 | kfree(name); | ||
257 | return -EINTR; | ||
258 | } | ||
259 | wq = autofs4_find_wait(sbi, name, hash, len); | ||
260 | if (wq) | ||
261 | break; | ||
262 | } | ||
232 | 263 | ||
233 | if (!wq) { | 264 | /* |
234 | /* Can't wait for an expire if there's no mount */ | 265 | * Not ideal but the status has already gone. Of the two |
235 | if (notify == NFY_NONE && !d_mountpoint(dentry)) { | 266 | * cases where we wait on NFY_NONE neither depend on the |
267 | * return status of the wait. | ||
268 | */ | ||
269 | if (!wq) { | ||
236 | kfree(name); | 270 | kfree(name); |
237 | mutex_unlock(&sbi->wq_mutex); | 271 | mutex_unlock(&sbi->wq_mutex); |
238 | return -ENOENT; | 272 | return 0; |
239 | } | 273 | } |
274 | } | ||
240 | 275 | ||
276 | if (!wq) { | ||
241 | /* Create a new wait queue */ | 277 | /* Create a new wait queue */ |
242 | wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); | 278 | wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); |
243 | if (!wq) { | 279 | if (!wq) { |
@@ -263,20 +299,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
263 | wq->tgid = current->tgid; | 299 | wq->tgid = current->tgid; |
264 | wq->status = -EINTR; /* Status return if interrupted */ | 300 | wq->status = -EINTR; /* Status return if interrupted */ |
265 | atomic_set(&wq->wait_ctr, 2); | 301 | atomic_set(&wq->wait_ctr, 2); |
266 | atomic_set(&wq->notify, 1); | ||
267 | mutex_unlock(&sbi->wq_mutex); | ||
268 | } else { | ||
269 | atomic_inc(&wq->wait_ctr); | ||
270 | mutex_unlock(&sbi->wq_mutex); | 302 | mutex_unlock(&sbi->wq_mutex); |
271 | kfree(name); | ||
272 | DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d", | ||
273 | (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify); | ||
274 | } | ||
275 | |||
276 | if (notify != NFY_NONE && atomic_read(&wq->notify)) { | ||
277 | int type; | ||
278 | |||
279 | atomic_dec(&wq->notify); | ||
280 | 303 | ||
281 | if (sbi->version < 5) { | 304 | if (sbi->version < 5) { |
282 | if (notify == NFY_MOUNT) | 305 | if (notify == NFY_MOUNT) |
@@ -299,6 +322,12 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
299 | 322 | ||
300 | /* autofs4_notify_daemon() may block */ | 323 | /* autofs4_notify_daemon() may block */ |
301 | autofs4_notify_daemon(sbi, wq, type); | 324 | autofs4_notify_daemon(sbi, wq, type); |
325 | } else { | ||
326 | atomic_inc(&wq->wait_ctr); | ||
327 | mutex_unlock(&sbi->wq_mutex); | ||
328 | kfree(name); | ||
329 | DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d", | ||
330 | (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify); | ||
302 | } | 331 | } |
303 | 332 | ||
304 | /* wq->name is NULL if and only if the lock is already released */ | 333 | /* wq->name is NULL if and only if the lock is already released */ |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 69f44dcdb0b4..b1c902e319c1 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -428,7 +428,6 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
428 | loff_t fpos; | 428 | loff_t fpos; |
429 | unsigned long start_code, end_code; | 429 | unsigned long start_code, end_code; |
430 | int ret; | 430 | int ret; |
431 | int exec_fileno; | ||
432 | 431 | ||
433 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ | 432 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ |
434 | inode = bprm->file->f_dentry->d_inode; | 433 | inode = bprm->file->f_dentry->d_inode; |
@@ -502,21 +501,12 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
502 | goto err; | 501 | goto err; |
503 | } | 502 | } |
504 | 503 | ||
505 | /* check file descriptor */ | ||
506 | exec_fileno = get_unused_fd(); | ||
507 | if (exec_fileno < 0) { | ||
508 | ret = -EMFILE; | ||
509 | goto err; | ||
510 | } | ||
511 | get_file(bprm->file); | ||
512 | fd_install(exec_fileno, bprm->file); | ||
513 | |||
514 | /* Flush all traces of the currently running executable */ | 504 | /* Flush all traces of the currently running executable */ |
515 | if (id == 0) { | 505 | if (id == 0) { |
516 | result = flush_old_exec(bprm); | 506 | result = flush_old_exec(bprm); |
517 | if (result) { | 507 | if (result) { |
518 | ret = result; | 508 | ret = result; |
519 | goto err_close; | 509 | goto err; |
520 | } | 510 | } |
521 | 511 | ||
522 | /* OK, This is the point of no return */ | 512 | /* OK, This is the point of no return */ |
@@ -548,7 +538,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
548 | textpos = (unsigned long) -ENOMEM; | 538 | textpos = (unsigned long) -ENOMEM; |
549 | printk("Unable to mmap process text, errno %d\n", (int)-textpos); | 539 | printk("Unable to mmap process text, errno %d\n", (int)-textpos); |
550 | ret = textpos; | 540 | ret = textpos; |
551 | goto err_close; | 541 | goto err; |
552 | } | 542 | } |
553 | 543 | ||
554 | down_write(¤t->mm->mmap_sem); | 544 | down_write(¤t->mm->mmap_sem); |
@@ -564,7 +554,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
564 | (int)-datapos); | 554 | (int)-datapos); |
565 | do_munmap(current->mm, textpos, text_len); | 555 | do_munmap(current->mm, textpos, text_len); |
566 | ret = realdatastart; | 556 | ret = realdatastart; |
567 | goto err_close; | 557 | goto err; |
568 | } | 558 | } |
569 | datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long); | 559 | datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long); |
570 | 560 | ||
@@ -587,7 +577,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
587 | do_munmap(current->mm, textpos, text_len); | 577 | do_munmap(current->mm, textpos, text_len); |
588 | do_munmap(current->mm, realdatastart, data_len + extra); | 578 | do_munmap(current->mm, realdatastart, data_len + extra); |
589 | ret = result; | 579 | ret = result; |
590 | goto err_close; | 580 | goto err; |
591 | } | 581 | } |
592 | 582 | ||
593 | reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len)); | 583 | reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len)); |
@@ -606,7 +596,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
606 | printk("Unable to allocate RAM for process text/data, errno %d\n", | 596 | printk("Unable to allocate RAM for process text/data, errno %d\n", |
607 | (int)-textpos); | 597 | (int)-textpos); |
608 | ret = textpos; | 598 | ret = textpos; |
609 | goto err_close; | 599 | goto err; |
610 | } | 600 | } |
611 | 601 | ||
612 | realdatastart = textpos + ntohl(hdr->data_start); | 602 | realdatastart = textpos + ntohl(hdr->data_start); |
@@ -652,7 +642,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
652 | do_munmap(current->mm, textpos, text_len + data_len + extra + | 642 | do_munmap(current->mm, textpos, text_len + data_len + extra + |
653 | MAX_SHARED_LIBS * sizeof(unsigned long)); | 643 | MAX_SHARED_LIBS * sizeof(unsigned long)); |
654 | ret = result; | 644 | ret = result; |
655 | goto err_close; | 645 | goto err; |
656 | } | 646 | } |
657 | } | 647 | } |
658 | 648 | ||
@@ -717,7 +707,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
717 | addr = calc_reloc(*rp, libinfo, id, 0); | 707 | addr = calc_reloc(*rp, libinfo, id, 0); |
718 | if (addr == RELOC_FAILED) { | 708 | if (addr == RELOC_FAILED) { |
719 | ret = -ENOEXEC; | 709 | ret = -ENOEXEC; |
720 | goto err_close; | 710 | goto err; |
721 | } | 711 | } |
722 | *rp = addr; | 712 | *rp = addr; |
723 | } | 713 | } |
@@ -747,7 +737,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
747 | rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1); | 737 | rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1); |
748 | if (rp == (unsigned long *)RELOC_FAILED) { | 738 | if (rp == (unsigned long *)RELOC_FAILED) { |
749 | ret = -ENOEXEC; | 739 | ret = -ENOEXEC; |
750 | goto err_close; | 740 | goto err; |
751 | } | 741 | } |
752 | 742 | ||
753 | /* Get the pointer's value. */ | 743 | /* Get the pointer's value. */ |
@@ -762,7 +752,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
762 | addr = calc_reloc(addr, libinfo, id, 0); | 752 | addr = calc_reloc(addr, libinfo, id, 0); |
763 | if (addr == RELOC_FAILED) { | 753 | if (addr == RELOC_FAILED) { |
764 | ret = -ENOEXEC; | 754 | ret = -ENOEXEC; |
765 | goto err_close; | 755 | goto err; |
766 | } | 756 | } |
767 | 757 | ||
768 | /* Write back the relocated pointer. */ | 758 | /* Write back the relocated pointer. */ |
@@ -783,8 +773,6 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
783 | stack_len); | 773 | stack_len); |
784 | 774 | ||
785 | return 0; | 775 | return 0; |
786 | err_close: | ||
787 | sys_close(exec_fileno); | ||
788 | err: | 776 | err: |
789 | return ret; | 777 | return ret; |
790 | } | 778 | } |
@@ -1116,6 +1116,9 @@ struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, int first_sectors) | |||
1116 | bp->bio1.bi_io_vec = &bp->bv1; | 1116 | bp->bio1.bi_io_vec = &bp->bv1; |
1117 | bp->bio2.bi_io_vec = &bp->bv2; | 1117 | bp->bio2.bi_io_vec = &bp->bv2; |
1118 | 1118 | ||
1119 | bp->bio1.bi_max_vecs = 1; | ||
1120 | bp->bio2.bi_max_vecs = 1; | ||
1121 | |||
1119 | bp->bio1.bi_end_io = bio_pair_end_1; | 1122 | bp->bio1.bi_end_io = bio_pair_end_1; |
1120 | bp->bio2.bi_end_io = bio_pair_end_2; | 1123 | bp->bio2.bi_end_io = bio_pair_end_2; |
1121 | 1124 | ||
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 1a27ecb46c9a..7271bb0257f6 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,3 +1,10 @@ | |||
1 | Version 1.43 | ||
2 | ------------ | ||
3 | POSIX locking to servers which support CIFS POSIX Extensions | ||
4 | (disabled by default controlled by proc/fs/cifs/Experimental). | ||
5 | Handle conversion of long share names (especially Asian languages) | ||
6 | to Unicode during mount. | ||
7 | |||
1 | Version 1.42 | 8 | Version 1.42 |
2 | ------------ | 9 | ------------ |
3 | Fix slow oplock break when mounted to different servers at the same time and | 10 | Fix slow oplock break when mounted to different servers at the same time and |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 4e829dc672a6..c98755dca868 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -99,5 +99,5 @@ extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); | |||
99 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); | 99 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); |
100 | extern int cifs_ioctl (struct inode * inode, struct file * filep, | 100 | extern int cifs_ioctl (struct inode * inode, struct file * filep, |
101 | unsigned int command, unsigned long arg); | 101 | unsigned int command, unsigned long arg); |
102 | #define CIFS_VERSION "1.42" | 102 | #define CIFS_VERSION "1.43" |
103 | #endif /* _CIFSFS_H */ | 103 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 2879ba343ca7..310ea2f0e0bf 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -267,7 +267,7 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
267 | const int waitFlag); | 267 | const int waitFlag); |
268 | extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | 268 | extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, |
269 | const __u16 smb_file_id, const int get_flag, | 269 | const __u16 smb_file_id, const int get_flag, |
270 | const __u64 len, const __u64 offset, | 270 | const __u64 len, struct file_lock *, |
271 | const __u16 lock_type, const int waitFlag); | 271 | const __u16 lock_type, const int waitFlag); |
272 | extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); | 272 | extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); |
273 | extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); | 273 | extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index fd36892eda55..925881e00ff2 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1355,7 +1355,8 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
1355 | int | 1355 | int |
1356 | CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | 1356 | CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, |
1357 | const __u16 smb_file_id, const int get_flag, const __u64 len, | 1357 | const __u16 smb_file_id, const int get_flag, const __u64 len, |
1358 | const __u64 lkoffset, const __u16 lock_type, const int waitFlag) | 1358 | struct file_lock *pLockData, const __u16 lock_type, |
1359 | const int waitFlag) | ||
1359 | { | 1360 | { |
1360 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 1361 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
1361 | struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; | 1362 | struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; |
@@ -1366,6 +1367,10 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1366 | __u16 params, param_offset, offset, byte_count, count; | 1367 | __u16 params, param_offset, offset, byte_count, count; |
1367 | 1368 | ||
1368 | cFYI(1, ("Posix Lock")); | 1369 | cFYI(1, ("Posix Lock")); |
1370 | |||
1371 | if(pLockData == NULL) | ||
1372 | return EINVAL; | ||
1373 | |||
1369 | rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); | 1374 | rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); |
1370 | 1375 | ||
1371 | if (rc) | 1376 | if (rc) |
@@ -1404,10 +1409,10 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1404 | 1409 | ||
1405 | parm_data->lock_type = cpu_to_le16(lock_type); | 1410 | parm_data->lock_type = cpu_to_le16(lock_type); |
1406 | if(waitFlag) | 1411 | if(waitFlag) |
1407 | parm_data->lock_flags = 1; | 1412 | parm_data->lock_flags = cpu_to_le16(1); |
1408 | parm_data->pid = cpu_to_le32(current->tgid); | 1413 | parm_data->pid = cpu_to_le32(current->tgid); |
1409 | parm_data->start = lkoffset; | 1414 | parm_data->start = cpu_to_le64(pLockData->fl_start); |
1410 | parm_data->length = len; /* normalize negative numbers */ | 1415 | parm_data->length = cpu_to_le64(len); /* normalize negative numbers */ |
1411 | 1416 | ||
1412 | pSMB->DataOffset = cpu_to_le16(offset); | 1417 | pSMB->DataOffset = cpu_to_le16(offset); |
1413 | pSMB->Fid = smb_file_id; | 1418 | pSMB->Fid = smb_file_id; |
@@ -1419,8 +1424,33 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1419 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1424 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1420 | if (rc) { | 1425 | if (rc) { |
1421 | cFYI(1, ("Send error in Posix Lock = %d", rc)); | 1426 | cFYI(1, ("Send error in Posix Lock = %d", rc)); |
1422 | } | 1427 | } else if (get_flag) { |
1428 | /* lock structure can be returned on get */ | ||
1429 | __u16 data_offset; | ||
1430 | __u16 data_count; | ||
1431 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); | ||
1423 | 1432 | ||
1433 | if (rc || (pSMBr->ByteCount < sizeof(struct cifs_posix_lock))) { | ||
1434 | rc = -EIO; /* bad smb */ | ||
1435 | goto plk_err_exit; | ||
1436 | } | ||
1437 | if(pLockData == NULL) { | ||
1438 | rc = -EINVAL; | ||
1439 | goto plk_err_exit; | ||
1440 | } | ||
1441 | data_offset = le16_to_cpu(pSMBr->t2.DataOffset); | ||
1442 | data_count = le16_to_cpu(pSMBr->t2.DataCount); | ||
1443 | if(data_count < sizeof(struct cifs_posix_lock)) { | ||
1444 | rc = -EIO; | ||
1445 | goto plk_err_exit; | ||
1446 | } | ||
1447 | parm_data = (struct cifs_posix_lock *) | ||
1448 | ((char *)&pSMBr->hdr.Protocol + data_offset); | ||
1449 | if(parm_data->lock_type == cpu_to_le16(CIFS_UNLCK)) | ||
1450 | pLockData->fl_type = F_UNLCK; | ||
1451 | } | ||
1452 | |||
1453 | plk_err_exit: | ||
1424 | if (pSMB) | 1454 | if (pSMB) |
1425 | cifs_small_buf_release(pSMB); | 1455 | cifs_small_buf_release(pSMB); |
1426 | 1456 | ||
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d2ec806a4f32..bae1479318d1 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2148,6 +2148,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2148 | /* We look for obvious messed up bcc or strings in response so we do not go off | 2148 | /* We look for obvious messed up bcc or strings in response so we do not go off |
2149 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2149 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
2150 | terminating last Unicode string in response */ | 2150 | terminating last Unicode string in response */ |
2151 | if(ses->serverOS) | ||
2152 | kfree(ses->serverOS); | ||
2151 | ses->serverOS = kzalloc(2 * (len + 1), GFP_KERNEL); | 2153 | ses->serverOS = kzalloc(2 * (len + 1), GFP_KERNEL); |
2152 | if(ses->serverOS == NULL) | 2154 | if(ses->serverOS == NULL) |
2153 | goto sesssetup_nomem; | 2155 | goto sesssetup_nomem; |
@@ -2160,6 +2162,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2160 | if (remaining_words > 0) { | 2162 | if (remaining_words > 0) { |
2161 | len = UniStrnlen((wchar_t *)bcc_ptr, | 2163 | len = UniStrnlen((wchar_t *)bcc_ptr, |
2162 | remaining_words-1); | 2164 | remaining_words-1); |
2165 | if(ses->serverNOS) | ||
2166 | kfree(ses->serverNOS); | ||
2163 | ses->serverNOS = kzalloc(2 * (len + 1),GFP_KERNEL); | 2167 | ses->serverNOS = kzalloc(2 * (len + 1),GFP_KERNEL); |
2164 | if(ses->serverNOS == NULL) | 2168 | if(ses->serverNOS == NULL) |
2165 | goto sesssetup_nomem; | 2169 | goto sesssetup_nomem; |
@@ -2177,6 +2181,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2177 | if (remaining_words > 0) { | 2181 | if (remaining_words > 0) { |
2178 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2182 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
2179 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2183 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
2184 | if(ses->serverDomain) | ||
2185 | kfree(ses->serverDomain); | ||
2180 | ses->serverDomain = | 2186 | ses->serverDomain = |
2181 | kzalloc(2*(len+1),GFP_KERNEL); | 2187 | kzalloc(2*(len+1),GFP_KERNEL); |
2182 | if(ses->serverDomain == NULL) | 2188 | if(ses->serverDomain == NULL) |
@@ -2187,15 +2193,22 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2187 | ses->serverDomain[2*len] = 0; | 2193 | ses->serverDomain[2*len] = 0; |
2188 | ses->serverDomain[1+(2*len)] = 0; | 2194 | ses->serverDomain[1+(2*len)] = 0; |
2189 | } /* else no more room so create dummy domain string */ | 2195 | } /* else no more room so create dummy domain string */ |
2190 | else | 2196 | else { |
2197 | if(ses->serverDomain) | ||
2198 | kfree(ses->serverDomain); | ||
2191 | ses->serverDomain = | 2199 | ses->serverDomain = |
2192 | kzalloc(2, GFP_KERNEL); | 2200 | kzalloc(2, GFP_KERNEL); |
2201 | } | ||
2193 | } else { /* no room so create dummy domain and NOS string */ | 2202 | } else { /* no room so create dummy domain and NOS string */ |
2194 | /* if these kcallocs fail not much we | 2203 | /* if these kcallocs fail not much we |
2195 | can do, but better to not fail the | 2204 | can do, but better to not fail the |
2196 | sesssetup itself */ | 2205 | sesssetup itself */ |
2206 | if(ses->serverDomain) | ||
2207 | kfree(ses->serverDomain); | ||
2197 | ses->serverDomain = | 2208 | ses->serverDomain = |
2198 | kzalloc(2, GFP_KERNEL); | 2209 | kzalloc(2, GFP_KERNEL); |
2210 | if(ses->serverNOS) | ||
2211 | kfree(ses->serverNOS); | ||
2199 | ses->serverNOS = | 2212 | ses->serverNOS = |
2200 | kzalloc(2, GFP_KERNEL); | 2213 | kzalloc(2, GFP_KERNEL); |
2201 | } | 2214 | } |
@@ -2204,6 +2217,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2204 | if (((long) bcc_ptr + len) - (long) | 2217 | if (((long) bcc_ptr + len) - (long) |
2205 | pByteArea(smb_buffer_response) | 2218 | pByteArea(smb_buffer_response) |
2206 | <= BCC(smb_buffer_response)) { | 2219 | <= BCC(smb_buffer_response)) { |
2220 | if(ses->serverOS) | ||
2221 | kfree(ses->serverOS); | ||
2207 | ses->serverOS = kzalloc(len + 1,GFP_KERNEL); | 2222 | ses->serverOS = kzalloc(len + 1,GFP_KERNEL); |
2208 | if(ses->serverOS == NULL) | 2223 | if(ses->serverOS == NULL) |
2209 | goto sesssetup_nomem; | 2224 | goto sesssetup_nomem; |
@@ -2214,6 +2229,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2214 | bcc_ptr++; | 2229 | bcc_ptr++; |
2215 | 2230 | ||
2216 | len = strnlen(bcc_ptr, 1024); | 2231 | len = strnlen(bcc_ptr, 1024); |
2232 | if(ses->serverNOS) | ||
2233 | kfree(ses->serverNOS); | ||
2217 | ses->serverNOS = kzalloc(len + 1,GFP_KERNEL); | 2234 | ses->serverNOS = kzalloc(len + 1,GFP_KERNEL); |
2218 | if(ses->serverNOS == NULL) | 2235 | if(ses->serverNOS == NULL) |
2219 | goto sesssetup_nomem; | 2236 | goto sesssetup_nomem; |
@@ -2223,6 +2240,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2223 | bcc_ptr++; | 2240 | bcc_ptr++; |
2224 | 2241 | ||
2225 | len = strnlen(bcc_ptr, 1024); | 2242 | len = strnlen(bcc_ptr, 1024); |
2243 | if(ses->serverDomain) | ||
2244 | kfree(ses->serverDomain); | ||
2226 | ses->serverDomain = kzalloc(len + 1,GFP_KERNEL); | 2245 | ses->serverDomain = kzalloc(len + 1,GFP_KERNEL); |
2227 | if(ses->serverDomain == NULL) | 2246 | if(ses->serverDomain == NULL) |
2228 | goto sesssetup_nomem; | 2247 | goto sesssetup_nomem; |
@@ -2427,6 +2446,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2427 | /* We look for obvious messed up bcc or strings in response so we do not go off | 2446 | /* We look for obvious messed up bcc or strings in response so we do not go off |
2428 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2447 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
2429 | terminating last Unicode string in response */ | 2448 | terminating last Unicode string in response */ |
2449 | if(ses->serverOS) | ||
2450 | kfree(ses->serverOS); | ||
2430 | ses->serverOS = | 2451 | ses->serverOS = |
2431 | kzalloc(2 * (len + 1), GFP_KERNEL); | 2452 | kzalloc(2 * (len + 1), GFP_KERNEL); |
2432 | cifs_strfromUCS_le(ses->serverOS, | 2453 | cifs_strfromUCS_le(ses->serverOS, |
@@ -2441,6 +2462,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2441 | len = UniStrnlen((wchar_t *)bcc_ptr, | 2462 | len = UniStrnlen((wchar_t *)bcc_ptr, |
2442 | remaining_words | 2463 | remaining_words |
2443 | - 1); | 2464 | - 1); |
2465 | if(ses->serverNOS) | ||
2466 | kfree(ses->serverNOS); | ||
2444 | ses->serverNOS = | 2467 | ses->serverNOS = |
2445 | kzalloc(2 * (len + 1), | 2468 | kzalloc(2 * (len + 1), |
2446 | GFP_KERNEL); | 2469 | GFP_KERNEL); |
@@ -2454,7 +2477,9 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2454 | remaining_words -= len + 1; | 2477 | remaining_words -= len + 1; |
2455 | if (remaining_words > 0) { | 2478 | if (remaining_words > 0) { |
2456 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2479 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
2457 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2480 | /* last string not null terminated (e.g.Windows XP/2000) */ |
2481 | if(ses->serverDomain) | ||
2482 | kfree(ses->serverDomain); | ||
2458 | ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL); | 2483 | ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL); |
2459 | cifs_strfromUCS_le(ses->serverDomain, | 2484 | cifs_strfromUCS_le(ses->serverDomain, |
2460 | (__le16 *)bcc_ptr, | 2485 | (__le16 *)bcc_ptr, |
@@ -2463,11 +2488,18 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2463 | ses->serverDomain[2*len] = 0; | 2488 | ses->serverDomain[2*len] = 0; |
2464 | ses->serverDomain[1+(2*len)] = 0; | 2489 | ses->serverDomain[1+(2*len)] = 0; |
2465 | } /* else no more room so create dummy domain string */ | 2490 | } /* else no more room so create dummy domain string */ |
2466 | else | 2491 | else { |
2492 | if(ses->serverDomain) | ||
2493 | kfree(ses->serverDomain); | ||
2467 | ses->serverDomain = | 2494 | ses->serverDomain = |
2468 | kzalloc(2,GFP_KERNEL); | 2495 | kzalloc(2,GFP_KERNEL); |
2469 | } else { /* no room so create dummy domain and NOS string */ | 2496 | } |
2497 | } else {/* no room use dummy domain&NOS */ | ||
2498 | if(ses->serverDomain) | ||
2499 | kfree(ses->serverDomain); | ||
2470 | ses->serverDomain = kzalloc(2, GFP_KERNEL); | 2500 | ses->serverDomain = kzalloc(2, GFP_KERNEL); |
2501 | if(ses->serverNOS) | ||
2502 | kfree(ses->serverNOS); | ||
2471 | ses->serverNOS = kzalloc(2, GFP_KERNEL); | 2503 | ses->serverNOS = kzalloc(2, GFP_KERNEL); |
2472 | } | 2504 | } |
2473 | } else { /* ASCII */ | 2505 | } else { /* ASCII */ |
@@ -2476,6 +2508,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2476 | if (((long) bcc_ptr + len) - (long) | 2508 | if (((long) bcc_ptr + len) - (long) |
2477 | pByteArea(smb_buffer_response) | 2509 | pByteArea(smb_buffer_response) |
2478 | <= BCC(smb_buffer_response)) { | 2510 | <= BCC(smb_buffer_response)) { |
2511 | if(ses->serverOS) | ||
2512 | kfree(ses->serverOS); | ||
2479 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); | 2513 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); |
2480 | strncpy(ses->serverOS, bcc_ptr, len); | 2514 | strncpy(ses->serverOS, bcc_ptr, len); |
2481 | 2515 | ||
@@ -2484,6 +2518,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2484 | bcc_ptr++; | 2518 | bcc_ptr++; |
2485 | 2519 | ||
2486 | len = strnlen(bcc_ptr, 1024); | 2520 | len = strnlen(bcc_ptr, 1024); |
2521 | if(ses->serverNOS) | ||
2522 | kfree(ses->serverNOS); | ||
2487 | ses->serverNOS = kzalloc(len + 1,GFP_KERNEL); | 2523 | ses->serverNOS = kzalloc(len + 1,GFP_KERNEL); |
2488 | strncpy(ses->serverNOS, bcc_ptr, len); | 2524 | strncpy(ses->serverNOS, bcc_ptr, len); |
2489 | bcc_ptr += len; | 2525 | bcc_ptr += len; |
@@ -2491,6 +2527,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2491 | bcc_ptr++; | 2527 | bcc_ptr++; |
2492 | 2528 | ||
2493 | len = strnlen(bcc_ptr, 1024); | 2529 | len = strnlen(bcc_ptr, 1024); |
2530 | if(ses->serverDomain) | ||
2531 | kfree(ses->serverDomain); | ||
2494 | ses->serverDomain = kzalloc(len + 1, GFP_KERNEL); | 2532 | ses->serverDomain = kzalloc(len + 1, GFP_KERNEL); |
2495 | strncpy(ses->serverDomain, bcc_ptr, len); | 2533 | strncpy(ses->serverDomain, bcc_ptr, len); |
2496 | bcc_ptr += len; | 2534 | bcc_ptr += len; |
@@ -2728,6 +2766,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2728 | /* We look for obvious messed up bcc or strings in response so we do not go off | 2766 | /* We look for obvious messed up bcc or strings in response so we do not go off |
2729 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2767 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
2730 | terminating last Unicode string in response */ | 2768 | terminating last Unicode string in response */ |
2769 | if(ses->serverOS) | ||
2770 | kfree(ses->serverOS); | ||
2731 | ses->serverOS = | 2771 | ses->serverOS = |
2732 | kzalloc(2 * (len + 1), GFP_KERNEL); | 2772 | kzalloc(2 * (len + 1), GFP_KERNEL); |
2733 | cifs_strfromUCS_le(ses->serverOS, | 2773 | cifs_strfromUCS_le(ses->serverOS, |
@@ -2743,6 +2783,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2743 | bcc_ptr, | 2783 | bcc_ptr, |
2744 | remaining_words | 2784 | remaining_words |
2745 | - 1); | 2785 | - 1); |
2786 | if(ses->serverNOS) | ||
2787 | kfree(ses->serverNOS); | ||
2746 | ses->serverNOS = | 2788 | ses->serverNOS = |
2747 | kzalloc(2 * (len + 1), | 2789 | kzalloc(2 * (len + 1), |
2748 | GFP_KERNEL); | 2790 | GFP_KERNEL); |
@@ -2760,6 +2802,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2760 | if (remaining_words > 0) { | 2802 | if (remaining_words > 0) { |
2761 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2803 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
2762 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2804 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
2805 | if(ses->serverDomain) | ||
2806 | kfree(ses->serverDomain); | ||
2763 | ses->serverDomain = | 2807 | ses->serverDomain = |
2764 | kzalloc(2 * | 2808 | kzalloc(2 * |
2765 | (len + | 2809 | (len + |
@@ -2777,13 +2821,20 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2777 | [1 + (2 * len)] | 2821 | [1 + (2 * len)] |
2778 | = 0; | 2822 | = 0; |
2779 | } /* else no more room so create dummy domain string */ | 2823 | } /* else no more room so create dummy domain string */ |
2780 | else | 2824 | else { |
2825 | if(ses->serverDomain) | ||
2826 | kfree(ses->serverDomain); | ||
2781 | ses->serverDomain = | 2827 | ses->serverDomain = |
2782 | kzalloc(2, | 2828 | kzalloc(2, |
2783 | GFP_KERNEL); | 2829 | GFP_KERNEL); |
2830 | } | ||
2784 | } else { /* no room so create dummy domain and NOS string */ | 2831 | } else { /* no room so create dummy domain and NOS string */ |
2832 | if(ses->serverDomain); | ||
2833 | kfree(ses->serverDomain); | ||
2785 | ses->serverDomain = | 2834 | ses->serverDomain = |
2786 | kzalloc(2, GFP_KERNEL); | 2835 | kzalloc(2, GFP_KERNEL); |
2836 | if(ses->serverNOS) | ||
2837 | kfree(ses->serverNOS); | ||
2787 | ses->serverNOS = | 2838 | ses->serverNOS = |
2788 | kzalloc(2, GFP_KERNEL); | 2839 | kzalloc(2, GFP_KERNEL); |
2789 | } | 2840 | } |
@@ -2792,6 +2843,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2792 | if (((long) bcc_ptr + len) - (long) | 2843 | if (((long) bcc_ptr + len) - (long) |
2793 | pByteArea(smb_buffer_response) | 2844 | pByteArea(smb_buffer_response) |
2794 | <= BCC(smb_buffer_response)) { | 2845 | <= BCC(smb_buffer_response)) { |
2846 | if(ses->serverOS) | ||
2847 | kfree(ses->serverOS); | ||
2795 | ses->serverOS = | 2848 | ses->serverOS = |
2796 | kzalloc(len + 1, | 2849 | kzalloc(len + 1, |
2797 | GFP_KERNEL); | 2850 | GFP_KERNEL); |
@@ -2803,6 +2856,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2803 | bcc_ptr++; | 2856 | bcc_ptr++; |
2804 | 2857 | ||
2805 | len = strnlen(bcc_ptr, 1024); | 2858 | len = strnlen(bcc_ptr, 1024); |
2859 | if(ses->serverNOS) | ||
2860 | kfree(ses->serverNOS); | ||
2806 | ses->serverNOS = | 2861 | ses->serverNOS = |
2807 | kzalloc(len + 1, | 2862 | kzalloc(len + 1, |
2808 | GFP_KERNEL); | 2863 | GFP_KERNEL); |
@@ -2812,6 +2867,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2812 | bcc_ptr++; | 2867 | bcc_ptr++; |
2813 | 2868 | ||
2814 | len = strnlen(bcc_ptr, 1024); | 2869 | len = strnlen(bcc_ptr, 1024); |
2870 | if(ses->serverDomain) | ||
2871 | kfree(ses->serverDomain); | ||
2815 | ses->serverDomain = | 2872 | ses->serverDomain = |
2816 | kzalloc(len + 1, | 2873 | kzalloc(len + 1, |
2817 | GFP_KERNEL); | 2874 | GFP_KERNEL); |
@@ -3116,6 +3173,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3116 | /* We look for obvious messed up bcc or strings in response so we do not go off | 3173 | /* We look for obvious messed up bcc or strings in response so we do not go off |
3117 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 3174 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
3118 | terminating last Unicode string in response */ | 3175 | terminating last Unicode string in response */ |
3176 | if(ses->serverOS) | ||
3177 | kfree(ses->serverOS); | ||
3119 | ses->serverOS = | 3178 | ses->serverOS = |
3120 | kzalloc(2 * (len + 1), GFP_KERNEL); | 3179 | kzalloc(2 * (len + 1), GFP_KERNEL); |
3121 | cifs_strfromUCS_le(ses->serverOS, | 3180 | cifs_strfromUCS_le(ses->serverOS, |
@@ -3131,6 +3190,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3131 | bcc_ptr, | 3190 | bcc_ptr, |
3132 | remaining_words | 3191 | remaining_words |
3133 | - 1); | 3192 | - 1); |
3193 | if(ses->serverNOS) | ||
3194 | kfree(ses->serverNOS); | ||
3134 | ses->serverNOS = | 3195 | ses->serverNOS = |
3135 | kzalloc(2 * (len + 1), | 3196 | kzalloc(2 * (len + 1), |
3136 | GFP_KERNEL); | 3197 | GFP_KERNEL); |
@@ -3147,6 +3208,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3147 | if (remaining_words > 0) { | 3208 | if (remaining_words > 0) { |
3148 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 3209 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
3149 | /* last string not always null terminated (e.g. for Windows XP & 2000) */ | 3210 | /* last string not always null terminated (e.g. for Windows XP & 2000) */ |
3211 | if(ses->serverDomain) | ||
3212 | kfree(ses->serverDomain); | ||
3150 | ses->serverDomain = | 3213 | ses->serverDomain = |
3151 | kzalloc(2 * | 3214 | kzalloc(2 * |
3152 | (len + | 3215 | (len + |
@@ -3172,10 +3235,17 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3172 | len)] | 3235 | len)] |
3173 | = 0; | 3236 | = 0; |
3174 | } /* else no more room so create dummy domain string */ | 3237 | } /* else no more room so create dummy domain string */ |
3175 | else | 3238 | else { |
3239 | if(ses->serverDomain) | ||
3240 | kfree(ses->serverDomain); | ||
3176 | ses->serverDomain = kzalloc(2,GFP_KERNEL); | 3241 | ses->serverDomain = kzalloc(2,GFP_KERNEL); |
3242 | } | ||
3177 | } else { /* no room so create dummy domain and NOS string */ | 3243 | } else { /* no room so create dummy domain and NOS string */ |
3244 | if(ses->serverDomain) | ||
3245 | kfree(ses->serverDomain); | ||
3178 | ses->serverDomain = kzalloc(2, GFP_KERNEL); | 3246 | ses->serverDomain = kzalloc(2, GFP_KERNEL); |
3247 | if(ses->serverNOS) | ||
3248 | kfree(ses->serverNOS); | ||
3179 | ses->serverNOS = kzalloc(2, GFP_KERNEL); | 3249 | ses->serverNOS = kzalloc(2, GFP_KERNEL); |
3180 | } | 3250 | } |
3181 | } else { /* ASCII */ | 3251 | } else { /* ASCII */ |
@@ -3183,6 +3253,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3183 | if (((long) bcc_ptr + len) - | 3253 | if (((long) bcc_ptr + len) - |
3184 | (long) pByteArea(smb_buffer_response) | 3254 | (long) pByteArea(smb_buffer_response) |
3185 | <= BCC(smb_buffer_response)) { | 3255 | <= BCC(smb_buffer_response)) { |
3256 | if(ses->serverOS) | ||
3257 | kfree(ses->serverOS); | ||
3186 | ses->serverOS = kzalloc(len + 1,GFP_KERNEL); | 3258 | ses->serverOS = kzalloc(len + 1,GFP_KERNEL); |
3187 | strncpy(ses->serverOS,bcc_ptr, len); | 3259 | strncpy(ses->serverOS,bcc_ptr, len); |
3188 | 3260 | ||
@@ -3191,6 +3263,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3191 | bcc_ptr++; | 3263 | bcc_ptr++; |
3192 | 3264 | ||
3193 | len = strnlen(bcc_ptr, 1024); | 3265 | len = strnlen(bcc_ptr, 1024); |
3266 | if(ses->serverNOS) | ||
3267 | kfree(ses->serverNOS); | ||
3194 | ses->serverNOS = kzalloc(len+1,GFP_KERNEL); | 3268 | ses->serverNOS = kzalloc(len+1,GFP_KERNEL); |
3195 | strncpy(ses->serverNOS, bcc_ptr, len); | 3269 | strncpy(ses->serverNOS, bcc_ptr, len); |
3196 | bcc_ptr += len; | 3270 | bcc_ptr += len; |
@@ -3198,6 +3272,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3198 | bcc_ptr++; | 3272 | bcc_ptr++; |
3199 | 3273 | ||
3200 | len = strnlen(bcc_ptr, 1024); | 3274 | len = strnlen(bcc_ptr, 1024); |
3275 | if(ses->serverDomain) | ||
3276 | kfree(ses->serverDomain); | ||
3201 | ses->serverDomain = kzalloc(len+1,GFP_KERNEL); | 3277 | ses->serverDomain = kzalloc(len+1,GFP_KERNEL); |
3202 | strncpy(ses->serverDomain, bcc_ptr, len); | 3278 | strncpy(ses->serverDomain, bcc_ptr, len); |
3203 | bcc_ptr += len; | 3279 | bcc_ptr += len; |
@@ -3282,7 +3358,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3282 | bcc_ptr++; /* align */ | 3358 | bcc_ptr++; /* align */ |
3283 | } | 3359 | } |
3284 | 3360 | ||
3285 | if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | 3361 | if(ses->server->secMode & |
3362 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | ||
3286 | smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; | 3363 | smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; |
3287 | 3364 | ||
3288 | if (ses->capabilities & CAP_STATUS32) { | 3365 | if (ses->capabilities & CAP_STATUS32) { |
@@ -3294,8 +3371,10 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3294 | if (ses->capabilities & CAP_UNICODE) { | 3371 | if (ses->capabilities & CAP_UNICODE) { |
3295 | smb_buffer->Flags2 |= SMBFLG2_UNICODE; | 3372 | smb_buffer->Flags2 |= SMBFLG2_UNICODE; |
3296 | length = | 3373 | length = |
3297 | cifs_strtoUCS((__le16 *) bcc_ptr, tree, 100, nls_codepage); | 3374 | cifs_strtoUCS((__le16 *) bcc_ptr, tree, |
3298 | bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */ | 3375 | 6 /* max utf8 char length in bytes */ * |
3376 | (/* server len*/ + 256 /* share len */), nls_codepage); | ||
3377 | bcc_ptr += 2 * length; /* convert num 16 bit words to bytes */ | ||
3299 | bcc_ptr += 2; /* skip trailing null */ | 3378 | bcc_ptr += 2; /* skip trailing null */ |
3300 | } else { /* ASCII */ | 3379 | } else { /* ASCII */ |
3301 | strcpy(bcc_ptr, tree); | 3380 | strcpy(bcc_ptr, tree); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e152bf6afa60..e2b4ce1dad66 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -84,6 +84,8 @@ static inline int cifs_get_disposition(unsigned int flags) | |||
84 | return FILE_OVERWRITE_IF; | 84 | return FILE_OVERWRITE_IF; |
85 | else if ((flags & O_CREAT) == O_CREAT) | 85 | else if ((flags & O_CREAT) == O_CREAT) |
86 | return FILE_OPEN_IF; | 86 | return FILE_OPEN_IF; |
87 | else if ((flags & O_TRUNC) == O_TRUNC) | ||
88 | return FILE_OVERWRITE; | ||
87 | else | 89 | else |
88 | return FILE_OPEN; | 90 | return FILE_OPEN; |
89 | } | 91 | } |
@@ -656,7 +658,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
656 | else | 658 | else |
657 | posix_lock_type = CIFS_WRLCK; | 659 | posix_lock_type = CIFS_WRLCK; |
658 | rc = CIFSSMBPosixLock(xid, pTcon, netfid, 1 /* get */, | 660 | rc = CIFSSMBPosixLock(xid, pTcon, netfid, 1 /* get */, |
659 | length, pfLock->fl_start, | 661 | length, pfLock, |
660 | posix_lock_type, wait_flag); | 662 | posix_lock_type, wait_flag); |
661 | FreeXid(xid); | 663 | FreeXid(xid); |
662 | return rc; | 664 | return rc; |
@@ -704,7 +706,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
704 | return -EOPNOTSUPP; | 706 | return -EOPNOTSUPP; |
705 | } | 707 | } |
706 | rc = CIFSSMBPosixLock(xid, pTcon, netfid, 0 /* set */, | 708 | rc = CIFSSMBPosixLock(xid, pTcon, netfid, 0 /* set */, |
707 | length, pfLock->fl_start, | 709 | length, pfLock, |
708 | posix_lock_type, wait_flag); | 710 | posix_lock_type, wait_flag); |
709 | } else | 711 | } else |
710 | rc = CIFSSMBLock(xid, pTcon, netfid, length, pfLock->fl_start, | 712 | rc = CIFSSMBLock(xid, pTcon, netfid, length, pfLock->fl_start, |
@@ -904,8 +906,10 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
904 | if (rc != 0) | 906 | if (rc != 0) |
905 | break; | 907 | break; |
906 | } | 908 | } |
907 | if(experimEnabled || (pTcon->ses->server->secMode & | 909 | if(experimEnabled || (pTcon->ses->server && |
908 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0) { | 910 | ((pTcon->ses->server->secMode & |
911 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | ||
912 | == 0))) { | ||
909 | struct kvec iov[2]; | 913 | struct kvec iov[2]; |
910 | unsigned int len; | 914 | unsigned int len; |
911 | 915 | ||
diff --git a/fs/compat.c b/fs/compat.c index 970888aad843..b1f64786a613 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1913,7 +1913,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, | |||
1913 | } | 1913 | } |
1914 | 1914 | ||
1915 | if (sigmask) { | 1915 | if (sigmask) { |
1916 | if (sigsetsize |= sizeof(compat_sigset_t)) | 1916 | if (sigsetsize != sizeof(compat_sigset_t)) |
1917 | return -EINVAL; | 1917 | return -EINVAL; |
1918 | if (copy_from_user(&ss32, sigmask, sizeof(ss32))) | 1918 | if (copy_from_user(&ss32, sigmask, sizeof(ss32))) |
1919 | return -EFAULT; | 1919 | return -EFAULT; |
@@ -2030,109 +2030,115 @@ union compat_nfsctl_res { | |||
2030 | struct knfsd_fh cr32_getfs; | 2030 | struct knfsd_fh cr32_getfs; |
2031 | }; | 2031 | }; |
2032 | 2032 | ||
2033 | static int compat_nfs_svc_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg) | 2033 | static int compat_nfs_svc_trans(struct nfsctl_arg *karg, |
2034 | struct compat_nfsctl_arg __user *arg) | ||
2034 | { | 2035 | { |
2035 | int err; | 2036 | if (!access_ok(VERIFY_READ, &arg->ca32_svc, sizeof(arg->ca32_svc)) || |
2036 | 2037 | get_user(karg->ca_version, &arg->ca32_version) || | |
2037 | err = access_ok(VERIFY_READ, &arg->ca32_svc, sizeof(arg->ca32_svc)); | 2038 | __get_user(karg->ca_svc.svc_port, &arg->ca32_svc.svc32_port) || |
2038 | err |= get_user(karg->ca_version, &arg->ca32_version); | 2039 | __get_user(karg->ca_svc.svc_nthreads, |
2039 | err |= __get_user(karg->ca_svc.svc_port, &arg->ca32_svc.svc32_port); | 2040 | &arg->ca32_svc.svc32_nthreads)) |
2040 | err |= __get_user(karg->ca_svc.svc_nthreads, &arg->ca32_svc.svc32_nthreads); | 2041 | return -EFAULT; |
2041 | return (err) ? -EFAULT : 0; | 2042 | return 0; |
2042 | } | 2043 | } |
2043 | 2044 | ||
2044 | static int compat_nfs_clnt_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg) | 2045 | static int compat_nfs_clnt_trans(struct nfsctl_arg *karg, |
2045 | { | 2046 | struct compat_nfsctl_arg __user *arg) |
2046 | int err; | 2047 | { |
2047 | 2048 | if (!access_ok(VERIFY_READ, &arg->ca32_client, | |
2048 | err = access_ok(VERIFY_READ, &arg->ca32_client, sizeof(arg->ca32_client)); | 2049 | sizeof(arg->ca32_client)) || |
2049 | err |= get_user(karg->ca_version, &arg->ca32_version); | 2050 | get_user(karg->ca_version, &arg->ca32_version) || |
2050 | err |= __copy_from_user(&karg->ca_client.cl_ident[0], | 2051 | __copy_from_user(&karg->ca_client.cl_ident[0], |
2051 | &arg->ca32_client.cl32_ident[0], | 2052 | &arg->ca32_client.cl32_ident[0], |
2052 | NFSCLNT_IDMAX); | 2053 | NFSCLNT_IDMAX) || |
2053 | err |= __get_user(karg->ca_client.cl_naddr, &arg->ca32_client.cl32_naddr); | 2054 | __get_user(karg->ca_client.cl_naddr, |
2054 | err |= __copy_from_user(&karg->ca_client.cl_addrlist[0], | 2055 | &arg->ca32_client.cl32_naddr) || |
2055 | &arg->ca32_client.cl32_addrlist[0], | 2056 | __copy_from_user(&karg->ca_client.cl_addrlist[0], |
2056 | (sizeof(struct in_addr) * NFSCLNT_ADDRMAX)); | 2057 | &arg->ca32_client.cl32_addrlist[0], |
2057 | err |= __get_user(karg->ca_client.cl_fhkeytype, | 2058 | (sizeof(struct in_addr) * NFSCLNT_ADDRMAX)) || |
2058 | &arg->ca32_client.cl32_fhkeytype); | 2059 | __get_user(karg->ca_client.cl_fhkeytype, |
2059 | err |= __get_user(karg->ca_client.cl_fhkeylen, | 2060 | &arg->ca32_client.cl32_fhkeytype) || |
2060 | &arg->ca32_client.cl32_fhkeylen); | 2061 | __get_user(karg->ca_client.cl_fhkeylen, |
2061 | err |= __copy_from_user(&karg->ca_client.cl_fhkey[0], | 2062 | &arg->ca32_client.cl32_fhkeylen) || |
2062 | &arg->ca32_client.cl32_fhkey[0], | 2063 | __copy_from_user(&karg->ca_client.cl_fhkey[0], |
2063 | NFSCLNT_KEYMAX); | 2064 | &arg->ca32_client.cl32_fhkey[0], |
2065 | NFSCLNT_KEYMAX)) | ||
2066 | return -EFAULT; | ||
2064 | 2067 | ||
2065 | return (err) ? -EFAULT : 0; | 2068 | return 0; |
2066 | } | 2069 | } |
2067 | 2070 | ||
2068 | static int compat_nfs_exp_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg) | 2071 | static int compat_nfs_exp_trans(struct nfsctl_arg *karg, |
2069 | { | 2072 | struct compat_nfsctl_arg __user *arg) |
2070 | int err; | 2073 | { |
2071 | 2074 | if (!access_ok(VERIFY_READ, &arg->ca32_export, | |
2072 | err = access_ok(VERIFY_READ, &arg->ca32_export, sizeof(arg->ca32_export)); | 2075 | sizeof(arg->ca32_export)) || |
2073 | err |= get_user(karg->ca_version, &arg->ca32_version); | 2076 | get_user(karg->ca_version, &arg->ca32_version) || |
2074 | err |= __copy_from_user(&karg->ca_export.ex_client[0], | 2077 | __copy_from_user(&karg->ca_export.ex_client[0], |
2075 | &arg->ca32_export.ex32_client[0], | 2078 | &arg->ca32_export.ex32_client[0], |
2076 | NFSCLNT_IDMAX); | 2079 | NFSCLNT_IDMAX) || |
2077 | err |= __copy_from_user(&karg->ca_export.ex_path[0], | 2080 | __copy_from_user(&karg->ca_export.ex_path[0], |
2078 | &arg->ca32_export.ex32_path[0], | 2081 | &arg->ca32_export.ex32_path[0], |
2079 | NFS_MAXPATHLEN); | 2082 | NFS_MAXPATHLEN) || |
2080 | err |= __get_user(karg->ca_export.ex_dev, | 2083 | __get_user(karg->ca_export.ex_dev, |
2081 | &arg->ca32_export.ex32_dev); | 2084 | &arg->ca32_export.ex32_dev) || |
2082 | err |= __get_user(karg->ca_export.ex_ino, | 2085 | __get_user(karg->ca_export.ex_ino, |
2083 | &arg->ca32_export.ex32_ino); | 2086 | &arg->ca32_export.ex32_ino) || |
2084 | err |= __get_user(karg->ca_export.ex_flags, | 2087 | __get_user(karg->ca_export.ex_flags, |
2085 | &arg->ca32_export.ex32_flags); | 2088 | &arg->ca32_export.ex32_flags) || |
2086 | err |= __get_user(karg->ca_export.ex_anon_uid, | 2089 | __get_user(karg->ca_export.ex_anon_uid, |
2087 | &arg->ca32_export.ex32_anon_uid); | 2090 | &arg->ca32_export.ex32_anon_uid) || |
2088 | err |= __get_user(karg->ca_export.ex_anon_gid, | 2091 | __get_user(karg->ca_export.ex_anon_gid, |
2089 | &arg->ca32_export.ex32_anon_gid); | 2092 | &arg->ca32_export.ex32_anon_gid)) |
2093 | return -EFAULT; | ||
2090 | SET_UID(karg->ca_export.ex_anon_uid, karg->ca_export.ex_anon_uid); | 2094 | SET_UID(karg->ca_export.ex_anon_uid, karg->ca_export.ex_anon_uid); |
2091 | SET_GID(karg->ca_export.ex_anon_gid, karg->ca_export.ex_anon_gid); | 2095 | SET_GID(karg->ca_export.ex_anon_gid, karg->ca_export.ex_anon_gid); |
2092 | 2096 | ||
2093 | return (err) ? -EFAULT : 0; | 2097 | return 0; |
2094 | } | 2098 | } |
2095 | 2099 | ||
2096 | static int compat_nfs_getfd_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg) | 2100 | static int compat_nfs_getfd_trans(struct nfsctl_arg *karg, |
2097 | { | 2101 | struct compat_nfsctl_arg __user *arg) |
2098 | int err; | 2102 | { |
2099 | 2103 | if (!access_ok(VERIFY_READ, &arg->ca32_getfd, | |
2100 | err = access_ok(VERIFY_READ, &arg->ca32_getfd, sizeof(arg->ca32_getfd)); | 2104 | sizeof(arg->ca32_getfd)) || |
2101 | err |= get_user(karg->ca_version, &arg->ca32_version); | 2105 | get_user(karg->ca_version, &arg->ca32_version) || |
2102 | err |= __copy_from_user(&karg->ca_getfd.gd_addr, | 2106 | __copy_from_user(&karg->ca_getfd.gd_addr, |
2103 | &arg->ca32_getfd.gd32_addr, | 2107 | &arg->ca32_getfd.gd32_addr, |
2104 | (sizeof(struct sockaddr))); | 2108 | (sizeof(struct sockaddr))) || |
2105 | err |= __copy_from_user(&karg->ca_getfd.gd_path, | 2109 | __copy_from_user(&karg->ca_getfd.gd_path, |
2106 | &arg->ca32_getfd.gd32_path, | 2110 | &arg->ca32_getfd.gd32_path, |
2107 | (NFS_MAXPATHLEN+1)); | 2111 | (NFS_MAXPATHLEN+1)) || |
2108 | err |= __get_user(karg->ca_getfd.gd_version, | 2112 | __get_user(karg->ca_getfd.gd_version, |
2109 | &arg->ca32_getfd.gd32_version); | 2113 | &arg->ca32_getfd.gd32_version)) |
2114 | return -EFAULT; | ||
2110 | 2115 | ||
2111 | return (err) ? -EFAULT : 0; | 2116 | return 0; |
2112 | } | 2117 | } |
2113 | 2118 | ||
2114 | static int compat_nfs_getfs_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg) | 2119 | static int compat_nfs_getfs_trans(struct nfsctl_arg *karg, |
2120 | struct compat_nfsctl_arg __user *arg) | ||
2115 | { | 2121 | { |
2116 | int err; | 2122 | if (!access_ok(VERIFY_READ,&arg->ca32_getfs,sizeof(arg->ca32_getfs)) || |
2117 | 2123 | get_user(karg->ca_version, &arg->ca32_version) || | |
2118 | err = access_ok(VERIFY_READ, &arg->ca32_getfs, sizeof(arg->ca32_getfs)); | 2124 | __copy_from_user(&karg->ca_getfs.gd_addr, |
2119 | err |= get_user(karg->ca_version, &arg->ca32_version); | 2125 | &arg->ca32_getfs.gd32_addr, |
2120 | err |= __copy_from_user(&karg->ca_getfs.gd_addr, | 2126 | (sizeof(struct sockaddr))) || |
2121 | &arg->ca32_getfs.gd32_addr, | 2127 | __copy_from_user(&karg->ca_getfs.gd_path, |
2122 | (sizeof(struct sockaddr))); | 2128 | &arg->ca32_getfs.gd32_path, |
2123 | err |= __copy_from_user(&karg->ca_getfs.gd_path, | 2129 | (NFS_MAXPATHLEN+1)) || |
2124 | &arg->ca32_getfs.gd32_path, | 2130 | __get_user(karg->ca_getfs.gd_maxlen, |
2125 | (NFS_MAXPATHLEN+1)); | 2131 | &arg->ca32_getfs.gd32_maxlen)) |
2126 | err |= __get_user(karg->ca_getfs.gd_maxlen, | 2132 | return -EFAULT; |
2127 | &arg->ca32_getfs.gd32_maxlen); | ||
2128 | 2133 | ||
2129 | return (err) ? -EFAULT : 0; | 2134 | return 0; |
2130 | } | 2135 | } |
2131 | 2136 | ||
2132 | /* This really doesn't need translations, we are only passing | 2137 | /* This really doesn't need translations, we are only passing |
2133 | * back a union which contains opaque nfs file handle data. | 2138 | * back a union which contains opaque nfs file handle data. |
2134 | */ | 2139 | */ |
2135 | static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, union compat_nfsctl_res __user *res) | 2140 | static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, |
2141 | union compat_nfsctl_res __user *res) | ||
2136 | { | 2142 | { |
2137 | int err; | 2143 | int err; |
2138 | 2144 | ||
@@ -2141,8 +2147,9 @@ static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, union compat_nfsct | |||
2141 | return (err) ? -EFAULT : 0; | 2147 | return (err) ? -EFAULT : 0; |
2142 | } | 2148 | } |
2143 | 2149 | ||
2144 | asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg __user *arg, | 2150 | asmlinkage long compat_sys_nfsservctl(int cmd, |
2145 | union compat_nfsctl_res __user *res) | 2151 | struct compat_nfsctl_arg __user *arg, |
2152 | union compat_nfsctl_res __user *res) | ||
2146 | { | 2153 | { |
2147 | struct nfsctl_arg *karg; | 2154 | struct nfsctl_arg *karg; |
2148 | union nfsctl_res *kres; | 2155 | union nfsctl_res *kres; |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 5638c8f9362f..5f952187fc53 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -505,13 +505,15 @@ static int populate_groups(struct config_group *group) | |||
505 | int i; | 505 | int i; |
506 | 506 | ||
507 | if (group->default_groups) { | 507 | if (group->default_groups) { |
508 | /* FYI, we're faking mkdir here | 508 | /* |
509 | * FYI, we're faking mkdir here | ||
509 | * I'm not sure we need this semaphore, as we're called | 510 | * I'm not sure we need this semaphore, as we're called |
510 | * from our parent's mkdir. That holds our parent's | 511 | * from our parent's mkdir. That holds our parent's |
511 | * i_mutex, so afaik lookup cannot continue through our | 512 | * i_mutex, so afaik lookup cannot continue through our |
512 | * parent to find us, let alone mess with our tree. | 513 | * parent to find us, let alone mess with our tree. |
513 | * That said, taking our i_mutex is closer to mkdir | 514 | * That said, taking our i_mutex is closer to mkdir |
514 | * emulation, and shouldn't hurt. */ | 515 | * emulation, and shouldn't hurt. |
516 | */ | ||
515 | mutex_lock(&dentry->d_inode->i_mutex); | 517 | mutex_lock(&dentry->d_inode->i_mutex); |
516 | 518 | ||
517 | for (i = 0; group->default_groups[i]; i++) { | 519 | for (i = 0; group->default_groups[i]; i++) { |
@@ -546,20 +548,34 @@ static void unlink_obj(struct config_item *item) | |||
546 | 548 | ||
547 | item->ci_group = NULL; | 549 | item->ci_group = NULL; |
548 | item->ci_parent = NULL; | 550 | item->ci_parent = NULL; |
551 | |||
552 | /* Drop the reference for ci_entry */ | ||
549 | config_item_put(item); | 553 | config_item_put(item); |
550 | 554 | ||
555 | /* Drop the reference for ci_parent */ | ||
551 | config_group_put(group); | 556 | config_group_put(group); |
552 | } | 557 | } |
553 | } | 558 | } |
554 | 559 | ||
555 | static void link_obj(struct config_item *parent_item, struct config_item *item) | 560 | static void link_obj(struct config_item *parent_item, struct config_item *item) |
556 | { | 561 | { |
557 | /* Parent seems redundant with group, but it makes certain | 562 | /* |
558 | * traversals much nicer. */ | 563 | * Parent seems redundant with group, but it makes certain |
564 | * traversals much nicer. | ||
565 | */ | ||
559 | item->ci_parent = parent_item; | 566 | item->ci_parent = parent_item; |
567 | |||
568 | /* | ||
569 | * We hold a reference on the parent for the child's ci_parent | ||
570 | * link. | ||
571 | */ | ||
560 | item->ci_group = config_group_get(to_config_group(parent_item)); | 572 | item->ci_group = config_group_get(to_config_group(parent_item)); |
561 | list_add_tail(&item->ci_entry, &item->ci_group->cg_children); | 573 | list_add_tail(&item->ci_entry, &item->ci_group->cg_children); |
562 | 574 | ||
575 | /* | ||
576 | * We hold a reference on the child for ci_entry on the parent's | ||
577 | * cg_children | ||
578 | */ | ||
563 | config_item_get(item); | 579 | config_item_get(item); |
564 | } | 580 | } |
565 | 581 | ||
@@ -684,6 +700,10 @@ static void client_drop_item(struct config_item *parent_item, | |||
684 | type = parent_item->ci_type; | 700 | type = parent_item->ci_type; |
685 | BUG_ON(!type); | 701 | BUG_ON(!type); |
686 | 702 | ||
703 | /* | ||
704 | * If ->drop_item() exists, it is responsible for the | ||
705 | * config_item_put(). | ||
706 | */ | ||
687 | if (type->ct_group_ops && type->ct_group_ops->drop_item) | 707 | if (type->ct_group_ops && type->ct_group_ops->drop_item) |
688 | type->ct_group_ops->drop_item(to_config_group(parent_item), | 708 | type->ct_group_ops->drop_item(to_config_group(parent_item), |
689 | item); | 709 | item); |
@@ -694,23 +714,28 @@ static void client_drop_item(struct config_item *parent_item, | |||
694 | 714 | ||
695 | static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 715 | static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) |
696 | { | 716 | { |
697 | int ret; | 717 | int ret, module_got = 0; |
698 | struct config_group *group; | 718 | struct config_group *group; |
699 | struct config_item *item; | 719 | struct config_item *item; |
700 | struct config_item *parent_item; | 720 | struct config_item *parent_item; |
701 | struct configfs_subsystem *subsys; | 721 | struct configfs_subsystem *subsys; |
702 | struct configfs_dirent *sd; | 722 | struct configfs_dirent *sd; |
703 | struct config_item_type *type; | 723 | struct config_item_type *type; |
704 | struct module *owner; | 724 | struct module *owner = NULL; |
705 | char *name; | 725 | char *name; |
706 | 726 | ||
707 | if (dentry->d_parent == configfs_sb->s_root) | 727 | if (dentry->d_parent == configfs_sb->s_root) { |
708 | return -EPERM; | 728 | ret = -EPERM; |
729 | goto out; | ||
730 | } | ||
709 | 731 | ||
710 | sd = dentry->d_parent->d_fsdata; | 732 | sd = dentry->d_parent->d_fsdata; |
711 | if (!(sd->s_type & CONFIGFS_USET_DIR)) | 733 | if (!(sd->s_type & CONFIGFS_USET_DIR)) { |
712 | return -EPERM; | 734 | ret = -EPERM; |
735 | goto out; | ||
736 | } | ||
713 | 737 | ||
738 | /* Get a working ref for the duration of this function */ | ||
714 | parent_item = configfs_get_config_item(dentry->d_parent); | 739 | parent_item = configfs_get_config_item(dentry->d_parent); |
715 | type = parent_item->ci_type; | 740 | type = parent_item->ci_type; |
716 | subsys = to_config_group(parent_item)->cg_subsys; | 741 | subsys = to_config_group(parent_item)->cg_subsys; |
@@ -719,15 +744,16 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
719 | if (!type || !type->ct_group_ops || | 744 | if (!type || !type->ct_group_ops || |
720 | (!type->ct_group_ops->make_group && | 745 | (!type->ct_group_ops->make_group && |
721 | !type->ct_group_ops->make_item)) { | 746 | !type->ct_group_ops->make_item)) { |
722 | config_item_put(parent_item); | 747 | ret = -EPERM; /* Lack-of-mkdir returns -EPERM */ |
723 | return -EPERM; /* What lack-of-mkdir returns */ | 748 | goto out_put; |
724 | } | 749 | } |
725 | 750 | ||
726 | name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL); | 751 | name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL); |
727 | if (!name) { | 752 | if (!name) { |
728 | config_item_put(parent_item); | 753 | ret = -ENOMEM; |
729 | return -ENOMEM; | 754 | goto out_put; |
730 | } | 755 | } |
756 | |||
731 | snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); | 757 | snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); |
732 | 758 | ||
733 | down(&subsys->su_sem); | 759 | down(&subsys->su_sem); |
@@ -748,40 +774,67 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
748 | 774 | ||
749 | kfree(name); | 775 | kfree(name); |
750 | if (!item) { | 776 | if (!item) { |
751 | config_item_put(parent_item); | 777 | /* |
752 | return -ENOMEM; | 778 | * If item == NULL, then link_obj() was never called. |
779 | * There are no extra references to clean up. | ||
780 | */ | ||
781 | ret = -ENOMEM; | ||
782 | goto out_put; | ||
753 | } | 783 | } |
754 | 784 | ||
755 | ret = -EINVAL; | 785 | /* |
786 | * link_obj() has been called (via link_group() for groups). | ||
787 | * From here on out, errors must clean that up. | ||
788 | */ | ||
789 | |||
756 | type = item->ci_type; | 790 | type = item->ci_type; |
757 | if (type) { | 791 | if (!type) { |
758 | owner = type->ct_owner; | 792 | ret = -EINVAL; |
759 | if (try_module_get(owner)) { | 793 | goto out_unlink; |
760 | if (group) { | 794 | } |
761 | ret = configfs_attach_group(parent_item, | ||
762 | item, | ||
763 | dentry); | ||
764 | } else { | ||
765 | ret = configfs_attach_item(parent_item, | ||
766 | item, | ||
767 | dentry); | ||
768 | } | ||
769 | 795 | ||
770 | if (ret) { | 796 | owner = type->ct_owner; |
771 | down(&subsys->su_sem); | 797 | if (!try_module_get(owner)) { |
772 | if (group) | 798 | ret = -EINVAL; |
773 | unlink_group(group); | 799 | goto out_unlink; |
774 | else | 800 | } |
775 | unlink_obj(item); | ||
776 | client_drop_item(parent_item, item); | ||
777 | up(&subsys->su_sem); | ||
778 | 801 | ||
779 | config_item_put(parent_item); | 802 | /* |
780 | module_put(owner); | 803 | * I hate doing it this way, but if there is |
781 | } | 804 | * an error, module_put() probably should |
782 | } | 805 | * happen after any cleanup. |
806 | */ | ||
807 | module_got = 1; | ||
808 | |||
809 | if (group) | ||
810 | ret = configfs_attach_group(parent_item, item, dentry); | ||
811 | else | ||
812 | ret = configfs_attach_item(parent_item, item, dentry); | ||
813 | |||
814 | out_unlink: | ||
815 | if (ret) { | ||
816 | /* Tear down everything we built up */ | ||
817 | down(&subsys->su_sem); | ||
818 | if (group) | ||
819 | unlink_group(group); | ||
820 | else | ||
821 | unlink_obj(item); | ||
822 | client_drop_item(parent_item, item); | ||
823 | up(&subsys->su_sem); | ||
824 | |||
825 | if (module_got) | ||
826 | module_put(owner); | ||
783 | } | 827 | } |
784 | 828 | ||
829 | out_put: | ||
830 | /* | ||
831 | * link_obj()/link_group() took a reference from child->parent, | ||
832 | * so the parent is safely pinned. We can drop our working | ||
833 | * reference. | ||
834 | */ | ||
835 | config_item_put(parent_item); | ||
836 | |||
837 | out: | ||
785 | return ret; | 838 | return ret; |
786 | } | 839 | } |
787 | 840 | ||
@@ -801,6 +854,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
801 | if (sd->s_type & CONFIGFS_USET_DEFAULT) | 854 | if (sd->s_type & CONFIGFS_USET_DEFAULT) |
802 | return -EPERM; | 855 | return -EPERM; |
803 | 856 | ||
857 | /* Get a working ref until we have the child */ | ||
804 | parent_item = configfs_get_config_item(dentry->d_parent); | 858 | parent_item = configfs_get_config_item(dentry->d_parent); |
805 | subsys = to_config_group(parent_item)->cg_subsys; | 859 | subsys = to_config_group(parent_item)->cg_subsys; |
806 | BUG_ON(!subsys); | 860 | BUG_ON(!subsys); |
@@ -817,6 +871,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
817 | return ret; | 871 | return ret; |
818 | } | 872 | } |
819 | 873 | ||
874 | /* Get a working ref for the duration of this function */ | ||
820 | item = configfs_get_config_item(dentry); | 875 | item = configfs_get_config_item(dentry); |
821 | 876 | ||
822 | /* Drop reference from above, item already holds one. */ | 877 | /* Drop reference from above, item already holds one. */ |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 85d166cdcae4..b55b4ea9a676 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -67,12 +67,13 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d | |||
67 | static int debugfs_mknod(struct inode *dir, struct dentry *dentry, | 67 | static int debugfs_mknod(struct inode *dir, struct dentry *dentry, |
68 | int mode, dev_t dev) | 68 | int mode, dev_t dev) |
69 | { | 69 | { |
70 | struct inode *inode = debugfs_get_inode(dir->i_sb, mode, dev); | 70 | struct inode *inode; |
71 | int error = -EPERM; | 71 | int error = -EPERM; |
72 | 72 | ||
73 | if (dentry->d_inode) | 73 | if (dentry->d_inode) |
74 | return -EEXIST; | 74 | return -EEXIST; |
75 | 75 | ||
76 | inode = debugfs_get_inode(dir->i_sb, mode, dev); | ||
76 | if (inode) { | 77 | if (inode) { |
77 | d_instantiate(dentry, inode); | 78 | d_instantiate(dentry, inode); |
78 | dget(dentry); | 79 | dget(dentry); |
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index b06b54f1bbbb..4c39009350f3 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
@@ -102,7 +102,7 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent, | |||
102 | if (acceptable(context, result)) | 102 | if (acceptable(context, result)) |
103 | return result; | 103 | return result; |
104 | if (S_ISDIR(result->d_inode->i_mode)) { | 104 | if (S_ISDIR(result->d_inode->i_mode)) { |
105 | /* there is no other dentry, so fail */ | 105 | err = -EACCES; |
106 | goto err_result; | 106 | goto err_result; |
107 | } | 107 | } |
108 | 108 | ||
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 8aac5334680d..34b39e9a1e5a 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -767,7 +767,6 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input) | |||
767 | if (input->group != sbi->s_groups_count) { | 767 | if (input->group != sbi->s_groups_count) { |
768 | ext3_warning(sb, __FUNCTION__, | 768 | ext3_warning(sb, __FUNCTION__, |
769 | "multiple resizers run on filesystem!"); | 769 | "multiple resizers run on filesystem!"); |
770 | unlock_super(sb); | ||
771 | err = -EBUSY; | 770 | err = -EBUSY; |
772 | goto exit_journal; | 771 | goto exit_journal; |
773 | } | 772 | } |
diff --git a/fs/inotify.c b/fs/inotify.c index 1f50302849c5..732ec4bd5774 100644 --- a/fs/inotify.c +++ b/fs/inotify.c | |||
@@ -848,7 +848,11 @@ static int inotify_release(struct inode *ignored, struct file *file) | |||
848 | inode = watch->inode; | 848 | inode = watch->inode; |
849 | mutex_lock(&inode->inotify_mutex); | 849 | mutex_lock(&inode->inotify_mutex); |
850 | mutex_lock(&dev->mutex); | 850 | mutex_lock(&dev->mutex); |
851 | remove_watch_no_event(watch, dev); | 851 | |
852 | /* make sure we didn't race with another list removal */ | ||
853 | if (likely(idr_find(&dev->idr, watch->wd))) | ||
854 | remove_watch_no_event(watch, dev); | ||
855 | |||
852 | mutex_unlock(&dev->mutex); | 856 | mutex_unlock(&dev->mutex); |
853 | mutex_unlock(&inode->inotify_mutex); | 857 | mutex_unlock(&inode->inotify_mutex); |
854 | put_inotify_watch(watch); | 858 | put_inotify_watch(watch); |
@@ -890,8 +894,7 @@ static int inotify_ignore(struct inotify_device *dev, s32 wd) | |||
890 | mutex_lock(&dev->mutex); | 894 | mutex_lock(&dev->mutex); |
891 | 895 | ||
892 | /* make sure that we did not race */ | 896 | /* make sure that we did not race */ |
893 | watch = idr_find(&dev->idr, wd); | 897 | if (likely(idr_find(&dev->idr, wd) == watch)) |
894 | if (likely(watch)) | ||
895 | remove_watch(watch, dev); | 898 | remove_watch(watch, dev); |
896 | 899 | ||
897 | mutex_unlock(&dev->mutex); | 900 | mutex_unlock(&dev->mutex); |
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c index d4d0c41490cd..1d46677afd17 100644 --- a/fs/jffs2/nodelist.c +++ b/fs/jffs2/nodelist.c | |||
@@ -438,7 +438,8 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info | |||
438 | if (c->mtd->point) { | 438 | if (c->mtd->point) { |
439 | err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer); | 439 | err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer); |
440 | if (!err && retlen < tn->csize) { | 440 | if (!err && retlen < tn->csize) { |
441 | JFFS2_WARNING("MTD point returned len too short: %u instead of %u.\n", retlen, tn->csize); | 441 | JFFS2_WARNING("MTD point returned len too short: %zu " |
442 | "instead of %u.\n", retlen, tn->csize); | ||
442 | c->mtd->unpoint(c->mtd, buffer, ofs, len); | 443 | c->mtd->unpoint(c->mtd, buffer, ofs, len); |
443 | } else if (err) | 444 | } else if (err) |
444 | JFFS2_WARNING("MTD point failed: error code %d.\n", err); | 445 | JFFS2_WARNING("MTD point failed: error code %d.\n", err); |
@@ -461,7 +462,8 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info | |||
461 | } | 462 | } |
462 | 463 | ||
463 | if (retlen != len) { | 464 | if (retlen != len) { |
464 | JFFS2_ERROR("short read at %#08x: %d instead of %d.\n", ofs, retlen, len); | 465 | JFFS2_ERROR("short read at %#08x: %zd instead of %d.\n", |
466 | ofs, retlen, len); | ||
465 | err = -EIO; | 467 | err = -EIO; |
466 | goto free_out; | 468 | goto free_out; |
467 | } | 469 | } |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index f28696f235c4..2b220dd6b4e7 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -542,7 +542,7 @@ add_failed: | |||
542 | static int metapage_releasepage(struct page *page, gfp_t gfp_mask) | 542 | static int metapage_releasepage(struct page *page, gfp_t gfp_mask) |
543 | { | 543 | { |
544 | struct metapage *mp; | 544 | struct metapage *mp; |
545 | int busy = 0; | 545 | int ret = 1; |
546 | unsigned int offset; | 546 | unsigned int offset; |
547 | 547 | ||
548 | for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) { | 548 | for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) { |
@@ -552,30 +552,20 @@ static int metapage_releasepage(struct page *page, gfp_t gfp_mask) | |||
552 | continue; | 552 | continue; |
553 | 553 | ||
554 | jfs_info("metapage_releasepage: mp = 0x%p", mp); | 554 | jfs_info("metapage_releasepage: mp = 0x%p", mp); |
555 | if (mp->count || mp->nohomeok) { | 555 | if (mp->count || mp->nohomeok || |
556 | test_bit(META_dirty, &mp->flag)) { | ||
556 | jfs_info("count = %ld, nohomeok = %d", mp->count, | 557 | jfs_info("count = %ld, nohomeok = %d", mp->count, |
557 | mp->nohomeok); | 558 | mp->nohomeok); |
558 | busy = 1; | 559 | ret = 0; |
559 | continue; | 560 | continue; |
560 | } | 561 | } |
561 | wait_on_page_writeback(page); | ||
562 | //WARN_ON(test_bit(META_dirty, &mp->flag)); | ||
563 | if (test_bit(META_dirty, &mp->flag)) { | ||
564 | dump_mem("dirty mp in metapage_releasepage", mp, | ||
565 | sizeof(struct metapage)); | ||
566 | dump_mem("page", page, sizeof(struct page)); | ||
567 | dump_stack(); | ||
568 | } | ||
569 | if (mp->lsn) | 562 | if (mp->lsn) |
570 | remove_from_logsync(mp); | 563 | remove_from_logsync(mp); |
571 | remove_metapage(page, mp); | 564 | remove_metapage(page, mp); |
572 | INCREMENT(mpStat.pagefree); | 565 | INCREMENT(mpStat.pagefree); |
573 | free_metapage(mp); | 566 | free_metapage(mp); |
574 | } | 567 | } |
575 | if (busy) | 568 | return ret; |
576 | return -1; | ||
577 | |||
578 | return 0; | ||
579 | } | 569 | } |
580 | 570 | ||
581 | static void metapage_invalidatepage(struct page *page, unsigned long offset) | 571 | static void metapage_invalidatepage(struct page *page, unsigned long offset) |
diff --git a/fs/locks.c b/fs/locks.c index 6f99c0a6f836..ab61a8b54829 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -755,6 +755,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) | |||
755 | if (request->fl_type == F_UNLCK) | 755 | if (request->fl_type == F_UNLCK) |
756 | goto out; | 756 | goto out; |
757 | 757 | ||
758 | error = -ENOMEM; | ||
758 | new_fl = locks_alloc_lock(); | 759 | new_fl = locks_alloc_lock(); |
759 | if (new_fl == NULL) | 760 | if (new_fl == NULL) |
760 | goto out; | 761 | goto out; |
@@ -781,6 +782,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) | |||
781 | locks_copy_lock(new_fl, request); | 782 | locks_copy_lock(new_fl, request); |
782 | locks_insert_lock(&inode->i_flock, new_fl); | 783 | locks_insert_lock(&inode->i_flock, new_fl); |
783 | new_fl = NULL; | 784 | new_fl = NULL; |
785 | error = 0; | ||
784 | 786 | ||
785 | out: | 787 | out: |
786 | unlock_kernel(); | 788 | unlock_kernel(); |
diff --git a/fs/namei.c b/fs/namei.c index 96723ae83c89..d6e2ee251736 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1080,8 +1080,8 @@ static int fastcall do_path_lookup(int dfd, const char *name, | |||
1080 | nd->flags = flags; | 1080 | nd->flags = flags; |
1081 | nd->depth = 0; | 1081 | nd->depth = 0; |
1082 | 1082 | ||
1083 | read_lock(¤t->fs->lock); | ||
1084 | if (*name=='/') { | 1083 | if (*name=='/') { |
1084 | read_lock(¤t->fs->lock); | ||
1085 | if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) { | 1085 | if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) { |
1086 | nd->mnt = mntget(current->fs->altrootmnt); | 1086 | nd->mnt = mntget(current->fs->altrootmnt); |
1087 | nd->dentry = dget(current->fs->altroot); | 1087 | nd->dentry = dget(current->fs->altroot); |
@@ -1092,33 +1092,35 @@ static int fastcall do_path_lookup(int dfd, const char *name, | |||
1092 | } | 1092 | } |
1093 | nd->mnt = mntget(current->fs->rootmnt); | 1093 | nd->mnt = mntget(current->fs->rootmnt); |
1094 | nd->dentry = dget(current->fs->root); | 1094 | nd->dentry = dget(current->fs->root); |
1095 | read_unlock(¤t->fs->lock); | ||
1095 | } else if (dfd == AT_FDCWD) { | 1096 | } else if (dfd == AT_FDCWD) { |
1097 | read_lock(¤t->fs->lock); | ||
1096 | nd->mnt = mntget(current->fs->pwdmnt); | 1098 | nd->mnt = mntget(current->fs->pwdmnt); |
1097 | nd->dentry = dget(current->fs->pwd); | 1099 | nd->dentry = dget(current->fs->pwd); |
1100 | read_unlock(¤t->fs->lock); | ||
1098 | } else { | 1101 | } else { |
1099 | struct dentry *dentry; | 1102 | struct dentry *dentry; |
1100 | 1103 | ||
1101 | file = fget_light(dfd, &fput_needed); | 1104 | file = fget_light(dfd, &fput_needed); |
1102 | retval = -EBADF; | 1105 | retval = -EBADF; |
1103 | if (!file) | 1106 | if (!file) |
1104 | goto unlock_fail; | 1107 | goto out_fail; |
1105 | 1108 | ||
1106 | dentry = file->f_dentry; | 1109 | dentry = file->f_dentry; |
1107 | 1110 | ||
1108 | retval = -ENOTDIR; | 1111 | retval = -ENOTDIR; |
1109 | if (!S_ISDIR(dentry->d_inode->i_mode)) | 1112 | if (!S_ISDIR(dentry->d_inode->i_mode)) |
1110 | goto fput_unlock_fail; | 1113 | goto fput_fail; |
1111 | 1114 | ||
1112 | retval = file_permission(file, MAY_EXEC); | 1115 | retval = file_permission(file, MAY_EXEC); |
1113 | if (retval) | 1116 | if (retval) |
1114 | goto fput_unlock_fail; | 1117 | goto fput_fail; |
1115 | 1118 | ||
1116 | nd->mnt = mntget(file->f_vfsmnt); | 1119 | nd->mnt = mntget(file->f_vfsmnt); |
1117 | nd->dentry = dget(dentry); | 1120 | nd->dentry = dget(dentry); |
1118 | 1121 | ||
1119 | fput_light(file, fput_needed); | 1122 | fput_light(file, fput_needed); |
1120 | } | 1123 | } |
1121 | read_unlock(¤t->fs->lock); | ||
1122 | current->total_link_count = 0; | 1124 | current->total_link_count = 0; |
1123 | retval = link_path_walk(name, nd); | 1125 | retval = link_path_walk(name, nd); |
1124 | out: | 1126 | out: |
@@ -1127,13 +1129,12 @@ out: | |||
1127 | nd->dentry->d_inode)) | 1129 | nd->dentry->d_inode)) |
1128 | audit_inode(name, nd->dentry->d_inode, flags); | 1130 | audit_inode(name, nd->dentry->d_inode, flags); |
1129 | } | 1131 | } |
1132 | out_fail: | ||
1130 | return retval; | 1133 | return retval; |
1131 | 1134 | ||
1132 | fput_unlock_fail: | 1135 | fput_fail: |
1133 | fput_light(file, fput_needed); | 1136 | fput_light(file, fput_needed); |
1134 | unlock_fail: | 1137 | goto out_fail; |
1135 | read_unlock(¤t->fs->lock); | ||
1136 | return retval; | ||
1137 | } | 1138 | } |
1138 | 1139 | ||
1139 | int fastcall path_lookup(const char *name, unsigned int flags, | 1140 | int fastcall path_lookup(const char *name, unsigned int flags, |
diff --git a/fs/namespace.c b/fs/namespace.c index 2c5f1f80bdc2..bf478addb852 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -899,13 +899,11 @@ static int do_change_type(struct nameidata *nd, int flag) | |||
899 | /* | 899 | /* |
900 | * do loopback mount. | 900 | * do loopback mount. |
901 | */ | 901 | */ |
902 | static int do_loopback(struct nameidata *nd, char *old_name, unsigned long flags, int mnt_flags) | 902 | static int do_loopback(struct nameidata *nd, char *old_name, int recurse) |
903 | { | 903 | { |
904 | struct nameidata old_nd; | 904 | struct nameidata old_nd; |
905 | struct vfsmount *mnt = NULL; | 905 | struct vfsmount *mnt = NULL; |
906 | int recurse = flags & MS_REC; | ||
907 | int err = mount_is_safe(nd); | 906 | int err = mount_is_safe(nd); |
908 | |||
909 | if (err) | 907 | if (err) |
910 | return err; | 908 | return err; |
911 | if (!old_name || !*old_name) | 909 | if (!old_name || !*old_name) |
@@ -939,7 +937,6 @@ static int do_loopback(struct nameidata *nd, char *old_name, unsigned long flags | |||
939 | spin_unlock(&vfsmount_lock); | 937 | spin_unlock(&vfsmount_lock); |
940 | release_mounts(&umount_list); | 938 | release_mounts(&umount_list); |
941 | } | 939 | } |
942 | mnt->mnt_flags = mnt_flags; | ||
943 | 940 | ||
944 | out: | 941 | out: |
945 | up_write(&namespace_sem); | 942 | up_write(&namespace_sem); |
@@ -1353,7 +1350,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page, | |||
1353 | retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags, | 1350 | retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags, |
1354 | data_page); | 1351 | data_page); |
1355 | else if (flags & MS_BIND) | 1352 | else if (flags & MS_BIND) |
1356 | retval = do_loopback(&nd, dev_name, flags, mnt_flags); | 1353 | retval = do_loopback(&nd, dev_name, flags & MS_REC); |
1357 | else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) | 1354 | else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) |
1358 | retval = do_change_type(&nd, flags); | 1355 | retval = do_change_type(&nd, flags); |
1359 | else if (flags & MS_MOVE) | 1356 | else if (flags & MS_MOVE) |
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 4e0578121d9a..3eec30000f3f 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -1066,9 +1066,11 @@ exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp, | |||
1066 | rv = nfserr_perm; | 1066 | rv = nfserr_perm; |
1067 | else if (IS_ERR(exp)) | 1067 | else if (IS_ERR(exp)) |
1068 | rv = nfserrno(PTR_ERR(exp)); | 1068 | rv = nfserrno(PTR_ERR(exp)); |
1069 | else | 1069 | else { |
1070 | rv = fh_compose(fhp, exp, | 1070 | rv = fh_compose(fhp, exp, |
1071 | fsid_key->ek_dentry, NULL); | 1071 | fsid_key->ek_dentry, NULL); |
1072 | exp_put(exp); | ||
1073 | } | ||
1072 | cache_put(&fsid_key->h, &svc_expkey_cache); | 1074 | cache_put(&fsid_key->h, &svc_expkey_cache); |
1073 | return rv; | 1075 | return rv; |
1074 | } | 1076 | } |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 6aa92d0e6876..1d65f13f458c 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1922,11 +1922,10 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) | |||
1922 | value = kmalloc(size, GFP_KERNEL); | 1922 | value = kmalloc(size, GFP_KERNEL); |
1923 | if (!value) | 1923 | if (!value) |
1924 | return -ENOMEM; | 1924 | return -ENOMEM; |
1925 | size = posix_acl_to_xattr(acl, value, size); | 1925 | error = posix_acl_to_xattr(acl, value, size); |
1926 | if (size < 0) { | 1926 | if (error < 0) |
1927 | error = size; | ||
1928 | goto getout; | 1927 | goto getout; |
1929 | } | 1928 | size = error; |
1930 | } else | 1929 | } else |
1931 | size = 0; | 1930 | size = 0; |
1932 | 1931 | ||
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 0d858d0b25be..47152bf9a7f2 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -276,13 +276,29 @@ static int ocfs2_writepage(struct page *page, struct writeback_control *wbc) | |||
276 | return ret; | 276 | return ret; |
277 | } | 277 | } |
278 | 278 | ||
279 | /* This can also be called from ocfs2_write_zero_page() which has done | ||
280 | * it's own cluster locking. */ | ||
281 | int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page, | ||
282 | unsigned from, unsigned to) | ||
283 | { | ||
284 | int ret; | ||
285 | |||
286 | down_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
287 | |||
288 | ret = block_prepare_write(page, from, to, ocfs2_get_block); | ||
289 | |||
290 | up_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
291 | |||
292 | return ret; | ||
293 | } | ||
294 | |||
279 | /* | 295 | /* |
280 | * ocfs2_prepare_write() can be an outer-most ocfs2 call when it is called | 296 | * ocfs2_prepare_write() can be an outer-most ocfs2 call when it is called |
281 | * from loopback. It must be able to perform its own locking around | 297 | * from loopback. It must be able to perform its own locking around |
282 | * ocfs2_get_block(). | 298 | * ocfs2_get_block(). |
283 | */ | 299 | */ |
284 | int ocfs2_prepare_write(struct file *file, struct page *page, | 300 | static int ocfs2_prepare_write(struct file *file, struct page *page, |
285 | unsigned from, unsigned to) | 301 | unsigned from, unsigned to) |
286 | { | 302 | { |
287 | struct inode *inode = page->mapping->host; | 303 | struct inode *inode = page->mapping->host; |
288 | int ret; | 304 | int ret; |
@@ -295,11 +311,7 @@ int ocfs2_prepare_write(struct file *file, struct page *page, | |||
295 | goto out; | 311 | goto out; |
296 | } | 312 | } |
297 | 313 | ||
298 | down_read(&OCFS2_I(inode)->ip_alloc_sem); | 314 | ret = ocfs2_prepare_write_nolock(inode, page, from, to); |
299 | |||
300 | ret = block_prepare_write(page, from, to, ocfs2_get_block); | ||
301 | |||
302 | up_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
303 | 315 | ||
304 | ocfs2_meta_unlock(inode, 0); | 316 | ocfs2_meta_unlock(inode, 0); |
305 | out: | 317 | out: |
@@ -625,11 +637,31 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
625 | int ret; | 637 | int ret; |
626 | 638 | ||
627 | mlog_entry_void(); | 639 | mlog_entry_void(); |
640 | |||
641 | /* | ||
642 | * We get PR data locks even for O_DIRECT. This allows | ||
643 | * concurrent O_DIRECT I/O but doesn't let O_DIRECT with | ||
644 | * extending and buffered zeroing writes race. If they did | ||
645 | * race then the buffered zeroing could be written back after | ||
646 | * the O_DIRECT I/O. It's one thing to tell people not to mix | ||
647 | * buffered and O_DIRECT writes, but expecting them to | ||
648 | * understand that file extension is also an implicit buffered | ||
649 | * write is too much. By getting the PR we force writeback of | ||
650 | * the buffered zeroing before proceeding. | ||
651 | */ | ||
652 | ret = ocfs2_data_lock(inode, 0); | ||
653 | if (ret < 0) { | ||
654 | mlog_errno(ret); | ||
655 | goto out; | ||
656 | } | ||
657 | ocfs2_data_unlock(inode, 0); | ||
658 | |||
628 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, | 659 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, |
629 | inode->i_sb->s_bdev, iov, offset, | 660 | inode->i_sb->s_bdev, iov, offset, |
630 | nr_segs, | 661 | nr_segs, |
631 | ocfs2_direct_IO_get_blocks, | 662 | ocfs2_direct_IO_get_blocks, |
632 | ocfs2_dio_end_io); | 663 | ocfs2_dio_end_io); |
664 | out: | ||
633 | mlog_exit(ret); | 665 | mlog_exit(ret); |
634 | return ret; | 666 | return ret; |
635 | } | 667 | } |
diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h index d40456d509a0..e88c3f0b8fa9 100644 --- a/fs/ocfs2/aops.h +++ b/fs/ocfs2/aops.h | |||
@@ -22,8 +22,8 @@ | |||
22 | #ifndef OCFS2_AOPS_H | 22 | #ifndef OCFS2_AOPS_H |
23 | #define OCFS2_AOPS_H | 23 | #define OCFS2_AOPS_H |
24 | 24 | ||
25 | int ocfs2_prepare_write(struct file *file, struct page *page, | 25 | int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page, |
26 | unsigned from, unsigned to); | 26 | unsigned from, unsigned to); |
27 | 27 | ||
28 | struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode, | 28 | struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode, |
29 | struct page *page, | 29 | struct page *page, |
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index 4601fc256f11..1a5c69071df6 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -569,7 +569,7 @@ static int ocfs2_extent_map_insert(struct inode *inode, | |||
569 | 569 | ||
570 | ret = -ENOMEM; | 570 | ret = -ENOMEM; |
571 | ctxt.new_ent = kmem_cache_alloc(ocfs2_em_ent_cachep, | 571 | ctxt.new_ent = kmem_cache_alloc(ocfs2_em_ent_cachep, |
572 | GFP_KERNEL); | 572 | GFP_NOFS); |
573 | if (!ctxt.new_ent) { | 573 | if (!ctxt.new_ent) { |
574 | mlog_errno(ret); | 574 | mlog_errno(ret); |
575 | return ret; | 575 | return ret; |
@@ -583,14 +583,14 @@ static int ocfs2_extent_map_insert(struct inode *inode, | |||
583 | if (ctxt.need_left && !ctxt.left_ent) { | 583 | if (ctxt.need_left && !ctxt.left_ent) { |
584 | ctxt.left_ent = | 584 | ctxt.left_ent = |
585 | kmem_cache_alloc(ocfs2_em_ent_cachep, | 585 | kmem_cache_alloc(ocfs2_em_ent_cachep, |
586 | GFP_KERNEL); | 586 | GFP_NOFS); |
587 | if (!ctxt.left_ent) | 587 | if (!ctxt.left_ent) |
588 | break; | 588 | break; |
589 | } | 589 | } |
590 | if (ctxt.need_right && !ctxt.right_ent) { | 590 | if (ctxt.need_right && !ctxt.right_ent) { |
591 | ctxt.right_ent = | 591 | ctxt.right_ent = |
592 | kmem_cache_alloc(ocfs2_em_ent_cachep, | 592 | kmem_cache_alloc(ocfs2_em_ent_cachep, |
593 | GFP_KERNEL); | 593 | GFP_NOFS); |
594 | if (!ctxt.right_ent) | 594 | if (!ctxt.right_ent) |
595 | break; | 595 | break; |
596 | } | 596 | } |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 581eb451a41a..a9559c874530 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -613,7 +613,8 @@ leave: | |||
613 | 613 | ||
614 | /* Some parts of this taken from generic_cont_expand, which turned out | 614 | /* Some parts of this taken from generic_cont_expand, which turned out |
615 | * to be too fragile to do exactly what we need without us having to | 615 | * to be too fragile to do exactly what we need without us having to |
616 | * worry about recursive locking in ->commit_write(). */ | 616 | * worry about recursive locking in ->prepare_write() and |
617 | * ->commit_write(). */ | ||
617 | static int ocfs2_write_zero_page(struct inode *inode, | 618 | static int ocfs2_write_zero_page(struct inode *inode, |
618 | u64 size) | 619 | u64 size) |
619 | { | 620 | { |
@@ -641,7 +642,7 @@ static int ocfs2_write_zero_page(struct inode *inode, | |||
641 | goto out; | 642 | goto out; |
642 | } | 643 | } |
643 | 644 | ||
644 | ret = ocfs2_prepare_write(NULL, page, offset, offset); | 645 | ret = ocfs2_prepare_write_nolock(inode, page, offset, offset); |
645 | if (ret < 0) { | 646 | if (ret < 0) { |
646 | mlog_errno(ret); | 647 | mlog_errno(ret); |
647 | goto out_unlock; | 648 | goto out_unlock; |
@@ -695,13 +696,26 @@ out: | |||
695 | return ret; | 696 | return ret; |
696 | } | 697 | } |
697 | 698 | ||
699 | /* | ||
700 | * A tail_to_skip value > 0 indicates that we're being called from | ||
701 | * ocfs2_file_aio_write(). This has the following implications: | ||
702 | * | ||
703 | * - we don't want to update i_size | ||
704 | * - di_bh will be NULL, which is fine because it's only used in the | ||
705 | * case where we want to update i_size. | ||
706 | * - ocfs2_zero_extend() will then only be filling the hole created | ||
707 | * between i_size and the start of the write. | ||
708 | */ | ||
698 | static int ocfs2_extend_file(struct inode *inode, | 709 | static int ocfs2_extend_file(struct inode *inode, |
699 | struct buffer_head *di_bh, | 710 | struct buffer_head *di_bh, |
700 | u64 new_i_size) | 711 | u64 new_i_size, |
712 | size_t tail_to_skip) | ||
701 | { | 713 | { |
702 | int ret = 0; | 714 | int ret = 0; |
703 | u32 clusters_to_add; | 715 | u32 clusters_to_add; |
704 | 716 | ||
717 | BUG_ON(!tail_to_skip && !di_bh); | ||
718 | |||
705 | /* setattr sometimes calls us like this. */ | 719 | /* setattr sometimes calls us like this. */ |
706 | if (new_i_size == 0) | 720 | if (new_i_size == 0) |
707 | goto out; | 721 | goto out; |
@@ -714,27 +728,44 @@ static int ocfs2_extend_file(struct inode *inode, | |||
714 | OCFS2_I(inode)->ip_clusters; | 728 | OCFS2_I(inode)->ip_clusters; |
715 | 729 | ||
716 | if (clusters_to_add) { | 730 | if (clusters_to_add) { |
717 | ret = ocfs2_extend_allocation(inode, clusters_to_add); | 731 | /* |
732 | * protect the pages that ocfs2_zero_extend is going to | ||
733 | * be pulling into the page cache.. we do this before the | ||
734 | * metadata extend so that we don't get into the situation | ||
735 | * where we've extended the metadata but can't get the data | ||
736 | * lock to zero. | ||
737 | */ | ||
738 | ret = ocfs2_data_lock(inode, 1); | ||
718 | if (ret < 0) { | 739 | if (ret < 0) { |
719 | mlog_errno(ret); | 740 | mlog_errno(ret); |
720 | goto out; | 741 | goto out; |
721 | } | 742 | } |
722 | 743 | ||
723 | ret = ocfs2_zero_extend(inode, new_i_size); | 744 | ret = ocfs2_extend_allocation(inode, clusters_to_add); |
724 | if (ret < 0) { | 745 | if (ret < 0) { |
725 | mlog_errno(ret); | 746 | mlog_errno(ret); |
726 | goto out; | 747 | goto out_unlock; |
727 | } | 748 | } |
728 | } | ||
729 | 749 | ||
730 | /* No allocation required, we just use this helper to | 750 | ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip); |
731 | * do a trivial update of i_size. */ | 751 | if (ret < 0) { |
732 | ret = ocfs2_simple_size_update(inode, di_bh, new_i_size); | 752 | mlog_errno(ret); |
733 | if (ret < 0) { | 753 | goto out_unlock; |
734 | mlog_errno(ret); | 754 | } |
735 | goto out; | 755 | } |
756 | |||
757 | if (!tail_to_skip) { | ||
758 | /* We're being called from ocfs2_setattr() which wants | ||
759 | * us to update i_size */ | ||
760 | ret = ocfs2_simple_size_update(inode, di_bh, new_i_size); | ||
761 | if (ret < 0) | ||
762 | mlog_errno(ret); | ||
736 | } | 763 | } |
737 | 764 | ||
765 | out_unlock: | ||
766 | if (clusters_to_add) /* this is the only case in which we lock */ | ||
767 | ocfs2_data_unlock(inode, 1); | ||
768 | |||
738 | out: | 769 | out: |
739 | return ret; | 770 | return ret; |
740 | } | 771 | } |
@@ -793,7 +824,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
793 | if (i_size_read(inode) > attr->ia_size) | 824 | if (i_size_read(inode) > attr->ia_size) |
794 | status = ocfs2_truncate_file(inode, bh, attr->ia_size); | 825 | status = ocfs2_truncate_file(inode, bh, attr->ia_size); |
795 | else | 826 | else |
796 | status = ocfs2_extend_file(inode, bh, attr->ia_size); | 827 | status = ocfs2_extend_file(inode, bh, attr->ia_size, 0); |
797 | if (status < 0) { | 828 | if (status < 0) { |
798 | if (status != -ENOSPC) | 829 | if (status != -ENOSPC) |
799 | mlog_errno(status); | 830 | mlog_errno(status); |
@@ -1049,21 +1080,12 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
1049 | if (!clusters) | 1080 | if (!clusters) |
1050 | break; | 1081 | break; |
1051 | 1082 | ||
1052 | ret = ocfs2_extend_allocation(inode, clusters); | 1083 | ret = ocfs2_extend_file(inode, NULL, newsize, count); |
1053 | if (ret < 0) { | 1084 | if (ret < 0) { |
1054 | if (ret != -ENOSPC) | 1085 | if (ret != -ENOSPC) |
1055 | mlog_errno(ret); | 1086 | mlog_errno(ret); |
1056 | goto out; | 1087 | goto out; |
1057 | } | 1088 | } |
1058 | |||
1059 | /* Fill any holes which would've been created by this | ||
1060 | * write. If we're O_APPEND, this will wind up | ||
1061 | * (correctly) being a noop. */ | ||
1062 | ret = ocfs2_zero_extend(inode, (u64) newsize - count); | ||
1063 | if (ret < 0) { | ||
1064 | mlog_errno(ret); | ||
1065 | goto out; | ||
1066 | } | ||
1067 | break; | 1089 | break; |
1068 | } | 1090 | } |
1069 | 1091 | ||
@@ -1146,6 +1168,22 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
1146 | ocfs2_iocb_set_rw_locked(iocb); | 1168 | ocfs2_iocb_set_rw_locked(iocb); |
1147 | } | 1169 | } |
1148 | 1170 | ||
1171 | /* | ||
1172 | * We're fine letting folks race truncates and extending | ||
1173 | * writes with read across the cluster, just like they can | ||
1174 | * locally. Hence no rw_lock during read. | ||
1175 | * | ||
1176 | * Take and drop the meta data lock to update inode fields | ||
1177 | * like i_size. This allows the checks down below | ||
1178 | * generic_file_aio_read() a chance of actually working. | ||
1179 | */ | ||
1180 | ret = ocfs2_meta_lock(inode, NULL, NULL, 0); | ||
1181 | if (ret < 0) { | ||
1182 | mlog_errno(ret); | ||
1183 | goto bail; | ||
1184 | } | ||
1185 | ocfs2_meta_unlock(inode, 0); | ||
1186 | |||
1149 | ret = generic_file_aio_read(iocb, buf, count, iocb->ki_pos); | 1187 | ret = generic_file_aio_read(iocb, buf, count, iocb->ki_pos); |
1150 | if (ret == -EINVAL) | 1188 | if (ret == -EINVAL) |
1151 | mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n"); | 1189 | mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n"); |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 6a610ae53583..eebc3cfa6be8 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -117,7 +117,7 @@ struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb) | |||
117 | { | 117 | { |
118 | struct ocfs2_journal_handle *retval = NULL; | 118 | struct ocfs2_journal_handle *retval = NULL; |
119 | 119 | ||
120 | retval = kcalloc(1, sizeof(*retval), GFP_KERNEL); | 120 | retval = kcalloc(1, sizeof(*retval), GFP_NOFS); |
121 | if (!retval) { | 121 | if (!retval) { |
122 | mlog(ML_ERROR, "Failed to allocate memory for journal " | 122 | mlog(ML_ERROR, "Failed to allocate memory for journal " |
123 | "handle!\n"); | 123 | "handle!\n"); |
@@ -870,9 +870,11 @@ static int ocfs2_force_read_journal(struct inode *inode) | |||
870 | if (p_blocks > CONCURRENT_JOURNAL_FILL) | 870 | if (p_blocks > CONCURRENT_JOURNAL_FILL) |
871 | p_blocks = CONCURRENT_JOURNAL_FILL; | 871 | p_blocks = CONCURRENT_JOURNAL_FILL; |
872 | 872 | ||
873 | /* We are reading journal data which should not | ||
874 | * be put in the uptodate cache */ | ||
873 | status = ocfs2_read_blocks(OCFS2_SB(inode->i_sb), | 875 | status = ocfs2_read_blocks(OCFS2_SB(inode->i_sb), |
874 | p_blkno, p_blocks, bhs, 0, | 876 | p_blkno, p_blocks, bhs, 0, |
875 | inode); | 877 | NULL); |
876 | if (status < 0) { | 878 | if (status < 0) { |
877 | mlog_errno(status); | 879 | mlog_errno(status); |
878 | goto bail; | 880 | goto bail; |
@@ -982,7 +984,7 @@ static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal, | |||
982 | { | 984 | { |
983 | struct ocfs2_la_recovery_item *item; | 985 | struct ocfs2_la_recovery_item *item; |
984 | 986 | ||
985 | item = kmalloc(sizeof(struct ocfs2_la_recovery_item), GFP_KERNEL); | 987 | item = kmalloc(sizeof(struct ocfs2_la_recovery_item), GFP_NOFS); |
986 | if (!item) { | 988 | if (!item) { |
987 | /* Though we wish to avoid it, we are in fact safe in | 989 | /* Though we wish to avoid it, we are in fact safe in |
988 | * skipping local alloc cleanup as fsck.ocfs2 is more | 990 | * skipping local alloc cleanup as fsck.ocfs2 is more |
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index 04a684dfdd96..b8a00a793326 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c | |||
@@ -337,7 +337,7 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_inode_info *oi, | |||
337 | (unsigned long long)oi->ip_blkno, | 337 | (unsigned long long)oi->ip_blkno, |
338 | (unsigned long long)block, expand_tree); | 338 | (unsigned long long)block, expand_tree); |
339 | 339 | ||
340 | new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_KERNEL); | 340 | new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_NOFS); |
341 | if (!new) { | 341 | if (!new) { |
342 | mlog_errno(-ENOMEM); | 342 | mlog_errno(-ENOMEM); |
343 | return; | 343 | return; |
@@ -349,7 +349,7 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_inode_info *oi, | |||
349 | * has no way of tracking that. */ | 349 | * has no way of tracking that. */ |
350 | for(i = 0; i < OCFS2_INODE_MAX_CACHE_ARRAY; i++) { | 350 | for(i = 0; i < OCFS2_INODE_MAX_CACHE_ARRAY; i++) { |
351 | tree[i] = kmem_cache_alloc(ocfs2_uptodate_cachep, | 351 | tree[i] = kmem_cache_alloc(ocfs2_uptodate_cachep, |
352 | GFP_KERNEL); | 352 | GFP_NOFS); |
353 | if (!tree[i]) { | 353 | if (!tree[i]) { |
354 | mlog_errno(-ENOMEM); | 354 | mlog_errno(-ENOMEM); |
355 | goto out_free; | 355 | goto out_free; |
diff --git a/fs/ocfs2/vote.c b/fs/ocfs2/vote.c index 53049a204197..ee42765a8553 100644 --- a/fs/ocfs2/vote.c +++ b/fs/ocfs2/vote.c | |||
@@ -586,7 +586,7 @@ static struct ocfs2_net_wait_ctxt *ocfs2_new_net_wait_ctxt(unsigned int response | |||
586 | { | 586 | { |
587 | struct ocfs2_net_wait_ctxt *w; | 587 | struct ocfs2_net_wait_ctxt *w; |
588 | 588 | ||
589 | w = kcalloc(1, sizeof(*w), GFP_KERNEL); | 589 | w = kcalloc(1, sizeof(*w), GFP_NOFS); |
590 | if (!w) { | 590 | if (!w) { |
591 | mlog_errno(-ENOMEM); | 591 | mlog_errno(-ENOMEM); |
592 | goto bail; | 592 | goto bail; |
@@ -749,7 +749,7 @@ static struct ocfs2_vote_msg * ocfs2_new_vote_request(struct ocfs2_super *osb, | |||
749 | 749 | ||
750 | BUG_ON(!ocfs2_is_valid_vote_request(type)); | 750 | BUG_ON(!ocfs2_is_valid_vote_request(type)); |
751 | 751 | ||
752 | request = kcalloc(1, sizeof(*request), GFP_KERNEL); | 752 | request = kcalloc(1, sizeof(*request), GFP_NOFS); |
753 | if (!request) { | 753 | if (!request) { |
754 | mlog_errno(-ENOMEM); | 754 | mlog_errno(-ENOMEM); |
755 | } else { | 755 | } else { |
@@ -1129,7 +1129,7 @@ static int ocfs2_handle_vote_message(struct o2net_msg *msg, | |||
1129 | struct ocfs2_super *osb = data; | 1129 | struct ocfs2_super *osb = data; |
1130 | struct ocfs2_vote_work *work; | 1130 | struct ocfs2_vote_work *work; |
1131 | 1131 | ||
1132 | work = kmalloc(sizeof(struct ocfs2_vote_work), GFP_KERNEL); | 1132 | work = kmalloc(sizeof(struct ocfs2_vote_work), GFP_NOFS); |
1133 | if (!work) { | 1133 | if (!work) { |
1134 | status = -ENOMEM; | 1134 | status = -ENOMEM; |
1135 | mlog_errno(status); | 1135 | mlog_errno(status); |
@@ -1124,7 +1124,6 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, | |||
1124 | prevent_tail_call(ret); | 1124 | prevent_tail_call(ret); |
1125 | return ret; | 1125 | return ret; |
1126 | } | 1126 | } |
1127 | EXPORT_SYMBOL_GPL(sys_openat); | ||
1128 | 1127 | ||
1129 | #ifndef __alpha__ | 1128 | #ifndef __alpha__ |
1130 | 1129 | ||
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 45ae7dd3c650..7ef1f094de91 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -533,6 +533,7 @@ void del_gendisk(struct gendisk *disk) | |||
533 | 533 | ||
534 | devfs_remove_disk(disk); | 534 | devfs_remove_disk(disk); |
535 | 535 | ||
536 | kobject_uevent(&disk->kobj, KOBJ_REMOVE); | ||
536 | if (disk->holder_dir) | 537 | if (disk->holder_dir) |
537 | kobject_unregister(disk->holder_dir); | 538 | kobject_unregister(disk->holder_dir); |
538 | if (disk->slave_dir) | 539 | if (disk->slave_dir) |
@@ -545,7 +546,7 @@ void del_gendisk(struct gendisk *disk) | |||
545 | kfree(disk_name); | 546 | kfree(disk_name); |
546 | } | 547 | } |
547 | put_device(disk->driverfs_dev); | 548 | put_device(disk->driverfs_dev); |
549 | disk->driverfs_dev = NULL; | ||
548 | } | 550 | } |
549 | kobject_uevent(&disk->kobj, KOBJ_REMOVE); | ||
550 | kobject_del(&disk->kobj); | 551 | kobject_del(&disk->kobj); |
551 | } | 552 | } |
diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c index 34c7a11d91f0..70d9c5a37f5a 100644 --- a/fs/smbfs/dir.c +++ b/fs/smbfs/dir.c | |||
@@ -434,6 +434,11 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
434 | if (dentry->d_name.len > SMB_MAXNAMELEN) | 434 | if (dentry->d_name.len > SMB_MAXNAMELEN) |
435 | goto out; | 435 | goto out; |
436 | 436 | ||
437 | /* Do not allow lookup of names with backslashes in */ | ||
438 | error = -EINVAL; | ||
439 | if (memchr(dentry->d_name.name, '\\', dentry->d_name.len)) | ||
440 | goto out; | ||
441 | |||
437 | lock_kernel(); | 442 | lock_kernel(); |
438 | error = smb_proc_getattr(dentry, &finfo); | 443 | error = smb_proc_getattr(dentry, &finfo); |
439 | #ifdef SMBFS_PARANOIA | 444 | #ifdef SMBFS_PARANOIA |
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c index c71c375863cc..c71dd2760d32 100644 --- a/fs/smbfs/request.c +++ b/fs/smbfs/request.c | |||
@@ -339,9 +339,11 @@ int smb_add_request(struct smb_request *req) | |||
339 | /* | 339 | /* |
340 | * On timeout or on interrupt we want to try and remove the | 340 | * On timeout or on interrupt we want to try and remove the |
341 | * request from the recvq/xmitq. | 341 | * request from the recvq/xmitq. |
342 | * First check if the request is still part of a queue. (May | ||
343 | * have been removed by some error condition) | ||
342 | */ | 344 | */ |
343 | smb_lock_server(server); | 345 | smb_lock_server(server); |
344 | if (!(req->rq_flags & SMB_REQ_RECEIVED)) { | 346 | if (!list_empty(&req->rq_queue)) { |
345 | list_del_init(&req->rq_queue); | 347 | list_del_init(&req->rq_queue); |
346 | smb_rput(req); | 348 | smb_rput(req); |
347 | } | 349 | } |
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index e27dc8f29972..b9beceb33141 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h | |||
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 64 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
65 | 65 | ||
66 | #define ACPI_CA_VERSION 0x20060127 | 66 | #define ACPI_CA_VERSION 0x20060608 |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | 69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, |
@@ -81,6 +81,7 @@ | |||
81 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ | 81 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ |
82 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ | 82 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ |
83 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ | 83 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ |
84 | #define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ | ||
84 | 85 | ||
85 | /* | 86 | /* |
86 | * Should the subsystem abort the loading of an ACPI table if the | 87 | * Should the subsystem abort the loading of an ACPI table if the |
@@ -102,9 +103,9 @@ | |||
102 | 103 | ||
103 | #define ACPI_MAX_SEMAPHORE_COUNT 256 | 104 | #define ACPI_MAX_SEMAPHORE_COUNT 256 |
104 | 105 | ||
105 | /* Max reference count (for debug only) */ | 106 | /* Maximum object reference count (detects object deletion issues) */ |
106 | 107 | ||
107 | #define ACPI_MAX_REFERENCE_COUNT 0x400 | 108 | #define ACPI_MAX_REFERENCE_COUNT 0x800 |
108 | 109 | ||
109 | /* Size of cached memory mapping for system memory operation region */ | 110 | /* Size of cached memory mapping for system memory operation region */ |
110 | 111 | ||
@@ -171,12 +172,7 @@ | |||
171 | 172 | ||
172 | /* Array sizes. Used for range checking also */ | 173 | /* Array sizes. Used for range checking also */ |
173 | 174 | ||
174 | #define ACPI_NUM_ACCESS_TYPES 6 | 175 | #define ACPI_MAX_MATCH_OPCODE 5 |
175 | #define ACPI_NUM_UPDATE_RULES 3 | ||
176 | #define ACPI_NUM_LOCK_RULES 2 | ||
177 | #define ACPI_NUM_MATCH_OPS 6 | ||
178 | #define ACPI_NUM_OPCODES 256 | ||
179 | #define ACPI_NUM_FIELD_NAMES 2 | ||
180 | 176 | ||
181 | /* RSDP checksums */ | 177 | /* RSDP checksums */ |
182 | 178 | ||
@@ -187,10 +183,6 @@ | |||
187 | 183 | ||
188 | #define ACPI_SMBUS_BUFFER_SIZE 34 | 184 | #define ACPI_SMBUS_BUFFER_SIZE 34 |
189 | 185 | ||
190 | /* Number of strings associated with the _OSI reserved method */ | ||
191 | |||
192 | #define ACPI_NUM_OSI_STRINGS 10 | ||
193 | |||
194 | /****************************************************************************** | 186 | /****************************************************************************** |
195 | * | 187 | * |
196 | * ACPI AML Debugger | 188 | * ACPI AML Debugger |
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 11a8fe39cb04..9a7d6921f534 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h | |||
@@ -50,26 +50,72 @@ | |||
50 | #define BLOCK_PAREN 1 | 50 | #define BLOCK_PAREN 1 |
51 | #define BLOCK_BRACE 2 | 51 | #define BLOCK_BRACE 2 |
52 | #define BLOCK_COMMA_LIST 4 | 52 | #define BLOCK_COMMA_LIST 4 |
53 | #define ACPI_DEFAULT_RESNAME *(u32 *) "__RD" | ||
53 | 54 | ||
54 | struct acpi_external_list { | 55 | struct acpi_external_list { |
55 | char *path; | 56 | char *path; |
57 | char *internal_path; | ||
56 | struct acpi_external_list *next; | 58 | struct acpi_external_list *next; |
59 | u32 value; | ||
60 | u16 length; | ||
61 | u8 type; | ||
57 | }; | 62 | }; |
58 | 63 | ||
59 | extern struct acpi_external_list *acpi_gbl_external_list; | 64 | extern struct acpi_external_list *acpi_gbl_external_list; |
60 | 65 | ||
61 | /* Strings used for decoding flags to ASL keywords */ | 66 | typedef const struct acpi_dmtable_info { |
67 | u8 opcode; | ||
68 | u8 offset; | ||
69 | char *name; | ||
70 | |||
71 | } acpi_dmtable_info; | ||
72 | |||
73 | /* | ||
74 | * Values for Opcode above. | ||
75 | * Note: 0-7 must not change, used as a flag shift value | ||
76 | */ | ||
77 | #define ACPI_DMT_FLAG0 0 | ||
78 | #define ACPI_DMT_FLAG1 1 | ||
79 | #define ACPI_DMT_FLAG2 2 | ||
80 | #define ACPI_DMT_FLAG3 3 | ||
81 | #define ACPI_DMT_FLAG4 4 | ||
82 | #define ACPI_DMT_FLAG5 5 | ||
83 | #define ACPI_DMT_FLAG6 6 | ||
84 | #define ACPI_DMT_FLAG7 7 | ||
85 | #define ACPI_DMT_FLAGS0 8 | ||
86 | #define ACPI_DMT_FLAGS2 9 | ||
87 | #define ACPI_DMT_UINT8 10 | ||
88 | #define ACPI_DMT_UINT16 11 | ||
89 | #define ACPI_DMT_UINT24 12 | ||
90 | #define ACPI_DMT_UINT32 13 | ||
91 | #define ACPI_DMT_UINT56 14 | ||
92 | #define ACPI_DMT_UINT64 15 | ||
93 | #define ACPI_DMT_STRING 16 | ||
94 | #define ACPI_DMT_NAME4 17 | ||
95 | #define ACPI_DMT_NAME6 18 | ||
96 | #define ACPI_DMT_NAME8 19 | ||
97 | #define ACPI_DMT_CHKSUM 20 | ||
98 | #define ACPI_DMT_SPACEID 21 | ||
99 | #define ACPI_DMT_GAS 22 | ||
100 | #define ACPI_DMT_MADT 23 | ||
101 | #define ACPI_DMT_SRAT 24 | ||
102 | #define ACPI_DMT_EXIT 25 | ||
62 | 103 | ||
63 | extern const char *acpi_gbl_word_decode[4]; | 104 | typedef |
64 | extern const char *acpi_gbl_irq_decode[2]; | 105 | void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table); |
65 | extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; | 106 | |
66 | extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; | 107 | struct acpi_dmtable_data { |
67 | extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; | 108 | char *signature; |
68 | extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; | 109 | struct acpi_dmtable_info *table_info; |
110 | ACPI_TABLE_HANDLER table_handler; | ||
111 | }; | ||
69 | 112 | ||
70 | struct acpi_op_walk_info { | 113 | struct acpi_op_walk_info { |
71 | u32 level; | 114 | u32 level; |
115 | u32 last_level; | ||
116 | u32 count; | ||
72 | u32 bit_offset; | 117 | u32 bit_offset; |
118 | u32 flags; | ||
73 | struct acpi_walk_state *walk_state; | 119 | struct acpi_walk_state *walk_state; |
74 | }; | 120 | }; |
75 | 121 | ||
@@ -77,6 +123,100 @@ typedef | |||
77 | acpi_status(*asl_walk_callback) (union acpi_parse_object * op, | 123 | acpi_status(*asl_walk_callback) (union acpi_parse_object * op, |
78 | u32 level, void *context); | 124 | u32 level, void *context); |
79 | 125 | ||
126 | struct acpi_resource_tag { | ||
127 | u32 bit_index; | ||
128 | char *tag; | ||
129 | }; | ||
130 | |||
131 | /* Strings used for decoding flags to ASL keywords */ | ||
132 | |||
133 | extern const char *acpi_gbl_word_decode[]; | ||
134 | extern const char *acpi_gbl_irq_decode[]; | ||
135 | extern const char *acpi_gbl_lock_rule[]; | ||
136 | extern const char *acpi_gbl_access_types[]; | ||
137 | extern const char *acpi_gbl_update_rules[]; | ||
138 | extern const char *acpi_gbl_match_ops[]; | ||
139 | |||
140 | extern struct acpi_dmtable_info acpi_dm_table_info_asf0[]; | ||
141 | extern struct acpi_dmtable_info acpi_dm_table_info_asf1[]; | ||
142 | extern struct acpi_dmtable_info acpi_dm_table_info_asf2[]; | ||
143 | extern struct acpi_dmtable_info acpi_dm_table_info_asf3[]; | ||
144 | extern struct acpi_dmtable_info acpi_dm_table_info_asf4[]; | ||
145 | extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[]; | ||
146 | extern struct acpi_dmtable_info acpi_dm_table_info_boot[]; | ||
147 | extern struct acpi_dmtable_info acpi_dm_table_info_cpep[]; | ||
148 | extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[]; | ||
149 | extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; | ||
150 | extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[]; | ||
151 | extern struct acpi_dmtable_info acpi_dm_table_info_facs[]; | ||
152 | extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[]; | ||
153 | extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[]; | ||
154 | extern struct acpi_dmtable_info acpi_dm_table_info_gas[]; | ||
155 | extern struct acpi_dmtable_info acpi_dm_table_info_header[]; | ||
156 | extern struct acpi_dmtable_info acpi_dm_table_info_hpet[]; | ||
157 | extern struct acpi_dmtable_info acpi_dm_table_info_madt[]; | ||
158 | extern struct acpi_dmtable_info acpi_dm_table_info_madt0[]; | ||
159 | extern struct acpi_dmtable_info acpi_dm_table_info_madt1[]; | ||
160 | extern struct acpi_dmtable_info acpi_dm_table_info_madt2[]; | ||
161 | extern struct acpi_dmtable_info acpi_dm_table_info_madt3[]; | ||
162 | extern struct acpi_dmtable_info acpi_dm_table_info_madt4[]; | ||
163 | extern struct acpi_dmtable_info acpi_dm_table_info_madt5[]; | ||
164 | extern struct acpi_dmtable_info acpi_dm_table_info_madt6[]; | ||
165 | extern struct acpi_dmtable_info acpi_dm_table_info_madt7[]; | ||
166 | extern struct acpi_dmtable_info acpi_dm_table_info_madt8[]; | ||
167 | extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[]; | ||
168 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[]; | ||
169 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; | ||
170 | extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[]; | ||
171 | extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[]; | ||
172 | extern struct acpi_dmtable_info acpi_dm_table_info_sbst[]; | ||
173 | extern struct acpi_dmtable_info acpi_dm_table_info_slit[]; | ||
174 | extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; | ||
175 | extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; | ||
176 | extern struct acpi_dmtable_info acpi_dm_table_info_srat[]; | ||
177 | extern struct acpi_dmtable_info acpi_dm_table_info_srat0[]; | ||
178 | extern struct acpi_dmtable_info acpi_dm_table_info_srat1[]; | ||
179 | extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[]; | ||
180 | extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; | ||
181 | |||
182 | /* | ||
183 | * dmtable | ||
184 | */ | ||
185 | void acpi_dm_dump_data_table(struct acpi_table_header *table); | ||
186 | |||
187 | void | ||
188 | acpi_dm_dump_table(u32 table_length, | ||
189 | u32 table_offset, | ||
190 | void *table, | ||
191 | u32 sub_table_length, struct acpi_dmtable_info *info); | ||
192 | |||
193 | void acpi_dm_line_header(u32 offset, u32 byte_length, char *name); | ||
194 | |||
195 | void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value); | ||
196 | |||
197 | /* | ||
198 | * dmtbdump | ||
199 | */ | ||
200 | void acpi_dm_dump_asf(struct acpi_table_header *table); | ||
201 | |||
202 | void acpi_dm_dump_cpep(struct acpi_table_header *table); | ||
203 | |||
204 | void acpi_dm_dump_fadt(struct acpi_table_header *table); | ||
205 | |||
206 | void acpi_dm_dump_srat(struct acpi_table_header *table); | ||
207 | |||
208 | void acpi_dm_dump_mcfg(struct acpi_table_header *table); | ||
209 | |||
210 | void acpi_dm_dump_madt(struct acpi_table_header *table); | ||
211 | |||
212 | u32 acpi_dm_dump_rsdp(struct acpi_table_header *table); | ||
213 | |||
214 | void acpi_dm_dump_rsdt(struct acpi_table_header *table); | ||
215 | |||
216 | void acpi_dm_dump_slit(struct acpi_table_header *table); | ||
217 | |||
218 | void acpi_dm_dump_xsdt(struct acpi_table_header *table); | ||
219 | |||
80 | /* | 220 | /* |
81 | * dmwalk | 221 | * dmwalk |
82 | */ | 222 | */ |
@@ -84,6 +224,11 @@ void | |||
84 | acpi_dm_disassemble(struct acpi_walk_state *walk_state, | 224 | acpi_dm_disassemble(struct acpi_walk_state *walk_state, |
85 | union acpi_parse_object *origin, u32 num_opcodes); | 225 | union acpi_parse_object *origin, u32 num_opcodes); |
86 | 226 | ||
227 | void | ||
228 | acpi_dm_walk_parse_tree(union acpi_parse_object *op, | ||
229 | asl_walk_callback descending_callback, | ||
230 | asl_walk_callback ascending_callback, void *context); | ||
231 | |||
87 | /* | 232 | /* |
88 | * dmopcode | 233 | * dmopcode |
89 | */ | 234 | */ |
@@ -166,6 +311,7 @@ void acpi_dm_dump_integer64(u64 value, char *name); | |||
166 | 311 | ||
167 | void | 312 | void |
168 | acpi_dm_resource_template(struct acpi_op_walk_info *info, | 313 | acpi_dm_resource_template(struct acpi_op_walk_info *info, |
314 | union acpi_parse_object *op, | ||
169 | u8 * byte_data, u32 byte_count); | 315 | u8 * byte_data, u32 byte_count); |
170 | 316 | ||
171 | u8 acpi_dm_is_resource_template(union acpi_parse_object *op); | 317 | u8 acpi_dm_is_resource_template(union acpi_parse_object *op); |
@@ -176,6 +322,8 @@ void acpi_dm_bit_list(u16 mask); | |||
176 | 322 | ||
177 | void acpi_dm_decode_attribute(u8 attribute); | 323 | void acpi_dm_decode_attribute(u8 attribute); |
178 | 324 | ||
325 | void acpi_dm_descriptor_name(void); | ||
326 | |||
179 | /* | 327 | /* |
180 | * dmresrcl | 328 | * dmresrcl |
181 | */ | 329 | */ |
@@ -248,6 +396,15 @@ acpi_dm_vendor_small_descriptor(union aml_resource *resource, | |||
248 | /* | 396 | /* |
249 | * dmutils | 397 | * dmutils |
250 | */ | 398 | */ |
251 | void acpi_dm_add_to_external_list(char *path); | 399 | void acpi_dm_add_to_external_list(char *path, u8 type, u32 value); |
400 | |||
401 | /* | ||
402 | * dmrestag | ||
403 | */ | ||
404 | void acpi_dm_find_resources(union acpi_parse_object *root); | ||
405 | |||
406 | void | ||
407 | acpi_dm_check_resource_reference(union acpi_parse_object *op, | ||
408 | struct acpi_walk_state *walk_state); | ||
252 | 409 | ||
253 | #endif /* __ACDISASM_H__ */ | 410 | #endif /* __ACDISASM_H__ */ |
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index c41a926ff317..288f84903af7 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h | |||
@@ -194,7 +194,9 @@ acpi_status | |||
194 | acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | 194 | acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, |
195 | union acpi_operand_object *return_desc); | 195 | union acpi_operand_object *return_desc); |
196 | 196 | ||
197 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); | 197 | void |
198 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | ||
199 | struct acpi_walk_state *walk_state); | ||
198 | 200 | ||
199 | acpi_status | 201 | acpi_status |
200 | acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | 202 | acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, |
@@ -302,7 +304,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
302 | struct acpi_namespace_node *method_node, | 304 | struct acpi_namespace_node *method_node, |
303 | u8 * aml_start, | 305 | u8 * aml_start, |
304 | u32 aml_length, | 306 | u32 aml_length, |
305 | struct acpi_parameter_info *info, u8 pass_number); | 307 | struct acpi_evaluate_info *info, u8 pass_number); |
306 | 308 | ||
307 | acpi_status | 309 | acpi_status |
308 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | 310 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, |
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index f2717be4fe0d..234142828e1a 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h | |||
@@ -93,7 +93,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
93 | */ | 93 | */ |
94 | u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); | 94 | u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); |
95 | 95 | ||
96 | acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback); | 96 | acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback); |
97 | 97 | ||
98 | acpi_status | 98 | acpi_status |
99 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 99 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
@@ -138,7 +138,7 @@ acpi_status | |||
138 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 138 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
139 | u32 function, | 139 | u32 function, |
140 | acpi_physical_address address, | 140 | acpi_physical_address address, |
141 | u32 bit_width, void *value); | 141 | u32 bit_width, acpi_integer * value); |
142 | 142 | ||
143 | acpi_status | 143 | acpi_status |
144 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, | 144 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, |
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index dc768aa580e4..797ca1ea5214 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
@@ -160,8 +160,9 @@ | |||
160 | #define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) | 160 | #define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) |
161 | #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) | 161 | #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) |
162 | #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) | 162 | #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) |
163 | #define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0022 | AE_CODE_AML) | ||
163 | 164 | ||
164 | #define AE_CODE_AML_MAX 0x0021 | 165 | #define AE_CODE_AML_MAX 0x0022 |
165 | 166 | ||
166 | /* | 167 | /* |
167 | * Internal exceptions used for control | 168 | * Internal exceptions used for control |
@@ -275,7 +276,8 @@ char const *acpi_gbl_exception_names_aml[] = { | |||
275 | "AE_AML_NO_RESOURCE_END_TAG", | 276 | "AE_AML_NO_RESOURCE_END_TAG", |
276 | "AE_AML_BAD_RESOURCE_VALUE", | 277 | "AE_AML_BAD_RESOURCE_VALUE", |
277 | "AE_AML_CIRCULAR_REFERENCE", | 278 | "AE_AML_CIRCULAR_REFERENCE", |
278 | "AE_AML_BAD_RESOURCE_LENGTH" | 279 | "AE_AML_BAD_RESOURCE_LENGTH", |
280 | "AE_AML_ILLEGAL_ADDRESS" | ||
279 | }; | 281 | }; |
280 | 282 | ||
281 | char const *acpi_gbl_exception_names_ctrl[] = { | 283 | char const *acpi_gbl_exception_names_ctrl[] = { |
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 734cc77bf2c7..14531d48f6b6 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h | |||
@@ -107,6 +107,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags; | |||
107 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) | 107 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) |
108 | * 4) Allow ANY object type to be a source operand for the Store() operator | 108 | * 4) Allow ANY object type to be a source operand for the Store() operator |
109 | * 5) Allow unresolved references (invalid target name) in package objects | 109 | * 5) Allow unresolved references (invalid target name) in package objects |
110 | * 6) Enable warning messages for behavior that is not ACPI spec compliant | ||
110 | */ | 111 | */ |
111 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); | 112 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); |
112 | 113 | ||
@@ -114,7 +115,7 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); | |||
114 | * Automatically serialize ALL control methods? Default is FALSE, meaning | 115 | * Automatically serialize ALL control methods? Default is FALSE, meaning |
115 | * to use the Serialized/not_serialized method flags on a per method basis. | 116 | * to use the Serialized/not_serialized method flags on a per method basis. |
116 | * Only change this if the ASL code is poorly written and cannot handle | 117 | * Only change this if the ASL code is poorly written and cannot handle |
117 | * reentrancy even though methods are marked "not_serialized". | 118 | * reentrancy even though methods are marked "NotSerialized". |
118 | */ | 119 | */ |
119 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); | 120 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); |
120 | 121 | ||
@@ -149,10 +150,10 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); | |||
149 | ACPI_EXTERN u32 acpi_gbl_table_flags; | 150 | ACPI_EXTERN u32 acpi_gbl_table_flags; |
150 | ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; | 151 | ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; |
151 | ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; | 152 | ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; |
152 | ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; | 153 | ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT; |
153 | ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; | 154 | ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT; |
154 | ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; | 155 | ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; |
155 | ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; | 156 | ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS; |
156 | ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; | 157 | ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; |
157 | /* | 158 | /* |
158 | * Since there may be multiple SSDTs and PSDTs, a single pointer is not | 159 | * Since there may be multiple SSDTs and PSDTs, a single pointer is not |
@@ -177,15 +178,15 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | |||
177 | /* | 178 | /* |
178 | * ACPI Table info arrays | 179 | * ACPI Table info arrays |
179 | */ | 180 | */ |
180 | extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; | 181 | extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; |
181 | extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; | 182 | extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1]; |
182 | 183 | ||
183 | /* | 184 | /* |
184 | * Predefined mutex objects. This array contains the | 185 | * Predefined mutex objects. This array contains the |
185 | * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. | 186 | * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. |
186 | * (The table maps local handles to the real OS handles) | 187 | * (The table maps local handles to the real OS handles) |
187 | */ | 188 | */ |
188 | ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; | 189 | ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX]; |
189 | 190 | ||
190 | /***************************************************************************** | 191 | /***************************************************************************** |
191 | * | 192 | * |
@@ -203,6 +204,7 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; | |||
203 | 204 | ||
204 | /* Object caches */ | 205 | /* Object caches */ |
205 | 206 | ||
207 | ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache; | ||
206 | ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; | 208 | ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; |
207 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; | 209 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; |
208 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; | 210 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; |
@@ -244,7 +246,6 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; | |||
244 | extern const char *acpi_gbl_highest_dstate_names[4]; | 246 | extern const char *acpi_gbl_highest_dstate_names[4]; |
245 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; | 247 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; |
246 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; | 248 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; |
247 | extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS]; | ||
248 | 249 | ||
249 | /***************************************************************************** | 250 | /***************************************************************************** |
250 | * | 251 | * |
@@ -291,14 +292,6 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step; | |||
291 | 292 | ||
292 | /***************************************************************************** | 293 | /***************************************************************************** |
293 | * | 294 | * |
294 | * Parser globals | ||
295 | * | ||
296 | ****************************************************************************/ | ||
297 | |||
298 | ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; | ||
299 | |||
300 | /***************************************************************************** | ||
301 | * | ||
302 | * Hardware globals | 295 | * Hardware globals |
303 | * | 296 | * |
304 | ****************************************************************************/ | 297 | ****************************************************************************/ |
@@ -321,7 +314,11 @@ ACPI_EXTERN struct acpi_fixed_event_handler | |||
321 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; | 314 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; |
322 | ACPI_EXTERN struct acpi_gpe_block_info | 315 | ACPI_EXTERN struct acpi_gpe_block_info |
323 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; | 316 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; |
317 | |||
318 | /* Spinlocks */ | ||
319 | |||
324 | ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; | 320 | ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; |
321 | ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock; | ||
325 | 322 | ||
326 | /***************************************************************************** | 323 | /***************************************************************************** |
327 | * | 324 | * |
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 8361820d2970..1eeca7adca95 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h | |||
@@ -44,7 +44,10 @@ | |||
44 | #ifndef __ACLOCAL_H__ | 44 | #ifndef __ACLOCAL_H__ |
45 | #define __ACLOCAL_H__ | 45 | #define __ACLOCAL_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ | 49 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ |
50 | #define ACPI_INFINITE_CONCURRENCY 0xFF | ||
48 | 51 | ||
49 | typedef void *acpi_mutex; | 52 | typedef void *acpi_mutex; |
50 | typedef u32 acpi_mutex_handle; | 53 | typedef u32 acpi_mutex_handle; |
@@ -69,52 +72,55 @@ union acpi_parse_object; | |||
69 | * Predefined handles for the mutex objects used within the subsystem | 72 | * Predefined handles for the mutex objects used within the subsystem |
70 | * All mutex objects are automatically created by acpi_ut_mutex_initialize. | 73 | * All mutex objects are automatically created by acpi_ut_mutex_initialize. |
71 | * | 74 | * |
72 | * The acquire/release ordering protocol is implied via this list. Mutexes | 75 | * The acquire/release ordering protocol is implied via this list. Mutexes |
73 | * with a lower value must be acquired before mutexes with a higher value. | 76 | * with a lower value must be acquired before mutexes with a higher value. |
74 | * | 77 | * |
75 | * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! | 78 | * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names |
79 | * table below also! | ||
76 | */ | 80 | */ |
77 | #define ACPI_MTX_EXECUTE 0 | 81 | #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ |
78 | #define ACPI_MTX_INTERPRETER 1 | 82 | #define ACPI_MTX_CONTROL_METHOD 1 /* Control method termination [TBD: may no longer be necessary] */ |
79 | #define ACPI_MTX_PARSER 2 | 83 | #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ |
80 | #define ACPI_MTX_DISPATCHER 3 | 84 | #define ACPI_MTX_NAMESPACE 3 /* ACPI Namespace */ |
81 | #define ACPI_MTX_TABLES 4 | 85 | #define ACPI_MTX_EVENTS 4 /* Data for ACPI events */ |
82 | #define ACPI_MTX_OP_REGIONS 5 | 86 | #define ACPI_MTX_CACHES 5 /* Internal caches, general purposes */ |
83 | #define ACPI_MTX_NAMESPACE 6 | 87 | #define ACPI_MTX_MEMORY 6 /* Debug memory tracking lists */ |
84 | #define ACPI_MTX_EVENTS 7 | 88 | #define ACPI_MTX_DEBUG_CMD_COMPLETE 7 /* AML debugger */ |
85 | #define ACPI_MTX_HARDWARE 8 | 89 | #define ACPI_MTX_DEBUG_CMD_READY 8 /* AML debugger */ |
86 | #define ACPI_MTX_CACHES 9 | 90 | |
87 | #define ACPI_MTX_MEMORY 10 | 91 | #define ACPI_MAX_MUTEX 8 |
88 | #define ACPI_MTX_DEBUG_CMD_COMPLETE 11 | 92 | #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 |
89 | #define ACPI_MTX_DEBUG_CMD_READY 12 | ||
90 | |||
91 | #define MAX_MUTEX 12 | ||
92 | #define NUM_MUTEX MAX_MUTEX+1 | ||
93 | 93 | ||
94 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 94 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
95 | #ifdef DEFINE_ACPI_GLOBALS | 95 | #ifdef DEFINE_ACPI_GLOBALS |
96 | 96 | ||
97 | /* Names for the mutexes used in the subsystem */ | 97 | /* Debug names for the mutexes above */ |
98 | 98 | ||
99 | static char *acpi_gbl_mutex_names[] = { | 99 | static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { |
100 | "ACPI_MTX_Execute", | ||
101 | "ACPI_MTX_Interpreter", | 100 | "ACPI_MTX_Interpreter", |
102 | "ACPI_MTX_Parser", | 101 | "ACPI_MTX_Method", |
103 | "ACPI_MTX_Dispatcher", | ||
104 | "ACPI_MTX_Tables", | 102 | "ACPI_MTX_Tables", |
105 | "ACPI_MTX_op_regions", | ||
106 | "ACPI_MTX_Namespace", | 103 | "ACPI_MTX_Namespace", |
107 | "ACPI_MTX_Events", | 104 | "ACPI_MTX_Events", |
108 | "ACPI_MTX_Hardware", | ||
109 | "ACPI_MTX_Caches", | 105 | "ACPI_MTX_Caches", |
110 | "ACPI_MTX_Memory", | 106 | "ACPI_MTX_Memory", |
111 | "ACPI_MTX_debug_cmd_complete", | 107 | "ACPI_MTX_DebugCmdComplete", |
112 | "ACPI_MTX_debug_cmd_ready", | 108 | "ACPI_MTX_DebugCmdReady" |
113 | }; | 109 | }; |
114 | 110 | ||
115 | #endif | 111 | #endif |
116 | #endif | 112 | #endif |
117 | 113 | ||
114 | /* | ||
115 | * Predefined handles for spinlocks used within the subsystem. | ||
116 | * These spinlocks are created by acpi_ut_mutex_initialize | ||
117 | */ | ||
118 | #define ACPI_LOCK_GPES 0 | ||
119 | #define ACPI_LOCK_HARDWARE 1 | ||
120 | |||
121 | #define ACPI_MAX_LOCK 1 | ||
122 | #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 | ||
123 | |||
118 | /* Owner IDs are used to track namespace nodes for selective deletion */ | 124 | /* Owner IDs are used to track namespace nodes for selective deletion */ |
119 | 125 | ||
120 | typedef u8 acpi_owner_id; | 126 | typedef u8 acpi_owner_id; |
@@ -129,7 +135,7 @@ typedef u8 acpi_owner_id; | |||
129 | struct acpi_mutex_info { | 135 | struct acpi_mutex_info { |
130 | acpi_mutex mutex; | 136 | acpi_mutex mutex; |
131 | u32 use_count; | 137 | u32 use_count; |
132 | u32 thread_id; | 138 | acpi_thread_id thread_id; |
133 | }; | 139 | }; |
134 | 140 | ||
135 | /* Lock flag parameter for various interfaces */ | 141 | /* Lock flag parameter for various interfaces */ |
@@ -144,6 +150,8 @@ struct acpi_mutex_info { | |||
144 | #define ACPI_FIELD_DWORD_GRANULARITY 4 | 150 | #define ACPI_FIELD_DWORD_GRANULARITY 4 |
145 | #define ACPI_FIELD_QWORD_GRANULARITY 8 | 151 | #define ACPI_FIELD_QWORD_GRANULARITY 8 |
146 | 152 | ||
153 | #define ACPI_ENTRY_NOT_FOUND NULL | ||
154 | |||
147 | /***************************************************************************** | 155 | /***************************************************************************** |
148 | * | 156 | * |
149 | * Namespace typedefs and structs | 157 | * Namespace typedefs and structs |
@@ -158,49 +166,55 @@ typedef enum { | |||
158 | ACPI_IMODE_EXECUTE = 0x0E | 166 | ACPI_IMODE_EXECUTE = 0x0E |
159 | } acpi_interpreter_mode; | 167 | } acpi_interpreter_mode; |
160 | 168 | ||
161 | /* | ||
162 | * The Node describes a named object that appears in the AML | ||
163 | * An acpi_node is used to store Nodes. | ||
164 | * | ||
165 | * data_type is used to differentiate between internal descriptors, and MUST | ||
166 | * be the first byte in this structure. | ||
167 | */ | ||
168 | union acpi_name_union { | 169 | union acpi_name_union { |
169 | u32 integer; | 170 | u32 integer; |
170 | char ascii[4]; | 171 | char ascii[4]; |
171 | }; | 172 | }; |
172 | 173 | ||
174 | /* | ||
175 | * The Namespace Node describes a named object that appears in the AML. | ||
176 | * descriptor_type is used to differentiate between internal descriptors. | ||
177 | * | ||
178 | * The node is optimized for both 32-bit and 64-bit platforms: | ||
179 | * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. | ||
180 | * | ||
181 | * Note: The descriptor_type and Type fields must appear in the identical | ||
182 | * position in both the struct acpi_namespace_node and union acpi_operand_object | ||
183 | * structures. | ||
184 | */ | ||
173 | struct acpi_namespace_node { | 185 | struct acpi_namespace_node { |
174 | u8 descriptor; /* Used to differentiate object descriptor types */ | 186 | union acpi_operand_object *object; /* Interpreter object */ |
175 | u8 type; /* Type associated with this name */ | 187 | u8 descriptor_type; /* Differentiate object descriptor types */ |
176 | u16 reference_count; /* Current count of references and children */ | 188 | u8 type; /* ACPI Type associated with this name */ |
189 | u8 flags; /* Miscellaneous flags */ | ||
190 | acpi_owner_id owner_id; /* Node creator */ | ||
177 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ | 191 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ |
178 | union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ | ||
179 | struct acpi_namespace_node *child; /* First child */ | 192 | struct acpi_namespace_node *child; /* First child */ |
180 | struct acpi_namespace_node *peer; /* Next peer */ | 193 | struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ |
181 | u8 owner_id; /* Who created this node */ | ||
182 | u8 flags; | ||
183 | |||
184 | /* Fields used by the ASL compiler only */ | ||
185 | 194 | ||
186 | #ifdef ACPI_ASL_COMPILER | 195 | /* |
187 | u32 value; | 196 | * The following fields are used by the ASL compiler and disassembler only |
197 | */ | ||
198 | #ifdef ACPI_LARGE_NAMESPACE_NODE | ||
188 | union acpi_parse_object *op; | 199 | union acpi_parse_object *op; |
200 | u32 value; | ||
201 | u32 length; | ||
189 | #endif | 202 | #endif |
190 | }; | 203 | }; |
191 | 204 | ||
192 | #define ACPI_ENTRY_NOT_FOUND NULL | 205 | /* Namespace Node flags */ |
193 | 206 | ||
194 | /* Node flags */ | 207 | #define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ |
208 | #define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */ | ||
209 | #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ | ||
210 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ | ||
211 | #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ | ||
195 | 212 | ||
196 | #define ANOBJ_RESERVED 0x01 | 213 | #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ |
197 | #define ANOBJ_END_OF_PEER_LIST 0x02 | 214 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ |
198 | #define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ | 215 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */ |
199 | #define ANOBJ_METHOD_ARG 0x08 | 216 | #define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ |
200 | #define ANOBJ_METHOD_LOCAL 0x10 | 217 | #define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */ |
201 | #define ANOBJ_METHOD_NO_RETVAL 0x20 | ||
202 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 | ||
203 | #define ANOBJ_IS_BIT_OFFSET 0x80 | ||
204 | 218 | ||
205 | /* | 219 | /* |
206 | * ACPI Table Descriptor. One per ACPI table | 220 | * ACPI Table Descriptor. One per ACPI table |
@@ -212,8 +226,8 @@ struct acpi_table_desc { | |||
212 | struct acpi_table_header *pointer; | 226 | struct acpi_table_header *pointer; |
213 | u8 *aml_start; | 227 | u8 *aml_start; |
214 | u64 physical_address; | 228 | u64 physical_address; |
215 | u32 aml_length; | ||
216 | acpi_size length; | 229 | acpi_size length; |
230 | u32 aml_length; | ||
217 | acpi_owner_id owner_id; | 231 | acpi_owner_id owner_id; |
218 | u8 type; | 232 | u8 type; |
219 | u8 allocation; | 233 | u8 allocation; |
@@ -276,6 +290,9 @@ struct acpi_create_field_info { | |||
276 | u8 field_type; | 290 | u8 field_type; |
277 | }; | 291 | }; |
278 | 292 | ||
293 | typedef | ||
294 | acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); | ||
295 | |||
279 | /* | 296 | /* |
280 | * Bitmapped ACPI types. Used internally only | 297 | * Bitmapped ACPI types. Used internally only |
281 | */ | 298 | */ |
@@ -377,7 +394,7 @@ struct acpi_gpe_walk_info { | |||
377 | struct acpi_gpe_block_info *gpe_block; | 394 | struct acpi_gpe_block_info *gpe_block; |
378 | }; | 395 | }; |
379 | 396 | ||
380 | typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info * | 397 | typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info * |
381 | gpe_xrupt_info, | 398 | gpe_xrupt_info, |
382 | struct acpi_gpe_block_info * | 399 | struct acpi_gpe_block_info * |
383 | gpe_block); | 400 | gpe_block); |
@@ -416,13 +433,14 @@ struct acpi_field_info { | |||
416 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 | 433 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 |
417 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 | 434 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 |
418 | 435 | ||
419 | #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ | 436 | #define ACPI_STATE_COMMON \ |
420 | u8 data_type; /* To differentiate various internal objs */\ | 437 | void *next; \ |
421 | u8 flags; \ | 438 | u8 descriptor_type; /* To differentiate various internal objs */\ |
422 | u16 value; \ | 439 | u8 flags; \ |
423 | u16 state; \ | 440 | u16 value; \ |
424 | u16 reserved; \ | 441 | u16 state; |
425 | void *next; | 442 | |
443 | /* There are 2 bytes available here until the next natural alignment boundary */ | ||
426 | 444 | ||
427 | struct acpi_common_state { | 445 | struct acpi_common_state { |
428 | ACPI_STATE_COMMON}; | 446 | ACPI_STATE_COMMON}; |
@@ -438,12 +456,12 @@ struct acpi_update_state { | |||
438 | * Pkg state - used to traverse nested package structures | 456 | * Pkg state - used to traverse nested package structures |
439 | */ | 457 | */ |
440 | struct acpi_pkg_state { | 458 | struct acpi_pkg_state { |
441 | ACPI_STATE_COMMON union acpi_operand_object *source_object; | 459 | ACPI_STATE_COMMON u16 index; |
460 | union acpi_operand_object *source_object; | ||
442 | union acpi_operand_object *dest_object; | 461 | union acpi_operand_object *dest_object; |
443 | struct acpi_walk_state *walk_state; | 462 | struct acpi_walk_state *walk_state; |
444 | void *this_target_obj; | 463 | void *this_target_obj; |
445 | u32 num_packages; | 464 | u32 num_packages; |
446 | u16 index; | ||
447 | }; | 465 | }; |
448 | 466 | ||
449 | /* | 467 | /* |
@@ -451,10 +469,10 @@ struct acpi_pkg_state { | |||
451 | * Allows nesting of these constructs | 469 | * Allows nesting of these constructs |
452 | */ | 470 | */ |
453 | struct acpi_control_state { | 471 | struct acpi_control_state { |
454 | ACPI_STATE_COMMON union acpi_parse_object *predicate_op; | 472 | ACPI_STATE_COMMON u16 opcode; |
473 | union acpi_parse_object *predicate_op; | ||
455 | u8 *aml_predicate_start; /* Start of if/while predicate */ | 474 | u8 *aml_predicate_start; /* Start of if/while predicate */ |
456 | u8 *package_end; /* End of if/while block */ | 475 | u8 *package_end; /* End of if/while block */ |
457 | u16 opcode; | ||
458 | }; | 476 | }; |
459 | 477 | ||
460 | /* | 478 | /* |
@@ -465,11 +483,11 @@ struct acpi_scope_state { | |||
465 | }; | 483 | }; |
466 | 484 | ||
467 | struct acpi_pscope_state { | 485 | struct acpi_pscope_state { |
468 | ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */ | 486 | ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */ |
487 | union acpi_parse_object *op; /* Current op being parsed */ | ||
469 | u8 *arg_end; /* Current argument end */ | 488 | u8 *arg_end; /* Current argument end */ |
470 | u8 *pkg_end; /* Current package end */ | 489 | u8 *pkg_end; /* Current package end */ |
471 | u32 arg_list; /* Next argument to parse */ | 490 | u32 arg_list; /* Next argument to parse */ |
472 | u32 arg_count; /* Number of fixed arguments */ | ||
473 | }; | 491 | }; |
474 | 492 | ||
475 | /* | 493 | /* |
@@ -477,10 +495,10 @@ struct acpi_pscope_state { | |||
477 | * states are created when there are nested control methods executing. | 495 | * states are created when there are nested control methods executing. |
478 | */ | 496 | */ |
479 | struct acpi_thread_state { | 497 | struct acpi_thread_state { |
480 | ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | 498 | ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */ |
499 | struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | ||
481 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ | 500 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ |
482 | u32 thread_id; /* Running thread ID */ | 501 | acpi_thread_id thread_id; /* Running thread ID */ |
483 | u8 current_sync_level; /* Mutex Sync (nested acquire) level */ | ||
484 | }; | 502 | }; |
485 | 503 | ||
486 | /* | 504 | /* |
@@ -488,10 +506,9 @@ struct acpi_thread_state { | |||
488 | * AML arguments | 506 | * AML arguments |
489 | */ | 507 | */ |
490 | struct acpi_result_values { | 508 | struct acpi_result_values { |
491 | ACPI_STATE_COMMON | 509 | ACPI_STATE_COMMON u8 num_results; |
492 | union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; | ||
493 | u8 num_results; | ||
494 | u8 last_insert; | 510 | u8 last_insert; |
511 | union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; | ||
495 | }; | 512 | }; |
496 | 513 | ||
497 | typedef | 514 | typedef |
@@ -546,7 +563,7 @@ struct acpi_opcode_info { | |||
546 | #endif | 563 | #endif |
547 | u32 parse_args; /* Grammar/Parse time arguments */ | 564 | u32 parse_args; /* Grammar/Parse time arguments */ |
548 | u32 runtime_args; /* Interpret time arguments */ | 565 | u32 runtime_args; /* Interpret time arguments */ |
549 | u32 flags; /* Misc flags */ | 566 | u16 flags; /* Misc flags */ |
550 | u8 object_type; /* Corresponding internal object type */ | 567 | u8 object_type; /* Corresponding internal object type */ |
551 | u8 class; /* Opcode class */ | 568 | u8 class; /* Opcode class */ |
552 | u8 type; /* Opcode type */ | 569 | u8 type; /* Opcode type */ |
@@ -563,29 +580,31 @@ union acpi_parse_value { | |||
563 | }; | 580 | }; |
564 | 581 | ||
565 | #define ACPI_PARSE_COMMON \ | 582 | #define ACPI_PARSE_COMMON \ |
566 | u8 data_type; /* To differentiate various internal objs */\ | 583 | union acpi_parse_object *parent; /* Parent op */\ |
567 | u8 flags; /* Type of Op */\ | 584 | u8 descriptor_type; /* To differentiate various internal objs */\ |
568 | u16 aml_opcode; /* AML opcode */\ | 585 | u8 flags; /* Type of Op */\ |
569 | u32 aml_offset; /* Offset of declaration in AML */\ | 586 | u16 aml_opcode; /* AML opcode */\ |
570 | union acpi_parse_object *parent; /* Parent op */\ | 587 | u32 aml_offset; /* Offset of declaration in AML */\ |
571 | union acpi_parse_object *next; /* Next op */\ | 588 | union acpi_parse_object *next; /* Next op */\ |
589 | struct acpi_namespace_node *node; /* For use by interpreter */\ | ||
590 | union acpi_parse_value value; /* Value or args associated with the opcode */\ | ||
572 | ACPI_DISASM_ONLY_MEMBERS (\ | 591 | ACPI_DISASM_ONLY_MEMBERS (\ |
573 | u8 disasm_flags; /* Used during AML disassembly */\ | 592 | u8 disasm_flags; /* Used during AML disassembly */\ |
574 | u8 disasm_opcode; /* Subtype used for disassembly */\ | 593 | u8 disasm_opcode; /* Subtype used for disassembly */\ |
575 | char aml_op_name[16]) /* Op name (debug only) */\ | 594 | char aml_op_name[16]) /* Op name (debug only) */ |
576 | /* NON-DEBUG members below: */\ | 595 | |
577 | struct acpi_namespace_node *node; /* For use by interpreter */\ | 596 | #define ACPI_DASM_BUFFER 0x00 |
578 | union acpi_parse_value value; /* Value or args associated with the opcode */ | 597 | #define ACPI_DASM_RESOURCE 0x01 |
579 | 598 | #define ACPI_DASM_STRING 0x02 | |
580 | #define ACPI_DASM_BUFFER 0x00 | 599 | #define ACPI_DASM_UNICODE 0x03 |
581 | #define ACPI_DASM_RESOURCE 0x01 | 600 | #define ACPI_DASM_EISAID 0x04 |
582 | #define ACPI_DASM_STRING 0x02 | 601 | #define ACPI_DASM_MATCHOP 0x05 |
583 | #define ACPI_DASM_UNICODE 0x03 | 602 | #define ACPI_DASM_LNOT_PREFIX 0x06 |
584 | #define ACPI_DASM_EISAID 0x04 | 603 | #define ACPI_DASM_LNOT_SUFFIX 0x07 |
585 | #define ACPI_DASM_MATCHOP 0x05 | 604 | #define ACPI_DASM_IGNORE 0x08 |
586 | 605 | ||
587 | /* | 606 | /* |
588 | * generic operation (for example: If, While, Store) | 607 | * Generic operation (for example: If, While, Store) |
589 | */ | 608 | */ |
590 | struct acpi_parse_obj_common { | 609 | struct acpi_parse_obj_common { |
591 | ACPI_PARSE_COMMON}; | 610 | ACPI_PARSE_COMMON}; |
@@ -601,7 +620,7 @@ struct acpi_parse_obj_named { | |||
601 | u32 name; /* 4-byte name or zero if no name */ | 620 | u32 name; /* 4-byte name or zero if no name */ |
602 | }; | 621 | }; |
603 | 622 | ||
604 | /* The parse node is the fundamental element of the parse tree */ | 623 | /* This version is used by the i_aSL compiler only */ |
605 | 624 | ||
606 | #define ACPI_MAX_PARSEOP_NAME 20 | 625 | #define ACPI_MAX_PARSEOP_NAME 20 |
607 | 626 | ||
@@ -643,7 +662,6 @@ union acpi_parse_object { | |||
643 | * method. | 662 | * method. |
644 | */ | 663 | */ |
645 | struct acpi_parse_state { | 664 | struct acpi_parse_state { |
646 | u32 aml_size; | ||
647 | u8 *aml_start; /* First AML byte */ | 665 | u8 *aml_start; /* First AML byte */ |
648 | u8 *aml; /* Next AML byte */ | 666 | u8 *aml; /* Next AML byte */ |
649 | u8 *aml_end; /* (last + 1) AML byte */ | 667 | u8 *aml_end; /* (last + 1) AML byte */ |
@@ -653,22 +671,23 @@ struct acpi_parse_state { | |||
653 | struct acpi_namespace_node *start_node; | 671 | struct acpi_namespace_node *start_node; |
654 | union acpi_generic_state *scope; /* Current scope */ | 672 | union acpi_generic_state *scope; /* Current scope */ |
655 | union acpi_parse_object *start_scope; | 673 | union acpi_parse_object *start_scope; |
674 | u32 aml_size; | ||
656 | }; | 675 | }; |
657 | 676 | ||
658 | /* Parse object flags */ | 677 | /* Parse object flags */ |
659 | 678 | ||
660 | #define ACPI_PARSEOP_GENERIC 0x01 | 679 | #define ACPI_PARSEOP_GENERIC 0x01 |
661 | #define ACPI_PARSEOP_NAMED 0x02 | 680 | #define ACPI_PARSEOP_NAMED 0x02 |
662 | #define ACPI_PARSEOP_DEFERRED 0x04 | 681 | #define ACPI_PARSEOP_DEFERRED 0x04 |
663 | #define ACPI_PARSEOP_BYTELIST 0x08 | 682 | #define ACPI_PARSEOP_BYTELIST 0x08 |
664 | #define ACPI_PARSEOP_IN_CACHE 0x80 | 683 | #define ACPI_PARSEOP_IN_CACHE 0x80 |
665 | 684 | ||
666 | /* Parse object disasm_flags */ | 685 | /* Parse object disasm_flags */ |
667 | 686 | ||
668 | #define ACPI_PARSEOP_IGNORE 0x01 | 687 | #define ACPI_PARSEOP_IGNORE 0x01 |
669 | #define ACPI_PARSEOP_PARAMLIST 0x02 | 688 | #define ACPI_PARSEOP_PARAMLIST 0x02 |
670 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 | 689 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 |
671 | #define ACPI_PARSEOP_SPECIAL 0x10 | 690 | #define ACPI_PARSEOP_SPECIAL 0x10 |
672 | 691 | ||
673 | /***************************************************************************** | 692 | /***************************************************************************** |
674 | * | 693 | * |
@@ -676,8 +695,8 @@ struct acpi_parse_state { | |||
676 | * | 695 | * |
677 | ****************************************************************************/ | 696 | ****************************************************************************/ |
678 | 697 | ||
679 | #define PCI_ROOT_HID_STRING "PNP0A03" | 698 | #define PCI_ROOT_HID_STRING "PNP0A03" |
680 | #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" | 699 | #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" |
681 | 700 | ||
682 | struct acpi_bit_register_info { | 701 | struct acpi_bit_register_info { |
683 | u8 parent_register; | 702 | u8 parent_register; |
@@ -710,13 +729,14 @@ struct acpi_bit_register_info { | |||
710 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ | 729 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ |
711 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 | 730 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 |
712 | 731 | ||
713 | #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ | 732 | #define ACPI_BITMASK_ALL_FIXED_STATUS (\ |
714 | ACPI_BITMASK_BUS_MASTER_STATUS | \ | 733 | ACPI_BITMASK_TIMER_STATUS | \ |
715 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ | 734 | ACPI_BITMASK_BUS_MASTER_STATUS | \ |
716 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | 735 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ |
717 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | 736 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ |
718 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | 737 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ |
719 | ACPI_BITMASK_WAKE_STATUS) | 738 | ACPI_BITMASK_RT_CLOCK_STATUS | \ |
739 | ACPI_BITMASK_WAKE_STATUS) | ||
720 | 740 | ||
721 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | 741 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 |
722 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 | 742 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 |
@@ -820,7 +840,7 @@ struct acpi_bit_register_info { | |||
820 | * | 840 | * |
821 | ****************************************************************************/ | 841 | ****************************************************************************/ |
822 | 842 | ||
823 | #define ACPI_ASCII_ZERO 0x30 | 843 | #define ACPI_ASCII_ZERO 0x30 |
824 | 844 | ||
825 | /***************************************************************************** | 845 | /***************************************************************************** |
826 | * | 846 | * |
@@ -842,9 +862,9 @@ struct acpi_integrity_info { | |||
842 | u32 objects; | 862 | u32 objects; |
843 | }; | 863 | }; |
844 | 864 | ||
845 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 | 865 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 |
846 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 | 866 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 |
847 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 | 867 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 |
848 | 868 | ||
849 | /***************************************************************************** | 869 | /***************************************************************************** |
850 | * | 870 | * |
@@ -854,18 +874,18 @@ struct acpi_integrity_info { | |||
854 | 874 | ||
855 | /* Entry for a memory allocation (debug only) */ | 875 | /* Entry for a memory allocation (debug only) */ |
856 | 876 | ||
857 | #define ACPI_MEM_MALLOC 0 | 877 | #define ACPI_MEM_MALLOC 0 |
858 | #define ACPI_MEM_CALLOC 1 | 878 | #define ACPI_MEM_CALLOC 1 |
859 | #define ACPI_MAX_MODULE_NAME 16 | 879 | #define ACPI_MAX_MODULE_NAME 16 |
860 | 880 | ||
861 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ | 881 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ |
862 | struct acpi_debug_mem_block *previous; \ | 882 | struct acpi_debug_mem_block *previous; \ |
863 | struct acpi_debug_mem_block *next; \ | 883 | struct acpi_debug_mem_block *next; \ |
864 | u32 size; \ | 884 | u32 size; \ |
865 | u32 component; \ | 885 | u32 component; \ |
866 | u32 line; \ | 886 | u32 line; \ |
867 | char module[ACPI_MAX_MODULE_NAME]; \ | 887 | char module[ACPI_MAX_MODULE_NAME]; \ |
868 | u8 alloc_type; | 888 | u8 alloc_type; |
869 | 889 | ||
870 | struct acpi_debug_mem_header { | 890 | struct acpi_debug_mem_header { |
871 | ACPI_COMMON_DEBUG_MEM_HEADER}; | 891 | ACPI_COMMON_DEBUG_MEM_HEADER}; |
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index f2be2a881730..38f9aa4bef00 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h | |||
@@ -56,6 +56,10 @@ | |||
56 | #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) | 56 | #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) |
57 | #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) | 57 | #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) |
58 | 58 | ||
59 | /* Size calculation */ | ||
60 | |||
61 | #define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) | ||
62 | |||
59 | #if ACPI_MACHINE_WIDTH == 16 | 63 | #if ACPI_MACHINE_WIDTH == 16 |
60 | 64 | ||
61 | /* | 65 | /* |
@@ -99,7 +103,7 @@ | |||
99 | * printf() format helpers | 103 | * printf() format helpers |
100 | */ | 104 | */ |
101 | 105 | ||
102 | /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ | 106 | /* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ |
103 | 107 | ||
104 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) | 108 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) |
105 | 109 | ||
@@ -130,7 +134,6 @@ | |||
130 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) | 134 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) |
131 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) | 135 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) |
132 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) | 136 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) |
133 | #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) | ||
134 | 137 | ||
135 | #if ACPI_MACHINE_WIDTH == 16 | 138 | #if ACPI_MACHINE_WIDTH == 16 |
136 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) | 139 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) |
@@ -141,6 +144,12 @@ | |||
141 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) | 144 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) |
142 | #endif | 145 | #endif |
143 | 146 | ||
147 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | ||
148 | #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b))) | ||
149 | #else | ||
150 | #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE)) | ||
151 | #endif | ||
152 | |||
144 | /* | 153 | /* |
145 | * Macros for moving data around to/from buffers that are possibly unaligned. | 154 | * Macros for moving data around to/from buffers that are possibly unaligned. |
146 | * If the hardware supports the transfer of unaligned data, just do the store. | 155 | * If the hardware supports the transfer of unaligned data, just do the store. |
@@ -341,29 +350,33 @@ | |||
341 | /* | 350 | /* |
342 | * Rounding macros (Power of two boundaries only) | 351 | * Rounding macros (Power of two boundaries only) |
343 | */ | 352 | */ |
344 | #define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ | 353 | #define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ |
345 | (~(((acpi_native_uint) boundary)-1))) | 354 | (~(((acpi_native_uint) boundary)-1))) |
346 | 355 | ||
347 | #define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ | 356 | #define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ |
348 | (((acpi_native_uint) boundary)-1)) & \ | 357 | (((acpi_native_uint) boundary)-1)) & \ |
349 | (~(((acpi_native_uint) boundary)-1))) | 358 | (~(((acpi_native_uint) boundary)-1))) |
350 | 359 | ||
351 | #define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) | 360 | /* Note: sizeof(acpi_native_uint) evaluates to either 2, 4, or 8 */ |
352 | #define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) | 361 | |
353 | #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) | 362 | #define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4) |
363 | #define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8) | ||
364 | #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_native_uint)) | ||
354 | 365 | ||
355 | #define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4) | 366 | #define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4) |
356 | #define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) | 367 | #define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8) |
357 | #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) | 368 | #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_native_uint)) |
358 | 369 | ||
359 | #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) | 370 | #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) |
360 | #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) | 371 | #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) |
361 | 372 | ||
362 | #define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) | 373 | #define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) |
363 | 374 | ||
364 | /* Generic (non-power-of-two) rounding */ | 375 | /* Generic (non-power-of-two) rounding */ |
365 | 376 | ||
366 | #define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) | 377 | #define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) |
378 | |||
379 | #define ACPI_IS_MISALIGNED(value) (((acpi_native_uint)value) & (sizeof(acpi_native_uint)-1)) | ||
367 | 380 | ||
368 | /* | 381 | /* |
369 | * Bitmask creation | 382 | * Bitmask creation |
@@ -371,10 +384,10 @@ | |||
371 | * MASK_BITS_ABOVE creates a mask starting AT the position and above | 384 | * MASK_BITS_ABOVE creates a mask starting AT the position and above |
372 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position | 385 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position |
373 | */ | 386 | */ |
374 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) | 387 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) |
375 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) | 388 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) |
376 | 389 | ||
377 | #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) | 390 | #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) |
378 | 391 | ||
379 | /* Bitfields within ACPI registers */ | 392 | /* Bitfields within ACPI registers */ |
380 | 393 | ||
@@ -396,8 +409,8 @@ | |||
396 | * | 409 | * |
397 | * The "Descriptor" field is the first field in both structures. | 410 | * The "Descriptor" field is the first field in both structures. |
398 | */ | 411 | */ |
399 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) | 412 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) |
400 | #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) | 413 | #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) |
401 | 414 | ||
402 | /* Macro to test the object type */ | 415 | /* Macro to test the object type */ |
403 | 416 | ||
@@ -486,7 +499,6 @@ | |||
486 | #define ACPI_ERROR(plist) | 499 | #define ACPI_ERROR(plist) |
487 | #define ACPI_ERROR_NAMESPACE(s,e) | 500 | #define ACPI_ERROR_NAMESPACE(s,e) |
488 | #define ACPI_ERROR_METHOD(s,n,p,e) | 501 | #define ACPI_ERROR_METHOD(s,n,p,e) |
489 | |||
490 | #endif | 502 | #endif |
491 | 503 | ||
492 | /* | 504 | /* |
@@ -514,12 +526,12 @@ | |||
514 | #define ACPI_GET_FUNCTION_NAME _acpi_function_name | 526 | #define ACPI_GET_FUNCTION_NAME _acpi_function_name |
515 | /* | 527 | /* |
516 | * The Name parameter should be the procedure name as a quoted string. | 528 | * The Name parameter should be the procedure name as a quoted string. |
517 | * This is declared as a local string ("my_function_name") so that it can | 529 | * This is declared as a local string ("MyFunctionName") so that it can |
518 | * be also used by the function exit macros below. | 530 | * be also used by the function exit macros below. |
519 | * Note: (const char) is used to be compatible with the debug interfaces | 531 | * Note: (const char) is used to be compatible with the debug interfaces |
520 | * and macros such as __FUNCTION__. | 532 | * and macros such as __FUNCTION__. |
521 | */ | 533 | */ |
522 | #define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name; | 534 | #define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = #name; |
523 | 535 | ||
524 | #else | 536 | #else |
525 | /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ | 537 | /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ |
@@ -528,13 +540,13 @@ | |||
528 | #endif | 540 | #endif |
529 | 541 | ||
530 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ | 542 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ |
531 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) | 543 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) |
532 | #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ | 544 | #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ |
533 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) | 545 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) |
534 | #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ | 546 | #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ |
535 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) | 547 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) |
536 | #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ | 548 | #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ |
537 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) | 549 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) |
538 | 550 | ||
539 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() | 551 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() |
540 | 552 | ||
@@ -543,7 +555,7 @@ | |||
543 | * WARNING: These macros include a return statement. This is usually considered | 555 | * WARNING: These macros include a return statement. This is usually considered |
544 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | 556 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. |
545 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | 557 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros |
546 | * so that "_acpi_function_name" is defined. | 558 | * so that "_AcpiFunctionName" is defined. |
547 | * | 559 | * |
548 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining | 560 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining |
549 | * about these constructs. | 561 | * about these constructs. |
@@ -654,6 +666,7 @@ | |||
654 | #define ACPI_DUMP_STACK_ENTRY(a) | 666 | #define ACPI_DUMP_STACK_ENTRY(a) |
655 | #define ACPI_DUMP_OPERANDS(a,b,c,d,e) | 667 | #define ACPI_DUMP_OPERANDS(a,b,c,d,e) |
656 | #define ACPI_DUMP_ENTRY(a,b) | 668 | #define ACPI_DUMP_ENTRY(a,b) |
669 | #define ACPI_DUMP_TABLES(a,b) | ||
657 | #define ACPI_DUMP_PATHNAME(a,b,c,d) | 670 | #define ACPI_DUMP_PATHNAME(a,b,c,d) |
658 | #define ACPI_DUMP_RESOURCE_LIST(a) | 671 | #define ACPI_DUMP_RESOURCE_LIST(a) |
659 | #define ACPI_DUMP_BUFFER(a,b) | 672 | #define ACPI_DUMP_BUFFER(a,b) |
@@ -709,19 +722,19 @@ | |||
709 | 722 | ||
710 | /* Memory allocation */ | 723 | /* Memory allocation */ |
711 | 724 | ||
712 | #define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) | 725 | #define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) |
713 | #define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) | 726 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) |
714 | #define ACPI_MEM_FREE(a) acpi_os_free(a) | 727 | #define ACPI_FREE(a) acpi_os_free(a) |
715 | #define ACPI_MEM_TRACKING(a) | 728 | #define ACPI_MEM_TRACKING(a) |
716 | 729 | ||
717 | #else | 730 | #else |
718 | 731 | ||
719 | /* Memory allocation */ | 732 | /* Memory allocation */ |
720 | 733 | ||
721 | #define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) | 734 | #define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) |
722 | #define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) | 735 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) |
723 | #define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) | 736 | #define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) |
724 | #define ACPI_MEM_TRACKING(a) a | 737 | #define ACPI_MEM_TRACKING(a) a |
725 | 738 | ||
726 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | 739 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
727 | 740 | ||
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index b667a804fc8a..83b52f9f899a 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h | |||
@@ -63,6 +63,8 @@ | |||
63 | #define ACPI_NS_DONT_OPEN_SCOPE 0x02 | 63 | #define ACPI_NS_DONT_OPEN_SCOPE 0x02 |
64 | #define ACPI_NS_NO_PEER_SEARCH 0x04 | 64 | #define ACPI_NS_NO_PEER_SEARCH 0x04 |
65 | #define ACPI_NS_ERROR_IF_FOUND 0x08 | 65 | #define ACPI_NS_ERROR_IF_FOUND 0x08 |
66 | #define ACPI_NS_PREFIX_IS_SCOPE 0x10 | ||
67 | #define ACPI_NS_EXTERNAL 0x20 | ||
66 | 68 | ||
67 | #define ACPI_NS_WALK_UNLOCK TRUE | 69 | #define ACPI_NS_WALK_UNLOCK TRUE |
68 | #define ACPI_NS_WALK_NO_UNLOCK FALSE | 70 | #define ACPI_NS_WALK_NO_UNLOCK FALSE |
@@ -171,19 +173,17 @@ acpi_ns_dump_objects(acpi_object_type type, | |||
171 | /* | 173 | /* |
172 | * nseval - Namespace evaluation functions | 174 | * nseval - Namespace evaluation functions |
173 | */ | 175 | */ |
174 | acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info); | 176 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); |
175 | |||
176 | acpi_status | ||
177 | acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info); | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info); | ||
181 | 177 | ||
182 | /* | 178 | /* |
183 | * nsnames - Name and Scope manipulation | 179 | * nsnames - Name and Scope manipulation |
184 | */ | 180 | */ |
185 | u32 acpi_ns_opens_scope(acpi_object_type type); | 181 | u32 acpi_ns_opens_scope(acpi_object_type type); |
186 | 182 | ||
183 | void | ||
184 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | ||
185 | acpi_size size, char *name_buffer); | ||
186 | |||
187 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); | 187 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); |
188 | 188 | ||
189 | char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); | 189 | char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); |
@@ -196,9 +196,9 @@ u8 | |||
196 | acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); | 196 | acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); |
197 | 197 | ||
198 | acpi_status | 198 | acpi_status |
199 | acpi_ns_get_node_by_path(char *external_pathname, | 199 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
200 | struct acpi_namespace_node *in_prefix_node, | 200 | char *external_pathname, |
201 | u32 flags, struct acpi_namespace_node **out_node); | 201 | u32 flags, struct acpi_namespace_node **out_node); |
202 | 202 | ||
203 | acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); | 203 | acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); |
204 | 204 | ||
@@ -241,10 +241,10 @@ acpi_ns_search_and_enter(u32 entry_name, | |||
241 | u32 flags, struct acpi_namespace_node **ret_node); | 241 | u32 flags, struct acpi_namespace_node **ret_node); |
242 | 242 | ||
243 | acpi_status | 243 | acpi_status |
244 | acpi_ns_search_node(u32 entry_name, | 244 | acpi_ns_search_one_scope(u32 entry_name, |
245 | struct acpi_namespace_node *node, | 245 | struct acpi_namespace_node *node, |
246 | acpi_object_type type, | 246 | acpi_object_type type, |
247 | struct acpi_namespace_node **ret_node); | 247 | struct acpi_namespace_node **ret_node); |
248 | 248 | ||
249 | void | 249 | void |
250 | acpi_ns_install_node(struct acpi_walk_state *walk_state, | 250 | acpi_ns_install_node(struct acpi_walk_state *walk_state, |
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index d130cfed8d55..1747d94084d8 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /****************************************************************************** | 2 | /****************************************************************************** |
3 | * | 3 | * |
4 | * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) | 4 | * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) |
5 | * | 5 | * |
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
@@ -45,10 +45,12 @@ | |||
45 | #ifndef _ACOBJECT_H | 45 | #ifndef _ACOBJECT_H |
46 | #define _ACOBJECT_H | 46 | #define _ACOBJECT_H |
47 | 47 | ||
48 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
49 | |||
48 | /* | 50 | /* |
49 | * The union acpi_operand_object is used to pass AML operands from the dispatcher | 51 | * The union acpi_operand_object is used to pass AML operands from the dispatcher |
50 | * to the interpreter, and to keep track of the various handlers such as | 52 | * to the interpreter, and to keep track of the various handlers such as |
51 | * address space handlers and notify handlers. The object is a constant | 53 | * address space handlers and notify handlers. The object is a constant |
52 | * size in order to allow it to be cached and reused. | 54 | * size in order to allow it to be cached and reused. |
53 | */ | 55 | */ |
54 | 56 | ||
@@ -61,17 +63,25 @@ | |||
61 | /* | 63 | /* |
62 | * Common area for all objects. | 64 | * Common area for all objects. |
63 | * | 65 | * |
64 | * data_type is used to differentiate between internal descriptors, and MUST | 66 | * descriptor_type is used to differentiate between internal descriptors, and |
65 | * be the first byte in this structure. | 67 | * must be in the same place across all descriptors |
68 | * | ||
69 | * Note: The descriptor_type and Type fields must appear in the identical | ||
70 | * position in both the struct acpi_namespace_node and union acpi_operand_object | ||
71 | * structures. | ||
66 | */ | 72 | */ |
67 | #define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ | 73 | #define ACPI_OBJECT_COMMON_HEADER \ |
68 | u8 descriptor; /* To differentiate various internal objs */\ | 74 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ |
69 | u8 type; /* acpi_object_type */\ | 75 | u8 descriptor_type; /* To differentiate various internal objs */\ |
70 | u16 reference_count; /* For object deletion management */\ | 76 | u8 type; /* acpi_object_type */\ |
71 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ | 77 | u16 reference_count; /* For object deletion management */\ |
72 | u8 flags; | 78 | u8 flags; |
73 | 79 | /* | |
74 | /* Values for flag byte above */ | 80 | * Note: There are 3 bytes available here before the |
81 | * next natural alignment boundary (for both 32/64 cases) | ||
82 | */ | ||
83 | |||
84 | /* Values for Flag byte above */ | ||
75 | 85 | ||
76 | #define AOPOBJ_AML_CONSTANT 0x01 | 86 | #define AOPOBJ_AML_CONSTANT 0x01 |
77 | #define AOPOBJ_STATIC_POINTER 0x02 | 87 | #define AOPOBJ_STATIC_POINTER 0x02 |
@@ -79,36 +89,7 @@ | |||
79 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 | 89 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 |
80 | #define AOPOBJ_SETUP_COMPLETE 0x10 | 90 | #define AOPOBJ_SETUP_COMPLETE 0x10 |
81 | #define AOPOBJ_SINGLE_DATUM 0x20 | 91 | #define AOPOBJ_SINGLE_DATUM 0x20 |
82 | 92 | #define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ | |
83 | /* | ||
84 | * Common bitfield for the field objects | ||
85 | * "Field Datum" -- a datum from the actual field object | ||
86 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
87 | */ | ||
88 | #define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\ | ||
89 | u8 field_flags; /* Access, update, and lock bits */\ | ||
90 | u8 attribute; /* From access_as keyword */\ | ||
91 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
92 | u32 bit_length; /* Length of field in bits */\ | ||
93 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
94 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
95 | u8 access_bit_width; /* Read/Write size in bits (8-64) */\ | ||
96 | u32 value; /* Value to store into the Bank or Index register */\ | ||
97 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
98 | |||
99 | /* | ||
100 | * Fields common to both Strings and Buffers | ||
101 | */ | ||
102 | #define ACPI_COMMON_BUFFER_INFO \ | ||
103 | u32 length; | ||
104 | |||
105 | /* | ||
106 | * Common fields for objects that support ASL notifications | ||
107 | */ | ||
108 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
109 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
110 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
111 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
112 | 93 | ||
113 | /****************************************************************************** | 94 | /****************************************************************************** |
114 | * | 95 | * |
@@ -125,25 +106,31 @@ struct acpi_object_integer { | |||
125 | 106 | ||
126 | /* | 107 | /* |
127 | * Note: The String and Buffer object must be identical through the Pointer | 108 | * Note: The String and Buffer object must be identical through the Pointer |
128 | * element. There is code that depends on this. | 109 | * and length elements. There is code that depends on this. |
110 | * | ||
111 | * Fields common to both Strings and Buffers | ||
129 | */ | 112 | */ |
113 | #define ACPI_COMMON_BUFFER_INFO(_type) \ | ||
114 | _type *pointer; \ | ||
115 | u32 length; | ||
116 | |||
130 | struct acpi_object_string { /* Null terminated, ASCII characters only */ | 117 | struct acpi_object_string { /* Null terminated, ASCII characters only */ |
131 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */ | 118 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */ |
132 | }; | 119 | }; |
133 | 120 | ||
134 | struct acpi_object_buffer { | 121 | struct acpi_object_buffer { |
135 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ | 122 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */ |
136 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
137 | u8 *aml_start; | ||
138 | u32 aml_length; | 123 | u32 aml_length; |
124 | u8 *aml_start; | ||
125 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
139 | }; | 126 | }; |
140 | 127 | ||
141 | struct acpi_object_package { | 128 | struct acpi_object_package { |
142 | ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ | 129 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */ |
143 | u32 aml_length; | ||
144 | u8 *aml_start; | ||
145 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
146 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ | 130 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ |
131 | u8 *aml_start; | ||
132 | u32 aml_length; | ||
133 | u32 count; /* # of elements in package */ | ||
147 | }; | 134 | }; |
148 | 135 | ||
149 | /****************************************************************************** | 136 | /****************************************************************************** |
@@ -156,23 +143,6 @@ struct acpi_object_event { | |||
156 | ACPI_OBJECT_COMMON_HEADER void *semaphore; | 143 | ACPI_OBJECT_COMMON_HEADER void *semaphore; |
157 | }; | 144 | }; |
158 | 145 | ||
159 | #define ACPI_INFINITE_CONCURRENCY 0xFF | ||
160 | |||
161 | typedef | ||
162 | acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); | ||
163 | |||
164 | struct acpi_object_method { | ||
165 | ACPI_OBJECT_COMMON_HEADER u8 method_flags; | ||
166 | u8 param_count; | ||
167 | u32 aml_length; | ||
168 | void *semaphore; | ||
169 | u8 *aml_start; | ||
170 | ACPI_INTERNAL_METHOD implementation; | ||
171 | u8 concurrency; | ||
172 | u8 thread_count; | ||
173 | acpi_owner_id owner_id; | ||
174 | }; | ||
175 | |||
176 | struct acpi_object_mutex { | 146 | struct acpi_object_mutex { |
177 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ | 147 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ |
178 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ | 148 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ |
@@ -186,11 +156,23 @@ struct acpi_object_mutex { | |||
186 | 156 | ||
187 | struct acpi_object_region { | 157 | struct acpi_object_region { |
188 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | 158 | ACPI_OBJECT_COMMON_HEADER u8 space_id; |
189 | union acpi_operand_object *handler; /* Handler for region access */ | ||
190 | struct acpi_namespace_node *node; /* Containing namespace node */ | 159 | struct acpi_namespace_node *node; /* Containing namespace node */ |
160 | union acpi_operand_object *handler; /* Handler for region access */ | ||
191 | union acpi_operand_object *next; | 161 | union acpi_operand_object *next; |
192 | u32 length; | ||
193 | acpi_physical_address address; | 162 | acpi_physical_address address; |
163 | u32 length; | ||
164 | }; | ||
165 | |||
166 | struct acpi_object_method { | ||
167 | ACPI_OBJECT_COMMON_HEADER u8 method_flags; | ||
168 | u8 param_count; | ||
169 | u8 concurrency; | ||
170 | void *semaphore; | ||
171 | u8 *aml_start; | ||
172 | ACPI_INTERNAL_METHOD implementation; | ||
173 | u32 aml_length; | ||
174 | u8 thread_count; | ||
175 | acpi_owner_id owner_id; | ||
194 | }; | 176 | }; |
195 | 177 | ||
196 | /****************************************************************************** | 178 | /****************************************************************************** |
@@ -199,6 +181,14 @@ struct acpi_object_region { | |||
199 | * | 181 | * |
200 | *****************************************************************************/ | 182 | *****************************************************************************/ |
201 | 183 | ||
184 | /* | ||
185 | * Common fields for objects that support ASL notifications | ||
186 | */ | ||
187 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
188 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
189 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
190 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
191 | |||
202 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ | 192 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ |
203 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | 193 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; |
204 | 194 | ||
@@ -213,9 +203,9 @@ struct acpi_object_power_resource { | |||
213 | }; | 203 | }; |
214 | 204 | ||
215 | struct acpi_object_processor { | 205 | struct acpi_object_processor { |
216 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; | 206 | ACPI_OBJECT_COMMON_HEADER u8 proc_id; |
217 | u32 length; | 207 | u8 length; |
218 | acpi_io_address address; | 208 | ACPI_COMMON_NOTIFY_INFO acpi_io_address address; |
219 | }; | 209 | }; |
220 | 210 | ||
221 | struct acpi_object_thermal_zone { | 211 | struct acpi_object_thermal_zone { |
@@ -227,9 +217,24 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | |||
227 | * | 217 | * |
228 | *****************************************************************************/ | 218 | *****************************************************************************/ |
229 | 219 | ||
220 | /* | ||
221 | * Common bitfield for the field objects | ||
222 | * "Field Datum" -- a datum from the actual field object | ||
223 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
224 | */ | ||
225 | #define ACPI_COMMON_FIELD_INFO \ | ||
226 | u8 field_flags; /* Access, update, and lock bits */\ | ||
227 | u8 attribute; /* From access_as keyword */\ | ||
228 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
229 | struct acpi_namespace_node *node; /* Link back to parent node */\ | ||
230 | u32 bit_length; /* Length of field in bits */\ | ||
231 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
232 | u32 value; /* Value to store into the Bank or Index register */\ | ||
233 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
234 | u8 access_bit_width; /* Read/Write size in bits (8-64) */ | ||
235 | |||
230 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ | 236 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ |
231 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */ | 237 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ |
232 | /* (REGION/BANK fields only) */ | ||
233 | }; | 238 | }; |
234 | 239 | ||
235 | struct acpi_object_region_field { | 240 | struct acpi_object_region_field { |
@@ -244,7 +249,7 @@ struct acpi_object_bank_field { | |||
244 | struct acpi_object_index_field { | 249 | struct acpi_object_index_field { |
245 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO | 250 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO |
246 | /* | 251 | /* |
247 | * No "region_obj" pointer needed since the Index and Data registers | 252 | * No "RegionObj" pointer needed since the Index and Data registers |
248 | * are each field definitions unto themselves. | 253 | * are each field definitions unto themselves. |
249 | */ | 254 | */ |
250 | union acpi_operand_object *index_obj; /* Index register */ | 255 | union acpi_operand_object *index_obj; /* Index register */ |
@@ -269,13 +274,9 @@ struct acpi_object_notify_handler { | |||
269 | void *context; | 274 | void *context; |
270 | }; | 275 | }; |
271 | 276 | ||
272 | /* Flags for address handler */ | ||
273 | |||
274 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 | ||
275 | |||
276 | struct acpi_object_addr_handler { | 277 | struct acpi_object_addr_handler { |
277 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | 278 | ACPI_OBJECT_COMMON_HEADER u8 space_id; |
278 | u16 hflags; | 279 | u8 handler_flags; |
279 | acpi_adr_space_handler handler; | 280 | acpi_adr_space_handler handler; |
280 | struct acpi_namespace_node *node; /* Parent device */ | 281 | struct acpi_namespace_node *node; /* Parent device */ |
281 | void *context; | 282 | void *context; |
@@ -284,6 +285,10 @@ struct acpi_object_addr_handler { | |||
284 | union acpi_operand_object *next; | 285 | union acpi_operand_object *next; |
285 | }; | 286 | }; |
286 | 287 | ||
288 | /* Flags for address handler (handler_flags) */ | ||
289 | |||
290 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01 | ||
291 | |||
287 | /****************************************************************************** | 292 | /****************************************************************************** |
288 | * | 293 | * |
289 | * Special internal objects | 294 | * Special internal objects |
@@ -297,10 +302,10 @@ struct acpi_object_addr_handler { | |||
297 | struct acpi_object_reference { | 302 | struct acpi_object_reference { |
298 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ | 303 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ |
299 | u16 opcode; | 304 | u16 opcode; |
300 | u32 offset; /* Used for arg_op, local_op, and index_op */ | 305 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ |
301 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ | ||
302 | struct acpi_namespace_node *node; | 306 | struct acpi_namespace_node *node; |
303 | union acpi_operand_object **where; | 307 | union acpi_operand_object **where; |
308 | u32 offset; /* Used for arg_op, local_op, and index_op */ | ||
304 | }; | 309 | }; |
305 | 310 | ||
306 | /* | 311 | /* |
@@ -311,12 +316,10 @@ struct acpi_object_reference { | |||
311 | * Currently: Region and field_unit types | 316 | * Currently: Region and field_unit types |
312 | */ | 317 | */ |
313 | struct acpi_object_extra { | 318 | struct acpi_object_extra { |
314 | ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; | 319 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ |
315 | u16 word_fill1; | ||
316 | u32 aml_length; | ||
317 | u8 *aml_start; | ||
318 | struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ | ||
319 | void *region_context; /* Region-specific data */ | 320 | void *region_context; /* Region-specific data */ |
321 | u8 *aml_start; | ||
322 | u32 aml_length; | ||
320 | }; | 323 | }; |
321 | 324 | ||
322 | /* Additional data that can be attached to namespace nodes */ | 325 | /* Additional data that can be attached to namespace nodes */ |
@@ -391,8 +394,13 @@ union acpi_operand_object { | |||
391 | #define ACPI_DESC_TYPE_NAMED 0x0F | 394 | #define ACPI_DESC_TYPE_NAMED 0x0F |
392 | #define ACPI_DESC_TYPE_MAX 0x0F | 395 | #define ACPI_DESC_TYPE_MAX 0x0F |
393 | 396 | ||
397 | struct acpi_common_descriptor { | ||
398 | void *common_pointer; | ||
399 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
400 | }; | ||
401 | |||
394 | union acpi_descriptor { | 402 | union acpi_descriptor { |
395 | u8 descriptor_id; /* To differentiate various internal objs */ | 403 | struct acpi_common_descriptor common; |
396 | union acpi_operand_object object; | 404 | union acpi_operand_object object; |
397 | struct acpi_namespace_node node; | 405 | struct acpi_namespace_node node; |
398 | union acpi_parse_object op; | 406 | union acpi_parse_object op; |
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h index e6d78bd9e90a..7659a46bc432 100644 --- a/include/acpi/acopcode.h +++ b/include/acpi/acopcode.h | |||
@@ -94,7 +94,7 @@ | |||
94 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | 94 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) |
95 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) | 95 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) |
96 | #define ARGP_CONTINUE_OP ARG_NONE | 96 | #define ARGP_CONTINUE_OP ARG_NONE |
97 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) | 97 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) |
98 | #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | 98 | #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) |
99 | #define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | 99 | #define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) |
100 | #define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | 100 | #define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) |
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 7785d481dc3e..8d5039d0b430 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -50,7 +50,7 @@ | |||
50 | * component basis and a per-exception-type basis. | 50 | * component basis and a per-exception-type basis. |
51 | */ | 51 | */ |
52 | 52 | ||
53 | /* Component IDs are used in the global "debug_layer" */ | 53 | /* Component IDs are used in the global "DebugLayer" */ |
54 | 54 | ||
55 | #define ACPI_UTILITIES 0x00000001 | 55 | #define ACPI_UTILITIES 0x00000001 |
56 | #define ACPI_HARDWARE 0x00000002 | 56 | #define ACPI_HARDWARE 0x00000002 |
@@ -121,7 +121,7 @@ | |||
121 | #define ACPI_LV_INTERRUPTS 0x08000000 | 121 | #define ACPI_LV_INTERRUPTS 0x08000000 |
122 | #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 | 122 | #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 |
123 | 123 | ||
124 | /* Exceptionally verbose output -- also used in the global "debug_level" */ | 124 | /* Exceptionally verbose output -- also used in the global "DebugLevel" */ |
125 | 125 | ||
126 | #define ACPI_LV_AML_DISASSEMBLE 0x10000000 | 126 | #define ACPI_LV_AML_DISASSEMBLE 0x10000000 |
127 | #define ACPI_LV_VERBOSE_INFO 0x20000000 | 127 | #define ACPI_LV_VERBOSE_INFO 0x20000000 |
@@ -135,7 +135,7 @@ | |||
135 | */ | 135 | */ |
136 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS | 136 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS |
137 | 137 | ||
138 | /* Exception level -- used in the global "debug_level" */ | 138 | /* Exception level -- used in the global "DebugLevel" */ |
139 | 139 | ||
140 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) | 140 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) |
141 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) | 141 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) |
@@ -144,13 +144,13 @@ | |||
144 | 144 | ||
145 | /* | 145 | /* |
146 | * These two levels are essentially obsolete, all instances in the | 146 | * These two levels are essentially obsolete, all instances in the |
147 | * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING | 147 | * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING |
148 | * (Kept here because some drivers may still use them) | 148 | * (Kept here because some drivers may still use them) |
149 | */ | 149 | */ |
150 | #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) | 150 | #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) |
151 | #define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) | 151 | #define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) |
152 | 152 | ||
153 | /* Trace level -- also used in the global "debug_level" */ | 153 | /* Trace level -- also used in the global "DebugLevel" */ |
154 | 154 | ||
155 | #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) | 155 | #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) |
156 | #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) | 156 | #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) |
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index 5a1ff484af33..9d49d3c41cd9 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | #define OP_HAS_RETURN_VALUE 1 | 47 | #define OP_HAS_RETURN_VALUE 1 |
48 | 48 | ||
49 | /* variable # arguments */ | 49 | /* Variable number of arguments. This field must be 32 bits */ |
50 | 50 | ||
51 | #define ACPI_VAR_ARGS ACPI_UINT32_MAX | 51 | #define ACPI_VAR_ARGS ACPI_UINT32_MAX |
52 | 52 | ||
@@ -71,7 +71,7 @@ | |||
71 | /* | 71 | /* |
72 | * psxface - Parser external interfaces | 72 | * psxface - Parser external interfaces |
73 | */ | 73 | */ |
74 | acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info); | 74 | acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info); |
75 | 75 | ||
76 | /* | 76 | /* |
77 | * psargs - Parse AML opcode arguments | 77 | * psargs - Parse AML opcode arguments |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 6dca3d542080..8c7590fdd822 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -59,7 +59,7 @@ acpi_evaluate_reference(acpi_handle handle, | |||
59 | 59 | ||
60 | #define ACPI_BUS_FILE_ROOT "acpi" | 60 | #define ACPI_BUS_FILE_ROOT "acpi" |
61 | extern struct proc_dir_entry *acpi_root_dir; | 61 | extern struct proc_dir_entry *acpi_root_dir; |
62 | extern FADT_DESCRIPTOR acpi_fadt; | 62 | extern struct fadt_descriptor acpi_fadt; |
63 | 63 | ||
64 | enum acpi_bus_removal_type { | 64 | enum acpi_bus_removal_type { |
65 | ACPI_BUS_REMOVAL_NORMAL = 0, | 65 | ACPI_BUS_REMOVAL_NORMAL = 0, |
@@ -327,7 +327,7 @@ int acpi_bus_set_power(acpi_handle handle, int state); | |||
327 | int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); | 327 | int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); |
328 | int acpi_bus_receive_event(struct acpi_bus_event *event); | 328 | int acpi_bus_receive_event(struct acpi_bus_event *event); |
329 | int acpi_bus_register_driver(struct acpi_driver *driver); | 329 | int acpi_bus_register_driver(struct acpi_driver *driver); |
330 | int acpi_bus_unregister_driver(struct acpi_driver *driver); | 330 | void acpi_bus_unregister_driver(struct acpi_driver *driver); |
331 | int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, | 331 | int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, |
332 | acpi_handle handle, int type); | 332 | acpi_handle handle, int type); |
333 | int acpi_bus_trim(struct acpi_device *start, int rmdevice); | 333 | int acpi_bus_trim(struct acpi_device *start, int rmdevice); |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 970e9a6372c3..8f473c83b7c4 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -50,12 +50,16 @@ | |||
50 | #include "platform/acenv.h" | 50 | #include "platform/acenv.h" |
51 | #include "actypes.h" | 51 | #include "actypes.h" |
52 | 52 | ||
53 | /* Priorities for acpi_os_queue_for_execution */ | 53 | /* Types for acpi_os_execute */ |
54 | 54 | ||
55 | #define OSD_PRIORITY_GPE 1 | 55 | typedef enum { |
56 | #define OSD_PRIORITY_HIGH 2 | 56 | OSL_GLOBAL_LOCK_HANDLER, |
57 | #define OSD_PRIORITY_MED 3 | 57 | OSL_NOTIFY_HANDLER, |
58 | #define OSD_PRIORITY_LO 4 | 58 | OSL_GPE_HANDLER, |
59 | OSL_DEBUGGER_THREAD, | ||
60 | OSL_EC_POLL_HANDLER, | ||
61 | OSL_EC_BURST_HANDLER | ||
62 | } acpi_execute_type; | ||
59 | 63 | ||
60 | #define ACPI_NO_UNIT_LIMIT ((u32) -1) | 64 | #define ACPI_NO_UNIT_LIMIT ((u32) -1) |
61 | #define ACPI_MUTEX_SEM 1 | 65 | #define ACPI_MUTEX_SEM 1 |
@@ -161,13 +165,11 @@ acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); | |||
161 | /* | 165 | /* |
162 | * Threads and Scheduling | 166 | * Threads and Scheduling |
163 | */ | 167 | */ |
164 | u32 acpi_os_get_thread_id(void); | 168 | acpi_thread_id acpi_os_get_thread_id(void); |
165 | 169 | ||
166 | acpi_status | 170 | acpi_status |
167 | acpi_os_queue_for_execution(u32 priority, | 171 | acpi_os_execute(acpi_execute_type type, |
168 | acpi_osd_exec_callback function, void *context); | 172 | acpi_osd_exec_callback function, void *context); |
169 | |||
170 | void acpi_os_wait_events_complete(void *context); | ||
171 | 173 | ||
172 | void acpi_os_wait_events_complete(void *context); | 174 | void acpi_os_wait_events_complete(void *context); |
173 | 175 | ||
@@ -214,6 +216,12 @@ acpi_os_derive_pci_id(acpi_handle rhandle, | |||
214 | /* | 216 | /* |
215 | * Miscellaneous | 217 | * Miscellaneous |
216 | */ | 218 | */ |
219 | acpi_status acpi_os_validate_interface(char *interface); | ||
220 | |||
221 | acpi_status | ||
222 | acpi_os_validate_address(u8 space_id, | ||
223 | acpi_physical_address address, acpi_size length); | ||
224 | |||
217 | u8 acpi_os_readable(void *pointer, acpi_size length); | 225 | u8 acpi_os_readable(void *pointer, acpi_size length); |
218 | 226 | ||
219 | #ifdef ACPI_FUTURE_USAGE | 227 | #ifdef ACPI_FUTURE_USAGE |
@@ -255,11 +263,4 @@ char *acpi_os_get_next_filename(void *dir_handle); | |||
255 | 263 | ||
256 | void acpi_os_close_directory(void *dir_handle); | 264 | void acpi_os_close_directory(void *dir_handle); |
257 | 265 | ||
258 | /* | ||
259 | * Debug | ||
260 | */ | ||
261 | void | ||
262 | acpi_os_dbg_assert(void *failed_assertion, | ||
263 | void *file_name, u32 line_number, char *message); | ||
264 | |||
265 | #endif /* __ACPIOSXF_H__ */ | 266 | #endif /* __ACPIOSXF_H__ */ |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 66cf2ecef57a..049e9aa1b867 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -268,7 +268,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device); | |||
268 | * Resource interfaces | 268 | * Resource interfaces |
269 | */ | 269 | */ |
270 | typedef | 270 | typedef |
271 | acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, | 271 | acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, |
272 | void *context); | 272 | void *context); |
273 | 273 | ||
274 | acpi_status | 274 | acpi_status |
@@ -290,7 +290,7 @@ acpi_get_possible_resources(acpi_handle device_handle, | |||
290 | acpi_status | 290 | acpi_status |
291 | acpi_walk_resources(acpi_handle device_handle, | 291 | acpi_walk_resources(acpi_handle device_handle, |
292 | char *name, | 292 | char *name, |
293 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); | 293 | acpi_walk_resource_callback user_function, void *context); |
294 | 294 | ||
295 | acpi_status | 295 | acpi_status |
296 | acpi_set_current_resources(acpi_handle device_handle, | 296 | acpi_set_current_resources(acpi_handle device_handle, |
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index fa02e8083381..ad11fc13fbef 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h | |||
@@ -164,23 +164,26 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
164 | /* | 164 | /* |
165 | * rsutils | 165 | * rsutils |
166 | */ | 166 | */ |
167 | |||
167 | acpi_status | 168 | acpi_status |
168 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 169 | acpi_rs_get_prt_method_data(struct acpi_namespace_node *node, |
170 | struct acpi_buffer *ret_buffer); | ||
169 | 171 | ||
170 | acpi_status | 172 | acpi_status |
171 | acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 173 | acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, |
174 | struct acpi_buffer *ret_buffer); | ||
172 | 175 | ||
173 | #ifdef ACPI_FUTURE_USAGE | ||
174 | acpi_status | 176 | acpi_status |
175 | acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 177 | acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, |
176 | #endif /* ACPI_FUTURE_USAGE */ | 178 | struct acpi_buffer *ret_buffer); |
177 | 179 | ||
178 | acpi_status | 180 | acpi_status |
179 | acpi_rs_get_method_data(acpi_handle handle, | 181 | acpi_rs_get_method_data(acpi_handle handle, |
180 | char *path, struct acpi_buffer *ret_buffer); | 182 | char *path, struct acpi_buffer *ret_buffer); |
181 | 183 | ||
182 | acpi_status | 184 | acpi_status |
183 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 185 | acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, |
186 | struct acpi_buffer *ret_buffer); | ||
184 | 187 | ||
185 | /* | 188 | /* |
186 | * rscalc | 189 | * rscalc |
@@ -198,8 +201,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
198 | acpi_size * buffer_size_needed); | 201 | acpi_size * buffer_size_needed); |
199 | 202 | ||
200 | acpi_status | 203 | acpi_status |
201 | acpi_rs_convert_aml_to_resources(u8 * aml_buffer, | 204 | acpi_rs_convert_aml_to_resources(u8 * aml, |
202 | u32 aml_buffer_length, u8 * output_buffer); | 205 | u32 length, |
206 | u32 offset, u8 resource_index, void **context); | ||
203 | 207 | ||
204 | acpi_status | 208 | acpi_status |
205 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | 209 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, |
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index d8c1c2cdac0c..5e8095f0f78f 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #ifndef __ACSTRUCT_H__ | 44 | #ifndef __ACSTRUCT_H__ |
45 | #define __ACSTRUCT_H__ | 45 | #define __ACSTRUCT_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | /***************************************************************************** | 49 | /***************************************************************************** |
48 | * | 50 | * |
49 | * Tree walking typedefs and structs | 51 | * Tree walking typedefs and structs |
@@ -51,67 +53,76 @@ | |||
51 | ****************************************************************************/ | 53 | ****************************************************************************/ |
52 | 54 | ||
53 | /* | 55 | /* |
54 | * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through | 56 | * Walk state - current state of a parse tree walk. Used for both a leisurely |
55 | * the tree (for whatever reason), and for control method execution. | 57 | * stroll through the tree (for whatever reason), and for control method |
58 | * execution. | ||
56 | */ | 59 | */ |
57 | #define ACPI_NEXT_OP_DOWNWARD 1 | 60 | #define ACPI_NEXT_OP_DOWNWARD 1 |
58 | #define ACPI_NEXT_OP_UPWARD 2 | 61 | #define ACPI_NEXT_OP_UPWARD 2 |
59 | 62 | ||
63 | /* | ||
64 | * Groups of definitions for walk_type used for different implementations of | ||
65 | * walkers (never simultaneously) - flags for interpreter: | ||
66 | */ | ||
60 | #define ACPI_WALK_NON_METHOD 0 | 67 | #define ACPI_WALK_NON_METHOD 0 |
61 | #define ACPI_WALK_METHOD 1 | 68 | #define ACPI_WALK_METHOD 0x01 |
62 | #define ACPI_WALK_METHOD_RESTART 2 | 69 | #define ACPI_WALK_METHOD_RESTART 0x02 |
63 | #define ACPI_WALK_CONST_REQUIRED 3 | 70 | |
64 | #define ACPI_WALK_CONST_OPTIONAL 4 | 71 | /* Flags for i_aSL compiler only */ |
72 | |||
73 | #define ACPI_WALK_CONST_REQUIRED 0x10 | ||
74 | #define ACPI_WALK_CONST_OPTIONAL 0x20 | ||
65 | 75 | ||
66 | struct acpi_walk_state { | 76 | struct acpi_walk_state { |
67 | u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */ | 77 | struct acpi_walk_state *next; /* Next walk_state in list */ |
78 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
68 | u8 walk_type; | 79 | u8 walk_type; |
69 | acpi_owner_id owner_id; /* Owner of objects created during the walk */ | 80 | u16 opcode; /* Current AML opcode */ |
70 | u8 last_predicate; /* Result of last predicate */ | ||
71 | u8 current_result; /* */ | ||
72 | u8 next_op_info; /* Info about next_op */ | 81 | u8 next_op_info; /* Info about next_op */ |
73 | u8 num_operands; /* Stack pointer for Operands[] array */ | 82 | u8 num_operands; /* Stack pointer for Operands[] array */ |
83 | acpi_owner_id owner_id; /* Owner of objects created during the walk */ | ||
84 | u8 last_predicate; /* Result of last predicate */ | ||
85 | u8 current_result; | ||
74 | u8 return_used; | 86 | u8 return_used; |
75 | u16 opcode; /* Current AML opcode */ | ||
76 | u8 scope_depth; | 87 | u8 scope_depth; |
77 | u8 pass_number; /* Parse pass during table load */ | 88 | u8 pass_number; /* Parse pass during table load */ |
78 | u32 arg_count; /* push for fixed or var args */ | ||
79 | u32 aml_offset; | 89 | u32 aml_offset; |
80 | u32 arg_types; | 90 | u32 arg_types; |
81 | u32 method_breakpoint; /* For single stepping */ | 91 | u32 method_breakpoint; /* For single stepping */ |
82 | u32 user_breakpoint; /* User AML breakpoint */ | 92 | u32 user_breakpoint; /* User AML breakpoint */ |
83 | u32 parse_flags; | 93 | u32 parse_flags; |
94 | |||
95 | struct acpi_parse_state parser_state; /* Current state of parser */ | ||
84 | u32 prev_arg_types; | 96 | u32 prev_arg_types; |
97 | u32 arg_count; /* push for fixed or var args */ | ||
85 | 98 | ||
86 | u8 *aml_last_while; | ||
87 | struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ | 99 | struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ |
100 | struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ | ||
101 | union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ | ||
102 | union acpi_operand_object **params; | ||
103 | |||
104 | u8 *aml_last_while; | ||
88 | union acpi_operand_object **caller_return_desc; | 105 | union acpi_operand_object **caller_return_desc; |
89 | union acpi_generic_state *control_state; /* List of control states (nested IFs) */ | 106 | union acpi_generic_state *control_state; /* List of control states (nested IFs) */ |
90 | struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ | 107 | struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ |
91 | struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ | 108 | struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ |
92 | union acpi_operand_object *implicit_return_obj; | 109 | union acpi_operand_object *implicit_return_obj; |
93 | struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ | ||
94 | struct acpi_namespace_node *method_call_node; /* Called method Node */ | 110 | struct acpi_namespace_node *method_call_node; /* Called method Node */ |
95 | union acpi_parse_object *method_call_op; /* method_call Op if running a method */ | 111 | union acpi_parse_object *method_call_op; /* method_call Op if running a method */ |
96 | union acpi_operand_object *method_desc; /* Method descriptor if running a method */ | 112 | union acpi_operand_object *method_desc; /* Method descriptor if running a method */ |
97 | struct acpi_namespace_node *method_node; /* Method node if running a method. */ | 113 | struct acpi_namespace_node *method_node; /* Method node if running a method. */ |
98 | union acpi_parse_object *op; /* Current parser op */ | 114 | union acpi_parse_object *op; /* Current parser op */ |
99 | union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ | ||
100 | const struct acpi_opcode_info *op_info; /* Info on current opcode */ | 115 | const struct acpi_opcode_info *op_info; /* Info on current opcode */ |
101 | union acpi_parse_object *origin; /* Start of walk [Obsolete] */ | 116 | union acpi_parse_object *origin; /* Start of walk [Obsolete] */ |
102 | union acpi_operand_object **params; | ||
103 | struct acpi_parse_state parser_state; /* Current state of parser */ | ||
104 | union acpi_operand_object *result_obj; | 117 | union acpi_operand_object *result_obj; |
105 | union acpi_generic_state *results; /* Stack of accumulated results */ | 118 | union acpi_generic_state *results; /* Stack of accumulated results */ |
106 | union acpi_operand_object *return_desc; /* Return object, if any */ | 119 | union acpi_operand_object *return_desc; /* Return object, if any */ |
107 | union acpi_generic_state *scope_info; /* Stack of nested scopes */ | 120 | union acpi_generic_state *scope_info; /* Stack of nested scopes */ |
108 | |||
109 | union acpi_parse_object *prev_op; /* Last op that was processed */ | 121 | union acpi_parse_object *prev_op; /* Last op that was processed */ |
110 | union acpi_parse_object *next_op; /* next op to be processed */ | 122 | union acpi_parse_object *next_op; /* next op to be processed */ |
123 | struct acpi_thread_state *thread; | ||
111 | acpi_parse_downwards descending_callback; | 124 | acpi_parse_downwards descending_callback; |
112 | acpi_parse_upwards ascending_callback; | 125 | acpi_parse_upwards ascending_callback; |
113 | struct acpi_thread_state *thread; | ||
114 | struct acpi_walk_state *next; /* Next walk_state in list */ | ||
115 | }; | 126 | }; |
116 | 127 | ||
117 | /* Info used by acpi_ps_init_objects */ | 128 | /* Info used by acpi_ps_init_objects */ |
@@ -131,32 +142,6 @@ struct acpi_init_walk_info { | |||
131 | struct acpi_table_desc *table_desc; | 142 | struct acpi_table_desc *table_desc; |
132 | }; | 143 | }; |
133 | 144 | ||
134 | /* Info used by acpi_ns_initialize_devices */ | ||
135 | |||
136 | struct acpi_device_walk_info { | ||
137 | u16 device_count; | ||
138 | u16 num_STA; | ||
139 | u16 num_INI; | ||
140 | struct acpi_table_desc *table_desc; | ||
141 | }; | ||
142 | |||
143 | /* TBD: [Restructure] Merge with struct above */ | ||
144 | |||
145 | struct acpi_walk_info { | ||
146 | u32 debug_level; | ||
147 | u32 count; | ||
148 | acpi_owner_id owner_id; | ||
149 | u8 display_type; | ||
150 | }; | ||
151 | |||
152 | /* Display Types */ | ||
153 | |||
154 | #define ACPI_DISPLAY_SUMMARY (u8) 0 | ||
155 | #define ACPI_DISPLAY_OBJECTS (u8) 1 | ||
156 | #define ACPI_DISPLAY_MASK (u8) 1 | ||
157 | |||
158 | #define ACPI_DISPLAY_SHORT (u8) 2 | ||
159 | |||
160 | struct acpi_get_devices_info { | 145 | struct acpi_get_devices_info { |
161 | acpi_walk_callback user_function; | 146 | acpi_walk_callback user_function; |
162 | void *context; | 147 | void *context; |
@@ -189,16 +174,21 @@ union acpi_aml_operands { | |||
189 | } mid; | 174 | } mid; |
190 | }; | 175 | }; |
191 | 176 | ||
192 | /* Internal method parameter list */ | 177 | /* |
193 | 178 | * Structure used to pass object evaluation parameters. | |
194 | struct acpi_parameter_info { | 179 | * Purpose is to reduce CPU stack use. |
195 | struct acpi_namespace_node *node; | 180 | */ |
181 | struct acpi_evaluate_info { | ||
182 | struct acpi_namespace_node *prefix_node; | ||
183 | char *pathname; | ||
196 | union acpi_operand_object *obj_desc; | 184 | union acpi_operand_object *obj_desc; |
197 | union acpi_operand_object **parameters; | 185 | union acpi_operand_object **parameters; |
186 | struct acpi_namespace_node *resolved_node; | ||
198 | union acpi_operand_object *return_object; | 187 | union acpi_operand_object *return_object; |
199 | u8 pass_number; | 188 | u8 pass_number; |
200 | u8 parameter_type; | 189 | u8 parameter_type; |
201 | u8 return_object_type; | 190 | u8 return_object_type; |
191 | u8 flags; | ||
202 | }; | 192 | }; |
203 | 193 | ||
204 | /* Types for parameter_type above */ | 194 | /* Types for parameter_type above */ |
@@ -206,4 +196,35 @@ struct acpi_parameter_info { | |||
206 | #define ACPI_PARAM_ARGS 0 | 196 | #define ACPI_PARAM_ARGS 0 |
207 | #define ACPI_PARAM_GPE 1 | 197 | #define ACPI_PARAM_GPE 1 |
208 | 198 | ||
199 | /* Values for Flags above */ | ||
200 | |||
201 | #define ACPI_IGNORE_RETURN_VALUE 1 | ||
202 | |||
203 | /* Info used by acpi_ns_initialize_devices */ | ||
204 | |||
205 | struct acpi_device_walk_info { | ||
206 | u16 device_count; | ||
207 | u16 num_STA; | ||
208 | u16 num_INI; | ||
209 | struct acpi_table_desc *table_desc; | ||
210 | struct acpi_evaluate_info *evaluate_info; | ||
211 | }; | ||
212 | |||
213 | /* TBD: [Restructure] Merge with struct above */ | ||
214 | |||
215 | struct acpi_walk_info { | ||
216 | u32 debug_level; | ||
217 | u32 count; | ||
218 | acpi_owner_id owner_id; | ||
219 | u8 display_type; | ||
220 | }; | ||
221 | |||
222 | /* Display Types */ | ||
223 | |||
224 | #define ACPI_DISPLAY_SUMMARY (u8) 0 | ||
225 | #define ACPI_DISPLAY_OBJECTS (u8) 1 | ||
226 | #define ACPI_DISPLAY_MASK (u8) 1 | ||
227 | |||
228 | #define ACPI_DISPLAY_SHORT (u8) 2 | ||
229 | |||
209 | #endif | 230 | #endif |
diff --git a/include/acpi/actables.h b/include/acpi/actables.h index 30a47542e1c8..4dbaf02fe526 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h | |||
@@ -136,7 +136,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc); | |||
136 | acpi_status | 136 | acpi_status |
137 | acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); | 137 | acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); |
138 | 138 | ||
139 | u8 acpi_tb_generate_checksum(void *buffer, u32 length); | 139 | u8 acpi_tb_sum_table(void *buffer, u32 length); |
140 | |||
141 | u8 acpi_tb_generate_checksum(struct acpi_table_header *table); | ||
142 | |||
143 | void acpi_tb_set_checksum(struct acpi_table_header *table); | ||
140 | 144 | ||
141 | acpi_status | 145 | acpi_status |
142 | acpi_tb_validate_table_header(struct acpi_table_header *table_header); | 146 | acpi_tb_validate_table_header(struct acpi_table_header *table_header); |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index ed53f842dad4..b125ceed9cb7 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Name: actbl.h - Table data structures defined in ACPI specification | 3 | * Name: actbl.h - Basic ACPI Table Definitions |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -45,66 +45,45 @@ | |||
45 | #define __ACTBL_H__ | 45 | #define __ACTBL_H__ |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 48 | * Values for description table header signatures. Useful because they make |
49 | * This is the only type that is even remotely portable. Anything else is not | 49 | * it more difficult to inadvertently type in the wrong signature. |
50 | * portable, so do not use any other bitfield types. | ||
51 | */ | ||
52 | |||
53 | /* | ||
54 | * Values for description table header signatures | ||
55 | */ | 50 | */ |
56 | #define RSDP_NAME "RSDP" | ||
57 | #define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ | ||
58 | #define APIC_SIG "APIC" /* Multiple APIC Description Table */ | ||
59 | #define DSDT_SIG "DSDT" /* Differentiated System Description Table */ | 51 | #define DSDT_SIG "DSDT" /* Differentiated System Description Table */ |
60 | #define FADT_SIG "FACP" /* Fixed ACPI Description Table */ | 52 | #define FADT_SIG "FACP" /* Fixed ACPI Description Table */ |
61 | #define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ | 53 | #define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ |
62 | #define PSDT_SIG "PSDT" /* Persistent System Description Table */ | 54 | #define PSDT_SIG "PSDT" /* Persistent System Description Table */ |
55 | #define RSDP_SIG "RSD PTR " /* Root System Description Pointer */ | ||
63 | #define RSDT_SIG "RSDT" /* Root System Description Table */ | 56 | #define RSDT_SIG "RSDT" /* Root System Description Table */ |
64 | #define XSDT_SIG "XSDT" /* Extended System Description Table */ | 57 | #define XSDT_SIG "XSDT" /* Extended System Description Table */ |
65 | #define SSDT_SIG "SSDT" /* Secondary System Description Table */ | 58 | #define SSDT_SIG "SSDT" /* Secondary System Description Table */ |
66 | #define SBST_SIG "SBST" /* Smart Battery Specification Table */ | 59 | #define RSDP_NAME "RSDP" |
67 | #define SPIC_SIG "SPIC" /* IOSAPIC table */ | ||
68 | #define BOOT_SIG "BOOT" /* Boot table */ | ||
69 | |||
70 | #define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ | ||
71 | 60 | ||
72 | /* | 61 | /* |
73 | * Common table types. The base code can remain | 62 | * All tables and structures must be byte-packed to match the ACPI |
74 | * constant if the underlying tables are changed | 63 | * specification, since the tables are provided by the system BIOS |
75 | */ | 64 | */ |
76 | #define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2 | ||
77 | #define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2 | ||
78 | #define FACS_DESCRIPTOR struct facs_descriptor_rev2 | ||
79 | #define FADT_DESCRIPTOR struct fadt_descriptor_rev2 | ||
80 | |||
81 | #pragma pack(1) | 65 | #pragma pack(1) |
82 | 66 | ||
83 | /* | 67 | /* |
84 | * ACPI Version-independent tables | 68 | * These are the ACPI tables that are directly consumed by the subsystem. |
69 | * | ||
70 | * The RSDP and FACS do not use the common ACPI table header. All other ACPI | ||
71 | * tables use the header. | ||
85 | * | 72 | * |
86 | * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) | 73 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. |
87 | * are in separate files. | 74 | * This is the only type that is even remotely portable. Anything else is not |
75 | * portable, so do not use any other bitfield types. | ||
88 | */ | 76 | */ |
89 | struct rsdp_descriptor { /* Root System Descriptor Pointer */ | ||
90 | char signature[8]; /* ACPI signature, contains "RSD PTR " */ | ||
91 | u8 checksum; /* ACPI 1.0 checksum */ | ||
92 | char oem_id[6]; /* OEM identification */ | ||
93 | u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ | ||
94 | u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ | ||
95 | u32 length; /* XSDT Length in bytes, including header */ | ||
96 | u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */ | ||
97 | u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */ | ||
98 | char reserved[3]; /* Reserved, must be zero */ | ||
99 | }; | ||
100 | 77 | ||
101 | struct acpi_common_facs { /* Common FACS for internal use */ | 78 | /******************************************************************************* |
102 | u32 *global_lock; | 79 | * |
103 | u64 *firmware_waking_vector; | 80 | * ACPI Table Header. This common header is used by all tables except the |
104 | u8 vector_width; | 81 | * RSDP and FACS. The define is used for direct inclusion of header into |
105 | }; | 82 | * other ACPI tables |
83 | * | ||
84 | ******************************************************************************/ | ||
106 | 85 | ||
107 | #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ | 86 | #define ACPI_TABLE_HEADER_DEF \ |
108 | char signature[4]; /* ASCII table signature */\ | 87 | char signature[4]; /* ASCII table signature */\ |
109 | u32 length; /* Length of table in bytes, including this header */\ | 88 | u32 length; /* Length of table in bytes, including this header */\ |
110 | u8 revision; /* ACPI Specification minor version # */\ | 89 | u8 revision; /* ACPI Specification minor version # */\ |
@@ -112,154 +91,239 @@ struct acpi_common_facs { /* Common FACS for internal use */ | |||
112 | char oem_id[6]; /* ASCII OEM identification */\ | 91 | char oem_id[6]; /* ASCII OEM identification */\ |
113 | char oem_table_id[8]; /* ASCII OEM table identification */\ | 92 | char oem_table_id[8]; /* ASCII OEM table identification */\ |
114 | u32 oem_revision; /* OEM revision number */\ | 93 | u32 oem_revision; /* OEM revision number */\ |
115 | char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ | 94 | char asl_compiler_id[4]; /* ASCII ASL compiler vendor ID */\ |
116 | u32 asl_compiler_revision; /* ASL compiler version */ | 95 | u32 asl_compiler_revision; /* ASL compiler version */ |
117 | 96 | ||
118 | struct acpi_table_header { /* ACPI common table header */ | 97 | struct acpi_table_header { |
119 | ACPI_TABLE_HEADER_DEF}; | 98 | ACPI_TABLE_HEADER_DEF}; |
120 | 99 | ||
121 | /* | 100 | /* |
122 | * MADT values and structures | 101 | * GAS - Generic Address Structure (ACPI 2.0+) |
123 | */ | 102 | */ |
103 | struct acpi_generic_address { | ||
104 | u8 address_space_id; /* Address space where struct or register exists */ | ||
105 | u8 register_bit_width; /* Size in bits of given register */ | ||
106 | u8 register_bit_offset; /* Bit offset within the register */ | ||
107 | u8 access_width; /* Minimum Access size (ACPI 3.0) */ | ||
108 | u64 address; /* 64-bit address of struct or register */ | ||
109 | }; | ||
124 | 110 | ||
125 | /* Values for MADT PCATCompat */ | 111 | /******************************************************************************* |
112 | * | ||
113 | * RSDP - Root System Description Pointer (Signature is "RSD PTR ") | ||
114 | * | ||
115 | ******************************************************************************/ | ||
116 | |||
117 | struct rsdp_descriptor { | ||
118 | char signature[8]; /* ACPI signature, contains "RSD PTR " */ | ||
119 | u8 checksum; /* ACPI 1.0 checksum */ | ||
120 | char oem_id[6]; /* OEM identification */ | ||
121 | u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ | ||
122 | u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ | ||
123 | u32 length; /* Table length in bytes, including header (ACPI 2.0+) */ | ||
124 | u64 xsdt_physical_address; /* 64-bit physical address of the XSDT (ACPI 2.0+) */ | ||
125 | u8 extended_checksum; /* Checksum of entire table (ACPI 2.0+) */ | ||
126 | u8 reserved[3]; /* Reserved, must be zero */ | ||
127 | }; | ||
126 | 128 | ||
127 | #define DUAL_PIC 0 | 129 | #define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */ |
128 | #define MULTIPLE_APIC 1 | ||
129 | 130 | ||
130 | /* Master MADT */ | 131 | /******************************************************************************* |
132 | * | ||
133 | * RSDT/XSDT - Root System Description Tables | ||
134 | * | ||
135 | ******************************************************************************/ | ||
131 | 136 | ||
132 | struct multiple_apic_table { | 137 | struct rsdt_descriptor { |
133 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | 138 | ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ |
134 | u32 local_apic_address; /* Physical address of local APIC */ | 139 | }; |
140 | |||
141 | struct xsdt_descriptor { | ||
142 | ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ | ||
143 | }; | ||
144 | |||
145 | /******************************************************************************* | ||
146 | * | ||
147 | * FACS - Firmware ACPI Control Structure (FACS) | ||
148 | * | ||
149 | ******************************************************************************/ | ||
150 | |||
151 | struct facs_descriptor { | ||
152 | char signature[4]; /* ASCII table signature */ | ||
153 | u32 length; /* Length of structure, in bytes */ | ||
154 | u32 hardware_signature; /* Hardware configuration signature */ | ||
155 | u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */ | ||
156 | u32 global_lock; /* Global Lock for shared hardware resources */ | ||
135 | 157 | ||
136 | /* Flags (32 bits) */ | 158 | /* Flags (32 bits) */ |
137 | 159 | ||
138 | u8 PCATcompat:1; /* 00: System also has dual 8259s */ | 160 | u8 S4bios_f:1; /* 00: S4BIOS support is present */ |
139 | u8:7; /* 01-07: Reserved, must be zero */ | 161 | u8:7; /* 01-07: Reserved, must be zero */ |
140 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ | 162 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ |
141 | }; | ||
142 | 163 | ||
143 | /* Values for Type in APIC_HEADER_DEF */ | 164 | u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ |
165 | u8 version; /* Version of this table (ACPI 2.0+) */ | ||
166 | u8 reserved[31]; /* Reserved, must be zero */ | ||
167 | }; | ||
144 | 168 | ||
145 | #define APIC_PROCESSOR 0 | 169 | #define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ |
146 | #define APIC_IO 1 | 170 | #define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ |
147 | #define APIC_XRUPT_OVERRIDE 2 | ||
148 | #define APIC_NMI 3 | ||
149 | #define APIC_LOCAL_NMI 4 | ||
150 | #define APIC_ADDRESS_OVERRIDE 5 | ||
151 | #define APIC_IO_SAPIC 6 | ||
152 | #define APIC_LOCAL_SAPIC 7 | ||
153 | #define APIC_XRUPT_SOURCE 8 | ||
154 | #define APIC_RESERVED 9 /* 9 and greater are reserved */ | ||
155 | 171 | ||
156 | /* | 172 | /* |
157 | * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) | 173 | * Common FACS - This is a version-independent FACS structure used for internal use only |
158 | */ | 174 | */ |
159 | #define APIC_HEADER_DEF /* Common APIC sub-structure header */\ | 175 | struct acpi_common_facs { |
160 | u8 type; \ | 176 | u32 *global_lock; |
161 | u8 length; | 177 | u64 *firmware_waking_vector; |
162 | 178 | u8 vector_width; | |
163 | struct apic_header { | ||
164 | APIC_HEADER_DEF}; | ||
165 | |||
166 | /* Values for MPS INTI flags */ | ||
167 | |||
168 | #define POLARITY_CONFORMS 0 | ||
169 | #define POLARITY_ACTIVE_HIGH 1 | ||
170 | #define POLARITY_RESERVED 2 | ||
171 | #define POLARITY_ACTIVE_LOW 3 | ||
172 | |||
173 | #define TRIGGER_CONFORMS 0 | ||
174 | #define TRIGGER_EDGE 1 | ||
175 | #define TRIGGER_RESERVED 2 | ||
176 | #define TRIGGER_LEVEL 3 | ||
177 | |||
178 | /* Common flag definitions (16 bits each) */ | ||
179 | |||
180 | #define MPS_INTI_FLAGS \ | ||
181 | u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ | ||
182 | u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ | ||
183 | u8 : 4; /* 04-07: Reserved, must be zero */\ | ||
184 | u8 reserved1; /* 08-15: Reserved, must be zero */ | ||
185 | |||
186 | #define LOCAL_APIC_FLAGS \ | ||
187 | u8 processor_enabled: 1; /* 00: Processor is usable if set */\ | ||
188 | u8 : 7; /* 01-07: Reserved, must be zero */\ | ||
189 | u8 reserved2; /* 08-15: Reserved, must be zero */ | ||
190 | |||
191 | /* Sub-structures for MADT */ | ||
192 | |||
193 | struct madt_processor_apic { | ||
194 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ | ||
195 | u8 local_apic_id; /* Processor's local APIC id */ | ||
196 | LOCAL_APIC_FLAGS}; | ||
197 | |||
198 | struct madt_io_apic { | ||
199 | APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ | ||
200 | u8 reserved; /* Reserved - must be zero */ | ||
201 | u32 address; /* APIC physical address */ | ||
202 | u32 interrupt; /* Global system interrupt where INTI | ||
203 | * lines start */ | ||
204 | }; | 179 | }; |
205 | 180 | ||
206 | struct madt_interrupt_override { | 181 | /******************************************************************************* |
207 | APIC_HEADER_DEF u8 bus; /* 0 - ISA */ | 182 | * |
208 | u8 source; /* Interrupt source (IRQ) */ | 183 | * FADT - Fixed ACPI Description Table (Signature "FACP") |
209 | u32 interrupt; /* Global system interrupt */ | 184 | * |
210 | MPS_INTI_FLAGS}; | 185 | ******************************************************************************/ |
186 | |||
187 | /* Fields common to all versions of the FADT */ | ||
188 | |||
189 | #define ACPI_FADT_COMMON \ | ||
190 | ACPI_TABLE_HEADER_DEF \ | ||
191 | u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ | ||
192 | u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ | ||
193 | u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ | ||
194 | u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ | ||
195 | u16 sci_int; /* System vector of SCI interrupt */ \ | ||
196 | u32 smi_cmd; /* Port address of SMI command port */ \ | ||
197 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ | ||
198 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ | ||
199 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ | ||
200 | u8 pstate_cnt; /* Processor performance state control*/ \ | ||
201 | u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Event Reg Blk */ \ | ||
202 | u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Event Reg Blk */ \ | ||
203 | u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ | ||
204 | u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ | ||
205 | u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ | ||
206 | u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ | ||
207 | u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ | ||
208 | u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ | ||
209 | u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ \ | ||
210 | u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ \ | ||
211 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ | ||
212 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ | ||
213 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ | ||
214 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ | ||
215 | u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ | ||
216 | u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ | ||
217 | u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ | ||
218 | u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ | ||
219 | u16 flush_size; /* Processor's memory cache line width, in bytes */ \ | ||
220 | u16 flush_stride; /* Number of flush strides that need to be read */ \ | ||
221 | u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ | ||
222 | u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ | ||
223 | u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ | ||
224 | u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ | ||
225 | u8 century; /* Index to century in RTC CMOS RAM */ \ | ||
226 | u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \ | ||
227 | u8 reserved2; /* Reserved, must be zero */ | ||
211 | 228 | ||
212 | struct madt_nmi_source { | 229 | /* |
213 | APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */ | 230 | * ACPI 2.0+ FADT |
231 | */ | ||
232 | struct fadt_descriptor { | ||
233 | ACPI_FADT_COMMON | ||
234 | /* Flags (32 bits) */ | ||
235 | u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ | ||
236 | u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ | ||
237 | u8 proc_c1:1; /* 02: All processors support C1 state */ | ||
238 | u8 plvl2_up:1; /* 03: C2 state works on MP system */ | ||
239 | u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ | ||
240 | u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ | ||
241 | u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ | ||
242 | u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ | ||
243 | u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */ | ||
244 | u8 dock_cap:1; /* 09: Docking supported */ | ||
245 | u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */ | ||
246 | u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */ | ||
247 | u8 headless:1; /* 12: No local video capabilities or local input devices */ | ||
248 | u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */ | ||
249 | |||
250 | u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ | ||
251 | u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ | ||
252 | u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ | ||
253 | u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */ | ||
254 | u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ | ||
255 | u8 force_apic_physical_destination_mode:1; /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */ | ||
256 | u8:4; /* 20-23: Reserved, must be zero */ | ||
257 | u8 reserved3; /* 24-31: Reserved, must be zero */ | ||
258 | |||
259 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
260 | u8 reset_value; /* Value to write to the reset_register port to reset the system */ | ||
261 | u8 reserved4[3]; /* These three bytes must be zero */ | ||
262 | u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ | ||
263 | u64 Xdsdt; /* 64-bit physical address of DSDT */ | ||
264 | struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ | ||
265 | struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ | ||
266 | struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ | ||
267 | struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ | ||
268 | struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ | ||
269 | struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ | ||
270 | struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ | ||
271 | struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ | ||
214 | }; | 272 | }; |
215 | 273 | ||
216 | struct madt_local_apic_nmi { | 274 | /* |
217 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ | 275 | * "Down-revved" ACPI 2.0 FADT descriptor |
218 | MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */ | 276 | * Defined here to allow compiler to generate the length of the struct |
277 | */ | ||
278 | struct fadt_descriptor_rev2_minus { | ||
279 | ACPI_FADT_COMMON u32 flags; | ||
280 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
281 | u8 reset_value; /* Value to write to the reset_register port to reset the system. */ | ||
282 | u8 reserved7[3]; /* Reserved, must be zero */ | ||
219 | }; | 283 | }; |
220 | 284 | ||
221 | struct madt_address_override { | 285 | /* |
222 | APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ | 286 | * ACPI 1.0 FADT |
223 | u64 address; /* APIC physical address */ | 287 | * Defined here to allow compiler to generate the length of the struct |
288 | */ | ||
289 | struct fadt_descriptor_rev1 { | ||
290 | ACPI_FADT_COMMON u32 flags; | ||
224 | }; | 291 | }; |
225 | 292 | ||
226 | struct madt_io_sapic { | 293 | /* FADT: Prefered Power Management Profiles */ |
227 | APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ | ||
228 | u8 reserved; /* Reserved, must be zero */ | ||
229 | u32 interrupt_base; /* Glocal interrupt for SAPIC start */ | ||
230 | u64 address; /* SAPIC physical address */ | ||
231 | }; | ||
232 | 294 | ||
233 | struct madt_local_sapic { | 295 | #define PM_UNSPECIFIED 0 |
234 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ | 296 | #define PM_DESKTOP 1 |
235 | u8 local_sapic_id; /* SAPIC ID */ | 297 | #define PM_MOBILE 2 |
236 | u8 local_sapic_eid; /* SAPIC EID */ | 298 | #define PM_WORKSTATION 3 |
237 | u8 reserved[3]; /* Reserved, must be zero */ | 299 | #define PM_ENTERPRISE_SERVER 4 |
238 | LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ | 300 | #define PM_SOHO_SERVER 5 |
239 | char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ | 301 | #define PM_APPLIANCE_PC 6 |
240 | }; | ||
241 | 302 | ||
242 | struct madt_interrupt_source { | 303 | /* FADT: Boot Arch Flags */ |
243 | APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ | ||
244 | u8 processor_id; /* Processor ID */ | ||
245 | u8 processor_eid; /* Processor EID */ | ||
246 | u8 io_sapic_vector; /* Vector value for PMI interrupts */ | ||
247 | u32 interrupt; /* Global system interrupt */ | ||
248 | u32 flags; /* Interrupt Source Flags */ | ||
249 | }; | ||
250 | 304 | ||
251 | /* | 305 | #define BAF_LEGACY_DEVICES 0x0001 |
252 | * Smart Battery | 306 | #define BAF_8042_KEYBOARD_CONTROLLER 0x0002 |
253 | */ | 307 | |
254 | struct smart_battery_table { | 308 | #define FADT2_REVISION_ID 3 |
255 | ACPI_TABLE_HEADER_DEF u32 warning_level; | 309 | #define FADT2_MINUS_REVISION_ID 2 |
256 | u32 low_level; | 310 | |
257 | u32 critical_level; | 311 | /* Reset to default packing */ |
258 | }; | ||
259 | 312 | ||
260 | #pragma pack() | 313 | #pragma pack() |
261 | 314 | ||
262 | /* | 315 | /* |
316 | * This macro is temporary until the table bitfield flag definitions | ||
317 | * are removed and replaced by a Flags field. | ||
318 | */ | ||
319 | #define ACPI_FLAG_OFFSET(d,f,o) (u8) (ACPI_OFFSET (d,f) + \ | ||
320 | sizeof(((d *)0)->f) + o) | ||
321 | /* | ||
322 | * Get the remaining ACPI tables | ||
323 | */ | ||
324 | #include "actbl1.h" | ||
325 | |||
326 | /* | ||
263 | * ACPI Table information. We save the table address, length, | 327 | * ACPI Table information. We save the table address, length, |
264 | * and type of memory allocation (mapped or allocated) for each | 328 | * and type of memory allocation (mapped or allocated) for each |
265 | * table for 1) when we exit, and 2) if a new table is installed | 329 | * table for 1) when we exit, and 2) if a new table is installed |
@@ -290,27 +354,17 @@ struct acpi_table_support { | |||
290 | u8 flags; | 354 | u8 flags; |
291 | }; | 355 | }; |
292 | 356 | ||
293 | /* | ||
294 | * Get the ACPI version-specific tables | ||
295 | */ | ||
296 | #include "actbl1.h" /* Acpi 1.0 table definitions */ | ||
297 | #include "actbl2.h" /* Acpi 2.0 table definitions */ | ||
298 | |||
299 | extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, | 357 | extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, |
300 | * needed for certain workarounds */ | 358 | * needed for certain workarounds */ |
359 | /* Macros used to generate offsets to specific table fields */ | ||
301 | 360 | ||
302 | #pragma pack(1) | 361 | #define ACPI_FACS_OFFSET(f) (u8) ACPI_OFFSET (struct facs_descriptor,f) |
303 | /* | 362 | #define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct fadt_descriptor, f) |
304 | * High performance timer | 363 | #define ACPI_GAS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_generic_address,f) |
305 | */ | 364 | #define ACPI_HDR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_header,f) |
306 | struct hpet_table { | 365 | #define ACPI_RSDP_OFFSET(f) (u8) ACPI_OFFSET (struct rsdp_descriptor,f) |
307 | ACPI_TABLE_HEADER_DEF u32 hardware_id; | ||
308 | struct acpi_generic_address base_address; | ||
309 | u8 hpet_number; | ||
310 | u16 clock_tick; | ||
311 | u8 attributes; | ||
312 | }; | ||
313 | 366 | ||
314 | #pragma pack() | 367 | #define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o) |
368 | #define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct facs_descriptor,f,o) | ||
315 | 369 | ||
316 | #endif /* __ACTBL_H__ */ | 370 | #endif /* __ACTBL_H__ */ |
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index cd428d57add0..745a6445a4f9 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Name: actbl1.h - ACPI 1.0 tables | 3 | * Name: actbl1.h - Additional ACPI table definitions |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -44,92 +44,599 @@ | |||
44 | #ifndef __ACTBL1_H__ | 44 | #ifndef __ACTBL1_H__ |
45 | #define __ACTBL1_H__ | 45 | #define __ACTBL1_H__ |
46 | 46 | ||
47 | /******************************************************************************* | ||
48 | * | ||
49 | * Additional ACPI Tables | ||
50 | * | ||
51 | * These tables are not consumed directly by the ACPICA subsystem, but are | ||
52 | * included here to support device drivers and the AML disassembler. | ||
53 | * | ||
54 | ******************************************************************************/ | ||
55 | |||
56 | /* | ||
57 | * Values for description table header signatures. Useful because they make | ||
58 | * it more difficult to inadvertently type in the wrong signature. | ||
59 | */ | ||
60 | #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ | ||
61 | #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ | ||
62 | #define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ | ||
63 | #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ | ||
64 | #define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ | ||
65 | #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ | ||
66 | #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ | ||
67 | #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ | ||
68 | #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ | ||
69 | #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ | ||
70 | #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ | ||
71 | #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ | ||
72 | #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ | ||
73 | #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ | ||
74 | #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ | ||
75 | |||
76 | /* Legacy names */ | ||
77 | |||
78 | #define APIC_SIG "APIC" /* Multiple APIC Description Table */ | ||
79 | #define BOOT_SIG "BOOT" /* Simple Boot Flag Table */ | ||
80 | #define SBST_SIG "SBST" /* Smart Battery Specification Table */ | ||
81 | |||
82 | /* | ||
83 | * All tables must be byte-packed to match the ACPI specification, since | ||
84 | * the tables are provided by the system BIOS. | ||
85 | */ | ||
47 | #pragma pack(1) | 86 | #pragma pack(1) |
48 | 87 | ||
49 | /* | 88 | /* |
50 | * ACPI 1.0 Root System Description Table (RSDT) | 89 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. |
90 | * This is the only type that is even remotely portable. Anything else is not | ||
91 | * portable, so do not use any other bitfield types. | ||
51 | */ | 92 | */ |
52 | struct rsdt_descriptor_rev1 { | 93 | |
53 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | 94 | /******************************************************************************* |
54 | u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ | 95 | * |
55 | }; | 96 | * ASF - Alert Standard Format table (Signature "ASF!") |
97 | * | ||
98 | ******************************************************************************/ | ||
99 | |||
100 | struct acpi_table_asf { | ||
101 | ACPI_TABLE_HEADER_DEF}; | ||
102 | |||
103 | #define ACPI_ASF_HEADER_DEF \ | ||
104 | u8 type; \ | ||
105 | u8 reserved; \ | ||
106 | u16 length; | ||
107 | |||
108 | struct acpi_asf_header { | ||
109 | ACPI_ASF_HEADER_DEF}; | ||
110 | |||
111 | /* Values for Type field */ | ||
112 | |||
113 | #define ASF_INFO 0 | ||
114 | #define ASF_ALERT 1 | ||
115 | #define ASF_CONTROL 2 | ||
116 | #define ASF_BOOT 3 | ||
117 | #define ASF_ADDRESS 4 | ||
118 | #define ASF_RESERVED 5 | ||
56 | 119 | ||
57 | /* | 120 | /* |
58 | * ACPI 1.0 Firmware ACPI Control Structure (FACS) | 121 | * ASF subtables |
59 | */ | 122 | */ |
60 | struct facs_descriptor_rev1 { | 123 | |
61 | char signature[4]; /* ASCII table signature */ | 124 | /* 0: ASF Information */ |
62 | u32 length; /* Length of structure in bytes */ | 125 | |
63 | u32 hardware_signature; /* Hardware configuration signature */ | 126 | struct acpi_asf_info { |
64 | u32 firmware_waking_vector; /* ACPI OS waking vector */ | 127 | ACPI_ASF_HEADER_DEF u8 min_reset_value; |
65 | u32 global_lock; /* Global Lock */ | 128 | u8 min_poll_interval; |
129 | u16 system_id; | ||
130 | u32 mfg_id; | ||
131 | u8 flags; | ||
132 | u8 reserved2[3]; | ||
133 | }; | ||
134 | |||
135 | /* 1: ASF Alerts */ | ||
136 | |||
137 | struct acpi_asf_alert { | ||
138 | ACPI_ASF_HEADER_DEF u8 assert_mask; | ||
139 | u8 deassert_mask; | ||
140 | u8 alerts; | ||
141 | u8 data_length; | ||
142 | u8 array[1]; | ||
143 | }; | ||
144 | |||
145 | /* 2: ASF Remote Control */ | ||
146 | |||
147 | struct acpi_asf_remote { | ||
148 | ACPI_ASF_HEADER_DEF u8 controls; | ||
149 | u8 data_length; | ||
150 | u16 reserved2; | ||
151 | u8 array[1]; | ||
152 | }; | ||
153 | |||
154 | /* 3: ASF RMCP Boot Options */ | ||
155 | |||
156 | struct acpi_asf_rmcp { | ||
157 | ACPI_ASF_HEADER_DEF u8 capabilities[7]; | ||
158 | u8 completion_code; | ||
159 | u32 enterprise_id; | ||
160 | u8 command; | ||
161 | u16 parameter; | ||
162 | u16 boot_options; | ||
163 | u16 oem_parameters; | ||
164 | }; | ||
165 | |||
166 | /* 4: ASF Address */ | ||
167 | |||
168 | struct acpi_asf_address { | ||
169 | ACPI_ASF_HEADER_DEF u8 eprom_address; | ||
170 | u8 devices; | ||
171 | u8 smbus_addresses[1]; | ||
172 | }; | ||
173 | |||
174 | /******************************************************************************* | ||
175 | * | ||
176 | * BOOT - Simple Boot Flag Table | ||
177 | * | ||
178 | ******************************************************************************/ | ||
179 | |||
180 | struct acpi_table_boot { | ||
181 | ACPI_TABLE_HEADER_DEF u8 cmos_index; /* Index in CMOS RAM for the boot register */ | ||
182 | u8 reserved[3]; | ||
183 | }; | ||
184 | |||
185 | /******************************************************************************* | ||
186 | * | ||
187 | * CPEP - Corrected Platform Error Polling table | ||
188 | * | ||
189 | ******************************************************************************/ | ||
190 | |||
191 | struct acpi_table_cpep { | ||
192 | ACPI_TABLE_HEADER_DEF u64 reserved; | ||
193 | }; | ||
194 | |||
195 | /* Subtable */ | ||
196 | |||
197 | struct acpi_cpep_polling { | ||
198 | u8 type; | ||
199 | u8 length; | ||
200 | u8 processor_id; /* Processor ID */ | ||
201 | u8 processor_eid; /* Processor EID */ | ||
202 | u32 polling_interval; /* Polling interval (msec) */ | ||
203 | }; | ||
204 | |||
205 | /******************************************************************************* | ||
206 | * | ||
207 | * DBGP - Debug Port table | ||
208 | * | ||
209 | ******************************************************************************/ | ||
210 | |||
211 | struct acpi_table_dbgp { | ||
212 | ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ | ||
213 | u8 reserved[3]; | ||
214 | struct acpi_generic_address debug_port; | ||
215 | }; | ||
216 | |||
217 | /******************************************************************************* | ||
218 | * | ||
219 | * ECDT - Embedded Controller Boot Resources Table | ||
220 | * | ||
221 | ******************************************************************************/ | ||
222 | |||
223 | struct ec_boot_resources { | ||
224 | ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ | ||
225 | struct acpi_generic_address ec_data; /* Address of EC data register */ | ||
226 | u32 uid; /* Unique ID - must be same as the EC _UID method */ | ||
227 | u8 gpe_bit; /* The GPE for the EC */ | ||
228 | u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ | ||
229 | }; | ||
230 | |||
231 | /******************************************************************************* | ||
232 | * | ||
233 | * HPET - High Precision Event Timer table | ||
234 | * | ||
235 | ******************************************************************************/ | ||
236 | |||
237 | struct acpi_hpet_table { | ||
238 | ACPI_TABLE_HEADER_DEF u32 hardware_id; /* Hardware ID of event timer block */ | ||
239 | struct acpi_generic_address base_address; /* Address of event timer block */ | ||
240 | u8 hpet_number; /* HPET sequence number */ | ||
241 | u16 clock_tick; /* Main counter min tick, periodic mode */ | ||
242 | u8 attributes; | ||
243 | }; | ||
244 | |||
245 | #if 0 /* HPET flags to be converted to macros */ | ||
246 | struct { /* Flags (8 bits) */ | ||
247 | u8 page_protect:1; /* 00: No page protection */ | ||
248 | u8 page_protect4:1; /* 01: 4_kB page protected */ | ||
249 | u8 page_protect64:1; /* 02: 64_kB page protected */ | ||
250 | u8:5; /* 03-07: Reserved, must be zero */ | ||
251 | } flags; | ||
252 | #endif | ||
253 | |||
254 | /******************************************************************************* | ||
255 | * | ||
256 | * MADT - Multiple APIC Description Table | ||
257 | * | ||
258 | ******************************************************************************/ | ||
259 | |||
260 | struct multiple_apic_table { | ||
261 | ACPI_TABLE_HEADER_DEF u32 local_apic_address; /* Physical address of local APIC */ | ||
66 | 262 | ||
67 | /* Flags (32 bits) */ | 263 | /* Flags (32 bits) */ |
68 | 264 | ||
69 | u8 S4bios_f:1; /* 00: S4BIOS support is present */ | 265 | u8 PCATcompat:1; /* 00: System also has dual 8259s */ |
70 | u8:7; /* 01-07: Reserved, must be zero */ | 266 | u8:7; /* 01-07: Reserved, must be zero */ |
71 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ | 267 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ |
72 | |||
73 | u8 reserved2[40]; /* Reserved, must be zero */ | ||
74 | }; | 268 | }; |
75 | 269 | ||
270 | /* Values for MADT PCATCompat */ | ||
271 | |||
272 | #define DUAL_PIC 0 | ||
273 | #define MULTIPLE_APIC 1 | ||
274 | |||
275 | /* Common MADT Sub-table header */ | ||
276 | |||
277 | #define APIC_HEADER_DEF \ | ||
278 | u8 type; \ | ||
279 | u8 length; | ||
280 | |||
281 | struct apic_header { | ||
282 | APIC_HEADER_DEF}; | ||
283 | |||
284 | /* Values for Type in struct apic_header */ | ||
285 | |||
286 | #define APIC_PROCESSOR 0 | ||
287 | #define APIC_IO 1 | ||
288 | #define APIC_XRUPT_OVERRIDE 2 | ||
289 | #define APIC_NMI 3 | ||
290 | #define APIC_LOCAL_NMI 4 | ||
291 | #define APIC_ADDRESS_OVERRIDE 5 | ||
292 | #define APIC_IO_SAPIC 6 | ||
293 | #define APIC_LOCAL_SAPIC 7 | ||
294 | #define APIC_XRUPT_SOURCE 8 | ||
295 | #define APIC_RESERVED 9 /* 9 and greater are reserved */ | ||
296 | |||
297 | /* Flag definitions for MADT sub-tables */ | ||
298 | |||
299 | #define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \ | ||
300 | u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ | ||
301 | u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ | ||
302 | u8 : 4; /* 04-07: Reserved, must be zero */\ | ||
303 | u8 reserved1; /* 08-15: Reserved, must be zero */ | ||
304 | |||
305 | #define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \ | ||
306 | u8 processor_enabled: 1; /* 00: Processor is usable if set */\ | ||
307 | u8 : 7; /* 01-07: Reserved, must be zero */\ | ||
308 | u8 reserved2[3]; /* 08-31: Reserved, must be zero */ | ||
309 | |||
310 | /* Values for MPS INTI flags */ | ||
311 | |||
312 | #define POLARITY_CONFORMS 0 | ||
313 | #define POLARITY_ACTIVE_HIGH 1 | ||
314 | #define POLARITY_RESERVED 2 | ||
315 | #define POLARITY_ACTIVE_LOW 3 | ||
316 | |||
317 | #define TRIGGER_CONFORMS 0 | ||
318 | #define TRIGGER_EDGE 1 | ||
319 | #define TRIGGER_RESERVED 2 | ||
320 | #define TRIGGER_LEVEL 3 | ||
321 | |||
76 | /* | 322 | /* |
77 | * ACPI 1.0 Fixed ACPI Description Table (FADT) | 323 | * MADT Sub-tables, correspond to Type in struct apic_header |
78 | */ | 324 | */ |
79 | struct fadt_descriptor_rev1 { | 325 | |
80 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | 326 | /* 0: processor APIC */ |
81 | u32 firmware_ctrl; /* Physical address of FACS */ | 327 | |
82 | u32 dsdt; /* Physical address of DSDT */ | 328 | struct madt_processor_apic { |
83 | u8 model; /* System Interrupt Model */ | 329 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ |
84 | u8 reserved1; /* Reserved, must be zero */ | 330 | u8 local_apic_id; /* Processor's local APIC id */ |
85 | u16 sci_int; /* System vector of SCI interrupt */ | 331 | ACPI_MADT_LFLAGS}; |
86 | u32 smi_cmd; /* Port address of SMI command port */ | 332 | |
87 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ | 333 | /* 1: IO APIC */ |
88 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ | 334 | |
89 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ | 335 | struct madt_io_apic { |
90 | u8 reserved2; /* Reserved, must be zero */ | 336 | APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ |
91 | u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ | 337 | u8 reserved; /* Reserved - must be zero */ |
92 | u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ | 338 | u32 address; /* APIC physical address */ |
93 | u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ | 339 | u32 interrupt; /* Global system interrupt where INTI lines start */ |
94 | u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ | 340 | }; |
95 | u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ | 341 | |
96 | u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ | 342 | /* 2: Interrupt Override */ |
97 | u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ | 343 | |
98 | u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ | 344 | struct madt_interrupt_override { |
99 | u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ | 345 | APIC_HEADER_DEF u8 bus; /* 0 - ISA */ |
100 | u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ | 346 | u8 source; /* Interrupt source (IRQ) */ |
101 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ | 347 | u32 interrupt; /* Global system interrupt */ |
102 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ | 348 | ACPI_MADT_IFLAGS}; |
103 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ | 349 | |
104 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ | 350 | /* 3: NMI Sources */ |
105 | u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ | 351 | |
106 | u8 reserved3; /* Reserved, must be zero */ | 352 | struct madt_nmi_source { |
107 | u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ | 353 | APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */ |
108 | u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ | 354 | }; |
109 | u16 flush_size; /* Size of area read to flush caches */ | 355 | |
110 | u16 flush_stride; /* Stride used in flushing caches */ | 356 | /* 4: Local APIC NMI */ |
111 | u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ | 357 | |
112 | u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ | 358 | struct madt_local_apic_nmi { |
113 | u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ | 359 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ |
114 | u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ | 360 | ACPI_MADT_IFLAGS u8 lint; /* LINTn to which NMI is connected */ |
115 | u8 century; /* Index to century in RTC CMOS RAM */ | 361 | }; |
116 | u8 reserved4[3]; /* Reserved, must be zero */ | 362 | |
363 | /* 5: Address Override */ | ||
364 | |||
365 | struct madt_address_override { | ||
366 | APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ | ||
367 | u64 address; /* APIC physical address */ | ||
368 | }; | ||
369 | |||
370 | /* 6: I/O Sapic */ | ||
371 | |||
372 | struct madt_io_sapic { | ||
373 | APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ | ||
374 | u8 reserved; /* Reserved, must be zero */ | ||
375 | u32 interrupt_base; /* Glocal interrupt for SAPIC start */ | ||
376 | u64 address; /* SAPIC physical address */ | ||
377 | }; | ||
378 | |||
379 | /* 7: Local Sapic */ | ||
380 | |||
381 | struct madt_local_sapic { | ||
382 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ | ||
383 | u8 local_sapic_id; /* SAPIC ID */ | ||
384 | u8 local_sapic_eid; /* SAPIC EID */ | ||
385 | u8 reserved[3]; /* Reserved, must be zero */ | ||
386 | ACPI_MADT_LFLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ | ||
387 | char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ | ||
388 | }; | ||
389 | |||
390 | /* 8: Platform Interrupt Source */ | ||
391 | |||
392 | struct madt_interrupt_source { | ||
393 | APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ | ||
394 | u8 processor_id; /* Processor ID */ | ||
395 | u8 processor_eid; /* Processor EID */ | ||
396 | u8 io_sapic_vector; /* Vector value for PMI interrupts */ | ||
397 | u32 interrupt; /* Global system interrupt */ | ||
398 | u32 flags; /* Interrupt Source Flags */ | ||
399 | }; | ||
400 | |||
401 | #ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H | ||
402 | /******************************************************************************* | ||
403 | * | ||
404 | * MCFG - PCI Memory Mapped Configuration table and sub-table | ||
405 | * | ||
406 | ******************************************************************************/ | ||
407 | |||
408 | struct acpi_table_mcfg { | ||
409 | ACPI_TABLE_HEADER_DEF u8 reserved[8]; | ||
410 | }; | ||
411 | |||
412 | struct acpi_mcfg_allocation { | ||
413 | u64 base_address; /* Base address, processor-relative */ | ||
414 | u16 pci_segment; /* PCI segment group number */ | ||
415 | u8 start_bus_number; /* Starting PCI Bus number */ | ||
416 | u8 end_bus_number; /* Final PCI Bus number */ | ||
417 | u32 reserved; | ||
418 | }; | ||
419 | #endif | ||
420 | |||
421 | /******************************************************************************* | ||
422 | * | ||
423 | * SBST - Smart Battery Specification Table | ||
424 | * | ||
425 | ******************************************************************************/ | ||
426 | |||
427 | struct smart_battery_table { | ||
428 | ACPI_TABLE_HEADER_DEF u32 warning_level; | ||
429 | u32 low_level; | ||
430 | u32 critical_level; | ||
431 | }; | ||
432 | |||
433 | /******************************************************************************* | ||
434 | * | ||
435 | * SLIT - System Locality Distance Information Table | ||
436 | * | ||
437 | ******************************************************************************/ | ||
438 | |||
439 | struct system_locality_info { | ||
440 | ACPI_TABLE_HEADER_DEF u64 locality_count; | ||
441 | u8 entry[1][1]; | ||
442 | }; | ||
443 | |||
444 | /******************************************************************************* | ||
445 | * | ||
446 | * SPCR - Serial Port Console Redirection table | ||
447 | * | ||
448 | ******************************************************************************/ | ||
449 | |||
450 | struct acpi_table_spcr { | ||
451 | ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ | ||
452 | u8 reserved[3]; | ||
453 | struct acpi_generic_address serial_port; | ||
454 | u8 interrupt_type; | ||
455 | u8 pc_interrupt; | ||
456 | u32 interrupt; | ||
457 | u8 baud_rate; | ||
458 | u8 parity; | ||
459 | u8 stop_bits; | ||
460 | u8 flow_control; | ||
461 | u8 terminal_type; | ||
462 | u8 reserved2; | ||
463 | u16 pci_device_id; | ||
464 | u16 pci_vendor_id; | ||
465 | u8 pci_bus; | ||
466 | u8 pci_device; | ||
467 | u8 pci_function; | ||
468 | u32 pci_flags; | ||
469 | u8 pci_segment; | ||
470 | u32 reserved3; | ||
471 | }; | ||
472 | |||
473 | /******************************************************************************* | ||
474 | * | ||
475 | * SPMI - Server Platform Management Interface table | ||
476 | * | ||
477 | ******************************************************************************/ | ||
478 | |||
479 | struct acpi_table_spmi { | ||
480 | ACPI_TABLE_HEADER_DEF u8 reserved; | ||
481 | u8 interface_type; | ||
482 | u16 spec_revision; /* Version of IPMI */ | ||
483 | u8 interrupt_type; | ||
484 | u8 gpe_number; /* GPE assigned */ | ||
485 | u8 reserved2; | ||
486 | u8 pci_device_flag; | ||
487 | u32 interrupt; | ||
488 | struct acpi_generic_address ipmi_register; | ||
489 | u8 pci_segment; | ||
490 | u8 pci_bus; | ||
491 | u8 pci_device; | ||
492 | u8 pci_function; | ||
493 | }; | ||
494 | |||
495 | /******************************************************************************* | ||
496 | * | ||
497 | * SRAT - System Resource Affinity Table | ||
498 | * | ||
499 | ******************************************************************************/ | ||
500 | |||
501 | struct system_resource_affinity { | ||
502 | ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ | ||
503 | u64 reserved2; /* Reserved, must be zero */ | ||
504 | }; | ||
505 | |||
506 | /* SRAT common sub-table header */ | ||
507 | |||
508 | #define SRAT_SUBTABLE_HEADER \ | ||
509 | u8 type; \ | ||
510 | u8 length; | ||
511 | |||
512 | /* Values for Type above */ | ||
513 | |||
514 | #define SRAT_CPU_AFFINITY 0 | ||
515 | #define SRAT_MEMORY_AFFINITY 1 | ||
516 | #define SRAT_RESERVED 2 | ||
517 | |||
518 | /* SRAT sub-tables */ | ||
519 | |||
520 | struct static_resource_alloc { | ||
521 | SRAT_SUBTABLE_HEADER u8 proximity_domain_lo; | ||
522 | u8 apic_id; | ||
523 | |||
524 | /* Flags (32 bits) */ | ||
525 | |||
526 | u8 enabled:1; /* 00: Use affinity structure */ | ||
527 | u8:7; /* 01-07: Reserved, must be zero */ | ||
528 | u8 reserved3[3]; /* 08-31: Reserved, must be zero */ | ||
529 | |||
530 | u8 local_sapic_eid; | ||
531 | u8 proximity_domain_hi[3]; | ||
532 | u32 reserved4; /* Reserved, must be zero */ | ||
533 | }; | ||
534 | |||
535 | struct memory_affinity { | ||
536 | SRAT_SUBTABLE_HEADER u32 proximity_domain; | ||
537 | u16 reserved3; | ||
538 | u64 base_address; | ||
539 | u64 address_length; | ||
540 | u32 reserved4; | ||
117 | 541 | ||
118 | /* Flags (32 bits) */ | 542 | /* Flags (32 bits) */ |
119 | 543 | ||
120 | u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ | 544 | u8 enabled:1; /* 00: Use affinity structure */ |
121 | u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ | 545 | u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */ |
122 | u8 proc_c1:1; /* 02: All processors support C1 state */ | 546 | u8 non_volatile:1; /* 02: Memory is non-volatile */ |
123 | u8 plvl2_up:1; /* 03: C2 state works on MP system */ | 547 | u8:5; /* 03-07: Reserved, must be zero */ |
124 | u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ | 548 | u8 reserved5[3]; /* 08-31: Reserved, must be zero */ |
125 | u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ | 549 | |
126 | u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ | 550 | u64 reserved6; /* Reserved, must be zero */ |
127 | u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ | 551 | }; |
128 | u8 tmr_val_ext:1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ | 552 | |
129 | u8:7; /* 09-15: Reserved, must be zero */ | 553 | /******************************************************************************* |
130 | u8 reserved5[2]; /* 16-31: Reserved, must be zero */ | 554 | * |
555 | * TCPA - Trusted Computing Platform Alliance table | ||
556 | * | ||
557 | ******************************************************************************/ | ||
558 | |||
559 | struct acpi_table_tcpa { | ||
560 | ACPI_TABLE_HEADER_DEF u16 reserved; | ||
561 | u32 max_log_length; /* Maximum length for the event log area */ | ||
562 | u64 log_address; /* Address of the event log area */ | ||
131 | }; | 563 | }; |
132 | 564 | ||
565 | /******************************************************************************* | ||
566 | * | ||
567 | * WDRT - Watchdog Resource Table | ||
568 | * | ||
569 | ******************************************************************************/ | ||
570 | |||
571 | struct acpi_table_wdrt { | ||
572 | ACPI_TABLE_HEADER_DEF u32 header_length; /* Watchdog Header Length */ | ||
573 | u8 pci_segment; /* PCI Segment number */ | ||
574 | u8 pci_bus; /* PCI Bus number */ | ||
575 | u8 pci_device; /* PCI Device number */ | ||
576 | u8 pci_function; /* PCI Function number */ | ||
577 | u32 timer_period; /* Period of one timer count (msec) */ | ||
578 | u32 max_count; /* Maximum counter value supported */ | ||
579 | u32 min_count; /* Minimum counter value */ | ||
580 | u8 flags; | ||
581 | u8 reserved[3]; | ||
582 | u32 entries; /* Number of watchdog entries that follow */ | ||
583 | }; | ||
584 | |||
585 | #if 0 /* Flags, will be converted to macros */ | ||
586 | u8 enabled:1; /* 00: Timer enabled */ | ||
587 | u8:6; /* 01-06: Reserved */ | ||
588 | u8 sleep_stop:1; /* 07: Timer stopped in sleep state */ | ||
589 | #endif | ||
590 | |||
591 | /* Macros used to generate offsets to specific table fields */ | ||
592 | |||
593 | #define ACPI_ASF0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_info,f) | ||
594 | #define ACPI_ASF1_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_alert,f) | ||
595 | #define ACPI_ASF2_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_remote,f) | ||
596 | #define ACPI_ASF3_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f) | ||
597 | #define ACPI_ASF4_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_address,f) | ||
598 | #define ACPI_BOOT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_boot,f) | ||
599 | #define ACPI_CPEP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_cpep,f) | ||
600 | #define ACPI_CPEP0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_cpep_polling,f) | ||
601 | #define ACPI_DBGP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_dbgp,f) | ||
602 | #define ACPI_ECDT_OFFSET(f) (u8) ACPI_OFFSET (struct ec_boot_resources,f) | ||
603 | #define ACPI_HPET_OFFSET(f) (u8) ACPI_OFFSET (struct hpet_table,f) | ||
604 | #define ACPI_MADT_OFFSET(f) (u8) ACPI_OFFSET (struct multiple_apic_table,f) | ||
605 | #define ACPI_MADT0_OFFSET(f) (u8) ACPI_OFFSET (struct madt_processor_apic,f) | ||
606 | #define ACPI_MADT1_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_apic,f) | ||
607 | #define ACPI_MADT2_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_override,f) | ||
608 | #define ACPI_MADT3_OFFSET(f) (u8) ACPI_OFFSET (struct madt_nmi_source,f) | ||
609 | #define ACPI_MADT4_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f) | ||
610 | #define ACPI_MADT5_OFFSET(f) (u8) ACPI_OFFSET (struct madt_address_override,f) | ||
611 | #define ACPI_MADT6_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_sapic,f) | ||
612 | #define ACPI_MADT7_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_sapic,f) | ||
613 | #define ACPI_MADT8_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_source,f) | ||
614 | #define ACPI_MADTH_OFFSET(f) (u8) ACPI_OFFSET (struct apic_header,f) | ||
615 | #define ACPI_MCFG_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_mcfg,f) | ||
616 | #define ACPI_MCFG0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f) | ||
617 | #define ACPI_SBST_OFFSET(f) (u8) ACPI_OFFSET (struct smart_battery_table,f) | ||
618 | #define ACPI_SLIT_OFFSET(f) (u8) ACPI_OFFSET (struct system_locality_info,f) | ||
619 | #define ACPI_SPCR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spcr,f) | ||
620 | #define ACPI_SPMI_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spmi,f) | ||
621 | #define ACPI_SRAT_OFFSET(f) (u8) ACPI_OFFSET (struct system_resource_affinity,f) | ||
622 | #define ACPI_SRAT0_OFFSET(f) (u8) ACPI_OFFSET (struct static_resource_alloc,f) | ||
623 | #define ACPI_SRAT1_OFFSET(f) (u8) ACPI_OFFSET (struct memory_affinity,f) | ||
624 | #define ACPI_TCPA_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_tcpa,f) | ||
625 | #define ACPI_WDRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_wdrt,f) | ||
626 | |||
627 | #define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct hpet_table,f,o) | ||
628 | #define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o) | ||
629 | #define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct memory_affinity,f,o) | ||
630 | #define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o) | ||
631 | #define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o) | ||
632 | #define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o) | ||
633 | #define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o) | ||
634 | #define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o) | ||
635 | #define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o) | ||
636 | #define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o) | ||
637 | |||
638 | /* Reset to default packing */ | ||
639 | |||
133 | #pragma pack() | 640 | #pragma pack() |
134 | 641 | ||
135 | #endif /* __ACTBL1_H__ */ | 642 | #endif /* __ACTBL1_H__ */ |
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index dfc7ac1094bb..67efe6cad27b 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h | |||
@@ -44,234 +44,6 @@ | |||
44 | #ifndef __ACTBL2_H__ | 44 | #ifndef __ACTBL2_H__ |
45 | #define __ACTBL2_H__ | 45 | #define __ACTBL2_H__ |
46 | 46 | ||
47 | /* | 47 | /* Code moved to both actbl.h and actbl1.h */ |
48 | * Prefered Power Management Profiles | ||
49 | */ | ||
50 | #define PM_UNSPECIFIED 0 | ||
51 | #define PM_DESKTOP 1 | ||
52 | #define PM_MOBILE 2 | ||
53 | #define PM_WORKSTATION 3 | ||
54 | #define PM_ENTERPRISE_SERVER 4 | ||
55 | #define PM_SOHO_SERVER 5 | ||
56 | #define PM_APPLIANCE_PC 6 | ||
57 | |||
58 | /* | ||
59 | * ACPI Boot Arch Flags | ||
60 | */ | ||
61 | #define BAF_LEGACY_DEVICES 0x0001 | ||
62 | #define BAF_8042_KEYBOARD_CONTROLLER 0x0002 | ||
63 | |||
64 | #define FADT2_REVISION_ID 3 | ||
65 | #define FADT2_MINUS_REVISION_ID 2 | ||
66 | |||
67 | #pragma pack(1) | ||
68 | |||
69 | /* | ||
70 | * ACPI 2.0 Root System Description Table (RSDT) | ||
71 | */ | ||
72 | struct rsdt_descriptor_rev2 { | ||
73 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
74 | u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ | ||
75 | }; | ||
76 | |||
77 | /* | ||
78 | * ACPI 2.0 Extended System Description Table (XSDT) | ||
79 | */ | ||
80 | struct xsdt_descriptor_rev2 { | ||
81 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
82 | u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ | ||
83 | }; | ||
84 | |||
85 | /* | ||
86 | * ACPI 2.0 Firmware ACPI Control Structure (FACS) | ||
87 | */ | ||
88 | struct facs_descriptor_rev2 { | ||
89 | char signature[4]; /* ASCII table signature */ | ||
90 | u32 length; /* Length of structure, in bytes */ | ||
91 | u32 hardware_signature; /* Hardware configuration signature */ | ||
92 | u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */ | ||
93 | u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ | ||
94 | |||
95 | /* Flags (32 bits) */ | ||
96 | |||
97 | u8 S4bios_f:1; /* 00: S4BIOS support is present */ | ||
98 | u8:7; /* 01-07: Reserved, must be zero */ | ||
99 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ | ||
100 | |||
101 | u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */ | ||
102 | u8 version; /* Version of this table */ | ||
103 | u8 reserved3[31]; /* Reserved, must be zero */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | * ACPI 2.0+ Generic Address Structure (GAS) | ||
108 | */ | ||
109 | struct acpi_generic_address { | ||
110 | u8 address_space_id; /* Address space where struct or register exists. */ | ||
111 | u8 register_bit_width; /* Size in bits of given register */ | ||
112 | u8 register_bit_offset; /* Bit offset within the register */ | ||
113 | u8 access_width; /* Minimum Access size (ACPI 3.0) */ | ||
114 | u64 address; /* 64-bit address of struct or register */ | ||
115 | }; | ||
116 | |||
117 | #define FADT_REV2_COMMON \ | ||
118 | u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ | ||
119 | u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ | ||
120 | u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ | ||
121 | u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ | ||
122 | u16 sci_int; /* System vector of SCI interrupt */ \ | ||
123 | u32 smi_cmd; /* Port address of SMI command port */ \ | ||
124 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ | ||
125 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ | ||
126 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ | ||
127 | u8 pstate_cnt; /* Processor performance state control*/ \ | ||
128 | u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ \ | ||
129 | u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ \ | ||
130 | u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ | ||
131 | u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ | ||
132 | u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ | ||
133 | u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ | ||
134 | u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ | ||
135 | u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ | ||
136 | u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \ | ||
137 | u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \ | ||
138 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ | ||
139 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ | ||
140 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ | ||
141 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ | ||
142 | u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ | ||
143 | u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ | ||
144 | u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ | ||
145 | u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ | ||
146 | u16 flush_size; /* Number of flush strides that need to be read */ \ | ||
147 | u16 flush_stride; /* Processor's memory cache line width, in bytes */ \ | ||
148 | u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ | ||
149 | u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ | ||
150 | u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ | ||
151 | u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ | ||
152 | u8 century; /* Index to century in RTC CMOS RAM */ \ | ||
153 | u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ | ||
154 | |||
155 | /* | ||
156 | * ACPI 2.0+ Fixed ACPI Description Table (FADT) | ||
157 | */ | ||
158 | struct fadt_descriptor_rev2 { | ||
159 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
160 | FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ | ||
161 | |||
162 | /* Flags (32 bits) */ | ||
163 | |||
164 | u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ | ||
165 | u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ | ||
166 | u8 proc_c1:1; /* 02: All processors support C1 state */ | ||
167 | u8 plvl2_up:1; /* 03: C2 state works on MP system */ | ||
168 | u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ | ||
169 | u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ | ||
170 | u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ | ||
171 | u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ | ||
172 | u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */ | ||
173 | u8 dock_cap:1; /* 09: Docking supported */ | ||
174 | u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */ | ||
175 | u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */ | ||
176 | u8 headless:1; /* 12: No local video capabilities or local input devices */ | ||
177 | u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */ | ||
178 | |||
179 | u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ | ||
180 | u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ | ||
181 | u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ | ||
182 | u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */ | ||
183 | u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ | ||
184 | u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */ | ||
185 | u8:4; /* 20-23: Reserved, must be zero */ | ||
186 | u8 reserved3; /* 24-31: Reserved, must be zero */ | ||
187 | |||
188 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
189 | u8 reset_value; /* Value to write to the reset_register port to reset the system */ | ||
190 | u8 reserved4[3]; /* These three bytes must be zero */ | ||
191 | u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ | ||
192 | u64 Xdsdt; /* 64-bit physical address of DSDT */ | ||
193 | struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ | ||
194 | struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ | ||
195 | struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ | ||
196 | struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ | ||
197 | struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ | ||
198 | struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ | ||
199 | struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ | ||
200 | struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ | ||
201 | }; | ||
202 | |||
203 | /* "Down-revved" ACPI 2.0 FADT descriptor */ | ||
204 | |||
205 | struct fadt_descriptor_rev2_minus { | ||
206 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
207 | FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ | ||
208 | u32 flags; | ||
209 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
210 | u8 reset_value; /* Value to write to the reset_register port to reset the system. */ | ||
211 | u8 reserved7[3]; /* Reserved, must be zero */ | ||
212 | }; | ||
213 | |||
214 | /* ECDT - Embedded Controller Boot Resources Table */ | ||
215 | |||
216 | struct ec_boot_resources { | ||
217 | ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ | ||
218 | struct acpi_generic_address ec_data; /* Address of EC data register */ | ||
219 | u32 uid; /* Unique ID - must be same as the EC _UID method */ | ||
220 | u8 gpe_bit; /* The GPE for the EC */ | ||
221 | u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ | ||
222 | }; | ||
223 | |||
224 | /* SRAT - System Resource Affinity Table */ | ||
225 | |||
226 | struct static_resource_alloc { | ||
227 | u8 type; | ||
228 | u8 length; | ||
229 | u8 proximity_domain_lo; | ||
230 | u8 apic_id; | ||
231 | |||
232 | /* Flags (32 bits) */ | ||
233 | |||
234 | u8 enabled:1; /* 00: Use affinity structure */ | ||
235 | u8:7; /* 01-07: Reserved, must be zero */ | ||
236 | u8 reserved3[3]; /* 08-31: Reserved, must be zero */ | ||
237 | |||
238 | u8 local_sapic_eid; | ||
239 | u8 proximity_domain_hi[3]; | ||
240 | u32 reserved4; /* Reserved, must be zero */ | ||
241 | }; | ||
242 | |||
243 | struct memory_affinity { | ||
244 | u8 type; | ||
245 | u8 length; | ||
246 | u32 proximity_domain; | ||
247 | u16 reserved3; | ||
248 | u64 base_address; | ||
249 | u64 address_length; | ||
250 | u32 reserved4; | ||
251 | |||
252 | /* Flags (32 bits) */ | ||
253 | |||
254 | u8 enabled:1; /* 00: Use affinity structure */ | ||
255 | u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */ | ||
256 | u8 non_volatile:1; /* 02: Memory is non-volatile */ | ||
257 | u8:5; /* 03-07: Reserved, must be zero */ | ||
258 | u8 reserved5[3]; /* 08-31: Reserved, must be zero */ | ||
259 | |||
260 | u64 reserved6; /* Reserved, must be zero */ | ||
261 | }; | ||
262 | |||
263 | struct system_resource_affinity { | ||
264 | ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ | ||
265 | u64 reserved2; /* Reserved, must be zero */ | ||
266 | }; | ||
267 | |||
268 | /* SLIT - System Locality Distance Information Table */ | ||
269 | |||
270 | struct system_locality_info { | ||
271 | ACPI_TABLE_HEADER_DEF u64 locality_count; | ||
272 | u8 entry[1][1]; | ||
273 | }; | ||
274 | |||
275 | #pragma pack() | ||
276 | 48 | ||
277 | #endif /* __ACTBL2_H__ */ | 49 | #endif /* __ACTBL2_H__ */ |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 7ca89cde706e..77cf1236b05a 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #ifndef __ACTYPES_H__ | 44 | #ifndef __ACTYPES_H__ |
45 | #define __ACTYPES_H__ | 45 | #define __ACTYPES_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | /* | 49 | /* |
48 | * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header | 50 | * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header |
49 | * and must be either 16, 32, or 64 | 51 | * and must be either 16, 32, or 64 |
@@ -154,7 +156,6 @@ typedef u64 acpi_physical_address; | |||
154 | #define ACPI_MAX_PTR ACPI_UINT64_MAX | 156 | #define ACPI_MAX_PTR ACPI_UINT64_MAX |
155 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX | 157 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX |
156 | 158 | ||
157 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 | ||
158 | #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ | 159 | #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ |
159 | 160 | ||
160 | /* | 161 | /* |
@@ -195,8 +196,6 @@ typedef u64 acpi_physical_address; | |||
195 | #define ACPI_MAX_PTR ACPI_UINT32_MAX | 196 | #define ACPI_MAX_PTR ACPI_UINT32_MAX |
196 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX | 197 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX |
197 | 198 | ||
198 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 | ||
199 | |||
200 | /******************************************************************************* | 199 | /******************************************************************************* |
201 | * | 200 | * |
202 | * Types specific to 16-bit targets | 201 | * Types specific to 16-bit targets |
@@ -223,7 +222,6 @@ typedef char *acpi_physical_address; | |||
223 | #define ACPI_MAX_PTR ACPI_UINT16_MAX | 222 | #define ACPI_MAX_PTR ACPI_UINT16_MAX |
224 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX | 223 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX |
225 | 224 | ||
226 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 | ||
227 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ | 225 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ |
228 | 226 | ||
229 | /* 64-bit integers cannot be supported */ | 227 | /* 64-bit integers cannot be supported */ |
@@ -254,7 +252,7 @@ typedef acpi_native_uint acpi_size; | |||
254 | /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ | 252 | /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ |
255 | 253 | ||
256 | #ifndef acpi_uintptr_t | 254 | #ifndef acpi_uintptr_t |
257 | #define acpi_uintptr_t void * | 255 | #define acpi_uintptr_t void * |
258 | #endif | 256 | #endif |
259 | 257 | ||
260 | /* | 258 | /* |
@@ -263,7 +261,7 @@ typedef acpi_native_uint acpi_size; | |||
263 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) | 261 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) |
264 | */ | 262 | */ |
265 | #ifndef acpi_cache_t | 263 | #ifndef acpi_cache_t |
266 | #define acpi_cache_t struct acpi_memory_list | 264 | #define acpi_cache_t struct acpi_memory_list |
267 | #endif | 265 | #endif |
268 | 266 | ||
269 | /* | 267 | /* |
@@ -271,7 +269,7 @@ typedef acpi_native_uint acpi_size; | |||
271 | * lock and unlock OSL interfaces. | 269 | * lock and unlock OSL interfaces. |
272 | */ | 270 | */ |
273 | #ifndef acpi_cpu_flags | 271 | #ifndef acpi_cpu_flags |
274 | #define acpi_cpu_flags acpi_native_uint | 272 | #define acpi_cpu_flags acpi_native_uint |
275 | #endif | 273 | #endif |
276 | 274 | ||
277 | /* | 275 | /* |
@@ -292,6 +290,21 @@ typedef acpi_native_uint acpi_size; | |||
292 | #define ACPI_UNUSED_VAR | 290 | #define ACPI_UNUSED_VAR |
293 | #endif | 291 | #endif |
294 | 292 | ||
293 | /* | ||
294 | * All ACPICA functions that are available to the rest of the kernel are | ||
295 | * tagged with this macro which can be defined as appropriate for the host. | ||
296 | */ | ||
297 | #ifndef ACPI_EXPORT_SYMBOL | ||
298 | #define ACPI_EXPORT_SYMBOL(symbol) | ||
299 | #endif | ||
300 | |||
301 | /* | ||
302 | * thread_id is returned by acpi_os_get_thread_id. | ||
303 | */ | ||
304 | #ifndef acpi_thread_id | ||
305 | #define acpi_thread_id acpi_native_uint | ||
306 | #endif | ||
307 | |||
295 | /******************************************************************************* | 308 | /******************************************************************************* |
296 | * | 309 | * |
297 | * Independent types | 310 | * Independent types |
@@ -477,15 +490,15 @@ typedef u64 acpi_integer; | |||
477 | */ | 490 | */ |
478 | typedef u32 acpi_table_type; | 491 | typedef u32 acpi_table_type; |
479 | 492 | ||
480 | #define ACPI_TABLE_RSDP (acpi_table_type) 0 | 493 | #define ACPI_TABLE_ID_RSDP (acpi_table_type) 0 |
481 | #define ACPI_TABLE_DSDT (acpi_table_type) 1 | 494 | #define ACPI_TABLE_ID_DSDT (acpi_table_type) 1 |
482 | #define ACPI_TABLE_FADT (acpi_table_type) 2 | 495 | #define ACPI_TABLE_ID_FADT (acpi_table_type) 2 |
483 | #define ACPI_TABLE_FACS (acpi_table_type) 3 | 496 | #define ACPI_TABLE_ID_FACS (acpi_table_type) 3 |
484 | #define ACPI_TABLE_PSDT (acpi_table_type) 4 | 497 | #define ACPI_TABLE_ID_PSDT (acpi_table_type) 4 |
485 | #define ACPI_TABLE_SSDT (acpi_table_type) 5 | 498 | #define ACPI_TABLE_ID_SSDT (acpi_table_type) 5 |
486 | #define ACPI_TABLE_XSDT (acpi_table_type) 6 | 499 | #define ACPI_TABLE_ID_XSDT (acpi_table_type) 6 |
487 | #define ACPI_TABLE_MAX 6 | 500 | #define ACPI_TABLE_ID_MAX 6 |
488 | #define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1) | 501 | #define ACPI_NUM_TABLE_TYPES (ACPI_TABLE_ID_MAX+1) |
489 | 502 | ||
490 | /* | 503 | /* |
491 | * Types associated with ACPI names and objects. The first group of | 504 | * Types associated with ACPI names and objects. The first group of |
@@ -816,7 +829,7 @@ struct acpi_system_info { | |||
816 | u32 debug_level; | 829 | u32 debug_level; |
817 | u32 debug_layer; | 830 | u32 debug_layer; |
818 | u32 num_table_types; | 831 | u32 num_table_types; |
819 | struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES]; | 832 | struct acpi_table_info table_info[ACPI_TABLE_ID_MAX + 1]; |
820 | }; | 833 | }; |
821 | 834 | ||
822 | /* | 835 | /* |
@@ -858,7 +871,7 @@ acpi_status(*acpi_adr_space_handler) (u32 function, | |||
858 | void *handler_context, | 871 | void *handler_context, |
859 | void *region_context); | 872 | void *region_context); |
860 | 873 | ||
861 | #define ACPI_DEFAULT_HANDLER NULL | 874 | #define ACPI_DEFAULT_HANDLER NULL |
862 | 875 | ||
863 | typedef | 876 | typedef |
864 | acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, | 877 | acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, |
@@ -911,12 +924,13 @@ struct acpi_compatible_id_list { | |||
911 | #define ACPI_STA_DEVICE_PRESENT 0x01 | 924 | #define ACPI_STA_DEVICE_PRESENT 0x01 |
912 | #define ACPI_STA_DEVICE_ENABLED 0x02 | 925 | #define ACPI_STA_DEVICE_ENABLED 0x02 |
913 | #define ACPI_STA_DEVICE_UI 0x04 | 926 | #define ACPI_STA_DEVICE_UI 0x04 |
914 | #define ACPI_STA_DEVICE_OK 0x08 | 927 | #define ACPI_STA_DEVICE_FUNCTIONING 0x08 |
928 | #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ | ||
915 | #define ACPI_STA_BATTERY_PRESENT 0x10 | 929 | #define ACPI_STA_BATTERY_PRESENT 0x10 |
916 | 930 | ||
917 | #define ACPI_COMMON_OBJ_INFO \ | 931 | #define ACPI_COMMON_OBJ_INFO \ |
918 | acpi_object_type type; /* ACPI object type */ \ | 932 | acpi_object_type type; /* ACPI object type */ \ |
919 | acpi_name name /* ACPI object Name */ | 933 | acpi_name name /* ACPI object Name */ |
920 | 934 | ||
921 | struct acpi_obj_info_header { | 935 | struct acpi_obj_info_header { |
922 | ACPI_COMMON_OBJ_INFO; | 936 | ACPI_COMMON_OBJ_INFO; |
@@ -957,7 +971,7 @@ struct acpi_mem_space_context { | |||
957 | * Definitions for Resource Attributes | 971 | * Definitions for Resource Attributes |
958 | */ | 972 | */ |
959 | typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ | 973 | typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ |
960 | typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ | 974 | typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */ |
961 | 975 | ||
962 | /* | 976 | /* |
963 | * Memory Attributes | 977 | * Memory Attributes |
@@ -972,8 +986,8 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6 | |||
972 | 986 | ||
973 | /* | 987 | /* |
974 | * IO Attributes | 988 | * IO Attributes |
975 | * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh. | 989 | * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. |
976 | * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh. | 990 | * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. |
977 | */ | 991 | */ |
978 | #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 | 992 | #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 |
979 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 | 993 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 |
@@ -1171,12 +1185,12 @@ struct acpi_resource_source { | |||
1171 | /* Fields common to all address descriptors, 16/32/64 bit */ | 1185 | /* Fields common to all address descriptors, 16/32/64 bit */ |
1172 | 1186 | ||
1173 | #define ACPI_RESOURCE_ADDRESS_COMMON \ | 1187 | #define ACPI_RESOURCE_ADDRESS_COMMON \ |
1174 | u8 resource_type; \ | 1188 | u8 resource_type; \ |
1175 | u8 producer_consumer; \ | 1189 | u8 producer_consumer; \ |
1176 | u8 decode; \ | 1190 | u8 decode; \ |
1177 | u8 min_address_fixed; \ | 1191 | u8 min_address_fixed; \ |
1178 | u8 max_address_fixed; \ | 1192 | u8 max_address_fixed; \ |
1179 | union acpi_resource_attribute info; | 1193 | union acpi_resource_attribute info; |
1180 | 1194 | ||
1181 | struct acpi_resource_address { | 1195 | struct acpi_resource_address { |
1182 | ACPI_RESOURCE_ADDRESS_COMMON}; | 1196 | ACPI_RESOURCE_ADDRESS_COMMON}; |
@@ -1297,16 +1311,6 @@ struct acpi_resource { | |||
1297 | 1311 | ||
1298 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) | 1312 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) |
1299 | 1313 | ||
1300 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | ||
1301 | #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) | ||
1302 | #else | ||
1303 | #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) | ||
1304 | #endif | ||
1305 | |||
1306 | /* | ||
1307 | * END: of definitions for Resource Attributes | ||
1308 | */ | ||
1309 | |||
1310 | struct acpi_pci_routing_table { | 1314 | struct acpi_pci_routing_table { |
1311 | u32 length; | 1315 | u32 length; |
1312 | u32 pin; | 1316 | u32 pin; |
@@ -1315,8 +1319,4 @@ struct acpi_pci_routing_table { | |||
1315 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ | 1319 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ |
1316 | }; | 1320 | }; |
1317 | 1321 | ||
1318 | /* | ||
1319 | * END: of definitions for PCI Routing tables | ||
1320 | */ | ||
1321 | |||
1322 | #endif /* __ACTYPES_H__ */ | 1322 | #endif /* __ACTYPES_H__ */ |
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 0927765df6aa..ba039ea1a057 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h | |||
@@ -50,24 +50,24 @@ extern const u8 acpi_gbl_resource_aml_sizes[]; | |||
50 | 50 | ||
51 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | 51 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) |
52 | 52 | ||
53 | extern const char *acpi_gbl_BMdecode[2]; | 53 | extern const char *acpi_gbl_bm_decode[]; |
54 | extern const char *acpi_gbl_config_decode[4]; | 54 | extern const char *acpi_gbl_config_decode[]; |
55 | extern const char *acpi_gbl_consume_decode[2]; | 55 | extern const char *acpi_gbl_consume_decode[]; |
56 | extern const char *acpi_gbl_DECdecode[2]; | 56 | extern const char *acpi_gbl_dec_decode[]; |
57 | extern const char *acpi_gbl_HEdecode[2]; | 57 | extern const char *acpi_gbl_he_decode[]; |
58 | extern const char *acpi_gbl_io_decode[2]; | 58 | extern const char *acpi_gbl_io_decode[]; |
59 | extern const char *acpi_gbl_LLdecode[2]; | 59 | extern const char *acpi_gbl_ll_decode[]; |
60 | extern const char *acpi_gbl_max_decode[2]; | 60 | extern const char *acpi_gbl_max_decode[]; |
61 | extern const char *acpi_gbl_MEMdecode[4]; | 61 | extern const char *acpi_gbl_mem_decode[]; |
62 | extern const char *acpi_gbl_min_decode[2]; | 62 | extern const char *acpi_gbl_min_decode[]; |
63 | extern const char *acpi_gbl_MTPdecode[4]; | 63 | extern const char *acpi_gbl_mtp_decode[]; |
64 | extern const char *acpi_gbl_RNGdecode[4]; | 64 | extern const char *acpi_gbl_rng_decode[]; |
65 | extern const char *acpi_gbl_RWdecode[2]; | 65 | extern const char *acpi_gbl_rw_decode[]; |
66 | extern const char *acpi_gbl_SHRdecode[2]; | 66 | extern const char *acpi_gbl_shr_decode[]; |
67 | extern const char *acpi_gbl_SIZdecode[4]; | 67 | extern const char *acpi_gbl_siz_decode[]; |
68 | extern const char *acpi_gbl_TRSdecode[2]; | 68 | extern const char *acpi_gbl_trs_decode[]; |
69 | extern const char *acpi_gbl_TTPdecode[2]; | 69 | extern const char *acpi_gbl_ttp_decode[]; |
70 | extern const char *acpi_gbl_TYPdecode[4]; | 70 | extern const char *acpi_gbl_typ_decode[]; |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | /* Types for Resource descriptor entries */ | 73 | /* Types for Resource descriptor entries */ |
@@ -78,6 +78,12 @@ extern const char *acpi_gbl_TYPdecode[4]; | |||
78 | #define ACPI_SMALL_VARIABLE_LENGTH 3 | 78 | #define ACPI_SMALL_VARIABLE_LENGTH 3 |
79 | 79 | ||
80 | typedef | 80 | typedef |
81 | acpi_status(*acpi_walk_aml_callback) (u8 * aml, | ||
82 | u32 length, | ||
83 | u32 offset, | ||
84 | u8 resource_index, void **context); | ||
85 | |||
86 | typedef | ||
81 | acpi_status(*acpi_pkg_callback) (u8 object_type, | 87 | acpi_status(*acpi_pkg_callback) (u8 object_type, |
82 | union acpi_operand_object * source_object, | 88 | union acpi_operand_object * source_object, |
83 | union acpi_generic_state * state, | 89 | union acpi_generic_state * state, |
@@ -277,6 +283,8 @@ acpi_ut_ptr_exit(u32 line_number, | |||
277 | 283 | ||
278 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); | 284 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); |
279 | 285 | ||
286 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display); | ||
287 | |||
280 | void acpi_ut_report_error(char *module_name, u32 line_number); | 288 | void acpi_ut_report_error(char *module_name, u32 line_number); |
281 | 289 | ||
282 | void acpi_ut_report_info(char *module_name, u32 line_number); | 290 | void acpi_ut_report_info(char *module_name, u32 line_number); |
@@ -445,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
445 | /* | 453 | /* |
446 | * utmisc | 454 | * utmisc |
447 | */ | 455 | */ |
456 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table); | ||
457 | |||
448 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); | 458 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); |
449 | 459 | ||
450 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id); | 460 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id); |
@@ -460,7 +470,9 @@ void acpi_ut_print_string(char *string, u8 max_length); | |||
460 | 470 | ||
461 | u8 acpi_ut_valid_acpi_name(u32 name); | 471 | u8 acpi_ut_valid_acpi_name(u32 name); |
462 | 472 | ||
463 | u8 acpi_ut_valid_acpi_character(char character); | 473 | acpi_name acpi_ut_repair_name(acpi_name name); |
474 | |||
475 | u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position); | ||
464 | 476 | ||
465 | acpi_status | 477 | acpi_status |
466 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | 478 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); |
@@ -469,6 +481,25 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | |||
469 | 481 | ||
470 | #define ACPI_ANY_BASE 0 | 482 | #define ACPI_ANY_BASE 0 |
471 | 483 | ||
484 | u32 acpi_ut_dword_byte_swap(u32 value); | ||
485 | |||
486 | void acpi_ut_set_integer_width(u8 revision); | ||
487 | |||
488 | #ifdef ACPI_DEBUG_OUTPUT | ||
489 | void | ||
490 | acpi_ut_display_init_pathname(u8 type, | ||
491 | struct acpi_namespace_node *obj_handle, | ||
492 | char *path); | ||
493 | #endif | ||
494 | |||
495 | /* | ||
496 | * utresrc | ||
497 | */ | ||
498 | acpi_status | ||
499 | acpi_ut_walk_aml_resources(u8 * aml, | ||
500 | acpi_size aml_length, | ||
501 | acpi_walk_aml_callback user_function, void **context); | ||
502 | |||
472 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); | 503 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); |
473 | 504 | ||
474 | u32 acpi_ut_get_descriptor_length(void *aml); | 505 | u32 acpi_ut_get_descriptor_length(void *aml); |
@@ -483,20 +514,6 @@ acpi_status | |||
483 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, | 514 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, |
484 | u8 ** end_tag); | 515 | u8 ** end_tag); |
485 | 516 | ||
486 | u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); | ||
487 | |||
488 | u32 acpi_ut_dword_byte_swap(u32 value); | ||
489 | |||
490 | void acpi_ut_set_integer_width(u8 revision); | ||
491 | |||
492 | #ifdef ACPI_DEBUG_OUTPUT | ||
493 | void | ||
494 | acpi_ut_display_init_pathname(u8 type, | ||
495 | struct acpi_namespace_node *obj_handle, | ||
496 | char *path); | ||
497 | |||
498 | #endif | ||
499 | |||
500 | /* | 517 | /* |
501 | * utmutex - mutex support | 518 | * utmutex - mutex support |
502 | */ | 519 | */ |
@@ -523,14 +540,15 @@ acpi_ut_initialize_buffer(struct acpi_buffer *buffer, | |||
523 | 540 | ||
524 | void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); | 541 | void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); |
525 | 542 | ||
526 | void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line); | 543 | void *acpi_ut_allocate_zeroed(acpi_size size, |
544 | u32 component, char *module, u32 line); | ||
527 | 545 | ||
528 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 546 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
529 | void *acpi_ut_allocate_and_track(acpi_size size, | 547 | void *acpi_ut_allocate_and_track(acpi_size size, |
530 | u32 component, char *module, u32 line); | 548 | u32 component, char *module, u32 line); |
531 | 549 | ||
532 | void *acpi_ut_callocate_and_track(acpi_size size, | 550 | void *acpi_ut_allocate_zeroed_and_track(acpi_size size, |
533 | u32 component, char *module, u32 line); | 551 | u32 component, char *module, u32 line); |
534 | 552 | ||
535 | void | 553 | void |
536 | acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); | 554 | acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); |
@@ -540,6 +558,11 @@ void acpi_ut_dump_allocation_info(void); | |||
540 | #endif /* ACPI_FUTURE_USAGE */ | 558 | #endif /* ACPI_FUTURE_USAGE */ |
541 | 559 | ||
542 | void acpi_ut_dump_allocations(u32 component, char *module); | 560 | void acpi_ut_dump_allocations(u32 component, char *module); |
561 | |||
562 | acpi_status | ||
563 | acpi_ut_create_list(char *list_name, | ||
564 | u16 object_size, struct acpi_memory_list **return_cache); | ||
565 | |||
543 | #endif | 566 | #endif |
544 | 567 | ||
545 | #endif /* _ACUTILS_H */ | 568 | #endif /* _ACUTILS_H */ |
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 37964a59aef8..cf18426a87b1 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h | |||
@@ -180,8 +180,10 @@ | |||
180 | #define AML_BANK_FIELD_OP (u16) 0x5b87 | 180 | #define AML_BANK_FIELD_OP (u16) 0x5b87 |
181 | #define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ | 181 | #define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ |
182 | 182 | ||
183 | /* Bogus opcodes (they are actually two separate opcodes) */ | 183 | /* |
184 | 184 | * Combination opcodes (actually two one-byte opcodes) | |
185 | * Used by the disassembler and i_aSL compiler | ||
186 | */ | ||
185 | #define AML_LGREATEREQUAL_OP (u16) 0x9295 | 187 | #define AML_LGREATEREQUAL_OP (u16) 0x9295 |
186 | #define AML_LLESSEQUAL_OP (u16) 0x9294 | 188 | #define AML_LLESSEQUAL_OP (u16) 0x9294 |
187 | #define AML_LNOTEQUAL_OP (u16) 0x9293 | 189 | #define AML_LNOTEQUAL_OP (u16) 0x9293 |
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index fb4735315ad3..be03818af9d1 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h | |||
@@ -42,39 +42,45 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
46 | |||
45 | #ifndef __AMLRESRC_H | 47 | #ifndef __AMLRESRC_H |
46 | #define __AMLRESRC_H | 48 | #define __AMLRESRC_H |
47 | 49 | ||
48 | #define ASL_RESNAME_ADDRESS "_ADR" | 50 | /* |
49 | #define ASL_RESNAME_ALIGNMENT "_ALN" | 51 | * Resource descriptor tags, as defined in the ACPI specification. |
50 | #define ASL_RESNAME_ADDRESSSPACE "_ASI" | 52 | * Used to symbolically reference fields within a descriptor. |
51 | #define ASL_RESNAME_ACCESSSIZE "_ASZ" | 53 | */ |
52 | #define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" | 54 | #define ACPI_RESTAG_ADDRESS "_ADR" |
53 | #define ASL_RESNAME_BASEADDRESS "_BAS" | 55 | #define ACPI_RESTAG_ALIGNMENT "_ALN" |
54 | #define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ | 56 | #define ACPI_RESTAG_ADDRESSSPACE "_ASI" |
55 | #define ASL_RESNAME_DECODE "_DEC" | 57 | #define ACPI_RESTAG_ACCESSSIZE "_ASZ" |
56 | #define ASL_RESNAME_DMA "_DMA" | 58 | #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" |
57 | #define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ | 59 | #define ACPI_RESTAG_BASEADDRESS "_BAS" |
58 | #define ASL_RESNAME_GRANULARITY "_GRA" | 60 | #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ |
59 | #define ASL_RESNAME_INTERRUPT "_INT" | 61 | #define ACPI_RESTAG_DECODE "_DEC" |
60 | #define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ | 62 | #define ACPI_RESTAG_DMA "_DMA" |
61 | #define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ | 63 | #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ |
62 | #define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ | 64 | #define ACPI_RESTAG_GRANULARITY "_GRA" |
63 | #define ASL_RESNAME_LENGTH "_LEN" | 65 | #define ACPI_RESTAG_INTERRUPT "_INT" |
64 | #define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ | 66 | #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ |
65 | #define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ | 67 | #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ |
66 | #define ASL_RESNAME_MAXADDR "_MAX" | 68 | #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ |
67 | #define ASL_RESNAME_MINADDR "_MIN" | 69 | #define ACPI_RESTAG_LENGTH "_LEN" |
68 | #define ASL_RESNAME_MAXTYPE "_MAF" | 70 | #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ |
69 | #define ASL_RESNAME_MINTYPE "_MIF" | 71 | #define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ |
70 | #define ASL_RESNAME_REGISTERBITOFFSET "_RBO" | 72 | #define ACPI_RESTAG_MAXADDR "_MAX" |
71 | #define ASL_RESNAME_REGISTERBITWIDTH "_RBW" | 73 | #define ACPI_RESTAG_MINADDR "_MIN" |
72 | #define ASL_RESNAME_RANGETYPE "_RNG" | 74 | #define ACPI_RESTAG_MAXTYPE "_MAF" |
73 | #define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ | 75 | #define ACPI_RESTAG_MINTYPE "_MIF" |
74 | #define ASL_RESNAME_TRANSLATION "_TRA" | 76 | #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" |
75 | #define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ | 77 | #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" |
76 | #define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ | 78 | #define ACPI_RESTAG_RANGETYPE "_RNG" |
77 | #define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ | 79 | #define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ |
80 | #define ACPI_RESTAG_TRANSLATION "_TRA" | ||
81 | #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ | ||
82 | #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ | ||
83 | #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */ | ||
78 | 84 | ||
79 | /* Default sizes for "small" resource descriptors */ | 85 | /* Default sizes for "small" resource descriptors */ |
80 | 86 | ||
@@ -109,7 +115,7 @@ struct asl_resource_node { | |||
109 | * SMALL descriptors | 115 | * SMALL descriptors |
110 | */ | 116 | */ |
111 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ | 117 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ |
112 | u8 descriptor_type; | 118 | u8 descriptor_type; |
113 | 119 | ||
114 | struct aml_resource_small_header { | 120 | struct aml_resource_small_header { |
115 | AML_RESOURCE_SMALL_HEADER_COMMON}; | 121 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
@@ -162,8 +168,8 @@ struct aml_resource_end_tag { | |||
162 | * LARGE descriptors | 168 | * LARGE descriptors |
163 | */ | 169 | */ |
164 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ | 170 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ |
165 | u8 descriptor_type;\ | 171 | u8 descriptor_type;\ |
166 | u16 resource_length; | 172 | u16 resource_length; |
167 | 173 | ||
168 | struct aml_resource_large_header { | 174 | struct aml_resource_large_header { |
169 | AML_RESOURCE_LARGE_HEADER_COMMON}; | 175 | AML_RESOURCE_LARGE_HEADER_COMMON}; |
@@ -194,9 +200,9 @@ struct aml_resource_fixed_memory32 { | |||
194 | }; | 200 | }; |
195 | 201 | ||
196 | #define AML_RESOURCE_ADDRESS_COMMON \ | 202 | #define AML_RESOURCE_ADDRESS_COMMON \ |
197 | u8 resource_type; \ | 203 | u8 resource_type; \ |
198 | u8 flags; \ | 204 | u8 flags; \ |
199 | u8 specific_flags; | 205 | u8 specific_flags; |
200 | 206 | ||
201 | struct aml_resource_address { | 207 | struct aml_resource_address { |
202 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; | 208 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; |
@@ -266,6 +272,7 @@ struct aml_resource_generic_register { | |||
266 | union aml_resource { | 272 | union aml_resource { |
267 | /* Descriptor headers */ | 273 | /* Descriptor headers */ |
268 | 274 | ||
275 | u8 descriptor_type; | ||
269 | struct aml_resource_small_header small_header; | 276 | struct aml_resource_small_header small_header; |
270 | struct aml_resource_large_header large_header; | 277 | struct aml_resource_large_header large_header; |
271 | 278 | ||
@@ -296,9 +303,9 @@ union aml_resource { | |||
296 | /* Utility overlays */ | 303 | /* Utility overlays */ |
297 | 304 | ||
298 | struct aml_resource_address address; | 305 | struct aml_resource_address address; |
299 | u32 u32_item; | 306 | u32 dword_item; |
300 | u16 u16_item; | 307 | u16 word_item; |
301 | u8 U8item; | 308 | u8 byte_item; |
302 | }; | 309 | }; |
303 | 310 | ||
304 | #endif | 311 | #endif |
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 223ec6467108..453a469fd397 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h | |||
@@ -49,33 +49,41 @@ | |||
49 | */ | 49 | */ |
50 | 50 | ||
51 | #ifdef ACPI_LIBRARY | 51 | #ifdef ACPI_LIBRARY |
52 | /* | ||
53 | * Note: The non-debug version of the acpi_library does not contain any | ||
54 | * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG | ||
55 | */ | ||
52 | #define ACPI_USE_LOCAL_CACHE | 56 | #define ACPI_USE_LOCAL_CACHE |
53 | #endif | 57 | #endif |
54 | 58 | ||
55 | #ifdef ACPI_DUMP_APP | 59 | #ifdef ACPI_ASL_COMPILER |
56 | #ifndef MSDOS | ||
57 | #define ACPI_DEBUG_OUTPUT | 60 | #define ACPI_DEBUG_OUTPUT |
58 | #endif | ||
59 | #define ACPI_APPLICATION | 61 | #define ACPI_APPLICATION |
60 | #define ACPI_DISASSEMBLER | 62 | #define ACPI_DISASSEMBLER |
61 | #define ACPI_NO_METHOD_EXECUTION | 63 | #define ACPI_CONSTANT_EVAL_ONLY |
64 | #define ACPI_LARGE_NAMESPACE_NODE | ||
65 | #define ACPI_DATA_TABLE_DISASSEMBLY | ||
62 | #endif | 66 | #endif |
63 | 67 | ||
64 | #ifdef ACPI_EXEC_APP | 68 | #ifdef ACPI_EXEC_APP |
65 | #undef DEBUGGER_THREADING | 69 | #undef DEBUGGER_THREADING |
66 | #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED | 70 | #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED |
67 | #define ACPI_DEBUG_OUTPUT | 71 | #define ACPI_FULL_DEBUG |
68 | #define ACPI_APPLICATION | 72 | #define ACPI_APPLICATION |
69 | #define ACPI_DEBUGGER | 73 | #define ACPI_DEBUGGER |
70 | #define ACPI_DISASSEMBLER | ||
71 | #define ACPI_MUTEX_DEBUG | 74 | #define ACPI_MUTEX_DEBUG |
75 | #define ACPI_DBG_TRACK_ALLOCATIONS | ||
72 | #endif | 76 | #endif |
73 | 77 | ||
74 | #ifdef ACPI_ASL_COMPILER | 78 | #ifdef ACPI_DASM_APP |
79 | #ifndef MSDOS | ||
75 | #define ACPI_DEBUG_OUTPUT | 80 | #define ACPI_DEBUG_OUTPUT |
81 | #endif | ||
76 | #define ACPI_APPLICATION | 82 | #define ACPI_APPLICATION |
77 | #define ACPI_DISASSEMBLER | 83 | #define ACPI_DISASSEMBLER |
78 | #define ACPI_CONSTANT_EVAL_ONLY | 84 | #define ACPI_NO_METHOD_EXECUTION |
85 | #define ACPI_LARGE_NAMESPACE_NODE | ||
86 | #define ACPI_DATA_TABLE_DISASSEMBLY | ||
79 | #endif | 87 | #endif |
80 | 88 | ||
81 | #ifdef ACPI_APPLICATION | 89 | #ifdef ACPI_APPLICATION |
@@ -83,6 +91,12 @@ | |||
83 | #define ACPI_USE_LOCAL_CACHE | 91 | #define ACPI_USE_LOCAL_CACHE |
84 | #endif | 92 | #endif |
85 | 93 | ||
94 | #ifdef ACPI_FULL_DEBUG | ||
95 | #define ACPI_DEBUGGER | ||
96 | #define ACPI_DEBUG_OUTPUT | ||
97 | #define ACPI_DISASSEMBLER | ||
98 | #endif | ||
99 | |||
86 | /* | 100 | /* |
87 | * Environment configuration. The purpose of this file is to interface to the | 101 | * Environment configuration. The purpose of this file is to interface to the |
88 | * local generation environment. | 102 | * local generation environment. |
@@ -137,7 +151,7 @@ | |||
137 | #elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ | 151 | #elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ |
138 | #include "acdos16.h" | 152 | #include "acdos16.h" |
139 | 153 | ||
140 | #elif defined(__FreeBSD__) | 154 | #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
141 | #include "acfreebsd.h" | 155 | #include "acfreebsd.h" |
142 | 156 | ||
143 | #elif defined(__NetBSD__) | 157 | #elif defined(__NetBSD__) |
@@ -163,17 +177,6 @@ | |||
163 | 177 | ||
164 | #endif | 178 | #endif |
165 | 179 | ||
166 | /* | ||
167 | * Memory allocation tracking. Used only if | ||
168 | * 1) This is the debug version | ||
169 | * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) | ||
170 | */ | ||
171 | #ifdef ACPI_DEBUG_OUTPUT | ||
172 | #if ACPI_MACHINE_WIDTH != 16 | ||
173 | #define ACPI_DBG_TRACK_ALLOCATIONS | ||
174 | #endif | ||
175 | #endif | ||
176 | |||
177 | /*! [End] no source code translation !*/ | 180 | /*! [End] no source code translation !*/ |
178 | 181 | ||
179 | /* | 182 | /* |
@@ -271,8 +274,8 @@ typedef char *va_list; | |||
271 | /* | 274 | /* |
272 | * Storage alignment properties | 275 | * Storage alignment properties |
273 | */ | 276 | */ |
274 | #define _AUPBND (sizeof (acpi_native_uint) - 1) | 277 | #define _AUPBND (sizeof (acpi_native_int) - 1) |
275 | #define _ADNBND (sizeof (acpi_native_uint) - 1) | 278 | #define _ADNBND (sizeof (acpi_native_int) - 1) |
276 | 279 | ||
277 | /* | 280 | /* |
278 | * Variable argument list macro definitions | 281 | * Variable argument list macro definitions |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 2e6d54569ee8..b5655a665ba8 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -52,27 +52,22 @@ | |||
52 | #include <linux/config.h> | 52 | #include <linux/config.h> |
53 | #include <linux/string.h> | 53 | #include <linux/string.h> |
54 | #include <linux/kernel.h> | 54 | #include <linux/kernel.h> |
55 | #include <linux/module.h> | ||
55 | #include <linux/ctype.h> | 56 | #include <linux/ctype.h> |
56 | #include <asm/system.h> | 57 | #include <asm/system.h> |
57 | #include <asm/atomic.h> | 58 | #include <asm/atomic.h> |
58 | #include <asm/div64.h> | 59 | #include <asm/div64.h> |
59 | #include <asm/acpi.h> | 60 | #include <asm/acpi.h> |
61 | #include <linux/slab.h> | ||
60 | 62 | ||
61 | #define strtoul simple_strtoul | 63 | /* Host-dependent types and defines */ |
62 | |||
63 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG | ||
64 | 64 | ||
65 | /* Type(s) for the OSL */ | 65 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG |
66 | 66 | #define acpi_cache_t kmem_cache_t | |
67 | #ifdef ACPI_USE_LOCAL_CACHE | 67 | #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); |
68 | #define acpi_cache_t struct acpi_memory_list | 68 | #define strtoul simple_strtoul |
69 | #else | ||
70 | #include <linux/slab.h> | ||
71 | #define acpi_cache_t kmem_cache_t | ||
72 | #endif | ||
73 | 69 | ||
74 | /* Full namespace pathname length limit - arbitrary */ | 70 | /* Full namespace pathname length limit - arbitrary */ |
75 | |||
76 | #define ACPI_PATHNAME_MAX 256 | 71 | #define ACPI_PATHNAME_MAX 256 |
77 | 72 | ||
78 | #else /* !__KERNEL__ */ | 73 | #else /* !__KERNEL__ */ |
@@ -104,4 +99,8 @@ | |||
104 | 99 | ||
105 | #define acpi_cpu_flags unsigned long | 100 | #define acpi_cpu_flags unsigned long |
106 | 101 | ||
102 | #define acpi_thread_id u32 | ||
103 | |||
104 | static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; } | ||
105 | |||
107 | #endif /* __ACLINUX_H__ */ | 106 | #endif /* __ACLINUX_H__ */ |
diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h index 9950706abdf8..e1432102be05 100644 --- a/include/asm-alpha/smp.h +++ b/include/asm-alpha/smp.h | |||
@@ -45,10 +45,8 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS]; | |||
45 | #define hard_smp_processor_id() __hard_smp_processor_id() | 45 | #define hard_smp_processor_id() __hard_smp_processor_id() |
46 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 46 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
47 | 47 | ||
48 | extern cpumask_t cpu_present_mask; | ||
49 | extern cpumask_t cpu_online_map; | ||
50 | extern int smp_num_cpus; | 48 | extern int smp_num_cpus; |
51 | #define cpu_possible_map cpu_present_mask | 49 | #define cpu_possible_map cpu_present_map |
52 | 50 | ||
53 | int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, cpumask_t cpu); | 51 | int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, cpumask_t cpu); |
54 | 52 | ||
diff --git a/include/asm-alpha/termbits.h b/include/asm-alpha/termbits.h index f4837fa29420..5541101b58ae 100644 --- a/include/asm-alpha/termbits.h +++ b/include/asm-alpha/termbits.h | |||
@@ -148,6 +148,7 @@ struct termios { | |||
148 | #define HUPCL 00040000 | 148 | #define HUPCL 00040000 |
149 | 149 | ||
150 | #define CLOCAL 00100000 | 150 | #define CLOCAL 00100000 |
151 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
151 | #define CRTSCTS 020000000000 /* flow control */ | 152 | #define CRTSCTS 020000000000 /* flow control */ |
152 | 153 | ||
153 | /* c_lflag bits */ | 154 | /* c_lflag bits */ |
diff --git a/include/asm-arm/arch-ixp23xx/memory.h b/include/asm-arm/arch-ixp23xx/memory.h index 6e19f46d54d1..c85fc06a043c 100644 --- a/include/asm-arm/arch-ixp23xx/memory.h +++ b/include/asm-arm/arch-ixp23xx/memory.h | |||
@@ -49,7 +49,7 @@ static inline int __ixp23xx_arch_is_coherent(void) | |||
49 | { | 49 | { |
50 | extern unsigned int processor_id; | 50 | extern unsigned int processor_id; |
51 | 51 | ||
52 | if (((processor_id & 15) >= 2) || machine_is_roadrunner()) | 52 | if (((processor_id & 15) >= 4) || machine_is_roadrunner()) |
53 | return 1; | 53 | return 1; |
54 | 54 | ||
55 | return 0; | 55 | return 0; |
diff --git a/include/asm-arm/arch-l7200/serial_l7200.h b/include/asm-arm/arch-l7200/serial_l7200.h index 238c595d97ea..b1008a9d23e5 100644 --- a/include/asm-arm/arch-l7200/serial_l7200.h +++ b/include/asm-arm/arch-l7200/serial_l7200.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #define UARTDR 0x00 /* Tx/Rx data */ | 28 | #define UARTDR 0x00 /* Tx/Rx data */ |
29 | #define RXSTAT 0x04 /* Rx status */ | 29 | #define RXSTAT 0x04 /* Rx status */ |
30 | #define H_UBRLCR 0x08 /* mode register high */ | 30 | #define H_UBRLCR 0x08 /* mode register high */ |
31 | #define M_UBRLCR 0x0C /* mode reg mid (MSB of buad)*/ | 31 | #define M_UBRLCR 0x0C /* mode reg mid (MSB of baud)*/ |
32 | #define L_UBRLCR 0x10 /* mode reg low (LSB of baud)*/ | 32 | #define L_UBRLCR 0x10 /* mode reg low (LSB of baud)*/ |
33 | #define UARTCON 0x14 /* control register */ | 33 | #define UARTCON 0x14 /* control register */ |
34 | #define UARTFLG 0x18 /* flag register */ | 34 | #define UARTFLG 0x18 /* flag register */ |
diff --git a/include/asm-arm/arch-l7200/uncompress.h b/include/asm-arm/arch-l7200/uncompress.h index 9fcd40aee3e3..04be2a088639 100644 --- a/include/asm-arm/arch-l7200/uncompress.h +++ b/include/asm-arm/arch-l7200/uncompress.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Changelog: | 6 | * Changelog: |
7 | * 05-01-2000 SJH Created | 7 | * 05-01-2000 SJH Created |
8 | * 05-13-2000 SJH Filled in function bodies | 8 | * 05-13-2000 SJH Filled in function bodies |
9 | * 07-26-2000 SJH Removed hard coded buad rate | 9 | * 07-26-2000 SJH Removed hard coded baud rate |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <asm/hardware.h> | 12 | #include <asm/hardware.h> |
diff --git a/include/asm-arm/arch-pxa/ohci.h b/include/asm-arm/arch-pxa/ohci.h index 7da89569061e..e848a47128cd 100644 --- a/include/asm-arm/arch-pxa/ohci.h +++ b/include/asm-arm/arch-pxa/ohci.h | |||
@@ -11,6 +11,8 @@ struct pxaohci_platform_data { | |||
11 | #define PMM_NPS_MODE 1 | 11 | #define PMM_NPS_MODE 1 |
12 | #define PMM_GLOBAL_MODE 2 | 12 | #define PMM_GLOBAL_MODE 2 |
13 | #define PMM_PERPORT_MODE 3 | 13 | #define PMM_PERPORT_MODE 3 |
14 | |||
15 | int power_budget; | ||
14 | }; | 16 | }; |
15 | 17 | ||
16 | extern void pxa_set_ohci_info(struct pxaohci_platform_data *info); | 18 | extern void pxa_set_ohci_info(struct pxaohci_platform_data *info); |
diff --git a/include/asm-arm/arch-pxa/pxa2xx_spi.h b/include/asm-arm/arch-pxa/pxa2xx_spi.h new file mode 100644 index 000000000000..915590c391c8 --- /dev/null +++ b/include/asm-arm/arch-pxa/pxa2xx_spi.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef PXA2XX_SPI_H_ | ||
20 | #define PXA2XX_SPI_H_ | ||
21 | |||
22 | #define PXA2XX_CS_ASSERT (0x01) | ||
23 | #define PXA2XX_CS_DEASSERT (0x02) | ||
24 | |||
25 | #if defined(CONFIG_PXA25x) | ||
26 | #define CLOCK_SPEED_HZ 3686400 | ||
27 | #define SSP1_SerClkDiv(x) (((CLOCK_SPEED_HZ/2/(x+1))<<8)&0x0000ff00) | ||
28 | #define SSP2_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00) | ||
29 | #define SSP3_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00) | ||
30 | #define SSP_TIMEOUT_SCALE (2712) | ||
31 | #elif defined(CONFIG_PXA27x) | ||
32 | #define CLOCK_SPEED_HZ 13000000 | ||
33 | #define SSP1_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00) | ||
34 | #define SSP2_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00) | ||
35 | #define SSP3_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00) | ||
36 | #define SSP_TIMEOUT_SCALE (769) | ||
37 | #endif | ||
38 | |||
39 | #define SSP_TIMEOUT(x) ((x*10000)/SSP_TIMEOUT_SCALE) | ||
40 | #define SSP1_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(1))))) | ||
41 | #define SSP2_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(2))))) | ||
42 | #define SSP3_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(3))))) | ||
43 | |||
44 | enum pxa_ssp_type { | ||
45 | SSP_UNDEFINED = 0, | ||
46 | PXA25x_SSP, /* pxa 210, 250, 255, 26x */ | ||
47 | PXA25x_NSSP, /* pxa 255, 26x (including ASSP) */ | ||
48 | PXA27x_SSP, | ||
49 | }; | ||
50 | |||
51 | /* device.platform_data for SSP controller devices */ | ||
52 | struct pxa2xx_spi_master { | ||
53 | enum pxa_ssp_type ssp_type; | ||
54 | u32 clock_enable; | ||
55 | u16 num_chipselect; | ||
56 | u8 enable_dma; | ||
57 | }; | ||
58 | |||
59 | /* spi_board_info.controller_data for SPI slave devices, | ||
60 | * copied to spi_device.platform_data ... mostly for dma tuning | ||
61 | */ | ||
62 | struct pxa2xx_spi_chip { | ||
63 | u8 tx_threshold; | ||
64 | u8 rx_threshold; | ||
65 | u8 dma_burst_size; | ||
66 | u32 timeout_microsecs; | ||
67 | u8 enable_loopback; | ||
68 | void (*cs_control)(u32 command); | ||
69 | }; | ||
70 | |||
71 | #endif /*PXA2XX_SPI_H_*/ | ||
diff --git a/include/asm-arm/arch-s3c2410/spi-gpio.h b/include/asm-arm/arch-s3c2410/spi-gpio.h new file mode 100644 index 000000000000..258c00bca270 --- /dev/null +++ b/include/asm-arm/arch-s3c2410/spi-gpio.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* linux/include/asm-arm/arch-s3c2410/spi.h | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 - SPI Controller platfrom_device info | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_SPIGPIO_H | ||
14 | #define __ASM_ARCH_SPIGPIO_H __FILE__ | ||
15 | |||
16 | struct s3c2410_spigpio_info; | ||
17 | struct spi_board_info; | ||
18 | |||
19 | struct s3c2410_spigpio_info { | ||
20 | unsigned long pin_clk; | ||
21 | unsigned long pin_mosi; | ||
22 | unsigned long pin_miso; | ||
23 | |||
24 | unsigned long board_size; | ||
25 | struct spi_board_info *board_info; | ||
26 | |||
27 | void (*chip_select)(struct s3c2410_spigpio_info *spi, int cs); | ||
28 | }; | ||
29 | |||
30 | |||
31 | #endif /* __ASM_ARCH_SPIGPIO_H */ | ||
diff --git a/include/asm-arm/arch-s3c2410/spi.h b/include/asm-arm/arch-s3c2410/spi.h new file mode 100644 index 000000000000..4029a1a1ab40 --- /dev/null +++ b/include/asm-arm/arch-s3c2410/spi.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* linux/include/asm-arm/arch-s3c2410/spi.h | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 - SPI Controller platform_device info | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_SPI_H | ||
14 | #define __ASM_ARCH_SPI_H __FILE__ | ||
15 | |||
16 | struct s3c2410_spi_info; | ||
17 | struct spi_board_info; | ||
18 | |||
19 | struct s3c2410_spi_info { | ||
20 | unsigned long pin_cs; /* simple gpio cs */ | ||
21 | |||
22 | unsigned long board_size; | ||
23 | struct spi_board_info *board_info; | ||
24 | |||
25 | void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); | ||
26 | }; | ||
27 | |||
28 | |||
29 | #endif /* __ASM_ARCH_SPI_H */ | ||
diff --git a/include/asm-arm/procinfo.h b/include/asm-arm/procinfo.h index a9c75b2c314f..842526055225 100644 --- a/include/asm-arm/procinfo.h +++ b/include/asm-arm/procinfo.h | |||
@@ -45,8 +45,6 @@ extern unsigned int elf_hwcap; | |||
45 | 45 | ||
46 | #endif /* __ASSEMBLY__ */ | 46 | #endif /* __ASSEMBLY__ */ |
47 | 47 | ||
48 | #define PROC_INFO_SZ 48 | ||
49 | |||
50 | #define HWCAP_SWP 1 | 48 | #define HWCAP_SWP 1 |
51 | #define HWCAP_HALF 2 | 49 | #define HWCAP_HALF 2 |
52 | #define HWCAP_THUMB 4 | 50 | #define HWCAP_THUMB 4 |
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h index 43ad4e55878c..406ca97a8ab2 100644 --- a/include/asm-arm/spinlock.h +++ b/include/asm-arm/spinlock.h | |||
@@ -142,6 +142,9 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
142 | : "cc"); | 142 | : "cc"); |
143 | } | 143 | } |
144 | 144 | ||
145 | /* write_can_lock - would write_trylock() succeed? */ | ||
146 | #define __raw_write_can_lock(x) ((x)->lock == 0x80000000) | ||
147 | |||
145 | /* | 148 | /* |
146 | * Read locks are a bit more hairy: | 149 | * Read locks are a bit more hairy: |
147 | * - Exclusively load the lock value. | 150 | * - Exclusively load the lock value. |
@@ -198,4 +201,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw) | |||
198 | 201 | ||
199 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) | 202 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) |
200 | 203 | ||
204 | /* read_can_lock - would read_trylock() succeed? */ | ||
205 | #define __raw_read_can_lock(x) ((x)->lock < 0x80000000) | ||
206 | |||
201 | #endif /* __ASM_SPINLOCK_H */ | 207 | #endif /* __ASM_SPINLOCK_H */ |
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 95b3abf4851b..7c9568d30307 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h | |||
@@ -127,6 +127,12 @@ static inline int cpu_is_xsc3(void) | |||
127 | } | 127 | } |
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | #if !defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_CPU_XSC3) | ||
131 | #define cpu_is_xscale() 0 | ||
132 | #else | ||
133 | #define cpu_is_xscale() 1 | ||
134 | #endif | ||
135 | |||
130 | #define set_cr(x) \ | 136 | #define set_cr(x) \ |
131 | __asm__ __volatile__( \ | 137 | __asm__ __volatile__( \ |
132 | "mcr p15, 0, %0, c1, c0, 0 @ set CR" \ | 138 | "mcr p15, 0, %0, c1, c0, 0 @ set CR" \ |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 358e4d309ceb..c2059a3a0621 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -159,17 +159,8 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres | |||
159 | #define lazy_mmu_prot_update(pte) do { } while (0) | 159 | #define lazy_mmu_prot_update(pte) do { } while (0) |
160 | #endif | 160 | #endif |
161 | 161 | ||
162 | #ifndef __HAVE_ARCH_MULTIPLE_ZERO_PAGE | 162 | #ifndef __HAVE_ARCH_MOVE_PTE |
163 | #define move_pte(pte, prot, old_addr, new_addr) (pte) | 163 | #define move_pte(pte, prot, old_addr, new_addr) (pte) |
164 | #else | ||
165 | #define move_pte(pte, prot, old_addr, new_addr) \ | ||
166 | ({ \ | ||
167 | pte_t newpte = (pte); \ | ||
168 | if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ | ||
169 | pte_page(pte) == ZERO_PAGE(old_addr)) \ | ||
170 | newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ | ||
171 | newpte; \ | ||
172 | }) | ||
173 | #endif | 164 | #endif |
174 | 165 | ||
175 | /* | 166 | /* |
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h index 5e4a35af2921..9f6995341fdc 100644 --- a/include/asm-i386/apicdef.h +++ b/include/asm-i386/apicdef.h | |||
@@ -121,7 +121,6 @@ | |||
121 | */ | 121 | */ |
122 | #define u32 unsigned int | 122 | #define u32 unsigned int |
123 | 123 | ||
124 | #define lapic ((volatile struct local_apic *)APIC_BASE) | ||
125 | 124 | ||
126 | struct local_apic { | 125 | struct local_apic { |
127 | 126 | ||
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h index 42520cc84b0f..1386af1cb7d9 100644 --- a/include/asm-mips/addrspace.h +++ b/include/asm-mips/addrspace.h | |||
@@ -129,6 +129,7 @@ | |||
129 | #if defined (CONFIG_CPU_R4300) \ | 129 | #if defined (CONFIG_CPU_R4300) \ |
130 | || defined (CONFIG_CPU_R4X00) \ | 130 | || defined (CONFIG_CPU_R4X00) \ |
131 | || defined (CONFIG_CPU_R5000) \ | 131 | || defined (CONFIG_CPU_R5000) \ |
132 | || defined (CONFIG_CPU_RM7000) \ | ||
132 | || defined (CONFIG_CPU_NEVADA) \ | 133 | || defined (CONFIG_CPU_NEVADA) \ |
133 | || defined (CONFIG_CPU_TX49XX) \ | 134 | || defined (CONFIG_CPU_TX49XX) \ |
134 | || defined (CONFIG_CPU_MIPS64) | 135 | || defined (CONFIG_CPU_MIPS64) |
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h index 818b9a97e214..dff2a0a52f8f 100644 --- a/include/asm-mips/cpu.h +++ b/include/asm-mips/cpu.h | |||
@@ -51,6 +51,7 @@ | |||
51 | #define PRID_IMP_R4300 0x0b00 | 51 | #define PRID_IMP_R4300 0x0b00 |
52 | #define PRID_IMP_VR41XX 0x0c00 | 52 | #define PRID_IMP_VR41XX 0x0c00 |
53 | #define PRID_IMP_R12000 0x0e00 | 53 | #define PRID_IMP_R12000 0x0e00 |
54 | #define PRID_IMP_R14000 0x0f00 | ||
54 | #define PRID_IMP_R8000 0x1000 | 55 | #define PRID_IMP_R8000 0x1000 |
55 | #define PRID_IMP_PR4450 0x1200 | 56 | #define PRID_IMP_PR4450 0x1200 |
56 | #define PRID_IMP_R4600 0x2000 | 57 | #define PRID_IMP_R4600 0x2000 |
@@ -87,6 +88,7 @@ | |||
87 | #define PRID_IMP_24K 0x9300 | 88 | #define PRID_IMP_24K 0x9300 |
88 | #define PRID_IMP_34K 0x9500 | 89 | #define PRID_IMP_34K 0x9500 |
89 | #define PRID_IMP_24KE 0x9600 | 90 | #define PRID_IMP_24KE 0x9600 |
91 | #define PRID_IMP_74K 0x9700 | ||
90 | 92 | ||
91 | /* | 93 | /* |
92 | * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE | 94 | * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE |
@@ -196,7 +198,9 @@ | |||
196 | #define CPU_34K 60 | 198 | #define CPU_34K 60 |
197 | #define CPU_PR4450 61 | 199 | #define CPU_PR4450 61 |
198 | #define CPU_SB1A 62 | 200 | #define CPU_SB1A 62 |
199 | #define CPU_LAST 62 | 201 | #define CPU_74K 63 |
202 | #define CPU_R14000 64 | ||
203 | #define CPU_LAST 64 | ||
200 | 204 | ||
201 | /* | 205 | /* |
202 | * ISA Level encodings | 206 | * ISA Level encodings |
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h index 64dd45150f64..928f30f8c45c 100644 --- a/include/asm-mips/delay.h +++ b/include/asm-mips/delay.h | |||
@@ -19,20 +19,22 @@ static inline void __delay(unsigned long loops) | |||
19 | { | 19 | { |
20 | if (sizeof(long) == 4) | 20 | if (sizeof(long) == 4) |
21 | __asm__ __volatile__ ( | 21 | __asm__ __volatile__ ( |
22 | ".set\tnoreorder\n" | 22 | " .set noreorder \n" |
23 | "1:\tbnez\t%0,1b\n\t" | 23 | " .align 3 \n" |
24 | "subu\t%0,1\n\t" | 24 | "1: bnez %0, 1b \n" |
25 | ".set\treorder" | 25 | " subu %0, 1 \n" |
26 | " .set reorder \n" | ||
26 | : "=r" (loops) | 27 | : "=r" (loops) |
27 | : "0" (loops)); | 28 | : "0" (loops)); |
28 | else if (sizeof(long) == 8) | 29 | else if (sizeof(long) == 8) |
29 | __asm__ __volatile__ ( | 30 | __asm__ __volatile__ ( |
30 | ".set\tnoreorder\n" | 31 | " .set noreorder \n" |
31 | "1:\tbnez\t%0,1b\n\t" | 32 | " .align 3 \n" |
32 | "dsubu\t%0,1\n\t" | 33 | "1: bnez %0, 1b \n" |
33 | ".set\treorder" | 34 | " dsubu %0, 1 \n" |
34 | :"=r" (loops) | 35 | " .set reorder \n" |
35 | :"0" (loops)); | 36 | : "=r" (loops) |
37 | : "0" (loops)); | ||
36 | } | 38 | } |
37 | 39 | ||
38 | 40 | ||
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h index a554089991f2..12d118f1bc9c 100644 --- a/include/asm-mips/futex.h +++ b/include/asm-mips/futex.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/futex.h> | 7 | #include <linux/futex.h> |
8 | #include <asm/errno.h> | 8 | #include <asm/errno.h> |
9 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
10 | #include <asm/war.h> | ||
10 | 11 | ||
11 | #ifdef CONFIG_SMP | 12 | #ifdef CONFIG_SMP |
12 | #define __FUTEX_SMP_SYNC " sync \n" | 13 | #define __FUTEX_SMP_SYNC " sync \n" |
@@ -16,30 +17,58 @@ | |||
16 | 17 | ||
17 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ | 18 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ |
18 | { \ | 19 | { \ |
19 | __asm__ __volatile__( \ | 20 | if (cpu_has_llsc && R10000_LLSC_WAR) { \ |
20 | " .set push \n" \ | 21 | __asm__ __volatile__( \ |
21 | " .set noat \n" \ | 22 | " .set push \n" \ |
22 | " .set mips3 \n" \ | 23 | " .set noat \n" \ |
23 | "1: ll %1, (%3) # __futex_atomic_op1 \n" \ | 24 | " .set mips3 \n" \ |
24 | " .set mips0 \n" \ | 25 | "1: ll %1, (%3) # __futex_atomic_op \n" \ |
25 | " " insn " \n" \ | 26 | " .set mips0 \n" \ |
26 | " .set mips3 \n" \ | 27 | " " insn " \n" \ |
27 | "2: sc $1, (%3) \n" \ | 28 | " .set mips3 \n" \ |
28 | " beqzl $1, 1b \n" \ | 29 | "2: sc $1, (%3) \n" \ |
29 | __FUTEX_SMP_SYNC \ | 30 | " beqzl $1, 1b \n" \ |
30 | "3: \n" \ | 31 | __FUTEX_SMP_SYNC \ |
31 | " .set pop \n" \ | 32 | "3: \n" \ |
32 | " .set mips0 \n" \ | 33 | " .set pop \n" \ |
33 | " .section .fixup,\"ax\" \n" \ | 34 | " .set mips0 \n" \ |
34 | "4: li %0, %5 \n" \ | 35 | " .section .fixup,\"ax\" \n" \ |
35 | " j 2b \n" \ | 36 | "4: li %0, %5 \n" \ |
36 | " .previous \n" \ | 37 | " j 2b \n" \ |
37 | " .section __ex_table,\"a\" \n" \ | 38 | " .previous \n" \ |
38 | " "__UA_ADDR "\t1b, 4b \n" \ | 39 | " .section __ex_table,\"a\" \n" \ |
39 | " "__UA_ADDR "\t2b, 4b \n" \ | 40 | " "__UA_ADDR "\t1b, 4b \n" \ |
40 | " .previous \n" \ | 41 | " "__UA_ADDR "\t2b, 4b \n" \ |
41 | : "=r" (ret), "=r" (oldval) \ | 42 | " .previous \n" \ |
42 | : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT)); \ | 43 | : "=r" (ret), "=r" (oldval) \ |
44 | : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT)); \ | ||
45 | } else if (cpu_has_llsc) { \ | ||
46 | __asm__ __volatile__( \ | ||
47 | " .set push \n" \ | ||
48 | " .set noat \n" \ | ||
49 | " .set mips3 \n" \ | ||
50 | "1: ll %1, (%3) # __futex_atomic_op \n" \ | ||
51 | " .set mips0 \n" \ | ||
52 | " " insn " \n" \ | ||
53 | " .set mips3 \n" \ | ||
54 | "2: sc $1, (%3) \n" \ | ||
55 | " beqz $1, 1b \n" \ | ||
56 | __FUTEX_SMP_SYNC \ | ||
57 | "3: \n" \ | ||
58 | " .set pop \n" \ | ||
59 | " .set mips0 \n" \ | ||
60 | " .section .fixup,\"ax\" \n" \ | ||
61 | "4: li %0, %5 \n" \ | ||
62 | " j 2b \n" \ | ||
63 | " .previous \n" \ | ||
64 | " .section __ex_table,\"a\" \n" \ | ||
65 | " "__UA_ADDR "\t1b, 4b \n" \ | ||
66 | " "__UA_ADDR "\t2b, 4b \n" \ | ||
67 | " .previous \n" \ | ||
68 | : "=r" (ret), "=r" (oldval) \ | ||
69 | : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT)); \ | ||
70 | } else \ | ||
71 | ret = -ENOSYS; \ | ||
43 | } | 72 | } |
44 | 73 | ||
45 | static inline int | 74 | static inline int |
@@ -102,7 +131,69 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
102 | static inline int | 131 | static inline int |
103 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | 132 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) |
104 | { | 133 | { |
105 | return -ENOSYS; | 134 | int retval; |
135 | |||
136 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | ||
137 | return -EFAULT; | ||
138 | |||
139 | if (cpu_has_llsc && R10000_LLSC_WAR) { | ||
140 | __asm__ __volatile__( | ||
141 | "# futex_atomic_cmpxchg_inatomic \n" | ||
142 | " .set push \n" | ||
143 | " .set noat \n" | ||
144 | " .set mips3 \n" | ||
145 | "1: ll %0, %2 \n" | ||
146 | " bne %0, %z3, 3f \n" | ||
147 | " .set mips0 \n" | ||
148 | " move $1, %z4 \n" | ||
149 | " .set mips3 \n" | ||
150 | "2: sc $1, %1 \n" | ||
151 | " beqzl $1, 1b \n" | ||
152 | __FUTEX_SMP_SYNC | ||
153 | "3: \n" | ||
154 | " .set pop \n" | ||
155 | " .section .fixup,\"ax\" \n" | ||
156 | "4: li %0, %5 \n" | ||
157 | " j 3b \n" | ||
158 | " .previous \n" | ||
159 | " .section __ex_table,\"a\" \n" | ||
160 | " "__UA_ADDR "\t1b, 4b \n" | ||
161 | " "__UA_ADDR "\t2b, 4b \n" | ||
162 | " .previous \n" | ||
163 | : "=&r" (retval), "=R" (*uaddr) | ||
164 | : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT) | ||
165 | : "memory"); | ||
166 | } else if (cpu_has_llsc) { | ||
167 | __asm__ __volatile__( | ||
168 | "# futex_atomic_cmpxchg_inatomic \n" | ||
169 | " .set push \n" | ||
170 | " .set noat \n" | ||
171 | " .set mips3 \n" | ||
172 | "1: ll %0, %2 \n" | ||
173 | " bne %0, %z3, 3f \n" | ||
174 | " .set mips0 \n" | ||
175 | " move $1, %z4 \n" | ||
176 | " .set mips3 \n" | ||
177 | "2: sc $1, %1 \n" | ||
178 | " beqz $1, 1b \n" | ||
179 | __FUTEX_SMP_SYNC | ||
180 | "3: \n" | ||
181 | " .set pop \n" | ||
182 | " .section .fixup,\"ax\" \n" | ||
183 | "4: li %0, %5 \n" | ||
184 | " j 3b \n" | ||
185 | " .previous \n" | ||
186 | " .section __ex_table,\"a\" \n" | ||
187 | " "__UA_ADDR "\t1b, 4b \n" | ||
188 | " "__UA_ADDR "\t2b, 4b \n" | ||
189 | " .previous \n" | ||
190 | : "=&r" (retval), "=R" (*uaddr) | ||
191 | : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT) | ||
192 | : "memory"); | ||
193 | } else | ||
194 | return -ENOSYS; | ||
195 | |||
196 | return retval; | ||
106 | } | 197 | } |
107 | 198 | ||
108 | #endif | 199 | #endif |
diff --git a/include/asm-mips/inst.h b/include/asm-mips/inst.h index e0745f4ff624..1ed8d0f62577 100644 --- a/include/asm-mips/inst.h +++ b/include/asm-mips/inst.h | |||
@@ -6,6 +6,7 @@ | |||
6 | * for more details. | 6 | * for more details. |
7 | * | 7 | * |
8 | * Copyright (C) 1996, 2000 by Ralf Baechle | 8 | * Copyright (C) 1996, 2000 by Ralf Baechle |
9 | * Copyright (C) 2006 by Thiemo Seufer | ||
9 | */ | 10 | */ |
10 | #ifndef _ASM_INST_H | 11 | #ifndef _ASM_INST_H |
11 | #define _ASM_INST_H | 12 | #define _ASM_INST_H |
@@ -21,14 +22,14 @@ enum major_op { | |||
21 | cop0_op, cop1_op, cop2_op, cop1x_op, | 22 | cop0_op, cop1_op, cop2_op, cop1x_op, |
22 | beql_op, bnel_op, blezl_op, bgtzl_op, | 23 | beql_op, bnel_op, blezl_op, bgtzl_op, |
23 | daddi_op, daddiu_op, ldl_op, ldr_op, | 24 | daddi_op, daddiu_op, ldl_op, ldr_op, |
24 | major_1c_op, jalx_op, major_1e_op, major_1f_op, | 25 | spec2_op, jalx_op, mdmx_op, spec3_op, |
25 | lb_op, lh_op, lwl_op, lw_op, | 26 | lb_op, lh_op, lwl_op, lw_op, |
26 | lbu_op, lhu_op, lwr_op, lwu_op, | 27 | lbu_op, lhu_op, lwr_op, lwu_op, |
27 | sb_op, sh_op, swl_op, sw_op, | 28 | sb_op, sh_op, swl_op, sw_op, |
28 | sdl_op, sdr_op, swr_op, cache_op, | 29 | sdl_op, sdr_op, swr_op, cache_op, |
29 | ll_op, lwc1_op, lwc2_op, pref_op, | 30 | ll_op, lwc1_op, lwc2_op, pref_op, |
30 | lld_op, ldc1_op, ldc2_op, ld_op, | 31 | lld_op, ldc1_op, ldc2_op, ld_op, |
31 | sc_op, swc1_op, swc2_op, rdhwr_op, | 32 | sc_op, swc1_op, swc2_op, major_3b_op, |
32 | scd_op, sdc1_op, sdc2_op, sd_op | 33 | scd_op, sdc1_op, sdc2_op, sd_op |
33 | }; | 34 | }; |
34 | 35 | ||
@@ -37,7 +38,7 @@ enum major_op { | |||
37 | */ | 38 | */ |
38 | enum spec_op { | 39 | enum spec_op { |
39 | sll_op, movc_op, srl_op, sra_op, | 40 | sll_op, movc_op, srl_op, sra_op, |
40 | sllv_op, srlv_op, srav_op, spec1_unused_op, /* Opcode 0x07 is unused */ | 41 | sllv_op, pmon_op, srlv_op, srav_op, |
41 | jr_op, jalr_op, movz_op, movn_op, | 42 | jr_op, jalr_op, movz_op, movn_op, |
42 | syscall_op, break_op, spim_op, sync_op, | 43 | syscall_op, break_op, spim_op, sync_op, |
43 | mfhi_op, mthi_op, mflo_op, mtlo_op, | 44 | mfhi_op, mthi_op, mflo_op, mtlo_op, |
@@ -55,6 +56,28 @@ enum spec_op { | |||
55 | }; | 56 | }; |
56 | 57 | ||
57 | /* | 58 | /* |
59 | * func field of spec2 opcode. | ||
60 | */ | ||
61 | enum spec2_op { | ||
62 | madd_op, maddu_op, mul_op, spec2_3_unused_op, | ||
63 | msub_op, msubu_op, /* more unused ops */ | ||
64 | clz_op = 0x20, clo_op, | ||
65 | dclz_op = 0x24, dclo_op, | ||
66 | sdbpp_op = 0x3f | ||
67 | }; | ||
68 | |||
69 | /* | ||
70 | * func field of spec3 opcode. | ||
71 | */ | ||
72 | enum spec3_op { | ||
73 | ext_op, dextm_op, dextu_op, dext_op, | ||
74 | ins_op, dinsm_op, dinsu_op, dins_op, | ||
75 | bshfl_op = 0x20, | ||
76 | dbshfl_op = 0x24, | ||
77 | rdhwr_op = 0x3f | ||
78 | }; | ||
79 | |||
80 | /* | ||
58 | * rt field of bcond opcodes. | 81 | * rt field of bcond opcodes. |
59 | */ | 82 | */ |
60 | enum rt_op { | 83 | enum rt_op { |
@@ -151,8 +174,8 @@ enum cop1x_func { | |||
151 | * func field for mad opcodes (MIPS IV). | 174 | * func field for mad opcodes (MIPS IV). |
152 | */ | 175 | */ |
153 | enum mad_func { | 176 | enum mad_func { |
154 | madd_op = 0x08, msub_op = 0x0a, | 177 | madd_fp_op = 0x08, msub_fp_op = 0x0a, |
155 | nmadd_op = 0x0c, nmsub_op = 0x0e | 178 | nmadd_fp_op = 0x0c, nmsub_fp_op = 0x0e |
156 | }; | 179 | }; |
157 | 180 | ||
158 | /* | 181 | /* |
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h index a2ef579f6b1a..5af7517fce8a 100644 --- a/include/asm-mips/mipsregs.h +++ b/include/asm-mips/mipsregs.h | |||
@@ -291,7 +291,7 @@ | |||
291 | #define ST0_DL (_ULCAST_(1) << 24) | 291 | #define ST0_DL (_ULCAST_(1) << 24) |
292 | 292 | ||
293 | /* | 293 | /* |
294 | * Enable the MIPS DSP ASE | 294 | * Enable the MIPS MDMX and DSP ASEs |
295 | */ | 295 | */ |
296 | #define ST0_MX 0x01000000 | 296 | #define ST0_MX 0x01000000 |
297 | 297 | ||
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index a1eab136ff6c..4035ec79ecd4 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h | |||
@@ -139,9 +139,11 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
139 | 139 | ||
140 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 140 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
141 | 141 | ||
142 | #ifndef CONFIG_SPARSEMEM | ||
142 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 143 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
143 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 144 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
144 | #endif | 145 | #endif |
146 | #endif | ||
145 | 147 | ||
146 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 148 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
147 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 149 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h index 4d6bc45df594..087c20769256 100644 --- a/include/asm-mips/pgtable-32.h +++ b/include/asm-mips/pgtable-32.h | |||
@@ -177,48 +177,67 @@ pfn_pte(unsigned long pfn, pgprot_t prot) | |||
177 | ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) | 177 | ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) |
178 | 178 | ||
179 | /* | 179 | /* |
180 | * Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset | 180 | * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range: |
181 | * into this range: | ||
182 | */ | 181 | */ |
183 | #define PTE_FILE_MAX_BITS 27 | 182 | #define PTE_FILE_MAX_BITS 28 |
184 | 183 | ||
185 | #define pte_to_pgoff(_pte) \ | 184 | #define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \ |
186 | ((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 )) | 185 | (((_pte).pte >> 2 ) & 0x38) | \ |
186 | (((_pte).pte >> 10) << 6 )) | ||
187 | 187 | ||
188 | #define pgoff_to_pte(off) \ | 188 | #define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \ |
189 | ((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE }) | 189 | (((off) & 0x38) << 2 ) | \ |
190 | (((off) >> 6 ) << 10) | \ | ||
191 | _PAGE_FILE }) | ||
190 | 192 | ||
191 | #else | 193 | #else |
192 | 194 | ||
193 | /* Swap entries must have VALID and GLOBAL bits cleared. */ | 195 | /* Swap entries must have VALID and GLOBAL bits cleared. */ |
196 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | ||
197 | #define __swp_type(x) (((x).val >> 2) & 0x1f) | ||
198 | #define __swp_offset(x) ((x).val >> 7) | ||
199 | #define __swp_entry(type,offset) \ | ||
200 | ((swp_entry_t) { ((type) << 2) | ((offset) << 7) }) | ||
201 | #else | ||
194 | #define __swp_type(x) (((x).val >> 8) & 0x1f) | 202 | #define __swp_type(x) (((x).val >> 8) & 0x1f) |
195 | #define __swp_offset(x) ((x).val >> 13) | 203 | #define __swp_offset(x) ((x).val >> 13) |
196 | #define __swp_entry(type,offset) \ | 204 | #define __swp_entry(type,offset) \ |
197 | ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) | 205 | ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) |
206 | #endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */ | ||
198 | 207 | ||
208 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | ||
199 | /* | 209 | /* |
200 | * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset | 210 | * Bits 0 and 1 of pte_high are taken, use the rest for the page offset... |
201 | * into this range: | ||
202 | */ | 211 | */ |
203 | #define PTE_FILE_MAX_BITS 27 | 212 | #define PTE_FILE_MAX_BITS 30 |
204 | 213 | ||
205 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 214 | #define pte_to_pgoff(_pte) ((_pte).pte_high >> 2) |
206 | /* fixme */ | 215 | #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 }) |
207 | #define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f)) | ||
208 | #define pgoff_to_pte(off) \ | ||
209 | ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)}) | ||
210 | 216 | ||
211 | #else | 217 | #else |
212 | #define pte_to_pgoff(_pte) \ | 218 | /* |
213 | ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) | 219 | * Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range: |
220 | */ | ||
221 | #define PTE_FILE_MAX_BITS 28 | ||
222 | |||
223 | #define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \ | ||
224 | (((_pte).pte >> 2) & 0x8) | \ | ||
225 | (((_pte).pte >> 8) << 4)) | ||
214 | 226 | ||
215 | #define pgoff_to_pte(off) \ | 227 | #define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \ |
216 | ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) | 228 | (((off) & 0x8) << 2) | \ |
229 | (((off) >> 4) << 8) | \ | ||
230 | _PAGE_FILE }) | ||
217 | #endif | 231 | #endif |
218 | 232 | ||
219 | #endif | 233 | #endif |
220 | 234 | ||
235 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | ||
236 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high }) | ||
237 | #define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val }) | ||
238 | #else | ||
221 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | 239 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) |
222 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | 240 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
241 | #endif | ||
223 | 242 | ||
224 | #endif /* _ASM_PGTABLE_32_H */ | 243 | #endif /* _ASM_PGTABLE_32_H */ |
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h index 82166b254b27..2faf5c9ff127 100644 --- a/include/asm-mips/pgtable-64.h +++ b/include/asm-mips/pgtable-64.h | |||
@@ -224,15 +224,12 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) | |||
224 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | 224 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * Bits 0, 1, 2, 7 and 8 are taken, split up the 32 bits of offset | 227 | * Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to |
228 | * into this range: | 228 | * make things easier, and only use the upper 56 bits for the page offset... |
229 | */ | 229 | */ |
230 | #define PTE_FILE_MAX_BITS 32 | 230 | #define PTE_FILE_MAX_BITS 56 |
231 | 231 | ||
232 | #define pte_to_pgoff(_pte) \ | 232 | #define pte_to_pgoff(_pte) ((_pte).pte >> 8) |
233 | ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) | 233 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 8) | _PAGE_FILE }) |
234 | |||
235 | #define pgoff_to_pte(off) \ | ||
236 | ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) | ||
237 | 234 | ||
238 | #endif /* _ASM_PGTABLE_64_H */ | 235 | #endif /* _ASM_PGTABLE_64_H */ |
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 702a28fa7a34..d0af2a3b0152 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
@@ -70,7 +70,15 @@ extern unsigned long zero_page_mask; | |||
70 | #define ZERO_PAGE(vaddr) \ | 70 | #define ZERO_PAGE(vaddr) \ |
71 | (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) | 71 | (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) |
72 | 72 | ||
73 | #define __HAVE_ARCH_MULTIPLE_ZERO_PAGE | 73 | #define __HAVE_ARCH_MOVE_PTE |
74 | #define move_pte(pte, prot, old_addr, new_addr) \ | ||
75 | ({ \ | ||
76 | pte_t newpte = (pte); \ | ||
77 | if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ | ||
78 | pte_page(pte) == ZERO_PAGE(old_addr)) \ | ||
79 | newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ | ||
80 | newpte; \ | ||
81 | }) | ||
74 | 82 | ||
75 | extern void paging_init(void); | 83 | extern void paging_init(void); |
76 | 84 | ||
@@ -82,10 +90,11 @@ extern void paging_init(void); | |||
82 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) | 90 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) |
83 | #define pmd_page_kernel(pmd) pmd_val(pmd) | 91 | #define pmd_page_kernel(pmd) pmd_val(pmd) |
84 | 92 | ||
85 | #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) | ||
86 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | ||
87 | |||
88 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 93 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
94 | |||
95 | #define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL)) | ||
96 | #define pte_present(pte) ((pte).pte_low & _PAGE_PRESENT) | ||
97 | |||
89 | static inline void set_pte(pte_t *ptep, pte_t pte) | 98 | static inline void set_pte(pte_t *ptep, pte_t pte) |
90 | { | 99 | { |
91 | ptep->pte_high = pte.pte_high; | 100 | ptep->pte_high = pte.pte_high; |
@@ -93,27 +102,35 @@ static inline void set_pte(pte_t *ptep, pte_t pte) | |||
93 | ptep->pte_low = pte.pte_low; | 102 | ptep->pte_low = pte.pte_low; |
94 | //printk("pte_high %x pte_low %x\n", ptep->pte_high, ptep->pte_low); | 103 | //printk("pte_high %x pte_low %x\n", ptep->pte_high, ptep->pte_low); |
95 | 104 | ||
96 | if (pte_val(pte) & _PAGE_GLOBAL) { | 105 | if (pte.pte_low & _PAGE_GLOBAL) { |
97 | pte_t *buddy = ptep_buddy(ptep); | 106 | pte_t *buddy = ptep_buddy(ptep); |
98 | /* | 107 | /* |
99 | * Make sure the buddy is global too (if it's !none, | 108 | * Make sure the buddy is global too (if it's !none, |
100 | * it better already be global) | 109 | * it better already be global) |
101 | */ | 110 | */ |
102 | if (pte_none(*buddy)) | 111 | if (pte_none(*buddy)) { |
103 | buddy->pte_low |= _PAGE_GLOBAL; | 112 | buddy->pte_low |= _PAGE_GLOBAL; |
113 | buddy->pte_high |= _PAGE_GLOBAL; | ||
114 | } | ||
104 | } | 115 | } |
105 | } | 116 | } |
106 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | 117 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) |
107 | 118 | ||
108 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 119 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
109 | { | 120 | { |
121 | pte_t null = __pte(0); | ||
122 | |||
110 | /* Preserve global status for the pair */ | 123 | /* Preserve global status for the pair */ |
111 | if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL) | 124 | if (ptep_buddy(ptep)->pte_low & _PAGE_GLOBAL) |
112 | set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL)); | 125 | null.pte_low = null.pte_high = _PAGE_GLOBAL; |
113 | else | 126 | |
114 | set_pte_at(mm, addr, ptep, __pte(0)); | 127 | set_pte_at(mm, addr, ptep, null); |
115 | } | 128 | } |
116 | #else | 129 | #else |
130 | |||
131 | #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) | ||
132 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | ||
133 | |||
117 | /* | 134 | /* |
118 | * Certain architectures need to do special things when pte's | 135 | * Certain architectures need to do special things when pte's |
119 | * within a page table are directly modified. Thus, the following | 136 | * within a page table are directly modified. Thus, the following |
@@ -174,75 +191,76 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | |||
174 | */ | 191 | */ |
175 | static inline int pte_user(pte_t pte) { BUG(); return 0; } | 192 | static inline int pte_user(pte_t pte) { BUG(); return 0; } |
176 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 193 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
177 | static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; } | 194 | static inline int pte_read(pte_t pte) { return pte.pte_low & _PAGE_READ; } |
178 | static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; } | 195 | static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; } |
179 | static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; } | 196 | static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; } |
180 | static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } | 197 | static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; } |
181 | static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; } | 198 | static inline int pte_file(pte_t pte) { return pte.pte_low & _PAGE_FILE; } |
199 | |||
182 | static inline pte_t pte_wrprotect(pte_t pte) | 200 | static inline pte_t pte_wrprotect(pte_t pte) |
183 | { | 201 | { |
184 | (pte).pte_low &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); | 202 | pte.pte_low &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); |
185 | (pte).pte_high &= ~_PAGE_SILENT_WRITE; | 203 | pte.pte_high &= ~_PAGE_SILENT_WRITE; |
186 | return pte; | 204 | return pte; |
187 | } | 205 | } |
188 | 206 | ||
189 | static inline pte_t pte_rdprotect(pte_t pte) | 207 | static inline pte_t pte_rdprotect(pte_t pte) |
190 | { | 208 | { |
191 | (pte).pte_low &= ~(_PAGE_READ | _PAGE_SILENT_READ); | 209 | pte.pte_low &= ~(_PAGE_READ | _PAGE_SILENT_READ); |
192 | (pte).pte_high &= ~_PAGE_SILENT_READ; | 210 | pte.pte_high &= ~_PAGE_SILENT_READ; |
193 | return pte; | 211 | return pte; |
194 | } | 212 | } |
195 | 213 | ||
196 | static inline pte_t pte_mkclean(pte_t pte) | 214 | static inline pte_t pte_mkclean(pte_t pte) |
197 | { | 215 | { |
198 | (pte).pte_low &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE); | 216 | pte.pte_low &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); |
199 | (pte).pte_high &= ~_PAGE_SILENT_WRITE; | 217 | pte.pte_high &= ~_PAGE_SILENT_WRITE; |
200 | return pte; | 218 | return pte; |
201 | } | 219 | } |
202 | 220 | ||
203 | static inline pte_t pte_mkold(pte_t pte) | 221 | static inline pte_t pte_mkold(pte_t pte) |
204 | { | 222 | { |
205 | (pte).pte_low &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ); | 223 | pte.pte_low &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ); |
206 | (pte).pte_high &= ~_PAGE_SILENT_READ; | 224 | pte.pte_high &= ~_PAGE_SILENT_READ; |
207 | return pte; | 225 | return pte; |
208 | } | 226 | } |
209 | 227 | ||
210 | static inline pte_t pte_mkwrite(pte_t pte) | 228 | static inline pte_t pte_mkwrite(pte_t pte) |
211 | { | 229 | { |
212 | (pte).pte_low |= _PAGE_WRITE; | 230 | pte.pte_low |= _PAGE_WRITE; |
213 | if ((pte).pte_low & _PAGE_MODIFIED) { | 231 | if (pte.pte_low & _PAGE_MODIFIED) { |
214 | (pte).pte_low |= _PAGE_SILENT_WRITE; | 232 | pte.pte_low |= _PAGE_SILENT_WRITE; |
215 | (pte).pte_high |= _PAGE_SILENT_WRITE; | 233 | pte.pte_high |= _PAGE_SILENT_WRITE; |
216 | } | 234 | } |
217 | return pte; | 235 | return pte; |
218 | } | 236 | } |
219 | 237 | ||
220 | static inline pte_t pte_mkread(pte_t pte) | 238 | static inline pte_t pte_mkread(pte_t pte) |
221 | { | 239 | { |
222 | (pte).pte_low |= _PAGE_READ; | 240 | pte.pte_low |= _PAGE_READ; |
223 | if ((pte).pte_low & _PAGE_ACCESSED) { | 241 | if (pte.pte_low & _PAGE_ACCESSED) { |
224 | (pte).pte_low |= _PAGE_SILENT_READ; | 242 | pte.pte_low |= _PAGE_SILENT_READ; |
225 | (pte).pte_high |= _PAGE_SILENT_READ; | 243 | pte.pte_high |= _PAGE_SILENT_READ; |
226 | } | 244 | } |
227 | return pte; | 245 | return pte; |
228 | } | 246 | } |
229 | 247 | ||
230 | static inline pte_t pte_mkdirty(pte_t pte) | 248 | static inline pte_t pte_mkdirty(pte_t pte) |
231 | { | 249 | { |
232 | (pte).pte_low |= _PAGE_MODIFIED; | 250 | pte.pte_low |= _PAGE_MODIFIED; |
233 | if ((pte).pte_low & _PAGE_WRITE) { | 251 | if (pte.pte_low & _PAGE_WRITE) { |
234 | (pte).pte_low |= _PAGE_SILENT_WRITE; | 252 | pte.pte_low |= _PAGE_SILENT_WRITE; |
235 | (pte).pte_high |= _PAGE_SILENT_WRITE; | 253 | pte.pte_high |= _PAGE_SILENT_WRITE; |
236 | } | 254 | } |
237 | return pte; | 255 | return pte; |
238 | } | 256 | } |
239 | 257 | ||
240 | static inline pte_t pte_mkyoung(pte_t pte) | 258 | static inline pte_t pte_mkyoung(pte_t pte) |
241 | { | 259 | { |
242 | (pte).pte_low |= _PAGE_ACCESSED; | 260 | pte.pte_low |= _PAGE_ACCESSED; |
243 | if ((pte).pte_low & _PAGE_READ) | 261 | if (pte.pte_low & _PAGE_READ) |
244 | (pte).pte_low |= _PAGE_SILENT_READ; | 262 | pte.pte_low |= _PAGE_SILENT_READ; |
245 | (pte).pte_high |= _PAGE_SILENT_READ; | 263 | pte.pte_high |= _PAGE_SILENT_READ; |
246 | return pte; | 264 | return pte; |
247 | } | 265 | } |
248 | #else | 266 | #else |
@@ -335,8 +353,9 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot) | |||
335 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 353 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
336 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 354 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
337 | { | 355 | { |
338 | pte.pte_low &= _PAGE_CHG_MASK; | 356 | pte.pte_low &= _PAGE_CHG_MASK; |
339 | pte.pte_low |= pgprot_val(newprot); | 357 | pte.pte_high &= ~0x3f; |
358 | pte.pte_low |= pgprot_val(newprot); | ||
340 | pte.pte_high |= pgprot_val(newprot) & 0x3f; | 359 | pte.pte_high |= pgprot_val(newprot) & 0x3f; |
341 | return pte; | 360 | return pte; |
342 | } | 361 | } |
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h index 8edabb0be23f..cefa657dd04a 100644 --- a/include/asm-mips/sigcontext.h +++ b/include/asm-mips/sigcontext.h | |||
@@ -55,8 +55,14 @@ struct sigcontext { | |||
55 | struct sigcontext { | 55 | struct sigcontext { |
56 | unsigned long sc_regs[32]; | 56 | unsigned long sc_regs[32]; |
57 | unsigned long sc_fpregs[32]; | 57 | unsigned long sc_fpregs[32]; |
58 | unsigned long sc_hi[4]; | 58 | unsigned long sc_mdhi; |
59 | unsigned long sc_lo[4]; | 59 | unsigned long sc_hi1; |
60 | unsigned long sc_hi2; | ||
61 | unsigned long sc_hi3; | ||
62 | unsigned long sc_mdlo; | ||
63 | unsigned long sc_lo1; | ||
64 | unsigned long sc_lo2; | ||
65 | unsigned long sc_lo3; | ||
60 | unsigned long sc_pc; | 66 | unsigned long sc_pc; |
61 | unsigned int sc_fpc_csr; | 67 | unsigned int sc_fpc_csr; |
62 | unsigned int sc_used_math; | 68 | unsigned int sc_used_math; |
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h index 75c6fe7c2126..e14e4b69de21 100644 --- a/include/asm-mips/smp.h +++ b/include/asm-mips/smp.h | |||
@@ -48,7 +48,6 @@ extern struct call_data_struct *call_data; | |||
48 | #define SMP_CALL_FUNCTION 0x2 | 48 | #define SMP_CALL_FUNCTION 0x2 |
49 | 49 | ||
50 | extern cpumask_t phys_cpu_present_map; | 50 | extern cpumask_t phys_cpu_present_map; |
51 | extern cpumask_t cpu_online_map; | ||
52 | #define cpu_possible_map phys_cpu_present_map | 51 | #define cpu_possible_map phys_cpu_present_map |
53 | 52 | ||
54 | extern cpumask_t cpu_callout_map; | 53 | extern cpumask_t cpu_callout_map; |
@@ -86,9 +85,9 @@ extern void prom_init_secondary(void); | |||
86 | extern void plat_smp_setup(void); | 85 | extern void plat_smp_setup(void); |
87 | 86 | ||
88 | /* | 87 | /* |
89 | * Called after init_IRQ but before __cpu_up. | 88 | * Called in smp_prepare_cpus. |
90 | */ | 89 | */ |
91 | extern void prom_prepare_cpus(unsigned int max_cpus); | 90 | extern void plat_prepare_cpus(unsigned int max_cpus); |
92 | 91 | ||
93 | /* | 92 | /* |
94 | * Last chance for the board code to finish SMP initialization before | 93 | * Last chance for the board code to finish SMP initialization before |
diff --git a/include/asm-mips/sparsemem.h b/include/asm-mips/sparsemem.h new file mode 100644 index 000000000000..795ac6c23203 --- /dev/null +++ b/include/asm-mips/sparsemem.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _MIPS_SPARSEMEM_H | ||
2 | #define _MIPS_SPARSEMEM_H | ||
3 | #ifdef CONFIG_SPARSEMEM | ||
4 | |||
5 | /* | ||
6 | * SECTION_SIZE_BITS 2^N: how big each section will be | ||
7 | * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space | ||
8 | */ | ||
9 | #define SECTION_SIZE_BITS 28 | ||
10 | #define MAX_PHYSMEM_BITS 35 | ||
11 | |||
12 | #endif /* CONFIG_SPARSEMEM */ | ||
13 | #endif /* _MIPS_SPARSEMEM_H */ | ||
14 | |||
diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h index ebf6055481dc..6d533b07aaf5 100644 --- a/include/asm-powerpc/termbits.h +++ b/include/asm-powerpc/termbits.h | |||
@@ -153,6 +153,7 @@ struct termios { | |||
153 | #define HUPCL 00040000 | 153 | #define HUPCL 00040000 |
154 | 154 | ||
155 | #define CLOCAL 00100000 | 155 | #define CLOCAL 00100000 |
156 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
156 | #define CRTSCTS 020000000000 /* flow control */ | 157 | #define CRTSCTS 020000000000 /* flow control */ |
157 | 158 | ||
158 | /* c_lflag bits */ | 159 | /* c_lflag bits */ |
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h index 908acb44cb8a..edde2462bf52 100644 --- a/include/asm-powerpc/unistd.h +++ b/include/asm-powerpc/unistd.h | |||
@@ -321,8 +321,10 @@ | |||
321 | #define __NR_readlinkat 296 | 321 | #define __NR_readlinkat 296 |
322 | #define __NR_fchmodat 297 | 322 | #define __NR_fchmodat 297 |
323 | #define __NR_faccessat 298 | 323 | #define __NR_faccessat 298 |
324 | #define __NR_get_robust_list 299 | ||
325 | #define __NR_set_robust_list 300 | ||
324 | 326 | ||
325 | #define __NR_syscalls 299 | 327 | #define __NR_syscalls 301 |
326 | 328 | ||
327 | #ifdef __KERNEL__ | 329 | #ifdef __KERNEL__ |
328 | #define __NR__exit __NR_exit | 330 | #define __NR__exit __NR_exit |
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h index 40c25e166a9b..1802775568b9 100644 --- a/include/asm-s390/futex.h +++ b/include/asm-s390/futex.h | |||
@@ -11,23 +11,24 @@ | |||
11 | #define __futex_atomic_fixup \ | 11 | #define __futex_atomic_fixup \ |
12 | ".section __ex_table,\"a\"\n" \ | 12 | ".section __ex_table,\"a\"\n" \ |
13 | " .align 4\n" \ | 13 | " .align 4\n" \ |
14 | " .long 0b,2b,1b,2b\n" \ | 14 | " .long 0b,4b,2b,4b,3b,4b\n" \ |
15 | ".previous" | 15 | ".previous" |
16 | #else /* __s390x__ */ | 16 | #else /* __s390x__ */ |
17 | #define __futex_atomic_fixup \ | 17 | #define __futex_atomic_fixup \ |
18 | ".section __ex_table,\"a\"\n" \ | 18 | ".section __ex_table,\"a\"\n" \ |
19 | " .align 8\n" \ | 19 | " .align 8\n" \ |
20 | " .quad 0b,2b,1b,2b\n" \ | 20 | " .quad 0b,4b,2b,4b,3b,4b\n" \ |
21 | ".previous" | 21 | ".previous" |
22 | #endif /* __s390x__ */ | 22 | #endif /* __s390x__ */ |
23 | 23 | ||
24 | #define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \ | 24 | #define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \ |
25 | asm volatile(" l %1,0(%6)\n" \ | 25 | asm volatile(" sacf 256\n" \ |
26 | "0: " insn \ | 26 | "0: l %1,0(%6)\n" \ |
27 | " cs %1,%2,0(%6)\n" \ | 27 | "1: " insn \ |
28 | "1: jl 0b\n" \ | 28 | "2: cs %1,%2,0(%6)\n" \ |
29 | "3: jl 1b\n" \ | ||
29 | " lhi %0,0\n" \ | 30 | " lhi %0,0\n" \ |
30 | "2:\n" \ | 31 | "4: sacf 0\n" \ |
31 | __futex_atomic_fixup \ | 32 | __futex_atomic_fixup \ |
32 | : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ | 33 | : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ |
33 | "=m" (*uaddr) \ | 34 | "=m" (*uaddr) \ |
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index db0606c1abd4..bea727904287 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h | |||
@@ -98,8 +98,8 @@ | |||
98 | #define __LC_KERNEL_ASCE 0xD58 | 98 | #define __LC_KERNEL_ASCE 0xD58 |
99 | #define __LC_USER_ASCE 0xD60 | 99 | #define __LC_USER_ASCE 0xD60 |
100 | #define __LC_PANIC_STACK 0xD68 | 100 | #define __LC_PANIC_STACK 0xD68 |
101 | #define __LC_CPUID 0xD90 | 101 | #define __LC_CPUID 0xD80 |
102 | #define __LC_CPUADDR 0xD98 | 102 | #define __LC_CPUADDR 0xD88 |
103 | #define __LC_IPLDEV 0xDB8 | 103 | #define __LC_IPLDEV 0xDB8 |
104 | #define __LC_JIFFY_TIMER 0xDC0 | 104 | #define __LC_JIFFY_TIMER 0xDC0 |
105 | #define __LC_CURRENT 0xDD8 | 105 | #define __LC_CURRENT 0xDD8 |
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index 657d582e8149..41c2792ff6b0 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -296,8 +296,14 @@ | |||
296 | #define __NR_pselect6 301 | 296 | #define __NR_pselect6 301 |
297 | #define __NR_ppoll 302 | 297 | #define __NR_ppoll 302 |
298 | #define __NR_unshare 303 | 298 | #define __NR_unshare 303 |
299 | #define __NR_set_robust_list 304 | ||
300 | #define __NR_get_robust_list 305 | ||
301 | #define __NR_splice 306 | ||
302 | #define __NR_sync_file_range 307 | ||
303 | #define __NR_tee 308 | ||
304 | #define __NR_vmsplice 309 | ||
299 | 305 | ||
300 | #define NR_syscalls 304 | 306 | #define NR_syscalls 310 |
301 | 307 | ||
302 | /* | 308 | /* |
303 | * There are some system calls that are not present on 64 bit, some | 309 | * There are some system calls that are not present on 64 bit, some |
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h index f5611a721fbd..45a576507785 100644 --- a/include/asm-sparc/unistd.h +++ b/include/asm-sparc/unistd.h | |||
@@ -316,11 +316,13 @@ | |||
316 | #define __NR_pselect6 297 | 316 | #define __NR_pselect6 297 |
317 | #define __NR_ppoll 298 | 317 | #define __NR_ppoll 298 |
318 | #define __NR_unshare 299 | 318 | #define __NR_unshare 299 |
319 | #define __NR_set_robust_list 300 | ||
320 | #define __NR_get_robust_list 301 | ||
319 | 321 | ||
320 | /* WARNING: You MAY NOT add syscall numbers larger than 299, since | 322 | /* WARNING: You MAY NOT add syscall numbers larger than 301, since |
321 | * all of the syscall tables in the Sparc kernel are | 323 | * all of the syscall tables in the Sparc kernel are |
322 | * sized to have 299 entries (starting at zero). Therefore | 324 | * sized to have 301 entries (starting at zero). Therefore |
323 | * find a free slot in the 0-299 range. | 325 | * find a free slot in the 0-301 range. |
324 | */ | 326 | */ |
325 | 327 | ||
326 | #define _syscall0(type,name) \ | 328 | #define _syscall0(type,name) \ |
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h index c7d5804ba76d..a8d39f23d43b 100644 --- a/include/asm-sparc64/dma-mapping.h +++ b/include/asm-sparc64/dma-mapping.h | |||
@@ -4,7 +4,146 @@ | |||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
6 | #ifdef CONFIG_PCI | 6 | #ifdef CONFIG_PCI |
7 | #include <asm-generic/dma-mapping.h> | 7 | |
8 | /* we implement the API below in terms of the existing PCI one, | ||
9 | * so include it */ | ||
10 | #include <linux/pci.h> | ||
11 | /* need struct page definitions */ | ||
12 | #include <linux/mm.h> | ||
13 | |||
14 | static inline int | ||
15 | dma_supported(struct device *dev, u64 mask) | ||
16 | { | ||
17 | BUG_ON(dev->bus != &pci_bus_type); | ||
18 | |||
19 | return pci_dma_supported(to_pci_dev(dev), mask); | ||
20 | } | ||
21 | |||
22 | static inline int | ||
23 | dma_set_mask(struct device *dev, u64 dma_mask) | ||
24 | { | ||
25 | BUG_ON(dev->bus != &pci_bus_type); | ||
26 | |||
27 | return pci_set_dma_mask(to_pci_dev(dev), dma_mask); | ||
28 | } | ||
29 | |||
30 | static inline void * | ||
31 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | ||
32 | gfp_t flag) | ||
33 | { | ||
34 | BUG_ON(dev->bus != &pci_bus_type); | ||
35 | |||
36 | return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag); | ||
37 | } | ||
38 | |||
39 | static inline void | ||
40 | dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | ||
41 | dma_addr_t dma_handle) | ||
42 | { | ||
43 | BUG_ON(dev->bus != &pci_bus_type); | ||
44 | |||
45 | pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle); | ||
46 | } | ||
47 | |||
48 | static inline dma_addr_t | ||
49 | dma_map_single(struct device *dev, void *cpu_addr, size_t size, | ||
50 | enum dma_data_direction direction) | ||
51 | { | ||
52 | BUG_ON(dev->bus != &pci_bus_type); | ||
53 | |||
54 | return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction); | ||
55 | } | ||
56 | |||
57 | static inline void | ||
58 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
59 | enum dma_data_direction direction) | ||
60 | { | ||
61 | BUG_ON(dev->bus != &pci_bus_type); | ||
62 | |||
63 | pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction); | ||
64 | } | ||
65 | |||
66 | static inline dma_addr_t | ||
67 | dma_map_page(struct device *dev, struct page *page, | ||
68 | unsigned long offset, size_t size, | ||
69 | enum dma_data_direction direction) | ||
70 | { | ||
71 | BUG_ON(dev->bus != &pci_bus_type); | ||
72 | |||
73 | return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction); | ||
74 | } | ||
75 | |||
76 | static inline void | ||
77 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
78 | enum dma_data_direction direction) | ||
79 | { | ||
80 | BUG_ON(dev->bus != &pci_bus_type); | ||
81 | |||
82 | pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction); | ||
83 | } | ||
84 | |||
85 | static inline int | ||
86 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
87 | enum dma_data_direction direction) | ||
88 | { | ||
89 | BUG_ON(dev->bus != &pci_bus_type); | ||
90 | |||
91 | return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction); | ||
92 | } | ||
93 | |||
94 | static inline void | ||
95 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
96 | enum dma_data_direction direction) | ||
97 | { | ||
98 | BUG_ON(dev->bus != &pci_bus_type); | ||
99 | |||
100 | pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction); | ||
101 | } | ||
102 | |||
103 | static inline void | ||
104 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
105 | enum dma_data_direction direction) | ||
106 | { | ||
107 | BUG_ON(dev->bus != &pci_bus_type); | ||
108 | |||
109 | pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle, | ||
110 | size, (int)direction); | ||
111 | } | ||
112 | |||
113 | static inline void | ||
114 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
115 | enum dma_data_direction direction) | ||
116 | { | ||
117 | BUG_ON(dev->bus != &pci_bus_type); | ||
118 | |||
119 | pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle, | ||
120 | size, (int)direction); | ||
121 | } | ||
122 | |||
123 | static inline void | ||
124 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
125 | enum dma_data_direction direction) | ||
126 | { | ||
127 | BUG_ON(dev->bus != &pci_bus_type); | ||
128 | |||
129 | pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction); | ||
130 | } | ||
131 | |||
132 | static inline void | ||
133 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, | ||
134 | enum dma_data_direction direction) | ||
135 | { | ||
136 | BUG_ON(dev->bus != &pci_bus_type); | ||
137 | |||
138 | pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction); | ||
139 | } | ||
140 | |||
141 | static inline int | ||
142 | dma_mapping_error(dma_addr_t dma_addr) | ||
143 | { | ||
144 | return pci_dma_mapping_error(dma_addr); | ||
145 | } | ||
146 | |||
8 | #else | 147 | #else |
9 | 148 | ||
10 | struct device; | 149 | struct device; |
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h index 7c5a589ea437..e1ea67bc32f2 100644 --- a/include/asm-sparc64/pci.h +++ b/include/asm-sparc64/pci.h | |||
@@ -42,7 +42,7 @@ static inline void pcibios_penalize_isa_irq(int irq, int active) | |||
42 | struct pci_dev; | 42 | struct pci_dev; |
43 | 43 | ||
44 | struct pci_iommu_ops { | 44 | struct pci_iommu_ops { |
45 | void *(*alloc_consistent)(struct pci_dev *, size_t, dma_addr_t *); | 45 | void *(*alloc_consistent)(struct pci_dev *, size_t, dma_addr_t *, gfp_t); |
46 | void (*free_consistent)(struct pci_dev *, size_t, void *, dma_addr_t); | 46 | void (*free_consistent)(struct pci_dev *, size_t, void *, dma_addr_t); |
47 | dma_addr_t (*map_single)(struct pci_dev *, void *, size_t, int); | 47 | dma_addr_t (*map_single)(struct pci_dev *, void *, size_t, int); |
48 | void (*unmap_single)(struct pci_dev *, dma_addr_t, size_t, int); | 48 | void (*unmap_single)(struct pci_dev *, dma_addr_t, size_t, int); |
@@ -59,7 +59,7 @@ extern struct pci_iommu_ops *pci_iommu_ops; | |||
59 | */ | 59 | */ |
60 | static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle) | 60 | static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle) |
61 | { | 61 | { |
62 | return pci_iommu_ops->alloc_consistent(hwdev, size, dma_handle); | 62 | return pci_iommu_ops->alloc_consistent(hwdev, size, dma_handle, GFP_ATOMIC); |
63 | } | 63 | } |
64 | 64 | ||
65 | /* Free and unmap a consistent DMA buffer. | 65 | /* Free and unmap a consistent DMA buffer. |
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index c44e7466534e..cd464f469a2c 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h | |||
@@ -689,6 +689,23 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p | |||
689 | #define pte_clear(mm,addr,ptep) \ | 689 | #define pte_clear(mm,addr,ptep) \ |
690 | set_pte_at((mm), (addr), (ptep), __pte(0UL)) | 690 | set_pte_at((mm), (addr), (ptep), __pte(0UL)) |
691 | 691 | ||
692 | #ifdef DCACHE_ALIASING_POSSIBLE | ||
693 | #define __HAVE_ARCH_MOVE_PTE | ||
694 | #define move_pte(pte, prot, old_addr, new_addr) \ | ||
695 | ({ \ | ||
696 | pte_t newpte = (pte); \ | ||
697 | if (tlb_type != hypervisor && pte_present(pte)) { \ | ||
698 | unsigned long this_pfn = pte_pfn(pte); \ | ||
699 | \ | ||
700 | if (pfn_valid(this_pfn) && \ | ||
701 | (((old_addr) ^ (new_addr)) & (1 << 13))) \ | ||
702 | flush_dcache_page_all(current->mm, \ | ||
703 | pfn_to_page(this_pfn)); \ | ||
704 | } \ | ||
705 | newpte; \ | ||
706 | }) | ||
707 | #endif | ||
708 | |||
692 | extern pgd_t swapper_pg_dir[2048]; | 709 | extern pgd_t swapper_pg_dir[2048]; |
693 | extern pmd_t swapper_low_pmd_dir[2048]; | 710 | extern pmd_t swapper_low_pmd_dir[2048]; |
694 | 711 | ||
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index 68705748bec0..998ef4ab0e06 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h | |||
@@ -318,11 +318,13 @@ | |||
318 | #define __NR_pselect6 297 | 318 | #define __NR_pselect6 297 |
319 | #define __NR_ppoll 298 | 319 | #define __NR_ppoll 298 |
320 | #define __NR_unshare 299 | 320 | #define __NR_unshare 299 |
321 | #define __NR_set_robust_list 300 | ||
322 | #define __NR_get_robust_list 301 | ||
321 | 323 | ||
322 | /* WARNING: You MAY NOT add syscall numbers larger than 299, since | 324 | /* WARNING: You MAY NOT add syscall numbers larger than 301, since |
323 | * all of the syscall tables in the Sparc kernel are | 325 | * all of the syscall tables in the Sparc kernel are |
324 | * sized to have 299 entries (starting at zero). Therefore | 326 | * sized to have 301 entries (starting at zero). Therefore |
325 | * find a free slot in the 0-299 range. | 327 | * find a free slot in the 0-301 range. |
326 | */ | 328 | */ |
327 | 329 | ||
328 | #define _syscall0(type,name) \ | 330 | #define _syscall0(type,name) \ |
diff --git a/include/asm-um/irqflags.h b/include/asm-um/irqflags.h new file mode 100644 index 000000000000..659b9abdfdba --- /dev/null +++ b/include/asm-um/irqflags.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_IRQFLAGS_H | ||
2 | #define __UM_IRQFLAGS_H | ||
3 | |||
4 | /* Empty for now */ | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h index bea5a015f667..16c734af9193 100644 --- a/include/asm-um/uaccess.h +++ b/include/asm-um/uaccess.h | |||
@@ -41,11 +41,11 @@ | |||
41 | 41 | ||
42 | #define __get_user(x, ptr) \ | 42 | #define __get_user(x, ptr) \ |
43 | ({ \ | 43 | ({ \ |
44 | const __typeof__(ptr) __private_ptr = ptr; \ | 44 | const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \ |
45 | __typeof__(x) __private_val; \ | 45 | __typeof__(x) __private_val; \ |
46 | int __private_ret = -EFAULT; \ | 46 | int __private_ret = -EFAULT; \ |
47 | (x) = (__typeof__(*(__private_ptr)))0; \ | 47 | (x) = (__typeof__(*(__private_ptr)))0; \ |
48 | if (__copy_from_user((void *) &__private_val, (__private_ptr), \ | 48 | if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\ |
49 | sizeof(*(__private_ptr))) == 0) { \ | 49 | sizeof(*(__private_ptr))) == 0) { \ |
50 | (x) = (__typeof__(*(__private_ptr))) __private_val; \ | 50 | (x) = (__typeof__(*(__private_ptr))) __private_val; \ |
51 | __private_ret = 0; \ | 51 | __private_ret = 0; \ |
@@ -62,7 +62,7 @@ | |||
62 | 62 | ||
63 | #define __put_user(x, ptr) \ | 63 | #define __put_user(x, ptr) \ |
64 | ({ \ | 64 | ({ \ |
65 | __typeof__(ptr) __private_ptr = ptr; \ | 65 | __typeof__(*(ptr)) __user *__private_ptr = ptr; \ |
66 | __typeof__(*(__private_ptr)) __private_val; \ | 66 | __typeof__(*(__private_ptr)) __private_val; \ |
67 | int __private_ret = -EFAULT; \ | 67 | int __private_ret = -EFAULT; \ |
68 | __private_val = (__typeof__(*(__private_ptr))) (x); \ | 68 | __private_val = (__typeof__(*(__private_ptr))) (x); \ |
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h index aa1c7b2e438c..2c95a319c056 100644 --- a/include/asm-x86_64/acpi.h +++ b/include/asm-x86_64/acpi.h | |||
@@ -162,6 +162,8 @@ extern int acpi_pci_disabled; | |||
162 | 162 | ||
163 | extern u8 x86_acpiid_to_apicid[]; | 163 | extern u8 x86_acpiid_to_apicid[]; |
164 | 164 | ||
165 | #define ARCH_HAS_POWER_INIT 1 | ||
166 | |||
165 | extern int acpi_skip_timer_override; | 167 | extern int acpi_skip_timer_override; |
166 | 168 | ||
167 | #endif /*__KERNEL__*/ | 169 | #endif /*__KERNEL__*/ |
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h index 5a48e9bcf218..1dd40067c67c 100644 --- a/include/asm-x86_64/apicdef.h +++ b/include/asm-x86_64/apicdef.h | |||
@@ -137,8 +137,6 @@ | |||
137 | */ | 137 | */ |
138 | #define u32 unsigned int | 138 | #define u32 unsigned int |
139 | 139 | ||
140 | #define lapic ((volatile struct local_apic *)APIC_BASE) | ||
141 | |||
142 | struct local_apic { | 140 | struct local_apic { |
143 | 141 | ||
144 | /*000*/ struct { u32 __reserved[4]; } __reserved_01; | 142 | /*000*/ struct { u32 __reserved[4]; } __reserved_01; |
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h index c98633af07d2..b4f8f4a41a6e 100644 --- a/include/asm-x86_64/elf.h +++ b/include/asm-x86_64/elf.h | |||
@@ -159,7 +159,7 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); | |||
159 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) | 159 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) |
160 | 160 | ||
161 | /* 1GB for 64bit, 8MB for 32bit */ | 161 | /* 1GB for 64bit, 8MB for 32bit */ |
162 | #define STACK_RND_MASK (is_compat_task() ? 0x7ff : 0x3fffff) | 162 | #define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff) |
163 | 163 | ||
164 | #endif | 164 | #endif |
165 | 165 | ||
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index ad133fcfb239..1713ace808bf 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
@@ -21,7 +21,7 @@ typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); | |||
21 | typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); | 21 | typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); |
22 | typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); | 22 | typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); |
23 | 23 | ||
24 | typedef int (elevator_init_fn) (request_queue_t *, elevator_t *); | 24 | typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *); |
25 | typedef void (elevator_exit_fn) (elevator_t *); | 25 | typedef void (elevator_exit_fn) (elevator_t *); |
26 | 26 | ||
27 | struct elevator_ops | 27 | struct elevator_ops |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 2d716080be4a..33d8f2087b6e 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
@@ -19,5 +19,4 @@ int request_firmware_nowait( | |||
19 | void (*cont)(const struct firmware *fw, void *context)); | 19 | void (*cont)(const struct firmware *fw, void *context)); |
20 | 20 | ||
21 | void release_firmware(const struct firmware *fw); | 21 | void release_firmware(const struct firmware *fw); |
22 | void register_firmware(const char *name, const u8 *data, size_t size); | ||
23 | #endif | 22 | #endif |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 3de2bfb2410f..f813bc8266aa 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -213,6 +213,10 @@ extern int dir_notify_enable; | |||
213 | #define FIBMAP _IO(0x00,1) /* bmap access */ | 213 | #define FIBMAP _IO(0x00,1) /* bmap access */ |
214 | #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ | 214 | #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ |
215 | 215 | ||
216 | #define SYNC_FILE_RANGE_WAIT_BEFORE 1 | ||
217 | #define SYNC_FILE_RANGE_WRITE 2 | ||
218 | #define SYNC_FILE_RANGE_WAIT_AFTER 4 | ||
219 | |||
216 | #ifdef __KERNEL__ | 220 | #ifdef __KERNEL__ |
217 | 221 | ||
218 | #include <linux/linkage.h> | 222 | #include <linux/linkage.h> |
@@ -758,9 +762,6 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | |||
758 | extern int fcntl_getlease(struct file *filp); | 762 | extern int fcntl_getlease(struct file *filp); |
759 | 763 | ||
760 | /* fs/sync.c */ | 764 | /* fs/sync.c */ |
761 | #define SYNC_FILE_RANGE_WAIT_BEFORE 1 | ||
762 | #define SYNC_FILE_RANGE_WRITE 2 | ||
763 | #define SYNC_FILE_RANGE_WAIT_AFTER 4 | ||
764 | extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte, | 765 | extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte, |
765 | unsigned int flags); | 766 | unsigned int flags); |
766 | 767 | ||
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index a3a0e078f79d..16fbe59edeb1 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -110,5 +110,16 @@ struct fsl_usb2_platform_data { | |||
110 | #define FSL_USB2_PORT0_ENABLED 0x00000001 | 110 | #define FSL_USB2_PORT0_ENABLED 0x00000001 |
111 | #define FSL_USB2_PORT1_ENABLED 0x00000002 | 111 | #define FSL_USB2_PORT1_ENABLED 0x00000002 |
112 | 112 | ||
113 | struct fsl_spi_platform_data { | ||
114 | u32 initial_spmode; /* initial SPMODE value */ | ||
115 | u16 bus_num; | ||
116 | |||
117 | /* board specific information */ | ||
118 | u16 max_chipselect; | ||
119 | void (*activate_cs)(u8 cs, u8 polarity); | ||
120 | void (*deactivate_cs)(u8 cs, u8 polarity); | ||
121 | u32 sysclk; | ||
122 | }; | ||
123 | |||
113 | #endif /* _FSL_DEVICE_H_ */ | 124 | #endif /* _FSL_DEVICE_H_ */ |
114 | #endif /* __KERNEL__ */ | 125 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index dd7d627bf66f..c115e9e840b4 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -1114,8 +1114,11 @@ static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c) | |||
1114 | 1114 | ||
1115 | mmsg->mfa = readl(c->in_port); | 1115 | mmsg->mfa = readl(c->in_port); |
1116 | if (unlikely(mmsg->mfa >= c->in_queue.len)) { | 1116 | if (unlikely(mmsg->mfa >= c->in_queue.len)) { |
1117 | u32 mfa = mmsg->mfa; | ||
1118 | |||
1117 | mempool_free(mmsg, c->in_msg.mempool); | 1119 | mempool_free(mmsg, c->in_msg.mempool); |
1118 | if(mmsg->mfa == I2O_QUEUE_EMPTY) | 1120 | |
1121 | if (mfa == I2O_QUEUE_EMPTY) | ||
1119 | return ERR_PTR(-EBUSY); | 1122 | return ERR_PTR(-EBUSY); |
1120 | return ERR_PTR(-EFAULT); | 1123 | return ERR_PTR(-EFAULT); |
1121 | } | 1124 | } |
diff --git a/include/linux/input.h b/include/linux/input.h index 50e338d2ffda..ce1a756c4c30 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -345,6 +345,8 @@ struct input_absinfo { | |||
345 | #define KEY_SAVE 234 | 345 | #define KEY_SAVE 234 |
346 | #define KEY_DOCUMENTS 235 | 346 | #define KEY_DOCUMENTS 235 |
347 | 347 | ||
348 | #define KEY_BATTERY 236 | ||
349 | |||
348 | #define KEY_UNKNOWN 240 | 350 | #define KEY_UNKNOWN 240 |
349 | 351 | ||
350 | #define BTN_MISC 0x100 | 352 | #define BTN_MISC 0x100 |
@@ -577,14 +579,9 @@ struct input_absinfo { | |||
577 | * Switch events | 579 | * Switch events |
578 | */ | 580 | */ |
579 | 581 | ||
580 | #define SW_0 0x00 | 582 | #define SW_LID 0x00 /* set = lid shut */ |
581 | #define SW_1 0x01 | 583 | #define SW_TABLET_MODE 0x01 /* set = tablet mode */ |
582 | #define SW_2 0x02 | 584 | #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ |
583 | #define SW_3 0x03 | ||
584 | #define SW_4 0x04 | ||
585 | #define SW_5 0x05 | ||
586 | #define SW_6 0x06 | ||
587 | #define SW_7 0x07 | ||
588 | #define SW_MAX 0x0f | 585 | #define SW_MAX 0x0f |
589 | 586 | ||
590 | /* | 587 | /* |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e1bd0842f6a1..f4fc576ed4c4 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -124,6 +124,7 @@ extern int get_option(char **str, int *pint); | |||
124 | extern char *get_options(const char *str, int nints, int *ints); | 124 | extern char *get_options(const char *str, int nints, int *ints); |
125 | extern unsigned long long memparse(char *ptr, char **retptr); | 125 | extern unsigned long long memparse(char *ptr, char **retptr); |
126 | 126 | ||
127 | extern int core_kernel_text(unsigned long addr); | ||
127 | extern int __kernel_text_address(unsigned long addr); | 128 | extern int __kernel_text_address(unsigned long addr); |
128 | extern int kernel_text_address(unsigned long addr); | 129 | extern int kernel_text_address(unsigned long addr); |
129 | extern int session_of_pgrp(int pgrp); | 130 | extern int session_of_pgrp(int pgrp); |
diff --git a/include/linux/m48t86.h b/include/linux/m48t86.h index 9065199319d0..915d6b4f0f89 100644 --- a/include/linux/m48t86.h +++ b/include/linux/m48t86.h | |||
@@ -11,6 +11,6 @@ | |||
11 | 11 | ||
12 | struct m48t86_ops | 12 | struct m48t86_ops |
13 | { | 13 | { |
14 | void (*writeb)(unsigned char value, unsigned long addr); | 14 | void (*writebyte)(unsigned char value, unsigned long addr); |
15 | unsigned char (*readb)(unsigned long addr); | 15 | unsigned char (*readbyte)(unsigned long addr); |
16 | }; | 16 | }; |
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 6a7621b2b12b..f5fdca1d67e6 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/nodemask.h> | 36 | #include <linux/nodemask.h> |
37 | 37 | ||
38 | struct vm_area_struct; | 38 | struct vm_area_struct; |
39 | struct mm_struct; | ||
39 | 40 | ||
40 | #ifdef CONFIG_NUMA | 41 | #ifdef CONFIG_NUMA |
41 | 42 | ||
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index bdc556d88498..03a14a30c46a 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
@@ -69,6 +69,7 @@ struct mmc_data { | |||
69 | unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */ | 69 | unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */ |
70 | unsigned int timeout_clks; /* data timeout (in clocks) */ | 70 | unsigned int timeout_clks; /* data timeout (in clocks) */ |
71 | unsigned int blksz_bits; /* data block size */ | 71 | unsigned int blksz_bits; /* data block size */ |
72 | unsigned int blksz; /* data block size */ | ||
72 | unsigned int blocks; /* number of blocks */ | 73 | unsigned int blocks; /* number of blocks */ |
73 | unsigned int error; /* data error */ | 74 | unsigned int error; /* data error */ |
74 | unsigned int flags; | 75 | unsigned int flags; |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index b5c21122c299..2d8337150493 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/seqlock.h> | 15 | #include <linux/seqlock.h> |
16 | #include <linux/nodemask.h> | 16 | #include <linux/nodemask.h> |
17 | #include <asm/atomic.h> | 17 | #include <asm/atomic.h> |
18 | #include <asm/page.h> | ||
18 | 19 | ||
19 | /* Free memory management - zoned buddy allocator. */ | 20 | /* Free memory management - zoned buddy allocator. */ |
20 | #ifndef CONFIG_FORCE_MAX_ZONEORDER | 21 | #ifndef CONFIG_FORCE_MAX_ZONEORDER |
@@ -22,6 +23,7 @@ | |||
22 | #else | 23 | #else |
23 | #define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER | 24 | #define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER |
24 | #endif | 25 | #endif |
26 | #define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1)) | ||
25 | 27 | ||
26 | struct free_area { | 28 | struct free_area { |
27 | struct list_head free_list; | 29 | struct list_head free_list; |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 4877e35ae202..936ef82ed76a 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -50,7 +50,7 @@ | |||
50 | extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); | 50 | extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); |
51 | extern acpi_status pci_osc_support_set(u32 flags); | 51 | extern acpi_status pci_osc_support_set(u32 flags); |
52 | #else | 52 | #else |
53 | #if !defined(acpi_status) | 53 | #if !defined(AE_ERROR) |
54 | typedef u32 acpi_status; | 54 | typedef u32 acpi_status; |
55 | #define AE_ERROR (acpi_status) (0x0001) | 55 | #define AE_ERROR (acpi_status) (0x0001) |
56 | #endif | 56 | #endif |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index d6fe048376ab..590dc6dca315 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1231,6 +1231,7 @@ | |||
1231 | #define PCI_DEVICE_ID_VIA_8380_0 0x0204 | 1231 | #define PCI_DEVICE_ID_VIA_8380_0 0x0204 |
1232 | #define PCI_DEVICE_ID_VIA_3238_0 0x0238 | 1232 | #define PCI_DEVICE_ID_VIA_3238_0 0x0238 |
1233 | #define PCI_DEVICE_ID_VIA_PT880 0x0258 | 1233 | #define PCI_DEVICE_ID_VIA_PT880 0x0258 |
1234 | #define PCI_DEVICE_ID_VIA_PT880ULTRA 0x0308 | ||
1234 | #define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259 | 1235 | #define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259 |
1235 | #define PCI_DEVICE_ID_VIA_3269_0 0x0269 | 1236 | #define PCI_DEVICE_ID_VIA_3269_0 0x0269 |
1236 | #define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282 | 1237 | #define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282 |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 5673008b61e1..970284f571a6 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -132,6 +132,7 @@ static inline void rcu_bh_qsctr_inc(int cpu) | |||
132 | } | 132 | } |
133 | 133 | ||
134 | extern int rcu_pending(int cpu); | 134 | extern int rcu_pending(int cpu); |
135 | extern int rcu_needs_cpu(int cpu); | ||
135 | 136 | ||
136 | /** | 137 | /** |
137 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. | 138 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 3af03b19c983..2d985d59c7b8 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -150,6 +150,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | |||
150 | 150 | ||
151 | extern void kfree(const void *); | 151 | extern void kfree(const void *); |
152 | extern unsigned int ksize(const void *); | 152 | extern unsigned int ksize(const void *); |
153 | extern int slab_is_available(void); | ||
153 | 154 | ||
154 | #ifdef CONFIG_NUMA | 155 | #ifdef CONFIG_NUMA |
155 | extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); | 156 | extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index b05f1463a267..e928c0dcc297 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -31,18 +31,23 @@ extern struct bus_type spi_bus_type; | |||
31 | * @master: SPI controller used with the device. | 31 | * @master: SPI controller used with the device. |
32 | * @max_speed_hz: Maximum clock rate to be used with this chip | 32 | * @max_speed_hz: Maximum clock rate to be used with this chip |
33 | * (on this board); may be changed by the device's driver. | 33 | * (on this board); may be changed by the device's driver. |
34 | * The spi_transfer.speed_hz can override this for each transfer. | ||
34 | * @chip-select: Chipselect, distinguishing chips handled by "master". | 35 | * @chip-select: Chipselect, distinguishing chips handled by "master". |
35 | * @mode: The spi mode defines how data is clocked out and in. | 36 | * @mode: The spi mode defines how data is clocked out and in. |
36 | * This may be changed by the device's driver. | 37 | * This may be changed by the device's driver. |
38 | * The "active low" default for chipselect mode can be overridden, | ||
39 | * as can the "MSB first" default for each word in a transfer. | ||
37 | * @bits_per_word: Data transfers involve one or more words; word sizes | 40 | * @bits_per_word: Data transfers involve one or more words; word sizes |
38 | * like eight or 12 bits are common. In-memory wordsizes are | 41 | * like eight or 12 bits are common. In-memory wordsizes are |
39 | * powers of two bytes (e.g. 20 bit samples use 32 bits). | 42 | * powers of two bytes (e.g. 20 bit samples use 32 bits). |
40 | * This may be changed by the device's driver. | 43 | * This may be changed by the device's driver, or left at the |
44 | * default (0) indicating protocol words are eight bit bytes. | ||
45 | * The spi_transfer.bits_per_word can override this for each transfer. | ||
41 | * @irq: Negative, or the number passed to request_irq() to receive | 46 | * @irq: Negative, or the number passed to request_irq() to receive |
42 | * interrupts from this device. | 47 | * interrupts from this device. |
43 | * @controller_state: Controller's runtime state | 48 | * @controller_state: Controller's runtime state |
44 | * @controller_data: Board-specific definitions for controller, such as | 49 | * @controller_data: Board-specific definitions for controller, such as |
45 | * FIFO initialization parameters; from board_info.controller_data | 50 | * FIFO initialization parameters; from board_info.controller_data |
46 | * | 51 | * |
47 | * An spi_device is used to interchange data between an SPI slave | 52 | * An spi_device is used to interchange data between an SPI slave |
48 | * (usually a discrete chip) and CPU memory. | 53 | * (usually a discrete chip) and CPU memory. |
@@ -65,6 +70,7 @@ struct spi_device { | |||
65 | #define SPI_MODE_2 (SPI_CPOL|0) | 70 | #define SPI_MODE_2 (SPI_CPOL|0) |
66 | #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) | 71 | #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) |
67 | #define SPI_CS_HIGH 0x04 /* chipselect active high? */ | 72 | #define SPI_CS_HIGH 0x04 /* chipselect active high? */ |
73 | #define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ | ||
68 | u8 bits_per_word; | 74 | u8 bits_per_word; |
69 | int irq; | 75 | int irq; |
70 | void *controller_state; | 76 | void *controller_state; |
@@ -73,7 +79,6 @@ struct spi_device { | |||
73 | 79 | ||
74 | // likely need more hooks for more protocol options affecting how | 80 | // likely need more hooks for more protocol options affecting how |
75 | // the controller talks to each chip, like: | 81 | // the controller talks to each chip, like: |
76 | // - bit order (default is wordwise msb-first) | ||
77 | // - memory packing (12 bit samples into low bits, others zeroed) | 82 | // - memory packing (12 bit samples into low bits, others zeroed) |
78 | // - priority | 83 | // - priority |
79 | // - drop chipselect after each word | 84 | // - drop chipselect after each word |
@@ -143,13 +148,13 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
143 | * struct spi_master - interface to SPI master controller | 148 | * struct spi_master - interface to SPI master controller |
144 | * @cdev: class interface to this driver | 149 | * @cdev: class interface to this driver |
145 | * @bus_num: board-specific (and often SOC-specific) identifier for a | 150 | * @bus_num: board-specific (and often SOC-specific) identifier for a |
146 | * given SPI controller. | 151 | * given SPI controller. |
147 | * @num_chipselect: chipselects are used to distinguish individual | 152 | * @num_chipselect: chipselects are used to distinguish individual |
148 | * SPI slaves, and are numbered from zero to num_chipselects. | 153 | * SPI slaves, and are numbered from zero to num_chipselects. |
149 | * each slave has a chipselect signal, but it's common that not | 154 | * each slave has a chipselect signal, but it's common that not |
150 | * every chipselect is connected to a slave. | 155 | * every chipselect is connected to a slave. |
151 | * @setup: updates the device mode and clocking records used by a | 156 | * @setup: updates the device mode and clocking records used by a |
152 | * device's SPI controller; protocol code may call this. | 157 | * device's SPI controller; protocol code may call this. |
153 | * @transfer: adds a message to the controller's transfer queue. | 158 | * @transfer: adds a message to the controller's transfer queue. |
154 | * @cleanup: frees controller-specific state | 159 | * @cleanup: frees controller-specific state |
155 | * | 160 | * |
@@ -167,13 +172,13 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
167 | struct spi_master { | 172 | struct spi_master { |
168 | struct class_device cdev; | 173 | struct class_device cdev; |
169 | 174 | ||
170 | /* other than zero (== assign one dynamically), bus_num is fully | 175 | /* other than negative (== assign one dynamically), bus_num is fully |
171 | * board-specific. usually that simplifies to being SOC-specific. | 176 | * board-specific. usually that simplifies to being SOC-specific. |
172 | * example: one SOC has three SPI controllers, numbered 1..3, | 177 | * example: one SOC has three SPI controllers, numbered 0..2, |
173 | * and one board's schematics might show it using SPI-2. software | 178 | * and one board's schematics might show it using SPI-2. software |
174 | * would normally use bus_num=2 for that controller. | 179 | * would normally use bus_num=2 for that controller. |
175 | */ | 180 | */ |
176 | u16 bus_num; | 181 | s16 bus_num; |
177 | 182 | ||
178 | /* chipselects will be integral to many controllers; some others | 183 | /* chipselects will be integral to many controllers; some others |
179 | * might use board-specific GPIOs. | 184 | * might use board-specific GPIOs. |
@@ -268,10 +273,14 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
268 | * @tx_dma: DMA address of tx_buf, if spi_message.is_dma_mapped | 273 | * @tx_dma: DMA address of tx_buf, if spi_message.is_dma_mapped |
269 | * @rx_dma: DMA address of rx_buf, if spi_message.is_dma_mapped | 274 | * @rx_dma: DMA address of rx_buf, if spi_message.is_dma_mapped |
270 | * @len: size of rx and tx buffers (in bytes) | 275 | * @len: size of rx and tx buffers (in bytes) |
276 | * @speed_hz: Select a speed other then the device default for this | ||
277 | * transfer. If 0 the default (from spi_device) is used. | ||
278 | * @bits_per_word: select a bits_per_word other then the device default | ||
279 | * for this transfer. If 0 the default (from spi_device) is used. | ||
271 | * @cs_change: affects chipselect after this transfer completes | 280 | * @cs_change: affects chipselect after this transfer completes |
272 | * @delay_usecs: microseconds to delay after this transfer before | 281 | * @delay_usecs: microseconds to delay after this transfer before |
273 | * (optionally) changing the chipselect status, then starting | 282 | * (optionally) changing the chipselect status, then starting |
274 | * the next transfer or completing this spi_message. | 283 | * the next transfer or completing this spi_message. |
275 | * @transfer_list: transfers are sequenced through spi_message.transfers | 284 | * @transfer_list: transfers are sequenced through spi_message.transfers |
276 | * | 285 | * |
277 | * SPI transfers always write the same number of bytes as they read. | 286 | * SPI transfers always write the same number of bytes as they read. |
@@ -322,7 +331,9 @@ struct spi_transfer { | |||
322 | dma_addr_t rx_dma; | 331 | dma_addr_t rx_dma; |
323 | 332 | ||
324 | unsigned cs_change:1; | 333 | unsigned cs_change:1; |
334 | u8 bits_per_word; | ||
325 | u16 delay_usecs; | 335 | u16 delay_usecs; |
336 | u32 speed_hz; | ||
326 | 337 | ||
327 | struct list_head transfer_list; | 338 | struct list_head transfer_list; |
328 | }; | 339 | }; |
@@ -356,7 +367,7 @@ struct spi_transfer { | |||
356 | * and its transfers, ignore them until its completion callback. | 367 | * and its transfers, ignore them until its completion callback. |
357 | */ | 368 | */ |
358 | struct spi_message { | 369 | struct spi_message { |
359 | struct list_head transfers; | 370 | struct list_head transfers; |
360 | 371 | ||
361 | struct spi_device *spi; | 372 | struct spi_device *spi; |
362 | 373 | ||
@@ -374,7 +385,7 @@ struct spi_message { | |||
374 | */ | 385 | */ |
375 | 386 | ||
376 | /* completion is reported through a callback */ | 387 | /* completion is reported through a callback */ |
377 | void (*complete)(void *context); | 388 | void (*complete)(void *context); |
378 | void *context; | 389 | void *context; |
379 | unsigned actual_length; | 390 | unsigned actual_length; |
380 | int status; | 391 | int status; |
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index c961fe9bf3eb..16ce178f54d7 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
@@ -30,6 +30,12 @@ struct spi_bitbang { | |||
30 | 30 | ||
31 | struct spi_master *master; | 31 | struct spi_master *master; |
32 | 32 | ||
33 | /* setup_transfer() changes clock and/or wordsize to match settings | ||
34 | * for this transfer; zeroes restore defaults from spi_device. | ||
35 | */ | ||
36 | int (*setup_transfer)(struct spi_device *spi, | ||
37 | struct spi_transfer *t); | ||
38 | |||
33 | void (*chipselect)(struct spi_device *spi, int is_on); | 39 | void (*chipselect)(struct spi_device *spi, int is_on); |
34 | #define BITBANG_CS_ACTIVE 1 /* normally nCS, active low */ | 40 | #define BITBANG_CS_ACTIVE 1 /* normally nCS, active low */ |
35 | #define BITBANG_CS_INACTIVE 0 | 41 | #define BITBANG_CS_INACTIVE 0 |
@@ -51,6 +57,8 @@ struct spi_bitbang { | |||
51 | extern int spi_bitbang_setup(struct spi_device *spi); | 57 | extern int spi_bitbang_setup(struct spi_device *spi); |
52 | extern void spi_bitbang_cleanup(const struct spi_device *spi); | 58 | extern void spi_bitbang_cleanup(const struct spi_device *spi); |
53 | extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m); | 59 | extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m); |
60 | extern int spi_bitbang_setup_transfer(struct spi_device *spi, | ||
61 | struct spi_transfer *t); | ||
54 | 62 | ||
55 | /* start or stop queue processing */ | 63 | /* start or stop queue processing */ |
56 | extern int spi_bitbang_start(struct spi_bitbang *spi); | 64 | extern int spi_bitbang_start(struct spi_bitbang *spi); |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 5b1fdf1cff4f..f03c24719302 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -296,7 +296,7 @@ static inline void disable_swap_token(void) | |||
296 | #define read_swap_cache_async(swp,vma,addr) NULL | 296 | #define read_swap_cache_async(swp,vma,addr) NULL |
297 | #define lookup_swap_cache(swp) NULL | 297 | #define lookup_swap_cache(swp) NULL |
298 | #define valid_swaphandles(swp, off) 0 | 298 | #define valid_swaphandles(swp, off) 0 |
299 | #define can_share_swap_page(p) 0 | 299 | #define can_share_swap_page(p) (page_mapcount(p) == 1) |
300 | #define move_to_swap_cache(p, swp) 1 | 300 | #define move_to_swap_cache(p, swp) 1 |
301 | #define move_from_swap_cache(p, i, m) 1 | 301 | #define move_from_swap_cache(p, i, m) 1 |
302 | #define __delete_from_swap_cache(p) /*NOTHING*/ | 302 | #define __delete_from_swap_cache(p) /*NOTHING*/ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 3996960fc565..60d49e5456e7 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -52,6 +52,7 @@ struct utimbuf; | |||
52 | struct mq_attr; | 52 | struct mq_attr; |
53 | struct compat_stat; | 53 | struct compat_stat; |
54 | struct compat_timeval; | 54 | struct compat_timeval; |
55 | struct robust_list_head; | ||
55 | 56 | ||
56 | #include <linux/config.h> | 57 | #include <linux/config.h> |
57 | #include <linux/types.h> | 58 | #include <linux/types.h> |
@@ -581,5 +582,10 @@ asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags); | |||
581 | 582 | ||
582 | asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, | 583 | asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, |
583 | unsigned int flags); | 584 | unsigned int flags); |
585 | asmlinkage long sys_get_robust_list(int pid, | ||
586 | struct robust_list_head __user **head_ptr, | ||
587 | size_t __user *len_ptr); | ||
588 | asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, | ||
589 | size_t len); | ||
584 | 590 | ||
585 | #endif | 591 | #endif |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index d7670ec1ec1e..ad7fa9c86c10 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -1141,8 +1141,13 @@ extern char *v4l2_type_names[]; | |||
1141 | /* Compatibility layer interface -- v4l1-compat module */ | 1141 | /* Compatibility layer interface -- v4l1-compat module */ |
1142 | typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, | 1142 | typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, |
1143 | unsigned int cmd, void *arg); | 1143 | unsigned int cmd, void *arg); |
1144 | |||
1145 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1144 | int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, | 1146 | int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, |
1145 | int cmd, void *arg, v4l2_kioctl driver_ioctl); | 1147 | int cmd, void *arg, v4l2_kioctl driver_ioctl); |
1148 | #else | ||
1149 | #define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL | ||
1150 | #endif | ||
1146 | 1151 | ||
1147 | /* 32 Bits compatibility layer for 64 bits processors */ | 1152 | /* 32 Bits compatibility layer for 64 bits processors */ |
1148 | extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, | 1153 | extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 530ae3f4248c..fab5aed8ca31 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
@@ -73,11 +73,6 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); | |||
73 | int vt_waitactive(int vt); | 73 | int vt_waitactive(int vt); |
74 | void change_console(struct vc_data *new_vc); | 74 | void change_console(struct vc_data *new_vc); |
75 | void reset_vc(struct vc_data *vc); | 75 | void reset_vc(struct vc_data *vc); |
76 | #ifdef CONFIG_VT | ||
77 | int is_console_suspend_safe(void); | ||
78 | #else | ||
79 | static inline int is_console_suspend_safe(void) { return 1; } | ||
80 | #endif | ||
81 | 76 | ||
82 | /* | 77 | /* |
83 | * vc_screen.c shares this temporary buffer with the console write code so that | 78 | * vc_screen.c shares this temporary buffer with the console write code so that |
diff --git a/include/net/compat.h b/include/net/compat.h index 8662b8f43df5..e65cbedb6abc 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
6 | struct sock; | ||
7 | |||
6 | #if defined(CONFIG_COMPAT) | 8 | #if defined(CONFIG_COMPAT) |
7 | 9 | ||
8 | #include <linux/compat.h> | 10 | #include <linux/compat.h> |
@@ -23,7 +25,6 @@ struct compat_cmsghdr { | |||
23 | compat_int_t cmsg_type; | 25 | compat_int_t cmsg_type; |
24 | }; | 26 | }; |
25 | 27 | ||
26 | struct sock; | ||
27 | extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); | 28 | extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); |
28 | 29 | ||
29 | #else /* defined(CONFIG_COMPAT) */ | 30 | #else /* defined(CONFIG_COMPAT) */ |
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h index 86aefb1fda5e..c0c895d379ba 100644 --- a/include/net/irda/irlmp.h +++ b/include/net/irda/irlmp.h | |||
@@ -112,7 +112,7 @@ struct lsap_cb { | |||
112 | 112 | ||
113 | struct timer_list watchdog_timer; | 113 | struct timer_list watchdog_timer; |
114 | 114 | ||
115 | IRLMP_STATE lsap_state; /* Connection state */ | 115 | LSAP_STATE lsap_state; /* Connection state */ |
116 | notify_t notify; /* Indication/Confirm entry points */ | 116 | notify_t notify; /* Indication/Confirm entry points */ |
117 | struct qos_info qos; /* QoS for this connection */ | 117 | struct qos_info qos; /* QoS for this connection */ |
118 | 118 | ||
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index b0666d66293f..4901ee446879 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -211,6 +211,7 @@ struct neigh_table | |||
211 | #define NEIGH_UPDATE_F_ADMIN 0x80000000 | 211 | #define NEIGH_UPDATE_F_ADMIN 0x80000000 |
212 | 212 | ||
213 | extern void neigh_table_init(struct neigh_table *tbl); | 213 | extern void neigh_table_init(struct neigh_table *tbl); |
214 | extern void neigh_table_init_no_netlink(struct neigh_table *tbl); | ||
214 | extern int neigh_table_clear(struct neigh_table *tbl); | 215 | extern int neigh_table_clear(struct neigh_table *tbl); |
215 | extern struct neighbour * neigh_lookup(struct neigh_table *tbl, | 216 | extern struct neighbour * neigh_lookup(struct neigh_table *tbl, |
216 | const void *pkey, | 217 | const void *pkey, |
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index 34a1a09e5aef..807d6f1ef4b5 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
@@ -99,6 +99,7 @@ typedef enum { | |||
99 | SCTP_CMD_DEL_NON_PRIMARY, /* Removes non-primary peer transports. */ | 99 | SCTP_CMD_DEL_NON_PRIMARY, /* Removes non-primary peer transports. */ |
100 | SCTP_CMD_T3_RTX_TIMERS_STOP, /* Stops T3-rtx pending timers */ | 100 | SCTP_CMD_T3_RTX_TIMERS_STOP, /* Stops T3-rtx pending timers */ |
101 | SCTP_CMD_FORCE_PRIM_RETRAN, /* Forces retrans. over primary path. */ | 101 | SCTP_CMD_FORCE_PRIM_RETRAN, /* Forces retrans. over primary path. */ |
102 | SCTP_CMD_SET_SK_ERR, /* Set sk_err */ | ||
102 | SCTP_CMD_LAST | 103 | SCTP_CMD_LAST |
103 | } sctp_verb_t; | 104 | } sctp_verb_t; |
104 | 105 | ||
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index e673b2c984e9..aa6033ca7cd8 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -461,12 +461,12 @@ static inline int sctp_frag_point(const struct sctp_sock *sp, int pmtu) | |||
461 | * there is room for a param header too. | 461 | * there is room for a param header too. |
462 | */ | 462 | */ |
463 | #define sctp_walk_params(pos, chunk, member)\ | 463 | #define sctp_walk_params(pos, chunk, member)\ |
464 | _sctp_walk_params((pos), (chunk), WORD_ROUND(ntohs((chunk)->chunk_hdr.length)), member) | 464 | _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) |
465 | 465 | ||
466 | #define _sctp_walk_params(pos, chunk, end, member)\ | 466 | #define _sctp_walk_params(pos, chunk, end, member)\ |
467 | for (pos.v = chunk->member;\ | 467 | for (pos.v = chunk->member;\ |
468 | pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\ | 468 | pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\ |
469 | pos.v <= (void *)chunk + end - WORD_ROUND(ntohs(pos.p->length)) &&\ | 469 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ |
470 | ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ | 470 | ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ |
471 | pos.v += WORD_ROUND(ntohs(pos.p->length))) | 471 | pos.v += WORD_ROUND(ntohs(pos.p->length))) |
472 | 472 | ||
@@ -477,7 +477,7 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) | |||
477 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ | 477 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ |
478 | sizeof(sctp_chunkhdr_t));\ | 478 | sizeof(sctp_chunkhdr_t));\ |
479 | (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\ | 479 | (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\ |
480 | (void *)err <= (void *)chunk_hdr + end - WORD_ROUND(ntohs(err->length)) &&\ | 480 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ |
481 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ | 481 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ |
482 | err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) | 482 | err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) |
483 | 483 | ||
diff --git a/init/do_mounts.c b/init/do_mounts.c index adb7cad3e6ee..f4b7b9d278cd 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -310,6 +310,11 @@ retry: | |||
310 | 310 | ||
311 | panic("VFS: Unable to mount root fs on %s", b); | 311 | panic("VFS: Unable to mount root fs on %s", b); |
312 | } | 312 | } |
313 | |||
314 | printk("No filesystem could mount root, tried: "); | ||
315 | for (p = fs_names; *p; p += strlen(p)+1) | ||
316 | printk(" %s", p); | ||
317 | printk("\n"); | ||
313 | panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b)); | 318 | panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b)); |
314 | out: | 319 | out: |
315 | putname(fs_names); | 320 | putname(fs_names); |
diff --git a/init/initramfs.c b/init/initramfs.c index 679d870d991b..f81cfa40a719 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
@@ -26,10 +26,12 @@ static void __init free(void *where) | |||
26 | 26 | ||
27 | /* link hash */ | 27 | /* link hash */ |
28 | 28 | ||
29 | #define N_ALIGN(len) ((((len) + 1) & ~3) + 2) | ||
30 | |||
29 | static __initdata struct hash { | 31 | static __initdata struct hash { |
30 | int ino, minor, major; | 32 | int ino, minor, major; |
31 | struct hash *next; | 33 | struct hash *next; |
32 | char *name; | 34 | char name[N_ALIGN(PATH_MAX)]; |
33 | } *head[32]; | 35 | } *head[32]; |
34 | 36 | ||
35 | static inline int hash(int major, int minor, int ino) | 37 | static inline int hash(int major, int minor, int ino) |
@@ -57,7 +59,7 @@ static char __init *find_link(int major, int minor, int ino, char *name) | |||
57 | q->ino = ino; | 59 | q->ino = ino; |
58 | q->minor = minor; | 60 | q->minor = minor; |
59 | q->major = major; | 61 | q->major = major; |
60 | q->name = name; | 62 | strcpy(q->name, name); |
61 | q->next = NULL; | 63 | q->next = NULL; |
62 | *p = q; | 64 | *p = q; |
63 | return NULL; | 65 | return NULL; |
@@ -133,8 +135,6 @@ static inline void eat(unsigned n) | |||
133 | count -= n; | 135 | count -= n; |
134 | } | 136 | } |
135 | 137 | ||
136 | #define N_ALIGN(len) ((((len) + 1) & ~3) + 2) | ||
137 | |||
138 | static __initdata char *collected; | 138 | static __initdata char *collected; |
139 | static __initdata int remains; | 139 | static __initdata int remains; |
140 | static __initdata char *collect; | 140 | static __initdata char *collect; |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 72248d1b9e3f..ab81fdd4572b 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -2231,19 +2231,25 @@ static const struct cpuset *nearest_exclusive_ancestor(const struct cpuset *cs) | |||
2231 | * So only GFP_KERNEL allocations, if all nodes in the cpuset are | 2231 | * So only GFP_KERNEL allocations, if all nodes in the cpuset are |
2232 | * short of memory, might require taking the callback_mutex mutex. | 2232 | * short of memory, might require taking the callback_mutex mutex. |
2233 | * | 2233 | * |
2234 | * The first loop over the zonelist in mm/page_alloc.c:__alloc_pages() | 2234 | * The first call here from mm/page_alloc:get_page_from_freelist() |
2235 | * calls here with __GFP_HARDWALL always set in gfp_mask, enforcing | 2235 | * has __GFP_HARDWALL set in gfp_mask, enforcing hardwall cpusets, so |
2236 | * hardwall cpusets - no allocation on a node outside the cpuset is | 2236 | * no allocation on a node outside the cpuset is allowed (unless in |
2237 | * allowed (unless in interrupt, of course). | 2237 | * interrupt, of course). |
2238 | * | 2238 | * |
2239 | * The second loop doesn't even call here for GFP_ATOMIC requests | 2239 | * The second pass through get_page_from_freelist() doesn't even call |
2240 | * (if the __alloc_pages() local variable 'wait' is set). That check | 2240 | * here for GFP_ATOMIC calls. For those calls, the __alloc_pages() |
2241 | * and the checks below have the combined affect in the second loop of | 2241 | * variable 'wait' is not set, and the bit ALLOC_CPUSET is not set |
2242 | * the __alloc_pages() routine that: | 2242 | * in alloc_flags. That logic and the checks below have the combined |
2243 | * affect that: | ||
2243 | * in_interrupt - any node ok (current task context irrelevant) | 2244 | * in_interrupt - any node ok (current task context irrelevant) |
2244 | * GFP_ATOMIC - any node ok | 2245 | * GFP_ATOMIC - any node ok |
2245 | * GFP_KERNEL - any node in enclosing mem_exclusive cpuset ok | 2246 | * GFP_KERNEL - any node in enclosing mem_exclusive cpuset ok |
2246 | * GFP_USER - only nodes in current tasks mems allowed ok. | 2247 | * GFP_USER - only nodes in current tasks mems allowed ok. |
2248 | * | ||
2249 | * Rule: | ||
2250 | * Don't call cpuset_zone_allowed() if you can't sleep, unless you | ||
2251 | * pass in the __GFP_HARDWALL flag set in gfp_flag, which disables | ||
2252 | * the code that might scan up ancestor cpusets and sleep. | ||
2247 | **/ | 2253 | **/ |
2248 | 2254 | ||
2249 | int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) | 2255 | int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) |
@@ -2255,6 +2261,7 @@ int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) | |||
2255 | if (in_interrupt()) | 2261 | if (in_interrupt()) |
2256 | return 1; | 2262 | return 1; |
2257 | node = z->zone_pgdat->node_id; | 2263 | node = z->zone_pgdat->node_id; |
2264 | might_sleep_if(!(gfp_mask & __GFP_HARDWALL)); | ||
2258 | if (node_isset(node, current->mems_allowed)) | 2265 | if (node_isset(node, current->mems_allowed)) |
2259 | return 1; | 2266 | return 1; |
2260 | if (gfp_mask & __GFP_HARDWALL) /* If hardwall request, stop here */ | 2267 | if (gfp_mask & __GFP_HARDWALL) /* If hardwall request, stop here */ |
diff --git a/kernel/extable.c b/kernel/extable.c index 7501b531ceed..7fe262855317 100644 --- a/kernel/extable.c +++ b/kernel/extable.c | |||
@@ -40,7 +40,7 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr) | |||
40 | return e; | 40 | return e; |
41 | } | 41 | } |
42 | 42 | ||
43 | static int core_kernel_text(unsigned long addr) | 43 | int core_kernel_text(unsigned long addr) |
44 | { | 44 | { |
45 | if (addr >= (unsigned long)_stext && | 45 | if (addr >= (unsigned long)_stext && |
46 | addr <= (unsigned long)_etext) | 46 | addr <= (unsigned long)_etext) |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index b7f0388bd71c..01fa2ae98a85 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -456,6 +456,7 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode) | |||
456 | 456 | ||
457 | return ret; | 457 | return ret; |
458 | } | 458 | } |
459 | EXPORT_SYMBOL_GPL(hrtimer_start); | ||
459 | 460 | ||
460 | /** | 461 | /** |
461 | * hrtimer_try_to_cancel - try to deactivate a timer | 462 | * hrtimer_try_to_cancel - try to deactivate a timer |
@@ -484,6 +485,7 @@ int hrtimer_try_to_cancel(struct hrtimer *timer) | |||
484 | return ret; | 485 | return ret; |
485 | 486 | ||
486 | } | 487 | } |
488 | EXPORT_SYMBOL_GPL(hrtimer_try_to_cancel); | ||
487 | 489 | ||
488 | /** | 490 | /** |
489 | * hrtimer_cancel - cancel a timer and wait for the handler to finish. | 491 | * hrtimer_cancel - cancel a timer and wait for the handler to finish. |
@@ -504,6 +506,7 @@ int hrtimer_cancel(struct hrtimer *timer) | |||
504 | cpu_relax(); | 506 | cpu_relax(); |
505 | } | 507 | } |
506 | } | 508 | } |
509 | EXPORT_SYMBOL_GPL(hrtimer_cancel); | ||
507 | 510 | ||
508 | /** | 511 | /** |
509 | * hrtimer_get_remaining - get remaining time for the timer | 512 | * hrtimer_get_remaining - get remaining time for the timer |
@@ -522,6 +525,7 @@ ktime_t hrtimer_get_remaining(const struct hrtimer *timer) | |||
522 | 525 | ||
523 | return rem; | 526 | return rem; |
524 | } | 527 | } |
528 | EXPORT_SYMBOL_GPL(hrtimer_get_remaining); | ||
525 | 529 | ||
526 | #ifdef CONFIG_NO_IDLE_HZ | 530 | #ifdef CONFIG_NO_IDLE_HZ |
527 | /** | 531 | /** |
@@ -580,6 +584,7 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, | |||
580 | timer->base = &bases[clock_id]; | 584 | timer->base = &bases[clock_id]; |
581 | timer->node.rb_parent = HRTIMER_INACTIVE; | 585 | timer->node.rb_parent = HRTIMER_INACTIVE; |
582 | } | 586 | } |
587 | EXPORT_SYMBOL_GPL(hrtimer_init); | ||
583 | 588 | ||
584 | /** | 589 | /** |
585 | * hrtimer_get_res - get the timer resolution for a clock | 590 | * hrtimer_get_res - get the timer resolution for a clock |
@@ -599,6 +604,7 @@ int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) | |||
599 | 604 | ||
600 | return 0; | 605 | return 0; |
601 | } | 606 | } |
607 | EXPORT_SYMBOL_GPL(hrtimer_get_res); | ||
602 | 608 | ||
603 | /* | 609 | /* |
604 | * Expire the per base hrtimer-queue: | 610 | * Expire the per base hrtimer-queue: |
diff --git a/kernel/module.c b/kernel/module.c index d24deb0dbbc9..bbe04862e1b0 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -705,14 +705,14 @@ EXPORT_SYMBOL(__symbol_put); | |||
705 | 705 | ||
706 | void symbol_put_addr(void *addr) | 706 | void symbol_put_addr(void *addr) |
707 | { | 707 | { |
708 | unsigned long flags; | 708 | struct module *modaddr; |
709 | 709 | ||
710 | spin_lock_irqsave(&modlist_lock, flags); | 710 | if (core_kernel_text((unsigned long)addr)) |
711 | if (!kernel_text_address((unsigned long)addr)) | 711 | return; |
712 | BUG(); | ||
713 | 712 | ||
714 | module_put(module_text_address((unsigned long)addr)); | 713 | if (!(modaddr = module_text_address((unsigned long)addr))) |
715 | spin_unlock_irqrestore(&modlist_lock, flags); | 714 | BUG(); |
715 | module_put(modaddr); | ||
716 | } | 716 | } |
717 | EXPORT_SYMBOL_GPL(symbol_put_addr); | 717 | EXPORT_SYMBOL_GPL(symbol_put_addr); |
718 | 718 | ||
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index 6d32ff26f948..2058f88c7bbb 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -479,12 +479,31 @@ static int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp) | |||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
481 | 481 | ||
482 | /* | ||
483 | * Check to see if there is any immediate RCU-related work to be done | ||
484 | * by the current CPU, returning 1 if so. This function is part of the | ||
485 | * RCU implementation; it is -not- an exported member of the RCU API. | ||
486 | */ | ||
482 | int rcu_pending(int cpu) | 487 | int rcu_pending(int cpu) |
483 | { | 488 | { |
484 | return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) || | 489 | return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) || |
485 | __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu)); | 490 | __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu)); |
486 | } | 491 | } |
487 | 492 | ||
493 | /* | ||
494 | * Check to see if any future RCU-related work will need to be done | ||
495 | * by the current CPU, even if none need be done immediately, returning | ||
496 | * 1 if so. This function is part of the RCU implementation; it is -not- | ||
497 | * an exported member of the RCU API. | ||
498 | */ | ||
499 | int rcu_needs_cpu(int cpu) | ||
500 | { | ||
501 | struct rcu_data *rdp = &per_cpu(rcu_data, cpu); | ||
502 | struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu); | ||
503 | |||
504 | return (!!rdp->curlist || !!rdp_bh->curlist || rcu_pending(cpu)); | ||
505 | } | ||
506 | |||
488 | void rcu_check_callbacks(int cpu, int user) | 507 | void rcu_check_callbacks(int cpu, int user) |
489 | { | 508 | { |
490 | if (user || | 509 | if (user || |
diff --git a/kernel/sched.c b/kernel/sched.c index 4c64f85698ae..c13f1bd2df7d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -665,55 +665,13 @@ static int effective_prio(task_t *p) | |||
665 | } | 665 | } |
666 | 666 | ||
667 | /* | 667 | /* |
668 | * We place interactive tasks back into the active array, if possible. | ||
669 | * | ||
670 | * To guarantee that this does not starve expired tasks we ignore the | ||
671 | * interactivity of a task if the first expired task had to wait more | ||
672 | * than a 'reasonable' amount of time. This deadline timeout is | ||
673 | * load-dependent, as the frequency of array switched decreases with | ||
674 | * increasing number of running tasks. We also ignore the interactivity | ||
675 | * if a better static_prio task has expired, and switch periodically | ||
676 | * regardless, to ensure that highly interactive tasks do not starve | ||
677 | * the less fortunate for unreasonably long periods. | ||
678 | */ | ||
679 | static inline int expired_starving(runqueue_t *rq) | ||
680 | { | ||
681 | int limit; | ||
682 | |||
683 | /* | ||
684 | * Arrays were recently switched, all is well | ||
685 | */ | ||
686 | if (!rq->expired_timestamp) | ||
687 | return 0; | ||
688 | |||
689 | limit = STARVATION_LIMIT * rq->nr_running; | ||
690 | |||
691 | /* | ||
692 | * It's time to switch arrays | ||
693 | */ | ||
694 | if (jiffies - rq->expired_timestamp >= limit) | ||
695 | return 1; | ||
696 | |||
697 | /* | ||
698 | * There's a better selection in the expired array | ||
699 | */ | ||
700 | if (rq->curr->static_prio > rq->best_expired_prio) | ||
701 | return 1; | ||
702 | |||
703 | /* | ||
704 | * All is well | ||
705 | */ | ||
706 | return 0; | ||
707 | } | ||
708 | |||
709 | /* | ||
710 | * __activate_task - move a task to the runqueue. | 668 | * __activate_task - move a task to the runqueue. |
711 | */ | 669 | */ |
712 | static void __activate_task(task_t *p, runqueue_t *rq) | 670 | static void __activate_task(task_t *p, runqueue_t *rq) |
713 | { | 671 | { |
714 | prio_array_t *target = rq->active; | 672 | prio_array_t *target = rq->active; |
715 | 673 | ||
716 | if (unlikely(batch_task(p) || (expired_starving(rq) && !rt_task(p)))) | 674 | if (batch_task(p)) |
717 | target = rq->expired; | 675 | target = rq->expired; |
718 | enqueue_task(p, target); | 676 | enqueue_task(p, target); |
719 | rq->nr_running++; | 677 | rq->nr_running++; |
@@ -2532,6 +2490,22 @@ unsigned long long current_sched_time(const task_t *tsk) | |||
2532 | } | 2490 | } |
2533 | 2491 | ||
2534 | /* | 2492 | /* |
2493 | * We place interactive tasks back into the active array, if possible. | ||
2494 | * | ||
2495 | * To guarantee that this does not starve expired tasks we ignore the | ||
2496 | * interactivity of a task if the first expired task had to wait more | ||
2497 | * than a 'reasonable' amount of time. This deadline timeout is | ||
2498 | * load-dependent, as the frequency of array switched decreases with | ||
2499 | * increasing number of running tasks. We also ignore the interactivity | ||
2500 | * if a better static_prio task has expired: | ||
2501 | */ | ||
2502 | #define EXPIRED_STARVING(rq) \ | ||
2503 | ((STARVATION_LIMIT && ((rq)->expired_timestamp && \ | ||
2504 | (jiffies - (rq)->expired_timestamp >= \ | ||
2505 | STARVATION_LIMIT * ((rq)->nr_running) + 1))) || \ | ||
2506 | ((rq)->curr->static_prio > (rq)->best_expired_prio)) | ||
2507 | |||
2508 | /* | ||
2535 | * Account user cpu time to a process. | 2509 | * Account user cpu time to a process. |
2536 | * @p: the process that the cpu time gets accounted to | 2510 | * @p: the process that the cpu time gets accounted to |
2537 | * @hardirq_offset: the offset to subtract from hardirq_count() | 2511 | * @hardirq_offset: the offset to subtract from hardirq_count() |
@@ -2666,7 +2640,7 @@ void scheduler_tick(void) | |||
2666 | 2640 | ||
2667 | if (!rq->expired_timestamp) | 2641 | if (!rq->expired_timestamp) |
2668 | rq->expired_timestamp = jiffies; | 2642 | rq->expired_timestamp = jiffies; |
2669 | if (!TASK_INTERACTIVE(p) || expired_starving(rq)) { | 2643 | if (!TASK_INTERACTIVE(p) || EXPIRED_STARVING(rq)) { |
2670 | enqueue_task(p, rq->expired); | 2644 | enqueue_task(p, rq->expired); |
2671 | if (p->static_prio < rq->best_expired_prio) | 2645 | if (p->static_prio < rq->best_expired_prio) |
2672 | rq->best_expired_prio = p->static_prio; | 2646 | rq->best_expired_prio = p->static_prio; |
diff --git a/kernel/timer.c b/kernel/timer.c index 67eaf0f54096..9e49deed468c 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -541,6 +541,22 @@ found: | |||
541 | } | 541 | } |
542 | spin_unlock(&base->lock); | 542 | spin_unlock(&base->lock); |
543 | 543 | ||
544 | /* | ||
545 | * It can happen that other CPUs service timer IRQs and increment | ||
546 | * jiffies, but we have not yet got a local timer tick to process | ||
547 | * the timer wheels. In that case, the expiry time can be before | ||
548 | * jiffies, but since the high-resolution timer here is relative to | ||
549 | * jiffies, the default expression when high-resolution timers are | ||
550 | * not active, | ||
551 | * | ||
552 | * time_before(MAX_JIFFY_OFFSET + jiffies, expires) | ||
553 | * | ||
554 | * would falsely evaluate to true. If that is the case, just | ||
555 | * return jiffies so that we can immediately fire the local timer | ||
556 | */ | ||
557 | if (time_before(expires, jiffies)) | ||
558 | return jiffies; | ||
559 | |||
544 | if (time_before(hr_expires, expires)) | 560 | if (time_before(hr_expires, expires)) |
545 | return hr_expires; | 561 | return hr_expires; |
546 | 562 | ||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 6ecc180beb71..ccb0c1fdf1b5 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -189,7 +189,7 @@ config FRAME_POINTER | |||
189 | config UNWIND_INFO | 189 | config UNWIND_INFO |
190 | bool "Compile the kernel with frame unwind information" | 190 | bool "Compile the kernel with frame unwind information" |
191 | depends on !IA64 | 191 | depends on !IA64 |
192 | depends on !MODULES || !(MIPS || PARISC || PPC || SUPERH || SPARC64 || V850) | 192 | depends on !MODULES || !(MIPS || PARISC || PPC || SUPERH || V850) |
193 | help | 193 | help |
194 | If you say Y here the resulting kernel image will be slightly larger | 194 | If you say Y here the resulting kernel image will be slightly larger |
195 | but not slower, and it will give very useful debugging information. | 195 | but not slower, and it will give very useful debugging information. |
diff --git a/lib/kobject.c b/lib/kobject.c index b46350c27837..687ab418d292 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -198,14 +198,14 @@ int kobject_add(struct kobject * kobj) | |||
198 | 198 | ||
199 | /* be noisy on error issues */ | 199 | /* be noisy on error issues */ |
200 | if (error == -EEXIST) | 200 | if (error == -EEXIST) |
201 | printk("kobject_add failed for %s with -EEXIST, " | 201 | pr_debug("kobject_add failed for %s with -EEXIST, " |
202 | "don't try to register things with the " | 202 | "don't try to register things with the " |
203 | "same name in the same directory.\n", | 203 | "same name in the same directory.\n", |
204 | kobject_name(kobj)); | 204 | kobject_name(kobj)); |
205 | else | 205 | else |
206 | printk("kobject_add failed for %s (%d)\n", | 206 | pr_debug("kobject_add failed for %s (%d)\n", |
207 | kobject_name(kobj), error); | 207 | kobject_name(kobj), error); |
208 | dump_stack(); | 208 | /* dump_stack(); */ |
209 | } | 209 | } |
210 | 210 | ||
211 | return error; | 211 | return error; |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 1ae2b2cc3a54..70df5c0d957e 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -91,8 +91,8 @@ static void grow_zone_span(struct zone *zone, | |||
91 | if (start_pfn < zone->zone_start_pfn) | 91 | if (start_pfn < zone->zone_start_pfn) |
92 | zone->zone_start_pfn = start_pfn; | 92 | zone->zone_start_pfn = start_pfn; |
93 | 93 | ||
94 | if (end_pfn > old_zone_end_pfn) | 94 | zone->spanned_pages = max(old_zone_end_pfn, end_pfn) - |
95 | zone->spanned_pages = end_pfn - zone->zone_start_pfn; | 95 | zone->zone_start_pfn; |
96 | 96 | ||
97 | zone_span_writeunlock(zone); | 97 | zone_span_writeunlock(zone); |
98 | } | 98 | } |
@@ -106,8 +106,8 @@ static void grow_pgdat_span(struct pglist_data *pgdat, | |||
106 | if (start_pfn < pgdat->node_start_pfn) | 106 | if (start_pfn < pgdat->node_start_pfn) |
107 | pgdat->node_start_pfn = start_pfn; | 107 | pgdat->node_start_pfn = start_pfn; |
108 | 108 | ||
109 | if (end_pfn > old_pgdat_end_pfn) | 109 | pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) - |
110 | pgdat->node_spanned_pages = end_pfn - pgdat->node_start_pfn; | 110 | pgdat->node_start_pfn; |
111 | } | 111 | } |
112 | 112 | ||
113 | int online_pages(unsigned long pfn, unsigned long nr_pages) | 113 | int online_pages(unsigned long pfn, unsigned long nr_pages) |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ea77c999047e..253a450c400d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/mempolicy.h> | 39 | #include <linux/mempolicy.h> |
40 | 40 | ||
41 | #include <asm/tlbflush.h> | 41 | #include <asm/tlbflush.h> |
42 | #include <asm/div64.h> | ||
42 | #include "internal.h" | 43 | #include "internal.h" |
43 | 44 | ||
44 | /* | 45 | /* |
@@ -950,7 +951,7 @@ restart: | |||
950 | goto got_pg; | 951 | goto got_pg; |
951 | 952 | ||
952 | do { | 953 | do { |
953 | if (cpuset_zone_allowed(*z, gfp_mask)) | 954 | if (cpuset_zone_allowed(*z, gfp_mask|__GFP_HARDWALL)) |
954 | wakeup_kswapd(*z, order); | 955 | wakeup_kswapd(*z, order); |
955 | } while (*(++z)); | 956 | } while (*(++z)); |
956 | 957 | ||
@@ -969,7 +970,8 @@ restart: | |||
969 | alloc_flags |= ALLOC_HARDER; | 970 | alloc_flags |= ALLOC_HARDER; |
970 | if (gfp_mask & __GFP_HIGH) | 971 | if (gfp_mask & __GFP_HIGH) |
971 | alloc_flags |= ALLOC_HIGH; | 972 | alloc_flags |= ALLOC_HIGH; |
972 | alloc_flags |= ALLOC_CPUSET; | 973 | if (wait) |
974 | alloc_flags |= ALLOC_CPUSET; | ||
973 | 975 | ||
974 | /* | 976 | /* |
975 | * Go through the zonelist again. Let __GFP_HIGH and allocations | 977 | * Go through the zonelist again. Let __GFP_HIGH and allocations |
@@ -2123,14 +2125,22 @@ static void __init alloc_node_mem_map(struct pglist_data *pgdat) | |||
2123 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | 2125 | #ifdef CONFIG_FLAT_NODE_MEM_MAP |
2124 | /* ia64 gets its own node_mem_map, before this, without bootmem */ | 2126 | /* ia64 gets its own node_mem_map, before this, without bootmem */ |
2125 | if (!pgdat->node_mem_map) { | 2127 | if (!pgdat->node_mem_map) { |
2126 | unsigned long size; | 2128 | unsigned long size, start, end; |
2127 | struct page *map; | 2129 | struct page *map; |
2128 | 2130 | ||
2129 | size = (pgdat->node_spanned_pages + 1) * sizeof(struct page); | 2131 | /* |
2132 | * The zone's endpoints aren't required to be MAX_ORDER | ||
2133 | * aligned but the node_mem_map endpoints must be in order | ||
2134 | * for the buddy allocator to function correctly. | ||
2135 | */ | ||
2136 | start = pgdat->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1); | ||
2137 | end = pgdat->node_start_pfn + pgdat->node_spanned_pages; | ||
2138 | end = ALIGN(end, MAX_ORDER_NR_PAGES); | ||
2139 | size = (end - start) * sizeof(struct page); | ||
2130 | map = alloc_remap(pgdat->node_id, size); | 2140 | map = alloc_remap(pgdat->node_id, size); |
2131 | if (!map) | 2141 | if (!map) |
2132 | map = alloc_bootmem_node(pgdat, size); | 2142 | map = alloc_bootmem_node(pgdat, size); |
2133 | pgdat->node_mem_map = map; | 2143 | pgdat->node_mem_map = map + (pgdat->node_start_pfn - start); |
2134 | } | 2144 | } |
2135 | #ifdef CONFIG_FLATMEM | 2145 | #ifdef CONFIG_FLATMEM |
2136 | /* | 2146 | /* |
@@ -2566,9 +2576,11 @@ void setup_per_zone_pages_min(void) | |||
2566 | } | 2576 | } |
2567 | 2577 | ||
2568 | for_each_zone(zone) { | 2578 | for_each_zone(zone) { |
2569 | unsigned long tmp; | 2579 | u64 tmp; |
2580 | |||
2570 | spin_lock_irqsave(&zone->lru_lock, flags); | 2581 | spin_lock_irqsave(&zone->lru_lock, flags); |
2571 | tmp = (pages_min * zone->present_pages) / lowmem_pages; | 2582 | tmp = (u64)pages_min * zone->present_pages; |
2583 | do_div(tmp, lowmem_pages); | ||
2572 | if (is_highmem(zone)) { | 2584 | if (is_highmem(zone)) { |
2573 | /* | 2585 | /* |
2574 | * __GFP_HIGH and PF_MEMALLOC allocations usually don't | 2586 | * __GFP_HIGH and PF_MEMALLOC allocations usually don't |
@@ -2595,8 +2607,8 @@ void setup_per_zone_pages_min(void) | |||
2595 | zone->pages_min = tmp; | 2607 | zone->pages_min = tmp; |
2596 | } | 2608 | } |
2597 | 2609 | ||
2598 | zone->pages_low = zone->pages_min + tmp / 4; | 2610 | zone->pages_low = zone->pages_min + (tmp >> 2); |
2599 | zone->pages_high = zone->pages_min + tmp / 2; | 2611 | zone->pages_high = zone->pages_min + (tmp >> 1); |
2600 | spin_unlock_irqrestore(&zone->lru_lock, flags); | 2612 | spin_unlock_irqrestore(&zone->lru_lock, flags); |
2601 | } | 2613 | } |
2602 | 2614 | ||
diff --git a/mm/shmem.c b/mm/shmem.c index 4c5e68e4e9ae..1e43c8a865ba 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1780,6 +1780,7 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry) | |||
1780 | if (!simple_empty(dentry)) | 1780 | if (!simple_empty(dentry)) |
1781 | return -ENOTEMPTY; | 1781 | return -ENOTEMPTY; |
1782 | 1782 | ||
1783 | dentry->d_inode->i_nlink--; | ||
1783 | dir->i_nlink--; | 1784 | dir->i_nlink--; |
1784 | return shmem_unlink(dir, dentry); | 1785 | return shmem_unlink(dir, dentry); |
1785 | } | 1786 | } |
@@ -2102,6 +2103,7 @@ static int shmem_fill_super(struct super_block *sb, | |||
2102 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; | 2103 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
2103 | sb->s_magic = TMPFS_MAGIC; | 2104 | sb->s_magic = TMPFS_MAGIC; |
2104 | sb->s_op = &shmem_ops; | 2105 | sb->s_op = &shmem_ops; |
2106 | sb->s_time_gran = 1; | ||
2105 | 2107 | ||
2106 | inode = shmem_get_inode(sb, S_IFDIR | mode, 0); | 2108 | inode = shmem_get_inode(sb, S_IFDIR | mode, 0); |
2107 | if (!inode) | 2109 | if (!inode) |
@@ -207,11 +207,6 @@ typedef unsigned int kmem_bufctl_t; | |||
207 | #define BUFCTL_ACTIVE (((kmem_bufctl_t)(~0U))-2) | 207 | #define BUFCTL_ACTIVE (((kmem_bufctl_t)(~0U))-2) |
208 | #define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-3) | 208 | #define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-3) |
209 | 209 | ||
210 | /* Max number of objs-per-slab for caches which use off-slab slabs. | ||
211 | * Needed to avoid a possible looping condition in cache_grow(). | ||
212 | */ | ||
213 | static unsigned long offslab_limit; | ||
214 | |||
215 | /* | 210 | /* |
216 | * struct slab | 211 | * struct slab |
217 | * | 212 | * |
@@ -700,6 +695,14 @@ static enum { | |||
700 | FULL | 695 | FULL |
701 | } g_cpucache_up; | 696 | } g_cpucache_up; |
702 | 697 | ||
698 | /* | ||
699 | * used by boot code to determine if it can use slab based allocator | ||
700 | */ | ||
701 | int slab_is_available(void) | ||
702 | { | ||
703 | return g_cpucache_up == FULL; | ||
704 | } | ||
705 | |||
703 | static DEFINE_PER_CPU(struct work_struct, reap_work); | 706 | static DEFINE_PER_CPU(struct work_struct, reap_work); |
704 | 707 | ||
705 | static void free_block(struct kmem_cache *cachep, void **objpp, int len, | 708 | static void free_block(struct kmem_cache *cachep, void **objpp, int len, |
@@ -1348,12 +1351,6 @@ void __init kmem_cache_init(void) | |||
1348 | NULL, NULL); | 1351 | NULL, NULL); |
1349 | } | 1352 | } |
1350 | 1353 | ||
1351 | /* Inc off-slab bufctl limit until the ceiling is hit. */ | ||
1352 | if (!(OFF_SLAB(sizes->cs_cachep))) { | ||
1353 | offslab_limit = sizes->cs_size - sizeof(struct slab); | ||
1354 | offslab_limit /= sizeof(kmem_bufctl_t); | ||
1355 | } | ||
1356 | |||
1357 | sizes->cs_dmacachep = kmem_cache_create(names->name_dma, | 1354 | sizes->cs_dmacachep = kmem_cache_create(names->name_dma, |
1358 | sizes->cs_size, | 1355 | sizes->cs_size, |
1359 | ARCH_KMALLOC_MINALIGN, | 1356 | ARCH_KMALLOC_MINALIGN, |
@@ -1772,6 +1769,7 @@ static void set_up_list3s(struct kmem_cache *cachep, int index) | |||
1772 | static size_t calculate_slab_order(struct kmem_cache *cachep, | 1769 | static size_t calculate_slab_order(struct kmem_cache *cachep, |
1773 | size_t size, size_t align, unsigned long flags) | 1770 | size_t size, size_t align, unsigned long flags) |
1774 | { | 1771 | { |
1772 | unsigned long offslab_limit; | ||
1775 | size_t left_over = 0; | 1773 | size_t left_over = 0; |
1776 | int gfporder; | 1774 | int gfporder; |
1777 | 1775 | ||
@@ -1783,9 +1781,18 @@ static size_t calculate_slab_order(struct kmem_cache *cachep, | |||
1783 | if (!num) | 1781 | if (!num) |
1784 | continue; | 1782 | continue; |
1785 | 1783 | ||
1786 | /* More than offslab_limit objects will cause problems */ | 1784 | if (flags & CFLGS_OFF_SLAB) { |
1787 | if ((flags & CFLGS_OFF_SLAB) && num > offslab_limit) | 1785 | /* |
1788 | break; | 1786 | * Max number of objs-per-slab for caches which |
1787 | * use off-slab slabs. Needed to avoid a possible | ||
1788 | * looping condition in cache_grow(). | ||
1789 | */ | ||
1790 | offslab_limit = size - sizeof(struct slab); | ||
1791 | offslab_limit /= sizeof(kmem_bufctl_t); | ||
1792 | |||
1793 | if (num > offslab_limit) | ||
1794 | break; | ||
1795 | } | ||
1789 | 1796 | ||
1790 | /* Found something acceptable - save it away */ | 1797 | /* Found something acceptable - save it away */ |
1791 | cachep->num = num; | 1798 | cachep->num = num; |
@@ -2192,11 +2199,14 @@ static void drain_cpu_caches(struct kmem_cache *cachep) | |||
2192 | check_irq_on(); | 2199 | check_irq_on(); |
2193 | for_each_online_node(node) { | 2200 | for_each_online_node(node) { |
2194 | l3 = cachep->nodelists[node]; | 2201 | l3 = cachep->nodelists[node]; |
2195 | if (l3) { | 2202 | if (l3 && l3->alien) |
2203 | drain_alien_cache(cachep, l3->alien); | ||
2204 | } | ||
2205 | |||
2206 | for_each_online_node(node) { | ||
2207 | l3 = cachep->nodelists[node]; | ||
2208 | if (l3) | ||
2196 | drain_array(cachep, l3, l3->shared, 1, node); | 2209 | drain_array(cachep, l3, l3->shared, 1, node); |
2197 | if (l3->alien) | ||
2198 | drain_alien_cache(cachep, l3->alien); | ||
2199 | } | ||
2200 | } | 2210 | } |
2201 | } | 2211 | } |
2202 | 2212 | ||
diff --git a/mm/sparse.c b/mm/sparse.c index d7c32de99ee8..100040c0dfb6 100644 --- a/mm/sparse.c +++ b/mm/sparse.c | |||
@@ -32,7 +32,7 @@ static struct mem_section *sparse_index_alloc(int nid) | |||
32 | unsigned long array_size = SECTIONS_PER_ROOT * | 32 | unsigned long array_size = SECTIONS_PER_ROOT * |
33 | sizeof(struct mem_section); | 33 | sizeof(struct mem_section); |
34 | 34 | ||
35 | if (system_state == SYSTEM_RUNNING) | 35 | if (slab_is_available()) |
36 | section = kmalloc_node(array_size, GFP_KERNEL, nid); | 36 | section = kmalloc_node(array_size, GFP_KERNEL, nid); |
37 | else | 37 | else |
38 | section = alloc_bootmem_node(NODE_DATA(nid), array_size); | 38 | section = alloc_bootmem_node(NODE_DATA(nid), array_size); |
@@ -87,11 +87,8 @@ int __section_nr(struct mem_section* ms) | |||
87 | unsigned long root_nr; | 87 | unsigned long root_nr; |
88 | struct mem_section* root; | 88 | struct mem_section* root; |
89 | 89 | ||
90 | for (root_nr = 0; | 90 | for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) { |
91 | root_nr < NR_MEM_SECTIONS; | 91 | root = __nr_to_section(root_nr * SECTIONS_PER_ROOT); |
92 | root_nr += SECTIONS_PER_ROOT) { | ||
93 | root = __nr_to_section(root_nr); | ||
94 | |||
95 | if (!root) | 92 | if (!root) |
96 | continue; | 93 | continue; |
97 | 94 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 4649a63a8cb6..440a733fe2e9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1061,7 +1061,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, unsigned long nr_pages, | |||
1061 | loop_again: | 1061 | loop_again: |
1062 | total_scanned = 0; | 1062 | total_scanned = 0; |
1063 | nr_reclaimed = 0; | 1063 | nr_reclaimed = 0; |
1064 | sc.may_writepage = !laptop_mode, | 1064 | sc.may_writepage = !laptop_mode; |
1065 | sc.nr_mapped = read_page_state(nr_mapped); | 1065 | sc.nr_mapped = read_page_state(nr_mapped); |
1066 | 1066 | ||
1067 | inc_page_state(pageoutrun); | 1067 | inc_page_state(pageoutrun); |
diff --git a/net/802/tr.c b/net/802/tr.c index afd8385c0c9c..e9dc803f2fe0 100644 --- a/net/802/tr.c +++ b/net/802/tr.c | |||
@@ -643,6 +643,5 @@ static int __init rif_init(void) | |||
643 | 643 | ||
644 | module_init(rif_init); | 644 | module_init(rif_init); |
645 | 645 | ||
646 | EXPORT_SYMBOL(tr_source_route); | ||
647 | EXPORT_SYMBOL(tr_type_trans); | 646 | EXPORT_SYMBOL(tr_type_trans); |
648 | EXPORT_SYMBOL(alloc_trdev); | 647 | EXPORT_SYMBOL(alloc_trdev); |
diff --git a/net/atm/clip.c b/net/atm/clip.c index 1a786bfaa416..72d852982664 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -963,7 +963,7 @@ static struct file_operations arp_seq_fops = { | |||
963 | static int __init atm_clip_init(void) | 963 | static int __init atm_clip_init(void) |
964 | { | 964 | { |
965 | struct proc_dir_entry *p; | 965 | struct proc_dir_entry *p; |
966 | neigh_table_init(&clip_tbl); | 966 | neigh_table_init_no_netlink(&clip_tbl); |
967 | 967 | ||
968 | clip_tbl_hook = &clip_tbl; | 968 | clip_tbl_hook = &clip_tbl; |
969 | register_atm_ioctl(&clip_ioctl_ops); | 969 | register_atm_ioctl(&clip_ioctl_ops); |
diff --git a/net/bridge/br.c b/net/bridge/br.c index 22d806cf40ca..12da21afb9ca 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c | |||
@@ -55,7 +55,7 @@ static int __init br_init(void) | |||
55 | 55 | ||
56 | static void __exit br_deinit(void) | 56 | static void __exit br_deinit(void) |
57 | { | 57 | { |
58 | llc_sap_close(br_stp_sap); | 58 | rcu_assign_pointer(br_stp_sap->rcv_func, NULL); |
59 | 59 | ||
60 | #ifdef CONFIG_BRIDGE_NETFILTER | 60 | #ifdef CONFIG_BRIDGE_NETFILTER |
61 | br_netfilter_fini(); | 61 | br_netfilter_fini(); |
@@ -67,6 +67,7 @@ static void __exit br_deinit(void) | |||
67 | 67 | ||
68 | synchronize_net(); | 68 | synchronize_net(); |
69 | 69 | ||
70 | llc_sap_put(br_stp_sap); | ||
70 | br_fdb_get_hook = NULL; | 71 | br_fdb_get_hook = NULL; |
71 | br_fdb_put_hook = NULL; | 72 | br_fdb_put_hook = NULL; |
72 | 73 | ||
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index ad1c7af65ec8..f5d47bf4f967 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -300,25 +300,20 @@ int br_add_bridge(const char *name) | |||
300 | rtnl_lock(); | 300 | rtnl_lock(); |
301 | if (strchr(dev->name, '%')) { | 301 | if (strchr(dev->name, '%')) { |
302 | ret = dev_alloc_name(dev, dev->name); | 302 | ret = dev_alloc_name(dev, dev->name); |
303 | if (ret < 0) | 303 | if (ret < 0) { |
304 | goto err1; | 304 | free_netdev(dev); |
305 | goto out; | ||
306 | } | ||
305 | } | 307 | } |
306 | 308 | ||
307 | ret = register_netdevice(dev); | 309 | ret = register_netdevice(dev); |
308 | if (ret) | 310 | if (ret) |
309 | goto err2; | 311 | goto out; |
310 | 312 | ||
311 | ret = br_sysfs_addbr(dev); | 313 | ret = br_sysfs_addbr(dev); |
312 | if (ret) | 314 | if (ret) |
313 | goto err3; | 315 | unregister_netdevice(dev); |
314 | rtnl_unlock(); | 316 | out: |
315 | return 0; | ||
316 | |||
317 | err3: | ||
318 | unregister_netdev(dev); | ||
319 | err2: | ||
320 | free_netdev(dev); | ||
321 | err1: | ||
322 | rtnl_unlock(); | 317 | rtnl_unlock(); |
323 | return ret; | 318 | return ret; |
324 | } | 319 | } |
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index d159c92cca84..466ed3440b74 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c | |||
@@ -168,7 +168,7 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr, | |||
168 | 168 | ||
169 | if (info->bitmask & EBT_LOG_NFLOG) | 169 | if (info->bitmask & EBT_LOG_NFLOG) |
170 | nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, | 170 | nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, |
171 | info->prefix); | 171 | "%s", info->prefix); |
172 | else | 172 | else |
173 | ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, | 173 | ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, |
174 | info->prefix); | 174 | info->prefix); |
diff --git a/net/core/dev.c b/net/core/dev.c index 2dce673a039b..4fba549caf29 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -127,7 +127,7 @@ | |||
127 | * sure which should go first, but I bet it won't make much | 127 | * sure which should go first, but I bet it won't make much |
128 | * difference if we are running VLANs. The good news is that | 128 | * difference if we are running VLANs. The good news is that |
129 | * this protocol won't be in the list unless compiled in, so | 129 | * this protocol won't be in the list unless compiled in, so |
130 | * the average user (w/out VLANs) will not be adversly affected. | 130 | * the average user (w/out VLANs) will not be adversely affected. |
131 | * --BLG | 131 | * --BLG |
132 | * | 132 | * |
133 | * 0800 IP | 133 | * 0800 IP |
@@ -149,7 +149,7 @@ static struct list_head ptype_base[16]; /* 16 way hashed list */ | |||
149 | static struct list_head ptype_all; /* Taps */ | 149 | static struct list_head ptype_all; /* Taps */ |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * The @dev_base list is protected by @dev_base_lock and the rtln | 152 | * The @dev_base list is protected by @dev_base_lock and the rtnl |
153 | * semaphore. | 153 | * semaphore. |
154 | * | 154 | * |
155 | * Pure readers hold dev_base_lock for reading. | 155 | * Pure readers hold dev_base_lock for reading. |
@@ -641,10 +641,12 @@ int dev_valid_name(const char *name) | |||
641 | * @name: name format string | 641 | * @name: name format string |
642 | * | 642 | * |
643 | * Passed a format string - eg "lt%d" it will try and find a suitable | 643 | * Passed a format string - eg "lt%d" it will try and find a suitable |
644 | * id. Not efficient for many devices, not called a lot. The caller | 644 | * id. It scans list of devices to build up a free map, then chooses |
645 | * must hold the dev_base or rtnl lock while allocating the name and | 645 | * the first empty slot. The caller must hold the dev_base or rtnl lock |
646 | * adding the device in order to avoid duplicates. Returns the number | 646 | * while allocating the name and adding the device in order to avoid |
647 | * of the unit assigned or a negative errno code. | 647 | * duplicates. |
648 | * Limited to bits_per_byte * page size devices (ie 32K on most platforms). | ||
649 | * Returns the number of the unit assigned or a negative errno code. | ||
648 | */ | 650 | */ |
649 | 651 | ||
650 | int dev_alloc_name(struct net_device *dev, const char *name) | 652 | int dev_alloc_name(struct net_device *dev, const char *name) |
@@ -744,7 +746,7 @@ int dev_change_name(struct net_device *dev, char *newname) | |||
744 | } | 746 | } |
745 | 747 | ||
746 | /** | 748 | /** |
747 | * netdev_features_change - device changes fatures | 749 | * netdev_features_change - device changes features |
748 | * @dev: device to cause notification | 750 | * @dev: device to cause notification |
749 | * | 751 | * |
750 | * Called to indicate a device has changed features. | 752 | * Called to indicate a device has changed features. |
@@ -2196,7 +2198,7 @@ int netdev_set_master(struct net_device *slave, struct net_device *master) | |||
2196 | * @dev: device | 2198 | * @dev: device |
2197 | * @inc: modifier | 2199 | * @inc: modifier |
2198 | * | 2200 | * |
2199 | * Add or remove promsicuity from a device. While the count in the device | 2201 | * Add or remove promiscuity from a device. While the count in the device |
2200 | * remains above zero the interface remains promiscuous. Once it hits zero | 2202 | * remains above zero the interface remains promiscuous. Once it hits zero |
2201 | * the device reverts back to normal filtering operation. A negative inc | 2203 | * the device reverts back to normal filtering operation. A negative inc |
2202 | * value is used to drop promiscuity on the device. | 2204 | * value is used to drop promiscuity on the device. |
@@ -3122,7 +3124,7 @@ EXPORT_SYMBOL(alloc_netdev); | |||
3122 | void free_netdev(struct net_device *dev) | 3124 | void free_netdev(struct net_device *dev) |
3123 | { | 3125 | { |
3124 | #ifdef CONFIG_SYSFS | 3126 | #ifdef CONFIG_SYSFS |
3125 | /* Compatiablity with error handling in drivers */ | 3127 | /* Compatibility with error handling in drivers */ |
3126 | if (dev->reg_state == NETREG_UNINITIALIZED) { | 3128 | if (dev->reg_state == NETREG_UNINITIALIZED) { |
3127 | kfree((char *)dev - dev->padded); | 3129 | kfree((char *)dev - dev->padded); |
3128 | return; | 3130 | return; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 4cf878efdb49..50a8c73caf97 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1326,8 +1326,7 @@ void neigh_parms_destroy(struct neigh_parms *parms) | |||
1326 | kfree(parms); | 1326 | kfree(parms); |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | 1329 | void neigh_table_init_no_netlink(struct neigh_table *tbl) | |
1330 | void neigh_table_init(struct neigh_table *tbl) | ||
1331 | { | 1330 | { |
1332 | unsigned long now = jiffies; | 1331 | unsigned long now = jiffies; |
1333 | unsigned long phsize; | 1332 | unsigned long phsize; |
@@ -1383,10 +1382,27 @@ void neigh_table_init(struct neigh_table *tbl) | |||
1383 | 1382 | ||
1384 | tbl->last_flush = now; | 1383 | tbl->last_flush = now; |
1385 | tbl->last_rand = now + tbl->parms.reachable_time * 20; | 1384 | tbl->last_rand = now + tbl->parms.reachable_time * 20; |
1385 | } | ||
1386 | |||
1387 | void neigh_table_init(struct neigh_table *tbl) | ||
1388 | { | ||
1389 | struct neigh_table *tmp; | ||
1390 | |||
1391 | neigh_table_init_no_netlink(tbl); | ||
1386 | write_lock(&neigh_tbl_lock); | 1392 | write_lock(&neigh_tbl_lock); |
1393 | for (tmp = neigh_tables; tmp; tmp = tmp->next) { | ||
1394 | if (tmp->family == tbl->family) | ||
1395 | break; | ||
1396 | } | ||
1387 | tbl->next = neigh_tables; | 1397 | tbl->next = neigh_tables; |
1388 | neigh_tables = tbl; | 1398 | neigh_tables = tbl; |
1389 | write_unlock(&neigh_tbl_lock); | 1399 | write_unlock(&neigh_tbl_lock); |
1400 | |||
1401 | if (unlikely(tmp)) { | ||
1402 | printk(KERN_ERR "NEIGH: Registering multiple tables for " | ||
1403 | "family %d\n", tbl->family); | ||
1404 | dump_stack(); | ||
1405 | } | ||
1390 | } | 1406 | } |
1391 | 1407 | ||
1392 | int neigh_table_clear(struct neigh_table *tbl) | 1408 | int neigh_table_clear(struct neigh_table *tbl) |
@@ -2657,6 +2673,7 @@ EXPORT_SYMBOL(neigh_rand_reach_time); | |||
2657 | EXPORT_SYMBOL(neigh_resolve_output); | 2673 | EXPORT_SYMBOL(neigh_resolve_output); |
2658 | EXPORT_SYMBOL(neigh_table_clear); | 2674 | EXPORT_SYMBOL(neigh_table_clear); |
2659 | EXPORT_SYMBOL(neigh_table_init); | 2675 | EXPORT_SYMBOL(neigh_table_init); |
2676 | EXPORT_SYMBOL(neigh_table_init_no_netlink); | ||
2660 | EXPORT_SYMBOL(neigh_update); | 2677 | EXPORT_SYMBOL(neigh_update); |
2661 | EXPORT_SYMBOL(neigh_update_hhs); | 2678 | EXPORT_SYMBOL(neigh_update_hhs); |
2662 | EXPORT_SYMBOL(pneigh_enqueue); | 2679 | EXPORT_SYMBOL(pneigh_enqueue); |
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index b5981e5f6b00..8c211c58893b 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c | |||
@@ -452,6 +452,7 @@ found: | |||
452 | (unsigned long long) | 452 | (unsigned long long) |
453 | avr->dccpavr_ack_ackno); | 453 | avr->dccpavr_ack_ackno); |
454 | dccp_ackvec_throw_record(av, avr); | 454 | dccp_ackvec_throw_record(av, avr); |
455 | break; | ||
455 | } | 456 | } |
456 | /* | 457 | /* |
457 | * If it wasn't received, continue scanning... we might | 458 | * If it wasn't received, continue scanning... we might |
diff --git a/net/ethernet/Makefile b/net/ethernet/Makefile index 69b74a9a0fc3..7cef1d8ace27 100644 --- a/net/ethernet/Makefile +++ b/net/ethernet/Makefile | |||
@@ -3,6 +3,5 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += eth.o | 5 | obj-y += eth.o |
6 | obj-$(CONFIG_SYSCTL) += sysctl_net_ether.o | ||
7 | obj-$(subst m,y,$(CONFIG_IPX)) += pe2.o | 6 | obj-$(subst m,y,$(CONFIG_IPX)) += pe2.o |
8 | obj-$(subst m,y,$(CONFIG_ATALK)) += pe2.o | 7 | obj-$(subst m,y,$(CONFIG_ATALK)) += pe2.o |
diff --git a/net/ethernet/sysctl_net_ether.c b/net/ethernet/sysctl_net_ether.c deleted file mode 100644 index 66b39fc342d2..000000000000 --- a/net/ethernet/sysctl_net_ether.c +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* -*- linux-c -*- | ||
2 | * sysctl_net_ether.c: sysctl interface to net Ethernet subsystem. | ||
3 | * | ||
4 | * Begun April 1, 1996, Mike Shaver. | ||
5 | * Added /proc/sys/net/ether directory entry (empty =) ). [MS] | ||
6 | */ | ||
7 | |||
8 | #include <linux/mm.h> | ||
9 | #include <linux/sysctl.h> | ||
10 | #include <linux/if_ether.h> | ||
11 | |||
12 | ctl_table ether_table[] = { | ||
13 | {0} | ||
14 | }; | ||
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 0923add122b4..9f0bb529ab70 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
@@ -116,6 +116,7 @@ sr_failed: | |||
116 | 116 | ||
117 | too_many_hops: | 117 | too_many_hops: |
118 | /* Tell the sender its packet died... */ | 118 | /* Tell the sender its packet died... */ |
119 | IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); | ||
119 | icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); | 120 | icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); |
120 | drop: | 121 | drop: |
121 | kfree_skb(skb); | 122 | kfree_skb(skb); |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index cd810f41af1a..95278b22b669 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -210,7 +210,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) | |||
210 | skb->h.icmph->code != ICMP_FRAG_NEEDED) | 210 | skb->h.icmph->code != ICMP_FRAG_NEEDED) |
211 | return; | 211 | return; |
212 | 212 | ||
213 | spi = ntohl(ntohs(ipch->cpi)); | 213 | spi = htonl(ntohs(ipch->cpi)); |
214 | x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, | 214 | x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, |
215 | spi, IPPROTO_COMP, AF_INET); | 215 | spi, IPPROTO_COMP, AF_INET); |
216 | if (!x) | 216 | if (!x) |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index 3d560dec63ab..d4072533da21 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
@@ -170,8 +170,8 @@ config IP_NF_PPTP | |||
170 | Documentation/modules.txt. If unsure, say `N'. | 170 | Documentation/modules.txt. If unsure, say `N'. |
171 | 171 | ||
172 | config IP_NF_H323 | 172 | config IP_NF_H323 |
173 | tristate 'H.323 protocol support' | 173 | tristate 'H.323 protocol support (EXPERIMENTAL)' |
174 | depends on IP_NF_CONNTRACK | 174 | depends on IP_NF_CONNTRACK && EXPERIMENTAL |
175 | help | 175 | help |
176 | H.323 is a VoIP signalling protocol from ITU-T. As one of the most | 176 | H.323 is a VoIP signalling protocol from ITU-T. As one of the most |
177 | important VoIP protocols, it is widely used by voice hardware and | 177 | important VoIP protocols, it is widely used by voice hardware and |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index c2d92f99a2b8..d0d19192026d 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -948,7 +948,7 @@ static int do_add_counters(void __user *user, unsigned int len) | |||
948 | 948 | ||
949 | write_lock_bh(&t->lock); | 949 | write_lock_bh(&t->lock); |
950 | private = t->private; | 950 | private = t->private; |
951 | if (private->number != paddc->num_counters) { | 951 | if (private->number != tmp.num_counters) { |
952 | ret = -EINVAL; | 952 | ret = -EINVAL; |
953 | goto unlock_up_free; | 953 | goto unlock_up_free; |
954 | } | 954 | } |
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index 979a2eac6f00..a297da7bbef5 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c | |||
@@ -1318,6 +1318,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) | |||
1318 | .tuple.dst.u.tcp.port; | 1318 | .tuple.dst.u.tcp.port; |
1319 | sin.sin_addr.s_addr = ct->tuplehash[IP_CT_DIR_ORIGINAL] | 1319 | sin.sin_addr.s_addr = ct->tuplehash[IP_CT_DIR_ORIGINAL] |
1320 | .tuple.dst.ip; | 1320 | .tuple.dst.ip; |
1321 | memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); | ||
1321 | 1322 | ||
1322 | DEBUGP("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n", | 1323 | DEBUGP("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n", |
1323 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); | 1324 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); |
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c b/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c index 355a53a5b6cd..26dfecadb335 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c | |||
@@ -528,14 +528,15 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level) | |||
528 | 528 | ||
529 | /* Decode */ | 529 | /* Decode */ |
530 | if ((err = (Decoders[son->type]) (bs, son, base, | 530 | if ((err = (Decoders[son->type]) (bs, son, base, |
531 | level + 1)) > | 531 | level + 1)) < |
532 | H323_ERROR_STOP) | 532 | H323_ERROR_NONE) |
533 | return err; | 533 | return err; |
534 | 534 | ||
535 | bs->cur = beg + len; | 535 | bs->cur = beg + len; |
536 | bs->bit = 0; | 536 | bs->bit = 0; |
537 | } else if ((err = (Decoders[son->type]) (bs, son, base, | 537 | } else if ((err = (Decoders[son->type]) (bs, son, base, |
538 | level + 1))) | 538 | level + 1)) < |
539 | H323_ERROR_NONE) | ||
539 | return err; | 540 | return err; |
540 | } | 541 | } |
541 | 542 | ||
@@ -554,7 +555,7 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level) | |||
554 | 555 | ||
555 | /* Decode the extension components */ | 556 | /* Decode the extension components */ |
556 | for (opt = 0; opt < bmp2_len; opt++, i++, son++) { | 557 | for (opt = 0; opt < bmp2_len; opt++, i++, son++) { |
557 | if (son->attr & STOP) { | 558 | if (i < f->ub && son->attr & STOP) { |
558 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ", | 559 | PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ", |
559 | son->name); | 560 | son->name); |
560 | return H323_ERROR_STOP; | 561 | return H323_ERROR_STOP; |
@@ -584,8 +585,8 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level) | |||
584 | beg = bs->cur; | 585 | beg = bs->cur; |
585 | 586 | ||
586 | if ((err = (Decoders[son->type]) (bs, son, base, | 587 | if ((err = (Decoders[son->type]) (bs, son, base, |
587 | level + 1)) > | 588 | level + 1)) < |
588 | H323_ERROR_STOP) | 589 | H323_ERROR_NONE) |
589 | return err; | 590 | return err; |
590 | 591 | ||
591 | bs->cur = beg + len; | 592 | bs->cur = beg + len; |
@@ -660,18 +661,20 @@ int decode_seqof(bitstr_t * bs, field_t * f, char *base, int level) | |||
660 | i < | 661 | i < |
661 | effective_count ? | 662 | effective_count ? |
662 | base : NULL, | 663 | base : NULL, |
663 | level + 1)) > | 664 | level + 1)) < |
664 | H323_ERROR_STOP) | 665 | H323_ERROR_NONE) |
665 | return err; | 666 | return err; |
666 | 667 | ||
667 | bs->cur = beg + len; | 668 | bs->cur = beg + len; |
668 | bs->bit = 0; | 669 | bs->bit = 0; |
669 | } else | 670 | } else |
670 | if ((err = (Decoders[son->type]) (bs, son, | 671 | if ((err = (Decoders[son->type]) (bs, son, |
671 | i < effective_count ? | 672 | i < |
672 | base : NULL, | 673 | effective_count ? |
673 | level + 1))) | 674 | base : NULL, |
674 | return err; | 675 | level + 1)) < |
676 | H323_ERROR_NONE) | ||
677 | return err; | ||
675 | 678 | ||
676 | if (base) | 679 | if (base) |
677 | base += son->offset; | 680 | base += son->offset; |
@@ -735,13 +738,14 @@ int decode_choice(bitstr_t * bs, field_t * f, char *base, int level) | |||
735 | } | 738 | } |
736 | beg = bs->cur; | 739 | beg = bs->cur; |
737 | 740 | ||
738 | if ((err = (Decoders[son->type]) (bs, son, base, level + 1)) > | 741 | if ((err = (Decoders[son->type]) (bs, son, base, level + 1)) < |
739 | H323_ERROR_STOP) | 742 | H323_ERROR_NONE) |
740 | return err; | 743 | return err; |
741 | 744 | ||
742 | bs->cur = beg + len; | 745 | bs->cur = beg + len; |
743 | bs->bit = 0; | 746 | bs->bit = 0; |
744 | } else if ((err = (Decoders[son->type]) (bs, son, base, level + 1))) | 747 | } else if ((err = (Decoders[son->type]) (bs, son, base, level + 1)) < |
748 | H323_ERROR_NONE) | ||
745 | return err; | 749 | return err; |
746 | 750 | ||
747 | return H323_ERROR_NONE; | 751 | return H323_ERROR_NONE; |
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c index 7d3ba4302e9e..8ccfe17bb253 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c | |||
@@ -469,8 +469,8 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
469 | DEBUGP("%s but no session\n", pptp_msg_name[msg]); | 469 | DEBUGP("%s but no session\n", pptp_msg_name[msg]); |
470 | break; | 470 | break; |
471 | } | 471 | } |
472 | if (info->sstate != PPTP_CALL_IN_REP | 472 | if (info->cstate != PPTP_CALL_IN_REP |
473 | && info->sstate != PPTP_CALL_IN_CONF) { | 473 | && info->cstate != PPTP_CALL_IN_CONF) { |
474 | DEBUGP("%s but never sent IN_CALL_REPLY\n", | 474 | DEBUGP("%s but never sent IN_CALL_REPLY\n", |
475 | pptp_msg_name[msg]); | 475 | pptp_msg_name[msg]); |
476 | break; | 476 | break; |
diff --git a/net/ipv4/netfilter/ip_nat_proto_gre.c b/net/ipv4/netfilter/ip_nat_proto_gre.c index 6c4899d8046a..96ceabaec402 100644 --- a/net/ipv4/netfilter/ip_nat_proto_gre.c +++ b/net/ipv4/netfilter/ip_nat_proto_gre.c | |||
@@ -49,15 +49,15 @@ gre_in_range(const struct ip_conntrack_tuple *tuple, | |||
49 | const union ip_conntrack_manip_proto *min, | 49 | const union ip_conntrack_manip_proto *min, |
50 | const union ip_conntrack_manip_proto *max) | 50 | const union ip_conntrack_manip_proto *max) |
51 | { | 51 | { |
52 | u_int32_t key; | 52 | __be16 key; |
53 | 53 | ||
54 | if (maniptype == IP_NAT_MANIP_SRC) | 54 | if (maniptype == IP_NAT_MANIP_SRC) |
55 | key = tuple->src.u.gre.key; | 55 | key = tuple->src.u.gre.key; |
56 | else | 56 | else |
57 | key = tuple->dst.u.gre.key; | 57 | key = tuple->dst.u.gre.key; |
58 | 58 | ||
59 | return ntohl(key) >= ntohl(min->gre.key) | 59 | return ntohs(key) >= ntohs(min->gre.key) |
60 | && ntohl(key) <= ntohl(max->gre.key); | 60 | && ntohs(key) <= ntohs(max->gre.key); |
61 | } | 61 | } |
62 | 62 | ||
63 | /* generate unique tuple ... */ | 63 | /* generate unique tuple ... */ |
@@ -81,14 +81,14 @@ gre_unique_tuple(struct ip_conntrack_tuple *tuple, | |||
81 | min = 1; | 81 | min = 1; |
82 | range_size = 0xffff; | 82 | range_size = 0xffff; |
83 | } else { | 83 | } else { |
84 | min = ntohl(range->min.gre.key); | 84 | min = ntohs(range->min.gre.key); |
85 | range_size = ntohl(range->max.gre.key) - min + 1; | 85 | range_size = ntohs(range->max.gre.key) - min + 1; |
86 | } | 86 | } |
87 | 87 | ||
88 | DEBUGP("min = %u, range_size = %u\n", min, range_size); | 88 | DEBUGP("min = %u, range_size = %u\n", min, range_size); |
89 | 89 | ||
90 | for (i = 0; i < range_size; i++, key++) { | 90 | for (i = 0; i < range_size; i++, key++) { |
91 | *keyptr = htonl(min + key % range_size); | 91 | *keyptr = htons(min + key % range_size); |
92 | if (!ip_nat_used_tuple(tuple, conntrack)) | 92 | if (!ip_nat_used_tuple(tuple, conntrack)) |
93 | return 1; | 93 | return 1; |
94 | } | 94 | } |
diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index c62253845538..c33244263b90 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c | |||
@@ -768,6 +768,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, | |||
768 | len *= sizeof(unsigned long); | 768 | len *= sizeof(unsigned long); |
769 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); | 769 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); |
770 | if (*obj == NULL) { | 770 | if (*obj == NULL) { |
771 | kfree(lp); | ||
771 | kfree(id); | 772 | kfree(id); |
772 | if (net_ratelimit()) | 773 | if (net_ratelimit()) |
773 | printk("OOM in bsalg (%d)\n", __LINE__); | 774 | printk("OOM in bsalg (%d)\n", __LINE__); |
@@ -1003,12 +1004,12 @@ static unsigned char snmp_trap_decode(struct asn1_ctx *ctx, | |||
1003 | 1004 | ||
1004 | return 1; | 1005 | return 1; |
1005 | 1006 | ||
1007 | err_addr_free: | ||
1008 | kfree((unsigned long *)trap->ip_address); | ||
1009 | |||
1006 | err_id_free: | 1010 | err_id_free: |
1007 | kfree(trap->id); | 1011 | kfree(trap->id); |
1008 | 1012 | ||
1009 | err_addr_free: | ||
1010 | kfree((unsigned long *)trap->ip_address); | ||
1011 | |||
1012 | return 0; | 1013 | return 0; |
1013 | } | 1014 | } |
1014 | 1015 | ||
@@ -1126,11 +1127,10 @@ static int snmp_parse_mangle(unsigned char *msg, | |||
1126 | struct snmp_v1_trap trap; | 1127 | struct snmp_v1_trap trap; |
1127 | unsigned char ret = snmp_trap_decode(&ctx, &trap, map, check); | 1128 | unsigned char ret = snmp_trap_decode(&ctx, &trap, map, check); |
1128 | 1129 | ||
1129 | /* Discard trap allocations regardless */ | 1130 | if (ret) { |
1130 | kfree(trap.id); | 1131 | kfree(trap.id); |
1131 | kfree((unsigned long *)trap.ip_address); | 1132 | kfree((unsigned long *)trap.ip_address); |
1132 | 1133 | } else | |
1133 | if (!ret) | ||
1134 | return ret; | 1134 | return ret; |
1135 | 1135 | ||
1136 | } else { | 1136 | } else { |
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index 39fd4c2a2386..b98f7b08b084 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -428,7 +428,7 @@ ipt_log_target(struct sk_buff **pskb, | |||
428 | 428 | ||
429 | if (loginfo->logflags & IPT_LOG_NFLOG) | 429 | if (loginfo->logflags & IPT_LOG_NFLOG) |
430 | nf_log_packet(PF_INET, hooknum, *pskb, in, out, &li, | 430 | nf_log_packet(PF_INET, hooknum, *pskb, in, out, &li, |
431 | loginfo->prefix); | 431 | "%s", loginfo->prefix); |
432 | else | 432 | else |
433 | ipt_log_packet(PF_INET, hooknum, *pskb, in, out, &li, | 433 | ipt_log_packet(PF_INET, hooknum, *pskb, in, out, &li, |
434 | loginfo->prefix); | 434 | loginfo->prefix); |
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index 143843285702..b847ee409efb 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c | |||
@@ -821,6 +821,7 @@ checkentry(const char *tablename, | |||
821 | /* Create our proc 'status' entry. */ | 821 | /* Create our proc 'status' entry. */ |
822 | curr_table->status_proc = create_proc_entry(curr_table->name, ip_list_perms, proc_net_ipt_recent); | 822 | curr_table->status_proc = create_proc_entry(curr_table->name, ip_list_perms, proc_net_ipt_recent); |
823 | if (!curr_table->status_proc) { | 823 | if (!curr_table->status_proc) { |
824 | vfree(hold); | ||
824 | printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for /proc entry.\n"); | 825 | printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for /proc entry.\n"); |
825 | /* Destroy the created table */ | 826 | /* Destroy the created table */ |
826 | spin_lock_bh(&recent_lock); | 827 | spin_lock_bh(&recent_lock); |
@@ -845,7 +846,6 @@ checkentry(const char *tablename, | |||
845 | spin_unlock_bh(&recent_lock); | 846 | spin_unlock_bh(&recent_lock); |
846 | vfree(curr_table->time_info); | 847 | vfree(curr_table->time_info); |
847 | vfree(curr_table->hash_table); | 848 | vfree(curr_table->hash_table); |
848 | vfree(hold); | ||
849 | vfree(curr_table->table); | 849 | vfree(curr_table->table); |
850 | vfree(curr_table); | 850 | vfree(curr_table); |
851 | return 0; | 851 | return 0; |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index 5bc9f64d7b5b..77d974443c7b 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -348,6 +348,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) | |||
348 | .tuple.dst.u.tcp.port; | 348 | .tuple.dst.u.tcp.port; |
349 | sin.sin_addr.s_addr = ct->tuplehash[IP_CT_DIR_ORIGINAL] | 349 | sin.sin_addr.s_addr = ct->tuplehash[IP_CT_DIR_ORIGINAL] |
350 | .tuple.dst.u3.ip; | 350 | .tuple.dst.u3.ip; |
351 | memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); | ||
351 | 352 | ||
352 | DEBUGP("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n", | 353 | DEBUGP("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n", |
353 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); | 354 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); |
diff --git a/net/ipv4/tcp_highspeed.c b/net/ipv4/tcp_highspeed.c index b72fa55dfb84..ba7c63ca5bb1 100644 --- a/net/ipv4/tcp_highspeed.c +++ b/net/ipv4/tcp_highspeed.c | |||
@@ -135,7 +135,8 @@ static void hstcp_cong_avoid(struct sock *sk, u32 adk, u32 rtt, | |||
135 | 135 | ||
136 | /* Do additive increase */ | 136 | /* Do additive increase */ |
137 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) { | 137 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) { |
138 | tp->snd_cwnd_cnt += ca->ai; | 138 | /* cwnd = cwnd + a(w) / cwnd */ |
139 | tp->snd_cwnd_cnt += ca->ai + 1; | ||
139 | if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { | 140 | if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { |
140 | tp->snd_cwnd_cnt -= tp->snd_cwnd; | 141 | tp->snd_cwnd_cnt -= tp->snd_cwnd; |
141 | tp->snd_cwnd++; | 142 | tp->snd_cwnd++; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 9f0cca4c4fae..b5521a9d3dc1 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1649,7 +1649,7 @@ static void tcp_update_scoreboard(struct sock *sk, struct tcp_sock *tp) | |||
1649 | * Hence, we can detect timed out packets during fast | 1649 | * Hence, we can detect timed out packets during fast |
1650 | * retransmit without falling to slow start. | 1650 | * retransmit without falling to slow start. |
1651 | */ | 1651 | */ |
1652 | if (tcp_head_timedout(sk, tp)) { | 1652 | if (!IsReno(tp) && tcp_head_timedout(sk, tp)) { |
1653 | struct sk_buff *skb; | 1653 | struct sk_buff *skb; |
1654 | 1654 | ||
1655 | skb = tp->scoreboard_skb_hint ? tp->scoreboard_skb_hint | 1655 | skb = tp->scoreboard_skb_hint ? tp->scoreboard_skb_hint |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 743016baa048..f33c9dddaa12 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -642,7 +642,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss | |||
642 | * eventually). The difference is that pulled data not copied, but | 642 | * eventually). The difference is that pulled data not copied, but |
643 | * immediately discarded. | 643 | * immediately discarded. |
644 | */ | 644 | */ |
645 | static unsigned char *__pskb_trim_head(struct sk_buff *skb, int len) | 645 | static void __pskb_trim_head(struct sk_buff *skb, int len) |
646 | { | 646 | { |
647 | int i, k, eat; | 647 | int i, k, eat; |
648 | 648 | ||
@@ -667,7 +667,6 @@ static unsigned char *__pskb_trim_head(struct sk_buff *skb, int len) | |||
667 | skb->tail = skb->data; | 667 | skb->tail = skb->data; |
668 | skb->data_len -= len; | 668 | skb->data_len -= len; |
669 | skb->len = skb->data_len; | 669 | skb->len = skb->data_len; |
670 | return skb->tail; | ||
671 | } | 670 | } |
672 | 671 | ||
673 | int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) | 672 | int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) |
@@ -676,12 +675,11 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) | |||
676 | pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) | 675 | pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) |
677 | return -ENOMEM; | 676 | return -ENOMEM; |
678 | 677 | ||
679 | if (len <= skb_headlen(skb)) { | 678 | /* If len == headlen, we avoid __skb_pull to preserve alignment. */ |
679 | if (unlikely(len < skb_headlen(skb))) | ||
680 | __skb_pull(skb, len); | 680 | __skb_pull(skb, len); |
681 | } else { | 681 | else |
682 | if (__pskb_trim_head(skb, len-skb_headlen(skb)) == NULL) | 682 | __pskb_trim_head(skb, len - skb_headlen(skb)); |
683 | return -ENOMEM; | ||
684 | } | ||
685 | 683 | ||
686 | TCP_SKB_CB(skb)->seq += len; | 684 | TCP_SKB_CB(skb)->seq += len; |
687 | skb->ip_summed = CHECKSUM_HW; | 685 | skb->ip_summed = CHECKSUM_HW; |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index f285bbf296e2..8604c747bca5 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -221,7 +221,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) | |||
221 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { | 221 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { |
222 | u16 *ipcomp_hdr = (u16 *)xprth; | 222 | u16 *ipcomp_hdr = (u16 *)xprth; |
223 | 223 | ||
224 | fl->fl_ipsec_spi = ntohl(ntohs(ipcomp_hdr[1])); | 224 | fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1])); |
225 | } | 225 | } |
226 | break; | 226 | break; |
227 | default: | 227 | default: |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 05eb67def39f..48636436028a 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -208,7 +208,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
208 | if (type != ICMPV6_DEST_UNREACH && type != ICMPV6_PKT_TOOBIG) | 208 | if (type != ICMPV6_DEST_UNREACH && type != ICMPV6_PKT_TOOBIG) |
209 | return; | 209 | return; |
210 | 210 | ||
211 | spi = ntohl(ntohs(ipcomph->cpi)); | 211 | spi = htonl(ntohs(ipcomph->cpi)); |
212 | x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6); | 212 | x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6); |
213 | if (!x) | 213 | if (!x) |
214 | return; | 214 | return; |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 0a673038344f..2e72f89a7019 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1103,7 +1103,7 @@ do_add_counters(void __user *user, unsigned int len) | |||
1103 | 1103 | ||
1104 | write_lock_bh(&t->lock); | 1104 | write_lock_bh(&t->lock); |
1105 | private = t->private; | 1105 | private = t->private; |
1106 | if (private->number != paddc->num_counters) { | 1106 | if (private->number != tmp.num_counters) { |
1107 | ret = -EINVAL; | 1107 | ret = -EINVAL; |
1108 | goto unlock_up_free; | 1108 | goto unlock_up_free; |
1109 | } | 1109 | } |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index a96c0de14b00..73c6300109d6 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -439,7 +439,7 @@ ip6t_log_target(struct sk_buff **pskb, | |||
439 | 439 | ||
440 | if (loginfo->logflags & IP6T_LOG_NFLOG) | 440 | if (loginfo->logflags & IP6T_LOG_NFLOG) |
441 | nf_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, | 441 | nf_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, |
442 | loginfo->prefix); | 442 | "%s", loginfo->prefix); |
443 | else | 443 | else |
444 | ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, | 444 | ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, |
445 | loginfo->prefix); | 445 | loginfo->prefix); |
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c index 94dbdb8b458d..4f6b84c8f4ab 100644 --- a/net/ipv6/netfilter/ip6t_eui64.c +++ b/net/ipv6/netfilter/ip6t_eui64.c | |||
@@ -40,7 +40,7 @@ match(const struct sk_buff *skb, | |||
40 | 40 | ||
41 | memset(eui64, 0, sizeof(eui64)); | 41 | memset(eui64, 0, sizeof(eui64)); |
42 | 42 | ||
43 | if (eth_hdr(skb)->h_proto == ntohs(ETH_P_IPV6)) { | 43 | if (eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) { |
44 | if (skb->nh.ipv6h->version == 0x6) { | 44 | if (skb->nh.ipv6h->version == 0x6) { |
45 | memcpy(eui64, eth_hdr(skb)->h_source, 3); | 45 | memcpy(eui64, eth_hdr(skb)->h_source, 3); |
46 | memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); | 46 | memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 0190e39096b9..8a777932786d 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -280,10 +280,13 @@ static int inline rt6_check_neigh(struct rt6_info *rt) | |||
280 | { | 280 | { |
281 | struct neighbour *neigh = rt->rt6i_nexthop; | 281 | struct neighbour *neigh = rt->rt6i_nexthop; |
282 | int m = 0; | 282 | int m = 0; |
283 | if (neigh) { | 283 | if (rt->rt6i_flags & RTF_NONEXTHOP || |
284 | !(rt->rt6i_flags & RTF_GATEWAY)) | ||
285 | m = 1; | ||
286 | else if (neigh) { | ||
284 | read_lock_bh(&neigh->lock); | 287 | read_lock_bh(&neigh->lock); |
285 | if (neigh->nud_state & NUD_VALID) | 288 | if (neigh->nud_state & NUD_VALID) |
286 | m = 1; | 289 | m = 2; |
287 | read_unlock_bh(&neigh->lock); | 290 | read_unlock_bh(&neigh->lock); |
288 | } | 291 | } |
289 | return m; | 292 | return m; |
@@ -292,15 +295,18 @@ static int inline rt6_check_neigh(struct rt6_info *rt) | |||
292 | static int rt6_score_route(struct rt6_info *rt, int oif, | 295 | static int rt6_score_route(struct rt6_info *rt, int oif, |
293 | int strict) | 296 | int strict) |
294 | { | 297 | { |
295 | int m = rt6_check_dev(rt, oif); | 298 | int m, n; |
299 | |||
300 | m = rt6_check_dev(rt, oif); | ||
296 | if (!m && (strict & RT6_SELECT_F_IFACE)) | 301 | if (!m && (strict & RT6_SELECT_F_IFACE)) |
297 | return -1; | 302 | return -1; |
298 | #ifdef CONFIG_IPV6_ROUTER_PREF | 303 | #ifdef CONFIG_IPV6_ROUTER_PREF |
299 | m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->rt6i_flags)) << 2; | 304 | m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->rt6i_flags)) << 2; |
300 | #endif | 305 | #endif |
301 | if (rt6_check_neigh(rt)) | 306 | n = rt6_check_neigh(rt); |
307 | if (n > 1) | ||
302 | m |= 16; | 308 | m |= 16; |
303 | else if (strict & RT6_SELECT_F_REACHABLE) | 309 | else if (!n && strict & RT6_SELECT_F_REACHABLE) |
304 | return -1; | 310 | return -1; |
305 | return m; | 311 | return m; |
306 | } | 312 | } |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 2dbf134d5266..811d998725bc 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -944,9 +944,9 @@ out: | |||
944 | return rc; | 944 | return rc; |
945 | } | 945 | } |
946 | 946 | ||
947 | static int ipx_map_frame_type(unsigned char type) | 947 | static __be16 ipx_map_frame_type(unsigned char type) |
948 | { | 948 | { |
949 | int rc = 0; | 949 | __be16 rc = 0; |
950 | 950 | ||
951 | switch (type) { | 951 | switch (type) { |
952 | case IPX_FRAME_ETHERII: rc = htons(ETH_P_IPX); break; | 952 | case IPX_FRAME_ETHERII: rc = htons(ETH_P_IPX); break; |
diff --git a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c index 67774448efd9..a394c6fe19a2 100644 --- a/net/ipx/ipx_route.c +++ b/net/ipx/ipx_route.c | |||
@@ -119,7 +119,7 @@ out: | |||
119 | return rc; | 119 | return rc; |
120 | } | 120 | } |
121 | 121 | ||
122 | static int ipxrtr_delete(long net) | 122 | static int ipxrtr_delete(__u32 net) |
123 | { | 123 | { |
124 | struct ipx_route *r, *tmp; | 124 | struct ipx_route *r, *tmp; |
125 | int rc; | 125 | int rc; |
diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 254f90746900..2d2e2b1919f4 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c | |||
@@ -544,7 +544,8 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self, | |||
544 | { | 544 | { |
545 | struct sk_buff *tx_skb; | 545 | struct sk_buff *tx_skb; |
546 | int n; | 546 | int n; |
547 | __u32 tmp_be32, tmp_be16; | 547 | __u32 tmp_be32; |
548 | __be16 tmp_be16; | ||
548 | __u8 *fp; | 549 | __u8 *fp; |
549 | 550 | ||
550 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__); | 551 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__); |
diff --git a/net/irda/irlap.c b/net/irda/irlap.c index 7029618f5719..a16528657b4c 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c | |||
@@ -884,7 +884,8 @@ static void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now) | |||
884 | if (now) { | 884 | if (now) { |
885 | /* Send down empty frame to trigger speed change */ | 885 | /* Send down empty frame to trigger speed change */ |
886 | skb = dev_alloc_skb(0); | 886 | skb = dev_alloc_skb(0); |
887 | irlap_queue_xmit(self, skb); | 887 | if (skb) |
888 | irlap_queue_xmit(self, skb); | ||
888 | } | 889 | } |
889 | } | 890 | } |
890 | 891 | ||
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index c60273cad778..61cdda4e5d3b 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -321,7 +321,7 @@ static int | |||
321 | nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags) | 321 | nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags) |
322 | { | 322 | { |
323 | spin_lock_bh(&inst->lock); | 323 | spin_lock_bh(&inst->lock); |
324 | inst->flags = ntohs(flags); | 324 | inst->flags = flags; |
325 | spin_unlock_bh(&inst->lock); | 325 | spin_unlock_bh(&inst->lock); |
326 | 326 | ||
327 | return 0; | 327 | return 0; |
@@ -902,7 +902,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, | |||
902 | if (nfula[NFULA_CFG_FLAGS-1]) { | 902 | if (nfula[NFULA_CFG_FLAGS-1]) { |
903 | u_int16_t flags = | 903 | u_int16_t flags = |
904 | *(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]); | 904 | *(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]); |
905 | nfulnl_set_flags(inst, ntohl(flags)); | 905 | nfulnl_set_flags(inst, ntohs(flags)); |
906 | } | 906 | } |
907 | 907 | ||
908 | out_put: | 908 | out_put: |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 31eb83717c26..138ea92ed268 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -193,8 +193,10 @@ static void dev_watchdog(unsigned long arg) | |||
193 | netif_running(dev) && | 193 | netif_running(dev) && |
194 | netif_carrier_ok(dev)) { | 194 | netif_carrier_ok(dev)) { |
195 | if (netif_queue_stopped(dev) && | 195 | if (netif_queue_stopped(dev) && |
196 | (jiffies - dev->trans_start) > dev->watchdog_timeo) { | 196 | time_after(jiffies, dev->trans_start + dev->watchdog_timeo)) { |
197 | printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", dev->name); | 197 | |
198 | printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", | ||
199 | dev->name); | ||
198 | dev->tx_timeout(dev); | 200 | dev->tx_timeout(dev); |
199 | } | 201 | } |
200 | if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo)) | 202 | if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo)) |
diff --git a/net/sctp/input.c b/net/sctp/input.c index d117ebc75cf8..1662f9cc869e 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -73,6 +73,8 @@ static struct sctp_association *__sctp_lookup_association( | |||
73 | const union sctp_addr *peer, | 73 | const union sctp_addr *peer, |
74 | struct sctp_transport **pt); | 74 | struct sctp_transport **pt); |
75 | 75 | ||
76 | static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb); | ||
77 | |||
76 | 78 | ||
77 | /* Calculate the SCTP checksum of an SCTP packet. */ | 79 | /* Calculate the SCTP checksum of an SCTP packet. */ |
78 | static inline int sctp_rcv_checksum(struct sk_buff *skb) | 80 | static inline int sctp_rcv_checksum(struct sk_buff *skb) |
@@ -186,7 +188,6 @@ int sctp_rcv(struct sk_buff *skb) | |||
186 | */ | 188 | */ |
187 | if (sk->sk_bound_dev_if && (sk->sk_bound_dev_if != af->skb_iif(skb))) | 189 | if (sk->sk_bound_dev_if && (sk->sk_bound_dev_if != af->skb_iif(skb))) |
188 | { | 190 | { |
189 | sock_put(sk); | ||
190 | if (asoc) { | 191 | if (asoc) { |
191 | sctp_association_put(asoc); | 192 | sctp_association_put(asoc); |
192 | asoc = NULL; | 193 | asoc = NULL; |
@@ -197,7 +198,6 @@ int sctp_rcv(struct sk_buff *skb) | |||
197 | sk = sctp_get_ctl_sock(); | 198 | sk = sctp_get_ctl_sock(); |
198 | ep = sctp_sk(sk)->ep; | 199 | ep = sctp_sk(sk)->ep; |
199 | sctp_endpoint_hold(ep); | 200 | sctp_endpoint_hold(ep); |
200 | sock_hold(sk); | ||
201 | rcvr = &ep->base; | 201 | rcvr = &ep->base; |
202 | } | 202 | } |
203 | 203 | ||
@@ -253,25 +253,18 @@ int sctp_rcv(struct sk_buff *skb) | |||
253 | */ | 253 | */ |
254 | sctp_bh_lock_sock(sk); | 254 | sctp_bh_lock_sock(sk); |
255 | 255 | ||
256 | /* It is possible that the association could have moved to a different | ||
257 | * socket if it is peeled off. If so, update the sk. | ||
258 | */ | ||
259 | if (sk != rcvr->sk) { | ||
260 | sctp_bh_lock_sock(rcvr->sk); | ||
261 | sctp_bh_unlock_sock(sk); | ||
262 | sk = rcvr->sk; | ||
263 | } | ||
264 | |||
265 | if (sock_owned_by_user(sk)) | 256 | if (sock_owned_by_user(sk)) |
266 | sk_add_backlog(sk, skb); | 257 | sctp_add_backlog(sk, skb); |
267 | else | 258 | else |
268 | sctp_backlog_rcv(sk, skb); | 259 | sctp_inq_push(&chunk->rcvr->inqueue, chunk); |
269 | 260 | ||
270 | /* Release the sock and the sock ref we took in the lookup calls. | ||
271 | * The asoc/ep ref will be released in sctp_backlog_rcv. | ||
272 | */ | ||
273 | sctp_bh_unlock_sock(sk); | 261 | sctp_bh_unlock_sock(sk); |
274 | sock_put(sk); | 262 | |
263 | /* Release the asoc/ep ref we took in the lookup calls. */ | ||
264 | if (asoc) | ||
265 | sctp_association_put(asoc); | ||
266 | else | ||
267 | sctp_endpoint_put(ep); | ||
275 | 268 | ||
276 | return 0; | 269 | return 0; |
277 | 270 | ||
@@ -280,8 +273,7 @@ discard_it: | |||
280 | return 0; | 273 | return 0; |
281 | 274 | ||
282 | discard_release: | 275 | discard_release: |
283 | /* Release any structures we may be holding. */ | 276 | /* Release the asoc/ep ref we took in the lookup calls. */ |
284 | sock_put(sk); | ||
285 | if (asoc) | 277 | if (asoc) |
286 | sctp_association_put(asoc); | 278 | sctp_association_put(asoc); |
287 | else | 279 | else |
@@ -290,56 +282,87 @@ discard_release: | |||
290 | goto discard_it; | 282 | goto discard_it; |
291 | } | 283 | } |
292 | 284 | ||
293 | /* Handle second half of inbound skb processing. If the sock was busy, | 285 | /* Process the backlog queue of the socket. Every skb on |
294 | * we may have need to delay processing until later when the sock is | 286 | * the backlog holds a ref on an association or endpoint. |
295 | * released (on the backlog). If not busy, we call this routine | 287 | * We hold this ref throughout the state machine to make |
296 | * directly from the bottom half. | 288 | * sure that the structure we need is still around. |
297 | */ | 289 | */ |
298 | int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) | 290 | int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) |
299 | { | 291 | { |
300 | struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk; | 292 | struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk; |
301 | struct sctp_inq *inqueue = NULL; | 293 | struct sctp_inq *inqueue = &chunk->rcvr->inqueue; |
302 | struct sctp_ep_common *rcvr = NULL; | 294 | struct sctp_ep_common *rcvr = NULL; |
295 | int backloged = 0; | ||
303 | 296 | ||
304 | rcvr = chunk->rcvr; | 297 | rcvr = chunk->rcvr; |
305 | 298 | ||
306 | BUG_TRAP(rcvr->sk == sk); | 299 | /* If the rcvr is dead then the association or endpoint |
307 | 300 | * has been deleted and we can safely drop the chunk | |
308 | if (rcvr->dead) { | 301 | * and refs that we are holding. |
309 | sctp_chunk_free(chunk); | 302 | */ |
310 | } else { | 303 | if (rcvr->dead) { |
311 | inqueue = &chunk->rcvr->inqueue; | 304 | sctp_chunk_free(chunk); |
312 | sctp_inq_push(inqueue, chunk); | 305 | goto done; |
313 | } | 306 | } |
314 | 307 | ||
315 | /* Release the asoc/ep ref we took in the lookup calls in sctp_rcv. */ | 308 | if (unlikely(rcvr->sk != sk)) { |
316 | if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type) | 309 | /* In this case, the association moved from one socket to |
317 | sctp_association_put(sctp_assoc(rcvr)); | 310 | * another. We are currently sitting on the backlog of the |
318 | else | 311 | * old socket, so we need to move. |
319 | sctp_endpoint_put(sctp_ep(rcvr)); | 312 | * However, since we are here in the process context we |
320 | 313 | * need to take make sure that the user doesn't own | |
314 | * the new socket when we process the packet. | ||
315 | * If the new socket is user-owned, queue the chunk to the | ||
316 | * backlog of the new socket without dropping any refs. | ||
317 | * Otherwise, we can safely push the chunk on the inqueue. | ||
318 | */ | ||
319 | |||
320 | sk = rcvr->sk; | ||
321 | sctp_bh_lock_sock(sk); | ||
322 | |||
323 | if (sock_owned_by_user(sk)) { | ||
324 | sk_add_backlog(sk, skb); | ||
325 | backloged = 1; | ||
326 | } else | ||
327 | sctp_inq_push(inqueue, chunk); | ||
328 | |||
329 | sctp_bh_unlock_sock(sk); | ||
330 | |||
331 | /* If the chunk was backloged again, don't drop refs */ | ||
332 | if (backloged) | ||
333 | return 0; | ||
334 | } else { | ||
335 | sctp_inq_push(inqueue, chunk); | ||
336 | } | ||
337 | |||
338 | done: | ||
339 | /* Release the refs we took in sctp_add_backlog */ | ||
340 | if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type) | ||
341 | sctp_association_put(sctp_assoc(rcvr)); | ||
342 | else if (SCTP_EP_TYPE_SOCKET == rcvr->type) | ||
343 | sctp_endpoint_put(sctp_ep(rcvr)); | ||
344 | else | ||
345 | BUG(); | ||
346 | |||
321 | return 0; | 347 | return 0; |
322 | } | 348 | } |
323 | 349 | ||
324 | void sctp_backlog_migrate(struct sctp_association *assoc, | 350 | static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb) |
325 | struct sock *oldsk, struct sock *newsk) | ||
326 | { | 351 | { |
327 | struct sk_buff *skb; | 352 | struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk; |
328 | struct sctp_chunk *chunk; | 353 | struct sctp_ep_common *rcvr = chunk->rcvr; |
329 | 354 | ||
330 | skb = oldsk->sk_backlog.head; | 355 | /* Hold the assoc/ep while hanging on the backlog queue. |
331 | oldsk->sk_backlog.head = oldsk->sk_backlog.tail = NULL; | 356 | * This way, we know structures we need will not disappear from us |
332 | while (skb != NULL) { | 357 | */ |
333 | struct sk_buff *next = skb->next; | 358 | if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type) |
334 | 359 | sctp_association_hold(sctp_assoc(rcvr)); | |
335 | chunk = SCTP_INPUT_CB(skb)->chunk; | 360 | else if (SCTP_EP_TYPE_SOCKET == rcvr->type) |
336 | skb->next = NULL; | 361 | sctp_endpoint_hold(sctp_ep(rcvr)); |
337 | if (&assoc->base == chunk->rcvr) | 362 | else |
338 | sk_add_backlog(newsk, skb); | 363 | BUG(); |
339 | else | 364 | |
340 | sk_add_backlog(oldsk, skb); | 365 | sk_add_backlog(sk, skb); |
341 | skb = next; | ||
342 | } | ||
343 | } | 366 | } |
344 | 367 | ||
345 | /* Handle icmp frag needed error. */ | 368 | /* Handle icmp frag needed error. */ |
@@ -412,7 +435,7 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, | |||
412 | union sctp_addr daddr; | 435 | union sctp_addr daddr; |
413 | struct sctp_af *af; | 436 | struct sctp_af *af; |
414 | struct sock *sk = NULL; | 437 | struct sock *sk = NULL; |
415 | struct sctp_association *asoc = NULL; | 438 | struct sctp_association *asoc; |
416 | struct sctp_transport *transport = NULL; | 439 | struct sctp_transport *transport = NULL; |
417 | 440 | ||
418 | *app = NULL; *tpp = NULL; | 441 | *app = NULL; *tpp = NULL; |
@@ -453,7 +476,6 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, | |||
453 | return sk; | 476 | return sk; |
454 | 477 | ||
455 | out: | 478 | out: |
456 | sock_put(sk); | ||
457 | if (asoc) | 479 | if (asoc) |
458 | sctp_association_put(asoc); | 480 | sctp_association_put(asoc); |
459 | return NULL; | 481 | return NULL; |
@@ -463,7 +485,6 @@ out: | |||
463 | void sctp_err_finish(struct sock *sk, struct sctp_association *asoc) | 485 | void sctp_err_finish(struct sock *sk, struct sctp_association *asoc) |
464 | { | 486 | { |
465 | sctp_bh_unlock_sock(sk); | 487 | sctp_bh_unlock_sock(sk); |
466 | sock_put(sk); | ||
467 | if (asoc) | 488 | if (asoc) |
468 | sctp_association_put(asoc); | 489 | sctp_association_put(asoc); |
469 | } | 490 | } |
@@ -490,7 +511,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) | |||
490 | int type = skb->h.icmph->type; | 511 | int type = skb->h.icmph->type; |
491 | int code = skb->h.icmph->code; | 512 | int code = skb->h.icmph->code; |
492 | struct sock *sk; | 513 | struct sock *sk; |
493 | struct sctp_association *asoc; | 514 | struct sctp_association *asoc = NULL; |
494 | struct sctp_transport *transport; | 515 | struct sctp_transport *transport; |
495 | struct inet_sock *inet; | 516 | struct inet_sock *inet; |
496 | char *saveip, *savesctp; | 517 | char *saveip, *savesctp; |
@@ -716,7 +737,6 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l | |||
716 | 737 | ||
717 | hit: | 738 | hit: |
718 | sctp_endpoint_hold(ep); | 739 | sctp_endpoint_hold(ep); |
719 | sock_hold(epb->sk); | ||
720 | read_unlock(&head->lock); | 740 | read_unlock(&head->lock); |
721 | return ep; | 741 | return ep; |
722 | } | 742 | } |
@@ -818,7 +838,6 @@ static struct sctp_association *__sctp_lookup_association( | |||
818 | hit: | 838 | hit: |
819 | *pt = transport; | 839 | *pt = transport; |
820 | sctp_association_hold(asoc); | 840 | sctp_association_hold(asoc); |
821 | sock_hold(epb->sk); | ||
822 | read_unlock(&head->lock); | 841 | read_unlock(&head->lock); |
823 | return asoc; | 842 | return asoc; |
824 | } | 843 | } |
@@ -846,7 +865,6 @@ int sctp_has_association(const union sctp_addr *laddr, | |||
846 | struct sctp_transport *transport; | 865 | struct sctp_transport *transport; |
847 | 866 | ||
848 | if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) { | 867 | if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) { |
849 | sock_put(asoc->base.sk); | ||
850 | sctp_association_put(asoc); | 868 | sctp_association_put(asoc); |
851 | return 1; | 869 | return 1; |
852 | } | 870 | } |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 8d1dc24bab4c..c5beb2ad7ef7 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -498,10 +498,6 @@ static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *commands, | |||
498 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | 498 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, |
499 | SCTP_STATE(SCTP_STATE_CLOSED)); | 499 | SCTP_STATE(SCTP_STATE_CLOSED)); |
500 | 500 | ||
501 | /* Set sk_err to ECONNRESET on a 1-1 style socket. */ | ||
502 | if (!sctp_style(asoc->base.sk, UDP)) | ||
503 | asoc->base.sk->sk_err = ECONNRESET; | ||
504 | |||
505 | /* SEND_FAILED sent later when cleaning up the association. */ | 501 | /* SEND_FAILED sent later when cleaning up the association. */ |
506 | asoc->outqueue.error = error; | 502 | asoc->outqueue.error = error; |
507 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); | 503 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); |
@@ -838,6 +834,15 @@ static void sctp_cmd_del_non_primary(struct sctp_association *asoc) | |||
838 | return; | 834 | return; |
839 | } | 835 | } |
840 | 836 | ||
837 | /* Helper function to set sk_err on a 1-1 style socket. */ | ||
838 | static void sctp_cmd_set_sk_err(struct sctp_association *asoc, int error) | ||
839 | { | ||
840 | struct sock *sk = asoc->base.sk; | ||
841 | |||
842 | if (!sctp_style(sk, UDP)) | ||
843 | sk->sk_err = error; | ||
844 | } | ||
845 | |||
841 | /* These three macros allow us to pull the debugging code out of the | 846 | /* These three macros allow us to pull the debugging code out of the |
842 | * main flow of sctp_do_sm() to keep attention focused on the real | 847 | * main flow of sctp_do_sm() to keep attention focused on the real |
843 | * functionality there. | 848 | * functionality there. |
@@ -1458,6 +1463,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1458 | local_cork = 0; | 1463 | local_cork = 0; |
1459 | asoc->peer.retran_path = t; | 1464 | asoc->peer.retran_path = t; |
1460 | break; | 1465 | break; |
1466 | case SCTP_CMD_SET_SK_ERR: | ||
1467 | sctp_cmd_set_sk_err(asoc, cmd->obj.error); | ||
1468 | break; | ||
1461 | default: | 1469 | default: |
1462 | printk(KERN_WARNING "Impossible command: %u, %p\n", | 1470 | printk(KERN_WARNING "Impossible command: %u, %p\n", |
1463 | cmd->verb, cmd->obj.ptr); | 1471 | cmd->verb, cmd->obj.ptr); |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 8cdba51ec076..8bc279219a72 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -93,7 +93,7 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(const struct sctp_endpoint *ep, | |||
93 | static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk); | 93 | static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk); |
94 | 94 | ||
95 | static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, | 95 | static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, |
96 | __u16 error, | 96 | __u16 error, int sk_err, |
97 | const struct sctp_association *asoc, | 97 | const struct sctp_association *asoc, |
98 | struct sctp_transport *transport); | 98 | struct sctp_transport *transport); |
99 | 99 | ||
@@ -448,7 +448,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
448 | __u32 init_tag; | 448 | __u32 init_tag; |
449 | struct sctp_chunk *err_chunk; | 449 | struct sctp_chunk *err_chunk; |
450 | struct sctp_packet *packet; | 450 | struct sctp_packet *packet; |
451 | sctp_disposition_t ret; | 451 | __u16 error; |
452 | 452 | ||
453 | if (!sctp_vtag_verify(chunk, asoc)) | 453 | if (!sctp_vtag_verify(chunk, asoc)) |
454 | return sctp_sf_pdiscard(ep, asoc, type, arg, commands); | 454 | return sctp_sf_pdiscard(ep, asoc, type, arg, commands); |
@@ -480,11 +480,9 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
480 | goto nomem; | 480 | goto nomem; |
481 | 481 | ||
482 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); | 482 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); |
483 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | 483 | return sctp_stop_t1_and_abort(commands, SCTP_ERROR_INV_PARAM, |
484 | SCTP_STATE(SCTP_STATE_CLOSED)); | 484 | ECONNREFUSED, asoc, |
485 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); | 485 | chunk->transport); |
486 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); | ||
487 | return SCTP_DISPOSITION_DELETE_TCB; | ||
488 | } | 486 | } |
489 | 487 | ||
490 | /* Verify the INIT chunk before processing it. */ | 488 | /* Verify the INIT chunk before processing it. */ |
@@ -511,27 +509,16 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
511 | sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, | 509 | sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, |
512 | SCTP_PACKET(packet)); | 510 | SCTP_PACKET(packet)); |
513 | SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); | 511 | SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); |
514 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | 512 | error = SCTP_ERROR_INV_PARAM; |
515 | SCTP_STATE(SCTP_STATE_CLOSED)); | ||
516 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, | ||
517 | SCTP_NULL()); | ||
518 | return SCTP_DISPOSITION_CONSUME; | ||
519 | } else { | 513 | } else { |
520 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | 514 | error = SCTP_ERROR_NO_RESOURCE; |
521 | SCTP_STATE(SCTP_STATE_CLOSED)); | ||
522 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, | ||
523 | SCTP_NULL()); | ||
524 | return SCTP_DISPOSITION_NOMEM; | ||
525 | } | 515 | } |
526 | } else { | 516 | } else { |
527 | ret = sctp_sf_tabort_8_4_8(ep, asoc, type, arg, | 517 | sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); |
528 | commands); | 518 | error = SCTP_ERROR_INV_PARAM; |
529 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | ||
530 | SCTP_STATE(SCTP_STATE_CLOSED)); | ||
531 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, | ||
532 | SCTP_NULL()); | ||
533 | return ret; | ||
534 | } | 519 | } |
520 | return sctp_stop_t1_and_abort(commands, error, ECONNREFUSED, | ||
521 | asoc, chunk->transport); | ||
535 | } | 522 | } |
536 | 523 | ||
537 | /* Tag the variable length parameters. Note that we never | 524 | /* Tag the variable length parameters. Note that we never |
@@ -886,6 +873,8 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep, | |||
886 | struct sctp_transport *transport = (struct sctp_transport *) arg; | 873 | struct sctp_transport *transport = (struct sctp_transport *) arg; |
887 | 874 | ||
888 | if (asoc->overall_error_count >= asoc->max_retrans) { | 875 | if (asoc->overall_error_count >= asoc->max_retrans) { |
876 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
877 | SCTP_ERROR(ETIMEDOUT)); | ||
889 | /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ | 878 | /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ |
890 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 879 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
891 | SCTP_U32(SCTP_ERROR_NO_ERROR)); | 880 | SCTP_U32(SCTP_ERROR_NO_ERROR)); |
@@ -1030,6 +1019,12 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep, | |||
1030 | commands); | 1019 | commands); |
1031 | 1020 | ||
1032 | hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data; | 1021 | hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data; |
1022 | /* Make sure that the length of the parameter is what we expect */ | ||
1023 | if (ntohs(hbinfo->param_hdr.length) != | ||
1024 | sizeof(sctp_sender_hb_info_t)) { | ||
1025 | return SCTP_DISPOSITION_DISCARD; | ||
1026 | } | ||
1027 | |||
1033 | from_addr = hbinfo->daddr; | 1028 | from_addr = hbinfo->daddr; |
1034 | link = sctp_assoc_lookup_paddr(asoc, &from_addr); | 1029 | link = sctp_assoc_lookup_paddr(asoc, &from_addr); |
1035 | 1030 | ||
@@ -2126,6 +2121,8 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep, | |||
2126 | int attempts = asoc->init_err_counter + 1; | 2121 | int attempts = asoc->init_err_counter + 1; |
2127 | 2122 | ||
2128 | if (attempts > asoc->max_init_attempts) { | 2123 | if (attempts > asoc->max_init_attempts) { |
2124 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
2125 | SCTP_ERROR(ETIMEDOUT)); | ||
2129 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, | 2126 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, |
2130 | SCTP_U32(SCTP_ERROR_STALE_COOKIE)); | 2127 | SCTP_U32(SCTP_ERROR_STALE_COOKIE)); |
2131 | return SCTP_DISPOSITION_DELETE_TCB; | 2128 | return SCTP_DISPOSITION_DELETE_TCB; |
@@ -2262,6 +2259,7 @@ sctp_disposition_t sctp_sf_do_9_1_abort(const struct sctp_endpoint *ep, | |||
2262 | if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) | 2259 | if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) |
2263 | error = ((sctp_errhdr_t *)chunk->skb->data)->cause; | 2260 | error = ((sctp_errhdr_t *)chunk->skb->data)->cause; |
2264 | 2261 | ||
2262 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET)); | ||
2265 | /* ASSOC_FAILED will DELETE_TCB. */ | 2263 | /* ASSOC_FAILED will DELETE_TCB. */ |
2266 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_U32(error)); | 2264 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_U32(error)); |
2267 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); | 2265 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); |
@@ -2306,7 +2304,8 @@ sctp_disposition_t sctp_sf_cookie_wait_abort(const struct sctp_endpoint *ep, | |||
2306 | if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) | 2304 | if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) |
2307 | error = ((sctp_errhdr_t *)chunk->skb->data)->cause; | 2305 | error = ((sctp_errhdr_t *)chunk->skb->data)->cause; |
2308 | 2306 | ||
2309 | return sctp_stop_t1_and_abort(commands, error, asoc, chunk->transport); | 2307 | return sctp_stop_t1_and_abort(commands, error, ECONNREFUSED, asoc, |
2308 | chunk->transport); | ||
2310 | } | 2309 | } |
2311 | 2310 | ||
2312 | /* | 2311 | /* |
@@ -2318,7 +2317,8 @@ sctp_disposition_t sctp_sf_cookie_wait_icmp_abort(const struct sctp_endpoint *ep | |||
2318 | void *arg, | 2317 | void *arg, |
2319 | sctp_cmd_seq_t *commands) | 2318 | sctp_cmd_seq_t *commands) |
2320 | { | 2319 | { |
2321 | return sctp_stop_t1_and_abort(commands, SCTP_ERROR_NO_ERROR, asoc, | 2320 | return sctp_stop_t1_and_abort(commands, SCTP_ERROR_NO_ERROR, |
2321 | ENOPROTOOPT, asoc, | ||
2322 | (struct sctp_transport *)arg); | 2322 | (struct sctp_transport *)arg); |
2323 | } | 2323 | } |
2324 | 2324 | ||
@@ -2343,7 +2343,7 @@ sctp_disposition_t sctp_sf_cookie_echoed_abort(const struct sctp_endpoint *ep, | |||
2343 | * This is common code called by several sctp_sf_*_abort() functions above. | 2343 | * This is common code called by several sctp_sf_*_abort() functions above. |
2344 | */ | 2344 | */ |
2345 | static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, | 2345 | static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, |
2346 | __u16 error, | 2346 | __u16 error, int sk_err, |
2347 | const struct sctp_association *asoc, | 2347 | const struct sctp_association *asoc, |
2348 | struct sctp_transport *transport) | 2348 | struct sctp_transport *transport) |
2349 | { | 2349 | { |
@@ -2353,6 +2353,7 @@ static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, | |||
2353 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); | 2353 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); |
2354 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 2354 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
2355 | SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); | 2355 | SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); |
2356 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(sk_err)); | ||
2356 | /* CMD_INIT_FAILED will DELETE_TCB. */ | 2357 | /* CMD_INIT_FAILED will DELETE_TCB. */ |
2357 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, | 2358 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, |
2358 | SCTP_U32(error)); | 2359 | SCTP_U32(error)); |
@@ -3336,6 +3337,8 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep, | |||
3336 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 3337 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
3337 | SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); | 3338 | SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); |
3338 | sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); | 3339 | sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); |
3340 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
3341 | SCTP_ERROR(ECONNABORTED)); | ||
3339 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 3342 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
3340 | SCTP_U32(SCTP_ERROR_ASCONF_ACK)); | 3343 | SCTP_U32(SCTP_ERROR_ASCONF_ACK)); |
3341 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); | 3344 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); |
@@ -3362,6 +3365,8 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep, | |||
3362 | * processing the rest of the chunks in the packet. | 3365 | * processing the rest of the chunks in the packet. |
3363 | */ | 3366 | */ |
3364 | sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); | 3367 | sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); |
3368 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
3369 | SCTP_ERROR(ECONNABORTED)); | ||
3365 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 3370 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
3366 | SCTP_U32(SCTP_ERROR_ASCONF_ACK)); | 3371 | SCTP_U32(SCTP_ERROR_ASCONF_ACK)); |
3367 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); | 3372 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); |
@@ -3714,9 +3719,13 @@ static sctp_disposition_t sctp_sf_violation_chunklen( | |||
3714 | if (asoc->state <= SCTP_STATE_COOKIE_ECHOED) { | 3719 | if (asoc->state <= SCTP_STATE_COOKIE_ECHOED) { |
3715 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 3720 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
3716 | SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); | 3721 | SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); |
3722 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
3723 | SCTP_ERROR(ECONNREFUSED)); | ||
3717 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, | 3724 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, |
3718 | SCTP_U32(SCTP_ERROR_PROTO_VIOLATION)); | 3725 | SCTP_U32(SCTP_ERROR_PROTO_VIOLATION)); |
3719 | } else { | 3726 | } else { |
3727 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
3728 | SCTP_ERROR(ECONNABORTED)); | ||
3720 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 3729 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
3721 | SCTP_U32(SCTP_ERROR_PROTO_VIOLATION)); | 3730 | SCTP_U32(SCTP_ERROR_PROTO_VIOLATION)); |
3722 | SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); | 3731 | SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); |
@@ -4034,6 +4043,8 @@ sctp_disposition_t sctp_sf_do_9_1_prm_abort( | |||
4034 | * TCB. This is a departure from our typical NOMEM handling. | 4043 | * TCB. This is a departure from our typical NOMEM handling. |
4035 | */ | 4044 | */ |
4036 | 4045 | ||
4046 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
4047 | SCTP_ERROR(ECONNABORTED)); | ||
4037 | /* Delete the established association. */ | 4048 | /* Delete the established association. */ |
4038 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 4049 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
4039 | SCTP_U32(SCTP_ERROR_USER_ABORT)); | 4050 | SCTP_U32(SCTP_ERROR_USER_ABORT)); |
@@ -4175,6 +4186,8 @@ sctp_disposition_t sctp_sf_cookie_wait_prm_abort( | |||
4175 | * TCB. This is a departure from our typical NOMEM handling. | 4186 | * TCB. This is a departure from our typical NOMEM handling. |
4176 | */ | 4187 | */ |
4177 | 4188 | ||
4189 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
4190 | SCTP_ERROR(ECONNREFUSED)); | ||
4178 | /* Delete the established association. */ | 4191 | /* Delete the established association. */ |
4179 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, | 4192 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, |
4180 | SCTP_U32(SCTP_ERROR_USER_ABORT)); | 4193 | SCTP_U32(SCTP_ERROR_USER_ABORT)); |
@@ -4543,6 +4556,8 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const struct sctp_endpoint *ep, | |||
4543 | struct sctp_transport *transport = arg; | 4556 | struct sctp_transport *transport = arg; |
4544 | 4557 | ||
4545 | if (asoc->overall_error_count >= asoc->max_retrans) { | 4558 | if (asoc->overall_error_count >= asoc->max_retrans) { |
4559 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
4560 | SCTP_ERROR(ETIMEDOUT)); | ||
4546 | /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ | 4561 | /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ |
4547 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 4562 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
4548 | SCTP_U32(SCTP_ERROR_NO_ERROR)); | 4563 | SCTP_U32(SCTP_ERROR_NO_ERROR)); |
@@ -4662,6 +4677,8 @@ sctp_disposition_t sctp_sf_t1_init_timer_expire(const struct sctp_endpoint *ep, | |||
4662 | SCTP_DEBUG_PRINTK("Giving up on INIT, attempts: %d" | 4677 | SCTP_DEBUG_PRINTK("Giving up on INIT, attempts: %d" |
4663 | " max_init_attempts: %d\n", | 4678 | " max_init_attempts: %d\n", |
4664 | attempts, asoc->max_init_attempts); | 4679 | attempts, asoc->max_init_attempts); |
4680 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
4681 | SCTP_ERROR(ETIMEDOUT)); | ||
4665 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, | 4682 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, |
4666 | SCTP_U32(SCTP_ERROR_NO_ERROR)); | 4683 | SCTP_U32(SCTP_ERROR_NO_ERROR)); |
4667 | return SCTP_DISPOSITION_DELETE_TCB; | 4684 | return SCTP_DISPOSITION_DELETE_TCB; |
@@ -4711,6 +4728,8 @@ sctp_disposition_t sctp_sf_t1_cookie_timer_expire(const struct sctp_endpoint *ep | |||
4711 | 4728 | ||
4712 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | 4729 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); |
4713 | } else { | 4730 | } else { |
4731 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
4732 | SCTP_ERROR(ETIMEDOUT)); | ||
4714 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, | 4733 | sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, |
4715 | SCTP_U32(SCTP_ERROR_NO_ERROR)); | 4734 | SCTP_U32(SCTP_ERROR_NO_ERROR)); |
4716 | return SCTP_DISPOSITION_DELETE_TCB; | 4735 | return SCTP_DISPOSITION_DELETE_TCB; |
@@ -4742,6 +4761,8 @@ sctp_disposition_t sctp_sf_t2_timer_expire(const struct sctp_endpoint *ep, | |||
4742 | 4761 | ||
4743 | SCTP_DEBUG_PRINTK("Timer T2 expired.\n"); | 4762 | SCTP_DEBUG_PRINTK("Timer T2 expired.\n"); |
4744 | if (asoc->overall_error_count >= asoc->max_retrans) { | 4763 | if (asoc->overall_error_count >= asoc->max_retrans) { |
4764 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
4765 | SCTP_ERROR(ETIMEDOUT)); | ||
4745 | /* Note: CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ | 4766 | /* Note: CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ |
4746 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 4767 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
4747 | SCTP_U32(SCTP_ERROR_NO_ERROR)); | 4768 | SCTP_U32(SCTP_ERROR_NO_ERROR)); |
@@ -4817,6 +4838,8 @@ sctp_disposition_t sctp_sf_t4_timer_expire( | |||
4817 | if (asoc->overall_error_count >= asoc->max_retrans) { | 4838 | if (asoc->overall_error_count >= asoc->max_retrans) { |
4818 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 4839 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
4819 | SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); | 4840 | SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); |
4841 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
4842 | SCTP_ERROR(ETIMEDOUT)); | ||
4820 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 4843 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
4821 | SCTP_U32(SCTP_ERROR_NO_ERROR)); | 4844 | SCTP_U32(SCTP_ERROR_NO_ERROR)); |
4822 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); | 4845 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); |
@@ -4870,6 +4893,8 @@ sctp_disposition_t sctp_sf_t5_timer_expire(const struct sctp_endpoint *ep, | |||
4870 | goto nomem; | 4893 | goto nomem; |
4871 | 4894 | ||
4872 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); | 4895 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); |
4896 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
4897 | SCTP_ERROR(ETIMEDOUT)); | ||
4873 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 4898 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
4874 | SCTP_U32(SCTP_ERROR_NO_ERROR)); | 4899 | SCTP_U32(SCTP_ERROR_NO_ERROR)); |
4875 | 4900 | ||
@@ -5309,6 +5334,8 @@ static int sctp_eat_data(const struct sctp_association *asoc, | |||
5309 | * processing the rest of the chunks in the packet. | 5334 | * processing the rest of the chunks in the packet. |
5310 | */ | 5335 | */ |
5311 | sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); | 5336 | sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); |
5337 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | ||
5338 | SCTP_ERROR(ECONNABORTED)); | ||
5312 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, | 5339 | sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, |
5313 | SCTP_U32(SCTP_ERROR_NO_DATA)); | 5340 | SCTP_U32(SCTP_ERROR_NO_DATA)); |
5314 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); | 5341 | SCTP_INC_STATS(SCTP_MIB_ABORTEDS); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index b6e4b89539b3..174d4d35e951 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -1057,6 +1057,7 @@ static int __sctp_connect(struct sock* sk, | |||
1057 | inet_sk(sk)->dport = htons(asoc->peer.port); | 1057 | inet_sk(sk)->dport = htons(asoc->peer.port); |
1058 | af = sctp_get_af_specific(to.sa.sa_family); | 1058 | af = sctp_get_af_specific(to.sa.sa_family); |
1059 | af->to_sk_daddr(&to, sk); | 1059 | af->to_sk_daddr(&to, sk); |
1060 | sk->sk_err = 0; | ||
1060 | 1061 | ||
1061 | timeo = sock_sndtimeo(sk, sk->sk_socket->file->f_flags & O_NONBLOCK); | 1062 | timeo = sock_sndtimeo(sk, sk->sk_socket->file->f_flags & O_NONBLOCK); |
1062 | err = sctp_wait_for_connect(asoc, &timeo); | 1063 | err = sctp_wait_for_connect(asoc, &timeo); |
@@ -1228,7 +1229,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout) | |||
1228 | 1229 | ||
1229 | ep = sctp_sk(sk)->ep; | 1230 | ep = sctp_sk(sk)->ep; |
1230 | 1231 | ||
1231 | /* Walk all associations on a socket, not on an endpoint. */ | 1232 | /* Walk all associations on an endpoint. */ |
1232 | list_for_each_safe(pos, temp, &ep->asocs) { | 1233 | list_for_each_safe(pos, temp, &ep->asocs) { |
1233 | asoc = list_entry(pos, struct sctp_association, asocs); | 1234 | asoc = list_entry(pos, struct sctp_association, asocs); |
1234 | 1235 | ||
@@ -1241,13 +1242,13 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout) | |||
1241 | if (sctp_state(asoc, CLOSED)) { | 1242 | if (sctp_state(asoc, CLOSED)) { |
1242 | sctp_unhash_established(asoc); | 1243 | sctp_unhash_established(asoc); |
1243 | sctp_association_free(asoc); | 1244 | sctp_association_free(asoc); |
1245 | continue; | ||
1246 | } | ||
1247 | } | ||
1244 | 1248 | ||
1245 | } else if (sock_flag(sk, SOCK_LINGER) && | 1249 | if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) |
1246 | !sk->sk_lingertime) | 1250 | sctp_primitive_ABORT(asoc, NULL); |
1247 | sctp_primitive_ABORT(asoc, NULL); | 1251 | else |
1248 | else | ||
1249 | sctp_primitive_SHUTDOWN(asoc, NULL); | ||
1250 | } else | ||
1251 | sctp_primitive_SHUTDOWN(asoc, NULL); | 1252 | sctp_primitive_SHUTDOWN(asoc, NULL); |
1252 | } | 1253 | } |
1253 | 1254 | ||
@@ -5317,6 +5318,7 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, | |||
5317 | */ | 5318 | */ |
5318 | sctp_release_sock(sk); | 5319 | sctp_release_sock(sk); |
5319 | current_timeo = schedule_timeout(current_timeo); | 5320 | current_timeo = schedule_timeout(current_timeo); |
5321 | BUG_ON(sk != asoc->base.sk); | ||
5320 | sctp_lock_sock(sk); | 5322 | sctp_lock_sock(sk); |
5321 | 5323 | ||
5322 | *timeo_p = current_timeo; | 5324 | *timeo_p = current_timeo; |
@@ -5604,12 +5606,14 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
5604 | */ | 5606 | */ |
5605 | newsp->type = type; | 5607 | newsp->type = type; |
5606 | 5608 | ||
5607 | spin_lock_bh(&oldsk->sk_lock.slock); | 5609 | /* Mark the new socket "in-use" by the user so that any packets |
5608 | /* Migrate the backlog from oldsk to newsk. */ | 5610 | * that may arrive on the association after we've moved it are |
5609 | sctp_backlog_migrate(assoc, oldsk, newsk); | 5611 | * queued to the backlog. This prevents a potential race between |
5610 | /* Migrate the association to the new socket. */ | 5612 | * backlog processing on the old socket and new-packet processing |
5613 | * on the new socket. | ||
5614 | */ | ||
5615 | sctp_lock_sock(newsk); | ||
5611 | sctp_assoc_migrate(assoc, newsk); | 5616 | sctp_assoc_migrate(assoc, newsk); |
5612 | spin_unlock_bh(&oldsk->sk_lock.slock); | ||
5613 | 5617 | ||
5614 | /* If the association on the newsk is already closed before accept() | 5618 | /* If the association on the newsk is already closed before accept() |
5615 | * is called, set RCV_SHUTDOWN flag. | 5619 | * is called, set RCV_SHUTDOWN flag. |
@@ -5618,6 +5622,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
5618 | newsk->sk_shutdown |= RCV_SHUTDOWN; | 5622 | newsk->sk_shutdown |= RCV_SHUTDOWN; |
5619 | 5623 | ||
5620 | newsk->sk_state = SCTP_SS_ESTABLISHED; | 5624 | newsk->sk_state = SCTP_SS_ESTABLISHED; |
5625 | sctp_release_sock(newsk); | ||
5621 | } | 5626 | } |
5622 | 5627 | ||
5623 | /* This proto struct describes the ULP interface for SCTP. */ | 5628 | /* This proto struct describes the ULP interface for SCTP. */ |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 3ac4193a78ed..7026b0866b7b 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -159,6 +159,7 @@ struct cache_head *sunrpc_cache_update(struct cache_detail *detail, | |||
159 | detail->update(tmp, new); | 159 | detail->update(tmp, new); |
160 | tmp->next = *head; | 160 | tmp->next = *head; |
161 | *head = tmp; | 161 | *head = tmp; |
162 | detail->entries++; | ||
162 | cache_get(tmp); | 163 | cache_get(tmp); |
163 | is_new = cache_fresh_locked(tmp, new->expiry_time); | 164 | is_new = cache_fresh_locked(tmp, new->expiry_time); |
164 | cache_fresh_locked(old, 0); | 165 | cache_fresh_locked(old, 0); |
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index 55538f6b60ff..58a1b6b42ddd 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -37,14 +37,6 @@ struct ctl_table net_table[] = { | |||
37 | .mode = 0555, | 37 | .mode = 0555, |
38 | .child = core_table, | 38 | .child = core_table, |
39 | }, | 39 | }, |
40 | #ifdef CONFIG_NET | ||
41 | { | ||
42 | .ctl_name = NET_ETHER, | ||
43 | .procname = "ethernet", | ||
44 | .mode = 0555, | ||
45 | .child = ether_table, | ||
46 | }, | ||
47 | #endif | ||
48 | #ifdef CONFIG_INET | 40 | #ifdef CONFIG_INET |
49 | { | 41 | { |
50 | .ctl_name = NET_IPV4, | 42 | .ctl_name = NET_IPV4, |
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index b54971059f16..891a6090cc09 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
@@ -62,7 +62,7 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq) | |||
62 | case IPPROTO_COMP: | 62 | case IPPROTO_COMP: |
63 | if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr))) | 63 | if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr))) |
64 | return -EINVAL; | 64 | return -EINVAL; |
65 | *spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2))); | 65 | *spi = htonl(ntohs(*(u16*)(skb->h.raw + 2))); |
66 | *seq = 0; | 66 | *seq = 0; |
67 | return 0; | 67 | return 0; |
68 | default: | 68 | default: |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 6d04504b2fc1..d0f86ed43f7a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -697,29 +697,79 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
697 | 697 | ||
698 | /* Walk through all sections */ | 698 | /* Walk through all sections */ |
699 | for (i = 0; i < hdr->e_shnum; i++) { | 699 | for (i = 0; i < hdr->e_shnum; i++) { |
700 | Elf_Rela *rela; | 700 | const char *name = secstrings + sechdrs[i].sh_name; |
701 | Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset; | 701 | const char *secname; |
702 | Elf_Rela *stop = (void*)start + sechdrs[i].sh_size; | 702 | Elf_Rela r; |
703 | const char *name = secstrings + sechdrs[i].sh_name + | 703 | unsigned int r_sym; |
704 | strlen(".rela"); | ||
705 | /* We want to process only relocation sections and not .init */ | 704 | /* We want to process only relocation sections and not .init */ |
706 | if (section_ref_ok(name) || (sechdrs[i].sh_type != SHT_RELA)) | 705 | if (sechdrs[i].sh_type == SHT_RELA) { |
707 | continue; | 706 | Elf_Rela *rela; |
707 | Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset; | ||
708 | Elf_Rela *stop = (void*)start + sechdrs[i].sh_size; | ||
709 | name += strlen(".rela"); | ||
710 | if (section_ref_ok(name)) | ||
711 | continue; | ||
708 | 712 | ||
709 | for (rela = start; rela < stop; rela++) { | 713 | for (rela = start; rela < stop; rela++) { |
710 | Elf_Rela r; | 714 | r.r_offset = TO_NATIVE(rela->r_offset); |
711 | const char *secname; | 715 | #if KERNEL_ELFCLASS == ELFCLASS64 |
712 | r.r_offset = TO_NATIVE(rela->r_offset); | 716 | if (hdr->e_machine == EM_MIPS) { |
713 | r.r_info = TO_NATIVE(rela->r_info); | 717 | r_sym = ELF64_MIPS_R_SYM(rela->r_info); |
714 | r.r_addend = TO_NATIVE(rela->r_addend); | 718 | r_sym = TO_NATIVE(r_sym); |
715 | sym = elf->symtab_start + ELF_R_SYM(r.r_info); | 719 | } else { |
716 | /* Skip special sections */ | 720 | r.r_info = TO_NATIVE(rela->r_info); |
717 | if (sym->st_shndx >= SHN_LORESERVE) | 721 | r_sym = ELF_R_SYM(r.r_info); |
722 | } | ||
723 | #else | ||
724 | r.r_info = TO_NATIVE(rela->r_info); | ||
725 | r_sym = ELF_R_SYM(r.r_info); | ||
726 | #endif | ||
727 | r.r_addend = TO_NATIVE(rela->r_addend); | ||
728 | sym = elf->symtab_start + r_sym; | ||
729 | /* Skip special sections */ | ||
730 | if (sym->st_shndx >= SHN_LORESERVE) | ||
731 | continue; | ||
732 | |||
733 | secname = secstrings + | ||
734 | sechdrs[sym->st_shndx].sh_name; | ||
735 | if (section(secname)) | ||
736 | warn_sec_mismatch(modname, name, | ||
737 | elf, sym, r); | ||
738 | } | ||
739 | } else if (sechdrs[i].sh_type == SHT_REL) { | ||
740 | Elf_Rel *rel; | ||
741 | Elf_Rel *start = (void *)hdr + sechdrs[i].sh_offset; | ||
742 | Elf_Rel *stop = (void*)start + sechdrs[i].sh_size; | ||
743 | name += strlen(".rel"); | ||
744 | if (section_ref_ok(name)) | ||
718 | continue; | 745 | continue; |
719 | 746 | ||
720 | secname = secstrings + sechdrs[sym->st_shndx].sh_name; | 747 | for (rel = start; rel < stop; rel++) { |
721 | if (section(secname)) | 748 | r.r_offset = TO_NATIVE(rel->r_offset); |
722 | warn_sec_mismatch(modname, name, elf, sym, r); | 749 | #if KERNEL_ELFCLASS == ELFCLASS64 |
750 | if (hdr->e_machine == EM_MIPS) { | ||
751 | r_sym = ELF64_MIPS_R_SYM(rel->r_info); | ||
752 | r_sym = TO_NATIVE(r_sym); | ||
753 | } else { | ||
754 | r.r_info = TO_NATIVE(rel->r_info); | ||
755 | r_sym = ELF_R_SYM(r.r_info); | ||
756 | } | ||
757 | #else | ||
758 | r.r_info = TO_NATIVE(rel->r_info); | ||
759 | r_sym = ELF_R_SYM(r.r_info); | ||
760 | #endif | ||
761 | r.r_addend = 0; | ||
762 | sym = elf->symtab_start + r_sym; | ||
763 | /* Skip special sections */ | ||
764 | if (sym->st_shndx >= SHN_LORESERVE) | ||
765 | continue; | ||
766 | |||
767 | secname = secstrings + | ||
768 | sechdrs[sym->st_shndx].sh_name; | ||
769 | if (section(secname)) | ||
770 | warn_sec_mismatch(modname, name, | ||
771 | elf, sym, r); | ||
772 | } | ||
723 | } | 773 | } |
724 | } | 774 | } |
725 | } | 775 | } |
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index b14255c72a37..861d866fcd83 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define ELF_ST_BIND ELF32_ST_BIND | 21 | #define ELF_ST_BIND ELF32_ST_BIND |
22 | #define ELF_ST_TYPE ELF32_ST_TYPE | 22 | #define ELF_ST_TYPE ELF32_ST_TYPE |
23 | 23 | ||
24 | #define Elf_Rel Elf32_Rel | ||
24 | #define Elf_Rela Elf32_Rela | 25 | #define Elf_Rela Elf32_Rela |
25 | #define ELF_R_SYM ELF32_R_SYM | 26 | #define ELF_R_SYM ELF32_R_SYM |
26 | #define ELF_R_TYPE ELF32_R_TYPE | 27 | #define ELF_R_TYPE ELF32_R_TYPE |
@@ -34,11 +35,31 @@ | |||
34 | #define ELF_ST_BIND ELF64_ST_BIND | 35 | #define ELF_ST_BIND ELF64_ST_BIND |
35 | #define ELF_ST_TYPE ELF64_ST_TYPE | 36 | #define ELF_ST_TYPE ELF64_ST_TYPE |
36 | 37 | ||
38 | #define Elf_Rel Elf64_Rel | ||
37 | #define Elf_Rela Elf64_Rela | 39 | #define Elf_Rela Elf64_Rela |
38 | #define ELF_R_SYM ELF64_R_SYM | 40 | #define ELF_R_SYM ELF64_R_SYM |
39 | #define ELF_R_TYPE ELF64_R_TYPE | 41 | #define ELF_R_TYPE ELF64_R_TYPE |
40 | #endif | 42 | #endif |
41 | 43 | ||
44 | /* The 64-bit MIPS ELF ABI uses an unusual reloc format. */ | ||
45 | typedef struct | ||
46 | { | ||
47 | Elf32_Word r_sym; /* Symbol index */ | ||
48 | unsigned char r_ssym; /* Special symbol for 2nd relocation */ | ||
49 | unsigned char r_type3; /* 3rd relocation type */ | ||
50 | unsigned char r_type2; /* 2nd relocation type */ | ||
51 | unsigned char r_type1; /* 1st relocation type */ | ||
52 | } _Elf64_Mips_R_Info; | ||
53 | |||
54 | typedef union | ||
55 | { | ||
56 | Elf64_Xword r_info_number; | ||
57 | _Elf64_Mips_R_Info r_info_fields; | ||
58 | } _Elf64_Mips_R_Info_union; | ||
59 | |||
60 | #define ELF64_MIPS_R_SYM(i) \ | ||
61 | ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym) | ||
62 | |||
42 | #if KERNEL_ELFDATA != HOST_ELFDATA | 63 | #if KERNEL_ELFDATA != HOST_ELFDATA |
43 | 64 | ||
44 | static inline void __endian(const void *src, void *dest, unsigned int size) | 65 | static inline void __endian(const void *src, void *dest, unsigned int size) |
@@ -48,8 +69,6 @@ static inline void __endian(const void *src, void *dest, unsigned int size) | |||
48 | ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1]; | 69 | ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1]; |
49 | } | 70 | } |
50 | 71 | ||
51 | |||
52 | |||
53 | #define TO_NATIVE(x) \ | 72 | #define TO_NATIVE(x) \ |
54 | ({ \ | 73 | ({ \ |
55 | typeof(x) __x; \ | 74 | typeof(x) __x; \ |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index d987048d3f33..90b4cdc0c948 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -3231,7 +3231,7 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
3231 | goto out; | 3231 | goto out; |
3232 | 3232 | ||
3233 | /* Handle mapped IPv4 packets arriving via IPv6 sockets */ | 3233 | /* Handle mapped IPv4 packets arriving via IPv6 sockets */ |
3234 | if (family == PF_INET6 && skb->protocol == ntohs(ETH_P_IP)) | 3234 | if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP)) |
3235 | family = PF_INET; | 3235 | family = PF_INET; |
3236 | 3236 | ||
3237 | read_lock_bh(&sk->sk_callback_lock); | 3237 | read_lock_bh(&sk->sk_callback_lock); |
@@ -4422,6 +4422,7 @@ void selinux_complete_init(void) | |||
4422 | 4422 | ||
4423 | /* Set up any superblocks initialized prior to the policy load. */ | 4423 | /* Set up any superblocks initialized prior to the policy load. */ |
4424 | printk(KERN_INFO "SELinux: Setting up existing superblocks.\n"); | 4424 | printk(KERN_INFO "SELinux: Setting up existing superblocks.\n"); |
4425 | spin_lock(&sb_lock); | ||
4425 | spin_lock(&sb_security_lock); | 4426 | spin_lock(&sb_security_lock); |
4426 | next_sb: | 4427 | next_sb: |
4427 | if (!list_empty(&superblock_security_head)) { | 4428 | if (!list_empty(&superblock_security_head)) { |
@@ -4430,19 +4431,20 @@ next_sb: | |||
4430 | struct superblock_security_struct, | 4431 | struct superblock_security_struct, |
4431 | list); | 4432 | list); |
4432 | struct super_block *sb = sbsec->sb; | 4433 | struct super_block *sb = sbsec->sb; |
4433 | spin_lock(&sb_lock); | ||
4434 | sb->s_count++; | 4434 | sb->s_count++; |
4435 | spin_unlock(&sb_lock); | ||
4436 | spin_unlock(&sb_security_lock); | 4435 | spin_unlock(&sb_security_lock); |
4436 | spin_unlock(&sb_lock); | ||
4437 | down_read(&sb->s_umount); | 4437 | down_read(&sb->s_umount); |
4438 | if (sb->s_root) | 4438 | if (sb->s_root) |
4439 | superblock_doinit(sb, NULL); | 4439 | superblock_doinit(sb, NULL); |
4440 | drop_super(sb); | 4440 | drop_super(sb); |
4441 | spin_lock(&sb_lock); | ||
4441 | spin_lock(&sb_security_lock); | 4442 | spin_lock(&sb_security_lock); |
4442 | list_del_init(&sbsec->list); | 4443 | list_del_init(&sbsec->list); |
4443 | goto next_sb; | 4444 | goto next_sb; |
4444 | } | 4445 | } |
4445 | spin_unlock(&sb_security_lock); | 4446 | spin_unlock(&sb_security_lock); |
4447 | spin_unlock(&sb_lock); | ||
4446 | } | 4448 | } |
4447 | 4449 | ||
4448 | /* SELinux requires early initialization in order to label | 4450 | /* SELinux requires early initialization in order to label |
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 7177e98df7f3..c284dbb8b8c0 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -594,6 +594,10 @@ int security_sid_to_context(u32 sid, char **scontext, u32 *scontext_len) | |||
594 | 594 | ||
595 | *scontext_len = strlen(initial_sid_to_string[sid]) + 1; | 595 | *scontext_len = strlen(initial_sid_to_string[sid]) + 1; |
596 | scontextp = kmalloc(*scontext_len,GFP_ATOMIC); | 596 | scontextp = kmalloc(*scontext_len,GFP_ATOMIC); |
597 | if (!scontextp) { | ||
598 | rc = -ENOMEM; | ||
599 | goto out; | ||
600 | } | ||
597 | strcpy(scontextp, initial_sid_to_string[sid]); | 601 | strcpy(scontextp, initial_sid_to_string[sid]); |
598 | *scontext = scontextp; | 602 | *scontext = scontextp; |
599 | goto out; | 603 | goto out; |
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index da7ef26995c3..77b06009735d 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c | |||
@@ -151,7 +151,7 @@ static struct pnp_device_id snd_mpu401_pnpids[] = { | |||
151 | 151 | ||
152 | MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids); | 152 | MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids); |
153 | 153 | ||
154 | static int __init snd_mpu401_pnp(int dev, struct pnp_dev *device, | 154 | static int __devinit snd_mpu401_pnp(int dev, struct pnp_dev *device, |
155 | const struct pnp_device_id *id) | 155 | const struct pnp_device_id *id) |
156 | { | 156 | { |
157 | if (!pnp_port_valid(device, 0) || | 157 | if (!pnp_port_valid(device, 0) || |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index a36ec1daa5cb..e6945db8ed1b 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -85,6 +85,8 @@ | |||
85 | #include <linux/pnp.h> | 85 | #include <linux/pnp.h> |
86 | #include <linux/isapnp.h> | 86 | #include <linux/isapnp.h> |
87 | #include <linux/moduleparam.h> | 87 | #include <linux/moduleparam.h> |
88 | #include <linux/delay.h> | ||
89 | |||
88 | #include <asm/io.h> | 90 | #include <asm/io.h> |
89 | #include <asm/dma.h> | 91 | #include <asm/dma.h> |
90 | #include <sound/core.h> | 92 | #include <sound/core.h> |
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 49796be955f3..e04fa49b0dc8 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c | |||
@@ -2026,7 +2026,8 @@ int ad1848_init (char *name, struct resource *ports, int irq, int dma_playback, | |||
2026 | if (irq > 0) | 2026 | if (irq > 0) |
2027 | { | 2027 | { |
2028 | devc->dev_no = my_dev; | 2028 | devc->dev_no = my_dev; |
2029 | if (request_irq(devc->irq, adintr, 0, devc->name, (void *)my_dev) < 0) | 2029 | if (request_irq(devc->irq, adintr, 0, devc->name, |
2030 | (void *)(long)my_dev) < 0) | ||
2030 | { | 2031 | { |
2031 | printk(KERN_WARNING "ad1848: Unable to allocate IRQ\n"); | 2032 | printk(KERN_WARNING "ad1848: Unable to allocate IRQ\n"); |
2032 | /* Don't free it either then.. */ | 2033 | /* Don't free it either then.. */ |
@@ -2175,7 +2176,7 @@ void ad1848_unload(int io_base, int irq, int dma_playback, int dma_capture, int | |||
2175 | if (!share_dma) | 2176 | if (!share_dma) |
2176 | { | 2177 | { |
2177 | if (devc->irq > 0) /* There is no point in freeing irq, if it wasn't allocated */ | 2178 | if (devc->irq > 0) /* There is no point in freeing irq, if it wasn't allocated */ |
2178 | free_irq(devc->irq, (void *)devc->dev_no); | 2179 | free_irq(devc->irq, (void *)(long)devc->dev_no); |
2179 | 2180 | ||
2180 | sound_free_dma(dma_playback); | 2181 | sound_free_dma(dma_playback); |
2181 | 2182 | ||
@@ -2204,7 +2205,7 @@ irqreturn_t adintr(int irq, void *dev_id, struct pt_regs *dummy) | |||
2204 | unsigned char c930_stat = 0; | 2205 | unsigned char c930_stat = 0; |
2205 | int cnt = 0; | 2206 | int cnt = 0; |
2206 | 2207 | ||
2207 | dev = (int)dev_id; | 2208 | dev = (long)dev_id; |
2208 | devc = (ad1848_info *) audio_devs[dev]->devc; | 2209 | devc = (ad1848_info *) audio_devs[dev]->devc; |
2209 | 2210 | ||
2210 | interrupt_again: /* Jump back here if int status doesn't reset */ | 2211 | interrupt_again: /* Jump back here if int status doesn't reset */ |
@@ -2900,7 +2901,8 @@ static struct pnp_dev *activate_dev(char *devname, char *resname, struct pnp_dev | |||
2900 | return(dev); | 2901 | return(dev); |
2901 | } | 2902 | } |
2902 | 2903 | ||
2903 | static struct pnp_dev *ad1848_init_generic(struct pnp_card *bus, struct address_info *hw_config, int slot) | 2904 | static struct pnp_dev __init *ad1848_init_generic(struct pnp_card *bus, |
2905 | struct address_info *hw_config, int slot) | ||
2904 | { | 2906 | { |
2905 | 2907 | ||
2906 | /* Configure Audio device */ | 2908 | /* Configure Audio device */ |
diff --git a/sound/oss/nm256_audio.c b/sound/oss/nm256_audio.c index 7de079b202f2..6e662ac009ae 100644 --- a/sound/oss/nm256_audio.c +++ b/sound/oss/nm256_audio.c | |||
@@ -960,7 +960,7 @@ static struct ac97_mixer_value_list mixer_defaults[] = { | |||
960 | 960 | ||
961 | 961 | ||
962 | /* Installs the AC97 mixer into CARD. */ | 962 | /* Installs the AC97 mixer into CARD. */ |
963 | static int __init | 963 | static int __devinit |
964 | nm256_install_mixer (struct nm256_info *card) | 964 | nm256_install_mixer (struct nm256_info *card) |
965 | { | 965 | { |
966 | int mixer; | 966 | int mixer; |
@@ -995,7 +995,7 @@ nm256_install_mixer (struct nm256_info *card) | |||
995 | * RAM. | 995 | * RAM. |
996 | */ | 996 | */ |
997 | 997 | ||
998 | static void __init | 998 | static void __devinit |
999 | nm256_peek_for_sig (struct nm256_info *card) | 999 | nm256_peek_for_sig (struct nm256_info *card) |
1000 | { | 1000 | { |
1001 | u32 port1offset | 1001 | u32 port1offset |
@@ -1056,7 +1056,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr) | |||
1056 | card->playing = 0; | 1056 | card->playing = 0; |
1057 | card->recording = 0; | 1057 | card->recording = 0; |
1058 | card->rev = rev; | 1058 | card->rev = rev; |
1059 | spin_lock_init(&card->lock); | 1059 | spin_lock_init(&card->lock); |
1060 | 1060 | ||
1061 | /* Init the memory port info. */ | 1061 | /* Init the memory port info. */ |
1062 | for (x = 0; x < 2; x++) { | 1062 | for (x = 0; x < 2; x++) { |